diff --git a/.editorconfig b/.editorconfig index 720f1c139..98d75b044 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,6 +1,6 @@ root = true -[*.{js,css,scss}] +[*.{js,css,scss,yml}] charset = utf-8 end_of_line = lf indent_size = 2 diff --git a/.github/workflows/deploy.js.yml b/.github/workflows/deploy.js.yml index 48147fc94..b6b680432 100644 --- a/.github/workflows/deploy.js.yml +++ b/.github/workflows/deploy.js.yml @@ -26,10 +26,3 @@ jobs: run: | npm install npm run build - - name: Deploy - uses: JamesIves/github-pages-deploy-action@3.7.1 - with: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - BRANCH: gh-pages # The branch the action should deploy to. - FOLDER: . # The folder the action should deploy. - CLEAN: true # Automatically remove deleted files from the deploy branch diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml new file mode 100644 index 000000000..6faecfcbc --- /dev/null +++ b/.github/workflows/pages.yml @@ -0,0 +1,23 @@ +name: GitHub Pages +on: [push] +permissions: + contents: write +jobs: + build-and-deploy: + runs-on: ubuntu-latest + steps: + - name: Checkout 🛎️ + uses: actions/checkout@v4 + - name: Node version + uses: actions/setup-node@v4 + with: + node-version: 20 + - name: Install and Build 🔧 + run: | + npm ci + npm run pages + - name: Deploy 🚀 + uses: JamesIves/github-pages-deploy-action@v4 + with: + folder: pages + clean: true diff --git a/README.md b/README.md index b145ac455..f892dd3b9 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ # REI Cedar Style Framework! + [![codecov](https://codecov.io/gh/rei/rei-cedar/branch/master/graph/badge.svg)](https://codecov.io/gh/rei/rei-cedar) [![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/) - Welcome to REI's style framework! The overall goals of this project are to provide a common scaffolding for UI elements, and a set of themes that build on this scaffolding. We started this project in 2015 as a fork of [Bootstrap](http://getbootstrap.com/). @@ -57,8 +57,13 @@ Publishes package to npm with a prerelease tag. You must increment the component ## Commits -This project is Commitizen friendly. To install: `npm install -g commitizen` +This project is Commitizen friendly. To install: `npm install -g commitizen` When creating a pull request run `git cz` rather than `git commit` and follow the prompts. This projects Changelogs are generated. + - Generate the Changelog: `npm run changelog` + +## Developer demo + +The main documentation site for Cedar is our separate [Cedar docs](https://cedar.rei.com) website. With that in mind, we also have a playground for developing components and sharing ideas with others and within our team. The Cedar team produces this *developer demo* through GitHub Pages that can be accessed at [https://rei.github.io/rei-cedar/](https://rei.github.io/rei-cedar/), but we do not guarantee it will always be up to date or be an accurate representation of the Cedar library. diff --git a/package.json b/package.json index c451eb5e0..abf9428b1 100644 --- a/package.json +++ b/package.json @@ -40,7 +40,8 @@ "build:copycss": "node build/copy-css.js", "build:umd": "vite build --config vite.umd.config.ts", "build:variables": "node build/component-variables-transfer.js", - "preview": "vite preview", + "pages": "vite build --config vite.pages.config.mts", + "preview": "vite preview --config vite.pages.config.mts", "unit": "vitest run", "watch": "vitest", "coverage": "vitest run --coverage", diff --git a/src/components/card/examples/demo/complexCard.vue b/src/components/card/examples/demo/complexCard.vue index fb2dc820e..49543c2d0 100644 --- a/src/components/card/examples/demo/complexCard.vue +++ b/src/components/card/examples/demo/complexCard.vue @@ -5,7 +5,7 @@
@@ -14,18 +14,14 @@ class="cdr-card__link" href="#foo" > -

- Complex Card Title -

+

Complex Card Title

