@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,142 @@
|
|
|
1
|
+
@use '../../../../shared/src/lib/sass/mixins/typography' as typography;
|
|
2
|
+
@use 'partials/variables' as variables;
|
|
3
|
+
@use '../focus/partials/variables' as focus-variables;
|
|
4
|
+
|
|
5
|
+
@use '../../../../shared/src/lib/sass/mixins/connotation/config' with (
|
|
6
|
+
$subset: primary cta success alert,
|
|
7
|
+
$shades: contrast fierce strong soft pale,
|
|
8
|
+
$default: primary,
|
|
9
|
+
);
|
|
10
|
+
@use '../../../../shared/src/lib/sass/mixins/connotation' as connotation;
|
|
11
|
+
|
|
12
|
+
@use '../../../../shared/src/lib/sass/mixins/appearance/config' as appearance-config with (
|
|
13
|
+
$appearances: filled outlined ghost,
|
|
14
|
+
$states: idle hover disabled active,
|
|
15
|
+
$default: ghost,
|
|
16
|
+
);
|
|
17
|
+
@use '../../../../shared/src/lib/sass/mixins/appearance' as appearance;
|
|
18
|
+
|
|
19
|
+
:host {
|
|
20
|
+
outline: 0 none;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.control {
|
|
24
|
+
@include connotation.connotation;
|
|
25
|
+
@include appearance.appearance;
|
|
26
|
+
|
|
27
|
+
position: relative;
|
|
28
|
+
display: inline-flex;
|
|
29
|
+
box-sizing: border-box;
|
|
30
|
+
align-items: center;
|
|
31
|
+
border: 0 none;
|
|
32
|
+
background-color: var(#{appearance.get-variable(fill)});
|
|
33
|
+
block-size: var(#{variables.$block-size});
|
|
34
|
+
box-shadow: inset 0 0 0 1px var(#{appearance.get-variable(outline)});
|
|
35
|
+
color: var(#{appearance.get-variable(text)});
|
|
36
|
+
cursor: pointer;
|
|
37
|
+
outline: 0 none;
|
|
38
|
+
vertical-align: middle;
|
|
39
|
+
|
|
40
|
+
&.icon-only {
|
|
41
|
+
padding-inline: 0;
|
|
42
|
+
place-content: center;
|
|
43
|
+
@supports (aspect-ratio: 1) {
|
|
44
|
+
aspect-ratio: 1;
|
|
45
|
+
}
|
|
46
|
+
@supports not (aspect-ratio: 1) {
|
|
47
|
+
inline-size: var(#{variables.$block-size});
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/* Size */
|
|
54
|
+
|
|
55
|
+
.control.size-base-small {
|
|
56
|
+
#{variables.$block-size}: 32px;
|
|
57
|
+
@include typography.typography-cat-shorthand('caption-bold');
|
|
58
|
+
|
|
59
|
+
&:not(.icon-only) {
|
|
60
|
+
#{variables.$icon-gap}: 8px;
|
|
61
|
+
|
|
62
|
+
padding-inline: 12px;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.icon {
|
|
66
|
+
font-size: 16px;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.control.size-base-large {
|
|
71
|
+
#{variables.$block-size}: 48px;
|
|
72
|
+
@include typography.typography-cat-shorthand('body-1-bold');
|
|
73
|
+
|
|
74
|
+
&:not(.icon-only) {
|
|
75
|
+
#{variables.$icon-gap}: 10px;
|
|
76
|
+
|
|
77
|
+
padding-inline: 20px;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.icon {
|
|
81
|
+
font-size: 24px;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.control:not(.size-base-small):not(.size-base-large) {
|
|
86
|
+
#{variables.$block-size}: 40px;
|
|
87
|
+
@include typography.typography-cat-shorthand('button');
|
|
88
|
+
|
|
89
|
+
&:not(.icon-only) {
|
|
90
|
+
#{variables.$icon-gap}: 8px;
|
|
91
|
+
|
|
92
|
+
padding-inline: 16px;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.icon {
|
|
96
|
+
font-size: 20px;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/* Shape */
|
|
101
|
+
|
|
102
|
+
// stylelint-disable-next-line no-descending-specificity
|
|
103
|
+
.control:not(.shape-pill) {
|
|
104
|
+
border-radius: 6px;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
.control.shape-pill {
|
|
108
|
+
&:not(.icon-only) {
|
|
109
|
+
border-radius: 24px;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
&.icon-only {
|
|
113
|
+
border-radius: 50%;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/* Icon */
|
|
118
|
+
|
|
119
|
+
// stylelint-disable-next-line no-descending-specificity
|
|
120
|
+
.icon {
|
|
121
|
+
// stylelint-disable-next-line no-descending-specificity
|
|
122
|
+
:not(.icon-trailing) & {
|
|
123
|
+
margin-inline-end: var(#{variables.$icon-gap});
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
// stylelint-disable-next-line no-descending-specificity
|
|
127
|
+
.icon-trailing & {
|
|
128
|
+
order: 1;
|
|
129
|
+
margin-inline-start: var(#{variables.$icon-gap});
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
.focus-indicator {
|
|
134
|
+
:not(:focus) & {
|
|
135
|
+
display: none;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
.appearance-outlined &,
|
|
139
|
+
.appearance-ghost & {
|
|
140
|
+
#{focus-variables.$focus-stroke-gap-color}: transparent;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { elementUpdated, fixture } from '@vivid-nx/shared';
|
|
2
|
+
import type { Icon } from '../icon/icon';
|
|
3
|
+
import { Button } from './button';
|
|
4
|
+
import '.';
|
|
5
|
+
|
|
6
|
+
const COMPONENT_TAG = 'vwc-button';
|
|
7
|
+
const ICON_SELECTOR = 'vwc-icon';
|
|
8
|
+
|
|
9
|
+
describe('vwc-button', () => {
|
|
10
|
+
let element: Button;
|
|
11
|
+
|
|
12
|
+
beforeEach(async () => {
|
|
13
|
+
element = await fixture(`<${COMPONENT_TAG}></${COMPONENT_TAG}>`) as Button;
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
describe('basic', () => {
|
|
17
|
+
it('initializes as a vwc-button', async () => {
|
|
18
|
+
expect(element).toBeInstanceOf(Button);
|
|
19
|
+
expect(element.label).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 button', async () => {
|
|
31
|
+
element.icon = 'home';
|
|
32
|
+
await elementUpdated(element);
|
|
33
|
+
|
|
34
|
+
const icon = element.shadowRoot?.querySelector(ICON_SELECTOR) as Icon;
|
|
35
|
+
expect(icon).toBeInstanceOf(HTMLElement);
|
|
36
|
+
expect(icon.type).toEqual('home');
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
it('setting `iconTrailing` set the order of element', async () => {
|
|
40
|
+
element.icon = 'home';
|
|
41
|
+
element.iconTrailing = true;
|
|
42
|
+
await elementUpdated(element);
|
|
43
|
+
|
|
44
|
+
const trailingIcon = element.shadowRoot?.querySelector(
|
|
45
|
+
`.icon-trailing ${ICON_SELECTOR}`,
|
|
46
|
+
);
|
|
47
|
+
expect(trailingIcon).toBeInstanceOf(HTMLElement);
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
describe('label', () => {
|
|
52
|
+
it('set label property to node', async () => {
|
|
53
|
+
const label = 'lorem';
|
|
54
|
+
element.label = label;
|
|
55
|
+
await elementUpdated(element);
|
|
56
|
+
|
|
57
|
+
const control = element.shadowRoot?.querySelector('.control');
|
|
58
|
+
expect(control?.textContent?.trim()).toEqual(label);
|
|
59
|
+
});
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
describe('connotation', () => {
|
|
63
|
+
it('sets correct internal connotation style', async () => {
|
|
64
|
+
const connotation = 'cta';
|
|
65
|
+
(element as any).connotation = connotation;
|
|
66
|
+
await elementUpdated(element);
|
|
67
|
+
|
|
68
|
+
const control = element.shadowRoot?.querySelector(`.control.connotation-${connotation}`);
|
|
69
|
+
expect(control).toBeInstanceOf(Element);
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
describe('shape', () => {
|
|
74
|
+
it('sets correct internal shape style', async () => {
|
|
75
|
+
const shape = 'pill';
|
|
76
|
+
(element as any).shape = shape;
|
|
77
|
+
await elementUpdated(element);
|
|
78
|
+
|
|
79
|
+
const control = element.shadowRoot?.querySelector(`.control.shape-${shape}`);
|
|
80
|
+
expect(control).toBeInstanceOf(Element);
|
|
81
|
+
});
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
describe('appearance', () => {
|
|
85
|
+
it('sets correct internal appearance style', async () => {
|
|
86
|
+
const appearance = 'filled';
|
|
87
|
+
(element as any).appearance = appearance;
|
|
88
|
+
await elementUpdated(element);
|
|
89
|
+
|
|
90
|
+
const control = element.shadowRoot?.querySelector(`.control.appearance-${appearance}`);
|
|
91
|
+
expect(control).toBeInstanceOf(Element);
|
|
92
|
+
});
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
describe('size', () => {
|
|
96
|
+
it('sets correct internal size style', async () => {
|
|
97
|
+
const size = 'small';
|
|
98
|
+
(element as any).size = size;
|
|
99
|
+
await elementUpdated(element);
|
|
100
|
+
|
|
101
|
+
const control = element.shadowRoot?.querySelector(`.control.size-${size}`);
|
|
102
|
+
expect(control).toBeInstanceOf(Element);
|
|
103
|
+
});
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
describe('icon-only', () => {
|
|
107
|
+
it('sets correct internal icon-only style', async () => {
|
|
108
|
+
const getControlIconOnly = () => element.shadowRoot?.querySelector('.control.icon-only');
|
|
109
|
+
const controlIconOnlyBefore = getControlIconOnly();
|
|
110
|
+
|
|
111
|
+
element.icon = 'home';
|
|
112
|
+
await elementUpdated(element);
|
|
113
|
+
|
|
114
|
+
const controlIconOnlyAfter = getControlIconOnly();
|
|
115
|
+
expect(controlIconOnlyBefore).toBeNull();
|
|
116
|
+
expect(controlIconOnlyAfter).toBeInstanceOf(Element);
|
|
117
|
+
});
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
describe('disabled', function () {
|
|
121
|
+
it('should set disabled class when disabled is true', async () => {
|
|
122
|
+
const appearance = 'filled';
|
|
123
|
+
(element as any).appearance = appearance;
|
|
124
|
+
element.toggleAttribute('disabled', true);
|
|
125
|
+
await elementUpdated(element);
|
|
126
|
+
|
|
127
|
+
const control = element.shadowRoot?.querySelector(`.control.appearance-${appearance}.disabled`);
|
|
128
|
+
expect(control).toBeInstanceOf(Element);
|
|
129
|
+
});
|
|
130
|
+
});
|
|
131
|
+
});
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import type { ViewTemplate } from '@microsoft/fast-element';
|
|
2
|
+
import { html, ref } from '@microsoft/fast-element';
|
|
3
|
+
import type { ElementDefinitionContext, FoundationElementDefinition } from '@microsoft/fast-foundation';
|
|
4
|
+
import { classNames } from '@microsoft/fast-web-utilities';
|
|
5
|
+
import { Focus } from '../focus/focus';
|
|
6
|
+
import { affixIconTemplateFactory } from '../../shared/patterns/affix';
|
|
7
|
+
import type { Button, ButtonAppearance } from './button';
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
const getAppearanceClassName = (appearance: ButtonAppearance, disabled: boolean) => {
|
|
11
|
+
let className = `appearance-${appearance}`;
|
|
12
|
+
disabled && (className += ' disabled');
|
|
13
|
+
return className;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
const getClasses = ({
|
|
17
|
+
connotation, appearance, shape, size, icon, label, disabled, iconTrailing
|
|
18
|
+
}: Button) => classNames(
|
|
19
|
+
'control',
|
|
20
|
+
[`connotation-${connotation}`, Boolean(connotation)],
|
|
21
|
+
[getAppearanceClassName(appearance as ButtonAppearance, disabled), Boolean(appearance)],
|
|
22
|
+
[`shape-${shape}`, Boolean(shape)],
|
|
23
|
+
[`size-${size}`, Boolean(size)],
|
|
24
|
+
['icon-only', !label && !!icon],
|
|
25
|
+
['icon-trailing', iconTrailing],
|
|
26
|
+
);
|
|
27
|
+
|
|
28
|
+
const focusTemplate = (context: ElementDefinitionContext) => {
|
|
29
|
+
const focusTag = context.tagFor(Focus);
|
|
30
|
+
|
|
31
|
+
return html`<${focusTag} class="focus-indicator"></${focusTag}>`;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* The template for the {@link @microsoft/fast-foundation#(Button:class)} component.
|
|
36
|
+
*
|
|
37
|
+
* @param context
|
|
38
|
+
* @param definition
|
|
39
|
+
* @public
|
|
40
|
+
*/
|
|
41
|
+
export const buttonTemplate: (
|
|
42
|
+
context: ElementDefinitionContext,
|
|
43
|
+
definition: FoundationElementDefinition
|
|
44
|
+
) => ViewTemplate<Button> = (context: ElementDefinitionContext) => {
|
|
45
|
+
const affixIconTemplate = affixIconTemplateFactory(context);
|
|
46
|
+
|
|
47
|
+
return html`
|
|
48
|
+
<button
|
|
49
|
+
class="${getClasses}"
|
|
50
|
+
?autofocus="${(x) => x.autofocus}"
|
|
51
|
+
?disabled="${(x) => x.disabled}"
|
|
52
|
+
form="${(x) => x.formId}"
|
|
53
|
+
formaction="${(x) => x.formaction}"
|
|
54
|
+
formenctype="${(x) => x.formenctype}"
|
|
55
|
+
formmethod="${(x) => x.formmethod}"
|
|
56
|
+
formnovalidate="${(x) => x.formnovalidate}"
|
|
57
|
+
formtarget="${(x) => x.formtarget}"
|
|
58
|
+
name="${(x) => x.name}"
|
|
59
|
+
type="${(x) => x.type}"
|
|
60
|
+
value="${(x) => x.value}"
|
|
61
|
+
aria-atomic="${(x) => x.ariaAtomic}"
|
|
62
|
+
aria-busy="${(x) => x.ariaBusy}"
|
|
63
|
+
aria-controls="${(x) => x.ariaControls}"
|
|
64
|
+
aria-current="${(x) => x.ariaCurrent}"
|
|
65
|
+
aria-describedby="${(x) => x.ariaDescribedby}"
|
|
66
|
+
aria-details="${(x) => x.ariaDetails}"
|
|
67
|
+
aria-disabled="${(x) => x.ariaDisabled}"
|
|
68
|
+
aria-errormessage="${(x) => x.ariaErrormessage}"
|
|
69
|
+
aria-expanded="${(x) => x.ariaExpanded}"
|
|
70
|
+
aria-flowto="${(x) => x.ariaFlowto}"
|
|
71
|
+
aria-haspopup="${(x) => x.ariaHaspopup}"
|
|
72
|
+
aria-hidden="${(x) => x.ariaHidden}"
|
|
73
|
+
aria-invalid="${(x) => x.ariaInvalid}"
|
|
74
|
+
aria-keyshortcuts="${(x) => x.ariaKeyshortcuts}"
|
|
75
|
+
aria-label="${(x) => x.ariaLabel}"
|
|
76
|
+
aria-labelledby="${(x) => x.ariaLabelledby}"
|
|
77
|
+
aria-live="${(x) => x.ariaLive}"
|
|
78
|
+
aria-owns="${(x) => x.ariaOwns}"
|
|
79
|
+
aria-pressed="${(x) => x.ariaPressed}"
|
|
80
|
+
aria-relevant="${(x) => x.ariaRelevant}"
|
|
81
|
+
aria-roledescription="${(x) => x.ariaRoledescription}"
|
|
82
|
+
${ref('control')}
|
|
83
|
+
>
|
|
84
|
+
${() => focusTemplate(context)}
|
|
85
|
+
${x => affixIconTemplate(x.icon)}
|
|
86
|
+
${(x) => x.label}
|
|
87
|
+
</button>
|
|
88
|
+
`;
|
|
89
|
+
};
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { applyMixins, Button as FoundationButton } from '@microsoft/fast-foundation';
|
|
2
|
+
import { attr } from '@microsoft/fast-element';
|
|
3
|
+
|
|
4
|
+
import type {
|
|
5
|
+
Appearance, Connotation, Shape, Size,
|
|
6
|
+
} from '../enums.js';
|
|
7
|
+
import { AffixIconWithTrailing } from '../../shared/patterns/affix';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Types of button connotation.
|
|
11
|
+
*
|
|
12
|
+
* @public
|
|
13
|
+
*/
|
|
14
|
+
type ButtonConnotation = Extract<Connotation,
|
|
15
|
+
| Connotation.Primary
|
|
16
|
+
| Connotation.CTA
|
|
17
|
+
| Connotation.Success
|
|
18
|
+
| Connotation.Alert>;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Types of button appearance.
|
|
22
|
+
*
|
|
23
|
+
* @public
|
|
24
|
+
*/
|
|
25
|
+
export type ButtonAppearance = Extract<Appearance,
|
|
26
|
+
Appearance.Filled | Appearance.Outlined | Appearance.Ghost>;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Types of button shape.
|
|
30
|
+
*
|
|
31
|
+
* @public
|
|
32
|
+
*/
|
|
33
|
+
type ButtonShape = Extract<Shape, Shape.Rounded | Shape.Pill>;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Types of button size.
|
|
37
|
+
*
|
|
38
|
+
* @public
|
|
39
|
+
*/
|
|
40
|
+
type ButtonSize = Extract<Size, Size.BaseSmall | Size.Base | Size.BaseLarge>;
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Base class for button
|
|
44
|
+
*
|
|
45
|
+
* @public
|
|
46
|
+
*/
|
|
47
|
+
export class Button extends FoundationButton {
|
|
48
|
+
/**
|
|
49
|
+
* The connotation the button should have.
|
|
50
|
+
*
|
|
51
|
+
* @public
|
|
52
|
+
* @remarks
|
|
53
|
+
* HTML Attribute: connotation
|
|
54
|
+
*/
|
|
55
|
+
@attr connotation?: ButtonConnotation;
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* The shape the button should have.
|
|
59
|
+
*
|
|
60
|
+
* @public
|
|
61
|
+
* @remarks
|
|
62
|
+
* HTML Attribute: shape
|
|
63
|
+
*/
|
|
64
|
+
@attr shape?: ButtonShape;
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* The appearance the button should have.
|
|
68
|
+
*
|
|
69
|
+
* @public
|
|
70
|
+
* @remarks
|
|
71
|
+
* HTML Attribute: appearance
|
|
72
|
+
*/
|
|
73
|
+
@attr appearance?: ButtonAppearance;
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* The size the button should have.
|
|
77
|
+
*
|
|
78
|
+
* @public
|
|
79
|
+
* @remarks
|
|
80
|
+
* HTML Attribute: size
|
|
81
|
+
*/
|
|
82
|
+
@attr size?: ButtonSize;
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Indicates the button's label.
|
|
86
|
+
*
|
|
87
|
+
* @public
|
|
88
|
+
* @remarks
|
|
89
|
+
* HTML Attribute: label
|
|
90
|
+
*/
|
|
91
|
+
@attr({ mode: 'fromView' }) label = '';
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export interface Button extends AffixIconWithTrailing {}
|
|
95
|
+
applyMixins(Button, AffixIconWithTrailing);
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import '../icon';
|
|
2
|
+
import '../focus';
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
import { Button as FastButton } from '@microsoft/fast-foundation';
|
|
6
|
+
import { designSystem } from '../../shared/design-system';
|
|
7
|
+
import { Button } from './button';
|
|
8
|
+
import styles from './button.scss';
|
|
9
|
+
import { buttonTemplate as template } from './button.template';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Represents a button custom element.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
export const vividButton = Button.compose({
|
|
16
|
+
baseName: 'button',
|
|
17
|
+
baseClass: FastButton,
|
|
18
|
+
template: template as any,
|
|
19
|
+
styles,
|
|
20
|
+
shadowOptions: {
|
|
21
|
+
delegatesFocus: true,
|
|
22
|
+
},
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
designSystem.register(vividButton());
|
|
@@ -0,0 +1,32 @@
|
|
|
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 = ['button'];
|
|
11
|
+
test('should show the component', async ({ page }: { page: Page }) => {
|
|
12
|
+
const template = extractHTMLBlocksFromReadme(path.join(new URL('.', import.meta.url).pathname, 'README.md'))
|
|
13
|
+
.reduce((htmlString: string, block: string) => `${htmlString} <div style="margin: 5px;">${block}</div>`, '');
|
|
14
|
+
|
|
15
|
+
await loadComponents({
|
|
16
|
+
page,
|
|
17
|
+
components,
|
|
18
|
+
});
|
|
19
|
+
await loadTemplate({
|
|
20
|
+
page,
|
|
21
|
+
template,
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
const testWrapper = await page.$('#wrapper');
|
|
25
|
+
|
|
26
|
+
await page.waitForLoadState('networkidle');
|
|
27
|
+
|
|
28
|
+
expect(await testWrapper?.screenshot())
|
|
29
|
+
.toMatchSnapshot(
|
|
30
|
+
'./snapshots/button.png',
|
|
31
|
+
);
|
|
32
|
+
});
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# calendar
|
|
2
|
+
|
|
3
|
+
Represents a calendar custom element.
|
|
4
|
+
|
|
5
|
+
```js
|
|
6
|
+
<script type="module">
|
|
7
|
+
import '@vonage/vivid/calendar';
|
|
8
|
+
</script>
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
```html preview
|
|
12
|
+
<vwc-calendar></vwc-calendar>
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Datetime
|
|
16
|
+
|
|
17
|
+
Use the `datetime` attribute to set date within a week of choice.
|
|
18
|
+
|
|
19
|
+
- Type: any [`Date()` constructor acceptable parameter](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/Date#parameters)
|
|
20
|
+
- Default: `undefined` (will use the current date)
|
|
21
|
+
|
|
22
|
+
```html preview
|
|
23
|
+
<vwc-calendar datetime="2022-01-01"></vwc-calendar>
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Start Day
|
|
27
|
+
|
|
28
|
+
Use the `start-day` attribute (or `startDay` property) to set the first day of the week (e.g. work week starts on Monday).
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
- Type: `'sunday'` | `'monday'`
|
|
32
|
+
- Default: `undefined` (programmatically defaults to `'monday'` if not specified)
|
|
33
|
+
|
|
34
|
+
```html preview
|
|
35
|
+
<vwc-calendar start-day="sunday"></vwc-calendar>
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Locales
|
|
39
|
+
|
|
40
|
+
Use `locales` to set a locale string or array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used. This parameter must conform to BCP 47 standards; see the [Intl.Collator object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Collator) for details. e.g. `en-US` | `en-US, he-IL`
|
|
41
|
+
|
|
42
|
+
- Type: `String` | `String[]`
|
|
43
|
+
- Default: `undefined` (will use the current locale)
|
|
44
|
+
|
|
45
|
+
```html preview
|
|
46
|
+
<vwc-calendar locales="he-IL" start-day="sunday" style="direction: rtl"></vwc-calendar>
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Hour 12
|
|
50
|
+
|
|
51
|
+
`hour12` sets the convention of displayed time in which the day runs from midnight to midnight and is divided into 24 or 12 hours.
|
|
52
|
+
Unless provided, choice will be set according to local time preference (e.g. US = 12, IL = 24).
|
|
53
|
+
|
|
54
|
+
- Type: `Boolean`
|
|
55
|
+
- Default: `false`
|
|
56
|
+
|
|
57
|
+
```html preview
|
|
58
|
+
<vwc-calendar hour12></vwc-calendar>
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## Methods
|
|
62
|
+
|
|
63
|
+
### Event Context
|
|
64
|
+
|
|
65
|
+
- Type: function
|
|
66
|
+
- Returns: `{ day: number, hour: number }` | `null`
|
|
67
|
+
|
|
68
|
+
Accepts event reference and returns an object containing _day_ & _hour_ if applicable.
|
|
69
|
+
|
|
70
|
+
|