@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
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
import { css } from 'lit';
|
|
2
|
+
export const styles = css `
|
|
3
|
+
:host {
|
|
4
|
+
display: block;
|
|
5
|
+
/* Component-specific -- no shared --wa-*/--lyra-* "conversation bubble
|
|
6
|
+
width" token exists to resolve through, same rationale as
|
|
7
|
+
--lyra-json-viewer-max-height in json-viewer.styles.ts. */
|
|
8
|
+
--lyra-chat-message-max-width: 80%;
|
|
9
|
+
font-size: 0.875rem;
|
|
10
|
+
line-height: 1.5;
|
|
11
|
+
}
|
|
12
|
+
[part='bubble'] {
|
|
13
|
+
display: flex;
|
|
14
|
+
flex-direction: column;
|
|
15
|
+
gap: var(--lyra-space-xs);
|
|
16
|
+
max-inline-size: var(--lyra-chat-message-max-width);
|
|
17
|
+
padding: var(--lyra-space-m);
|
|
18
|
+
border: 1px solid var(--lyra-color-border);
|
|
19
|
+
border-radius: var(--lyra-radius);
|
|
20
|
+
background: var(--lyra-color-surface);
|
|
21
|
+
overflow-wrap: anywhere;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/* -- role ---------------------------------------------------------------
|
|
25
|
+
The role property reflects to 'data-role' rather than the bare 'role'
|
|
26
|
+
attribute -- see the class doc for why -- so these selectors key off
|
|
27
|
+
'data-role'. */
|
|
28
|
+
:host([data-role='user']) [part='bubble'] {
|
|
29
|
+
margin-inline-start: auto;
|
|
30
|
+
background: var(--lyra-color-brand-quiet);
|
|
31
|
+
border-color: transparent;
|
|
32
|
+
}
|
|
33
|
+
:host([data-role='assistant']) [part='bubble'] {
|
|
34
|
+
margin-inline-end: auto;
|
|
35
|
+
}
|
|
36
|
+
:host([data-role='system']) [part='bubble'] {
|
|
37
|
+
margin-inline-end: auto;
|
|
38
|
+
color: var(--lyra-color-text-quiet);
|
|
39
|
+
font-style: italic;
|
|
40
|
+
border-style: dashed;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/* -- status ---------------------------------------------------------------
|
|
44
|
+
'failed' gets an unmistakable treatment that does not rely on color
|
|
45
|
+
alone (see [part='status-text']); 'streaming' is a quieter accent plus
|
|
46
|
+
the pulsing dot below. */
|
|
47
|
+
:host([status='failed']) [part='bubble'] {
|
|
48
|
+
border-color: var(--lyra-color-danger);
|
|
49
|
+
background: var(--lyra-color-danger-quiet);
|
|
50
|
+
}
|
|
51
|
+
:host([status='streaming']) [part='bubble'] {
|
|
52
|
+
border-color: var(--lyra-color-brand);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
[part='header'] {
|
|
56
|
+
display: flex;
|
|
57
|
+
align-items: center;
|
|
58
|
+
gap: var(--lyra-space-xs);
|
|
59
|
+
}
|
|
60
|
+
[part='header'][hidden],
|
|
61
|
+
[part='avatar'][hidden],
|
|
62
|
+
[part='badges'][hidden],
|
|
63
|
+
[part='attachments'][hidden],
|
|
64
|
+
[part='footer'][hidden],
|
|
65
|
+
[part='actions'][hidden],
|
|
66
|
+
[part='body'][hidden] {
|
|
67
|
+
display: none;
|
|
68
|
+
}
|
|
69
|
+
[part='avatar'] {
|
|
70
|
+
flex: 0 0 auto;
|
|
71
|
+
display: inline-flex;
|
|
72
|
+
}
|
|
73
|
+
[part='badges'] {
|
|
74
|
+
flex: 1 1 auto;
|
|
75
|
+
display: flex;
|
|
76
|
+
flex-wrap: wrap;
|
|
77
|
+
align-items: center;
|
|
78
|
+
gap: var(--lyra-space-xs);
|
|
79
|
+
min-inline-size: 0;
|
|
80
|
+
}
|
|
81
|
+
[part='collapse-button'] {
|
|
82
|
+
flex: 0 0 auto;
|
|
83
|
+
display: inline-flex;
|
|
84
|
+
align-items: center;
|
|
85
|
+
justify-content: center;
|
|
86
|
+
min-inline-size: var(--lyra-icon-button-size);
|
|
87
|
+
min-block-size: var(--lyra-icon-button-size);
|
|
88
|
+
margin-inline-start: auto;
|
|
89
|
+
border: none;
|
|
90
|
+
background: transparent;
|
|
91
|
+
color: var(--lyra-color-text-quiet);
|
|
92
|
+
border-radius: var(--lyra-radius);
|
|
93
|
+
cursor: pointer;
|
|
94
|
+
}
|
|
95
|
+
[part='collapse-button']:hover {
|
|
96
|
+
background: var(--lyra-color-brand-quiet);
|
|
97
|
+
color: var(--lyra-color-brand);
|
|
98
|
+
}
|
|
99
|
+
[part='collapse-button']:focus-visible,
|
|
100
|
+
[part='retry-button']:focus-visible {
|
|
101
|
+
outline: var(--lyra-focus-ring-width) solid var(--lyra-focus-ring-color);
|
|
102
|
+
outline-offset: var(--lyra-focus-ring-offset);
|
|
103
|
+
}
|
|
104
|
+
[part='collapse-button'] .chevron {
|
|
105
|
+
display: inline-flex;
|
|
106
|
+
transition: transform var(--lyra-transition-fast);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
[part='attachments'] {
|
|
110
|
+
display: flex;
|
|
111
|
+
flex-wrap: wrap;
|
|
112
|
+
gap: var(--lyra-space-xs);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
[part='footer'] {
|
|
116
|
+
display: flex;
|
|
117
|
+
align-items: center;
|
|
118
|
+
gap: var(--lyra-space-xs);
|
|
119
|
+
font-size: 0.75rem;
|
|
120
|
+
color: var(--lyra-color-text-quiet);
|
|
121
|
+
}
|
|
122
|
+
[part='actions'] {
|
|
123
|
+
display: flex;
|
|
124
|
+
align-items: center;
|
|
125
|
+
gap: var(--lyra-space-xs);
|
|
126
|
+
margin-inline-start: auto;
|
|
127
|
+
}
|
|
128
|
+
[part='timestamp'] {
|
|
129
|
+
white-space: nowrap;
|
|
130
|
+
}
|
|
131
|
+
/* [part='timestamp']/[part='actions'] inherit the footer's own quiet
|
|
132
|
+
text color by default; against the danger-quiet bubble background a
|
|
133
|
+
'failed' message gets underneath it, that muted color's contrast ratio
|
|
134
|
+
drops below 4.5:1 (verified via axe's color-contrast rule), so the
|
|
135
|
+
whole footer switches to the same --lyra-color-danger already used for
|
|
136
|
+
[part='status-text'] instead. */
|
|
137
|
+
:host([status='failed']) [part='footer'] {
|
|
138
|
+
color: var(--lyra-color-danger);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
[part='status-indicator'] {
|
|
142
|
+
flex: 0 0 auto;
|
|
143
|
+
inline-size: 0.5rem;
|
|
144
|
+
block-size: 0.5rem;
|
|
145
|
+
border-radius: 50%;
|
|
146
|
+
background: var(--lyra-color-text-quiet);
|
|
147
|
+
}
|
|
148
|
+
:host([status='streaming']) [part='status-indicator'] {
|
|
149
|
+
background: var(--lyra-color-brand);
|
|
150
|
+
animation: lyra-chat-message-pulse 1.5s ease-in-out infinite;
|
|
151
|
+
}
|
|
152
|
+
:host([status='failed']) [part='status-indicator'] {
|
|
153
|
+
background: var(--lyra-color-danger);
|
|
154
|
+
}
|
|
155
|
+
[part='status-text'] {
|
|
156
|
+
white-space: nowrap;
|
|
157
|
+
}
|
|
158
|
+
:host([status='failed']) [part='status-text'] {
|
|
159
|
+
color: var(--lyra-color-danger);
|
|
160
|
+
font-weight: 600;
|
|
161
|
+
}
|
|
162
|
+
@keyframes lyra-chat-message-pulse {
|
|
163
|
+
0%,
|
|
164
|
+
100% {
|
|
165
|
+
opacity: 1;
|
|
166
|
+
}
|
|
167
|
+
50% {
|
|
168
|
+
opacity: 0.35;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
[part='retry-button'] {
|
|
173
|
+
flex: 0 0 auto;
|
|
174
|
+
display: inline-flex;
|
|
175
|
+
align-items: center;
|
|
176
|
+
gap: var(--lyra-space-xs);
|
|
177
|
+
padding: 0.125rem var(--lyra-space-xs);
|
|
178
|
+
border: 1px solid var(--lyra-color-danger);
|
|
179
|
+
border-radius: var(--lyra-radius);
|
|
180
|
+
background: transparent;
|
|
181
|
+
color: var(--lyra-color-danger);
|
|
182
|
+
font: inherit;
|
|
183
|
+
font-size: 0.75rem;
|
|
184
|
+
cursor: pointer;
|
|
185
|
+
}
|
|
186
|
+
[part='retry-button']:hover {
|
|
187
|
+
background: var(--lyra-color-danger-quiet);
|
|
188
|
+
}
|
|
189
|
+
[part='retry-button'] svg {
|
|
190
|
+
inline-size: 0.875em;
|
|
191
|
+
block-size: 0.875em;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
@media (prefers-reduced-motion: reduce) {
|
|
195
|
+
[part='status-indicator'] {
|
|
196
|
+
animation: none !important;
|
|
197
|
+
opacity: 1;
|
|
198
|
+
}
|
|
199
|
+
[part='collapse-button'] .chevron {
|
|
200
|
+
transition: none !important;
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
`;
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { type TemplateResult } from 'lit';
|
|
2
|
+
import { LyraElement } from '../../internal/lyra-element.js';
|
|
3
|
+
/**
|
|
4
|
+
* `<lyra-checkbox>` — a boolean form control. Structurally the same idea as
|
|
5
|
+
* `<lyra-switch>` (form-associated via `ElementInternals`, click and
|
|
6
|
+
* Space/Enter both toggle) but with checkbox semantics: `role="checkbox"` +
|
|
7
|
+
* an `aria-checked` that can also be `"mixed"`, and a visual box/checkmark
|
|
8
|
+
* instead of a track/thumb.
|
|
9
|
+
*
|
|
10
|
+
* `checked` is not a plain string, so this attaches `ElementInternals`
|
|
11
|
+
* directly and implements its own `updateValidity()` rather than using the
|
|
12
|
+
* `FormAssociated` mixin — see `<lyra-combobox>` for the same
|
|
13
|
+
* direct-`ElementInternals` shape with a non-string value.
|
|
14
|
+
*
|
|
15
|
+
* @customElement lyra-checkbox
|
|
16
|
+
* @slot - Label text, rendered next to the box. Clicking it toggles the
|
|
17
|
+
* checkbox, the same as clicking a native checkbox's associated `<label>`.
|
|
18
|
+
* If left empty, set `aria-label` on the host so the control still has an
|
|
19
|
+
* accessible name.
|
|
20
|
+
* @event lyra-change - The user toggled the checkbox (click or Space/Enter).
|
|
21
|
+
* `detail: { checked }`. Not fired for a programmatic `.checked` assignment.
|
|
22
|
+
* @csspart base - The whole interactive control (`role="checkbox"`); wraps the box and label.
|
|
23
|
+
* @csspart box - The small square that shows the checkmark/indeterminate dash.
|
|
24
|
+
* @csspart checkmark - The checkmark (or indeterminate dash) glyph inside the box.
|
|
25
|
+
* @csspart label - The wrapper around the default slot.
|
|
26
|
+
*/
|
|
27
|
+
export declare class LyraCheckbox extends LyraElement {
|
|
28
|
+
static styles: import("lit").CSSResultGroup[];
|
|
29
|
+
static formAssociated: boolean;
|
|
30
|
+
static properties: {
|
|
31
|
+
checked: {
|
|
32
|
+
type: BooleanConstructor;
|
|
33
|
+
reflect: boolean;
|
|
34
|
+
noAccessor: boolean;
|
|
35
|
+
};
|
|
36
|
+
indeterminate: {
|
|
37
|
+
type: BooleanConstructor;
|
|
38
|
+
reflect: boolean;
|
|
39
|
+
noAccessor: boolean;
|
|
40
|
+
};
|
|
41
|
+
disabled: {
|
|
42
|
+
type: BooleanConstructor;
|
|
43
|
+
reflect: boolean;
|
|
44
|
+
noAccessor: boolean;
|
|
45
|
+
};
|
|
46
|
+
name: {
|
|
47
|
+
reflect: boolean;
|
|
48
|
+
noAccessor: boolean;
|
|
49
|
+
};
|
|
50
|
+
required: {
|
|
51
|
+
type: BooleanConstructor;
|
|
52
|
+
reflect: boolean;
|
|
53
|
+
noAccessor: boolean;
|
|
54
|
+
};
|
|
55
|
+
value: {
|
|
56
|
+
noAccessor: boolean;
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
private hasLabelSlot;
|
|
60
|
+
private touched;
|
|
61
|
+
private internals;
|
|
62
|
+
private validityController;
|
|
63
|
+
private labelObserver?;
|
|
64
|
+
private _defaultChecked;
|
|
65
|
+
private _defaultCaptured;
|
|
66
|
+
private _fieldsetDisabled;
|
|
67
|
+
private _name;
|
|
68
|
+
private _checked;
|
|
69
|
+
private _indeterminate;
|
|
70
|
+
private _disabled;
|
|
71
|
+
private _required;
|
|
72
|
+
private _value;
|
|
73
|
+
/** Whether the control is disabled explicitly or by an ancestor fieldset. */
|
|
74
|
+
get effectiveDisabled(): boolean;
|
|
75
|
+
get checked(): boolean;
|
|
76
|
+
set checked(next: boolean);
|
|
77
|
+
get indeterminate(): boolean;
|
|
78
|
+
set indeterminate(next: boolean);
|
|
79
|
+
get disabled(): boolean;
|
|
80
|
+
set disabled(next: boolean);
|
|
81
|
+
/** The form submission key, reflected synchronously for native form APIs. */
|
|
82
|
+
get name(): string;
|
|
83
|
+
set name(next: string);
|
|
84
|
+
get required(): boolean;
|
|
85
|
+
set required(next: boolean);
|
|
86
|
+
get value(): string;
|
|
87
|
+
set value(next: string);
|
|
88
|
+
constructor();
|
|
89
|
+
get form(): HTMLFormElement | null;
|
|
90
|
+
get labels(): NodeList;
|
|
91
|
+
get validity(): ValidityState;
|
|
92
|
+
get validationMessage(): string;
|
|
93
|
+
get willValidate(): boolean;
|
|
94
|
+
connectedCallback(): void;
|
|
95
|
+
disconnectedCallback(): void;
|
|
96
|
+
protected willUpdate(): void;
|
|
97
|
+
private updateValidity;
|
|
98
|
+
private reflectInvalid;
|
|
99
|
+
private syncFormState;
|
|
100
|
+
formResetCallback(): void;
|
|
101
|
+
formStateRestoreCallback(state: string | File | FormData | null, _mode?: 'restore' | 'autocomplete'): void;
|
|
102
|
+
formDisabledCallback(disabled: boolean): void;
|
|
103
|
+
checkValidity(): boolean;
|
|
104
|
+
reportValidity(): boolean;
|
|
105
|
+
private toggle;
|
|
106
|
+
private onClick;
|
|
107
|
+
private onKeyDown;
|
|
108
|
+
private onSlotChange;
|
|
109
|
+
private recomputeHasLabelSlot;
|
|
110
|
+
private onBlur;
|
|
111
|
+
render(): TemplateResult;
|
|
112
|
+
}
|
|
113
|
+
declare global {
|
|
114
|
+
interface HTMLElementTagNameMap {
|
|
115
|
+
'lyra-checkbox': LyraCheckbox;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
@@ -0,0 +1,353 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
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
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { html, svg, nothing } from 'lit';
|
|
8
|
+
import { state } from 'lit/decorators.js';
|
|
9
|
+
import { LyraElement } from '../../internal/lyra-element.js';
|
|
10
|
+
import { defineElement } from '../../internal/prefix.js';
|
|
11
|
+
import { AnchoredValidityController, VALIDITY_ANCHOR } from '../../internal/anchored-validity.js';
|
|
12
|
+
import { styles } from './checkbox.styles.js';
|
|
13
|
+
// Mirrors the shared icon set's viewBox/stroke conventions
|
|
14
|
+
// (internal/icons.ts's chevronIcon()/closeIcon()/etc.) without importing
|
|
15
|
+
// that module — it's off limits here — so the glyph still reads as part of
|
|
16
|
+
// the same visual language as the rest of the library's inline icons.
|
|
17
|
+
const GLYPH_VIEW_BOX = '0 0 24 24';
|
|
18
|
+
const GLYPH_STROKE_WIDTH = '1.75';
|
|
19
|
+
function checkmarkGlyph() {
|
|
20
|
+
return svg `
|
|
21
|
+
<svg
|
|
22
|
+
part="checkmark"
|
|
23
|
+
width="1em"
|
|
24
|
+
height="1em"
|
|
25
|
+
viewBox=${GLYPH_VIEW_BOX}
|
|
26
|
+
fill="none"
|
|
27
|
+
stroke="currentColor"
|
|
28
|
+
stroke-width=${GLYPH_STROKE_WIDTH}
|
|
29
|
+
stroke-linecap="round"
|
|
30
|
+
stroke-linejoin="round"
|
|
31
|
+
aria-hidden="true"
|
|
32
|
+
focusable="false"
|
|
33
|
+
><polyline points="5 12.5 10 17.5 19 6.5"></polyline></svg>
|
|
34
|
+
`;
|
|
35
|
+
}
|
|
36
|
+
/** The indeterminate/mixed-state dash — takes priority over the checkmark. */
|
|
37
|
+
function indeterminateGlyph() {
|
|
38
|
+
return svg `
|
|
39
|
+
<svg
|
|
40
|
+
part="checkmark"
|
|
41
|
+
width="1em"
|
|
42
|
+
height="1em"
|
|
43
|
+
viewBox=${GLYPH_VIEW_BOX}
|
|
44
|
+
fill="none"
|
|
45
|
+
stroke="currentColor"
|
|
46
|
+
stroke-width=${GLYPH_STROKE_WIDTH}
|
|
47
|
+
stroke-linecap="round"
|
|
48
|
+
stroke-linejoin="round"
|
|
49
|
+
aria-hidden="true"
|
|
50
|
+
focusable="false"
|
|
51
|
+
><line x1="5" y1="12" x2="19" y2="12"></line></svg>
|
|
52
|
+
`;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* `<lyra-checkbox>` — a boolean form control. Structurally the same idea as
|
|
56
|
+
* `<lyra-switch>` (form-associated via `ElementInternals`, click and
|
|
57
|
+
* Space/Enter both toggle) but with checkbox semantics: `role="checkbox"` +
|
|
58
|
+
* an `aria-checked` that can also be `"mixed"`, and a visual box/checkmark
|
|
59
|
+
* instead of a track/thumb.
|
|
60
|
+
*
|
|
61
|
+
* `checked` is not a plain string, so this attaches `ElementInternals`
|
|
62
|
+
* directly and implements its own `updateValidity()` rather than using the
|
|
63
|
+
* `FormAssociated` mixin — see `<lyra-combobox>` for the same
|
|
64
|
+
* direct-`ElementInternals` shape with a non-string value.
|
|
65
|
+
*
|
|
66
|
+
* @customElement lyra-checkbox
|
|
67
|
+
* @slot - Label text, rendered next to the box. Clicking it toggles the
|
|
68
|
+
* checkbox, the same as clicking a native checkbox's associated `<label>`.
|
|
69
|
+
* If left empty, set `aria-label` on the host so the control still has an
|
|
70
|
+
* accessible name.
|
|
71
|
+
* @event lyra-change - The user toggled the checkbox (click or Space/Enter).
|
|
72
|
+
* `detail: { checked }`. Not fired for a programmatic `.checked` assignment.
|
|
73
|
+
* @csspart base - The whole interactive control (`role="checkbox"`); wraps the box and label.
|
|
74
|
+
* @csspart box - The small square that shows the checkmark/indeterminate dash.
|
|
75
|
+
* @csspart checkmark - The checkmark (or indeterminate dash) glyph inside the box.
|
|
76
|
+
* @csspart label - The wrapper around the default slot.
|
|
77
|
+
*/
|
|
78
|
+
export class LyraCheckbox extends LyraElement {
|
|
79
|
+
static { this.styles = [LyraElement.styles, styles]; }
|
|
80
|
+
static { this.formAssociated = true; }
|
|
81
|
+
static { this.properties = {
|
|
82
|
+
checked: { type: Boolean, reflect: true, noAccessor: true },
|
|
83
|
+
indeterminate: { type: Boolean, reflect: true, noAccessor: true },
|
|
84
|
+
disabled: { type: Boolean, reflect: true, noAccessor: true },
|
|
85
|
+
name: { reflect: true, noAccessor: true },
|
|
86
|
+
required: { type: Boolean, reflect: true, noAccessor: true },
|
|
87
|
+
value: { noAccessor: true },
|
|
88
|
+
}; }
|
|
89
|
+
/** Whether the control is disabled explicitly or by an ancestor fieldset. */
|
|
90
|
+
get effectiveDisabled() {
|
|
91
|
+
return this.disabled || this._fieldsetDisabled;
|
|
92
|
+
}
|
|
93
|
+
get checked() {
|
|
94
|
+
return this._checked;
|
|
95
|
+
}
|
|
96
|
+
set checked(next) {
|
|
97
|
+
const old = this._checked;
|
|
98
|
+
this._checked = Boolean(next);
|
|
99
|
+
this.syncFormState();
|
|
100
|
+
this.requestUpdate('checked', old);
|
|
101
|
+
}
|
|
102
|
+
get indeterminate() {
|
|
103
|
+
return this._indeterminate;
|
|
104
|
+
}
|
|
105
|
+
set indeterminate(next) {
|
|
106
|
+
const old = this._indeterminate;
|
|
107
|
+
this._indeterminate = Boolean(next);
|
|
108
|
+
this.syncFormState();
|
|
109
|
+
this.requestUpdate('indeterminate', old);
|
|
110
|
+
}
|
|
111
|
+
get disabled() {
|
|
112
|
+
return this._disabled;
|
|
113
|
+
}
|
|
114
|
+
set disabled(next) {
|
|
115
|
+
const old = this._disabled;
|
|
116
|
+
this._disabled = Boolean(next);
|
|
117
|
+
this.toggleAttribute('disabled', this._disabled);
|
|
118
|
+
this.requestUpdate('disabled', old);
|
|
119
|
+
}
|
|
120
|
+
/** The form submission key, reflected synchronously for native form APIs. */
|
|
121
|
+
get name() {
|
|
122
|
+
return this._name;
|
|
123
|
+
}
|
|
124
|
+
set name(next) {
|
|
125
|
+
const old = this._name;
|
|
126
|
+
this._name = next ?? '';
|
|
127
|
+
if (this._name) {
|
|
128
|
+
this.setAttribute('name', this._name);
|
|
129
|
+
}
|
|
130
|
+
else {
|
|
131
|
+
this.removeAttribute('name');
|
|
132
|
+
}
|
|
133
|
+
this.requestUpdate('name', old);
|
|
134
|
+
}
|
|
135
|
+
get required() {
|
|
136
|
+
return this._required;
|
|
137
|
+
}
|
|
138
|
+
set required(next) {
|
|
139
|
+
const old = this._required;
|
|
140
|
+
this._required = Boolean(next);
|
|
141
|
+
this.toggleAttribute('required', this._required);
|
|
142
|
+
this.updateValidity();
|
|
143
|
+
this.requestUpdate('required', old);
|
|
144
|
+
}
|
|
145
|
+
get value() {
|
|
146
|
+
return this._value;
|
|
147
|
+
}
|
|
148
|
+
set value(next) {
|
|
149
|
+
const old = this._value;
|
|
150
|
+
this._value = next ?? 'on';
|
|
151
|
+
this.syncFormState();
|
|
152
|
+
this.requestUpdate('value', old);
|
|
153
|
+
}
|
|
154
|
+
constructor() {
|
|
155
|
+
super();
|
|
156
|
+
// Visual-only mixed state, matching native `<input type="checkbox">`
|
|
157
|
+
// semantics: it does not affect `checked`'s own value, and a user
|
|
158
|
+
// interaction (click/keyboard) clears it back to `false`, exactly like the
|
|
159
|
+
// native control does.
|
|
160
|
+
// Tracks whether the default slot carries any real (non-whitespace)
|
|
161
|
+
// content, so the label wrapper — and the gap next to the box — can
|
|
162
|
+
// collapse to nothing for an icon-only/aria-label-only checkbox instead of
|
|
163
|
+
// leaving a stray empty gap. See lyra-switch's identical field for why
|
|
164
|
+
// `assignedNodes` (not `assignedElements`) is checked — the common case is
|
|
165
|
+
// a bare slotted text label, e.g. `<lyra-checkbox>Accept terms</lyra-checkbox>`.
|
|
166
|
+
this.hasLabelSlot = false;
|
|
167
|
+
// Set on the control's first `blur`; gates the `data-invalid`/`aria-invalid`
|
|
168
|
+
// reflection below so validity styling never flashes on first render,
|
|
169
|
+
// mirroring `<lyra-combobox>`/`<lyra-select>`'s identical `touched` field.
|
|
170
|
+
this.touched = false;
|
|
171
|
+
// What `form.reset()` restores to — captured once from the declarative
|
|
172
|
+
// `checked` content attribute at first connect. A pre-connect `.checked`
|
|
173
|
+
// property assignment changes live state but not the reset default, matching
|
|
174
|
+
// native `checked`/`defaultChecked` semantics. `checked` reflects, so unlike `FormAssociated`'s
|
|
175
|
+
// non-reflecting `value` this can't be captured from
|
|
176
|
+
// `attributeChangedCallback` alone — that would also fire (and wrongly
|
|
177
|
+
// redefine the default) every time the property setter reflects a later
|
|
178
|
+
// user toggle back into the attribute. Guarding with a one-shot flag
|
|
179
|
+
// instead mirrors `<lyra-combobox>`'s `_defaultCaptured`/`_defaultSelected`
|
|
180
|
+
// and `<lyra-switch>`'s identical `_defaultChecked`.
|
|
181
|
+
this._defaultChecked = false;
|
|
182
|
+
this._defaultCaptured = false;
|
|
183
|
+
this._fieldsetDisabled = false;
|
|
184
|
+
this._name = '';
|
|
185
|
+
this._checked = false;
|
|
186
|
+
this._indeterminate = false;
|
|
187
|
+
this._disabled = false;
|
|
188
|
+
this._required = false;
|
|
189
|
+
this._value = 'on';
|
|
190
|
+
this.onClick = () => {
|
|
191
|
+
this.toggle();
|
|
192
|
+
};
|
|
193
|
+
this.onKeyDown = (e) => {
|
|
194
|
+
if (this.effectiveDisabled)
|
|
195
|
+
return;
|
|
196
|
+
// Space/Enter both activate, matching lyra-switch's onKeyDown (and
|
|
197
|
+
// lyra-table's sortable-header/row convention) for role-based clickable
|
|
198
|
+
// elements — bound to keydown, not keyup/native click-forwarding.
|
|
199
|
+
if (e.key === ' ' || e.key === 'Spacebar' || e.key === 'Enter') {
|
|
200
|
+
// Space would otherwise scroll the page, same as a native checkbox.
|
|
201
|
+
e.preventDefault();
|
|
202
|
+
this.toggle();
|
|
203
|
+
}
|
|
204
|
+
};
|
|
205
|
+
this.onSlotChange = () => {
|
|
206
|
+
this.recomputeHasLabelSlot();
|
|
207
|
+
};
|
|
208
|
+
this.onBlur = () => {
|
|
209
|
+
this.touched = true;
|
|
210
|
+
this.reflectInvalid();
|
|
211
|
+
};
|
|
212
|
+
this.internals = this.attachInternals();
|
|
213
|
+
this.validityController = new AnchoredValidityController(this, this.internals, () => this[VALIDITY_ANCHOR]());
|
|
214
|
+
this.syncFormState();
|
|
215
|
+
}
|
|
216
|
+
get form() {
|
|
217
|
+
return this.internals.form;
|
|
218
|
+
}
|
|
219
|
+
get labels() {
|
|
220
|
+
return this.internals.labels;
|
|
221
|
+
}
|
|
222
|
+
get validity() {
|
|
223
|
+
return this.internals.validity;
|
|
224
|
+
}
|
|
225
|
+
get validationMessage() {
|
|
226
|
+
return this.internals.validationMessage;
|
|
227
|
+
}
|
|
228
|
+
get willValidate() {
|
|
229
|
+
return this.internals.willValidate;
|
|
230
|
+
}
|
|
231
|
+
/** @internal */
|
|
232
|
+
[VALIDITY_ANCHOR]() {
|
|
233
|
+
return this.renderRoot?.querySelector('[part="base"]') ?? null;
|
|
234
|
+
}
|
|
235
|
+
connectedCallback() {
|
|
236
|
+
super.connectedCallback();
|
|
237
|
+
if (!this._defaultCaptured) {
|
|
238
|
+
this._defaultCaptured = true;
|
|
239
|
+
this._defaultChecked = this.hasAttribute('checked');
|
|
240
|
+
}
|
|
241
|
+
this.updateValidity();
|
|
242
|
+
this.labelObserver = new MutationObserver(() => this.recomputeHasLabelSlot());
|
|
243
|
+
this.labelObserver.observe(this, { childList: true, subtree: true, characterData: true });
|
|
244
|
+
}
|
|
245
|
+
disconnectedCallback() {
|
|
246
|
+
super.disconnectedCallback();
|
|
247
|
+
this.labelObserver?.disconnect();
|
|
248
|
+
this.labelObserver = undefined;
|
|
249
|
+
}
|
|
250
|
+
willUpdate() {
|
|
251
|
+
// Seed `hasLabelSlot` from the light-DOM children synchronously before
|
|
252
|
+
// the very first render (same `!hasUpdated` guard as combobox/date-input's
|
|
253
|
+
// `hasHintSlot` etc.) so declaratively-provided label text doesn't flash
|
|
254
|
+
// hidden for one frame while waiting on the first `slotchange` event.
|
|
255
|
+
if (!this.hasUpdated) {
|
|
256
|
+
this.hasLabelSlot = Array.from(this.childNodes).some((n) => (n.textContent ?? '').trim().length > 0);
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
updateValidity() {
|
|
260
|
+
if (this.required && !this.checked) {
|
|
261
|
+
this.validityController.setValidity({ valueMissing: true }, 'Please check this box if you want to continue.');
|
|
262
|
+
}
|
|
263
|
+
else {
|
|
264
|
+
this.validityController.setValidity({});
|
|
265
|
+
}
|
|
266
|
+
this.reflectInvalid();
|
|
267
|
+
}
|
|
268
|
+
// Keeps `data-invalid` (styling hook) in lockstep with `aria-invalid`
|
|
269
|
+
// (rendered from the same expression in `render()`) any time validity
|
|
270
|
+
// could have changed, rather than waiting on Lit's async `updated()` --
|
|
271
|
+
// consistent with this component's already-synchronous
|
|
272
|
+
// `syncFormState()`/setter shape.
|
|
273
|
+
reflectInvalid() {
|
|
274
|
+
this.toggleAttribute('data-invalid', this.touched && !this.internals.validity.valid);
|
|
275
|
+
}
|
|
276
|
+
syncFormState() {
|
|
277
|
+
// A native checkbox submits its `value` content attribute (default
|
|
278
|
+
// "on") only while checked, and contributes nothing at all — not even
|
|
279
|
+
// an empty string — while unchecked.
|
|
280
|
+
const state = `${this.checked ? 'checked' : 'unchecked'}${this.indeterminate ? '/indeterminate' : ''}`;
|
|
281
|
+
this.internals.setFormValue(this.checked ? this.value : null, state);
|
|
282
|
+
this.updateValidity();
|
|
283
|
+
}
|
|
284
|
+
formResetCallback() {
|
|
285
|
+
this.checked = this._defaultChecked;
|
|
286
|
+
}
|
|
287
|
+
formStateRestoreCallback(state, _mode) {
|
|
288
|
+
const oldChecked = this._checked;
|
|
289
|
+
const oldIndeterminate = this._indeterminate;
|
|
290
|
+
this._checked = state === 'checked' || state === 'checked/indeterminate';
|
|
291
|
+
this._indeterminate = state === 'checked/indeterminate' || state === 'unchecked/indeterminate';
|
|
292
|
+
this.syncFormState();
|
|
293
|
+
this.requestUpdate('checked', oldChecked);
|
|
294
|
+
this.requestUpdate('indeterminate', oldIndeterminate);
|
|
295
|
+
}
|
|
296
|
+
formDisabledCallback(disabled) {
|
|
297
|
+
this._fieldsetDisabled = disabled;
|
|
298
|
+
this.requestUpdate();
|
|
299
|
+
}
|
|
300
|
+
checkValidity() {
|
|
301
|
+
return this.internals.checkValidity();
|
|
302
|
+
}
|
|
303
|
+
reportValidity() {
|
|
304
|
+
return this.internals.reportValidity();
|
|
305
|
+
}
|
|
306
|
+
toggle() {
|
|
307
|
+
if (this.effectiveDisabled)
|
|
308
|
+
return;
|
|
309
|
+
this.checked = !this.checked;
|
|
310
|
+
this.indeterminate = false;
|
|
311
|
+
this.emit('lyra-change', { checked: this.checked });
|
|
312
|
+
}
|
|
313
|
+
// Shared by `onSlotChange` (the "set of distributed nodes changed" case)
|
|
314
|
+
// and `labelObserver` (the "an already-slotted node mutated in place"
|
|
315
|
+
// case) so both paths agree on what counts as real label content.
|
|
316
|
+
recomputeHasLabelSlot() {
|
|
317
|
+
const slot = this.renderRoot.querySelector('slot');
|
|
318
|
+
if (!slot)
|
|
319
|
+
return;
|
|
320
|
+
const nodes = slot.assignedNodes({ flatten: true });
|
|
321
|
+
this.hasLabelSlot = nodes.some((n) => (n.textContent ?? '').trim().length > 0);
|
|
322
|
+
}
|
|
323
|
+
render() {
|
|
324
|
+
const mixed = this.indeterminate;
|
|
325
|
+
return html `
|
|
326
|
+
<span
|
|
327
|
+
part="base"
|
|
328
|
+
role="checkbox"
|
|
329
|
+
tabindex=${this.effectiveDisabled ? '-1' : '0'}
|
|
330
|
+
aria-checked=${mixed ? 'mixed' : this.checked ? 'true' : 'false'}
|
|
331
|
+
aria-required=${this.required ? 'true' : nothing}
|
|
332
|
+
aria-invalid=${this.touched && !this.internals.validity.valid ? 'true' : 'false'}
|
|
333
|
+
aria-disabled=${this.effectiveDisabled ? 'true' : nothing}
|
|
334
|
+
aria-label=${this.getAttribute('aria-label') || nothing}
|
|
335
|
+
@click=${this.onClick}
|
|
336
|
+
@keydown=${this.onKeyDown}
|
|
337
|
+
@blur=${this.onBlur}
|
|
338
|
+
>
|
|
339
|
+
<span part="box"> ${mixed ? indeterminateGlyph() : this.checked ? checkmarkGlyph() : nothing} </span>
|
|
340
|
+
<span part="label" ?hidden=${!this.hasLabelSlot}>
|
|
341
|
+
<slot @slotchange=${this.onSlotChange}></slot>
|
|
342
|
+
</span>
|
|
343
|
+
</span>
|
|
344
|
+
`;
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
__decorate([
|
|
348
|
+
state()
|
|
349
|
+
], LyraCheckbox.prototype, "hasLabelSlot", void 0);
|
|
350
|
+
__decorate([
|
|
351
|
+
state()
|
|
352
|
+
], LyraCheckbox.prototype, "touched", void 0);
|
|
353
|
+
defineElement('checkbox', LyraCheckbox);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const styles: import("lit").CSSResult;
|