@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,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
|
+
}
|
|
@@ -0,0 +1,115 @@
|
|
|
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 { closeIcon } from '../../internal/icons.js';
|
|
12
|
+
import { styles } from './chip.styles.js';
|
|
13
|
+
/**
|
|
14
|
+
* `<lyra-chip>` — a small, content-agnostic pill for a short label: a tag, an
|
|
15
|
+
* active-filter/scope indicator, etc. Distinct from `<lyra-attachment-chip>`
|
|
16
|
+
* (specifically file-shaped, with a thumbnail/size/upload-progress) — this
|
|
17
|
+
* one carries no domain assumptions at all, just a label and an optional
|
|
18
|
+
* leading icon/dot.
|
|
19
|
+
*
|
|
20
|
+
* `tone` tints the whole pill using the same loud-color-on-quiet-tint
|
|
21
|
+
* convention `<lyra-tool-call-chip>`/`<lyra-citation-badge>` already
|
|
22
|
+
* establish for status coloring: background is the tone's `-quiet` tint,
|
|
23
|
+
* text/icon is the tone's loud color. `neutral` (the default) has no
|
|
24
|
+
* dedicated token pair of its own, so it falls back to a plain
|
|
25
|
+
* bordered-surface look — the same "no signal" treatment
|
|
26
|
+
* `<lyra-citation-badge>`'s `default` status and `<lyra-tool-call-chip>`'s
|
|
27
|
+
* `pending` status already use.
|
|
28
|
+
*
|
|
29
|
+
* This is a controlled component: clicking the remove (×) button only fires
|
|
30
|
+
* `lyra-remove` — the chip never removes itself from the DOM on its own
|
|
31
|
+
* interaction, the same contract `<lyra-attachment-chip>`/
|
|
32
|
+
* `<lyra-conversation-item>` already follow. A consumer owns the underlying
|
|
33
|
+
* list and decides whether/how the click actually removes anything.
|
|
34
|
+
*
|
|
35
|
+
* @customElement lyra-chip
|
|
36
|
+
* @slot - The chip's label content.
|
|
37
|
+
* @slot icon - Optional leading icon or status dot. Nothing is reserved for
|
|
38
|
+
* it (no extra gap) when left empty.
|
|
39
|
+
* @event lyra-remove - The remove (×) button was activated (click, or
|
|
40
|
+
* Enter/Space while focused — native `<button>` behavior). `detail: { value }`
|
|
41
|
+
* — `value` is `undefined` when the `value` prop was never set. Only
|
|
42
|
+
* rendered while `removable`.
|
|
43
|
+
* @csspart base - The pill's root container.
|
|
44
|
+
* @csspart icon - Wrapper around the `icon` slot. Hidden entirely while empty.
|
|
45
|
+
* @csspart label - Wrapper around the default slot.
|
|
46
|
+
* @csspart remove-button - The remove (×) affordance, only rendered while `removable`.
|
|
47
|
+
*/
|
|
48
|
+
export class LyraChip extends LyraElement {
|
|
49
|
+
constructor() {
|
|
50
|
+
super(...arguments);
|
|
51
|
+
/** Status/emphasis color. `neutral` (the default) reads as plain/unstyled. */
|
|
52
|
+
this.tone = 'neutral';
|
|
53
|
+
/** Shows the remove (×) button. */
|
|
54
|
+
this.removable = false;
|
|
55
|
+
// A `[part]` always contains a literal `<slot>` child regardless of
|
|
56
|
+
// assigned content, so `:empty` never matches — real emptiness is tracked
|
|
57
|
+
// in JS instead, the same fix `<lyra-stat>`'s `hasIcon`/
|
|
58
|
+
// `<lyra-tool-call-chip>`'s `hasDetailSlot` etc. already establish.
|
|
59
|
+
this.hasIconSlot = false;
|
|
60
|
+
this.onIconSlotChange = (e) => {
|
|
61
|
+
this.hasIconSlot = e.target.assignedElements({ flatten: true }).length > 0;
|
|
62
|
+
};
|
|
63
|
+
this.onRemoveClick = () => {
|
|
64
|
+
this.emit('lyra-remove', { value: this.value });
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
static { this.styles = [LyraElement.styles, styles]; }
|
|
68
|
+
willUpdate() {
|
|
69
|
+
if (!this.hasUpdated) {
|
|
70
|
+
this.hasIconSlot = Array.from(this.children).some((el) => el.getAttribute('slot') === 'icon');
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
// Only the default slot's own content counts toward the remove button's
|
|
74
|
+
// accessible name — text incidentally living inside the (decorative)
|
|
75
|
+
// `icon` slot shouldn't leak into "Remove {text}".
|
|
76
|
+
get labelText() {
|
|
77
|
+
return Array.from(this.childNodes)
|
|
78
|
+
.filter((n) => !(n instanceof Element && n.getAttribute('slot') === 'icon'))
|
|
79
|
+
.map((n) => n.textContent ?? '')
|
|
80
|
+
.join('')
|
|
81
|
+
.trim();
|
|
82
|
+
}
|
|
83
|
+
get accessibleRemoveLabel() {
|
|
84
|
+
const text = this.labelText;
|
|
85
|
+
return text ? `Remove ${text}` : 'Remove';
|
|
86
|
+
}
|
|
87
|
+
render() {
|
|
88
|
+
return html `
|
|
89
|
+
<span part="base">
|
|
90
|
+
<span part="icon" aria-hidden="true" ?hidden=${!this.hasIconSlot}>
|
|
91
|
+
<slot name="icon" @slotchange=${this.onIconSlotChange}></slot>
|
|
92
|
+
</span>
|
|
93
|
+
<span part="label"><slot></slot></span>
|
|
94
|
+
${this.removable
|
|
95
|
+
? html `<button part="remove-button" type="button" aria-label=${this.accessibleRemoveLabel} @click=${this.onRemoveClick}>
|
|
96
|
+
${closeIcon()}
|
|
97
|
+
</button>`
|
|
98
|
+
: nothing}
|
|
99
|
+
</span>
|
|
100
|
+
`;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
__decorate([
|
|
104
|
+
property({ reflect: true })
|
|
105
|
+
], LyraChip.prototype, "tone", void 0);
|
|
106
|
+
__decorate([
|
|
107
|
+
property({ type: Boolean, reflect: true })
|
|
108
|
+
], LyraChip.prototype, "removable", void 0);
|
|
109
|
+
__decorate([
|
|
110
|
+
property()
|
|
111
|
+
], LyraChip.prototype, "value", void 0);
|
|
112
|
+
__decorate([
|
|
113
|
+
state()
|
|
114
|
+
], LyraChip.prototype, "hasIconSlot", void 0);
|
|
115
|
+
defineElement('chip', LyraChip);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const styles: import("lit").CSSResult;
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { css } from 'lit';
|
|
2
|
+
export const styles = css `
|
|
3
|
+
:host {
|
|
4
|
+
display: inline-flex;
|
|
5
|
+
max-inline-size: 100%;
|
|
6
|
+
vertical-align: middle;
|
|
7
|
+
/* One custom-property trio swapped by the :host([tone]) rules below,
|
|
8
|
+
rather than repeating background/color/border per part per tone —
|
|
9
|
+
mirrors lyra-tool-call-chip's/lyra-attachment-chip's identical
|
|
10
|
+
-accent/-bg/-border trio so a chip's tone vocabulary reads the same
|
|
11
|
+
everywhere in the library. 'neutral' has no dedicated token pair (see
|
|
12
|
+
the class doc), so it falls back to plain surface/border/text instead
|
|
13
|
+
of inventing a sixth tint. */
|
|
14
|
+
--lyra-chip-accent: var(--lyra-color-text);
|
|
15
|
+
--lyra-chip-bg: var(--lyra-color-surface);
|
|
16
|
+
--lyra-chip-border: var(--lyra-color-border);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
:host([tone='brand']) {
|
|
20
|
+
--lyra-chip-accent: var(--lyra-color-brand);
|
|
21
|
+
--lyra-chip-bg: var(--lyra-color-brand-quiet);
|
|
22
|
+
--lyra-chip-border: transparent;
|
|
23
|
+
}
|
|
24
|
+
:host([tone='success']) {
|
|
25
|
+
--lyra-chip-accent: var(--lyra-color-success);
|
|
26
|
+
--lyra-chip-bg: var(--lyra-color-success-quiet);
|
|
27
|
+
--lyra-chip-border: transparent;
|
|
28
|
+
}
|
|
29
|
+
:host([tone='warning']) {
|
|
30
|
+
--lyra-chip-accent: var(--lyra-color-warning);
|
|
31
|
+
--lyra-chip-bg: var(--lyra-color-warning-quiet);
|
|
32
|
+
--lyra-chip-border: transparent;
|
|
33
|
+
}
|
|
34
|
+
:host([tone='danger']) {
|
|
35
|
+
--lyra-chip-accent: var(--lyra-color-danger);
|
|
36
|
+
--lyra-chip-bg: var(--lyra-color-danger-quiet);
|
|
37
|
+
--lyra-chip-border: transparent;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
[part='base'] {
|
|
41
|
+
display: inline-flex;
|
|
42
|
+
align-items: center;
|
|
43
|
+
gap: var(--lyra-space-xs);
|
|
44
|
+
max-inline-size: 100%;
|
|
45
|
+
box-sizing: border-box;
|
|
46
|
+
padding: 0.25rem var(--lyra-space-s);
|
|
47
|
+
border: 1px solid var(--lyra-chip-border);
|
|
48
|
+
border-radius: 999px;
|
|
49
|
+
background: var(--lyra-chip-bg);
|
|
50
|
+
color: var(--lyra-chip-accent);
|
|
51
|
+
font: inherit;
|
|
52
|
+
font-size: 0.8125rem;
|
|
53
|
+
font-weight: 500;
|
|
54
|
+
line-height: 1.3;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
[part='icon'] {
|
|
58
|
+
display: inline-flex;
|
|
59
|
+
flex: 0 0 auto;
|
|
60
|
+
align-items: center;
|
|
61
|
+
justify-content: center;
|
|
62
|
+
}
|
|
63
|
+
[part='icon'] ::slotted(*) {
|
|
64
|
+
display: block;
|
|
65
|
+
}
|
|
66
|
+
/* Defeats [part='icon']'s own 'display: inline-flex' above -- the native
|
|
67
|
+
[hidden] UA rule alone would lose to it at equal specificity. Same fix
|
|
68
|
+
lyra-stat's identical [part='icon'][hidden] override already applies. */
|
|
69
|
+
[part='icon'][hidden] {
|
|
70
|
+
display: none;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
[part='label'] {
|
|
74
|
+
flex: 1 1 auto;
|
|
75
|
+
min-inline-size: 0;
|
|
76
|
+
overflow: hidden;
|
|
77
|
+
text-overflow: ellipsis;
|
|
78
|
+
white-space: nowrap;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
[part='remove-button'] {
|
|
82
|
+
flex: 0 0 auto;
|
|
83
|
+
display: inline-flex;
|
|
84
|
+
align-items: center;
|
|
85
|
+
justify-content: center;
|
|
86
|
+
min-inline-size: min(var(--lyra-icon-button-size), 1.25rem);
|
|
87
|
+
min-block-size: min(var(--lyra-icon-button-size), 1.25rem);
|
|
88
|
+
margin-inline-end: -0.15rem;
|
|
89
|
+
padding: 0;
|
|
90
|
+
border: none;
|
|
91
|
+
border-radius: 999px;
|
|
92
|
+
background: transparent;
|
|
93
|
+
color: inherit;
|
|
94
|
+
font-size: 0.75em;
|
|
95
|
+
cursor: pointer;
|
|
96
|
+
-webkit-tap-highlight-color: transparent;
|
|
97
|
+
transition: background-color var(--lyra-transition-fast);
|
|
98
|
+
}
|
|
99
|
+
[part='remove-button']:hover {
|
|
100
|
+
background: color-mix(in srgb, currentColor 16%, transparent);
|
|
101
|
+
}
|
|
102
|
+
[part='remove-button']:focus-visible {
|
|
103
|
+
outline: var(--lyra-focus-ring-width) solid var(--lyra-focus-ring-color);
|
|
104
|
+
outline-offset: var(--lyra-focus-ring-offset);
|
|
105
|
+
}
|
|
106
|
+
[part='remove-button'] svg {
|
|
107
|
+
display: block;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
@media (prefers-reduced-motion: reduce) {
|
|
111
|
+
[part='remove-button'] {
|
|
112
|
+
transition: none !important;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
`;
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { type TemplateResult, type PropertyValues } from 'lit';
|
|
2
|
+
import { LyraElement } from '../../internal/lyra-element.js';
|
|
3
|
+
export type CitationBadgeStatus = 'default' | 'high' | 'medium' | 'low' | 'verified' | 'unverified';
|
|
4
|
+
export interface CitationActivateDetail {
|
|
5
|
+
sourceId: string;
|
|
6
|
+
index: number;
|
|
7
|
+
}
|
|
8
|
+
export interface CitationOpenDetail {
|
|
9
|
+
sourceId: string;
|
|
10
|
+
index: number;
|
|
11
|
+
href?: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* `<lyra-citation-badge>` — an inline `[n]` citation marker with a hover/
|
|
15
|
+
* focus preview popover and confidence/verification-status coloring. Used
|
|
16
|
+
* for an agent response's inline citations, each carrying a `source-id`
|
|
17
|
+
* that matches a corresponding `<lyra-source-card>` shown elsewhere on the
|
|
18
|
+
* page (a sibling component in this same family — this component doesn't
|
|
19
|
+
* import or know anything about it, only carries the id through its
|
|
20
|
+
* events).
|
|
21
|
+
*
|
|
22
|
+
* The default slot is *not* the badge's visible content — the badge always
|
|
23
|
+
* renders `[index]` — it's reserved for optional rich preview content (e.g.
|
|
24
|
+
* a filename + short excerpt) shown in a floating popover on hover/focus,
|
|
25
|
+
* positioned with `internal/positioner.js`'s `place()` the same way
|
|
26
|
+
* `<lyra-tool-call-chip>` positions its own detail tooltip. No popover shows
|
|
27
|
+
* at all when the slot carries no content, and the popover never traps
|
|
28
|
+
* focus — it's supplementary preview content, not a modal, so Tab continues
|
|
29
|
+
* past the badge normally even while it happens to be visible from a mouse
|
|
30
|
+
* hover.
|
|
31
|
+
*
|
|
32
|
+
* Two distinct signals fire from the same badge: `lyra-citation-activate`
|
|
33
|
+
* (click, or Enter while focused — native `<button>` behavior, no listener
|
|
34
|
+
* needed for the Enter case) is the lightweight "jump to this source"
|
|
35
|
+
* signal a host wires to scrolling/highlighting the matching
|
|
36
|
+
* `<lyra-source-card>`. `lyra-citation-open` (dblclick, or Space while
|
|
37
|
+
* focused) is a distinct "full preview" signal — `href` in its detail is
|
|
38
|
+
* `undefined` when the `href` prop isn't set; the consumer decides what
|
|
39
|
+
* "open" means (a new tab, a dialog, etc). A double-click still fires two
|
|
40
|
+
* `lyra-citation-activate` events (one per constituent click — standard
|
|
41
|
+
* browser `dblclick` behavior) in addition to the one `lyra-citation-open`;
|
|
42
|
+
* a consumer that only cares about the richer signal on a double-click
|
|
43
|
+
* should ignore the paired activate events in that case.
|
|
44
|
+
*
|
|
45
|
+
* Status coloring: `verified`/`high` use the success tones (a claim that's
|
|
46
|
+
* been checked out, or the model is confident in). `medium`/`low` use
|
|
47
|
+
* warning (progressively less certain, but still a real citation).
|
|
48
|
+
* `unverified` uses danger — deliberately distinct from `low`: "hasn't been
|
|
49
|
+
* checked at all" is a different (arguably riskier) claim than "checked but
|
|
50
|
+
* uncertain". `default` renders as plain neutral text with no background
|
|
51
|
+
* tint, for citations that carry no confidence/verification signal at all.
|
|
52
|
+
*
|
|
53
|
+
* @customElement lyra-citation-badge
|
|
54
|
+
* @slot - Rich preview/tooltip content (e.g. a filename + excerpt), shown in
|
|
55
|
+
* a floating popover on hover/focus. Nothing renders (no hover affordance at
|
|
56
|
+
* all) when this slot is empty.
|
|
57
|
+
* @event lyra-citation-activate - The badge was activated (click, or Enter
|
|
58
|
+
* while focused). `detail: { sourceId, index }`.
|
|
59
|
+
* @event lyra-citation-open - The badge's "full preview" affordance was
|
|
60
|
+
* triggered (dblclick, or Space while focused).
|
|
61
|
+
* `detail: { sourceId, index, href }`.
|
|
62
|
+
* @csspart base - The clickable badge (`<button>`).
|
|
63
|
+
* @csspart bracket - Each of the two literal `[`/`]` glyphs.
|
|
64
|
+
* @csspart index - The citation number.
|
|
65
|
+
* @csspart popover - The floating preview panel (only meaningful while open).
|
|
66
|
+
*/
|
|
67
|
+
export declare class LyraCitationBadge extends LyraElement {
|
|
68
|
+
static styles: import("lit").CSSResultGroup[];
|
|
69
|
+
/** The citation number shown, e.g. `3` renders as `[3]`. */
|
|
70
|
+
index: number;
|
|
71
|
+
/** Confidence/verification state — drives the badge's color and (unless
|
|
72
|
+
* `label` is set) part of its accessible name. */
|
|
73
|
+
status: CitationBadgeStatus;
|
|
74
|
+
/** Id of a corresponding `<lyra-source-card>` elsewhere on the page —
|
|
75
|
+
* echoed back verbatim in both events, never read or validated here. */
|
|
76
|
+
sourceId: string;
|
|
77
|
+
/** Optional direct link target for the citation's source. Carried into
|
|
78
|
+
* `lyra-citation-open`'s detail as-is; this component never navigates. */
|
|
79
|
+
href: string;
|
|
80
|
+
/** Overrides the computed accessible name (`"Citation {index}[, {status}]"`). */
|
|
81
|
+
label: string;
|
|
82
|
+
private hasPreviewSlot;
|
|
83
|
+
private popoverOpen;
|
|
84
|
+
private buttonEl?;
|
|
85
|
+
private popoverEl?;
|
|
86
|
+
private readonly popoverId;
|
|
87
|
+
private cleanupPositioner?;
|
|
88
|
+
private hideTimer?;
|
|
89
|
+
private hovering;
|
|
90
|
+
private focused;
|
|
91
|
+
protected willUpdate(): void;
|
|
92
|
+
protected updated(changed: PropertyValues): void;
|
|
93
|
+
disconnectedCallback(): void;
|
|
94
|
+
private get accessibleLabel();
|
|
95
|
+
private onSlotChange;
|
|
96
|
+
private showPreview;
|
|
97
|
+
private scheduleHidePreview;
|
|
98
|
+
private hidePreviewNow;
|
|
99
|
+
private onPointerEnter;
|
|
100
|
+
private onPointerLeave;
|
|
101
|
+
private onFocusIn;
|
|
102
|
+
private onFocusOut;
|
|
103
|
+
private onKeyDown;
|
|
104
|
+
private onClick;
|
|
105
|
+
private onDblClick;
|
|
106
|
+
private emitOpen;
|
|
107
|
+
render(): TemplateResult;
|
|
108
|
+
}
|
|
109
|
+
declare global {
|
|
110
|
+
interface HTMLElementTagNameMap {
|
|
111
|
+
'lyra-citation-badge': LyraCitationBadge;
|
|
112
|
+
}
|
|
113
|
+
}
|