@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,322 @@
|
|
|
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, svg } from 'lit';
|
|
8
|
+
import { property, state, query } from 'lit/decorators.js';
|
|
9
|
+
import { LyraElement } from '../../internal/lyra-element.js';
|
|
10
|
+
import { defineElement } from '../../internal/prefix.js';
|
|
11
|
+
import { styles } from './conversation-item.styles.js';
|
|
12
|
+
// Mirrors the shared icon set's viewBox/stroke conventions
|
|
13
|
+
// (internal/icons.ts's chevronIcon()/closeIcon()/etc.) without adding a
|
|
14
|
+
// pencil/edit glyph to that module -- it's off limits here -- so this
|
|
15
|
+
// one-off icon still reads as part of the same visual language as the rest
|
|
16
|
+
// of the library's inline icons. Same approach lyra-checkbox's own local
|
|
17
|
+
// checkmark/indeterminate glyphs and lyra-chat-message's local retryIcon()
|
|
18
|
+
// take for the identical reason.
|
|
19
|
+
const ICON_VIEW_BOX = '0 0 24 24';
|
|
20
|
+
const ICON_STROKE_WIDTH = '1.75';
|
|
21
|
+
function pencilIcon() {
|
|
22
|
+
return svg `
|
|
23
|
+
<svg
|
|
24
|
+
width="1em"
|
|
25
|
+
height="1em"
|
|
26
|
+
viewBox=${ICON_VIEW_BOX}
|
|
27
|
+
fill="none"
|
|
28
|
+
stroke="currentColor"
|
|
29
|
+
stroke-width=${ICON_STROKE_WIDTH}
|
|
30
|
+
stroke-linecap="round"
|
|
31
|
+
stroke-linejoin="round"
|
|
32
|
+
aria-hidden="true"
|
|
33
|
+
focusable="false"
|
|
34
|
+
><path d="M12 20h9"></path><path d="M16.5 3.5a2.121 2.121 0 0 1 3 3L7 19l-4 1 1-4Z"></path></svg>
|
|
35
|
+
`;
|
|
36
|
+
}
|
|
37
|
+
/** `Intl.DateTimeFormat`-based absolute formatter -- clock time ("3:45 PM")
|
|
38
|
+
* for a timestamp that falls on the same calendar day as `now`, otherwise a
|
|
39
|
+
* calendar date ("Jul 10", or "Jul 10, 2024" once it's not the current
|
|
40
|
+
* year). Deliberately not a fuzzy "2 hours ago" relative string -- bucketed
|
|
41
|
+
* relative time (grouping a whole history list into "Today"/"Yesterday"/
|
|
42
|
+
* "Last 7 days" sections) is a separate, later-phase concern at the list
|
|
43
|
+
* level, not this single row's job. `formatTimestamp` overrides this
|
|
44
|
+
* entirely, mirroring `<lyra-chat-message>`'s identical override hook. */
|
|
45
|
+
function defaultFormatTimestamp(date, now = new Date()) {
|
|
46
|
+
const sameDay = date.toDateString() === now.toDateString();
|
|
47
|
+
if (sameDay) {
|
|
48
|
+
return new Intl.DateTimeFormat(undefined, { hour: 'numeric', minute: '2-digit' }).format(date);
|
|
49
|
+
}
|
|
50
|
+
const sameYear = date.getFullYear() === now.getFullYear();
|
|
51
|
+
return new Intl.DateTimeFormat(undefined, sameYear ? { month: 'short', day: 'numeric' } : { month: 'short', day: 'numeric', year: 'numeric' }).format(date);
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* `<lyra-conversation-item>` — a selectable row representing one chat
|
|
55
|
+
* session in a history sidebar list. Usable standalone or as the
|
|
56
|
+
* `renderItem()` payload of a sibling virtualized-list component; this
|
|
57
|
+
* module has no dependency on that (or any) other component.
|
|
58
|
+
*
|
|
59
|
+
* Takes `title`/`excerpt`/`timestamp` as individual primitive props rather
|
|
60
|
+
* than one opaque bound object, deliberately consistent with how
|
|
61
|
+
* `<lyra-chat-message>` takes individual props instead of a single
|
|
62
|
+
* `.message` blob -- every other component in this family follows that
|
|
63
|
+
* shape, so this one does too even though a single bound `.session` object
|
|
64
|
+
* would also have been a reasonable design.
|
|
65
|
+
*
|
|
66
|
+
* Identifying *which* session a `lyra-select` click/keypress was about: this
|
|
67
|
+
* reuses the platform's own `id` attribute (every element already has one)
|
|
68
|
+
* rather than inventing a second, differently-named id-carrying prop --
|
|
69
|
+
* consumers already have the event's `target`/`currentTarget` (and thus
|
|
70
|
+
* `.id`), the same reasoning `<lyra-attachment-chip>` documents for its own
|
|
71
|
+
* identically-shaped choice. `lyra-select` therefore carries no detail
|
|
72
|
+
* payload at all.
|
|
73
|
+
*
|
|
74
|
+
* `role="option"` (not `"button"`) on `[part="option"]`, since this is meant
|
|
75
|
+
* to live inside a `role="listbox"` history list (that future list
|
|
76
|
+
* component supplies the listbox/group ancestor `role="option"` requires)
|
|
77
|
+
* rather than stand in for a single push-button action. Used truly
|
|
78
|
+
* standalone -- with no listbox/group ancestor -- it's still fully
|
|
79
|
+
* operable, just technically missing that ARIA parent context; wrap it in a
|
|
80
|
+
* `role="listbox"` (or `role="group"`) container to satisfy that when
|
|
81
|
+
* accessibility-auditing a standalone usage.
|
|
82
|
+
*
|
|
83
|
+
* `role="option"` (like native `<option>`/`role="button"`) forbids focusable
|
|
84
|
+
* descendants -- verified against axe-core's `nested-interactive` rule,
|
|
85
|
+
* which flags it. That's why the rename button and the `actions` slot are
|
|
86
|
+
* rendered as DOM *siblings* of `[part="option"]` (both inside
|
|
87
|
+
* `[part="base"]`) rather than nested inside it: `[part="option"]` only ever
|
|
88
|
+
* contains plain text/`<time>` content. The in-place rename `<input>` is the
|
|
89
|
+
* same problem one level deeper -- it replaces the title *inside*
|
|
90
|
+
* `[part="option"]` while renaming -- so `[part="option"]` sheds its
|
|
91
|
+
* `role`/`tabindex`/`aria-selected`/`aria-label` entirely for the duration
|
|
92
|
+
* of an edit. This isn't just an ARIA-compliance workaround: a row mid-edit
|
|
93
|
+
* genuinely isn't a selectable listbox choice at that moment, it's a text
|
|
94
|
+
* field, so suspending the option semantics is also the more accurate
|
|
95
|
+
* description of what's on screen.
|
|
96
|
+
*
|
|
97
|
+
* Inline rename is a dedicated pencil/edit icon button (not a double-click
|
|
98
|
+
* on the title) -- double-click has no keyboard/screen-reader equivalent
|
|
99
|
+
* and would silently swallow the row's own single-click `lyra-select`,
|
|
100
|
+
* whereas a button is independently focusable, has its own accessible name,
|
|
101
|
+
* and composes cleanly with click-to-select.
|
|
102
|
+
*
|
|
103
|
+
* @customElement lyra-conversation-item
|
|
104
|
+
* @slot actions - Overflow/icon-button controls (e.g. a future pin/delete
|
|
105
|
+
* button) rendered at the trailing edge of the row. `lyra-menu` doesn't
|
|
106
|
+
* exist yet in this phase, so this is a plain slot for whatever a consumer
|
|
107
|
+
* wants to put there today.
|
|
108
|
+
* @event lyra-select - The row was activated: a click on `[part="option"]`
|
|
109
|
+
* (i.e. outside the rename button and the `actions` slot), or Enter/Space
|
|
110
|
+
* while it's focused -- in both cases only while not currently renaming. No
|
|
111
|
+
* detail payload -- see the class doc's "Identifying which session" note.
|
|
112
|
+
* @event lyra-rename - An in-place rename was committed (Enter, or blur
|
|
113
|
+
* while editing). `detail: { title }`. Does not mutate `title` itself --
|
|
114
|
+
* this is a controlled component, the same convention
|
|
115
|
+
* `<lyra-chat-message>` follows by not clearing its own state on retry; the
|
|
116
|
+
* consumer applies the new title once it's actually persisted. Not fired
|
|
117
|
+
* when the trimmed draft is empty or unchanged from the original `title`
|
|
118
|
+
* (that's treated as an implicit cancel).
|
|
119
|
+
* @csspart base - The outer row wrapper (plain, no ARIA role) laying out `[part="option"]`, the rename button, and `actions`.
|
|
120
|
+
* @csspart option - The selectable region (`role="option"`, removed while renaming -- see the class doc). Wraps `content` and `timestamp`.
|
|
121
|
+
* @csspart content - Wrapper around the title and excerpt.
|
|
122
|
+
* @csspart title - The title text, shown while not renaming.
|
|
123
|
+
* @csspart title-input - The in-place rename `<input>`, shown only while renaming.
|
|
124
|
+
* @csspart rename-button - The pencil/edit affordance that starts a rename (only rendered while `editable` and not already renaming).
|
|
125
|
+
* @csspart excerpt - The last-message preview snippet. Only rendered when `excerpt` is non-empty.
|
|
126
|
+
* @csspart timestamp - The formatted `timestamp`, rendered in a `<time>` element. Only rendered when `timestamp` is set and valid.
|
|
127
|
+
* @csspart actions - The wrapper around the `actions` slot.
|
|
128
|
+
*/
|
|
129
|
+
export class LyraConversationItem extends LyraElement {
|
|
130
|
+
constructor() {
|
|
131
|
+
super(...arguments);
|
|
132
|
+
/** The session's display title. */
|
|
133
|
+
this.title = '';
|
|
134
|
+
/** A short preview snippet of the last message. Omit for no excerpt line. */
|
|
135
|
+
this.excerpt = '';
|
|
136
|
+
/** Whether this is the currently-selected/open session. Drives the
|
|
137
|
+
* brand-quiet background treatment. */
|
|
138
|
+
this.active = false;
|
|
139
|
+
/** Whether inline-rename is available at all. When `false`, the rename
|
|
140
|
+
* button never renders and the row can never enter its editing state. */
|
|
141
|
+
this.editable = true;
|
|
142
|
+
this.renaming = false;
|
|
143
|
+
this.draftTitle = '';
|
|
144
|
+
this.hasActionsSlot = false;
|
|
145
|
+
this.onOptionClick = () => {
|
|
146
|
+
// While renaming, `[part="option"]` has no role/selection semantics
|
|
147
|
+
// (see the class doc) -- a click inside it (e.g. to place the caret in
|
|
148
|
+
// the input) must not also select the row.
|
|
149
|
+
if (this.renaming)
|
|
150
|
+
return;
|
|
151
|
+
this.select();
|
|
152
|
+
};
|
|
153
|
+
this.onOptionKeyDown = (e) => {
|
|
154
|
+
if (this.renaming)
|
|
155
|
+
return;
|
|
156
|
+
if (e.key === 'Enter' || e.key === ' ' || e.key === 'Spacebar') {
|
|
157
|
+
// Space would otherwise scroll the page, same as lyra-checkbox/lyra-switch.
|
|
158
|
+
e.preventDefault();
|
|
159
|
+
this.select();
|
|
160
|
+
}
|
|
161
|
+
};
|
|
162
|
+
this.onRenameButtonClick = () => {
|
|
163
|
+
// No stopPropagation() needed here: the rename button is a DOM sibling
|
|
164
|
+
// of `[part="option"]` (see the class doc), not a descendant of it, so
|
|
165
|
+
// this click was never going to reach onOptionClick's listener anyway.
|
|
166
|
+
this.startRename();
|
|
167
|
+
};
|
|
168
|
+
this.onTitleInputChange = (e) => {
|
|
169
|
+
this.draftTitle = e.target.value;
|
|
170
|
+
};
|
|
171
|
+
this.onTitleInputKeyDown = (e) => {
|
|
172
|
+
// The input is a descendant of `[part="option"]` (unlike the rename
|
|
173
|
+
// button/actions slot, which are siblings of it) -- its keydown would
|
|
174
|
+
// otherwise bubble into onOptionKeyDown above. Stopping it here avoids a
|
|
175
|
+
// race where commitRename() (called below) has already flipped
|
|
176
|
+
// `renaming` back to `false` by the time that bubbled event reaches
|
|
177
|
+
// onOptionKeyDown's own `if (this.renaming) return;` guard, which would
|
|
178
|
+
// otherwise wrongly let the same Enter keystroke also fire lyra-select.
|
|
179
|
+
e.stopPropagation();
|
|
180
|
+
if (e.key === 'Enter') {
|
|
181
|
+
e.preventDefault();
|
|
182
|
+
this.commitRename();
|
|
183
|
+
}
|
|
184
|
+
else if (e.key === 'Escape') {
|
|
185
|
+
e.preventDefault();
|
|
186
|
+
this.cancelRename();
|
|
187
|
+
}
|
|
188
|
+
};
|
|
189
|
+
this.onTitleInputBlur = () => {
|
|
190
|
+
// If Escape already ended the edit synchronously (cancelRename() runs
|
|
191
|
+
// before this fires), `renaming` is already false by the time the
|
|
192
|
+
// now-removed input's blur event reaches here -- skip so Escape can't
|
|
193
|
+
// also commit.
|
|
194
|
+
if (!this.renaming)
|
|
195
|
+
return;
|
|
196
|
+
this.commitRename();
|
|
197
|
+
};
|
|
198
|
+
this.onActionsSlotChange = (e) => {
|
|
199
|
+
this.hasActionsSlot = e.target.assignedElements({ flatten: true }).length > 0;
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
static { this.styles = [LyraElement.styles, styles]; }
|
|
203
|
+
willUpdate() {
|
|
204
|
+
if (!this.hasUpdated) {
|
|
205
|
+
this.hasActionsSlot = Array.from(this.children).some((el) => el.getAttribute('slot') === 'actions');
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
updated(changed) {
|
|
209
|
+
if (changed.has('renaming') && this.renaming) {
|
|
210
|
+
// Runs after render, so the input already exists in the DOM.
|
|
211
|
+
this.titleInput?.focus();
|
|
212
|
+
this.titleInput?.select();
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
get normalizedTimestamp() {
|
|
216
|
+
if (this.timestamp === undefined)
|
|
217
|
+
return undefined;
|
|
218
|
+
const date = this.timestamp instanceof Date ? this.timestamp : new Date(this.timestamp);
|
|
219
|
+
return Number.isNaN(date.getTime()) ? undefined : date;
|
|
220
|
+
}
|
|
221
|
+
select() {
|
|
222
|
+
this.emit('lyra-select');
|
|
223
|
+
}
|
|
224
|
+
startRename() {
|
|
225
|
+
if (!this.editable || this.renaming)
|
|
226
|
+
return;
|
|
227
|
+
this.draftTitle = this.title;
|
|
228
|
+
this.renaming = true;
|
|
229
|
+
}
|
|
230
|
+
commitRename() {
|
|
231
|
+
this.renaming = false;
|
|
232
|
+
const next = this.draftTitle.trim();
|
|
233
|
+
// An empty or unchanged draft has nothing meaningful to commit -- treat
|
|
234
|
+
// it the same as Escape rather than firing a no-op (or blanking) rename
|
|
235
|
+
// for the consumer to deal with.
|
|
236
|
+
if (!next || next === this.title)
|
|
237
|
+
return;
|
|
238
|
+
this.emit('lyra-rename', { title: next });
|
|
239
|
+
}
|
|
240
|
+
cancelRename() {
|
|
241
|
+
this.renaming = false;
|
|
242
|
+
}
|
|
243
|
+
render() {
|
|
244
|
+
const ts = this.normalizedTimestamp;
|
|
245
|
+
const formatter = this.formatTimestamp ?? defaultFormatTimestamp;
|
|
246
|
+
const displayTitle = this.title || 'Untitled conversation';
|
|
247
|
+
const showRenameButton = this.editable && !this.renaming;
|
|
248
|
+
return html `
|
|
249
|
+
<div part="base">
|
|
250
|
+
<div
|
|
251
|
+
part="option"
|
|
252
|
+
role=${this.renaming ? nothing : 'option'}
|
|
253
|
+
tabindex=${this.renaming ? nothing : '0'}
|
|
254
|
+
aria-selected=${this.renaming ? nothing : this.active ? 'true' : 'false'}
|
|
255
|
+
aria-label=${this.renaming ? nothing : this.getAttribute('aria-label') || displayTitle}
|
|
256
|
+
@click=${this.onOptionClick}
|
|
257
|
+
@keydown=${this.onOptionKeyDown}
|
|
258
|
+
>
|
|
259
|
+
<div part="content">
|
|
260
|
+
${this.renaming
|
|
261
|
+
? html `<input
|
|
262
|
+
part="title-input"
|
|
263
|
+
type="text"
|
|
264
|
+
.value=${this.draftTitle}
|
|
265
|
+
aria-label="Rename conversation"
|
|
266
|
+
@input=${this.onTitleInputChange}
|
|
267
|
+
@keydown=${this.onTitleInputKeyDown}
|
|
268
|
+
@blur=${this.onTitleInputBlur}
|
|
269
|
+
/>`
|
|
270
|
+
: html `<span part="title" title=${displayTitle}>${displayTitle}</span>`}
|
|
271
|
+
${this.excerpt ? html `<span part="excerpt">${this.excerpt}</span>` : nothing}
|
|
272
|
+
</div>
|
|
273
|
+
${ts ? html `<time part="timestamp" datetime=${ts.toISOString()}>${formatter(ts)}</time>` : nothing}
|
|
274
|
+
</div>
|
|
275
|
+
${showRenameButton
|
|
276
|
+
? html `<button
|
|
277
|
+
part="rename-button"
|
|
278
|
+
type="button"
|
|
279
|
+
aria-label=${`Rename ${displayTitle}`}
|
|
280
|
+
@click=${this.onRenameButtonClick}
|
|
281
|
+
>
|
|
282
|
+
${pencilIcon()}
|
|
283
|
+
</button>`
|
|
284
|
+
: nothing}
|
|
285
|
+
<span part="actions" ?hidden=${!this.hasActionsSlot}>
|
|
286
|
+
<slot name="actions" @slotchange=${this.onActionsSlotChange}></slot>
|
|
287
|
+
</span>
|
|
288
|
+
</div>
|
|
289
|
+
`;
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
__decorate([
|
|
293
|
+
property()
|
|
294
|
+
], LyraConversationItem.prototype, "title", void 0);
|
|
295
|
+
__decorate([
|
|
296
|
+
property()
|
|
297
|
+
], LyraConversationItem.prototype, "excerpt", void 0);
|
|
298
|
+
__decorate([
|
|
299
|
+
property({ attribute: false })
|
|
300
|
+
], LyraConversationItem.prototype, "timestamp", void 0);
|
|
301
|
+
__decorate([
|
|
302
|
+
property({ attribute: false })
|
|
303
|
+
], LyraConversationItem.prototype, "formatTimestamp", void 0);
|
|
304
|
+
__decorate([
|
|
305
|
+
property({ type: Boolean, reflect: true })
|
|
306
|
+
], LyraConversationItem.prototype, "active", void 0);
|
|
307
|
+
__decorate([
|
|
308
|
+
property({ type: Boolean, reflect: true })
|
|
309
|
+
], LyraConversationItem.prototype, "editable", void 0);
|
|
310
|
+
__decorate([
|
|
311
|
+
state()
|
|
312
|
+
], LyraConversationItem.prototype, "renaming", void 0);
|
|
313
|
+
__decorate([
|
|
314
|
+
state()
|
|
315
|
+
], LyraConversationItem.prototype, "draftTitle", void 0);
|
|
316
|
+
__decorate([
|
|
317
|
+
state()
|
|
318
|
+
], LyraConversationItem.prototype, "hasActionsSlot", void 0);
|
|
319
|
+
__decorate([
|
|
320
|
+
query('[part="title-input"]')
|
|
321
|
+
], LyraConversationItem.prototype, "titleInput", void 0);
|
|
322
|
+
defineElement('conversation-item', LyraConversationItem);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const styles: import("lit").CSSResult;
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import { css } from 'lit';
|
|
2
|
+
export const styles = css `
|
|
3
|
+
:host {
|
|
4
|
+
display: block;
|
|
5
|
+
font-size: 0.875rem;
|
|
6
|
+
line-height: 1.4;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
/* [part='base'] is a plain layout wrapper (no ARIA role of its own) --
|
|
10
|
+
the interactive/selectable region is [part='option'] alone, kept free
|
|
11
|
+
of focusable descendants (see the class doc's nested-interactive note).
|
|
12
|
+
The row-level hover/active background treatments still live here so
|
|
13
|
+
hovering anywhere across the row -- including over the trailing
|
|
14
|
+
rename/actions controls -- highlights the whole thing as one row. */
|
|
15
|
+
[part='base'] {
|
|
16
|
+
display: flex;
|
|
17
|
+
align-items: flex-start;
|
|
18
|
+
gap: var(--lyra-space-xs);
|
|
19
|
+
padding: var(--lyra-space-s) var(--lyra-space-m);
|
|
20
|
+
border-radius: var(--lyra-radius);
|
|
21
|
+
transition: background-color var(--lyra-transition-fast);
|
|
22
|
+
}
|
|
23
|
+
:host(:hover) [part='base'] {
|
|
24
|
+
background: color-mix(in srgb, var(--lyra-color-text) 6%, transparent);
|
|
25
|
+
}
|
|
26
|
+
/* Placed after the :hover rule (equal selector specificity) so an
|
|
27
|
+
active-and-hovered row keeps the stronger active tint instead of the
|
|
28
|
+
two backgrounds visually competing. */
|
|
29
|
+
:host([active]) [part='base'] {
|
|
30
|
+
background: var(--lyra-color-brand-quiet);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/* text-quiet's contrast ratio against brand-quiet lands at ~4.25:1 --
|
|
34
|
+
just under the WCAG AA 4.5:1 floor for normal-size text -- even though
|
|
35
|
+
it comfortably passes against the plain (non-active) background used
|
|
36
|
+
the rest of the time. Same class of bug already hit and fixed in
|
|
37
|
+
lyra-attachment-chip's [part='size'] and lyra-chat-message's
|
|
38
|
+
[part='footer']; same fix, full-strength text color once active. */
|
|
39
|
+
:host([active]) [part='excerpt'],
|
|
40
|
+
:host([active]) [part='timestamp'] {
|
|
41
|
+
color: var(--lyra-color-text);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
[part='option'] {
|
|
45
|
+
display: flex;
|
|
46
|
+
align-items: flex-start;
|
|
47
|
+
gap: var(--lyra-space-s);
|
|
48
|
+
flex: 1 1 auto;
|
|
49
|
+
min-inline-size: 0;
|
|
50
|
+
cursor: pointer;
|
|
51
|
+
outline: none; /* the visible ring below targets [part='option'] directly */
|
|
52
|
+
-webkit-tap-highlight-color: transparent;
|
|
53
|
+
}
|
|
54
|
+
[part='option']:focus-visible {
|
|
55
|
+
outline: var(--lyra-focus-ring-width) solid var(--lyra-focus-ring-color);
|
|
56
|
+
outline-offset: var(--lyra-focus-ring-offset);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
[part='content'] {
|
|
60
|
+
flex: 1 1 auto;
|
|
61
|
+
min-inline-size: 0;
|
|
62
|
+
display: flex;
|
|
63
|
+
flex-direction: column;
|
|
64
|
+
gap: 0.125rem;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
[part='title'] {
|
|
68
|
+
display: block;
|
|
69
|
+
overflow: hidden;
|
|
70
|
+
text-overflow: ellipsis;
|
|
71
|
+
white-space: nowrap;
|
|
72
|
+
font-weight: 600;
|
|
73
|
+
color: var(--lyra-color-text);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
[part='title-input'] {
|
|
77
|
+
display: block;
|
|
78
|
+
inline-size: 100%;
|
|
79
|
+
box-sizing: border-box;
|
|
80
|
+
padding: 0.125rem var(--lyra-space-xs);
|
|
81
|
+
border: 1px solid var(--lyra-color-brand);
|
|
82
|
+
border-radius: calc(var(--lyra-radius) * 0.6);
|
|
83
|
+
background: var(--lyra-color-surface);
|
|
84
|
+
color: var(--lyra-color-text);
|
|
85
|
+
font: inherit;
|
|
86
|
+
font-weight: 600;
|
|
87
|
+
}
|
|
88
|
+
[part='title-input']:focus-visible {
|
|
89
|
+
outline: var(--lyra-focus-ring-width) solid var(--lyra-focus-ring-color);
|
|
90
|
+
outline-offset: var(--lyra-focus-ring-offset);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
[part='excerpt'] {
|
|
94
|
+
display: block;
|
|
95
|
+
overflow: hidden;
|
|
96
|
+
text-overflow: ellipsis;
|
|
97
|
+
white-space: nowrap;
|
|
98
|
+
color: var(--lyra-color-text-quiet);
|
|
99
|
+
font-size: 0.8125rem;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
[part='timestamp'] {
|
|
103
|
+
flex: 0 0 auto;
|
|
104
|
+
align-self: flex-start;
|
|
105
|
+
white-space: nowrap;
|
|
106
|
+
color: var(--lyra-color-text-quiet);
|
|
107
|
+
font-size: 0.75rem;
|
|
108
|
+
font-variant-numeric: tabular-nums;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
[part='rename-button'] {
|
|
112
|
+
flex: 0 0 auto;
|
|
113
|
+
display: inline-flex;
|
|
114
|
+
align-items: center;
|
|
115
|
+
justify-content: center;
|
|
116
|
+
min-inline-size: min(var(--lyra-icon-button-size), 1.75rem);
|
|
117
|
+
min-block-size: min(var(--lyra-icon-button-size), 1.75rem);
|
|
118
|
+
padding: 0;
|
|
119
|
+
border: none;
|
|
120
|
+
border-radius: calc(var(--lyra-radius) * 0.6);
|
|
121
|
+
background: transparent;
|
|
122
|
+
color: var(--lyra-color-text-quiet);
|
|
123
|
+
cursor: pointer;
|
|
124
|
+
-webkit-tap-highlight-color: transparent;
|
|
125
|
+
transition: background-color var(--lyra-transition-fast);
|
|
126
|
+
}
|
|
127
|
+
[part='rename-button']:hover {
|
|
128
|
+
background: color-mix(in srgb, var(--lyra-color-text) 8%, transparent);
|
|
129
|
+
color: var(--lyra-color-text);
|
|
130
|
+
}
|
|
131
|
+
[part='rename-button']:focus-visible {
|
|
132
|
+
outline: var(--lyra-focus-ring-width) solid var(--lyra-focus-ring-color);
|
|
133
|
+
outline-offset: var(--lyra-focus-ring-offset);
|
|
134
|
+
}
|
|
135
|
+
[part='rename-button'] svg {
|
|
136
|
+
display: block;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
[part='actions'] {
|
|
140
|
+
flex: 0 0 auto;
|
|
141
|
+
display: flex;
|
|
142
|
+
align-items: center;
|
|
143
|
+
gap: var(--lyra-space-xs);
|
|
144
|
+
}
|
|
145
|
+
[part='actions'][hidden] {
|
|
146
|
+
display: none;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
@media (prefers-reduced-motion: reduce) {
|
|
150
|
+
[part='base'],
|
|
151
|
+
[part='rename-button'] {
|
|
152
|
+
transition: none !important;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
`;
|
|
@@ -59,6 +59,30 @@ export declare class LyraDateInput extends LyraDateInput_base {
|
|
|
59
59
|
disconnectedCallback(): void;
|
|
60
60
|
protected updated(changed: PropertyValues): void;
|
|
61
61
|
private onInputChange;
|
|
62
|
+
/** Parses one date, ISO-first (so a calendar-invalid ISO string like
|
|
63
|
+
* "2026-02-30" is rejected rather than silently rolled over by Date.parse()).
|
|
64
|
+
* A 3-part, ambiguous slash/dot/dash-separated date (e.g. "15/07/2026") is
|
|
65
|
+
* parsed according to the locale's own day/month/year order (via a real
|
|
66
|
+
* Intl.DateTimeFormat sample, see localeDateOrder()) rather than
|
|
67
|
+
* Date.parse()'s implementation-defined heuristics -- this is what prevents
|
|
68
|
+
* e.g. an en-GB "15/07/2026" from being silently misread as some other day.
|
|
69
|
+
* A 4-digit first group (e.g. "2026-7-15") is never locale-guessed, though:
|
|
70
|
+
* it's unambiguously a year regardless of locale/separator (ISO's own
|
|
71
|
+
* year-first convention, just without zero-padding), so it's routed
|
|
72
|
+
* straight through parseISO() instead -- this is what lets a non-padded
|
|
73
|
+
* ISO-ish date keep parsing correctly (it did via Date.parse() before the
|
|
74
|
+
* ambiguous-date regex below existed at all).
|
|
75
|
+
* Anything else (e.g. "July 15, 2026") still falls through to Date.parse(). */
|
|
76
|
+
private parseOneDate;
|
|
77
|
+
private parseSingleText;
|
|
78
|
+
/** Only round-trips the exact `displayText` shape this component itself
|
|
79
|
+
* renders (`"<locale from> – <locale to>"`) — a raw ISO range typed
|
|
80
|
+
* directly (`"2026-05-01/2026-05-15"`) is also accepted as a convenience.
|
|
81
|
+
* A reversed typed range (`to` before `from`) is normalized into
|
|
82
|
+
* from-before-to order, matching what the date-picker's own UI-driven
|
|
83
|
+
* `commit()` already does for a UI-picked range. */
|
|
84
|
+
private parseRangeText;
|
|
85
|
+
private isWithinBounds;
|
|
62
86
|
private onInputKey;
|
|
63
87
|
private onFormControlKey;
|
|
64
88
|
private onInputBlur;
|