diff --git a/.babelrc b/.babelrc
index cb456f1ef..fdc09d9fa 100644
--- a/.babelrc
+++ b/.babelrc
@@ -8,7 +8,7 @@
"test": {
"presets": [
[
- "babel-preset-env",
+ "@babel/preset-env",
{
"targets": {
"node": "current"
diff --git a/.browserslistrc b/.browserslistrc
new file mode 100644
index 000000000..214388fe4
--- /dev/null
+++ b/.browserslistrc
@@ -0,0 +1,3 @@
+> 1%
+last 2 versions
+not dead
diff --git a/.circleci/config.yml b/.circleci/config.yml
index c7cf2b8eb..91b7962e1 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -1,12 +1,36 @@
version: 2
jobs:
- build:
+ lint:
docker:
- - image: circleci/node:dubnium
+ - image: circleci/node:lts
steps:
- checkout
+ - restore_cache:
+ key: dependency-cache-{{ checksum "package.json" }}
- run: yarn
+ - save_cache:
+ key: dependency-cache-{{ checksum "package.json" }}
+ paths:
+ - node_modules
- run: yarn eslint
- run: yarn stylelint
+ test:
+ docker:
+ - image: circleci/node:lts
+ steps:
+ - checkout
+ - restore_cache:
+ key: dependency-cache-{{ checksum "package.json" }}
+ - run: yarn
+ - save_cache:
+ key: dependency-cache-{{ checksum "package.json" }}
+ paths:
+ - node_modules
- run: yarn test
- - run: yarn codecov
+
+workflows:
+ version: 2
+ lint-and-test:
+ jobs:
+ - lint
+ - test
diff --git a/.eslintignore b/.eslintignore
index 212d41268..5a35b1183 100644
--- a/.eslintignore
+++ b/.eslintignore
@@ -1,4 +1,4 @@
node_modules
/index.js
-!/.storybook
+.storybook/*
src/atoms/icon/templates/*
diff --git a/.gitignore b/.gitignore
index 9b3c055ba..10eb1094e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -77,3 +77,5 @@ typings/
# Project
/index.js
+/default.config.js
+dist/
diff --git a/.node-version b/.node-version
index 6695c0939..21cce914a 100644
--- a/.node-version
+++ b/.node-version
@@ -1 +1 @@
->=10.0.0 <=11.1.0
+>=12.13.0 <13.0.0
diff --git a/.storybook/addons.js b/.storybook/addons.js
deleted file mode 100644
index 1c64cfbff..000000000
--- a/.storybook/addons.js
+++ /dev/null
@@ -1,7 +0,0 @@
-import 'storybook-addon-vue-info/lib/register'
-import '@storybook/addon-knobs/register'
-import '@storybook/addon-actions/register'
-import '@storybook/addon-a11y/register'
-import '@storybook/addon-storysource/register'
-import '@storybook/addon-notes/register'
-import '@storybook/addon-viewport/register'
diff --git a/.storybook/config.js b/.storybook/config.js
deleted file mode 100644
index 61d945c20..000000000
--- a/.storybook/config.js
+++ /dev/null
@@ -1,45 +0,0 @@
-// Storybook
-import { configure, addDecorator, addParameters } from '@storybook/vue'
-
-// Polyfills
-import 'focus-visible'
-import 'svgxuse'
-
-// Addons
-import { withInfo } from 'storybook-addon-vue-info'
-import { withA11y } from '@storybook/addon-a11y'
-import { withKnobs } from '@storybook/addon-knobs'
-
-// Wrap every story in Alpaca App component
-import AApp from '../src/templates/app/App.vue'
-
-addDecorator(withInfo)
-addDecorator(withA11y)
-addDecorator(withKnobs)
-addDecorator(() => ({
- components: {
- AApp
- },
- template: `
-
Check Knobs tab to edit component properties dynamically.
Check Knobs tab to edit component properties dynamically.
+diff --git a/src/atoms/blockquote/Blockquote.js b/src/atoms/blockquote/Blockquote.js index 5e1e33d65..fc2963464 100644 --- a/src/atoms/blockquote/Blockquote.js +++ b/src/atoms/blockquote/Blockquote.js @@ -1,2 +1,20 @@ -// @vue/component -export default {} +import alpacaUIMixin from '../../../utils/helpers/alpaca-ui.js' + +export default { + mixins: [alpacaUIMixin], + config: { + base: { + blockquote: [ + 'my-2', + 'py-2', 'pl-4', 'pr-2', + 'border-l-4', 'border-solid', + 'leading-relaxed' + ] + }, + primary: { + blockquote: [ + 'border-light' + ] + } + } +} diff --git a/src/atoms/blockquote/Blockquote.scss b/src/atoms/blockquote/Blockquote.scss deleted file mode 100644 index 94c65acf0..000000000 --- a/src/atoms/blockquote/Blockquote.scss +++ /dev/null @@ -1,17 +0,0 @@ -@import '../../../assets/styles/_globals.scss'; - -$blockquote__margin : $spacer 0 !default; -$blockquote__padding : $spacer $spacer $spacer $spacer--medium !default; -$blockquote__border-left: 5px $border-style-base $gray-light !default; - -.a-blockquote { - display: block; - margin: $blockquote__margin; - padding: $blockquote__padding; - border-left: $blockquote__border-left; -} - -blockquote { - @extend .a-blockquote; -} - diff --git a/src/atoms/blockquote/Blockquote.spec.js b/src/atoms/blockquote/Blockquote.spec.js index a5e4a06fd..ddec58fe2 100644 --- a/src/atoms/blockquote/Blockquote.spec.js +++ b/src/atoms/blockquote/Blockquote.spec.js @@ -5,9 +5,7 @@ describe('Blockquote', () => { it('has default structure', () => { const wrapper = mount(ABlockquote) - expect(wrapper.is('blockquote')).toBe(true) - expect(wrapper.classes()).toContain('a-blockquote') - expect(wrapper.classes().length).toBe(1) + expect(wrapper.element.tagName).toBe('BLOCKQUOTE') }) it('renders slot text when passed', () => { @@ -17,7 +15,7 @@ describe('Blockquote', () => { } }) - expect(wrapper.find('.a-blockquote').exists()).toBe(true) - expect(wrapper.find('.a-blockquote').text()).toEqual('Blockquote content') + expect(wrapper.find('blockquote').exists()).toBe(true) + expect(wrapper.find('blockquote').text()).toEqual('Blockquote content') }) }) diff --git a/src/atoms/blockquote/Blockquote.stories.js b/src/atoms/blockquote/Blockquote.stories.js index 20fc3d9b9..28e93e685 100644 --- a/src/atoms/blockquote/Blockquote.stories.js +++ b/src/atoms/blockquote/Blockquote.stories.js @@ -1,20 +1,28 @@ -import { storiesOf } from '@storybook/vue' -import { text } from '@storybook/addon-knobs' - import ABlockquote from './Blockquote.vue' -storiesOf('Atoms/Blockquote', module) - .addParameters({ info: true }) - .add('Default', () => ({ - components: { ABlockquote }, - props: { - contentKnob: { - default: text('Blockquote content', 'Qui quis labore ad laborum laborum ipsum veniam sunt. Laboris tempor id ut commodo aute incididunt consequat esse aute irure. Et irure elit veniam proident non do commodo labore cillum irure laborum ullamco nostrud.') +export default { + title: 'Atoms/Blockquote', + component: ABlockquote, + argTypes: { + text: { + control: { + type: 'text' } - }, - template: ` -- {{ contentKnob }} - - ` - })) + } + } +} + +const Template = (args, { argTypes }) => ({ + components: { ABlockquote }, + props: Object.keys(argTypes), + template: ` ++ {{ text }} + + ` +}) + +export const Default = Template.bind({}) +Default.args = { + text: 'Qui quis labore ad laborum laborum ipsum veniam sunt. Laboris tempor id ut commodo aute incididunt consequat esse aute irure. Et irure elit veniam proident non do commodo labore cillum irure laborum ullamco nostrud.' +} diff --git a/src/atoms/blockquote/Blockquote.vue b/src/atoms/blockquote/Blockquote.vue index 412c88838..ed4d399c7 100644 --- a/src/atoms/blockquote/Blockquote.vue +++ b/src/atoms/blockquote/Blockquote.vue @@ -5,9 +5,6 @@ import ABlockquote from './Blockquote.js' export default { name: 'AlpacaBlockquote', - mixins: [ABlockquote] } - - diff --git a/src/atoms/breadcrumbs/Breadcrumbs.js b/src/atoms/breadcrumbs/Breadcrumbs.js deleted file mode 100644 index 0e3629dec..000000000 --- a/src/atoms/breadcrumbs/Breadcrumbs.js +++ /dev/null @@ -1,19 +0,0 @@ -// @vue/component -export default { - props: { - /** - * Array with breadcrumbs - */ - breadcrumbs: { - type: Array, - required: true - }, - /** - * Describes the type of navigation provided in the nav element - */ - breadcrumbsNavAriaLabel: { - type: String, - default: 'Breadcrumb' - } - } -} diff --git a/src/atoms/breadcrumbs/Breadcrumbs.scss b/src/atoms/breadcrumbs/Breadcrumbs.scss deleted file mode 100644 index 886f90550..000000000 --- a/src/atoms/breadcrumbs/Breadcrumbs.scss +++ /dev/null @@ -1,54 +0,0 @@ -@import '../../../assets/styles/globals'; - -$breadcrumbs__font-size : $font-size-small !default; - -$breadcrumbs__list-margin : 0 !default; -$breadcrumbs__list-padding : 0 !default; - -$breadcrumbs__list-item-margin : 0 0 $spacer 0 !default; - -$breadcrumbs__link-color : $black !default; -$breadcrumbs__link-color--hover : $blue !default; -$breadcrumbs__link-color--current : $blue !default; -$breadcrumbs__link-pointer-events--current: none !default; -$breadcrumbs__link-text-decoration : none !default; - -$breadcrumbs__separator-margin : 0 $spacer !default; -$breadcrumbs__separator-color : $breadcrumbs__link-color !default; - -.a-breadcrumbs { - font-size: $breadcrumbs__font-size; - - &__list { - display: flex; - flex-wrap: wrap; - margin: $breadcrumbs__list-margin; - padding: $breadcrumbs__list-padding; - list-style: none; - } - - &__list-item { - display: flex; - align-items: center; - margin: $breadcrumbs__list-item-margin; - } - - &__link { - color: $breadcrumbs__link-color; - text-decoration: $breadcrumbs__link-text-decoration; - - &:hover { - color: $breadcrumbs__link-color--hover; - } - - &--current { - color: $breadcrumbs__link-color--current; - pointer-events: $breadcrumbs__link-pointer-events--current; - } - } - - &__separator { - margin: $breadcrumbs__separator-margin; - color: $breadcrumbs__separator-color; - } -} diff --git a/src/atoms/breadcrumbs/Breadcrumbs.spec.js b/src/atoms/breadcrumbs/Breadcrumbs.spec.js deleted file mode 100644 index 6dcc2f47b..000000000 --- a/src/atoms/breadcrumbs/Breadcrumbs.spec.js +++ /dev/null @@ -1,49 +0,0 @@ -import { mount } from '@vue/test-utils' -import breadcrumbs from '../../../mocks/breadcrumbs.json' -import ABreadcrumbs from './Breadcrumbs.vue' - -describe('Breadcrumbs', () => { - it('has default structure', () => { - const itemsCount = breadcrumbs.length - const wrapper = mount(ABreadcrumbs, { - propsData: { - breadcrumbs: breadcrumbs - }, - stubs: ['router-link'] - }) - expect(wrapper.is('nav')).toBe(true) - expect(wrapper.attributes('aria-label')).toEqual('Breadcrumb') - expect(wrapper.classes()).toContain('a-breadcrumbs') - expect(wrapper.findAll('.a-breadcrumbs__separator').length).toBe(itemsCount - 1) - expect(wrapper.findAll('.a-breadcrumbs__link').length).toBe(itemsCount) - expect((wrapper.find('.a-breadcrumbs__link--current')).attributes('aria-current')).toEqual('page') - expect(wrapper.classes().length).toBe(1) - }) - - it('renders slots when passed', () => { - const previousCount = breadcrumbs.length - 1 - const wrapper = mount(ABreadcrumbs, { - propsData: { - breadcrumbs: breadcrumbs - }, - slots: { - previous: ` - - `, - separator: ` - - `, - current: ` - - ` - } - }) - - expect(wrapper.findAll('.a-breadcrumbs__link')).toHaveLength(previousCount) - expect(wrapper.find('.a-breadcrumbs__link').text()).toEqual('Previous breadcrumb') - expect(wrapper.find('.a-breadcrumbs__separator').exists()).toBe(true) - expect(wrapper.find('.a-breadcrumbs__separator').text()).toEqual('-') - expect(wrapper.find('.a-breadcrumbs__item').exists()).toBe(true) - expect(wrapper.find('.a-breadcrumbs__item').text()).toEqual('Current breadcrumb') - }) -}) diff --git a/src/atoms/breadcrumbs/Breadcrumbs.stories.js b/src/atoms/breadcrumbs/Breadcrumbs.stories.js deleted file mode 100644 index 18871e134..000000000 --- a/src/atoms/breadcrumbs/Breadcrumbs.stories.js +++ /dev/null @@ -1,61 +0,0 @@ -import { addDecorator, storiesOf } from '@storybook/vue' -import { object } from '@storybook/addon-knobs' -import StoryRouter from 'storybook-vue-router' - -import ABreadcrumbs from './Breadcrumbs.vue' -import ALink from '../link/Link.vue' - -import breadcrumbs from '../../../mocks/breadcrumbs.json' - -const defaultData = { - data: () => ({ breadcrumbs }) -} - -addDecorator(StoryRouter()) - -storiesOf('Atoms/Breadcrumbs', module) - .addParameters({ info: true }) - .add('Default', () => ({ - components: { ABreadcrumbs }, - props: { - breadcrumbsKnob: { - default: object('Breadcrumbs links', breadcrumbs) - } - }, - ...defaultData, - template: '' - })) - .add('With slots', () => ({ - components: { ABreadcrumbs, ALink }, - props: { - breadcrumbsKnob: { - default: object('Breadcrumbs links', breadcrumbs) - } - }, - ...defaultData, - template: ` - - - - ` - })) diff --git a/src/atoms/button/Button.html b/src/atoms/button/Button.html index 99bb798ea..4ad0e11c0 100644 --- a/src/atoms/button/Button.html +++ b/src/atoms/button/Button.html @@ -1,6 +1,8 @@- {{ data.breadcrumb.text }} - - - - - - - - {{ data.breadcrumb.text }} - - -