@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
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
@use 'partials/variables' as variables;
|
|
2
|
+
@use '../../../../shared/src/lib/sass/mixins/typography' as typography;
|
|
3
|
+
@use '../../../../../node_modules/@vonage/vivid-tokens/dist/sass/themes/consts' as theme-consts;
|
|
4
|
+
|
|
5
|
+
.body {
|
|
6
|
+
@include typography.typography-cat-shorthand('body-2');
|
|
7
|
+
|
|
8
|
+
padding: 8px 32px 24px 16px;
|
|
9
|
+
.icon:not(.icon-trailing) &{
|
|
10
|
+
padding-left: 48px;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.control {
|
|
15
|
+
display: flex;
|
|
16
|
+
flex-direction: column;
|
|
17
|
+
|
|
18
|
+
&:not(.open) {
|
|
19
|
+
.toggle-close,
|
|
20
|
+
.body {
|
|
21
|
+
display: none;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
&.open{
|
|
25
|
+
.toggle-open {
|
|
26
|
+
display: none;
|
|
27
|
+
}
|
|
28
|
+
.toggle-close {
|
|
29
|
+
display: initial;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.header {
|
|
35
|
+
padding: 0;
|
|
36
|
+
margin: 0;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.button {
|
|
40
|
+
@include typography.typography-cat-shorthand('subtitle-2');
|
|
41
|
+
|
|
42
|
+
position: relative;
|
|
43
|
+
display: flex;
|
|
44
|
+
width: 100%;
|
|
45
|
+
align-items: center;
|
|
46
|
+
padding: 16px;
|
|
47
|
+
border: 0 none;
|
|
48
|
+
background: transparent;
|
|
49
|
+
cursor: pointer;
|
|
50
|
+
|
|
51
|
+
&:hover {
|
|
52
|
+
background: var(#{theme-consts.$vvd-color-neutral-10});
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.heading-text {
|
|
56
|
+
flex-grow: 1;
|
|
57
|
+
margin-inline-end: auto;
|
|
58
|
+
text-align: left;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.meta {
|
|
62
|
+
@include typography.typography-cat-shorthand('body-2-bold');
|
|
63
|
+
|
|
64
|
+
overflow: hidden;
|
|
65
|
+
max-width: 20%;
|
|
66
|
+
flex-shrink: 0;
|
|
67
|
+
color: var(#{theme-consts.$vvd-color-neutral-70});
|
|
68
|
+
margin-inline-start: 1rem;
|
|
69
|
+
text-align: end;
|
|
70
|
+
text-overflow: ellipsis;
|
|
71
|
+
white-space: nowrap;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.indicator {
|
|
75
|
+
display: flex;
|
|
76
|
+
vwc-icon,
|
|
77
|
+
slot[name="indicator"i]::slotted(vwc-icon) {
|
|
78
|
+
margin-inline-start: 16px;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.icon {
|
|
83
|
+
margin-inline-end: 16px;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/* Icon */
|
|
88
|
+
|
|
89
|
+
.icon-trailing .icon {
|
|
90
|
+
order: 1;
|
|
91
|
+
}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { elementUpdated, fixture, getControlElement } from '@vivid-nx/shared';
|
|
2
|
+
import { AccordionItem } from './accordion-item';
|
|
3
|
+
import '.';
|
|
4
|
+
|
|
5
|
+
const COMPONENT_TAG = 'vwc-accordion-item';
|
|
6
|
+
|
|
7
|
+
describe('vwc-accordion-item', () => {
|
|
8
|
+
let element: AccordionItem;
|
|
9
|
+
|
|
10
|
+
beforeEach(async () => {
|
|
11
|
+
element = (await fixture(
|
|
12
|
+
`<${COMPONENT_TAG}></${COMPONENT_TAG}>`
|
|
13
|
+
)) as AccordionItem;
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
describe('basic', () => {
|
|
17
|
+
it('should be initialized as a vwc-accordion-item', async () => {
|
|
18
|
+
expect(element).toBeInstanceOf(AccordionItem);
|
|
19
|
+
expect(element.open).toBeFalsy();
|
|
20
|
+
expect(element.icon).toBeUndefined();
|
|
21
|
+
expect(element.iconTrailing).toBeFalsy();
|
|
22
|
+
expect(element.meta).toEqual('');
|
|
23
|
+
expect(element.noIndicator).toBeFalsy();
|
|
24
|
+
expect(element.heading).toEqual('');
|
|
25
|
+
expect(element.headingLevel).toBeUndefined();
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
describe('show', () => {
|
|
30
|
+
it('should set "open" to true and add "open" class', async () => {
|
|
31
|
+
expect(getControlElement(element).classList.contains('open')).toBeFalsy();
|
|
32
|
+
|
|
33
|
+
element.open = true;
|
|
34
|
+
await elementUpdated(element);
|
|
35
|
+
expect(element.open).toBeTruthy();
|
|
36
|
+
expect(getControlElement(element).classList.contains('open')).toBeTruthy();
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
describe('hide', () => {
|
|
41
|
+
it('should unset "open"', async () => {
|
|
42
|
+
element.open = true;
|
|
43
|
+
await elementUpdated(element);
|
|
44
|
+
expect(getControlElement(element).classList.contains('open')).toBeTruthy();
|
|
45
|
+
|
|
46
|
+
element.open = false;
|
|
47
|
+
await elementUpdated(element);
|
|
48
|
+
expect(element.open).toBeFalsy();
|
|
49
|
+
expect(getControlElement(element).classList.contains('open')).toBeFalsy();
|
|
50
|
+
});
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
describe('toggle', () => {
|
|
54
|
+
it('should toggle "open" state', async () => {
|
|
55
|
+
const button: any = element.shadowRoot?.querySelector('.button');
|
|
56
|
+
expect(getControlElement(element).classList.contains('open')).toBeFalsy();
|
|
57
|
+
|
|
58
|
+
button.click();
|
|
59
|
+
await elementUpdated(element);
|
|
60
|
+
expect(element.open).toBeTruthy();
|
|
61
|
+
expect(getControlElement(element).classList.contains('open')).toBeTruthy();
|
|
62
|
+
|
|
63
|
+
button.click();
|
|
64
|
+
await elementUpdated(element);
|
|
65
|
+
expect(element.open).toBeFalsy();
|
|
66
|
+
expect(getControlElement(element).classList.contains('open')).toBeFalsy();
|
|
67
|
+
});
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
describe('icon', () => {
|
|
71
|
+
it('should set icon class', async () => {
|
|
72
|
+
expect(getControlElement(element).classList.contains('icon')).toBeFalsy();
|
|
73
|
+
element.icon = 'chat-solid';
|
|
74
|
+
await elementUpdated(element);
|
|
75
|
+
expect(getControlElement(element).classList.contains('icon')).toBeTruthy();
|
|
76
|
+
});
|
|
77
|
+
it('should set iconTrailing', async () => {
|
|
78
|
+
expect(getControlElement(element).classList.contains('icon-trailing')).toBeFalsy();
|
|
79
|
+
element.icon = 'chat-solid';
|
|
80
|
+
element.iconTrailing = true;
|
|
81
|
+
await elementUpdated(element);
|
|
82
|
+
expect(getControlElement(element).classList.contains('icon-trailing')).toBeTruthy();
|
|
83
|
+
});
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
describe('no-indicator', () => {
|
|
87
|
+
it('should remove indicator class', async () => {
|
|
88
|
+
expect(getControlElement(element).classList.contains('no-indicator')).toBeFalsy();
|
|
89
|
+
element.noIndicator = true;
|
|
90
|
+
await elementUpdated(element);
|
|
91
|
+
expect(getControlElement(element).classList.contains('no-indicator')).toBeTruthy();
|
|
92
|
+
});
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
describe('heading level', () => {
|
|
96
|
+
it('should update heading level', async () => {
|
|
97
|
+
expect(element.shadowRoot?.querySelector('.header')?.tagName).toEqual('H3');
|
|
98
|
+
element.headingLevel = 4;
|
|
99
|
+
await elementUpdated(element);
|
|
100
|
+
expect(element.shadowRoot?.querySelector('.header')?.tagName).toEqual('H4');
|
|
101
|
+
});
|
|
102
|
+
});
|
|
103
|
+
});
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { html, when } 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 { affixIconTemplateFactory } from '../../shared/patterns/affix';
|
|
9
|
+
import type { AccordionItem } from './accordion-item';
|
|
10
|
+
|
|
11
|
+
const PANEL = 'panel';
|
|
12
|
+
|
|
13
|
+
const getClasses = ({
|
|
14
|
+
open, iconTrailing, icon, noIndicator
|
|
15
|
+
}: AccordionItem) => classNames(
|
|
16
|
+
'control',
|
|
17
|
+
['open', open],
|
|
18
|
+
['icon', Boolean(icon)],
|
|
19
|
+
['icon-trailing', iconTrailing],
|
|
20
|
+
['no-indicator', noIndicator],
|
|
21
|
+
);
|
|
22
|
+
|
|
23
|
+
export const AccordionItemTemplate: (
|
|
24
|
+
context: ElementDefinitionContext,
|
|
25
|
+
definition: FoundationElementDefinition
|
|
26
|
+
) => ViewTemplate<AccordionItem> = (context) => html<AccordionItem>`
|
|
27
|
+
<div class="${getClasses}">
|
|
28
|
+
${x => renderPanelHeader(context, x.headingLevel)}
|
|
29
|
+
<div class="body" id="${PANEL}" role="region" aria-labelledby="header">
|
|
30
|
+
<slot></slot>
|
|
31
|
+
</div>
|
|
32
|
+
</div>
|
|
33
|
+
`;
|
|
34
|
+
|
|
35
|
+
const renderPanelHeader = (context: ElementDefinitionContext, headingLevel: number | string | undefined) => {
|
|
36
|
+
const header: string = headingLevel ? 'h' + headingLevel : 'h3';
|
|
37
|
+
return html<AccordionItem>`
|
|
38
|
+
<${header} class="header">
|
|
39
|
+
${renderHeaderButton(context)}
|
|
40
|
+
</${header}>
|
|
41
|
+
`;
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
const renderHeaderButton = (context: ElementDefinitionContext) => {
|
|
45
|
+
const affixIconTemplate = affixIconTemplateFactory(context);
|
|
46
|
+
|
|
47
|
+
return html<AccordionItem>`
|
|
48
|
+
<button class="button" id="header" @click=${x => x.open = !x.open}
|
|
49
|
+
?aria-expanded=${x => x.open}
|
|
50
|
+
aria-controls="${PANEL}">
|
|
51
|
+
${x => affixIconTemplate(x.icon)}
|
|
52
|
+
<span class="heading-text">${x => x.heading}</span>
|
|
53
|
+
${when(x => x.meta, html`<span class="meta">${x => x.meta}</span>`)}
|
|
54
|
+
<span class="indicator">
|
|
55
|
+
${when(x => !x.noIndicator && !x.iconTrailing, html`
|
|
56
|
+
<vwc-icon class="toggle-open" type='chevron-down-solid'></vwc-icon>
|
|
57
|
+
<vwc-icon class="toggle-close" type='chevron-up-solid'></vwc-icon>
|
|
58
|
+
`)}
|
|
59
|
+
</span>
|
|
60
|
+
</button>
|
|
61
|
+
`;
|
|
62
|
+
};
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { FoundationElement } from '@microsoft/fast-foundation';
|
|
2
|
+
import { applyMixins } from '@microsoft/fast-foundation';
|
|
3
|
+
import { attr } from '@microsoft/fast-element';
|
|
4
|
+
import { AffixIconWithTrailing } from '../../shared/patterns/affix';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Base class for accordion-item
|
|
8
|
+
*
|
|
9
|
+
* @public
|
|
10
|
+
*/
|
|
11
|
+
export class AccordionItem extends FoundationElement {
|
|
12
|
+
/**
|
|
13
|
+
*
|
|
14
|
+
*
|
|
15
|
+
* @public
|
|
16
|
+
*
|
|
17
|
+
* HTML Attribute: heading
|
|
18
|
+
*/
|
|
19
|
+
@attr({ mode: 'fromView' }) heading = '';
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
*
|
|
23
|
+
* @public
|
|
24
|
+
* HTML Attribute: heading-level
|
|
25
|
+
*/
|
|
26
|
+
@attr({ attribute: 'heading-level'}) headingLevel?: 2 | 3 | 4 | 5 | 6;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Indicates whether the accordion-item has indicator
|
|
30
|
+
*
|
|
31
|
+
* @public
|
|
32
|
+
* HTML Attribute: no-indicator
|
|
33
|
+
*/
|
|
34
|
+
@attr({ mode: 'boolean', attribute: 'no-indicator' }) noIndicator = false;
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
*
|
|
38
|
+
* @public
|
|
39
|
+
*
|
|
40
|
+
* HTML Attribute: meta
|
|
41
|
+
*/
|
|
42
|
+
@attr({ mode: 'fromView' }) meta = '';
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Indicates whether the accordion-item is open
|
|
46
|
+
*
|
|
47
|
+
* @public
|
|
48
|
+
* HTML Attribute: open
|
|
49
|
+
*/
|
|
50
|
+
@attr({ mode: 'boolean' }) open = false;
|
|
51
|
+
|
|
52
|
+
override attributeChangedCallback(name: string, oldValue: string, newValue: string): void{
|
|
53
|
+
super.attributeChangedCallback(name, oldValue, newValue);
|
|
54
|
+
if (name === 'open') {
|
|
55
|
+
newValue === null ? this.emitEvent('closed') : this.emitEvent('opened');
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
private emitEvent(name: string): void {
|
|
60
|
+
const init: CustomEventInit = { bubbles: true, composed: true };
|
|
61
|
+
const ev = new CustomEvent(name, init);
|
|
62
|
+
this.dispatchEvent(ev);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export interface AccordionItem extends AffixIconWithTrailing {}
|
|
67
|
+
applyMixins(AccordionItem, AffixIconWithTrailing);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { FoundationElementDefinition } from '@microsoft/fast-foundation';
|
|
2
|
+
import { designSystem } from '../../shared/design-system';
|
|
3
|
+
import styles from './accordion-item.scss';
|
|
4
|
+
|
|
5
|
+
import { AccordionItem } from './accordion-item';
|
|
6
|
+
import { AccordionItemTemplate as template } from './accordion-item.template';
|
|
7
|
+
import '../icon';
|
|
8
|
+
|
|
9
|
+
export const vividAccordionItem =
|
|
10
|
+
AccordionItem.compose<FoundationElementDefinition>({
|
|
11
|
+
baseName: 'accordion-item', template: template as any, styles,
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
designSystem.register(vividAccordionItem());
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
$expansion-panel-icon-size-variable-name: --vvd-expansion-panel-icon-size;
|
|
@@ -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-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-item.png'
|
|
36
|
+
);
|
|
37
|
+
});
|
|
Binary file
|
package/src/lib/accordion-item/ui.test.ts-snapshots/snapshots-accordion-item-Chrome-Stable-linux.png
ADDED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
# badge
|
|
2
|
+
|
|
3
|
+
Badge is a label that holds small amounts of information.
|
|
4
|
+
A badge can be used to display unread notifications, or to label a block of text.
|
|
5
|
+
Badges don’t work for navigation because they can't include a hyperlink.
|
|
6
|
+
|
|
7
|
+
```js
|
|
8
|
+
<script type='module'>
|
|
9
|
+
import '@vonage/vivid/badge';
|
|
10
|
+
</script>
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Text
|
|
14
|
+
|
|
15
|
+
- Type: `String`
|
|
16
|
+
- Default: `''`
|
|
17
|
+
|
|
18
|
+
Add a `text` attribute to add text to the badge.
|
|
19
|
+
|
|
20
|
+
```html preview
|
|
21
|
+
<vwc-badge text='A default badge'></vwc-badge>
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Size
|
|
25
|
+
|
|
26
|
+
Use the `size` attribute to change the badge's size.
|
|
27
|
+
|
|
28
|
+
- Type: `'base-small'` | `'base'` | `'base-large'`
|
|
29
|
+
- Default: `'base'`
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
```html preview
|
|
33
|
+
<vwc-badge text='base-small' size='base-small'></vwc-badge>
|
|
34
|
+
<vwc-badge text='base' size='base'></vwc-badge>
|
|
35
|
+
<vwc-badge text='base-large' size='base-large'></vwc-badge>
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Shape
|
|
39
|
+
|
|
40
|
+
Use the `shape` attribute to change the badge's edges.
|
|
41
|
+
|
|
42
|
+
- Type: `'rounded'` | `'pill'`
|
|
43
|
+
- Default: `'rounded'`
|
|
44
|
+
|
|
45
|
+
```html preview
|
|
46
|
+
<vwc-badge text='rounded' shape='rounded'></vwc-badge>
|
|
47
|
+
<vwc-badge text='pill' shape='pill'></vwc-badge>
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Icon
|
|
51
|
+
|
|
52
|
+
Badge text can be affixed by a decorative icon, either by its start or end.
|
|
53
|
+
Use the `icon` attribute to add an icon. Use the `icon-trailing` to place the icon to the right.
|
|
54
|
+
|
|
55
|
+
```html preview
|
|
56
|
+
<vwc-badge text='icon' icon='check-line'></vwc-badge>
|
|
57
|
+
<vwc-badge text='icon-trailing' icon='check-line' icon-trailing></vwc-badge>
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Appearance
|
|
61
|
+
|
|
62
|
+
Set the `appearance` attribute to change the badge's appearance.
|
|
63
|
+
|
|
64
|
+
- Type: `'filled'` | `'subtle'` | `'outlined'`
|
|
65
|
+
- Default: `'filled'`
|
|
66
|
+
|
|
67
|
+
```html preview
|
|
68
|
+
<vwc-badge text='filled' appearance='filled'></vwc-badge>
|
|
69
|
+
<vwc-badge text='subtle' appearance='subtle'></vwc-badge>
|
|
70
|
+
<vwc-badge text='outlined' appearance='outlined'></vwc-badge>
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## Connotation
|
|
74
|
+
|
|
75
|
+
Set the `connotation` attribute to change the badge's connotation.
|
|
76
|
+
It accepts a subset of predefined values.
|
|
77
|
+
|
|
78
|
+
- Type: `'primary'` | `'cta'` | `'success'` | `'alert'` | `'warning'` | `'info'`
|
|
79
|
+
- Default: `'primary'`
|
|
80
|
+
|
|
81
|
+
### Filled badge with connotation
|
|
82
|
+
|
|
83
|
+
```html preview
|
|
84
|
+
<vwc-badge text='primary' connotation='primary' appearance="filled"></vwc-badge>
|
|
85
|
+
<vwc-badge text='cta' connotation='cta' appearance="filled"></vwc-badge>
|
|
86
|
+
<vwc-badge text='info' connotation='info' appearance="filled"></vwc-badge>
|
|
87
|
+
<vwc-badge text='success' connotation='success'></vwc-badge>
|
|
88
|
+
<vwc-badge text='warning' connotation='warning'></vwc-badge>
|
|
89
|
+
<vwc-badge text='alert' connotation='alert'></vwc-badge>
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### Subtle badge with connotation
|
|
93
|
+
|
|
94
|
+
```html preview
|
|
95
|
+
<vwc-badge text='primary' appearance='subtle' connotation='primary'></vwc-badge>
|
|
96
|
+
<vwc-badge text='cta' appearance='subtle' connotation='cta'></vwc-badge>
|
|
97
|
+
<vwc-badge text='info' appearance='subtle' connotation='info'></vwc-badge>
|
|
98
|
+
<vwc-badge text='success' appearance='subtle' connotation='success'></vwc-badge>
|
|
99
|
+
<vwc-badge text='warning' appearance='subtle' connotation='warning'></vwc-badge>
|
|
100
|
+
<vwc-badge text='alert' appearance='subtle' connotation='alert'></vwc-badge>
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
### Outlined badge with connotation
|
|
104
|
+
|
|
105
|
+
```html preview
|
|
106
|
+
<vwc-badge text='primary' appearance='outlined' connotation='primary'></vwc-badge>
|
|
107
|
+
<vwc-badge text='cta' appearance='outlined' connotation='cta'></vwc-badge>
|
|
108
|
+
<vwc-badge text='info' appearance='outlined' connotation='info'></vwc-badge>
|
|
109
|
+
<vwc-badge text='success' appearance='outlined' connotation='success'></vwc-badge>
|
|
110
|
+
<vwc-badge text='warning' appearance='outlined' connotation='warning'></vwc-badge>
|
|
111
|
+
<vwc-badge text='alert' appearance='outlined' connotation='alert'></vwc-badge>
|
|
112
|
+
```
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
@use '../../../../shared/src/lib/sass/mixins/typography' as typography;
|
|
2
|
+
|
|
3
|
+
@use '../../../../shared/src/lib/sass/mixins/connotation/config' with (
|
|
4
|
+
$subset: primary cta success alert warning info,
|
|
5
|
+
$shades: soft contrast,
|
|
6
|
+
$default: primary,
|
|
7
|
+
);
|
|
8
|
+
@use '../../../../shared/src/lib/sass/mixins/connotation' as connotation;
|
|
9
|
+
|
|
10
|
+
@use '../../../../shared/src/lib/sass/mixins/appearance/config' as appearance-config with (
|
|
11
|
+
$appearances: filled outlined subtle,
|
|
12
|
+
$states: idle,
|
|
13
|
+
$outline-duotone: true,
|
|
14
|
+
$default: filled,
|
|
15
|
+
);
|
|
16
|
+
@use '../../../../shared/src/lib/sass/mixins/appearance' as appearance;
|
|
17
|
+
|
|
18
|
+
.control {
|
|
19
|
+
@include typography.typography-cat-shorthand('caption-bold');
|
|
20
|
+
@include connotation.connotation;
|
|
21
|
+
@include appearance.appearance;
|
|
22
|
+
|
|
23
|
+
display: inline-flex;
|
|
24
|
+
box-sizing: border-box;
|
|
25
|
+
align-items: center;
|
|
26
|
+
background-color: var(#{appearance.get-variable(fill)});
|
|
27
|
+
box-shadow: inset 0 0 0 1px var(#{appearance.get-variable(outline)});
|
|
28
|
+
color: var(#{appearance.get-variable(text)});
|
|
29
|
+
column-gap: 8px;
|
|
30
|
+
vertical-align: middle;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/* Size */
|
|
34
|
+
|
|
35
|
+
.control:not(.size-base-small):not(.size-base-large) {
|
|
36
|
+
block-size: 24px;
|
|
37
|
+
padding-inline: 10px;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.control.size-base-small {
|
|
41
|
+
block-size: 20px;
|
|
42
|
+
padding-inline: 8px;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.control.size-base-large {
|
|
46
|
+
block-size: 28px;
|
|
47
|
+
padding-inline: 12px;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/* Shape */
|
|
51
|
+
|
|
52
|
+
// stylelint-disable-next-line no-descending-specificity
|
|
53
|
+
.control:not(.shape-pill) {
|
|
54
|
+
border-radius: 4px;
|
|
55
|
+
}
|
|
56
|
+
.control.shape-pill {
|
|
57
|
+
border-radius: 14px;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/* Icon */
|
|
61
|
+
|
|
62
|
+
.icon-trailing .icon {
|
|
63
|
+
order: 1;
|
|
64
|
+
}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { elementUpdated, fixture } from '@vivid-nx/shared';
|
|
2
|
+
import {Icon} from '../icon/icon';
|
|
3
|
+
import {Badge} from './badge';
|
|
4
|
+
import '.';
|
|
5
|
+
|
|
6
|
+
const COMPONENT_TAG = 'vwc-badge';
|
|
7
|
+
const ICON_SELECTOR = 'vwc-icon';
|
|
8
|
+
|
|
9
|
+
describe('vwc-badge', () => {
|
|
10
|
+
let element: Badge;
|
|
11
|
+
|
|
12
|
+
beforeEach(async () => {
|
|
13
|
+
element = await fixture(`<${COMPONENT_TAG}></${COMPONENT_TAG}>`) as Badge;
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
describe('basic', () => {
|
|
17
|
+
it('initializes as a vwc-badge', async () => {
|
|
18
|
+
expect(element).toBeInstanceOf(Badge);
|
|
19
|
+
expect(element.text).toEqual('');
|
|
20
|
+
expect(element.icon).toBeUndefined();
|
|
21
|
+
expect(element.iconTrailing).toBeFalsy();
|
|
22
|
+
expect(element.connotation).toBeUndefined();
|
|
23
|
+
expect(element.shape).toBeUndefined();
|
|
24
|
+
expect(element.appearance).toBeUndefined();
|
|
25
|
+
expect(element.size).toBeUndefined();
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
describe('icon', () => {
|
|
30
|
+
it('adds an icon to the badge', async () => {
|
|
31
|
+
element.icon = 'home';
|
|
32
|
+
await elementUpdated(element);
|
|
33
|
+
|
|
34
|
+
const icon = element.shadowRoot?.querySelector(ICON_SELECTOR) as Icon;
|
|
35
|
+
expect(icon)
|
|
36
|
+
.toBeInstanceOf(Icon);
|
|
37
|
+
expect(icon?.type)
|
|
38
|
+
.toEqual('home');
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
it('setting `iconTrailing` set the order of element', async () => {
|
|
42
|
+
element.icon = 'home';
|
|
43
|
+
element.iconTrailing = true;
|
|
44
|
+
await elementUpdated(element);
|
|
45
|
+
|
|
46
|
+
const trailingIcon = element.shadowRoot?.querySelector(
|
|
47
|
+
`.icon-trailing ${ICON_SELECTOR}`,
|
|
48
|
+
);
|
|
49
|
+
expect(trailingIcon)
|
|
50
|
+
.toBeInstanceOf(Icon);
|
|
51
|
+
},
|
|
52
|
+
);
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
describe('text', () => {
|
|
56
|
+
it('set text property to node', async () => {
|
|
57
|
+
const text = 'lorem';
|
|
58
|
+
element.text = text;
|
|
59
|
+
await elementUpdated(element);
|
|
60
|
+
|
|
61
|
+
const control = element.shadowRoot?.querySelector('.control');
|
|
62
|
+
expect(control?.textContent?.trim())
|
|
63
|
+
.toEqual(text);
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
describe('connotation', () => {
|
|
68
|
+
it('sets correct internal connotation style', async () => {
|
|
69
|
+
const connotation = 'info';
|
|
70
|
+
(element as any).connotation = connotation;
|
|
71
|
+
await elementUpdated(element);
|
|
72
|
+
|
|
73
|
+
const control = element.shadowRoot?.querySelector(`.control.connotation-${connotation}`);
|
|
74
|
+
expect(control)
|
|
75
|
+
.toBeInstanceOf(Element);
|
|
76
|
+
});
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
describe('shape', () => {
|
|
80
|
+
it('sets correct internal shape style', async () => {
|
|
81
|
+
const shape = 'pill';
|
|
82
|
+
(element as any).shape = shape;
|
|
83
|
+
await elementUpdated(element);
|
|
84
|
+
|
|
85
|
+
const control = element.shadowRoot?.querySelector(`.control.shape-${shape}`);
|
|
86
|
+
expect(control)
|
|
87
|
+
.toBeInstanceOf(Element);
|
|
88
|
+
});
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
describe('appearance', () => {
|
|
92
|
+
it('sets correct internal appearance style', async () => {
|
|
93
|
+
const appearance = 'soft';
|
|
94
|
+
(element as any).appearance = appearance;
|
|
95
|
+
await elementUpdated(element);
|
|
96
|
+
|
|
97
|
+
const control = element.shadowRoot?.querySelector(`.control.appearance-${appearance}`);
|
|
98
|
+
expect(control)
|
|
99
|
+
.toBeInstanceOf(Element);
|
|
100
|
+
});
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
describe('size', () => {
|
|
104
|
+
it('sets correct internal size style', async () => {
|
|
105
|
+
const size = 'small';
|
|
106
|
+
(element as any).size = size;
|
|
107
|
+
await elementUpdated(element);
|
|
108
|
+
|
|
109
|
+
const control = element.shadowRoot?.querySelector(`.control.size-${size}`);
|
|
110
|
+
expect(control)
|
|
111
|
+
.toBeInstanceOf(Element);
|
|
112
|
+
});
|
|
113
|
+
});
|
|
114
|
+
});
|