@aceshooting/lyra-ui 1.2.0 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +98 -14
- package/custom-elements.json +30279 -12124
- package/dist/components/app-rail/app-rail-item.d.ts +30 -0
- package/dist/components/app-rail/app-rail-item.js +68 -0
- package/dist/components/app-rail/app-rail-item.styles.d.ts +1 -0
- package/dist/components/app-rail/app-rail-item.styles.js +65 -0
- package/dist/components/app-rail/app-rail.d.ts +168 -0
- package/dist/components/app-rail/app-rail.js +419 -0
- package/dist/components/app-rail/app-rail.styles.d.ts +1 -0
- package/dist/components/app-rail/app-rail.styles.js +128 -0
- package/dist/components/attachment-chip/attachment-chip.d.ts +141 -0
- package/dist/components/attachment-chip/attachment-chip.js +356 -0
- package/dist/components/attachment-chip/attachment-chip.styles.d.ts +1 -0
- package/dist/components/attachment-chip/attachment-chip.styles.js +184 -0
- package/dist/components/attachment-trigger/attachment-trigger.d.ts +96 -0
- package/dist/components/attachment-trigger/attachment-trigger.js +270 -0
- package/dist/components/attachment-trigger/attachment-trigger.styles.d.ts +1 -0
- package/dist/components/attachment-trigger/attachment-trigger.styles.js +90 -0
- package/dist/components/chart/bar-chart.js +2 -18
- package/dist/components/chart/box-plot.d.ts +25 -1
- package/dist/components/chart/box-plot.js +147 -7
- package/dist/components/chart/box-plot.styles.js +13 -0
- package/dist/components/chart/bubble-chart.js +2 -18
- package/dist/components/chart/chart-loader.d.ts +44 -13
- package/dist/components/chart/chart-loader.js +65 -18
- package/dist/components/chart/chart.d.ts +55 -12
- package/dist/components/chart/chart.js +247 -49
- package/dist/components/chart/doughnut-chart.js +2 -18
- package/dist/components/chart/histogram-bin.d.ts +7 -1
- package/dist/components/chart/histogram-bin.js +32 -14
- package/dist/components/chart/histogram.js +8 -16
- package/dist/components/chart/line-chart.js +2 -18
- package/dist/components/chart/lite-chart.d.ts +134 -3
- package/dist/components/chart/lite-chart.js +382 -67
- package/dist/components/chart/lite-chart.styles.js +9 -0
- package/dist/components/chart/pie-chart.js +2 -18
- package/dist/components/chart/polar-area-chart.js +2 -18
- package/dist/components/chart/radar-chart.js +2 -18
- package/dist/components/chart/scatter-chart.js +2 -18
- package/dist/components/chat-composer/chat-composer.d.ts +133 -0
- package/dist/components/chat-composer/chat-composer.js +366 -0
- package/dist/components/chat-composer/chat-composer.styles.d.ts +1 -0
- package/dist/components/chat-composer/chat-composer.styles.js +145 -0
- package/dist/components/chat-message/chat-message.d.ts +141 -0
- package/dist/components/chat-message/chat-message.js +331 -0
- package/dist/components/chat-message/chat-message.styles.d.ts +1 -0
- package/dist/components/chat-message/chat-message.styles.js +203 -0
- package/dist/components/checkbox/checkbox.d.ts +117 -0
- package/dist/components/checkbox/checkbox.js +353 -0
- package/dist/components/checkbox/checkbox.styles.d.ts +1 -0
- package/dist/components/checkbox/checkbox.styles.js +77 -0
- package/dist/components/chip/chip-group.d.ts +56 -0
- package/dist/components/chip/chip-group.js +130 -0
- package/dist/components/chip/chip-group.styles.d.ts +1 -0
- package/dist/components/chip/chip-group.styles.js +57 -0
- package/dist/components/chip/chip.d.ts +64 -0
- package/dist/components/chip/chip.js +122 -0
- package/dist/components/chip/chip.styles.d.ts +1 -0
- package/dist/components/chip/chip.styles.js +115 -0
- package/dist/components/citation-badge/citation-badge.d.ts +113 -0
- package/dist/components/citation-badge/citation-badge.js +318 -0
- package/dist/components/citation-badge/citation-badge.styles.d.ts +1 -0
- package/dist/components/citation-badge/citation-badge.styles.js +96 -0
- package/dist/components/code-block/code-block.d.ts +127 -0
- package/dist/components/code-block/code-block.js +382 -0
- package/dist/components/code-block/code-block.styles.d.ts +1 -0
- package/dist/components/code-block/code-block.styles.js +187 -0
- package/dist/components/code-block/code-loader.d.ts +87 -0
- package/dist/components/code-block/code-loader.js +142 -0
- package/dist/components/combobox/combobox.d.ts +65 -6
- package/dist/components/combobox/combobox.js +258 -48
- package/dist/components/combobox/combobox.styles.js +3 -3
- package/dist/components/combobox/option.d.ts +5 -1
- package/dist/components/combobox/option.js +35 -0
- package/dist/components/context-meter/context-meter.d.ts +53 -0
- package/dist/components/context-meter/context-meter.js +159 -0
- package/dist/components/context-meter/context-meter.styles.d.ts +1 -0
- package/dist/components/context-meter/context-meter.styles.js +114 -0
- package/dist/components/conversation-item/conversation-item.d.ts +125 -0
- package/dist/components/conversation-item/conversation-item.js +331 -0
- package/dist/components/conversation-item/conversation-item.styles.d.ts +1 -0
- package/dist/components/conversation-item/conversation-item.styles.js +155 -0
- package/dist/components/date-picker/calendar-core.d.ts +24 -0
- package/dist/components/date-picker/calendar-core.js +51 -4
- package/dist/components/date-picker/date-input.d.ts +100 -9
- package/dist/components/date-picker/date-input.js +383 -66
- package/dist/components/date-picker/date-picker.d.ts +35 -4
- package/dist/components/date-picker/date-picker.js +171 -44
- package/dist/components/dialog/confirm.d.ts +40 -0
- package/dist/components/dialog/confirm.js +76 -0
- package/dist/components/dialog/dialog.d.ts +129 -0
- package/dist/components/dialog/dialog.js +288 -0
- package/dist/components/dialog/dialog.styles.d.ts +1 -0
- package/dist/components/dialog/dialog.styles.js +96 -0
- package/dist/components/dock-panel/dock-panel.d.ts +142 -0
- package/dist/components/dock-panel/dock-panel.js +359 -0
- package/dist/components/dock-panel/dock-panel.styles.d.ts +1 -0
- package/dist/components/dock-panel/dock-panel.styles.js +159 -0
- package/dist/components/document-preview/document-preview.d.ts +143 -0
- package/dist/components/document-preview/document-preview.js +388 -0
- package/dist/components/document-preview/document-preview.styles.d.ts +1 -0
- package/dist/components/document-preview/document-preview.styles.js +191 -0
- package/dist/components/empty/empty.d.ts +1 -2
- package/dist/components/empty/empty.js +18 -12
- package/dist/components/empty/empty.styles.js +0 -3
- package/dist/components/export-button/csv.js +1 -1
- package/dist/components/export-button/export-button.d.ts +12 -0
- package/dist/components/export-button/export-button.js +35 -5
- package/dist/components/export-button/export-button.styles.js +5 -1
- package/dist/components/file-input/accept.js +2 -0
- package/dist/components/file-input/file-input.d.ts +10 -1
- package/dist/components/file-input/file-input.js +36 -5
- package/dist/components/flag/flag.d.ts +29 -13
- package/dist/components/flag/flag.js +54 -14
- package/dist/components/flag/flag.styles.js +1 -1
- package/dist/components/flag/language-map.d.ts +4 -1
- package/dist/components/flag/language-map.js +6 -3
- package/dist/components/gauge/gauge.d.ts +10 -1
- package/dist/components/gauge/gauge.js +41 -13
- package/dist/components/generation-status/generation-status.d.ts +117 -0
- package/dist/components/generation-status/generation-status.js +327 -0
- package/dist/components/generation-status/generation-status.styles.d.ts +1 -0
- package/dist/components/generation-status/generation-status.styles.js +84 -0
- package/dist/components/graph/graph.d.ts +37 -3
- package/dist/components/graph/graph.js +132 -20
- package/dist/components/heatmap/calendar-grid.d.ts +19 -7
- package/dist/components/heatmap/calendar-grid.js +42 -18
- package/dist/components/heatmap/heatmap-scale.d.ts +11 -1
- package/dist/components/heatmap/heatmap-scale.js +14 -2
- package/dist/components/heatmap/heatmap.d.ts +227 -12
- package/dist/components/heatmap/heatmap.js +488 -93
- package/dist/components/json-viewer/json-viewer.d.ts +70 -0
- package/dist/components/json-viewer/json-viewer.js +361 -0
- package/dist/components/json-viewer/json-viewer.styles.d.ts +1 -0
- package/dist/components/json-viewer/json-viewer.styles.js +177 -0
- package/dist/components/kbd/kbd.d.ts +77 -0
- package/dist/components/kbd/kbd.js +231 -0
- package/dist/components/kbd/kbd.styles.d.ts +1 -0
- package/dist/components/kbd/kbd.styles.js +52 -0
- package/dist/components/live-region/live-region.d.ts +90 -0
- package/dist/components/live-region/live-region.js +189 -0
- package/dist/components/live-region/live-region.styles.d.ts +1 -0
- package/dist/components/live-region/live-region.styles.js +10 -0
- package/dist/components/map/map.d.ts +32 -7
- package/dist/components/map/map.js +133 -32
- package/dist/components/markdown/markdown-loader.d.ts +58 -0
- package/dist/components/markdown/markdown-loader.js +77 -0
- package/dist/components/markdown/markdown.d.ts +119 -0
- package/dist/components/markdown/markdown.js +389 -0
- package/dist/components/markdown/markdown.styles.d.ts +1 -0
- package/dist/components/markdown/markdown.styles.js +88 -0
- package/dist/components/media-card/media-card.d.ts +130 -0
- package/dist/components/media-card/media-card.js +273 -0
- package/dist/components/media-card/media-card.styles.d.ts +1 -0
- package/dist/components/media-card/media-card.styles.js +132 -0
- package/dist/components/mention-popover/mention-popover.d.ts +203 -0
- package/dist/components/mention-popover/mention-popover.js +493 -0
- package/dist/components/mention-popover/mention-popover.styles.d.ts +1 -0
- package/dist/components/mention-popover/mention-popover.styles.js +101 -0
- package/dist/components/menu/menu-item.d.ts +91 -0
- package/dist/components/menu/menu-item.js +206 -0
- package/dist/components/menu/menu-item.styles.d.ts +1 -0
- package/dist/components/menu/menu-item.styles.js +75 -0
- package/dist/components/menu/menu.d.ts +167 -0
- package/dist/components/menu/menu.js +461 -0
- package/dist/components/menu/menu.styles.d.ts +1 -0
- package/dist/components/menu/menu.styles.js +67 -0
- package/dist/components/model-select/model-select.d.ts +170 -0
- package/dist/components/model-select/model-select.js +588 -0
- package/dist/components/model-select/model-select.styles.d.ts +1 -0
- package/dist/components/model-select/model-select.styles.js +203 -0
- package/dist/components/model-settings-panel/model-settings-panel.d.ts +93 -0
- package/dist/components/model-settings-panel/model-settings-panel.js +209 -0
- package/dist/components/model-settings-panel/model-settings-panel.styles.d.ts +1 -0
- package/dist/components/model-settings-panel/model-settings-panel.styles.js +82 -0
- package/dist/components/playback/playback.d.ts +19 -3
- package/dist/components/playback/playback.js +109 -33
- package/dist/components/playback/playback.styles.js +6 -1
- package/dist/components/responsive-panel/responsive-panel.d.ts +163 -0
- package/dist/components/responsive-panel/responsive-panel.js +363 -0
- package/dist/components/responsive-panel/responsive-panel.styles.d.ts +1 -0
- package/dist/components/responsive-panel/responsive-panel.styles.js +103 -0
- package/dist/components/result-card/result-card.d.ts +50 -0
- package/dist/components/result-card/result-card.js +89 -0
- package/dist/components/result-card/result-card.styles.d.ts +1 -0
- package/dist/components/result-card/result-card.styles.js +49 -0
- package/dist/components/result-card/result-field.d.ts +36 -0
- package/dist/components/result-card/result-field.js +87 -0
- package/dist/components/result-card/result-field.styles.d.ts +1 -0
- package/dist/components/result-card/result-field.styles.js +32 -0
- package/dist/components/select/select.d.ts +84 -4
- package/dist/components/select/select.js +251 -36
- package/dist/components/skeleton/skeleton.d.ts +3 -0
- package/dist/components/skeleton/skeleton.js +7 -1
- package/dist/components/skeleton/skeleton.styles.js +5 -4
- package/dist/components/slider/slider.d.ts +141 -0
- package/dist/components/slider/slider.js +467 -0
- package/dist/components/slider/slider.styles.d.ts +1 -0
- package/dist/components/slider/slider.styles.js +87 -0
- package/dist/components/source-card/source-card.d.ts +104 -0
- package/dist/components/source-card/source-card.js +195 -0
- package/dist/components/source-card/source-card.styles.d.ts +1 -0
- package/dist/components/source-card/source-card.styles.js +69 -0
- package/dist/components/source-list/source-list.d.ts +63 -0
- package/dist/components/source-list/source-list.js +130 -0
- package/dist/components/source-list/source-list.styles.d.ts +1 -0
- package/dist/components/source-list/source-list.styles.js +59 -0
- package/dist/components/sparkline/sparkline.js +58 -20
- package/dist/components/split/split.d.ts +224 -5
- package/dist/components/split/split.js +617 -43
- package/dist/components/split/split.styles.js +47 -0
- package/dist/components/stat/stat.d.ts +15 -4
- package/dist/components/stat/stat.js +53 -12
- package/dist/components/stream-status/stream-status.d.ts +126 -0
- package/dist/components/stream-status/stream-status.js +292 -0
- package/dist/components/stream-status/stream-status.styles.d.ts +1 -0
- package/dist/components/stream-status/stream-status.styles.js +103 -0
- package/dist/components/streaming-text/streaming-text.d.ts +104 -0
- package/dist/components/streaming-text/streaming-text.js +224 -0
- package/dist/components/streaming-text/streaming-text.styles.d.ts +1 -0
- package/dist/components/streaming-text/streaming-text.styles.js +63 -0
- package/dist/components/switch/switch.d.ts +103 -0
- package/dist/components/switch/switch.js +250 -0
- package/dist/components/switch/switch.styles.d.ts +1 -0
- package/dist/components/switch/switch.styles.js +75 -0
- package/dist/components/table/table.d.ts +89 -5
- package/dist/components/table/table.js +243 -26
- package/dist/components/table/table.styles.js +6 -1
- package/dist/components/tabs/tabs.d.ts +74 -0
- package/dist/components/tabs/tabs.js +254 -0
- package/dist/components/tabs/tabs.styles.d.ts +1 -0
- package/dist/components/tabs/tabs.styles.js +74 -0
- package/dist/components/thinking-panel/thinking-panel.d.ts +123 -0
- package/dist/components/thinking-panel/thinking-panel.js +260 -0
- package/dist/components/thinking-panel/thinking-panel.styles.d.ts +1 -0
- package/dist/components/thinking-panel/thinking-panel.styles.js +123 -0
- package/dist/components/time-range/time-range.d.ts +59 -2
- package/dist/components/time-range/time-range.js +163 -67
- package/dist/components/toast/toast-item.d.ts +12 -2
- package/dist/components/toast/toast-item.js +106 -44
- package/dist/components/toast/toast-item.styles.js +59 -28
- package/dist/components/toast/toast.js +17 -5
- package/dist/components/toast/toaster.js +10 -1
- package/dist/components/tool-approval-dialog/tool-approval-dialog.d.ts +131 -0
- package/dist/components/tool-approval-dialog/tool-approval-dialog.js +329 -0
- package/dist/components/tool-approval-dialog/tool-approval-dialog.styles.d.ts +1 -0
- package/dist/components/tool-approval-dialog/tool-approval-dialog.styles.js +160 -0
- package/dist/components/tool-call-chip/tool-call-chip.d.ts +105 -0
- package/dist/components/tool-call-chip/tool-call-chip.js +349 -0
- package/dist/components/tool-call-chip/tool-call-chip.styles.d.ts +1 -0
- package/dist/components/tool-call-chip/tool-call-chip.styles.js +203 -0
- package/dist/components/tool-param-form/tool-param-form.d.ts +206 -0
- package/dist/components/tool-param-form/tool-param-form.js +610 -0
- package/dist/components/tool-param-form/tool-param-form.styles.d.ts +1 -0
- package/dist/components/tool-param-form/tool-param-form.styles.js +75 -0
- package/dist/components/tool-result-dialog/tool-result-dialog.d.ts +122 -0
- package/dist/components/tool-result-dialog/tool-result-dialog.js +358 -0
- package/dist/components/tool-result-dialog/tool-result-dialog.styles.d.ts +1 -0
- package/dist/components/tool-result-dialog/tool-result-dialog.styles.js +176 -0
- package/dist/components/tool-result-view/registry.d.ts +73 -0
- package/dist/components/tool-result-view/registry.js +89 -0
- package/dist/components/tool-result-view/tool-result-view.d.ts +58 -0
- package/dist/components/tool-result-view/tool-result-view.js +152 -0
- package/dist/components/tool-result-view/tool-result-view.styles.d.ts +1 -0
- package/dist/components/tool-result-view/tool-result-view.styles.js +13 -0
- package/dist/components/tool-select-dialog/tool-select-dialog.d.ts +151 -0
- package/dist/components/tool-select-dialog/tool-select-dialog.js +350 -0
- package/dist/components/tool-select-dialog/tool-select-dialog.styles.d.ts +1 -0
- package/dist/components/tool-select-dialog/tool-select-dialog.styles.js +191 -0
- package/dist/components/tree/tree-node.d.ts +15 -3
- package/dist/components/tree/tree-node.js +20 -7
- package/dist/components/tree/tree.d.ts +25 -10
- package/dist/components/tree/tree.js +39 -31
- package/dist/components/typing-indicator/typing-indicator.d.ts +70 -0
- package/dist/components/typing-indicator/typing-indicator.js +108 -0
- package/dist/components/typing-indicator/typing-indicator.styles.d.ts +1 -0
- package/dist/components/typing-indicator/typing-indicator.styles.js +132 -0
- package/dist/components/virtual-list/virtual-list.d.ts +210 -0
- package/dist/components/virtual-list/virtual-list.js +607 -0
- package/dist/components/virtual-list/virtual-list.styles.d.ts +1 -0
- package/dist/components/virtual-list/virtual-list.styles.js +56 -0
- package/dist/components/widget/widget.d.ts +5 -4
- package/dist/components/widget/widget.js +54 -120
- package/dist/components/widget/widget.styles.js +8 -2
- package/dist/components/word-cloud/word-cloud-layout.d.ts +7 -0
- package/dist/components/word-cloud/word-cloud-layout.js +29 -2
- package/dist/components/word-cloud/word-cloud.d.ts +28 -2
- package/dist/components/word-cloud/word-cloud.js +69 -19
- package/dist/components/word-cloud/word-cloud.styles.js +16 -3
- package/dist/internal/anchored-validity.d.ts +1 -0
- package/dist/internal/anchored-validity.js +86 -0
- package/dist/internal/announcer.d.ts +57 -0
- package/dist/internal/announcer.js +71 -0
- package/dist/internal/form-associated.d.ts +8 -0
- package/dist/internal/form-associated.js +98 -15
- package/dist/internal/group-by-recency.d.ts +50 -0
- package/dist/internal/group-by-recency.js +80 -0
- package/dist/internal/numbers.d.ts +12 -0
- package/dist/internal/numbers.js +26 -0
- package/dist/internal/overlay-manager.d.ts +51 -0
- package/dist/internal/overlay-manager.js +523 -0
- package/dist/internal/positioner.js +27 -3
- package/dist/internal/rtl.d.ts +23 -0
- package/dist/internal/rtl.js +28 -0
- package/dist/internal/safe-url.d.ts +12 -0
- package/dist/internal/safe-url.js +41 -0
- package/dist/internal/scroll-lock.d.ts +10 -5
- package/dist/internal/scroll-lock.js +30 -14
- package/dist/internal/tokens.styles.js +22 -10
- package/dist/lyra.d.ts +133 -31
- package/dist/lyra.js +96 -26
- package/llms-full.txt +4546 -183
- package/llms.txt +21 -5
- package/package.json +41 -6
- package/dist/components/chart/bar-chart.stories.d.ts +0 -5
- package/dist/components/chart/bar-chart.stories.js +0 -20
- package/dist/components/chart/box-plot.stories.d.ts +0 -5
- package/dist/components/chart/box-plot.stories.js +0 -29
- package/dist/components/chart/bubble-chart.stories.d.ts +0 -5
- package/dist/components/chart/bubble-chart.stories.js +0 -26
- package/dist/components/chart/chart.stories.d.ts +0 -32
- package/dist/components/chart/chart.stories.js +0 -141
- package/dist/components/chart/doughnut-chart.stories.d.ts +0 -5
- package/dist/components/chart/doughnut-chart.stories.js +0 -26
- package/dist/components/chart/histogram.stories.d.ts +0 -5
- package/dist/components/chart/histogram.stories.js +0 -17
- package/dist/components/chart/line-chart.stories.d.ts +0 -22
- package/dist/components/chart/line-chart.stories.js +0 -99
- package/dist/components/chart/lite-chart.stories.d.ts +0 -14
- package/dist/components/chart/lite-chart.stories.js +0 -114
- package/dist/components/chart/pie-chart.stories.d.ts +0 -5
- package/dist/components/chart/pie-chart.stories.js +0 -26
- package/dist/components/chart/polar-area-chart.stories.d.ts +0 -5
- package/dist/components/chart/polar-area-chart.stories.js +0 -20
- package/dist/components/chart/radar-chart.stories.d.ts +0 -5
- package/dist/components/chart/radar-chart.stories.js +0 -20
- package/dist/components/chart/scatter-chart.stories.d.ts +0 -5
- package/dist/components/chart/scatter-chart.stories.js +0 -31
- package/dist/components/combobox/combobox.stories.d.ts +0 -24
- package/dist/components/combobox/combobox.stories.js +0 -102
- package/dist/components/date-picker/date-input.stories.d.ts +0 -10
- package/dist/components/date-picker/date-input.stories.js +0 -48
- package/dist/components/date-picker/date-picker.stories.d.ts +0 -10
- package/dist/components/date-picker/date-picker.stories.js +0 -25
- package/dist/components/empty/empty.stories.d.ts +0 -7
- package/dist/components/empty/empty.stories.js +0 -34
- package/dist/components/export-button/export-button.stories.d.ts +0 -7
- package/dist/components/export-button/export-button.stories.js +0 -37
- package/dist/components/file-input/file-input.stories.d.ts +0 -7
- package/dist/components/file-input/file-input.stories.js +0 -19
- package/dist/components/flag/flag.stories.d.ts +0 -6
- package/dist/components/flag/flag.stories.js +0 -31
- package/dist/components/gauge/gauge.stories.d.ts +0 -8
- package/dist/components/gauge/gauge.stories.js +0 -19
- package/dist/components/graph/graph.stories.d.ts +0 -8
- package/dist/components/graph/graph.stories.js +0 -68
- package/dist/components/heatmap/heatmap.stories.d.ts +0 -27
- package/dist/components/heatmap/heatmap.stories.js +0 -179
- package/dist/components/map/map.stories.d.ts +0 -15
- package/dist/components/map/map.stories.js +0 -135
- package/dist/components/playback/playback.stories.d.ts +0 -7
- package/dist/components/playback/playback.stories.js +0 -16
- package/dist/components/select/select.stories.d.ts +0 -21
- package/dist/components/select/select.stories.js +0 -91
- package/dist/components/skeleton/skeleton.stories.d.ts +0 -5
- package/dist/components/skeleton/skeleton.stories.js +0 -16
- package/dist/components/sparkline/sparkline.stories.d.ts +0 -11
- package/dist/components/sparkline/sparkline.stories.js +0 -39
- package/dist/components/split/split.stories.d.ts +0 -7
- package/dist/components/split/split.stories.js +0 -36
- package/dist/components/stat/stat.stories.d.ts +0 -9
- package/dist/components/stat/stat.stories.js +0 -81
- package/dist/components/table/table.stories.d.ts +0 -12
- package/dist/components/table/table.stories.js +0 -67
- package/dist/components/time-range/time-range.stories.d.ts +0 -8
- package/dist/components/time-range/time-range.stories.js +0 -26
- package/dist/components/toast/toast.stories.d.ts +0 -8
- package/dist/components/toast/toast.stories.js +0 -72
- package/dist/components/tree/tree.stories.d.ts +0 -9
- package/dist/components/tree/tree.stories.js +0 -52
- package/dist/components/widget/widget.stories.d.ts +0 -9
- package/dist/components/widget/widget.stories.js +0 -74
- package/dist/components/word-cloud/word-cloud.stories.d.ts +0 -10
- package/dist/components/word-cloud/word-cloud.stories.js +0 -55
|
@@ -4,18 +4,48 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
4
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
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
|
-
import { html } from 'lit';
|
|
7
|
+
import { html, nothing, } from 'lit';
|
|
8
8
|
import { property, state } from 'lit/decorators.js';
|
|
9
9
|
import { LyraElement } from '../../internal/lyra-element.js';
|
|
10
10
|
import { FormAssociated } from '../../internal/form-associated.js';
|
|
11
|
+
import { SET_ANCHORED_VALIDITY } from '../../internal/anchored-validity.js';
|
|
11
12
|
import { defineElement } from '../../internal/prefix.js';
|
|
12
13
|
import { place } from '../../internal/positioner.js';
|
|
13
14
|
import { nextId } from '../../internal/a11y.js';
|
|
14
15
|
import { closeIcon, calendarIcon } from '../../internal/icons.js';
|
|
15
|
-
import {
|
|
16
|
+
import { composedContains, deepActiveElement } from '../../internal/overlay-manager.js';
|
|
17
|
+
import { dateTimeFormat, parseISO, formatISO, normalizeCalendarMonths, normalizeWeekdayFormat, } from './calendar-core.js';
|
|
16
18
|
import { styles } from './date-input.styles.js';
|
|
17
19
|
import { LyraDatePicker } from './date-picker.js';
|
|
18
20
|
import './date-picker.js';
|
|
21
|
+
/** Determines the locale's day/month/year field order from a real formatted
|
|
22
|
+
* sample (Jan 2, 2026 -- a date where day/month/year are all numerically
|
|
23
|
+
* distinguishable), instead of relying on Date.parse()'s implementation-defined
|
|
24
|
+
* (commonly mm/dd/yyyy-biased) heuristics for an ambiguous separated date. */
|
|
25
|
+
function localeDateOrder(locale) {
|
|
26
|
+
try {
|
|
27
|
+
const parts = new Intl.DateTimeFormat(locale || undefined, {
|
|
28
|
+
year: 'numeric',
|
|
29
|
+
month: '2-digit',
|
|
30
|
+
day: '2-digit',
|
|
31
|
+
}).formatToParts(new Date(2026, 0, 2));
|
|
32
|
+
const order = parts
|
|
33
|
+
.filter((p) => p.type === 'day' || p.type === 'month' || p.type === 'year')
|
|
34
|
+
.map((p) => p.type);
|
|
35
|
+
return order.length === 3 ? order : ['month', 'day', 'year'];
|
|
36
|
+
}
|
|
37
|
+
catch {
|
|
38
|
+
return ['month', 'day', 'year']; // Date.parse()'s own bias, as a last-resort fallback
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
const monthsConverter = {
|
|
42
|
+
fromAttribute: normalizeCalendarMonths,
|
|
43
|
+
toAttribute: normalizeCalendarMonths,
|
|
44
|
+
};
|
|
45
|
+
const weekdayFormatConverter = {
|
|
46
|
+
fromAttribute: normalizeWeekdayFormat,
|
|
47
|
+
toAttribute: normalizeWeekdayFormat,
|
|
48
|
+
};
|
|
19
49
|
/**
|
|
20
50
|
* `<lyra-date-input>` — a date field with an attached calendar popover.
|
|
21
51
|
* Mirrors the core `<wa-date-input>` API under `lyra-`. Value is ISO 8601
|
|
@@ -29,31 +59,52 @@ import './date-picker.js';
|
|
|
29
59
|
* @event change - Fired on committed date transitions.
|
|
30
60
|
* @event lyra-show / lyra-hide - Calendar popover lifecycle.
|
|
31
61
|
* @event lyra-clear - The clear button was used.
|
|
32
|
-
* @csspart form-control
|
|
62
|
+
* @csspart form-control - The outer form-control wrapper.
|
|
63
|
+
* @csspart form-control-label - The label wrapper.
|
|
64
|
+
* @csspart input-wrapper - The input and button wrapper.
|
|
65
|
+
* @csspart input - The text input.
|
|
66
|
+
* @csspart clear-button - The clear control.
|
|
67
|
+
* @csspart expand-button - The calendar popup toggle.
|
|
68
|
+
* @csspart expand-icon - The calendar icon.
|
|
69
|
+
* @csspart popup - The positioned calendar popup.
|
|
70
|
+
* @csspart date-picker - The nested date picker.
|
|
71
|
+
* @csspart hint - The hint message.
|
|
72
|
+
* @csspart error - The validation message.
|
|
33
73
|
* @slot label - Custom label content.
|
|
34
74
|
* @slot error - Custom error content.
|
|
35
75
|
* @slot hint - Custom hint content.
|
|
36
76
|
*/
|
|
37
77
|
export class LyraDateInput extends FormAssociated(LyraElement) {
|
|
78
|
+
static { this.styles = [LyraElement.styles, styles]; }
|
|
79
|
+
static { this.properties = {
|
|
80
|
+
mode: { noAccessor: true },
|
|
81
|
+
min: { noAccessor: true },
|
|
82
|
+
max: { noAccessor: true },
|
|
83
|
+
readonly: { type: Boolean, reflect: true, noAccessor: true },
|
|
84
|
+
disablePast: { type: Boolean, attribute: 'disable-past', noAccessor: true },
|
|
85
|
+
disableFuture: { type: Boolean, attribute: 'disable-future', noAccessor: true },
|
|
86
|
+
}; }
|
|
38
87
|
constructor() {
|
|
39
|
-
super(
|
|
40
|
-
this.mode = 'single';
|
|
41
|
-
this.min = '';
|
|
42
|
-
this.max = '';
|
|
43
|
-
this.readonly = false;
|
|
88
|
+
super();
|
|
44
89
|
this.open = false;
|
|
45
90
|
this.withClear = false;
|
|
46
91
|
this.label = '';
|
|
47
92
|
this.hint = '';
|
|
48
93
|
this.errorText = '';
|
|
49
94
|
this.placeholder = '';
|
|
95
|
+
this.accessibleLabel = null;
|
|
50
96
|
this.locale = '';
|
|
51
97
|
this.months = 1;
|
|
52
98
|
this.firstDayOfWeek = 'auto';
|
|
53
99
|
this.weekdayFormat = 'short';
|
|
54
|
-
this.disablePast = false;
|
|
55
|
-
this.disableFuture = false;
|
|
56
100
|
this.withOutsideDays = false;
|
|
101
|
+
/** Accessible label for the clear button. Override for a non-English `locale`. */
|
|
102
|
+
this.clearLabel = 'Clear';
|
|
103
|
+
/** Accessible label for the calendar-toggle button. Override for a non-English `locale`. */
|
|
104
|
+
this.openLabel = 'Open calendar';
|
|
105
|
+
/** Accessible name for the calendar popover dialog. Override for a non-English `locale`. */
|
|
106
|
+
this.dialogLabel = 'Choose date';
|
|
107
|
+
this.restorePopupFocusOnClose = false;
|
|
57
108
|
this.inputId = nextId('date-input');
|
|
58
109
|
this.popupId = nextId('date-popup');
|
|
59
110
|
// Set on the date input's first `blur`; gates the `data-invalid`
|
|
@@ -69,6 +120,13 @@ export class LyraDateInput extends FormAssociated(LyraElement) {
|
|
|
69
120
|
this.hasHintSlot = false;
|
|
70
121
|
this.hasErrorSlot = false;
|
|
71
122
|
this.hasLabelSlot = false;
|
|
123
|
+
this._mode = 'single';
|
|
124
|
+
this._min = '';
|
|
125
|
+
this._max = '';
|
|
126
|
+
this._readonly = false;
|
|
127
|
+
this._disablePast = false;
|
|
128
|
+
this._disableFuture = false;
|
|
129
|
+
this.typedBadInput = false;
|
|
72
130
|
this.onDocPointer = (e) => {
|
|
73
131
|
if (!e.composedPath().includes(this))
|
|
74
132
|
this.hide();
|
|
@@ -84,26 +142,20 @@ export class LyraDateInput extends FormAssociated(LyraElement) {
|
|
|
84
142
|
this.emit('change');
|
|
85
143
|
return;
|
|
86
144
|
}
|
|
87
|
-
|
|
88
|
-
// by parseISO alone: it validates calendar correctness (rejects e.g.
|
|
89
|
-
// "2026-02-30"), but Date.parse() doesn't -- falling through to it for an
|
|
90
|
-
// ISO-shaped string would silently resurrect the same rollover parseISO
|
|
91
|
-
// guards against (Date.parse('2026-02-30') also normalizes to March 2).
|
|
92
|
-
const looksLikeISO = /^\d{4}-\d{2}-\d{2}$/.test(raw);
|
|
93
|
-
const parsed = looksLikeISO ? parseISO(raw) : isNaN(Date.parse(raw)) ? null : new Date(Date.parse(raw));
|
|
145
|
+
const parsed = this.mode === 'range' ? this.parseRangeText(raw) : this.parseSingleText(raw);
|
|
94
146
|
if (parsed) {
|
|
95
|
-
this.value =
|
|
147
|
+
this.value = parsed;
|
|
96
148
|
this.emit('input');
|
|
97
149
|
this.emit('change');
|
|
98
150
|
}
|
|
99
151
|
else {
|
|
100
152
|
// Unparseable text: don't silently keep the committed value while the
|
|
101
|
-
// field still shows garbage -- revert the
|
|
102
|
-
//
|
|
103
|
-
//
|
|
104
|
-
// form-associated.ts).
|
|
153
|
+
// field still shows garbage -- revert the display to the last commit
|
|
154
|
+
// and flag bad input. Parseable dates outside an active bound instead
|
|
155
|
+
// commit above and expose their precise range validity state.
|
|
105
156
|
target.value = this.displayText;
|
|
106
|
-
this.
|
|
157
|
+
this.setTypedBadInput(true);
|
|
158
|
+
this.updateValidity();
|
|
107
159
|
}
|
|
108
160
|
};
|
|
109
161
|
this.onInputKey = (e) => {
|
|
@@ -119,8 +171,7 @@ export class LyraDateInput extends FormAssociated(LyraElement) {
|
|
|
119
171
|
this.onFormControlKey = (e) => {
|
|
120
172
|
if (e.key === 'Escape' && this.open) {
|
|
121
173
|
e.preventDefault();
|
|
122
|
-
this.hide();
|
|
123
|
-
this.renderRoot.querySelector('[part="expand-button"]')?.focus();
|
|
174
|
+
this.hide(true);
|
|
124
175
|
}
|
|
125
176
|
};
|
|
126
177
|
this.onInputBlur = () => {
|
|
@@ -153,44 +204,216 @@ export class LyraDateInput extends FormAssociated(LyraElement) {
|
|
|
153
204
|
// The picker only fires `change` once a selection is finalized (a single
|
|
154
205
|
// pick, or the second click of a range), so this is always the right
|
|
155
206
|
// moment to close, in either mode.
|
|
156
|
-
this.hide();
|
|
207
|
+
this.hide(true);
|
|
157
208
|
};
|
|
209
|
+
this.addEventListener('invalid', () => {
|
|
210
|
+
this.touched = true;
|
|
211
|
+
});
|
|
212
|
+
}
|
|
213
|
+
get mode() {
|
|
214
|
+
return this._mode;
|
|
215
|
+
}
|
|
216
|
+
set mode(next) {
|
|
217
|
+
const old = this._mode;
|
|
218
|
+
this._mode = next === 'range' ? 'range' : 'single';
|
|
219
|
+
this.updateValidity();
|
|
220
|
+
this.requestUpdate('mode', old);
|
|
221
|
+
}
|
|
222
|
+
get min() {
|
|
223
|
+
return this._min;
|
|
224
|
+
}
|
|
225
|
+
set min(next) {
|
|
226
|
+
const old = this._min;
|
|
227
|
+
this._min = next ?? '';
|
|
228
|
+
this.updateValidity();
|
|
229
|
+
this.requestUpdate('min', old);
|
|
230
|
+
}
|
|
231
|
+
get max() {
|
|
232
|
+
return this._max;
|
|
233
|
+
}
|
|
234
|
+
set max(next) {
|
|
235
|
+
const old = this._max;
|
|
236
|
+
this._max = next ?? '';
|
|
237
|
+
this.updateValidity();
|
|
238
|
+
this.requestUpdate('max', old);
|
|
239
|
+
}
|
|
240
|
+
get readonly() {
|
|
241
|
+
return this._readonly;
|
|
242
|
+
}
|
|
243
|
+
set readonly(next) {
|
|
244
|
+
const old = this._readonly;
|
|
245
|
+
this._readonly = Boolean(next);
|
|
246
|
+
this.toggleAttribute('readonly', this._readonly);
|
|
247
|
+
this.updateValidity();
|
|
248
|
+
this.requestUpdate('readonly', old);
|
|
249
|
+
}
|
|
250
|
+
get disablePast() {
|
|
251
|
+
return this._disablePast;
|
|
252
|
+
}
|
|
253
|
+
set disablePast(next) {
|
|
254
|
+
const old = this._disablePast;
|
|
255
|
+
this._disablePast = Boolean(next);
|
|
256
|
+
this.updateValidity();
|
|
257
|
+
this.requestUpdate('disablePast', old);
|
|
258
|
+
}
|
|
259
|
+
get disableFuture() {
|
|
260
|
+
return this._disableFuture;
|
|
261
|
+
}
|
|
262
|
+
set disableFuture(next) {
|
|
263
|
+
const old = this._disableFuture;
|
|
264
|
+
this._disableFuture = Boolean(next);
|
|
265
|
+
this.updateValidity();
|
|
266
|
+
this.requestUpdate('disableFuture', old);
|
|
267
|
+
}
|
|
268
|
+
get value() {
|
|
269
|
+
return super.value;
|
|
270
|
+
}
|
|
271
|
+
set value(next) {
|
|
272
|
+
this.setTypedBadInput(false);
|
|
273
|
+
super.value = this.normalizeCommittedValue(next ?? '');
|
|
274
|
+
}
|
|
275
|
+
setTypedBadInput(next) {
|
|
276
|
+
const old = this.typedBadInput;
|
|
277
|
+
this.typedBadInput = next;
|
|
278
|
+
if (old !== next)
|
|
279
|
+
this.requestUpdate('typedBadInput', old);
|
|
280
|
+
}
|
|
281
|
+
parseStrictISO(value) {
|
|
282
|
+
if (!/^\d{4}-\d{2}-\d{2}$/.test(value))
|
|
283
|
+
return null;
|
|
284
|
+
return parseISO(value);
|
|
285
|
+
}
|
|
286
|
+
normalizeCommittedValue(value) {
|
|
287
|
+
if (value === '')
|
|
288
|
+
return '';
|
|
289
|
+
const parts = value.split('/');
|
|
290
|
+
if (parts.length !== 1 && parts.length !== 2)
|
|
291
|
+
return '';
|
|
292
|
+
const dates = parts.map((part) => this.parseStrictISO(part));
|
|
293
|
+
if (dates.some((date) => date === null))
|
|
294
|
+
return '';
|
|
295
|
+
if (parts.length === 2 && dates[0] > dates[1])
|
|
296
|
+
return `${parts[1]}/${parts[0]}`;
|
|
297
|
+
return value;
|
|
298
|
+
}
|
|
299
|
+
valueDates(value) {
|
|
300
|
+
const parts = value.split('/');
|
|
301
|
+
const expectedParts = this.mode === 'range' ? 2 : 1;
|
|
302
|
+
if (parts.length !== expectedParts)
|
|
303
|
+
return null;
|
|
304
|
+
const dates = parts.map((part) => this.parseStrictISO(part));
|
|
305
|
+
return dates.some((date) => date === null) ? null : dates;
|
|
306
|
+
}
|
|
307
|
+
updateValidity() {
|
|
308
|
+
if (this.readonly) {
|
|
309
|
+
this[SET_ANCHORED_VALIDITY]({});
|
|
310
|
+
return;
|
|
311
|
+
}
|
|
312
|
+
const flags = {};
|
|
313
|
+
let underflowMessage = '';
|
|
314
|
+
let overflowMessage = '';
|
|
315
|
+
if (this.required && this.value === '')
|
|
316
|
+
flags.valueMissing = true;
|
|
317
|
+
if (this.typedBadInput)
|
|
318
|
+
flags.badInput = true;
|
|
319
|
+
if (this.value !== '') {
|
|
320
|
+
const dates = this.valueDates(this.value);
|
|
321
|
+
if (!dates) {
|
|
322
|
+
flags.badInput = true;
|
|
323
|
+
}
|
|
324
|
+
else {
|
|
325
|
+
const min = this.parseStrictISO(this.min);
|
|
326
|
+
const max = this.parseStrictISO(this.max);
|
|
327
|
+
const today = new Date();
|
|
328
|
+
today.setHours(0, 0, 0, 0);
|
|
329
|
+
if (min !== null && dates.some((date) => date < min)) {
|
|
330
|
+
flags.rangeUnderflow = true;
|
|
331
|
+
underflowMessage = `Date must be on or after ${this.min}.`;
|
|
332
|
+
}
|
|
333
|
+
if (this.disablePast && dates.some((date) => date < today)) {
|
|
334
|
+
flags.rangeUnderflow = true;
|
|
335
|
+
underflowMessage ||= 'Date cannot be in the past.';
|
|
336
|
+
}
|
|
337
|
+
if (max !== null && dates.some((date) => date > max)) {
|
|
338
|
+
flags.rangeOverflow = true;
|
|
339
|
+
overflowMessage = `Date must be on or before ${this.max}.`;
|
|
340
|
+
}
|
|
341
|
+
if (this.disableFuture && dates.some((date) => date > today)) {
|
|
342
|
+
flags.rangeOverflow = true;
|
|
343
|
+
overflowMessage ||= 'Date cannot be in the future.';
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
let message = '';
|
|
348
|
+
if (flags.badInput)
|
|
349
|
+
message = 'Enter a valid date.';
|
|
350
|
+
else if (flags.rangeUnderflow)
|
|
351
|
+
message = underflowMessage;
|
|
352
|
+
else if (flags.rangeOverflow)
|
|
353
|
+
message = overflowMessage;
|
|
354
|
+
else if (flags.valueMissing)
|
|
355
|
+
message = 'Please fill out this field.';
|
|
356
|
+
this[SET_ANCHORED_VALIDITY](flags, message);
|
|
158
357
|
}
|
|
159
|
-
static { this.styles = [LyraElement.styles, styles]; }
|
|
160
358
|
get displayText() {
|
|
161
359
|
const parts = this.value.split('/');
|
|
162
360
|
const from = parseISO(parts[0] ?? '');
|
|
163
361
|
const to = parseISO(parts[1] ?? '');
|
|
164
362
|
if (!from)
|
|
165
363
|
return '';
|
|
166
|
-
const
|
|
364
|
+
const formatter = dateTimeFormat(this.locale, {});
|
|
365
|
+
const fmt = (d) => formatter.format(d);
|
|
167
366
|
return this.mode === 'range' && to ? `${fmt(from)} – ${fmt(to)}` : fmt(from);
|
|
168
367
|
}
|
|
169
|
-
willUpdate() {
|
|
368
|
+
willUpdate(changed) {
|
|
170
369
|
if (!this.hasUpdated) {
|
|
171
370
|
this.hasHintSlot = Array.from(this.children).some((el) => el.getAttribute('slot') === 'hint');
|
|
172
371
|
this.hasErrorSlot = Array.from(this.children).some((el) => el.getAttribute('slot') === 'error');
|
|
173
372
|
this.hasLabelSlot = Array.from(this.children).some((el) => el.getAttribute('slot') === 'label');
|
|
174
373
|
}
|
|
374
|
+
if (changed.has('open')) {
|
|
375
|
+
if (this.open) {
|
|
376
|
+
if (!this.popupTrigger) {
|
|
377
|
+
const active = deepActiveElement(this.ownerDocument);
|
|
378
|
+
this.popupTrigger = active && typeof active.focus === 'function' ? active : undefined;
|
|
379
|
+
}
|
|
380
|
+
this.ownerDocument.addEventListener('pointerdown', this.onDocPointer);
|
|
381
|
+
}
|
|
382
|
+
else {
|
|
383
|
+
this.ownerDocument.removeEventListener('pointerdown', this.onDocPointer);
|
|
384
|
+
const active = deepActiveElement(this.ownerDocument);
|
|
385
|
+
const popup = this.renderRoot.querySelector('[part="popup"]');
|
|
386
|
+
const restoreFocus = this.restorePopupFocusOnClose || (popup !== null && composedContains(popup, active));
|
|
387
|
+
const trigger = this.popupTrigger;
|
|
388
|
+
this.popupTrigger = undefined;
|
|
389
|
+
this.restorePopupFocusOnClose = false;
|
|
390
|
+
if (restoreFocus && trigger?.isConnected)
|
|
391
|
+
trigger.focus();
|
|
392
|
+
}
|
|
393
|
+
}
|
|
175
394
|
}
|
|
176
395
|
/** Open the calendar popover. */
|
|
177
396
|
show() {
|
|
178
|
-
if (this.open || this.
|
|
397
|
+
if (this.open || this.effectiveDisabled || this.readonly)
|
|
179
398
|
return;
|
|
180
399
|
this.open = true;
|
|
181
400
|
this.emit('lyra-show');
|
|
182
|
-
document.addEventListener('pointerdown', this.onDocPointer);
|
|
183
401
|
}
|
|
184
402
|
/** Close the calendar popover. */
|
|
185
|
-
hide() {
|
|
403
|
+
hide(restoreFocus = false) {
|
|
186
404
|
if (!this.open)
|
|
187
405
|
return;
|
|
406
|
+
this.restorePopupFocusOnClose ||= restoreFocus;
|
|
188
407
|
this.open = false;
|
|
189
408
|
this.emit('lyra-hide');
|
|
190
|
-
document.removeEventListener('pointerdown', this.onDocPointer);
|
|
191
409
|
}
|
|
192
410
|
/** Clear the value. */
|
|
193
411
|
clear() {
|
|
412
|
+
// Matches how `onInputBlur` already flips this on the first blur -- an
|
|
413
|
+
// explicit user-initiated clear() is itself an interaction, so a
|
|
414
|
+
// required-and-now-empty field must surface its invalid state right
|
|
415
|
+
// away instead of silently looking valid until some later blur.
|
|
416
|
+
this.touched = true;
|
|
194
417
|
this.value = '';
|
|
195
418
|
this.emit('input');
|
|
196
419
|
this.emit('change');
|
|
@@ -199,7 +422,16 @@ export class LyraDateInput extends FormAssociated(LyraElement) {
|
|
|
199
422
|
disconnectedCallback() {
|
|
200
423
|
super.disconnectedCallback();
|
|
201
424
|
this.cleanupFn?.();
|
|
202
|
-
|
|
425
|
+
this.cleanupFn = undefined;
|
|
426
|
+
this.ownerDocument.removeEventListener('pointerdown', this.onDocPointer);
|
|
427
|
+
this.popupTrigger = undefined;
|
|
428
|
+
this.restorePopupFocusOnClose = false;
|
|
429
|
+
// Reset so a reconnect (e.g. a drag-drop reparent) re-triggers
|
|
430
|
+
// `updated()`'s `open`-driven branch -- without this, `open` stays
|
|
431
|
+
// stuck `true` across the disconnect, `updated()` never sees it
|
|
432
|
+
// *change*, and `place()` never gets called again to re-bind
|
|
433
|
+
// positioning to the (possibly relocated) anchor.
|
|
434
|
+
this.open = false;
|
|
203
435
|
}
|
|
204
436
|
updated(changed) {
|
|
205
437
|
super.updated(changed);
|
|
@@ -213,15 +445,101 @@ export class LyraDateInput extends FormAssociated(LyraElement) {
|
|
|
213
445
|
this.cleanupFn = place(anchor, popup);
|
|
214
446
|
}
|
|
215
447
|
}
|
|
216
|
-
if (changed.has('touched') ||
|
|
448
|
+
if (changed.has('touched') ||
|
|
449
|
+
changed.has('required') ||
|
|
450
|
+
changed.has('value') ||
|
|
451
|
+
changed.has('mode') ||
|
|
452
|
+
changed.has('min') ||
|
|
453
|
+
changed.has('max') ||
|
|
454
|
+
changed.has('readonly') ||
|
|
455
|
+
changed.has('disablePast') ||
|
|
456
|
+
changed.has('disableFuture') ||
|
|
457
|
+
changed.has('typedBadInput')) {
|
|
217
458
|
this.toggleAttribute('data-invalid', this.touched && !this.internals.validity.valid);
|
|
218
459
|
}
|
|
219
460
|
}
|
|
461
|
+
/** Parses one date, ISO-first (so a calendar-invalid ISO string like
|
|
462
|
+
* "2026-02-30" is rejected rather than silently rolled over by Date.parse()).
|
|
463
|
+
* A 3-part, ambiguous slash/dot/dash-separated date (e.g. "15/07/2026") is
|
|
464
|
+
* parsed according to the locale's own day/month/year order (via a real
|
|
465
|
+
* Intl.DateTimeFormat sample, see localeDateOrder()) rather than
|
|
466
|
+
* Date.parse()'s implementation-defined heuristics -- this is what prevents
|
|
467
|
+
* e.g. an en-GB "15/07/2026" from being silently misread as some other day.
|
|
468
|
+
* A 4-digit first group (e.g. "2026-7-15") is never locale-guessed, though:
|
|
469
|
+
* it's unambiguously a year regardless of locale/separator (ISO's own
|
|
470
|
+
* year-first convention, just without zero-padding), so it's routed
|
|
471
|
+
* straight through parseISO() instead -- this is what lets a non-padded
|
|
472
|
+
* ISO-ish date keep parsing correctly (it did via Date.parse() before the
|
|
473
|
+
* ambiguous-date regex below existed at all).
|
|
474
|
+
* Anything else (e.g. "July 15, 2026") still falls through to Date.parse(). */
|
|
475
|
+
parseOneDate(raw) {
|
|
476
|
+
const looksLikeISO = /^\d{4}-\d{2}-\d{2}$/.test(raw);
|
|
477
|
+
if (looksLikeISO)
|
|
478
|
+
return parseISO(raw);
|
|
479
|
+
const ambiguous = /^(\d{1,4})[/.-](\d{1,4})[/.-](\d{1,4})$/.exec(raw);
|
|
480
|
+
if (ambiguous) {
|
|
481
|
+
const [, g1, g2, g3] = ambiguous;
|
|
482
|
+
if (g1.length === 4) {
|
|
483
|
+
return parseISO(`${g1}-${g2.padStart(2, '0')}-${g3.padStart(2, '0')}`);
|
|
484
|
+
}
|
|
485
|
+
const order = localeDateOrder(this.locale);
|
|
486
|
+
const values = [Number(g1), Number(g2), Number(g3)];
|
|
487
|
+
const fields = {};
|
|
488
|
+
order.forEach((type, i) => {
|
|
489
|
+
fields[type] = values[i];
|
|
490
|
+
});
|
|
491
|
+
if (fields.day != null && fields.month != null && fields.year != null) {
|
|
492
|
+
const year = fields.year < 100 ? 2000 + fields.year : fields.year;
|
|
493
|
+
return parseISO(`${String(year).padStart(4, '0')}-${String(fields.month).padStart(2, '0')}-${String(fields.day).padStart(2, '0')}`);
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
return isNaN(Date.parse(raw)) ? null : new Date(Date.parse(raw));
|
|
497
|
+
}
|
|
498
|
+
parseSingleText(raw) {
|
|
499
|
+
const parsed = this.parseOneDate(raw);
|
|
500
|
+
return parsed ? formatISO(parsed) : null;
|
|
501
|
+
}
|
|
502
|
+
/** Only round-trips the exact `displayText` shape this component itself
|
|
503
|
+
* renders (`"<locale from> – <locale to>"`) — a raw ISO range typed
|
|
504
|
+
* directly (`"2026-05-01/2026-05-15"`) is also accepted as a convenience.
|
|
505
|
+
* A reversed typed range (`to` before `from`) is normalized into
|
|
506
|
+
* from-before-to order, matching what the date-picker's own UI-driven
|
|
507
|
+
* `commit()` already does for a UI-picked range. */
|
|
508
|
+
parseRangeText(raw) {
|
|
509
|
+
if (/^\d{4}-\d{2}-\d{2}\/\d{4}-\d{2}-\d{2}$/.test(raw)) {
|
|
510
|
+
const [a, b] = raw.split('/');
|
|
511
|
+
const from = parseISO(a);
|
|
512
|
+
const to = parseISO(b);
|
|
513
|
+
if (!from || !to)
|
|
514
|
+
return null;
|
|
515
|
+
return from <= to ? raw : `${b}/${a}`;
|
|
516
|
+
}
|
|
517
|
+
const separator = ' – '; // matches displayText's ` – ` join exactly
|
|
518
|
+
const idx = raw.indexOf(separator);
|
|
519
|
+
if (idx === -1)
|
|
520
|
+
return null;
|
|
521
|
+
const from = this.parseOneDate(raw.slice(0, idx).trim());
|
|
522
|
+
const to = this.parseOneDate(raw.slice(idx + separator.length).trim());
|
|
523
|
+
if (!from || !to)
|
|
524
|
+
return null;
|
|
525
|
+
return from <= to ? `${formatISO(from)}/${formatISO(to)}` : `${formatISO(to)}/${formatISO(from)}`;
|
|
526
|
+
}
|
|
527
|
+
formStateRestoreCallback(state, _mode) {
|
|
528
|
+
this.value = typeof state === 'string' ? state : '';
|
|
529
|
+
}
|
|
530
|
+
formResetCallback() {
|
|
531
|
+
super.formResetCallback();
|
|
532
|
+
this.touched = false;
|
|
533
|
+
}
|
|
220
534
|
render() {
|
|
221
535
|
const hasValue = this.value.length > 0;
|
|
222
536
|
const hasHint = this.hasHintSlot || this.hint.length > 0;
|
|
223
537
|
const hasError = this.hasErrorSlot || this.errorText.length > 0;
|
|
224
538
|
const hasLabel = this.hasLabelSlot || this.label.length > 0;
|
|
539
|
+
const invalid = this.touched && !this.internals.validity.valid;
|
|
540
|
+
const describedBy = [hasError ? 'date-input-error' : '', hasHint ? 'date-input-hint' : '']
|
|
541
|
+
.filter(Boolean)
|
|
542
|
+
.join(' ');
|
|
225
543
|
return html `
|
|
226
544
|
<div part="form-control" @keydown=${this.onFormControlKey}>
|
|
227
545
|
<label part="form-control-label" for=${this.inputId} ?hidden=${!hasLabel}>
|
|
@@ -232,10 +550,14 @@ export class LyraDateInput extends FormAssociated(LyraElement) {
|
|
|
232
550
|
id=${this.inputId}
|
|
233
551
|
part="input"
|
|
234
552
|
type="text"
|
|
235
|
-
aria-label=${this.
|
|
553
|
+
aria-label=${this.accessibleLabel || (hasLabel ? nothing : this.placeholder || 'Date')}
|
|
554
|
+
aria-describedby=${describedBy || nothing}
|
|
555
|
+
aria-required=${this.required ? 'true' : 'false'}
|
|
556
|
+
aria-invalid=${invalid ? 'true' : 'false'}
|
|
236
557
|
.value=${this.displayText}
|
|
237
558
|
placeholder=${this.placeholder}
|
|
238
|
-
?
|
|
559
|
+
?required=${this.required}
|
|
560
|
+
?disabled=${this.effectiveDisabled}
|
|
239
561
|
?readonly=${this.readonly}
|
|
240
562
|
@change=${this.onInputChange}
|
|
241
563
|
@keydown=${this.onInputKey}
|
|
@@ -245,7 +567,8 @@ export class LyraDateInput extends FormAssociated(LyraElement) {
|
|
|
245
567
|
? html `<button
|
|
246
568
|
part="clear-button"
|
|
247
569
|
type="button"
|
|
248
|
-
|
|
570
|
+
?disabled=${this.effectiveDisabled || this.readonly}
|
|
571
|
+
aria-label=${this.clearLabel}
|
|
249
572
|
@click=${() => this.clear()}
|
|
250
573
|
>
|
|
251
574
|
${closeIcon()}
|
|
@@ -254,58 +577,46 @@ export class LyraDateInput extends FormAssociated(LyraElement) {
|
|
|
254
577
|
<button
|
|
255
578
|
part="expand-button"
|
|
256
579
|
type="button"
|
|
257
|
-
aria-label
|
|
580
|
+
aria-label=${this.openLabel}
|
|
258
581
|
aria-haspopup="dialog"
|
|
259
582
|
aria-expanded=${this.open ? 'true' : 'false'}
|
|
260
583
|
aria-controls=${this.popupId}
|
|
261
|
-
?disabled=${this.
|
|
584
|
+
?disabled=${this.effectiveDisabled || this.readonly}
|
|
262
585
|
@click=${() => (this.open ? this.hide() : this.show())}
|
|
263
586
|
>
|
|
264
587
|
<span part="expand-icon" aria-hidden="true">${calendarIcon()}</span>
|
|
265
588
|
</button>
|
|
266
589
|
</div>
|
|
267
|
-
<div id=${this.popupId} part="popup" role="dialog" aria-label
|
|
590
|
+
<div id=${this.popupId} part="popup" role="dialog" aria-label=${this.dialogLabel}>
|
|
268
591
|
<lyra-date-picker
|
|
269
592
|
part="date-picker"
|
|
270
593
|
.value=${this.value}
|
|
271
594
|
.mode=${this.mode}
|
|
272
595
|
.min=${this.min}
|
|
273
596
|
.max=${this.max}
|
|
274
|
-
.months=${this.months}
|
|
597
|
+
.months=${normalizeCalendarMonths(this.months)}
|
|
275
598
|
.locale=${this.locale}
|
|
276
|
-
.disabled=${this.
|
|
599
|
+
.disabled=${this.effectiveDisabled}
|
|
277
600
|
.readonly=${this.readonly}
|
|
278
601
|
.disablePast=${this.disablePast}
|
|
279
602
|
.disableFuture=${this.disableFuture}
|
|
280
603
|
.withOutsideDays=${this.withOutsideDays}
|
|
281
604
|
first-day-of-week=${this.firstDayOfWeek}
|
|
282
|
-
|
|
605
|
+
.weekdayFormat=${normalizeWeekdayFormat(this.weekdayFormat)}
|
|
283
606
|
@input=${this.onPickerInput}
|
|
284
607
|
@change=${this.onPickerChange}
|
|
285
608
|
></lyra-date-picker>
|
|
286
609
|
</div>
|
|
287
|
-
<div part="error" ?hidden=${!hasError}>
|
|
610
|
+
<div id="date-input-error" part="error" ?hidden=${!hasError}>
|
|
288
611
|
${this.errorText}<slot name="error" @slotchange=${this.onErrorSlotChange}></slot>
|
|
289
612
|
</div>
|
|
290
|
-
<div part="hint" ?hidden=${!hasHint}>
|
|
613
|
+
<div id="date-input-hint" part="hint" ?hidden=${!hasHint}>
|
|
291
614
|
${this.hint}<slot name="hint" @slotchange=${this.onHintSlotChange}></slot>
|
|
292
615
|
</div>
|
|
293
616
|
</div>
|
|
294
617
|
`;
|
|
295
618
|
}
|
|
296
619
|
}
|
|
297
|
-
__decorate([
|
|
298
|
-
property()
|
|
299
|
-
], LyraDateInput.prototype, "mode", void 0);
|
|
300
|
-
__decorate([
|
|
301
|
-
property()
|
|
302
|
-
], LyraDateInput.prototype, "min", void 0);
|
|
303
|
-
__decorate([
|
|
304
|
-
property()
|
|
305
|
-
], LyraDateInput.prototype, "max", void 0);
|
|
306
|
-
__decorate([
|
|
307
|
-
property({ type: Boolean, reflect: true })
|
|
308
|
-
], LyraDateInput.prototype, "readonly", void 0);
|
|
309
620
|
__decorate([
|
|
310
621
|
property({ type: Boolean, reflect: true })
|
|
311
622
|
], LyraDateInput.prototype, "open", void 0);
|
|
@@ -324,27 +635,33 @@ __decorate([
|
|
|
324
635
|
__decorate([
|
|
325
636
|
property()
|
|
326
637
|
], LyraDateInput.prototype, "placeholder", void 0);
|
|
638
|
+
__decorate([
|
|
639
|
+
property({ attribute: 'aria-label' })
|
|
640
|
+
], LyraDateInput.prototype, "accessibleLabel", void 0);
|
|
327
641
|
__decorate([
|
|
328
642
|
property()
|
|
329
643
|
], LyraDateInput.prototype, "locale", void 0);
|
|
330
644
|
__decorate([
|
|
331
|
-
property({
|
|
645
|
+
property({ converter: monthsConverter })
|
|
332
646
|
], LyraDateInput.prototype, "months", void 0);
|
|
333
647
|
__decorate([
|
|
334
648
|
property({ attribute: 'first-day-of-week' })
|
|
335
649
|
], LyraDateInput.prototype, "firstDayOfWeek", void 0);
|
|
336
650
|
__decorate([
|
|
337
|
-
property({ attribute: 'weekday-format' })
|
|
651
|
+
property({ attribute: 'weekday-format', converter: weekdayFormatConverter })
|
|
338
652
|
], LyraDateInput.prototype, "weekdayFormat", void 0);
|
|
339
|
-
__decorate([
|
|
340
|
-
property({ type: Boolean, attribute: 'disable-past' })
|
|
341
|
-
], LyraDateInput.prototype, "disablePast", void 0);
|
|
342
|
-
__decorate([
|
|
343
|
-
property({ type: Boolean, attribute: 'disable-future' })
|
|
344
|
-
], LyraDateInput.prototype, "disableFuture", void 0);
|
|
345
653
|
__decorate([
|
|
346
654
|
property({ type: Boolean, attribute: 'with-outside-days' })
|
|
347
655
|
], LyraDateInput.prototype, "withOutsideDays", void 0);
|
|
656
|
+
__decorate([
|
|
657
|
+
property({ attribute: 'clear-label' })
|
|
658
|
+
], LyraDateInput.prototype, "clearLabel", void 0);
|
|
659
|
+
__decorate([
|
|
660
|
+
property({ attribute: 'open-label' })
|
|
661
|
+
], LyraDateInput.prototype, "openLabel", void 0);
|
|
662
|
+
__decorate([
|
|
663
|
+
property({ attribute: 'dialog-label' })
|
|
664
|
+
], LyraDateInput.prototype, "dialogLabel", void 0);
|
|
348
665
|
__decorate([
|
|
349
666
|
state()
|
|
350
667
|
], LyraDateInput.prototype, "touched", void 0);
|