vira 32.0.0-beta.0 → 32.0.0
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/dist/elements/color/vira-all-color-space-sliders.element.d.ts +11 -0
- package/dist/elements/color/vira-all-color-space-sliders.element.js +55 -0
- package/dist/elements/color/vira-all-spaces-color-picker.element.d.ts +15 -0
- package/dist/elements/color/vira-all-spaces-color-picker.element.js +73 -0
- package/dist/elements/color/vira-color-details.element.d.ts +14 -0
- package/{src/elements/color/vira-color-details.element.ts → dist/elements/color/vira-color-details.element.js} +43 -59
- package/dist/elements/color/vira-color-format-sliders.element.d.ts +14 -0
- package/dist/elements/color/vira-color-format-sliders.element.js +60 -0
- package/dist/elements/color/vira-color-pair-contrast-summary.element.d.ts +9 -0
- package/{src/elements/color/vira-color-pair-contrast-summary.element.ts → dist/elements/color/vira-color-pair-contrast-summary.element.js} +68 -100
- package/dist/elements/color/vira-color-pair.element.d.ts +17 -0
- package/{src/elements/color/vira-color-pair.element.ts → dist/elements/color/vira-color-pair.element.js} +50 -71
- package/dist/elements/color/vira-color-picker.element.d.ts +20 -0
- package/{src/elements/color/vira-color-picker.element.ts → dist/elements/color/vira-color-picker.element.js} +92 -117
- package/dist/elements/color/vira-color-slider.element.d.ts +14 -0
- package/dist/elements/color/vira-color-slider.element.js +124 -0
- package/dist/elements/color/vira-color-swatch.element.d.ts +20 -0
- package/{src/elements/color/vira-color-swatch.element.ts → dist/elements/color/vira-color-swatch.element.js} +6 -16
- package/dist/elements/color/vira-contrast-indicator.element.d.ts +10 -0
- package/{src/elements/color/vira-contrast-indicator.element.ts → dist/elements/color/vira-contrast-indicator.element.js} +13 -28
- package/dist/elements/index.js +39 -0
- package/dist/elements/pop-up/vira-menu-item.element.d.ts +38 -0
- package/{src/elements/pop-up/vira-menu-item.element.ts → dist/elements/pop-up/vira-menu-item.element.js} +80 -117
- package/dist/elements/pop-up/vira-menu-trigger.element.d.ts +45 -0
- package/dist/elements/pop-up/vira-menu-trigger.element.js +100 -0
- package/dist/elements/pop-up/vira-menu.element.d.ts +36 -0
- package/{src/elements/pop-up/vira-menu.element.ts → dist/elements/pop-up/vira-menu.element.js} +28 -31
- package/dist/elements/pop-up/vira-pop-up-trigger.element.d.ts +109 -0
- package/dist/elements/pop-up/vira-pop-up-trigger.element.js +408 -0
- package/dist/elements/vira-absolute-time.element.d.ts +35 -0
- package/dist/elements/vira-absolute-time.element.js +43 -0
- package/dist/elements/vira-bold-text.element.d.ts +9 -0
- package/{src/elements/vira-bold-text.element.ts → dist/elements/vira-bold-text.element.js} +11 -10
- package/dist/elements/vira-button.element.d.ts +44 -0
- package/{src/elements/vira-button.element.ts → dist/elements/vira-button.element.js} +107 -255
- package/dist/elements/vira-card.element.d.ts +18 -0
- package/{src/elements/vira-card.element.ts → dist/elements/vira-card.element.js} +19 -18
- package/dist/elements/vira-checkbox.element.d.ts +44 -0
- package/{src/elements/vira-checkbox.element.ts → dist/elements/vira-checkbox.element.js} +48 -95
- package/dist/elements/vira-collapsible-card.element.d.ts +36 -0
- package/{src/elements/vira-collapsible-card.element.ts → dist/elements/vira-collapsible-card.element.js} +44 -71
- package/dist/elements/vira-collapsible-wrapper.element.d.ts +30 -0
- package/{src/elements/vira-collapsible-wrapper.element.ts → dist/elements/vira-collapsible-wrapper.element.js} +47 -59
- package/dist/elements/vira-date-input.element.d.ts +47 -0
- package/dist/elements/vira-date-input.element.js +142 -0
- package/dist/elements/vira-drawer.element.d.ts +24 -0
- package/{src/elements/vira-drawer.element.ts → dist/elements/vira-drawer.element.js} +98 -125
- package/dist/elements/vira-dropdown.element.d.ts +43 -0
- package/dist/elements/vira-dropdown.element.js +247 -0
- package/dist/elements/vira-error.element.d.ts +7 -0
- package/{src/elements/vira-error.element.ts → dist/elements/vira-error.element.js} +7 -8
- package/dist/elements/vira-form.element.d.ts +56 -0
- package/dist/elements/vira-form.element.js +376 -0
- package/dist/elements/vira-icon.element.d.ts +13 -0
- package/{src/elements/vira-icon.element.ts → dist/elements/vira-icon.element.js} +12 -16
- package/dist/elements/vira-image.element.d.ts +45 -0
- package/{src/elements/vira-image.element.ts → dist/elements/vira-image.element.js} +50 -70
- package/dist/elements/vira-input.element.d.ts +64 -0
- package/{src/elements/vira-input.element.ts → dist/elements/vira-input.element.js} +112 -167
- package/dist/elements/vira-json-form.element.d.ts +35 -0
- package/{src/elements/vira-json-form.element.ts → dist/elements/vira-json-form.element.js} +356 -522
- package/dist/elements/vira-link.element.d.ts +78 -0
- package/{src/elements/vira-link.element.ts → dist/elements/vira-link.element.js} +24 -83
- package/dist/elements/vira-modal.element.d.ts +40 -0
- package/{src/elements/vira-modal.element.ts → dist/elements/vira-modal.element.js} +68 -104
- package/dist/elements/vira-progress.element.d.ts +18 -0
- package/{src/elements/vira-progress.element.ts → dist/elements/vira-progress.element.js} +12 -25
- package/dist/elements/vira-relative-time.element.d.ts +42 -0
- package/dist/elements/vira-relative-time.element.js +96 -0
- package/dist/elements/vira-select.element.d.ts +44 -0
- package/{src/elements/vira-select.element.ts → dist/elements/vira-select.element.js} +89 -138
- package/dist/elements/vira-tabs.element.d.ts +124 -0
- package/{src/elements/vira-tabs.element.ts → dist/elements/vira-tabs.element.js} +242 -446
- package/dist/elements/vira-tag.element.d.ts +40 -0
- package/{src/elements/vira-tag.element.ts → dist/elements/vira-tag.element.js} +152 -266
- package/dist/elements/vira-text-area.element.d.ts +48 -0
- package/{src/elements/vira-text-area.element.ts → dist/elements/vira-text-area.element.js} +52 -70
- package/dist/elements/vira-theme-switcher.element.d.ts +17 -0
- package/{src/elements/vira-theme-switcher.element.ts → dist/elements/vira-theme-switcher.element.js} +34 -49
- package/dist/icons/colored-icon.d.ts +11 -0
- package/{src/icons/colored-icon.ts → dist/icons/colored-icon.js} +17 -24
- package/dist/icons/icon-css-vars.d.ts +14 -0
- package/{src/icons/icon-css-vars.ts → dist/icons/icon-css-vars.js} +1 -2
- package/{src/icons/icon-svg.ts → dist/icons/icon-svg.d.ts} +3 -15
- package/dist/icons/icon-svg.js +12 -0
- package/dist/icons/icon-svgs/16/check-16.icon.d.ts +8 -0
- package/{src/icons/icon-svgs/16/check-16.icon.ts → dist/icons/icon-svgs/16/check-16.icon.js} +4 -5
- package/dist/icons/icon-svgs/16/chevron-down-16.icon.d.ts +8 -0
- package/{src/icons/icon-svgs/16/chevron-down-16.icon.ts → dist/icons/icon-svgs/16/chevron-down-16.icon.js} +4 -5
- package/dist/icons/icon-svgs/16/chevron-up-16.icon.d.ts +8 -0
- package/{src/icons/icon-svgs/16/chevron-up-16.icon.ts → dist/icons/icon-svgs/16/chevron-up-16.icon.js} +4 -5
- package/dist/icons/icon-svgs/16/dash-16.icon.d.ts +8 -0
- package/{src/icons/icon-svgs/16/dash-16.icon.ts → dist/icons/icon-svgs/16/dash-16.icon.js} +4 -5
- package/dist/icons/icon-svgs/16/element-16.icon.d.ts +8 -0
- package/{src/icons/icon-svgs/16/element-16.icon.ts → dist/icons/icon-svgs/16/element-16.icon.js} +4 -5
- package/dist/icons/icon-svgs/16/plus-16.icon.d.ts +8 -0
- package/{src/icons/icon-svgs/16/plus-16.icon.ts → dist/icons/icon-svgs/16/plus-16.icon.js} +4 -5
- package/dist/icons/icon-svgs/16/upload-16.icon.d.ts +8 -0
- package/{src/icons/icon-svgs/16/upload-16.icon.ts → dist/icons/icon-svgs/16/upload-16.icon.js} +4 -5
- package/dist/icons/icon-svgs/16/x-16.icon.d.ts +8 -0
- package/{src/icons/icon-svgs/16/x-16.icon.ts → dist/icons/icon-svgs/16/x-16.icon.js} +4 -5
- package/dist/icons/icon-svgs/24/arrow-down-24.icon.d.ts +8 -0
- package/{src/icons/icon-svgs/24/arrow-down-24.icon.ts → dist/icons/icon-svgs/24/arrow-down-24.icon.js} +4 -5
- package/dist/icons/icon-svgs/24/arrow-left-24.icon.d.ts +8 -0
- package/{src/icons/icon-svgs/24/arrow-left-24.icon.ts → dist/icons/icon-svgs/24/arrow-left-24.icon.js} +4 -5
- package/dist/icons/icon-svgs/24/arrow-right-24.icon.d.ts +8 -0
- package/{src/icons/icon-svgs/24/arrow-right-24.icon.ts → dist/icons/icon-svgs/24/arrow-right-24.icon.js} +4 -5
- package/dist/icons/icon-svgs/24/arrow-up-24.icon.d.ts +8 -0
- package/{src/icons/icon-svgs/24/arrow-up-24.icon.ts → dist/icons/icon-svgs/24/arrow-up-24.icon.js} +4 -5
- package/dist/icons/icon-svgs/24/auto-theme-24.icon.d.ts +8 -0
- package/{src/icons/icon-svgs/24/auto-theme-24.icon.ts → dist/icons/icon-svgs/24/auto-theme-24.icon.js} +4 -5
- package/dist/icons/icon-svgs/24/bell-24.icon.d.ts +8 -0
- package/{src/icons/icon-svgs/24/bell-24.icon.ts → dist/icons/icon-svgs/24/bell-24.icon.js} +4 -5
- package/dist/icons/icon-svgs/24/chat-24.icon.d.ts +8 -0
- package/{src/icons/icon-svgs/24/chat-24.icon.ts → dist/icons/icon-svgs/24/chat-24.icon.js} +4 -5
- package/dist/icons/icon-svgs/24/check-24.icon.d.ts +8 -0
- package/{src/icons/icon-svgs/24/check-24.icon.ts → dist/icons/icon-svgs/24/check-24.icon.js} +4 -5
- package/dist/icons/icon-svgs/24/chevron-down-24.icon.d.ts +8 -0
- package/{src/icons/icon-svgs/24/chevron-down-24.icon.ts → dist/icons/icon-svgs/24/chevron-down-24.icon.js} +4 -5
- package/dist/icons/icon-svgs/24/chevron-up-24.icon.d.ts +8 -0
- package/{src/icons/icon-svgs/24/chevron-up-24.icon.ts → dist/icons/icon-svgs/24/chevron-up-24.icon.js} +4 -5
- package/dist/icons/icon-svgs/24/close-x-24.icon.d.ts +8 -0
- package/{src/icons/icon-svgs/24/close-x-24.icon.ts → dist/icons/icon-svgs/24/close-x-24.icon.js} +4 -5
- package/dist/icons/icon-svgs/24/commit-24.icon.d.ts +8 -0
- package/{src/icons/icon-svgs/24/commit-24.icon.ts → dist/icons/icon-svgs/24/commit-24.icon.js} +4 -5
- package/dist/icons/icon-svgs/24/copy-24.icon.d.ts +8 -0
- package/{src/icons/icon-svgs/24/copy-24.icon.ts → dist/icons/icon-svgs/24/copy-24.icon.js} +4 -5
- package/dist/icons/icon-svgs/24/document-24.icon.d.ts +8 -0
- package/{src/icons/icon-svgs/24/document-24.icon.ts → dist/icons/icon-svgs/24/document-24.icon.js} +4 -5
- package/dist/icons/icon-svgs/24/document-search-24.icon.d.ts +8 -0
- package/{src/icons/icon-svgs/24/document-search-24.icon.ts → dist/icons/icon-svgs/24/document-search-24.icon.js} +4 -5
- package/dist/icons/icon-svgs/24/double-chevron-24.icon.d.ts +8 -0
- package/{src/icons/icon-svgs/24/double-chevron-24.icon.ts → dist/icons/icon-svgs/24/double-chevron-24.icon.js} +4 -5
- package/dist/icons/icon-svgs/24/element-24.icon.d.ts +8 -0
- package/{src/icons/icon-svgs/24/element-24.icon.ts → dist/icons/icon-svgs/24/element-24.icon.js} +4 -5
- package/dist/icons/icon-svgs/24/external-link-24.icon.d.ts +8 -0
- package/{src/icons/icon-svgs/24/external-link-24.icon.ts → dist/icons/icon-svgs/24/external-link-24.icon.js} +4 -5
- package/dist/icons/icon-svgs/24/eye-closed-24.icon.d.ts +8 -0
- package/{src/icons/icon-svgs/24/eye-closed-24.icon.ts → dist/icons/icon-svgs/24/eye-closed-24.icon.js} +4 -5
- package/dist/icons/icon-svgs/24/eye-open-24.icon.d.ts +8 -0
- package/{src/icons/icon-svgs/24/eye-open-24.icon.ts → dist/icons/icon-svgs/24/eye-open-24.icon.js} +4 -5
- package/dist/icons/icon-svgs/24/filter-24.icon.d.ts +8 -0
- package/{src/icons/icon-svgs/24/filter-24.icon.ts → dist/icons/icon-svgs/24/filter-24.icon.js} +4 -5
- package/dist/icons/icon-svgs/24/globe-24.icon.d.ts +8 -0
- package/{src/icons/icon-svgs/24/globe-24.icon.ts → dist/icons/icon-svgs/24/globe-24.icon.js} +4 -5
- package/dist/icons/icon-svgs/24/link-24.icon.d.ts +8 -0
- package/{src/icons/icon-svgs/24/link-24.icon.ts → dist/icons/icon-svgs/24/link-24.icon.js} +4 -5
- package/dist/icons/icon-svgs/24/loader-24.icon.d.ts +8 -0
- package/{src/icons/icon-svgs/24/loader-24.icon.ts → dist/icons/icon-svgs/24/loader-24.icon.js} +4 -5
- package/dist/icons/icon-svgs/24/loader-animated-24.icon.d.ts +8 -0
- package/{src/icons/icon-svgs/24/loader-animated-24.icon.ts → dist/icons/icon-svgs/24/loader-animated-24.icon.js} +6 -8
- package/dist/icons/icon-svgs/24/lock-24.icon.d.ts +8 -0
- package/{src/icons/icon-svgs/24/lock-24.icon.ts → dist/icons/icon-svgs/24/lock-24.icon.js} +4 -5
- package/dist/icons/icon-svgs/24/magnifying-glass-24.icon.d.ts +8 -0
- package/{src/icons/icon-svgs/24/magnifying-glass-24.icon.ts → dist/icons/icon-svgs/24/magnifying-glass-24.icon.js} +4 -5
- package/dist/icons/icon-svgs/24/moon-24.icon.d.ts +8 -0
- package/{src/icons/icon-svgs/24/moon-24.icon.ts → dist/icons/icon-svgs/24/moon-24.icon.js} +4 -5
- package/dist/icons/icon-svgs/24/options-24.icon.d.ts +8 -0
- package/{src/icons/icon-svgs/24/options-24.icon.ts → dist/icons/icon-svgs/24/options-24.icon.js} +4 -5
- package/dist/icons/icon-svgs/24/pencil-24.icon.d.ts +8 -0
- package/{src/icons/icon-svgs/24/pencil-24.icon.ts → dist/icons/icon-svgs/24/pencil-24.icon.js} +4 -5
- package/dist/icons/icon-svgs/24/plus-24.icon.d.ts +8 -0
- package/{src/icons/icon-svgs/24/plus-24.icon.ts → dist/icons/icon-svgs/24/plus-24.icon.js} +4 -5
- package/dist/icons/icon-svgs/24/printer-24.icon.d.ts +8 -0
- package/{src/icons/icon-svgs/24/printer-24.icon.ts → dist/icons/icon-svgs/24/printer-24.icon.js} +4 -5
- package/dist/icons/icon-svgs/24/shield-24.icon.d.ts +8 -0
- package/{src/icons/icon-svgs/24/shield-24.icon.ts → dist/icons/icon-svgs/24/shield-24.icon.js} +4 -5
- package/dist/icons/icon-svgs/24/sort-ascending-24.icon.d.ts +8 -0
- package/{src/icons/icon-svgs/24/sort-ascending-24.icon.ts → dist/icons/icon-svgs/24/sort-ascending-24.icon.js} +4 -5
- package/dist/icons/icon-svgs/24/sort-descending-24.icon.d.ts +8 -0
- package/{src/icons/icon-svgs/24/sort-descending-24.icon.ts → dist/icons/icon-svgs/24/sort-descending-24.icon.js} +4 -5
- package/dist/icons/icon-svgs/24/sparkle-24.icon.d.ts +8 -0
- package/{src/icons/icon-svgs/24/sparkle-24.icon.ts → dist/icons/icon-svgs/24/sparkle-24.icon.js} +4 -5
- package/dist/icons/icon-svgs/24/speaker-loud-24.icon.d.ts +8 -0
- package/{src/icons/icon-svgs/24/speaker-loud-24.icon.ts → dist/icons/icon-svgs/24/speaker-loud-24.icon.js} +4 -5
- package/dist/icons/icon-svgs/24/speaker-medium-24.icon.d.ts +8 -0
- package/{src/icons/icon-svgs/24/speaker-medium-24.icon.ts → dist/icons/icon-svgs/24/speaker-medium-24.icon.js} +4 -5
- package/dist/icons/icon-svgs/24/speaker-muted-24.icon.d.ts +8 -0
- package/{src/icons/icon-svgs/24/speaker-muted-24.icon.ts → dist/icons/icon-svgs/24/speaker-muted-24.icon.js} +4 -5
- package/dist/icons/icon-svgs/24/speaker-quiet-24.icon.d.ts +8 -0
- package/{src/icons/icon-svgs/24/speaker-quiet-24.icon.ts → dist/icons/icon-svgs/24/speaker-quiet-24.icon.js} +4 -5
- package/dist/icons/icon-svgs/24/star-24.icon.d.ts +8 -0
- package/{src/icons/icon-svgs/24/star-24.icon.ts → dist/icons/icon-svgs/24/star-24.icon.js} +4 -5
- package/dist/icons/icon-svgs/24/status-failure-24.icon.d.ts +8 -0
- package/{src/icons/icon-svgs/24/status-failure-24.icon.ts → dist/icons/icon-svgs/24/status-failure-24.icon.js} +4 -5
- package/dist/icons/icon-svgs/24/status-in-progress-24.icon.d.ts +8 -0
- package/{src/icons/icon-svgs/24/status-in-progress-24.icon.ts → dist/icons/icon-svgs/24/status-in-progress-24.icon.js} +4 -5
- package/dist/icons/icon-svgs/24/status-success-24.icon.d.ts +8 -0
- package/{src/icons/icon-svgs/24/status-success-24.icon.ts → dist/icons/icon-svgs/24/status-success-24.icon.js} +4 -5
- package/dist/icons/icon-svgs/24/status-unknown-24.icon.d.ts +8 -0
- package/{src/icons/icon-svgs/24/status-unknown-24.icon.ts → dist/icons/icon-svgs/24/status-unknown-24.icon.js} +4 -5
- package/dist/icons/icon-svgs/24/status-warning-24.icon.d.ts +8 -0
- package/{src/icons/icon-svgs/24/status-warning-24.icon.ts → dist/icons/icon-svgs/24/status-warning-24.icon.js} +4 -5
- package/dist/icons/icon-svgs/24/sun-24.icon.d.ts +8 -0
- package/{src/icons/icon-svgs/24/sun-24.icon.ts → dist/icons/icon-svgs/24/sun-24.icon.js} +4 -5
- package/dist/icons/icon-svgs/24/upload-24.icon.d.ts +8 -0
- package/{src/icons/icon-svgs/24/upload-24.icon.ts → dist/icons/icon-svgs/24/upload-24.icon.js} +4 -5
- package/dist/icons/icon-svgs/24/x-24.icon.d.ts +8 -0
- package/{src/icons/icon-svgs/24/x-24.icon.ts → dist/icons/icon-svgs/24/x-24.icon.js} +4 -5
- package/dist/icons/index.d.ts +197 -0
- package/{src/icons/index.ts → dist/icons/index.js} +60 -65
- package/dist/icons/lucide-icons.d.ts +15 -0
- package/dist/icons/lucide-icons.js +79 -0
- package/dist/icons/sized-icon.d.ts +8 -0
- package/{src/icons/sized-icon.ts → dist/icons/sized-icon.js} +1 -3
- package/dist/index.js +4 -0
- package/dist/styles/disabled.d.ts +6 -0
- package/{src/styles/disabled.ts → dist/styles/disabled.js} +2 -3
- package/dist/styles/durations.d.ts +22 -0
- package/{src/styles/durations.ts → dist/styles/durations.js} +1 -2
- package/dist/styles/focus.d.ts +26 -0
- package/{src/styles/focus.ts → dist/styles/focus.js} +12 -40
- package/dist/styles/font.d.ts +12 -0
- package/{src/styles/font.ts → dist/styles/font.js} +1 -3
- package/dist/styles/form-styles.d.ts +46 -0
- package/dist/styles/form-styles.js +53 -0
- package/dist/styles/form-variants.d.ts +117 -0
- package/{src/styles/form-variants.ts → dist/styles/form-variants.js} +34 -42
- package/{src/styles/index.ts → dist/styles/index.d.ts} +0 -1
- package/dist/styles/index.js +14 -0
- package/dist/styles/native-styles.d.ts +13 -0
- package/{src/styles/native-styles.ts → dist/styles/native-styles.js} +3 -5
- package/dist/styles/scrollbar.d.ts +6 -0
- package/{src/styles/scrollbar.ts → dist/styles/scrollbar.js} +3 -4
- package/dist/styles/shadows.d.ts +19 -0
- package/{src/styles/shadows.ts → dist/styles/shadows.js} +5 -7
- package/dist/styles/user-select.d.ts +6 -0
- package/{src/styles/user-select.ts → dist/styles/user-select.js} +2 -3
- package/dist/styles/vira-color-palette.d.ts +178 -0
- package/{src/styles/vira-color-palette.ts → dist/styles/vira-color-palette.js} +1 -3
- package/dist/styles/vira-color-theme-object.d.ts +65 -0
- package/dist/styles/vira-color-theme-object.js +65 -0
- package/dist/styles/vira-color-theme.d.ts +2785 -0
- package/{src/styles/vira-color-theme.ts → dist/styles/vira-color-theme.js} +1222 -1227
- package/dist/util/color-local-storage.client.d.ts +4 -0
- package/dist/util/color-local-storage.client.js +6 -0
- package/dist/util/define-table.d.ts +115 -0
- package/dist/util/define-table.js +115 -0
- package/dist/util/define-vira-element.d.ts +18 -0
- package/dist/util/define-vira-element.js +19 -0
- package/dist/util/dynamic-element.d.ts +62 -0
- package/dist/util/dynamic-element.js +61 -0
- package/dist/util/index.js +11 -0
- package/dist/util/overflow-observer.d.ts +25 -0
- package/{src/util/overflow-observer.ts → dist/util/overflow-observer.js} +1 -30
- package/dist/util/pop-up-helpers.d.ts +59 -0
- package/dist/util/pop-up-helpers.js +66 -0
- package/dist/util/pop-up-manager.d.ts +200 -0
- package/dist/util/pop-up-manager.js +258 -0
- package/dist/util/shared-text-input-logic.d.ts +69 -0
- package/dist/util/shared-text-input-logic.js +114 -0
- package/dist/util/vira-form-fields.d.ts +145 -0
- package/dist/util/vira-form-fields.js +66 -0
- package/dist/util/vira-json-schema.d.ts +206 -0
- package/{src/util/vira-json-schema.ts → dist/util/vira-json-schema.js} +155 -298
- package/{src/util/vira-select-option.ts → dist/util/vira-select-option.d.ts} +2 -9
- package/dist/util/vira-select-option.js +8 -0
- package/dist/util/vira-theme-client.d.ts +83 -0
- package/dist/util/vira-theme-client.js +93 -0
- package/package.json +13 -13
- package/src/elements/color/vira-all-color-space-sliders.element.ts +0 -66
- package/src/elements/color/vira-all-spaces-color-picker.element.ts +0 -85
- package/src/elements/color/vira-color-format-sliders.element.ts +0 -78
- package/src/elements/color/vira-color-slider.element.ts +0 -169
- package/src/elements/pop-up/vira-menu-trigger.element.ts +0 -135
- package/src/elements/pop-up/vira-pop-up-trigger.element.ts +0 -539
- package/src/elements/vira-absolute-time.element.ts +0 -81
- package/src/elements/vira-date-input.element.ts +0 -185
- package/src/elements/vira-dropdown.element.ts +0 -310
- package/src/elements/vira-form.element.ts +0 -466
- package/src/elements/vira-relative-time.element.ts +0 -135
- package/src/icons/icon-color.test-helper.ts +0 -9
- package/src/icons/lucide-icons.ts +0 -120
- package/src/styles/form-styles.ts +0 -86
- package/src/styles/vira-color-palette.json +0 -170
- package/src/styles/vira-color-theme-object.ts +0 -170
- package/src/util/color-local-storage.client.ts +0 -7
- package/src/util/define-table.ts +0 -286
- package/src/util/define-vira-element.ts +0 -29
- package/src/util/dynamic-element.ts +0 -128
- package/src/util/pop-up-helpers.ts +0 -133
- package/src/util/pop-up-manager.ts +0 -434
- package/src/util/shared-text-input-logic.ts +0 -192
- package/src/util/vira-form-fields.ts +0 -195
- package/src/util/vira-theme-client.ts +0 -140
- /package/{src/elements/index.ts → dist/elements/index.d.ts} +0 -0
- /package/{src/index.ts → dist/index.d.ts} +0 -0
- /package/{src/util/index.ts → dist/util/index.d.ts} +0 -0
|
@@ -1,108 +1,52 @@
|
|
|
1
|
-
import {check} from '@augment-vir/assert';
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
} from '
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
} from 'element
|
|
21
|
-
import {
|
|
22
|
-
routeHasPaths,
|
|
23
|
-
type FullSpaRoute,
|
|
24
|
-
type GenericTreePaths,
|
|
25
|
-
type SpaRouter,
|
|
26
|
-
} from 'spa-router-vir';
|
|
27
|
-
import {themeDefaultKey} from 'theme-vir/dist/color-theme/color-theme.js';
|
|
28
|
-
import {type ViraIconSvg} from '../icons/icon-svg.js';
|
|
29
|
-
import {Check24Icon} from '../icons/icon-svgs/24/check-24.icon.js';
|
|
30
|
-
import {createFocusStyles} from '../styles/focus.js';
|
|
31
|
-
import {viraFontCssVars} from '../styles/font.js';
|
|
32
|
-
import {viraFormCssVars} from '../styles/form-styles.js';
|
|
33
|
-
import {
|
|
34
|
-
standaloneThemeColorNames,
|
|
35
|
-
ViraColorVariant,
|
|
36
|
-
viraColorVariantToHostClassKey,
|
|
37
|
-
} from '../styles/form-variants.js';
|
|
38
|
-
import {noNativeFormStyles, noUserSelect, viraDisabledStyles, viraTheme} from '../styles/index.js';
|
|
39
|
-
import {viraThemeByKeys, ViraThemeColorName} from '../styles/vira-color-theme-object.js';
|
|
40
|
-
import {defineViraElement} from '../util/define-vira-element.js';
|
|
41
|
-
import {renderMenuItemEntries, type ViraMenuItemEntry} from '../util/pop-up-helpers.js';
|
|
42
|
-
import {ViraMenuTrigger} from './pop-up/vira-menu-trigger.element.js';
|
|
43
|
-
import {ViraMenuCornerStyle} from './pop-up/vira-menu.element.js';
|
|
44
|
-
import {type HorizontalAnchor, type PopUpOffset} from './pop-up/vira-pop-up-trigger.element.js';
|
|
45
|
-
import {ViraBoldText} from './vira-bold-text.element.js';
|
|
46
|
-
import {ViraButton} from './vira-button.element.js';
|
|
47
|
-
import {ViraIcon} from './vira-icon.element.js';
|
|
48
|
-
import {ViraLink} from './vira-link.element.js';
|
|
49
|
-
|
|
1
|
+
import { check } from '@augment-vir/assert';
|
|
2
|
+
import { arrayToObject, filterMap, getObjectTypedKeys, } from '@augment-vir/common';
|
|
3
|
+
import { ContrastLevelName } from '@electrovir/color/dist/data/contrast/contrast.js';
|
|
4
|
+
import { classMap, css, defineElementEvent, html, listen, nothing, onDomCreated, unsafeCSS, } from 'element-vir';
|
|
5
|
+
import { routeHasPaths, } from 'spa-router-vir';
|
|
6
|
+
import { themeDefaultKey } from 'theme-vir/dist/color-theme/color-theme.js';
|
|
7
|
+
import { ChevronDown16Icon } from '../icons/icon-svgs/16/chevron-down-16.icon.js';
|
|
8
|
+
import { createFocusStyles } from '../styles/focus.js';
|
|
9
|
+
import { viraFontCssVars } from '../styles/font.js';
|
|
10
|
+
import { viraFormCssVars } from '../styles/form-styles.js';
|
|
11
|
+
import { standaloneThemeColorNames, ViraColorVariant, viraColorVariantToHostClassKey, } from '../styles/form-variants.js';
|
|
12
|
+
import { noNativeFormStyles, noUserSelect, viraDisabledStyles, viraTheme } from '../styles/index.js';
|
|
13
|
+
import { viraThemeByKeys, ViraThemeColorName } from '../styles/vira-color-theme-object.js';
|
|
14
|
+
import { defineViraElement } from '../util/define-vira-element.js';
|
|
15
|
+
import { renderMenuItemEntries } from '../util/pop-up-helpers.js';
|
|
16
|
+
import { ViraMenuTrigger } from './pop-up/vira-menu-trigger.element.js';
|
|
17
|
+
import { ViraMenuCornerStyle } from './pop-up/vira-menu.element.js';
|
|
18
|
+
import { ViraBoldText } from './vira-bold-text.element.js';
|
|
19
|
+
import { ViraButton } from './vira-button.element.js';
|
|
20
|
+
import { ViraIcon } from './vira-icon.element.js';
|
|
21
|
+
import { ViraLink } from './vira-link.element.js';
|
|
50
22
|
/**
|
|
51
23
|
* Controls which edge of the tab the selection indicator bar appears on.
|
|
52
24
|
*
|
|
53
25
|
* @category Internal
|
|
54
26
|
*/
|
|
55
|
-
export
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
27
|
+
export var ViraTabsBarDirection;
|
|
28
|
+
(function (ViraTabsBarDirection) {
|
|
29
|
+
ViraTabsBarDirection["Top"] = "top";
|
|
30
|
+
ViraTabsBarDirection["Bottom"] = "bottom";
|
|
31
|
+
ViraTabsBarDirection["Left"] = "left";
|
|
32
|
+
ViraTabsBarDirection["Right"] = "right";
|
|
33
|
+
})(ViraTabsBarDirection || (ViraTabsBarDirection = {}));
|
|
62
34
|
/**
|
|
63
35
|
* Controls whether tab icons render above/below or beside the label text.
|
|
64
36
|
*
|
|
65
37
|
* @category Internal
|
|
66
38
|
*/
|
|
67
|
-
export
|
|
39
|
+
export var ViraTabsIconLayout;
|
|
40
|
+
(function (ViraTabsIconLayout) {
|
|
68
41
|
/** Icon renders above (or below) the label. */
|
|
69
|
-
Vertical =
|
|
42
|
+
ViraTabsIconLayout["Vertical"] = "vertical";
|
|
70
43
|
/** Icon renders beside the label. */
|
|
71
|
-
Horizontal =
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
function measureElementWidth(mirrorElement: Element, selector: string) {
|
|
44
|
+
ViraTabsIconLayout["Horizontal"] = "horizontal";
|
|
45
|
+
})(ViraTabsIconLayout || (ViraTabsIconLayout = {}));
|
|
46
|
+
function measureElementWidth(mirrorElement, selector) {
|
|
75
47
|
const element = mirrorElement.querySelector(selector);
|
|
76
48
|
return element ? element.getBoundingClientRect().width : 0;
|
|
77
49
|
}
|
|
78
|
-
|
|
79
|
-
/**
|
|
80
|
-
* A single tab entry for {@link ViraTabs}.
|
|
81
|
-
*
|
|
82
|
-
* @category Internal
|
|
83
|
-
*/
|
|
84
|
-
export type ViraTab = {
|
|
85
|
-
label: string;
|
|
86
|
-
paths: GenericTreePaths;
|
|
87
|
-
} & PartialWithUndefined<{
|
|
88
|
-
icon: Readonly<ViraIconSvg>;
|
|
89
|
-
isHidden: boolean;
|
|
90
|
-
isDisabled: boolean;
|
|
91
|
-
/**
|
|
92
|
-
* When true, the tab is only considered selected when the current route's paths exactly equal
|
|
93
|
-
* `paths.fullPaths`. By default a tab is considered selected when its paths are a prefix of the
|
|
94
|
-
* current route.
|
|
95
|
-
*/
|
|
96
|
-
exactMatch: boolean;
|
|
97
|
-
/**
|
|
98
|
-
* Optional cluster label. Consecutive tabs sharing the same `group` string render together
|
|
99
|
-
* under that label, separated from other clusters by an inset vertical divider. Tabs with no
|
|
100
|
-
* `group` render standalone (no label, no divider). Grouping only affects rendering when at
|
|
101
|
-
* least one tab has a `group`.
|
|
102
|
-
*/
|
|
103
|
-
group: string;
|
|
104
|
-
}>;
|
|
105
|
-
|
|
106
50
|
/**
|
|
107
51
|
* Groups a flat list of tabs into clusters. Consecutive tabs sharing the same `group` string are
|
|
108
52
|
* merged into a single cluster; ungrouped tabs (and tabs whose `group` differs from their
|
|
@@ -110,13 +54,8 @@ export type ViraTab = {
|
|
|
110
54
|
*
|
|
111
55
|
* @category Internal
|
|
112
56
|
*/
|
|
113
|
-
export function buildClusters(tabList
|
|
114
|
-
return tabList.reduce
|
|
115
|
-
{
|
|
116
|
-
group: string | undefined;
|
|
117
|
-
tabs: ReadonlyArray<Readonly<ViraTab>>;
|
|
118
|
-
}[]
|
|
119
|
-
>((accumulatedClusters, tab) => {
|
|
57
|
+
export function buildClusters(tabList) {
|
|
58
|
+
return tabList.reduce((accumulatedClusters, tab) => {
|
|
120
59
|
const lastCluster = accumulatedClusters[accumulatedClusters.length - 1];
|
|
121
60
|
if (tab.group != undefined && lastCluster && lastCluster.group === tab.group) {
|
|
122
61
|
return [
|
|
@@ -139,33 +78,27 @@ export function buildClusters(tabList: ReadonlyArray<Readonly<ViraTab>>) {
|
|
|
139
78
|
];
|
|
140
79
|
}, []);
|
|
141
80
|
}
|
|
142
|
-
|
|
143
|
-
function renderGroupedContent(
|
|
144
|
-
tabList: ReadonlyArray<Readonly<ViraTab>>,
|
|
145
|
-
renderItem: (tab: Readonly<ViraTab>) => HTMLTemplateResult,
|
|
146
|
-
) {
|
|
81
|
+
function renderGroupedContent(tabList, renderItem) {
|
|
147
82
|
const clusters = buildClusters(tabList);
|
|
148
83
|
return clusters.map((cluster, clusterIndex) => {
|
|
149
84
|
const previousCluster = clusters[clusterIndex - 1];
|
|
150
|
-
const dividerTemplate =
|
|
151
|
-
|
|
152
|
-
? html`
|
|
85
|
+
const dividerTemplate = previousCluster && previousCluster.group != undefined && cluster.group != undefined
|
|
86
|
+
? html `
|
|
153
87
|
<span class="tab-cluster-divider"></span>
|
|
154
88
|
`
|
|
155
|
-
|
|
156
|
-
const labelTemplate =
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
: html`
|
|
89
|
+
: nothing;
|
|
90
|
+
const labelTemplate = cluster.group == undefined
|
|
91
|
+
? nothing
|
|
92
|
+
: html `
|
|
160
93
|
<span class="tab-group-label">${cluster.group}</span>
|
|
161
94
|
`;
|
|
162
|
-
return html`
|
|
95
|
+
return html `
|
|
163
96
|
${dividerTemplate}
|
|
164
97
|
<div
|
|
165
98
|
class=${classMap({
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
99
|
+
'tab-cluster': true,
|
|
100
|
+
standalone: cluster.group == undefined,
|
|
101
|
+
})}
|
|
169
102
|
>
|
|
170
103
|
${labelTemplate}
|
|
171
104
|
<div class="tab-cluster-tabs">${cluster.tabs.map(renderItem)}</div>
|
|
@@ -173,213 +106,124 @@ function renderGroupedContent(
|
|
|
173
106
|
`;
|
|
174
107
|
});
|
|
175
108
|
}
|
|
176
|
-
|
|
177
109
|
/**
|
|
178
110
|
* A tab bar element that renders an array of tabs with an animated selection indicator.
|
|
179
111
|
*
|
|
180
112
|
* @category Elements
|
|
181
113
|
*/
|
|
182
|
-
export const ViraTabs = defineViraElement
|
|
183
|
-
{
|
|
184
|
-
tabs: ReadonlyArray<Readonly<ViraTab>>;
|
|
185
|
-
router: Pick<SpaRouter<any, any, any>, 'createRouteUrl' | 'setRouteOnDirectNavigation'>;
|
|
186
|
-
currentRoute: Readonly<FullSpaRoute>;
|
|
187
|
-
} & PartialWithUndefined<{
|
|
188
|
-
/**
|
|
189
|
-
* Which edge of the tab the selection bar appears on.
|
|
190
|
-
*
|
|
191
|
-
* @default ViraTabsBarDirection.Bottom
|
|
192
|
-
*/
|
|
193
|
-
barDirection: ViraTabsBarDirection;
|
|
194
|
-
/**
|
|
195
|
-
* Color variant for the tab selection indicator and active tab text. Accepts any
|
|
196
|
-
* {@link ViraColorVariant} or a {@link ViraThemeColorName} (e.g.,
|
|
197
|
-
* `ViraThemeColorName.blue`).
|
|
198
|
-
*
|
|
199
|
-
* @default ViraColorVariant.Plain
|
|
200
|
-
*/
|
|
201
|
-
color: ViraColorVariant | ViraThemeColorName;
|
|
202
|
-
/**
|
|
203
|
-
* Layout direction for icons relative to their label text.
|
|
204
|
-
*
|
|
205
|
-
* @default ViraTabsIconLayout.Vertical
|
|
206
|
-
*/
|
|
207
|
-
iconLayout: ViraTabsIconLayout;
|
|
208
|
-
/**
|
|
209
|
-
* Horizontal anchor for the dropdown menu. Only used when tabs overflow into a dropdown.
|
|
210
|
-
*
|
|
211
|
-
* @default HorizontalAnchor.Left
|
|
212
|
-
*/
|
|
213
|
-
menuHorizontalAnchor: HorizontalAnchor;
|
|
214
|
-
/** Whether the dropdown trigger is disabled. Only used when tabs overflow into a dropdown. */
|
|
215
|
-
menuIsDisabled: boolean;
|
|
216
|
-
/** Offset for the dropdown pop-up. Only used when tabs overflow into a dropdown. */
|
|
217
|
-
menuPopUpOffset: Readonly<PopUpOffset>;
|
|
218
|
-
/**
|
|
219
|
-
* Text shown on the overflow "more" trigger when the selected tab is _not_ collapsed into
|
|
220
|
-
* the menu. When the selected tab _is_ collapsed, the trigger shows that tab's label (with
|
|
221
|
-
* a checkmark) instead. Set this to a localized string; it defaults to `'More'`.
|
|
222
|
-
*
|
|
223
|
-
* @default 'More'
|
|
224
|
-
*/
|
|
225
|
-
overflowLabel: string;
|
|
226
|
-
/** When true, tabs and their container expand to fill all available horizontal space. */
|
|
227
|
-
shouldFillWidth: boolean;
|
|
228
|
-
}>
|
|
229
|
-
>()({
|
|
114
|
+
export const ViraTabs = defineViraElement()({
|
|
230
115
|
tagName: 'vira-tabs',
|
|
231
116
|
events: {
|
|
232
117
|
/** Fires when a tab is clicked with the corresponding tab entry. */
|
|
233
|
-
tabSelect: defineElementEvent
|
|
118
|
+
tabSelect: defineElementEvent(),
|
|
234
119
|
},
|
|
235
120
|
state() {
|
|
236
121
|
return {
|
|
237
122
|
/** How many of the visible tabs are collapsed into the overflow "more" menu. */
|
|
238
123
|
overflowCount: 0,
|
|
239
124
|
/** A callback to remove all internal observers. */
|
|
240
|
-
cleanupObserver: undefined
|
|
125
|
+
cleanupObserver: undefined,
|
|
241
126
|
};
|
|
242
127
|
},
|
|
243
128
|
hostClasses: {
|
|
244
|
-
'vira-tabs-bar-top'
|
|
245
|
-
|
|
129
|
+
'vira-tabs-bar-top'({ inputs }) {
|
|
130
|
+
return inputs.barDirection === ViraTabsBarDirection.Top;
|
|
131
|
+
},
|
|
132
|
+
'vira-tabs-bar-bottom'({ inputs }) {
|
|
246
133
|
return !inputs.barDirection || inputs.barDirection === ViraTabsBarDirection.Bottom;
|
|
247
134
|
},
|
|
248
|
-
'vira-tabs-bar-left'
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
})
|
|
281
|
-
|
|
282
|
-
standaloneThemeColorNames,
|
|
283
|
-
(colorName) => {
|
|
284
|
-
return {
|
|
285
|
-
key: `vira-tabs-color-${colorName}` as const,
|
|
286
|
-
value: ({
|
|
287
|
-
inputs,
|
|
288
|
-
}: {
|
|
289
|
-
inputs: Readonly<
|
|
290
|
-
PartialWithUndefined<{color: ViraColorVariant | ViraThemeColorName}>
|
|
291
|
-
>;
|
|
292
|
-
}) => {
|
|
293
|
-
return inputs.color === colorName;
|
|
294
|
-
},
|
|
295
|
-
};
|
|
296
|
-
},
|
|
297
|
-
{
|
|
298
|
-
useRequired: true,
|
|
299
|
-
},
|
|
300
|
-
),
|
|
301
|
-
'vira-tabs-icon-layout-vertical': ({inputs}) => {
|
|
135
|
+
'vira-tabs-bar-left'({ inputs }) {
|
|
136
|
+
return inputs.barDirection === ViraTabsBarDirection.Left;
|
|
137
|
+
},
|
|
138
|
+
'vira-tabs-bar-right'({ inputs }) {
|
|
139
|
+
return inputs.barDirection === ViraTabsBarDirection.Right;
|
|
140
|
+
},
|
|
141
|
+
...arrayToObject(getObjectTypedKeys(viraColorVariantToHostClassKey), (colorVariant) => {
|
|
142
|
+
const colorKey = viraColorVariantToHostClassKey[colorVariant];
|
|
143
|
+
return {
|
|
144
|
+
key: `vira-tabs-color-${colorKey}`,
|
|
145
|
+
value({ inputs, }) {
|
|
146
|
+
return inputs.color === colorVariant || inputs.color === colorKey;
|
|
147
|
+
},
|
|
148
|
+
};
|
|
149
|
+
}, {
|
|
150
|
+
useRequired: true,
|
|
151
|
+
}),
|
|
152
|
+
'vira-tabs-color-plain'({ inputs, }) {
|
|
153
|
+
return !inputs.color || inputs.color === ViraColorVariant.Plain;
|
|
154
|
+
},
|
|
155
|
+
'vira-tabs-color-neutral'({ inputs, }) {
|
|
156
|
+
return inputs.color === ViraColorVariant.Neutral;
|
|
157
|
+
},
|
|
158
|
+
...arrayToObject(standaloneThemeColorNames, (colorName) => {
|
|
159
|
+
return {
|
|
160
|
+
key: `vira-tabs-color-${colorName}`,
|
|
161
|
+
value({ inputs, }) {
|
|
162
|
+
return inputs.color === colorName;
|
|
163
|
+
},
|
|
164
|
+
};
|
|
165
|
+
}, {
|
|
166
|
+
useRequired: true,
|
|
167
|
+
}),
|
|
168
|
+
'vira-tabs-icon-layout-vertical'({ inputs }) {
|
|
302
169
|
return !inputs.iconLayout || inputs.iconLayout === ViraTabsIconLayout.Vertical;
|
|
303
170
|
},
|
|
304
|
-
'vira-tabs-icon-layout-horizontal'
|
|
171
|
+
'vira-tabs-icon-layout-horizontal'({ inputs }) {
|
|
305
172
|
return inputs.iconLayout === ViraTabsIconLayout.Horizontal;
|
|
306
173
|
},
|
|
307
|
-
'vira-tabs-fill-width'
|
|
174
|
+
'vira-tabs-fill-width'({ inputs }) {
|
|
175
|
+
return !!inputs.shouldFillWidth;
|
|
176
|
+
},
|
|
308
177
|
},
|
|
309
178
|
cssVars: {
|
|
310
|
-
'vira-tabs-active-color':
|
|
311
|
-
|
|
312
|
-
ContrastLevelName.NonBodyText
|
|
313
|
-
].background.value,
|
|
314
|
-
'vira-tabs-active-hover-color':
|
|
315
|
-
viraThemeByKeys[viraColorVariantToHostClassKey[ViraColorVariant.Info]]['behind-bg'][
|
|
316
|
-
ContrastLevelName.Header
|
|
317
|
-
].background.value,
|
|
179
|
+
'vira-tabs-active-color': viraThemeByKeys[viraColorVariantToHostClassKey[ViraColorVariant.Info]]['behind-bg'][ContrastLevelName.NonBodyText].background.value,
|
|
180
|
+
'vira-tabs-active-hover-color': viraThemeByKeys[viraColorVariantToHostClassKey[ViraColorVariant.Info]]['behind-bg'][ContrastLevelName.Header].background.value,
|
|
318
181
|
'vira-tabs-inactive-color': viraTheme.colors[themeDefaultKey].foreground.value,
|
|
319
182
|
'vira-tabs-inactive-hover-color': viraTheme.colors[themeDefaultKey].foreground.value,
|
|
320
183
|
'vira-tabs-bar-thickness': '2px',
|
|
321
184
|
},
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
function buildThemedTabsColors(colorName: ViraThemeColorName) {
|
|
185
|
+
styles({ hostClasses, cssVars }) {
|
|
186
|
+
function buildThemedTabsColors(colorName) {
|
|
325
187
|
return {
|
|
326
188
|
active: viraThemeByKeys[colorName]['behind-bg'][ContrastLevelName.NonBodyText]
|
|
327
189
|
.background,
|
|
328
190
|
hover: viraThemeByKeys[colorName]['behind-bg'][ContrastLevelName.Header].background,
|
|
329
191
|
};
|
|
330
192
|
}
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
variantSelector: CSSResult,
|
|
334
|
-
colors: {active: {value: CSSResult}; hover: {value: CSSResult}},
|
|
335
|
-
): CSSResult {
|
|
336
|
-
return css`
|
|
193
|
+
function buildVariantCssRule(variantSelector, colors) {
|
|
194
|
+
return css `
|
|
337
195
|
${variantSelector} {
|
|
338
196
|
${cssVars['vira-tabs-active-color'].name}: ${colors.active.value};
|
|
339
197
|
${cssVars['vira-tabs-active-hover-color'].name}: ${colors.hover.value};
|
|
340
198
|
}
|
|
341
199
|
`;
|
|
342
200
|
}
|
|
343
|
-
|
|
344
|
-
function generateVariantCss(): CSSResult {
|
|
201
|
+
function generateVariantCss() {
|
|
345
202
|
const plainColors = {
|
|
346
203
|
active: viraTheme.colors['vira-grey-foreground-small-body'].foreground,
|
|
347
204
|
hover: viraTheme.colors['vira-grey-foreground-body'].foreground,
|
|
348
205
|
};
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
);
|
|
358
|
-
const plainStyle = buildVariantCssRule(
|
|
359
|
-
hostClasses['vira-tabs-color-plain'].selector,
|
|
360
|
-
plainColors,
|
|
361
|
-
);
|
|
362
|
-
const neutralStyle = buildVariantCssRule(
|
|
363
|
-
hostClasses['vira-tabs-color-neutral'].selector,
|
|
364
|
-
buildThemedTabsColors(ViraThemeColorName.grey),
|
|
365
|
-
);
|
|
206
|
+
const themedStyles = getObjectTypedKeys(viraColorVariantToHostClassKey).map((colorVariant) => {
|
|
207
|
+
const colorKey = viraColorVariantToHostClassKey[colorVariant];
|
|
208
|
+
const variantSelector = hostClasses[`vira-tabs-color-${colorKey}`].selector;
|
|
209
|
+
const colors = buildThemedTabsColors(colorKey);
|
|
210
|
+
return buildVariantCssRule(variantSelector, colors);
|
|
211
|
+
});
|
|
212
|
+
const plainStyle = buildVariantCssRule(hostClasses['vira-tabs-color-plain'].selector, plainColors);
|
|
213
|
+
const neutralStyle = buildVariantCssRule(hostClasses['vira-tabs-color-neutral'].selector, buildThemedTabsColors(ViraThemeColorName.grey));
|
|
366
214
|
const standaloneStyles = standaloneThemeColorNames.map((colorName) => {
|
|
367
215
|
const variantSelector = hostClasses[`vira-tabs-color-${colorName}`].selector;
|
|
368
216
|
const colors = buildThemedTabsColors(colorName);
|
|
369
217
|
return buildVariantCssRule(variantSelector, colors);
|
|
370
218
|
});
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
...standaloneStyles,
|
|
378
|
-
].join('\n'),
|
|
379
|
-
);
|
|
219
|
+
return unsafeCSS([
|
|
220
|
+
...themedStyles,
|
|
221
|
+
plainStyle,
|
|
222
|
+
neutralStyle,
|
|
223
|
+
...standaloneStyles,
|
|
224
|
+
].join('\n'));
|
|
380
225
|
}
|
|
381
|
-
|
|
382
|
-
return css`
|
|
226
|
+
return css `
|
|
383
227
|
:host {
|
|
384
228
|
display: flex;
|
|
385
229
|
box-sizing: border-box;
|
|
@@ -440,9 +284,9 @@ export const ViraTabs = defineViraElement<
|
|
|
440
284
|
font-weight: ${viraFontCssVars['vira-font-weight-medium'].value};
|
|
441
285
|
text-decoration: none;
|
|
442
286
|
${createFocusStyles({
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
287
|
+
renderInside: true,
|
|
288
|
+
elementBorderSize: '0',
|
|
289
|
+
})}
|
|
446
290
|
|
|
447
291
|
&::after {
|
|
448
292
|
content: '';
|
|
@@ -453,7 +297,7 @@ export const ViraTabs = defineViraElement<
|
|
|
453
297
|
&:hover {
|
|
454
298
|
color: ${cssVars['vira-tabs-inactive-hover-color'].value};
|
|
455
299
|
background-color: ${viraTheme.colors['vira-grey-on-self-small-body'].background
|
|
456
|
-
|
|
300
|
+
.value};
|
|
457
301
|
}
|
|
458
302
|
|
|
459
303
|
&.selected {
|
|
@@ -606,58 +450,55 @@ export const ViraTabs = defineViraElement<
|
|
|
606
450
|
width: 1px;
|
|
607
451
|
margin: 8px 0;
|
|
608
452
|
background-color: ${viraTheme.colors['vira-grey-foreground-decoration'].foreground
|
|
609
|
-
|
|
453
|
+
.value};
|
|
610
454
|
}
|
|
611
455
|
`;
|
|
612
456
|
},
|
|
613
|
-
cleanup({state}) {
|
|
457
|
+
cleanup({ state }) {
|
|
614
458
|
state.cleanupObserver?.();
|
|
615
459
|
},
|
|
616
|
-
render({inputs, state, updateState, host, dispatch, events}) {
|
|
617
|
-
function renderTabInner(tab
|
|
460
|
+
render({ inputs, state, updateState, host, dispatch, events }) {
|
|
461
|
+
function renderTabInner(tab, forMeasurement) {
|
|
618
462
|
const isSelected = routeHasPaths(inputs.currentRoute, tab.paths, {
|
|
619
463
|
exactMatch: tab.exactMatch,
|
|
620
464
|
});
|
|
621
|
-
|
|
622
465
|
const iconTemplate = tab.icon
|
|
623
|
-
? html`
|
|
466
|
+
? html `
|
|
624
467
|
<${ViraIcon.assign({
|
|
625
|
-
|
|
626
|
-
|
|
468
|
+
icon: tab.icon,
|
|
469
|
+
})}></${ViraIcon}>
|
|
627
470
|
`
|
|
628
471
|
: nothing;
|
|
629
|
-
|
|
630
472
|
const isInert = isSelected || !!tab.isDisabled;
|
|
631
|
-
|
|
632
473
|
return {
|
|
633
474
|
isSelected,
|
|
634
|
-
content: html`
|
|
475
|
+
content: html `
|
|
635
476
|
<${ViraLink.assign({
|
|
477
|
+
route: {
|
|
478
|
+
router: inputs.router,
|
|
636
479
|
route: {
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
480
|
+
paths: tab.paths.fullPaths,
|
|
481
|
+
},
|
|
482
|
+
scrollToTop: true,
|
|
483
|
+
},
|
|
484
|
+
disableLinkStyles: true,
|
|
485
|
+
attributePassthrough: forMeasurement
|
|
486
|
+
? undefined
|
|
487
|
+
: {
|
|
488
|
+
a: {
|
|
489
|
+
role: 'tab',
|
|
490
|
+
'aria-selected': String(isSelected),
|
|
491
|
+
'aria-disabled': String(!!tab.isDisabled),
|
|
492
|
+
tabindex: isInert ? '-1' : undefined,
|
|
640
493
|
},
|
|
641
|
-
scrollToTop: true,
|
|
642
494
|
},
|
|
643
|
-
|
|
644
|
-
attributePassthrough: forMeasurement
|
|
645
|
-
? undefined
|
|
646
|
-
: {
|
|
647
|
-
a: {
|
|
648
|
-
role: 'tab',
|
|
649
|
-
'aria-selected': String(isSelected),
|
|
650
|
-
'aria-disabled': String(!!tab.isDisabled),
|
|
651
|
-
tabindex: isInert ? '-1' : undefined,
|
|
652
|
-
},
|
|
653
|
-
},
|
|
654
|
-
})}>
|
|
495
|
+
})}>
|
|
655
496
|
<span class="tab-content">
|
|
656
497
|
${iconTemplate}
|
|
657
498
|
<${ViraBoldText.assign({
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
499
|
+
text: tab.label,
|
|
500
|
+
bold: isSelected,
|
|
501
|
+
})}
|
|
661
502
|
class="tab-label"
|
|
662
503
|
></${ViraBoldText}>
|
|
663
504
|
</span>
|
|
@@ -665,26 +506,22 @@ export const ViraTabs = defineViraElement<
|
|
|
665
506
|
`,
|
|
666
507
|
};
|
|
667
508
|
}
|
|
668
|
-
|
|
669
|
-
function handleTabClick(tab: Readonly<ViraTab>) {
|
|
509
|
+
function handleTabClick(tab) {
|
|
670
510
|
if (!tab.isDisabled) {
|
|
671
|
-
dispatch(
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
}),
|
|
675
|
-
);
|
|
511
|
+
dispatch(new events.tabSelect({
|
|
512
|
+
detail: tab,
|
|
513
|
+
}));
|
|
676
514
|
}
|
|
677
515
|
}
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
return html`
|
|
516
|
+
function renderTabItem(tab) {
|
|
517
|
+
const { isSelected, content } = renderTabInner(tab, false);
|
|
518
|
+
return html `
|
|
682
519
|
<div
|
|
683
520
|
class=${classMap({
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
521
|
+
'tab-item': true,
|
|
522
|
+
selected: isSelected,
|
|
523
|
+
disabled: !!tab.isDisabled,
|
|
524
|
+
})}
|
|
688
525
|
role="presentation"
|
|
689
526
|
${listen('click', () => handleTabClick(tab))}
|
|
690
527
|
>
|
|
@@ -692,78 +529,66 @@ export const ViraTabs = defineViraElement<
|
|
|
692
529
|
</div>
|
|
693
530
|
`;
|
|
694
531
|
}
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
return html`
|
|
532
|
+
function renderMeasureTabItem(tab) {
|
|
533
|
+
const { isSelected, content } = renderTabInner(tab, true);
|
|
534
|
+
return html `
|
|
699
535
|
<div
|
|
700
536
|
class=${classMap({
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
537
|
+
'tab-item': true,
|
|
538
|
+
'measure-selected': isSelected,
|
|
539
|
+
})}
|
|
704
540
|
>
|
|
705
541
|
${content}
|
|
706
542
|
</div>
|
|
707
543
|
`;
|
|
708
544
|
}
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
exactMatch: tab.exactMatch,
|
|
717
|
-
});
|
|
718
|
-
|
|
719
|
-
const iconTemplate = tab.icon
|
|
720
|
-
? html`
|
|
545
|
+
function buildMenuItems(tabList) {
|
|
546
|
+
return renderMenuItemEntries(filterMap(tabList, (tab) => {
|
|
547
|
+
const isSelected = routeHasPaths(inputs.currentRoute, tab.paths, {
|
|
548
|
+
exactMatch: tab.exactMatch,
|
|
549
|
+
});
|
|
550
|
+
const iconTemplate = tab.icon
|
|
551
|
+
? html `
|
|
721
552
|
<${ViraIcon.assign({
|
|
722
|
-
|
|
723
|
-
|
|
553
|
+
icon: tab.icon,
|
|
554
|
+
})}></${ViraIcon}>
|
|
724
555
|
`
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
content: html`
|
|
556
|
+
: nothing;
|
|
557
|
+
return {
|
|
558
|
+
content: html `
|
|
729
559
|
<${ViraLink.assign({
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
560
|
+
route: {
|
|
561
|
+
router: inputs.router,
|
|
562
|
+
route: {
|
|
563
|
+
paths: tab.paths.fullPaths,
|
|
564
|
+
},
|
|
565
|
+
scrollToTop: true,
|
|
566
|
+
},
|
|
567
|
+
disableLinkStyles: true,
|
|
568
|
+
stylePassthrough: {
|
|
569
|
+
a: css `
|
|
740
570
|
display: flex;
|
|
741
571
|
align-items: center;
|
|
742
572
|
gap: 8px;
|
|
743
573
|
`,
|
|
744
|
-
|
|
745
|
-
|
|
574
|
+
},
|
|
575
|
+
})}>
|
|
746
576
|
${iconTemplate} ${tab.label}
|
|
747
577
|
</${ViraLink}>
|
|
748
578
|
`,
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
},
|
|
754
|
-
};
|
|
579
|
+
selected: isSelected,
|
|
580
|
+
disabled: tab.isDisabled,
|
|
581
|
+
onClick() {
|
|
582
|
+
handleTabClick(tab);
|
|
755
583
|
},
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
);
|
|
584
|
+
};
|
|
585
|
+
}, check.isTruthy));
|
|
759
586
|
}
|
|
760
|
-
|
|
761
|
-
function measureOverflow(mirrorElement: Element) {
|
|
587
|
+
function measureOverflow(mirrorElement) {
|
|
762
588
|
const availableWidth = host.clientWidth;
|
|
763
589
|
if (!availableWidth) {
|
|
764
590
|
return;
|
|
765
591
|
}
|
|
766
|
-
|
|
767
592
|
/**
|
|
768
593
|
* Vertical (left/right) tab bars stack their tabs in a column, so horizontal
|
|
769
594
|
* width-based overflow does not apply: keep every tab inline.
|
|
@@ -779,15 +604,12 @@ export const ViraTabs = defineViraElement<
|
|
|
779
604
|
}
|
|
780
605
|
return;
|
|
781
606
|
}
|
|
782
|
-
|
|
783
607
|
const tabElements = Array.from(mirrorElement.querySelectorAll('.tab-item'));
|
|
784
608
|
const tabCount = tabElements.length;
|
|
785
609
|
if (!tabCount) {
|
|
786
610
|
return;
|
|
787
611
|
}
|
|
788
|
-
|
|
789
612
|
const tabWidths = tabElements.map((element) => element.getBoundingClientRect().width);
|
|
790
|
-
|
|
791
613
|
/**
|
|
792
614
|
* In grouped mode a partially-shown cluster still renders its group label and its
|
|
793
615
|
* leading divider, so its inline width is `max(labelWidth, shownTabsWidth)` rather than
|
|
@@ -802,26 +624,23 @@ export const ViraTabs = defineViraElement<
|
|
|
802
624
|
const clusterLabelWidth = labelElement
|
|
803
625
|
? labelElement.getBoundingClientRect().width
|
|
804
626
|
: 0;
|
|
805
|
-
return Array.from(clusterElement.querySelectorAll('.tab-item')).map(
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
},
|
|
814
|
-
);
|
|
627
|
+
return Array.from(clusterElement.querySelectorAll('.tab-item')).map((tabElement, indexInCluster) => {
|
|
628
|
+
return {
|
|
629
|
+
clusterLeft,
|
|
630
|
+
clusterLabelWidth,
|
|
631
|
+
indexInCluster,
|
|
632
|
+
width: tabElement.getBoundingClientRect().width,
|
|
633
|
+
};
|
|
634
|
+
});
|
|
815
635
|
});
|
|
816
|
-
|
|
817
636
|
/** Width of the inline area when the first `count` tabs are shown. */
|
|
818
|
-
function inlineWidthForCount(count
|
|
637
|
+
function inlineWidthForCount(count) {
|
|
819
638
|
if (count <= 0) {
|
|
820
639
|
return 0;
|
|
821
|
-
}
|
|
640
|
+
}
|
|
641
|
+
else if (!clusterElements.length) {
|
|
822
642
|
return tabWidths.slice(0, count).reduce((sum, width) => sum + width, 0);
|
|
823
643
|
}
|
|
824
|
-
|
|
825
644
|
const lastInfo = tabClusterInfo[count - 1];
|
|
826
645
|
if (!lastInfo) {
|
|
827
646
|
return 0;
|
|
@@ -829,25 +648,20 @@ export const ViraTabs = defineViraElement<
|
|
|
829
648
|
const inlineTabsInLastCluster = tabClusterInfo
|
|
830
649
|
.slice(count - 1 - lastInfo.indexInCluster, count)
|
|
831
650
|
.reduce((sum, info) => sum + info.width, 0);
|
|
832
|
-
return (
|
|
833
|
-
lastInfo.
|
|
834
|
-
Math.max(lastInfo.clusterLabelWidth, inlineTabsInLastCluster)
|
|
835
|
-
);
|
|
651
|
+
return (lastInfo.clusterLeft +
|
|
652
|
+
Math.max(lastInfo.clusterLabelWidth, inlineTabsInLastCluster));
|
|
836
653
|
}
|
|
837
|
-
|
|
838
654
|
const totalWidth = inlineWidthForCount(tabCount);
|
|
839
|
-
|
|
840
655
|
/**
|
|
841
656
|
* Largest number of leading tabs whose inline width fits within the available width
|
|
842
657
|
* minus the given reserve (the width the "more" button will occupy). Can return 0.
|
|
843
658
|
*/
|
|
844
|
-
function maxInlineForReserve(reservePx
|
|
659
|
+
function maxInlineForReserve(reservePx) {
|
|
845
660
|
const limit = availableWidth - reservePx;
|
|
846
661
|
return tabElements.reduce((fittingCount, _tabElement, index) => {
|
|
847
662
|
return inlineWidthForCount(index + 1) <= limit ? index + 1 : fittingCount;
|
|
848
663
|
}, 0);
|
|
849
664
|
}
|
|
850
|
-
|
|
851
665
|
/** When every tab fits on its own, there is no overflow and no "more" button. */
|
|
852
666
|
if (totalWidth <= availableWidth) {
|
|
853
667
|
if (state.overflowCount !== 0) {
|
|
@@ -857,20 +671,16 @@ export const ViraTabs = defineViraElement<
|
|
|
857
671
|
}
|
|
858
672
|
return;
|
|
859
673
|
}
|
|
860
|
-
|
|
861
674
|
const defaultButtonWidth = measureElementWidth(mirrorElement, '.measure-more-default');
|
|
862
675
|
const labeledButtonWidth = measureElementWidth(mirrorElement, '.measure-more-labeled');
|
|
863
|
-
|
|
864
676
|
const selectedElement = mirrorElement.querySelector('.tab-item.measure-selected');
|
|
865
677
|
const selectedIndex = selectedElement ? tabElements.indexOf(selectedElement) : -1;
|
|
866
|
-
|
|
867
678
|
/**
|
|
868
679
|
* Reserving the default ("more") trigger reveals whether the selected tab would end up
|
|
869
680
|
* collapsed.
|
|
870
681
|
*/
|
|
871
682
|
const defaultInlineCount = maxInlineForReserve(defaultButtonWidth);
|
|
872
683
|
const selectedIsCollapsed = selectedIndex >= 0 && selectedIndex >= defaultInlineCount;
|
|
873
|
-
|
|
874
684
|
/**
|
|
875
685
|
* When the selected tab is collapsed, the trigger always shows that tab's own label
|
|
876
686
|
* (with a checkmark), reserving its width even when it cannot fully fit (it is allowed
|
|
@@ -880,20 +690,16 @@ export const ViraTabs = defineViraElement<
|
|
|
880
690
|
const inlineCount = selectedIsCollapsed
|
|
881
691
|
? maxInlineForReserve(labeledButtonWidth)
|
|
882
692
|
: defaultInlineCount;
|
|
883
|
-
|
|
884
693
|
const newOverflowCount = Math.max(1, tabCount - inlineCount);
|
|
885
|
-
|
|
886
694
|
if (newOverflowCount !== state.overflowCount) {
|
|
887
695
|
updateState({
|
|
888
696
|
overflowCount: newOverflowCount,
|
|
889
697
|
});
|
|
890
698
|
}
|
|
891
699
|
}
|
|
892
|
-
|
|
893
|
-
function setUpOverflowMeasurement(mirrorElement: Element) {
|
|
700
|
+
function setUpOverflowMeasurement(mirrorElement) {
|
|
894
701
|
state.cleanupObserver?.();
|
|
895
|
-
|
|
896
|
-
let frameId: number | undefined = undefined;
|
|
702
|
+
let frameId = undefined;
|
|
897
703
|
function scheduleMeasure() {
|
|
898
704
|
if (frameId != undefined) {
|
|
899
705
|
return;
|
|
@@ -903,7 +709,6 @@ export const ViraTabs = defineViraElement<
|
|
|
903
709
|
measureOverflow(mirrorElement);
|
|
904
710
|
});
|
|
905
711
|
}
|
|
906
|
-
|
|
907
712
|
const resizeObserver = new ResizeObserver(scheduleMeasure);
|
|
908
713
|
resizeObserver.observe(host);
|
|
909
714
|
/**
|
|
@@ -918,7 +723,6 @@ export const ViraTabs = defineViraElement<
|
|
|
918
723
|
characterData: true,
|
|
919
724
|
});
|
|
920
725
|
scheduleMeasure();
|
|
921
|
-
|
|
922
726
|
updateState({
|
|
923
727
|
cleanupObserver() {
|
|
924
728
|
if (frameId != undefined) {
|
|
@@ -929,15 +733,12 @@ export const ViraTabs = defineViraElement<
|
|
|
929
733
|
},
|
|
930
734
|
});
|
|
931
735
|
}
|
|
932
|
-
|
|
933
736
|
const visibleTabs = inputs.tabs.filter((tab) => !tab.isHidden);
|
|
934
737
|
const hasGroups = visibleTabs.some((tab) => tab.group != undefined);
|
|
935
|
-
|
|
936
738
|
const overflowCount = Math.min(visibleTabs.length, Math.max(0, state.overflowCount));
|
|
937
739
|
const inlineCount = visibleTabs.length - overflowCount;
|
|
938
740
|
const inlineTabs = visibleTabs.slice(0, inlineCount);
|
|
939
741
|
const overflowTabs = visibleTabs.slice(inlineCount);
|
|
940
|
-
|
|
941
742
|
const selectedIndex = visibleTabs.findIndex((tab) => {
|
|
942
743
|
return routeHasPaths(inputs.currentRoute, tab.paths, {
|
|
943
744
|
exactMatch: tab.exactMatch,
|
|
@@ -946,59 +747,55 @@ export const ViraTabs = defineViraElement<
|
|
|
946
747
|
const selectedTab = selectedIndex >= 0 ? visibleTabs[selectedIndex] : undefined;
|
|
947
748
|
/** Whether the selected tab is currently collapsed into the overflow menu. */
|
|
948
749
|
const selectedIsCollapsed = selectedIndex >= 0 && selectedIndex >= inlineCount;
|
|
949
|
-
|
|
950
750
|
const inlineContent = hasGroups
|
|
951
751
|
? renderGroupedContent(inlineTabs, renderTabItem)
|
|
952
752
|
: inlineTabs.map(renderTabItem);
|
|
953
753
|
const measureContent = hasGroups
|
|
954
754
|
? renderGroupedContent(visibleTabs, renderMeasureTabItem)
|
|
955
755
|
: visibleTabs.map(renderMeasureTabItem);
|
|
956
|
-
|
|
957
756
|
const overflowLabel = inputs.overflowLabel || 'More';
|
|
958
|
-
|
|
959
757
|
/**
|
|
960
758
|
* Hidden copies of the "more" button in each of its possible shapes, rendered inside the
|
|
961
759
|
* measurement mirror so their true widths can be measured before choosing which one fits:
|
|
962
|
-
* the default overflow label, and the collapsed selected tab's own label
|
|
963
|
-
* checkmark).
|
|
760
|
+
* the default overflow label, and the collapsed selected tab's own label, with a caret.
|
|
964
761
|
*/
|
|
965
|
-
const measureMoreButtons = html`
|
|
762
|
+
const measureMoreButtons = html `
|
|
966
763
|
<${ViraButton.assign({
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
764
|
+
text: overflowLabel,
|
|
765
|
+
icon: ChevronDown16Icon,
|
|
766
|
+
showIconOnRight: true,
|
|
767
|
+
color: ViraColorVariant.Neutral,
|
|
768
|
+
})}
|
|
971
769
|
class="measure-more-default"
|
|
972
770
|
></${ViraButton}>
|
|
973
771
|
${selectedTab
|
|
974
|
-
|
|
772
|
+
? html `
|
|
975
773
|
<${ViraButton.assign({
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
774
|
+
text: selectedTab.label,
|
|
775
|
+
icon: ChevronDown16Icon,
|
|
776
|
+
showIconOnRight: true,
|
|
777
|
+
color: ViraColorVariant.Neutral,
|
|
778
|
+
})}
|
|
981
779
|
class="measure-more-labeled"
|
|
982
780
|
></${ViraButton}>
|
|
983
781
|
`
|
|
984
|
-
|
|
782
|
+
: nothing}
|
|
985
783
|
`;
|
|
986
|
-
|
|
987
784
|
const overflowMenuTemplate = overflowTabs.length
|
|
988
|
-
? html`
|
|
785
|
+
? html `
|
|
989
786
|
<div class="tab-more">
|
|
990
787
|
<${ViraMenuTrigger.assign({
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
788
|
+
horizontalAnchor: inputs.menuHorizontalAnchor,
|
|
789
|
+
isDisabled: inputs.menuIsDisabled,
|
|
790
|
+
popUpOffset: inputs.menuPopUpOffset,
|
|
791
|
+
menuCornerStyle: ViraMenuCornerStyle.AllRounded,
|
|
792
|
+
})}>
|
|
996
793
|
<${ViraButton.assign({
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
794
|
+
text: selectedIsCollapsed ? selectedTab?.label : overflowLabel,
|
|
795
|
+
icon: ChevronDown16Icon,
|
|
796
|
+
showIconOnRight: true,
|
|
797
|
+
color: ViraColorVariant.Neutral,
|
|
798
|
+
})}
|
|
1002
799
|
slot=${ViraMenuTrigger.slotNames['vira-menu-trigger-trigger']}
|
|
1003
800
|
></${ViraButton}>
|
|
1004
801
|
${buildMenuItems(overflowTabs)}
|
|
@@ -1006,14 +803,13 @@ export const ViraTabs = defineViraElement<
|
|
|
1006
803
|
</div>
|
|
1007
804
|
`
|
|
1008
805
|
: nothing;
|
|
1009
|
-
|
|
1010
|
-
return html`
|
|
806
|
+
return html `
|
|
1011
807
|
<div
|
|
1012
808
|
class=${classMap({
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
809
|
+
'tabs-container': true,
|
|
810
|
+
'tabs-measure': true,
|
|
811
|
+
grouped: hasGroups,
|
|
812
|
+
})}
|
|
1017
813
|
aria-hidden="true"
|
|
1018
814
|
${onDomCreated(setUpOverflowMeasurement)}
|
|
1019
815
|
>
|
|
@@ -1021,9 +817,9 @@ export const ViraTabs = defineViraElement<
|
|
|
1021
817
|
</div>
|
|
1022
818
|
<div
|
|
1023
819
|
class=${classMap({
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
820
|
+
'tabs-container': true,
|
|
821
|
+
grouped: hasGroups,
|
|
822
|
+
})}
|
|
1027
823
|
role="tablist"
|
|
1028
824
|
>
|
|
1029
825
|
${inlineContent} ${overflowMenuTemplate}
|