@aceshooting/lyra-ui 1.2.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -0
- package/custom-elements.json +23341 -11202
- package/dist/components/app-rail/app-rail.d.ts +171 -0
- package/dist/components/app-rail/app-rail.js +483 -0
- package/dist/components/app-rail/app-rail.styles.d.ts +1 -0
- package/dist/components/app-rail/app-rail.styles.js +125 -0
- package/dist/components/attachment-chip/attachment-chip.d.ts +114 -0
- package/dist/components/attachment-chip/attachment-chip.js +312 -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 +83 -0
- package/dist/components/attachment-trigger/attachment-trigger.js +258 -0
- package/dist/components/attachment-trigger/attachment-trigger.styles.d.ts +1 -0
- package/dist/components/attachment-trigger/attachment-trigger.styles.js +68 -0
- package/dist/components/chart/box-plot.js +11 -1
- 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 +1 -2
- package/dist/components/chart/chart.js +67 -12
- package/dist/components/chart/histogram-bin.d.ts +4 -1
- package/dist/components/chart/histogram-bin.js +24 -14
- package/dist/components/chart/lite-chart.d.ts +54 -0
- package/dist/components/chart/lite-chart.js +140 -22
- package/dist/components/chart/lite-chart.styles.js +9 -0
- package/dist/components/chat-composer/chat-composer.d.ts +92 -0
- package/dist/components/chat-composer/chat-composer.js +285 -0
- package/dist/components/chat-composer/chat-composer.styles.d.ts +1 -0
- package/dist/components/chat-composer/chat-composer.styles.js +135 -0
- package/dist/components/chat-message/chat-message.d.ts +113 -0
- package/dist/components/chat-message/chat-message.js +291 -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 +59 -0
- package/dist/components/checkbox/checkbox.js +230 -0
- package/dist/components/checkbox/checkbox.styles.d.ts +1 -0
- package/dist/components/checkbox/checkbox.styles.js +70 -0
- package/dist/components/chip/chip-group.d.ts +56 -0
- package/dist/components/chip/chip-group.js +124 -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 +115 -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 +300 -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 +89 -0
- package/dist/components/code-block/code-block.js +317 -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 +44 -0
- package/dist/components/code-block/code-loader.js +79 -0
- package/dist/components/combobox/combobox.d.ts +19 -1
- package/dist/components/combobox/combobox.js +84 -14
- 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 +150 -0
- package/dist/components/context-meter/context-meter.styles.d.ts +1 -0
- package/dist/components/context-meter/context-meter.styles.js +120 -0
- package/dist/components/conversation-item/conversation-item.d.ts +128 -0
- package/dist/components/conversation-item/conversation-item.js +322 -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/date-input.d.ts +24 -0
- package/dist/components/date-picker/date-input.js +134 -22
- package/dist/components/date-picker/date-picker.d.ts +7 -0
- package/dist/components/date-picker/date-picker.js +85 -16
- package/dist/components/dialog/confirm.d.ts +40 -0
- package/dist/components/dialog/confirm.js +79 -0
- package/dist/components/dialog/dialog.d.ts +85 -0
- package/dist/components/dialog/dialog.js +272 -0
- package/dist/components/dialog/dialog.styles.d.ts +1 -0
- package/dist/components/dialog/dialog.styles.js +52 -0
- package/dist/components/dock-panel/dock-panel.d.ts +134 -0
- package/dist/components/dock-panel/dock-panel.js +345 -0
- package/dist/components/dock-panel/dock-panel.styles.d.ts +1 -0
- package/dist/components/dock-panel/dock-panel.styles.js +145 -0
- package/dist/components/document-preview/document-preview.d.ts +135 -0
- package/dist/components/document-preview/document-preview.js +372 -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/export-button/csv.js +1 -1
- package/dist/components/export-button/export-button.js +2 -0
- package/dist/components/flag/flag.d.ts +29 -13
- package/dist/components/flag/flag.js +39 -13
- package/dist/components/gauge/gauge.js +19 -10
- package/dist/components/generation-status/generation-status.d.ts +109 -0
- package/dist/components/generation-status/generation-status.js +273 -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/heatmap/calendar-grid.d.ts +4 -1
- package/dist/components/heatmap/calendar-grid.js +25 -12
- package/dist/components/heatmap/heatmap-scale.d.ts +6 -0
- package/dist/components/heatmap/heatmap-scale.js +7 -1
- package/dist/components/heatmap/heatmap.d.ts +74 -0
- package/dist/components/heatmap/heatmap.js +135 -23
- package/dist/components/json-viewer/json-viewer.d.ts +53 -0
- package/dist/components/json-viewer/json-viewer.js +283 -0
- package/dist/components/json-viewer/json-viewer.styles.d.ts +1 -0
- package/dist/components/json-viewer/json-viewer.styles.js +176 -0
- package/dist/components/kbd/kbd.d.ts +77 -0
- package/dist/components/kbd/kbd.js +214 -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 +81 -0
- package/dist/components/live-region/live-region.js +153 -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 +8 -6
- package/dist/components/map/map.js +44 -8
- package/dist/components/markdown/markdown-loader.d.ts +34 -0
- package/dist/components/markdown/markdown-loader.js +43 -0
- package/dist/components/markdown/markdown.d.ts +81 -0
- package/dist/components/markdown/markdown.js +284 -0
- package/dist/components/markdown/markdown.styles.d.ts +1 -0
- package/dist/components/markdown/markdown.styles.js +82 -0
- package/dist/components/media-card/media-card.d.ts +122 -0
- package/dist/components/media-card/media-card.js +295 -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 +200 -0
- package/dist/components/mention-popover/mention-popover.js +475 -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 +62 -0
- package/dist/components/menu/menu-item.js +119 -0
- package/dist/components/menu/menu-item.styles.d.ts +1 -0
- package/dist/components/menu/menu-item.styles.js +67 -0
- package/dist/components/menu/menu.d.ts +143 -0
- package/dist/components/menu/menu.js +365 -0
- package/dist/components/menu/menu.styles.d.ts +1 -0
- package/dist/components/menu/menu.styles.js +66 -0
- package/dist/components/model-select/model-select.d.ts +125 -0
- package/dist/components/model-select/model-select.js +490 -0
- package/dist/components/model-select/model-select.styles.d.ts +1 -0
- package/dist/components/model-select/model-select.styles.js +189 -0
- package/dist/components/model-settings-panel/model-settings-panel.d.ts +69 -0
- package/dist/components/model-settings-panel/model-settings-panel.js +145 -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 +13 -1
- package/dist/components/playback/playback.js +47 -14
- package/dist/components/responsive-panel/responsive-panel.d.ts +150 -0
- package/dist/components/responsive-panel/responsive-panel.js +365 -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 +44 -0
- package/dist/components/result-card/result-card.js +83 -0
- package/dist/components/result-card/result-card.styles.d.ts +1 -0
- package/dist/components/result-card/result-card.styles.js +50 -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 +43 -2
- package/dist/components/select/select.js +150 -17
- package/dist/components/slider/slider.d.ts +89 -0
- package/dist/components/slider/slider.js +352 -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 +92 -0
- package/dist/components/source-card/source-card.js +148 -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 +122 -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 +27 -13
- package/dist/components/split/split.d.ts +93 -1
- package/dist/components/split/split.js +284 -15
- package/dist/components/split/split.styles.js +30 -0
- package/dist/components/stat/stat.d.ts +6 -1
- package/dist/components/stat/stat.js +8 -2
- package/dist/components/stream-status/stream-status.d.ts +110 -0
- package/dist/components/stream-status/stream-status.js +210 -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 +98 -0
- package/dist/components/streaming-text/streaming-text.js +209 -0
- package/dist/components/streaming-text/streaming-text.styles.d.ts +1 -0
- package/dist/components/streaming-text/streaming-text.styles.js +62 -0
- package/dist/components/switch/switch.d.ts +58 -0
- package/dist/components/switch/switch.js +179 -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 +73 -4
- package/dist/components/table/table.js +169 -20
- package/dist/components/table/table.styles.js +6 -1
- package/dist/components/tabs/tabs.d.ts +51 -0
- package/dist/components/tabs/tabs.js +190 -0
- package/dist/components/tabs/tabs.styles.d.ts +1 -0
- package/dist/components/tabs/tabs.styles.js +63 -0
- package/dist/components/thinking-panel/thinking-panel.d.ts +121 -0
- package/dist/components/thinking-panel/thinking-panel.js +235 -0
- package/dist/components/thinking-panel/thinking-panel.styles.d.ts +1 -0
- package/dist/components/thinking-panel/thinking-panel.styles.js +117 -0
- package/dist/components/toast/toast-item.d.ts +1 -0
- package/dist/components/toast/toast-item.js +31 -6
- package/dist/components/tool-approval-dialog/tool-approval-dialog.d.ts +130 -0
- package/dist/components/tool-approval-dialog/tool-approval-dialog.js +403 -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 +89 -0
- package/dist/components/tool-call-chip/tool-call-chip.js +288 -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 +145 -0
- package/dist/components/tool-param-form/tool-param-form.js +366 -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 +102 -0
- package/dist/components/tool-result-dialog/tool-result-dialog.js +393 -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 +81 -0
- package/dist/components/tool-result-view/registry.js +84 -0
- package/dist/components/tool-result-view/tool-result-view.d.ts +55 -0
- package/dist/components/tool-result-view/tool-result-view.js +138 -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 +439 -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 +182 -0
- package/dist/components/tree/tree-node.d.ts +11 -2
- package/dist/components/tree/tree-node.js +16 -6
- package/dist/components/tree/tree.d.ts +8 -2
- package/dist/components/tree/tree.js +18 -11
- package/dist/components/typing-indicator/typing-indicator.d.ts +60 -0
- package/dist/components/typing-indicator/typing-indicator.js +96 -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 +173 -0
- package/dist/components/virtual-list/virtual-list.js +461 -0
- package/dist/components/virtual-list/virtual-list.styles.d.ts +1 -0
- package/dist/components/virtual-list/virtual-list.styles.js +44 -0
- package/dist/components/word-cloud/word-cloud-layout.js +14 -1
- package/dist/components/word-cloud/word-cloud.d.ts +6 -0
- package/dist/components/word-cloud/word-cloud.js +25 -14
- package/dist/components/word-cloud/word-cloud.styles.js +3 -2
- package/dist/internal/announcer.d.ts +57 -0
- package/dist/internal/announcer.js +71 -0
- package/dist/internal/form-associated.d.ts +1 -0
- package/dist/internal/form-associated.js +55 -11
- package/dist/internal/group-by-recency.d.ts +50 -0
- package/dist/internal/group-by-recency.js +80 -0
- package/dist/internal/rtl.d.ts +23 -0
- package/dist/internal/rtl.js +28 -0
- package/dist/internal/scroll-lock.d.ts +10 -5
- package/dist/internal/scroll-lock.js +30 -14
- package/dist/internal/tokens.styles.js +6 -0
- package/dist/lyra.d.ts +130 -31
- package/dist/lyra.js +94 -26
- package/llms-full.txt +3836 -17
- package/llms.txt +16 -1
- package/package.json +23 -5
- 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,59 @@
|
|
|
1
|
+
import { type TemplateResult, type PropertyValues } 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
|
+
checked: boolean;
|
|
31
|
+
indeterminate: boolean;
|
|
32
|
+
disabled: boolean;
|
|
33
|
+
required: boolean;
|
|
34
|
+
name: string;
|
|
35
|
+
value: string;
|
|
36
|
+
private hasLabelSlot;
|
|
37
|
+
private internals;
|
|
38
|
+
private _defaultChecked;
|
|
39
|
+
private _defaultCaptured;
|
|
40
|
+
constructor();
|
|
41
|
+
connectedCallback(): void;
|
|
42
|
+
protected willUpdate(): void;
|
|
43
|
+
private updateValidity;
|
|
44
|
+
protected updated(changed: PropertyValues): void;
|
|
45
|
+
formResetCallback(): void;
|
|
46
|
+
formDisabledCallback(disabled: boolean): void;
|
|
47
|
+
checkValidity(): boolean;
|
|
48
|
+
reportValidity(): boolean;
|
|
49
|
+
private toggle;
|
|
50
|
+
private onClick;
|
|
51
|
+
private onKeyDown;
|
|
52
|
+
private onSlotChange;
|
|
53
|
+
render(): TemplateResult;
|
|
54
|
+
}
|
|
55
|
+
declare global {
|
|
56
|
+
interface HTMLElementTagNameMap {
|
|
57
|
+
'lyra-checkbox': LyraCheckbox;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
@@ -0,0 +1,230 @@
|
|
|
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 { property, state } from 'lit/decorators.js';
|
|
9
|
+
import { LyraElement } from '../../internal/lyra-element.js';
|
|
10
|
+
import { defineElement } from '../../internal/prefix.js';
|
|
11
|
+
import { styles } from './checkbox.styles.js';
|
|
12
|
+
// Mirrors the shared icon set's viewBox/stroke conventions
|
|
13
|
+
// (internal/icons.ts's chevronIcon()/closeIcon()/etc.) without importing
|
|
14
|
+
// that module — it's off limits here — so the glyph still reads as part of
|
|
15
|
+
// the same visual language as the rest of the library's inline icons.
|
|
16
|
+
const GLYPH_VIEW_BOX = '0 0 24 24';
|
|
17
|
+
const GLYPH_STROKE_WIDTH = '1.75';
|
|
18
|
+
function checkmarkGlyph() {
|
|
19
|
+
return svg `
|
|
20
|
+
<svg
|
|
21
|
+
part="checkmark"
|
|
22
|
+
width="1em"
|
|
23
|
+
height="1em"
|
|
24
|
+
viewBox=${GLYPH_VIEW_BOX}
|
|
25
|
+
fill="none"
|
|
26
|
+
stroke="currentColor"
|
|
27
|
+
stroke-width=${GLYPH_STROKE_WIDTH}
|
|
28
|
+
stroke-linecap="round"
|
|
29
|
+
stroke-linejoin="round"
|
|
30
|
+
aria-hidden="true"
|
|
31
|
+
focusable="false"
|
|
32
|
+
><polyline points="5 12.5 10 17.5 19 6.5"></polyline></svg>
|
|
33
|
+
`;
|
|
34
|
+
}
|
|
35
|
+
/** The indeterminate/mixed-state dash — takes priority over the checkmark. */
|
|
36
|
+
function indeterminateGlyph() {
|
|
37
|
+
return svg `
|
|
38
|
+
<svg
|
|
39
|
+
part="checkmark"
|
|
40
|
+
width="1em"
|
|
41
|
+
height="1em"
|
|
42
|
+
viewBox=${GLYPH_VIEW_BOX}
|
|
43
|
+
fill="none"
|
|
44
|
+
stroke="currentColor"
|
|
45
|
+
stroke-width=${GLYPH_STROKE_WIDTH}
|
|
46
|
+
stroke-linecap="round"
|
|
47
|
+
stroke-linejoin="round"
|
|
48
|
+
aria-hidden="true"
|
|
49
|
+
focusable="false"
|
|
50
|
+
><line x1="5" y1="12" x2="19" y2="12"></line></svg>
|
|
51
|
+
`;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* `<lyra-checkbox>` — a boolean form control. Structurally the same idea as
|
|
55
|
+
* `<lyra-switch>` (form-associated via `ElementInternals`, click and
|
|
56
|
+
* Space/Enter both toggle) but with checkbox semantics: `role="checkbox"` +
|
|
57
|
+
* an `aria-checked` that can also be `"mixed"`, and a visual box/checkmark
|
|
58
|
+
* instead of a track/thumb.
|
|
59
|
+
*
|
|
60
|
+
* `checked` is not a plain string, so this attaches `ElementInternals`
|
|
61
|
+
* directly and implements its own `updateValidity()` rather than using the
|
|
62
|
+
* `FormAssociated` mixin — see `<lyra-combobox>` for the same
|
|
63
|
+
* direct-`ElementInternals` shape with a non-string value.
|
|
64
|
+
*
|
|
65
|
+
* @customElement lyra-checkbox
|
|
66
|
+
* @slot - Label text, rendered next to the box. Clicking it toggles the
|
|
67
|
+
* checkbox, the same as clicking a native checkbox's associated `<label>`.
|
|
68
|
+
* If left empty, set `aria-label` on the host so the control still has an
|
|
69
|
+
* accessible name.
|
|
70
|
+
* @event lyra-change - The user toggled the checkbox (click or Space/Enter).
|
|
71
|
+
* `detail: { checked }`. Not fired for a programmatic `.checked` assignment.
|
|
72
|
+
* @csspart base - The whole interactive control (`role="checkbox"`); wraps the box and label.
|
|
73
|
+
* @csspart box - The small square that shows the checkmark/indeterminate dash.
|
|
74
|
+
* @csspart checkmark - The checkmark (or indeterminate dash) glyph inside the box.
|
|
75
|
+
* @csspart label - The wrapper around the default slot.
|
|
76
|
+
*/
|
|
77
|
+
export class LyraCheckbox extends LyraElement {
|
|
78
|
+
static { this.styles = [LyraElement.styles, styles]; }
|
|
79
|
+
static { this.formAssociated = true; }
|
|
80
|
+
constructor() {
|
|
81
|
+
super();
|
|
82
|
+
this.checked = false;
|
|
83
|
+
// Visual-only mixed state, matching native `<input type="checkbox">`
|
|
84
|
+
// semantics: it does not affect `checked`'s own value, and a user
|
|
85
|
+
// interaction (click/keyboard) clears it back to `false`, exactly like the
|
|
86
|
+
// native control does.
|
|
87
|
+
this.indeterminate = false;
|
|
88
|
+
this.disabled = false;
|
|
89
|
+
this.required = false;
|
|
90
|
+
this.name = '';
|
|
91
|
+
this.value = 'on';
|
|
92
|
+
// Tracks whether the default slot carries any real (non-whitespace)
|
|
93
|
+
// content, so the label wrapper — and the gap next to the box — can
|
|
94
|
+
// collapse to nothing for an icon-only/aria-label-only checkbox instead of
|
|
95
|
+
// leaving a stray empty gap. See lyra-switch's identical field for why
|
|
96
|
+
// `assignedNodes` (not `assignedElements`) is checked — the common case is
|
|
97
|
+
// a bare slotted text label, e.g. `<lyra-checkbox>Accept terms</lyra-checkbox>`.
|
|
98
|
+
this.hasLabelSlot = false;
|
|
99
|
+
// What `form.reset()` restores to — captured once, from whatever `checked`
|
|
100
|
+
// reads at first connect (i.e. whatever the declarative `checked`
|
|
101
|
+
// attribute parsed to, since attribute parsing happens before
|
|
102
|
+
// `connectedCallback`). `checked` reflects, so unlike `FormAssociated`'s
|
|
103
|
+
// non-reflecting `value` this can't be captured from
|
|
104
|
+
// `attributeChangedCallback` alone — that would also fire (and wrongly
|
|
105
|
+
// redefine the default) every time the property setter reflects a later
|
|
106
|
+
// user toggle back into the attribute. Guarding with a one-shot flag
|
|
107
|
+
// instead mirrors `<lyra-combobox>`'s `_defaultCaptured`/`_defaultSelected`
|
|
108
|
+
// and `<lyra-switch>`'s identical `_defaultChecked`.
|
|
109
|
+
this._defaultChecked = false;
|
|
110
|
+
this._defaultCaptured = false;
|
|
111
|
+
this.onClick = () => {
|
|
112
|
+
this.toggle();
|
|
113
|
+
};
|
|
114
|
+
this.onKeyDown = (e) => {
|
|
115
|
+
if (this.disabled)
|
|
116
|
+
return;
|
|
117
|
+
// Space/Enter both activate, matching lyra-switch's onKeyDown (and
|
|
118
|
+
// lyra-table's sortable-header/row convention) for role-based clickable
|
|
119
|
+
// elements — bound to keydown, not keyup/native click-forwarding.
|
|
120
|
+
if (e.key === ' ' || e.key === 'Spacebar' || e.key === 'Enter') {
|
|
121
|
+
// Space would otherwise scroll the page, same as a native checkbox.
|
|
122
|
+
e.preventDefault();
|
|
123
|
+
this.toggle();
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
this.onSlotChange = (e) => {
|
|
127
|
+
const nodes = e.target.assignedNodes({ flatten: true });
|
|
128
|
+
this.hasLabelSlot = nodes.some((n) => (n.textContent ?? '').trim().length > 0);
|
|
129
|
+
};
|
|
130
|
+
this.internals = this.attachInternals();
|
|
131
|
+
}
|
|
132
|
+
connectedCallback() {
|
|
133
|
+
super.connectedCallback();
|
|
134
|
+
if (!this._defaultCaptured) {
|
|
135
|
+
this._defaultCaptured = true;
|
|
136
|
+
this._defaultChecked = this.checked;
|
|
137
|
+
}
|
|
138
|
+
this.updateValidity();
|
|
139
|
+
}
|
|
140
|
+
willUpdate() {
|
|
141
|
+
// Seed `hasLabelSlot` from the light-DOM children synchronously before
|
|
142
|
+
// the very first render (same `!hasUpdated` guard as combobox/date-input's
|
|
143
|
+
// `hasHintSlot` etc.) so declaratively-provided label text doesn't flash
|
|
144
|
+
// hidden for one frame while waiting on the first `slotchange` event.
|
|
145
|
+
if (!this.hasUpdated) {
|
|
146
|
+
this.hasLabelSlot = Array.from(this.childNodes).some((n) => (n.textContent ?? '').trim().length > 0);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
updateValidity() {
|
|
150
|
+
if (this.required && !this.checked) {
|
|
151
|
+
this.internals.setValidity({ valueMissing: true }, 'Please check this box if you want to continue.');
|
|
152
|
+
}
|
|
153
|
+
else {
|
|
154
|
+
this.internals.setValidity({});
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
updated(changed) {
|
|
158
|
+
if (changed.has('checked') || changed.has('value')) {
|
|
159
|
+
// A native checkbox submits its `value` content attribute (default
|
|
160
|
+
// "on") only while checked, and contributes nothing at all — not even
|
|
161
|
+
// an empty string — while unchecked.
|
|
162
|
+
this.internals.setFormValue(this.checked ? this.value : null);
|
|
163
|
+
}
|
|
164
|
+
if (changed.has('checked') || changed.has('required')) {
|
|
165
|
+
this.updateValidity();
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
formResetCallback() {
|
|
169
|
+
this.checked = this._defaultChecked;
|
|
170
|
+
}
|
|
171
|
+
formDisabledCallback(disabled) {
|
|
172
|
+
this.disabled = disabled;
|
|
173
|
+
}
|
|
174
|
+
checkValidity() {
|
|
175
|
+
return this.internals.checkValidity();
|
|
176
|
+
}
|
|
177
|
+
reportValidity() {
|
|
178
|
+
return this.internals.reportValidity();
|
|
179
|
+
}
|
|
180
|
+
toggle() {
|
|
181
|
+
if (this.disabled)
|
|
182
|
+
return;
|
|
183
|
+
this.checked = !this.checked;
|
|
184
|
+
this.indeterminate = false;
|
|
185
|
+
this.emit('lyra-change', { checked: this.checked });
|
|
186
|
+
}
|
|
187
|
+
render() {
|
|
188
|
+
const mixed = this.indeterminate;
|
|
189
|
+
return html `
|
|
190
|
+
<span
|
|
191
|
+
part="base"
|
|
192
|
+
role="checkbox"
|
|
193
|
+
tabindex=${this.disabled ? '-1' : '0'}
|
|
194
|
+
aria-checked=${mixed ? 'mixed' : this.checked ? 'true' : 'false'}
|
|
195
|
+
aria-required=${this.required ? 'true' : nothing}
|
|
196
|
+
aria-disabled=${this.disabled ? 'true' : nothing}
|
|
197
|
+
aria-label=${this.getAttribute('aria-label') || nothing}
|
|
198
|
+
@click=${this.onClick}
|
|
199
|
+
@keydown=${this.onKeyDown}
|
|
200
|
+
>
|
|
201
|
+
<span part="box"> ${mixed ? indeterminateGlyph() : this.checked ? checkmarkGlyph() : nothing} </span>
|
|
202
|
+
<span part="label" ?hidden=${!this.hasLabelSlot}>
|
|
203
|
+
<slot @slotchange=${this.onSlotChange}></slot>
|
|
204
|
+
</span>
|
|
205
|
+
</span>
|
|
206
|
+
`;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
__decorate([
|
|
210
|
+
property({ type: Boolean, reflect: true })
|
|
211
|
+
], LyraCheckbox.prototype, "checked", void 0);
|
|
212
|
+
__decorate([
|
|
213
|
+
property({ type: Boolean, reflect: true })
|
|
214
|
+
], LyraCheckbox.prototype, "indeterminate", void 0);
|
|
215
|
+
__decorate([
|
|
216
|
+
property({ type: Boolean, reflect: true })
|
|
217
|
+
], LyraCheckbox.prototype, "disabled", void 0);
|
|
218
|
+
__decorate([
|
|
219
|
+
property({ type: Boolean, reflect: true })
|
|
220
|
+
], LyraCheckbox.prototype, "required", void 0);
|
|
221
|
+
__decorate([
|
|
222
|
+
property()
|
|
223
|
+
], LyraCheckbox.prototype, "name", void 0);
|
|
224
|
+
__decorate([
|
|
225
|
+
property()
|
|
226
|
+
], LyraCheckbox.prototype, "value", void 0);
|
|
227
|
+
__decorate([
|
|
228
|
+
state()
|
|
229
|
+
], LyraCheckbox.prototype, "hasLabelSlot", void 0);
|
|
230
|
+
defineElement('checkbox', LyraCheckbox);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const styles: import("lit").CSSResult;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { css } from 'lit';
|
|
2
|
+
export const styles = css `
|
|
3
|
+
:host {
|
|
4
|
+
display: inline-block;
|
|
5
|
+
}
|
|
6
|
+
[part='base'] {
|
|
7
|
+
display: inline-flex;
|
|
8
|
+
align-items: center;
|
|
9
|
+
gap: var(--lyra-space-s);
|
|
10
|
+
cursor: pointer;
|
|
11
|
+
-webkit-tap-highlight-color: transparent;
|
|
12
|
+
}
|
|
13
|
+
[part='base']:focus-visible {
|
|
14
|
+
outline: var(--lyra-focus-ring-width) solid var(--lyra-focus-ring-color);
|
|
15
|
+
outline-offset: var(--lyra-focus-ring-offset);
|
|
16
|
+
}
|
|
17
|
+
:host([disabled]) [part='base'] {
|
|
18
|
+
cursor: not-allowed;
|
|
19
|
+
opacity: var(--lyra-opacity-disabled);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
[part='box'] {
|
|
23
|
+
display: inline-flex;
|
|
24
|
+
align-items: center;
|
|
25
|
+
justify-content: center;
|
|
26
|
+
flex: 0 0 auto;
|
|
27
|
+
box-sizing: border-box;
|
|
28
|
+
/* Matches the inline icon-affordance sizing convention used by
|
|
29
|
+
lyra-combobox's clear-button / lyra-select's toggle
|
|
30
|
+
(--lyra-icon-button-size capped at 1.75rem) — a real touch target
|
|
31
|
+
without ballooning to the full 2.5rem meant for standalone
|
|
32
|
+
icon-only buttons. */
|
|
33
|
+
min-inline-size: min(var(--lyra-icon-button-size), 1.75rem);
|
|
34
|
+
min-block-size: min(var(--lyra-icon-button-size), 1.75rem);
|
|
35
|
+
border: 1px solid var(--lyra-color-border);
|
|
36
|
+
border-radius: calc(var(--lyra-radius) * 0.6);
|
|
37
|
+
background: var(--lyra-color-surface);
|
|
38
|
+
color: var(--lyra-color-on-brand);
|
|
39
|
+
transition:
|
|
40
|
+
background-color var(--lyra-transition-fast),
|
|
41
|
+
border-color var(--lyra-transition-fast);
|
|
42
|
+
}
|
|
43
|
+
:host(:not([disabled])) [part='base']:hover [part='box'] {
|
|
44
|
+
border-color: var(--lyra-color-brand);
|
|
45
|
+
}
|
|
46
|
+
:host([checked]) [part='box'],
|
|
47
|
+
:host([indeterminate]) [part='box'] {
|
|
48
|
+
background: var(--lyra-color-brand);
|
|
49
|
+
border-color: var(--lyra-color-brand);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
[part='checkmark'] {
|
|
53
|
+
display: block;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/* No explicit "display" here (unlike e.g. lyra-combobox's
|
|
57
|
+
[part='form-control-label']), so the UA stylesheet's default
|
|
58
|
+
"[hidden] { display: none }" rule needs no author-side override to
|
|
59
|
+
take effect when hasLabelSlot is false. */
|
|
60
|
+
[part='label'] {
|
|
61
|
+
font-size: 0.875rem;
|
|
62
|
+
color: var(--lyra-color-text);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
@media (prefers-reduced-motion: reduce) {
|
|
66
|
+
[part='box'] {
|
|
67
|
+
transition: none !important;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
`;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { type TemplateResult } from 'lit';
|
|
2
|
+
import { LyraElement } from '../../internal/lyra-element.js';
|
|
3
|
+
export interface ChipGroupOverflowToggleDetail {
|
|
4
|
+
expanded: boolean;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* `<lyra-chip-group>` — a flex-wrap container for a set of `<lyra-chip>`
|
|
8
|
+
* children (plain light-DOM composition — direct children are the chips,
|
|
9
|
+
* the same shape `<lyra-split>`'s panels / `<lyra-source-list>`'s cards
|
|
10
|
+
* take — no `.items` array prop).
|
|
11
|
+
*
|
|
12
|
+
* `max-visible` is entirely optional. When unset, every child is always
|
|
13
|
+
* shown and this component does nothing beyond flex-wrap layout. When set
|
|
14
|
+
* and the group has more chip children than that, the excess children are
|
|
15
|
+
* hidden (via their own `hidden` property — CSS alone can't parameterize
|
|
16
|
+
* `:nth-child` on a runtime prop, so this reaches into the light DOM the
|
|
17
|
+
* same way `<lyra-split>` sets each panel's inline `flex`/`order`) and a
|
|
18
|
+
* "+N" overflow-indicator pill takes their place. Clicking it is a toggle:
|
|
19
|
+
* it reveals the rest (and relabels itself "Show less"); clicking again
|
|
20
|
+
* re-collapses back to `max-visible`. `lyra-overflow-toggle` fires only from
|
|
21
|
+
* that click — i.e. only when `max-visible` is actually causing an overflow
|
|
22
|
+
* state — never as a side effect of `max-visible`/children changing on
|
|
23
|
+
* their own.
|
|
24
|
+
*
|
|
25
|
+
* @customElement lyra-chip-group
|
|
26
|
+
* @slot - `<lyra-chip>` elements (or any content, though the chip pairing is
|
|
27
|
+
* the intended usage).
|
|
28
|
+
* @event lyra-overflow-toggle - The overflow indicator was activated,
|
|
29
|
+
* revealing or re-collapsing the excess children. `detail: { expanded }`.
|
|
30
|
+
* @csspart base - The flex-wrap container (holds both the slot and the overflow indicator).
|
|
31
|
+
* @csspart overflow-indicator - The "+N" / "Show less" toggle button. Only rendered while `max-visible` is actively causing an overflow.
|
|
32
|
+
*/
|
|
33
|
+
export declare class LyraChipGroup extends LyraElement {
|
|
34
|
+
static styles: import("lit").CSSResultGroup[];
|
|
35
|
+
/** Maximum number of direct children shown before the rest collapse behind
|
|
36
|
+
* a "+N" indicator. Unset (the default) means no limit — every child is
|
|
37
|
+
* always shown. */
|
|
38
|
+
maxVisible?: number;
|
|
39
|
+
private childCount;
|
|
40
|
+
/** Whether the excess (beyond `max-visible`) children are currently
|
|
41
|
+
* revealed. Meaningless (and never rendered) while there's no overflow. */
|
|
42
|
+
private expanded;
|
|
43
|
+
protected willUpdate(): void;
|
|
44
|
+
firstUpdated(): void;
|
|
45
|
+
protected updated(): void;
|
|
46
|
+
private get hasOverflow();
|
|
47
|
+
private syncChildVisibility;
|
|
48
|
+
private onSlotChange;
|
|
49
|
+
private onToggleOverflow;
|
|
50
|
+
render(): TemplateResult;
|
|
51
|
+
}
|
|
52
|
+
declare global {
|
|
53
|
+
interface HTMLElementTagNameMap {
|
|
54
|
+
'lyra-chip-group': LyraChipGroup;
|
|
55
|
+
}
|
|
56
|
+
}
|