@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
|
@@ -16,7 +16,31 @@ import '../empty/empty.js';
|
|
|
16
16
|
* actions-column button). Clicks/keydowns landing on one of these — or
|
|
17
17
|
* bubbling up through one — must not be re-interpreted as row/column
|
|
18
18
|
* activation by the table's own delegated listeners. */
|
|
19
|
-
const INTERACTIVE_SELECTOR = 'button, a[href], input, select, textarea, [role="button"]';
|
|
19
|
+
const INTERACTIVE_SELECTOR = 'button, a[href], input, select, textarea, summary, audio[controls], video[controls], [contenteditable]:not([contenteditable="false"]), [tabindex]:not([tabindex="-1"]), [role="button"], [role="checkbox"], [role="combobox"], [role="listbox"], [role="menu"], [role="menuitem"], [role="option"], [role="radio"], [role="slider"], [role="spinbutton"], [role="switch"], [role="tab"], [role="textbox"]';
|
|
20
|
+
/** Encodes a row/column identity key for use as a Map key or a DOM
|
|
21
|
+
* `data-row-key` attribute value, preserving the distinction between a
|
|
22
|
+
* numeric key and a string key that happen to stringify the same way
|
|
23
|
+
* (`1` vs `"1"`) -- a bare `String(key)` would silently collide the two. */
|
|
24
|
+
function encodeKey(key) {
|
|
25
|
+
return `${typeof key}:${key}`;
|
|
26
|
+
}
|
|
27
|
+
/** Whether `target` (or an ancestor up to the delegated listener's own
|
|
28
|
+
* `<table>`, exclusive) is a custom element — i.e. any tag containing a
|
|
29
|
+
* hyphen, the one universal rule every custom element name must follow —
|
|
30
|
+
* which is never itself matched by INTERACTIVE_SELECTOR's plain-HTML
|
|
31
|
+
* selector list but should still own its own clicks/keydowns (e.g. a
|
|
32
|
+
* `<lyra-select>`/`<lyra-combobox>` rendered by a `cell()` template)
|
|
33
|
+
* instead of being re-interpreted as row/column activation. */
|
|
34
|
+
function closestInteractive(target, boundary) {
|
|
35
|
+
let el = target;
|
|
36
|
+
while (el && el !== boundary) {
|
|
37
|
+
if ((el.matches(INTERACTIVE_SELECTOR) && !el.matches('[data-row-key], th[data-col-key]')) ||
|
|
38
|
+
el.tagName.includes('-'))
|
|
39
|
+
return el;
|
|
40
|
+
el = el.parentElement;
|
|
41
|
+
}
|
|
42
|
+
return null;
|
|
43
|
+
}
|
|
20
44
|
/**
|
|
21
45
|
* `<lyra-table>` — a presentational, sort/select-aware data table.
|
|
22
46
|
*
|
|
@@ -37,17 +61,37 @@ const INTERACTIVE_SELECTOR = 'button, a[href], input, select, textarea, [role="b
|
|
|
37
61
|
* Enter/Space still only sort/activate (see `activateColumn()` /
|
|
38
62
|
* `activateRow()`).
|
|
39
63
|
*
|
|
64
|
+
* Set `aria-label` on the host to give the `role="grid"` element an
|
|
65
|
+
* accessible name; it's forwarded into the shadow DOM's `<table>`.
|
|
66
|
+
*
|
|
40
67
|
* `columns[].priority` ('medium' | 'low') hides that column under
|
|
41
68
|
* `[part='base']`'s `@container` breakpoints; `[part='reveal-columns-button']`
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
69
|
+
* forces them all back into view. Rather than a *static* check of whether any
|
|
70
|
+
* column merely declares a `priority`, the button (and the public
|
|
71
|
+
* `columnsHidden` property, see below) reflects whether a `priority` column
|
|
72
|
+
* is *actually* hidden right now — measured via `ResizeObserver` on
|
|
73
|
+
* `[part='base']` plus a post-render DOM check — or `showAllColumns`
|
|
74
|
+
* force-visible mode is currently active (so there's still a way to toggle
|
|
75
|
+
* it back off). `columns[].sticky` pins a column's header/cells to the
|
|
76
|
+
* inline-start edge while the table scrolls horizontally.
|
|
45
77
|
*
|
|
46
78
|
* @customElement lyra-table
|
|
47
79
|
* @event lyra-sort - A sortable header was activated. `detail: { key }`.
|
|
48
80
|
* @event lyra-row-click - A row was activated. `detail: { row }`.
|
|
49
81
|
* @event lyra-load-more - The "load more" control was activated.
|
|
50
|
-
* @
|
|
82
|
+
* @event lyra-columns-hidden-change - `columnsHidden` actually changed value
|
|
83
|
+
* (a `priority` column just became hidden/un-hidden by the `@container`
|
|
84
|
+
* rules, or `showAllColumns` force-visible mode was toggled while a
|
|
85
|
+
* `priority` column was hidden). `detail: { hidden: boolean }`.
|
|
86
|
+
* @csspart base - The root wrapper around the `<table>` and its footer controls.
|
|
87
|
+
* @csspart table - The `<table role="grid">` element.
|
|
88
|
+
* @csspart head - The `<thead>` element.
|
|
89
|
+
* @csspart header-cell - Each `<th>` header cell.
|
|
90
|
+
* @csspart row - Each body `<tr>`.
|
|
91
|
+
* @csspart cell - Each body `<td>`.
|
|
92
|
+
* @csspart more-button - The "load more" control, shown when `hasMore` is true.
|
|
93
|
+
* @csspart sort-icon - The chevron shown in the active sortable column's header cell.
|
|
94
|
+
* @csspart reveal-columns-button - The button that toggles `priority`-hidden columns back into view.
|
|
51
95
|
*/
|
|
52
96
|
export class LyraTable extends LyraElement {
|
|
53
97
|
constructor() {
|
|
@@ -65,6 +109,16 @@ export class LyraTable extends LyraElement {
|
|
|
65
109
|
this.noColumnsDescription = '';
|
|
66
110
|
this.revealColumnsLabel = 'Show all columns';
|
|
67
111
|
this.hideColumnsLabel = 'Show fewer columns';
|
|
112
|
+
/** Whether a `priority` column is *actually* hidden right now by
|
|
113
|
+
* table.styles.ts's `@container` rules, or `showAllColumns` force-visible
|
|
114
|
+
* mode is currently active — the same computed value that gates whether
|
|
115
|
+
* `[part='reveal-columns-button']` renders at all (see `render()`), kept
|
|
116
|
+
* in sync by `recomputeColumnsHidden()`. Computed/read-only by
|
|
117
|
+
* convention: consumers may read it (and listen for
|
|
118
|
+
* `lyra-columns-hidden-change`), but setting it directly has no lasting
|
|
119
|
+
* effect, since it's recomputed on the very next render or
|
|
120
|
+
* `[part='base']` resize. */
|
|
121
|
+
this.columnsHidden = false;
|
|
68
122
|
/** Forces `priority`-hidden columns back into view, overriding the
|
|
69
123
|
* `@container` hide rules in table.styles.ts. Toggled by
|
|
70
124
|
* `[part='reveal-columns-button']`. */
|
|
@@ -79,17 +133,24 @@ export class LyraTable extends LyraElement {
|
|
|
79
133
|
this.activeRowKey = null;
|
|
80
134
|
this.rowsByKey = new Map();
|
|
81
135
|
this.columnsByKey = new Map();
|
|
136
|
+
this.observedHeaders = new Set();
|
|
82
137
|
this.toggleColumns = () => {
|
|
83
138
|
this.showAllColumns = !this.showAllColumns;
|
|
84
139
|
};
|
|
85
140
|
this.onTableClick = (e) => {
|
|
86
141
|
const target = e.target;
|
|
87
|
-
|
|
88
|
-
//
|
|
89
|
-
//
|
|
90
|
-
|
|
142
|
+
const table = e.currentTarget;
|
|
143
|
+
// A cell()-rendered button/link/input/custom-element etc. owns its own
|
|
144
|
+
// click — don't let the delegated row/column resolution below
|
|
145
|
+
// re-interpret it as row or header activation.
|
|
146
|
+
if (closestInteractive(target, table))
|
|
91
147
|
return;
|
|
92
|
-
|
|
148
|
+
// Scoped to `th` — body `<td>`s also carry `data-col-key` now (for the
|
|
149
|
+
// sticky-offset measurement pass), so an unscoped `[data-col-key]` would
|
|
150
|
+
// match the clicked cell itself and misroute a plain cell click to
|
|
151
|
+
// column-sort activation instead of falling through to the row check
|
|
152
|
+
// below.
|
|
153
|
+
const th = target.closest('th[data-col-key]');
|
|
93
154
|
if (th)
|
|
94
155
|
return this.activateColumn(th.dataset.colKey);
|
|
95
156
|
const tr = target.closest('[data-row-key]');
|
|
@@ -98,12 +159,14 @@ export class LyraTable extends LyraElement {
|
|
|
98
159
|
};
|
|
99
160
|
this.onTableKeyDown = (e) => {
|
|
100
161
|
const target = e.target;
|
|
162
|
+
const table = e.currentTarget;
|
|
101
163
|
// Same guard as onTableClick — also skips the table's own
|
|
102
164
|
// preventDefault(), so a focused nested control keeps its native/own
|
|
103
165
|
// Enter or Space activation instead of having it swallowed.
|
|
104
|
-
if (target
|
|
166
|
+
if (closestInteractive(target, table))
|
|
105
167
|
return;
|
|
106
|
-
|
|
168
|
+
// Same th-scoping rationale as onTableClick above.
|
|
169
|
+
const th = target.closest('th[data-col-key]');
|
|
107
170
|
if (th)
|
|
108
171
|
return this.onHeaderKeyDown(e, th);
|
|
109
172
|
const tr = target.closest('[data-row-key]');
|
|
@@ -112,15 +175,92 @@ export class LyraTable extends LyraElement {
|
|
|
112
175
|
};
|
|
113
176
|
}
|
|
114
177
|
static { this.styles = [LyraElement.styles, styles]; }
|
|
178
|
+
connectedCallback() {
|
|
179
|
+
super.connectedCallback();
|
|
180
|
+
this.resizeObserver = new ResizeObserver(() => {
|
|
181
|
+
this.recomputeColumnsHidden();
|
|
182
|
+
this.applyStickyOffsets();
|
|
183
|
+
});
|
|
184
|
+
// A reconnect re-creates the observer above but the shadow root content
|
|
185
|
+
// survives across disconnect/reconnect (Lit doesn't tear down the shadow
|
|
186
|
+
// root) — re-observe [part='base'] here if it already exists from before
|
|
187
|
+
// the disconnect. On the very first mount connectedCallback() fires
|
|
188
|
+
// *before* Lit's first render, so [part='base'] doesn't exist yet and
|
|
189
|
+
// this is a no-op; updated() below (which always runs after render, first
|
|
190
|
+
// paint included) covers that case instead.
|
|
191
|
+
const base = this.renderRoot?.querySelector('[part="base"]');
|
|
192
|
+
if (base)
|
|
193
|
+
this.observeBase(base);
|
|
194
|
+
}
|
|
195
|
+
disconnectedCallback() {
|
|
196
|
+
super.disconnectedCallback();
|
|
197
|
+
this.resizeObserver?.disconnect();
|
|
198
|
+
this.observedBase = undefined;
|
|
199
|
+
this.observedHeaders.clear();
|
|
200
|
+
}
|
|
201
|
+
observeBase(base) {
|
|
202
|
+
if (this.observedBase === base)
|
|
203
|
+
return;
|
|
204
|
+
if (this.observedBase)
|
|
205
|
+
this.resizeObserver?.unobserve(this.observedBase);
|
|
206
|
+
this.resizeObserver?.observe(base);
|
|
207
|
+
this.observedBase = base;
|
|
208
|
+
}
|
|
209
|
+
observeHeaders() {
|
|
210
|
+
const headers = new Set(this.columns.some((column) => column.sticky)
|
|
211
|
+
? this.renderRoot.querySelectorAll('th[data-col-key]')
|
|
212
|
+
: []);
|
|
213
|
+
for (const header of this.observedHeaders) {
|
|
214
|
+
if (!headers.has(header)) {
|
|
215
|
+
this.resizeObserver?.unobserve(header);
|
|
216
|
+
this.observedHeaders.delete(header);
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
for (const header of headers) {
|
|
220
|
+
if (!this.observedHeaders.has(header)) {
|
|
221
|
+
this.observedHeaders.add(header);
|
|
222
|
+
this.resizeObserver?.observe(header);
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
/** Recomputes `columnsHidden` from the live DOM (mirrors `visibleHeaders()`'s
|
|
227
|
+
* own `offsetParent !== null` technique for detecting `@container`-hidden
|
|
228
|
+
* cells) and dispatches `lyra-columns-hidden-change` only on a real
|
|
229
|
+
* transition. Called from `updated()` (covers a change driven by
|
|
230
|
+
* `columns`/`rows`/`showAllColumns` rather than a container resize) and
|
|
231
|
+
* from the `ResizeObserver` callback (covers a container resize with no
|
|
232
|
+
* Lit-tracked property change at all). */
|
|
233
|
+
recomputeColumnsHidden() {
|
|
234
|
+
const hasPriorityColumns = this.columns.some((col) => col.priority);
|
|
235
|
+
const anyPriorityHidden = hasPriorityColumns &&
|
|
236
|
+
[...this.renderRoot.querySelectorAll('th[data-priority]')].some((el) => el.offsetParent === null);
|
|
237
|
+
const next = anyPriorityHidden || (hasPriorityColumns && this.showAllColumns);
|
|
238
|
+
this.rehomeFocusedColumn();
|
|
239
|
+
if (this.columnsHidden === next)
|
|
240
|
+
return;
|
|
241
|
+
this.columnsHidden = next;
|
|
242
|
+
this.emit('lyra-columns-hidden-change', { hidden: next });
|
|
243
|
+
}
|
|
244
|
+
rehomeFocusedColumn() {
|
|
245
|
+
const visible = this.visibleHeaders();
|
|
246
|
+
if (visible.length === 0 || this.activeColKey === null)
|
|
247
|
+
return;
|
|
248
|
+
if (!visible.some((header) => header.dataset.colKey === this.activeColKey)) {
|
|
249
|
+
this.activeColKey = visible[0].dataset.colKey ?? null;
|
|
250
|
+
}
|
|
251
|
+
}
|
|
115
252
|
keyOf(row, index) {
|
|
116
253
|
return this.rowKey ? this.rowKey(row) : index;
|
|
117
254
|
}
|
|
118
255
|
/** The header cell that currently owns `tabindex="0"`. */
|
|
119
256
|
focusedColKey() {
|
|
257
|
+
const visible = this.visibleHeaders();
|
|
258
|
+
const visibleKeys = new Set(visible.map((el) => el.dataset.colKey).filter((key) => key !== undefined && this.columnsByKey.has(key)));
|
|
120
259
|
if (this.activeColKey !== null && this.columnsByKey.has(this.activeColKey)) {
|
|
121
|
-
|
|
260
|
+
if (visibleKeys.size === 0 || visibleKeys.has(this.activeColKey))
|
|
261
|
+
return this.activeColKey;
|
|
122
262
|
}
|
|
123
|
-
return this.columns[0]?.key ?? null;
|
|
263
|
+
return visible.find((el) => el.dataset.colKey !== undefined && this.columnsByKey.has(el.dataset.colKey))?.dataset.colKey ?? this.columns[0]?.key ?? null;
|
|
124
264
|
}
|
|
125
265
|
/** The body row that currently owns `tabindex="0"`. */
|
|
126
266
|
focusedRowKey() {
|
|
@@ -128,20 +268,85 @@ export class LyraTable extends LyraElement {
|
|
|
128
268
|
return this.activeRowKey;
|
|
129
269
|
}
|
|
130
270
|
if (this.selectedKey !== null) {
|
|
131
|
-
const selected =
|
|
271
|
+
const selected = encodeKey(this.selectedKey);
|
|
132
272
|
if (this.rowsByKey.has(selected))
|
|
133
273
|
return selected;
|
|
134
274
|
}
|
|
135
|
-
return this.rows.length > 0 ?
|
|
275
|
+
return this.rows.length > 0 ? encodeKey(this.keyOf(this.rows[0], 0)) : null;
|
|
136
276
|
}
|
|
137
277
|
willUpdate(changed) {
|
|
138
278
|
if (changed.has('rows') || changed.has('rowKey')) {
|
|
139
|
-
this.rowsByKey = new Map(this.rows.map((row, i) => [
|
|
279
|
+
this.rowsByKey = new Map(this.rows.map((row, i) => [encodeKey(this.keyOf(row, i)), row]));
|
|
140
280
|
}
|
|
141
281
|
if (changed.has('columns')) {
|
|
142
282
|
this.columnsByKey = new Map(this.columns.map((c) => [c.key, c]));
|
|
143
283
|
}
|
|
144
284
|
}
|
|
285
|
+
/** Each sticky column's cumulative inline-start offset — the sum of the *rendered
|
|
286
|
+
* width* of every earlier sticky column — so multiple sticky columns
|
|
287
|
+
* stack left-to-right instead of all pinning to inset-inline-start: 0 and
|
|
288
|
+
* overlapping. Table columns are intrinsically sized (not fixed-width), so
|
|
289
|
+
* this can't be computed in CSS alone; it requires measuring the actual
|
|
290
|
+
* laid-out `offsetWidth` of each earlier sticky column's header cell. */
|
|
291
|
+
stickyOffsets() {
|
|
292
|
+
const offsets = new Map();
|
|
293
|
+
let running = 0;
|
|
294
|
+
for (const col of this.columns) {
|
|
295
|
+
if (!col.sticky)
|
|
296
|
+
continue;
|
|
297
|
+
const headerEl = [...this.renderRoot.querySelectorAll('th[data-col-key]')].find((el) => el.dataset.colKey === col.key);
|
|
298
|
+
offsets.set(col.key, running);
|
|
299
|
+
running += headerEl?.offsetWidth ?? 0;
|
|
300
|
+
}
|
|
301
|
+
return offsets;
|
|
302
|
+
}
|
|
303
|
+
applyStickyOffsets() {
|
|
304
|
+
if (!this.columns.some((c) => c.sticky))
|
|
305
|
+
return;
|
|
306
|
+
const offsets = this.stickyOffsets();
|
|
307
|
+
this.renderRoot.querySelectorAll('[data-col-key]').forEach((el) => {
|
|
308
|
+
const key = el.dataset.colKey;
|
|
309
|
+
if (key !== undefined && offsets.has(key)) {
|
|
310
|
+
el.style.setProperty('--lyra-table-sticky-offset', `${offsets.get(key)}px`);
|
|
311
|
+
}
|
|
312
|
+
});
|
|
313
|
+
}
|
|
314
|
+
/** Applies stickyOffsets()'s measured per-column offsets as an inline
|
|
315
|
+
* `--lyra-table-sticky-offset` custom property on every header cell and
|
|
316
|
+
* body cell in that column (addressed by the shared `data-col-key`
|
|
317
|
+
* attribute). This is a post-render DOM measurement — column widths
|
|
318
|
+
* aren't known until after the browser has laid out this update's
|
|
319
|
+
* render() output — so it runs from `updated()`, not `willUpdate()`,
|
|
320
|
+
* intentionally kept as a separate pass from the rowsByKey/columnsByKey
|
|
321
|
+
* rebuild above: those two must stay in `willUpdate()` so `render()`'s
|
|
322
|
+
* own `focusedRowKey()` call sees the current update's identity maps
|
|
323
|
+
* (e.g. a freshly-assigned `selectedKey` resolving to the correct
|
|
324
|
+
* roving-tabindex row on the very first paint), whereas the sticky-offset
|
|
325
|
+
* measurement can only run after that same paint has happened. Only runs
|
|
326
|
+
* when `hasSticky` is true (opt-in) and simply recomputes on every
|
|
327
|
+
* update; a future optimization pass could cache column widths instead of
|
|
328
|
+
* re-querying every time — out of scope for this correctness fix. */
|
|
329
|
+
updated(changed) {
|
|
330
|
+
if (changed.has('columns') || changed.has('rows') || changed.has('rowKey'))
|
|
331
|
+
this.applyStickyOffsets();
|
|
332
|
+
// Re-observe [part='base'] whenever this update's render() produced a
|
|
333
|
+
// fresh one (first mount, or a swap to/from the <lyra-empty> template
|
|
334
|
+
// shape) — observeBase() itself no-ops when it's the same element as
|
|
335
|
+
// already observed.
|
|
336
|
+
const base = this.renderRoot.querySelector('[part="base"]');
|
|
337
|
+
if (base)
|
|
338
|
+
this.observeBase(base);
|
|
339
|
+
this.observeHeaders();
|
|
340
|
+
// Deferred to a microtask rather than called synchronously here: a real
|
|
341
|
+
// priority-hidden transition mutates the reactive `columnsHidden`
|
|
342
|
+
// property, and doing that from inside this same updated() call stack
|
|
343
|
+
// schedules a second update from within the first update's own lifecycle
|
|
344
|
+
// callback -- Lit's dev-mode "scheduled an update ... after an update
|
|
345
|
+
// completed" warning. Pushing the write out to a microtask lets this
|
|
346
|
+
// update finish first, so the follow-up update is a normal externally
|
|
347
|
+
// triggered one instead.
|
|
348
|
+
queueMicrotask(() => this.recomputeColumnsHidden());
|
|
349
|
+
}
|
|
145
350
|
activateColumn(key) {
|
|
146
351
|
this.activeColKey = key;
|
|
147
352
|
const col = this.columnsByKey.get(key);
|
|
@@ -157,9 +362,11 @@ export class LyraTable extends LyraElement {
|
|
|
157
362
|
/** Header cells currently in the tab sequence — excludes columns hidden by
|
|
158
363
|
* a `priority`-driven `@container` rule (table.styles.ts), so Left/Right/
|
|
159
364
|
* Home/End never strand the roving tab stop on a `display: none` cell
|
|
160
|
-
* that `.focus()` would silently no-op on.
|
|
365
|
+
* that `.focus()` would silently no-op on. Scoped to `th` — body `<td>`s
|
|
366
|
+
* now carry the same `data-col-key` attribute (for the sticky-offset
|
|
367
|
+
* measurement pass) but must never be treated as header cells here. */
|
|
161
368
|
visibleHeaders() {
|
|
162
|
-
return [...this.renderRoot.querySelectorAll('[data-col-key]')].filter((el) => el.offsetParent !== null);
|
|
369
|
+
return [...this.renderRoot.querySelectorAll('th[data-col-key]')].filter((el) => el.offsetParent !== null);
|
|
163
370
|
}
|
|
164
371
|
focusHeader(el) {
|
|
165
372
|
if (!el?.dataset.colKey)
|
|
@@ -183,14 +390,15 @@ export class LyraTable extends LyraElement {
|
|
|
183
390
|
const index = headers.indexOf(th);
|
|
184
391
|
if (index < 0)
|
|
185
392
|
return;
|
|
393
|
+
const rtl = getComputedStyle(this).direction === 'rtl';
|
|
186
394
|
switch (e.key) {
|
|
187
395
|
case 'ArrowLeft':
|
|
188
396
|
e.preventDefault();
|
|
189
|
-
this.focusHeader(headers[Math.max(0, index - 1)]);
|
|
397
|
+
this.focusHeader(headers[rtl ? Math.min(headers.length - 1, index + 1) : Math.max(0, index - 1)]);
|
|
190
398
|
return;
|
|
191
399
|
case 'ArrowRight':
|
|
192
400
|
e.preventDefault();
|
|
193
|
-
this.focusHeader(headers[Math.min(headers.length - 1, index + 1)]);
|
|
401
|
+
this.focusHeader(headers[rtl ? Math.max(0, index - 1) : Math.min(headers.length - 1, index + 1)]);
|
|
194
402
|
return;
|
|
195
403
|
case 'Home':
|
|
196
404
|
e.preventDefault();
|
|
@@ -262,12 +470,17 @@ export class LyraTable extends LyraElement {
|
|
|
262
470
|
description=${this.emptyDescription}
|
|
263
471
|
></lyra-empty>`;
|
|
264
472
|
}
|
|
265
|
-
const hasPriorityColumns = this.columns.some((col) => col.priority);
|
|
266
473
|
const focusedCol = this.focusedColKey();
|
|
267
474
|
const focusedRow = this.focusedRowKey();
|
|
268
475
|
return html `
|
|
269
476
|
<div part="base" ?data-force-visible=${this.showAllColumns}>
|
|
270
|
-
<table
|
|
477
|
+
<table
|
|
478
|
+
part="table"
|
|
479
|
+
role="grid"
|
|
480
|
+
aria-label=${this.getAttribute('aria-label') || nothing}
|
|
481
|
+
@click=${this.onTableClick}
|
|
482
|
+
@keydown=${this.onTableKeyDown}
|
|
483
|
+
>
|
|
271
484
|
<thead part="head">
|
|
272
485
|
<tr role="row">
|
|
273
486
|
${this.columns.map((col) => {
|
|
@@ -302,13 +515,14 @@ export class LyraTable extends LyraElement {
|
|
|
302
515
|
return html `<tr
|
|
303
516
|
part="row"
|
|
304
517
|
role="row"
|
|
305
|
-
data-row-key=${
|
|
518
|
+
data-row-key=${encodeKey(key)}
|
|
306
519
|
aria-selected=${selected ? 'true' : 'false'}
|
|
307
|
-
tabindex=${
|
|
520
|
+
tabindex=${encodeKey(key) === focusedRow ? '0' : '-1'}
|
|
308
521
|
>
|
|
309
522
|
${this.columns.map((col) => html `<td
|
|
310
523
|
part="cell"
|
|
311
524
|
role="gridcell"
|
|
525
|
+
data-col-key=${col.key}
|
|
312
526
|
data-align=${col.align ?? 'start'}
|
|
313
527
|
data-priority=${col.priority ?? nothing}
|
|
314
528
|
?data-sticky=${col.sticky}
|
|
@@ -319,7 +533,7 @@ export class LyraTable extends LyraElement {
|
|
|
319
533
|
})}
|
|
320
534
|
</tbody>
|
|
321
535
|
</table>
|
|
322
|
-
${
|
|
536
|
+
${this.columnsHidden
|
|
323
537
|
? html `<button
|
|
324
538
|
part="reveal-columns-button"
|
|
325
539
|
type="button"
|
|
@@ -384,6 +598,9 @@ __decorate([
|
|
|
384
598
|
__decorate([
|
|
385
599
|
property({ attribute: 'hide-columns-label' })
|
|
386
600
|
], LyraTable.prototype, "hideColumnsLabel", void 0);
|
|
601
|
+
__decorate([
|
|
602
|
+
property({ type: Boolean, attribute: 'columns-hidden', reflect: true })
|
|
603
|
+
], LyraTable.prototype, "columnsHidden", void 0);
|
|
387
604
|
__decorate([
|
|
388
605
|
state()
|
|
389
606
|
], LyraTable.prototype, "showAllColumns", void 0);
|
|
@@ -115,7 +115,12 @@ export const styles = css `
|
|
|
115
115
|
[part='header-cell'][data-sticky],
|
|
116
116
|
[part='cell'][data-sticky] {
|
|
117
117
|
position: sticky;
|
|
118
|
-
|
|
118
|
+
/* Set per-column by table.ts's stickyOffsets()/updated(), which measures
|
|
119
|
+
each earlier sticky column's rendered width so multiple sticky columns
|
|
120
|
+
stack left-to-right instead of all pinning to the same edge and
|
|
121
|
+
overlapping. Falls back to 0 for the first sticky column (or before
|
|
122
|
+
the first measurement pass has run). */
|
|
123
|
+
inset-inline-start: var(--lyra-table-sticky-offset, 0);
|
|
119
124
|
z-index: 1;
|
|
120
125
|
background: var(--lyra-color-surface);
|
|
121
126
|
box-shadow: 1px 0 0 0 var(--lyra-color-border);
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { type TemplateResult, type PropertyValues } from 'lit';
|
|
2
|
+
import { LyraElement } from '../../internal/lyra-element.js';
|
|
3
|
+
/**
|
|
4
|
+
* `<lyra-tabs>` — a tab strip whose panels are direct light-DOM children,
|
|
5
|
+
* each carrying `slot="<id>"` (the panel's stable id) and `label="<text>"`
|
|
6
|
+
* (the tab button's text). One named `<slot>` is rendered per distinct
|
|
7
|
+
* `slot` name found among the current children — a child with no `label`,
|
|
8
|
+
* or a name with no matching child, simply never produces a tab.
|
|
9
|
+
*
|
|
10
|
+
* A tab button's *visible* content can carry a leading icon without ever
|
|
11
|
+
* changing its *accessible name* (which always stays exactly `label`'s
|
|
12
|
+
* text, nothing else): give a tab an extra direct-child sibling of
|
|
13
|
+
* `<lyra-tabs>` carrying `slot="<id>-icon"` (that sibling's own content --
|
|
14
|
+
* an inline SVG, an emoji span, a custom icon element, anything -- is
|
|
15
|
+
* entirely up to the consumer). It's rendered ahead of the label inside
|
|
16
|
+
* that tab's button, wrapped in an `aria-hidden="true"` part so it's
|
|
17
|
+
* excluded from accessible-name computation no matter what it contains. A
|
|
18
|
+
* tab with no matching `<id>-icon` sibling renders no icon wrapper at all,
|
|
19
|
+
* so existing text-only tabs are completely unaffected. (A named slot,
|
|
20
|
+
* rather than a second attribute holding an icon-name lookup, was chosen
|
|
21
|
+
* because this library's `internal/icons.ts` is a small closed set of
|
|
22
|
+
* chrome glyphs for this library's *own* components, not a public
|
|
23
|
+
* name-keyed registry -- a slot lets a consumer supply an arbitrary,
|
|
24
|
+
* domain-specific icon instead of being limited to that internal set.)
|
|
25
|
+
*
|
|
26
|
+
* Implements the WAI-ARIA APG tabs pattern with automatic activation:
|
|
27
|
+
* Left/Right (swapped under RTL) move focus *and* selection together,
|
|
28
|
+
* Home/End jump to the first/last enabled tab, and a roving `tabindex`
|
|
29
|
+
* follows whichever tab is currently selected.
|
|
30
|
+
*
|
|
31
|
+
* @customElement lyra-tabs
|
|
32
|
+
* @slot - Direct children with `slot="<id>" label="<text>"` (and optionally `disabled`); one becomes each tab's panel.
|
|
33
|
+
* @slot <id>-icon - Optional sibling direct child supplying a tab's leading icon content; excluded from the tab button's accessible name.
|
|
34
|
+
* @event lyra-tabs-change - `detail: { tabId }`, fired when the active tab changes via click or keyboard.
|
|
35
|
+
* @csspart base - The root wrapper around the tablist and panels.
|
|
36
|
+
* @csspart tablist - The `role="tablist"` row of tab buttons.
|
|
37
|
+
* @csspart tab - A single tab button.
|
|
38
|
+
* @csspart tab-icon - The optional leading-icon wrapper inside a tab button; only rendered when that tab has a matching `<id>-icon` sibling.
|
|
39
|
+
* @csspart panel - A single `role="tabpanel"` wrapper (one per tab, hidden unless active).
|
|
40
|
+
*/
|
|
41
|
+
export declare class LyraTabs extends LyraElement {
|
|
42
|
+
static styles: import("lit").CSSResultGroup[];
|
|
43
|
+
/** The active tab's `slot`/id. Falls back to the first enabled tab whenever the current value doesn't resolve to one. */
|
|
44
|
+
active: string;
|
|
45
|
+
private tabs;
|
|
46
|
+
private baseId;
|
|
47
|
+
private nextOpaqueId;
|
|
48
|
+
private readonly idsBySlot;
|
|
49
|
+
private mutationObserver?;
|
|
50
|
+
connectedCallback(): void;
|
|
51
|
+
disconnectedCallback(): void;
|
|
52
|
+
/** Rebuilds `tabs` from the current direct children. First child wins when two share a `slot` name (matches native slot assignment: both would render into the one panel, but only one label can back the button). */
|
|
53
|
+
private syncTabs;
|
|
54
|
+
/** Keeps `active` resolved to a real, enabled tab -- covers the initial default, a tab disappearing/becoming disabled underneath the current selection, and a consumer assigning `.active` directly. Silent (no `lyra-tabs-change`): this corrects *invalid* state rather than responding to a user picking a different tab. */
|
|
55
|
+
protected willUpdate(changed: PropertyValues): void;
|
|
56
|
+
/** Activates `tab` (no-op for a disabled tab or one that's already active) and emits `lyra-tabs-change`. */
|
|
57
|
+
private selectTab;
|
|
58
|
+
/** Moves real DOM focus to tab `slotName`'s button. Safe to call immediately (no `updateComplete` wait): every tab button already exists in the DOM regardless of its current `tabindex`, and `tabindex="-1"` elements are still focusable via script. */
|
|
59
|
+
private focusTab;
|
|
60
|
+
private onTabListKeyDown;
|
|
61
|
+
private tabId;
|
|
62
|
+
private panelId;
|
|
63
|
+
private idsFor;
|
|
64
|
+
/** Derives a tab's optional icon-sibling `slot` name from its own `slotName` -- see the class doc. */
|
|
65
|
+
private iconSlotName;
|
|
66
|
+
private renderTab;
|
|
67
|
+
private renderPanel;
|
|
68
|
+
render(): TemplateResult;
|
|
69
|
+
}
|
|
70
|
+
declare global {
|
|
71
|
+
interface HTMLElementTagNameMap {
|
|
72
|
+
'lyra-tabs': LyraTabs;
|
|
73
|
+
}
|
|
74
|
+
}
|