@aceshooting/lyra-ui 1.1.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 +12 -1
- package/custom-elements.json +21460 -8489
- 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 +12 -2
- package/dist/components/chart/chart.js +121 -14
- 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 +63 -0
- package/dist/components/chart/lite-chart.js +181 -23
- 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 +42 -5
- package/dist/components/flag/flag.js +70 -3
- 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 +89 -3
- package/dist/components/heatmap/heatmap.js +158 -29
- 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 +45 -1
- package/dist/components/select/select.js +114 -17
- package/dist/components/select/select.styles.js +26 -2
- 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 +22 -1
- package/dist/components/stat/stat.js +49 -3
- package/dist/components/stat/stat.styles.js +20 -0
- 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/widget/widget.d.ts +10 -0
- package/dist/components/widget/widget.js +24 -1
- package/dist/components/widget/widget.styles.js +9 -2
- 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 +4 -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 +3921 -32
- 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 -12
- package/dist/components/chart/lite-chart.stories.js +0 -98
- 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 -5
- package/dist/components/flag/flag.stories.js +0 -17
- 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 -22
- package/dist/components/heatmap/heatmap.stories.js +0 -154
- 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 -19
- package/dist/components/select/select.stories.js +0 -75
- 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 -8
- package/dist/components/stat/stat.stories.js +0 -64
- 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 -7
- package/dist/components/widget/widget.stories.js +0 -41
- 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,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
|
+
}
|
|
@@ -0,0 +1,124 @@
|
|
|
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, 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 './chip-group.styles.js';
|
|
12
|
+
/**
|
|
13
|
+
* `<lyra-chip-group>` — a flex-wrap container for a set of `<lyra-chip>`
|
|
14
|
+
* children (plain light-DOM composition — direct children are the chips,
|
|
15
|
+
* the same shape `<lyra-split>`'s panels / `<lyra-source-list>`'s cards
|
|
16
|
+
* take — no `.items` array prop).
|
|
17
|
+
*
|
|
18
|
+
* `max-visible` is entirely optional. When unset, every child is always
|
|
19
|
+
* shown and this component does nothing beyond flex-wrap layout. When set
|
|
20
|
+
* and the group has more chip children than that, the excess children are
|
|
21
|
+
* hidden (via their own `hidden` property — CSS alone can't parameterize
|
|
22
|
+
* `:nth-child` on a runtime prop, so this reaches into the light DOM the
|
|
23
|
+
* same way `<lyra-split>` sets each panel's inline `flex`/`order`) and a
|
|
24
|
+
* "+N" overflow-indicator pill takes their place. Clicking it is a toggle:
|
|
25
|
+
* it reveals the rest (and relabels itself "Show less"); clicking again
|
|
26
|
+
* re-collapses back to `max-visible`. `lyra-overflow-toggle` fires only from
|
|
27
|
+
* that click — i.e. only when `max-visible` is actually causing an overflow
|
|
28
|
+
* state — never as a side effect of `max-visible`/children changing on
|
|
29
|
+
* their own.
|
|
30
|
+
*
|
|
31
|
+
* @customElement lyra-chip-group
|
|
32
|
+
* @slot - `<lyra-chip>` elements (or any content, though the chip pairing is
|
|
33
|
+
* the intended usage).
|
|
34
|
+
* @event lyra-overflow-toggle - The overflow indicator was activated,
|
|
35
|
+
* revealing or re-collapsing the excess children. `detail: { expanded }`.
|
|
36
|
+
* @csspart base - The flex-wrap container (holds both the slot and the overflow indicator).
|
|
37
|
+
* @csspart overflow-indicator - The "+N" / "Show less" toggle button. Only rendered while `max-visible` is actively causing an overflow.
|
|
38
|
+
*/
|
|
39
|
+
export class LyraChipGroup extends LyraElement {
|
|
40
|
+
constructor() {
|
|
41
|
+
super(...arguments);
|
|
42
|
+
// Tracks the default slot's assigned-element count, the same
|
|
43
|
+
// connectedCallback/willUpdate + slotchange convention `<lyra-split>`'s
|
|
44
|
+
// `panelCount`/`<lyra-source-list>`'s `slottedCount` already establish.
|
|
45
|
+
this.childCount = 0;
|
|
46
|
+
/** Whether the excess (beyond `max-visible`) children are currently
|
|
47
|
+
* revealed. Meaningless (and never rendered) while there's no overflow. */
|
|
48
|
+
this.expanded = false;
|
|
49
|
+
this.onSlotChange = (e) => {
|
|
50
|
+
this.childCount = e.target.assignedElements({ flatten: true }).length;
|
|
51
|
+
};
|
|
52
|
+
this.onToggleOverflow = () => {
|
|
53
|
+
this.expanded = !this.expanded;
|
|
54
|
+
this.emit('lyra-overflow-toggle', { expanded: this.expanded });
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
static { this.styles = [LyraElement.styles, styles]; }
|
|
58
|
+
willUpdate() {
|
|
59
|
+
if (!this.hasUpdated) {
|
|
60
|
+
this.childCount = this.children.length;
|
|
61
|
+
}
|
|
62
|
+
// max-visible/children can change out from under an already-expanded
|
|
63
|
+
// group (e.g. the consumer raises max-visible past the current count) —
|
|
64
|
+
// silently resync rather than leaving `expanded` stuck true with nothing
|
|
65
|
+
// left for it to mean. This never fires the event: only an actual click
|
|
66
|
+
// on the indicator does (see the class doc). Corrected here (not in
|
|
67
|
+
// `updated()`) so it folds into the update already in progress instead
|
|
68
|
+
// of scheduling a second one.
|
|
69
|
+
if (this.expanded && !this.hasOverflow)
|
|
70
|
+
this.expanded = false;
|
|
71
|
+
}
|
|
72
|
+
firstUpdated() {
|
|
73
|
+
// Fallback reconciliation for slot-forwarding / engines that don't fire
|
|
74
|
+
// `slotchange` for content present at parse time — same idiom as
|
|
75
|
+
// `<lyra-source-list>`'s identical `firstUpdated`.
|
|
76
|
+
const slot = this.shadowRoot.querySelector('slot');
|
|
77
|
+
this.childCount = slot.assignedElements({ flatten: true }).length;
|
|
78
|
+
this.syncChildVisibility();
|
|
79
|
+
}
|
|
80
|
+
updated() {
|
|
81
|
+
this.syncChildVisibility();
|
|
82
|
+
}
|
|
83
|
+
get hasOverflow() {
|
|
84
|
+
const max = this.maxVisible;
|
|
85
|
+
return max != null && Number.isFinite(max) && max >= 0 && this.childCount > max;
|
|
86
|
+
}
|
|
87
|
+
syncChildVisibility() {
|
|
88
|
+
const max = this.maxVisible;
|
|
89
|
+
const overflowing = this.hasOverflow;
|
|
90
|
+
Array.from(this.children).forEach((child, i) => {
|
|
91
|
+
child.hidden = overflowing && !this.expanded && i >= max;
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
render() {
|
|
95
|
+
const overflowing = this.hasOverflow;
|
|
96
|
+
const hiddenCount = overflowing ? this.childCount - this.maxVisible : 0;
|
|
97
|
+
return html `
|
|
98
|
+
<div part="base">
|
|
99
|
+
<slot @slotchange=${this.onSlotChange}></slot>
|
|
100
|
+
${overflowing
|
|
101
|
+
? html `<button
|
|
102
|
+
part="overflow-indicator"
|
|
103
|
+
type="button"
|
|
104
|
+
aria-expanded=${this.expanded ? 'true' : 'false'}
|
|
105
|
+
aria-label=${this.expanded ? 'Show less' : `Show ${hiddenCount} more`}
|
|
106
|
+
@click=${this.onToggleOverflow}
|
|
107
|
+
>
|
|
108
|
+
${this.expanded ? 'Show less' : `+${hiddenCount}`}
|
|
109
|
+
</button>`
|
|
110
|
+
: nothing}
|
|
111
|
+
</div>
|
|
112
|
+
`;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
__decorate([
|
|
116
|
+
property({ type: Number, attribute: 'max-visible' })
|
|
117
|
+
], LyraChipGroup.prototype, "maxVisible", void 0);
|
|
118
|
+
__decorate([
|
|
119
|
+
state()
|
|
120
|
+
], LyraChipGroup.prototype, "childCount", void 0);
|
|
121
|
+
__decorate([
|
|
122
|
+
state()
|
|
123
|
+
], LyraChipGroup.prototype, "expanded", void 0);
|
|
124
|
+
defineElement('chip-group', LyraChipGroup);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const styles: import("lit").CSSResult;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { css } from 'lit';
|
|
2
|
+
export const styles = css `
|
|
3
|
+
:host {
|
|
4
|
+
display: block;
|
|
5
|
+
}
|
|
6
|
+
[part='base'] {
|
|
7
|
+
display: flex;
|
|
8
|
+
flex-wrap: wrap;
|
|
9
|
+
align-items: center;
|
|
10
|
+
gap: var(--lyra-space-xs);
|
|
11
|
+
}
|
|
12
|
+
/* Deliberately its own local pill styling rather than instantiating a
|
|
13
|
+
real <lyra-chip> in the shadow DOM for this -- keeps the group's
|
|
14
|
+
rendering self-contained instead of depending on chip.ts's internal
|
|
15
|
+
shape, the same way this family's overlay-shaped components duplicate
|
|
16
|
+
rather than nest one another. */
|
|
17
|
+
[part='overflow-indicator'] {
|
|
18
|
+
display: inline-flex;
|
|
19
|
+
align-items: center;
|
|
20
|
+
box-sizing: border-box;
|
|
21
|
+
padding: 0.25rem var(--lyra-space-s);
|
|
22
|
+
border: 1px dashed var(--lyra-color-border);
|
|
23
|
+
border-radius: 999px;
|
|
24
|
+
background: var(--lyra-color-surface);
|
|
25
|
+
color: var(--lyra-color-text-quiet);
|
|
26
|
+
font: inherit;
|
|
27
|
+
font-size: 0.8125rem;
|
|
28
|
+
font-weight: 600;
|
|
29
|
+
line-height: 1.3;
|
|
30
|
+
cursor: pointer;
|
|
31
|
+
-webkit-tap-highlight-color: transparent;
|
|
32
|
+
transition:
|
|
33
|
+
background-color var(--lyra-transition-fast),
|
|
34
|
+
border-color var(--lyra-transition-fast),
|
|
35
|
+
color var(--lyra-transition-fast);
|
|
36
|
+
}
|
|
37
|
+
/* Dashed border marks it as a structural "more" affordance, distinct at a
|
|
38
|
+
glance from the solid-bordered real chips it sits alongside. */
|
|
39
|
+
[part='overflow-indicator']:hover {
|
|
40
|
+
border-color: var(--lyra-color-brand);
|
|
41
|
+
color: var(--lyra-color-text);
|
|
42
|
+
}
|
|
43
|
+
[part='overflow-indicator']:focus-visible {
|
|
44
|
+
outline: var(--lyra-focus-ring-width) solid var(--lyra-focus-ring-color);
|
|
45
|
+
outline-offset: var(--lyra-focus-ring-offset);
|
|
46
|
+
}
|
|
47
|
+
[part='overflow-indicator'][aria-expanded='true'] {
|
|
48
|
+
border-style: solid;
|
|
49
|
+
color: var(--lyra-color-text);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
@media (prefers-reduced-motion: reduce) {
|
|
53
|
+
[part='overflow-indicator'] {
|
|
54
|
+
transition: none !important;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
`;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { type TemplateResult } from 'lit';
|
|
2
|
+
import { LyraElement } from '../../internal/lyra-element.js';
|
|
3
|
+
export type ChipTone = 'neutral' | 'brand' | 'success' | 'warning' | 'danger';
|
|
4
|
+
export interface ChipRemoveDetail {
|
|
5
|
+
value?: string;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* `<lyra-chip>` — a small, content-agnostic pill for a short label: a tag, an
|
|
9
|
+
* active-filter/scope indicator, etc. Distinct from `<lyra-attachment-chip>`
|
|
10
|
+
* (specifically file-shaped, with a thumbnail/size/upload-progress) — this
|
|
11
|
+
* one carries no domain assumptions at all, just a label and an optional
|
|
12
|
+
* leading icon/dot.
|
|
13
|
+
*
|
|
14
|
+
* `tone` tints the whole pill using the same loud-color-on-quiet-tint
|
|
15
|
+
* convention `<lyra-tool-call-chip>`/`<lyra-citation-badge>` already
|
|
16
|
+
* establish for status coloring: background is the tone's `-quiet` tint,
|
|
17
|
+
* text/icon is the tone's loud color. `neutral` (the default) has no
|
|
18
|
+
* dedicated token pair of its own, so it falls back to a plain
|
|
19
|
+
* bordered-surface look — the same "no signal" treatment
|
|
20
|
+
* `<lyra-citation-badge>`'s `default` status and `<lyra-tool-call-chip>`'s
|
|
21
|
+
* `pending` status already use.
|
|
22
|
+
*
|
|
23
|
+
* This is a controlled component: clicking the remove (×) button only fires
|
|
24
|
+
* `lyra-remove` — the chip never removes itself from the DOM on its own
|
|
25
|
+
* interaction, the same contract `<lyra-attachment-chip>`/
|
|
26
|
+
* `<lyra-conversation-item>` already follow. A consumer owns the underlying
|
|
27
|
+
* list and decides whether/how the click actually removes anything.
|
|
28
|
+
*
|
|
29
|
+
* @customElement lyra-chip
|
|
30
|
+
* @slot - The chip's label content.
|
|
31
|
+
* @slot icon - Optional leading icon or status dot. Nothing is reserved for
|
|
32
|
+
* it (no extra gap) when left empty.
|
|
33
|
+
* @event lyra-remove - The remove (×) button was activated (click, or
|
|
34
|
+
* Enter/Space while focused — native `<button>` behavior). `detail: { value }`
|
|
35
|
+
* — `value` is `undefined` when the `value` prop was never set. Only
|
|
36
|
+
* rendered while `removable`.
|
|
37
|
+
* @csspart base - The pill's root container.
|
|
38
|
+
* @csspart icon - Wrapper around the `icon` slot. Hidden entirely while empty.
|
|
39
|
+
* @csspart label - Wrapper around the default slot.
|
|
40
|
+
* @csspart remove-button - The remove (×) affordance, only rendered while `removable`.
|
|
41
|
+
*/
|
|
42
|
+
export declare class LyraChip extends LyraElement {
|
|
43
|
+
static styles: import("lit").CSSResultGroup[];
|
|
44
|
+
/** Status/emphasis color. `neutral` (the default) reads as plain/unstyled. */
|
|
45
|
+
tone: ChipTone;
|
|
46
|
+
/** Shows the remove (×) button. */
|
|
47
|
+
removable: boolean;
|
|
48
|
+
/** Opaque consumer bookkeeping value — never read, validated, or rendered
|
|
49
|
+
* by this component itself, only ever echoed back verbatim (including
|
|
50
|
+
* `undefined` if never set) in `lyra-remove`'s detail. */
|
|
51
|
+
value?: string;
|
|
52
|
+
private hasIconSlot;
|
|
53
|
+
protected willUpdate(): void;
|
|
54
|
+
private onIconSlotChange;
|
|
55
|
+
private get labelText();
|
|
56
|
+
private get accessibleRemoveLabel();
|
|
57
|
+
private onRemoveClick;
|
|
58
|
+
render(): TemplateResult;
|
|
59
|
+
}
|
|
60
|
+
declare global {
|
|
61
|
+
interface HTMLElementTagNameMap {
|
|
62
|
+
'lyra-chip': LyraChip;
|
|
63
|
+
}
|
|
64
|
+
}
|