@aceshooting/lyra-ui 32.0.0 → 33.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +224 -1380
- package/README.md +36 -7
- package/custom-elements.slim.json +1 -0
- package/design-tokens.json +1 -1
- package/dist/accent-roles.css +1 -0
- 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 +54 -44
- 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/agent-tools/tool-call-chip/tool-call-chip.class.d.ts +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/chat-composer/chat-composer.class.d.ts +10 -0
- package/dist/components/conversation/code-block/code-block-base.class.d.ts +31 -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 +48 -3
- 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/code-block/code-grammar-registry.d.ts +35 -0
- package/dist/components/conversation/code-block/code-grammar-registry.js +1 -0
- 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 +12 -5
- package/dist/components/conversation/selection-toolbar/selection-toolbar.class.d.ts +1 -1
- 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/usage-badge/usage-badge.class.d.ts +1 -1
- package/dist/components/conversation/voice-picker/voice-picker.class.d.ts +12 -5
- 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 +64 -5
- package/dist/components/data/table/table-support.js +1 -1
- package/dist/components/data/table/table.class.d.ts +78 -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 +54 -8
- 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/catalog-picker-base.d.ts +14 -1
- package/dist/components/forms/checkbox/checkbox.class.js +1 -1
- package/dist/components/forms/checkbox-group/checkbox-group.class.d.ts +28 -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 +18 -3
- package/dist/components/forms/code-editor/code-editor.styles.js +1 -1
- package/dist/components/forms/color-picker/color-picker.class.d.ts +25 -5
- 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-option-html.js +1 -0
- package/dist/components/forms/combobox/combobox.class.d.ts +140 -12
- package/dist/components/forms/combobox/combobox.class.js +113 -22
- package/dist/components/forms/combobox/combobox.styles.js +1 -1
- package/dist/components/forms/country-picker/country-picker.class.d.ts +4 -3
- package/dist/components/forms/currency-picker/currency-picker.class.d.ts +4 -3
- package/dist/components/forms/date-picker/date-input.class.d.ts +53 -3
- 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 +14 -0
- package/dist/components/forms/emoji-picker/emoji-picker.class.js +1 -1
- package/dist/components/forms/icon-button/icon-button.class.d.ts +2 -1
- package/dist/components/forms/icon-button/icon-button.styles.js +1 -1
- package/dist/components/forms/input/input-shared.d.ts +24 -3
- package/dist/components/forms/input/input.styles.js +1 -1
- package/dist/components/forms/input/time-input.class.d.ts +19 -4
- package/dist/components/forms/input/time-input.styles.js +1 -1
- package/dist/components/forms/locale-picker/locale-picker.class.d.ts +17 -5
- package/dist/components/forms/locale-picker/locale-picker.styles.js +1 -1
- package/dist/components/forms/otp-input/otp-input.class.d.ts +8 -3
- package/dist/components/forms/otp-input/otp-input.styles.js +1 -1
- package/dist/components/forms/phone-input/phone-input.class.d.ts +18 -3
- package/dist/components/forms/phone-input/phone-input.styles.js +1 -1
- package/dist/components/forms/radio/radio-group.class.d.ts +23 -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/radio/radio.class.js +2 -2
- package/dist/components/forms/rubric-form/rubric-form.class.d.ts +4 -0
- package/dist/components/forms/select/select.class.d.ts +16 -4
- 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 +8 -3
- package/dist/components/forms/signature-pad/signature-pad.styles.js +1 -1
- package/dist/components/forms/slider/slider.class.d.ts +29 -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 +20 -3
- package/dist/components/forms/textarea/textarea.styles.js +1 -1
- package/dist/components/forms/time-zone-picker/time-zone-picker.class.d.ts +4 -3
- package/dist/components/forms/token-input/token-input.class.d.ts +99 -21
- 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 +4 -3
- 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/command-palette/command-palette.class.d.ts +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 +4 -1
- package/dist/components/layout/menu/menu.styles.js +1 -1
- package/dist/components/layout/navigation-menu-item/navigation-menu-item.class.d.ts +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 +102 -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 +8 -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 +67 -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-source.js +1 -1
- package/dist/components/media/lightbox/lightbox-types.d.ts +4 -1
- package/dist/components/media/lightbox/lightbox.class.d.ts +123 -30
- package/dist/components/media/lightbox/lightbox.class.js +18 -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 +6 -1
- package/dist/components/overlays/context-menu/context-menu.class.js +1 -1
- package/dist/components/overlays/dialog/dialog.class.d.ts +54 -6
- 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 +22 -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 +5 -1
- 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 +30 -4
- package/dist/components/overlays/overlay/popover.class.js +2 -2
- package/dist/components/overlays/overlay/tooltip.class.d.ts +7 -0
- package/dist/components/overlays/overlay/tooltip.class.js +4 -4
- package/dist/components/overlays/toast/toast-item.class.d.ts +3 -2
- 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/retrieval/citation-badge/citation-badge.class.d.ts +1 -1
- package/dist/components/retrieval/entity-chip/entity-chip.class.d.ts +1 -1
- package/dist/components/utility/copy-button/copy-button.class.d.ts +4 -1
- 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 +6 -1
- package/dist/components/utility/export-button/export-button.styles.js +1 -1
- package/dist/components/utility/icon/icon-library-bootstrap.d.ts +50 -0
- package/dist/components/utility/icon/icon-library-bootstrap.js +1 -0
- package/dist/components/utility/icon/icon-library-font-awesome.d.ts +68 -0
- package/dist/components/utility/icon/icon-library-font-awesome.js +1 -0
- 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 +14 -0
- package/dist/components/utility/mention-popover/mention-popover.class.d.ts +1 -1
- package/dist/components/utility/number-ticker/number-ticker.class.d.ts +66 -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/utility/tour/tour.class.d.ts +1 -1
- 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/accessibility-visibility.js +1 -1
- package/dist/internal/all-defined-arguments.d.ts +19 -0
- package/dist/internal/all-defined-arguments.js +1 -0
- package/dist/internal/autoloader-manifest.js +1 -1
- 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/declarative-overlay-action.js +1 -0
- 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-token-css.generated.js +10 -0
- package/dist/internal/document-tokens.generated.js +2 -11
- package/dist/internal/document-tokens.js +2 -2
- package/dist/internal/dom-guards.js +1 -1
- package/dist/internal/external-label-association.js +1 -0
- package/dist/internal/focus-navigation.js +1 -1
- package/dist/internal/form-control/chrome.styles.js +1 -1
- package/dist/internal/form-control-labels.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.d.ts +11 -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/internal/theme-observation.js +1 -1
- 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-citation-badge.md +1 -1
- package/llms/components/lr-code-block-core.md +39 -9
- package/llms/components/lr-code-block.md +59 -6
- package/llms/components/lr-code-editor.md +11 -1
- package/llms/components/lr-color-picker.md +19 -6
- package/llms/components/lr-combobox.md +81 -9
- package/llms/components/lr-context-menu.md +6 -4
- package/llms/components/lr-copy-button.md +6 -4
- package/llms/components/lr-counter.md +60 -0
- package/llms/components/lr-country-picker.md +4 -0
- package/llms/components/lr-currency-picker.md +4 -0
- 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 +101 -9
- package/llms/components/lr-divider.md +14 -5
- package/llms/components/lr-doughnut-chart.md +1 -1
- package/llms/components/lr-drawer.md +32 -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-entity-chip.md +1 -1
- package/llms/components/lr-export-button.md +6 -3
- 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 +104 -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 +119 -14
- 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-mention-popover.md +1 -1
- package/llms/components/lr-menu-item.md +1 -1
- package/llms/components/lr-menu-label.md +5 -2
- package/llms/components/lr-menu.md +22 -7
- package/llms/components/lr-model-select.md +13 -3
- 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 +60 -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 +26 -6
- 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 +11 -3
- package/llms/components/lr-selection-toolbar.md +1 -1
- 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 +67 -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 +9 -2
- package/llms/components/lr-time-zone-picker.md +4 -0
- package/llms/components/lr-timeline-item.md +1 -1
- package/llms/components/lr-timeline.md +47 -3
- package/llms/components/lr-toast-item.md +1 -1
- package/llms/components/lr-toast.md +8 -3
- package/llms/components/lr-token-input.md +68 -11
- package/llms/components/lr-tool-call-chip.md +1 -1
- package/llms/components/lr-tooltip.md +8 -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 +4 -0
- package/llms/components/lr-usage-badge.md +1 -1
- package/llms/components/lr-video.md +5 -4
- package/llms/components/lr-voice-picker.md +10 -2
- package/llms/components/lr-widget.md +2 -2
- package/llms/components/lr-zoomable-frame.md +8 -0
- package/llms/index.md +205 -201
- package/llms/migration.md +103 -16
- package/llms/peers.md +3 -3
- package/llms/shared/events-and-types.md +36 -0
- package/llms/shared/forms-and-accessibility.md +4 -1
- package/llms/shared/frameworks-and-ssr.md +10 -1
- package/llms/shared/imports-and-registration.md +68 -2
- package/llms/shared/localization-and-rtl.md +5 -0
- package/llms/shared/native-styles-and-utilities.md +142 -7
- package/llms/shared/styles-and-tokens.md +60 -6
- package/llms/shared/testing-and-utilities.md +30 -0
- package/llms/shared.md +354 -17
- package/llms/tokens.md +6 -1
- package/llms.txt +3 -3
- package/locales.json +1 -1
- package/package.json +48 -10
- package/registrations.json +1 -1
- package/skills/compose-lyra-interfaces/SKILL.md +1 -1
- package/skills/lyra-ui/SKILL.md +1 -1
- package/skills/lyra-ui/commands/migrate.md +1 -1
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{__decorate}from"tslib";import{AccessibleTextController}from"../../../internal/accessible-text-controller.js";import{html,nothing}from"lit";import{property,query,state}from"lit/decorators.js";import{composedAccessibilityText,isAccessibilitySubtreeExcluded}from"../../../internal/accessibility-visibility.js";import{applyComposedFocusRepair,captureComposedFocusRepair,nearestExternalFocusTarget,repairComposedFocus}from"../../../internal/focus-navigation.js";import{LyraElement}from"../../../internal/lyra-element.js";import{closeIcon}from"../../../internal/icons.js";import{variants}from"../../../internal/variants.styles.js";import{LyraBadge}from"./badge.class.js";import{styles as badgeStyles}from"./badge.styles.js";import{styles as tagStyles}from"./tag.styles.js";import{LYRA_DEFAULT_remove,LYRA_DEFAULT_removeWithContext}from"../../../internal/default-strings/shared.generated.js";function sourceParent(node){if(node.parentElement)return node.parentElement;const root=node.getRootNode();return"host"in root?root.host:null}function isClosedSourceDetailsBranch(details,branch){return details.localName!=="details"||details.hasAttribute("open")||branch===null?!1:Array.from(details.children).find(child=>child.localName==="summary")!==branch}function isSourceLabelAvailable(node){const target=node.nodeType===1?node:sourceParent(node);if(!target?.isConnected)return!1;let branch=target,current=sourceParent(target);if(isAccessibilitySubtreeExcluded(target))return!1;for(;current;){if(isAccessibilitySubtreeExcluded(current)||isClosedSourceDetailsBranch(current,branch))return!1;branch=current,current=sourceParent(current)}return!0}class LyraTag extends LyraBadge{constructor(){super(...arguments),this.disabled=!1,this.removeEnabled=!1,this.changingRemoveAliasAttribute=!1,this.labelTextObserver=new AccessibleTextController(this,[""],()=>{this.syncHostActionRole(),this.updateBrowserDerivedState(()=>this.recomputeLabelText())},["slot","role"],!1),this.managedActionGroupRole=!1,this.labelText="",this.onLabelSlotChange=event=>{const target=event.target;target?.nodeType!==1||target.localName!=="slot"||(this.labelTextObserver.bind(),this.withRemove&&this.updateBrowserDerivedState(()=>this.recomputeLabelText()))},this.onRemoveClick=()=>{if(!this.withRemove||this.disabled)return;const repair=captureComposedFocusRepair(this,()=>nearestExternalFocusTarget(this));this.emit("lr-remove",{value:this.value}),repair&&(!this.isConnected||!this.withRemove)&&applyComposedFocusRepair(repair)}}static{this.defaultStrings={...super.defaultStrings,remove:LYRA_DEFAULT_remove,removeWithContext:LYRA_DEFAULT_removeWithContext}}static{this.styles=[LyraElement.styles,variants,badgeStyles,tagStyles]}static{this.properties={withRemove:{attribute:"with-remove",type:Boolean,noAccessor:!0},removable:{attribute:"removable",type:Boolean,noAccessor:!0}}}get effectiveVariant(){return this.variant==="text"?"neutral":super.effectiveVariant}get withRemove(){return this.removeEnabled}set withRemove(next){this.setRemoveEnabled(!!next,"with-remove")}get removable(){return this.removeEnabled}set removable(next){this.setRemoveEnabled(!!next,"removable")}attributeChangedCallback(name,oldValue,value){const isRemoveAlias=name==="with-remove"||name==="removable";isRemoveAlias&&(this.changingRemoveAliasAttribute=!0);try{super.attributeChangedCallback(name,oldValue,value)}finally{isRemoveAlias&&(this.changingRemoveAliasAttribute=!1)}}setRemoveEnabled(next,preferredAttribute){const old=this.removeEnabled;this.changingRemoveAliasAttribute?this.removeEnabled=this.hasAttribute("with-remove")||this.hasAttribute("removable"):next?(this.setAttribute(preferredAttribute,""),this.removeEnabled=!0):(this.removeAttribute("with-remove"),this.removeAttribute("removable"),this.removeEnabled=!1),old!==this.removeEnabled&&(this.requestUpdate("withRemove",old),this.requestUpdate("removable",old))}connectedCallback(){super.connectedCallback(),this.addEventListener("slotchange",this.onLabelSlotChange),this.syncLabelObserver(),this.hasUpdated?(this.withRemove&&this.recomputeLabelText(!0),this.ownerDocument.defaultView?.queueMicrotask(()=>{this.isConnected&&this.withRemove&&this.recomputeLabelText()})):this.seedFirstRenderState(()=>this.recomputeLabelText(!0))}disconnectedCallback(){this.removeEventListener("slotchange",this.onLabelSlotChange),this.releaseHostActionRole(),super.disconnectedCallback()}adoptedCallback(){super.adoptedCallback(),this.labelTextObserver.adopted()}syncLabelObserver(){this.labelTextObserver.setEnabled(this.withRemove)}recomputeLabelText(preferLightDom=!1){const slot=this.renderRoot?.querySelector("slot:not([name])"),lightDomNodes=this.childNodes,nodes=slot?slot.assignedNodes({flatten:!0}):Array.from(lightDomNodes??[]).filter(node=>{if(node.nodeType!==1)return!0;const slotName=node.getAttribute("slot");return slotName!=="start"&&slotName!=="end"});this.labelText=nodes.map(node=>composedAccessibilityText(node,{ancestorBoundary:this,isSubtreeExcluded:element=>element.getRootNode()===this.renderRoot&&element.getAttribute("part")?.split(/\s+/).includes("content")?!1:isAccessibilitySubtreeExcluded(element),requireRendered:preferLightDom?!1:node.nodeType!==1||node.localName!=="slot",shouldPruneNode:candidate=>!this.contains(candidate)&&!isSourceLabelAvailable(candidate),ignoreInheritedVisibility:!0})).join(" ").replace(/\s+/g," ").trim()}get accessibleRemoveLabel(){const text=this.labelText;return text?this.localize("removeWithContext",void 0,{label:text}):this.localize("remove")}focus(options){this.deferFocusUntilRendered(options)||this.withRemove&&this.removeButtonEl?.focus(options)}blur(){this.removeButtonEl?.blur()}click(){if(!this.withRemove){super.click();return}this.removeButtonEl?.click()}willUpdate(changed){if(super.willUpdate(changed),changed.has("withRemove")&&!this.withRemove||changed.has("disabled")&&this.disabled){const button=this.removeButtonEl;button&&repairComposedFocus(button,()=>[nearestExternalFocusTarget(this)])}changed.has("withRemove")&&(this.syncLabelObserver(),this.withRemove&&this.hasUpdated&&this.recomputeLabelText())}updated(changed){super.updated(changed),this.syncHostActionRole()}syncHostActionRole(){const needsGroup=this.withRemove&&this.hasAttribute("aria-label");needsGroup&&!this.hasAttribute("role")?(this.setAttribute("role","group"),this.managedActionGroupRole=!0):needsGroup||this.releaseHostActionRole()}releaseHostActionRole(){this.managedActionGroupRole&&this.getAttribute("role")==="group"&&this.removeAttribute("role"),this.managedActionGroupRole=!1}renderTrailing(){return this.withRemove?html`<button part="remove-button remove-button__base" type="button" ?disabled=${this.disabled} aria-label=${this.accessibleRemoveLabel} @click=${this.onRemoveClick} >
|
|
1
|
+
import{__decorate}from"tslib";import{AccessibleTextController}from"../../../internal/accessible-text-controller.js";import{html,nothing}from"lit";import{property,query,state}from"lit/decorators.js";import{composedAccessibilityText,isAccessibilitySubtreeExcluded}from"../../../internal/accessibility-visibility.js";import{applyComposedFocusRepair,captureComposedFocusRepair,nearestExternalFocusTarget,repairComposedFocus}from"../../../internal/focus-navigation.js";import{LyraElement}from"../../../internal/lyra-element.js";import{closeIcon}from"../../../internal/icons.js";import{variants}from"../../../internal/variants.styles.js";import{LyraBadge}from"./badge.class.js";import{styles as badgeStyles}from"./badge.styles.js";import{styles as tagStyles}from"./tag.styles.js";import{LYRA_DEFAULT_remove,LYRA_DEFAULT_removeWithContext}from"../../../internal/default-strings/shared.generated.js";function sourceParent(node){if(node.parentElement)return node.parentElement;const root=node.getRootNode();return"host"in root?root.host:null}function isClosedSourceDetailsBranch(details,branch){return details.localName!=="details"||details.hasAttribute("open")||branch===null?!1:Array.from(details.children).find(child=>child.localName==="summary")!==branch}function isSourceLabelAvailable(node){const target=node.nodeType===1?node:sourceParent(node);if(!target?.isConnected)return!1;let branch=target,current=sourceParent(target);if(isAccessibilitySubtreeExcluded(target))return!1;for(;current;){if(isAccessibilitySubtreeExcluded(current)||isClosedSourceDetailsBranch(current,branch))return!1;branch=current,current=sourceParent(current)}return!0}class LyraTag extends LyraBadge{constructor(){super(...arguments),this.disabled=!1,this.removeEnabled=!1,this.changingRemoveAliasAttribute=!1,this.labelTextObserver=new AccessibleTextController(this,[""],()=>{this.syncHostActionRole(),this.updateBrowserDerivedState(()=>this.recomputeLabelText())},["slot","role"],!1),this.managedActionGroupRole=!1,this.labelText="",this.onLabelSlotChange=event=>{const target=event.target;target?.nodeType!==1||target.localName!=="slot"||(this.labelTextObserver.bind(),this.withRemove&&this.updateBrowserDerivedState(()=>this.recomputeLabelText()))},this.onRemoveClick=()=>{if(!this.withRemove||this.disabled)return;const repair=captureComposedFocusRepair(this,()=>nearestExternalFocusTarget(this));this.emit("lr-remove",{value:this.value}),repair&&(!this.isConnected||!this.withRemove)&&applyComposedFocusRepair(repair)}}static{this.defaultStrings={...super.defaultStrings,remove:LYRA_DEFAULT_remove,removeWithContext:LYRA_DEFAULT_removeWithContext}}static{this.styles=[LyraElement.styles,variants,badgeStyles,tagStyles]}static{this.properties={withRemove:{attribute:"with-remove",type:Boolean,noAccessor:!0},removable:{attribute:"removable",type:Boolean,noAccessor:!0}}}get effectiveVariant(){return this.variant==="text"?"neutral":super.effectiveVariant}get withRemove(){return this.removeEnabled}set withRemove(next){this.setRemoveEnabled(!!next,"with-remove")}get removable(){return this.removeEnabled}set removable(next){this.setRemoveEnabled(!!next,"removable")}attributeChangedCallback(name,oldValue,value){const isRemoveAlias=name==="with-remove"||name==="removable";isRemoveAlias&&(this.changingRemoveAliasAttribute=!0);try{super.attributeChangedCallback(name,oldValue,value)}finally{isRemoveAlias&&(this.changingRemoveAliasAttribute=!1)}}setRemoveEnabled(next,preferredAttribute){const old=this.removeEnabled;this.changingRemoveAliasAttribute?this.removeEnabled=this.hasAttribute("with-remove")||this.hasAttribute("removable"):next?(this.setAttribute(preferredAttribute,""),this.removeEnabled=!0):(this.removeAttribute("with-remove"),this.removeAttribute("removable"),this.removeEnabled=!1),old!==this.removeEnabled&&(this.requestUpdate("withRemove",old),this.requestUpdate("removable",old))}connectedCallback(){super.connectedCallback(),this.addEventListener("slotchange",this.onLabelSlotChange),this.syncLabelObserver(),this.hasUpdated?(this.withRemove&&this.recomputeLabelText(!0),this.ownerDocument.defaultView?.queueMicrotask(()=>{this.isConnected&&this.withRemove&&this.recomputeLabelText()})):this.seedFirstRenderState(()=>this.recomputeLabelText(!0))}disconnectedCallback(){this.removeEventListener("slotchange",this.onLabelSlotChange),this.releaseHostActionRole(),super.disconnectedCallback()}adoptedCallback(){super.adoptedCallback(),this.labelTextObserver.adopted()}syncLabelObserver(){this.labelTextObserver.setEnabled(this.withRemove)}recomputeLabelText(preferLightDom=!1){const slot=this.renderRoot?.querySelector("slot:not([name])"),lightDomNodes=this.childNodes,nodes=slot?slot.assignedNodes({flatten:!0}):Array.from(lightDomNodes??[]).filter(node=>{if(node.nodeType!==1)return!0;const slotName=node.getAttribute("slot");return slotName!=="start"&&slotName!=="end"});this.labelText=nodes.map(node=>composedAccessibilityText(node,{ancestorBoundary:this,isSubtreeExcluded:element=>element.getRootNode()===this.renderRoot&&element.getAttribute("part")?.split(/\s+/).includes("content")?!1:isAccessibilitySubtreeExcluded(element),requireRendered:preferLightDom?!1:node.nodeType!==1||node.localName!=="slot",shouldPruneNode:candidate=>!this.contains(candidate)&&!isSourceLabelAvailable(candidate),ignoreInheritedVisibility:!0})).join(" ").replace(/\s+/g," ").trim()}get accessibleRemoveLabel(){const text=this.labelText;return text?this.localize("removeWithContext",void 0,{label:text}):this.localize("remove")}focus(options){this.deferFocusUntilRendered(options)||this.withRemove&&this.removeButtonEl?.focus(options)}blur(){this.removeButtonEl?.blur()}click(){if(!this.withRemove){super.click();return}this.removeButtonEl?.click()}willUpdate(changed){if(super.willUpdate(changed),changed.has("withRemove")&&!this.withRemove||changed.has("disabled")&&this.disabled){const button=this.removeButtonEl;button&&repairComposedFocus(button,()=>[nearestExternalFocusTarget(this)])}changed.has("withRemove")&&(this.syncLabelObserver(),this.withRemove&&this.hasUpdated&&this.recomputeLabelText())}updated(changed){super.updated(changed),this.syncHostActionRole()}syncHostActionRole(){const needsGroup=this.withRemove&&this.hasAttribute("aria-label");needsGroup&&!this.hasAttribute("role")?(this.setAttribute("role","group"),this.managedActionGroupRole=!0):needsGroup||this.releaseHostActionRole()}releaseHostActionRole(){this.managedActionGroupRole&&this.getAttribute("role")==="group"&&this.removeAttribute("role"),this.managedActionGroupRole=!1}renderTrailing(){return this.withRemove?html`<button part="remove-button remove-button__base remove-button__button" type="button" ?disabled=${this.disabled} aria-label=${this.accessibleRemoveLabel} @click=${this.onRemoveClick} >
|
|
2
2
|
${closeIcon()}
|
|
3
3
|
</button>`:nothing}}__decorate([property()],LyraTag.prototype,"value",void 0),__decorate([property({type:Boolean,reflect:!0})],LyraTag.prototype,"disabled",void 0),__decorate([state()],LyraTag.prototype,"labelText",void 0),__decorate([query('[part~="remove-button"]')],LyraTag.prototype,"removeButtonEl",void 0);export{LyraTag};
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
import{type PropertyValues,type TemplateResult}from'lit';import{LyraElement}from'../../../internal/lyra-element.js';export interface ChipGroupOverflowToggleDetail{expanded:boolean;}
|
|
1
|
+
import{type PropertyValues,type TemplateResult}from'lit';import{LyraElement}from'../../../internal/lyra-element.js';export interface ChipGroupOverflowToggleDetail{expanded:boolean;}
|
|
2
|
+
/** How a chip group manages its toggleable chips: `none` (default) leaves them alone.*/
|
|
3
|
+
export type LyraChipGroupSelection='none'|'single'|'multiple';export interface ChipGroupChangeDetail{
|
|
4
|
+
/** The new selection: a string (empty when nothing is selected) in `single`, an array in `multiple`.*/
|
|
5
|
+
value:string|string[];}export interface LyraChipGroupEventMap{'lr-overflow-toggle':CustomEvent<ChipGroupOverflowToggleDetail>;'lr-change':CustomEvent<ChipGroupChangeDetail>;}
|
|
2
6
|
/**
|
|
3
7
|
* `<lr-chip-group>` — a flex-wrap container for a set of `<lr-chip>`
|
|
4
8
|
* children (plain light-DOM composition — direct children are the chips,
|
|
@@ -24,11 +28,24 @@ import{type PropertyValues,type TemplateResult}from'lit';import{LyraElement}from
|
|
|
24
28
|
*
|
|
25
29
|
* Collapsed groups reapply max-visible when assigned children are replaced or reordered at the same count, preserving authored hidden/inert state and releasing departed visibility leases.
|
|
26
30
|
*
|
|
31
|
+
* An opt-in selection model turns the group into a filter bar. `selection="single"` or `"multiple"`
|
|
32
|
+
* makes the group own the pressed state of every direct `<lr-chip>` child that has a `value`: it
|
|
33
|
+
* sets them `toggleable`, presses the ones named by `value`, and, in `single`, releases the others
|
|
34
|
+
* when one is pressed. Pressing a pressed chip releases it, so the selection may be empty. A chip
|
|
35
|
+
* without a `value` is left alone. `value` is a string in `single` and an array in `multiple`; as an
|
|
36
|
+
* attribute it is the string, comma-separated in `multiple`. An unknown value is kept (it simply
|
|
37
|
+
* presses no chip). Setting `value` is silent; `lr-change` fires only from a user press.
|
|
38
|
+
* `all-value` names an optional "all" chip, the child whose `value` equals it: it is pressed while
|
|
39
|
+
* the selection is empty, pressing it clears the selection, and it cannot be un-pressed. It is never
|
|
40
|
+
* part of `value`. With `selection` unset the group behaves exactly as before.
|
|
41
|
+
*
|
|
27
42
|
* @customElement lr-chip-group
|
|
28
43
|
* @slot - `<lr-chip>` elements (or any content, though the chip pairing is
|
|
29
44
|
* the intended usage).
|
|
30
45
|
* @event lr-overflow-toggle - The overflow indicator was activated,
|
|
31
46
|
* revealing or re-collapsing the excess children. `detail: { expanded }`.
|
|
47
|
+
* @event lr-change - A user press changed the selection (`selection` is `single` or `multiple`).
|
|
48
|
+
* `detail: { value }`.
|
|
32
49
|
* @csspart base - The flex-wrap container (holds both the slot and the overflow indicator).
|
|
33
50
|
* Carries `role="group"` and the accessible name when one is supplied -- see `accessibleLabel`.
|
|
34
51
|
* @csspart overflow-indicator - The "+N" / "Show less" toggle button. Only rendered while `max-visible` is actively causing an overflow.
|
|
@@ -55,14 +72,24 @@ import{type PropertyValues,type TemplateResult}from'lit';import{LyraElement}from
|
|
|
55
72
|
* @status stable
|
|
56
73
|
* @since 4.0.0
|
|
57
74
|
*/
|
|
58
|
-
export declare class LyraChipGroup extends LyraElement<LyraChipGroupEventMap>{static styles:import("lit").CSSResultGroup[];private _maxVisible?;
|
|
75
|
+
export declare class LyraChipGroup extends LyraElement<LyraChipGroupEventMap>{protected static collectionSupport:import("../../../internal/lyra-element.js").LyraCollectionSupport;protected static readonly immutableEventDetails:readonly string[];static styles:import("lit").CSSResultGroup[];private _maxVisible?;
|
|
59
76
|
/** Maximum number of assigned children shown before the rest collapse behind a "+N"
|
|
60
77
|
* indicator. Flattened slot-forwarded children count the same as direct light-DOM children.
|
|
61
78
|
* Unset (the default) means no limit — every child is always shown. Any explicitly assigned
|
|
62
79
|
* value is sanitized to a finite, non-negative integer via `finiteCount` — this feeds the
|
|
63
80
|
* `hasOverflow`/`syncChildVisibility` index comparisons below directly, so a NaN/negative value
|
|
64
81
|
* must never reach them. */
|
|
65
|
-
get maxVisible():number|undefined;set maxVisible(next:number|undefined|null);
|
|
82
|
+
get maxVisible():number|undefined;set maxVisible(next:number|undefined|null);private _selection;
|
|
83
|
+
/** `none` (default): the group does not manage chip state. `single` allows zero or one pressed
|
|
84
|
+
* chip, `multiple` any number. Unsupported values fall back to `none`. */
|
|
85
|
+
get selection():LyraChipGroupSelection;set selection(next:LyraChipGroupSelection);private selectedValues;private rawValue;private parseSelection;
|
|
86
|
+
/** The pressed chips' values: a string in `single` (empty when none), an array otherwise. In
|
|
87
|
+
* `single` an array assignment keeps its first entry; in `multiple` a string is read as a
|
|
88
|
+
* comma-separated list. `null`/`undefined` clears. Silent: never fires `lr-change`.
|
|
89
|
+
* @default '' */
|
|
90
|
+
get value():string|string[];set value(next:string|readonly string[]|null|undefined);
|
|
91
|
+
/** The `value` of the optional "all" chip (selection mode only). Unset means no all chip.*/
|
|
92
|
+
allValue?:string;
|
|
66
93
|
/**
|
|
67
94
|
* Accessible name for the group, forwarded to `[part="base"]`.
|
|
68
95
|
*
|
|
@@ -77,4 +104,4 @@ get maxVisible():number|undefined;set maxVisible(next:number|undefined|null);
|
|
|
77
104
|
* verbosity without adding information, and applying it unconditionally would change the
|
|
78
105
|
* accessibility tree of every decorative chip row already shipped.
|
|
79
106
|
*/
|
|
80
|
-
accessibleLabel:string;private childCount;private expanded;private readonly authorHidden;private readonly observedChildren;private readonly pendingHiddenWrites;private visibilityObserver?;private visibilityObserverDocument?;private trackedChipFocus?;private overflowFocusRepair?;connectedCallback():void;private armVisibilityObserver;protected willUpdate(changed:PropertyValues<this>):void;firstUpdated(changed:PropertyValues<this>):void;protected updated(changed:PropertyValues<this>):void;disconnectedCallback():void;adoptedCallback():void;private resetVisibilityObserver;private get hasOverflow();private assignedChildren;private isAuthorHidden;private isCapacityEligible;private eligibleChildren;private childWillBeVisible;private focusRepairBeforeVisibility;private focusTargetAfterVisibility;private reconcileChildVisibilityAndFocus;private syncChildVisibility;private observeChildren;private drainVisibilityRecords;private processHiddenMutations;private recordHiddenWrite;private setManagedHidden;private restoreChildVisibility;private onSlotChange;private onFocusIn;private onFocusOut;private onToggleOverflow;render():TemplateResult;}declare global{interface HTMLElementTagNameMap{'lr-chip-group':LyraChipGroup;}}
|
|
107
|
+
accessibleLabel:string;private childCount;private expanded;private readonly authorHidden;private readonly observedChildren;private readonly pendingHiddenWrites;private visibilityObserver?;private visibilityObserverDocument?;private trackedChipFocus?;private overflowFocusRepair?;connectedCallback():void;private armVisibilityObserver;protected willUpdate(changed:PropertyValues<this>):void;firstUpdated(changed:PropertyValues<this>):void;protected updated(changed:PropertyValues<this>):void;disconnectedCallback():void;adoptedCallback():void;private resetVisibilityObserver;private get hasOverflow();private assignedChildren;private isAuthorHidden;private isCapacityEligible;private eligibleChildren;private childWillBeVisible;private focusRepairBeforeVisibility;private focusTargetAfterVisibility;private reconcileChildVisibilityAndFocus;private syncChildVisibility;private observeChildren;private drainVisibilityRecords;private processHiddenMutations;private recordHiddenWrite;private setManagedHidden;private restoreChildVisibility;private onSlotChange;private onFocusIn;private onFocusOut;private managedChips;private isAllChip;private syncSelectedChips;private onChipToggleRequest;private onChipChange;private onToggleOverflow;render():TemplateResult;}declare global{interface HTMLElementTagNameMap{'lr-chip-group':LyraChipGroup;}}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import{__decorate}from"tslib";import{html,nothing}from"lit";import{property,state}from"lit/decorators.js";import{LyraElement}from"../../../internal/lyra-element.js";import{finiteCount}from"../../../internal/numbers.js";import{getNumberFormat}from"../../../internal/intl-cache.js";import{deepActiveElementIn}from"../../../internal/active-element.js";import{applyComposedFocusRepair,captureComposedFocusRepair,collectComposedFocusTargets}from"../../../internal/focus-navigation.js";import{composedContains}from"../../../internal/overlay-manager.js";import{styles}from"./chip-group.styles.js";import{blankNumberConverter}from"../../../internal/converters.js";import{LYRA_DEFAULT_showLess,LYRA_DEFAULT_showMoreCollapsed,LYRA_DEFAULT_showMoreOverflowLabel}from"../../../internal/default-strings/shared.generated.js";class LyraChipGroup extends LyraElement{constructor(){super(...arguments),this.accessibleLabel="",this.childCount=0,this.expanded=!1,this.authorHidden=new Map,this.observedChildren=new Set,this.pendingHiddenWrites=new Map,this.onSlotChange=e=>{const slot=e.target;this.updateBrowserDerivedState(()=>{this.isConnected&&(this.childCount=slot.assignedElements({flatten:!0}).length,this.requestUpdate())})},this.onFocusIn=()=>{const active=deepActiveElementIn(this.ownerDocument),children=this.assignedChildren(),index=children.findIndex(child2=>composedContains(child2,active)),base=this.renderRoot.querySelector('[part="base"]');if(index<0||!base){this.trackedChipFocus=void 0;return}const child=children[index];if(!("focus"in child)){this.trackedChipFocus=void 0;return}const repair=captureComposedFocusRepair(child,base);this.trackedChipFocus=repair?{child,index,repair}:void 0},this.onFocusOut=()=>{const tracked=this.trackedChipFocus;tracked&&queueMicrotask(()=>{if(this.trackedChipFocus!==tracked)return;const active=deepActiveElementIn(this.ownerDocument);if(active!==null&&composedContains(tracked.child,active))return;!tracked.child.isConnected&&(active===null||active===this.ownerDocument.body||active===this.ownerDocument.documentElement)||(this.trackedChipFocus=void 0)})},this.onToggleOverflow=()=>{this.expanded=!this.expanded,this.emit("lr-overflow-toggle",{expanded:this.expanded})}}static{this.defaultStrings={...super.defaultStrings,showLess:LYRA_DEFAULT_showLess,showMoreCollapsed:LYRA_DEFAULT_showMoreCollapsed,showMoreOverflowLabel:LYRA_DEFAULT_showMoreOverflowLabel}}static{this.styles=[LyraElement.styles,styles]}get maxVisible(){return this._maxVisible}set maxVisible(next){const old=this._maxVisible;this._maxVisible=next==null?void 0:finiteCount(next),this.requestUpdate("maxVisible",old)}connectedCallback(){super.connectedCallback(),this.armVisibilityObserver(),this.hasUpdated&&this.reconcileChildVisibilityAndFocus()}armVisibilityObserver(){const ownerDocument=this.ownerDocument;if(!this.isConnected||this.visibilityObserver&&this.visibilityObserverDocument===ownerDocument)return;this.resetVisibilityObserver();const MutationObserverCtor=ownerDocument.defaultView?.MutationObserver;if(!MutationObserverCtor)return;const observer=new MutationObserverCtor(records=>{this.processHiddenMutations(records)&&(this.reconcileChildVisibilityAndFocus(),this.requestUpdate())});this.visibilityObserver=observer,this.visibilityObserverDocument=ownerDocument}willUpdate(changed){if(super.willUpdate(changed),this.hasUpdated||this.seedFirstRenderState(()=>{this.childCount=this.children.length}),!this.hasOverflow){this.expanded=!1;const disclosure=this.shadowRoot?.querySelector('[part="overflow-indicator"]');disclosure&&(this.overflowFocusRepair=captureComposedFocusRepair(disclosure,disclosure)??void 0)}}firstUpdated(changed){super.firstUpdated(changed);const slot=this.shadowRoot.querySelector("slot");queueMicrotask(()=>{this.isConnected&&this.updateBrowserDerivedState(()=>{this.childCount=slot.assignedElements({flatten:!0}).length})})}updated(changed){super.updated(changed);const overflowRepair=this.overflowFocusRepair;this.overflowFocusRepair=void 0,this.reconcileChildVisibilityAndFocus(overflowRepair)}disconnectedCallback(){this.resetVisibilityObserver(),this.observedChildren.clear(),this.pendingHiddenWrites.clear(),this.trackedChipFocus=void 0,this.restoreChildVisibility(),super.disconnectedCallback()}adoptedCallback(){super.adoptedCallback(),this.resetVisibilityObserver(),this.observedChildren.clear(),this.pendingHiddenWrites.clear(),this.trackedChipFocus=void 0}resetVisibilityObserver(){this.drainVisibilityRecords(),this.visibilityObserver?.disconnect(),this.visibilityObserver=void 0,this.visibilityObserverDocument=void 0}get hasOverflow(){const max=this.maxVisible;return max!=null&&this.childCount>0&&this.eligibleChildren().length>max}assignedChildren(){return this.shadowRoot?.querySelector("slot")?.assignedElements({flatten:!0})??Array.from(this.children)}isAuthorHidden(child){return this.authorHidden.get(child)??child.hasAttribute("hidden")}isCapacityEligible(child){return!this.isAuthorHidden(child)&&!child.hasAttribute("inert")}eligibleChildren(children=this.assignedChildren()){return children.filter(child=>this.isCapacityEligible(child))}childWillBeVisible(child,assignedChildren){if(!this.isCapacityEligible(child))return!this.isAuthorHidden(child);const eligibleIndex=this.eligibleChildren(assignedChildren).indexOf(child);return!(this.hasOverflow&&!this.expanded&&eligibleIndex>=this.maxVisible)}focusRepairBeforeVisibility(assignedChildren){const tracked=this.trackedChipFocus;if(!tracked)return null;const currentIndex=assignedChildren.indexOf(tracked.child);if(currentIndex>=0&&this.childWillBeVisible(tracked.child,assignedChildren))return tracked.index=currentIndex,null;const active=deepActiveElementIn(this.ownerDocument),stillOwnsFocus=active!==null&&composedContains(tracked.child,active),focusWasLostWithRemovedBranch=currentIndex<0&&(active===null||active===this.ownerDocument.body||active===this.ownerDocument.documentElement),focusWasLostWithAlreadyHiddenBranch=tracked.child.hasAttribute("hidden")&&(active===null||active===this.ownerDocument.body||active===this.ownerDocument.documentElement);return!stillOwnsFocus&&!focusWasLostWithRemovedBranch&&!focusWasLostWithAlreadyHiddenBranch?null:{index:currentIndex>=0?currentIndex:tracked.index,repair:tracked.repair}}focusTargetAfterVisibility(assignedChildren,originIndex){const chipTargets=assignedChildren.map((child,index)=>({index,target:collectComposedFocusTargets(child,{includeRoot:!1,mode:"programmatic"}).elements[0]})).filter(entry=>entry.target!==void 0).sort((first,second)=>Math.abs(first.index-originIndex)-Math.abs(second.index-originIndex)||first.index-second.index);if(chipTargets[0])return chipTargets[0].target;const disclosure=this.renderRoot.querySelector('[part="overflow-indicator"]');if(disclosure){const available=collectComposedFocusTargets(disclosure,{mode:"programmatic"}).elements[0];if(available)return available}const base=this.renderRoot.querySelector('[part="base"]');return base?collectComposedFocusTargets(base,{mode:"programmatic"}).elements.find(target=>target===base)??null:null}reconcileChildVisibilityAndFocus(overflowRepair){const assignedChildren=this.assignedChildren(),focusRepair=overflowRepair?{index:assignedChildren.length,repair:overflowRepair}:this.focusRepairBeforeVisibility(assignedChildren);if(this.syncChildVisibility(assignedChildren),!focusRepair)return;const candidate=this.focusTargetAfterVisibility(assignedChildren,focusRepair.index);this.trackedChipFocus=void 0,candidate&&applyComposedFocusRepair(focusRepair.repair,candidate)}syncChildVisibility(assignedChildren=this.assignedChildren()){const max=this.maxVisible,overflowing=this.hasOverflow;this.observeChildren(assignedChildren);const current=new Set(assignedChildren);for(const[child,hidden]of this.authorHidden)current.has(child)||(child.toggleAttribute("hidden",hidden),this.authorHidden.delete(child));let eligibleIndex=0;assignedChildren.forEach(element=>{this.authorHidden.has(element)||this.authorHidden.set(element,element.hasAttribute("hidden"));const authored=this.authorHidden.get(element)??!1,eligible=!authored&&!element.hasAttribute("inert"),managed=eligible&&overflowing&&!this.expanded&&eligibleIndex>=max;this.setManagedHidden(element,authored||managed),eligible&&(eligibleIndex+=1)})}observeChildren(children){const next=new Set(children);if(!(next.size===this.observedChildren.size&&[...next].every(child=>this.observedChildren.has(child)))){this.drainVisibilityRecords(),this.visibilityObserver?.disconnect(),this.observedChildren.clear();for(const child of children)this.visibilityObserver?.observe(child,{attributes:!0,attributeFilter:["hidden","inert"],attributeOldValue:!0}),this.observedChildren.add(child)}}drainVisibilityRecords(){const records=this.visibilityObserver?.takeRecords();records?.length&&this.processHiddenMutations(records)}processHiddenMutations(records){let authorChanged=!1;const hiddenTargets=new Set;for(const record of records){if(record.type!=="attributes")continue;const child=record.target;if(this.authorHidden.has(child)){if(record.attributeName==="inert"){authorChanged=!0;continue}record.attributeName==="hidden"&&(hiddenTargets.has(child)&&this.recordHiddenWrite(child,record.oldValue!==null)&&(authorChanged=!0),hiddenTargets.add(child))}}for(const child of hiddenTargets)this.recordHiddenWrite(child,child.hasAttribute("hidden"))&&(authorChanged=!0);return authorChanged}recordHiddenWrite(child,hidden){const pending=this.pendingHiddenWrites.get(child);return pending&&pending.values[pending.cursor]===hidden?(++pending.cursor===pending.values.length&&this.pendingHiddenWrites.delete(child),!1):(this.authorHidden.set(child,hidden),!0)}setManagedHidden(child,hidden){if(child.hasAttribute("hidden")===hidden)return;let pending=this.pendingHiddenWrites.get(child);pending||(pending={values:[],cursor:0},this.pendingHiddenWrites.set(child,pending)),pending.values.push(hidden),child.toggleAttribute("hidden",hidden)}restoreChildVisibility(){for(const[child,hidden]of this.authorHidden)child.toggleAttribute("hidden",hidden);this.authorHidden.clear()}render(){const hasAccessibleLabel=this.hasAttribute("aria-label")||!!this.accessibleLabel,overflowing=this.hasOverflow,hiddenCount=overflowing?this.eligibleChildren().length-this.maxVisible:0,formattedHiddenCount=getNumberFormat(this.effectiveLocale).format(hiddenCount),visible=overflowing?this.expanded?this.localize("showLess"):this.localize("showMoreCollapsed",void 0,{count:formattedHiddenCount}):"";return html`
|
|
2
|
-
<div part="base" tabindex="-1" role=${hasAccessibleLabel?"group":nothing} aria-label=${hasAccessibleLabel?this.accessibleLabel:nothing} @focusin=${this.onFocusIn} @focusout=${this.onFocusOut} >
|
|
1
|
+
import{__decorate}from"tslib";import{html,nothing}from"lit";import{eventCollectionSupport}from"../../../internal/collection-snapshot.js";import{property,state}from"lit/decorators.js";import{LyraElement}from"../../../internal/lyra-element.js";import{finiteCount}from"../../../internal/numbers.js";import{getNumberFormat}from"../../../internal/intl-cache.js";import{deepActiveElementIn}from"../../../internal/active-element.js";import{applyComposedFocusRepair,captureComposedFocusRepair,collectComposedFocusTargets}from"../../../internal/focus-navigation.js";import{composedContains}from"../../../internal/overlay-manager.js";import{styles}from"./chip-group.styles.js";import{blankNumberConverter,literalSetConverter}from"../../../internal/converters.js";import{LYRA_DEFAULT_showLess,LYRA_DEFAULT_showMoreCollapsed,LYRA_DEFAULT_showMoreOverflowLabel}from"../../../internal/default-strings/shared.generated.js";const SELECTION=literalSetConverter(["none","single","multiple"],"none");class LyraChipGroup extends LyraElement{constructor(){super(...arguments),this._selection="none",this.selectedValues=[],this.accessibleLabel="",this.childCount=0,this.expanded=!1,this.authorHidden=new Map,this.observedChildren=new Set,this.pendingHiddenWrites=new Map,this.onSlotChange=e=>{const slot=e.target;this.updateBrowserDerivedState(()=>{this.isConnected&&(this.childCount=slot.assignedElements({flatten:!0}).length,this.requestUpdate())})},this.onFocusIn=()=>{const active=deepActiveElementIn(this.ownerDocument),children=this.assignedChildren(),index=children.findIndex(child2=>composedContains(child2,active)),base=this.renderRoot.querySelector('[part="base"]');if(index<0||!base){this.trackedChipFocus=void 0;return}const child=children[index];if(!("focus"in child)){this.trackedChipFocus=void 0;return}const repair=captureComposedFocusRepair(child,base);this.trackedChipFocus=repair?{child,index,repair}:void 0},this.onFocusOut=()=>{const tracked=this.trackedChipFocus;tracked&&queueMicrotask(()=>{if(this.trackedChipFocus!==tracked)return;const active=deepActiveElementIn(this.ownerDocument);if(active!==null&&composedContains(tracked.child,active))return;!tracked.child.isConnected&&(active===null||active===this.ownerDocument.body||active===this.ownerDocument.documentElement)||(this.trackedChipFocus=void 0)})},this.onChipToggleRequest=event=>{const chip=event.target;this.managedChips().includes(chip)&&this.isAllChip(chip)&&chip.selected&&event.preventDefault()},this.onChipChange=event=>{const chip=event.target;if(!this.managedChips().includes(chip))return;const value=chip.value;this.isAllChip(chip)?this.selectedValues=[]:chip.selected?this.selectedValues=this.selection==="single"?[value]:[...this.selectedValues,value]:this.selectedValues=this.selectedValues.filter(entry=>entry!==value),this.rawValue=[...this.selectedValues],this.syncSelectedChips(),this.requestUpdate("value"),this.emit("lr-change",{value:this.value})},this.onToggleOverflow=()=>{this.expanded=!this.expanded,this.emit("lr-overflow-toggle",{expanded:this.expanded})}}static{this.defaultStrings={...super.defaultStrings,showLess:LYRA_DEFAULT_showLess,showMoreCollapsed:LYRA_DEFAULT_showMoreCollapsed,showMoreOverflowLabel:LYRA_DEFAULT_showMoreOverflowLabel}}static{this.collectionSupport=eventCollectionSupport}static{this.immutableEventDetails=Object.freeze(["lr-change"])}static{this.styles=[LyraElement.styles,styles]}get maxVisible(){return this._maxVisible}set maxVisible(next){const old=this._maxVisible;this._maxVisible=next==null?void 0:finiteCount(next),this.requestUpdate("maxVisible",old)}get selection(){return this._selection}set selection(next){const normalized=SELECTION.normalizeReflected(this,"selection",next),old=this._selection;old!==normalized&&(this._selection=normalized,this.selectedValues=this.parseSelection(this.rawValue),this.requestUpdate("selection",old))}parseSelection(next){const list=next==null?[]:typeof next=="string"?this.selection==="multiple"?next.split(","):[next]:[...next],cleaned=[...new Set(list.map(entry=>String(entry).trim()).filter(entry=>entry!==""))];return this.selection==="multiple"?cleaned:cleaned.slice(0,1)}get value(){return this.selection==="multiple"?[...this.selectedValues]:this.selectedValues[0]??""}set value(next){const old=this.value;this.rawValue=next,this.selectedValues=this.parseSelection(next),this.requestUpdate("value",old)}connectedCallback(){super.connectedCallback(),this.armVisibilityObserver(),this.hasUpdated&&this.reconcileChildVisibilityAndFocus()}armVisibilityObserver(){const ownerDocument=this.ownerDocument;if(!this.isConnected||this.visibilityObserver&&this.visibilityObserverDocument===ownerDocument)return;this.resetVisibilityObserver();const MutationObserverCtor=ownerDocument.defaultView?.MutationObserver;if(!MutationObserverCtor)return;const observer=new MutationObserverCtor(records=>{this.processHiddenMutations(records)&&(this.reconcileChildVisibilityAndFocus(),this.requestUpdate())});this.visibilityObserver=observer,this.visibilityObserverDocument=ownerDocument}willUpdate(changed){if(super.willUpdate(changed),this.hasUpdated||this.seedFirstRenderState(()=>{this.childCount=this.children.length}),!this.hasOverflow){this.expanded=!1;const disclosure=this.shadowRoot?.querySelector('[part="overflow-indicator"]');disclosure&&(this.overflowFocusRepair=captureComposedFocusRepair(disclosure,disclosure)??void 0)}}firstUpdated(changed){super.firstUpdated(changed);const slot=this.shadowRoot.querySelector("slot");queueMicrotask(()=>{this.isConnected&&this.updateBrowserDerivedState(()=>{this.childCount=slot.assignedElements({flatten:!0}).length})})}updated(changed){super.updated(changed),this.syncSelectedChips();const overflowRepair=this.overflowFocusRepair;this.overflowFocusRepair=void 0,this.reconcileChildVisibilityAndFocus(overflowRepair)}disconnectedCallback(){this.resetVisibilityObserver(),this.observedChildren.clear(),this.pendingHiddenWrites.clear(),this.trackedChipFocus=void 0,this.restoreChildVisibility(),super.disconnectedCallback()}adoptedCallback(){super.adoptedCallback(),this.resetVisibilityObserver(),this.observedChildren.clear(),this.pendingHiddenWrites.clear(),this.trackedChipFocus=void 0}resetVisibilityObserver(){this.drainVisibilityRecords(),this.visibilityObserver?.disconnect(),this.visibilityObserver=void 0,this.visibilityObserverDocument=void 0}get hasOverflow(){const max=this.maxVisible;return max!=null&&this.childCount>0&&this.eligibleChildren().length>max}assignedChildren(){return this.shadowRoot?.querySelector("slot")?.assignedElements({flatten:!0})??Array.from(this.children)}isAuthorHidden(child){return this.authorHidden.get(child)??child.hasAttribute("hidden")}isCapacityEligible(child){return!this.isAuthorHidden(child)&&!child.hasAttribute("inert")}eligibleChildren(children=this.assignedChildren()){return children.filter(child=>this.isCapacityEligible(child))}childWillBeVisible(child,assignedChildren){if(!this.isCapacityEligible(child))return!this.isAuthorHidden(child);const eligibleIndex=this.eligibleChildren(assignedChildren).indexOf(child);return!(this.hasOverflow&&!this.expanded&&eligibleIndex>=this.maxVisible)}focusRepairBeforeVisibility(assignedChildren){const tracked=this.trackedChipFocus;if(!tracked)return null;const currentIndex=assignedChildren.indexOf(tracked.child);if(currentIndex>=0&&this.childWillBeVisible(tracked.child,assignedChildren))return tracked.index=currentIndex,null;const active=deepActiveElementIn(this.ownerDocument),stillOwnsFocus=active!==null&&composedContains(tracked.child,active),focusWasLostWithRemovedBranch=currentIndex<0&&(active===null||active===this.ownerDocument.body||active===this.ownerDocument.documentElement),focusWasLostWithAlreadyHiddenBranch=tracked.child.hasAttribute("hidden")&&(active===null||active===this.ownerDocument.body||active===this.ownerDocument.documentElement);return!stillOwnsFocus&&!focusWasLostWithRemovedBranch&&!focusWasLostWithAlreadyHiddenBranch?null:{index:currentIndex>=0?currentIndex:tracked.index,repair:tracked.repair}}focusTargetAfterVisibility(assignedChildren,originIndex){const chipTargets=assignedChildren.map((child,index)=>({index,target:collectComposedFocusTargets(child,{includeRoot:!1,mode:"programmatic"}).elements[0]})).filter(entry=>entry.target!==void 0).sort((first,second)=>Math.abs(first.index-originIndex)-Math.abs(second.index-originIndex)||first.index-second.index);if(chipTargets[0])return chipTargets[0].target;const disclosure=this.renderRoot.querySelector('[part="overflow-indicator"]');if(disclosure){const available=collectComposedFocusTargets(disclosure,{mode:"programmatic"}).elements[0];if(available)return available}const base=this.renderRoot.querySelector('[part="base"]');return base?collectComposedFocusTargets(base,{mode:"programmatic"}).elements.find(target=>target===base)??null:null}reconcileChildVisibilityAndFocus(overflowRepair){const assignedChildren=this.assignedChildren(),focusRepair=overflowRepair?{index:assignedChildren.length,repair:overflowRepair}:this.focusRepairBeforeVisibility(assignedChildren);if(this.syncChildVisibility(assignedChildren),!focusRepair)return;const candidate=this.focusTargetAfterVisibility(assignedChildren,focusRepair.index);this.trackedChipFocus=void 0,candidate&&applyComposedFocusRepair(focusRepair.repair,candidate)}syncChildVisibility(assignedChildren=this.assignedChildren()){const max=this.maxVisible,overflowing=this.hasOverflow;this.observeChildren(assignedChildren);const current=new Set(assignedChildren);for(const[child,hidden]of this.authorHidden)current.has(child)||(child.toggleAttribute("hidden",hidden),this.authorHidden.delete(child));let eligibleIndex=0;assignedChildren.forEach(element=>{this.authorHidden.has(element)||this.authorHidden.set(element,element.hasAttribute("hidden"));const authored=this.authorHidden.get(element)??!1,eligible=!authored&&!element.hasAttribute("inert"),managed=eligible&&overflowing&&!this.expanded&&eligibleIndex>=max;this.setManagedHidden(element,authored||managed),eligible&&(eligibleIndex+=1)})}observeChildren(children){const next=new Set(children);if(!(next.size===this.observedChildren.size&&[...next].every(child=>this.observedChildren.has(child)))){this.drainVisibilityRecords(),this.visibilityObserver?.disconnect(),this.observedChildren.clear();for(const child of children)this.visibilityObserver?.observe(child,{attributes:!0,attributeFilter:["hidden","inert"],attributeOldValue:!0}),this.observedChildren.add(child)}}drainVisibilityRecords(){const records=this.visibilityObserver?.takeRecords();records?.length&&this.processHiddenMutations(records)}processHiddenMutations(records){let authorChanged=!1;const hiddenTargets=new Set;for(const record of records){if(record.type!=="attributes")continue;const child=record.target;if(this.authorHidden.has(child)){if(record.attributeName==="inert"){authorChanged=!0;continue}record.attributeName==="hidden"&&(hiddenTargets.has(child)&&this.recordHiddenWrite(child,record.oldValue!==null)&&(authorChanged=!0),hiddenTargets.add(child))}}for(const child of hiddenTargets)this.recordHiddenWrite(child,child.hasAttribute("hidden"))&&(authorChanged=!0);return authorChanged}recordHiddenWrite(child,hidden){const pending=this.pendingHiddenWrites.get(child);return pending&&pending.values[pending.cursor]===hidden?(++pending.cursor===pending.values.length&&this.pendingHiddenWrites.delete(child),!1):(this.authorHidden.set(child,hidden),!0)}setManagedHidden(child,hidden){if(child.hasAttribute("hidden")===hidden)return;let pending=this.pendingHiddenWrites.get(child);pending||(pending={values:[],cursor:0},this.pendingHiddenWrites.set(child,pending)),pending.values.push(hidden),child.toggleAttribute("hidden",hidden)}restoreChildVisibility(){for(const[child,hidden]of this.authorHidden)child.toggleAttribute("hidden",hidden);this.authorHidden.clear()}managedChips(){return this.selection==="none"?[]:this.assignedChildren().filter(child=>"toggleable"in child&&"selected"in child&&typeof child.value=="string")}isAllChip(chip){return this.allValue!=null&&chip.value===this.allValue}syncSelectedChips(){const chosen=new Set(this.selectedValues);for(const chip of this.managedChips()){chip.toggleable||(chip.toggleable=!0);const pressed=this.isAllChip(chip)?chosen.size===0:chosen.has(chip.value);chip.selected!==pressed&&(chip.selected=pressed)}}render(){const hasAccessibleLabel=this.hasAttribute("aria-label")||!!this.accessibleLabel,overflowing=this.hasOverflow,hiddenCount=overflowing?this.eligibleChildren().length-this.maxVisible:0,formattedHiddenCount=getNumberFormat(this.effectiveLocale).format(hiddenCount),visible=overflowing?this.expanded?this.localize("showLess"):this.localize("showMoreCollapsed",void 0,{count:formattedHiddenCount}):"";return html`
|
|
2
|
+
<div part="base" tabindex="-1" role=${hasAccessibleLabel?"group":nothing} aria-label=${hasAccessibleLabel?this.accessibleLabel:nothing} @focusin=${this.onFocusIn} @focusout=${this.onFocusOut} @lr-chip-toggle-request=${this.onChipToggleRequest} @lr-chip-change=${this.onChipChange} >
|
|
3
3
|
<slot @slotchange=${this.onSlotChange}></slot>
|
|
4
4
|
${overflowing?html`<button part="overflow-indicator" type="button" aria-expanded=${this.expanded?"true":"false"} aria-label=${this.expanded?visible:this.localize("showMoreOverflowLabel",void 0,{visible,count:formattedHiddenCount})} @click=${this.onToggleOverflow} >
|
|
5
5
|
${visible}
|
|
6
6
|
</button>`:nothing}
|
|
7
7
|
</div>
|
|
8
|
-
`}}__decorate([property({converter:blankNumberConverter(void 0),attribute:"max-visible"})],LyraChipGroup.prototype,"maxVisible",null),__decorate([property({attribute:"aria-label"})],LyraChipGroup.prototype,"accessibleLabel",void 0),__decorate([state()],LyraChipGroup.prototype,"childCount",void 0),__decorate([state()],LyraChipGroup.prototype,"expanded",void 0);export{LyraChipGroup};
|
|
8
|
+
`}}__decorate([property({converter:blankNumberConverter(void 0),attribute:"max-visible"})],LyraChipGroup.prototype,"maxVisible",null),__decorate([property({reflect:!0,useDefault:!0,converter:SELECTION})],LyraChipGroup.prototype,"selection",null),__decorate([property()],LyraChipGroup.prototype,"value",null),__decorate([property({attribute:"all-value"})],LyraChipGroup.prototype,"allValue",void 0),__decorate([property({attribute:"aria-label"})],LyraChipGroup.prototype,"accessibleLabel",void 0),__decorate([state()],LyraChipGroup.prototype,"childCount",void 0),__decorate([state()],LyraChipGroup.prototype,"expanded",void 0);export{LyraChipGroup};
|
|
@@ -79,10 +79,15 @@ export interface LyraContextMenuPoint{x:number;y:number;contextElement?:Element;
|
|
|
79
79
|
* @cssprop [--lr-overlay-surface=var(--lr-color-surface-container-high)] - Shared floating-surface fill.
|
|
80
80
|
* @cssprop [--lr-overlay-border=var(--lr-color-border-subtle)] - Shared floating-surface edge
|
|
81
81
|
* colour.
|
|
82
|
-
* @cssprop [--lr-overlay-radius=var(--lr-radius)] - Shared floating-surface corner radius.
|
|
82
|
+
* @cssprop [--lr-overlay-radius=var(--lr-radius-container)] - Shared floating-surface corner radius.
|
|
83
83
|
* @cssprop [--lr-overlay-shadow-anchored=var(--lr-shadow-m)] - Elevation of the anchored popup.
|
|
84
84
|
* @cssprop [--lr-overlay-max-inline-size=var(--lr-size-20rem)] - Maximum inline size fallback of
|
|
85
85
|
* the popup.
|
|
86
|
+
* @cssprop [--lr-context-menu-min-inline-size=var(--lr-overlay-min-inline-size, 0px)] - Minimum
|
|
87
|
+
* inline size of the menu, capped by the available viewport space. Wins over the shared
|
|
88
|
+
* `--lr-overlay-min-inline-size`, so a menu can be floored without widening other popups.
|
|
89
|
+
* @cssprop [--lr-overlay-min-inline-size=0px] - Shared minimum inline size of anchored popups,
|
|
90
|
+
* read when `--lr-context-menu-min-inline-size` is unset.
|
|
86
91
|
* @status experimental
|
|
87
92
|
* @since 21.0.0
|
|
88
93
|
*/
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{__decorate}from"tslib";import{listenUntilPointerEnd}from"../../../internal/document-pointer.js";import{eventCollectionSupport}from"../../../internal/collection-snapshot.js";import{isHandledOrComposingKey}from"../../../internal/list-navigation.js";import{html}from"lit";import{property,query}from"lit/decorators.js";import{LyraElement}from"../../../internal/lyra-element.js";import{resolveAccessibleName}from"../../../internal/accessible-name.js";import{composedParentElement}from"../../../internal/active-element.js";import{setCustomState}from"../../../internal/custom-states.js";import{isHtmlElement}from"../../../internal/dom-guards.js";import{attachInternalsSafely}from"../../../internal/element-internals.js";import{composedContains,deepActiveElement}from"../../../internal/nonmodal-overlay-manager.js";import{tag}from"../../../internal/prefix.js";import{css as lyraStaticStyleCss}from"lit";const styles=lyraStaticStyleCss`:host,.trigger{display:contents}:host(:not([disabled])) .trigger{-webkit-touch-callout:none}.shell{display:contents}.shell::part(trigger){display:none}`;import{LYRA_DEFAULT_menuLabel}from"../../../internal/default-strings/shared.generated.js";const LONG_PRESS_TOLERANCE_PX=10,GESTURE_WINDOW_MS=1e3,POINTER_GAP_PX=2,ANCHOR_MOVE_TOLERANCE_PX=2,claimed=new WeakSet,now=()=>Date.now();function isElementNode(value){return typeof value=="object"&&value!==null&&value.nodeType===1}function firstElement(path){for(const entry of path)if(isElementNode(entry))return entry;return null}function isEditableTarget(element){return element?element.localName==="input"||element.localName==="textarea"?!0:isHtmlElement(element)&&element.isContentEditable:!1}function isContextMenuKey(event){return event.ctrlKey||event.altKey||event.metaKey?!1:event.key==="F10"&&event.shiftKey||event.key==="ContextMenu"}class LyraContextMenu extends LyraElement{constructor(){super(...arguments),this.disabled=!1,this.size="m",this.topLayer=!1,this.contextMenuInternals=attachInternalsSafely(this),this.swallowClickUntil=0,this.expectingInnerShow=!1,this.silentClose=!1,this.closingForMove=!1,this.onRegionContextMenu=event=>{if(claimed.has(event)||event.defaultPrevented||this.disabled||this.inForeignOpenSurface(event))return;if(claimed.add(event),this.open){event.preventDefault();return}const gesture=this.gesture;if(gesture&&now()<gesture.until&&gesture.vetoed){this.gesture=void 0;return}if(this.press?.decided==="vetoed")return;this.press&&!this.press.decided&&(this.press.decided="open",this.cancelPress());const path=event.composedPath(),target=firstElement(path);if(!target)return;const rect=target.getBoundingClientRect(),pointInside=event.clientX>=rect.left-1&&event.clientX<=rect.right+1&&event.clientY>=rect.top-1&&event.clientY<=rect.bottom+1;let source,x=event.clientX,y=event.clientY;pointInside?source=event.pointerType==="touch"?"long-press":"pointer":(source="keyboard",[x,y]=this.elementPoint(target)),this.requestOpen({source,target,path:this.regionPath(path),x,y,anchor:target,originalEvent:event})&&event.preventDefault()},this.onRegionKeyDown=event=>{if(this.gesture=void 0,claimed.has(event)||isHandledOrComposingKey(event)||this.inForeignOpenSurface(event)||!isContextMenuKey(event)||this.disabled)return;claimed.add(event);const path=event.composedPath(),anchor=firstElement(path);if(!anchor)return;const[x,y]=this.elementPoint(anchor);if(this.open){event.preventDefault(),this.shell?.showAt({x,y,contextElement:anchor},{returnFocusTo:this.returnFocusTo}),this.startWatching(anchor),this.gesture={kind:"keyboard",vetoed:!1,until:now()+GESTURE_WINDOW_MS};return}const opened=this.requestOpen({source:"keyboard",target:anchor,path:this.regionPath(path),x,y,anchor,originalEvent:event});opened&&event.preventDefault(),this.gesture={kind:"keyboard",vetoed:!opened,until:now()+GESTURE_WINDOW_MS}},this.onRegionPointerDown=event=>{if(this.gesture=void 0,this.swallowClickUntil=0,this.press&&this.cancelPress(),claimed.has(event)||this.disabled||this.inForeignOpenSurface(event)||event.pointerType!=="touch"&&event.pointerType!=="pen"||!event.isPrimary||event.button!==0)return;claimed.add(event);const path=event.composedPath(),target=firstElement(path),ownerDocument=this.ownerDocument,view=ownerDocument.defaultView;if(!target||!view)return;const selection=ownerDocument.getSelection(),press={pointerId:event.pointerId,startX:event.clientX,startY:event.clientY,target,path:this.regionPath(path),down:event,selectionWasCollapsed:!selection||selection.rangeCount===0||selection.isCollapsed,editableTarget:isEditableTarget(target),view},onMove=move=>{if(move.pointerId!==press.pointerId)return;Math.hypot(move.clientX-press.startX,move.clientY-press.startY)>LONG_PRESS_TOLERANCE_PX&&this.endPress(press)},onEnd=end=>{end.pointerId===press.pointerId&&this.endPress(press)},onScroll=()=>this.endPress(press);press.release=listenUntilPointerEnd(ownerDocument,onEnd,{capture:!0,passive:!0,extra:{pointermove:event2=>onMove(event2),scroll:onScroll}}),press.timer=view.setTimeout(()=>this.onPressTimer(press),LyraContextMenu.longPressDelayMs),this.press=press},this.onRegionClick=event=>{now()>=this.swallowClickUntil||(this.swallowClickUntil=0,event.preventDefault(),event.stopPropagation())},this.onSurfacePointerDown=event=>{claimed.add(event)},this.onSurfaceKeyDown=event=>{claimed.add(event),isContextMenuKey(event)&&event.preventDefault()},this.onSurfaceContextMenu=event=>{claimed.add(event),isEditableTarget(firstElement(event.composedPath()))||event.preventDefault()},this.onSurfaceFocusOut=event=>{const shell=this.shell,next=event.relatedTarget;!shell||!this.open||!isElementNode(next)||composedContains(shell,next)||this.hide({focusTrigger:!1})},this.onInnerShow=event=>{event.target===this.shell&&(event.stopPropagation(),this.expectingInnerShow||event.preventDefault())},this.onInnerAfterShow=event=>{event.target===this.shell&&(event.stopPropagation(),this.silentClose||this.emit("lr-after-show"))},this.onInnerHide=event=>{if(event.target!==this.shell||(event.stopPropagation(),this.silentClose))return;if(this.emit("lr-hide",null,{cancelable:!0}).defaultPrevented){event.preventDefault(),this.closingForMove&&this.stopWatching();return}setCustomState(this.contextMenuInternals,"open",!1),this.stopWatching()},this.onInnerAfterHide=event=>{event.target===this.shell&&(event.stopPropagation(),this.returnFocusTo=void 0,this.anchorElement=void 0,this.anchorRect=void 0,this.silentClose?this.silentClose=!1:this.emit("lr-after-hide"))}}static{this.defaultStrings={...super.defaultStrings,menuLabel:LYRA_DEFAULT_menuLabel}}static{this.longPressDelayMs=500}static{this.styles=[LyraElement.styles,styles]}static{this.collectionSupport=eventCollectionSupport}static{this.immutableEventDetails=Object.freeze(["lr-show"])}static{this.identityEventDetailProperties=Object.freeze({"lr-show":Object.freeze(["target","originalEvent"])})}static{this.identityEventDetailCollectionItems=Object.freeze({"lr-show":Object.freeze(["path"])})}get open(){return this.shell?.open??!1}showAt(point,options){if(!Number.isFinite(point.x)||!Number.isFinite(point.y)||this.disabled||!this.isConnected)return;const contextElement=point.contextElement;if(this.open){options?.returnFocusTo&&(this.returnFocusTo=options.returnFocusTo),this.shell?.showAt({x:point.x,y:point.y,contextElement},{returnFocusTo:this.returnFocusTo}),contextElement?this.startWatching(contextElement):this.stopWatching();return}this.requestOpen({source:"programmatic",target:contextElement??null,path:contextElement?this.contextElementPath(contextElement):[],x:point.x,y:point.y,anchor:contextElement,originalEvent:null,returnFocusTo:options?.returnFocusTo})}hide(options){return this.shell?.hide(options)??Promise.resolve()}get resolvedLabel(){return resolveAccessibleName(this,this.label,this.localize("menuLabel"))}disconnectedCallback(){this.cancelPress(),this.gesture=void 0,this.swallowClickUntil=0,this.stopWatching();const shell=this.shell;shell?.open&&(this.silentClose=!0,shell.hide({focusTrigger:!1})),setCustomState(this.contextMenuInternals,"open",!1),this.returnFocusTo=void 0,this.anchorElement=void 0,this.anchorRect=void 0,this.pendingOpen=void 0,this.expectingInnerShow=!1,this.closingForMove=!1,super.disconnectedCallback()}updated(changed){super.updated(changed),changed.has("disabled")&&this.disabled&&this.cancelPress()}inForeignOpenSurface(event){const path=event.composedPath(),surfaceTags=new Set([tag("popover"),tag("dropdown")]);for(let index=0;index<path.length;index+=1){const entry=path[index];if(entry===this)break;if(!isElementNode(entry)||!surfaceTags.has(entry.localName)||entry.open!==!0)continue;const child=path.slice(0,index).find(node=>isElementNode(node)&&node.parentElement===entry);if(!child||child.getAttribute("slot")!=="trigger")return!0}return!1}regionPath(path){const elements=[];for(const entry of path)if(isElementNode(entry)&&(elements.push(entry),entry.parentElement===this))break;return elements}contextElementPath(contextElement){const elements=[];let current=contextElement;for(;current;){if(elements.push(current),current.parentElement===this&¤t.getAttribute("slot")==="trigger")return elements;if(current===this)break;current=composedParentElement(current)}return[contextElement]}onPressTimer(press){if(this.press!==press)return;if(press.timer=void 0,this.open){press.decided="open",this.endPress(press);return}const opened=this.requestOpen({source:"long-press",target:press.target,path:press.path,x:press.startX,y:press.startY,anchor:press.target,originalEvent:press.down});press.decided=opened?"open":"vetoed",opened?(this.clearPressSelection(press),this.swallowClickUntil=now()+GESTURE_WINDOW_MS):this.gesture={kind:"long-press",vetoed:!0,until:now()+GESTURE_WINDOW_MS}}clearPressSelection(press){if(!press.selectionWasCollapsed||press.editableTarget)return;const selection=this.ownerDocument.getSelection();if(!selection||selection.rangeCount===0||selection.isCollapsed)return;const anchorNode=selection.anchorNode,anchorElement=isElementNode(anchorNode)?anchorNode:anchorNode?.parentElement??null;anchorElement&&composedContains(this,anchorElement)&&selection.removeAllRanges()}endPress(press){press.timer!==void 0&&press.view?.clearTimeout(press.timer),press.timer=void 0,press.release?.(),press.release=void 0,this.press===press&&!press.decided&&(this.press=void 0)}cancelPress(){const press=this.press;press&&(this.endPress(press),this.press=void 0)}requestOpen(request){const shell=this.shell;if(this.disabled||!this.isConnected||this.open||!shell)return!1;request={...request,returnFocusTo:request.returnFocusTo??this.relatedFocusTarget(request)};const inPreflight=this.pendingOpen!==void 0;if(this.pendingOpen=request,inPreflight)return!1;this.silentClose=!1;const event=this.emit("lr-show",{source:request.source,target:request.target,path:Object.freeze([...request.path]),clientX:request.x,clientY:request.y,originalEvent:request.originalEvent},{cancelable:!0}),accepted=this.pendingOpen;if(this.pendingOpen=void 0,event.defaultPrevented||!accepted||this.disabled||!this.isConnected)return!1;const{x,y,anchor,returnFocusTo}=accepted;this.expectingInnerShow=!0;try{shell.showAt({x,y,contextElement:anchor},{returnFocusTo})}finally{this.expectingInnerShow=!1}return shell.open?(this.returnFocusTo=returnFocusTo,setCustomState(this.contextMenuInternals,"open",!0),anchor?this.startWatching(anchor):this.stopWatching(),!0):!1}relatedFocusTarget(request){const ownerDocument=this.ownerDocument,active=deepActiveElement(ownerDocument);if(!(!isHtmlElement(active)||active===ownerDocument.body)&&active.ownerDocument===ownerDocument&&(composedContains(this,active)||request.source==="programmatic"&&request.anchor&&composedContains(request.anchor,active)))return active}elementPoint(anchor){const rect=anchor.getBoundingClientRect(),root=this.ownerDocument.documentElement,width=root.clientWidth,height=root.clientHeight;let left=Math.max(rect.left,0),right=Math.min(rect.right,width),top=Math.max(rect.top,0),bottom=Math.min(rect.bottom,height);return(left>right||top>bottom)&&(left=Math.min(Math.max(rect.left,0),width),right=Math.min(Math.max(rect.right,0),width),top=Math.min(Math.max(rect.top,0),height),bottom=Math.min(Math.max(rect.bottom,0),height)),[this.effectiveDirection==="rtl"?right:left,bottom]}startWatching(anchor){this.stopWatching();const ownerDocument=anchor.ownerDocument,view=ownerDocument.defaultView;this.anchorElement=anchor,this.anchorRect=anchor.getBoundingClientRect();const roots=new Set([ownerDocument]);for(let current=anchor;current;current=composedParentElement(current)){const root=current.getRootNode();root!==ownerDocument&&root.host&&roots.add(root)}const onScroll=event=>{const target=event.target;(target?.nodeType===9||isElementNode(target)&&composedContains(target,anchor))&&this.checkAnchor(anchor)},onResize=()=>this.checkAnchor(anchor),listen={capture:!0,passive:!0};for(const root of roots)root.addEventListener("scroll",onScroll,listen);view?.addEventListener("resize",onResize,{passive:!0});const visualViewport=view?.visualViewport;visualViewport?.addEventListener("resize",onResize,{passive:!0});const ResizeObserverCtor=view?.ResizeObserver,observer=ResizeObserverCtor?new ResizeObserverCtor(()=>{anchor.isConnected||this.checkAnchor(anchor)}):void 0;observer?.observe(anchor),this.watchCleanup=()=>{for(const root of roots)root.removeEventListener("scroll",onScroll,listen);view?.removeEventListener("resize",onResize),visualViewport?.removeEventListener("resize",onResize),observer?.disconnect()}}stopWatching(){const cleanup=this.watchCleanup;this.watchCleanup=void 0,cleanup?.()}checkAnchor(anchor){if(!(!this.open||this.anchorElement!==anchor)){if(anchor.isConnected){const baseline=this.anchorRect,current=anchor.getBoundingClientRect();if(baseline&&Math.abs(current.left-baseline.left)<=ANCHOR_MOVE_TOLERANCE_PX&&Math.abs(current.top-baseline.top)<=ANCHOR_MOVE_TOLERANCE_PX)return}this.closeForMove()}}closeForMove(){const shell=this.shell;if(!shell)return;const focusWasInMenu=composedContains(shell,deepActiveElement(this.ownerDocument)),returnFocusTo=this.returnFocusTo;this.closingForMove=!0;try{shell.hide({focusTrigger:!1})}finally{this.closingForMove=!1}!shell.open&&focusWasInMenu&&returnFocusTo?.isConnected&&returnFocusTo.focus({preventScroll:!0})}render(){return html`
|
|
1
|
+
import{__decorate}from"tslib";import{listenUntilPointerEnd}from"../../../internal/document-pointer.js";import{eventCollectionSupport}from"../../../internal/collection-snapshot.js";import{isHandledOrComposingKey}from"../../../internal/list-navigation.js";import{html}from"lit";import{property,query}from"lit/decorators.js";import{LyraElement}from"../../../internal/lyra-element.js";import{resolveAccessibleName}from"../../../internal/accessible-name.js";import{composedParentElement}from"../../../internal/active-element.js";import{setCustomState}from"../../../internal/custom-states.js";import{isHtmlElement}from"../../../internal/dom-guards.js";import{attachInternalsSafely}from"../../../internal/element-internals.js";import{composedContains,deepActiveElement}from"../../../internal/nonmodal-overlay-manager.js";import{tag}from"../../../internal/prefix.js";import{css as lyraStaticStyleCss}from"lit";const styles=lyraStaticStyleCss`:host,.trigger{display:contents}:host(:not([disabled])) .trigger{-webkit-touch-callout:none}.shell{--_lr-popup-min-inline-size:var(--lr-context-menu-min-inline-size);display:contents}.shell::part(trigger){display:none}`;import{LYRA_DEFAULT_menuLabel}from"../../../internal/default-strings/shared.generated.js";const LONG_PRESS_TOLERANCE_PX=10,GESTURE_WINDOW_MS=1e3,POINTER_GAP_PX=2,ANCHOR_MOVE_TOLERANCE_PX=2,claimed=new WeakSet,now=()=>Date.now();function isElementNode(value){return typeof value=="object"&&value!==null&&value.nodeType===1}function firstElement(path){for(const entry of path)if(isElementNode(entry))return entry;return null}function isEditableTarget(element){return element?element.localName==="input"||element.localName==="textarea"?!0:isHtmlElement(element)&&element.isContentEditable:!1}function isContextMenuKey(event){return event.ctrlKey||event.altKey||event.metaKey?!1:event.key==="F10"&&event.shiftKey||event.key==="ContextMenu"}class LyraContextMenu extends LyraElement{constructor(){super(...arguments),this.disabled=!1,this.size="m",this.topLayer=!1,this.contextMenuInternals=attachInternalsSafely(this),this.swallowClickUntil=0,this.expectingInnerShow=!1,this.silentClose=!1,this.closingForMove=!1,this.onRegionContextMenu=event=>{if(claimed.has(event)||event.defaultPrevented||this.disabled||this.inForeignOpenSurface(event))return;if(claimed.add(event),this.open){event.preventDefault();return}const gesture=this.gesture;if(gesture&&now()<gesture.until&&gesture.vetoed){this.gesture=void 0;return}if(this.press?.decided==="vetoed")return;this.press&&!this.press.decided&&(this.press.decided="open",this.cancelPress());const path=event.composedPath(),target=firstElement(path);if(!target)return;const rect=target.getBoundingClientRect(),pointInside=event.clientX>=rect.left-1&&event.clientX<=rect.right+1&&event.clientY>=rect.top-1&&event.clientY<=rect.bottom+1;let source,x=event.clientX,y=event.clientY;pointInside?source=event.pointerType==="touch"?"long-press":"pointer":(source="keyboard",[x,y]=this.elementPoint(target)),this.requestOpen({source,target,path:this.regionPath(path),x,y,anchor:target,originalEvent:event})&&event.preventDefault()},this.onRegionKeyDown=event=>{if(this.gesture=void 0,claimed.has(event)||isHandledOrComposingKey(event)||this.inForeignOpenSurface(event)||!isContextMenuKey(event)||this.disabled)return;claimed.add(event);const path=event.composedPath(),anchor=firstElement(path);if(!anchor)return;const[x,y]=this.elementPoint(anchor);if(this.open){event.preventDefault(),this.shell?.showAt({x,y,contextElement:anchor},{returnFocusTo:this.returnFocusTo}),this.startWatching(anchor),this.gesture={kind:"keyboard",vetoed:!1,until:now()+GESTURE_WINDOW_MS};return}const opened=this.requestOpen({source:"keyboard",target:anchor,path:this.regionPath(path),x,y,anchor,originalEvent:event});opened&&event.preventDefault(),this.gesture={kind:"keyboard",vetoed:!opened,until:now()+GESTURE_WINDOW_MS}},this.onRegionPointerDown=event=>{if(this.gesture=void 0,this.swallowClickUntil=0,this.press&&this.cancelPress(),claimed.has(event)||this.disabled||this.inForeignOpenSurface(event)||event.pointerType!=="touch"&&event.pointerType!=="pen"||!event.isPrimary||event.button!==0)return;claimed.add(event);const path=event.composedPath(),target=firstElement(path),ownerDocument=this.ownerDocument,view=ownerDocument.defaultView;if(!target||!view)return;const selection=ownerDocument.getSelection(),press={pointerId:event.pointerId,startX:event.clientX,startY:event.clientY,target,path:this.regionPath(path),down:event,selectionWasCollapsed:!selection||selection.rangeCount===0||selection.isCollapsed,editableTarget:isEditableTarget(target),view},onMove=move=>{if(move.pointerId!==press.pointerId)return;Math.hypot(move.clientX-press.startX,move.clientY-press.startY)>LONG_PRESS_TOLERANCE_PX&&this.endPress(press)},onEnd=end=>{end.pointerId===press.pointerId&&this.endPress(press)},onScroll=()=>this.endPress(press);press.release=listenUntilPointerEnd(ownerDocument,onEnd,{capture:!0,passive:!0,extra:{pointermove:event2=>onMove(event2),scroll:onScroll}}),press.timer=view.setTimeout(()=>this.onPressTimer(press),LyraContextMenu.longPressDelayMs),this.press=press},this.onRegionClick=event=>{now()>=this.swallowClickUntil||(this.swallowClickUntil=0,event.preventDefault(),event.stopPropagation())},this.onSurfacePointerDown=event=>{claimed.add(event)},this.onSurfaceKeyDown=event=>{claimed.add(event),isContextMenuKey(event)&&event.preventDefault()},this.onSurfaceContextMenu=event=>{claimed.add(event),isEditableTarget(firstElement(event.composedPath()))||event.preventDefault()},this.onSurfaceFocusOut=event=>{const shell=this.shell,next=event.relatedTarget;!shell||!this.open||!isElementNode(next)||composedContains(shell,next)||this.hide({focusTrigger:!1})},this.onInnerShow=event=>{event.target===this.shell&&(event.stopPropagation(),this.expectingInnerShow||event.preventDefault())},this.onInnerAfterShow=event=>{event.target===this.shell&&(event.stopPropagation(),this.silentClose||this.emit("lr-after-show"))},this.onInnerHide=event=>{if(event.target!==this.shell||(event.stopPropagation(),this.silentClose))return;if(this.emit("lr-hide",null,{cancelable:!0}).defaultPrevented){event.preventDefault(),this.closingForMove&&this.stopWatching();return}setCustomState(this.contextMenuInternals,"open",!1),this.stopWatching()},this.onInnerAfterHide=event=>{event.target===this.shell&&(event.stopPropagation(),this.returnFocusTo=void 0,this.anchorElement=void 0,this.anchorRect=void 0,this.silentClose?this.silentClose=!1:this.emit("lr-after-hide"))}}static{this.defaultStrings={...super.defaultStrings,menuLabel:LYRA_DEFAULT_menuLabel}}static{this.longPressDelayMs=500}static{this.styles=[LyraElement.styles,styles]}static{this.collectionSupport=eventCollectionSupport}static{this.immutableEventDetails=Object.freeze(["lr-show"])}static{this.identityEventDetailProperties=Object.freeze({"lr-show":Object.freeze(["target","originalEvent"])})}static{this.identityEventDetailCollectionItems=Object.freeze({"lr-show":Object.freeze(["path"])})}get open(){return this.shell?.open??!1}showAt(point,options){if(!Number.isFinite(point.x)||!Number.isFinite(point.y)||this.disabled||!this.isConnected)return;const contextElement=point.contextElement;if(this.open){options?.returnFocusTo&&(this.returnFocusTo=options.returnFocusTo),this.shell?.showAt({x:point.x,y:point.y,contextElement},{returnFocusTo:this.returnFocusTo}),contextElement?this.startWatching(contextElement):this.stopWatching();return}this.requestOpen({source:"programmatic",target:contextElement??null,path:contextElement?this.contextElementPath(contextElement):[],x:point.x,y:point.y,anchor:contextElement,originalEvent:null,returnFocusTo:options?.returnFocusTo})}hide(options){return this.shell?.hide(options)??Promise.resolve()}get resolvedLabel(){return resolveAccessibleName(this,this.label,this.localize("menuLabel"))}disconnectedCallback(){this.cancelPress(),this.gesture=void 0,this.swallowClickUntil=0,this.stopWatching();const shell=this.shell;shell?.open&&(this.silentClose=!0,shell.hide({focusTrigger:!1})),setCustomState(this.contextMenuInternals,"open",!1),this.returnFocusTo=void 0,this.anchorElement=void 0,this.anchorRect=void 0,this.pendingOpen=void 0,this.expectingInnerShow=!1,this.closingForMove=!1,super.disconnectedCallback()}updated(changed){super.updated(changed),changed.has("disabled")&&this.disabled&&this.cancelPress()}inForeignOpenSurface(event){const path=event.composedPath(),surfaceTags=new Set([tag("popover"),tag("dropdown")]);for(let index=0;index<path.length;index+=1){const entry=path[index];if(entry===this)break;if(!isElementNode(entry)||!surfaceTags.has(entry.localName)||entry.open!==!0)continue;const child=path.slice(0,index).find(node=>isElementNode(node)&&node.parentElement===entry);if(!child||child.getAttribute("slot")!=="trigger")return!0}return!1}regionPath(path){const elements=[];for(const entry of path)if(isElementNode(entry)&&(elements.push(entry),entry.parentElement===this))break;return elements}contextElementPath(contextElement){const elements=[];let current=contextElement;for(;current;){if(elements.push(current),current.parentElement===this&¤t.getAttribute("slot")==="trigger")return elements;if(current===this)break;current=composedParentElement(current)}return[contextElement]}onPressTimer(press){if(this.press!==press)return;if(press.timer=void 0,this.open){press.decided="open",this.endPress(press);return}const opened=this.requestOpen({source:"long-press",target:press.target,path:press.path,x:press.startX,y:press.startY,anchor:press.target,originalEvent:press.down});press.decided=opened?"open":"vetoed",opened?(this.clearPressSelection(press),this.swallowClickUntil=now()+GESTURE_WINDOW_MS):this.gesture={kind:"long-press",vetoed:!0,until:now()+GESTURE_WINDOW_MS}}clearPressSelection(press){if(!press.selectionWasCollapsed||press.editableTarget)return;const selection=this.ownerDocument.getSelection();if(!selection||selection.rangeCount===0||selection.isCollapsed)return;const anchorNode=selection.anchorNode,anchorElement=isElementNode(anchorNode)?anchorNode:anchorNode?.parentElement??null;anchorElement&&composedContains(this,anchorElement)&&selection.removeAllRanges()}endPress(press){press.timer!==void 0&&press.view?.clearTimeout(press.timer),press.timer=void 0,press.release?.(),press.release=void 0,this.press===press&&!press.decided&&(this.press=void 0)}cancelPress(){const press=this.press;press&&(this.endPress(press),this.press=void 0)}requestOpen(request){const shell=this.shell;if(this.disabled||!this.isConnected||this.open||!shell)return!1;request={...request,returnFocusTo:request.returnFocusTo??this.relatedFocusTarget(request)};const inPreflight=this.pendingOpen!==void 0;if(this.pendingOpen=request,inPreflight)return!1;this.silentClose=!1;const event=this.emit("lr-show",{source:request.source,target:request.target,path:Object.freeze([...request.path]),clientX:request.x,clientY:request.y,originalEvent:request.originalEvent},{cancelable:!0}),accepted=this.pendingOpen;if(this.pendingOpen=void 0,event.defaultPrevented||!accepted||this.disabled||!this.isConnected)return!1;const{x,y,anchor,returnFocusTo}=accepted;this.expectingInnerShow=!0;try{shell.showAt({x,y,contextElement:anchor},{returnFocusTo})}finally{this.expectingInnerShow=!1}return shell.open?(this.returnFocusTo=returnFocusTo,setCustomState(this.contextMenuInternals,"open",!0),anchor?this.startWatching(anchor):this.stopWatching(),!0):!1}relatedFocusTarget(request){const ownerDocument=this.ownerDocument,active=deepActiveElement(ownerDocument);if(!(!isHtmlElement(active)||active===ownerDocument.body)&&active.ownerDocument===ownerDocument&&(composedContains(this,active)||request.source==="programmatic"&&request.anchor&&composedContains(request.anchor,active)))return active}elementPoint(anchor){const rect=anchor.getBoundingClientRect(),root=this.ownerDocument.documentElement,width=root.clientWidth,height=root.clientHeight;let left=Math.max(rect.left,0),right=Math.min(rect.right,width),top=Math.max(rect.top,0),bottom=Math.min(rect.bottom,height);return(left>right||top>bottom)&&(left=Math.min(Math.max(rect.left,0),width),right=Math.min(Math.max(rect.right,0),width),top=Math.min(Math.max(rect.top,0),height),bottom=Math.min(Math.max(rect.bottom,0),height)),[this.effectiveDirection==="rtl"?right:left,bottom]}startWatching(anchor){this.stopWatching();const ownerDocument=anchor.ownerDocument,view=ownerDocument.defaultView;this.anchorElement=anchor,this.anchorRect=anchor.getBoundingClientRect();const roots=new Set([ownerDocument]);for(let current=anchor;current;current=composedParentElement(current)){const root=current.getRootNode();root!==ownerDocument&&root.host&&roots.add(root)}const onScroll=event=>{const target=event.target;(target?.nodeType===9||isElementNode(target)&&composedContains(target,anchor))&&this.checkAnchor(anchor)},onResize=()=>this.checkAnchor(anchor),listen={capture:!0,passive:!0};for(const root of roots)root.addEventListener("scroll",onScroll,listen);view?.addEventListener("resize",onResize,{passive:!0});const visualViewport=view?.visualViewport;visualViewport?.addEventListener("resize",onResize,{passive:!0});const ResizeObserverCtor=view?.ResizeObserver,observer=ResizeObserverCtor?new ResizeObserverCtor(()=>{anchor.isConnected||this.checkAnchor(anchor)}):void 0;observer?.observe(anchor),this.watchCleanup=()=>{for(const root of roots)root.removeEventListener("scroll",onScroll,listen);view?.removeEventListener("resize",onResize),visualViewport?.removeEventListener("resize",onResize),observer?.disconnect()}}stopWatching(){const cleanup=this.watchCleanup;this.watchCleanup=void 0,cleanup?.()}checkAnchor(anchor){if(!(!this.open||this.anchorElement!==anchor)){if(anchor.isConnected){const baseline=this.anchorRect,current=anchor.getBoundingClientRect();if(baseline&&Math.abs(current.left-baseline.left)<=ANCHOR_MOVE_TOLERANCE_PX&&Math.abs(current.top-baseline.top)<=ANCHOR_MOVE_TOLERANCE_PX)return}this.closeForMove()}}closeForMove(){const shell=this.shell;if(!shell)return;const focusWasInMenu=composedContains(shell,deepActiveElement(this.ownerDocument)),returnFocusTo=this.returnFocusTo;this.closingForMove=!0;try{shell.hide({focusTrigger:!1})}finally{this.closingForMove=!1}!shell.open&&focusWasInMenu&&returnFocusTo?.isConnected&&returnFocusTo.focus({preventScroll:!0})}render(){return html`
|
|
2
2
|
<span class="trigger" @contextmenu=${this.onRegionContextMenu} @keydown=${this.onRegionKeyDown} @pointerdown=${this.onRegionPointerDown} @click=${{handleEvent:this.onRegionClick,capture:!0}} ><slot name="trigger"></slot
|
|
3
3
|
></span>
|
|
4
4
|
<lr-dropdown without-arrow class="shell" exportparts="popup, content" trigger="manual" placement="right-start" positioning-strategy="fixed" .topLayer=${this.topLayer} .distance=${POINTER_GAP_PX} .size=${this.size} .disabled=${this.disabled} .accessibleLabel=${this.resolvedLabel} @lr-show=${this.onInnerShow} @lr-after-show=${this.onInnerAfterShow} @lr-hide=${this.onInnerHide} @lr-after-hide=${this.onInnerAfterHide} @pointerdown=${this.onSurfacePointerDown} @keydown=${this.onSurfaceKeyDown} @contextmenu=${this.onSurfaceContextMenu} @focusout=${this.onSurfaceFocusOut} ><slot></slot
|
|
@@ -3,7 +3,9 @@ import{type TemplateResult,type PropertyValues}from'lit';import{LyraElement}from
|
|
|
3
3
|
* Reason a dialog was dismissed, forwarded as the `lr-close` event
|
|
4
4
|
* detail. `'escape'` and `'backdrop'` are emitted by the dialog's own built-in
|
|
5
5
|
* dismiss triggers; `'close-button'` by the built-in header close button
|
|
6
|
-
* (rendered unless `without-close-button` is set); `'
|
|
6
|
+
* (rendered unless `without-close-button` is set); `'close-action'` by an activated descendant
|
|
7
|
+
* carrying the declarative close attribute (`data-dialog="close"`, or `data-drawer="close"` inside
|
|
8
|
+
* `<lr-drawer>`); `'unmount'` is emitted when the dialog is
|
|
7
9
|
* removed from the DOM while still open by something other than its own
|
|
8
10
|
* `close()` (e.g. a consumer's own cleanup code, or a parent re-render that
|
|
9
11
|
* drops it); any other string is whatever a caller passes to `close()` (e.g. a
|
|
@@ -73,6 +75,18 @@ export interface LyraDialogCloseDetail{reason:DialogCloseReason;}export interfac
|
|
|
73
75
|
* neither `heading` nor the `label` slot is set) and closes the dialog via the same `close()` path
|
|
74
76
|
* as Escape/backdrop-dismiss, with reason `'close-button'`; `without-close-button` removes it.
|
|
75
77
|
*
|
|
78
|
+
* Declarative actions open and close the dialog from markup alone. Activating any element with
|
|
79
|
+
* `data-dialog="open <id>"` (a click, so keyboard activation of a button counts) opens the
|
|
80
|
+
* `<lr-dialog>` with that `id`, looked up in the trigger's own shadow root or document first and
|
|
81
|
+
* then in its document; an `id` that matches nothing, or matches something other than a dialog,
|
|
82
|
+
* is ignored. Activating a descendant with `data-dialog="close"` -- including one inside a
|
|
83
|
+
* descendant's open shadow root -- closes the nearest owning dialog with reason `'close-action'`
|
|
84
|
+
* and the action as the `lr-hide` `source`; a nested dialog consumes its own close action. Both run
|
|
85
|
+
* the ordinary `show()`/close lifecycle, so `lr-show`, `lr-hide` and `lr-close-request` can veto
|
|
86
|
+
* them. A disabled, `aria-disabled="true"` or inert action does nothing, as does a click whose
|
|
87
|
+
* default was already prevented. One delegated document listener serves every dialog and drawer
|
|
88
|
+
* and is removed once the last of them disconnects.
|
|
89
|
+
*
|
|
76
90
|
* The `body` part is the element that scrolls, so it carries `tabindex="0"` only while it
|
|
77
91
|
* actually overflows; a short body keeps `tabindex="-1"`. A dialog holding only prose, a table,
|
|
78
92
|
* or a rendered document would otherwise have no keyboard stop at all and its content would be
|
|
@@ -143,6 +157,8 @@ export interface LyraDialogCloseDetail{reason:DialogCloseReason;}export interfac
|
|
|
143
157
|
* @csspart close-button - The built-in close button, rendered inside `header`
|
|
144
158
|
* unless `without-close-button` is set.
|
|
145
159
|
* @csspart close-button__base - Exported mapped alias on the close button, on the same node.
|
|
160
|
+
* @csspart close-button__button - Web Awesome-named alias of `close-button-control`: the close button's
|
|
161
|
+
* own native control.
|
|
146
162
|
* @csspart close-button-control - The composed `<lr-icon-button>`'s own native control, forwarded
|
|
147
163
|
* because the painted surface now sits one shadow boundary deeper than `close-button`. As of
|
|
148
164
|
* 16.0.0 the close button IS an `<lr-icon-button>`, so its background, radius, hover/press mixes,
|
|
@@ -155,6 +171,8 @@ export interface LyraDialogCloseDetail{reason:DialogCloseReason;}export interfac
|
|
|
155
171
|
* @csspart body - The wrapper around the default slot.
|
|
156
172
|
* @csspart footer - The wrapper around the `footer` slot.
|
|
157
173
|
* @cssprop [--lr-dialog-overlay-color=var(--lr-color-overlay)] - Backdrop scrim color.
|
|
174
|
+
* @cssprop [--backdrop-color=var(--lr-color-overlay)] - Mapped alias of `--lr-dialog-overlay-color`; the
|
|
175
|
+
* `--lr-*` name wins when both are set.
|
|
158
176
|
* @cssprop [--lr-dialog-backdrop-filter=none] - `backdrop-filter` applied to the scrim, for a
|
|
159
177
|
* frosted-glass treatment over the page behind it.
|
|
160
178
|
* @cssprop [--backdrop-filter=var(--lr-dialog-backdrop-filter,none)] - Mapped backdrop-filter
|
|
@@ -181,11 +199,28 @@ export interface LyraDialogCloseDetail{reason:DialogCloseReason;}export interfac
|
|
|
181
199
|
* slotted content a definite, fillable block size -- `header` and `footer` keep their natural
|
|
182
200
|
* size and only `body` grows or shrinks into the remaining space. Add `fill-body` to make `body` a
|
|
183
201
|
* column flex container whose slotted children fill that space.
|
|
202
|
+
* @cssprop [--lr-dialog-max-height=100%] - Cap on the panel's block size, the block-axis twin of
|
|
203
|
+
* `--lr-dialog-max-width`. The viewport (`100%`) stays a hard limit on top, so a value larger
|
|
204
|
+
* than the viewport is a no-op.
|
|
205
|
+
* @cssprop [--lr-dialog-viewport-inset=var(--lr-space-l)] - Gap between the viewport edges and the
|
|
206
|
+
* panel, on all four sides. The device safe-area insets still win wherever they are larger.
|
|
207
|
+
* @cssprop [--lr-dialog-panel-bg=var(--lr-overlay-surface)] - Fill of this panel only. Unlike
|
|
208
|
+
* `--lr-overlay-surface`, it does not reach the popups, menus and listboxes opened inside the
|
|
209
|
+
* dialog. The glass surface treatment applies to it in the same way.
|
|
210
|
+
* @cssprop [--lr-dialog-divider-color=var(--lr-overlay-border)] - Colour of the header's and footer's
|
|
211
|
+
* dividing rules. Left unset they follow the panel edge colour.
|
|
184
212
|
* @cssprop [--lr-dialog-heading-font-family=var(--lr-font-heading)] - Font family of the visible
|
|
185
213
|
* header title.
|
|
186
214
|
* @cssprop [--lr-dialog-heading-font-size=inherit] - Font size of the visible header title.
|
|
187
215
|
* @cssprop [--lr-dialog-heading-font-weight=var(--lr-font-weight-semibold)] - Font weight of the
|
|
188
216
|
* visible header title.
|
|
217
|
+
* @cssprop [--lr-dialog-heading-letter-spacing=normal] - Letter spacing of the visible header title.
|
|
218
|
+
* @cssprop [--lr-dialog-heading-line-height=inherit] - Line height of the visible header title.
|
|
219
|
+
* @cssprop [--lr-dialog-header-border=var(--lr-border-width-thin) solid var(--lr-dialog-divider-color)] -
|
|
220
|
+
* Border shorthand of the header's bottom rule; `none` removes it. The footer rule keeps
|
|
221
|
+
* `--lr-dialog-divider-color`.
|
|
222
|
+
* @cssprop [--lr-dialog-body-overflow=auto] - `overflow` of the body region, for example `hidden`
|
|
223
|
+
* when slotted content manages its own scrolling.
|
|
189
224
|
* @cssprop [--lr-dialog-spacing=var(--lr-space-l)] - Padding inside the body, and the inline
|
|
190
225
|
* padding of the header and footer rows.
|
|
191
226
|
* @cssprop [--lr-dialog-spacing-block=var(--lr-space-m)] - Block padding of the header and footer
|
|
@@ -196,10 +231,11 @@ export interface LyraDialogCloseDetail{reason:DialogCloseReason;}export interfac
|
|
|
196
231
|
* fade.
|
|
197
232
|
* @cssprop [--lr-overlay-surface=var(--lr-color-surface-container-highest)] - Shared floating-surface fill,
|
|
198
233
|
* on the panel. The same family every anchored popup now reads, so one declaration retints the
|
|
199
|
-
* dialog and the popups opened from it together.
|
|
234
|
+
* dialog and the popups opened from it together; `--lr-dialog-panel-bg` retints the panel alone.
|
|
200
235
|
* @cssprop [--lr-overlay-border=var(--lr-color-border-subtle)] - Shared floating-surface edge
|
|
201
|
-
* colour, on the panel and on the header's and
|
|
202
|
-
*
|
|
236
|
+
* colour, on the panel and, unless `--lr-dialog-divider-color` is set, on the header's and
|
|
237
|
+
* footer's dividing rules.
|
|
238
|
+
* @cssprop [--lr-overlay-radius=var(--lr-radius-container)] - Shared floating-surface corner radius, on the
|
|
203
239
|
* panel and on the close button.
|
|
204
240
|
* @cssprop [--lr-overlay-shadow-modal=var(--lr-shadow-xl)] - Elevation of a modal panel. A separate
|
|
205
241
|
* tier from `--lr-overlay-shadow-anchored`, so raising popups never raises dialogs.
|
|
@@ -241,6 +277,12 @@ noHeader:boolean;
|
|
|
241
277
|
* space; wrap several in one element, or set `flex: none` on the ones that should keep their
|
|
242
278
|
* natural size. */
|
|
243
279
|
fillBody:boolean;
|
|
280
|
+
/** Opt-in full-screen layout for narrow viewports. While the viewport is at most `40rem` wide
|
|
281
|
+
* the panel drops its viewport inset, corner radius and size caps and fills the viewport,
|
|
282
|
+
* carrying the device safe-area insets as its own padding; at wider viewports it renders exactly
|
|
283
|
+
* as without the attribute. The breakpoint is evaluated with `matchMedia()` and followed live
|
|
284
|
+
* while the dialog is connected. */
|
|
285
|
+
fullscreenNarrow:boolean;
|
|
244
286
|
/** SSR hint that keeps the footer wrapper rendered before slot assignment is observable.*/
|
|
245
287
|
withFooter:boolean;
|
|
246
288
|
/** Visual width tier for the panel, on the library's shared six-step size ladder. `'m'` (the
|
|
@@ -254,12 +296,18 @@ size:LyraSize;private hostAriaLabel;
|
|
|
254
296
|
* backdrop dismissal on, so a mechanical `wa-dialog` → `lr-dialog` rename silently flipped the
|
|
255
297
|
* behaviour of every migrated dialog. A rename that changes what the markup does with nothing
|
|
256
298
|
* to warn on is worse than no rename at all, so the polarity now matches upstream exactly. */
|
|
257
|
-
lightDismiss:boolean;private
|
|
299
|
+
lightDismiss:boolean;private releaseFullscreenQuery?;
|
|
300
|
+
/** Server-rendering hint: set it when a `label` slot child is provided so the server markup
|
|
301
|
+
* already carries the titled header before hydration. In the browser only the real label
|
|
302
|
+
* content decides, so a `with-label` dialog with no label renders no empty heading. */
|
|
303
|
+
withLabel:boolean;private hasFooterSlot;private hasLabelSlot;private hasHeaderActionsSlot;private headingText?;private overlay?;private focusReturnOpener;private hideSettled?;private readonly nativeModal;private readonly modalPresentation;private pendingScrollLockRelease?;private readonly hostDescription;private headingReferences?;private readonly headingObserver;private headingObserverOpen?;private readonly bodyOverflowObserver;private bodyOverflowObservedBody?;private transitionToken;private readonly openRequest;private transitionAnimations;private initialFocusDecision?;private readonly headingId;private externalModalDepth;
|
|
258
304
|
/** Shoelace-compatible modal controller. External activation suspends this dialog's focus/Escape
|
|
259
305
|
* ownership without changing its logical `open` state; deactivation restores it. */
|
|
260
306
|
modal:LyraDialogModalController;
|
|
261
307
|
/** Drawer overrides this for its nonmodal `contained` mode.*/
|
|
262
|
-
protected get modalSurface():boolean;
|
|
308
|
+
protected get modalSurface():boolean;
|
|
309
|
+
/** The `data-*` attribute that addresses this overlay declaratively; drawer answers `'drawer'`.*/
|
|
310
|
+
protected get declarativeKind():'dialog'|'drawer';private releaseDeclarativeActions?;private syncFullscreenQuery;protected willUpdate(changed:PropertyValues):void;private flushPendingScrollLockRelease;protected updated(changed:PropertyValues):void;connectedCallback():void;disconnectedCallback():void;adoptedCallback():void;private headingChanged;private armHeadingObserver;private resetHeadingObserver;private syncBodyTabIndex;private armBodyOverflowObserver;private resetBodyOverflowObserver;private defaultSlotElements;
|
|
263
311
|
/** Whether an external-removal hide request can preserve open state for a later reconnect.*/
|
|
264
312
|
protected get disconnectHideCancelable():boolean;private onDefaultSlotChange;private onFooterSlotChange;private detectLightDomChrome;
|
|
265
313
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{__decorate}from"tslib";import{OwnedMutationObserver,OwnedResizeObserver}from"../../../internal/owned-observer.js";import{ModalOpenRequest}from"../../../internal/modal-open-request.js";import{GlassScrollLayer}from"../../../internal/glass-scroll-layer.js";import{NativeModalCarrier}from"../../../internal/native-modal-carrier.js";import{ModalSurfaceController}from"../../../internal/modal-surface-controller.js";import{nativeModalCarrierStyles}from"../../../internal/native-modal-carrier.styles.js";import{html,nothing}from"lit";import{property,state}from"lit/decorators.js";import{LyraElement}from"../../../internal/lyra-element.js";import{resolveHeadingLevel}from"../../../internal/heading-level.js";import{activateOverlay,collectFocusableElements,composedContains,deepActiveElement}from"../../../internal/overlay-manager.js";import{cancelDeferredFocusReturn,captureFocusReturnOpener,scheduleDeferredFocusReturn}from"../../../internal/deferred-focus-return.js";import{HostDescriptionController}from"../../../internal/aria-controls.js";import{nextId}from"../../../internal/a11y.js";import{composedAccessibilityText,composedAccessibilityTextResult,observeAccessibleTextReferences,releaseAccessibleTextReferences,isAccessibilitySubtreeExcluded}from"../../../internal/accessibility-visibility.js";import{closeIcon}from"../../../internal/icons.js";import{animateRegistered}from"../../../internal/registered-animation.js";import{styles}from"./dialog.styles.js";import{LYRA_DEFAULT_close}from"../../../internal/default-strings/shared.generated.js";const HEADING_SELECTOR='h1, h2, h3, h4, h5, h6, [role="heading"]';class LyraDialog extends LyraElement{static{this.defaultStrings={...super.defaultStrings,close:LYRA_DEFAULT_close}}constructor(){super(),this._open=!1,this.label="",this.headingLevel="3",this.withoutCloseButton=!1,this.withoutHeader=!1,this.noHeader=!1,this.fillBody=!1,this.withFooter=!1,this.size="m",this.hostAriaLabel=null,this.lightDismiss=!1,this.hasFooterSlot=!1,this.hasLabelSlot=!1,this.hasHeaderActionsSlot=!1,this.focusReturnOpener=null,this.nativeModal=new NativeModalCarrier(this,{onCancel:event=>this.onNativeCancel(event),onUnexpectedClose:carrier=>{!this.open||!this.modalSurface||(this.closeFrom("api",carrier),this.open&&this.enterTopLayer())}}),this.modalPresentation=new ModalSurfaceController(this,this.nativeModal),this.hostDescription=new HostDescriptionController(this,()=>this.renderRoot.querySelector('[role="dialog"]')),this.headingObserver=new OwnedMutationObserver(this,()=>this.headingChanged()),this.bodyOverflowObserver=new OwnedResizeObserver(this,()=>this.syncBodyTabIndex()),this.transitionToken=0,this.openRequest=new ModalOpenRequest,this.transitionAnimations=[],this.headingId=nextId("dialog-heading"),this.externalModalDepth=0,this.modal={activateExternal:()=>{this.externalModalDepth++,this.externalModalDepth===1&&this.overlay?.suspend()},deactivateExternal:()=>{this.externalModalDepth!==0&&(this.externalModalDepth--,this.externalModalDepth===0&&this.open&&this.modalSurface&&(this.overlay?.resume(),queueMicrotask(()=>this.focusInitial())))}},this.onDefaultSlotChange=()=>{this.detectLightDomChrome(),this.syncBodyTabIndex(),this.resetBodyOverflowObserver(),this.armBodyOverflowObserver()},this.onFooterSlotChange=()=>{this.hasFooterSlot=Array.from(this.children).some(el=>el.getAttribute("slot")==="footer")},this.onNativeCancel=event=>{if(event.preventDefault(),!this.open||!this.overlay?.isTopmost())return;const panel=this.renderRoot.querySelector('[part~="panel"]')??this;this.requestClose("keyboard","escape",panel)},this.onBackdropClick=()=>{this.lightDismiss&&this.overlay?.dismissBackdrop()},this.onCloseButtonClick=()=>{const button=this.renderRoot.querySelector('[part~="close-button"]')??this;this.requestClose("close-button","close-button",button)},new GlassScrollLayer(this,'[part~="panel"]',()=>this.open)}static{this.styles=[LyraElement.styles,styles,nativeModalCarrierStyles]}get open(){return this._open}set open(next){const normalized=!!next;if(!this.openRequest.coalesce(normalized)&&normalized!==this._open){if(!this.hasUpdated){this.applyOpenState(normalized);return}normalized?this.show():this.close("api")}}get modalSurface(){return!0}willUpdate(changed){if(super.willUpdate(changed),(!this.hasUpdated||changed.has("open")&&this.open)&&(this.hasFooterSlot=Array.from(this.children).some(el=>el.getAttribute("slot")==="footer"),this.detectLightDomChrome()),this.open&&(changed.has("open")||changed.has("contained"))&&this.nativeModal.prepare(this.modalSurface),changed.has("open")){if(this.flushPendingScrollLockRelease(),this.open)cancelDeferredFocusReturn(this),this.focusReturnOpener=captureFocusReturnOpener(this),this.isConnected&&this.modalSurface&&this.activateOverlay();else{this.modalPresentation.beginClose();const returnsFocus=this.overlay!==void 0||composedContains(this,deepActiveElement(this.ownerDocument));this.pendingScrollLockRelease=this.deactivateOverlay({deferScrollLockRelease:!0});const opener=this.focusReturnOpener;this.focusReturnOpener=null,returnsFocus&&opener&&this.isConnected&&scheduleDeferredFocusReturn({host:this,candidates:()=>[opener],settled:this.hideSettled,isCurrent:()=>!this.open})}this.hideSettled=void 0}}flushPendingScrollLockRelease(){const release=this.pendingScrollLockRelease;this.pendingScrollLockRelease=void 0,release?.()}updated(changed){super.updated(changed),changed.has("open")&&this.armHeadingObserver(),this.syncBodyTabIndex(),this.armBodyOverflowObserver(),changed.has("open")&&this.open&&this.isConnected&&(this.modalSurface&&(this.enterTopLayer(),this.focusInitial()),queueMicrotask(()=>{this.open&&this.isConnected&&this.detectLightDomChrome()}))}connectedCallback(){super.connectedCallback(),this.armHeadingObserver(),this.syncBodyTabIndex(),this.armBodyOverflowObserver(),this.hasUpdated&&this.open&&(this.modalSurface&&(this.overlay?.isActive()?this.externalModalDepth===0&&this.overlay.resume():this.activateOverlay(),this.enterTopLayer()),queueMicrotask(()=>{!this.open||!this.isConnected||(this.detectLightDomChrome(),this.modalSurface&&this.focusInitial())}))}disconnectedCallback(){this.resetHeadingObserver(),this.resetBodyOverflowObserver(),super.disconnectedCallback(),this.modalPresentation.disconnect(),this.overlay?.suspend(),cancelDeferredFocusReturn(this),this.transitionToken++,this.flushPendingScrollLockRelease(),this.cancelTransitionAnimations(),this.removeAttribute("data-closing"),this.open&&queueMicrotask(()=>{if(!this.isConnected&&this.open){if(this.emit("lr-hide",{source:this},{cancelable:this.disconnectHideCancelable}).defaultPrevented){this.syncOpenAttribute();return}this.applyOpenState(!1),this.emit("lr-close",{reason:"unmount"}),this.emit("lr-after-hide")}})}adoptedCallback(){super.adoptedCallback(),this.hostDescription.adopted(),this.resetHeadingObserver(),this.resetBodyOverflowObserver(),this.isConnected&&(this.armHeadingObserver(),this.armBodyOverflowObserver(),this.syncBodyTabIndex())}headingChanged(){this.detectLightDomChrome(),this.syncBodyTabIndex(),this.resetHeadingObserver(),this.armHeadingObserver()}armHeadingObserver(){if(!this.isConnected||this.headingObserver.active&&this.headingObserverOpen===this.open)return;this.resetHeadingObserver();const observer=this.headingObserver;if(this.headingObserverOpen=this.open,observer.observe(this,{childList:!0}),this.open){for(const child of this.children)observer.observe(child,{attributes:!0,attributeFilter:["slot"]});const heading=Array.from(this.children).find(child=>child.getAttribute("slot")===null&&child.matches(HEADING_SELECTOR));if(!heading)return;observer.observe(heading,{attributes:!0,attributeFilter:["aria-label","aria-labelledby","aria-hidden","hidden","inert","class","style","slot"],characterData:!0,childList:!0,subtree:!0}),heading.hasAttribute("aria-labelledby")&&(this.headingReferences={releases:[],changed:()=>this.headingChanged()},observeAccessibleTextReferences(observer,heading,composedAccessibilityTextResult(heading,{ancestorBoundary:this,requireRendered:!1}),this.headingReferences))}}resetHeadingObserver(){this.headingReferences&&releaseAccessibleTextReferences(this.headingReferences),this.headingReferences=void 0,this.headingObserver.clear(),this.headingObserverOpen=void 0}syncBodyTabIndex(){const body=this.renderRoot?.querySelector('[part="body"]');if(!body)return;const next=this.open&&(body.scrollHeight>body.clientHeight&&body.scrollHeight>0||body.scrollWidth>body.clientWidth&&body.scrollWidth>0)?0:-1;body.tabIndex!==next&&(body.tabIndex=next)}armBodyOverflowObserver(){const body=this.renderRoot?.querySelector('[part="body"]');if(!body||!this.isConnected||this.bodyOverflowObservedBody===body)return;this.resetBodyOverflowObserver();const observer=this.bodyOverflowObserver;this.bodyOverflowObservedBody=body,observer.observe(body);for(const element of this.defaultSlotElements())observer.observe(element)}resetBodyOverflowObserver(){this.bodyOverflowObserver.clear(),this.bodyOverflowObservedBody=void 0}defaultSlotElements(){return this.renderRoot?.querySelector('[part="body"] slot:not([name])')?.assignedElements({flatten:!0})??[]}get disconnectHideCancelable(){return!1}detectLightDomChrome(){const children=Array.from(this.children),heading=children.find(el=>el.getAttribute("slot")===null&&el.matches(HEADING_SELECTOR));!heading||isAccessibilitySubtreeExcluded(heading)?this.headingText=void 0:heading.hasAttribute("aria-label")?this.headingText=heading.getAttribute("aria-label")??"":heading.hasAttribute("aria-labelledby")?this.headingText=composedAccessibilityText(heading,{ancestorBoundary:this}).trim()||void 0:this.headingText=composedAccessibilityText(Array.from(heading.childNodes),{ancestorBoundary:heading}).trim()||void 0,this.hasLabelSlot=children.some(el=>el.getAttribute("slot")==="label"),this.hasHeaderActionsSlot=children.some(el=>el.getAttribute("slot")==="header-actions")}show(){if(this.openRequest.coalesce(!0)||this._open)return Promise.resolve();this.openRequest.begin(!0);const prevented=this.emit("lr-show",null,{cancelable:!0}).defaultPrevented,superseded=this.openRequest.superseded(!0);return this.openRequest.finish(),prevented||superseded?(this.syncOpenAttribute(),Promise.resolve()):(this.cancelTransitionAnimations(),this.removeAttribute("data-closing"),this.applyOpenState(!0),this.settleTransition("lr-after-show"))}hide(){return this.close("api")}close(reason="api"){return this.closeFrom(reason,this)}closeFrom(reason,source){if(this.openRequest.coalesce(!1)||!this._open)return Promise.resolve();if(this.openRequest.begin(!1),this.emit("lr-hide",{source},{cancelable:!0}).defaultPrevented||this.openRequest.superseded(!1))return this.openRequest.finish(),this.syncOpenAttribute(),Promise.resolve();if(this.emit("lr-close-request",{reason},{cancelable:!0}).defaultPrevented||this.openRequest.superseded(!1))return this.openRequest.finish(),this.syncOpenAttribute(),Promise.resolve();this.openRequest.finish(),this.cancelTransitionAnimations(),this.isConnected&&this.setAttribute("data-closing",""),this.applyOpenState(!1);const settled=this.settleTransition("lr-after-hide");return this.hideSettled=settled,this.emit("lr-close",{reason}),settled}applyOpenState(next){const old=this._open;this._open=next,next&&(this.initialFocusDecision=void 0),this.requestUpdate("open",old)}syncOpenAttribute(){this.toggleAttribute("open",this._open)}panelAnimationName(showing){return showing?"dialog.show":"dialog.hide"}overlayAnimationName(showing){return showing?"dialog.overlay.show":"dialog.overlay.hide"}panelAnimationSpec(showing){const offset="translateY(calc(-1 * var(--lr-size-0-5rem)))";return{keyframes:showing?[{opacity:0,transform:offset},{opacity:1,transform:"translateY(0)"}]:[{opacity:1,transform:"translateY(0)"},{opacity:0,transform:offset}],durationProperties:[showing?"--show-duration":"--hide-duration","--lr-dialog-panel-duration","--lr-duration-base"],easingProperties:["--lr-easing-standard"]}}overlayAnimationSpec(showing){return{keyframes:showing?[{opacity:0},{opacity:1}]:[{opacity:1},{opacity:0}],durationProperties:[showing?"--show-duration":"--hide-duration","--lr-dialog-backdrop-duration","--lr-duration-fast"],easingProperties:["--lr-easing-standard"]}}cancelTransitionAnimations(){for(const animation of this.transitionAnimations)animation.cancel();this.transitionAnimations=[]}async settleTransition(event){const token=++this.transitionToken;if(await this.updateComplete,this.transitionToken===token){if(this.isConnected){const root=this.renderRoot,panel=root.querySelector('[part~="panel"]'),backdrop=root.querySelector('[part~="backdrop"]'),showing=event==="lr-after-show",animations=[panel?animateRegistered(this,panel,this.panelAnimationName(showing),this.effectiveDirection,this.panelAnimationSpec(showing)):void 0,this.modalSurface&&backdrop?animateRegistered(this,backdrop,this.overlayAnimationName(showing),this.effectiveDirection,this.overlayAnimationSpec(showing)):void 0].filter(animation=>animation!==void 0);if(this.transitionAnimations=animations,await Promise.all(animations.map(animation=>animation.finished.catch(()=>{}))),this.transitionToken!==token)return;this.cancelTransitionAnimations()}event==="lr-after-hide"&&(this.removeAttribute("data-closing"),this.leaveTopLayer(),this.flushPendingScrollLockRelease()),this.emit(event)}}enterTopLayer(){this.externalModalDepth===0&&this.overlay?.resume(),this.modalPresentation.show()}leaveTopLayer(){this.modalPresentation.hide()}requestClose(source,reason,sourceElement){this.emit("lr-request-close",{source},{cancelable:!0}).defaultPrevented||this.closeFrom(reason,sourceElement)}focusInitial(){this.overlay?.focusInitial()}activateOverlay(){!this.isConnected||this.overlay?.isActive()||(this.overlay=activateOverlay({host:this,panel:()=>this.shadowRoot?.querySelector('[part~="panel"]')??null,onEscape:()=>{const panel=this.renderRoot.querySelector('[part~="panel"]')??this;this.requestClose("keyboard","escape",panel)},onBackdrop:()=>{const backdrop=this.renderRoot.querySelector('[part~="backdrop"]')??this;this.requestClose("overlay","backdrop",backdrop)},preferredInitialFocus:()=>{const panel=this.renderRoot.querySelector('[part~="panel"]'),body=this.renderRoot.querySelector('[part="body"]'),stops=body?collectFocusableElements(body):[];return stops.find(stop=>stop!==body)??stops[0]??panel},beforeInitialFocus:()=>(this.initialFocusDecision===void 0&&(this.initialFocusDecision=!this.emit("lr-initial-focus",null,{cancelable:!0}).defaultPrevented),this.initialFocusDecision),lockScroll:!0,suspendWhenUnrendered:!0}),this.externalModalDepth>0&&this.overlay.suspend())}deactivateOverlay(options){const overlay=this.overlay;return this.overlay=void 0,overlay?.deactivate(options)}render(){const suppressHeader=this.withoutHeader||this.noHeader,renderHeading=!suppressHeader&&!this.headingText&&(this.hasLabelSlot||(this.label??"").length>0||!!this.heading),hasHostName=this.hostAriaLabel!==null,explicitName=hasHostName?this.hostAriaLabel:this.headingText,hasExplicitName=hasHostName||!!explicitName,useHeadingForName=!hasExplicitName&&renderHeading,showHeader=!suppressHeader&&(renderHeading||this.hasHeaderActionsSlot||!this.withoutCloseButton),headingLevel=resolveHeadingLevel(this.headingLevel);return this.nativeModal.render(html`
|
|
1
|
+
import{__decorate}from"tslib";import{OwnedMutationObserver,OwnedResizeObserver}from"../../../internal/owned-observer.js";import{ModalOpenRequest}from"../../../internal/modal-open-request.js";import{GlassScrollLayer}from"../../../internal/glass-scroll-layer.js";import{NativeModalCarrier}from"../../../internal/native-modal-carrier.js";import{ModalSurfaceController}from"../../../internal/modal-surface-controller.js";import{nativeModalCarrierStyles}from"../../../internal/native-modal-carrier.styles.js";import{html,isServer,nothing}from"lit";import{property,state}from"lit/decorators.js";import{LyraElement}from"../../../internal/lyra-element.js";import{resolveHeadingLevel}from"../../../internal/heading-level.js";import{activateOverlay,collectFocusableElements,composedContains,deepActiveElement}from"../../../internal/overlay-manager.js";import{cancelDeferredFocusReturn,captureFocusReturnOpener,scheduleDeferredFocusReturn}from"../../../internal/deferred-focus-return.js";import{HostDescriptionController}from"../../../internal/aria-controls.js";import{nextId}from"../../../internal/a11y.js";import{composedAccessibilityText,composedAccessibilityTextResult,observeAccessibleTextReferences,releaseAccessibleTextReferences,isAccessibilitySubtreeExcluded}from"../../../internal/accessibility-visibility.js";import{closeIcon}from"../../../internal/icons.js";import{registerDeclarativeOverlay}from"../../../internal/declarative-overlay-action.js";import{animateRegistered}from"../../../internal/registered-animation.js";import{styles}from"./dialog.styles.js";import{LYRA_DEFAULT_close}from"../../../internal/default-strings/shared.generated.js";const HEADING_SELECTOR='h1, h2, h3, h4, h5, h6, [role="heading"]',FULLSCREEN_NARROW_QUERY="(max-width: 40rem)";class LyraDialog extends LyraElement{static{this.defaultStrings={...super.defaultStrings,close:LYRA_DEFAULT_close}}constructor(){super(),this._open=!1,this.label="",this.headingLevel="3",this.withoutCloseButton=!1,this.withoutHeader=!1,this.noHeader=!1,this.fillBody=!1,this.fullscreenNarrow=!1,this.withFooter=!1,this.size="m",this.hostAriaLabel=null,this.lightDismiss=!1,this.withLabel=!1,this.hasFooterSlot=!1,this.hasLabelSlot=!1,this.hasHeaderActionsSlot=!1,this.focusReturnOpener=null,this.nativeModal=new NativeModalCarrier(this,{onCancel:event=>this.onNativeCancel(event),onUnexpectedClose:carrier=>{!this.open||!this.modalSurface||(this.closeFrom("api",carrier),this.open&&this.enterTopLayer())}}),this.modalPresentation=new ModalSurfaceController(this,this.nativeModal),this.hostDescription=new HostDescriptionController(this,()=>this.renderRoot.querySelector('[role="dialog"]')),this.headingObserver=new OwnedMutationObserver(this,()=>this.headingChanged()),this.bodyOverflowObserver=new OwnedResizeObserver(this,()=>this.syncBodyTabIndex()),this.transitionToken=0,this.openRequest=new ModalOpenRequest,this.transitionAnimations=[],this.headingId=nextId("dialog-heading"),this.externalModalDepth=0,this.modal={activateExternal:()=>{this.externalModalDepth++,this.externalModalDepth===1&&this.overlay?.suspend()},deactivateExternal:()=>{this.externalModalDepth!==0&&(this.externalModalDepth--,this.externalModalDepth===0&&this.open&&this.modalSurface&&(this.overlay?.resume(),queueMicrotask(()=>this.focusInitial())))}},this.onDefaultSlotChange=()=>{this.detectLightDomChrome(),this.syncBodyTabIndex(),this.resetBodyOverflowObserver(),this.armBodyOverflowObserver()},this.onFooterSlotChange=()=>{this.hasFooterSlot=Array.from(this.children).some(el=>el.getAttribute("slot")==="footer")},this.onNativeCancel=event=>{if(event.preventDefault(),!this.open||!this.overlay?.isTopmost())return;const panel=this.renderRoot.querySelector('[part~="panel"]')??this;this.requestClose("keyboard","escape",panel)},this.onBackdropClick=()=>{this.lightDismiss&&this.overlay?.dismissBackdrop()},this.onCloseButtonClick=()=>{const button=this.renderRoot.querySelector('[part~="close-button"]')??this;this.requestClose("close-button","close-button",button)},new GlassScrollLayer(this,'[part~="panel"]',()=>this.open)}static{this.styles=[LyraElement.styles,styles,nativeModalCarrierStyles]}get open(){return this._open}set open(next){const normalized=!!next;if(!this.openRequest.coalesce(normalized)&&normalized!==this._open){if(!this.hasUpdated){this.applyOpenState(normalized);return}normalized?this.show():this.close("api")}}get modalSurface(){return!0}get declarativeKind(){return"dialog"}syncFullscreenQuery(){this.releaseFullscreenQuery?.(),this.releaseFullscreenQuery=void 0;const view=this.ownerDocument?.defaultView;if(!this.fullscreenNarrow||!this.isConnected||typeof view?.matchMedia!="function"){this.removeAttribute("data-fullscreen");return}const query=view.matchMedia(FULLSCREEN_NARROW_QUERY),apply=()=>{this.toggleAttribute("data-fullscreen",query.matches)};query.addEventListener("change",apply),this.releaseFullscreenQuery=()=>query.removeEventListener("change",apply),apply()}willUpdate(changed){if(super.willUpdate(changed),changed.has("fullscreenNarrow")&&this.syncFullscreenQuery(),(!this.hasUpdated||changed.has("open")&&this.open)&&(this.hasFooterSlot=Array.from(this.children).some(el=>el.getAttribute("slot")==="footer"),this.detectLightDomChrome()),this.open&&(changed.has("open")||changed.has("contained"))&&this.nativeModal.prepare(this.modalSurface),changed.has("open")){if(this.flushPendingScrollLockRelease(),this.open)cancelDeferredFocusReturn(this),this.focusReturnOpener=captureFocusReturnOpener(this),this.isConnected&&this.modalSurface&&this.activateOverlay();else{this.modalPresentation.beginClose();const returnsFocus=this.overlay!==void 0||composedContains(this,deepActiveElement(this.ownerDocument));this.pendingScrollLockRelease=this.deactivateOverlay({deferScrollLockRelease:!0});const opener=this.focusReturnOpener;this.focusReturnOpener=null,returnsFocus&&opener&&this.isConnected&&scheduleDeferredFocusReturn({host:this,candidates:()=>[opener],settled:this.hideSettled,isCurrent:()=>!this.open})}this.hideSettled=void 0}}flushPendingScrollLockRelease(){const release=this.pendingScrollLockRelease;this.pendingScrollLockRelease=void 0,release?.()}updated(changed){super.updated(changed),changed.has("open")&&this.armHeadingObserver(),this.syncBodyTabIndex(),this.armBodyOverflowObserver(),changed.has("open")&&this.open&&this.isConnected&&(this.modalSurface&&(this.enterTopLayer(),this.focusInitial()),queueMicrotask(()=>{this.open&&this.isConnected&&this.detectLightDomChrome()}))}connectedCallback(){super.connectedCallback(),this.releaseDeclarativeActions?.(),this.releaseDeclarativeActions=registerDeclarativeOverlay(this,{kind:()=>this.declarativeKind,open:()=>{this.show()},close:source=>{this.closeFrom("close-action",source)}}),this.syncFullscreenQuery(),this.armHeadingObserver(),this.syncBodyTabIndex(),this.armBodyOverflowObserver(),this.hasUpdated&&this.open&&(this.modalSurface&&(this.overlay?.isActive()?this.externalModalDepth===0&&this.overlay.resume():this.activateOverlay(),this.enterTopLayer()),queueMicrotask(()=>{!this.open||!this.isConnected||(this.detectLightDomChrome(),this.modalSurface&&this.focusInitial())}))}disconnectedCallback(){this.releaseDeclarativeActions?.(),this.releaseDeclarativeActions=void 0,this.releaseFullscreenQuery?.(),this.releaseFullscreenQuery=void 0,this.removeAttribute("data-fullscreen"),this.resetHeadingObserver(),this.resetBodyOverflowObserver(),super.disconnectedCallback(),this.modalPresentation.disconnect(),this.overlay?.suspend(),cancelDeferredFocusReturn(this),this.transitionToken++,this.flushPendingScrollLockRelease(),this.cancelTransitionAnimations(),this.removeAttribute("data-closing"),this.open&&queueMicrotask(()=>{if(!this.isConnected&&this.open){if(this.emit("lr-hide",{source:this},{cancelable:this.disconnectHideCancelable}).defaultPrevented){this.syncOpenAttribute();return}this.applyOpenState(!1),this.emit("lr-close",{reason:"unmount"}),this.emit("lr-after-hide")}})}adoptedCallback(){super.adoptedCallback(),this.hostDescription.adopted(),this.resetHeadingObserver(),this.resetBodyOverflowObserver(),this.isConnected&&(this.armHeadingObserver(),this.armBodyOverflowObserver(),this.syncBodyTabIndex())}headingChanged(){this.detectLightDomChrome(),this.syncBodyTabIndex(),this.resetHeadingObserver(),this.armHeadingObserver()}armHeadingObserver(){if(!this.isConnected||this.headingObserver.active&&this.headingObserverOpen===this.open)return;this.resetHeadingObserver();const observer=this.headingObserver;if(this.headingObserverOpen=this.open,observer.observe(this,{childList:!0}),this.open){for(const child of this.children)observer.observe(child,{attributes:!0,attributeFilter:["slot"]});const heading=Array.from(this.children).find(child=>child.getAttribute("slot")===null&&child.matches(HEADING_SELECTOR));if(!heading)return;observer.observe(heading,{attributes:!0,attributeFilter:["aria-label","aria-labelledby","aria-hidden","hidden","inert","class","style","slot"],characterData:!0,childList:!0,subtree:!0}),heading.hasAttribute("aria-labelledby")&&(this.headingReferences={releases:[],changed:()=>this.headingChanged()},observeAccessibleTextReferences(observer,heading,composedAccessibilityTextResult(heading,{ancestorBoundary:this,requireRendered:!1}),this.headingReferences))}}resetHeadingObserver(){this.headingReferences&&releaseAccessibleTextReferences(this.headingReferences),this.headingReferences=void 0,this.headingObserver.clear(),this.headingObserverOpen=void 0}syncBodyTabIndex(){const body=this.renderRoot?.querySelector('[part="body"]');if(!body)return;const next=this.open&&(body.scrollHeight>body.clientHeight&&body.scrollHeight>0||body.scrollWidth>body.clientWidth&&body.scrollWidth>0)?0:-1;body.tabIndex!==next&&(body.tabIndex=next)}armBodyOverflowObserver(){const body=this.renderRoot?.querySelector('[part="body"]');if(!body||!this.isConnected||this.bodyOverflowObservedBody===body)return;this.resetBodyOverflowObserver();const observer=this.bodyOverflowObserver;this.bodyOverflowObservedBody=body,observer.observe(body);for(const element of this.defaultSlotElements())observer.observe(element)}resetBodyOverflowObserver(){this.bodyOverflowObserver.clear(),this.bodyOverflowObservedBody=void 0}defaultSlotElements(){return this.renderRoot?.querySelector('[part="body"] slot:not([name])')?.assignedElements({flatten:!0})??[]}get disconnectHideCancelable(){return!1}detectLightDomChrome(){const children=Array.from(this.children),heading=children.find(el=>el.getAttribute("slot")===null&&el.matches(HEADING_SELECTOR));!heading||isAccessibilitySubtreeExcluded(heading)?this.headingText=void 0:heading.hasAttribute("aria-label")?this.headingText=heading.getAttribute("aria-label")??"":heading.hasAttribute("aria-labelledby")?this.headingText=composedAccessibilityText(heading,{ancestorBoundary:this}).trim()||void 0:this.headingText=composedAccessibilityText(Array.from(heading.childNodes),{ancestorBoundary:heading}).trim()||void 0,this.hasLabelSlot=children.some(el=>el.getAttribute("slot")==="label"),this.hasHeaderActionsSlot=children.some(el=>el.getAttribute("slot")==="header-actions")}show(){if(this.openRequest.coalesce(!0)||this._open)return Promise.resolve();this.openRequest.begin(!0);const prevented=this.emit("lr-show",null,{cancelable:!0}).defaultPrevented,superseded=this.openRequest.superseded(!0);return this.openRequest.finish(),prevented||superseded?(this.syncOpenAttribute(),Promise.resolve()):(this.cancelTransitionAnimations(),this.removeAttribute("data-closing"),this.applyOpenState(!0),this.settleTransition("lr-after-show"))}hide(){return this.close("api")}close(reason="api"){return this.closeFrom(reason,this)}closeFrom(reason,source){if(this.openRequest.coalesce(!1)||!this._open)return Promise.resolve();if(this.openRequest.begin(!1),this.emit("lr-hide",{source},{cancelable:!0}).defaultPrevented||this.openRequest.superseded(!1))return this.openRequest.finish(),this.syncOpenAttribute(),Promise.resolve();if(this.emit("lr-close-request",{reason},{cancelable:!0}).defaultPrevented||this.openRequest.superseded(!1))return this.openRequest.finish(),this.syncOpenAttribute(),Promise.resolve();this.openRequest.finish(),this.cancelTransitionAnimations(),this.isConnected&&this.setAttribute("data-closing",""),this.applyOpenState(!1);const settled=this.settleTransition("lr-after-hide");return this.hideSettled=settled,this.emit("lr-close",{reason}),settled}applyOpenState(next){const old=this._open;this._open=next,next&&(this.initialFocusDecision=void 0),this.requestUpdate("open",old)}syncOpenAttribute(){this.toggleAttribute("open",this._open)}panelAnimationName(showing){return showing?"dialog.show":"dialog.hide"}overlayAnimationName(showing){return showing?"dialog.overlay.show":"dialog.overlay.hide"}panelAnimationSpec(showing){const offset="translateY(calc(-1 * var(--lr-size-0-5rem)))";return{keyframes:showing?[{opacity:0,transform:offset},{opacity:1,transform:"translateY(0)"}]:[{opacity:1,transform:"translateY(0)"},{opacity:0,transform:offset}],durationProperties:[showing?"--show-duration":"--hide-duration","--lr-dialog-panel-duration","--lr-duration-base"],easingProperties:["--lr-easing-standard"]}}overlayAnimationSpec(showing){return{keyframes:showing?[{opacity:0},{opacity:1}]:[{opacity:1},{opacity:0}],durationProperties:[showing?"--show-duration":"--hide-duration","--lr-dialog-backdrop-duration","--lr-duration-fast"],easingProperties:["--lr-easing-standard"]}}cancelTransitionAnimations(){for(const animation of this.transitionAnimations)animation.cancel();this.transitionAnimations=[]}async settleTransition(event){const token=++this.transitionToken;if(await this.updateComplete,this.transitionToken===token){if(this.isConnected){const root=this.renderRoot,panel=root.querySelector('[part~="panel"]'),backdrop=root.querySelector('[part~="backdrop"]'),showing=event==="lr-after-show",animations=[panel?animateRegistered(this,panel,this.panelAnimationName(showing),this.effectiveDirection,this.panelAnimationSpec(showing)):void 0,this.modalSurface&&backdrop?animateRegistered(this,backdrop,this.overlayAnimationName(showing),this.effectiveDirection,this.overlayAnimationSpec(showing)):void 0].filter(animation=>animation!==void 0);if(this.transitionAnimations=animations,await Promise.all(animations.map(animation=>animation.finished.catch(()=>{}))),this.transitionToken!==token)return;this.cancelTransitionAnimations()}event==="lr-after-hide"&&(this.removeAttribute("data-closing"),this.leaveTopLayer(),this.flushPendingScrollLockRelease()),this.emit(event)}}enterTopLayer(){this.externalModalDepth===0&&this.overlay?.resume(),this.modalPresentation.show()}leaveTopLayer(){this.modalPresentation.hide()}requestClose(source,reason,sourceElement){this.emit("lr-request-close",{source},{cancelable:!0}).defaultPrevented||this.closeFrom(reason,sourceElement)}focusInitial(){this.overlay?.focusInitial()}activateOverlay(){!this.isConnected||this.overlay?.isActive()||(this.overlay=activateOverlay({host:this,panel:()=>this.shadowRoot?.querySelector('[part~="panel"]')??null,onEscape:()=>{const panel=this.renderRoot.querySelector('[part~="panel"]')??this;this.requestClose("keyboard","escape",panel)},onBackdrop:()=>{const backdrop=this.renderRoot.querySelector('[part~="backdrop"]')??this;this.requestClose("overlay","backdrop",backdrop)},preferredInitialFocus:()=>{const panel=this.renderRoot.querySelector('[part~="panel"]'),body=this.renderRoot.querySelector('[part="body"]'),stops=body?collectFocusableElements(body):[];return stops.find(stop=>stop!==body)??stops[0]??panel},beforeInitialFocus:()=>(this.initialFocusDecision===void 0&&(this.initialFocusDecision=!this.emit("lr-initial-focus",null,{cancelable:!0}).defaultPrevented),this.initialFocusDecision),lockScroll:!0,suspendWhenUnrendered:!0}),this.externalModalDepth>0&&this.overlay.suspend())}deactivateOverlay(options){const overlay=this.overlay;return this.overlay=void 0,overlay?.deactivate(options)}render(){const suppressHeader=this.withoutHeader||this.noHeader,renderHeading=!suppressHeader&&!this.headingText&&(this.hasLabelSlot||isServer&&this.withLabel||(this.label??"").length>0||!!this.heading),hasHostName=this.hostAriaLabel!==null,explicitName=hasHostName?this.hostAriaLabel:this.headingText,hasExplicitName=hasHostName||!!explicitName,useHeadingForName=!hasExplicitName&&renderHeading,showHeader=!suppressHeader&&(renderHeading||this.hasHeaderActionsSlot||!this.withoutCloseButton),headingLevel=resolveHeadingLevel(this.headingLevel);return this.nativeModal.render(html`
|
|
2
2
|
<div part="backdrop overlay" @click=${this.onBackdropClick}></div>
|
|
3
3
|
<div part="panel dialog" role=${this.open&&!this.nativeModal.requested?"dialog":nothing} aria-modal=${this.open&&this.modalSurface&&!this.nativeModal.requested?"true":nothing} aria-label=${!this.nativeModal.requested&&hasExplicitName?explicitName:nothing} aria-labelledby=${!this.nativeModal.requested&&useHeadingForName?this.headingId:nothing} tabindex="-1" >
|
|
4
4
|
<span class="glass-scroll-layer" aria-hidden="true"></span>
|
|
@@ -8,7 +8,7 @@ import{__decorate}from"tslib";import{OwnedMutationObserver,OwnedResizeObserver}f
|
|
|
8
8
|
>`:nothing}
|
|
9
9
|
${this.hasHeaderActionsSlot?html`<span part="header-actions"><slot name="header-actions"></slot></span>`:nothing}
|
|
10
10
|
${this.withoutCloseButton?nothing:html`
|
|
11
|
-
<lr-icon-button part="close-button close-button__base" exportparts="button:close-button-control" aria-label=${this.localize("close")} @click=${this.onCloseButtonClick} >
|
|
11
|
+
<lr-icon-button part="close-button close-button__base" exportparts="button:close-button-control, button:close-button__button" aria-label=${this.localize("close")} @click=${this.onCloseButtonClick} >
|
|
12
12
|
${closeIcon()}
|
|
13
13
|
</lr-icon-button>
|
|
14
14
|
`}
|
|
@@ -24,4 +24,4 @@ import{__decorate}from"tslib";import{OwnedMutationObserver,OwnedResizeObserver}f
|
|
|
24
24
|
</div>
|
|
25
25
|
${this.nativeModal.renderHelperSlot()}
|
|
26
26
|
</div>
|
|
27
|
-
`,{part:"base",label:hasExplicitName?explicitName:void 0,labelledBy:useHeadingForName?this.headingId:void 0})}}__decorate([property({type:Boolean,reflect:!0})],LyraDialog.prototype,"open",null),__decorate([property({reflect:!0})],LyraDialog.prototype,"label",void 0),__decorate([property({attribute:"heading-level",reflect:!0})],LyraDialog.prototype,"headingLevel",void 0),__decorate([property()],LyraDialog.prototype,"heading",void 0),__decorate([property({type:Boolean,attribute:"without-close-button",reflect:!0})],LyraDialog.prototype,"withoutCloseButton",void 0),__decorate([property({type:Boolean,attribute:"without-header",reflect:!0})],LyraDialog.prototype,"withoutHeader",void 0),__decorate([property({type:Boolean,attribute:"no-header",reflect:!0})],LyraDialog.prototype,"noHeader",void 0),__decorate([property({type:Boolean,attribute:"fill-body",reflect:!0})],LyraDialog.prototype,"fillBody",void 0),__decorate([property({type:Boolean,attribute:"with-footer",reflect:!0})],LyraDialog.prototype,"withFooter",void 0),__decorate([property({reflect:!0})],LyraDialog.prototype,"size",void 0),__decorate([property({attribute:"aria-label"})],LyraDialog.prototype,"hostAriaLabel",void 0),__decorate([property({type:Boolean,attribute:"light-dismiss"})],LyraDialog.prototype,"lightDismiss",void 0),__decorate([state()],LyraDialog.prototype,"hasFooterSlot",void 0),__decorate([state()],LyraDialog.prototype,"hasLabelSlot",void 0),__decorate([state()],LyraDialog.prototype,"hasHeaderActionsSlot",void 0),__decorate([state()],LyraDialog.prototype,"headingText",void 0);export{LyraDialog};
|
|
27
|
+
`,{part:"base",label:hasExplicitName?explicitName:void 0,labelledBy:useHeadingForName?this.headingId:void 0})}}__decorate([property({type:Boolean,reflect:!0})],LyraDialog.prototype,"open",null),__decorate([property({reflect:!0})],LyraDialog.prototype,"label",void 0),__decorate([property({attribute:"heading-level",reflect:!0})],LyraDialog.prototype,"headingLevel",void 0),__decorate([property()],LyraDialog.prototype,"heading",void 0),__decorate([property({type:Boolean,attribute:"without-close-button",reflect:!0})],LyraDialog.prototype,"withoutCloseButton",void 0),__decorate([property({type:Boolean,attribute:"without-header",reflect:!0})],LyraDialog.prototype,"withoutHeader",void 0),__decorate([property({type:Boolean,attribute:"no-header",reflect:!0})],LyraDialog.prototype,"noHeader",void 0),__decorate([property({type:Boolean,attribute:"fill-body",reflect:!0})],LyraDialog.prototype,"fillBody",void 0),__decorate([property({type:Boolean,attribute:"fullscreen-narrow",reflect:!0})],LyraDialog.prototype,"fullscreenNarrow",void 0),__decorate([property({type:Boolean,attribute:"with-footer",reflect:!0})],LyraDialog.prototype,"withFooter",void 0),__decorate([property({reflect:!0})],LyraDialog.prototype,"size",void 0),__decorate([property({attribute:"aria-label"})],LyraDialog.prototype,"hostAriaLabel",void 0),__decorate([property({type:Boolean,attribute:"light-dismiss"})],LyraDialog.prototype,"lightDismiss",void 0),__decorate([property({type:Boolean,attribute:"with-label"})],LyraDialog.prototype,"withLabel",void 0),__decorate([state()],LyraDialog.prototype,"hasFooterSlot",void 0),__decorate([state()],LyraDialog.prototype,"hasLabelSlot",void 0),__decorate([state()],LyraDialog.prototype,"hasHeaderActionsSlot",void 0),__decorate([state()],LyraDialog.prototype,"headingText",void 0);export{LyraDialog};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{modalHostStyles}from"../../../internal/native-modal-carrier.styles.js";import{dialogChrome,dialogOpenHost}from"../../../internal/modal-surface.styles.js";import{css}from"lit";import{glassSurface}from"../../../internal/glass-surface.styles.js";import{glassScrollLayerStyles}from"../../../internal/glass-scroll-layer.styles.js";import{glassIndependentRootStyles}from"../../../internal/glass-independent-root.styles.js";import{overlaySurface}from"../../../internal/overlay-surface.styles.js";import{activeFill,focusRingInwardOffset}from"../../../internal/interactive-control.styles.js";const styles=css` :host{--_lr-dialog-overlay-color:var(--lr-color-overlay);--_lr-dialog-max-width:var(--lr-size-32rem);--_lr-dialog-close-background:transparent;--_lr-dialog-close-background-hover:var(--lr-color-brand-quiet);--_lr-dialog-close-background-active: ${activeFill("var( --lr-icon-button-hover-bg, var(--lr-color-brand-quiet) )")};--_lr-dialog-close-color:var(--lr-color-text-quiet);--_lr-dialog-close-color-hover:var(--lr-color-brand);--_lr-dialog-close-color-active:var(--lr-icon-button-hover-color, var(--lr-color-brand));--_lr-dialog-close-radius:var(--lr-overlay-radius, var(--lr-radius));${modalHostStyles} ${dialogChrome}}${dialogOpenHost} :host([data-closing]){display:flex;pointer-events:none}:host([size='2xs']){--_lr-dialog-max-width:var(--lr-size-20rem)}:host([size=xs]){--_lr-dialog-max-width:var(--lr-size-24rem)}:host([size=s]),:host([size=small]){--_lr-dialog-max-width:var(--lr-size-28rem)}:host([size=l]),:host([size=large]){--_lr-dialog-max-width:var(--lr-size-38rem)}:host([size=xl]){--_lr-dialog-max-width:var(--lr-size-48rem)}[part~=base]{display:contents}[part~=backdrop]{position:absolute;inset:0;background:var(--lr-dialog-overlay-color,var(--_lr-dialog-overlay-color));backdrop-filter:var(--backdrop-filter,var(--lr-dialog-backdrop-filter,none))}[part~=panel]{position:relative;display:flex;flex-direction:column;min-inline-size:0;inline-size:var(--width,var(--lr-dialog-width,auto));max-inline-size:min(var(--lr-dialog-max-width,var(--width,var(--lr-dialog-width,var(--_lr-dialog-max-width)))),100%);block-size:var(--lr-dialog-height,auto);max-block-size:100
|
|
1
|
+
import{modalHostStyles}from"../../../internal/native-modal-carrier.styles.js";import{dialogChrome,dialogOpenHost}from"../../../internal/modal-surface.styles.js";import{css}from"lit";import{glassSurface}from"../../../internal/glass-surface.styles.js";import{glassScrollLayerStyles}from"../../../internal/glass-scroll-layer.styles.js";import{glassIndependentRootStyles}from"../../../internal/glass-independent-root.styles.js";import{overlaySurface}from"../../../internal/overlay-surface.styles.js";import{activeFill,focusRingInwardOffset}from"../../../internal/interactive-control.styles.js";const styles=css` :host{--_lr-dialog-overlay-color:var(--lr-color-overlay);--_lr-dialog-max-width:var(--lr-size-32rem);--_lr-dialog-close-background:transparent;--_lr-dialog-close-background-hover:var(--lr-color-brand-quiet);--_lr-dialog-close-background-active: ${activeFill("var( --lr-icon-button-hover-bg, var(--lr-color-brand-quiet) )")};--_lr-dialog-close-color:var(--lr-color-text-quiet);--_lr-dialog-close-color-hover:var(--lr-color-brand);--_lr-dialog-close-color-active:var(--lr-icon-button-hover-color, var(--lr-color-brand));--_lr-dialog-close-radius:var(--lr-overlay-radius, var(--lr-radius-container));${modalHostStyles} ${dialogChrome} padding-block-start:max(var(--lr-dialog-viewport-inset,var(--lr-space-l)),var(--lr-safe-area-top));padding-block-end:max(var(--lr-dialog-viewport-inset,var(--lr-space-l)),var(--lr-safe-area-bottom));padding-inline-start:max(var(--lr-dialog-viewport-inset,var(--lr-space-l)),var(--lr-safe-area-inline-start));padding-inline-end:max(var(--lr-dialog-viewport-inset,var(--lr-space-l)),var(--lr-safe-area-inline-end))}${dialogOpenHost} :host([data-closing]){display:flex;pointer-events:none}:host([size='2xs']){--_lr-dialog-max-width:var(--lr-size-20rem)}:host([size=xs]){--_lr-dialog-max-width:var(--lr-size-24rem)}:host([size=s]),:host([size=small]){--_lr-dialog-max-width:var(--lr-size-28rem)}:host([size=l]),:host([size=large]){--_lr-dialog-max-width:var(--lr-size-38rem)}:host([size=xl]){--_lr-dialog-max-width:var(--lr-size-48rem)}[part~=base]{display:contents}[part~=backdrop]{position:absolute;inset:0;background:var(--lr-dialog-overlay-color,var(--backdrop-color,var(--_lr-dialog-overlay-color)));backdrop-filter:var(--backdrop-filter,var(--lr-dialog-backdrop-filter,none))}[part~=panel]{position:relative;display:flex;flex-direction:column;min-inline-size:0;inline-size:var(--width,var(--lr-dialog-width,auto));max-inline-size:min(var(--lr-dialog-max-width,var(--width,var(--lr-dialog-width,var(--_lr-dialog-max-width)))),100%);block-size:var(--lr-dialog-height,auto);max-block-size:min(var(--lr-dialog-max-height,100%),100%);--_lr-overlay-surface:var(--lr-color-surface-container-highest);--_lr-dialog-panel-fill:var( --lr-dialog-panel-bg, var(--lr-overlay-surface, var(--_lr-overlay-surface, var(--lr-color-surface-container-highest))) );${overlaySurface} box-shadow:var(--lr-overlay-shadow-modal,var(--lr-shadow-xl));overflow:auto}[part=header]{display:flex;flex-wrap:wrap;align-items:center;min-inline-size:0;max-inline-size:100%;gap:var(--lr-space-s);padding:var(--header-spacing,var(--spacing,var(--lr-dialog-spacing-block,var(--lr-space-m)) var(--lr-dialog-spacing,var(--lr-space-l))));border-block-end:var(--lr-dialog-header-border,var(--lr-border-width-thin) solid var(--lr-dialog-divider-color,var(--lr-overlay-border,var(--lr-color-border-subtle))))}[part~=heading]{flex:1 1 auto;min-inline-size:0;margin:0;font-family:var(--lr-dialog-heading-font-family,var(--lr-font-heading));font-size:var(--lr-dialog-heading-font-size,inherit);font-weight:var(--lr-dialog-heading-font-weight,var(--lr-font-weight-semibold));letter-spacing:var(--lr-dialog-heading-letter-spacing,normal);line-height:var(--lr-dialog-heading-line-height,inherit);overflow:hidden;overflow-wrap:break-word;white-space:normal}[part=header-actions]{flex:1 1 auto;display:flex;flex-wrap:wrap;align-items:center;justify-content:flex-end;min-inline-size:0;max-inline-size:100%;overflow-wrap:anywhere;gap:var(--lr-space-xs);margin-inline-start:auto}[part=header-actions] ::slotted(*){min-inline-size:0;max-inline-size:100%;overflow-wrap:anywhere}[part~=close-button]{flex:0 0 auto;margin-inline-start:auto;--_lr-icon-button-background-default:var(--_lr-dialog-close-background);--_lr-icon-button-background-hover-default:var(--_lr-dialog-close-background-hover);--_lr-icon-button-background-active-default:var(--_lr-dialog-close-background-active);--_lr-icon-button-color-default:var(--_lr-dialog-close-color);--_lr-icon-button-color-hover-default:var(--_lr-dialog-close-color-hover);--_lr-icon-button-color-active-default:var(--_lr-dialog-close-color-active);--_lr-icon-button-radius-default:var(--_lr-dialog-close-radius)}[part=header-actions] + [part~=close-button]{margin-inline-start:0}[part~=close-button] svg{display:block}[part=body]{flex:1 1 auto;min-inline-size:0;max-inline-size:100%;padding:var(--body-spacing,var(--spacing,var(--lr-dialog-spacing,var(--lr-space-l))));overflow:var(--lr-dialog-body-overflow,auto);overflow-wrap:anywhere}:host([fill-body]) [part=body]{display:flex;flex-direction:column;flex:1 1 auto;min-block-size:0}:host([fill-body]) [part=body] ::slotted(*){flex:1 1 auto;min-block-size:0}[part=body]:focus-visible{${focusRingInwardOffset}}[part=footer]{display:flex;flex-wrap:wrap;align-items:center;justify-content:flex-end;min-inline-size:0;max-inline-size:100%;gap:var(--lr-space-s);padding:var(--footer-spacing,var(--spacing,var(--lr-dialog-spacing-block,var(--lr-space-m)) var(--lr-dialog-spacing,var(--lr-space-l))));border-block-start:var(--lr-border-width-thin) solid var(--lr-dialog-divider-color,var(--lr-overlay-border,var(--lr-color-border-subtle)));overflow-wrap:anywhere}[part=footer] ::slotted(*){min-inline-size:0;max-inline-size:100%;overflow-wrap:anywhere}[part=footer][hidden]{display:none}:host([fullscreen-narrow][data-fullscreen]){padding:0}:host([fullscreen-narrow][data-fullscreen]) [part~=panel]{box-sizing:border-box;inline-size:100%;max-inline-size:100%;block-size:100%;max-block-size:100%;border-radius:0;padding-block:var(--lr-safe-area-top) var(--lr-safe-area-bottom);padding-inline:var(--lr-safe-area-inline-start) var(--lr-safe-area-inline-end)}${glassScrollLayerStyles} ${glassIndependentRootStyles} ${glassSurface('[part~="panel"]',css`var(--_lr-dialog-panel-fill, var(--lr-overlay-surface, var(--_lr-overlay-surface, var(--lr-color-surface-container-highest))))`,void 0,!0)} `;export{styles};
|