@ethlete/components 0.1.0-next.9 → 1.0.0-next.101
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/CHANGELOG.md +3519 -0
- package/README.md +1 -1
- package/design/accordion.ts +73 -0
- package/design/anchored-dialog.ts +102 -0
- package/design/avatar.ts +90 -0
- package/design/badge.ts +48 -0
- package/design/banner.ts +77 -0
- package/design/bracket.ts +457 -0
- package/design/breadcrumb.ts +144 -0
- package/design/button.ts +116 -0
- package/design/calendar.ts +306 -0
- package/design/card.ts +92 -0
- package/design/carousel.ts +240 -0
- package/design/chart.ts +512 -0
- package/design/checkbox.ts +275 -0
- package/design/chip.ts +64 -0
- package/design/config.json +26 -0
- package/design/control.ts +19 -0
- package/design/copy-button.ts +59 -0
- package/design/description-list.ts +41 -0
- package/design/dialog.ts +210 -0
- package/design/divider.ts +27 -0
- package/design/empty-state.ts +45 -0
- package/design/floating-action.ts +55 -0
- package/design/form-field.ts +256 -0
- package/design/grid.ts +148 -0
- package/design/icon-set.ts +19 -0
- package/design/icon.ts +9 -0
- package/design/input.ts +86 -0
- package/design/kbd.ts +19 -0
- package/design/loader.ts +156 -0
- package/design/masonry.ts +115 -0
- package/design/match.ts +131 -0
- package/design/menu.ts +149 -0
- package/design/notification.ts +132 -0
- package/design/otp-input.ts +107 -0
- package/design/pagination.ts +120 -0
- package/design/picture.ts +80 -0
- package/design/progress-steps.ts +79 -0
- package/design/query-error.ts +60 -0
- package/design/radio-group.ts +132 -0
- package/design/scheduler.ts +369 -0
- package/design/scrollable.ts +219 -0
- package/design/scrollbar.ts +47 -0
- package/design/sdk/assets/fallback.svg +1 -0
- package/design/sdk/assets/fonts/et-kbd-arrows-400-normal.woff2 +0 -0
- package/design/sdk/assets/fonts/et-kbd-control-400-normal.woff2 +0 -0
- package/design/sdk/assets/fonts/et-kbd-keys-400-normal.woff2 +0 -0
- package/design/sdk/assets/fonts/source-code-pro-latin-wght-normal.woff2 +0 -0
- package/design/sdk/assets/fonts/source-sans-3-latin-wght-normal.woff2 +0 -0
- package/design/sdk/assets/tall.svg +1 -0
- package/design/sdk/assets/wide.svg +1 -0
- package/design/sdk/components/accent-on-light/accent-on-light.css +35 -0
- package/design/sdk/components/accent-on-light/accent-on-light.ts +15 -0
- package/design/sdk/components/accent-on-light/shared/controls.ts +46 -0
- package/design/sdk/components/accordion/accordion.css +17 -0
- package/design/sdk/components/accordion/accordion.ts +79 -0
- package/design/sdk/components/action-sheet/action-sheet.css +124 -0
- package/design/sdk/components/action-sheet/action-sheet.ts +131 -0
- package/design/sdk/components/anchored-dialog/anchored-dialog.css +60 -0
- package/design/sdk/components/anchored-dialog/anchored-dialog.ts +89 -0
- package/design/sdk/components/avatar/avatar.css +14 -0
- package/design/sdk/components/avatar/avatar.ts +95 -0
- package/design/sdk/components/badge/badge.css +31 -0
- package/design/sdk/components/badge/badge.ts +89 -0
- package/design/sdk/components/banner/banner.css +18 -0
- package/design/sdk/components/banner/banner.ts +160 -0
- package/design/sdk/components/bracket/bracket.css +56 -0
- package/design/sdk/components/bracket/bracket.ts +183 -0
- package/design/sdk/components/breadcrumb/breadcrumb.css +25 -0
- package/design/sdk/components/breadcrumb/breadcrumb.ts +96 -0
- package/design/sdk/components/button/button.css +19 -0
- package/design/sdk/components/button/button.ts +201 -0
- package/design/sdk/components/calendar/calendar.css +33 -0
- package/design/sdk/components/calendar/calendar.ts +183 -0
- package/design/sdk/components/card/card.css +19 -0
- package/design/sdk/components/card/card.ts +111 -0
- package/design/sdk/components/carousel/carousel.css +44 -0
- package/design/sdk/components/carousel/carousel.ts +162 -0
- package/design/sdk/components/chart/chart.css +56 -0
- package/design/sdk/components/chart/chart.ts +146 -0
- package/design/sdk/components/checkbox/checkbox.css +10 -0
- package/design/sdk/components/checkbox/checkbox.ts +223 -0
- package/design/sdk/components/chip/chip.css +18 -0
- package/design/sdk/components/chip/chip.ts +99 -0
- package/design/sdk/components/copy-button/copy-button.css +14 -0
- package/design/sdk/components/copy-button/copy-button.ts +77 -0
- package/design/sdk/components/description-list/description-list.css +7 -0
- package/design/sdk/components/description-list/description-list.ts +64 -0
- package/design/sdk/components/dialog/dialog.css +29 -0
- package/design/sdk/components/dialog/dialog.ts +173 -0
- package/design/sdk/components/divider/divider.css +26 -0
- package/design/sdk/components/divider/divider.ts +49 -0
- package/design/sdk/components/empty-state/empty-state.css +39 -0
- package/design/sdk/components/empty-state/empty-state.ts +67 -0
- package/design/sdk/components/floating-action/floating-action.css +51 -0
- package/design/sdk/components/floating-action/floating-action.ts +78 -0
- package/design/sdk/components/form-field/form-field.ts +204 -0
- package/design/sdk/components/grid/grid.css +17 -0
- package/design/sdk/components/grid/grid.ts +96 -0
- package/design/sdk/components/input/input.css +48 -0
- package/design/sdk/components/input/input.ts +156 -0
- package/design/sdk/components/kbd/kbd.css +25 -0
- package/design/sdk/components/kbd/kbd.ts +70 -0
- package/design/sdk/components/loader/loader.css +37 -0
- package/design/sdk/components/loader/loader.ts +79 -0
- package/design/sdk/components/masonry/masonry.css +7 -0
- package/design/sdk/components/masonry/masonry.ts +50 -0
- package/design/sdk/components/match/match.css +22 -0
- package/design/sdk/components/match/match.ts +95 -0
- package/design/sdk/components/menu/menu.css +22 -0
- package/design/sdk/components/menu/menu.ts +120 -0
- package/design/sdk/components/notification/notification.css +32 -0
- package/design/sdk/components/notification/notification.ts +117 -0
- package/design/sdk/components/otp-input/otp-input.css +35 -0
- package/design/sdk/components/otp-input/otp-input.ts +94 -0
- package/design/sdk/components/pagination/pagination.css +14 -0
- package/design/sdk/components/pagination/pagination.ts +97 -0
- package/design/sdk/components/picture/picture.css +37 -0
- package/design/sdk/components/picture/picture.ts +112 -0
- package/design/sdk/components/progress-steps/progress-steps.css +37 -0
- package/design/sdk/components/progress-steps/progress-steps.ts +109 -0
- package/design/sdk/components/query-error/query-error.css +27 -0
- package/design/sdk/components/query-error/query-error.ts +167 -0
- package/design/sdk/components/radio-group/radio-group.css +10 -0
- package/design/sdk/components/radio-group/radio-group.ts +209 -0
- package/design/sdk/components/scheduler/scheduler.css +49 -0
- package/design/sdk/components/scheduler/scheduler.ts +267 -0
- package/design/sdk/components/scrollable/scrollable.css +58 -0
- package/design/sdk/components/scrollable/scrollable.ts +198 -0
- package/design/sdk/components/scrollbar/scrollbar.css +78 -0
- package/design/sdk/components/scrollbar/scrollbar.ts +152 -0
- package/design/sdk/components/select/select.css +5 -0
- package/design/sdk/components/select/select.ts +42 -0
- package/design/sdk/components/select/shared/select-part.ts +80 -0
- package/design/sdk/components/select-panel/select-panel.css +3 -0
- package/design/sdk/components/select-panel/select-panel.ts +144 -0
- package/design/sdk/components/skeleton/skeleton.css +22 -0
- package/design/sdk/components/skeleton/skeleton.ts +58 -0
- package/design/sdk/components/slider/slider.css +47 -0
- package/design/sdk/components/slider/slider.ts +133 -0
- package/design/sdk/components/standings/standings.css +32 -0
- package/design/sdk/components/standings/standings.ts +146 -0
- package/design/sdk/components/stat-tile/stat-tile.css +15 -0
- package/design/sdk/components/stat-tile/stat-tile.ts +97 -0
- package/design/sdk/components/stream/stream.css +42 -0
- package/design/sdk/components/stream/stream.ts +63 -0
- package/design/sdk/components/switch/switch.ts +94 -0
- package/design/sdk/components/table/table.css +67 -0
- package/design/sdk/components/table/table.ts +320 -0
- package/design/sdk/components/tabs/tabs.css +13 -0
- package/design/sdk/components/tabs/tabs.ts +95 -0
- package/design/sdk/components/textarea/textarea.css +90 -0
- package/design/sdk/components/textarea/textarea.ts +154 -0
- package/design/sdk/components/timeline/timeline.css +30 -0
- package/design/sdk/components/timeline/timeline.ts +98 -0
- package/design/sdk/components/toolbar/toolbar.css +24 -0
- package/design/sdk/components/toolbar/toolbar.ts +104 -0
- package/design/sdk/components/tooltip/tooltip.css +15 -0
- package/design/sdk/components/tooltip/tooltip.ts +39 -0
- package/design/sdk/components/tree/selected-tint.css +15 -0
- package/design/sdk/components/tree/tree.ts +89 -0
- package/design/sdk/fixtures.ts +0 -0
- package/design/sdk/foundations/colors/colors.css +602 -0
- package/design/sdk/foundations/colors/colors.ts +218 -0
- package/design/sdk/foundations/colors/faces.css +75 -0
- package/design/sdk/foundations/colors/overrides.json +19 -0
- package/design/sdk/foundations/colors/shared/contrast.ts +105 -0
- package/design/sdk/foundations/elevation/elevation.css +6 -0
- package/design/sdk/foundations/elevation/elevation.ts +18 -0
- package/design/sdk/foundations/elevation/shared/elevation/scene.css +106 -0
- package/design/sdk/foundations/elevation/shared/elevation/scene.ts +74 -0
- package/design/sdk/foundations/icons/icons.ts +125 -0
- package/design/sdk/lint-baseline.json +6 -0
- package/design/sdk/ready.json +488 -0
- package/design/sdk/rule-baseline.json +48 -0
- package/design/select.ts +199 -0
- package/design/skeleton.ts +67 -0
- package/design/slider.ts +155 -0
- package/design/standings.ts +166 -0
- package/design/stat-tile.ts +109 -0
- package/design/stream.ts +92 -0
- package/design/switch.ts +83 -0
- package/design/table.ts +309 -0
- package/design/tabs.ts +75 -0
- package/design/textarea.ts +94 -0
- package/design/timeline.ts +52 -0
- package/design/toggletip.ts +85 -0
- package/design/toolbar.ts +95 -0
- package/design/tooltip.ts +95 -0
- package/design/tree.ts +106 -0
- package/fesm2022/ethlete-components-testing.mjs +440 -0
- package/fesm2022/ethlete-components-testing.mjs.map +1 -0
- package/fesm2022/ethlete-components.mjs +115628 -12455
- package/fesm2022/ethlete-components.mjs.map +1 -1
- package/generators/component/component-names.js +42 -0
- package/generators/component/component-templates.js +211 -0
- package/generators/component/generator.js +144 -0
- package/generators/component/schema.json +109 -0
- package/generators/component/workspace-edits.js +92 -0
- package/generators/generators.json +126 -0
- package/generators/icons/generator.js +231 -0
- package/generators/icons/schema.json +35 -0
- package/generators/migrate-bracket-default-cards/bracket-default-cards.js +67 -0
- package/generators/migrate-bracket-default-cards/migration.js +63 -0
- package/generators/migrate-bracket-default-cards/schema.json +26 -0
- package/generators/migrate-bracket-ethlete-renames/bracket-ethlete-renames.js +15 -0
- package/generators/migrate-bracket-ethlete-renames/migration.js +31 -0
- package/generators/migrate-bracket-ethlete-renames/schema.json +26 -0
- package/generators/migrate-cascader-tree-internals/cascader-tree-internals.js +6 -0
- package/generators/migrate-cascader-tree-internals/migration.js +11 -0
- package/generators/migrate-cascader-tree-internals/schema.json +26 -0
- package/generators/migrate-chart-baseline-y/chart-baseline-y.js +10 -0
- package/generators/migrate-chart-baseline-y/migration.js +41 -0
- package/generators/migrate-chart-baseline-y/schema.json +26 -0
- package/generators/migrate-duration-format-internals/duration-format-internals.js +6 -0
- package/generators/migrate-duration-format-internals/migration.js +11 -0
- package/generators/migrate-duration-format-internals/schema.json +26 -0
- package/generators/migrate-error-color-theme-signal/error-color-theme-signal.js +37 -0
- package/generators/migrate-error-color-theme-signal/migration.js +55 -0
- package/generators/migrate-error-color-theme-signal/schema.json +26 -0
- package/generators/migrate-grid-engine-internals/grid-engine-internals.js +43 -0
- package/generators/migrate-grid-engine-internals/migration.js +11 -0
- package/generators/migrate-grid-engine-internals/schema.json +26 -0
- package/generators/migrate-line-chart-stacked-area-mix/line-chart-stacked-area-mix.js +48 -0
- package/generators/migrate-line-chart-stacked-area-mix/migration.js +35 -0
- package/generators/migrate-line-chart-stacked-area-mix/schema.json +26 -0
- package/generators/migrate-loader-determinate/loader-determinate.js +87 -0
- package/generators/migrate-loader-determinate/migration.js +49 -0
- package/generators/migrate-loader-determinate/schema.json +26 -0
- package/generators/migrate-overlay-and-column-api/column-visibility-host.js +102 -0
- package/generators/migrate-overlay-and-column-api/migration.js +39 -0
- package/generators/migrate-overlay-and-column-api/overlay-and-column-api.js +18 -0
- package/generators/migrate-overlay-and-column-api/overlay-result.js +399 -0
- package/generators/migrate-overlay-and-column-api/schema.json +26 -0
- package/generators/migrate-overlay-and-column-api/source-scan.js +171 -0
- package/generators/migrate-overlay-fullscreen-animation/migration.js +11 -0
- package/generators/migrate-overlay-fullscreen-animation/overlay-fullscreen-animation.js +16 -0
- package/generators/migrate-overlay-fullscreen-animation/schema.json +26 -0
- package/generators/migrate-overlay-nav-tab-imports/migration.js +35 -0
- package/generators/migrate-overlay-nav-tab-imports/overlay-nav-tab-imports.js +25 -0
- package/generators/migrate-overlay-nav-tab-imports/schema.json +26 -0
- package/generators/migrate-pip-window-z-index/migration.js +85 -0
- package/generators/migrate-pip-window-z-index/pip-window-z-index.js +60 -0
- package/generators/migrate-pip-window-z-index/schema.json +26 -0
- package/generators/migrate-query-error-labels/migration-scope.js +30 -0
- package/generators/migrate-query-error-labels/migration.js +58 -0
- package/generators/migrate-query-error-labels/query-error-labels.js +30 -0
- package/generators/migrate-query-error-labels/schema.json +26 -0
- package/generators/migrate-rich-text-editor-floating-toolbar/migration.js +57 -0
- package/generators/migrate-rich-text-editor-floating-toolbar/rich-text-editor-floating-toolbar.js +28 -0
- package/generators/migrate-rich-text-editor-floating-toolbar/schema.json +26 -0
- package/generators/migrate-rich-text-editor-link-editor/migration.js +57 -0
- package/generators/migrate-rich-text-editor-link-editor/rich-text-editor-link-editor.js +28 -0
- package/generators/migrate-rich-text-editor-link-editor/schema.json +26 -0
- package/generators/migrate-rich-text-editor-tools/migration.js +64 -0
- package/generators/migrate-rich-text-editor-tools/rich-text-editor-tools.js +36 -0
- package/generators/migrate-rich-text-editor-tools/schema.json +26 -0
- package/generators/migrate-select-input-renames/migration.js +41 -0
- package/generators/migrate-select-input-renames/schema.json +26 -0
- package/generators/migrate-select-input-renames/select-input-renames.js +37 -0
- package/generators/migrate-stream-default-components/migration.js +86 -0
- package/generators/migrate-stream-default-components/schema.json +26 -0
- package/generators/migrate-stream-default-components/stream-default-components.js +111 -0
- package/generators/migrate-tabs-active-underline/migration.js +31 -0
- package/generators/migrate-tabs-active-underline/schema.json +26 -0
- package/generators/migrate-tabs-active-underline/tabs-active-underline.js +46 -0
- package/generators/migrate-time-picker-ring/migration.js +17 -0
- package/generators/migrate-time-picker-ring/schema.json +26 -0
- package/generators/migrate-time-picker-ring/time-picker-ring.js +25 -0
- package/generators/migrate-youtube-player-slot-directive/migration.js +11 -0
- package/generators/migrate-youtube-player-slot-directive/schema.json +26 -0
- package/generators/migrate-youtube-player-slot-directive/youtube-player-slot-directive.js +12 -0
- package/generators/removed-exports/removed-exports.js +154 -0
- package/generators/removed-exports/run-removed-exports-migration.js +48 -0
- package/migrations/components-sdk-layer.md +55 -0
- package/migrations.json +211 -0
- package/package.json +47 -17
- package/src/lib/accordion/accordion-group.component.css +12 -0
- package/src/lib/accordion/accordion.component.css +236 -0
- package/src/lib/avatar/avatar-group.component.css +31 -0
- package/src/lib/avatar/avatar.component.css +90 -0
- package/src/lib/badge/badge.component.css +118 -0
- package/src/lib/banner/banner.component.css +102 -0
- package/src/lib/bracket/bracket-default-continue.component.css +29 -0
- package/src/lib/bracket/bracket-default-final-match.component.css +76 -0
- package/src/lib/bracket/bracket-default-match.component.css +21 -0
- package/src/lib/bracket/bracket-default-round-header.component.css +36 -0
- package/src/lib/bracket/bracket-default-section-title.component.css +14 -0
- package/src/lib/bracket/bracket-participants.component.css +13 -0
- package/src/lib/bracket/bracket-pick-card.component.css +232 -0
- package/src/lib/bracket/bracket-rounds-list.component.css +75 -0
- package/src/lib/bracket/bracket-skeleton.component.css +55 -0
- package/src/lib/bracket/bracket.component.css +123 -0
- package/src/lib/bracket/layouts/swiss/bracket-swiss-round-header.component.css +65 -0
- package/src/lib/bracket/layouts/swiss/bracket-swiss-styles.component.css +14 -0
- package/src/lib/breadcrumb/breadcrumb-outlet.component.css +5 -0
- package/src/lib/breadcrumb/breadcrumb-overflow.component.css +38 -0
- package/src/lib/breadcrumb/breadcrumb.component.css +126 -0
- package/src/lib/button/button-properties-styles.component.css +195 -0
- package/src/lib/button/button.component.css +259 -0
- package/src/lib/button/button.types.ts +33 -0
- package/src/lib/button/fab.component.css +257 -0
- package/src/lib/button/icon-button.component.css +152 -0
- package/src/lib/button/split-button.component.css +103 -0
- package/src/lib/button/text-button.component.css +142 -0
- package/src/lib/button/window-control-button.component.css +214 -0
- package/src/lib/calendar/calendar-coarse-grid-styles.component.css +29 -0
- package/src/lib/calendar/calendar-comparison-band-styles.component.css +36 -0
- package/src/lib/calendar/calendar-week-numbers-styles.component.css +32 -0
- package/src/lib/calendar/calendar.component.css +374 -0
- package/src/lib/card/card.component.css +43 -0
- package/src/lib/carousel/carousel-autoplay-styles.component.css +171 -0
- package/src/lib/carousel/carousel-transition-styles.component.css +179 -0
- package/src/lib/carousel/carousel.component.css +220 -0
- package/src/lib/chart/bar-chart.component.css +176 -0
- package/src/lib/chart/chart-axis.component.css +40 -0
- package/src/lib/chart/chart-grid.component.css +6 -0
- package/src/lib/chart/chart-legend.component.css +46 -0
- package/src/lib/chart/chart-tooltip.component.css +34 -0
- package/src/lib/chart/line-chart-tooltip.component.css +51 -0
- package/src/lib/chart/line-chart.component.css +234 -0
- package/src/lib/chart/pie-chart.component.css +176 -0
- package/src/lib/chart/sankey-chart.component.css +221 -0
- package/src/lib/chip/chip.component.css +161 -0
- package/src/lib/collapse/collapse.component.css +43 -0
- package/src/lib/command-palette/command-palette-item.component.css +98 -0
- package/src/lib/command-palette/command-palette.component.css +148 -0
- package/src/lib/description-list/description-list.component.css +78 -0
- package/src/lib/divider/divider.component.css +40 -0
- package/src/lib/empty-state/empty-state.component.css +79 -0
- package/src/lib/floating-action/floating-action-styles.component.css +105 -0
- package/src/lib/focus-ring/focus-ring-styles.component.css +31 -0
- package/src/lib/forms/cascader/cascader-breadcrumb-styles.component.css +98 -0
- package/src/lib/forms/cascader/cascader-panel.component.css +390 -0
- package/src/lib/forms/cascader/cascader-sheet-styles.component.css +241 -0
- package/src/lib/forms/cascader/cascader.component.css +52 -0
- package/src/lib/forms/checkbox/checkbox.component.css +278 -0
- package/src/lib/forms/choice-field/choice-field-card-styles.component.css +66 -0
- package/src/lib/forms/choice-field/choice-field.component.css +227 -0
- package/src/lib/forms/color-input/color-input.component.css +109 -0
- package/src/lib/forms/color-input/color-picker-panel.component.css +354 -0
- package/src/lib/forms/date-time/date-input/date-input.component.css +35 -0
- package/src/lib/forms/date-time/date-picker-panel.component.css +118 -0
- package/src/lib/forms/date-time/date-range-input/date-range-input.component.css +16 -0
- package/src/lib/forms/date-time/date-range-presets.component.css +60 -0
- package/src/lib/forms/date-time/date-time-input/date-time-input.component.css +151 -0
- package/src/lib/forms/date-time/date-time-range-input/date-time-range-input.component.css +121 -0
- package/src/lib/forms/date-time/duration-input/duration-input.component.css +88 -0
- package/src/lib/forms/date-time/range-input-shell-styles.component.css +55 -0
- package/src/lib/forms/date-time/time-input/time-input.component.css +35 -0
- package/src/lib/forms/date-time/time-range-input/time-range-input.component.css +16 -0
- package/src/lib/forms/description/description.component.css +7 -0
- package/src/lib/forms/dropzone/dropzone-crop.component.css +139 -0
- package/src/lib/forms/dropzone/dropzone-item.component.css +67 -0
- package/src/lib/forms/dropzone/dropzone-preview-styles.component.css +83 -0
- package/src/lib/forms/dropzone/dropzone-readonly-styles.component.css +34 -0
- package/src/lib/forms/dropzone/dropzone-row-styles.component.css +85 -0
- package/src/lib/forms/dropzone/dropzone.component.css +291 -0
- package/src/lib/forms/form-field/counter.component.css +25 -0
- package/src/lib/forms/form-field/form-field-control-suffix-styles.component.css +174 -0
- package/src/lib/forms/form-field/form-field-rich-text-styles.component.css +31 -0
- package/src/lib/forms/form-field/form-field-suffix-overlap-styles.component.css +93 -0
- package/src/lib/forms/form-field/form-field-text-shell-styles.component.css +396 -0
- package/src/lib/forms/form-field/form-field-textarea-styles.component.css +94 -0
- package/src/lib/forms/form-field/form-field.component.css +381 -0
- package/src/lib/forms/form-field/form-support-styles.component.css +102 -0
- package/src/lib/forms/form-field/headless/label.directive.css +25 -0
- package/src/lib/forms/form-field/hint.component.css +18 -0
- package/src/lib/forms/input/input.component.css +53 -0
- package/src/lib/forms/input/number-input.component.css +128 -0
- package/src/lib/forms/input/password-input.component.css +103 -0
- package/src/lib/forms/multi-language-rich-text-editor/multi-language-rich-text-editor.component.css +8 -0
- package/src/lib/forms/multi-language-rich-text-editor/tools/multi-language-rich-text-editor-language-tool.component.css +101 -0
- package/src/lib/forms/otp-input/otp-input.component.css +218 -0
- package/src/lib/forms/phone-input/phone-input.component.css +126 -0
- package/src/lib/forms/rating/rating.component.css +197 -0
- package/src/lib/forms/rich-text-editor/rich-text-content-styles.component.css +234 -0
- package/src/lib/forms/rich-text-editor/rich-text-editor-floating-toolbar.component.css +95 -0
- package/src/lib/forms/rich-text-editor/rich-text-editor-image-editor.component.css +172 -0
- package/src/lib/forms/rich-text-editor/rich-text-editor-link-editor.component.css +149 -0
- package/src/lib/forms/rich-text-editor/rich-text-editor-token-palette.component.css +18 -0
- package/src/lib/forms/rich-text-editor/rich-text-editor-token-popup.component.css +206 -0
- package/src/lib/forms/rich-text-editor/rich-text-editor.component.css +175 -0
- package/src/lib/forms/rich-text-editor/rich-text-viewer.component.css +6 -0
- package/src/lib/forms/rich-text-editor/tools/rich-text-editor-align-tool.component.css +5 -0
- package/src/lib/forms/rich-text-editor/tools/rich-text-editor-heading-tool.component.css +5 -0
- package/src/lib/forms/rich-text-editor/tools/rich-text-editor-image-styles.component.css +109 -0
- package/src/lib/forms/rich-text-editor/tools/rich-text-editor-table-styles.component.css +21 -0
- package/src/lib/forms/rich-text-editor/tools/rich-text-editor-table-tool.component.css +44 -0
- package/src/lib/forms/select/select-all-option.component.css +14 -0
- package/src/lib/forms/select/select-extras-styles.component.css +146 -0
- package/src/lib/forms/select/select-option-group.component.css +36 -0
- package/src/lib/forms/select/select-option-styles.component.css +167 -0
- package/src/lib/forms/select/select-panel.component.css +122 -0
- package/src/lib/forms/select/select.component.css +247 -0
- package/src/lib/forms/selection-card-styles.component.css +144 -0
- package/src/lib/forms/selection-list/checkbox-group/checkbox-group-select-all.component.css +98 -0
- package/src/lib/forms/selection-list/checkbox-group/checkbox-group.component.css +142 -0
- package/src/lib/forms/selection-list/checkbox-group/checkbox-option.component.css +162 -0
- package/src/lib/forms/selection-list/radio-group/radio-group.component.css +134 -0
- package/src/lib/forms/selection-list/radio-group/radio.component.css +144 -0
- package/src/lib/forms/selection-list/segmented-button-group/segmented-button-group.component.css +213 -0
- package/src/lib/forms/selection-list/segmented-button-group/segmented-button.component.css +200 -0
- package/src/lib/forms/slider/range-slider.component.css +434 -0
- package/src/lib/forms/slider/slider.component.css +428 -0
- package/src/lib/forms/switch/switch.component.css +214 -0
- package/src/lib/forms/tag-input/tag-input.component.css +54 -0
- package/src/lib/forms/textarea/textarea-autosize-styles.component.css +16 -0
- package/src/lib/forms/textarea/textarea.component.css +45 -0
- package/src/lib/grid/grid-debug.component.css +130 -0
- package/src/lib/grid/grid-item-default-actions.component.css +11 -0
- package/src/lib/grid/grid-item-toolbar.component.css +10 -0
- package/src/lib/grid/grid-item.component.css +176 -0
- package/src/lib/grid/grid.component.css +56 -0
- package/src/lib/icon/headless/align-icons.ts +30 -0
- package/src/lib/icon/headless/arrow-out-up-right-icon.ts +17 -0
- package/src/lib/icon/headless/arrow-right-icon.ts +23 -0
- package/src/lib/icon/headless/arrow-up-icon.ts +30 -0
- package/src/lib/icon/headless/arrows-left-right-icon.ts +31 -0
- package/src/lib/icon/headless/bold-icon.ts +11 -0
- package/src/lib/icon/headless/calendar-icon.ts +21 -0
- package/src/lib/icon/headless/check-icon.ts +14 -0
- package/src/lib/icon/headless/chevron-icon.ts +14 -0
- package/src/lib/icon/headless/circle-check-icon.ts +14 -0
- package/src/lib/icon/headless/circle-info-icon.ts +14 -0
- package/src/lib/icon/headless/clipboard-check-icon.ts +28 -0
- package/src/lib/icon/headless/clock-icon.ts +21 -0
- package/src/lib/icon/headless/code-block-icon.ts +15 -0
- package/src/lib/icon/headless/code-icon.ts +14 -0
- package/src/lib/icon/headless/ellipsis-icon.ts +13 -0
- package/src/lib/icon/headless/ellipsis-vertical-icon.ts +13 -0
- package/src/lib/icon/headless/eye-icons.ts +27 -0
- package/src/lib/icon/headless/eyedropper-icon.ts +22 -0
- package/src/lib/icon/headless/file-icon.ts +16 -0
- package/src/lib/icon/headless/filter-icon.ts +11 -0
- package/src/lib/icon/headless/floppy-disk-icon.ts +27 -0
- package/src/lib/icon/headless/focus-frame-icon.ts +16 -0
- package/src/lib/icon/headless/grid-2x2-icon.ts +17 -0
- package/src/lib/icon/headless/heading-1-icon.ts +11 -0
- package/src/lib/icon/headless/heading-2-icon.ts +11 -0
- package/src/lib/icon/headless/heading-3-icon.ts +11 -0
- package/src/lib/icon/headless/icon-definition.ts +14 -0
- package/src/lib/icon/headless/icon-styles.component.css +7 -0
- package/src/lib/icon/headless/image-icon.ts +14 -0
- package/src/lib/icon/headless/italic-icon.ts +19 -0
- package/src/lib/icon/headless/link-icon.ts +17 -0
- package/src/lib/icon/headless/list-bulleted-icon.ts +14 -0
- package/src/lib/icon/headless/list-numbered-icon.ts +14 -0
- package/src/lib/icon/headless/location-icon.ts +21 -0
- package/src/lib/icon/headless/lock-icon.ts +14 -0
- package/src/lib/icon/headless/minus-icon.ts +14 -0
- package/src/lib/icon/headless/paragraph-icon.ts +11 -0
- package/src/lib/icon/headless/pause-icon.ts +11 -0
- package/src/lib/icon/headless/pencil-icon.ts +21 -0
- package/src/lib/icon/headless/play-icon.ts +10 -0
- package/src/lib/icon/headless/plus-icon.ts +21 -0
- package/src/lib/icon/headless/quote-icon.ts +15 -0
- package/src/lib/icon/headless/rotate-right-icon.ts +16 -0
- package/src/lib/icon/headless/star-icon.ts +14 -0
- package/src/lib/icon/headless/strikethrough-icon.ts +18 -0
- package/src/lib/icon/headless/table-icon.ts +15 -0
- package/src/lib/icon/headless/thumbtack-icon.ts +18 -0
- package/src/lib/icon/headless/times-icon.ts +14 -0
- package/src/lib/icon/headless/trash-icon.ts +24 -0
- package/src/lib/icon/headless/triangle-exclamation-icon.ts +14 -0
- package/src/lib/icon/headless/trophy-icon.ts +24 -0
- package/src/lib/icon/headless/underline-icon.ts +12 -0
- package/src/lib/icon/headless/undo-redo-icons.ts +24 -0
- package/src/lib/icon/headless/upload-icon.ts +16 -0
- package/src/lib/kbd/kbd.component.css +62 -0
- package/src/lib/loader/brand-loader/brand-loader.component.css +133 -0
- package/src/lib/loader/progress-bar/progress-bar.component.css +186 -0
- package/src/lib/loader/spinner/spinner-styles.component.css +225 -0
- package/src/lib/loader/spinner/spinner-sweep-dashes.ts +19 -0
- package/src/lib/masonry/masonry-styles.component.css +84 -0
- package/src/lib/match/match-card.component.css +545 -0
- package/src/lib/match/match-participant.component.css +236 -0
- package/src/lib/match/match-score.component.css +77 -0
- package/src/lib/match/match-scoreline.component.css +53 -0
- package/src/lib/match/match-time.component.css +5 -0
- package/src/lib/menu/menu-group-label.component.css +12 -0
- package/src/lib/menu/menu-item-shortcut.component.css +26 -0
- package/src/lib/menu/menu-item-submenu-icon.component.css +18 -0
- package/src/lib/menu/menu-item.component.css +36 -0
- package/src/lib/menu/menu-search-styles.component.css +83 -0
- package/src/lib/menu/menu-selection-item.component.css +92 -0
- package/src/lib/menu/menu-separator.component.css +9 -0
- package/src/lib/menu/menu.component.css +310 -0
- package/src/lib/notification/notification-stack.component.css +114 -0
- package/src/lib/notification/notification.component.css +275 -0
- package/src/lib/overlay/alert-dialog/alert-dialog.component.css +55 -0
- package/src/lib/overlay/floating-panel-styles.component.css +71 -0
- package/src/lib/overlay/floating-tip-styles.component.css +84 -0
- package/src/lib/overlay/overlay-container.component.css +173 -0
- package/src/lib/overlay/overlay-main-styles.component.css +105 -0
- package/src/lib/overlay/overlay-template-host.component.css +7 -0
- package/src/lib/overlay/routing/overlay-route-header-template-outlet.component.css +36 -0
- package/src/lib/overlay/routing/overlay-router-outlet.component.css +215 -0
- package/src/lib/overlay/routing/overlay-shared-route-template-outlet.component.css +5 -0
- package/src/lib/overlay/sidebar/overlay-sidebar.component.css +23 -0
- package/src/lib/overlay/strategies/anchored-dialog-styles.component.css +78 -0
- package/src/lib/overlay/strategies/dialog-styles.component.css +77 -0
- package/src/lib/overlay/strategies/full-screen-dialog-styles.component.css +141 -0
- package/src/lib/overlay/strategies/overlay-arrow-styles.component.css +112 -0
- package/src/lib/overlay/strategies/overlay-origin-clone.component.css +92 -0
- package/src/lib/overlay/strategies/sheet-styles.component.css +170 -0
- package/src/lib/pagination/page-size-select.component.css +6 -0
- package/src/lib/pagination/pagination.component.css +185 -0
- package/src/lib/picture/picture.component.css +82 -0
- package/src/lib/progress-steps/progress-step.component.css +269 -0
- package/src/lib/progress-steps/progress-steps.component.css +26 -0
- package/src/lib/query-error/query-error.component.css +27 -0
- package/src/lib/scheduler/scheduler-agenda-view.component.css +106 -0
- package/src/lib/scheduler/scheduler-appointment-drag-styles.component.css +59 -0
- package/src/lib/scheduler/scheduler-appointment-styles.component.css +129 -0
- package/src/lib/scheduler/scheduler-edit-color.component.css +16 -0
- package/src/lib/scheduler/scheduler-edit-surface-actions.component.css +14 -0
- package/src/lib/scheduler/scheduler-edit-surface-breadcrumb.component.css +26 -0
- package/src/lib/scheduler/scheduler-edit-surface-children.component.css +57 -0
- package/src/lib/scheduler/scheduler-edit-surface-fields.component.css +11 -0
- package/src/lib/scheduler/scheduler-edit-surface-footer.component.css +7 -0
- package/src/lib/scheduler/scheduler-edit-surface-header.component.css +15 -0
- package/src/lib/scheduler/scheduler-edit-time-range.component.css +11 -0
- package/src/lib/scheduler/scheduler-month-view.component.css +143 -0
- package/src/lib/scheduler/scheduler-time-grid-view.component.css +269 -0
- package/src/lib/scheduler/scheduler.component.css +87 -0
- package/src/lib/scrollable/headless/scrollable-buttons.component.css +223 -0
- package/src/lib/scrollable/headless/scrollable-footer.css +37 -0
- package/src/lib/scrollable/headless/scrollable-masks.component.css +165 -0
- package/src/lib/scrollable/headless/scrollable-navigation.component.css +94 -0
- package/src/lib/scrollable/scrollable.component.css +234 -0
- package/src/lib/scrollbar/scrollbar.component.css +116 -0
- package/src/lib/skeleton/skeleton.component.css +132 -0
- package/src/lib/standings/standings-pick.component.css +208 -0
- package/src/lib/standings/standings.component.css +347 -0
- package/src/lib/stat-tile/stat-tile-sparkline.component.css +49 -0
- package/src/lib/stat-tile/stat-tile.component.css +134 -0
- package/src/lib/stream/consent/stream-consent.component.css +100 -0
- package/src/lib/stream/error/stream-player-error.component.css +101 -0
- package/src/lib/stream/loading/stream-player-loading.component.css +16 -0
- package/src/lib/stream/pip/pip-player.component.css +40 -0
- package/src/lib/stream/pip/pip-slot-placeholder.component.css +68 -0
- package/src/lib/stream/pip/pip-stage-styles.component.css +93 -0
- package/src/lib/stream/pip/pip-window.component.css +221 -0
- package/src/lib/stream/stream-manager-styles.component.css +10 -0
- package/src/lib/stream/stream-overlay-card-styles.component.css +69 -0
- package/src/lib/stream/stream-player-slot-styles.component.css +18 -0
- package/src/lib/table/table-column-chooser.component.css +17 -0
- package/src/lib/table/table-column-menu-trigger.component.css +31 -0
- package/src/lib/table/table-detail-styles.component.css +103 -0
- package/src/lib/table/table-drag-scroll-styles.component.css +18 -0
- package/src/lib/table/table-expander-cell.component.css +64 -0
- package/src/lib/table/table-filter-trigger.component.css +44 -0
- package/src/lib/table/table-group-header-row.component.css +38 -0
- package/src/lib/table/table-inline-edit-styles.component.css +20 -0
- package/src/lib/table/table-page-sticky-header-styles.component.css +77 -0
- package/src/lib/table/table-reorder-overlay.component.css +42 -0
- package/src/lib/table/table-resize-grip.component.css +65 -0
- package/src/lib/table/table-row-box-styles.component.css +268 -0
- package/src/lib/table/table-select-cell.component.css +119 -0
- package/src/lib/table/table-skeleton-rows.component.css +19 -0
- package/src/lib/table/table-sort-priority-styles.component.css +15 -0
- package/src/lib/table/table-sticky-columns-styles.component.css +80 -0
- package/src/lib/table/table-virtual-scroll-styles.component.css +9 -0
- package/src/lib/table/table.component.css +853 -0
- package/src/lib/tabs/nav-tabs/nav-tab-link-styles.component.css +37 -0
- package/src/lib/tabs/tab-bar-styles.component.css +266 -0
- package/src/lib/tabs/tab-scale-styles.component.css +61 -0
- package/src/lib/tabs/tabs/tab-group.component.css +115 -0
- package/src/lib/time-picker/time-picker.component.css +212 -0
- package/src/lib/timeline/timeline-item.component.css +139 -0
- package/src/lib/timeline/timeline.component.css +7 -0
- package/src/lib/toggletip/toggletip.component.css +88 -0
- package/src/lib/toolbar/toolbar.component.css +44 -0
- package/src/lib/tooltip/tooltip.component.css +84 -0
- package/src/lib/tree/tree.component.css +221 -0
- package/types/ethlete-components-testing.d.ts +300 -0
- package/types/ethlete-components.d.ts +37511 -3814
package/design/match.ts
ADDED
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import focusRing from '../src/lib/focus-ring/focus-ring-styles.component.css?inline';
|
|
2
|
+
import cardBase from '../src/lib/match/match-card.component.css?inline';
|
|
3
|
+
import participantBase from '../src/lib/match/match-participant.component.css?inline';
|
|
4
|
+
import scoreBase from '../src/lib/match/match-score.component.css?inline';
|
|
5
|
+
|
|
6
|
+
export type MatchMockParticipant = {
|
|
7
|
+
/** The participant id the card puts on its side as `data-participant-id`, which the bracket's journey highlight reads. */
|
|
8
|
+
id?: string;
|
|
9
|
+
name: string;
|
|
10
|
+
code?: string;
|
|
11
|
+
subtitle?: string;
|
|
12
|
+
seed?: number;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export type MatchMockOptions = {
|
|
16
|
+
/** Left out, the side is still to be decided and draws the `TBD` label. */
|
|
17
|
+
home?: MatchMockParticipant;
|
|
18
|
+
away?: MatchMockParticipant;
|
|
19
|
+
status: 'scheduled' | 'live' | 'finished';
|
|
20
|
+
resultKind?: 'score' | 'points' | 'outcome';
|
|
21
|
+
homeScore?: number | string;
|
|
22
|
+
awayScore?: number | string;
|
|
23
|
+
winnerSide?: 'home' | 'away';
|
|
24
|
+
gameScores?: readonly { home: number; away: number }[];
|
|
25
|
+
label?: string;
|
|
26
|
+
/** The kick-off as the card formats it, e.g. `10/31/2026 8:00 PM`. */
|
|
27
|
+
startTime?: string;
|
|
28
|
+
size?: 'auto' | 'compact' | 'expanded' | 'wide';
|
|
29
|
+
showSeeds?: boolean;
|
|
30
|
+
hideNames?: boolean;
|
|
31
|
+
/** Draws the card on an `<a>`, the interactive host. */
|
|
32
|
+
interactive?: boolean;
|
|
33
|
+
/** A color theme name the app registers, for the live badge. Left out, the badge takes the color theme around the card. */
|
|
34
|
+
liveColor?: string;
|
|
35
|
+
/** A design marker on the host, e.g. `hover` or `focus-visible`. */
|
|
36
|
+
force?: string;
|
|
37
|
+
/** Extra classes on the host, e.g. the class a bracket cell gives its card. */
|
|
38
|
+
className?: string;
|
|
39
|
+
/** Extra attributes on the host, e.g. a style or design markers. */
|
|
40
|
+
attributes?: string;
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
/** The stylesheets the match mock draws with: the real match card, match participant, match score and focus ring CSS. */
|
|
44
|
+
export const matchStyles = /* @__PURE__ */ [focusRing, participantBase, scoreBase, cardBase].join('\n');
|
|
45
|
+
|
|
46
|
+
const SEPARATOR = ' : ';
|
|
47
|
+
|
|
48
|
+
const OUTCOME = { win: 'W', loss: 'L', draw: 'D' } as const;
|
|
49
|
+
|
|
50
|
+
const participant = ({
|
|
51
|
+
value,
|
|
52
|
+
compact,
|
|
53
|
+
showSeed,
|
|
54
|
+
}: {
|
|
55
|
+
value: MatchMockParticipant | undefined;
|
|
56
|
+
compact: boolean;
|
|
57
|
+
showSeed: boolean;
|
|
58
|
+
}) => {
|
|
59
|
+
const name = value ? (compact ? (value.code ?? value.name) : value.name) : 'TBD';
|
|
60
|
+
const mark = value
|
|
61
|
+
? `<span data-mark="${(Array.from(name.trim())[0] ?? '').toUpperCase()}" class="et-match-participant-emblem-mark" aria-hidden="true"></span>`
|
|
62
|
+
: '';
|
|
63
|
+
const subtitle = value?.subtitle ? `<span class="et-match-participant-subtitle">${value.subtitle}</span>` : '';
|
|
64
|
+
const seed =
|
|
65
|
+
showSeed && value?.seed !== undefined
|
|
66
|
+
? `<span class="et-match-participant-seed"><span aria-hidden="true">${value.seed}</span></span>`
|
|
67
|
+
: '';
|
|
68
|
+
const attributes = [compact ? ' data-compact=""' : '', value ? '' : ' data-tbd=""'].join('');
|
|
69
|
+
|
|
70
|
+
return `<et-match-participant class="et-match-participant et-focus-ring et-match-card-participant"${attributes}><span class="et-match-participant-emblem">${mark}</span><span class="et-match-participant-names"><span class="et-match-participant-name${value ? '' : ' et-match-participant-name--tbd'}">${name}</span>${subtitle}</span>${seed}</et-match-participant>`;
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
const outcomeFor = (options: MatchMockOptions, side: 'home' | 'away') => {
|
|
74
|
+
if (!options.winnerSide) return OUTCOME.draw;
|
|
75
|
+
|
|
76
|
+
return options.winnerSide === side ? OUTCOME.win : OUTCOME.loss;
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
/** Draws an `et-match-card` with its meta row, both sides, the result and the game scores, as HTML, without its visually hidden live region. Score animations are drawn at rest. */
|
|
80
|
+
export const matchCard = (options: MatchMockOptions) => {
|
|
81
|
+
const size = options.size ?? 'auto';
|
|
82
|
+
const resultKind = options.resultKind ?? 'score';
|
|
83
|
+
const compact = size === 'compact';
|
|
84
|
+
const live = options.status === 'live';
|
|
85
|
+
const drawsScore = resultKind !== 'outcome' && options.homeScore !== undefined && options.awayScore !== undefined;
|
|
86
|
+
const drawsOutcome = resultKind === 'outcome' && options.status === 'finished';
|
|
87
|
+
|
|
88
|
+
const liveBadge = live
|
|
89
|
+
? `<span class="et-match-card-live${options.liveColor ? ` et-color--${options.liveColor}` : ''}"><span class="et-match-card-live-dot"></span> Live </span>`
|
|
90
|
+
: options.startTime
|
|
91
|
+
? `<span class="et-match-card-time">${options.startTime}</span>`
|
|
92
|
+
: '';
|
|
93
|
+
const meta =
|
|
94
|
+
options.label || live || options.startTime
|
|
95
|
+
? `<div class="et-match-card-meta">${options.label ? `<span class="et-match-card-label">${options.label}</span>` : ''}${liveBadge}</div>`
|
|
96
|
+
: '';
|
|
97
|
+
|
|
98
|
+
const side = (key: 'home' | 'away') => {
|
|
99
|
+
const value = key === 'home' ? options.home : options.away;
|
|
100
|
+
const score = key === 'home' ? options.homeScore : options.awayScore;
|
|
101
|
+
const result = drawsScore
|
|
102
|
+
? `<et-match-score class="et-match-score et-match-card-score" aria-hidden="true"><span class="et-match-score-digit">${score}</span></et-match-score>`
|
|
103
|
+
: drawsOutcome
|
|
104
|
+
? `<span class="et-match-card-outcome" aria-hidden="true">${outcomeFor(options, key)}</span>`
|
|
105
|
+
: '';
|
|
106
|
+
|
|
107
|
+
const participantId = value?.id ? ` data-participant-id="${value.id}"` : '';
|
|
108
|
+
|
|
109
|
+
return `<div class="et-match-card-side" data-side="${key}"${participantId}>${participant({ value, compact, showSeed: !!options.showSeeds })}${result}</div>`;
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
const games = options.gameScores?.length
|
|
113
|
+
? `<ol class="et-match-card-games">${options.gameScores.map((game, index) => `<li aria-label="Game ${index + 1}: ${game.home}${SEPARATOR}${game.away}" class="et-match-card-game">${game.home}${SEPARATOR}${game.away}</li>`).join('')}</ol>`
|
|
114
|
+
: '';
|
|
115
|
+
|
|
116
|
+
const homeName = options.home?.name ?? 'TBD';
|
|
117
|
+
const awayName = options.away?.name ?? 'TBD';
|
|
118
|
+
const tag = options.interactive ? 'a' : 'et-match-card';
|
|
119
|
+
const hostAttributes = [
|
|
120
|
+
` data-status="${options.status}" data-size="${size}" data-result-kind="${resultKind}"`,
|
|
121
|
+
options.winnerSide ? ` data-winner="${options.winnerSide}"` : '',
|
|
122
|
+
options.interactive ? ' data-interactive="" href="#"' : ' role="group"',
|
|
123
|
+
options.hideNames ? ' data-hide-names=""' : '',
|
|
124
|
+
options.force ? ` data-et-force="${options.force}"` : '',
|
|
125
|
+
` aria-label="${homeName} vs ${awayName}"`,
|
|
126
|
+
].join('');
|
|
127
|
+
|
|
128
|
+
const classes = ['et-match-card', options.className, 'et-focus-ring'].filter(Boolean).join(' ');
|
|
129
|
+
|
|
130
|
+
return `<${tag} class="${classes}"${hostAttributes} ${options.attributes ?? ''}><div class="et-match-card-content">${meta}<div class="et-match-card-sides">${side('home')}<span class="et-match-card-versus" aria-hidden="true">${drawsScore || drawsOutcome ? SEPARATOR.trim() : 'vs'}</span>${side('away')}</div>${games}</div></${tag}>`;
|
|
131
|
+
};
|
package/design/menu.ts
ADDED
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import { CHEVRON_ICON } from '../src/lib/icon/headless/chevron-icon';
|
|
2
|
+
import { IconDefinition } from '../src/lib/icon/headless/icon-definition';
|
|
3
|
+
import groupLabel from '../src/lib/menu/menu-group-label.component.css?inline';
|
|
4
|
+
import itemShortcut from '../src/lib/menu/menu-item-shortcut.component.css?inline';
|
|
5
|
+
import itemSubmenuIcon from '../src/lib/menu/menu-item-submenu-icon.component.css?inline';
|
|
6
|
+
import item from '../src/lib/menu/menu-item.component.css?inline';
|
|
7
|
+
import selectionItem from '../src/lib/menu/menu-selection-item.component.css?inline';
|
|
8
|
+
import separator from '../src/lib/menu/menu-separator.component.css?inline';
|
|
9
|
+
import menuBase from '../src/lib/menu/menu.component.css?inline';
|
|
10
|
+
import { iconMarkup } from './icon';
|
|
11
|
+
|
|
12
|
+
type MenuMockRowState = {
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
/** The menu's active item: the keyboard or the pointer points at it. */
|
|
15
|
+
active?: boolean;
|
|
16
|
+
/** What made the row active. `keyboard` draws the keyboard highlight on a focus-visible row. */
|
|
17
|
+
activeSource?: 'keyboard' | 'pointer';
|
|
18
|
+
/** Extra attributes on the row's element, e.g. design markers. */
|
|
19
|
+
attributes?: string;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export type MenuMockItem = MenuMockRowState & {
|
|
23
|
+
kind?: 'item';
|
|
24
|
+
label: string;
|
|
25
|
+
icon?: IconDefinition;
|
|
26
|
+
shortcut?: string;
|
|
27
|
+
/** Draws the item as the trigger of a submenu, with its chevron. */
|
|
28
|
+
submenu?: boolean | 'open';
|
|
29
|
+
destructive?: boolean;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export type MenuMockSelectionItem = MenuMockRowState & {
|
|
33
|
+
kind: 'checkbox' | 'radio';
|
|
34
|
+
label: string;
|
|
35
|
+
checked?: boolean | 'mixed';
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export type MenuMockGroup = {
|
|
39
|
+
kind: 'checkbox-group' | 'radio-group';
|
|
40
|
+
label?: string;
|
|
41
|
+
items: MenuMockSelectionItem[];
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export type MenuMockRow =
|
|
45
|
+
MenuMockItem | MenuMockSelectionItem | MenuMockGroup | { kind: 'separator' } | { kind: 'label'; label: string };
|
|
46
|
+
|
|
47
|
+
export type MenuMockOptions = {
|
|
48
|
+
rows: MenuMockRow[];
|
|
49
|
+
/** Unique per frame: the ids of the panel, group labels and submenus derive from it. */
|
|
50
|
+
id?: string;
|
|
51
|
+
/** The app's default color theme name, as the menu syncs it from its trigger. */
|
|
52
|
+
color?: string;
|
|
53
|
+
/** The color theme name the app registers for errors, e.g. `danger` in Storybook. */
|
|
54
|
+
errorColor?: string;
|
|
55
|
+
/** A surface theme name the app registers, for the panel. Left out, the panel takes the surface one elevation above its parent. */
|
|
56
|
+
surface?: string;
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
/** The stylesheets `menu()` draws with: the real `et-menu` CSS. */
|
|
60
|
+
export const menuStyles = /* @__PURE__ */ [
|
|
61
|
+
menuBase,
|
|
62
|
+
item,
|
|
63
|
+
selectionItem,
|
|
64
|
+
groupLabel,
|
|
65
|
+
separator,
|
|
66
|
+
itemShortcut,
|
|
67
|
+
itemSubmenuIcon,
|
|
68
|
+
].join('\n');
|
|
69
|
+
|
|
70
|
+
const rowAttributes = (row: MenuMockRowState) =>
|
|
71
|
+
[
|
|
72
|
+
row.attributes,
|
|
73
|
+
`tabindex="${row.active && !row.disabled ? 0 : -1}"`,
|
|
74
|
+
row.disabled && 'aria-disabled="true"',
|
|
75
|
+
row.active && 'data-active="true"',
|
|
76
|
+
row.active && row.activeSource && `data-active-source="${row.activeSource}"`,
|
|
77
|
+
].filter(Boolean);
|
|
78
|
+
|
|
79
|
+
const menuItem = (row: MenuMockItem, { submenuId, errorColor }: { submenuId: string; errorColor?: string }) => {
|
|
80
|
+
const attributes = [
|
|
81
|
+
'et-menu-item',
|
|
82
|
+
'type="button"',
|
|
83
|
+
'role="menuitem"',
|
|
84
|
+
...rowAttributes(row),
|
|
85
|
+
row.submenu && `aria-haspopup="menu" aria-expanded="${row.submenu === 'open'}"`,
|
|
86
|
+
row.submenu === 'open' && `aria-controls="${submenuId}" data-menu-open="true"`,
|
|
87
|
+
`class="et-menu-item et-color--${row.destructive && errorColor ? errorColor : 'inherited'}"`,
|
|
88
|
+
`data-variant="${row.destructive ? 'destructive' : 'default'}"`,
|
|
89
|
+
].filter(Boolean);
|
|
90
|
+
const icon = row.icon ? iconMarkup(row.icon) : '';
|
|
91
|
+
const shortcut = row.shortcut
|
|
92
|
+
? `<et-menu-item-shortcut class="et-menu-item-shortcut" aria-hidden="true">${row.shortcut}</et-menu-item-shortcut>`
|
|
93
|
+
: '';
|
|
94
|
+
const chevron = row.submenu
|
|
95
|
+
? `<et-menu-item-submenu-icon class="et-menu-item-submenu-icon" aria-hidden="true">${iconMarkup(CHEVRON_ICON)}</et-menu-item-submenu-icon>`
|
|
96
|
+
: '';
|
|
97
|
+
|
|
98
|
+
return `<button ${attributes.join(' ')}><span class="et-menu-item-icon">${icon}</span><span class="et-menu-item-content">${row.label}</span><span class="et-menu-item-trailing">${shortcut}${chevron}</span></button>`;
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
const selectionRow = (row: MenuMockSelectionItem) => {
|
|
102
|
+
const attributes = [
|
|
103
|
+
`role="${row.kind === 'checkbox' ? 'menuitemcheckbox' : 'menuitemradio'}"`,
|
|
104
|
+
...rowAttributes(row),
|
|
105
|
+
`aria-checked="${row.checked ?? false}"`,
|
|
106
|
+
`class="et-menu-item et-menu-selection-item et-menu-${row.kind}-item"`,
|
|
107
|
+
].filter(Boolean);
|
|
108
|
+
|
|
109
|
+
return `<et-menu-${row.kind}-item ${attributes.join(' ')}><span class="et-menu-item-content">${row.label}</span><span class="et-menu-item-check" aria-hidden="true"></span></et-menu-${row.kind}-item>`;
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
const groupLabelMarkup = (label: string, id: string) =>
|
|
113
|
+
`<et-menu-group-label class="et-menu-group-label" role="presentation" id="${id}">${label}</et-menu-group-label>`;
|
|
114
|
+
|
|
115
|
+
/** Draws the open `<et-menu>` panel with the DOM it renders inside its overlay. */
|
|
116
|
+
export const menu = (options: MenuMockOptions) => {
|
|
117
|
+
const { id = 'menu' } = options;
|
|
118
|
+
|
|
119
|
+
const rowMarkup = (row: MenuMockRow, index: number) => {
|
|
120
|
+
switch (row.kind) {
|
|
121
|
+
case 'separator':
|
|
122
|
+
return '<et-menu-separator class="et-menu-separator" role="separator" aria-orientation="horizontal"></et-menu-separator>';
|
|
123
|
+
case 'label':
|
|
124
|
+
return groupLabelMarkup(row.label, `et-menu-group-label-${id}-${index}`);
|
|
125
|
+
case 'checkbox':
|
|
126
|
+
case 'radio':
|
|
127
|
+
return selectionRow(row);
|
|
128
|
+
case 'checkbox-group':
|
|
129
|
+
case 'radio-group': {
|
|
130
|
+
const labelId = `et-menu-group-label-${id}-${index}`;
|
|
131
|
+
const label = row.label ? groupLabelMarkup(row.label, labelId) : '';
|
|
132
|
+
const labelledBy = row.label ? ` aria-labelledby="${labelId}"` : '';
|
|
133
|
+
|
|
134
|
+
return `<et-menu-${row.kind} class="et-menu-group et-menu-${row.kind}" role="group"${labelledBy}>${label}${row.items.map(selectionRow).join('')}</et-menu-${row.kind}>`;
|
|
135
|
+
}
|
|
136
|
+
default:
|
|
137
|
+
return menuItem(row, { submenuId: `et-menu-panel-${id}-${index}`, errorColor: options.errorColor });
|
|
138
|
+
}
|
|
139
|
+
};
|
|
140
|
+
|
|
141
|
+
const classes = [
|
|
142
|
+
'et-menu',
|
|
143
|
+
`et-color--${options.color ?? 'inherited'}`,
|
|
144
|
+
options.surface && `et-surface--${options.surface}`,
|
|
145
|
+
].filter(Boolean);
|
|
146
|
+
const autoSurface = options.surface ? '' : ' data-et-auto-surface';
|
|
147
|
+
|
|
148
|
+
return `<et-menu id="et-menu-panel-${id}"${autoSurface} class="${classes.join(' ')}" role="menu" aria-orientation="vertical" tabindex="-1"><div class="et-menu-header"><div class="et-menu-search-field"></div></div><div class="et-menu-body-wrapper"><div class="et-menu-body"><div class="et-menu-body-content">${options.rows.map(rowMarkup).join('')}</div></div></div></et-menu>`;
|
|
149
|
+
};
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import iconButtonBase from '../src/lib/button/icon-button.component.css?inline';
|
|
2
|
+
import textButtonBase from '../src/lib/button/text-button.component.css?inline';
|
|
3
|
+
import { CIRCLE_CHECK_ICON } from '../src/lib/icon/headless/circle-check-icon';
|
|
4
|
+
import { CIRCLE_INFO_ICON } from '../src/lib/icon/headless/circle-info-icon';
|
|
5
|
+
import iconBase from '../src/lib/icon/headless/icon-styles.component.css?inline';
|
|
6
|
+
import { TIMES_ICON } from '../src/lib/icon/headless/times-icon';
|
|
7
|
+
import { TRIANGLE_EXCLAMATION_ICON } from '../src/lib/icon/headless/triangle-exclamation-icon';
|
|
8
|
+
import spinnerBase from '../src/lib/loader/spinner/spinner-styles.component.css?inline';
|
|
9
|
+
import notificationBase from '../src/lib/notification/notification.component.css?inline';
|
|
10
|
+
import { buttonStyles } from './button';
|
|
11
|
+
import { iconMarkup } from './icon';
|
|
12
|
+
|
|
13
|
+
export type NotificationMockAction = {
|
|
14
|
+
label: string;
|
|
15
|
+
/** Extra attributes on the action button, e.g. design markers. */
|
|
16
|
+
attributes?: string;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export type NotificationMockOptions = {
|
|
20
|
+
status: 'success' | 'error' | 'info' | 'loading';
|
|
21
|
+
title: string;
|
|
22
|
+
message?: string;
|
|
23
|
+
/** The `action` of the notification config. */
|
|
24
|
+
action?: NotificationMockAction;
|
|
25
|
+
/** The `secondaryAction` of the notification config. */
|
|
26
|
+
secondaryAction?: NotificationMockAction;
|
|
27
|
+
/**
|
|
28
|
+
* The color theme name the manager resolves for the status (`statusColorMapping`, else the semantic theme of
|
|
29
|
+
* its type). Left out, the notification takes the color theme around it.
|
|
30
|
+
*/
|
|
31
|
+
color?: string;
|
|
32
|
+
/**
|
|
33
|
+
* A surface theme name the app registers. Left out, the notification takes the surface one elevation above its
|
|
34
|
+
* parent, as the component forces elevation 1 on the page.
|
|
35
|
+
*/
|
|
36
|
+
surface?: string;
|
|
37
|
+
/** Extra attributes on the dismiss button, e.g. design markers. */
|
|
38
|
+
dismissAttributes?: string;
|
|
39
|
+
/** Extra attributes on the notification, e.g. design markers. */
|
|
40
|
+
attributes?: string;
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
const STATUS_ICONS = {
|
|
44
|
+
success: CIRCLE_CHECK_ICON,
|
|
45
|
+
error: TRIANGLE_EXCLAMATION_ICON,
|
|
46
|
+
info: CIRCLE_INFO_ICON,
|
|
47
|
+
loading: null,
|
|
48
|
+
} as const;
|
|
49
|
+
|
|
50
|
+
/** The stylesheets `notification()` draws with: the real notification, icon button, text button, spinner and icon CSS. */
|
|
51
|
+
export const notificationStyles = /* @__PURE__ */ [
|
|
52
|
+
buttonStyles,
|
|
53
|
+
iconBase,
|
|
54
|
+
iconButtonBase,
|
|
55
|
+
textButtonBase,
|
|
56
|
+
spinnerBase,
|
|
57
|
+
notificationBase,
|
|
58
|
+
`@layer components.sdk {
|
|
59
|
+
.et-notification-mock-stack {
|
|
60
|
+
display: flex;
|
|
61
|
+
flex-direction: column;
|
|
62
|
+
align-items: flex-end;
|
|
63
|
+
gap: var(--et-notification-stack-gap, 0.5rem);
|
|
64
|
+
}
|
|
65
|
+
.et-notification-mock-spinner {
|
|
66
|
+
--et-spinner-size: 16px;
|
|
67
|
+
--et-spinner-stroke-width: 2px;
|
|
68
|
+
}
|
|
69
|
+
.et-notification-mock-spinner circle {
|
|
70
|
+
stroke-dasharray: 18.85px;
|
|
71
|
+
stroke-dashoffset: 9.42px;
|
|
72
|
+
stroke-width: 12.5%;
|
|
73
|
+
}
|
|
74
|
+
}`,
|
|
75
|
+
].join('\n');
|
|
76
|
+
|
|
77
|
+
const spinner = () => {
|
|
78
|
+
const circle = `<svg viewBox="0 0 8 8" class="et-spinner-circle-graphic" xmlns="http://www.w3.org/2000/svg" focusable="false"><circle r="3" cx="50%" cy="50%"></circle></svg>`;
|
|
79
|
+
|
|
80
|
+
return `<et-spinner class="et-notification-spinner et-notification-mock-spinner et-color--inherited et-spinner" role="progressbar" aria-label="Loading"><div class="et-spinner-indeterminate"><div class="et-spinner-indeterminate-container" aria-hidden="true"><div class="et-spinner-layer"><div class="et-spinner-circle-clipper et-spinner-circle-left">${circle}</div><div class="et-spinner-gap-patch">${circle}</div><div class="et-spinner-circle-clipper et-spinner-circle-right">${circle}</div></div></div></div></et-spinner>`;
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
const dismissButton = (color: string | undefined, attributes?: string) => {
|
|
84
|
+
const classes = [
|
|
85
|
+
'et-notification-dismiss-btn',
|
|
86
|
+
'et-color-interactive',
|
|
87
|
+
'et-icon-button',
|
|
88
|
+
'et-focus-ring',
|
|
89
|
+
`et-color--${color ?? 'inherited'}`,
|
|
90
|
+
];
|
|
91
|
+
|
|
92
|
+
return `<button ${attributes ?? ''} etNotificationDismiss type="button" aria-label="Dismiss" class="${classes.join(' ')}" data-variant="transparent" data-size="xs"><div class="et-icon-button-icon">${iconMarkup(TIMES_ICON)}</div></button>`;
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
const actionButton = (action: NotificationMockAction, slot: 'primary' | 'secondary') => {
|
|
96
|
+
const classes = [
|
|
97
|
+
slot === 'secondary' && 'et-notification-secondary-action',
|
|
98
|
+
'et-text-button',
|
|
99
|
+
'et-color-interactive',
|
|
100
|
+
'et-focus-ring',
|
|
101
|
+
'et-color--inherited',
|
|
102
|
+
].filter(Boolean);
|
|
103
|
+
const slotAttribute = slot === 'secondary' ? 'etNotificationAction="secondary"' : 'etNotificationAction';
|
|
104
|
+
|
|
105
|
+
return `<button ${action.attributes ?? ''} ${slotAttribute} type="button" class="${classes.join(' ')}" data-icon-alignment="start" data-size="xs"><div class="et-text-button-contents">${action.label}</div></button>`;
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
/** Draws an `et-notification` as the notification stack renders it, entered and at rest, as HTML. */
|
|
109
|
+
export const notification = (options: NotificationMockOptions) => {
|
|
110
|
+
const icon = STATUS_ICONS[options.status];
|
|
111
|
+
const glyph = icon ? iconMarkup(icon, 'et-notification-icon') : options.status === 'loading' ? spinner() : '';
|
|
112
|
+
const header = `<div class="et-notification-header">${glyph}<span class="et-notification-title">${options.title}</span>${dismissButton(options.color, options.dismissAttributes)}</div>`;
|
|
113
|
+
const message = options.message ? `<p class="et-notification-message">${options.message}</p>` : '';
|
|
114
|
+
const actions = [
|
|
115
|
+
options.action && actionButton(options.action, 'primary'),
|
|
116
|
+
options.secondaryAction && actionButton(options.secondaryAction, 'secondary'),
|
|
117
|
+
].filter(Boolean);
|
|
118
|
+
const footer = actions.length ? `<div class="et-notification-footer">${actions.join('')}</div>` : '';
|
|
119
|
+
const classes = [
|
|
120
|
+
'et-notification',
|
|
121
|
+
`et-color--${options.color ?? 'inherited'}`,
|
|
122
|
+
options.surface && `et-surface--${options.surface}`,
|
|
123
|
+
'et-animation-enter-done',
|
|
124
|
+
].filter(Boolean);
|
|
125
|
+
const autoSurface = options.surface ? '' : ' data-et-auto-surface';
|
|
126
|
+
|
|
127
|
+
return `<et-notification ${options.attributes ?? ''}${autoSurface} class="${classes.join(' ')}"><div class="et-notification-content">${header}${message}${footer}</div></et-notification>`;
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
/** Draws notifications in the stack's column and gap, in flow instead of fixed to the viewport. */
|
|
131
|
+
export const notificationStack = (notifications: string[]) =>
|
|
132
|
+
`<div class="et-notification-stack et-notification-mock-stack">${notifications.join('')}</div>`;
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import formSupport from '../src/lib/forms/form-field/form-support-styles.component.css?inline';
|
|
2
|
+
import label from '../src/lib/forms/form-field/headless/label.directive.css?inline';
|
|
3
|
+
import otpInputBase from '../src/lib/forms/otp-input/otp-input.component.css?inline';
|
|
4
|
+
|
|
5
|
+
/** An interaction a frame forces with the `data-et-force` design marker. */
|
|
6
|
+
export type OtpInputMockForce = 'hover' | 'active';
|
|
7
|
+
|
|
8
|
+
export type OtpInputMockOptions = {
|
|
9
|
+
/** The number of segments. */
|
|
10
|
+
length?: number;
|
|
11
|
+
/** The typed characters; only the first `length` show. */
|
|
12
|
+
value?: string;
|
|
13
|
+
/** Draws each typed character as a dot. */
|
|
14
|
+
masked?: boolean;
|
|
15
|
+
/** Draws the field focused: the caret segment after the last character, or the last segment when full. */
|
|
16
|
+
focused?: boolean;
|
|
17
|
+
/** The label, as HTML. */
|
|
18
|
+
label?: string;
|
|
19
|
+
/** The hint, as HTML. Hidden while an `error` shows. */
|
|
20
|
+
hint?: string;
|
|
21
|
+
/** The error message, as HTML. Draws the field touched and invalid. */
|
|
22
|
+
error?: string;
|
|
23
|
+
/** The color theme name the app registers for errors, e.g. `danger` in Storybook. */
|
|
24
|
+
errorColor?: string;
|
|
25
|
+
disabled?: boolean;
|
|
26
|
+
readonly?: boolean;
|
|
27
|
+
required?: boolean;
|
|
28
|
+
/** Unique per frame: the label and message ids derive from it. */
|
|
29
|
+
id?: string;
|
|
30
|
+
/** A color theme name the app registers. */
|
|
31
|
+
color?: string;
|
|
32
|
+
/** Forced interactions on the field. */
|
|
33
|
+
force?: OtpInputMockForce | OtpInputMockForce[];
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
/** The stylesheets `otpInput()` draws with: the real `et-otp-input` and form support CSS. */
|
|
37
|
+
export const otpInputStyles = /* @__PURE__ */ [label, formSupport, otpInputBase].join('\n');
|
|
38
|
+
|
|
39
|
+
const forceList = (force: OtpInputMockForce | OtpInputMockForce[] | undefined) =>
|
|
40
|
+
force === undefined ? [] : Array.isArray(force) ? force : [force];
|
|
41
|
+
|
|
42
|
+
/** Draws `<et-otp-input>` as HTML, with the DOM the component renders. */
|
|
43
|
+
export const otpInput = (options: OtpInputMockOptions) => {
|
|
44
|
+
const { id = 'otp-input', length = 6, value = '' } = options;
|
|
45
|
+
const ids = { hint: `et-form-field-hint-${id}`, error: `et-form-field-error-${id}` };
|
|
46
|
+
const labelId = options.label !== undefined ? `et-label-${id}` : null;
|
|
47
|
+
const invalid = options.error !== undefined;
|
|
48
|
+
const supportId = invalid ? ids.error : options.hint !== undefined ? ids.hint : null;
|
|
49
|
+
const colorClass = invalid && options.errorColor ? options.errorColor : (options.color ?? 'inherited');
|
|
50
|
+
const chars = value.slice(0, length);
|
|
51
|
+
const caretIndex = options.focused && !options.readonly ? Math.min(chars.length, length - 1) : -1;
|
|
52
|
+
const force = forceList(options.force);
|
|
53
|
+
|
|
54
|
+
const hostAttributes = [
|
|
55
|
+
`class="et-otp-input et-color--${colorClass}"`,
|
|
56
|
+
invalid && 'data-error="true"',
|
|
57
|
+
force.length > 0 && `data-et-force="${force.join(' ')}"`,
|
|
58
|
+
].filter(Boolean);
|
|
59
|
+
|
|
60
|
+
const segments = Array.from({ length }, (_, index) => {
|
|
61
|
+
const char = chars[index];
|
|
62
|
+
const attributes = [
|
|
63
|
+
'class="et-otp-input-segment"',
|
|
64
|
+
index === caretIndex && 'data-caret="true"',
|
|
65
|
+
char !== undefined && 'data-filled="true"',
|
|
66
|
+
].filter(Boolean);
|
|
67
|
+
const content =
|
|
68
|
+
char !== undefined
|
|
69
|
+
? `<span class="et-otp-input-segment-char">${options.masked ? '•' : char}</span>`
|
|
70
|
+
: index === caretIndex
|
|
71
|
+
? '<span class="et-otp-input-caret"></span>'
|
|
72
|
+
: '';
|
|
73
|
+
|
|
74
|
+
return `<div ${attributes.join(' ')}>${content}</div>`;
|
|
75
|
+
}).join('');
|
|
76
|
+
|
|
77
|
+
const inputAttributes = [
|
|
78
|
+
'class="et-otp-input-native"',
|
|
79
|
+
'autocapitalize="off"',
|
|
80
|
+
'autocomplete="one-time-code"',
|
|
81
|
+
'spellcheck="false"',
|
|
82
|
+
`type="${options.masked ? 'password' : 'text'}"`,
|
|
83
|
+
'inputmode="numeric"',
|
|
84
|
+
`value="${chars}"`,
|
|
85
|
+
options.required && 'required',
|
|
86
|
+
options.disabled && 'disabled',
|
|
87
|
+
options.readonly && 'readonly',
|
|
88
|
+
labelId && `aria-labelledby="${labelId}"`,
|
|
89
|
+
supportId && `aria-describedby="${supportId}"`,
|
|
90
|
+
invalid && 'aria-invalid="true"',
|
|
91
|
+
].filter(Boolean);
|
|
92
|
+
|
|
93
|
+
const labelHtml = labelId
|
|
94
|
+
? `<et-label id="${labelId}"${options.disabled ? ' data-disabled="true"' : ''}><span class="et-label-content">${options.label}</span>${options.required ? '<span aria-hidden="true" class="et-label-required-marker">*</span>' : ''}</et-label>`
|
|
95
|
+
: '';
|
|
96
|
+
|
|
97
|
+
const support =
|
|
98
|
+
options.hint === undefined && options.error === undefined
|
|
99
|
+
? ''
|
|
100
|
+
: `<et-form-support class="et-form-support"><div class="et-form-support-stack">${
|
|
101
|
+
invalid
|
|
102
|
+
? `<div class="et-form-support-content et-form-support-errors${options.errorColor ? ` et-color--${options.errorColor}` : ''}" id="${ids.error}" aria-atomic="true" aria-live="polite" data-active="true" data-direction="from-below" data-state="active"><et-form-error class="et-form-error">${options.error}</et-form-error></div>`
|
|
103
|
+
: `<div class="et-form-support-content et-form-support-hint" id="${ids.hint}" data-active="true" data-direction="from-above" data-state="active"><et-hint>${options.hint}</et-hint></div>`
|
|
104
|
+
}</div></et-form-support>`;
|
|
105
|
+
|
|
106
|
+
return `<et-otp-input ${hostAttributes.join(' ')}>${labelHtml}<div class="et-otp-input-field"><div class="et-otp-input-segments" aria-hidden="true">${segments}</div><input ${inputAttributes.join(' ')}></div>${support}</et-otp-input>`;
|
|
107
|
+
};
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import paginationBase from '../src/lib/pagination/pagination.component.css?inline';
|
|
2
|
+
import { button, buttonStyles } from './button';
|
|
3
|
+
|
|
4
|
+
type PaginationMockControlType = 'first' | 'previous' | 'next' | 'last';
|
|
5
|
+
|
|
6
|
+
export type PaginationMockItem =
|
|
7
|
+
| {
|
|
8
|
+
type: 'page';
|
|
9
|
+
page: number;
|
|
10
|
+
current?: boolean;
|
|
11
|
+
/** Extra attributes on the item's button, e.g. design markers. */
|
|
12
|
+
attributes?: string;
|
|
13
|
+
}
|
|
14
|
+
| {
|
|
15
|
+
type: PaginationMockControlType;
|
|
16
|
+
/** The page the control goes to; links draw it into their href. */
|
|
17
|
+
page?: number;
|
|
18
|
+
disabled?: boolean;
|
|
19
|
+
attributes?: string;
|
|
20
|
+
}
|
|
21
|
+
| { type: 'ellipsis' };
|
|
22
|
+
|
|
23
|
+
export type PaginationMockOptions = {
|
|
24
|
+
items: PaginationMockItem[];
|
|
25
|
+
/** Defaults to `md`. */
|
|
26
|
+
size?: 'sm' | 'md';
|
|
27
|
+
/** Draws `<a href>` items instead of `<button>`s, as `renderAs="links"` does. */
|
|
28
|
+
renderAs?: 'buttons' | 'links';
|
|
29
|
+
/** The "Showing 1–10 of 200" readout before the list, as `totalItems` and `pageSize` turn it on. */
|
|
30
|
+
range?: string;
|
|
31
|
+
/** Draws the compact pager: this "3 / 20" readout, then only the previous and next items. */
|
|
32
|
+
compactStatus?: string;
|
|
33
|
+
/** Defaults to `true`, as `responsive` sets it. */
|
|
34
|
+
fitWidth?: boolean;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
const CHEVRON_PATHS: Record<PaginationMockControlType, string> = {
|
|
38
|
+
first: 'M11 3 6 8l5 5M5 3v10',
|
|
39
|
+
previous: 'M10 3 5 8l5 5',
|
|
40
|
+
next: 'M6 3l5 5-5 5',
|
|
41
|
+
last: 'M5 3l5 5-5 5M11 3v10',
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
const CONTROL_LABELS: Record<PaginationMockControlType, string> = {
|
|
45
|
+
first: 'First page',
|
|
46
|
+
previous: 'Previous page',
|
|
47
|
+
next: 'Next page',
|
|
48
|
+
last: 'Last page',
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
const chevron = (type: PaginationMockControlType) =>
|
|
52
|
+
`<svg viewBox="0 0 16 16" width="14" height="14" fill="none" aria-hidden="true"><path d="${CHEVRON_PATHS[type]}" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"/></svg>`;
|
|
53
|
+
|
|
54
|
+
/** The stylesheets `pagination()` draws with: the real `et-pagination` and `et-button` CSS. */
|
|
55
|
+
export const paginationStyles = `${buttonStyles}\n${paginationBase}`;
|
|
56
|
+
|
|
57
|
+
const control = (item: Exclude<PaginationMockItem, { type: 'ellipsis' }>, renderAs: 'buttons' | 'links') => {
|
|
58
|
+
const isPage = item.type === 'page';
|
|
59
|
+
const current = isPage && !!item.current;
|
|
60
|
+
const disabled = !isPage && !!item.disabled;
|
|
61
|
+
const link = renderAs === 'links' && !disabled && item.page !== undefined;
|
|
62
|
+
const label = isPage ? `Page ${item.page}` : CONTROL_LABELS[item.type];
|
|
63
|
+
|
|
64
|
+
const markup = button({
|
|
65
|
+
label: isPage ? `${item.page}` : chevron(item.type),
|
|
66
|
+
size: 'sm',
|
|
67
|
+
variant: current ? 'filled' : 'transparent',
|
|
68
|
+
color: current ? undefined : 'surface',
|
|
69
|
+
disabled,
|
|
70
|
+
tag: link ? 'a' : 'button',
|
|
71
|
+
class: isPage ? 'et-pagination-button' : 'et-pagination-button et-pagination-button--control',
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
const attributes = [
|
|
75
|
+
item.attributes,
|
|
76
|
+
link && `href="?page=${item.page}"`,
|
|
77
|
+
`aria-label="${label}"`,
|
|
78
|
+
current && 'aria-current="page"',
|
|
79
|
+
`data-type="${item.type}"`,
|
|
80
|
+
].filter(Boolean);
|
|
81
|
+
|
|
82
|
+
return markup.replace(/^<(button|a) /, `<$1 ${attributes.join(' ')} `);
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
const listItem = (item: PaginationMockItem, renderAs: 'buttons' | 'links') =>
|
|
86
|
+
`<li data-type="${item.type}" class="et-pagination-item">${
|
|
87
|
+
item.type === 'ellipsis'
|
|
88
|
+
? '<span class="et-pagination-ellipsis" aria-hidden="true">…</span>'
|
|
89
|
+
: control(item, renderAs)
|
|
90
|
+
}</li>`;
|
|
91
|
+
|
|
92
|
+
const readout = (text: string) =>
|
|
93
|
+
`<span class="et-pagination-readout-sizer" aria-hidden="true">${text}</span><span class="et-pagination-readout-text">${text}</span>`;
|
|
94
|
+
|
|
95
|
+
/** Draws `<et-pagination>` as HTML, with the DOM and classes the component renders. */
|
|
96
|
+
export const pagination = (options: PaginationMockOptions) => {
|
|
97
|
+
const { size = 'md', renderAs = 'buttons', compactStatus, fitWidth = true } = options;
|
|
98
|
+
const compact = compactStatus !== undefined;
|
|
99
|
+
|
|
100
|
+
const hostAttributes = [
|
|
101
|
+
'class="et-pagination-host"',
|
|
102
|
+
'role="navigation"',
|
|
103
|
+
'aria-label="Pagination"',
|
|
104
|
+
`data-size="${size}"`,
|
|
105
|
+
compact && 'data-compact=""',
|
|
106
|
+
fitWidth && !compact && 'data-fit-width=""',
|
|
107
|
+
].filter(Boolean);
|
|
108
|
+
|
|
109
|
+
const range =
|
|
110
|
+
!compact && options.range ? `<p class="et-pagination-range" aria-live="polite">${readout(options.range)}</p>` : '';
|
|
111
|
+
|
|
112
|
+
const items = compact
|
|
113
|
+
? `<li class="et-pagination-status" aria-live="polite">${readout(compactStatus)}</li>${options.items
|
|
114
|
+
.filter((item) => item.type === 'previous' || item.type === 'next')
|
|
115
|
+
.map((item) => listItem(item, renderAs))
|
|
116
|
+
.join('')}`
|
|
117
|
+
: options.items.map((item) => listItem(item, renderAs)).join('');
|
|
118
|
+
|
|
119
|
+
return `<et-pagination ${hostAttributes.join(' ')}>${range}<ul class="et-pagination-list">${items}</ul></et-pagination>`;
|
|
120
|
+
};
|