@aceshooting/lyra-ui 32.0.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/CHANGELOG.md +203 -0
- package/README.md +24 -6
- package/design-tokens.json +1 -1
- package/dist/all.d.ts +1 -1
- package/dist/all.js +1 -1
- package/dist/autoloader.d.ts +10 -0
- package/dist/autoloader.js +1 -1
- package/dist/cli/migrate-wa.mjs +45 -37
- package/dist/cli/migration-contract.json.gz +0 -0
- package/dist/components/agent-tools/budget-meter/budget-meter.class.d.ts +1 -0
- package/dist/components/agent-tools/budget-meter/budget-meter.styles.js +1 -1
- package/dist/components/charts/chart/box-plot.class.d.ts +3 -0
- package/dist/components/charts/chart/chart-band.js +1 -1
- package/dist/components/charts/chart/chart-input-projection.js +1 -1
- package/dist/components/charts/chart/chart-surface.styles.js +1 -1
- package/dist/components/charts/chart/chart-types.d.ts +16 -2
- package/dist/components/charts/chart/chart.class.d.ts +4 -1
- package/dist/components/charts/chart/chart.class.js +3 -3
- package/dist/components/charts/chart/lite-chart.class.d.ts +3 -0
- package/dist/components/charts/chart/lite-chart.styles.js +1 -1
- package/dist/components/conversation/code-block/code-block-base.class.d.ts +29 -3
- package/dist/components/conversation/code-block/code-block-base.class.js +1 -1
- package/dist/components/conversation/code-block/code-block-core.class.d.ts +46 -2
- package/dist/components/conversation/code-block/code-block-core.class.js +1 -1
- package/dist/components/conversation/code-block/code-block-shared.d.ts +6 -2
- package/dist/components/conversation/code-block/code-block-shared.js +5 -4
- package/dist/components/conversation/code-block/code-block.class.d.ts +45 -1
- package/dist/components/conversation/code-block/code-block.class.js +1 -1
- package/dist/components/conversation/code-block/code-block.styles.js +1 -1
- package/dist/components/conversation/markdown/markdown-core.class.d.ts +12 -0
- package/dist/components/conversation/markdown/markdown.class.d.ts +12 -0
- package/dist/components/conversation/markdown/markdown.styles.js +1 -1
- package/dist/components/conversation/model-select/model-select.class.d.ts +6 -0
- package/dist/components/conversation/suggestion-chips/suggestion-chips.class.d.ts +1 -0
- package/dist/components/conversation/suggestion-chips/suggestion-chips.styles.js +1 -1
- package/dist/components/conversation/thread-list/thread-list.class.d.ts +3 -0
- package/dist/components/conversation/thread-list/thread-list.styles.js +1 -1
- package/dist/components/conversation/voice-picker/voice-picker.class.d.ts +6 -0
- package/dist/components/data/graph-query-builder/graph-query-builder.class.d.ts +4 -0
- package/dist/components/data/heatmap/heatmap.class.d.ts +21 -2
- package/dist/components/data/heatmap/heatmap.class.js +2 -2
- package/dist/components/data/heatmap/heatmap.styles.js +1 -1
- package/dist/components/data/stat/stat.class.d.ts +24 -1
- package/dist/components/data/stat/stat.class.js +2 -2
- package/dist/components/data/stat/stat.styles.js +1 -1
- package/dist/components/data/table/table-row-attributes.js +1 -0
- package/dist/components/data/table/table-support.d.ts +65 -5
- package/dist/components/data/table/table-support.js +1 -1
- package/dist/components/data/table/table.class.d.ts +77 -7
- package/dist/components/data/table/table.class.js +10 -10
- package/dist/components/data/table/table.styles.js +1 -1
- package/dist/components/data/timeline/timeline-item.class.d.ts +27 -5
- package/dist/components/data/timeline/timeline-item.class.js +11 -7
- package/dist/components/data/timeline/timeline-item.styles.js +1 -1
- package/dist/components/data/timeline/timeline.class.d.ts +40 -5
- package/dist/components/data/timeline/timeline.class.js +11 -7
- package/dist/components/data/timeline/timeline.styles.js +1 -1
- package/dist/components/data/tree/tree-item.class.d.ts +2 -0
- package/dist/components/data/tree/tree-item.class.js +2 -2
- package/dist/components/data/tree/tree-item.styles.js +1 -1
- package/dist/components/forms/button/button.class.d.ts +13 -0
- package/dist/components/forms/button/button.styles.js +1 -1
- package/dist/components/forms/checkbox-group/checkbox-group.class.d.ts +29 -2
- package/dist/components/forms/checkbox-group/checkbox-group.class.js +3 -3
- package/dist/components/forms/checkbox-group/checkbox-group.styles.js +1 -1
- package/dist/components/forms/code-editor/code-editor.class.d.ts +6 -0
- package/dist/components/forms/color-picker/color-picker.class.d.ts +9 -0
- package/dist/components/forms/color-picker/color-picker.class.js +3 -3
- package/dist/components/forms/color-picker/color-picker.styles.js +1 -1
- package/dist/components/forms/combobox/combobox.class.d.ts +114 -7
- package/dist/components/forms/combobox/combobox.class.js +9 -7
- package/dist/components/forms/combobox/combobox.styles.js +1 -1
- package/dist/components/forms/country-picker/country-picker.class.d.ts +2 -0
- package/dist/components/forms/currency-picker/currency-picker.class.d.ts +2 -0
- package/dist/components/forms/date-picker/date-input.class.d.ts +41 -0
- package/dist/components/forms/date-picker/date-input.class.js +2 -2
- package/dist/components/forms/date-picker/date-input.styles.js +1 -1
- package/dist/components/forms/emoji-picker/emoji-picker.class.d.ts +4 -0
- package/dist/components/forms/icon-button/icon-button.styles.js +1 -1
- package/dist/components/forms/input/input-shared.d.ts +12 -0
- package/dist/components/forms/input/input.styles.js +1 -1
- package/dist/components/forms/input/time-input.class.d.ts +6 -0
- package/dist/components/forms/input/time-input.styles.js +1 -1
- package/dist/components/forms/locale-picker/locale-picker.class.d.ts +11 -0
- package/dist/components/forms/locale-picker/locale-picker.styles.js +1 -1
- package/dist/components/forms/otp-input/otp-input.class.d.ts +6 -0
- package/dist/components/forms/phone-input/phone-input.class.d.ts +6 -0
- package/dist/components/forms/phone-input/phone-input.styles.js +1 -1
- package/dist/components/forms/radio/radio-group.class.d.ts +24 -2
- package/dist/components/forms/radio/radio-group.class.js +2 -2
- package/dist/components/forms/radio/radio-group.styles.js +1 -1
- package/dist/components/forms/rubric-form/rubric-form.class.d.ts +4 -0
- package/dist/components/forms/select/select.class.d.ts +13 -0
- package/dist/components/forms/select/select.class.js +1 -1
- package/dist/components/forms/select/select.styles.js +1 -1
- package/dist/components/forms/signature-pad/signature-pad.class.d.ts +6 -0
- package/dist/components/forms/signature-pad/signature-pad.styles.js +1 -1
- package/dist/components/forms/slider/slider.class.d.ts +28 -2
- package/dist/components/forms/slider/slider.class.js +3 -3
- package/dist/components/forms/slider/slider.styles.js +1 -1
- package/dist/components/forms/switch/switch.class.d.ts +2 -0
- package/dist/components/forms/switch/switch.styles.js +1 -1
- package/dist/components/forms/textarea/textarea.class.d.ts +8 -0
- package/dist/components/forms/textarea/textarea.styles.js +1 -1
- package/dist/components/forms/time-zone-picker/time-zone-picker.class.d.ts +2 -0
- package/dist/components/forms/token-input/token-input.class.d.ts +96 -18
- package/dist/components/forms/token-input/token-input.class.js +11 -8
- package/dist/components/forms/token-input/token-input.styles.js +1 -1
- package/dist/components/forms/unit-picker/unit-picker.class.d.ts +2 -0
- package/dist/components/layout/app-rail/app-rail.class.d.ts +3 -0
- package/dist/components/layout/app-rail/app-rail.styles.js +1 -1
- package/dist/components/layout/button-group/button-group.class.d.ts +4 -0
- package/dist/components/layout/button-group/button-group.class.js +1 -1
- package/dist/components/layout/card/card.class.d.ts +15 -1
- package/dist/components/layout/card/card.styles.js +1 -1
- package/dist/components/layout/details/details.class.d.ts +6 -0
- package/dist/components/layout/details/details.styles.js +1 -1
- package/dist/components/layout/filter-bar/filter-bar.class.d.ts +6 -0
- package/dist/components/layout/filter-bar/filter-bar.styles.js +1 -1
- package/dist/components/layout/index.d.ts +1 -1
- package/dist/components/layout/index.js +1 -1
- package/dist/components/layout/menu/dropdown-item.class.d.ts +8 -2
- package/dist/components/layout/menu/dropdown-item.class.js +1 -1
- package/dist/components/layout/menu/menu-item.class.d.ts +7 -0
- package/dist/components/layout/menu/menu-item.styles.js +1 -1
- package/dist/components/layout/menu/menu-label.class.d.ts +5 -0
- package/dist/components/layout/menu/menu-label.class.js +1 -1
- package/dist/components/layout/menu/menu.class.d.ts +3 -0
- package/dist/components/layout/menu/menu.styles.js +1 -1
- package/dist/components/layout/page/page.class.d.ts +9 -1
- package/dist/components/layout/page/page.class.js +2 -2
- package/dist/components/layout/segmented/segmented.class.d.ts +22 -3
- package/dist/components/layout/segmented/segmented.class.js +3 -4
- package/dist/components/layout/segmented/segmented.styles.js +1 -1
- package/dist/components/layout/stepper/step.class.d.ts +89 -0
- package/dist/components/layout/stepper/step.class.js +18 -0
- package/dist/components/layout/stepper/step.styles.js +1 -0
- package/dist/components/layout/stepper/stepper.class.d.ts +106 -13
- package/dist/components/layout/stepper/stepper.class.js +6 -2
- package/dist/components/layout/stepper/stepper.styles.js +1 -1
- package/dist/components/layout/tab-group/tab-group.class.d.ts +10 -1
- package/dist/components/layout/tab-group/tab-group.class.js +1 -1
- package/dist/components/layout/tab-group/tab-group.styles.js +1 -1
- package/dist/components/layout/tab-group/tab-panel.class.d.ts +1 -0
- package/dist/components/layout/tab-group/tab-panel.class.js +1 -1
- package/dist/components/layout/tab-group/tab.class.d.ts +4 -0
- package/dist/components/layout/widget/widget.class.d.ts +1 -0
- package/dist/components/layout/widget/widget.styles.js +1 -1
- package/dist/components/lr-code-block-core.d.ts +1 -1
- package/dist/components/lr-code-block.d.ts +1 -1
- package/dist/components/lr-counter.d.ts +1 -0
- package/dist/components/lr-counter.js +1 -0
- package/dist/components/lr-lightbox-item.d.ts +1 -0
- package/dist/components/lr-lightbox-item.js +1 -0
- package/dist/components/lr-lightbox.d.ts +1 -1
- package/dist/components/lr-lightbox.js +1 -1
- package/dist/components/lr-number-ticker.d.ts +1 -0
- package/dist/components/lr-number-ticker.js +1 -0
- package/dist/components/lr-step.d.ts +1 -0
- package/dist/components/lr-step.js +1 -0
- package/dist/components/media/file-input/file-input.class.d.ts +7 -1
- package/dist/components/media/file-input/file-input.class.js +2 -2
- package/dist/components/media/file-input/file-input.styles.js +1 -1
- package/dist/components/media/index.d.ts +1 -1
- package/dist/components/media/index.js +1 -1
- package/dist/components/media/lightbox/lightbox-item.class.d.ts +57 -0
- package/dist/components/media/lightbox/lightbox-item.class.js +9 -0
- package/dist/components/media/lightbox/lightbox-item.styles.js +1 -0
- package/dist/components/media/lightbox/lightbox.class.d.ts +90 -20
- package/dist/components/media/lightbox/lightbox.class.js +17 -12
- package/dist/components/media/lightbox/lightbox.styles.js +1 -1
- package/dist/components/media/map/map-anchor-avoid.js +1 -1
- package/dist/components/media/map/map-drawing-controller.js +1 -1
- package/dist/components/media/map/map.class.d.ts +137 -7
- package/dist/components/media/map/map.class.js +6 -6
- package/dist/components/media/map/map.styles.js +1 -1
- package/dist/components/media/sequence-playback/sequence-playback.class.d.ts +9 -0
- package/dist/components/media/sequence-playback/sequence-playback.class.js +2 -2
- package/dist/components/media/sequence-playback/sequence-playback.styles.js +1 -1
- package/dist/components/media/video/video.class.d.ts +4 -0
- package/dist/components/media/video/video.class.js +2 -2
- package/dist/components/media/video/video.styles.js +1 -1
- package/dist/components/media/zoomable-frame/zoomable-frame.class.d.ts +15 -0
- package/dist/components/media/zoomable-frame/zoomable-frame.class.js +2 -2
- package/dist/components/overlays/badge/badge.class.d.ts +2 -0
- package/dist/components/overlays/badge/badge.styles.js +1 -1
- package/dist/components/overlays/badge/tag.class.d.ts +2 -0
- package/dist/components/overlays/badge/tag.class.js +1 -1
- package/dist/components/overlays/chip/chip-group.class.d.ts +31 -4
- package/dist/components/overlays/chip/chip-group.class.js +3 -3
- package/dist/components/overlays/context-menu/context-menu.class.d.ts +5 -0
- package/dist/components/overlays/context-menu/context-menu.class.js +1 -1
- package/dist/components/overlays/dialog/dialog.class.d.ts +36 -4
- package/dist/components/overlays/dialog/dialog.class.js +3 -3
- package/dist/components/overlays/dialog/dialog.styles.js +1 -1
- package/dist/components/overlays/dialog/prompt.d.ts +60 -0
- package/dist/components/overlays/dialog/prompt.js +1 -0
- package/dist/components/overlays/drawer/drawer.class.d.ts +16 -1
- package/dist/components/overlays/drawer/drawer.class.js +1 -1
- package/dist/components/overlays/empty/empty.class.d.ts +1 -0
- package/dist/components/overlays/empty/empty.class.js +1 -1
- package/dist/components/overlays/overlay/dropdown.class.d.ts +4 -0
- package/dist/components/overlays/overlay/dropdown.class.js +1 -1
- package/dist/components/overlays/overlay/overlay.styles.js +1 -1
- package/dist/components/overlays/overlay/popover.class.d.ts +29 -3
- package/dist/components/overlays/overlay/popover.class.js +2 -2
- package/dist/components/overlays/overlay/tooltip.class.d.ts +2 -0
- package/dist/components/overlays/overlay/tooltip.class.js +2 -2
- package/dist/components/overlays/toast/toast-item.class.d.ts +1 -0
- package/dist/components/overlays/toast/toast-item.class.js +1 -1
- package/dist/components/overlays/toast/toast-item.styles.js +1 -1
- package/dist/components/overlays/toast/toast.class.d.ts +6 -0
- package/dist/components/overlays/toast/toast.class.js +1 -1
- package/dist/components/utility/copy-button/copy-button.class.d.ts +2 -0
- package/dist/components/utility/copy-button/copy-button.class.js +2 -2
- package/dist/components/utility/counter/counter-time.d.ts +15 -0
- package/dist/components/utility/counter/counter-time.js +1 -0
- package/dist/components/utility/counter/counter.class.d.ts +67 -0
- package/dist/components/utility/counter/counter.class.js +1 -0
- package/dist/components/utility/counter/counter.styles.js +1 -0
- package/dist/components/utility/divider/divider.class.d.ts +21 -3
- package/dist/components/utility/divider/divider.class.js +5 -1
- package/dist/components/utility/export-button/export-button.class.d.ts +5 -0
- package/dist/components/utility/export-button/export-button.styles.js +1 -1
- package/dist/components/utility/icon/icon-library.d.ts +14 -1
- package/dist/components/utility/icon/icon-library.js +1 -1
- package/dist/components/utility/icon/icon-sprite.js +1 -0
- package/dist/components/utility/icon/icon.class.d.ts +4 -2
- package/dist/components/utility/icon/icon.class.js +2 -2
- package/dist/components/utility/index.d.ts +1 -1
- package/dist/components/utility/index.js +1 -1
- package/dist/components/utility/known-date/known-date.class.d.ts +4 -0
- package/dist/components/utility/number-ticker/number-ticker.class.d.ts +58 -0
- package/dist/components/utility/number-ticker/number-ticker.class.js +1 -0
- package/dist/components/utility/number-ticker/number-ticker.styles.js +1 -0
- package/dist/components/viewers/include/include.class.d.ts +4 -1
- package/dist/components/viewers/include/include.class.js +1 -1
- package/dist/components/viewers/pdf-viewer/pdf-viewer.class.d.ts +10 -1
- package/dist/components/viewers/pdf-viewer/pdf-viewer.class.js +2 -2
- package/dist/components/viewers/pdf-viewer/pdf-viewer.styles.js +1 -1
- package/dist/custom-elements-jsx.d.ts +1 -1
- package/dist/event-classes.d.ts +2342 -0
- package/dist/event-classes.js +1 -0
- package/dist/events.d.ts +48 -22
- package/dist/framework-types.d.ts +2 -2
- package/dist/internal/all-defined-arguments.d.ts +19 -0
- package/dist/internal/all-defined-arguments.js +1 -0
- package/dist/internal/autoloader-tags.d.ts +1 -1
- package/dist/internal/autoloader-tags.js +1 -1
- package/dist/internal/checked-control-label.js +1 -1
- package/dist/internal/component-loaders.generated.js +1 -1
- package/dist/internal/dedent.js +7 -0
- package/dist/internal/default-strings/forms.generated.js +1 -1
- package/dist/internal/default-strings/layout.generated.js +1 -1
- package/dist/internal/dev-mode-attribute-warning.development.js +1 -1
- package/dist/internal/document-tokens.generated.js +3 -3
- package/dist/internal/form-control/chrome.styles.js +1 -1
- package/dist/internal/form-control.styles.js +1 -1
- package/dist/internal/interactive-control.styles.js +2 -2
- package/dist/internal/labeled-group.js +1 -1
- package/dist/internal/localization-runtime.d.ts +5 -0
- package/dist/internal/localization-runtime.js +1 -1
- package/dist/internal/localization-types.d.ts +1 -1
- package/dist/internal/localization.js +2 -2
- package/dist/internal/lyra-element.js +2 -2
- package/dist/internal/lyra-event.d.ts +22 -0
- package/dist/internal/lyra-event.js +1 -0
- package/dist/internal/overlay-shared.d.ts +5 -2
- package/dist/internal/overlay-shared.js +1 -1
- package/dist/internal/package-metadata.js +1 -1
- package/dist/internal/root-registration-allowlist.js +1 -1
- package/dist/internal/scoped-definitions.generated.js +1 -1
- package/dist/internal/shiki/core.d.ts +4 -1
- package/dist/internal/shiki/tokenize.js +1 -1
- package/dist/internal/srcset.js +1 -0
- package/dist/lyra.d.ts +1 -1
- package/dist/lyra.js +1 -1
- package/dist/ssr/all.d.ts +1 -1
- package/dist/ssr/all.js +1 -1
- package/dist/ssr.d.ts +5 -5
- package/dist/ssr.js +1 -1
- package/dist/styles/native.css +1 -1
- package/dist/styles/palette.css +1 -0
- package/dist/styles/tokens-root.css +1 -1
- package/dist/styles/utilities.css +1 -1
- package/dist/svelte.d.ts +1 -1
- package/dist/testing/happy-dom-shims.d.ts +11 -2
- package/dist/testing/happy-dom-shims.js +1 -1
- package/dist/testing/index.d.ts +1 -1
- package/dist/testing/index.js +1 -1
- package/dist/testing/lyra-tag-event-map.d.ts +2 -2
- package/dist/testing/lyra-tag-event-map.js +1 -1
- package/dist/theme-core.css +1 -1
- package/dist/theme.css +1 -1
- package/dist/utilities/defined.d.ts +10 -1
- package/dist/utilities/defined.js +1 -1
- package/dist/utilities/form.d.ts +9 -0
- package/dist/utilities/form.js +1 -0
- package/dist/utilities/index.d.ts +1 -1
- package/dist/utilities/index.js +1 -1
- package/dist/vue.d.ts +1 -1
- package/llms/components/lr-app-rail.md +4 -2
- package/llms/components/lr-badge.md +4 -4
- package/llms/components/lr-bar-chart.md +1 -1
- package/llms/components/lr-box-plot.md +6 -1
- package/llms/components/lr-bubble-chart.md +1 -1
- package/llms/components/lr-budget-meter.md +2 -2
- package/llms/components/lr-button-group.md +7 -3
- package/llms/components/lr-button.md +11 -1
- package/llms/components/lr-card.md +11 -1
- package/llms/components/lr-chart.md +21 -7
- package/llms/components/lr-checkbox-group.md +11 -1
- package/llms/components/lr-chip.md +11 -1
- package/llms/components/lr-code-block-core.md +36 -8
- package/llms/components/lr-code-block.md +45 -6
- package/llms/components/lr-code-editor.md +11 -1
- package/llms/components/lr-color-picker.md +17 -4
- package/llms/components/lr-combobox.md +62 -6
- package/llms/components/lr-context-menu.md +5 -3
- package/llms/components/lr-copy-button.md +2 -1
- package/llms/components/lr-counter.md +60 -0
- package/llms/components/lr-country-picker.md +5 -1
- package/llms/components/lr-currency-picker.md +5 -1
- package/llms/components/lr-date-input.md +1 -1
- package/llms/components/lr-date-picker.md +25 -1
- package/llms/components/lr-details.md +6 -2
- package/llms/components/lr-dialog.md +72 -8
- package/llms/components/lr-divider.md +14 -5
- package/llms/components/lr-doughnut-chart.md +1 -1
- package/llms/components/lr-drawer.md +26 -7
- package/llms/components/lr-dropdown-item.md +1 -1
- package/llms/components/lr-dropdown.md +8 -4
- package/llms/components/lr-emoji-picker.md +10 -1
- package/llms/components/lr-empty.md +3 -2
- package/llms/components/lr-export-button.md +5 -2
- package/llms/components/lr-file-input.md +13 -1
- package/llms/components/lr-filter-bar.md +6 -2
- package/llms/components/lr-graph-query-builder.md +10 -1
- package/llms/components/lr-heatmap.md +20 -3
- package/llms/components/lr-histogram.md +7 -2
- package/llms/components/lr-icon-button.md +3 -1
- package/llms/components/lr-icon.md +8 -0
- package/llms/components/lr-include.md +3 -0
- package/llms/components/lr-input.md +9 -1
- package/llms/components/lr-known-date.md +10 -1
- package/llms/components/lr-lightbox-item.md +14 -0
- package/llms/components/lr-lightbox.md +84 -5
- package/llms/components/lr-line-chart.md +7 -2
- package/llms/components/lr-lite-chart.md +3 -2
- package/llms/components/lr-locale-picker.md +17 -1
- package/llms/components/lr-map.md +122 -11
- package/llms/components/lr-markdown-core.md +15 -4
- package/llms/components/lr-markdown.md +13 -4
- package/llms/components/lr-menu-item.md +1 -1
- package/llms/components/lr-menu-label.md +5 -2
- package/llms/components/lr-menu.md +21 -6
- package/llms/components/lr-model-select.md +11 -1
- package/llms/components/lr-native-time-input.md +11 -1
- package/llms/components/lr-number-input.md +11 -1
- package/llms/components/lr-number-ticker.md +55 -0
- package/llms/components/lr-otp-input.md +11 -1
- package/llms/components/lr-page.md +7 -1
- package/llms/components/lr-pagination.md +18 -0
- package/llms/components/lr-pdf-viewer.md +6 -1
- package/llms/components/lr-phone-input.md +11 -1
- package/llms/components/lr-pie-chart.md +1 -1
- package/llms/components/lr-polar-area-chart.md +1 -1
- package/llms/components/lr-popover.md +25 -5
- package/llms/components/lr-radar-chart.md +1 -1
- package/llms/components/lr-radio-group.md +11 -1
- package/llms/components/lr-rubric-form.md +7 -1
- package/llms/components/lr-scatter-chart.md +1 -1
- package/llms/components/lr-segmented.md +20 -2
- package/llms/components/lr-select.md +10 -2
- package/llms/components/lr-sequence-playback.md +8 -2
- package/llms/components/lr-signature-pad.md +8 -1
- package/llms/components/lr-slider.md +17 -4
- package/llms/components/lr-stat.md +20 -5
- package/llms/components/lr-step.md +61 -0
- package/llms/components/lr-stepper.md +64 -8
- package/llms/components/lr-suggestion-chips.md +3 -2
- package/llms/components/lr-switch.md +4 -3
- package/llms/components/lr-tab-group.md +10 -3
- package/llms/components/lr-tab-panel.md +2 -2
- package/llms/components/lr-table.md +87 -8
- package/llms/components/lr-tag.md +1 -1
- package/llms/components/lr-textarea.md +17 -1
- package/llms/components/lr-thread-list.md +4 -2
- package/llms/components/lr-time-input.md +8 -1
- package/llms/components/lr-time-zone-picker.md +5 -1
- package/llms/components/lr-timeline-item.md +1 -1
- package/llms/components/lr-timeline.md +38 -1
- package/llms/components/lr-toast-item.md +1 -1
- package/llms/components/lr-toast.md +7 -2
- package/llms/components/lr-token-input.md +64 -8
- package/llms/components/lr-tooltip.md +3 -3
- package/llms/components/lr-tree-item.md +1 -1
- package/llms/components/lr-tree.md +2 -1
- package/llms/components/lr-unit-picker.md +5 -1
- package/llms/components/lr-video.md +5 -4
- package/llms/components/lr-voice-picker.md +8 -1
- package/llms/components/lr-widget.md +2 -2
- package/llms/components/lr-zoomable-frame.md +8 -0
- package/llms/index.md +145 -141
- package/llms/migration.md +20 -12
- package/llms/peers.md +2 -2
- package/llms/shared/events-and-types.md +36 -0
- package/llms/shared/imports-and-registration.md +60 -1
- package/llms/shared/native-styles-and-utilities.md +109 -3
- package/llms/shared/styles-and-tokens.md +2 -2
- package/llms/shared/testing-and-utilities.md +21 -0
- package/llms/shared.md +227 -6
- package/llms/tokens.md +6 -1
- package/llms.txt +3 -3
- package/locales.json +1 -1
- package/package.json +38 -9
- package/registrations.json +1 -1
- package/skills/compose-lyra-interfaces/SKILL.md +1 -1
- package/skills/lyra-ui/SKILL.md +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{type PropertyValues,type TemplateResult}from'lit';import{LyraElement}from'../../../internal/lyra-element.js';import{type BreakpointBasis}from'../../../internal/orientation-breakpoint.js';import type{LyraOrientation}from'../../../internal/shared-unions.js';export type LyraStepState='pending'|'current'|'completed'|'error';export interface LyraStepperOrientationChangeDetail{orientation:LyraOrientation;}export interface LyraStepItem{
|
|
1
|
+
import type{LyraStep}from'./step.class.js';import{type PropertyValues,type TemplateResult}from'lit';import{LyraElement}from'../../../internal/lyra-element.js';import{type BreakpointBasis}from'../../../internal/orientation-breakpoint.js';import type{LyraOrientation}from'../../../internal/shared-unions.js';export type LyraStepState='pending'|'current'|'completed'|'error';export interface LyraStepperOrientationChangeDetail{orientation:LyraOrientation;}export interface LyraStepItem{
|
|
2
2
|
/** Stable business identity for this step. Duplicate IDs are valid occurrences and are
|
|
3
3
|
* disambiguated by their zero-based collection index. */
|
|
4
4
|
stepId:string;
|
|
@@ -18,13 +18,44 @@ title?:string;
|
|
|
18
18
|
* additionally to, never instead of, the state-driven index chip/checkmark -- the icon
|
|
19
19
|
* identifies the step's topic, the chip/checkmark identifies its state. It is inert and hidden
|
|
20
20
|
* from assistive technology, so it never supplies a second action or accessible name. */
|
|
21
|
-
icon?:unknown;}
|
|
21
|
+
icon?:unknown;}
|
|
22
|
+
/** Layout axis of a stepper. `auto` lays the steps in a row and stacks them when the stepper is too
|
|
23
|
+
* narrow to give each step room. */
|
|
24
|
+
export type LyraStepperOrientation=LyraOrientation|'auto';
|
|
25
|
+
/** Payload of `lr-before-step-change` and `lr-step-change` in child-driven mode.*/
|
|
26
|
+
export interface LyraStepChangeDetail{
|
|
27
|
+
/** `name` of the step becoming current.*/
|
|
28
|
+
name:string;
|
|
29
|
+
/** `name` of the step that was current, or `null` when none was.*/
|
|
30
|
+
previousName:string|null;
|
|
31
|
+
/** The step becoming current.*/
|
|
32
|
+
step:LyraStep;
|
|
33
|
+
/** The step that was current, or `null` when none was.*/
|
|
34
|
+
previousStep:LyraStep|null;}export interface LyraStepperEventMap{'lr-step-select':CustomEvent<{stepId:string;index:number;}>;'lr-before-step-change':CustomEvent<LyraStepChangeDetail>;'lr-step-change':CustomEvent<LyraStepChangeDetail>;'lr-stepper-orientation-change':CustomEvent<LyraStepperOrientationChangeDetail>;}
|
|
22
35
|
/**
|
|
23
36
|
* `<lr-stepper>` — ordered multi-step wizard/form navigation: label + index per step,
|
|
24
|
-
* current/completed/locked/error state, click-to-jump.
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
37
|
+
* current/completed/locked/error state, click-to-jump. Mirrors `wa-stepper`, whose `wa-step`
|
|
38
|
+
* children are `<lr-step>`; the stepper has two authoring modes.
|
|
39
|
+
*
|
|
40
|
+
* Data-driven mode (the original contract): fully controlled, like `lr-table`'s `columns`/`rows` --
|
|
41
|
+
* it never mutates `steps` itself; a click or Enter/Space on a non-disabled step fires a
|
|
42
|
+
* non-cancelable `lr-step-select`, and the host decides whether/how `steps` changes in response.
|
|
43
|
+
*
|
|
44
|
+
* Child mode: with an empty `steps` array and `<lr-step>` children, the stepper owns the current
|
|
45
|
+
* step. `active` names it (the first step when unset or unmatched), `goTo(name)`, `next()` and
|
|
46
|
+
* `previous()` move it, and each move first emits a cancelable `lr-before-step-change` (a
|
|
47
|
+
* `preventDefault()` veto keeps the current step) and then `lr-step-change`, and announces the new
|
|
48
|
+
* position politely. `linear` stops a step being reached until every step before it is
|
|
49
|
+
* `completed`; later steps render locked. `clickable` makes each step a button (one roving tab stop,
|
|
50
|
+
* Left/Right swapped under RTL, Up/Down while stacked, Home/End) so a click or Enter/Space jumps to
|
|
51
|
+
* it; unset, only the methods and invokers move the step, and the stepper is a labelled group
|
|
52
|
+
* instead of a navigation landmark. Any element on the page, inside the stepper or not, with
|
|
53
|
+
* `data-stepper="next <id>"`, `"previous <id>"` or `"goto <id> <step-name>"` drives the stepper
|
|
54
|
+
* whose `id` it names when clicked. `label` names the group. The array mode is unchanged and wins
|
|
55
|
+
* while `steps` is non-empty.
|
|
56
|
+
*
|
|
57
|
+
* `orientation="auto"` lays the steps in a row and stacks them whenever the stepper's own measured
|
|
58
|
+
* width cannot give every step about 6em, so a phone-width container stacks without any breakpoint.
|
|
28
59
|
*
|
|
29
60
|
* An opt-in `orientationBreakpoint` (unset by default -- no behavior change) makes the effective
|
|
30
61
|
* layout/navigation axis respond to a measured inline size instead of only the authored
|
|
@@ -56,7 +87,16 @@ icon?:unknown;}export interface LyraStepperEventMap{'lr-step-select':CustomEvent
|
|
|
56
87
|
* `lr-table`'s `columns`/`rows` contract) and takes no default action of its own on selection
|
|
57
88
|
* (it never mutates `steps`), so there is no real veto point for `preventDefault()` to gate.
|
|
58
89
|
* @event lr-stepper-orientation-change - `detail: { orientation }`, fired when an enabled
|
|
59
|
-
* `orientationBreakpoint` changes the effective layout/navigation axis.
|
|
90
|
+
* `orientationBreakpoint`, or `orientation="auto"`, changes the effective layout/navigation axis.
|
|
91
|
+
* @event lr-before-step-change - Child mode. Cancelable; `detail: { name, previousName, step,
|
|
92
|
+
* previousStep }`, fired before `active` changes. `preventDefault()` keeps the current step.
|
|
93
|
+
* @event lr-step-change - Child mode. `detail` as `lr-before-step-change`; fired after `active`
|
|
94
|
+
* changed and the steps re-rendered.
|
|
95
|
+
* @slot - Child mode: one or more `<lr-step>` elements.
|
|
96
|
+
* @csspart stepper - Child mode: the outer wrapper, a `<nav>` landmark while `clickable`, otherwise
|
|
97
|
+
* a labelled `role="group"`.
|
|
98
|
+
* @csspart summary - Child mode: visually hidden "Step X of Y" text for assistive technology.
|
|
99
|
+
* @csspart steps - The list element that lays out the steps; the same node as `base`.
|
|
60
100
|
* @csspart base - The root wrapper, and the horizontally scrolling track. Takes `tabindex="0"`
|
|
61
101
|
* only while `readonly` and genuinely overflowing, so an otherwise keyboard-unreachable
|
|
62
102
|
* read-only strip can still be scrolled; style that state with `::part(base):focus-visible`.
|
|
@@ -69,6 +109,33 @@ icon?:unknown;}export interface LyraStepperEventMap{'lr-step-select':CustomEvent
|
|
|
69
109
|
* @csspart step-index - The numbered index chip, shown for `pending`/`current`/`error` steps.
|
|
70
110
|
* @csspart step-check - The completed-checkmark glyph, shown for `completed` steps instead of `step-index`.
|
|
71
111
|
* @csspart step-label - The step's label text.
|
|
112
|
+
* @cssprop [--lr-stepper-marker-size=var(--lr-size-2rem)] - Child mode: diameter of each step's marker.
|
|
113
|
+
* @cssprop [--lr-stepper-connector-color=var(--lr-color-neutral-fill-normal)] - Child mode: color of the
|
|
114
|
+
* line after a step that is not completed.
|
|
115
|
+
* @cssprop [--lr-stepper-connector-active-color] - Child mode: color of the line after a completed
|
|
116
|
+
* step; unset, it follows that step's variant.
|
|
117
|
+
* @cssprop [--lr-stepper-connector-width=var(--lr-border-width-medium)] - Child mode: line thickness.
|
|
118
|
+
* @cssprop [--lr-stepper-connector-gap=var(--lr-size-0-35em)] - Child mode: gap between a marker and
|
|
119
|
+
* the line on both sides.
|
|
120
|
+
* @cssprop [--lr-stepper-step-gap=var(--lr-space-m)] - Child mode: space between steps while stacked.
|
|
121
|
+
* @cssprop [--marker-size=var(--lr-stepper-marker-size,var(--lr-size-2rem))] - Child mode: alias of
|
|
122
|
+
* `--lr-stepper-marker-size`; wins when both are set.
|
|
123
|
+
* @cssprop [--connector-color=var(--lr-stepper-connector-color,var(--lr-color-neutral-fill-normal))] -
|
|
124
|
+
* Child mode: alias of `--lr-stepper-connector-color`; wins when both are set.
|
|
125
|
+
* @cssprop [--connector-color-active] - Child mode: alias of `--lr-stepper-connector-active-color`;
|
|
126
|
+
* wins when both are set.
|
|
127
|
+
* @cssprop [--connector-width=var(--lr-stepper-connector-width,var(--lr-border-width-medium))] - Child
|
|
128
|
+
* mode: alias of `--lr-stepper-connector-width`; wins when both are set.
|
|
129
|
+
* @cssprop [--connector-gap=var(--lr-stepper-connector-gap,var(--lr-size-0-35em))] - Child mode: alias
|
|
130
|
+
* of `--lr-stepper-connector-gap`; wins when both are set.
|
|
131
|
+
* @cssprop [--gap=var(--lr-stepper-step-gap,var(--lr-space-m))] - Child mode: alias of
|
|
132
|
+
* `--lr-stepper-step-gap`, the space between stacked steps; wins when both are set. In a row the
|
|
133
|
+
* connectors span the space between steps, which share the width evenly.
|
|
134
|
+
* @cssstate completed - Every step is completed (child mode: every `<lr-step>` is `completed`; data
|
|
135
|
+
* mode: every item's `state` is `completed`).
|
|
136
|
+
* @cssstate loading - Child mode: at least one `<lr-step>` is `loading`.
|
|
137
|
+
* @cssstate stacked - The steps are laid out vertically, by `orientation="vertical"`, an
|
|
138
|
+
* `orientationBreakpoint` or an `auto` stepper too narrow for a row.
|
|
72
139
|
* @cssprop [--lr-scroll-fade-size=2rem] - Width of each decorative horizontal overflow fade.
|
|
73
140
|
* Pointer-state hooks use inline `var()` fallbacks rather than a `:host` declaration, so they
|
|
74
141
|
* inherit from the stepper or any ancestor without retheming another state.
|
|
@@ -89,6 +156,10 @@ icon?:unknown;}export interface LyraStepperEventMap{'lr-step-select':CustomEvent
|
|
|
89
156
|
* @cssprop [--lr-stepper-error-color=var(--lr-color-danger)] - Text color of an `error` step.
|
|
90
157
|
* @cssprop [--lr-stepper-index-bg=var(--lr-color-neutral-fill-normal)] - Background of a step's
|
|
91
158
|
* `[part='step-index']` outside the current and error states.
|
|
159
|
+
* @cssprop [--lr-stepper-index-border=none] - Border shorthand of a step's index circle (for example
|
|
160
|
+
* `2px solid currentColor`); the circle keeps its size.
|
|
161
|
+
* @cssprop [--lr-stepper-current-index-border=var(--lr-stepper-index-border,none)] - Border of the `current` step's index.
|
|
162
|
+
* @cssprop [--lr-stepper-error-index-border=var(--lr-stepper-index-border,none)] - Border of an `error` step's index.
|
|
92
163
|
* @cssprop [--lr-stepper-index-color=var(--lr-color-neutral-on-normal)] - Text color of that index.
|
|
93
164
|
* @cssprop [--lr-stepper-error-index-bg=var(--lr-color-neutral-fill-normal)] - Background of an
|
|
94
165
|
* `error` step's index.
|
|
@@ -103,7 +174,7 @@ icon?:unknown;}export interface LyraStepperEventMap{'lr-step-select':CustomEvent
|
|
|
103
174
|
* @status stable
|
|
104
175
|
* @since 4.0.0
|
|
105
176
|
*/
|
|
106
|
-
export declare class LyraStepper extends LyraElement<LyraStepperEventMap>{static styles:import("lit").CSSResultGroup[];private omitted;private readonly stepsSnapshot;
|
|
177
|
+
export declare class LyraStepper extends LyraElement<LyraStepperEventMap>{protected static collectionSupport:import("../../../internal/lyra-element.js").LyraCollectionSupport;protected static readonly immutableEventDetails:readonly string[];protected static readonly identityEventDetailProperties:Readonly<{'lr-before-step-change':readonly string[];'lr-step-change':readonly string[];}>;static styles:import("lit").CSSResultGroup[];private omitted;private readonly stepsSnapshot;
|
|
107
178
|
/** Input positions beyond the 256-position limit on the latest assignment.*/
|
|
108
179
|
get omittedSteps():number;
|
|
109
180
|
/** Ordered step data. Never mutated by this component -- see the class doc's controlled-
|
|
@@ -112,10 +183,13 @@ get omittedSteps():number;
|
|
|
112
183
|
* locked. */
|
|
113
184
|
get steps():readonly LyraStepItem[];set steps(value:readonly LyraStepItem[]);
|
|
114
185
|
/** `'horizontal'` (the default) lays steps out in a row (Left/Right, RTL-aware, to navigate);
|
|
115
|
-
* `'vertical'` stacks them (Up/Down navigate instead, no RTL swap needed)
|
|
186
|
+
* `'vertical'` stacks them (Up/Down navigate instead, no RTL swap needed); `'auto'` lays them in
|
|
187
|
+
* a row and stacks them whenever the stepper's measured inline size cannot give each step about
|
|
188
|
+
* 6em (plus the gaps), so a narrow container or a phone stacks with no breakpoint to author.
|
|
189
|
+
* `'auto'` measures the stepper, so a server-rendered one starts as a row. The *authored* axis
|
|
116
190
|
* used at/above `orientationBreakpoint` (or always, when that's unset) -- see
|
|
117
191
|
* `effectiveOrientation` for the live axis actually in effect. */
|
|
118
|
-
orientation:
|
|
192
|
+
orientation:LyraStepperOrientation;
|
|
119
193
|
/** Opt-in inline-size breakpoint, measured on `[part="base"]`. Below it, `narrowOrientation`
|
|
120
194
|
* becomes effective instead of `orientation`. Unset (the default): no behavior change, the
|
|
121
195
|
* authored `orientation` always applies.
|
|
@@ -176,8 +250,27 @@ readonly:boolean;
|
|
|
176
250
|
* property. Unset, the list renders without an `aria-label` (the role carries no localized
|
|
177
251
|
* default name). */
|
|
178
252
|
accessibleLabel:string|null;
|
|
179
|
-
/** Accessible name when no aria-label is supplied
|
|
180
|
-
|
|
253
|
+
/** Accessible name when no aria-label is supplied. In child mode it names the stepper's group or
|
|
254
|
+
* navigation landmark (a localized "Steps" when unset). */
|
|
255
|
+
label?:string;
|
|
256
|
+
/** Child mode: the `name` of the current `<lr-step>`. Falls back to the first step when unset or
|
|
257
|
+
* when it matches no step. Changing it from script moves the step without the veto event;
|
|
258
|
+
* `goTo()`, `next()` and `previous()` ask first. */
|
|
259
|
+
active:string;
|
|
260
|
+
/** Child mode: steps must be completed in order. `next()`, `goTo()`, an invoker and a click
|
|
261
|
+
* cannot reach a step until every step before it is `completed`; later steps render locked. */
|
|
262
|
+
linear:boolean;
|
|
263
|
+
/** Child mode: each step becomes a button, so a click (or Enter/Space on a focused step) jumps to
|
|
264
|
+
* it. Unset, only the methods and `data-stepper` invokers move the step. */
|
|
265
|
+
clickable:boolean;private childSteps;private readonly stepperInternals;private childCount;private readonly announcements;private get childMode();constructor();private _effectiveOrientation;private readonly resizeFrame;private readonly resizeObserver;private readonlyFocusLost;private pendingStepFocus?;private baseEl?;private measuredInlineSize;private orientationBreakpoints;private scrollOverflow;private get observesContainer();
|
|
181
266
|
/** The live layout/navigation axis after applying `orientationBreakpoint` -- identical to
|
|
182
267
|
* `orientation` whenever that's unset. See the class doc. */
|
|
183
|
-
get effectiveOrientation():LyraOrientation;connectedCallback():void;private seedInlineSize;private orientationInlineSize;disconnectedCallback():void;adoptedCallback():void;protected firstUpdated(changed:PropertyValues):void;protected willUpdate(changed:PropertyValues):void;protected updated(changed:PropertyValues):void;private syncScrollTabStop;private updateEffectiveOrientation;private armResizeObserver;private resetResizeObserver;private
|
|
268
|
+
get effectiveOrientation():LyraOrientation;connectedCallback():void;private invokerDocument?;private registerInvokers;private unregisterInvokers;private seedInlineSize;private orientationInlineSize;disconnectedCallback():void;adoptedCallback():void;protected firstUpdated(changed:PropertyValues):void;protected willUpdate(changed:PropertyValues):void;protected updated(changed:PropertyValues):void;private syncScrollTabStop;private updateEffectiveOrientation;private autoStacks;private observedBase?;private armResizeObserver;private resetResizeObserver;private syncChildSteps;private syncCustomStates;private resolveActiveStep;private linearBoundary;private isReachable;private applyChildState;private activeIndex;
|
|
269
|
+
/** Child mode: requests a change to the named step. Emits a cancelable `lr-before-step-change`;
|
|
270
|
+
* unless vetoed, updates `active`, emits `lr-step-change` and announces the new position. Does
|
|
271
|
+
* nothing when the step does not exist, is `disabled`, or (while `linear`) cannot be reached yet. */
|
|
272
|
+
goTo(name:string):void;
|
|
273
|
+
/** Child mode: goes to the step after the current one, if any.*/
|
|
274
|
+
next():void;
|
|
275
|
+
/** Child mode: goes back to the step before the current one, if any.*/
|
|
276
|
+
previous():void;private ownStepOf;private readonly onChildClick;private readonly onChildKeyDown;private renderChildren;private selectStep;private focusStep;private onKeyDown;render():TemplateResult;}declare global{interface HTMLElementTagNameMap{'lr-stepper':LyraStepper;}}
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
import{__decorate}from"tslib";import{finiteCount}from"../../../internal/numbers.js";import{declaredDefaultConverter}from"../../../internal/converters.js";import{checkIcon}from"../../../internal/icons.js";import{OwnedResizeObserver,readInlineSize}from"../../../internal/owned-observer.js";import{OwnedFrame}from"../../../internal/owned-timer.js";import{SnapshotProperty}from"../../../internal/collection-source-tracker.js";import{html,nothing}from"lit";import{property,query}from"lit/decorators.js";import{repeat}from"lit/directives/repeat.js";import{LyraElement}from"../../../internal/lyra-element.js";import{resolveAccessibleName}from"../../../internal/accessible-name.js";import{hostAriaLabel}from"../../../internal/a11y.js";import{OrientationBreakpointController}from"../../../internal/orientation-breakpoint.js";import{isRepeatedActivationKey,shouldIgnoreNavigationKey,resolveListMove}from"../../../internal/list-navigation.js";import{observeScrollOverflow,SCROLL_OVERFLOW_ATTRIBUTE}from"../../../internal/scroll-overflow.js";import{scrollOverflowFadeStyles}from"../../../internal/scroll-overflow.styles.js";import{styles}from"./stepper.styles.js";import{getListFormat,getNumberFormat}from"../../../internal/intl-cache.js";import{restoreComposedFocus}from"../../../internal/focus-repair.js";import{shadowFocusTarget}from"../../../internal/active-element.js";import{syncAriaDescribedByElements}from"../../../internal/aria-reflection.js";import{LYRA_DEFAULT_stepperStateCompleted,LYRA_DEFAULT_stepperStateError,LYRA_DEFAULT_stepperStateLocked,LYRA_DEFAULT_stepperStatePending}from"../../../internal/default-strings/layout.generated.js";const STEP_STATES=new Set(["pending","current","completed","error"]),MAX_STEPS=256;function snapshotSteps(value,reportOmitted){try{if(!Array.isArray(value))return Object.freeze([])}catch{return Object.freeze([])}const normalized=[];let length=0;try{const sourceLength=finiteCount(value.length);length=Math.min(sourceLength,MAX_STEPS),reportOmitted(sourceLength-length)}catch{return Object.freeze(normalized)}for(let index=0;index<length;index+=1)try{const candidate=value[index];if(!candidate||typeof candidate!="object")continue;const record=candidate,stepId=record.stepId,label=record.label,state=record.state,disabled=record.disabled,title=record.title,icon=record.icon;if(typeof stepId!="string"||stepId.length===0||stepId!==stepId.trim()||typeof label!="string"||label.trim()===""||typeof state!="string"||!STEP_STATES.has(state)||disabled!==void 0&&typeof disabled!="boolean"||title!==void 0&&typeof title!="string")continue;normalized.push(Object.freeze({stepId,label,state,...disabled!==void 0?{disabled}:{},...title!==void 0?{title}:{},...icon!==void 0?{icon}:{}}))}catch{}return Object.freeze(normalized)}class LyraStepper extends LyraElement{constructor(){super(...arguments),this.omitted=0,this.stepsSnapshot=new SnapshotProperty(Object.freeze([]),value=>(this.omitted=0,snapshotSteps(value,count=>{this.omitted=count}))),this.orientation="horizontal",this.orientationBreakpointBasis="container",this.narrowOrientation="vertical",this.wrapLabels=!1,this.readonly=!1,this.accessibleLabel=null,this._effectiveOrientation="horizontal",this.resizeFrame=new OwnedFrame(this),this.resizeObserver=new OwnedResizeObserver(this,entries=>{const width=readInlineSize(entries[0])??this.orientationInlineSize();this.resizeFrame.schedule(()=>{this.measuredInlineSize=width,this.updateEffectiveOrientation(width,!0)})}),this.readonlyFocusLost=!1,this.measuredInlineSize=Number.POSITIVE_INFINITY,this.orientationBreakpoints=new OrientationBreakpointController(this,()=>this.updateEffectiveOrientation(this.orientationInlineSize(),!0)),this.scrollOverflow=observeScrollOverflow(this,()=>this.baseEl,()=>this.syncScrollTabStop()),this.onKeyDown=e=>{if(this.readonly||e.defaultPrevented||shouldIgnoreNavigationKey(e))return;const navigable=this.steps.map((step,index)=>({step,index})).filter(({step})=>!step.disabled);if(navigable.length===0)return;const focused=shadowFocusTarget(this),focusedIndex=Number(focused?.dataset.index),currentIndex=navigable.findIndex(item=>item.index===focusedIndex);if(e.key==="Enter"||e.key===" "){if(e.preventDefault(),isRepeatedActivationKey(e))return;if(currentIndex>=0){const target=navigable[currentIndex];this.selectStep(target.step,target.index)}return}const targetIndex=resolveListMove(e,{count:navigable.length,current:currentIndex,orientation:this.effectiveOrientation==="vertical"?"vertical":"horizontal",direction:this.effectiveDirection,wrap:!1,clamp:!0,backwardFromMissing:"first"});targetIndex!==null&&(e.preventDefault(),this.focusStep(navigable[targetIndex].index))}}static{this.defaultStrings={...super.defaultStrings,stepperStateCompleted:LYRA_DEFAULT_stepperStateCompleted,stepperStateError:LYRA_DEFAULT_stepperStateError,stepperStateLocked:LYRA_DEFAULT_stepperStateLocked,stepperStatePending:LYRA_DEFAULT_stepperStatePending}}static{this.styles=[LyraElement.styles,scrollOverflowFadeStyles,styles]}get omittedSteps(){return this.omitted}get steps(){return this.stepsSnapshot.read()}set steps(value){this.stepsSnapshot.assign(this,"steps",value)}get effectiveOrientation(){return this._effectiveOrientation}connectedCallback(){super.connectedCallback(),this.hasUpdated&&this.orientationBreakpoints.containerObservationEnabled&&this.seedInlineSize(),this.orientationBreakpoints.containerObservationEnabled&&this.armResizeObserver()}seedInlineSize(){const hostWidth=this.getBoundingClientRect().width;hostWidth>0&&(this.measuredInlineSize=hostWidth)}orientationInlineSize(){return this.orientationBreakpoints.containerObservationEnabled?this.baseEl?.clientWidth??this.measuredInlineSize:this.measuredInlineSize}disconnectedCallback(){super.disconnectedCallback(),this.resetResizeObserver()}adoptedCallback(){super.adoptedCallback(),this.resetResizeObserver()}firstUpdated(changed){super.firstUpdated(changed),this.orientationBreakpoints.containerObservationEnabled&&this.armResizeObserver()}willUpdate(changed){if(super.willUpdate(changed),changed.has("readonly")&&this.hasUpdated&&(this.readonlyFocusLost=shadowFocusTarget(this)?.getAttribute("part")==="step"),changed.has("steps")){const focusedStep=shadowFocusTarget(this);focusedStep?.getAttribute("part")==="step"&&(this.pendingStepFocus={stepId:focusedStep.dataset.stepId??"",index:Number(focusedStep.dataset.index)})}(changed.has("orientationBreakpoint")||changed.has("orientationBreakpointBasis"))&&this.orientationBreakpoints.configure(this.orientationBreakpoint,this.orientationBreakpointBasis),!this.hasUpdated&&this.isConnected&&this.orientationBreakpoints.containerObservationEnabled&&this.seedInlineSize(),(changed.has("orientation")||changed.has("narrowOrientation")||changed.has("orientationBreakpoint")||changed.has("orientationBreakpointBasis"))&&this.updateEffectiveOrientation(this.orientationInlineSize(),this.hasUpdated&&this.orientationBreakpointBasis==="viewport")}updated(changed){super.updated(changed);const base=this.renderRoot.querySelector('[part~="base"]')??void 0;if(syncAriaDescribedByElements(this,base,this.getAttribute("aria-describedby")),this.scrollOverflow.observeExtra(this.renderRoot.querySelectorAll('[part="step"]')),this.syncScrollTabStop(),this.readonlyFocusLost&&(this.readonlyFocusLost=!1,restoreComposedFocus(this,!0,this.renderRoot.querySelector('[part="base"]'))),this.pendingStepFocus!==void 0){const focusedOccurrence=this.pendingStepFocus;this.pendingStepFocus=void 0;const enabledIdentityMatches=[...this.renderRoot.querySelectorAll('[part="step"]')].filter(step=>step.dataset.stepId===focusedOccurrence.stepId&&step.getAttribute("aria-disabled")!=="true");(enabledIdentityMatches.find(step=>Number(step.dataset.index)===focusedOccurrence.index)??(enabledIdentityMatches.length===1?enabledIdentityMatches[0]:void 0)??this.renderRoot.querySelector('[part="step"][tabindex="0"]'))?.focus()}(changed.has("orientationBreakpoint")||changed.has("orientationBreakpointBasis"))&&(this.orientationBreakpoints.containerObservationEnabled?this.armResizeObserver():this.resetResizeObserver())}syncScrollTabStop(){const base=this.baseEl;if(!base)return;const scrollable=this.effectiveOrientation==="horizontal"&&base.hasAttribute(SCROLL_OVERFLOW_ATTRIBUTE);this.readonly&&scrollable?base.setAttribute("tabindex","0"):this.readonly&&(this.readonlyFocusLost||shadowFocusTarget(this)===base)?base.tabIndex=-1:base.removeAttribute("tabindex")}updateEffectiveOrientation(width,emitOnChange){const next=this.orientationBreakpoints.isBelow(width)?this.narrowOrientation:this.orientation;this.orientationBreakpoints.active?this.setAttribute("data-effective-orientation",next):this.removeAttribute("data-effective-orientation"),next!==this._effectiveOrientation&&(this._effectiveOrientation=next,this.requestUpdate(),emitOnChange&&this.emit("lr-stepper-orientation-change",{orientation:next}))}armResizeObserver(){this.baseEl&&!this.resizeObserver.active&&this.resizeObserver.observe(this.baseEl)}resetResizeObserver(){this.resizeFrame.cancel(),this.resizeObserver.clear()}selectStep(step,index){this.readonly||step.disabled||this.emit("lr-step-select",{stepId:step.stepId,index})}focusStep(index){this.renderRoot.querySelector(`[part="step"][data-index="${index}"]`)?.focus()}render(){const currentIndex=this.steps.findIndex(step=>step.state==="current"),rovingIndex=this.readonly?-1:currentIndex>=0&&!this.steps[currentIndex].disabled?currentIndex:this.steps.findIndex(step=>!step.disabled),numberFormat=getNumberFormat(this.effectiveLocale),stateText=step=>{const parts=[];return step.state==="completed"?parts.push(this.localize("stepperStateCompleted")):step.state==="error"?parts.push(this.localize("stepperStateError")):step.state==="pending"&&parts.push(this.localize("stepperStatePending")),step.disabled&&!this.readonly&&parts.push(this.localize("stepperStateLocked")),parts.length===0?nothing:html`<span class="visually-hidden">${parts.length===1?parts[0]:getListFormat(this.effectiveLocale,{type:"unit"}).format(parts)}</span>`},stepGlyphs=(step,index)=>html`${step.icon!==void 0?html`<span part="step-icon" aria-hidden="true" inert >${step.icon}</span
|
|
1
|
+
import{__decorate}from"tslib";import{finiteCount}from"../../../internal/numbers.js";import{eventCollectionSupport}from"../../../internal/collection-snapshot.js";import{declaredDefaultConverter}from"../../../internal/converters.js";import{checkIcon}from"../../../internal/icons.js";import{HostChildrenObserver,OwnedResizeObserver,readInlineSize}from"../../../internal/owned-observer.js";import{AnnouncementSinkController}from"../../../internal/announcer.js";import{tag}from"../../../internal/prefix.js";import{OwnedFrame}from"../../../internal/owned-timer.js";import{SnapshotProperty}from"../../../internal/collection-source-tracker.js";import{html,nothing}from"lit";import{property,query,state}from"lit/decorators.js";import{repeat}from"lit/directives/repeat.js";import{LyraElement}from"../../../internal/lyra-element.js";import{resolveAccessibleName}from"../../../internal/accessible-name.js";import{hostAriaLabel}from"../../../internal/a11y.js";import{OrientationBreakpointController}from"../../../internal/orientation-breakpoint.js";import{isRepeatedActivationKey,shouldIgnoreNavigationKey,resolveListMove}from"../../../internal/list-navigation.js";import{observeScrollOverflow,SCROLL_OVERFLOW_ATTRIBUTE}from"../../../internal/scroll-overflow.js";import{scrollOverflowFadeStyles}from"../../../internal/scroll-overflow.styles.js";import{styles}from"./stepper.styles.js";import{getListFormat,getNumberFormat}from"../../../internal/intl-cache.js";import{restoreComposedFocus}from"../../../internal/focus-repair.js";import{shadowFocusTarget}from"../../../internal/active-element.js";import{syncAriaDescribedByElements}from"../../../internal/aria-reflection.js";import{setCustomState}from"../../../internal/custom-states.js";import{attachInternalsSafely}from"../../../internal/element-internals.js";import{LYRA_DEFAULT_stepperStateCompleted,LYRA_DEFAULT_stepperStateError,LYRA_DEFAULT_stepperStateLocked,LYRA_DEFAULT_stepperStatePending,LYRA_DEFAULT_stepperStepPosition,LYRA_DEFAULT_stepperSteps}from"../../../internal/default-strings/layout.generated.js";const STEP_STATES=new Set(["pending","current","completed","error"]),MAX_STEPS=256,invokerRecords=new WeakMap,INVOKER_COMMANDS=new Set(["next","previous","goto"]);function handleInvokerClick(event){const invoker=event.composedPath().find(node=>node instanceof Element&&node.hasAttribute("data-stepper"));if(!invoker)return;const[rawCommand,...rest]=(invoker.getAttribute("data-stepper")??"").trim().split(/\s+/),command=(rawCommand??"").toLowerCase();if(!INVOKER_COMMANDS.has(command))return;const root=invoker.getRootNode(),named=rest[0]?root.getElementById?.(rest[0])??null:null,byId=named?.localName===tag("stepper"),target=byId?named:invoker.closest(tag("stepper"));if(!target)return;const args=byId?rest.slice(1):rest;command==="next"?target.next():command==="previous"?target.previous():args.length>0&&target.goTo(args.join(" "))}function acquireInvokers(doc){const existing=invokerRecords.get(doc);if(existing){existing.count+=1;return}doc.addEventListener("click",handleInvokerClick),invokerRecords.set(doc,{count:1,handler:handleInvokerClick})}function releaseInvokers(doc){const record=invokerRecords.get(doc);record&&(record.count-=1,!(record.count>0)&&(doc.removeEventListener("click",record.handler),invokerRecords.delete(doc)))}function snapshotSteps(value,reportOmitted){try{if(!Array.isArray(value))return Object.freeze([])}catch{return Object.freeze([])}const normalized=[];let length=0;try{const sourceLength=finiteCount(value.length);length=Math.min(sourceLength,MAX_STEPS),reportOmitted(sourceLength-length)}catch{return Object.freeze(normalized)}for(let index=0;index<length;index+=1)try{const candidate=value[index];if(!candidate||typeof candidate!="object")continue;const record=candidate,stepId=record.stepId,label=record.label,state2=record.state,disabled=record.disabled,title=record.title,icon=record.icon;if(typeof stepId!="string"||stepId.length===0||stepId!==stepId.trim()||typeof label!="string"||label.trim()===""||typeof state2!="string"||!STEP_STATES.has(state2)||disabled!==void 0&&typeof disabled!="boolean"||title!==void 0&&typeof title!="string")continue;normalized.push(Object.freeze({stepId,label,state:state2,...disabled!==void 0?{disabled}:{},...title!==void 0?{title}:{},...icon!==void 0?{icon}:{}}))}catch{}return Object.freeze(normalized)}class LyraStepper extends LyraElement{static{this.defaultStrings={...super.defaultStrings,stepperStateCompleted:LYRA_DEFAULT_stepperStateCompleted,stepperStateError:LYRA_DEFAULT_stepperStateError,stepperStateLocked:LYRA_DEFAULT_stepperStateLocked,stepperStatePending:LYRA_DEFAULT_stepperStatePending,stepperStepPosition:LYRA_DEFAULT_stepperStepPosition,stepperSteps:LYRA_DEFAULT_stepperSteps}}static{this.collectionSupport=eventCollectionSupport}static{this.immutableEventDetails=Object.freeze(["lr-before-step-change","lr-step-change"])}static{this.identityEventDetailProperties=Object.freeze({"lr-before-step-change":Object.freeze(["step","previousStep"]),"lr-step-change":Object.freeze(["step","previousStep"])})}static{this.styles=[LyraElement.styles,scrollOverflowFadeStyles,styles]}get omittedSteps(){return this.omitted}get steps(){return this.stepsSnapshot.read()}set steps(value){this.stepsSnapshot.assign(this,"steps",value)}get childMode(){return this.childCount>0&&this.steps.length===0}constructor(){super(),this.omitted=0,this.stepsSnapshot=new SnapshotProperty(Object.freeze([]),value=>(this.omitted=0,snapshotSteps(value,count=>{this.omitted=count}))),this.orientation="horizontal",this.orientationBreakpointBasis="container",this.narrowOrientation="vertical",this.wrapLabels=!1,this.readonly=!1,this.accessibleLabel=null,this.active="",this.linear=!1,this.clickable=!1,this.childSteps=[],this.stepperInternals=attachInternalsSafely(this),this.childCount=0,this.announcements=new AnnouncementSinkController(this,{eager:["polite"]}),this._effectiveOrientation="horizontal",this.resizeFrame=new OwnedFrame(this),this.resizeObserver=new OwnedResizeObserver(this,entries=>{const width=readInlineSize(entries[0])??this.orientationInlineSize();this.resizeFrame.schedule(()=>{this.measuredInlineSize=width,this.updateEffectiveOrientation(width,!0)})}),this.readonlyFocusLost=!1,this.measuredInlineSize=Number.POSITIVE_INFINITY,this.orientationBreakpoints=new OrientationBreakpointController(this,()=>this.updateEffectiveOrientation(this.orientationInlineSize(),!0)),this.scrollOverflow=observeScrollOverflow(this,()=>this.baseEl,()=>this.syncScrollTabStop()),this.activeIndex=0,this.onChildClick=event=>{if(!this.childMode||!this.clickable)return;const step=this.ownStepOf(event);step&&this.goTo(step.name)},this.onChildKeyDown=event=>{if(!this.childMode||!this.clickable||event.defaultPrevented||shouldIgnoreNavigationKey(event))return;const current=this.ownStepOf(event);if(!current)return;const navigable=this.childSteps.filter(step=>this.isReachable(step)),target=resolveListMove(event,{count:navigable.length,current:navigable.indexOf(current),orientation:this.effectiveOrientation==="vertical"?"vertical":"horizontal",direction:this.effectiveDirection,wrap:!1,clamp:!0,backwardFromMissing:"first"});target!==null&&(event.preventDefault(),navigable[target]?.focus())},this.onKeyDown=e=>{if(this.readonly||e.defaultPrevented||shouldIgnoreNavigationKey(e))return;const navigable=this.steps.map((step,index)=>({step,index})).filter(({step})=>!step.disabled);if(navigable.length===0)return;const focused=shadowFocusTarget(this),focusedIndex=Number(focused?.dataset.index),currentIndex=navigable.findIndex(item=>item.index===focusedIndex);if(e.key==="Enter"||e.key===" "){if(e.preventDefault(),isRepeatedActivationKey(e))return;if(currentIndex>=0){const target=navigable[currentIndex];this.selectStep(target.step,target.index)}return}const targetIndex=resolveListMove(e,{count:navigable.length,current:currentIndex,orientation:this.effectiveOrientation==="vertical"?"vertical":"horizontal",direction:this.effectiveDirection,wrap:!1,clamp:!0,backwardFromMissing:"first"});targetIndex!==null&&(e.preventDefault(),this.focusStep(navigable[targetIndex].index))},this.addEventListener("click",this.onChildClick),this.addEventListener("keydown",this.onChildKeyDown),new HostChildrenObserver(this,{subtree:!0,attributeFilter:["name","completed","loading","disabled","variant"],onChange:records=>{records.some(record=>{const target=record.target;return target===this||target.closest?.(tag("stepper"))===this})&&this.syncChildSteps()}})}get observesContainer(){return this.orientationBreakpoints.containerObservationEnabled||this.orientation==="auto"}get effectiveOrientation(){return this._effectiveOrientation}connectedCallback(){super.connectedCallback(),this.hasUpdated&&this.observesContainer&&this.seedInlineSize(),this.observesContainer&&this.armResizeObserver(),this.registerInvokers(),this.syncChildSteps()}registerInvokers(){const doc=this.ownerDocument;this.invokerDocument!==doc&&(this.unregisterInvokers(),this.invokerDocument=doc,acquireInvokers(doc))}unregisterInvokers(){this.invokerDocument&&releaseInvokers(this.invokerDocument),this.invokerDocument=void 0}seedInlineSize(){const hostWidth=this.getBoundingClientRect().width;hostWidth>0&&(this.measuredInlineSize=hostWidth)}orientationInlineSize(){return this.observesContainer?this.baseEl?.clientWidth??this.measuredInlineSize:this.measuredInlineSize}disconnectedCallback(){super.disconnectedCallback(),this.resetResizeObserver(),this.unregisterInvokers()}adoptedCallback(){super.adoptedCallback(),this.resetResizeObserver(),this.unregisterInvokers()}firstUpdated(changed){super.firstUpdated(changed),this.observesContainer&&this.armResizeObserver()}willUpdate(changed){if(super.willUpdate(changed),changed.has("readonly")&&this.hasUpdated&&(this.readonlyFocusLost=shadowFocusTarget(this)?.getAttribute("part")==="step"),(changed.has("active")||changed.has("linear")||changed.has("clickable")||changed.has("steps")||!this.hasUpdated)&&this.applyChildState(),changed.has("steps")){const focusedStep=shadowFocusTarget(this);focusedStep?.getAttribute("part")==="step"&&(this.pendingStepFocus={stepId:focusedStep.dataset.stepId??"",index:Number(focusedStep.dataset.index)})}(changed.has("orientationBreakpoint")||changed.has("orientationBreakpointBasis"))&&this.orientationBreakpoints.configure(this.orientationBreakpoint,this.orientationBreakpointBasis),!this.hasUpdated&&this.isConnected&&this.observesContainer&&this.seedInlineSize(),(changed.has("orientation")||changed.has("steps")&&this.orientation==="auto"||changed.has("narrowOrientation")||changed.has("orientationBreakpoint")||changed.has("orientationBreakpointBasis"))&&this.updateEffectiveOrientation(this.orientationInlineSize(),this.hasUpdated&&this.orientationBreakpointBasis==="viewport")}updated(changed){super.updated(changed),this.syncCustomStates(),this.registerInvokers();const base=this.renderRoot.querySelector('[part~="base"]')??void 0;if(syncAriaDescribedByElements(this,base,this.getAttribute("aria-describedby")),this.scrollOverflow.observeExtra(this.renderRoot.querySelectorAll('[part="step"]')),this.syncScrollTabStop(),this.readonlyFocusLost&&(this.readonlyFocusLost=!1,restoreComposedFocus(this,!0,this.renderRoot.querySelector('[part~="base"]'))),this.pendingStepFocus!==void 0){const focusedOccurrence=this.pendingStepFocus;this.pendingStepFocus=void 0;const enabledIdentityMatches=[...this.renderRoot.querySelectorAll('[part="step"]')].filter(step=>step.dataset.stepId===focusedOccurrence.stepId&&step.getAttribute("aria-disabled")!=="true");(enabledIdentityMatches.find(step=>Number(step.dataset.index)===focusedOccurrence.index)??(enabledIdentityMatches.length===1?enabledIdentityMatches[0]:void 0)??this.renderRoot.querySelector('[part="step"][tabindex="0"]'))?.focus()}this.observesContainer?this.armResizeObserver():this.resetResizeObserver()}syncScrollTabStop(){const base=this.baseEl;if(!base)return;const scrollable=this.effectiveOrientation==="horizontal"&&base.hasAttribute(SCROLL_OVERFLOW_ATTRIBUTE);this.readonly&&scrollable?base.setAttribute("tabindex","0"):this.readonly&&(this.readonlyFocusLost||shadowFocusTarget(this)===base)?base.tabIndex=-1:base.removeAttribute("tabindex")}updateEffectiveOrientation(width,emitOnChange){const next=this.orientationBreakpoints.isBelow(width)?this.narrowOrientation:this.orientation==="auto"?this.autoStacks(width)?"vertical":"horizontal":this.orientation;if(this.orientationBreakpoints.active||this.orientation==="auto"?this.setAttribute("data-effective-orientation",next):this.removeAttribute("data-effective-orientation"),next!==this._effectiveOrientation){this._effectiveOrientation=next;for(const step of this.childSteps)step.vertical=next==="vertical";this.requestUpdate(),emitOnChange&&this.emit("lr-stepper-orientation-change",{orientation:next})}}autoStacks(width){if(!Number.isFinite(width)||width<=0)return!1;const count=this.childMode?this.childSteps.length:this.steps.length;if(count<2)return!1;const fontSize=Number.parseFloat(getComputedStyle(this).fontSize)||16,gap=this.baseEl&&Number.parseFloat(getComputedStyle(this.baseEl).columnGap)||0;return width<count*fontSize*6+(count-1)*gap}armResizeObserver(){const base=this.baseEl;base&&(this.observedBase===base&&this.resizeObserver.active||(this.resizeObserver.clear(),this.resizeObserver.observe(base),this.observedBase=base))}resetResizeObserver(){this.resizeFrame.cancel(),this.resizeObserver.clear(),this.observedBase=void 0}syncChildSteps(){const steps=Array.from(this.children).filter(child=>child.localName===tag("step")),countChanged=steps.length!==this.childSteps.length;this.childSteps=steps,this.childCount=steps.length,this.applyChildState(),this.syncCustomStates(),countChanged&&this.orientation==="auto"&&this.updateEffectiveOrientation(this.orientationInlineSize(),!0)}syncCustomStates(){const child=this.childMode,completed=child?this.childSteps.every(step=>step.completed):this.steps.length>0&&this.steps.every(step=>step.state==="completed");setCustomState(this.stepperInternals,"completed",completed),setCustomState(this.stepperInternals,"loading",child&&this.childSteps.some(step=>step.loading)),setCustomState(this.stepperInternals,"stacked",this.effectiveOrientation==="vertical")}resolveActiveStep(steps){return steps.find(step=>step.name===this.active)??steps[0]}linearBoundary(steps){const firstIncomplete=steps.findIndex(step=>!step.completed);return firstIncomplete===-1?steps.length-1:firstIncomplete}isReachable(step,steps=this.childSteps){return step.disabled?!1:this.linear?steps.indexOf(step)<=this.linearBoundary(steps):!0}applyChildState(){const steps=this.childSteps;if(steps.length===0||this.steps.length>0)return;const activeStep=this.resolveActiveStep(steps),boundary=this.linearBoundary(steps);this.activeIndex=activeStep?steps.indexOf(activeStep):0;const stop=activeStep&&this.isReachable(activeStep,steps)?activeStep:steps.find(step=>this.isReachable(step,steps)),vertical=this.effectiveOrientation==="vertical";steps.forEach((step,index)=>{step.position=index+1,step.active=step===activeStep,step.locked=this.linear&&index>boundary,step.clickable=this.clickable,step.vertical=vertical,step.first=index===0,step.last=index===steps.length-1,step.tabStop=step===stop;const previous=steps[index-1];step.connectorStartVariant=previous?.completed?previous.variant:void 0})}goTo(name){if(!this.childMode)return;const steps=this.childSteps,target=steps.find(step=>step.name===name);if(!target||!this.isReachable(target,steps))return;const previousStep=this.resolveActiveStep(steps)??null;if(target===previousStep)return;const detail={name:target.name,previousName:previousStep?.name??null,step:target,previousStep};this.emit("lr-before-step-change",detail,{cancelable:!0}).defaultPrevented||(this.active=target.name,this.updateComplete.then(()=>{this.emit("lr-step-change",detail);const format=getNumberFormat(this.effectiveLocale);this.announcements.announcePolite(this.localize("stepperStepPosition",void 0,{current:format.format(this.activeIndex+1),total:format.format(this.childSteps.length)}))}))}next(){const steps=this.childSteps,index=steps.findIndex(step=>step===this.resolveActiveStep(steps)),target=steps[index+1];index>=0&&target&&this.goTo(target.name)}previous(){const steps=this.childSteps,index=steps.findIndex(step=>step===this.resolveActiveStep(steps)),target=index>0?steps[index-1]:void 0;target&&this.goTo(target.name)}ownStepOf(event){const origin=event.target;if(!(origin instanceof Element))return;const step=origin.closest(tag("step"));return step&&step.parentNode===this?step:void 0}renderChildren(){const format=getNumberFormat(this.effectiveLocale),name=this.accessibleLabel||this.label||this.localize("stepperSteps"),body=html`
|
|
2
|
+
<span part="summary" class="visually-hidden" >${this.localize("stepperStepPosition",void 0,{current:format.format(this.activeIndex+1),total:format.format(this.childCount)})}</span
|
|
3
|
+
>
|
|
4
|
+
<div part="base steps" class="child-steps" role="list"><slot></slot></div>
|
|
5
|
+
`;return this.clickable?html`<nav part="stepper" aria-label=${name}>${body}</nav>`:html`<div part="stepper" role="group" aria-label=${name}>${body}</div>`}selectStep(step,index){this.readonly||step.disabled||this.emit("lr-step-select",{stepId:step.stepId,index})}focusStep(index){this.renderRoot.querySelector(`[part="step"][data-index="${index}"]`)?.focus()}render(){if(this.childMode)return this.renderChildren();const currentIndex=this.steps.findIndex(step=>step.state==="current"),rovingIndex=this.readonly?-1:currentIndex>=0&&!this.steps[currentIndex].disabled?currentIndex:this.steps.findIndex(step=>!step.disabled),numberFormat=getNumberFormat(this.effectiveLocale),stateText=step=>{const parts=[];return step.state==="completed"?parts.push(this.localize("stepperStateCompleted")):step.state==="error"?parts.push(this.localize("stepperStateError")):step.state==="pending"&&parts.push(this.localize("stepperStatePending")),step.disabled&&!this.readonly&&parts.push(this.localize("stepperStateLocked")),parts.length===0?nothing:html`<span class="visually-hidden">${parts.length===1?parts[0]:getListFormat(this.effectiveLocale,{type:"unit"}).format(parts)}</span>`},stepGlyphs=(step,index)=>html`${step.icon!==void 0?html`<span part="step-icon" aria-hidden="true" inert >${step.icon}</span
|
|
2
6
|
>`:nothing}
|
|
3
7
|
${step.state==="completed"?html`<span part="step-check">${checkIcon()}</span>`:html`<span part="step-index" >${numberFormat.format(index+1)}</span
|
|
4
8
|
>`}`;return html`
|
|
@@ -15,4 +19,4 @@ import{__decorate}from"tslib";import{finiteCount}from"../../../internal/numbers.
|
|
|
15
19
|
</button>`}
|
|
16
20
|
</div>`)}
|
|
17
21
|
</div>
|
|
18
|
-
`}}__decorate([property({attribute:!1})],LyraStepper.prototype,"steps",null),__decorate([property({reflect:!0,converter:declaredDefaultConverter("horizontal")})],LyraStepper.prototype,"orientation",void 0),__decorate([property({attribute:"orientation-breakpoint"})],LyraStepper.prototype,"orientationBreakpoint",void 0),__decorate([property({reflect:!0,converter:declaredDefaultConverter("container"),attribute:"orientation-breakpoint-basis"})],LyraStepper.prototype,"orientationBreakpointBasis",void 0),__decorate([property({reflect:!0,converter:declaredDefaultConverter("vertical"),attribute:"narrow-orientation"})],LyraStepper.prototype,"narrowOrientation",void 0),__decorate([property({type:Boolean,reflect:!0,attribute:"wrap-labels"})],LyraStepper.prototype,"wrapLabels",void 0),__decorate([property({type:Boolean,reflect:!0})],LyraStepper.prototype,"readonly",void 0),__decorate([property({attribute:"aria-label"})],LyraStepper.prototype,"accessibleLabel",void 0),__decorate([property()],LyraStepper.prototype,"label",void 0),__decorate([query('[part
|
|
22
|
+
`}}__decorate([property({attribute:!1})],LyraStepper.prototype,"steps",null),__decorate([property({reflect:!0,converter:declaredDefaultConverter("horizontal")})],LyraStepper.prototype,"orientation",void 0),__decorate([property({attribute:"orientation-breakpoint"})],LyraStepper.prototype,"orientationBreakpoint",void 0),__decorate([property({reflect:!0,converter:declaredDefaultConverter("container"),attribute:"orientation-breakpoint-basis"})],LyraStepper.prototype,"orientationBreakpointBasis",void 0),__decorate([property({reflect:!0,converter:declaredDefaultConverter("vertical"),attribute:"narrow-orientation"})],LyraStepper.prototype,"narrowOrientation",void 0),__decorate([property({type:Boolean,reflect:!0,attribute:"wrap-labels"})],LyraStepper.prototype,"wrapLabels",void 0),__decorate([property({type:Boolean,reflect:!0})],LyraStepper.prototype,"readonly",void 0),__decorate([property({attribute:"aria-label"})],LyraStepper.prototype,"accessibleLabel",void 0),__decorate([property()],LyraStepper.prototype,"label",void 0),__decorate([property({reflect:!0})],LyraStepper.prototype,"active",void 0),__decorate([property({type:Boolean,reflect:!0})],LyraStepper.prototype,"linear",void 0),__decorate([property({type:Boolean,reflect:!0})],LyraStepper.prototype,"clickable",void 0),__decorate([state()],LyraStepper.prototype,"childCount",void 0),__decorate([query('[part~="base"]')],LyraStepper.prototype,"baseEl",void 0),__decorate([state()],LyraStepper.prototype,"activeIndex",void 0);export{LyraStepper};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{visuallyHidden}from"../../../internal/a11y.js";import{forcedColorsPart}from"../../../internal/forced-colors.styles.js";import{activeFill,disabledControl,focusRing,focusRingOffset,focusRingOffsetInset}from"../../../internal/interactive-control.styles.js";import{scrollOverflowFade}from"../../../internal/scroll-overflow.styles.js";import{css}from"lit";import{blockHost}from"../../../internal/layout-fragments.styles.js";const styles=css` :host{${blockHost}}[part
|
|
1
|
+
import{visuallyHidden}from"../../../internal/a11y.js";import{forcedColorsPart}from"../../../internal/forced-colors.styles.js";import{activeFill,disabledControl,focusRing,focusRingOffset,focusRingOffsetInset}from"../../../internal/interactive-control.styles.js";import{scrollOverflowFade}from"../../../internal/scroll-overflow.styles.js";import{css}from"lit";import{blockHost}from"../../../internal/layout-fragments.styles.js";const styles=css` :host{${blockHost}}[part~=base]{display:flex;min-inline-size:0;max-inline-size:100%;gap:var(--lr-space-m);padding-inline:var(--lr-size-1px);overflow-x:auto;overflow-y:hidden}[part~=base]:focus-visible{${focusRing}}[part=step-item]{display:contents}:host([orientation=vertical]) [part~=base]{flex-direction:column;overflow-x:visible;overflow-y:visible;-webkit-mask-image:none;mask-image:none}:host([data-effective-orientation=vertical]) [part~=base]{flex-direction:column;overflow-x:visible;overflow-y:visible;-webkit-mask-image:none;mask-image:none}:host([data-effective-orientation=horizontal]) [part~=base]{flex-direction:row;overflow-x:auto;overflow-y:hidden;-webkit-mask-image:none;mask-image:none}${scrollOverflowFade(':host([data-effective-orientation="horizontal"]) [part~="base"][data-scroll-overflow]',':host(:dir(rtl)[data-effective-orientation="horizontal"]) [part~="base"][data-scroll-overflow]')} [part=step]{display:flex;align-items:center;gap:var(--lr-space-xs);flex:0 0 auto;border:none;background:transparent;color:var(--lr-color-text-quiet);font:inherit;cursor:pointer;padding:var(--lr-space-2xs);border-radius:var(--lr-radius);transition:background-color var(--lr-transition-fast),color var(--lr-transition-fast)}[part=step][aria-disabled=true]{${disabledControl}}:host([readonly]) [part=step]{cursor:default}:where(button[part=step]):hover:where(:not([aria-disabled=true])){background:var(--lr-stepper-hover-bg,var(--lr-color-brand-quiet));color:var(--lr-stepper-hover-color,var(--lr-color-text))}:where(button[part=step]):active:where(:not([aria-disabled=true])){background:var(--lr-stepper-active-bg,${activeFill("var(--lr-color-brand-quiet)")});color:var(--lr-stepper-active-color,var(--lr-color-text))}[part=step]:focus-visible{${focusRing}}:host(:where(:not([orientation=vertical]))) [part=step]:focus-visible,:host(:where([data-effective-orientation=horizontal])) [part=step]:focus-visible{${focusRingOffsetInset}}:host(:where([data-effective-orientation=vertical])) [part=step]:focus-visible{${focusRingOffset}}[part=step][data-state=current]{color:var(--lr-stepper-current-color,var(--lr-color-text));font-weight:var(--lr-stepper-current-font-weight,var(--lr-font-weight-semibold))}[part=step][data-state=error]{color:var(--lr-stepper-error-color,var(--lr-color-danger))}[part=step-icon]{display:inline-flex;align-items:center;flex:0 0 auto;block-size:var(--lr-size-1em);max-inline-size:var(--lr-size-2-5rem)}[part=step-index]{display:inline-flex;align-items:center;justify-content:center;inline-size:var(--lr-size-1-5rem);block-size:var(--lr-size-1-5rem);box-sizing:border-box;border:var(--lr-stepper-index-border,none);border-radius:var(--lr-radius-pill);background:var(--lr-stepper-index-bg,var(--lr-color-neutral-fill-normal));color:var(--lr-stepper-index-color,var(--lr-color-neutral-on-normal));font-size:var(--lr-font-size-xs);flex:0 0 auto}[part=step][data-state=current] [part=step-index]{border:var(--lr-stepper-current-index-border,var(--lr-stepper-index-border,none));background:var(--lr-stepper-current-index-bg,var(--lr-color-brand));color:var(--lr-stepper-current-index-color,var(--lr-color-on-brand))}[part=step][data-state=error] [part=step-index]{border:var(--lr-stepper-error-index-border,var(--lr-stepper-index-border,none));background:var(--lr-stepper-error-index-bg,var(--lr-color-neutral-fill-normal));color:var(--lr-stepper-error-index-color,var(--lr-color-neutral-on-normal))}[part=step-check]{display:inline-flex;color:var(--lr-stepper-check-color,var(--lr-color-success));flex:0 0 auto}[part=step-label]{white-space:nowrap}.visually-hidden{${visuallyHidden}}:host([wrap-labels][orientation=vertical]) [part=step-label],:host([wrap-labels][data-effective-orientation=vertical]) [part=step-label]{min-inline-size:0;white-space:normal;overflow-wrap:anywhere}:host([wrap-labels][data-effective-orientation=horizontal]) [part=step-label]{min-inline-size:auto;white-space:nowrap;overflow-wrap:normal}@media (forced-colors:active){[part~=base],[part~=base][data-scroll-overflow],:host(:dir(rtl)) [part~=base][data-scroll-overflow],:host([data-effective-orientation=horizontal]) [part~=base][data-scroll-overflow],:host(:dir(rtl)[data-effective-orientation=horizontal]) [part~=base][data-scroll-overflow]{-webkit-mask-image:none;mask-image:none}}:host [part~=base].child-steps{gap:0;padding-inline:0;overflow-x:visible;overflow-y:visible;-webkit-mask-image:none;mask-image:none}:host([orientation=vertical]) ::slotted(*),:host([data-effective-orientation=vertical]) ::slotted(*){flex:0 0 auto}:host([data-effective-orientation=horizontal]) ::slotted(*){flex:1 1 0}${forcedColorsPart('[part="step"][aria-current="step"]')} `;export{styles};
|
|
@@ -103,6 +103,7 @@ readonly previousValue:string;}export interface LyraTabGroupEventMap{'lr-tab-gro
|
|
|
103
103
|
* @csspart tablist - The `role="tablist"` row of tab buttons.
|
|
104
104
|
* @csspart scroll-button - Shared part on both overflow scroll controls.
|
|
105
105
|
* @csspart scroll-button__base - Export-compatible base name on both scroll controls.
|
|
106
|
+
* @csspart scroll-button__button - Upstream name for the inner native button of a scroll control; on the same node as `scroll-button`.
|
|
106
107
|
* @csspart scroll-button-start - The control that scrolls the tabs toward their inline start ("previous" — the right-hand control under RTL).
|
|
107
108
|
* @csspart scroll-button-end - The control that scrolls the tabs toward their inline end ("next" — the left-hand control under RTL).
|
|
108
109
|
* @csspart scroll-button--start - Upstream modifier alias on `scroll-button-start`.
|
|
@@ -113,7 +114,15 @@ readonly previousValue:string;}export interface LyraTabGroupEventMap{'lr-tab-gro
|
|
|
113
114
|
* @csspart active-tab-indicator - Indicator inside the active tab.
|
|
114
115
|
* @cssprop --indicator-color - Upstream alias for the active indicator color.
|
|
115
116
|
* @cssprop --track-color - Upstream track color.
|
|
116
|
-
* @cssprop --track-width - Upstream track width.
|
|
117
|
+
* @cssprop --track-width - Upstream track width. Wins over `--lr-tab-group-track-width`.
|
|
118
|
+
* @cssprop [--lr-tab-group-track-width=var(--lr-border-width-thin)] - Width of the track rule along
|
|
119
|
+
* the tab strip, on whichever edge `placement` puts it. The selected underline overlaps it
|
|
120
|
+
* exactly.
|
|
121
|
+
* @cssprop [--lr-tab-group-tab-padding=var(--lr-space-s) var(--lr-space-xs)] - Padding of each tab
|
|
122
|
+
* button.
|
|
123
|
+
* @cssprop [--lr-tab-group-tab-font-size=inherit] - Font size of each tab button.
|
|
124
|
+
* @cssprop [--lr-tab-group-tab-min-block-size=auto] - Minimum block size of each tab button, for a
|
|
125
|
+
* taller touch-friendly strip.
|
|
117
126
|
* @cssprop [--lr-scroll-fade-size=2rem] - Width of the fade at each horizontal scroll edge. The
|
|
118
127
|
* fade is applied only while the tablist actually overflows, so a row that fits is never dimmed.
|
|
119
128
|
* @cssprop [--lr-tab-group-selected-color=var(--lr-color-brand)] - Text color of the selected tab.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{__decorate}from"tslib";import{OwnedMutationObserver}from"../../../internal/owned-observer.js";import{resolveIdReferencesIn}from"../../../internal/aria-reflection.js";import{HostDescriptionController}from"../../../internal/aria-controls.js";import{declaredDefaultConverter}from"../../../internal/converters.js";import{html,nothing}from"lit";import{property,query,state}from"lit/decorators.js";import{repeat}from"lit/directives/repeat.js";import{LyraElement}from"../../../internal/lyra-element.js";import{resolveAccessibleName}from"../../../internal/accessible-name.js";import{capturePointer,releasePointer}from"../../../internal/pointer-capture.js";import{resolveListMove,isRepeatedActivationKey,shouldIgnoreNavigationKey}from"../../../internal/list-navigation.js";import{hostAriaLabel,nextId}from"../../../internal/a11y.js";import{asciiWhitespaceTokens}from"../../../internal/ascii-whitespace.js";import{subscribeInheritedAttributes}from"../../../internal/inherited-attribute-hub.js";import{composedAccessibilityText,isHostLayoutRendered,labelReferenceRecordsMatter}from"../../../internal/accessibility-visibility.js";import{CustomElementUpgradeObserver}from"../../../internal/custom-element-upgrade-observer.js";import{isHtmlElement}from"../../../internal/dom-guards.js";import{chevronIcon,closeIcon}from"../../../internal/icons.js";import{motionScrollBehavior}from"../../../internal/motion.js";import{tag}from"../../../internal/prefix.js";import{observeScrollOverflow}from"../../../internal/scroll-overflow.js";import{scrollOverflowFadeStyles}from"../../../internal/scroll-overflow.styles.js";import{styles}from"./tab-group.styles.js";import{shadowFocusTarget}from"../../../internal/active-element.js";import{applyComposedFocusRepair,captureComposedFocusRepair}from"../../../internal/focus-navigation.js";import{requestThenCommit}from"../../../internal/request-commit.js";import{markVetoGuardWrite,VetoWriteGuard}from"../../../internal/veto-write-guard.js";import{LYRA_DEFAULT_scrollNext,LYRA_DEFAULT_scrollPrevious,LYRA_DEFAULT_tabCloseAction}from"../../../internal/default-strings/layout.generated.js";function isInertChild(child){return isHtmlElement(child)&&child.inert}function isTabLabelSubtreeExcludedWithoutInert(element){if(element.hasAttribute("hidden")||element.getAttribute("aria-hidden")?.trim().toLowerCase()==="true")return!0;const rendered=element.ownerDocument.defaultView?.getComputedStyle(element);return rendered?.display==="none"||rendered?.contentVisibility==="hidden"}const SYNTHETIC_PANEL_PREFIX="lr-tab-",SCROLL_STEP_RATIO=.8;class LyraTabGroup extends LyraElement{constructor(){super(...arguments),this.hostDescription=new HostDescriptionController(this,()=>this.renderRoot.querySelector('[part~="tablist"]')),this.selectGuard=new VetoWriteGuard,this._active="",this.accessibleLabel=null,this.placement="top",this.fillBody=!1,this.activation="auto",this.withoutScrollControls=!1,this.noScrollControls=!1,this.fixedScrollControls=!1,this.tabs=[],this.focusedTab="",this.baseId=nextId("tab-group"),this.nextOpaqueId=0,this.idsBySlot=new Map,this.mutationObserver=new OwnedMutationObserver(this,records=>{const isDirectChild=node=>node.parentNode===this,isElementTabContent=node=>{let current=node.nodeType===1?node:node.parentElement;for(;current&¤t!==this;){if(current.localName===tag("tab")&¤t.parentNode===this)return!0;current=current.parentElement}return!1},relevant=records.some(record=>{if(record.type==="childList")return record.target===this||isElementTabContent(record.target);if(record.type==="characterData")return isElementTabContent(record.target);if(record.attributeName==="inert"&&this.projectedSourceSnapshots.has(record.target)||record.attributeName==="inert"&&this.restoredSourceInertWrites.has(record.target)&&record.target.getAttribute("inert")===this.restoredSourceInertWrites.get(record.target))return!1;if(record.attributeName==="slot"){if(this.restoredSlotWrites.has(record.target)&&record.target.getAttribute("slot")===this.restoredSlotWrites.get(record.target))return!1;const snapshot=this.projectedSlotSnapshots.get(record.target);if(snapshot&&record.target.getAttribute("slot")===snapshot.appliedSlot)return!1}return isDirectChild(record.target)||isElementTabContent(record.target)});this.restoredSourceInertWrites.clear(),this.restoredSlotWrites.clear(),relevant&&(this.excludedUnnamedDescriptors.clear(),this.syncTabs())}),this.projectionGeneration=0,this.projectionPending=!1,this.stagingSlotName="tab-group-sources",this.pendingDescriptorUpdates=new WeakSet,this.excludedUnnamedDescriptors=new Set,this.descriptorUpgrades=new CustomElementUpgradeObserver(()=>{this.excludedUnnamedDescriptors.clear(),this.queueProjectionReconciliation()}),this.restoredSourceInertWrites=new Map,this.restoredSlotWrites=new Map,this.projectedSourceSnapshots=new Map,this.projectedSlotSnapshots=new Map,this.projectedSourceObserver=new OwnedMutationObserver(this,()=>this.syncTabs()),this.labelIds=new Set,this.labelTargets=new Set,this.rehomeTabFocus=!1,this.panelFocusRepair=null,this.scrollStartAvailable=!1,this.scrollEndAvailable=!1,this.scrollOverflow=observeScrollOverflow(this,()=>this.renderRoot.querySelector('[part~="tablist"]'),()=>this.measureTabScrollEdges()),this.queueProjectionReconciliation=()=>{if(!this.isConnected||this.projectionTimer!==void 0)return;const ownerDocument=this.ownerDocument,ownerWindow=ownerDocument.defaultView;if(!ownerWindow)return;const generation=this.projectionGeneration;this.beginProjectionSettlement(),this.projectionTimerWindow=ownerWindow,this.projectionTimer=ownerWindow.setTimeout(()=>{generation!==this.projectionGeneration||this.ownerDocument!==ownerDocument||!this.isConnected||(this.projectionTimer=void 0,this.projectionTimerWindow=void 0,this.updateBrowserDerivedState(this.syncTabs))},0)},this.syncTabs=()=>{const children=Array.from(this.children);this.adoptProjectedSourceInertStates(),this.adoptProjectedSlotStates();const projectedSlots=new Set,wasPending=this.projectionPending;this.labelIds.clear(),this.labelTargets.clear();const next=this.readElementModel(children,projectedSlots);this.observeLabelReferences(),this.syncProjectedSlots(projectedSlots),this.syncProjectedSources(next.filter(tab=>tab.element.parentNode===this));const liveSlots=new Set(next.map(tab=>tab.slotName));for(const slotName of this.idsBySlot.keys())liveSlots.has(slotName)||this.idsBySlot.delete(slotName);(next.length!==this.tabs.length||wasPending&&!this.projectionPending||next.some((tab,index)=>{const previous=this.tabs[index];return tab.element!==previous.element||tab.slotName!==previous.slotName||tab.panel!==previous.panel||tab.label!==previous.label||tab.disabled!==previous.disabled||tab.inert!==previous.inert}))&&(this.tabs=next),this.projectionPending||this.projectionTimer!==void 0?this.beginProjectionSettlement():this.settleProjection()},this.onTabListKeyDown=e=>{if(e.defaultPrevented||shouldIgnoreNavigationKey(e))return;const navigable=this.tabs.filter(t=>this.isNavigable(t));if(navigable.length===0)return;const origin=this.keyboardOriginTab(e,navigable),currentIndex=origin?navigable.indexOf(origin):-1;if(e.key==="Delete"){if(!origin?.element.closable||(e.preventDefault(),isRepeatedActivationKey(e)))return;origin.element.requestCloseFromOwner();return}if(this.activation==="manual"&&(e.key==="Enter"||e.key===" "||e.key==="Spacebar")){if(!origin||(e.preventDefault(),isRepeatedActivationKey(e)))return;this.activateTab(origin);return}const targetIndex=resolveListMove(e,{count:navigable.length,current:currentIndex,orientation:this.isVertical?"vertical":"horizontal",direction:this.effectiveDirection});if(targetIndex===null)return;e.preventDefault();const target=navigable[targetIndex];if(this.activation==="manual"){this.focusOnly(target);return}this.activateTab(target)&&this.focusTabButton(target.slotName)},this.onTabListScroll=()=>{this.measureTabScrollEdges()},this.onScrollControlMouseDown=event=>{event.preventDefault()},this.onScrollControlPointerDown=event=>{const control=event.currentTarget;control.setAttribute("data-pressed",""),capturePointer(control,event.pointerId)},this.onScrollControlPointerEnd=event=>{const control=event.currentTarget;control.removeAttribute("data-pressed"),releasePointer(control,event.pointerId)}}static{this.defaultStrings={...super.defaultStrings,scrollNext:LYRA_DEFAULT_scrollNext,scrollPrevious:LYRA_DEFAULT_scrollPrevious,tabCloseAction:LYRA_DEFAULT_tabCloseAction}}static{this.styles=[LyraElement.styles,scrollOverflowFadeStyles,styles]}get active(){return this._active}set active(value){markVetoGuardWrite(this.selectGuard),this._active=value}connectedCallback(){super.connectedCallback(),this.hasUpdated?this.syncTabs():this.seedFirstRenderState(this.syncTabs),this.mutationObserver.observe(this,{childList:!0,subtree:!0,attributes:!0,characterData:!0,attributeFilter:["alt","aria-hidden","aria-label","aria-labelledby","class","closable","disabled","hidden","inert","id","label","name","open","panel","slot","style"]})}disconnectedCallback(){this.stopLabelObservation?.(),this.stopLabelObservation=void 0,this.labelTargets.clear(),this.resetProjectionReconciliation(),this.mutationObserver.clear(),this.projectedSourceObserver.clear(),this.restoreProjectedSources(),this.restoreProjectedSlots(),super.disconnectedCallback()}adoptedCallback(){super.adoptedCallback(),this.hostDescription.adopted(),this.mutationObserver.clear(),this.projectedSourceObserver.clear(),this.resetProjectionReconciliation()}resetProjectionReconciliation(){this.projectionGeneration+=1,this.projectionTimer!==void 0&&this.projectionTimerWindow?.clearTimeout(this.projectionTimer),this.projectionTimer=void 0,this.projectionTimerWindow=void 0,this.projectionPending=!1,this.pendingDescriptorUpdates=new WeakSet,this.descriptorUpgrades.disconnect(),this.restoredSourceInertWrites.clear(),this.restoredSlotWrites.clear(),this.excludedUnnamedDescriptors.clear(),this.settleProjection()}beginProjectionSettlement(){this.projectionSettlement||(this.projectionSettlement=new Promise(resolve=>{this.resolveProjectionSettlement=resolve}))}settleProjection(){const resolve=this.resolveProjectionSettlement;this.resolveProjectionSettlement=void 0,this.projectionSettlement=void 0,resolve?.()}async getUpdateComplete(){const generation=this.projectionGeneration,ownerDocument=this.ownerDocument;let complete=await super.getUpdateComplete();if(this.renderSlotPresence(!1)||!ownerDocument.defaultView)return complete;const current=()=>this.isConnected&&generation===this.projectionGeneration&&this.ownerDocument===ownerDocument;for(;current();){const settlement=this.projectionSettlement;if(settlement){if(await settlement,!current())return complete;complete=await super.getUpdateComplete()}else if(this.isUpdatePending)complete=await super.getUpdateComplete();else return complete}return complete}waitForDescriptorUpdate(tab){if(tab.hasUpdated===!0)return!1;const updateComplete=tab.updateComplete;if(updateComplete==null)return this.descriptorUpgrades.observeElement(tab),!1;if(!this.pendingDescriptorUpdates.has(tab)){this.pendingDescriptorUpdates.add(tab);const generation=this.projectionGeneration,ownerDocument=this.ownerDocument;updateComplete.then(()=>{generation===this.projectionGeneration&&this.ownerDocument===ownerDocument&&(this.pendingDescriptorUpdates.delete(tab),tab.parentNode===this&&this.queueProjectionReconciliation())})}return!0}readElementModel(children,projectedSlots){this.projectionPending=!1;const seen=new Set,next=[],panelsByName=new Map;for(const child of children){if(child.localName!==tag("tab-panel"))continue;const name=child.getAttribute("name");name!==null&&!panelsByName.has(name)&&panelsByName.set(name,child)}const authoredNames=new Set(children.flatMap(child=>{if(child.localName===tag("tab")){const name=child.getAttribute("panel");return name?[name]:[]}if(child.localName===tag("tab-panel")){const name=child.getAttribute("name");return name?[name]:[]}return[]}));let stagingName="tab-group-sources";for(;authoredNames.has(stagingName);)stagingName+="-sources";this.stagingSlotName=stagingName;let index=0;for(const child of children){if(child.localName!==tag("tab"))continue;const authoredPanel=child.getAttribute("panel")||void 0;let slotName=authoredPanel??`${SYNTHETIC_PANEL_PREFIX}${index}`;if(!authoredPanel){let collision=0;for(;authoredNames.has(slotName)||seen.has(slotName);)collision+=1,slotName=`${SYNTHETIC_PANEL_PREFIX}${index}-${collision}`}if(index+=1,seen.has(slotName))continue;seen.add(slotName);const tabSlot=this.tabSlotName(slotName),assignedSlot=child.assignedSlot,assignedHere=assignedSlot?.getRootNode()===this.renderRoot&&(assignedSlot.name===tabSlot||assignedSlot.name===this.stagingSlotName);if(!assignedHere||!authoredPanel&&this.excludedUnnamedDescriptors.has(child)){this.projectSlot(child,this.stagingSlotName,projectedSlots),assignedHere||(this.projectionPending=!0);continue}if(this.waitForDescriptorUpdate(child)){this.projectionPending=!0,this.projectSlot(child,this.stagingSlotName,projectedSlots);continue}const visibleLabel=this.readElementLabel(child);if(!authoredPanel&&!visibleLabel){this.excludedUnnamedDescriptors.add(child),this.projectSlot(child,this.stagingSlotName,projectedSlots);continue}projectedSlots.add(child);const label=visibleLabel||slotName,panel=panelsByName.get(slotName);panel&&this.projectSlot(panel,slotName,projectedSlots),next.push({slotName,panel:authoredPanel??"",label,disabled:child.hasAttribute("disabled"),inert:isInertChild(child),element:child}),!this.active&&child.hasAttribute("active")&&(this.active=slotName)}if(this.projectionPending){for(const child of children)this.projectedSlotSnapshots.has(child)&&projectedSlots.add(child);return this.tabs}for(const tab of next)this.projectSlot(tab.element,this.tabSlotName(tab.slotName),projectedSlots);return next}readElementLabel(tab){const labelledBy=tab.getAttribute("aria-labelledby");if(labelledBy)for(const id of asciiWhitespaceTokens(labelledBy))this.labelIds.add(id);const references=resolveIdReferencesIn(tab.getRootNode(),labelledBy);for(const reference of references)this.labelTargets.add(reference);const referenced=references.map(node=>composedAccessibilityText(node)).join(" ").trim(),explicit=tab.getAttribute("aria-label")?.trim();if(referenced)return referenced;if(explicit)return explicit;const labelNodes=Array.from(tab.childNodes).filter(node=>node.nodeType!==Node.ELEMENT_NODE||node.getAttribute("slot")===null||node.getAttribute("slot")==="");return composedAccessibilityText(labelNodes,{ancestorBoundary:tab,isSubtreeExcluded:element=>this.isTabLabelSubtreeExcluded(element),ignoreInheritedVisibility:!0,requireRendered:isHostLayoutRendered(this)}).replace(/\s+/g," ").trim()}libraryOwnsSourceInert(element){return this.projectedSourceSnapshots.get(element)?.libraryOwnsInert===!0}isTabLabelSubtreeExcluded(element){return isTabLabelSubtreeExcludedWithoutInert(element)||element.hasAttribute("inert")&&!this.libraryOwnsSourceInert(element)}snapshotProjectedSource(source){const inert=source.getAttribute("inert");return{inert,appliedInert:inert,libraryOwnsInert:!1}}adoptProjectedSourceInert(source,snapshot){const current=source.getAttribute("inert");current!==snapshot.appliedInert&&(snapshot.inert=current,snapshot.libraryOwnsInert=!1)}makeProjectedSourceInert(source,snapshot){source.hasAttribute("inert")||(source.setAttribute("inert",""),snapshot.libraryOwnsInert=!0),snapshot.appliedInert=source.getAttribute("inert")}restoreProjectedSource(source,snapshot){this.adoptProjectedSourceInert(source,snapshot);const before=source.getAttribute("inert");snapshot.inert===null?source.removeAttribute("inert"):source.setAttribute("inert",snapshot.inert),this.mutationObserver.active&&this.contains(source)&&source.getAttribute("inert")!==before&&this.restoredSourceInertWrites.set(source,source.getAttribute("inert"))}restoreProjectedSources(){for(const[source,snapshot]of this.projectedSourceSnapshots)this.restoreProjectedSource(source,snapshot);this.projectedSourceSnapshots.clear()}observeLabelReferences(){this.labelIds.size?this.stopLabelObservation||(this.stopLabelObservation=subscribeInheritedAttributes(this.getRootNode(),this.ownerDocument.defaultView?.MutationObserver,{attributes:["id","aria-label","aria-hidden","hidden","class","style"],characterData:!0,childList:!0,changed:records=>{(records.some(record=>Array.from(this.labelTargets).some(target=>target.contains(record.target)))||labelReferenceRecordsMatter(records,this.labelIds,this.labelTargets))&&this.syncTabs()}})):(this.stopLabelObservation?.(),this.stopLabelObservation=void 0)}projectedSources(tabs){const sources=new Set;for(const tab of tabs)for(const child of Array.from(tab.element.children))(child.getAttribute("slot")??"")===""&&sources.add(child);return sources}syncProjectedSources(tabs){const sources=this.projectedSources(tabs);for(const[source,snapshot]of this.projectedSourceSnapshots)this.adoptProjectedSourceInert(source,snapshot),sources.has(source)||(this.restoreProjectedSource(source,snapshot),this.projectedSourceSnapshots.delete(source));for(const source of sources){const snapshot=this.projectedSourceSnapshots.get(source)??this.snapshotProjectedSource(source);this.projectedSourceSnapshots.set(source,snapshot),this.adoptProjectedSourceInert(source,snapshot),this.makeProjectedSourceInert(source,snapshot)}this.projectedSourceObserver.clear();for(const source of sources)this.projectedSourceObserver.observe(source,{attributeFilter:["inert"]})}adoptProjectedSourceInertStates(){for(const[source,snapshot]of this.projectedSourceSnapshots)this.adoptProjectedSourceInert(source,snapshot)}snapshotProjectedSlot(source){const slot=source.getAttribute("slot");return{slot,appliedSlot:slot,libraryOwnsSlot:!1}}adoptProjectedSlot(source,snapshot){const current=source.getAttribute("slot");current!==snapshot.appliedSlot&&(snapshot.slot=current,snapshot.libraryOwnsSlot=!1)}projectSlot(source,slot,projectedSlots){const snapshot=this.projectedSlotSnapshots.get(source)??this.snapshotProjectedSlot(source);this.projectedSlotSnapshots.set(source,snapshot),this.adoptProjectedSlot(source,snapshot),source.getAttribute("slot")!==slot&&(source.setAttribute("slot",slot),snapshot.libraryOwnsSlot=!0),snapshot.appliedSlot=source.getAttribute("slot"),projectedSlots.add(source)}restoreProjectedSlot(source,snapshot){this.adoptProjectedSlot(source,snapshot);const before=source.getAttribute("slot");snapshot.slot===null?source.removeAttribute("slot"):source.setAttribute("slot",snapshot.slot),this.mutationObserver.active&&this.contains(source)&&source.getAttribute("slot")!==before&&this.restoredSlotWrites.set(source,source.getAttribute("slot"))}syncProjectedSlots(projectedSlots){for(const[source,snapshot]of this.projectedSlotSnapshots)projectedSlots.has(source)||(this.restoreProjectedSlot(source,snapshot),this.projectedSlotSnapshots.delete(source))}restoreProjectedSlots(){for(const[source,snapshot]of this.projectedSlotSnapshots)this.restoreProjectedSlot(source,snapshot);this.projectedSlotSnapshots.clear()}adoptProjectedSlotStates(){for(const[source,snapshot]of this.projectedSlotSnapshots)this.adoptProjectedSlot(source,snapshot)}isNavigable(tab){return!tab.disabled&&!tab.inert}willUpdate(changed){if(super.willUpdate(changed),this.projectionPending||!changed.has("tabs")&&!changed.has("active"))return;if(this.hasUpdated){const shown=this.renderRoot.querySelector('[part="panel"]:not([hidden])');this.panelFocusRepair=shown?captureComposedFocusRepair(shown,shown):null}const focused=shadowFocusTarget(this),focusedSlot=focused?.getAttribute("part")==="tab"?focused.getAttribute("data-slot"):null;focusedSlot!==null&&!this.tabs.some(tab=>tab.slotName===focusedSlot&&this.isNavigable(tab))&&(this.rehomeTabFocus=!0,this.focusedTab=this.active);const current=this.tabs.find(t=>t.slotName===this.active);if(current&&this.isNavigable(current))return;this.rehomeTabFocus=this.rehomeTabFocus||focusedSlot!==null;const outgoing=this.active,before=changed.get("tabs")??this.tabs,at=this.hasUpdated&&changed.has("tabs")&&!changed.has("active")?before.findIndex(t=>t.slotName===outgoing):-1,renamed=at<0?void 0:this.tabs.find(t=>t.element===before[at].element&&this.isNavigable(t));let candidates=this.tabs;if(at>=0){const liveByName=new Map;for(const tab of this.tabs)liveByName.has(tab.slotName)||liveByName.set(tab.slotName,tab);candidates=[...before.slice(at+1),...before.slice(0,at).reverse()].map(tab=>liveByName.get(tab.slotName))}if(this.active=(renamed??candidates.find(t=>t&&this.isNavigable(t)))?.slotName??"",this.focusedTab=this.active,at>=0&&!renamed){const incoming=this.tabs.find(tab=>tab.slotName===this.active);this.scheduleAfterUpdate(()=>{this.emit("lr-tab-hide",{name:outgoing}),incoming&&this.isCurrentTab(incoming)&&this.emit("lr-tab-show",{name:incoming.slotName})},"tab-self-correction")}}updated(changed){super.updated(changed),changed.has("tabs")&&this.queueProjectionReconciliation(),!this.projectionPending&&(changed.has("active")||changed.has("tabs"))&&this.syncElementActiveState(),this.scrollOverflow.observeExtra(this.renderRoot.querySelectorAll('[part="tab"]')),this.measureTabScrollEdges();const panelFocus=this.panelFocusRepair;this.panelFocusRepair=null,panelFocus?.owner.hasAttribute("hidden")&&applyComposedFocusRepair(panelFocus,()=>[this.renderRoot.querySelector('[part="tab"][tabindex="0"]'),this.renderRoot.querySelector('[part="panel"]:not([hidden])')]),this.rehomeTabFocus&&(this.rehomeTabFocus=!1,this.renderRoot.querySelector('[part="tab"][tabindex="0"]')?.focus())}isCurrentTab(tab){return this.isConnected&&this.active===tab.slotName&&tab.element.parentElement===this&&tab.element.panel===tab.panel&&!tab.element.disabled&&!isInertChild(tab.element)}selectTab(tab){if(!this.isNavigable(tab)||tab.slotName===this.active)return;const previous=this.active;this.active=tab.slotName,this.focusedTab=tab.slotName,previous&&this.emit("lr-tab-hide",{name:previous}),this.isCurrentTab(tab)&&this.emit("lr-tab-show",{name:tab.slotName})}activateTab(tab){return!this.isNavigable(tab)||tab.slotName!==this.active&&(requestThenCommit({requestDetail:{value:tab.slotName,previousValue:this.active},emitRequest:(detail,init)=>this.emit("lr-tab-group-select-request",detail,init),guard:this.selectGuard,commit:()=>this.selectTab(tab)}).defaultPrevented||this.active!==tab.slotName)?!1:(this.isCurrentTab(tab)&&this.emit("lr-activate",{value:tab.slotName}),!0)}show(panel){const tab=this.tabs.find(candidate=>candidate.slotName===panel);tab&&this.selectTab(tab)}syncElementActiveState(){const definitions=new Map;for(const tab of this.tabs)definitions.has(tab.element)||definitions.set(tab.element,tab);for(const child of Array.from(this.children))if(child.localName===tag("tab")){const definition=definitions.get(child);child.toggleAttribute("active",definition?.slotName===this.active)}else child.localName===tag("tab-panel")&&child.toggleAttribute("active",child.getAttribute("name")===this.active)}focusOnly(tab){this.focusedTab=tab.slotName,this.focusTabButton(tab.slotName)}get rovingTab(){if(this.activation!=="manual")return this.active;const candidate=this.tabs.find(t=>t.slotName===this.focusedTab&&this.isNavigable(t));return candidate?candidate.slotName:this.active}keyboardOriginTab(event,navigable){const eventButton=event.composedPath().find(candidate=>candidate.nodeType===1&&candidate.getAttribute?.("part")==="tab"&&candidate.getRootNode()===this.renderRoot),focused=shadowFocusTarget(this),owned=(eventButton??(focused?.getAttribute("part")==="tab"?focused:void 0))?.dataset.slot;return navigable.find(tab=>tab.slotName===owned)??navigable.find(tab=>tab.slotName===this.rovingTab)}focusTabButton(slotName,options){const button=this.tabButton(slotName);return button?(button.focus(options),!0):!1}tabButton(slotName){const buttons=this.renderRoot.querySelectorAll('[part="tab"]');return Array.from(buttons).find(button=>button.dataset.slot===slotName)}focusTab(panel,options){const tab=this.tabs.find(candidate=>candidate.slotName===panel);return tab?this.focusTabDefinition(tab,options):!1}focusTabElement(element,options){const tab=this.tabs.find(candidate=>candidate.element===element);return tab?this.focusTabDefinition(tab,options):!1}blurTabElement(element){const tab=this.tabs.find(candidate=>candidate.element===element),button=tab?this.tabButton(tab.slotName):void 0;button&&shadowFocusTarget(this)===button&&button.blur()}focusTabDefinition(tab,options){return this.isNavigable(tab)?(this.activation==="manual"?this.focusedTab=tab.slotName:this.selectTab(tab),this.focusTabButton(tab.slotName,options)):!1}get isVertical(){return this.placement==="start"||this.placement==="end"}tabId(slotName){return this.idsFor(slotName).tab}panelId(slotName){return this.idsFor(slotName).panel}idsFor(slotName){const existing=this.idsBySlot.get(slotName);if(existing)return existing;const token=`${this.baseId}-${this.nextOpaqueId++}`,ids={tab:`${token}-tab`,panel:`${token}-panel`};return this.idsBySlot.set(slotName,ids),ids}tabSlotName(slotName){return`${slotName}-tab`}get scrollControlsSuppressed(){return this.withoutScrollControls||this.noScrollControls}measureTabScrollEdges(){const tablist=this.renderRoot.querySelector('[part~="tablist"]');if(!tablist||this.isVertical){this.setTabScrollEdges(!1,!1,tablist);return}const maximum=Math.max(0,tablist.scrollWidth-tablist.clientWidth),position=Math.max(0,Math.min(maximum,this.effectiveDirection==="rtl"?-tablist.scrollLeft:tablist.scrollLeft));this.setTabScrollEdges(position>1,position<maximum-1,tablist)}setTabScrollEdges(start,end,tablist){tablist?.toggleAttribute("data-scroll-start",start),tablist?.toggleAttribute("data-scroll-end",end),!(start===this.scrollStartAvailable&&end===this.scrollEndAvailable)&&(this.scrollStartAvailable=start,this.scrollEndAvailable=end)}scrollTabs(edge){const tablist=this.renderRoot.querySelector('[part~="tablist"]');if(!tablist||!isHtmlElement(tablist)||typeof tablist.scrollBy!="function")return;const step=Math.max(1,tablist.clientWidth*SCROLL_STEP_RATIO),towardEnd=edge==="end"?1:-1,physical=this.effectiveDirection==="rtl"?-towardEnd:towardEnd;tablist.scrollBy({left:step*physical,behavior:motionScrollBehavior(this)})}renderScrollControl(edge){if(this.isVertical||this.scrollControlsSuppressed)return nothing;const available=edge==="start"?this.scrollStartAvailable:this.scrollEndAvailable;return html`<button type="button" part=${edge==="start"?"scroll-button scroll-button__base scroll-button-start scroll-button--start":"scroll-button scroll-button__base scroll-button-end scroll-button--end"} tabindex="-1" aria-hidden="true" ?hidden=${!this.fixedScrollControls&&!available} data-inactive=${available?nothing:""} aria-label=${edge==="start"?this.localize("scrollPrevious"):this.localize("scrollNext")} @pointerdown=${this.onScrollControlPointerDown} @pointerup=${this.onScrollControlPointerEnd} @pointercancel=${this.onScrollControlPointerEnd} @lostpointercapture=${this.onScrollControlPointerEnd} @mousedown=${this.onScrollControlMouseDown} @click=${()=>{available&&this.scrollTabs(edge)}} >
|
|
1
|
+
import{__decorate}from"tslib";import{OwnedMutationObserver}from"../../../internal/owned-observer.js";import{resolveIdReferencesIn}from"../../../internal/aria-reflection.js";import{HostDescriptionController}from"../../../internal/aria-controls.js";import{declaredDefaultConverter}from"../../../internal/converters.js";import{html,nothing}from"lit";import{property,query,state}from"lit/decorators.js";import{repeat}from"lit/directives/repeat.js";import{LyraElement}from"../../../internal/lyra-element.js";import{resolveAccessibleName}from"../../../internal/accessible-name.js";import{capturePointer,releasePointer}from"../../../internal/pointer-capture.js";import{resolveListMove,isRepeatedActivationKey,shouldIgnoreNavigationKey}from"../../../internal/list-navigation.js";import{hostAriaLabel,nextId}from"../../../internal/a11y.js";import{asciiWhitespaceTokens}from"../../../internal/ascii-whitespace.js";import{subscribeInheritedAttributes}from"../../../internal/inherited-attribute-hub.js";import{composedAccessibilityText,isHostLayoutRendered,labelReferenceRecordsMatter}from"../../../internal/accessibility-visibility.js";import{CustomElementUpgradeObserver}from"../../../internal/custom-element-upgrade-observer.js";import{isHtmlElement}from"../../../internal/dom-guards.js";import{chevronIcon,closeIcon}from"../../../internal/icons.js";import{motionScrollBehavior}from"../../../internal/motion.js";import{tag}from"../../../internal/prefix.js";import{observeScrollOverflow}from"../../../internal/scroll-overflow.js";import{scrollOverflowFadeStyles}from"../../../internal/scroll-overflow.styles.js";import{styles}from"./tab-group.styles.js";import{shadowFocusTarget}from"../../../internal/active-element.js";import{applyComposedFocusRepair,captureComposedFocusRepair}from"../../../internal/focus-navigation.js";import{requestThenCommit}from"../../../internal/request-commit.js";import{markVetoGuardWrite,VetoWriteGuard}from"../../../internal/veto-write-guard.js";import{LYRA_DEFAULT_scrollNext,LYRA_DEFAULT_scrollPrevious,LYRA_DEFAULT_tabCloseAction}from"../../../internal/default-strings/layout.generated.js";function isInertChild(child){return isHtmlElement(child)&&child.inert}function isTabLabelSubtreeExcludedWithoutInert(element){if(element.hasAttribute("hidden")||element.getAttribute("aria-hidden")?.trim().toLowerCase()==="true")return!0;const rendered=element.ownerDocument.defaultView?.getComputedStyle(element);return rendered?.display==="none"||rendered?.contentVisibility==="hidden"}const SYNTHETIC_PANEL_PREFIX="lr-tab-",SCROLL_STEP_RATIO=.8;class LyraTabGroup extends LyraElement{constructor(){super(...arguments),this.hostDescription=new HostDescriptionController(this,()=>this.renderRoot.querySelector('[part~="tablist"]')),this.selectGuard=new VetoWriteGuard,this._active="",this.accessibleLabel=null,this.placement="top",this.fillBody=!1,this.activation="auto",this.withoutScrollControls=!1,this.noScrollControls=!1,this.fixedScrollControls=!1,this.tabs=[],this.focusedTab="",this.baseId=nextId("tab-group"),this.nextOpaqueId=0,this.idsBySlot=new Map,this.mutationObserver=new OwnedMutationObserver(this,records=>{const isDirectChild=node=>node.parentNode===this,isElementTabContent=node=>{let current=node.nodeType===1?node:node.parentElement;for(;current&¤t!==this;){if(current.localName===tag("tab")&¤t.parentNode===this)return!0;current=current.parentElement}return!1},relevant=records.some(record=>{if(record.type==="childList")return record.target===this||isElementTabContent(record.target);if(record.type==="characterData")return isElementTabContent(record.target);if(record.attributeName==="inert"&&this.projectedSourceSnapshots.has(record.target)||record.attributeName==="inert"&&this.restoredSourceInertWrites.has(record.target)&&record.target.getAttribute("inert")===this.restoredSourceInertWrites.get(record.target))return!1;if(record.attributeName==="slot"){if(this.restoredSlotWrites.has(record.target)&&record.target.getAttribute("slot")===this.restoredSlotWrites.get(record.target))return!1;const snapshot=this.projectedSlotSnapshots.get(record.target);if(snapshot&&record.target.getAttribute("slot")===snapshot.appliedSlot)return!1}return isDirectChild(record.target)||isElementTabContent(record.target)});this.restoredSourceInertWrites.clear(),this.restoredSlotWrites.clear(),relevant&&(this.excludedUnnamedDescriptors.clear(),this.syncTabs())}),this.projectionGeneration=0,this.projectionPending=!1,this.stagingSlotName="tab-group-sources",this.pendingDescriptorUpdates=new WeakSet,this.excludedUnnamedDescriptors=new Set,this.descriptorUpgrades=new CustomElementUpgradeObserver(()=>{this.excludedUnnamedDescriptors.clear(),this.queueProjectionReconciliation()}),this.restoredSourceInertWrites=new Map,this.restoredSlotWrites=new Map,this.projectedSourceSnapshots=new Map,this.projectedSlotSnapshots=new Map,this.projectedSourceObserver=new OwnedMutationObserver(this,()=>this.syncTabs()),this.labelIds=new Set,this.labelTargets=new Set,this.rehomeTabFocus=!1,this.panelFocusRepair=null,this.scrollStartAvailable=!1,this.scrollEndAvailable=!1,this.scrollOverflow=observeScrollOverflow(this,()=>this.renderRoot.querySelector('[part~="tablist"]'),()=>this.measureTabScrollEdges()),this.queueProjectionReconciliation=()=>{if(!this.isConnected||this.projectionTimer!==void 0)return;const ownerDocument=this.ownerDocument,ownerWindow=ownerDocument.defaultView;if(!ownerWindow)return;const generation=this.projectionGeneration;this.beginProjectionSettlement(),this.projectionTimerWindow=ownerWindow,this.projectionTimer=ownerWindow.setTimeout(()=>{generation!==this.projectionGeneration||this.ownerDocument!==ownerDocument||!this.isConnected||(this.projectionTimer=void 0,this.projectionTimerWindow=void 0,this.updateBrowserDerivedState(this.syncTabs))},0)},this.syncTabs=()=>{const children=Array.from(this.children);this.adoptProjectedSourceInertStates(),this.adoptProjectedSlotStates();const projectedSlots=new Set,wasPending=this.projectionPending;this.labelIds.clear(),this.labelTargets.clear();const next=this.readElementModel(children,projectedSlots);this.observeLabelReferences(),this.syncProjectedSlots(projectedSlots),this.syncProjectedSources(next.filter(tab=>tab.element.parentNode===this));const liveSlots=new Set(next.map(tab=>tab.slotName));for(const slotName of this.idsBySlot.keys())liveSlots.has(slotName)||this.idsBySlot.delete(slotName);(next.length!==this.tabs.length||wasPending&&!this.projectionPending||next.some((tab,index)=>{const previous=this.tabs[index];return tab.element!==previous.element||tab.slotName!==previous.slotName||tab.panel!==previous.panel||tab.label!==previous.label||tab.disabled!==previous.disabled||tab.inert!==previous.inert}))&&(this.tabs=next),this.projectionPending||this.projectionTimer!==void 0?this.beginProjectionSettlement():this.settleProjection()},this.onTabListKeyDown=e=>{if(e.defaultPrevented||shouldIgnoreNavigationKey(e))return;const navigable=this.tabs.filter(t=>this.isNavigable(t));if(navigable.length===0)return;const origin=this.keyboardOriginTab(e,navigable),currentIndex=origin?navigable.indexOf(origin):-1;if(e.key==="Delete"){if(!origin?.element.closable||(e.preventDefault(),isRepeatedActivationKey(e)))return;origin.element.requestCloseFromOwner();return}if(this.activation==="manual"&&(e.key==="Enter"||e.key===" "||e.key==="Spacebar")){if(!origin||(e.preventDefault(),isRepeatedActivationKey(e)))return;this.activateTab(origin);return}const targetIndex=resolveListMove(e,{count:navigable.length,current:currentIndex,orientation:this.isVertical?"vertical":"horizontal",direction:this.effectiveDirection});if(targetIndex===null)return;e.preventDefault();const target=navigable[targetIndex];if(this.activation==="manual"){this.focusOnly(target);return}this.activateTab(target)&&this.focusTabButton(target.slotName)},this.onTabListScroll=()=>{this.measureTabScrollEdges()},this.onScrollControlMouseDown=event=>{event.preventDefault()},this.onScrollControlPointerDown=event=>{const control=event.currentTarget;control.setAttribute("data-pressed",""),capturePointer(control,event.pointerId)},this.onScrollControlPointerEnd=event=>{const control=event.currentTarget;control.removeAttribute("data-pressed"),releasePointer(control,event.pointerId)}}static{this.defaultStrings={...super.defaultStrings,scrollNext:LYRA_DEFAULT_scrollNext,scrollPrevious:LYRA_DEFAULT_scrollPrevious,tabCloseAction:LYRA_DEFAULT_tabCloseAction}}static{this.styles=[LyraElement.styles,scrollOverflowFadeStyles,styles]}get active(){return this._active}set active(value){markVetoGuardWrite(this.selectGuard),this._active=value}connectedCallback(){super.connectedCallback(),this.hasUpdated?this.syncTabs():this.seedFirstRenderState(this.syncTabs),this.mutationObserver.observe(this,{childList:!0,subtree:!0,attributes:!0,characterData:!0,attributeFilter:["alt","aria-hidden","aria-label","aria-labelledby","class","closable","disabled","hidden","inert","id","label","name","open","panel","slot","style"]})}disconnectedCallback(){this.stopLabelObservation?.(),this.stopLabelObservation=void 0,this.labelTargets.clear(),this.resetProjectionReconciliation(),this.mutationObserver.clear(),this.projectedSourceObserver.clear(),this.restoreProjectedSources(),this.restoreProjectedSlots(),super.disconnectedCallback()}adoptedCallback(){super.adoptedCallback(),this.hostDescription.adopted(),this.mutationObserver.clear(),this.projectedSourceObserver.clear(),this.resetProjectionReconciliation()}resetProjectionReconciliation(){this.projectionGeneration+=1,this.projectionTimer!==void 0&&this.projectionTimerWindow?.clearTimeout(this.projectionTimer),this.projectionTimer=void 0,this.projectionTimerWindow=void 0,this.projectionPending=!1,this.pendingDescriptorUpdates=new WeakSet,this.descriptorUpgrades.disconnect(),this.restoredSourceInertWrites.clear(),this.restoredSlotWrites.clear(),this.excludedUnnamedDescriptors.clear(),this.settleProjection()}beginProjectionSettlement(){this.projectionSettlement||(this.projectionSettlement=new Promise(resolve=>{this.resolveProjectionSettlement=resolve}))}settleProjection(){const resolve=this.resolveProjectionSettlement;this.resolveProjectionSettlement=void 0,this.projectionSettlement=void 0,resolve?.()}async getUpdateComplete(){const generation=this.projectionGeneration,ownerDocument=this.ownerDocument;let complete=await super.getUpdateComplete();if(this.renderSlotPresence(!1)||!ownerDocument.defaultView)return complete;const current=()=>this.isConnected&&generation===this.projectionGeneration&&this.ownerDocument===ownerDocument;for(;current();){const settlement=this.projectionSettlement;if(settlement){if(await settlement,!current())return complete;complete=await super.getUpdateComplete()}else if(this.isUpdatePending)complete=await super.getUpdateComplete();else return complete}return complete}waitForDescriptorUpdate(tab){if(tab.hasUpdated===!0)return!1;const updateComplete=tab.updateComplete;if(updateComplete==null)return this.descriptorUpgrades.observeElement(tab),!1;if(!this.pendingDescriptorUpdates.has(tab)){this.pendingDescriptorUpdates.add(tab);const generation=this.projectionGeneration,ownerDocument=this.ownerDocument;updateComplete.then(()=>{generation===this.projectionGeneration&&this.ownerDocument===ownerDocument&&(this.pendingDescriptorUpdates.delete(tab),tab.parentNode===this&&this.queueProjectionReconciliation())})}return!0}readElementModel(children,projectedSlots){this.projectionPending=!1;const seen=new Set,next=[],panelsByName=new Map;for(const child of children){if(child.localName!==tag("tab-panel"))continue;const name=child.getAttribute("name");name!==null&&!panelsByName.has(name)&&panelsByName.set(name,child)}const authoredNames=new Set(children.flatMap(child=>{if(child.localName===tag("tab")){const name=child.getAttribute("panel");return name?[name]:[]}if(child.localName===tag("tab-panel")){const name=child.getAttribute("name");return name?[name]:[]}return[]}));let stagingName="tab-group-sources";for(;authoredNames.has(stagingName);)stagingName+="-sources";this.stagingSlotName=stagingName;let index=0;for(const child of children){if(child.localName!==tag("tab"))continue;const authoredPanel=child.getAttribute("panel")||void 0;let slotName=authoredPanel??`${SYNTHETIC_PANEL_PREFIX}${index}`;if(!authoredPanel){let collision=0;for(;authoredNames.has(slotName)||seen.has(slotName);)collision+=1,slotName=`${SYNTHETIC_PANEL_PREFIX}${index}-${collision}`}if(index+=1,seen.has(slotName))continue;seen.add(slotName);const tabSlot=this.tabSlotName(slotName),assignedSlot=child.assignedSlot,assignedHere=assignedSlot?.getRootNode()===this.renderRoot&&(assignedSlot.name===tabSlot||assignedSlot.name===this.stagingSlotName);if(!assignedHere||!authoredPanel&&this.excludedUnnamedDescriptors.has(child)){this.projectSlot(child,this.stagingSlotName,projectedSlots),assignedHere||(this.projectionPending=!0);continue}if(this.waitForDescriptorUpdate(child)){this.projectionPending=!0,this.projectSlot(child,this.stagingSlotName,projectedSlots);continue}const visibleLabel=this.readElementLabel(child);if(!authoredPanel&&!visibleLabel){this.excludedUnnamedDescriptors.add(child),this.projectSlot(child,this.stagingSlotName,projectedSlots);continue}projectedSlots.add(child);const label=visibleLabel||slotName,panel=panelsByName.get(slotName);panel&&this.projectSlot(panel,slotName,projectedSlots),next.push({slotName,panel:authoredPanel??"",label,disabled:child.hasAttribute("disabled"),inert:isInertChild(child),element:child}),!this.active&&child.hasAttribute("active")&&(this.active=slotName)}if(this.projectionPending){for(const child of children)this.projectedSlotSnapshots.has(child)&&projectedSlots.add(child);return this.tabs}for(const tab of next)this.projectSlot(tab.element,this.tabSlotName(tab.slotName),projectedSlots);return next}readElementLabel(tab){const labelledBy=tab.getAttribute("aria-labelledby");if(labelledBy)for(const id of asciiWhitespaceTokens(labelledBy))this.labelIds.add(id);const references=resolveIdReferencesIn(tab.getRootNode(),labelledBy);for(const reference of references)this.labelTargets.add(reference);const referenced=references.map(node=>composedAccessibilityText(node)).join(" ").trim(),explicit=tab.getAttribute("aria-label")?.trim();if(referenced)return referenced;if(explicit)return explicit;const labelNodes=Array.from(tab.childNodes).filter(node=>node.nodeType!==Node.ELEMENT_NODE||node.getAttribute("slot")===null||node.getAttribute("slot")==="");return composedAccessibilityText(labelNodes,{ancestorBoundary:tab,isSubtreeExcluded:element=>this.isTabLabelSubtreeExcluded(element),ignoreInheritedVisibility:!0,requireRendered:isHostLayoutRendered(this)}).replace(/\s+/g," ").trim()}libraryOwnsSourceInert(element){return this.projectedSourceSnapshots.get(element)?.libraryOwnsInert===!0}isTabLabelSubtreeExcluded(element){return isTabLabelSubtreeExcludedWithoutInert(element)||element.hasAttribute("inert")&&!this.libraryOwnsSourceInert(element)}snapshotProjectedSource(source){const inert=source.getAttribute("inert");return{inert,appliedInert:inert,libraryOwnsInert:!1}}adoptProjectedSourceInert(source,snapshot){const current=source.getAttribute("inert");current!==snapshot.appliedInert&&(snapshot.inert=current,snapshot.libraryOwnsInert=!1)}makeProjectedSourceInert(source,snapshot){source.hasAttribute("inert")||(source.setAttribute("inert",""),snapshot.libraryOwnsInert=!0),snapshot.appliedInert=source.getAttribute("inert")}restoreProjectedSource(source,snapshot){this.adoptProjectedSourceInert(source,snapshot);const before=source.getAttribute("inert");snapshot.inert===null?source.removeAttribute("inert"):source.setAttribute("inert",snapshot.inert),this.mutationObserver.active&&this.contains(source)&&source.getAttribute("inert")!==before&&this.restoredSourceInertWrites.set(source,source.getAttribute("inert"))}restoreProjectedSources(){for(const[source,snapshot]of this.projectedSourceSnapshots)this.restoreProjectedSource(source,snapshot);this.projectedSourceSnapshots.clear()}observeLabelReferences(){this.labelIds.size?this.stopLabelObservation||(this.stopLabelObservation=subscribeInheritedAttributes(this.getRootNode(),this.ownerDocument.defaultView?.MutationObserver,{attributes:["id","aria-label","aria-hidden","hidden","class","style"],characterData:!0,childList:!0,changed:records=>{(records.some(record=>Array.from(this.labelTargets).some(target=>target.contains(record.target)))||labelReferenceRecordsMatter(records,this.labelIds,this.labelTargets))&&this.syncTabs()}})):(this.stopLabelObservation?.(),this.stopLabelObservation=void 0)}projectedSources(tabs){const sources=new Set;for(const tab of tabs)for(const child of Array.from(tab.element.children))(child.getAttribute("slot")??"")===""&&sources.add(child);return sources}syncProjectedSources(tabs){const sources=this.projectedSources(tabs);for(const[source,snapshot]of this.projectedSourceSnapshots)this.adoptProjectedSourceInert(source,snapshot),sources.has(source)||(this.restoreProjectedSource(source,snapshot),this.projectedSourceSnapshots.delete(source));for(const source of sources){const snapshot=this.projectedSourceSnapshots.get(source)??this.snapshotProjectedSource(source);this.projectedSourceSnapshots.set(source,snapshot),this.adoptProjectedSourceInert(source,snapshot),this.makeProjectedSourceInert(source,snapshot)}this.projectedSourceObserver.clear();for(const source of sources)this.projectedSourceObserver.observe(source,{attributeFilter:["inert"]})}adoptProjectedSourceInertStates(){for(const[source,snapshot]of this.projectedSourceSnapshots)this.adoptProjectedSourceInert(source,snapshot)}snapshotProjectedSlot(source){const slot=source.getAttribute("slot");return{slot,appliedSlot:slot,libraryOwnsSlot:!1}}adoptProjectedSlot(source,snapshot){const current=source.getAttribute("slot");current!==snapshot.appliedSlot&&(snapshot.slot=current,snapshot.libraryOwnsSlot=!1)}projectSlot(source,slot,projectedSlots){const snapshot=this.projectedSlotSnapshots.get(source)??this.snapshotProjectedSlot(source);this.projectedSlotSnapshots.set(source,snapshot),this.adoptProjectedSlot(source,snapshot),source.getAttribute("slot")!==slot&&(source.setAttribute("slot",slot),snapshot.libraryOwnsSlot=!0),snapshot.appliedSlot=source.getAttribute("slot"),projectedSlots.add(source)}restoreProjectedSlot(source,snapshot){this.adoptProjectedSlot(source,snapshot);const before=source.getAttribute("slot");snapshot.slot===null?source.removeAttribute("slot"):source.setAttribute("slot",snapshot.slot),this.mutationObserver.active&&this.contains(source)&&source.getAttribute("slot")!==before&&this.restoredSlotWrites.set(source,source.getAttribute("slot"))}syncProjectedSlots(projectedSlots){for(const[source,snapshot]of this.projectedSlotSnapshots)projectedSlots.has(source)||(this.restoreProjectedSlot(source,snapshot),this.projectedSlotSnapshots.delete(source))}restoreProjectedSlots(){for(const[source,snapshot]of this.projectedSlotSnapshots)this.restoreProjectedSlot(source,snapshot);this.projectedSlotSnapshots.clear()}adoptProjectedSlotStates(){for(const[source,snapshot]of this.projectedSlotSnapshots)this.adoptProjectedSlot(source,snapshot)}isNavigable(tab){return!tab.disabled&&!tab.inert}willUpdate(changed){if(super.willUpdate(changed),this.projectionPending||this.renderSlotPresence(!1)||!changed.has("tabs")&&!changed.has("active"))return;if(this.hasUpdated){const shown=this.renderRoot.querySelector('[part="panel"]:not([hidden])');this.panelFocusRepair=shown?captureComposedFocusRepair(shown,shown):null}const focused=shadowFocusTarget(this),focusedSlot=focused?.getAttribute("part")==="tab"?focused.getAttribute("data-slot"):null;focusedSlot!==null&&!this.tabs.some(tab=>tab.slotName===focusedSlot&&this.isNavigable(tab))&&(this.rehomeTabFocus=!0,this.focusedTab=this.active);const current=this.tabs.find(t=>t.slotName===this.active);if(current&&this.isNavigable(current))return;this.rehomeTabFocus=this.rehomeTabFocus||focusedSlot!==null;const outgoing=this.active,before=changed.get("tabs")??this.tabs,at=this.hasUpdated&&changed.has("tabs")&&!changed.has("active")?before.findIndex(t=>t.slotName===outgoing):-1,renamed=at<0?void 0:this.tabs.find(t=>t.element===before[at].element&&this.isNavigable(t));let candidates=this.tabs;if(at>=0){const liveByName=new Map;for(const tab of this.tabs)liveByName.has(tab.slotName)||liveByName.set(tab.slotName,tab);candidates=[...before.slice(at+1),...before.slice(0,at).reverse()].map(tab=>liveByName.get(tab.slotName))}if(this.active=(renamed??candidates.find(t=>t&&this.isNavigable(t)))?.slotName??"",this.focusedTab=this.active,at>=0&&!renamed){const incoming=this.tabs.find(tab=>tab.slotName===this.active);this.scheduleAfterUpdate(()=>{this.emit("lr-tab-hide",{name:outgoing}),incoming&&this.isCurrentTab(incoming)&&this.emit("lr-tab-show",{name:incoming.slotName})},"tab-self-correction")}}updated(changed){super.updated(changed),changed.has("tabs")&&this.queueProjectionReconciliation(),!this.projectionPending&&(changed.has("active")||changed.has("tabs"))&&this.syncElementActiveState(),this.scrollOverflow.observeExtra(this.renderRoot.querySelectorAll('[part="tab"]')),this.measureTabScrollEdges();const panelFocus=this.panelFocusRepair;this.panelFocusRepair=null,panelFocus?.owner.hasAttribute("hidden")&&applyComposedFocusRepair(panelFocus,()=>[this.renderRoot.querySelector('[part="tab"][tabindex="0"]'),this.renderRoot.querySelector('[part="panel"]:not([hidden])')]),this.rehomeTabFocus&&(this.rehomeTabFocus=!1,this.renderRoot.querySelector('[part="tab"][tabindex="0"]')?.focus())}isCurrentTab(tab){return this.isConnected&&this.active===tab.slotName&&tab.element.parentElement===this&&tab.element.panel===tab.panel&&!tab.element.disabled&&!isInertChild(tab.element)}selectTab(tab){if(!this.isNavigable(tab)||tab.slotName===this.active)return;const previous=this.active;this.active=tab.slotName,this.focusedTab=tab.slotName,previous&&this.emit("lr-tab-hide",{name:previous}),this.isCurrentTab(tab)&&this.emit("lr-tab-show",{name:tab.slotName})}activateTab(tab){return!this.isNavigable(tab)||tab.slotName!==this.active&&(requestThenCommit({requestDetail:{value:tab.slotName,previousValue:this.active},emitRequest:(detail,init)=>this.emit("lr-tab-group-select-request",detail,init),guard:this.selectGuard,commit:()=>this.selectTab(tab)}).defaultPrevented||this.active!==tab.slotName)?!1:(this.isCurrentTab(tab)&&this.emit("lr-activate",{value:tab.slotName}),!0)}show(panel){const tab=this.tabs.find(candidate=>candidate.slotName===panel);tab&&this.selectTab(tab)}syncElementActiveState(){const definitions=new Map;for(const tab of this.tabs)definitions.has(tab.element)||definitions.set(tab.element,tab);for(const child of Array.from(this.children))if(child.localName===tag("tab")){const definition=definitions.get(child);child.toggleAttribute("active",definition?.slotName===this.active)}else child.localName===tag("tab-panel")&&child.toggleAttribute("active",child.getAttribute("name")===this.active)}focusOnly(tab){this.focusedTab=tab.slotName,this.focusTabButton(tab.slotName)}get rovingTab(){if(this.activation!=="manual")return this.active;const candidate=this.tabs.find(t=>t.slotName===this.focusedTab&&this.isNavigable(t));return candidate?candidate.slotName:this.active}keyboardOriginTab(event,navigable){const eventButton=event.composedPath().find(candidate=>candidate.nodeType===1&&candidate.getAttribute?.("part")==="tab"&&candidate.getRootNode()===this.renderRoot),focused=shadowFocusTarget(this),owned=(eventButton??(focused?.getAttribute("part")==="tab"?focused:void 0))?.dataset.slot;return navigable.find(tab=>tab.slotName===owned)??navigable.find(tab=>tab.slotName===this.rovingTab)}focusTabButton(slotName,options){const button=this.tabButton(slotName);return button?(button.focus(options),!0):!1}tabButton(slotName){const buttons=this.renderRoot.querySelectorAll('[part="tab"]');return Array.from(buttons).find(button=>button.dataset.slot===slotName)}focusTab(panel,options){const tab=this.tabs.find(candidate=>candidate.slotName===panel);return tab?this.focusTabDefinition(tab,options):!1}focusTabElement(element,options){const tab=this.tabs.find(candidate=>candidate.element===element);return tab?this.focusTabDefinition(tab,options):!1}blurTabElement(element){const tab=this.tabs.find(candidate=>candidate.element===element),button=tab?this.tabButton(tab.slotName):void 0;button&&shadowFocusTarget(this)===button&&button.blur()}focusTabDefinition(tab,options){return this.isNavigable(tab)?(this.activation==="manual"?this.focusedTab=tab.slotName:this.selectTab(tab),this.focusTabButton(tab.slotName,options)):!1}get isVertical(){return this.placement==="start"||this.placement==="end"}tabId(slotName){return this.idsFor(slotName).tab}panelId(slotName){return this.idsFor(slotName).panel}idsFor(slotName){const existing=this.idsBySlot.get(slotName);if(existing)return existing;const token=`${this.baseId}-${this.nextOpaqueId++}`,ids={tab:`${token}-tab`,panel:`${token}-panel`};return this.idsBySlot.set(slotName,ids),ids}tabSlotName(slotName){return`${slotName}-tab`}get scrollControlsSuppressed(){return this.withoutScrollControls||this.noScrollControls}measureTabScrollEdges(){const tablist=this.renderRoot.querySelector('[part~="tablist"]');if(!tablist||this.isVertical){this.setTabScrollEdges(!1,!1,tablist);return}const maximum=Math.max(0,tablist.scrollWidth-tablist.clientWidth),position=Math.max(0,Math.min(maximum,this.effectiveDirection==="rtl"?-tablist.scrollLeft:tablist.scrollLeft));this.setTabScrollEdges(position>1,position<maximum-1,tablist)}setTabScrollEdges(start,end,tablist){tablist?.toggleAttribute("data-scroll-start",start),tablist?.toggleAttribute("data-scroll-end",end),!(start===this.scrollStartAvailable&&end===this.scrollEndAvailable)&&(this.scrollStartAvailable=start,this.scrollEndAvailable=end)}scrollTabs(edge){const tablist=this.renderRoot.querySelector('[part~="tablist"]');if(!tablist||!isHtmlElement(tablist)||typeof tablist.scrollBy!="function")return;const step=Math.max(1,tablist.clientWidth*SCROLL_STEP_RATIO),towardEnd=edge==="end"?1:-1,physical=this.effectiveDirection==="rtl"?-towardEnd:towardEnd;tablist.scrollBy({left:step*physical,behavior:motionScrollBehavior(this)})}renderScrollControl(edge){if(this.isVertical||this.scrollControlsSuppressed)return nothing;const available=edge==="start"?this.scrollStartAvailable:this.scrollEndAvailable;return html`<button type="button" part=${edge==="start"?"scroll-button scroll-button__base scroll-button__button scroll-button-start scroll-button--start":"scroll-button scroll-button__base scroll-button__button scroll-button-end scroll-button--end"} tabindex="-1" aria-hidden="true" ?hidden=${!this.fixedScrollControls&&!available} data-inactive=${available?nothing:""} aria-label=${edge==="start"?this.localize("scrollPrevious"):this.localize("scrollNext")} @pointerdown=${this.onScrollControlPointerDown} @pointerup=${this.onScrollControlPointerEnd} @pointercancel=${this.onScrollControlPointerEnd} @lostpointercapture=${this.onScrollControlPointerEnd} @mousedown=${this.onScrollControlMouseDown} @click=${()=>{available&&this.scrollTabs(edge)}} >
|
|
2
2
|
<span part="scroll-button-glyph" aria-hidden="true" >${chevronIcon()}</span
|
|
3
3
|
>
|
|
4
4
|
</button>`}renderTab(tab){const selected=tab.slotName===this.active,closable=this.isNavigable(tab)&&tab.element.closable;return html`<button type="button" part="tab" id=${this.tabId(tab.slotName)} data-slot=${tab.slotName} role="tab" ?inert=${tab.inert} aria-selected=${selected?"true":"false"} aria-disabled=${tab.disabled?"true":"false"} aria-label=${tab.label?tab.label:nothing} aria-controls=${this.panelId(tab.slotName)} aria-keyshortcuts=${closable?"Delete":nothing} tabindex=${tab.slotName===this.rovingTab?"0":"-1"} @click=${()=>this.activateTab(tab)} >
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{visuallyHidden}from"../../../internal/a11y.js";import{forcedColorsPart}from"../../../internal/forced-colors.styles.js";import{activeFill,focusRingInsetOffset,focusRingInwardOffset,focusRingShorthandInsetPastFrame,focusRingOffsetFrom,iconHitTarget}from"../../../internal/interactive-control.styles.js";import{css,unsafeCSS}from"lit";import{tag}from"../../../internal/prefix.js";import{blockHost}from"../../../internal/layout-fragments.styles.js";const styles=css` :host{${blockHost} min-block-size:0}[part~=base]{display:flex;flex-direction:column;gap:var(--lr-space-s);min-inline-size:0;min-block-size:0;max-block-size:100%;block-size:100%;box-sizing:border-box}[part=nav]{flex:none;position:relative;display:flex;align-items:stretch;min-inline-size:0;min-block-size:0}[data-descriptor-staging]{position:absolute;inset:0;overflow:clip;opacity:0;pointer-events:none}[part~=tablist]{display:flex;align-items:stretch;gap:var(--lr-space-m);border-block-end:var(--track-width,var(--lr-border-width-thin)) solid var(--track-color,var(--lr-color-border-subtle));overflow-x:auto;overflow-y:hidden;flex:1 1 auto;min-inline-size:0}:where([part~=scroll-button]){flex:0 0 auto;display:inline-grid;place-items:center;inline-size:var(--lr-icon-button-size);${iconHitTarget} padding:0;appearance:none;background:none;border:none;font:inherit;border-block-end:var(--lr-border-width-thin) solid var(--lr-color-border-subtle);color:var(--lr-color-text-quiet);cursor:pointer;transition:color var(--lr-transition-fast),background var(--lr-transition-fast)}:where([part=nav]:not(:has([part~=tablist][data-scroll-overflow]))) [part~=scroll-button]{display:none}:where([part~=scroll-button][hidden]){display:none}:where([part~=scroll-button]):where(:hover){color:var(--lr-tab-group-scroll-button-hover-color,var(--lr-color-text))}:where([part~=scroll-button]):where(:active){background:var(--lr-tab-group-scroll-button-active-bg,${activeFill("transparent")});color:var(--lr-tab-group-scroll-button-active-color,var(--lr-color-text))}:where([part~=scroll-button]):where([data-pressed]){background:var(--lr-tab-group-scroll-button-active-bg,${activeFill("transparent")});color:var(--lr-tab-group-scroll-button-active-color,var(--lr-color-text))}[part~=scroll-button]:focus-visible{${focusRingInwardOffset} border-radius:var(--lr-radius)}[part=scroll-button-glyph]{display:inline-flex;align-items:center}[part~=scroll-button-start] [part=scroll-button-glyph]{transform:scaleX(-1)}:host(:dir(rtl)) [part~=scroll-button-start] [part=scroll-button-glyph]{transform:none}:host(:dir(rtl)) [part~=scroll-button-end] [part=scroll-button-glyph]{transform:scaleX(-1)}[data-close-tab]:not(:focus){${visuallyHidden}}[part=tab]{position:relative;appearance:none;background:none;border:none;border-block-end:var(--lr-border-width-medium) solid transparent;margin-block-end:calc(-1 * var(--track-width,var(--lr-border-width-thin)));padding:var(--lr-space-s) var(--lr-space-xs);font:inherit;font-weight:var(--lr-font-weight-medium);color:var(--lr-color-text-quiet);cursor:pointer;white-space:nowrap;display:inline-flex;align-items:center;gap:var(--lr-space-xs);transition:color var(--lr-transition-fast),border-color var(--lr-transition-fast),background-color var(--lr-transition-fast)}[data-tab-label]{min-inline-size:0}:where([part=tab]):hover:where(:not([aria-disabled=true])){color:var(--lr-tab-group-hover-color,var(--lr-color-text))}:where([part=tab]):active:where(:not([aria-disabled=true])){background:var(--lr-tab-group-active-bg,${activeFill("transparent")});color:var(--lr-tab-group-active-color,var(--lr-tab-group-hover-color,var(--lr-color-text)))}[part=tab][aria-selected=true]{color:var(--lr-tab-group-selected-color,var(--lr-color-brand));border-block-end-color:var(--indicator-color,var(--lr-tab-group-indicator-color,var(--lr-color-brand)))}[part=active-tab-indicator]{position:absolute;inset-inline:0;inset-block-end:calc(-1 * var(--lr-border-width-medium));block-size:var(--lr-border-width-medium);background:var(--indicator-color,var(--lr-tab-group-indicator-color,var(--lr-color-brand)));pointer-events:none}[part=tab][aria-disabled=true]{cursor:not-allowed;pointer-events:none;opacity:var(--lr-opacity-disabled)}[part=tab]:focus-visible{${focusRingShorthandInsetPastFrame} border-radius:var(--lr-radius)}[part=panel]{min-inline-size:0;padding-block-start:var(--lr-space-xs);overflow-wrap:break-word}[part=body]{flex:1 1 auto;min-inline-size:0;min-block-size:0;overflow:auto}:host([fill-body]) [part=body]{overflow:clip}:host([fill-body]) [part=panel]{block-size:100%;box-sizing:border-box}:host([fill-body]) [part=panel] ::slotted(${unsafeCSS(tag("tab-panel"))}){--_lr-tab-panel-block-size:100%;block-size:100%;box-sizing:border-box}[part=panel]:hover:not(:focus-visible){outline-width:var(--lr-tab-group-panel-hover-outline-width,var(--lr-border-width-thin));outline-style:var(--lr-tab-group-panel-hover-outline-style,solid);outline-color:var(--lr-tab-group-panel-hover-outline-color,var(--lr-color-border));${focusRingOffsetFrom("--lr-tab-group-panel-hover-outline-offset")} border-radius:var(--lr-radius)}[part=panel]:focus-visible{${focusRingInsetOffset} border-radius:var(--lr-radius)}@media (prefers-reduced-motion:reduce){[part=tab],[part~=scroll-button]{transition:none!important}}:host([placement=bottom]) [part~=base]{flex-direction:column-reverse}:host([placement=bottom]) [part~=tablist],:host([placement=bottom]) [part~=scroll-button]{border-block-end:none;border-block-start:var(--track-width,var(--lr-border-width-thin)) solid var(--track-color,var(--lr-color-border-subtle))}:host([placement=bottom]) [part=tab][aria-selected=true]{border-block-end-color:transparent}:host([placement=bottom]) [part=active-tab-indicator]{inset-block-start:calc(-1 * var(--lr-border-width-medium));inset-block-end:auto}:host([placement=start]) [part=nav],:host([placement=end]) [part=nav]{flex:0 1 auto;min-inline-size:0;max-inline-size:var(--lr-tab-group-vertical-nav-max-inline-size,var(--lr-size-12rem));max-block-size:100%}:host([placement=start]) [part~=base],:host([placement=end]) [part~=base]{flex-direction:row;align-items:stretch}:host([placement=end]) [part~=base]{flex-direction:row-reverse}:host([placement=start]) [part~=tablist],:host([placement=end]) [part~=tablist]{flex-direction:column;align-items:stretch;flex:1 1 auto;min-inline-size:0;max-inline-size:100%;gap:var(--lr-space-2xs);overflow-x:hidden;overflow-y:auto;min-block-size:0;max-block-size:100%;border-block-end:none}:host([placement=start]) [part=tab],:host([placement=end]) [part=tab]{min-inline-size:0;max-inline-size:100%;overflow:hidden;text-overflow:ellipsis}:host([placement=start]) [data-tab-label],:host([placement=end]) [data-tab-label]{display:block;flex:1 1 auto;max-inline-size:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}:host([placement=start]) [part~=tablist]{border-inline-end:var(--track-width,var(--lr-border-width-thin)) solid var(--track-color,var(--lr-color-border-subtle))}:host([placement=end]) [part~=tablist]{border-inline-start:var(--track-width,var(--lr-border-width-thin)) solid var(--track-color,var(--lr-color-border-subtle))}:host([placement=start]) [part~=tablist][data-scroll-overflow],:host([placement=end]) [part~=tablist][data-scroll-overflow]{-webkit-mask-image:none;mask-image:none}:host([placement=start]) [part=tab][aria-selected=true],:host([placement=end]) [part=tab][aria-selected=true]{box-shadow:none;border-block-end-color:transparent}:host([placement=start]) [part=tab][aria-selected=true]{border-inline-end:var(--lr-border-width-thick) solid var(--indicator-color,var(--lr-tab-group-indicator-color,var(--lr-color-brand)))}:host([placement=end]) [part=tab][aria-selected=true]{border-inline-start:var(--lr-border-width-thick) solid var(--indicator-color,var(--lr-tab-group-indicator-color,var(--lr-color-brand)))}:host([placement=start]) [part=active-tab-indicator]{inset-block:0;inset-inline:auto calc(-1 * var(--lr-border-width-thick));inline-size:var(--lr-border-width-thick);block-size:auto}:host([placement=end]) [part=active-tab-indicator]{inset-block:0;inset-inline:calc(-1 * var(--lr-border-width-thick)) auto;inline-size:var(--lr-border-width-thick);block-size:auto}:host([placement=start]) [part=panel],:host([placement=end]) [part=panel]{flex:1 1 auto;min-inline-size:0}${forcedColorsPart('[part="tab"][aria-selected="true"]')} `;export{styles};
|
|
1
|
+
import{visuallyHidden}from"../../../internal/a11y.js";import{forcedColorsPart}from"../../../internal/forced-colors.styles.js";import{activeFill,focusRingInsetOffset,focusRingInwardOffset,focusRingShorthandInsetPastFrame,focusRingOffsetFrom,iconHitTarget}from"../../../internal/interactive-control.styles.js";import{css,unsafeCSS}from"lit";import{tag}from"../../../internal/prefix.js";import{blockHost}from"../../../internal/layout-fragments.styles.js";const styles=css` :host{${blockHost} min-block-size:0}[part~=base]{display:flex;flex-direction:column;gap:var(--lr-space-s);min-inline-size:0;min-block-size:0;max-block-size:100%;block-size:100%;box-sizing:border-box}[part=nav]{flex:none;position:relative;display:flex;align-items:stretch;min-inline-size:0;min-block-size:0}[data-descriptor-staging]{position:absolute;inset:0;overflow:clip;opacity:0;pointer-events:none}[part~=tablist]{display:flex;align-items:stretch;gap:var(--lr-space-m);border-block-end:var(--track-width,var(--lr-tab-group-track-width,var(--lr-border-width-thin))) solid var(--track-color,var(--lr-color-border-subtle));overflow-x:auto;overflow-y:hidden;flex:1 1 auto;min-inline-size:0}:where([part~=scroll-button]){flex:0 0 auto;display:inline-grid;place-items:center;inline-size:var(--lr-icon-button-size);${iconHitTarget} padding:0;appearance:none;background:none;border:none;font:inherit;border-block-end:var(--lr-border-width-thin) solid var(--lr-color-border-subtle);color:var(--lr-color-text-quiet);cursor:pointer;transition:color var(--lr-transition-fast),background var(--lr-transition-fast)}:where([part=nav]:not(:has([part~=tablist][data-scroll-overflow]))) [part~=scroll-button]{display:none}:where([part~=scroll-button][hidden]){display:none}:where([part~=scroll-button]):where(:hover){color:var(--lr-tab-group-scroll-button-hover-color,var(--lr-color-text))}:where([part~=scroll-button]):where(:active){background:var(--lr-tab-group-scroll-button-active-bg,${activeFill("transparent")});color:var(--lr-tab-group-scroll-button-active-color,var(--lr-color-text))}:where([part~=scroll-button]):where([data-pressed]){background:var(--lr-tab-group-scroll-button-active-bg,${activeFill("transparent")});color:var(--lr-tab-group-scroll-button-active-color,var(--lr-color-text))}[part~=scroll-button]:focus-visible{${focusRingInwardOffset} border-radius:var(--lr-radius)}[part=scroll-button-glyph]{display:inline-flex;align-items:center}[part~=scroll-button-start] [part=scroll-button-glyph]{transform:scaleX(-1)}:host(:dir(rtl)) [part~=scroll-button-start] [part=scroll-button-glyph]{transform:none}:host(:dir(rtl)) [part~=scroll-button-end] [part=scroll-button-glyph]{transform:scaleX(-1)}[data-close-tab]:not(:focus){${visuallyHidden}}[part=tab]{position:relative;appearance:none;background:none;border:none;border-block-end:var(--lr-border-width-medium) solid transparent;margin-block-end:calc(-1 * var(--track-width,var(--lr-tab-group-track-width,var(--lr-border-width-thin))));padding:var(--lr-tab-group-tab-padding,var(--lr-space-s) var(--lr-space-xs));min-block-size:var(--lr-tab-group-tab-min-block-size,auto);font:inherit;font-size:var(--lr-tab-group-tab-font-size,inherit);font-weight:var(--lr-font-weight-medium);color:var(--lr-color-text-quiet);cursor:pointer;white-space:nowrap;display:inline-flex;align-items:center;gap:var(--lr-space-xs);transition:color var(--lr-transition-fast),border-color var(--lr-transition-fast),background-color var(--lr-transition-fast)}[data-tab-label]{min-inline-size:0}:where([part=tab]):hover:where(:not([aria-disabled=true])){color:var(--lr-tab-group-hover-color,var(--lr-color-text))}:where([part=tab]):active:where(:not([aria-disabled=true])){background:var(--lr-tab-group-active-bg,${activeFill("transparent")});color:var(--lr-tab-group-active-color,var(--lr-tab-group-hover-color,var(--lr-color-text)))}[part=tab][aria-selected=true]{color:var(--lr-tab-group-selected-color,var(--lr-color-brand));border-block-end-color:var(--indicator-color,var(--lr-tab-group-indicator-color,var(--lr-color-brand)))}[part=active-tab-indicator]{position:absolute;inset-inline:0;inset-block-end:calc(-1 * var(--lr-border-width-medium));block-size:var(--lr-border-width-medium);background:var(--indicator-color,var(--lr-tab-group-indicator-color,var(--lr-color-brand)));pointer-events:none}[part=tab][aria-disabled=true]{cursor:not-allowed;pointer-events:none;opacity:var(--lr-opacity-disabled)}[part=tab]:focus-visible{${focusRingShorthandInsetPastFrame} border-radius:var(--lr-radius)}[part=panel]{min-inline-size:0;padding-block-start:var(--lr-space-xs);overflow-wrap:break-word}[part=body]{flex:1 1 auto;min-inline-size:0;min-block-size:0;overflow:auto}:host([fill-body]) [part=body]{overflow:clip}:host([fill-body]) [part=panel]{block-size:100%;box-sizing:border-box}:host([fill-body]) [part=panel] ::slotted(${unsafeCSS(tag("tab-panel"))}){--_lr-tab-panel-block-size:100%;block-size:100%;box-sizing:border-box}[part=panel]:hover:not(:focus-visible){outline-width:var(--lr-tab-group-panel-hover-outline-width,var(--lr-border-width-thin));outline-style:var(--lr-tab-group-panel-hover-outline-style,solid);outline-color:var(--lr-tab-group-panel-hover-outline-color,var(--lr-color-border));${focusRingOffsetFrom("--lr-tab-group-panel-hover-outline-offset")} border-radius:var(--lr-radius)}[part=panel]:focus-visible{${focusRingInsetOffset} border-radius:var(--lr-radius)}@media (prefers-reduced-motion:reduce){[part=tab],[part~=scroll-button]{transition:none!important}}:host([placement=bottom]) [part~=base]{flex-direction:column-reverse}:host([placement=bottom]) [part~=tablist],:host([placement=bottom]) [part~=scroll-button]{border-block-end:none;border-block-start:var(--track-width,var(--lr-tab-group-track-width,var(--lr-border-width-thin))) solid var(--track-color,var(--lr-color-border-subtle))}:host([placement=bottom]) [part=tab][aria-selected=true]{border-block-end-color:transparent}:host([placement=bottom]) [part=active-tab-indicator]{inset-block-start:calc(-1 * var(--lr-border-width-medium));inset-block-end:auto}:host([placement=start]) [part=nav],:host([placement=end]) [part=nav]{flex:0 1 auto;min-inline-size:0;max-inline-size:var(--lr-tab-group-vertical-nav-max-inline-size,var(--lr-size-12rem));max-block-size:100%}:host([placement=start]) [part~=base],:host([placement=end]) [part~=base]{flex-direction:row;align-items:stretch}:host([placement=end]) [part~=base]{flex-direction:row-reverse}:host([placement=start]) [part~=tablist],:host([placement=end]) [part~=tablist]{flex-direction:column;align-items:stretch;flex:1 1 auto;min-inline-size:0;max-inline-size:100%;gap:var(--lr-space-2xs);overflow-x:hidden;overflow-y:auto;min-block-size:0;max-block-size:100%;border-block-end:none}:host([placement=start]) [part=tab],:host([placement=end]) [part=tab]{min-inline-size:0;max-inline-size:100%;overflow:hidden;text-overflow:ellipsis}:host([placement=start]) [data-tab-label],:host([placement=end]) [data-tab-label]{display:block;flex:1 1 auto;max-inline-size:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}:host([placement=start]) [part~=tablist]{border-inline-end:var(--track-width,var(--lr-tab-group-track-width,var(--lr-border-width-thin))) solid var(--track-color,var(--lr-color-border-subtle))}:host([placement=end]) [part~=tablist]{border-inline-start:var(--track-width,var(--lr-tab-group-track-width,var(--lr-border-width-thin))) solid var(--track-color,var(--lr-color-border-subtle))}:host([placement=start]) [part~=tablist][data-scroll-overflow],:host([placement=end]) [part~=tablist][data-scroll-overflow]{-webkit-mask-image:none;mask-image:none}:host([placement=start]) [part=tab][aria-selected=true],:host([placement=end]) [part=tab][aria-selected=true]{box-shadow:none;border-block-end-color:transparent}:host([placement=start]) [part=tab][aria-selected=true]{border-inline-end:var(--lr-border-width-thick) solid var(--indicator-color,var(--lr-tab-group-indicator-color,var(--lr-color-brand)))}:host([placement=end]) [part=tab][aria-selected=true]{border-inline-start:var(--lr-border-width-thick) solid var(--indicator-color,var(--lr-tab-group-indicator-color,var(--lr-color-brand)))}:host([placement=start]) [part=active-tab-indicator]{inset-block:0;inset-inline:auto calc(-1 * var(--lr-border-width-thick));inline-size:var(--lr-border-width-thick);block-size:auto}:host([placement=end]) [part=active-tab-indicator]{inset-block:0;inset-inline:calc(-1 * var(--lr-border-width-thick)) auto;inline-size:var(--lr-border-width-thick);block-size:auto}:host([placement=start]) [part=panel],:host([placement=end]) [part=panel]{flex:1 1 auto;min-inline-size:0}${forcedColorsPart('[part="tab"][aria-selected="true"]')} `;export{styles};
|
|
@@ -10,6 +10,7 @@ import{type TemplateResult}from'lit';import{LyraElement}from'../../../internal/l
|
|
|
10
10
|
* @customElement lr-tab-panel
|
|
11
11
|
* @slot - The panel's content.
|
|
12
12
|
* @csspart base - The panel content wrapper.
|
|
13
|
+
* @csspart tab-panel - Web Awesome-named alias on the same wrapper as `base`.
|
|
13
14
|
* @cssprop [--padding=0] - Inner panel padding.
|
|
14
15
|
* @status stable
|
|
15
16
|
* @since 8.0.0
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__decorate}from"tslib";import{html}from"lit";import{property}from"lit/decorators.js";import{LyraElement}from"../../../internal/lyra-element.js";import{css as lyraStaticStyleCss}from"lit";const styles=lyraStaticStyleCss`:host{--_lr-tab-panel-block-size:initial;display:block}:host(:not([active])){display:none}[part
|
|
1
|
+
import{__decorate}from"tslib";import{html}from"lit";import{property}from"lit/decorators.js";import{LyraElement}from"../../../internal/lyra-element.js";import{css as lyraStaticStyleCss}from"lit";const styles=lyraStaticStyleCss`:host{--_lr-tab-panel-block-size:initial;display:block}:host(:not([active])){display:none}[part~=base]{padding:var(--padding,0);block-size:var(--_lr-tab-panel-block-size,auto);box-sizing:border-box}`;class LyraTabPanel extends LyraElement{constructor(){super(...arguments),this.name="",this.active=!1}static{this.styles=[LyraElement.styles,styles]}render(){return html`<div part="base tab-panel"><slot></slot></div>`}}__decorate([property({reflect:!0})],LyraTabPanel.prototype,"name",void 0),__decorate([property({type:Boolean,reflect:!0})],LyraTabPanel.prototype,"active",void 0);export{LyraTabPanel};
|
|
@@ -16,6 +16,10 @@ import{type TemplateResult}from'lit';import{LyraElement}from'../../../internal/l
|
|
|
16
16
|
* noncancelable `lr-close` notification without selecting or removing the tab; the owning
|
|
17
17
|
* application decides whether and when to remove the matching tab and panel.
|
|
18
18
|
*
|
|
19
|
+
* The real tab button belongs to the group, so its padding, font size and minimum block size are
|
|
20
|
+
* the group's `--lr-tab-group-tab-padding`, `--lr-tab-group-tab-font-size` and
|
|
21
|
+
* `--lr-tab-group-tab-min-block-size` tokens; set them on the group or an ancestor.
|
|
22
|
+
*
|
|
19
23
|
* @customElement lr-tab
|
|
20
24
|
* @slot - The tab's visual label content. Its direct default-slot element roots are inert while the
|
|
21
25
|
* owning group projects them; their accessibility-exposed flattened text names the real tab button.
|
|
@@ -96,6 +96,7 @@ ariaLabel?:string;}export interface LyraWidgetEventMap{'lr-toggle-request':Custo
|
|
|
96
96
|
* fullscreen panel.
|
|
97
97
|
* @cssprop [--lr-widget-border-color=var(--lr-color-border-subtle)] - Docked border color.
|
|
98
98
|
* @cssprop [--lr-widget-radius=var(--lr-radius)] - Docked corner radius.
|
|
99
|
+
* @cssprop [--lr-widget-header-divider=var(--lr-border-width-thin) solid var(--lr-color-border-subtle)] - Border shorthand of the rule under the header; set `none` to remove it.
|
|
99
100
|
* @cssprop [--lr-widget-gap=var(--lr-space-s)] - Gap between header contents, defaulting to the size tier.
|
|
100
101
|
* @cssprop [--lr-widget-header-padding=var(--lr-space-s) var(--lr-space-m)] - Header padding, defaulting to the size tier.
|
|
101
102
|
* @cssprop [--lr-widget-body-padding=var(--lr-space-m)] - Body padding, defaulting to the size tier.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{activeFill,focusRing,focusRingInset,focusRingRoom,iconHitTarget,interactiveTransition}from"../../../internal/interactive-control.styles.js";import{forcedColorsSelected}from"../../../internal/forced-colors.styles.js";import{css}from"lit";const styles=css` :host{display:block;--_lr-widget-overlay-color:var(--lr-color-overlay);--_lr-widget-fullscreen-inset:max( var(--lr-space-l), var(--lr-safe-area-top) ) max(var(--lr-space-l), var(--lr-safe-area-inline-end)) max(var(--lr-space-l), var(--lr-safe-area-bottom)) max(var(--lr-space-l), var(--lr-safe-area-inline-start));--_lr-widget-backdrop-inset:0}[part=base]{display:flex;flex-direction:column;box-sizing:border-box;border:var(--lr-border-width-thin) solid var(--lr-color-border-subtle);border-radius:var(--lr-radius);background:var(--lr-color-surface);overflow:hidden}:host(:not([fullscreen])) [part=base]{border-color:var(--lr-widget-border-color,var(--lr-color-border-subtle));border-radius:var(--lr-widget-radius,var(--lr-radius));background:var(--lr-widget-bg,var(--lr-color-surface));block-size:100%;min-block-size:0}[part=header]{display:flex;flex:0 0 auto;align-items:center;flex-wrap:wrap;min-inline-size:0;gap:var(--lr-widget-gap,var(--lr-space-s));padding:var(--lr-widget-header-padding,var(--lr-space-s) var(--lr-space-m));border-block-end:var(--lr-border-width-thin) solid var(--lr-color-border-subtle)}[part=title]{display:flex;align-items:center;gap:var(--lr-space-xs);flex:1 1 auto;min-inline-size:0}[part=icon]{display:inline-flex;flex:0 0 auto;align-items:center}[part=icon][hidden]{display:none}[part=label-group]{display:flex;flex-direction:column;min-inline-size:0}[part=label],[part=sublabel]{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}[part=label]{font-weight:var(--lr-font-weight-semibold)}[part=sublabel]{font-size:var(--lr-font-size-sm);color:var(--lr-color-text-quiet)}[part=label][hidden],[part=sublabel][hidden]{display:none}[part=actions]{--_lr-widget-ring-room: ${focusRingRoom};padding:var(--_lr-widget-ring-room);margin:calc(-1 * var(--_lr-widget-ring-room));display:flex;flex:0 1 auto;align-items:center;min-inline-size:0;max-inline-size:100%;gap:var(--lr-space-xs);overflow-x:auto;overflow-y:hidden}[part=actions][hidden]{display:none}[part=actions] ::slotted(*){flex-shrink:0;max-inline-size:none}[part=view-toggles]{display:flex;flex:0 1 auto;min-inline-size:0;max-inline-size:100%;gap:var(--lr-space-2xs);overflow-x:auto;overflow-y:hidden}[part=view-toggle]{display:inline-flex;flex:0 1 auto;align-items:center;justify-content:center;${iconHitTarget} max-inline-size:100%;gap:var(--lr-space-2xs);padding:var(--lr-size-0-125rem) var(--lr-space-s);border:var(--lr-border-width-thin) solid var(--lr-color-border);border-radius:var(--lr-radius-pill);background:transparent;color:var(--lr-color-text-quiet);font:inherit;font-size:var(--lr-font-size-sm);cursor:pointer;${interactiveTransition}}[part=view-icon]{display:inline-flex;flex:0 0 auto}[part=view-label]{min-inline-size:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}:where([part=view-toggle]):hover{background:var(--lr-widget-view-toggle-hover-bg,var(--lr-color-brand-quiet));color:var(--lr-widget-view-toggle-hover-color,var(--lr-color-text))}:where([part=view-toggle]):active{background: ${activeFill("var(--lr-widget-view-toggle-hover-bg, var(--lr-color-brand-quiet))")};color:var(--lr-widget-view-toggle-hover-color,var(--lr-color-text))}[part=view-toggle][aria-pressed=true]{background:var(--lr-widget-view-toggle-active-bg,var(--lr-color-brand-quiet));color:var(--lr-widget-view-toggle-active-color,var(--lr-color-brand));border-color:var(--lr-widget-view-toggle-active-border-color,transparent)}[part=view-toggle][aria-pressed=true]:active{background: ${activeFill("var(--lr-widget-view-toggle-active-bg, var(--lr-color-brand-quiet))")};color:var(--lr-widget-view-toggle-active-color,var(--lr-color-brand))}[part=view-toggle]:focus-visible{${focusRingInset}}[part=collapse-button],[part=fullscreen-button]{display:inline-flex;align-items:center;justify-content:center;${iconHitTarget} border:none;background:transparent;color:var(--lr-color-text-quiet);border-radius:var(--lr-radius);font:inherit;cursor:pointer;transition:var(--lr-transition-interactive),transform var(--lr-transition-fast)}[part=collapse-button]:hover{background:var(--lr-widget-collapse-button-hover-bg,var(--lr-color-brand-quiet));color:var(--lr-widget-collapse-button-hover-color,var(--lr-color-brand))}[part=fullscreen-button]:hover{background:var(--lr-widget-fullscreen-button-hover-bg,var(--lr-color-brand-quiet));color:var(--lr-widget-fullscreen-button-hover-color,var(--lr-color-brand))}[part=collapse-button]:active{background: ${activeFill("var(--lr-widget-collapse-button-hover-bg, var(--lr-color-brand-quiet))")};color:var(--lr-widget-collapse-button-hover-color,var(--lr-color-brand))}[part=fullscreen-button]:active{background: ${activeFill("var(--lr-widget-fullscreen-button-hover-bg, var(--lr-color-brand-quiet))")};color:var(--lr-widget-fullscreen-button-hover-color,var(--lr-color-brand))}[part=collapse-button]:focus-visible,[part=fullscreen-button]:focus-visible{${focusRing}}:host(:not([collapsed])) [part=collapse-button]{transform:rotate(90deg)}:host([collapsed]:dir(rtl)) [part=collapse-button]{transform:scaleX(-1)}[part=body]{padding:var(--lr-widget-body-padding,var(--lr-space-m));flex:1 1 auto;min-block-size:0;overflow:auto}[part=body][hidden]{display:none}[part=body]:focus-visible{${focusRingInset}}[part=backdrop]{position:fixed;inset:var(--lr-widget-backdrop-inset,var(--_lr-widget-backdrop-inset,0));background:var(--lr-widget-overlay-color,var(--_lr-widget-overlay-color));z-index:var(--lr-overlay-stack-index,var(--lr-layer-modal))}:host([fullscreen]) [part=base]{position:fixed;inset:var(--lr-widget-fullscreen-inset,var(--_lr-widget-fullscreen-inset,0));z-index:calc(var(--lr-overlay-stack-index,var(--lr-layer-modal)) + 1);background:var(--lr-widget-bg,var(--lr-overlay-surface,var(--lr-color-surface-container-highest)));box-shadow:var(--lr-overlay-shadow-modal,var(--lr-shadow-xl))}:host([fullscreen]) [part=body]{block-size:100%}:host(:is([size='2xs'],[size=xs],[size=s],[size=small])) [part=header]{padding:var(--lr-widget-header-padding,var(--lr-space-xs) var(--lr-space-s));gap:var(--lr-widget-gap,var(--lr-space-xs))}:host(:is([size='2xs'],[size=xs],[size=s],[size=small])) [part=body]{padding:var(--lr-widget-body-padding,var(--lr-space-s))}@media (prefers-reduced-motion:reduce){[part=collapse-button],[part=fullscreen-button]{transition:none!important}}${forcedColorsSelected} `;export{styles};
|
|
1
|
+
import{activeFill,focusRing,focusRingInset,focusRingRoom,iconHitTarget,interactiveTransition}from"../../../internal/interactive-control.styles.js";import{forcedColorsSelected}from"../../../internal/forced-colors.styles.js";import{css}from"lit";const styles=css` :host{display:block;--_lr-widget-overlay-color:var(--lr-color-overlay);--_lr-widget-fullscreen-inset:max( var(--lr-space-l), var(--lr-safe-area-top) ) max(var(--lr-space-l), var(--lr-safe-area-inline-end)) max(var(--lr-space-l), var(--lr-safe-area-bottom)) max(var(--lr-space-l), var(--lr-safe-area-inline-start));--_lr-widget-backdrop-inset:0}[part=base]{display:flex;flex-direction:column;box-sizing:border-box;border:var(--lr-border-width-thin) solid var(--lr-color-border-subtle);border-radius:var(--lr-radius);background:var(--lr-color-surface);overflow:hidden}:host(:not([fullscreen])) [part=base]{border-color:var(--lr-widget-border-color,var(--lr-color-border-subtle));border-radius:var(--lr-widget-radius,var(--lr-radius));background:var(--lr-widget-bg,var(--lr-color-surface));block-size:100%;min-block-size:0}[part=header]{display:flex;flex:0 0 auto;align-items:center;flex-wrap:wrap;min-inline-size:0;gap:var(--lr-widget-gap,var(--lr-space-s));padding:var(--lr-widget-header-padding,var(--lr-space-s) var(--lr-space-m));border-block-end:var(--lr-widget-header-divider,var(--lr-border-width-thin) solid var(--lr-color-border-subtle))}[part=title]{display:flex;align-items:center;gap:var(--lr-space-xs);flex:1 1 auto;min-inline-size:0}[part=icon]{display:inline-flex;flex:0 0 auto;align-items:center}[part=icon][hidden]{display:none}[part=label-group]{display:flex;flex-direction:column;min-inline-size:0}[part=label],[part=sublabel]{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}[part=label]{font-weight:var(--lr-font-weight-semibold)}[part=sublabel]{font-size:var(--lr-font-size-sm);color:var(--lr-color-text-quiet)}[part=label][hidden],[part=sublabel][hidden]{display:none}[part=actions]{--_lr-widget-ring-room: ${focusRingRoom};padding:var(--_lr-widget-ring-room);margin:calc(-1 * var(--_lr-widget-ring-room));display:flex;flex:0 1 auto;align-items:center;min-inline-size:0;max-inline-size:100%;gap:var(--lr-space-xs);overflow-x:auto;overflow-y:hidden}[part=actions][hidden]{display:none}[part=actions] ::slotted(*){flex-shrink:0;max-inline-size:none}[part=view-toggles]{display:flex;flex:0 1 auto;min-inline-size:0;max-inline-size:100%;gap:var(--lr-space-2xs);overflow-x:auto;overflow-y:hidden}[part=view-toggle]{display:inline-flex;flex:0 1 auto;align-items:center;justify-content:center;${iconHitTarget} max-inline-size:100%;gap:var(--lr-space-2xs);padding:var(--lr-size-0-125rem) var(--lr-space-s);border:var(--lr-border-width-thin) solid var(--lr-color-border);border-radius:var(--lr-radius-pill);background:transparent;color:var(--lr-color-text-quiet);font:inherit;font-size:var(--lr-font-size-sm);cursor:pointer;${interactiveTransition}}[part=view-icon]{display:inline-flex;flex:0 0 auto}[part=view-label]{min-inline-size:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}:where([part=view-toggle]):hover{background:var(--lr-widget-view-toggle-hover-bg,var(--lr-color-brand-quiet));color:var(--lr-widget-view-toggle-hover-color,var(--lr-color-text))}:where([part=view-toggle]):active{background: ${activeFill("var(--lr-widget-view-toggle-hover-bg, var(--lr-color-brand-quiet))")};color:var(--lr-widget-view-toggle-hover-color,var(--lr-color-text))}[part=view-toggle][aria-pressed=true]{background:var(--lr-widget-view-toggle-active-bg,var(--lr-color-brand-quiet));color:var(--lr-widget-view-toggle-active-color,var(--lr-color-brand));border-color:var(--lr-widget-view-toggle-active-border-color,transparent)}[part=view-toggle][aria-pressed=true]:active{background: ${activeFill("var(--lr-widget-view-toggle-active-bg, var(--lr-color-brand-quiet))")};color:var(--lr-widget-view-toggle-active-color,var(--lr-color-brand))}[part=view-toggle]:focus-visible{${focusRingInset}}[part=collapse-button],[part=fullscreen-button]{display:inline-flex;align-items:center;justify-content:center;${iconHitTarget} border:none;background:transparent;color:var(--lr-color-text-quiet);border-radius:var(--lr-radius);font:inherit;cursor:pointer;transition:var(--lr-transition-interactive),transform var(--lr-transition-fast)}[part=collapse-button]:hover{background:var(--lr-widget-collapse-button-hover-bg,var(--lr-color-brand-quiet));color:var(--lr-widget-collapse-button-hover-color,var(--lr-color-brand))}[part=fullscreen-button]:hover{background:var(--lr-widget-fullscreen-button-hover-bg,var(--lr-color-brand-quiet));color:var(--lr-widget-fullscreen-button-hover-color,var(--lr-color-brand))}[part=collapse-button]:active{background: ${activeFill("var(--lr-widget-collapse-button-hover-bg, var(--lr-color-brand-quiet))")};color:var(--lr-widget-collapse-button-hover-color,var(--lr-color-brand))}[part=fullscreen-button]:active{background: ${activeFill("var(--lr-widget-fullscreen-button-hover-bg, var(--lr-color-brand-quiet))")};color:var(--lr-widget-fullscreen-button-hover-color,var(--lr-color-brand))}[part=collapse-button]:focus-visible,[part=fullscreen-button]:focus-visible{${focusRing}}:host(:not([collapsed])) [part=collapse-button]{transform:rotate(90deg)}:host([collapsed]:dir(rtl)) [part=collapse-button]{transform:scaleX(-1)}[part=body]{padding:var(--lr-widget-body-padding,var(--lr-space-m));flex:1 1 auto;min-block-size:0;overflow:auto}[part=body][hidden]{display:none}[part=body]:focus-visible{${focusRingInset}}[part=backdrop]{position:fixed;inset:var(--lr-widget-backdrop-inset,var(--_lr-widget-backdrop-inset,0));background:var(--lr-widget-overlay-color,var(--_lr-widget-overlay-color));z-index:var(--lr-overlay-stack-index,var(--lr-layer-modal))}:host([fullscreen]) [part=base]{position:fixed;inset:var(--lr-widget-fullscreen-inset,var(--_lr-widget-fullscreen-inset,0));z-index:calc(var(--lr-overlay-stack-index,var(--lr-layer-modal)) + 1);background:var(--lr-widget-bg,var(--lr-overlay-surface,var(--lr-color-surface-container-highest)));box-shadow:var(--lr-overlay-shadow-modal,var(--lr-shadow-xl))}:host([fullscreen]) [part=body]{block-size:100%}:host(:is([size='2xs'],[size=xs],[size=s],[size=small])) [part=header]{padding:var(--lr-widget-header-padding,var(--lr-space-xs) var(--lr-space-s));gap:var(--lr-widget-gap,var(--lr-space-xs))}:host(:is([size='2xs'],[size=xs],[size=s],[size=small])) [part=body]{padding:var(--lr-widget-body-padding,var(--lr-space-s))}@media (prefers-reduced-motion:reduce){[part=collapse-button],[part=fullscreen-button]{transition:none!important}}${forcedColorsSelected} `;export{styles};
|