@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,132 @@
|
|
|
1
|
+
# tooltip
|
|
2
|
+
|
|
3
|
+
A tooltip is a brief, informative message or descriptions or explanations for their paired element. Tooltips in general are less accessible so be sure to follow our accessibility recommendation in the docs.
|
|
4
|
+
|
|
5
|
+
```js
|
|
6
|
+
<script type="module">
|
|
7
|
+
import '@vonage/vivid/tooltip';
|
|
8
|
+
</script>
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Anchor
|
|
12
|
+
The tooltip can be placed on interactive controls (things that can be clicked or focusable) such as: button, checkbox, input text.
|
|
13
|
+
The tooltip can't be placed on non-interactive elements such as paragraph or plain div.
|
|
14
|
+
Do not target non-interactive controls as a tooltip's anchor (such as non-focusable / disabled elements).
|
|
15
|
+
|
|
16
|
+
- Type: `string`
|
|
17
|
+
- Default: `undefined`
|
|
18
|
+
|
|
19
|
+
```html preview
|
|
20
|
+
<style>
|
|
21
|
+
.wrapper{
|
|
22
|
+
width: 100%;
|
|
23
|
+
height: 120px;
|
|
24
|
+
display: flex;
|
|
25
|
+
align-items: center;
|
|
26
|
+
justify-content: center;
|
|
27
|
+
}
|
|
28
|
+
</style>
|
|
29
|
+
<div class="wrapper">
|
|
30
|
+
<vwc-button id="anchor" icon="help-line" shape="pill" aria-describedby="tooltip"></vwc-button>
|
|
31
|
+
<vwc-tooltip id="tooltip" anchor="anchor" text="I'm a tooltip" open></vwc-tooltip>
|
|
32
|
+
</div>
|
|
33
|
+
```
|
|
34
|
+
## Text
|
|
35
|
+
The tooltip is a description and therefor, the tooltip itself can not be interactive. `vwc-tooltip` contains only text.
|
|
36
|
+
|
|
37
|
+
- Type: `string`
|
|
38
|
+
- Default: `''`
|
|
39
|
+
|
|
40
|
+
## Open
|
|
41
|
+
Use the `open` attribute to indicate whether the tooltip is open.
|
|
42
|
+
|
|
43
|
+
- Type: `boolean`
|
|
44
|
+
- Default: `false`
|
|
45
|
+
|
|
46
|
+
```html preview
|
|
47
|
+
<style>
|
|
48
|
+
.wrapper{
|
|
49
|
+
width: 100%;
|
|
50
|
+
height: 120px;
|
|
51
|
+
display: flex;
|
|
52
|
+
align-items: center;
|
|
53
|
+
justify-content: center;
|
|
54
|
+
}
|
|
55
|
+
vwc-tooltip#tooltip{
|
|
56
|
+
--tooltip-inline-size:200px;
|
|
57
|
+
}
|
|
58
|
+
</style>
|
|
59
|
+
<div class="wrapper">
|
|
60
|
+
<vwc-button id="button" icon="info-line" shape="pill" aria-describedby="tooltip"></vwc-button>
|
|
61
|
+
<vwc-tooltip id="tooltip" anchor="button" text="Click on the icon to toggle"></vwc-tooltip>
|
|
62
|
+
</div>
|
|
63
|
+
<script>
|
|
64
|
+
button.addEventListener('click', toggleOpen);
|
|
65
|
+
function toggleOpen() {
|
|
66
|
+
tooltip.open = !tooltip.open;
|
|
67
|
+
}
|
|
68
|
+
</script>
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Corner
|
|
72
|
+
|
|
73
|
+
Use the `corner` attribute to set the placement of the tooltip around the anchor.
|
|
74
|
+
|
|
75
|
+
- Type: `'top'` | `'top-start'` | `'top-end'` | `'right'` | `'right-start'` | `'right-end'` | `'bottom'` | `'bottom-start'` | `'bottom-end'`| `'left'` | `'left-start'`| `'left-end'`
|
|
76
|
+
- Default: `'left'`
|
|
77
|
+
|
|
78
|
+
```html preview
|
|
79
|
+
<style>
|
|
80
|
+
.wrapper{
|
|
81
|
+
width: 100%;
|
|
82
|
+
height: 220px;
|
|
83
|
+
display: flex;
|
|
84
|
+
align-items: center;
|
|
85
|
+
justify-content: center;
|
|
86
|
+
}
|
|
87
|
+
vwc-tooltip#tooltip2{
|
|
88
|
+
--tooltip-inline-size:100px;
|
|
89
|
+
}
|
|
90
|
+
</style>
|
|
91
|
+
<div class="wrapper">
|
|
92
|
+
<vwc-button id="anchor2" aria-describedby="tooltip2" appearance='outlined' label='This is an anchor'></vwc-button>
|
|
93
|
+
<vwc-tooltip id="tooltip2" anchor="anchor2" open text="right" corner="right">
|
|
94
|
+
</vwc-tooltip>
|
|
95
|
+
<vwc-tooltip id="tooltip2" anchor="anchor2" open text="left" corner="left">
|
|
96
|
+
</vwc-tooltip>
|
|
97
|
+
<vwc-tooltip id="tooltip2" anchor="anchor2" open text="top" corner="top">
|
|
98
|
+
</vwc-tooltip>
|
|
99
|
+
<vwc-tooltip id="tooltip2" anchor="anchor2" open text="bottom" corner="bottom">
|
|
100
|
+
</vwc-tooltip>
|
|
101
|
+
</div>
|
|
102
|
+
```
|
|
103
|
+
## Usage inside text
|
|
104
|
+
```html preview
|
|
105
|
+
<div>
|
|
106
|
+
<vwc-text font-face="body-1" tight>Text with tooltip - press the question mark<vwc-button id="button3" icon="help-line" shape="pill" aria-describedby="tooltip3"></vwc-button>more text after tooltip.</vwc-text>
|
|
107
|
+
<vwc-tooltip id="tooltip3" anchor="button3" corner="bottom-end" text="I'm the tooltip content"></vwc-tooltip>
|
|
108
|
+
</div>
|
|
109
|
+
<script>
|
|
110
|
+
button3.addEventListener('click', toggle);
|
|
111
|
+
function toggle() {
|
|
112
|
+
tooltip3.open = !tooltip3.open;
|
|
113
|
+
}
|
|
114
|
+
</script>
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
## Accessibility
|
|
118
|
+
Be sure to add `aria-describedby="vwc-tooltip's ID"` on the tooltip trigger element for screen readers readability.
|
|
119
|
+
|
|
120
|
+
```js
|
|
121
|
+
<vwc-button id="anchor" aria-describedby="tooltip"></vwc-button>
|
|
122
|
+
<vwc-tooltip id="tooltip" anchor="anchor"></vwc-tooltip>
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
## CSS Custom Properties
|
|
126
|
+
|
|
127
|
+
### Inline-size
|
|
128
|
+
- `--tooltip-inline-size`
|
|
129
|
+
- Type: `Number`
|
|
130
|
+
- Default: `240px`
|
|
131
|
+
|
|
132
|
+
Controls the tooltip width.
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import '../popup';
|
|
2
|
+
|
|
3
|
+
import type { FoundationElementDefinition } from '@microsoft/fast-foundation';
|
|
4
|
+
import { designSystem } from '../../shared/design-system';
|
|
5
|
+
import styles from './tooltip.scss';
|
|
6
|
+
|
|
7
|
+
import { Tooltip } from './tooltip';
|
|
8
|
+
import { TooltipTemplate as template } from './tooltip.template';
|
|
9
|
+
|
|
10
|
+
export const vividTooltip = Tooltip.compose<FoundationElementDefinition>({
|
|
11
|
+
baseName: 'tooltip',
|
|
12
|
+
template: template as any,
|
|
13
|
+
styles,
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
designSystem.register(vividTooltip());
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
$tooltip-inline-size: --tooltip-inline-size;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
@use 'partials/variables' as variables;
|
|
2
|
+
@use '../../../../../node_modules/@vonage/vivid-tokens/dist/sass/themes/consts' as theme-consts;
|
|
3
|
+
@use '../../../../shared/src/lib/sass/mixins/typography' as typography;
|
|
4
|
+
|
|
5
|
+
.control {
|
|
6
|
+
pointer-events: none;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.tooltip {
|
|
10
|
+
width: var(#{variables.$tooltip-inline-size}, 240px);
|
|
11
|
+
|
|
12
|
+
&-text {
|
|
13
|
+
@include typography.typography-cat-shorthand('body-2-bold');
|
|
14
|
+
|
|
15
|
+
padding: 8px 12px;
|
|
16
|
+
color: var(#{theme-consts.$vvd-color-on-canvas});
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { ADD_TEMPLATE_TO_FIXTURE, elementUpdated, fixture } from '@vivid-nx/shared';
|
|
2
|
+
import type { Button } from '../button/button';
|
|
3
|
+
import { Tooltip } from './tooltip';
|
|
4
|
+
import '.';
|
|
5
|
+
|
|
6
|
+
const COMPONENT_TAG = 'vwc-tooltip';
|
|
7
|
+
|
|
8
|
+
describe('vwc-tooltip', () => {
|
|
9
|
+
let element: Tooltip;
|
|
10
|
+
|
|
11
|
+
global.ResizeObserver = jest.fn()
|
|
12
|
+
.mockImplementation(() => ({
|
|
13
|
+
observe: jest.fn(),
|
|
14
|
+
unobserve: jest.fn(),
|
|
15
|
+
disconnect: jest.fn()
|
|
16
|
+
}));
|
|
17
|
+
|
|
18
|
+
beforeEach(async () => {
|
|
19
|
+
element = (await fixture(
|
|
20
|
+
`<${COMPONENT_TAG}></${COMPONENT_TAG}>`
|
|
21
|
+
)) as Tooltip;
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
describe('basic', () => {
|
|
25
|
+
it('should be initialized as a vwc-tooltip', async () => {
|
|
26
|
+
expect(element).toBeInstanceOf(Tooltip);
|
|
27
|
+
expect(element.open)
|
|
28
|
+
.toBeFalsy();
|
|
29
|
+
expect(element.anchor)
|
|
30
|
+
.toBeUndefined();
|
|
31
|
+
expect(element.corner)
|
|
32
|
+
.toBeUndefined;
|
|
33
|
+
expect(element.text)
|
|
34
|
+
.toEqual('');
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
describe('show', () => {
|
|
39
|
+
it('should set "open" to true', async () => {
|
|
40
|
+
await setAnchor();
|
|
41
|
+
element.anchor = 'anchor';
|
|
42
|
+
await elementUpdated(element);
|
|
43
|
+
|
|
44
|
+
element.open = true;
|
|
45
|
+
await elementUpdated(element);
|
|
46
|
+
|
|
47
|
+
expect(element.open)
|
|
48
|
+
.toEqual(true);
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
describe('hide', () => {
|
|
53
|
+
it('should set "open" to false', async () => {
|
|
54
|
+
element.open = false;
|
|
55
|
+
await elementUpdated(element);
|
|
56
|
+
|
|
57
|
+
expect(element.open)
|
|
58
|
+
.toEqual(false);
|
|
59
|
+
});
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
*
|
|
64
|
+
*/
|
|
65
|
+
async function setAnchor() {
|
|
66
|
+
const anchorEl = await fixture('<vwc-button id="anchor"></vwc-button>', ADD_TEMPLATE_TO_FIXTURE) as Button;
|
|
67
|
+
await elementUpdated(anchorEl);
|
|
68
|
+
return anchorEl;
|
|
69
|
+
}
|
|
70
|
+
});
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { html } from '@microsoft/fast-element';
|
|
2
|
+
import type { ViewTemplate } from '@microsoft/fast-element';
|
|
3
|
+
import type {
|
|
4
|
+
ElementDefinitionContext,
|
|
5
|
+
FoundationElementDefinition,
|
|
6
|
+
} from '@microsoft/fast-foundation';
|
|
7
|
+
import { classNames } from '@microsoft/fast-web-utilities';
|
|
8
|
+
import type { Tooltip } from './tooltip';
|
|
9
|
+
|
|
10
|
+
const getClasses = (_: Tooltip) => classNames('control');
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* The template for the {@link @microsoft/fast-foundation#Tooltip} component.
|
|
14
|
+
*
|
|
15
|
+
* @param context
|
|
16
|
+
* @public
|
|
17
|
+
*/
|
|
18
|
+
export const TooltipTemplate: (
|
|
19
|
+
context: ElementDefinitionContext,
|
|
20
|
+
definition: FoundationElementDefinition
|
|
21
|
+
) => ViewTemplate<Tooltip> = () => html`
|
|
22
|
+
<vwc-popup class="${getClasses}" arrow alternate="true"
|
|
23
|
+
corner=${(x) => x.corner} open=${(x) => x.open} anchor=${(x) => x.anchor}
|
|
24
|
+
exportparts="vvd-theme-alternate">
|
|
25
|
+
<div class="tooltip">
|
|
26
|
+
<header part="vvd-theme-alternate" class="tooltip-header">
|
|
27
|
+
<div class="tooltip-text">${(x) => x.text}</div>
|
|
28
|
+
</header>
|
|
29
|
+
</div>
|
|
30
|
+
</vwc-popup>`;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { FoundationElement } from '@microsoft/fast-foundation';
|
|
2
|
+
import { attr } from '@microsoft/fast-element';
|
|
3
|
+
import type { Placement } from '@floating-ui/dom';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Base class for tooltip
|
|
7
|
+
*
|
|
8
|
+
* @public
|
|
9
|
+
*/
|
|
10
|
+
export class Tooltip extends FoundationElement {
|
|
11
|
+
/**
|
|
12
|
+
* the text of the tooltip
|
|
13
|
+
* accepts string
|
|
14
|
+
*
|
|
15
|
+
* @public
|
|
16
|
+
*/
|
|
17
|
+
@attr({ mode: 'fromView' }) text = '';
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* indicates whether the tooltip is open
|
|
21
|
+
*
|
|
22
|
+
* @public
|
|
23
|
+
* HTML Attribute: open
|
|
24
|
+
*/
|
|
25
|
+
@attr({
|
|
26
|
+
mode: 'boolean',
|
|
27
|
+
}) open = false;
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* the placement of the tooltip
|
|
31
|
+
*
|
|
32
|
+
* @public
|
|
33
|
+
* HTML Attribute: corner
|
|
34
|
+
*/
|
|
35
|
+
@attr corner?: Placement;
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* ID reference to element in the tooltip's owner document.
|
|
39
|
+
*
|
|
40
|
+
* @public
|
|
41
|
+
* HTML Attribute: anchor
|
|
42
|
+
*/
|
|
43
|
+
@attr anchor?: string;
|
|
44
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
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 = ['tooltip','button'];
|
|
9
|
+
|
|
10
|
+
test('should show the component', async ({ page }: { page: Page }) => {
|
|
11
|
+
const template = `
|
|
12
|
+
<style>
|
|
13
|
+
.wrapper{
|
|
14
|
+
width: 100%;
|
|
15
|
+
height: 220px;
|
|
16
|
+
display: flex;
|
|
17
|
+
align-items: center;
|
|
18
|
+
justify-content: center;
|
|
19
|
+
}
|
|
20
|
+
vwc-tooltip#tooltip{
|
|
21
|
+
--tooltip-inline-size:100px;
|
|
22
|
+
}
|
|
23
|
+
</style>
|
|
24
|
+
<div class="wrapper">
|
|
25
|
+
<vwc-button id="anchor" aria-describedby="tooltip" appearance='outlined' label='This is an anchor'></vwc-button>
|
|
26
|
+
<vwc-tooltip id="tooltip" anchor="anchor" open text="right" corner="right">
|
|
27
|
+
</vwc-tooltip>
|
|
28
|
+
<vwc-tooltip id="tooltip" anchor="anchor" open text="left" corner="left">
|
|
29
|
+
</vwc-tooltip>
|
|
30
|
+
<vwc-tooltip id="tooltip" anchor="anchor" open text="top" corner="top">
|
|
31
|
+
</vwc-tooltip>
|
|
32
|
+
<vwc-tooltip id="tooltip" anchor="anchor" open text="bottom" corner="bottom">
|
|
33
|
+
</vwc-tooltip>
|
|
34
|
+
</div>
|
|
35
|
+
`;
|
|
36
|
+
|
|
37
|
+
await loadComponents({
|
|
38
|
+
page,
|
|
39
|
+
components,
|
|
40
|
+
});
|
|
41
|
+
await loadTemplate({
|
|
42
|
+
page,
|
|
43
|
+
template,
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
const testWrapper = await page.$('#wrapper');
|
|
47
|
+
|
|
48
|
+
await page.waitForLoadState('networkidle');
|
|
49
|
+
|
|
50
|
+
expect(await testWrapper?.screenshot()).toMatchSnapshot(
|
|
51
|
+
'./snapshots/tooltip.png'
|
|
52
|
+
);
|
|
53
|
+
});
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { DesignSystem } from '@microsoft/fast-foundation';
|
|
2
|
+
|
|
3
|
+
// common components dependency
|
|
4
|
+
/**
|
|
5
|
+
* @param {HTMLElement} element - The element to get or create a design system for.
|
|
6
|
+
* @returns {DesignSystem} - Represents a configurable design system. An API gateway to design system features.
|
|
7
|
+
*/
|
|
8
|
+
export function provideVividDesignSystem(element?: HTMLElement): DesignSystem {
|
|
9
|
+
return DesignSystem.getOrCreate(element).withPrefix('vwc');
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export const designSystem = provideVividDesignSystem();
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { attr, html } from '@microsoft/fast-element';
|
|
2
|
+
import type { ViewTemplate } from '@microsoft/fast-element';
|
|
3
|
+
import type { ElementDefinitionContext } from '@microsoft/fast-foundation';
|
|
4
|
+
import { Icon } from '../../lib/icon/icon';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* A mixin class implementing prefix elements.
|
|
8
|
+
* These are generally used to decorate text elements with icons or other visual indicators.
|
|
9
|
+
*
|
|
10
|
+
* @public
|
|
11
|
+
*/
|
|
12
|
+
export class AffixIcon {
|
|
13
|
+
/**
|
|
14
|
+
* A decorative icon the custom element should have.
|
|
15
|
+
*
|
|
16
|
+
* @public
|
|
17
|
+
* @remarks
|
|
18
|
+
* HTML Attribute: icon
|
|
19
|
+
*/
|
|
20
|
+
@attr icon?: string;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* A mixin class implementing icon affix (prefix or suffix) alignment.
|
|
25
|
+
*
|
|
26
|
+
* @public
|
|
27
|
+
*/
|
|
28
|
+
export class AffixIconWithTrailing extends AffixIcon {
|
|
29
|
+
/**
|
|
30
|
+
* Indicates the icon affix alignment.
|
|
31
|
+
*
|
|
32
|
+
* @public
|
|
33
|
+
* @remarks
|
|
34
|
+
* HTML Attribute: icon-trailing
|
|
35
|
+
*/
|
|
36
|
+
@attr({
|
|
37
|
+
mode: 'boolean',
|
|
38
|
+
attribute: 'icon-trailing',
|
|
39
|
+
}) iconTrailing = false;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* The template for the prefixed element.
|
|
44
|
+
* For use with {@link AffixIcon}
|
|
45
|
+
*
|
|
46
|
+
* @param context
|
|
47
|
+
* @param icon
|
|
48
|
+
* @public
|
|
49
|
+
*/
|
|
50
|
+
export const affixIconTemplateFactory: (context: ElementDefinitionContext) =>
|
|
51
|
+
(icon?: string) => ViewTemplate<AffixIcon> | null = (context: ElementDefinitionContext) => {
|
|
52
|
+
const iconTag = context.tagFor(Icon);
|
|
53
|
+
return (icon?: string) => icon
|
|
54
|
+
? html`<span class="icon"><${iconTag} :type="${() => icon}"></${iconTag}></span>`
|
|
55
|
+
: null;
|
|
56
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './affix';
|
|
1
|
+
export * from './affix';
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import * as fs from 'fs';
|
|
2
|
+
import * as path from 'path';
|
|
3
|
+
import type {Page} from '@playwright/test';
|
|
4
|
+
import * as extract from 'extract-gfm';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* @param str
|
|
8
|
+
* @param find
|
|
9
|
+
* @param replace
|
|
10
|
+
*/
|
|
11
|
+
export function replaceAll(str: string, find: string, replace: string) {
|
|
12
|
+
return str.replace(new RegExp(find, 'g'), replace);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* @param pathToReadme
|
|
17
|
+
*/
|
|
18
|
+
export function extractHTMLBlocksFromReadme(pathToReadme: string): string[] {
|
|
19
|
+
const readmeFileContents = fs.readFileSync(path.resolve(pathToReadme))
|
|
20
|
+
.toString();
|
|
21
|
+
const readmeFileSnippets = extract.extractBlocks(readmeFileContents);
|
|
22
|
+
return readmeFileSnippets.filter((block: any) => block.lang === 'html')
|
|
23
|
+
.map((block: any) => replaceAll(block.code.replace('preview', ''), '\n', ''));
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const defaultStyles = [
|
|
27
|
+
'http://127.0.0.1:8080/dist/libs/styles/fonts/spezia.css',
|
|
28
|
+
'http://127.0.0.1:8080/dist/libs/styles/themes/light.css'
|
|
29
|
+
];
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* @param root0
|
|
33
|
+
* @param root0.page
|
|
34
|
+
* @param root0.components
|
|
35
|
+
* @param root0.styleUrls
|
|
36
|
+
*/
|
|
37
|
+
export async function loadComponents({
|
|
38
|
+
page,
|
|
39
|
+
components,
|
|
40
|
+
styleUrls = defaultStyles,
|
|
41
|
+
}: {
|
|
42
|
+
page: Page,
|
|
43
|
+
components: string[],
|
|
44
|
+
styleUrls?: string[]
|
|
45
|
+
}) {
|
|
46
|
+
await page.goto('http://127.0.0.1:8080/scripts/visual-tests/index.html');
|
|
47
|
+
|
|
48
|
+
(async function () {
|
|
49
|
+
for (const component of components) {
|
|
50
|
+
await page.addScriptTag({
|
|
51
|
+
url: `http://127.0.0.1:8080/dist/libs/components/${component}/index.js`,
|
|
52
|
+
type: 'module',
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
})();
|
|
56
|
+
|
|
57
|
+
const styleTags$ = styleUrls.map(url => page.addStyleTag({url}));
|
|
58
|
+
await Promise.all(styleTags$);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* @param root0
|
|
63
|
+
* @param root0.page
|
|
64
|
+
* @param root0.template
|
|
65
|
+
*/
|
|
66
|
+
export async function loadTemplate({
|
|
67
|
+
page,
|
|
68
|
+
template,
|
|
69
|
+
}: { page: Page, template: string }) {
|
|
70
|
+
const wrappedTemplate = `<div id="wrapper">${template}</div>`;
|
|
71
|
+
await page.addScriptTag({
|
|
72
|
+
content: `
|
|
73
|
+
document.body.innerHTML = \`${wrappedTemplate}\`;
|
|
74
|
+
`,
|
|
75
|
+
});
|
|
76
|
+
}
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "../../tsconfig.base.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"target": "ES2017",
|
|
5
|
+
"module": "ES2015",
|
|
6
|
+
"preserveWatchOutput": true,
|
|
7
|
+
"moduleResolution": "Node",
|
|
8
|
+
"sourceMap": true,
|
|
9
|
+
"inlineSources": true,
|
|
10
|
+
"noFallthroughCasesInSwitch": true,
|
|
11
|
+
"isolatedModules": true,
|
|
12
|
+
"noImplicitReturns": true,
|
|
13
|
+
"noImplicitOverride": true,
|
|
14
|
+
"noUnusedLocals": true,
|
|
15
|
+
"noUnusedParameters": true,
|
|
16
|
+
"forceConsistentCasingInFileNames": true,
|
|
17
|
+
"importsNotUsedAsValues": "error",
|
|
18
|
+
"strict": true,
|
|
19
|
+
"experimentalDecorators": true,
|
|
20
|
+
"stripInternal": true, // check if we need it
|
|
21
|
+
"importHelpers": true,
|
|
22
|
+
"allowSyntheticDefaultImports": true,
|
|
23
|
+
"removeComments": true,
|
|
24
|
+
"composite": true
|
|
25
|
+
},
|
|
26
|
+
"files": [],
|
|
27
|
+
"include": [],
|
|
28
|
+
"references": [
|
|
29
|
+
{
|
|
30
|
+
"path": "./tsconfig.lib.json",
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"path": "./tsconfig.spec.json"
|
|
34
|
+
}
|
|
35
|
+
]
|
|
36
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "./tsconfig.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"rootDirs": ["src", "src/lib"],
|
|
5
|
+
"outDir": "../../dist/out-tsc",
|
|
6
|
+
"declaration": true,
|
|
7
|
+
"types": ["node"]
|
|
8
|
+
},
|
|
9
|
+
"exclude": ["**/*.spec.ts", "**/*.test.ts", "**/*.config.*.ts", "**/visual-tests/**/*", "*.*"],
|
|
10
|
+
"include": ["**/*.ts"]
|
|
11
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "./tsconfig.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"outDir": "../../dist/out-tsc",
|
|
5
|
+
"module": "commonjs",
|
|
6
|
+
"types": ["jest", "node"],
|
|
7
|
+
"allowJs": true,
|
|
8
|
+
},
|
|
9
|
+
"exclude": [
|
|
10
|
+
"**/*.config.spec.ts",
|
|
11
|
+
],
|
|
12
|
+
"include": [
|
|
13
|
+
"**/*.spec.ts",
|
|
14
|
+
"**/*.d.ts"
|
|
15
|
+
]
|
|
16
|
+
}
|
package/accordion/index.js
DELETED
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import { F as FoundationElement, _ as __decorate, a as attr, b as __metadata, h as html, d as designSystem } from '../shared/index.js';
|
|
2
|
-
import { s as styleInject } from '../shared/style-inject.es.js';
|
|
3
|
-
import { c as classNames } from '../shared/class-names.js';
|
|
4
|
-
|
|
5
|
-
var css_248z = ".control {\n display: flex;\n flex-direction: column;\n}\n\n::slotted(vwc-accordion-item:not(:only-of-type)) {\n border-bottom: 1px solid var(--vvd-color-neutral-30);\n}";
|
|
6
|
-
styleInject(css_248z);
|
|
7
|
-
|
|
8
|
-
class Accordion extends FoundationElement {
|
|
9
|
-
constructor() {
|
|
10
|
-
super();
|
|
11
|
-
this.accordionItems = undefined;
|
|
12
|
-
this.multi = false;
|
|
13
|
-
this.addEventListener('opened', this.handleOpened);
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
connectedCallback() {
|
|
17
|
-
super.connectedCallback();
|
|
18
|
-
this.accordionItems = this.children;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
handleOpened(e) {
|
|
22
|
-
if (!this.multi && this.accordionItems) {
|
|
23
|
-
for (let i = 0; i < this.accordionItems.length; i++) {
|
|
24
|
-
if (this.accordionItems[i] !== e.target) {
|
|
25
|
-
this.accordionItems[i].open = false;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
closeAll() {
|
|
32
|
-
if (this.accordionItems) {
|
|
33
|
-
for (let i = 0; i < this.accordionItems.length; i++) {
|
|
34
|
-
this.accordionItems[i].open = false;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
__decorate([attr({
|
|
42
|
-
mode: 'boolean'
|
|
43
|
-
}), __metadata("design:type", Object)], Accordion.prototype, "multi", void 0);
|
|
44
|
-
|
|
45
|
-
let _2 = t => t,
|
|
46
|
-
_t;
|
|
47
|
-
|
|
48
|
-
const getClasses = _ => classNames('control');
|
|
49
|
-
|
|
50
|
-
const AccordionTemplate = () => html(_t || (_t = _2`<div class="${0}">
|
|
51
|
-
<slot></slot>
|
|
52
|
-
</div>`), getClasses);
|
|
53
|
-
|
|
54
|
-
const vividAccordion = Accordion.compose({
|
|
55
|
-
baseName: 'accordion',
|
|
56
|
-
template: AccordionTemplate,
|
|
57
|
-
styles: css_248z
|
|
58
|
-
});
|
|
59
|
-
designSystem.register(vividAccordion());
|
|
60
|
-
|
|
61
|
-
export { vividAccordion };
|