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