@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,173 @@
|
|
|
1
|
+
import {elementUpdated, fixture} from '@vivid-nx/shared';
|
|
2
|
+
import {Connotation, Shape} from '../enums';
|
|
3
|
+
import {Progress} from './progress';
|
|
4
|
+
import '.';
|
|
5
|
+
|
|
6
|
+
const COMPONENT_TAG = 'vwc-progress';
|
|
7
|
+
|
|
8
|
+
describe('vwc-progress', () => {
|
|
9
|
+
let element: Progress;
|
|
10
|
+
|
|
11
|
+
beforeEach(async () => {
|
|
12
|
+
element = (await fixture(
|
|
13
|
+
`<${COMPONENT_TAG}></${COMPONENT_TAG}>`
|
|
14
|
+
)) as Progress;
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
describe('basic', () => {
|
|
18
|
+
it('should be initialized as a vwc-progress', async () => {
|
|
19
|
+
expect(element)
|
|
20
|
+
.toBeInstanceOf(Progress);
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
it('should reflect min and max', async function () {
|
|
24
|
+
element.min = 10;
|
|
25
|
+
element.max = 90;
|
|
26
|
+
await elementUpdated(element);
|
|
27
|
+
expect(element.getAttribute('min'))
|
|
28
|
+
.toEqual(element.min.toString());
|
|
29
|
+
expect(element.getAttribute('max'))
|
|
30
|
+
.toEqual(element.max.toString());
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
describe('connotation', function () {
|
|
35
|
+
it('should be undefined by default', async function () {
|
|
36
|
+
expect(element.connotation)
|
|
37
|
+
.toEqual(undefined);
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
it('should reflect its value to host', async function () {
|
|
41
|
+
|
|
42
|
+
element.setAttribute('connotation', 'alert');
|
|
43
|
+
await elementUpdated(element);
|
|
44
|
+
const connotationPropertyAfterAttributeChange = element.connotation;
|
|
45
|
+
|
|
46
|
+
element.connotation = Connotation.Success;
|
|
47
|
+
await elementUpdated(element);
|
|
48
|
+
const connotationAttributeAfterPropertyChange = element.getAttribute('connotation');
|
|
49
|
+
|
|
50
|
+
expect(connotationPropertyAfterAttributeChange)
|
|
51
|
+
.toEqual(Connotation.Alert);
|
|
52
|
+
expect(connotationAttributeAfterPropertyChange)
|
|
53
|
+
.toEqual(Connotation.Success);
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
it('should set connotation on the base div', async function () {
|
|
57
|
+
const connotation = Connotation.CTA;
|
|
58
|
+
const baseDiv = element.shadowRoot?.querySelector('.base');
|
|
59
|
+
const connotationClassExistsBeforeChange = baseDiv?.classList.contains(`connotation-${connotation}`);
|
|
60
|
+
element.connotation = connotation;
|
|
61
|
+
await elementUpdated(element);
|
|
62
|
+
const connotationClassExistsAfterChange = baseDiv?.classList.contains(`connotation-${connotation}`);
|
|
63
|
+
|
|
64
|
+
expect(connotationClassExistsBeforeChange)
|
|
65
|
+
.toEqual(false);
|
|
66
|
+
expect(connotationClassExistsAfterChange)
|
|
67
|
+
.toEqual(true);
|
|
68
|
+
});
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
describe('paused', function () {
|
|
72
|
+
it('should reflect to host', async function () {
|
|
73
|
+
const pausedAttributeExistsOnInit = element.hasAttribute('paused');
|
|
74
|
+
element.paused = true;
|
|
75
|
+
await elementUpdated(element);
|
|
76
|
+
const pausedAttributeExistsWhenTrue = element.hasAttribute('paused');
|
|
77
|
+
element.paused = false;
|
|
78
|
+
await elementUpdated(element);
|
|
79
|
+
const pausedAttributeExistsWhenFalse = element.hasAttribute('paused');
|
|
80
|
+
expect(pausedAttributeExistsOnInit)
|
|
81
|
+
.toEqual(false);
|
|
82
|
+
expect(pausedAttributeExistsWhenTrue)
|
|
83
|
+
.toEqual(true);
|
|
84
|
+
expect(pausedAttributeExistsWhenFalse)
|
|
85
|
+
.toEqual(false);
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
it('should set class paused on base element', async function () {
|
|
89
|
+
const baseDiv = element.shadowRoot?.querySelector('.base');
|
|
90
|
+
const pausedClassExistsBeforeChange = baseDiv?.classList.contains('paused');
|
|
91
|
+
element.paused = true;
|
|
92
|
+
await elementUpdated(element);
|
|
93
|
+
const pausedClassExistsAfterChange = baseDiv?.classList.contains('paused');
|
|
94
|
+
|
|
95
|
+
expect(pausedClassExistsBeforeChange)
|
|
96
|
+
.toEqual(false);
|
|
97
|
+
expect(pausedClassExistsAfterChange)
|
|
98
|
+
.toEqual(true);
|
|
99
|
+
});
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
describe('value', function () {
|
|
103
|
+
it('should reflect to host', async function () {
|
|
104
|
+
element.value = 50;
|
|
105
|
+
await elementUpdated(element);
|
|
106
|
+
expect(element.getAttribute('value'))
|
|
107
|
+
.toEqual('50');
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
it('should set percentComplete to percentage of the range', async function () {
|
|
111
|
+
element.min = 0;
|
|
112
|
+
element.max = 100;
|
|
113
|
+
element.value = 25;
|
|
114
|
+
await elementUpdated(element);
|
|
115
|
+
const percentWithBigRange = element.percentComplete;
|
|
116
|
+
|
|
117
|
+
element.min = 0;
|
|
118
|
+
element.max = 50;
|
|
119
|
+
element.value = 25;
|
|
120
|
+
await elementUpdated(element);
|
|
121
|
+
const percentWithSmallRange = element.percentComplete;
|
|
122
|
+
|
|
123
|
+
expect(percentWithBigRange)
|
|
124
|
+
.toEqual(25);
|
|
125
|
+
expect(percentWithSmallRange)
|
|
126
|
+
.toEqual(50);
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
it('should set the determinate div width to percentComplete', async function () {
|
|
130
|
+
element.min = 0;
|
|
131
|
+
element.max = 100;
|
|
132
|
+
element.value = 25;
|
|
133
|
+
await elementUpdated(element);
|
|
134
|
+
const determinateDiv = element.shadowRoot?.querySelector('.determinate') as HTMLElement;
|
|
135
|
+
expect(determinateDiv?.style.width)
|
|
136
|
+
.toEqual(`${element.value}%`);
|
|
137
|
+
});
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
describe('reverse', function () {
|
|
141
|
+
it('should reflect reverse on host', async function () {
|
|
142
|
+
element.reverse = true;
|
|
143
|
+
await elementUpdated(element);
|
|
144
|
+
expect(element.hasAttribute('reverse'))
|
|
145
|
+
.toEqual(true);
|
|
146
|
+
});
|
|
147
|
+
|
|
148
|
+
it('should add class "reverse" to base div', async function () {
|
|
149
|
+
const baseDiv = element.shadowRoot?.querySelector('.base');
|
|
150
|
+
element.reverse = true;
|
|
151
|
+
await elementUpdated(element);
|
|
152
|
+
expect(baseDiv?.classList.contains('reverse'))
|
|
153
|
+
.toEqual(true);
|
|
154
|
+
});
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
describe('shape', function () {
|
|
158
|
+
it('should reflect shape on host', async function () {
|
|
159
|
+
element.shape = Shape.Rounded;
|
|
160
|
+
await elementUpdated(element);
|
|
161
|
+
expect(element.getAttribute('shape'))
|
|
162
|
+
.toEqual(Shape.Rounded);
|
|
163
|
+
});
|
|
164
|
+
|
|
165
|
+
it('should add class "shape" to base div', async function () {
|
|
166
|
+
const baseDiv = element.shadowRoot?.querySelector('.base');
|
|
167
|
+
element.shape = Shape.Rounded;
|
|
168
|
+
await elementUpdated(element);
|
|
169
|
+
expect(baseDiv?.classList.contains(`shape-${Shape.Rounded}`))
|
|
170
|
+
.toEqual(true);
|
|
171
|
+
});
|
|
172
|
+
});
|
|
173
|
+
});
|
|
@@ -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
|
+
} from '@microsoft/fast-foundation';
|
|
6
|
+
import {classNames} from '@microsoft/fast-web-utilities';
|
|
7
|
+
import type {BaseProgress, ProgressOptions} from '@microsoft/fast-foundation';
|
|
8
|
+
import type { Progress } from './progress';
|
|
9
|
+
|
|
10
|
+
const getClasses = (_: Progress) => classNames(
|
|
11
|
+
'base',
|
|
12
|
+
[`connotation-${_.connotation}`, !!_.connotation],
|
|
13
|
+
[`shape-${_.shape}`, !!_.shape],
|
|
14
|
+
['reverse', _.reverse]
|
|
15
|
+
);
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* The template for the {@link @microsoft/fast-foundation#Progress} component.
|
|
19
|
+
*
|
|
20
|
+
* @param context
|
|
21
|
+
* @param _
|
|
22
|
+
* @param definition
|
|
23
|
+
* @public
|
|
24
|
+
*/
|
|
25
|
+
export const ProgressTemplate: (
|
|
26
|
+
context: ElementDefinitionContext,
|
|
27
|
+
definition: ProgressOptions
|
|
28
|
+
) => ViewTemplate<Progress> = (_: ElementDefinitionContext) => {
|
|
29
|
+
return html`
|
|
30
|
+
<div
|
|
31
|
+
role="progressbar"
|
|
32
|
+
aria-valuenow="${x => x.value}"
|
|
33
|
+
aria-valuemin="${x => x.min}"
|
|
34
|
+
aria-valuemax="${x => x.max}"
|
|
35
|
+
class="${x => (x.paused ? 'paused' : '')} ${getClasses}"
|
|
36
|
+
>
|
|
37
|
+
${when(
|
|
38
|
+
x => typeof x.value === 'number',
|
|
39
|
+
html<BaseProgress>`
|
|
40
|
+
<div class="progress">
|
|
41
|
+
<div
|
|
42
|
+
class="determinate"
|
|
43
|
+
style="width: ${x => x.percentComplete}%"
|
|
44
|
+
></div>
|
|
45
|
+
</div>
|
|
46
|
+
`
|
|
47
|
+
)}
|
|
48
|
+
${when(
|
|
49
|
+
x => typeof x.value !== 'number',
|
|
50
|
+
html<BaseProgress>`
|
|
51
|
+
<div class="progress indeterminate">
|
|
52
|
+
<span class="indeterminate" name="indeterminate">
|
|
53
|
+
<span class="indeterminate-indicator-1"></span>
|
|
54
|
+
<span class="indeterminate-indicator-2"></span>
|
|
55
|
+
</span>
|
|
56
|
+
</div>
|
|
57
|
+
`
|
|
58
|
+
)}
|
|
59
|
+
</div>
|
|
60
|
+
`;
|
|
61
|
+
};
|
|
62
|
+
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { BaseProgress } from '@microsoft/fast-foundation';
|
|
2
|
+
import {attr} from '@microsoft/fast-element';
|
|
3
|
+
import type {Connotation, ConnotationDecorative, Shape} from '../enums';
|
|
4
|
+
|
|
5
|
+
export type ProgressConnotation =
|
|
6
|
+
Connotation.Primary |
|
|
7
|
+
Connotation.Success |
|
|
8
|
+
Connotation.Alert |
|
|
9
|
+
Connotation.CTA |
|
|
10
|
+
ConnotationDecorative.Pacific;
|
|
11
|
+
|
|
12
|
+
export type ProgressShape =
|
|
13
|
+
Shape.Rounded |
|
|
14
|
+
Shape.Sharp;
|
|
15
|
+
/**
|
|
16
|
+
* Base class for progress
|
|
17
|
+
*
|
|
18
|
+
* @public
|
|
19
|
+
*/
|
|
20
|
+
export class Progress extends BaseProgress {
|
|
21
|
+
@attr() shape?: ProgressShape;
|
|
22
|
+
@attr() connotation?: ProgressConnotation;
|
|
23
|
+
@attr({mode: 'boolean'}) reverse = false;
|
|
24
|
+
}
|
|
25
|
+
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import {expect, test} from '@playwright/test';
|
|
2
|
+
import type {Page} from '@playwright/test';
|
|
3
|
+
import {
|
|
4
|
+
loadComponents,
|
|
5
|
+
loadTemplate,
|
|
6
|
+
} from '../../visual-tests/visual-tests-utils.ts';
|
|
7
|
+
|
|
8
|
+
const components = ['progress'];
|
|
9
|
+
|
|
10
|
+
test('should show the component', async ({page}: { page: Page }) => {
|
|
11
|
+
const template = `
|
|
12
|
+
<div style="margin: 5px;">
|
|
13
|
+
<vwc-progress min="0" max="100" value="25" connotation="primary"></vwc-progress>
|
|
14
|
+
<br/>
|
|
15
|
+
<br/>
|
|
16
|
+
<vwc-progress min="0" max="100" value="25" connotation="cta"></vwc-progress>
|
|
17
|
+
<br/>
|
|
18
|
+
<br/>
|
|
19
|
+
<vwc-progress min="0" max="100" value="25" connotation="success"></vwc-progress>
|
|
20
|
+
<br/>
|
|
21
|
+
<br/>
|
|
22
|
+
<vwc-progress min="0" max="100" value="25" connotation="alert"></vwc-progress>
|
|
23
|
+
<br/>
|
|
24
|
+
<br/>
|
|
25
|
+
<vwc-progress min="0" max="100" value="25" connotation="pacific"></vwc-progress>
|
|
26
|
+
<br/>
|
|
27
|
+
<br/>
|
|
28
|
+
<vwc-progress min="0" max="50" value="25" paused></vwc-progress>
|
|
29
|
+
<br/>
|
|
30
|
+
<br/>
|
|
31
|
+
<vwc-progress min="0" max="50" value="indeterminate" paused></vwc-progress>
|
|
32
|
+
<br/>
|
|
33
|
+
<br/>
|
|
34
|
+
<vwc-progress min="0" max="50" value="25" reverse></vwc-progress>
|
|
35
|
+
<br/>
|
|
36
|
+
<br/>
|
|
37
|
+
<vwc-progress min="0" max="100" value="25" connotation="primary" shape="sharp"></vwc-progress>
|
|
38
|
+
<br/>
|
|
39
|
+
<br/>
|
|
40
|
+
<vwc-progress min="0" max="100" value="25" connotation="cta" shape="sharp"></vwc-progress>
|
|
41
|
+
<br/>
|
|
42
|
+
<br/>
|
|
43
|
+
<vwc-progress min="0" max="100" value="25" connotation="success" shape="sharp"></vwc-progress>
|
|
44
|
+
<br/>
|
|
45
|
+
<br/>
|
|
46
|
+
<vwc-progress min="0" max="100" value="25" connotation="alert" shape="sharp"></vwc-progress>
|
|
47
|
+
<br/>
|
|
48
|
+
<br/>
|
|
49
|
+
<vwc-progress min="0" max="100" value="25" connotation="pacific" shape="sharp"></vwc-progress>
|
|
50
|
+
</div>
|
|
51
|
+
`;
|
|
52
|
+
|
|
53
|
+
await loadComponents({
|
|
54
|
+
page,
|
|
55
|
+
components,
|
|
56
|
+
});
|
|
57
|
+
await loadTemplate({
|
|
58
|
+
page,
|
|
59
|
+
template,
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
const testWrapper = await page.$('#wrapper');
|
|
63
|
+
|
|
64
|
+
await page.waitForLoadState('networkidle');
|
|
65
|
+
|
|
66
|
+
expect(await testWrapper?.screenshot())
|
|
67
|
+
.toMatchSnapshot(
|
|
68
|
+
'./snapshots/progress.png'
|
|
69
|
+
);
|
|
70
|
+
});
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
# progress-ring
|
|
2
|
+
|
|
3
|
+
Progress-ring is used to display the length of time a process will take or to visualize percentage value (referred to as a determinate state) and to represent an unspecified wait time (referred to as an indeterminate state).
|
|
4
|
+
|
|
5
|
+
```js
|
|
6
|
+
<script type="module">
|
|
7
|
+
import '@vonage/vivid/progress-ring';
|
|
8
|
+
</script>
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
```html preview
|
|
12
|
+
<vwc-progress-ring></vwc-progress-ring>
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
### Min/Max
|
|
16
|
+
Use `min`, `max` in order to determine the range of the progress.
|
|
17
|
+
|
|
18
|
+
- Type: `number`
|
|
19
|
+
- Default: `undefined`
|
|
20
|
+
|
|
21
|
+
```html preview
|
|
22
|
+
<vwc-layout column-basis="block">
|
|
23
|
+
<vwc-progress-ring min="0" max="50" value="12.5"></vwc-progress-ring>
|
|
24
|
+
<vwc-progress-ring min="0" max="50" value="50"></vwc-progress-ring>
|
|
25
|
+
<vwc-progress-ring min="0" max="100" value="50"></vwc-progress-ring>
|
|
26
|
+
</vwc-layout>
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
### Value
|
|
30
|
+
Use `value` in order to set the state of the progress. Omitting the attribute or setting it for a non-number value will set the state to `indetermintate`.
|
|
31
|
+
|
|
32
|
+
- Type: `number` | `string`
|
|
33
|
+
- Default: `undefined`
|
|
34
|
+
|
|
35
|
+
```html preview
|
|
36
|
+
<vwc-layout column-basis="block">
|
|
37
|
+
<vwc-progress-ring value="12.5"></vwc-progress-ring>
|
|
38
|
+
<vwc-progress-ring value="45"></vwc-progress-ring>
|
|
39
|
+
<vwc-progress-ring value="73"></vwc-progress-ring>
|
|
40
|
+
<vwc-progress-ring value="100"></vwc-progress-ring>
|
|
41
|
+
</vwc-layout>
|
|
42
|
+
```
|
|
43
|
+
### Connotation
|
|
44
|
+
Use `connotation` in order to set the color the progress.
|
|
45
|
+
|
|
46
|
+
- Type: `'primary'` | `'cta'` | `'success'` | `'alert'`
|
|
47
|
+
- Default: `'primary'`
|
|
48
|
+
|
|
49
|
+
```html preview
|
|
50
|
+
<vwc-layout column-basis="block">
|
|
51
|
+
<vwc-progress-ring connotation="primary"></vwc-progress-ring>
|
|
52
|
+
<vwc-progress-ring connotation="cta"></vwc-progress-ring>
|
|
53
|
+
<vwc-progress-ring connotation="success"></vwc-progress-ring>
|
|
54
|
+
<vwc-progress-ring connotation="alert"></vwc-progress-ring>
|
|
55
|
+
</vwc-layout>
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### Paused
|
|
59
|
+
Use the `paused` attribute to show a disabled state of the progress.
|
|
60
|
+
|
|
61
|
+
- Type: `boolean`
|
|
62
|
+
- Default: `false`
|
|
63
|
+
|
|
64
|
+
```html preview
|
|
65
|
+
<vwc-layout column-basis="block">
|
|
66
|
+
<h2>Determinate</h2>
|
|
67
|
+
<vwc-progress-ring min="0" max="50" value="25" paused></vwc-progress-ring>
|
|
68
|
+
<h2>Indeterminate</h2>
|
|
69
|
+
<vwc-progress-ring min="0" max="50" paused></vwc-progress-ring>
|
|
70
|
+
</vwc-layout>
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## Example Usage
|
|
74
|
+
|
|
75
|
+
### Determinate State
|
|
76
|
+
Set the `min`, `max` and `value` in order to show the determinate state.
|
|
77
|
+
|
|
78
|
+
In the example below, we set the value to `12.5` while the range is `0` to `50`. This means, 25% of the progress bar will be filled.
|
|
79
|
+
```html preview
|
|
80
|
+
<vwc-progress-ring min="0" max="50" value="12.5"></vwc-progress-ring>
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### Indeterminate
|
|
84
|
+
Remove `value` or set it to be a non-number value (e.g. `indeterminate`) to show an indeterminate state.
|
|
85
|
+
```html preview
|
|
86
|
+
<vwc-layout column-basis="block">
|
|
87
|
+
<vwc-progress-ring min="0" max="50"></vwc-progress-ring>
|
|
88
|
+
<vwc-progress-ring min="0" max="50" value="indeterminate"></vwc-progress-ring>
|
|
89
|
+
</vwc-layout>
|
|
90
|
+
```
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type {FoundationElementDefinition} from '@microsoft/fast-foundation';
|
|
2
|
+
import {designSystem} from '../../shared/design-system';
|
|
3
|
+
import styles from './progress-ring.scss';
|
|
4
|
+
|
|
5
|
+
import {ProgressRing} from './progress-ring';
|
|
6
|
+
import {ProgressRingTemplate as template} from './progress-ring.template';
|
|
7
|
+
|
|
8
|
+
export const vividProgressRing =
|
|
9
|
+
ProgressRing.compose<FoundationElementDefinition>({
|
|
10
|
+
baseName: 'progress-ring',
|
|
11
|
+
template: template as any,
|
|
12
|
+
styles,
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
designSystem.register(vividProgressRing());
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
@use '../../../../../node_modules/@vonage/vivid-tokens/dist/sass/themes/consts' as theme-consts;
|
|
2
|
+
|
|
3
|
+
@use '../../../../shared/src/lib/sass/mixins/connotation/config' with (
|
|
4
|
+
$subset: cta primary alert success,
|
|
5
|
+
$default: primary
|
|
6
|
+
);
|
|
7
|
+
@use '../../../../shared/src/lib/sass/mixins/connotation' as connotation;
|
|
8
|
+
|
|
9
|
+
.base {
|
|
10
|
+
@include connotation.connotation;
|
|
11
|
+
|
|
12
|
+
width: 36px;
|
|
13
|
+
height: 36px;
|
|
14
|
+
align-items: center;
|
|
15
|
+
outline: none;
|
|
16
|
+
}
|
|
17
|
+
.base.base-large {
|
|
18
|
+
width: 48px;
|
|
19
|
+
height: 48px;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.base.base-small {
|
|
23
|
+
width: 24px;
|
|
24
|
+
height: 24px;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.progress {
|
|
28
|
+
width: 100%;
|
|
29
|
+
height: 100%;
|
|
30
|
+
}
|
|
31
|
+
.background {
|
|
32
|
+
fill: none;
|
|
33
|
+
stroke: transparent;
|
|
34
|
+
stroke-width: 2px;
|
|
35
|
+
}
|
|
36
|
+
.determinate {
|
|
37
|
+
fill: none;
|
|
38
|
+
stroke: var(#{connotation.$vvd-color-connotation});
|
|
39
|
+
stroke-linecap: round;
|
|
40
|
+
stroke-width: 2px;
|
|
41
|
+
transform: rotate(-90deg);
|
|
42
|
+
transform-origin: 50% 50%;
|
|
43
|
+
transition: all 0.2s ease-in-out;
|
|
44
|
+
}
|
|
45
|
+
.indeterminate-indicator-1 {
|
|
46
|
+
animation: spin-infinite 2s linear infinite;
|
|
47
|
+
fill: none;
|
|
48
|
+
stroke: var(#{connotation.$vvd-color-connotation});
|
|
49
|
+
stroke-linecap: round;
|
|
50
|
+
stroke-width: 2px;
|
|
51
|
+
transform: rotate(-90deg);
|
|
52
|
+
transform-origin: 50% 50%;
|
|
53
|
+
transition: all 0.2s ease-in-out;
|
|
54
|
+
}
|
|
55
|
+
.base.paused .indeterminate-indicator-1 {
|
|
56
|
+
animation-play-state: paused;
|
|
57
|
+
stroke: var(#{theme-consts.$vvd-color-neutral});
|
|
58
|
+
}
|
|
59
|
+
.base.paused .determinate {
|
|
60
|
+
stroke: var(#{theme-consts.$vvd-color-neutral});
|
|
61
|
+
}
|
|
62
|
+
@keyframes spin-infinite {
|
|
63
|
+
0% {
|
|
64
|
+
stroke-dasharray: 0.01px 43.97px;
|
|
65
|
+
transform: rotate(0deg);
|
|
66
|
+
}
|
|
67
|
+
50% {
|
|
68
|
+
stroke-dasharray: 21.99px 21.99px;
|
|
69
|
+
transform: rotate(450deg);
|
|
70
|
+
}
|
|
71
|
+
100% {
|
|
72
|
+
stroke-dasharray: 0.01px 43.97px;
|
|
73
|
+
transform: rotate(1080deg);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import {elementUpdated, fixture} from '@vivid-nx/shared';
|
|
2
|
+
import {Connotation} from '../enums';
|
|
3
|
+
import {ProgressRing} from './progress-ring';
|
|
4
|
+
import '.';
|
|
5
|
+
|
|
6
|
+
const COMPONENT_TAG = 'vwc-progress-ring';
|
|
7
|
+
|
|
8
|
+
describe('vwc-progress-ring', () => {
|
|
9
|
+
let element: ProgressRing;
|
|
10
|
+
|
|
11
|
+
beforeEach(async () => {
|
|
12
|
+
element = (await fixture(
|
|
13
|
+
`<${COMPONENT_TAG}></${COMPONENT_TAG}>`
|
|
14
|
+
)) as ProgressRing;
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
describe('basic', () => {
|
|
18
|
+
it('should be initialized as a vwc-progress-ring', async () => {
|
|
19
|
+
expect(element).toBeInstanceOf(ProgressRing);
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
it('should reflect min and max', async function () {
|
|
23
|
+
element.min = 10;
|
|
24
|
+
element.max = 90;
|
|
25
|
+
await elementUpdated(element);
|
|
26
|
+
expect(element.getAttribute('min'))
|
|
27
|
+
.toEqual(element.min.toString());
|
|
28
|
+
expect(element.getAttribute('max'))
|
|
29
|
+
.toEqual(element.max.toString());
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
describe('value', function () {
|
|
34
|
+
it('should reflect to host', async function () {
|
|
35
|
+
element.value = 50;
|
|
36
|
+
await elementUpdated(element);
|
|
37
|
+
expect(element.getAttribute('value'))
|
|
38
|
+
.toEqual('50');
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
it('should set percentComplete to percentage of the range', async function () {
|
|
42
|
+
element.min = 0;
|
|
43
|
+
element.max = 100;
|
|
44
|
+
element.value = 25;
|
|
45
|
+
await elementUpdated(element);
|
|
46
|
+
const percentWithBigRange = element.percentComplete;
|
|
47
|
+
|
|
48
|
+
element.min = 0;
|
|
49
|
+
element.max = 50;
|
|
50
|
+
element.value = 25;
|
|
51
|
+
await elementUpdated(element);
|
|
52
|
+
const percentWithSmallRange = element.percentComplete;
|
|
53
|
+
|
|
54
|
+
expect(percentWithBigRange)
|
|
55
|
+
.toEqual(25);
|
|
56
|
+
expect(percentWithSmallRange)
|
|
57
|
+
.toEqual(50);
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
it('should set the determinate div width to percentComplete', async function () {
|
|
61
|
+
element.min = 0;
|
|
62
|
+
element.max = 100;
|
|
63
|
+
element.value = 25;
|
|
64
|
+
const expectedValue = element.value * 44 / 100;
|
|
65
|
+
await elementUpdated(element);
|
|
66
|
+
const determinateDiv = element.shadowRoot?.querySelector('.determinate') as HTMLElement;
|
|
67
|
+
expect(determinateDiv?.style.strokeDasharray)
|
|
68
|
+
.toEqual(`${expectedValue}px 44px`);
|
|
69
|
+
});
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
describe('paused', function () {
|
|
73
|
+
it('should reflect to host', async function () {
|
|
74
|
+
const pausedAttributeExistsOnInit = element.hasAttribute('paused');
|
|
75
|
+
element.paused = true;
|
|
76
|
+
await elementUpdated(element);
|
|
77
|
+
const pausedAttributeExistsWhenTrue = element.hasAttribute('paused');
|
|
78
|
+
element.paused = false;
|
|
79
|
+
await elementUpdated(element);
|
|
80
|
+
const pausedAttributeExistsWhenFalse = element.hasAttribute('paused');
|
|
81
|
+
expect(pausedAttributeExistsOnInit)
|
|
82
|
+
.toEqual(false);
|
|
83
|
+
expect(pausedAttributeExistsWhenTrue)
|
|
84
|
+
.toEqual(true);
|
|
85
|
+
expect(pausedAttributeExistsWhenFalse)
|
|
86
|
+
.toEqual(false);
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
it('should set class paused on base element', async function () {
|
|
90
|
+
const baseDiv = element.shadowRoot?.querySelector('.base');
|
|
91
|
+
const pausedClassExistsBeforeChange = baseDiv?.classList.contains('paused');
|
|
92
|
+
element.paused = true;
|
|
93
|
+
await elementUpdated(element);
|
|
94
|
+
const pausedClassExistsAfterChange = baseDiv?.classList.contains('paused');
|
|
95
|
+
|
|
96
|
+
expect(pausedClassExistsBeforeChange)
|
|
97
|
+
.toEqual(false);
|
|
98
|
+
expect(pausedClassExistsAfterChange)
|
|
99
|
+
.toEqual(true);
|
|
100
|
+
});
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
describe('connotation', function () {
|
|
104
|
+
it('should be undefined by default', async function () {
|
|
105
|
+
expect(element.connotation)
|
|
106
|
+
.toEqual(undefined);
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
it('should reflect its value to host', async function () {
|
|
110
|
+
|
|
111
|
+
element.setAttribute('connotation', 'alert');
|
|
112
|
+
await elementUpdated(element);
|
|
113
|
+
const connotationPropertyAfterAttributeChange = element.connotation;
|
|
114
|
+
|
|
115
|
+
element.connotation = Connotation.Success;
|
|
116
|
+
await elementUpdated(element);
|
|
117
|
+
const connotationAttributeAfterPropertyChange = element.getAttribute('connotation');
|
|
118
|
+
|
|
119
|
+
expect(connotationPropertyAfterAttributeChange)
|
|
120
|
+
.toEqual(Connotation.Alert);
|
|
121
|
+
expect(connotationAttributeAfterPropertyChange)
|
|
122
|
+
.toEqual(Connotation.Success);
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
it('should set connotation on the base div', async function () {
|
|
126
|
+
const connotation = Connotation.CTA;
|
|
127
|
+
const baseDiv = element.shadowRoot?.querySelector('.base');
|
|
128
|
+
const connotationClassExistsBeforeChange = baseDiv?.classList.contains(`connotation-${connotation}`);
|
|
129
|
+
element.connotation = connotation;
|
|
130
|
+
await elementUpdated(element);
|
|
131
|
+
const connotationClassExistsAfterChange = baseDiv?.classList.contains(`connotation-${connotation}`);
|
|
132
|
+
|
|
133
|
+
expect(connotationClassExistsBeforeChange)
|
|
134
|
+
.toEqual(false);
|
|
135
|
+
expect(connotationClassExistsAfterChange)
|
|
136
|
+
.toEqual(true);
|
|
137
|
+
});
|
|
138
|
+
});
|
|
139
|
+
});
|