@aceshooting/lyra-ui 1.2.0 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +98 -14
- package/custom-elements.json +30279 -12124
- package/dist/components/app-rail/app-rail-item.d.ts +30 -0
- package/dist/components/app-rail/app-rail-item.js +68 -0
- package/dist/components/app-rail/app-rail-item.styles.d.ts +1 -0
- package/dist/components/app-rail/app-rail-item.styles.js +65 -0
- package/dist/components/app-rail/app-rail.d.ts +168 -0
- package/dist/components/app-rail/app-rail.js +419 -0
- package/dist/components/app-rail/app-rail.styles.d.ts +1 -0
- package/dist/components/app-rail/app-rail.styles.js +128 -0
- package/dist/components/attachment-chip/attachment-chip.d.ts +141 -0
- package/dist/components/attachment-chip/attachment-chip.js +356 -0
- package/dist/components/attachment-chip/attachment-chip.styles.d.ts +1 -0
- package/dist/components/attachment-chip/attachment-chip.styles.js +184 -0
- package/dist/components/attachment-trigger/attachment-trigger.d.ts +96 -0
- package/dist/components/attachment-trigger/attachment-trigger.js +270 -0
- package/dist/components/attachment-trigger/attachment-trigger.styles.d.ts +1 -0
- package/dist/components/attachment-trigger/attachment-trigger.styles.js +90 -0
- package/dist/components/chart/bar-chart.js +2 -18
- package/dist/components/chart/box-plot.d.ts +25 -1
- package/dist/components/chart/box-plot.js +147 -7
- package/dist/components/chart/box-plot.styles.js +13 -0
- package/dist/components/chart/bubble-chart.js +2 -18
- package/dist/components/chart/chart-loader.d.ts +44 -13
- package/dist/components/chart/chart-loader.js +65 -18
- package/dist/components/chart/chart.d.ts +55 -12
- package/dist/components/chart/chart.js +247 -49
- package/dist/components/chart/doughnut-chart.js +2 -18
- package/dist/components/chart/histogram-bin.d.ts +7 -1
- package/dist/components/chart/histogram-bin.js +32 -14
- package/dist/components/chart/histogram.js +8 -16
- package/dist/components/chart/line-chart.js +2 -18
- package/dist/components/chart/lite-chart.d.ts +134 -3
- package/dist/components/chart/lite-chart.js +382 -67
- package/dist/components/chart/lite-chart.styles.js +9 -0
- package/dist/components/chart/pie-chart.js +2 -18
- package/dist/components/chart/polar-area-chart.js +2 -18
- package/dist/components/chart/radar-chart.js +2 -18
- package/dist/components/chart/scatter-chart.js +2 -18
- package/dist/components/chat-composer/chat-composer.d.ts +133 -0
- package/dist/components/chat-composer/chat-composer.js +366 -0
- package/dist/components/chat-composer/chat-composer.styles.d.ts +1 -0
- package/dist/components/chat-composer/chat-composer.styles.js +145 -0
- package/dist/components/chat-message/chat-message.d.ts +141 -0
- package/dist/components/chat-message/chat-message.js +331 -0
- package/dist/components/chat-message/chat-message.styles.d.ts +1 -0
- package/dist/components/chat-message/chat-message.styles.js +203 -0
- package/dist/components/checkbox/checkbox.d.ts +117 -0
- package/dist/components/checkbox/checkbox.js +353 -0
- package/dist/components/checkbox/checkbox.styles.d.ts +1 -0
- package/dist/components/checkbox/checkbox.styles.js +77 -0
- package/dist/components/chip/chip-group.d.ts +56 -0
- package/dist/components/chip/chip-group.js +130 -0
- package/dist/components/chip/chip-group.styles.d.ts +1 -0
- package/dist/components/chip/chip-group.styles.js +57 -0
- package/dist/components/chip/chip.d.ts +64 -0
- package/dist/components/chip/chip.js +122 -0
- package/dist/components/chip/chip.styles.d.ts +1 -0
- package/dist/components/chip/chip.styles.js +115 -0
- package/dist/components/citation-badge/citation-badge.d.ts +113 -0
- package/dist/components/citation-badge/citation-badge.js +318 -0
- package/dist/components/citation-badge/citation-badge.styles.d.ts +1 -0
- package/dist/components/citation-badge/citation-badge.styles.js +96 -0
- package/dist/components/code-block/code-block.d.ts +127 -0
- package/dist/components/code-block/code-block.js +382 -0
- package/dist/components/code-block/code-block.styles.d.ts +1 -0
- package/dist/components/code-block/code-block.styles.js +187 -0
- package/dist/components/code-block/code-loader.d.ts +87 -0
- package/dist/components/code-block/code-loader.js +142 -0
- package/dist/components/combobox/combobox.d.ts +65 -6
- package/dist/components/combobox/combobox.js +258 -48
- package/dist/components/combobox/combobox.styles.js +3 -3
- package/dist/components/combobox/option.d.ts +5 -1
- package/dist/components/combobox/option.js +35 -0
- package/dist/components/context-meter/context-meter.d.ts +53 -0
- package/dist/components/context-meter/context-meter.js +159 -0
- package/dist/components/context-meter/context-meter.styles.d.ts +1 -0
- package/dist/components/context-meter/context-meter.styles.js +114 -0
- package/dist/components/conversation-item/conversation-item.d.ts +125 -0
- package/dist/components/conversation-item/conversation-item.js +331 -0
- package/dist/components/conversation-item/conversation-item.styles.d.ts +1 -0
- package/dist/components/conversation-item/conversation-item.styles.js +155 -0
- package/dist/components/date-picker/calendar-core.d.ts +24 -0
- package/dist/components/date-picker/calendar-core.js +51 -4
- package/dist/components/date-picker/date-input.d.ts +100 -9
- package/dist/components/date-picker/date-input.js +383 -66
- package/dist/components/date-picker/date-picker.d.ts +35 -4
- package/dist/components/date-picker/date-picker.js +171 -44
- package/dist/components/dialog/confirm.d.ts +40 -0
- package/dist/components/dialog/confirm.js +76 -0
- package/dist/components/dialog/dialog.d.ts +129 -0
- package/dist/components/dialog/dialog.js +288 -0
- package/dist/components/dialog/dialog.styles.d.ts +1 -0
- package/dist/components/dialog/dialog.styles.js +96 -0
- package/dist/components/dock-panel/dock-panel.d.ts +142 -0
- package/dist/components/dock-panel/dock-panel.js +359 -0
- package/dist/components/dock-panel/dock-panel.styles.d.ts +1 -0
- package/dist/components/dock-panel/dock-panel.styles.js +159 -0
- package/dist/components/document-preview/document-preview.d.ts +143 -0
- package/dist/components/document-preview/document-preview.js +388 -0
- package/dist/components/document-preview/document-preview.styles.d.ts +1 -0
- package/dist/components/document-preview/document-preview.styles.js +191 -0
- package/dist/components/empty/empty.d.ts +1 -2
- package/dist/components/empty/empty.js +18 -12
- package/dist/components/empty/empty.styles.js +0 -3
- package/dist/components/export-button/csv.js +1 -1
- package/dist/components/export-button/export-button.d.ts +12 -0
- package/dist/components/export-button/export-button.js +35 -5
- package/dist/components/export-button/export-button.styles.js +5 -1
- package/dist/components/file-input/accept.js +2 -0
- package/dist/components/file-input/file-input.d.ts +10 -1
- package/dist/components/file-input/file-input.js +36 -5
- package/dist/components/flag/flag.d.ts +29 -13
- package/dist/components/flag/flag.js +54 -14
- package/dist/components/flag/flag.styles.js +1 -1
- package/dist/components/flag/language-map.d.ts +4 -1
- package/dist/components/flag/language-map.js +6 -3
- package/dist/components/gauge/gauge.d.ts +10 -1
- package/dist/components/gauge/gauge.js +41 -13
- package/dist/components/generation-status/generation-status.d.ts +117 -0
- package/dist/components/generation-status/generation-status.js +327 -0
- package/dist/components/generation-status/generation-status.styles.d.ts +1 -0
- package/dist/components/generation-status/generation-status.styles.js +84 -0
- package/dist/components/graph/graph.d.ts +37 -3
- package/dist/components/graph/graph.js +132 -20
- package/dist/components/heatmap/calendar-grid.d.ts +19 -7
- package/dist/components/heatmap/calendar-grid.js +42 -18
- package/dist/components/heatmap/heatmap-scale.d.ts +11 -1
- package/dist/components/heatmap/heatmap-scale.js +14 -2
- package/dist/components/heatmap/heatmap.d.ts +227 -12
- package/dist/components/heatmap/heatmap.js +488 -93
- package/dist/components/json-viewer/json-viewer.d.ts +70 -0
- package/dist/components/json-viewer/json-viewer.js +361 -0
- package/dist/components/json-viewer/json-viewer.styles.d.ts +1 -0
- package/dist/components/json-viewer/json-viewer.styles.js +177 -0
- package/dist/components/kbd/kbd.d.ts +77 -0
- package/dist/components/kbd/kbd.js +231 -0
- package/dist/components/kbd/kbd.styles.d.ts +1 -0
- package/dist/components/kbd/kbd.styles.js +52 -0
- package/dist/components/live-region/live-region.d.ts +90 -0
- package/dist/components/live-region/live-region.js +189 -0
- package/dist/components/live-region/live-region.styles.d.ts +1 -0
- package/dist/components/live-region/live-region.styles.js +10 -0
- package/dist/components/map/map.d.ts +32 -7
- package/dist/components/map/map.js +133 -32
- package/dist/components/markdown/markdown-loader.d.ts +58 -0
- package/dist/components/markdown/markdown-loader.js +77 -0
- package/dist/components/markdown/markdown.d.ts +119 -0
- package/dist/components/markdown/markdown.js +389 -0
- package/dist/components/markdown/markdown.styles.d.ts +1 -0
- package/dist/components/markdown/markdown.styles.js +88 -0
- package/dist/components/media-card/media-card.d.ts +130 -0
- package/dist/components/media-card/media-card.js +273 -0
- package/dist/components/media-card/media-card.styles.d.ts +1 -0
- package/dist/components/media-card/media-card.styles.js +132 -0
- package/dist/components/mention-popover/mention-popover.d.ts +203 -0
- package/dist/components/mention-popover/mention-popover.js +493 -0
- package/dist/components/mention-popover/mention-popover.styles.d.ts +1 -0
- package/dist/components/mention-popover/mention-popover.styles.js +101 -0
- package/dist/components/menu/menu-item.d.ts +91 -0
- package/dist/components/menu/menu-item.js +206 -0
- package/dist/components/menu/menu-item.styles.d.ts +1 -0
- package/dist/components/menu/menu-item.styles.js +75 -0
- package/dist/components/menu/menu.d.ts +167 -0
- package/dist/components/menu/menu.js +461 -0
- package/dist/components/menu/menu.styles.d.ts +1 -0
- package/dist/components/menu/menu.styles.js +67 -0
- package/dist/components/model-select/model-select.d.ts +170 -0
- package/dist/components/model-select/model-select.js +588 -0
- package/dist/components/model-select/model-select.styles.d.ts +1 -0
- package/dist/components/model-select/model-select.styles.js +203 -0
- package/dist/components/model-settings-panel/model-settings-panel.d.ts +93 -0
- package/dist/components/model-settings-panel/model-settings-panel.js +209 -0
- package/dist/components/model-settings-panel/model-settings-panel.styles.d.ts +1 -0
- package/dist/components/model-settings-panel/model-settings-panel.styles.js +82 -0
- package/dist/components/playback/playback.d.ts +19 -3
- package/dist/components/playback/playback.js +109 -33
- package/dist/components/playback/playback.styles.js +6 -1
- package/dist/components/responsive-panel/responsive-panel.d.ts +163 -0
- package/dist/components/responsive-panel/responsive-panel.js +363 -0
- package/dist/components/responsive-panel/responsive-panel.styles.d.ts +1 -0
- package/dist/components/responsive-panel/responsive-panel.styles.js +103 -0
- package/dist/components/result-card/result-card.d.ts +50 -0
- package/dist/components/result-card/result-card.js +89 -0
- package/dist/components/result-card/result-card.styles.d.ts +1 -0
- package/dist/components/result-card/result-card.styles.js +49 -0
- package/dist/components/result-card/result-field.d.ts +36 -0
- package/dist/components/result-card/result-field.js +87 -0
- package/dist/components/result-card/result-field.styles.d.ts +1 -0
- package/dist/components/result-card/result-field.styles.js +32 -0
- package/dist/components/select/select.d.ts +84 -4
- package/dist/components/select/select.js +251 -36
- package/dist/components/skeleton/skeleton.d.ts +3 -0
- package/dist/components/skeleton/skeleton.js +7 -1
- package/dist/components/skeleton/skeleton.styles.js +5 -4
- package/dist/components/slider/slider.d.ts +141 -0
- package/dist/components/slider/slider.js +467 -0
- package/dist/components/slider/slider.styles.d.ts +1 -0
- package/dist/components/slider/slider.styles.js +87 -0
- package/dist/components/source-card/source-card.d.ts +104 -0
- package/dist/components/source-card/source-card.js +195 -0
- package/dist/components/source-card/source-card.styles.d.ts +1 -0
- package/dist/components/source-card/source-card.styles.js +69 -0
- package/dist/components/source-list/source-list.d.ts +63 -0
- package/dist/components/source-list/source-list.js +130 -0
- package/dist/components/source-list/source-list.styles.d.ts +1 -0
- package/dist/components/source-list/source-list.styles.js +59 -0
- package/dist/components/sparkline/sparkline.js +58 -20
- package/dist/components/split/split.d.ts +224 -5
- package/dist/components/split/split.js +617 -43
- package/dist/components/split/split.styles.js +47 -0
- package/dist/components/stat/stat.d.ts +15 -4
- package/dist/components/stat/stat.js +53 -12
- package/dist/components/stream-status/stream-status.d.ts +126 -0
- package/dist/components/stream-status/stream-status.js +292 -0
- package/dist/components/stream-status/stream-status.styles.d.ts +1 -0
- package/dist/components/stream-status/stream-status.styles.js +103 -0
- package/dist/components/streaming-text/streaming-text.d.ts +104 -0
- package/dist/components/streaming-text/streaming-text.js +224 -0
- package/dist/components/streaming-text/streaming-text.styles.d.ts +1 -0
- package/dist/components/streaming-text/streaming-text.styles.js +63 -0
- package/dist/components/switch/switch.d.ts +103 -0
- package/dist/components/switch/switch.js +250 -0
- package/dist/components/switch/switch.styles.d.ts +1 -0
- package/dist/components/switch/switch.styles.js +75 -0
- package/dist/components/table/table.d.ts +89 -5
- package/dist/components/table/table.js +243 -26
- package/dist/components/table/table.styles.js +6 -1
- package/dist/components/tabs/tabs.d.ts +74 -0
- package/dist/components/tabs/tabs.js +254 -0
- package/dist/components/tabs/tabs.styles.d.ts +1 -0
- package/dist/components/tabs/tabs.styles.js +74 -0
- package/dist/components/thinking-panel/thinking-panel.d.ts +123 -0
- package/dist/components/thinking-panel/thinking-panel.js +260 -0
- package/dist/components/thinking-panel/thinking-panel.styles.d.ts +1 -0
- package/dist/components/thinking-panel/thinking-panel.styles.js +123 -0
- package/dist/components/time-range/time-range.d.ts +59 -2
- package/dist/components/time-range/time-range.js +163 -67
- package/dist/components/toast/toast-item.d.ts +12 -2
- package/dist/components/toast/toast-item.js +106 -44
- package/dist/components/toast/toast-item.styles.js +59 -28
- package/dist/components/toast/toast.js +17 -5
- package/dist/components/toast/toaster.js +10 -1
- package/dist/components/tool-approval-dialog/tool-approval-dialog.d.ts +131 -0
- package/dist/components/tool-approval-dialog/tool-approval-dialog.js +329 -0
- package/dist/components/tool-approval-dialog/tool-approval-dialog.styles.d.ts +1 -0
- package/dist/components/tool-approval-dialog/tool-approval-dialog.styles.js +160 -0
- package/dist/components/tool-call-chip/tool-call-chip.d.ts +105 -0
- package/dist/components/tool-call-chip/tool-call-chip.js +349 -0
- package/dist/components/tool-call-chip/tool-call-chip.styles.d.ts +1 -0
- package/dist/components/tool-call-chip/tool-call-chip.styles.js +203 -0
- package/dist/components/tool-param-form/tool-param-form.d.ts +206 -0
- package/dist/components/tool-param-form/tool-param-form.js +610 -0
- package/dist/components/tool-param-form/tool-param-form.styles.d.ts +1 -0
- package/dist/components/tool-param-form/tool-param-form.styles.js +75 -0
- package/dist/components/tool-result-dialog/tool-result-dialog.d.ts +122 -0
- package/dist/components/tool-result-dialog/tool-result-dialog.js +358 -0
- package/dist/components/tool-result-dialog/tool-result-dialog.styles.d.ts +1 -0
- package/dist/components/tool-result-dialog/tool-result-dialog.styles.js +176 -0
- package/dist/components/tool-result-view/registry.d.ts +73 -0
- package/dist/components/tool-result-view/registry.js +89 -0
- package/dist/components/tool-result-view/tool-result-view.d.ts +58 -0
- package/dist/components/tool-result-view/tool-result-view.js +152 -0
- package/dist/components/tool-result-view/tool-result-view.styles.d.ts +1 -0
- package/dist/components/tool-result-view/tool-result-view.styles.js +13 -0
- package/dist/components/tool-select-dialog/tool-select-dialog.d.ts +151 -0
- package/dist/components/tool-select-dialog/tool-select-dialog.js +350 -0
- package/dist/components/tool-select-dialog/tool-select-dialog.styles.d.ts +1 -0
- package/dist/components/tool-select-dialog/tool-select-dialog.styles.js +191 -0
- package/dist/components/tree/tree-node.d.ts +15 -3
- package/dist/components/tree/tree-node.js +20 -7
- package/dist/components/tree/tree.d.ts +25 -10
- package/dist/components/tree/tree.js +39 -31
- package/dist/components/typing-indicator/typing-indicator.d.ts +70 -0
- package/dist/components/typing-indicator/typing-indicator.js +108 -0
- package/dist/components/typing-indicator/typing-indicator.styles.d.ts +1 -0
- package/dist/components/typing-indicator/typing-indicator.styles.js +132 -0
- package/dist/components/virtual-list/virtual-list.d.ts +210 -0
- package/dist/components/virtual-list/virtual-list.js +607 -0
- package/dist/components/virtual-list/virtual-list.styles.d.ts +1 -0
- package/dist/components/virtual-list/virtual-list.styles.js +56 -0
- package/dist/components/widget/widget.d.ts +5 -4
- package/dist/components/widget/widget.js +54 -120
- package/dist/components/widget/widget.styles.js +8 -2
- package/dist/components/word-cloud/word-cloud-layout.d.ts +7 -0
- package/dist/components/word-cloud/word-cloud-layout.js +29 -2
- package/dist/components/word-cloud/word-cloud.d.ts +28 -2
- package/dist/components/word-cloud/word-cloud.js +69 -19
- package/dist/components/word-cloud/word-cloud.styles.js +16 -3
- package/dist/internal/anchored-validity.d.ts +1 -0
- package/dist/internal/anchored-validity.js +86 -0
- package/dist/internal/announcer.d.ts +57 -0
- package/dist/internal/announcer.js +71 -0
- package/dist/internal/form-associated.d.ts +8 -0
- package/dist/internal/form-associated.js +98 -15
- package/dist/internal/group-by-recency.d.ts +50 -0
- package/dist/internal/group-by-recency.js +80 -0
- package/dist/internal/numbers.d.ts +12 -0
- package/dist/internal/numbers.js +26 -0
- package/dist/internal/overlay-manager.d.ts +51 -0
- package/dist/internal/overlay-manager.js +523 -0
- package/dist/internal/positioner.js +27 -3
- package/dist/internal/rtl.d.ts +23 -0
- package/dist/internal/rtl.js +28 -0
- package/dist/internal/safe-url.d.ts +12 -0
- package/dist/internal/safe-url.js +41 -0
- package/dist/internal/scroll-lock.d.ts +10 -5
- package/dist/internal/scroll-lock.js +30 -14
- package/dist/internal/tokens.styles.js +22 -10
- package/dist/lyra.d.ts +133 -31
- package/dist/lyra.js +96 -26
- package/llms-full.txt +4546 -183
- package/llms.txt +21 -5
- package/package.json +41 -6
- package/dist/components/chart/bar-chart.stories.d.ts +0 -5
- package/dist/components/chart/bar-chart.stories.js +0 -20
- package/dist/components/chart/box-plot.stories.d.ts +0 -5
- package/dist/components/chart/box-plot.stories.js +0 -29
- package/dist/components/chart/bubble-chart.stories.d.ts +0 -5
- package/dist/components/chart/bubble-chart.stories.js +0 -26
- package/dist/components/chart/chart.stories.d.ts +0 -32
- package/dist/components/chart/chart.stories.js +0 -141
- package/dist/components/chart/doughnut-chart.stories.d.ts +0 -5
- package/dist/components/chart/doughnut-chart.stories.js +0 -26
- package/dist/components/chart/histogram.stories.d.ts +0 -5
- package/dist/components/chart/histogram.stories.js +0 -17
- package/dist/components/chart/line-chart.stories.d.ts +0 -22
- package/dist/components/chart/line-chart.stories.js +0 -99
- package/dist/components/chart/lite-chart.stories.d.ts +0 -14
- package/dist/components/chart/lite-chart.stories.js +0 -114
- package/dist/components/chart/pie-chart.stories.d.ts +0 -5
- package/dist/components/chart/pie-chart.stories.js +0 -26
- package/dist/components/chart/polar-area-chart.stories.d.ts +0 -5
- package/dist/components/chart/polar-area-chart.stories.js +0 -20
- package/dist/components/chart/radar-chart.stories.d.ts +0 -5
- package/dist/components/chart/radar-chart.stories.js +0 -20
- package/dist/components/chart/scatter-chart.stories.d.ts +0 -5
- package/dist/components/chart/scatter-chart.stories.js +0 -31
- package/dist/components/combobox/combobox.stories.d.ts +0 -24
- package/dist/components/combobox/combobox.stories.js +0 -102
- package/dist/components/date-picker/date-input.stories.d.ts +0 -10
- package/dist/components/date-picker/date-input.stories.js +0 -48
- package/dist/components/date-picker/date-picker.stories.d.ts +0 -10
- package/dist/components/date-picker/date-picker.stories.js +0 -25
- package/dist/components/empty/empty.stories.d.ts +0 -7
- package/dist/components/empty/empty.stories.js +0 -34
- package/dist/components/export-button/export-button.stories.d.ts +0 -7
- package/dist/components/export-button/export-button.stories.js +0 -37
- package/dist/components/file-input/file-input.stories.d.ts +0 -7
- package/dist/components/file-input/file-input.stories.js +0 -19
- package/dist/components/flag/flag.stories.d.ts +0 -6
- package/dist/components/flag/flag.stories.js +0 -31
- package/dist/components/gauge/gauge.stories.d.ts +0 -8
- package/dist/components/gauge/gauge.stories.js +0 -19
- package/dist/components/graph/graph.stories.d.ts +0 -8
- package/dist/components/graph/graph.stories.js +0 -68
- package/dist/components/heatmap/heatmap.stories.d.ts +0 -27
- package/dist/components/heatmap/heatmap.stories.js +0 -179
- package/dist/components/map/map.stories.d.ts +0 -15
- package/dist/components/map/map.stories.js +0 -135
- package/dist/components/playback/playback.stories.d.ts +0 -7
- package/dist/components/playback/playback.stories.js +0 -16
- package/dist/components/select/select.stories.d.ts +0 -21
- package/dist/components/select/select.stories.js +0 -91
- package/dist/components/skeleton/skeleton.stories.d.ts +0 -5
- package/dist/components/skeleton/skeleton.stories.js +0 -16
- package/dist/components/sparkline/sparkline.stories.d.ts +0 -11
- package/dist/components/sparkline/sparkline.stories.js +0 -39
- package/dist/components/split/split.stories.d.ts +0 -7
- package/dist/components/split/split.stories.js +0 -36
- package/dist/components/stat/stat.stories.d.ts +0 -9
- package/dist/components/stat/stat.stories.js +0 -81
- package/dist/components/table/table.stories.d.ts +0 -12
- package/dist/components/table/table.stories.js +0 -67
- package/dist/components/time-range/time-range.stories.d.ts +0 -8
- package/dist/components/time-range/time-range.stories.js +0 -26
- package/dist/components/toast/toast.stories.d.ts +0 -8
- package/dist/components/toast/toast.stories.js +0 -72
- package/dist/components/tree/tree.stories.d.ts +0 -9
- package/dist/components/tree/tree.stories.js +0 -52
- package/dist/components/widget/widget.stories.d.ts +0 -9
- package/dist/components/widget/widget.stories.js +0 -74
- package/dist/components/word-cloud/word-cloud.stories.d.ts +0 -10
- package/dist/components/word-cloud/word-cloud.stories.js +0 -55
|
@@ -4,34 +4,102 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
4
4
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
|
-
import { html } from 'lit';
|
|
7
|
+
import { html, nothing } from 'lit';
|
|
8
8
|
import { property, state } from 'lit/decorators.js';
|
|
9
9
|
import { LyraElement } from '../../internal/lyra-element.js';
|
|
10
10
|
import { defineElement } from '../../internal/prefix.js';
|
|
11
11
|
import { place } from '../../internal/positioner.js';
|
|
12
12
|
import { nextId } from '../../internal/a11y.js';
|
|
13
13
|
import { chevronIcon } from '../../internal/icons.js';
|
|
14
|
+
import { AnchoredValidityController, VALIDITY_ANCHOR } from '../../internal/anchored-validity.js';
|
|
14
15
|
import { styles } from './select.styles.js';
|
|
15
16
|
import { LyraOption } from '../combobox/option.js';
|
|
16
17
|
import '../combobox/option.js';
|
|
18
|
+
/**
|
|
19
|
+
* `<lyra-select>` — a plain closed-list dropdown: a direct `<lyra-*>`
|
|
20
|
+
* counterpart to `<wa-select>`/`<wa-option>`. Trigger is a button (not a text
|
|
21
|
+
* input) -- click/Enter/Space/ArrowDown opens it, there's no typing-to-filter.
|
|
22
|
+
* A printable keypress instead jumps (or, while closed, directly selects) the
|
|
23
|
+
* next option whose label starts with what's been typed, like a native
|
|
24
|
+
* `<select>`'s type-ahead.
|
|
25
|
+
*
|
|
26
|
+
* Options are `<lyra-option value>` children, the same element `<lyra-combobox>`
|
|
27
|
+
* uses. Unlike `lyra-combobox` this is single-select only, with no filter/
|
|
28
|
+
* source/with-clear/max-options-visible/empty-text/max-render/multiple surface
|
|
29
|
+
* -- see `<lyra-combobox>` for the filterable/multi-select case.
|
|
30
|
+
*
|
|
31
|
+
* Reuses `lyra-combobox`'s popup positioning (`internal/positioner.js`) and
|
|
32
|
+
* click-outside/Escape/Home/End/Arrow-key listbox navigation patterns,
|
|
33
|
+
* adapted to a trigger button that keeps DOM focus throughout (the listbox's
|
|
34
|
+
* "active" row is conveyed via `aria-activedescendant`, never actual focus),
|
|
35
|
+
* matching the WAI-ARIA "select-only combobox" pattern.
|
|
36
|
+
*
|
|
37
|
+
* When `autoCommitSingleOption` is set and exactly one option is enabled
|
|
38
|
+
* (regardless of how many disabled ones exist alongside it), the popup never
|
|
39
|
+
* opens at all: a click, Enter, Space, ArrowDown, or ArrowUp on the trigger
|
|
40
|
+
* commits that sole option directly, and the trigger renders as a plain
|
|
41
|
+
* `role="button"` with no chevron/`aria-haspopup`/`aria-expanded` rather than
|
|
42
|
+
* a combobox with a permanently inert popup state — opening a one-row list to
|
|
43
|
+
* pick the only available choice is pure friction with no real decision
|
|
44
|
+
* behind it. This never changes `value`/validity defaults on its own — an
|
|
45
|
+
* unselected single-option select stays unselected (and a `required` one
|
|
46
|
+
* stays invalid) exactly like the multi-option case, until the trigger is
|
|
47
|
+
* actually activated. `autoCommitSingleOption` defaults to `false`: by
|
|
48
|
+
* default a select always renders the normal combobox/listbox/chevron
|
|
49
|
+
* trigger no matter how many options are enabled, matching pre-1.3.0
|
|
50
|
+
* behavior — opt in explicitly if a narrowing-to-one option list should
|
|
51
|
+
* auto-commit.
|
|
52
|
+
*
|
|
53
|
+
* @customElement lyra-select
|
|
54
|
+
* @slot - `<lyra-option>` elements.
|
|
55
|
+
* @slot label - Custom label content.
|
|
56
|
+
* @slot hint - Custom hint content.
|
|
57
|
+
* @slot error - Custom error content.
|
|
58
|
+
* @event change - The selection changed.
|
|
59
|
+
* @event input - Fired alongside `change` on every selection change (native
|
|
60
|
+
* `<select>` doesn't meaningfully distinguish the two either).
|
|
61
|
+
* @event lyra-show - The listbox opened.
|
|
62
|
+
* @event lyra-hide - The listbox closed.
|
|
63
|
+
* @csspart form-control - The outer wrapper around label, trigger, listbox, error and hint.
|
|
64
|
+
* @csspart form-control-label - The `<label>` element.
|
|
65
|
+
* @csspart trigger - The trigger button (positioning anchor).
|
|
66
|
+
* @csspart listbox - The options popover.
|
|
67
|
+
* @csspart option - An option row.
|
|
68
|
+
* @csspart option-dot - An option row's leading status dot (when `dot-color` is set).
|
|
69
|
+
* @csspart option-label - An option row's label/sub wrapper.
|
|
70
|
+
* @csspart option-sub - An option row's secondary line (when `sub` is set).
|
|
71
|
+
* @csspart expand-icon - The dropdown indicator.
|
|
72
|
+
* @csspart error - The error message.
|
|
73
|
+
* @csspart hint - The hint message.
|
|
74
|
+
*/
|
|
17
75
|
export class LyraSelect extends LyraElement {
|
|
18
76
|
static { this.formAssociated = true; }
|
|
19
77
|
static { this.styles = [LyraElement.styles, styles]; }
|
|
20
78
|
static { this.properties = {
|
|
79
|
+
disabled: { type: Boolean, reflect: true, noAccessor: true },
|
|
80
|
+
required: { type: Boolean, reflect: true, noAccessor: true },
|
|
21
81
|
value: { noAccessor: true },
|
|
82
|
+
name: { reflect: true, noAccessor: true },
|
|
22
83
|
}; }
|
|
23
84
|
constructor() {
|
|
24
85
|
super();
|
|
25
86
|
this.placeholder = '';
|
|
26
|
-
this.disabled = false;
|
|
27
|
-
this.required = false;
|
|
28
|
-
this.name = '';
|
|
29
87
|
this.label = '';
|
|
30
88
|
this.hint = '';
|
|
31
89
|
this.errorText = '';
|
|
32
90
|
this.open = false;
|
|
33
91
|
/** Visual size — same `xs`–`xl` scale as `lyra-toast-item`'s `size`. */
|
|
34
92
|
this.size = 'm';
|
|
93
|
+
/**
|
|
94
|
+
* Opt-in: when `true` and exactly one `<lyra-option>` is enabled, the
|
|
95
|
+
* trigger commits that option directly (click/Enter/Space/ArrowDown/
|
|
96
|
+
* ArrowUp) instead of opening the listbox, and renders as a plain
|
|
97
|
+
* `role="button"` with no chevron. Defaults to `false`, which always
|
|
98
|
+
* renders the normal combobox/listbox/chevron trigger regardless of how
|
|
99
|
+
* many options are enabled — the pre-1.3.0 behavior. See the class doc
|
|
100
|
+
* above and `onlyOption` below for the full rationale.
|
|
101
|
+
*/
|
|
102
|
+
this.autoCommitSingleOption = false;
|
|
35
103
|
this.activeIndex = -1;
|
|
36
104
|
this.options = [];
|
|
37
105
|
// Set on the trigger button's first `blur`; gates the `data-invalid`
|
|
@@ -44,10 +112,17 @@ export class LyraSelect extends LyraElement {
|
|
|
44
112
|
this.hasHintSlot = false;
|
|
45
113
|
this.hasErrorSlot = false;
|
|
46
114
|
this.hasLabelSlot = false;
|
|
115
|
+
// Tracked separately from the consumer's own `disabled` -- a native
|
|
116
|
+
// `<input>`'s own `disabled` IDL property/attribute is never mutated by
|
|
117
|
+
// fieldset cascading, so a consumer's explicit `disabled` must survive the
|
|
118
|
+
// fieldset re-enabling (see `formDisabledCallback` below).
|
|
119
|
+
this._fieldsetDisabled = false;
|
|
47
120
|
this.listId = nextId('select-list');
|
|
48
121
|
this.triggerId = nextId('select-trigger');
|
|
49
122
|
this._isFirstUpdate = true;
|
|
50
123
|
this._selected = '';
|
|
124
|
+
this._disabled = false;
|
|
125
|
+
this._required = false;
|
|
51
126
|
// What `form.reset()` restores to. Captured exactly once, from whatever
|
|
52
127
|
// `<lyra-option selected>` markup was present the first time slotted
|
|
53
128
|
// options are collected (mirrors native `<select><option selected>`) --
|
|
@@ -56,10 +131,22 @@ export class LyraSelect extends LyraElement {
|
|
|
56
131
|
// the reset default. See lyra-combobox's identical `_defaultSelected`.
|
|
57
132
|
this._defaultSelected = '';
|
|
58
133
|
this._defaultCaptured = false;
|
|
134
|
+
// A restored value must win over declarative selected markup collected by
|
|
135
|
+
// the first asynchronous slotchange. Cleared by the next ordinary value write.
|
|
136
|
+
this._restoredStateActive = false;
|
|
59
137
|
// Standard listbox type-ahead: printable keystrokes accumulate into this
|
|
60
138
|
// buffer and reset ~500ms after the last one, so "b" then "a" narrows to
|
|
61
139
|
// "ba" instead of restarting the search on every keystroke.
|
|
62
140
|
this.typeAheadBuffer = '';
|
|
141
|
+
// Hand-written accessor (mirrors the `value` accessor below, and Task 2's
|
|
142
|
+
// `FormAssociated.name` in `../../internal/form-associated.ts`): a
|
|
143
|
+
// form-associated custom element's submitted entry name is resolved by the
|
|
144
|
+
// browser from the live `name` *content attribute*, read synchronously at
|
|
145
|
+
// FormData-construction/submit time (see `syncFormValue()` below) -- Lit's
|
|
146
|
+
// async (microtask-deferred) `reflect: true` alone would leave a
|
|
147
|
+
// property-only assignment like `el.name = 'b'` invisible to a same-tick
|
|
148
|
+
// `new FormData(form)`/submit, so the attribute write happens here instead.
|
|
149
|
+
this._name = '';
|
|
63
150
|
this.collectOptions = (e) => {
|
|
64
151
|
const slot = e.target;
|
|
65
152
|
const previous = new Set(this.options);
|
|
@@ -77,7 +164,7 @@ export class LyraSelect extends LyraElement {
|
|
|
77
164
|
// the reset default.
|
|
78
165
|
const declared = this.options.filter((o) => o.selected).map((o) => o.value);
|
|
79
166
|
this._defaultSelected = declared[0] ?? '';
|
|
80
|
-
if (declared.length) {
|
|
167
|
+
if (declared.length && !this._restoredStateActive) {
|
|
81
168
|
this.value = declared[0];
|
|
82
169
|
return; // `value=`'s setter already called reflectSelected()
|
|
83
170
|
}
|
|
@@ -89,20 +176,31 @@ export class LyraSelect extends LyraElement {
|
|
|
89
176
|
// into the live selection instead of letting reflectSelected() below
|
|
90
177
|
// strip its `selected` attribute back off.
|
|
91
178
|
const newlySelected = this.options.filter((o) => !previous.has(o) && o.selected).map((o) => o.value);
|
|
92
|
-
if (newlySelected.length) {
|
|
179
|
+
if (newlySelected.length && !this._restoredStateActive) {
|
|
93
180
|
this.value = newlySelected[newlySelected.length - 1];
|
|
94
181
|
return; // `value=`'s setter already called reflectSelected()
|
|
95
182
|
}
|
|
96
183
|
}
|
|
97
184
|
this.reflectSelected();
|
|
98
185
|
};
|
|
186
|
+
// Fired by `option.ts`'s `lyra-option-change` (a MutationObserver on the
|
|
187
|
+
// option's own light-DOM content/attributes) when an already-slotted
|
|
188
|
+
// `<lyra-option>` mutates its own data in place -- `collectOptions()` only
|
|
189
|
+
// re-runs on `slotchange`, which never fires for such a mutation, so
|
|
190
|
+
// without this the rendered listbox row would go stale. Reassigning (not
|
|
191
|
+
// mutating) `options` gives Lit a new array reference to diff against.
|
|
192
|
+
this.onOptionChange = () => {
|
|
193
|
+
this.options = [...this.options];
|
|
194
|
+
};
|
|
99
195
|
this.onDocPointer = (e) => {
|
|
100
196
|
if (!e.composedPath().includes(this))
|
|
101
197
|
this.hide();
|
|
102
198
|
};
|
|
103
199
|
this.onTriggerClick = () => {
|
|
104
|
-
if (this.
|
|
200
|
+
if (this.effectiveDisabled)
|
|
105
201
|
return;
|
|
202
|
+
if (this.onlyOption)
|
|
203
|
+
return this.selectOption(this.onlyOption);
|
|
106
204
|
this.open ? this.hide() : this.show();
|
|
107
205
|
};
|
|
108
206
|
this.onTriggerBlur = () => {
|
|
@@ -127,12 +225,16 @@ export class LyraSelect extends LyraElement {
|
|
|
127
225
|
switch (e.key) {
|
|
128
226
|
case 'ArrowDown':
|
|
129
227
|
e.preventDefault();
|
|
228
|
+
if (this.onlyOption)
|
|
229
|
+
return this.selectOption(this.onlyOption);
|
|
130
230
|
if (!this.open)
|
|
131
231
|
return this.show();
|
|
132
232
|
this.activeIndex = Math.min(navigable.length - 1, this.activeIndex + 1);
|
|
133
233
|
break;
|
|
134
234
|
case 'ArrowUp':
|
|
135
235
|
e.preventDefault();
|
|
236
|
+
if (this.onlyOption)
|
|
237
|
+
return this.selectOption(this.onlyOption);
|
|
136
238
|
if (!this.open)
|
|
137
239
|
return this.show();
|
|
138
240
|
this.activeIndex = Math.max(0, this.activeIndex - 1);
|
|
@@ -195,6 +297,27 @@ export class LyraSelect extends LyraElement {
|
|
|
195
297
|
this.selectOption(option);
|
|
196
298
|
};
|
|
197
299
|
this.internals = this.attachInternals();
|
|
300
|
+
this.validityController = new AnchoredValidityController(this, this.internals, () => this[VALIDITY_ANCHOR]());
|
|
301
|
+
this.syncFormValue();
|
|
302
|
+
}
|
|
303
|
+
get form() {
|
|
304
|
+
return this.internals.form;
|
|
305
|
+
}
|
|
306
|
+
get labels() {
|
|
307
|
+
return this.internals.labels;
|
|
308
|
+
}
|
|
309
|
+
get validity() {
|
|
310
|
+
return this.internals.validity;
|
|
311
|
+
}
|
|
312
|
+
get validationMessage() {
|
|
313
|
+
return this.internals.validationMessage;
|
|
314
|
+
}
|
|
315
|
+
get willValidate() {
|
|
316
|
+
return this.internals.willValidate;
|
|
317
|
+
}
|
|
318
|
+
/** @internal */
|
|
319
|
+
[VALIDITY_ANCHOR]() {
|
|
320
|
+
return this.renderRoot?.querySelector('[part="trigger"]') ?? null;
|
|
198
321
|
}
|
|
199
322
|
connectedCallback() {
|
|
200
323
|
super.connectedCallback();
|
|
@@ -212,12 +335,48 @@ export class LyraSelect extends LyraElement {
|
|
|
212
335
|
this.hasLabelSlot = Array.from(this.children).some((el) => el.getAttribute('slot') === 'label');
|
|
213
336
|
}
|
|
214
337
|
}
|
|
338
|
+
get name() {
|
|
339
|
+
return this._name;
|
|
340
|
+
}
|
|
341
|
+
set name(next) {
|
|
342
|
+
const old = this._name;
|
|
343
|
+
this._name = next ?? '';
|
|
344
|
+
if (this._name) {
|
|
345
|
+
this.setAttribute('name', this._name);
|
|
346
|
+
}
|
|
347
|
+
else {
|
|
348
|
+
this.removeAttribute('name');
|
|
349
|
+
}
|
|
350
|
+
this.requestUpdate('name', old);
|
|
351
|
+
}
|
|
352
|
+
get disabled() {
|
|
353
|
+
return this._disabled;
|
|
354
|
+
}
|
|
355
|
+
set disabled(next) {
|
|
356
|
+
const old = this._disabled;
|
|
357
|
+
this._disabled = Boolean(next);
|
|
358
|
+
this.toggleAttribute('disabled', this._disabled);
|
|
359
|
+
if (this._disabled)
|
|
360
|
+
this.hide();
|
|
361
|
+
this.requestUpdate('disabled', old);
|
|
362
|
+
}
|
|
363
|
+
get required() {
|
|
364
|
+
return this._required;
|
|
365
|
+
}
|
|
366
|
+
set required(next) {
|
|
367
|
+
const old = this._required;
|
|
368
|
+
this._required = Boolean(next);
|
|
369
|
+
this.toggleAttribute('required', this._required);
|
|
370
|
+
this.updateValidity();
|
|
371
|
+
this.requestUpdate('required', old);
|
|
372
|
+
}
|
|
215
373
|
/** The selected value: a single string (empty when nothing is selected). */
|
|
216
374
|
get value() {
|
|
217
375
|
return this._selected;
|
|
218
376
|
}
|
|
219
377
|
set value(next) {
|
|
220
378
|
const old = this._selected;
|
|
379
|
+
this._restoredStateActive = false;
|
|
221
380
|
this._selected = next ?? '';
|
|
222
381
|
this.syncFormValue();
|
|
223
382
|
this.reflectSelected();
|
|
@@ -226,20 +385,39 @@ export class LyraSelect extends LyraElement {
|
|
|
226
385
|
}
|
|
227
386
|
updateValidity() {
|
|
228
387
|
if (this.required && !this._selected) {
|
|
229
|
-
this.
|
|
388
|
+
this.validityController.setValidity({ valueMissing: true }, 'Please select an option.');
|
|
230
389
|
}
|
|
231
390
|
else {
|
|
232
|
-
this.
|
|
391
|
+
this.validityController.setValidity({});
|
|
233
392
|
}
|
|
234
393
|
}
|
|
235
394
|
syncFormValue() {
|
|
236
395
|
this.internals.setFormValue(this._selected);
|
|
237
396
|
}
|
|
397
|
+
/** Effective disabled state: this element's own `disabled` OR an ancestor
|
|
398
|
+
* `<fieldset disabled>`'s inherited state -- mirrors native `<input>`, whose
|
|
399
|
+
* own `disabled` IDL property/attribute is never mutated by a fieldset. */
|
|
400
|
+
get effectiveDisabled() {
|
|
401
|
+
return this.disabled || this._fieldsetDisabled;
|
|
402
|
+
}
|
|
238
403
|
formResetCallback() {
|
|
239
404
|
this.value = this._defaultSelected;
|
|
240
405
|
}
|
|
406
|
+
formStateRestoreCallback(state, _mode) {
|
|
407
|
+
this.value = typeof state === 'string' ? state : '';
|
|
408
|
+
this._restoredStateActive = true;
|
|
409
|
+
}
|
|
410
|
+
/**
|
|
411
|
+
* Called by the browser when an ancestor `<fieldset disabled>` toggles.
|
|
412
|
+
* Tracked separately from the consumer's own `disabled` (see
|
|
413
|
+
* `effectiveDisabled`) so a consumer's explicit `disabled` survives the
|
|
414
|
+
* fieldset re-enabling instead of being permanently overwritten.
|
|
415
|
+
*/
|
|
241
416
|
formDisabledCallback(disabled) {
|
|
242
|
-
this.
|
|
417
|
+
this._fieldsetDisabled = disabled;
|
|
418
|
+
if (disabled)
|
|
419
|
+
this.hide();
|
|
420
|
+
this.requestUpdate();
|
|
243
421
|
}
|
|
244
422
|
checkValidity() {
|
|
245
423
|
return this.internals.checkValidity();
|
|
@@ -250,15 +428,41 @@ export class LyraSelect extends LyraElement {
|
|
|
250
428
|
disconnectedCallback() {
|
|
251
429
|
super.disconnectedCallback();
|
|
252
430
|
this.cleanup?.();
|
|
431
|
+
this.cleanup = undefined;
|
|
253
432
|
clearTimeout(this.typeAheadTimer);
|
|
254
433
|
document.removeEventListener('pointerdown', this.onDocPointer);
|
|
434
|
+
// Reset so a reconnect (e.g. a drag-drop reparent) re-triggers
|
|
435
|
+
// `updated()`'s `open`-driven branch -- without this, `open` stays
|
|
436
|
+
// `true` across the disconnect/reconnect and `changed.has('open')` never
|
|
437
|
+
// fires again, leaving the listbox rendered open with no positioning and
|
|
438
|
+
// no outside-click listener.
|
|
439
|
+
this.open = false;
|
|
255
440
|
}
|
|
256
441
|
reflectSelected() {
|
|
257
442
|
for (const o of this.options)
|
|
258
443
|
o.selected = o.value === this._selected;
|
|
259
444
|
}
|
|
445
|
+
/**
|
|
446
|
+
* The sole navigable (non-disabled) option, when `autoCommitSingleOption` is set and
|
|
447
|
+
* there's exactly one. Opening a one-row popup to pick the only available choice is pure
|
|
448
|
+
* friction with no real decision behind it, so an opted-in single-option select skips the
|
|
449
|
+
* popup entirely -- see `onTriggerClick`/`onKeyDown`, which commit this option directly on
|
|
450
|
+
* activation instead of opening the listbox, and `render()`, which drops the popup-trigger
|
|
451
|
+
* ARIA semantics (`role="combobox"`, `aria-haspopup`, `aria-expanded`, the chevron) in favor
|
|
452
|
+
* of a plain button's, since no popup can ever appear while this getter returns a value.
|
|
453
|
+
* Returns `undefined` whenever `autoCommitSingleOption` is `false` (the default), regardless
|
|
454
|
+
* of option count, so the normal combobox trigger renders unconditionally. Does not affect
|
|
455
|
+
* `value`/validity defaults in any way -- an unselected single-option select stays unselected
|
|
456
|
+
* until the trigger is actually activated, exactly like the multi-option case.
|
|
457
|
+
*/
|
|
458
|
+
get onlyOption() {
|
|
459
|
+
if (!this.autoCommitSingleOption)
|
|
460
|
+
return undefined;
|
|
461
|
+
const navigable = this.options.filter((o) => !o.disabled);
|
|
462
|
+
return navigable.length === 1 ? navigable[0] : undefined;
|
|
463
|
+
}
|
|
260
464
|
show() {
|
|
261
|
-
if (this.open || this.
|
|
465
|
+
if (this.open || this.effectiveDisabled)
|
|
262
466
|
return;
|
|
263
467
|
this.open = true;
|
|
264
468
|
}
|
|
@@ -295,19 +499,26 @@ export class LyraSelect extends LyraElement {
|
|
|
295
499
|
this.emit('lyra-hide');
|
|
296
500
|
}
|
|
297
501
|
}
|
|
298
|
-
if (changed.has('required'))
|
|
299
|
-
this.updateValidity();
|
|
300
502
|
if (changed.has('touched') || changed.has('required') || changed.has('value')) {
|
|
301
503
|
this.toggleAttribute('data-invalid', this.touched && !this.internals.validity.valid);
|
|
302
504
|
}
|
|
303
505
|
}
|
|
304
506
|
selectOption(option) {
|
|
305
|
-
if (option.disabled)
|
|
507
|
+
if (this.effectiveDisabled || option.disabled)
|
|
306
508
|
return;
|
|
509
|
+
// Reopening the listbox (or, on a single-option select, simply
|
|
510
|
+
// reactivating the trigger) and landing back on the already-selected
|
|
511
|
+
// row is not a selection change -- `change`/`input` are documented as
|
|
512
|
+
// firing when "the selection changed", so only emit them when the
|
|
513
|
+
// value actually moves, matching a native <select> (which never fires
|
|
514
|
+
// `change` for re-picking the currently-selected <option>).
|
|
515
|
+
const changed = option.value !== this._selected;
|
|
307
516
|
this.value = option.value;
|
|
308
517
|
this.hide();
|
|
309
|
-
|
|
310
|
-
|
|
518
|
+
if (changed) {
|
|
519
|
+
this.emit('input');
|
|
520
|
+
this.emit('change');
|
|
521
|
+
}
|
|
311
522
|
}
|
|
312
523
|
/**
|
|
313
524
|
* Standard listbox type-ahead: moves to the next non-disabled option whose
|
|
@@ -385,6 +596,15 @@ export class LyraSelect extends LyraElement {
|
|
|
385
596
|
const hasHint = this.hasHintSlot || this.hint.length > 0;
|
|
386
597
|
const hasError = this.hasErrorSlot || this.errorText.length > 0;
|
|
387
598
|
const hasLabel = this.hasLabelSlot || this.label.length > 0;
|
|
599
|
+
const describedBy = [hasError ? 'select-error' : '', hasHint ? 'select-hint' : ''].filter(Boolean).join(' ');
|
|
600
|
+
// A single navigable option has no popup to expand into -- when opted in via
|
|
601
|
+
// autoCommitSingleOption, the trigger commits it directly on activation (see
|
|
602
|
+
// onTriggerClick/onKeyDown) instead of opening the listbox, so it's exposed as a plain
|
|
603
|
+
// button rather than a combobox with a permanently-closed popup: no aria-haspopup/
|
|
604
|
+
// aria-expanded/aria-controls/aria-activedescendant (all meaningless without a popup that
|
|
605
|
+
// can ever appear) and no chevron. Without the opt-in (the default), this is always
|
|
606
|
+
// `false` and the normal combobox/listbox/chevron trigger renders regardless of option count.
|
|
607
|
+
const isSingleOption = this.autoCommitSingleOption && navigable.length === 1;
|
|
388
608
|
return html `
|
|
389
609
|
<div part="form-control">
|
|
390
610
|
<label part="form-control-label" for=${this.triggerId} ?hidden=${!hasLabel}>
|
|
@@ -394,15 +614,16 @@ export class LyraSelect extends LyraElement {
|
|
|
394
614
|
id=${this.triggerId}
|
|
395
615
|
part="trigger"
|
|
396
616
|
type="button"
|
|
397
|
-
role
|
|
398
|
-
aria-haspopup
|
|
399
|
-
aria-expanded=${this.open ? 'true' : 'false'}
|
|
400
|
-
aria-controls=${this.listId}
|
|
401
|
-
aria-activedescendant=${activeId}
|
|
402
|
-
aria-label=${this.getAttribute('aria-label') ||
|
|
617
|
+
role=${isSingleOption ? 'button' : 'combobox'}
|
|
618
|
+
aria-haspopup=${isSingleOption ? nothing : 'listbox'}
|
|
619
|
+
aria-expanded=${isSingleOption ? nothing : this.open ? 'true' : 'false'}
|
|
620
|
+
aria-controls=${isSingleOption ? nothing : this.listId}
|
|
621
|
+
aria-activedescendant=${isSingleOption ? nothing : activeId}
|
|
622
|
+
aria-label=${this.getAttribute('aria-label') || (hasLabel ? nothing : this.placeholder || 'Select')}
|
|
623
|
+
aria-describedby=${describedBy || nothing}
|
|
403
624
|
aria-required=${this.required ? 'true' : 'false'}
|
|
404
625
|
aria-invalid=${this.touched && !this.internals.validity.valid ? 'true' : 'false'}
|
|
405
|
-
?disabled=${this.
|
|
626
|
+
?disabled=${this.effectiveDisabled}
|
|
406
627
|
@click=${this.onTriggerClick}
|
|
407
628
|
@keydown=${this.onKeyDown}
|
|
408
629
|
@blur=${this.onTriggerBlur}
|
|
@@ -410,7 +631,7 @@ export class LyraSelect extends LyraElement {
|
|
|
410
631
|
<span class="trigger-label" ?data-placeholder=${!hasValue}
|
|
411
632
|
>${hasValue ? selectedLabel : this.placeholder}</span
|
|
412
633
|
>
|
|
413
|
-
|
|
634
|
+
${isSingleOption ? nothing : html `<span part="expand-icon" aria-hidden="true">${chevronIcon()}</span>`}
|
|
414
635
|
</button>
|
|
415
636
|
<div
|
|
416
637
|
part="listbox"
|
|
@@ -421,29 +642,20 @@ export class LyraSelect extends LyraElement {
|
|
|
421
642
|
>
|
|
422
643
|
${this.renderRows(options, activeId)}
|
|
423
644
|
</div>
|
|
424
|
-
<div part="error" ?hidden=${!hasError}>
|
|
645
|
+
<div id="select-error" part="error" ?hidden=${!hasError}>
|
|
425
646
|
${this.errorText}<slot name="error" @slotchange=${this.onErrorSlotChange}></slot>
|
|
426
647
|
</div>
|
|
427
|
-
<div part="hint" ?hidden=${!hasHint}>
|
|
648
|
+
<div id="select-hint" part="hint" ?hidden=${!hasHint}>
|
|
428
649
|
${this.hint}<slot name="hint" @slotchange=${this.onHintSlotChange}></slot>
|
|
429
650
|
</div>
|
|
430
651
|
</div>
|
|
431
|
-
<slot @slotchange=${this.collectOptions} hidden></slot>
|
|
652
|
+
<slot @slotchange=${this.collectOptions} @lyra-option-change=${this.onOptionChange} hidden></slot>
|
|
432
653
|
`;
|
|
433
654
|
}
|
|
434
655
|
}
|
|
435
656
|
__decorate([
|
|
436
657
|
property()
|
|
437
658
|
], LyraSelect.prototype, "placeholder", void 0);
|
|
438
|
-
__decorate([
|
|
439
|
-
property({ type: Boolean, reflect: true })
|
|
440
|
-
], LyraSelect.prototype, "disabled", void 0);
|
|
441
|
-
__decorate([
|
|
442
|
-
property({ type: Boolean, reflect: true })
|
|
443
|
-
], LyraSelect.prototype, "required", void 0);
|
|
444
|
-
__decorate([
|
|
445
|
-
property()
|
|
446
|
-
], LyraSelect.prototype, "name", void 0);
|
|
447
659
|
__decorate([
|
|
448
660
|
property()
|
|
449
661
|
], LyraSelect.prototype, "label", void 0);
|
|
@@ -459,6 +671,9 @@ __decorate([
|
|
|
459
671
|
__decorate([
|
|
460
672
|
property({ reflect: true })
|
|
461
673
|
], LyraSelect.prototype, "size", void 0);
|
|
674
|
+
__decorate([
|
|
675
|
+
property({ type: Boolean, attribute: 'auto-commit-single-option' })
|
|
676
|
+
], LyraSelect.prototype, "autoCommitSingleOption", void 0);
|
|
462
677
|
__decorate([
|
|
463
678
|
state()
|
|
464
679
|
], LyraSelect.prototype, "activeIndex", void 0);
|
|
@@ -15,6 +15,9 @@ export declare class LyraSkeleton extends LyraElement {
|
|
|
15
15
|
effect: SkeletonEffect;
|
|
16
16
|
width?: string;
|
|
17
17
|
height?: string;
|
|
18
|
+
/** Accessible name announced via `role="status"`. Override with a
|
|
19
|
+
* description of what is actually loading (e.g. "Loading chart"). */
|
|
20
|
+
label: string;
|
|
18
21
|
protected willUpdate(): void;
|
|
19
22
|
protected updated(changed: PropertyValues): void;
|
|
20
23
|
render(): TemplateResult;
|
|
@@ -22,6 +22,9 @@ export class LyraSkeleton extends LyraElement {
|
|
|
22
22
|
super(...arguments);
|
|
23
23
|
this.variant = 'text';
|
|
24
24
|
this.effect = 'pulse';
|
|
25
|
+
/** Accessible name announced via `role="status"`. Override with a
|
|
26
|
+
* description of what is actually loading (e.g. "Loading chart"). */
|
|
27
|
+
this.label = 'Loading…';
|
|
25
28
|
}
|
|
26
29
|
static { this.styles = [LyraElement.styles, styles, srOnly]; }
|
|
27
30
|
willUpdate() {
|
|
@@ -44,7 +47,7 @@ export class LyraSkeleton extends LyraElement {
|
|
|
44
47
|
}
|
|
45
48
|
}
|
|
46
49
|
render() {
|
|
47
|
-
return html `<span part="base"><span class="sr-only"
|
|
50
|
+
return html `<span part="base"><span class="sr-only">${this.label}</span></span>`;
|
|
48
51
|
}
|
|
49
52
|
}
|
|
50
53
|
__decorate([
|
|
@@ -59,4 +62,7 @@ __decorate([
|
|
|
59
62
|
__decorate([
|
|
60
63
|
property()
|
|
61
64
|
], LyraSkeleton.prototype, "height", void 0);
|
|
65
|
+
__decorate([
|
|
66
|
+
property()
|
|
67
|
+
], LyraSkeleton.prototype, "label", void 0);
|
|
62
68
|
defineElement('skeleton', LyraSkeleton);
|
|
@@ -10,15 +10,13 @@ export const styles = css `
|
|
|
10
10
|
block-size: 100%;
|
|
11
11
|
background: var(--lyra-color-border);
|
|
12
12
|
}
|
|
13
|
-
:host([variant='text']) [part='base']
|
|
13
|
+
:host([variant='text']) [part='base'],
|
|
14
|
+
:host([variant='rect']) [part='base'] {
|
|
14
15
|
border-radius: var(--lyra-radius);
|
|
15
16
|
}
|
|
16
17
|
:host([variant='circle']) [part='base'] {
|
|
17
18
|
border-radius: 50%;
|
|
18
19
|
}
|
|
19
|
-
:host([variant='rect']) [part='base'] {
|
|
20
|
-
border-radius: var(--lyra-radius);
|
|
21
|
-
}
|
|
22
20
|
:host([effect='pulse']) [part='base'] {
|
|
23
21
|
animation: lyra-skeleton-pulse 1.5s ease-in-out infinite;
|
|
24
22
|
}
|
|
@@ -53,5 +51,8 @@ export const styles = css `
|
|
|
53
51
|
[part='base'] {
|
|
54
52
|
animation: none !important;
|
|
55
53
|
}
|
|
54
|
+
:host([effect='sheen']) [part='base'] {
|
|
55
|
+
background-image: none;
|
|
56
|
+
}
|
|
56
57
|
}
|
|
57
58
|
`;
|