@vonage/vivid 3.0.0-next.6 → 3.0.0-next.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.babelrc +3 -0
- package/.eslintrc.json +70 -0
- package/.stylelintrc.json +8 -0
- package/CHANGELOG.json +343 -0
- package/CHANGELOG.md +45 -0
- package/jest.config.cjs +20 -0
- package/package.json +4 -13
- package/playwright.config.dev.ts +21 -0
- package/playwright.config.ts +34 -0
- package/project.json +122 -0
- package/rollup.config.prod.ts +50 -0
- package/setupJestTests.js +17 -0
- package/{index.d.ts → src/index.ts} +2 -2
- package/src/lib/accordion/README.md +55 -0
- package/src/lib/accordion/accordion.scss +10 -0
- package/src/lib/accordion/accordion.spec.ts +91 -0
- package/src/lib/accordion/accordion.template.ts +23 -0
- package/src/lib/accordion/accordion.ts +49 -0
- package/src/lib/accordion/index.ts +14 -0
- package/src/lib/accordion/ui.test.ts +37 -0
- package/src/lib/accordion/ui.test.ts-snapshots/snapshots-accordion-Chrome-Stable-darwin.png +0 -0
- package/src/lib/accordion/ui.test.ts-snapshots/snapshots-accordion-Chrome-Stable-linux.png +0 -0
- package/src/lib/accordion/ui.test.ts-snapshots/snapshots-accordion-Desktop-Firefox-darwin.png +0 -0
- package/src/lib/accordion/ui.test.ts-snapshots/snapshots-accordion-Desktop-Firefox-linux.png +0 -0
- package/src/lib/accordion/ui.test.ts-snapshots/snapshots-accordion-Desktop-Safari-darwin.png +0 -0
- package/src/lib/accordion/ui.test.ts-snapshots/snapshots-accordion-Desktop-Safari-linux.png +0 -0
- package/src/lib/accordion-item/README.md +113 -0
- package/src/lib/accordion-item/accordion-item.scss +91 -0
- package/src/lib/accordion-item/accordion-item.spec.ts +103 -0
- package/src/lib/accordion-item/accordion-item.template.ts +62 -0
- package/src/lib/accordion-item/accordion-item.ts +67 -0
- package/src/lib/accordion-item/index.ts +14 -0
- package/src/lib/accordion-item/partials/variables.scss +1 -0
- package/src/lib/accordion-item/ui.test.ts +37 -0
- package/src/lib/accordion-item/ui.test.ts-snapshots/snapshots-accordion-item-Chrome-Stable-darwin.png +0 -0
- package/src/lib/accordion-item/ui.test.ts-snapshots/snapshots-accordion-item-Chrome-Stable-linux.png +0 -0
- package/src/lib/accordion-item/ui.test.ts-snapshots/snapshots-accordion-item-Desktop-Firefox-darwin.png +0 -0
- package/src/lib/accordion-item/ui.test.ts-snapshots/snapshots-accordion-item-Desktop-Firefox-linux.png +0 -0
- package/src/lib/accordion-item/ui.test.ts-snapshots/snapshots-accordion-item-Desktop-Safari-darwin.png +0 -0
- package/src/lib/accordion-item/ui.test.ts-snapshots/snapshots-accordion-item-Desktop-Safari-linux.png +0 -0
- package/src/lib/badge/README.md +112 -0
- package/src/lib/badge/badge.scss +64 -0
- package/src/lib/badge/badge.spec.ts +114 -0
- package/src/lib/badge/badge.template.ts +36 -0
- package/src/lib/badge/badge.ts +97 -0
- package/src/lib/badge/index.ts +23 -0
- package/src/lib/badge/ui.test.ts +28 -0
- package/src/lib/badge/ui.test.ts-snapshots/snapshots-badge-Chrome-Stable-darwin.png +0 -0
- package/src/lib/badge/ui.test.ts-snapshots/snapshots-badge-Chrome-Stable-linux.png +0 -0
- package/src/lib/badge/ui.test.ts-snapshots/snapshots-badge-Desktop-Firefox-darwin.png +0 -0
- package/src/lib/badge/ui.test.ts-snapshots/snapshots-badge-Desktop-Firefox-linux.png +0 -0
- package/src/lib/badge/ui.test.ts-snapshots/snapshots-badge-Desktop-Safari-darwin.png +0 -0
- package/src/lib/badge/ui.test.ts-snapshots/snapshots-badge-Desktop-Safari-linux.png +0 -0
- package/src/lib/banner/README.md +117 -0
- package/src/lib/banner/banner.scss +71 -0
- package/src/lib/banner/banner.spec.ts +355 -0
- package/src/lib/banner/banner.template.ts +61 -0
- package/src/lib/banner/banner.ts +77 -0
- package/src/lib/banner/index.ts +14 -0
- package/src/lib/banner/ui.test.ts +64 -0
- package/src/lib/banner/ui.test.ts-snapshots/snapshots-banner-Chrome-Stable-darwin.png +0 -0
- package/src/lib/banner/ui.test.ts-snapshots/snapshots-banner-Chrome-Stable-linux.png +0 -0
- package/src/lib/banner/ui.test.ts-snapshots/snapshots-banner-Desktop-Firefox-darwin.png +0 -0
- package/src/lib/banner/ui.test.ts-snapshots/snapshots-banner-Desktop-Firefox-linux.png +0 -0
- package/src/lib/banner/ui.test.ts-snapshots/snapshots-banner-Desktop-Safari-darwin.png +0 -0
- package/src/lib/banner/ui.test.ts-snapshots/snapshots-banner-Desktop-Safari-linux.png +0 -0
- package/src/lib/breadcrumb/README.md +25 -0
- package/src/lib/breadcrumb/breadcrumb.scss +3 -0
- package/src/lib/breadcrumb/breadcrumb.spec.ts +78 -0
- package/src/lib/breadcrumb/breadcrumb.ts +10 -0
- package/src/lib/breadcrumb/index.ts +13 -0
- package/src/lib/breadcrumb/ui.test.ts +36 -0
- package/src/lib/breadcrumb/ui.test.ts-snapshots/snapshots-breadcrumb-Chrome-Stable-darwin.png +0 -0
- package/src/lib/breadcrumb/ui.test.ts-snapshots/snapshots-breadcrumb-Chrome-Stable-linux.png +0 -0
- package/src/lib/breadcrumb/ui.test.ts-snapshots/snapshots-breadcrumb-Desktop-Firefox-darwin.png +0 -0
- package/src/lib/breadcrumb/ui.test.ts-snapshots/snapshots-breadcrumb-Desktop-Firefox-linux.png +0 -0
- package/src/lib/breadcrumb/ui.test.ts-snapshots/snapshots-breadcrumb-Desktop-Safari-darwin.png +0 -0
- package/src/lib/breadcrumb/ui.test.ts-snapshots/snapshots-breadcrumb-Desktop-Safari-linux.png +0 -0
- package/src/lib/breadcrumb-item/README.md +40 -0
- package/src/lib/breadcrumb-item/breadcrumb-item.scss +28 -0
- package/src/lib/breadcrumb-item/breadcrumb-item.spec.ts +192 -0
- package/src/lib/breadcrumb-item/breadcrumb-item.template.ts +37 -0
- package/src/lib/breadcrumb-item/breadcrumb-item.ts +15 -0
- package/src/lib/breadcrumb-item/index.ts +16 -0
- package/src/lib/breadcrumb-item/ui.test.ts +38 -0
- package/src/lib/breadcrumb-item/ui.test.ts-snapshots/snapshots-breadcrumb-item-Chrome-Stable-darwin.png +0 -0
- package/src/lib/breadcrumb-item/ui.test.ts-snapshots/snapshots-breadcrumb-item-Chrome-Stable-linux.png +0 -0
- package/src/lib/breadcrumb-item/ui.test.ts-snapshots/snapshots-breadcrumb-item-Desktop-Firefox-darwin.png +0 -0
- package/src/lib/breadcrumb-item/ui.test.ts-snapshots/snapshots-breadcrumb-item-Desktop-Firefox-linux.png +0 -0
- package/src/lib/breadcrumb-item/ui.test.ts-snapshots/snapshots-breadcrumb-item-Desktop-Safari-darwin.png +0 -0
- package/src/lib/breadcrumb-item/ui.test.ts-snapshots/snapshots-breadcrumb-item-Desktop-Safari-linux.png +0 -0
- package/src/lib/button/README.md +120 -0
- package/src/lib/button/button.scss +142 -0
- package/src/lib/button/button.spec.ts +131 -0
- package/src/lib/button/button.template.ts +89 -0
- package/src/lib/button/button.ts +95 -0
- package/src/lib/button/index.ts +25 -0
- package/src/lib/button/partials/variables.scss +2 -0
- package/src/lib/button/ui.test.ts +32 -0
- package/src/lib/button/ui.test.ts-snapshots/snapshots-button-Chrome-Stable-darwin.png +0 -0
- package/src/lib/button/ui.test.ts-snapshots/snapshots-button-Chrome-Stable-linux.png +0 -0
- package/src/lib/button/ui.test.ts-snapshots/snapshots-button-Desktop-Firefox-darwin.png +0 -0
- package/src/lib/button/ui.test.ts-snapshots/snapshots-button-Desktop-Firefox-linux.png +0 -0
- package/src/lib/button/ui.test.ts-snapshots/snapshots-button-Desktop-Safari-darwin.png +0 -0
- package/src/lib/button/ui.test.ts-snapshots/snapshots-button-Desktop-Safari-linux.png +0 -0
- package/src/lib/calendar/README.md +70 -0
- package/src/lib/calendar/calendar.scss +176 -0
- package/src/lib/calendar/calendar.spec.ts +341 -0
- package/src/lib/calendar/calendar.template.ts +93 -0
- package/src/lib/calendar/calendar.ts +139 -0
- package/src/lib/calendar/helpers/calendar.date-functions.ts +31 -0
- package/src/lib/calendar/helpers/calendar.event-context.ts +72 -0
- package/src/lib/calendar/helpers/calendar.keyboard-interactions.ts +65 -0
- package/src/lib/calendar/index.ts +16 -0
- package/src/lib/calendar/partials/_variables.scss +15 -0
- package/src/lib/calendar/ui.test.ts +32 -0
- package/src/lib/calendar/ui.test.ts-snapshots/snapshots-calendar-Chrome-Stable-darwin.png +0 -0
- package/src/lib/calendar/ui.test.ts-snapshots/snapshots-calendar-Chrome-Stable-linux.png +0 -0
- package/src/lib/calendar/ui.test.ts-snapshots/snapshots-calendar-Desktop-Firefox-darwin.png +0 -0
- package/src/lib/calendar/ui.test.ts-snapshots/snapshots-calendar-Desktop-Firefox-linux.png +0 -0
- package/src/lib/calendar/ui.test.ts-snapshots/snapshots-calendar-Desktop-Safari-darwin.png +0 -0
- package/src/lib/calendar/ui.test.ts-snapshots/snapshots-calendar-Desktop-Safari-linux.png +0 -0
- package/src/lib/components.spec.ts +7 -0
- package/{lib/components.d.ts → src/lib/components.ts} +16 -16
- package/src/lib/elevation/README.md +99 -0
- package/src/lib/elevation/elevation.scss +15 -0
- package/src/lib/elevation/elevation.spec.ts +55 -0
- package/src/lib/elevation/elevation.template.ts +26 -0
- package/src/lib/elevation/elevation.ts +17 -0
- package/src/lib/elevation/index.ts +17 -0
- package/src/lib/elevation/partials/_elevation.mixin.scss +4 -0
- package/src/lib/elevation/ui.test.ts +32 -0
- package/src/lib/elevation/ui.test.ts-snapshots/snapshots-elevation-Chrome-Stable-darwin.png +0 -0
- package/src/lib/elevation/ui.test.ts-snapshots/snapshots-elevation-Chrome-Stable-linux.png +0 -0
- package/src/lib/elevation/ui.test.ts-snapshots/snapshots-elevation-Desktop-Firefox-darwin.png +0 -0
- package/src/lib/elevation/ui.test.ts-snapshots/snapshots-elevation-Desktop-Firefox-linux.png +0 -0
- package/src/lib/elevation/ui.test.ts-snapshots/snapshots-elevation-Desktop-Safari-darwin.png +0 -0
- package/src/lib/elevation/ui.test.ts-snapshots/snapshots-elevation-Desktop-Safari-linux.png +0 -0
- package/src/lib/enums.ts +55 -0
- package/src/lib/focus/README.md +1 -0
- package/src/lib/focus/focus.scss +17 -0
- package/src/lib/focus/focus.template.ts +16 -0
- package/src/lib/focus/focus.ts +10 -0
- package/src/lib/focus/index.ts +21 -0
- package/src/lib/focus/partials/variables.scss +2 -0
- package/src/lib/icon/README.md +70 -0
- package/src/lib/icon/__snapshots__/icon.spec.ts.snap +16 -0
- package/src/lib/icon/icon.placeholder.ts +12 -0
- package/src/lib/icon/icon.scss +52 -0
- package/src/lib/icon/icon.spec.ts +106 -0
- package/src/lib/icon/icon.template.ts +23 -0
- package/src/lib/icon/icon.ts +93 -0
- package/src/lib/icon/index.ts +14 -0
- package/src/lib/layout/README.md +154 -0
- package/src/lib/layout/index.ts +18 -0
- package/src/lib/layout/layout.scss +40 -0
- package/src/lib/layout/layout.spec.ts +73 -0
- package/src/lib/layout/layout.template.ts +29 -0
- package/src/lib/layout/layout.ts +46 -0
- package/src/lib/layout/partials/_functions.scss +15 -0
- package/src/lib/layout/partials/_mixins.scss +5 -0
- package/src/lib/layout/partials/_variables.scss +23 -0
- package/src/lib/layout/ui.test.ts +32 -0
- package/src/lib/layout/ui.test.ts-snapshots/snapshots-layout-Chrome-Stable-darwin.png +0 -0
- package/src/lib/layout/ui.test.ts-snapshots/snapshots-layout-Chrome-Stable-linux.png +0 -0
- package/src/lib/layout/ui.test.ts-snapshots/snapshots-layout-Desktop-Firefox-darwin.png +0 -0
- package/src/lib/layout/ui.test.ts-snapshots/snapshots-layout-Desktop-Firefox-linux.png +0 -0
- package/src/lib/layout/ui.test.ts-snapshots/snapshots-layout-Desktop-Safari-darwin.png +0 -0
- package/src/lib/layout/ui.test.ts-snapshots/snapshots-layout-Desktop-Safari-linux.png +0 -0
- package/src/lib/popup/README.md +261 -0
- package/src/lib/popup/index.ts +21 -0
- package/src/lib/popup/popup.scss +43 -0
- package/src/lib/popup/popup.spec.ts +265 -0
- package/src/lib/popup/popup.template.ts +41 -0
- package/src/lib/popup/popup.ts +158 -0
- package/src/lib/popup/ui.test.ts +111 -0
- package/src/lib/popup/ui.test.ts-snapshots/snapshots-popup-Chrome-Stable-darwin.png +0 -0
- package/src/lib/popup/ui.test.ts-snapshots/snapshots-popup-Chrome-Stable-linux.png +0 -0
- package/src/lib/popup/ui.test.ts-snapshots/snapshots-popup-Desktop-Firefox-darwin.png +0 -0
- package/src/lib/popup/ui.test.ts-snapshots/snapshots-popup-Desktop-Firefox-linux.png +0 -0
- package/src/lib/popup/ui.test.ts-snapshots/snapshots-popup-Desktop-Safari-darwin.png +0 -0
- package/src/lib/popup/ui.test.ts-snapshots/snapshots-popup-Desktop-Safari-linux.png +0 -0
- package/src/lib/progress/README.md +107 -0
- package/src/lib/progress/index.ts +14 -0
- package/src/lib/progress/progress.scss +133 -0
- package/src/lib/progress/progress.spec.ts +173 -0
- package/src/lib/progress/progress.template.ts +62 -0
- package/src/lib/progress/progress.ts +25 -0
- package/src/lib/progress/ui.test.ts +70 -0
- package/src/lib/progress/ui.test.ts-snapshots/snapshots-progress-Chrome-Stable-darwin.png +0 -0
- package/src/lib/progress/ui.test.ts-snapshots/snapshots-progress-Chrome-Stable-linux.png +0 -0
- package/src/lib/progress/ui.test.ts-snapshots/snapshots-progress-Desktop-Firefox-darwin.png +0 -0
- package/src/lib/progress/ui.test.ts-snapshots/snapshots-progress-Desktop-Firefox-linux.png +0 -0
- package/src/lib/progress/ui.test.ts-snapshots/snapshots-progress-Desktop-Safari-darwin.png +0 -0
- package/src/lib/progress/ui.test.ts-snapshots/snapshots-progress-Desktop-Safari-linux.png +0 -0
- package/src/lib/progress-ring/README.md +90 -0
- package/src/lib/progress-ring/index.ts +15 -0
- package/src/lib/progress-ring/progress-ring.scss +75 -0
- package/src/lib/progress-ring/progress-ring.spec.ts +139 -0
- package/src/lib/progress-ring/progress-ring.template.ts +82 -0
- package/src/lib/progress-ring/progress-ring.ts +18 -0
- package/src/lib/progress-ring/ui.test.ts +35 -0
- package/src/lib/progress-ring/ui.test.ts-snapshots/snapshots-progress-ring-Chrome-Stable-darwin.png +0 -0
- package/src/lib/progress-ring/ui.test.ts-snapshots/snapshots-progress-ring-Chrome-Stable-linux.png +0 -0
- package/src/lib/progress-ring/ui.test.ts-snapshots/snapshots-progress-ring-Desktop-Firefox-darwin.png +0 -0
- package/src/lib/progress-ring/ui.test.ts-snapshots/snapshots-progress-ring-Desktop-Firefox-linux.png +0 -0
- package/src/lib/progress-ring/ui.test.ts-snapshots/snapshots-progress-ring-Desktop-Safari-darwin.png +0 -0
- package/src/lib/progress-ring/ui.test.ts-snapshots/snapshots-progress-ring-Desktop-Safari-linux.png +0 -0
- package/src/lib/side-drawer/README.md +304 -0
- package/src/lib/side-drawer/index.ts +16 -0
- package/src/lib/side-drawer/partials/variables.scss +6 -0
- package/src/lib/side-drawer/side-drawer.scss +109 -0
- package/src/lib/side-drawer/side-drawer.spec.ts +118 -0
- package/src/lib/side-drawer/side-drawer.template.ts +51 -0
- package/src/lib/side-drawer/side-drawer.ts +58 -0
- package/src/lib/side-drawer/ui.test.ts +102 -0
- package/src/lib/side-drawer/ui.test.ts-snapshots/snapshots-side-drawer-Chrome-Stable-darwin.png +0 -0
- package/src/lib/side-drawer/ui.test.ts-snapshots/snapshots-side-drawer-Chrome-Stable-linux.png +0 -0
- package/src/lib/side-drawer/ui.test.ts-snapshots/snapshots-side-drawer-Desktop-Firefox-darwin.png +0 -0
- package/src/lib/side-drawer/ui.test.ts-snapshots/snapshots-side-drawer-Desktop-Firefox-linux.png +0 -0
- package/src/lib/side-drawer/ui.test.ts-snapshots/snapshots-side-drawer-Desktop-Safari-darwin.png +0 -0
- package/src/lib/side-drawer/ui.test.ts-snapshots/snapshots-side-drawer-Desktop-Safari-linux.png +0 -0
- package/src/lib/side-drawer/ui.test.ts-snapshots/snapshots-side-drawer-modal-Chrome-Stable-darwin.png +0 -0
- package/src/lib/side-drawer/ui.test.ts-snapshots/snapshots-side-drawer-modal-Chrome-Stable-linux.png +0 -0
- package/src/lib/side-drawer/ui.test.ts-snapshots/snapshots-side-drawer-modal-Desktop-Firefox-darwin.png +0 -0
- package/src/lib/side-drawer/ui.test.ts-snapshots/snapshots-side-drawer-modal-Desktop-Firefox-linux.png +0 -0
- package/src/lib/side-drawer/ui.test.ts-snapshots/snapshots-side-drawer-modal-Desktop-Safari-darwin.png +0 -0
- package/src/lib/side-drawer/ui.test.ts-snapshots/snapshots-side-drawer-modal-Desktop-Safari-linux.png +0 -0
- package/src/lib/sidenav-item/README.md +41 -0
- package/src/lib/sidenav-item/index.ts +20 -0
- package/src/lib/sidenav-item/sidenav-item.scss +51 -0
- package/src/lib/sidenav-item/sidenav-item.spec.ts +64 -0
- package/src/lib/sidenav-item/sidenav-item.template.ts +25 -0
- package/src/lib/sidenav-item/sidenav-item.ts +15 -0
- package/src/lib/sidenav-item/ui.test.ts +32 -0
- package/src/lib/sidenav-item/ui.test.ts-snapshots/snapshots-sidenav-item-Chrome-Stable-darwin.png +0 -0
- package/src/lib/sidenav-item/ui.test.ts-snapshots/snapshots-sidenav-item-Chrome-Stable-linux.png +0 -0
- package/src/lib/sidenav-item/ui.test.ts-snapshots/snapshots-sidenav-item-Desktop-Firefox-darwin.png +0 -0
- package/src/lib/sidenav-item/ui.test.ts-snapshots/snapshots-sidenav-item-Desktop-Firefox-linux.png +0 -0
- package/src/lib/sidenav-item/ui.test.ts-snapshots/snapshots-sidenav-item-Desktop-Safari-darwin.png +0 -0
- package/src/lib/sidenav-item/ui.test.ts-snapshots/snapshots-sidenav-item-Desktop-Safari-linux.png +0 -0
- package/src/lib/text/README.md +119 -0
- package/src/lib/text/index.ts +14 -0
- package/src/lib/text/text.scss +92 -0
- package/src/lib/text/text.spec.ts +54 -0
- package/src/lib/text/text.template.ts +28 -0
- package/src/lib/text/text.ts +55 -0
- package/src/lib/text/ui.test.ts +39 -0
- package/src/lib/text/ui.test.ts-snapshots/snapshots-text-Chrome-Stable-darwin.png +0 -0
- package/src/lib/text/ui.test.ts-snapshots/snapshots-text-Chrome-Stable-linux.png +0 -0
- package/src/lib/text/ui.test.ts-snapshots/snapshots-text-Desktop-Firefox-darwin.png +0 -0
- package/src/lib/text/ui.test.ts-snapshots/snapshots-text-Desktop-Firefox-linux.png +0 -0
- package/src/lib/text/ui.test.ts-snapshots/snapshots-text-Desktop-Safari-darwin.png +0 -0
- package/src/lib/text/ui.test.ts-snapshots/snapshots-text-Desktop-Safari-linux.png +0 -0
- package/src/lib/text-anchor/README.md +5 -0
- package/src/lib/text-anchor/index.ts +12 -0
- package/src/lib/text-anchor/text-anchor.spec.ts +153 -0
- package/src/lib/text-anchor/text-anchor.template.ts +66 -0
- package/src/lib/text-anchor/text-anchor.ts +22 -0
- package/src/lib/tooltip/README.md +132 -0
- package/src/lib/tooltip/index.ts +16 -0
- package/src/lib/tooltip/partials/variables.scss +1 -0
- package/src/lib/tooltip/tooltip.scss +18 -0
- package/src/lib/tooltip/tooltip.spec.ts +70 -0
- package/src/lib/tooltip/tooltip.template.ts +30 -0
- package/src/lib/tooltip/tooltip.ts +44 -0
- package/src/lib/tooltip/ui.test.ts +53 -0
- package/src/lib/tooltip/ui.test.ts-snapshots/snapshots-tooltip-Chrome-Stable-darwin.png +0 -0
- package/src/lib/tooltip/ui.test.ts-snapshots/snapshots-tooltip-Chrome-Stable-linux.png +0 -0
- package/src/lib/tooltip/ui.test.ts-snapshots/snapshots-tooltip-Desktop-Firefox-darwin.png +0 -0
- package/src/lib/tooltip/ui.test.ts-snapshots/snapshots-tooltip-Desktop-Firefox-linux.png +0 -0
- package/src/lib/tooltip/ui.test.ts-snapshots/snapshots-tooltip-Desktop-Safari-darwin.png +0 -0
- package/src/lib/tooltip/ui.test.ts-snapshots/snapshots-tooltip-Desktop-Safari-linux.png +0 -0
- package/src/shared/design-system/index.ts +12 -0
- package/src/shared/patterns/affix.ts +56 -0
- package/{shared/patterns/index.d.ts → src/shared/patterns/index.ts} +1 -1
- package/src/types/extract-gfm.d.ts +5 -0
- package/src/types/style.d.ts +4 -0
- package/src/visual-tests/visual-tests-utils.ts +76 -0
- package/tsconfig.json +36 -0
- package/tsconfig.lib.json +11 -0
- package/tsconfig.spec.json +16 -0
- package/accordion/index.js +0 -61
- package/accordion-item/index.js +0 -125
- package/badge/index.js +0 -64
- package/banner/index.js +0 -212
- package/breadcrumb/index.js +0 -100
- package/breadcrumb-item/index.js +0 -55
- package/button/index.js +0 -761
- package/calendar/index.js +0 -1521
- package/elevation/index.js +0 -31
- package/focus/index.js +0 -3
- package/icon/index.js +0 -34
- package/index.js +0 -32
- package/layout/index.js +0 -53
- package/lib/accordion/accordion.d.ts +0 -9
- package/lib/accordion/accordion.template.d.ts +0 -4
- package/lib/accordion/index.d.ts +0 -2
- package/lib/accordion-item/accordion-item.d.ts +0 -13
- package/lib/accordion-item/accordion-item.template.d.ts +0 -4
- package/lib/accordion-item/index.d.ts +0 -3
- package/lib/badge/badge.d.ts +0 -17
- package/lib/badge/badge.template.d.ts +0 -4
- package/lib/badge/index.d.ts +0 -3
- package/lib/banner/banner.d.ts +0 -20
- package/lib/banner/banner.template.d.ts +0 -6
- package/lib/banner/index.d.ts +0 -2
- package/lib/breadcrumb/breadcrumb.d.ts +0 -3
- package/lib/breadcrumb/index.d.ts +0 -2
- package/lib/breadcrumb-item/breadcrumb-item.d.ts +0 -5
- package/lib/breadcrumb-item/breadcrumb-item.template.d.ts +0 -4
- package/lib/breadcrumb-item/index.d.ts +0 -3
- package/lib/button/button.d.ts +0 -17
- package/lib/button/button.template.d.ts +0 -4
- package/lib/button/index.d.ts +0 -21
- package/lib/calendar/calendar.d.ts +0 -11
- package/lib/calendar/calendar.template.d.ts +0 -4
- package/lib/calendar/helpers/calendar.date-functions.d.ts +0 -2
- package/lib/calendar/helpers/calendar.event-context.d.ts +0 -6
- package/lib/calendar/helpers/calendar.keyboard-interactions.d.ts +0 -9
- package/lib/calendar/index.d.ts +0 -3
- package/lib/elevation/elevation.d.ts +0 -4
- package/lib/elevation/elevation.template.d.ts +0 -4
- package/lib/elevation/index.d.ts +0 -2
- package/lib/enums.d.ts +0 -45
- package/lib/focus/focus.d.ts +0 -3
- package/lib/focus/focus.template.d.ts +0 -4
- package/lib/focus/index.d.ts +0 -2
- package/lib/icon/icon.d.ts +0 -11
- package/lib/icon/icon.placeholder.d.ts +0 -1
- package/lib/icon/icon.template.d.ts +0 -4
- package/lib/icon/index.d.ts +0 -2
- package/lib/layout/index.d.ts +0 -2
- package/lib/layout/layout.d.ts +0 -16
- package/lib/layout/layout.template.d.ts +0 -4
- package/lib/popup/index.d.ts +0 -4
- package/lib/popup/popup.d.ts +0 -29
- package/lib/popup/popup.template.d.ts +0 -4
- package/lib/progress/index.d.ts +0 -2
- package/lib/progress/progress.d.ts +0 -9
- package/lib/progress/progress.template.d.ts +0 -5
- package/lib/progress-ring/index.d.ts +0 -2
- package/lib/progress-ring/progress-ring.d.ts +0 -6
- package/lib/progress-ring/progress-ring.template.d.ts +0 -4
- package/lib/side-drawer/index.d.ts +0 -2
- package/lib/side-drawer/side-drawer.d.ts +0 -12
- package/lib/side-drawer/side-drawer.template.d.ts +0 -4
- package/lib/sidenav-item/index.d.ts +0 -3
- package/lib/sidenav-item/sidenav-item.d.ts +0 -6
- package/lib/sidenav-item/sidenav-item.template.d.ts +0 -4
- package/lib/text/index.d.ts +0 -2
- package/lib/text/text.d.ts +0 -10
- package/lib/text/text.template.d.ts +0 -4
- package/lib/text-anchor/index.d.ts +0 -2
- package/lib/text-anchor/text-anchor.d.ts +0 -7
- package/lib/text-anchor/text-anchor.template.d.ts +0 -4
- package/lib/tooltip/index.d.ts +0 -3
- package/lib/tooltip/tooltip.d.ts +0 -10
- package/lib/tooltip/tooltip.template.d.ts +0 -4
- package/popup/index.js +0 -2087
- package/progress/index.js +0 -98
- package/progress-ring/index.js +0 -76
- package/shared/_has.js +0 -58
- package/shared/affix.js +0 -29
- package/shared/anchor.js +0 -78
- package/shared/apply-mixins.js +0 -22
- package/shared/aria-global.js +0 -156
- package/shared/base-progress.js +0 -65
- package/shared/breadcrumb-item.js +0 -25
- package/shared/class-names.js +0 -15
- package/shared/design-system/index.d.ts +0 -3
- package/shared/es.object.assign.js +0 -68
- package/shared/icon.js +0 -1393
- package/shared/index.js +0 -4991
- package/shared/index2.js +0 -21
- package/shared/patterns/affix.d.ts +0 -9
- package/shared/slotted.js +0 -119
- package/shared/style-inject.es.js +0 -28
- package/shared/text-anchor.js +0 -21
- package/shared/text-anchor.template.js +0 -54
- package/shared/web.dom-collections.iterator.js +0 -1479
- package/shared/when.js +0 -15
- package/side-drawer/index.js +0 -103
- package/sidenav-item/index.js +0 -38
- package/styles/fonts/spezia.css +0 -23
- package/styles/themes/dark.css +0 -193
- package/styles/themes/light.css +0 -193
- package/text/index.js +0 -45
- package/text-anchor/index.js +0 -19
- package/tooltip/index.js +0 -73
package/project.json
ADDED
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
{
|
|
2
|
+
"root": "libs/components",
|
|
3
|
+
"sourceRoot": "libs/components/src",
|
|
4
|
+
"projectType": "library",
|
|
5
|
+
"targets": {
|
|
6
|
+
"e2e": {
|
|
7
|
+
"executor": "@nrwl/workspace:run-commands",
|
|
8
|
+
"options": {
|
|
9
|
+
"commands": ["./scripts/visual-tests/run.tests.in.container.sh {args.task}"],
|
|
10
|
+
"parallel": false
|
|
11
|
+
},
|
|
12
|
+
"configurations": {
|
|
13
|
+
"watch": {
|
|
14
|
+
"commands": [
|
|
15
|
+
{
|
|
16
|
+
"command": "npx nx run components:build --watch"
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
"command":"npx nx run styles:serve"
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
"command":"npx http-server -s"
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"command":"npx -y nodemon --watch dist/libs/components/ --watch dist/libs/styles/ --watch 'libs/components/**/*.test.ts' -e js,css,ts --signal SIGHUP --exec 'npx playwright test -c ./libs/components/playwright.config.dev.ts'"
|
|
26
|
+
}
|
|
27
|
+
],
|
|
28
|
+
"parallel": true
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
"lint": {
|
|
33
|
+
"executor": "@nrwl/linter:eslint",
|
|
34
|
+
"outputs": ["{options.outputFile}"],
|
|
35
|
+
"options": {
|
|
36
|
+
"lintFilePatterns": ["libs/components/**/*.ts"]
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
"test": {
|
|
40
|
+
"executor": "@nrwl/jest:jest",
|
|
41
|
+
"outputs": ["coverage/libs/components"],
|
|
42
|
+
"options": {
|
|
43
|
+
"jestConfig": "libs/components/jest.config.cjs",
|
|
44
|
+
"passWithNoTests": true
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
"build": {
|
|
48
|
+
"executor": "@nrwl/web:rollup",
|
|
49
|
+
"outputs": ["{options.outputPath}"],
|
|
50
|
+
"options": {
|
|
51
|
+
"entryFile": "libs/components/src/index.ts",
|
|
52
|
+
"outputPath": "dist/libs/components",
|
|
53
|
+
"tsConfig": "libs/components/tsconfig.lib.json",
|
|
54
|
+
"project": "libs/components/package.json",
|
|
55
|
+
"rollupConfig": "libs/components/rollup.config.prod.ts",
|
|
56
|
+
"assets": [
|
|
57
|
+
{
|
|
58
|
+
"input": "./libs/components",
|
|
59
|
+
"glob": "README.md",
|
|
60
|
+
"output": "."
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
"input": "./dist/libs/styles/themes/**",
|
|
64
|
+
"glob": "*.css",
|
|
65
|
+
"output": "./styles/themes"
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
"input": "./dist/libs/styles/fonts/**",
|
|
69
|
+
"glob": "*.css",
|
|
70
|
+
"output": "./styles/fonts"
|
|
71
|
+
}
|
|
72
|
+
],
|
|
73
|
+
"buildableProjectDepsInPackageJsonType": "dependencies",
|
|
74
|
+
"updateBuildableProjectDepsInPackageJson": true,
|
|
75
|
+
"format": ["esm"],
|
|
76
|
+
"extractCss": false
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
"serve": {
|
|
80
|
+
"executor": "@nrwl/web:rollup",
|
|
81
|
+
"outputs": ["{options.outputPath}"],
|
|
82
|
+
"options": {
|
|
83
|
+
"entryFile": "libs/components/src/index.ts",
|
|
84
|
+
"outputPath": "dist/libs/components",
|
|
85
|
+
"tsConfig": "libs/components/tsconfig.lib.json",
|
|
86
|
+
"project": "libs/components/package.json",
|
|
87
|
+
"rollupConfig": "libs/components/rollup.config.prod.ts",
|
|
88
|
+
"watch": true,
|
|
89
|
+
"buildableProjectDepsInPackageJsonType": "dependencies",
|
|
90
|
+
"updateBuildableProjectDepsInPackageJson": true,
|
|
91
|
+
"assets": [
|
|
92
|
+
{
|
|
93
|
+
"input": "./libs/components",
|
|
94
|
+
"glob": "README.md",
|
|
95
|
+
"output": "."
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
"input": "./dist/libs/styles/themes/**",
|
|
99
|
+
"glob": "*.css",
|
|
100
|
+
"output": "./styles/themes"
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
"input": "./dist/libs/styles/fonts/**",
|
|
104
|
+
"glob": "*.css",
|
|
105
|
+
"output": "./styles/fonts"
|
|
106
|
+
}
|
|
107
|
+
],
|
|
108
|
+
"format": ["esm"],
|
|
109
|
+
"extractCss": false
|
|
110
|
+
}
|
|
111
|
+
},
|
|
112
|
+
"stylelint": {
|
|
113
|
+
"executor": "nx-stylelint:lint",
|
|
114
|
+
"outputs": ["{options.outputFile}"],
|
|
115
|
+
"options": {
|
|
116
|
+
"lintFilePatterns": ["libs/components/**/*.scss"]
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
},
|
|
120
|
+
"tags": [],
|
|
121
|
+
"implicitDependencies": ["styles"]
|
|
122
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
|
|
2
|
+
const fs = require('fs');
|
|
3
|
+
const path = require('path');
|
|
4
|
+
const replace = require('@rollup/plugin-replace');
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* @param workingFolder
|
|
8
|
+
*/
|
|
9
|
+
function getFoldersInAFolder(workingFolder = './src/lib/') {
|
|
10
|
+
const folders = [];
|
|
11
|
+
const testsFolder = path.join(__dirname, workingFolder);
|
|
12
|
+
fs.readdirSync(testsFolder).forEach((testFolder) => {
|
|
13
|
+
if (testFolder === 'common') return;
|
|
14
|
+
const absolutePath = path.join(testsFolder, testFolder);
|
|
15
|
+
if (fs.statSync(absolutePath).isDirectory()) {
|
|
16
|
+
folders.push(testFolder);
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
return folders;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const components = getFoldersInAFolder();
|
|
23
|
+
const input = components.reduce((inputObject, componentName) => {
|
|
24
|
+
inputObject[`${componentName}/index`] = path.join(
|
|
25
|
+
process.cwd(),
|
|
26
|
+
`libs/components/src/lib/${componentName}/index.ts`
|
|
27
|
+
);
|
|
28
|
+
return inputObject;
|
|
29
|
+
}, {});
|
|
30
|
+
|
|
31
|
+
module.exports = function setVividRollupConfig(config) {
|
|
32
|
+
|
|
33
|
+
input.index = config.input;
|
|
34
|
+
|
|
35
|
+
const output = config.output;
|
|
36
|
+
output.chunkFileNames = 'shared/[name].js';
|
|
37
|
+
delete output.name;
|
|
38
|
+
delete output.entryFileNames;
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
const plugins = [...config.plugins,
|
|
42
|
+
replace({
|
|
43
|
+
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV),
|
|
44
|
+
})];
|
|
45
|
+
return {
|
|
46
|
+
input,
|
|
47
|
+
output,
|
|
48
|
+
plugins
|
|
49
|
+
};
|
|
50
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as jestFetchMock from 'jest-fetch-mock';
|
|
2
|
+
|
|
3
|
+
jestFetchMock.enableFetchMocks();
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(window, 'matchMedia', {
|
|
6
|
+
writable: true,
|
|
7
|
+
value: jest.fn().mockImplementation((query: any) => ({
|
|
8
|
+
matches: false,
|
|
9
|
+
media: query,
|
|
10
|
+
onchange: null,
|
|
11
|
+
addListener: jest.fn(), // deprecated
|
|
12
|
+
removeListener: jest.fn(), // deprecated
|
|
13
|
+
addEventListener: jest.fn(),
|
|
14
|
+
removeEventListener: jest.fn(),
|
|
15
|
+
dispatchEvent: jest.fn(),
|
|
16
|
+
})),
|
|
17
|
+
});
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './lib/components';
|
|
2
|
-
export * from './shared/design-system';
|
|
1
|
+
export * from './lib/components';
|
|
2
|
+
export * from './shared/design-system';
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# accordion
|
|
2
|
+
|
|
3
|
+
```js
|
|
4
|
+
<script type="module">
|
|
5
|
+
import '@vonage/vivid/accordion';
|
|
6
|
+
</script>
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
```html preview
|
|
10
|
+
<vwc-accordion>
|
|
11
|
+
<vwc-accordion-item heading="accordion item with heading">
|
|
12
|
+
<vwc-text>content</vwc-text>
|
|
13
|
+
</vwc-accordion-item>
|
|
14
|
+
<vwc-accordion-item heading="accordion item with heading">
|
|
15
|
+
<vwc-text>content</vwc-text>
|
|
16
|
+
</vwc-accordion-item>
|
|
17
|
+
<vwc-accordion-item heading="accordion item with heading">
|
|
18
|
+
<vwc-text>content</vwc-text>
|
|
19
|
+
</vwc-accordion-item>
|
|
20
|
+
<vwc-accordion-item heading="accordion item with heading">
|
|
21
|
+
<vwc-text>content</vwc-text>
|
|
22
|
+
</vwc-accordion-item>
|
|
23
|
+
</vwc-accordion>
|
|
24
|
+
```
|
|
25
|
+
## Multi
|
|
26
|
+
Add the `multi` attribute to the accordion to allow multiple items to be open at once.
|
|
27
|
+
|
|
28
|
+
- Type: `boolean`
|
|
29
|
+
- Default: `false`
|
|
30
|
+
|
|
31
|
+
```html preview
|
|
32
|
+
<vwc-accordion multi>
|
|
33
|
+
<vwc-accordion-item heading="accordion item with heading">
|
|
34
|
+
<vwc-text>content</vwc-text>
|
|
35
|
+
</vwc-accordion-item>
|
|
36
|
+
<vwc-accordion-item heading="accordion item with heading">
|
|
37
|
+
<vwc-text>content</vwc-text>
|
|
38
|
+
</vwc-accordion-item>
|
|
39
|
+
<vwc-accordion-item heading="accordion item with heading">
|
|
40
|
+
<vwc-text>content</vwc-text>
|
|
41
|
+
</vwc-accordion-item>
|
|
42
|
+
<vwc-accordion-item heading="accordion item with heading">
|
|
43
|
+
<vwc-text>content</vwc-text>
|
|
44
|
+
</vwc-accordion-item>
|
|
45
|
+
</vwc-accordion>
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Methods
|
|
49
|
+
|
|
50
|
+
### CloseAll
|
|
51
|
+
|
|
52
|
+
- Type: function
|
|
53
|
+
- Returns: `void`
|
|
54
|
+
|
|
55
|
+
Closes all the accordion items from the open state.
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
@use '../../../../../node_modules/@vonage/vivid-tokens/dist/sass/themes/consts' as theme-consts;
|
|
2
|
+
|
|
3
|
+
.control {
|
|
4
|
+
display: flex;
|
|
5
|
+
flex-direction: column;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
::slotted(vwc-accordion-item:not(:only-of-type)) {
|
|
9
|
+
border-bottom: 1px solid var(#{theme-consts.$vvd-color-neutral-30});
|
|
10
|
+
}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { elementUpdated, fixture } from '@vivid-nx/shared';
|
|
2
|
+
import type { AccordionItem } from '../accordion-item/accordion-item';
|
|
3
|
+
import { Accordion } from './accordion';
|
|
4
|
+
import '.';
|
|
5
|
+
import '../accordion-item';
|
|
6
|
+
|
|
7
|
+
const COMPONENT_TAG = 'vwc-accordion';
|
|
8
|
+
|
|
9
|
+
describe('vwc-accordion', () => {
|
|
10
|
+
let element: Accordion;
|
|
11
|
+
let accordionItem1: AccordionItem;
|
|
12
|
+
let accordionItem2: AccordionItem;
|
|
13
|
+
|
|
14
|
+
beforeEach(async () => {
|
|
15
|
+
element = (await fixture(
|
|
16
|
+
`<${COMPONENT_TAG}>
|
|
17
|
+
<vwc-accordion-item heading="accordion item" id="item1"><p>content</p></vwc-accordion-item>
|
|
18
|
+
<vwc-accordion-item heading="accordion item" id="item2"><p>content</p></vwc-accordion-item>
|
|
19
|
+
</${COMPONENT_TAG}>`
|
|
20
|
+
)) as Accordion;
|
|
21
|
+
await elementUpdated(element);
|
|
22
|
+
|
|
23
|
+
accordionItem1 = element.querySelector('#item1') as AccordionItem;
|
|
24
|
+
accordionItem2 = element.querySelector('#item2') as AccordionItem;
|
|
25
|
+
await elementUpdated(accordionItem1);
|
|
26
|
+
await elementUpdated(accordionItem2);
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
describe('basic', () => {
|
|
30
|
+
it('should be initialized as a vwc-accordion', async () => {
|
|
31
|
+
expect(element).toBeInstanceOf(Accordion);
|
|
32
|
+
expect(element.multi).toBeFalsy();
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
describe('non multi', () => {
|
|
37
|
+
it('should only allow one accordion items open at a time', async () => {
|
|
38
|
+
expect(accordionItem1.open).toBeFalsy();
|
|
39
|
+
expect(accordionItem2.open).toBeFalsy();
|
|
40
|
+
|
|
41
|
+
accordionItem1.open = true;
|
|
42
|
+
await elementUpdated(element);
|
|
43
|
+
accordionItem2.open = true;
|
|
44
|
+
await elementUpdated(element);
|
|
45
|
+
|
|
46
|
+
expect(accordionItem1.open).toBeFalsy();
|
|
47
|
+
expect(accordionItem2.open).toBeTruthy();
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
describe('multi', () => {
|
|
52
|
+
it('should allow all accordion items open when multi', async () => {
|
|
53
|
+
element.multi = true;
|
|
54
|
+
await elementUpdated(element);
|
|
55
|
+
|
|
56
|
+
expect(accordionItem1.open).toBeFalsy();
|
|
57
|
+
expect(accordionItem2.open).toBeFalsy();
|
|
58
|
+
|
|
59
|
+
accordionItem1.open = true;
|
|
60
|
+
await elementUpdated(element);
|
|
61
|
+
accordionItem2.open = true;
|
|
62
|
+
await elementUpdated(element);
|
|
63
|
+
|
|
64
|
+
expect(accordionItem1.open).toBeTruthy();
|
|
65
|
+
expect(accordionItem2.open).toBeTruthy();
|
|
66
|
+
});
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
describe('close all', () => {
|
|
71
|
+
it('should close all accordion items', async () => {
|
|
72
|
+
element.multi = true;
|
|
73
|
+
await elementUpdated(element);
|
|
74
|
+
|
|
75
|
+
accordionItem1.open = true;
|
|
76
|
+
await elementUpdated(element);
|
|
77
|
+
accordionItem2.open = true;
|
|
78
|
+
await elementUpdated(element);
|
|
79
|
+
|
|
80
|
+
expect(accordionItem1.open).toBeTruthy();
|
|
81
|
+
expect(accordionItem2.open).toBeTruthy();
|
|
82
|
+
|
|
83
|
+
element.closeAll();
|
|
84
|
+
await elementUpdated(element);
|
|
85
|
+
|
|
86
|
+
expect(accordionItem1.open).toBeFalsy();
|
|
87
|
+
expect(accordionItem2.open).toBeFalsy();
|
|
88
|
+
});
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
});
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { html } from '@microsoft/fast-element';
|
|
2
|
+
import type { ViewTemplate } from '@microsoft/fast-element';
|
|
3
|
+
import type {
|
|
4
|
+
ElementDefinitionContext,
|
|
5
|
+
FoundationElementDefinition,
|
|
6
|
+
} from '@microsoft/fast-foundation';
|
|
7
|
+
import { classNames } from '@microsoft/fast-web-utilities';
|
|
8
|
+
import type { Accordion } from './accordion';
|
|
9
|
+
|
|
10
|
+
const getClasses = (_: Accordion) => classNames('control');
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
*
|
|
14
|
+
* @param context
|
|
15
|
+
* @public
|
|
16
|
+
*/
|
|
17
|
+
export const AccordionTemplate: (
|
|
18
|
+
context: ElementDefinitionContext,
|
|
19
|
+
definition: FoundationElementDefinition
|
|
20
|
+
) => ViewTemplate<Accordion> = (
|
|
21
|
+
) => html`<div class="${getClasses}">
|
|
22
|
+
<slot></slot>
|
|
23
|
+
</div>`;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { FoundationElement } from '@microsoft/fast-foundation';
|
|
2
|
+
import { attr } from '@microsoft/fast-element';
|
|
3
|
+
import type { AccordionItem } from '../accordion-item/accordion-item';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Base class for accordion
|
|
7
|
+
*
|
|
8
|
+
* @public
|
|
9
|
+
*/
|
|
10
|
+
export class Accordion extends FoundationElement {
|
|
11
|
+
private accordionItems: HTMLCollectionOf<AccordionItem> | undefined = undefined;
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
*
|
|
15
|
+
* @public
|
|
16
|
+
* HTML Attribute: multi
|
|
17
|
+
*/
|
|
18
|
+
@attr({
|
|
19
|
+
mode: 'boolean',
|
|
20
|
+
}) multi = false;
|
|
21
|
+
|
|
22
|
+
constructor() {
|
|
23
|
+
super();
|
|
24
|
+
this.addEventListener('opened', this.handleOpened);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
override connectedCallback(): void {
|
|
28
|
+
super.connectedCallback();
|
|
29
|
+
this.accordionItems = this.children as HTMLCollectionOf<AccordionItem>;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
private handleOpened(e: Event): any {
|
|
33
|
+
if (!this.multi && this.accordionItems) {
|
|
34
|
+
for (let i = 0; i < this.accordionItems.length; i++) {
|
|
35
|
+
if (this.accordionItems[i] !== e.target) {
|
|
36
|
+
this.accordionItems[i].open = false;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
closeAll(): void {
|
|
43
|
+
if (this.accordionItems) {
|
|
44
|
+
for (let i = 0; i < this.accordionItems.length; i++) {
|
|
45
|
+
this.accordionItems[i].open = false;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { FoundationElementDefinition } from '@microsoft/fast-foundation';
|
|
2
|
+
import { designSystem } from '../../shared/design-system';
|
|
3
|
+
import styles from './accordion.scss';
|
|
4
|
+
|
|
5
|
+
import { Accordion } from './accordion';
|
|
6
|
+
import { AccordionTemplate as template } from './accordion.template';
|
|
7
|
+
|
|
8
|
+
export const vividAccordion = Accordion.compose<FoundationElementDefinition>({
|
|
9
|
+
baseName: 'accordion',
|
|
10
|
+
template: template as any,
|
|
11
|
+
styles,
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
designSystem.register(vividAccordion());
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import * as path from 'path';
|
|
2
|
+
import { expect, test } from '@playwright/test';
|
|
3
|
+
import type { Page } from '@playwright/test';
|
|
4
|
+
import {
|
|
5
|
+
extractHTMLBlocksFromReadme,
|
|
6
|
+
loadComponents,
|
|
7
|
+
loadTemplate,
|
|
8
|
+
} from '../../visual-tests/visual-tests-utils.ts';
|
|
9
|
+
|
|
10
|
+
const components = ['accordion','accordion-item'];
|
|
11
|
+
|
|
12
|
+
test('should show the component', async ({ page }: { page: Page }) => {
|
|
13
|
+
const template = extractHTMLBlocksFromReadme(
|
|
14
|
+
path.join(new URL('.', import.meta.url).pathname, 'README.md')
|
|
15
|
+
).reduce(
|
|
16
|
+
(htmlString: string, block: string) =>
|
|
17
|
+
`${htmlString} <div style="margin: 5px;">${block}</div>`,
|
|
18
|
+
''
|
|
19
|
+
);
|
|
20
|
+
|
|
21
|
+
await loadComponents({
|
|
22
|
+
page,
|
|
23
|
+
components,
|
|
24
|
+
});
|
|
25
|
+
await loadTemplate({
|
|
26
|
+
page,
|
|
27
|
+
template,
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
const testWrapper = await page.$('#wrapper');
|
|
31
|
+
|
|
32
|
+
await page.waitForLoadState('networkidle');
|
|
33
|
+
|
|
34
|
+
expect(await testWrapper?.screenshot()).toMatchSnapshot(
|
|
35
|
+
'./snapshots/accordion.png'
|
|
36
|
+
);
|
|
37
|
+
});
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
# accordion-item
|
|
2
|
+
|
|
3
|
+
```js
|
|
4
|
+
<script type="module">
|
|
5
|
+
import '@vonage/vivid/accordion-item';
|
|
6
|
+
</script>
|
|
7
|
+
```
|
|
8
|
+
## Heading
|
|
9
|
+
Add the `heading` attribute to set the heading text.
|
|
10
|
+
|
|
11
|
+
- Type: `string`
|
|
12
|
+
- Default: `''`
|
|
13
|
+
|
|
14
|
+
```html preview
|
|
15
|
+
<vwc-accordion-item heading="accordion item with heading">
|
|
16
|
+
<vwc-text font-face="body-1">
|
|
17
|
+
Lorem Ipsum is simply dummy text of the printing and typesetting industry.
|
|
18
|
+
</vwc-text>
|
|
19
|
+
</vwc-accordion-item>
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Heading-Level
|
|
23
|
+
|
|
24
|
+
Use the `heading-level` attribute (or `headingLevel` property) to set the accordion heading level so it fits correctly within the outline of the page. Read more on [heading elements](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/Heading_Elements).
|
|
25
|
+
|
|
26
|
+
- Type: `2` | `3` | `4` | `5` | `6`
|
|
27
|
+
- Default: `3`
|
|
28
|
+
|
|
29
|
+
The following sets the heading of accordion-item to level 2
|
|
30
|
+
|
|
31
|
+
```
|
|
32
|
+
<vwc-accordion-item heading="my heading" heading-level="2"></vwc-accordion-item>
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
which will output the shadow tree heading element to be rendered as a `<h2>` tag
|
|
36
|
+
|
|
37
|
+
e.g.
|
|
38
|
+
|
|
39
|
+
```
|
|
40
|
+
<h2 class="header">
|
|
41
|
+
<button>
|
|
42
|
+
<!-- ... -->
|
|
43
|
+
</button>
|
|
44
|
+
</h2>
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Open
|
|
48
|
+
Use the `open` attribute to set the accordion-item's open state.
|
|
49
|
+
|
|
50
|
+
- Type: `boolean`
|
|
51
|
+
- Default: `false`
|
|
52
|
+
|
|
53
|
+
```html preview
|
|
54
|
+
<vwc-accordion-item heading="Click to toggle accordion item" open>
|
|
55
|
+
<vwc-text font-face="body-1">
|
|
56
|
+
Lorem Ipsum is simply dummy text of the printing and typesetting industry.
|
|
57
|
+
</vwc-text>
|
|
58
|
+
</vwc-accordion-item>
|
|
59
|
+
```
|
|
60
|
+
## No-Indicator
|
|
61
|
+
Add the `no-indicator` attribute (or `noIndicator` property) to remove the indicator icon from the heading.
|
|
62
|
+
|
|
63
|
+
- Type: `boolean`
|
|
64
|
+
- Default: `false`
|
|
65
|
+
|
|
66
|
+
```html preview
|
|
67
|
+
<vwc-accordion-item heading="accordion item without indicator" no-indicator>
|
|
68
|
+
<vwc-text font-face="body-1">
|
|
69
|
+
Lorem Ipsum is simply dummy text of the printing and typesetting industry.
|
|
70
|
+
</vwc-text>
|
|
71
|
+
</vwc-accordion-item>
|
|
72
|
+
```
|
|
73
|
+
## Meta
|
|
74
|
+
Add the `meta` attribute to add metadata to the heading.
|
|
75
|
+
|
|
76
|
+
- Type: `string`
|
|
77
|
+
- Default: `''`
|
|
78
|
+
|
|
79
|
+
```html preview
|
|
80
|
+
<vwc-accordion-item heading="accordion item with metadata" meta="meta-data">
|
|
81
|
+
<vwc-text font-face="body-1">
|
|
82
|
+
Lorem Ipsum is simply dummy text of the printing and typesetting industry.
|
|
83
|
+
</vwc-text>
|
|
84
|
+
</vwc-accordion-item>
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## Icon
|
|
88
|
+
Add the `icon` attribute to add an icon to the heading.
|
|
89
|
+
|
|
90
|
+
- Type: `string`
|
|
91
|
+
- Default: `''`
|
|
92
|
+
|
|
93
|
+
```html preview
|
|
94
|
+
<vwc-accordion-item heading="accordion item with icon" icon="chat-solid">
|
|
95
|
+
<vwc-text font-face="body-1">
|
|
96
|
+
Lorem Ipsum is simply dummy text of the printing and typesetting industry.
|
|
97
|
+
</vwc-text>
|
|
98
|
+
</vwc-accordion-item>
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
## Icon-Trailing
|
|
102
|
+
Add the `icon-trailing` attribute (or `iconTrailing` property) to add an icon to the right of the heading text. Mind that `icon-trailing` will override the Indicator.
|
|
103
|
+
|
|
104
|
+
- Type: `boolean`
|
|
105
|
+
- Default: `false`
|
|
106
|
+
|
|
107
|
+
```html preview
|
|
108
|
+
<vwc-accordion-item heading="accordion item with icon-trailing" icon="chat-solid" icon-trailing>
|
|
109
|
+
<vwc-text font-face="body-1">
|
|
110
|
+
Lorem Ipsum is simply dummy text of the printing and typesetting industry.
|
|
111
|
+
</vwc-text>
|
|
112
|
+
</vwc-accordion-item>
|
|
113
|
+
```
|