- - Card content - + Card content @@ -34,10 +30,14 @@ diff --git a/src/components/card/examples/demo/fluidHeadingCard.vue b/src/components/card/examples/demo/fluidHeadingCard.vue index 4834f800f..1902e54cc 100644 --- a/src/components/card/examples/demo/fluidHeadingCard.vue +++ b/src/components/card/examples/demo/fluidHeadingCard.vue @@ -5,7 +5,7 @@
@@ -14,13 +14,9 @@ class="cdr-card__link" href="#foo" > - - Fluid title component - + Fluid title component - - Card content - + Card content @@ -29,10 +25,14 @@ diff --git a/src/components/examples.js b/src/components/examples.js index cc621401d..27f045cb2 100644 --- a/src/components/examples.js +++ b/src/components/examples.js @@ -17,8 +17,10 @@ import images from 'componentsdir/image/examples/Images.vue'; import inputs from 'componentsdir/input/examples/Inputs.vue'; import kicker from 'componentsdir/kicker/examples/Kicker.vue'; import landingLead from 'componentsdir/landingLead/examples/LandingLead.vue'; +import layout from 'componentsdir/layout/examples/Layout.vue'; import links from 'componentsdir/link/examples/Links.vue'; import list from 'componentsdir/list/examples/Lists.vue'; +// import mediaObject from 'componentsdir/mediaObject/examples/MediaObject.vue'; import modal from 'componentsdir/modal/examples/Modal.vue'; import pagination from 'componentsdir/pagination/examples/Pagination.vue'; import picture from 'componentsdir/picture/examples/Picture.vue'; @@ -62,8 +64,10 @@ export default { inputs, kicker, landingLead, + layout, links, list, + // mediaObject, modal, pagination, picture, diff --git a/src/components/fulfillmentTile/CdrFulfillmentTile.vue b/src/components/fulfillmentTile/CdrFulfillmentTile.vue index d93cb287d..085e1ec36 100644 --- a/src/components/fulfillmentTile/CdrFulfillmentTile.vue +++ b/src/components/fulfillmentTile/CdrFulfillmentTile.vue @@ -2,8 +2,8 @@ import { useCssModule, computed } from 'vue'; import mapClasses from '../../utils/mapClasses'; import { surfaceSelection } from '../../types/interfaces'; -import { getSurfaceSelectionProps } from '../../utils/surface'; -import CdrFulfillmentTileLayout from './CdrFulfillmentTileLayout.vue'; +import { getSurfaceSelectionProps, getDefaultLayout } from '../../utils/surface'; +import CdrLayout from '../layout/CdrLayout.vue'; import CdrFulfillmentTileHeader from './CdrFulfillmentTileHeader.vue'; import CdrFulfillmentTileContent from './CdrFulfillmentTileContent.vue'; import CdrSkeleton from '../skeleton/CdrSkeleton.vue'; @@ -20,7 +20,7 @@ const props = withDefaults(defineProps(), { checked: false, disabled: false, loading: false, - orientation: 'vertical', + layout: () => getDefaultLayout({ flow: 'row' }), }); const style = useCssModule(); @@ -28,9 +28,14 @@ const baseClass = 'cdr-fulfillment-tile'; // Manages the props passed along to CdrSurface const rootProps = computed(() => { - const { classes, ...additionalProps } = getSurfaceSelectionProps(props, baseClass); + const { classes, ...additionalProps } = getSurfaceSelectionProps(props, baseClass); return { ...additionalProps, class: mapClasses(style, ...classes) || undefined }; }); + +// Merge layout props +const layoutProps = computed(() => + Object.assign(getDefaultLayout({ flow: 'row', rows: [1] }), props.layout), +); diff --git a/src/components/fulfillmentTile/CdrFulfillmentTileContent.vue b/src/components/fulfillmentTile/CdrFulfillmentTileContent.vue index d61836df9..cd7782890 100644 --- a/src/components/fulfillmentTile/CdrFulfillmentTileContent.vue +++ b/src/components/fulfillmentTile/CdrFulfillmentTileContent.vue @@ -8,7 +8,6 @@ import { fulfillmentTileContent } from '../../types/interfaces'; defineOptions({ name: 'CdrFulfillmentTileContent' }); const props = withDefaults(defineProps(), { - stretch: false, scale: '-2', }); @@ -19,10 +18,7 @@ const rootProps = computed( (): bodyTextProps => ({ tag: 'div', scale: props.scale, - class: { - [style[baseClass]]: true, - [style[`${baseClass}--stretch`]]: props.stretch, - }, + class: [style[baseClass]], }), ); diff --git a/src/components/fulfillmentTile/CdrFulfillmentTileHeader.vue b/src/components/fulfillmentTile/CdrFulfillmentTileHeader.vue index a49634d52..8da0a667d 100644 --- a/src/components/fulfillmentTile/CdrFulfillmentTileHeader.vue +++ b/src/components/fulfillmentTile/CdrFulfillmentTileHeader.vue @@ -1,26 +1,16 @@ diff --git a/src/components/fulfillmentTile/CdrFulfillmentTileLayout.vue b/src/components/fulfillmentTile/CdrFulfillmentTileLayout.vue deleted file mode 100644 index 26e197b43..000000000 --- a/src/components/fulfillmentTile/CdrFulfillmentTileLayout.vue +++ /dev/null @@ -1,36 +0,0 @@ - - - - - diff --git a/src/components/fulfillmentTile/__tests__/CdrFulfillmentTile.spec.js b/src/components/fulfillmentTile/__tests__/CdrFulfillmentTile.spec.js index 8e5e88e62..68fad498c 100644 --- a/src/components/fulfillmentTile/__tests__/CdrFulfillmentTile.spec.js +++ b/src/components/fulfillmentTile/__tests__/CdrFulfillmentTile.spec.js @@ -86,7 +86,7 @@ describe('CdrFulfillmentTile', () => { }, }); expect(wrapper.element).toMatchSnapshot(); - expect(wrapper.find('.cdr-fulfillment-tile-content--stretch').text()).toBe('Body slot'); + expect(wrapper.find('.cdr-fulfillment-tile-content').text()).toBe('Body slot'); }); it('shows footer', () => { @@ -97,7 +97,7 @@ describe('CdrFulfillmentTile', () => { footer: 'Footer slot', }, }); - expect(wrapper.find('.cdr-fulfillment-tile-content').text()).toBe('Footer slot'); + expect(wrapper.find('.cdr-fulfillment-tile-content:nth-child(2)').text()).toBe('Footer slot'); expect(wrapper.element).toMatchSnapshot(); }); diff --git a/src/components/fulfillmentTile/__tests__/CdrFulfillmentTileContent.spec.js b/src/components/fulfillmentTile/__tests__/CdrFulfillmentTileContent.spec.js index c73bc02e5..66323c753 100644 --- a/src/components/fulfillmentTile/__tests__/CdrFulfillmentTileContent.spec.js +++ b/src/components/fulfillmentTile/__tests__/CdrFulfillmentTileContent.spec.js @@ -23,10 +23,6 @@ describe('CdrFulfillmentTileContent', () => { }, }); expect(wrapper.element).toMatchSnapshot(); - expect(wrapper.classes()).toEqual([ - 'cdr-body', - 'cdr-fulfillment-tile-content', - 'cdr-fulfillment-tile-content--stretch', - ]); + expect(wrapper.classes()).toEqual(['cdr-body', 'cdr-fulfillment-tile-content']); }); }); diff --git a/src/components/fulfillmentTile/__tests__/CdrFulfillmentTileLayout.spec.js b/src/components/fulfillmentTile/__tests__/CdrFulfillmentTileLayout.spec.js deleted file mode 100644 index 8a2f23125..000000000 --- a/src/components/fulfillmentTile/__tests__/CdrFulfillmentTileLayout.spec.js +++ /dev/null @@ -1,28 +0,0 @@ -import { mount } from '../../../../test/vue-jest-style-workaround.js'; -import CdrFulfillmentTileLayout from '../CdrFulfillmentTileLayout.vue'; - -describe('CdrFulfillmentTileLayout', () => { - it('has defaults', () => { - const wrapper = mount(CdrFulfillmentTileLayout, { - props: {}, - slots: { default: 'X' }, - }); - expect(wrapper.element).toMatchSnapshot(); - expect(wrapper.classes()).toEqual([ - 'cdr-fulfillment-tile-layout', - 'cdr-fulfillment-tile-layout--horizontal', - ]); - }); - - it('has vertical layout', () => { - const wrapper = mount(CdrFulfillmentTileLayout, { - props: { orientation: 'vertical' }, - slots: { default: 'X' }, - }); - expect(wrapper.element).toMatchSnapshot(); - expect(wrapper.classes()).toEqual([ - 'cdr-fulfillment-tile-layout', - 'cdr-fulfillment-tile-layout--vertical', - ]); - }); -}); diff --git a/src/components/fulfillmentTile/__tests__/__snapshots__/CdrFulfillmentTile.spec.js.snap b/src/components/fulfillmentTile/__tests__/__snapshots__/CdrFulfillmentTile.spec.js.snap index 5117a2141..a191ab16e 100644 --- a/src/components/fulfillmentTile/__tests__/__snapshots__/CdrFulfillmentTile.spec.js.snap +++ b/src/components/fulfillmentTile/__tests__/__snapshots__/CdrFulfillmentTile.spec.js.snap @@ -4,20 +4,18 @@ exports[`CdrFulfillmentTile > component unit tests > default component with no c `; @@ -76,20 +83,18 @@ exports[`CdrFulfillmentTile > is loading 1`] = ` aria-checked="false" class="cdr-fulfillment-tile cdr-fulfillment-tile--modifier-default" data-loading="true" - modifier="default" - orientation="vertical" role="radio" - tag="button" type="button" >
+ +
- - is loading 1`] = ` -
- + - +
+ + +
is loading 1`] = `
+
`; @@ -162,20 +174,18 @@ exports[`CdrFulfillmentTile > shows body 1`] = ` `; @@ -248,20 +259,18 @@ exports[`CdrFulfillmentTile > shows footer 1`] = ` `; @@ -334,20 +350,18 @@ exports[`CdrFulfillmentTile > shows header 1`] = ` `; @@ -405,20 +428,18 @@ exports[`CdrFulfillmentTile > snapshot test > renders correctly 1`] = ` `; @@ -476,20 +506,18 @@ exports[`CdrFulfillmentTile > supports icon right configuration 1`] = ` `; @@ -585,20 +614,18 @@ exports[`CdrFulfillmentTile > supports icon left configuration 1`] = ` `; diff --git a/src/components/fulfillmentTile/__tests__/__snapshots__/CdrFulfillmentTileContent.spec.js.snap b/src/components/fulfillmentTile/__tests__/__snapshots__/CdrFulfillmentTileContent.spec.js.snap index 9c3a0cfed..0f5da3be7 100644 --- a/src/components/fulfillmentTile/__tests__/__snapshots__/CdrFulfillmentTileContent.spec.js.snap +++ b/src/components/fulfillmentTile/__tests__/__snapshots__/CdrFulfillmentTileContent.spec.js.snap @@ -2,7 +2,8 @@ exports[`CdrFulfillmentTileContent > is stretch 1`] = `
diff --git a/src/components/fulfillmentTile/__tests__/__snapshots__/CdrFulfillmentTileHeader.spec.js.snap b/src/components/fulfillmentTile/__tests__/__snapshots__/CdrFulfillmentTileHeader.spec.js.snap index 0bbe0e5e6..c585c8efb 100644 --- a/src/components/fulfillmentTile/__tests__/__snapshots__/CdrFulfillmentTileHeader.spec.js.snap +++ b/src/components/fulfillmentTile/__tests__/__snapshots__/CdrFulfillmentTileHeader.spec.js.snap @@ -2,10 +2,8 @@ exports[`CdrFulfillmentTileHeader > icon left configuration 1`] = `
- - @@ -27,16 +25,13 @@ exports[`CdrFulfillmentTileHeader > icon left configuration 1`] = ` -
`; exports[`CdrFulfillmentTileHeader > icon right configuration 1`] = `
- - icon right configuration 1`] = ` X -
`; exports[`CdrFulfillmentTileHeader > shows label 1`] = `
- - shows label 1`] = ` -
`; diff --git a/src/components/fulfillmentTile/__tests__/__snapshots__/CdrFulfillmentTileLayout.spec.js.snap b/src/components/fulfillmentTile/__tests__/__snapshots__/CdrFulfillmentTileLayout.spec.js.snap deleted file mode 100644 index 4577f898d..000000000 --- a/src/components/fulfillmentTile/__tests__/__snapshots__/CdrFulfillmentTileLayout.spec.js.snap +++ /dev/null @@ -1,23 +0,0 @@ -// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html - -exports[`CdrFulfillmentTileLayout > has defaults 1`] = ` -
- - - X - -
-`; - -exports[`CdrFulfillmentTileLayout > has vertical layout 1`] = ` -
- - - X - -
-`; diff --git a/src/components/fulfillmentTile/examples/FulfillmentTile.vue b/src/components/fulfillmentTile/examples/FulfillmentTile.vue index 8896523be..b8a303f7b 100644 --- a/src/components/fulfillmentTile/examples/FulfillmentTile.vue +++ b/src/components/fulfillmentTile/examples/FulfillmentTile.vue @@ -68,11 +68,11 @@ const toggleCheckbox2 = (value: number) => { role="radio" @click="radio1 = 1" > -