@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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type TemplateResult, type PropertyValues } from 'lit';
|
|
2
2
|
import { LyraElement } from '../../internal/lyra-element.js';
|
|
3
|
-
import { type WeekdayFormat } from './calendar-core.js';
|
|
3
|
+
import { type CalendarMode, type WeekdayFormat } from './calendar-core.js';
|
|
4
4
|
export interface DateRange {
|
|
5
5
|
from: Date | null;
|
|
6
6
|
to: Date | null;
|
|
@@ -14,14 +14,30 @@ export interface DateRange {
|
|
|
14
14
|
* @customElement lyra-date-picker
|
|
15
15
|
* @event change - The user committed a value.
|
|
16
16
|
* @event input - The value changed during interaction (range: after the first click).
|
|
17
|
-
* @csspart base
|
|
18
|
-
* @csspart
|
|
17
|
+
* @csspart base - The date-picker wrapper.
|
|
18
|
+
* @csspart month - A visible month wrapper.
|
|
19
|
+
* @csspart header - The month header.
|
|
20
|
+
* @csspart title - The month title.
|
|
21
|
+
* @csspart previous - The previous-month button.
|
|
22
|
+
* @csspart next - The next-month button.
|
|
23
|
+
* @csspart weekdays - The weekday header row.
|
|
24
|
+
* @csspart weekday - A weekday label.
|
|
25
|
+
* @csspart grid - A month date grid.
|
|
26
|
+
* @csspart week - A calendar week row.
|
|
27
|
+
* @csspart day - A calendar day button.
|
|
28
|
+
* @csspart day-today - A day representing today.
|
|
29
|
+
* @csspart day-outside - A day outside the active month.
|
|
30
|
+
* @csspart day-selected - A selected day.
|
|
31
|
+
* @csspart day-range-start - The start of a selected range.
|
|
32
|
+
* @csspart day-range-end - The end of a selected range.
|
|
33
|
+
* @csspart day-range-inner - An interior day in a selected range.
|
|
34
|
+
* @csspart day-placeholder - A non-day grid placeholder.
|
|
19
35
|
*/
|
|
20
36
|
export declare class LyraDatePicker extends LyraElement {
|
|
21
37
|
static styles: import("lit").CSSResultGroup[];
|
|
22
38
|
/** ISO value: `YYYY-MM-DD` or `YYYY-MM-DD/YYYY-MM-DD`. */
|
|
23
39
|
value: string;
|
|
24
|
-
mode:
|
|
40
|
+
mode: CalendarMode;
|
|
25
41
|
min: string;
|
|
26
42
|
max: string;
|
|
27
43
|
disabled: boolean;
|
|
@@ -33,16 +49,31 @@ export declare class LyraDatePicker extends LyraElement {
|
|
|
33
49
|
disablePast: boolean;
|
|
34
50
|
disableFuture: boolean;
|
|
35
51
|
withOutsideDays: boolean;
|
|
52
|
+
/** Accessible label for the previous-month button. Override for a non-English `locale`. */
|
|
53
|
+
previousLabel: string;
|
|
54
|
+
/** Accessible label for the next-month button. Override for a non-English `locale`. */
|
|
55
|
+
nextLabel: string;
|
|
36
56
|
private viewDate;
|
|
37
57
|
private focusedDate;
|
|
38
58
|
private focusPending;
|
|
59
|
+
private readonly titleIds;
|
|
39
60
|
private suppressViewSync;
|
|
61
|
+
private get effectiveMode();
|
|
62
|
+
private get visibleMonths();
|
|
63
|
+
private get effectiveWeekdayFormat();
|
|
40
64
|
get selection(): DateRange;
|
|
41
65
|
/** Read-only Date view of a single-mode value. */
|
|
42
66
|
get valueAsDate(): Date | null;
|
|
43
67
|
protected willUpdate(changed: PropertyValues): void;
|
|
44
68
|
private get fdow();
|
|
45
69
|
private isDisabled;
|
|
70
|
+
/** The first enabled day at/after the first visible month's start, scanning
|
|
71
|
+
* forward across all visible months -- used as the sole focusable day when
|
|
72
|
+
* there's no selection and no prior keyboard focus, so the empty-grid case
|
|
73
|
+
* never defaults to a possibly-disabled day 1. Returns null if every
|
|
74
|
+
* visible day is disabled (pathological but possible with a very narrow
|
|
75
|
+
* min/max window). */
|
|
76
|
+
private firstEnabledDate;
|
|
46
77
|
private commit;
|
|
47
78
|
private selectDate;
|
|
48
79
|
/** Clear the selection and emit input + change. */
|
|
@@ -4,13 +4,26 @@ 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, nothing } 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 { defineElement } from '../../internal/prefix.js';
|
|
11
11
|
import { chevronIcon } from '../../internal/icons.js';
|
|
12
|
+
import { nextId } from '../../internal/a11y.js';
|
|
12
13
|
import { styles } from './date-picker.styles.js';
|
|
13
|
-
import { monthMatrix, weekdayLabels, monthTitle, formatISO, parseISO, isSameDay, addMonths, clampDate, resolveFirstDayOfWeek, } from './calendar-core.js';
|
|
14
|
+
import { monthMatrix, weekdayLabels, monthTitle, formatISO, parseISO, isSameDay, addMonths, addMonthsClampingDay, clampDate, dateTimeFormat, normalizeCalendarMode, normalizeCalendarMonths, normalizeWeekdayFormat, resolveFirstDayOfWeek, } from './calendar-core.js';
|
|
15
|
+
const modeConverter = {
|
|
16
|
+
fromAttribute: normalizeCalendarMode,
|
|
17
|
+
toAttribute: normalizeCalendarMode,
|
|
18
|
+
};
|
|
19
|
+
const monthsConverter = {
|
|
20
|
+
fromAttribute: normalizeCalendarMonths,
|
|
21
|
+
toAttribute: normalizeCalendarMonths,
|
|
22
|
+
};
|
|
23
|
+
const weekdayFormatConverter = {
|
|
24
|
+
fromAttribute: normalizeWeekdayFormat,
|
|
25
|
+
toAttribute: normalizeWeekdayFormat,
|
|
26
|
+
};
|
|
14
27
|
/**
|
|
15
28
|
* `<lyra-date-picker>` — an inline month-grid calendar for picking a single date
|
|
16
29
|
* or a date range. Mirrors the core `<wa-date-picker>` API under `lyra-`.
|
|
@@ -20,8 +33,24 @@ import { monthMatrix, weekdayLabels, monthTitle, formatISO, parseISO, isSameDay,
|
|
|
20
33
|
* @customElement lyra-date-picker
|
|
21
34
|
* @event change - The user committed a value.
|
|
22
35
|
* @event input - The value changed during interaction (range: after the first click).
|
|
23
|
-
* @csspart base
|
|
24
|
-
* @csspart
|
|
36
|
+
* @csspart base - The date-picker wrapper.
|
|
37
|
+
* @csspart month - A visible month wrapper.
|
|
38
|
+
* @csspart header - The month header.
|
|
39
|
+
* @csspart title - The month title.
|
|
40
|
+
* @csspart previous - The previous-month button.
|
|
41
|
+
* @csspart next - The next-month button.
|
|
42
|
+
* @csspart weekdays - The weekday header row.
|
|
43
|
+
* @csspart weekday - A weekday label.
|
|
44
|
+
* @csspart grid - A month date grid.
|
|
45
|
+
* @csspart week - A calendar week row.
|
|
46
|
+
* @csspart day - A calendar day button.
|
|
47
|
+
* @csspart day-today - A day representing today.
|
|
48
|
+
* @csspart day-outside - A day outside the active month.
|
|
49
|
+
* @csspart day-selected - A selected day.
|
|
50
|
+
* @csspart day-range-start - The start of a selected range.
|
|
51
|
+
* @csspart day-range-end - The end of a selected range.
|
|
52
|
+
* @csspart day-range-inner - An interior day in a selected range.
|
|
53
|
+
* @csspart day-placeholder - A non-day grid placeholder.
|
|
25
54
|
*/
|
|
26
55
|
export class LyraDatePicker extends LyraElement {
|
|
27
56
|
constructor() {
|
|
@@ -40,9 +69,17 @@ export class LyraDatePicker extends LyraElement {
|
|
|
40
69
|
this.disablePast = false;
|
|
41
70
|
this.disableFuture = false;
|
|
42
71
|
this.withOutsideDays = false;
|
|
72
|
+
/** Accessible label for the previous-month button. Override for a non-English `locale`. */
|
|
73
|
+
this.previousLabel = 'Previous month';
|
|
74
|
+
/** Accessible label for the next-month button. Override for a non-English `locale`. */
|
|
75
|
+
this.nextLabel = 'Next month';
|
|
43
76
|
this.viewDate = new Date(new Date().getFullYear(), new Date().getMonth(), 1);
|
|
44
77
|
this.focusedDate = null;
|
|
45
78
|
this.focusPending = false;
|
|
79
|
+
// Stable per-instance ids for each visible month's title, referenced by
|
|
80
|
+
// that month's grid via aria-labelledby -- `months` only ever renders 1 or
|
|
81
|
+
// 2 months, so two ids always suffice regardless of which is in use.
|
|
82
|
+
this.titleIds = [nextId('date-picker-title'), nextId('date-picker-title')];
|
|
46
83
|
// Set right before `commit()` assigns `value`, so `willUpdate` can tell its
|
|
47
84
|
// own write apart from an external assignment. Internal commits already
|
|
48
85
|
// know the right date is on-screen (it's the cell the user just clicked, or
|
|
@@ -50,32 +87,54 @@ export class LyraDatePicker extends LyraElement {
|
|
|
50
87
|
// `selection.from`'s month -- only an externally-set `value` should do that.
|
|
51
88
|
this.suppressViewSync = false;
|
|
52
89
|
this.onGridKey = (e) => {
|
|
53
|
-
const
|
|
90
|
+
const min = parseISO(this.min);
|
|
91
|
+
const max = parseISO(this.max);
|
|
92
|
+
const today = new Date();
|
|
93
|
+
today.setHours(0, 0, 0, 0);
|
|
94
|
+
const current = this.focusedDate ??
|
|
95
|
+
this.selection.from ??
|
|
96
|
+
this.firstEnabledDate(min, max, today) ??
|
|
97
|
+
new Date(this.viewDate.getFullYear(), this.viewDate.getMonth(), 1);
|
|
98
|
+
const step = (base, days) => new Date(base.getFullYear(), base.getMonth(), base.getDate() + days);
|
|
99
|
+
// Walks in the requested direction until an enabled day is found, bounded
|
|
100
|
+
// by a step cap (366 days -- more than a year) so an all-disabled range
|
|
101
|
+
// (e.g. min/max entirely in the past with disable-past set) can't loop
|
|
102
|
+
// forever; returns null rather than landing focus on a disabled cell,
|
|
103
|
+
// whose `.focus()` would be a silent no-op anyway.
|
|
104
|
+
const firstEnabledFrom = (base, dayStep) => {
|
|
105
|
+
let d = base;
|
|
106
|
+
for (let i = 0; i < 366; i++) {
|
|
107
|
+
if (!this.isDisabled(d, min, max, today))
|
|
108
|
+
return d;
|
|
109
|
+
d = step(d, dayStep);
|
|
110
|
+
}
|
|
111
|
+
return null;
|
|
112
|
+
};
|
|
54
113
|
let next = null;
|
|
55
114
|
switch (e.key) {
|
|
56
115
|
case 'ArrowLeft':
|
|
57
|
-
next =
|
|
116
|
+
next = firstEnabledFrom(step(current, -1), -1);
|
|
58
117
|
break;
|
|
59
118
|
case 'ArrowRight':
|
|
60
|
-
next =
|
|
119
|
+
next = firstEnabledFrom(step(current, 1), 1);
|
|
61
120
|
break;
|
|
62
121
|
case 'ArrowUp':
|
|
63
|
-
next =
|
|
122
|
+
next = firstEnabledFrom(step(current, -7), -1);
|
|
64
123
|
break;
|
|
65
124
|
case 'ArrowDown':
|
|
66
|
-
next =
|
|
125
|
+
next = firstEnabledFrom(step(current, 7), 1);
|
|
67
126
|
break;
|
|
68
127
|
case 'PageUp':
|
|
69
|
-
next =
|
|
128
|
+
next = firstEnabledFrom(addMonthsClampingDay(current, -1), 1);
|
|
70
129
|
break;
|
|
71
130
|
case 'PageDown':
|
|
72
|
-
next =
|
|
131
|
+
next = firstEnabledFrom(addMonthsClampingDay(current, 1), 1);
|
|
73
132
|
break;
|
|
74
133
|
case 'Home':
|
|
75
|
-
next = new Date(current.getFullYear(), current.getMonth(), 1);
|
|
134
|
+
next = firstEnabledFrom(new Date(current.getFullYear(), current.getMonth(), 1), 1);
|
|
76
135
|
break;
|
|
77
136
|
case 'End':
|
|
78
|
-
next = new Date(current.getFullYear(), current.getMonth() + 1, 0);
|
|
137
|
+
next = firstEnabledFrom(new Date(current.getFullYear(), current.getMonth() + 1, 0), -1);
|
|
79
138
|
break;
|
|
80
139
|
case 'Enter':
|
|
81
140
|
case ' ':
|
|
@@ -86,19 +145,30 @@ export class LyraDatePicker extends LyraElement {
|
|
|
86
145
|
return;
|
|
87
146
|
}
|
|
88
147
|
e.preventDefault();
|
|
148
|
+
if (!next)
|
|
149
|
+
return;
|
|
89
150
|
this.focusedDate = next;
|
|
90
151
|
this.viewDate = this.viewDateForFocus(next);
|
|
91
152
|
this.focusPending = true;
|
|
92
153
|
};
|
|
93
154
|
}
|
|
94
155
|
static { this.styles = [LyraElement.styles, styles]; }
|
|
156
|
+
get effectiveMode() {
|
|
157
|
+
return normalizeCalendarMode(this.mode);
|
|
158
|
+
}
|
|
159
|
+
get visibleMonths() {
|
|
160
|
+
return normalizeCalendarMonths(this.months);
|
|
161
|
+
}
|
|
162
|
+
get effectiveWeekdayFormat() {
|
|
163
|
+
return normalizeWeekdayFormat(this.weekdayFormat);
|
|
164
|
+
}
|
|
95
165
|
get selection() {
|
|
96
166
|
const parts = this.value.split('/');
|
|
97
167
|
return { from: parseISO(parts[0] ?? ''), to: parseISO(parts[1] ?? '') };
|
|
98
168
|
}
|
|
99
169
|
/** Read-only Date view of a single-mode value. */
|
|
100
170
|
get valueAsDate() {
|
|
101
|
-
return this.
|
|
171
|
+
return this.effectiveMode === 'single' ? this.selection.from : null;
|
|
102
172
|
}
|
|
103
173
|
willUpdate(changed) {
|
|
104
174
|
if (changed.has('value')) {
|
|
@@ -127,8 +197,25 @@ export class LyraDatePicker extends LyraElement {
|
|
|
127
197
|
return true;
|
|
128
198
|
return false;
|
|
129
199
|
}
|
|
200
|
+
/** The first enabled day at/after the first visible month's start, scanning
|
|
201
|
+
* forward across all visible months -- used as the sole focusable day when
|
|
202
|
+
* there's no selection and no prior keyboard focus, so the empty-grid case
|
|
203
|
+
* never defaults to a possibly-disabled day 1. Returns null if every
|
|
204
|
+
* visible day is disabled (pathological but possible with a very narrow
|
|
205
|
+
* min/max window). */
|
|
206
|
+
firstEnabledDate(min, max, today) {
|
|
207
|
+
let d = new Date(this.viewDate.getFullYear(), this.viewDate.getMonth(), 1);
|
|
208
|
+
const lastVisibleMonth = addMonths(d, this.visibleMonths - 1);
|
|
209
|
+
const boundEnd = new Date(lastVisibleMonth.getFullYear(), lastVisibleMonth.getMonth() + 1, 0);
|
|
210
|
+
for (let i = 0; i < 732 && d <= boundEnd; i++) {
|
|
211
|
+
if (!this.isDisabled(d, min, max, today))
|
|
212
|
+
return d;
|
|
213
|
+
d = new Date(d.getFullYear(), d.getMonth(), d.getDate() + 1);
|
|
214
|
+
}
|
|
215
|
+
return null;
|
|
216
|
+
}
|
|
130
217
|
commit(from, to, fire) {
|
|
131
|
-
const next = this.
|
|
218
|
+
const next = this.effectiveMode === 'range'
|
|
132
219
|
? from && to
|
|
133
220
|
? `${formatISO(from)}/${formatISO(to)}`
|
|
134
221
|
: from
|
|
@@ -155,7 +242,7 @@ export class LyraDatePicker extends LyraElement {
|
|
|
155
242
|
if (this.isDisabled(date, min, max, today))
|
|
156
243
|
return;
|
|
157
244
|
this.focusedDate = date;
|
|
158
|
-
if (this.
|
|
245
|
+
if (this.effectiveMode === 'range') {
|
|
159
246
|
const { from, to } = this.selection;
|
|
160
247
|
if (!from || (from && to)) {
|
|
161
248
|
this.commit(date, null, false);
|
|
@@ -183,9 +270,9 @@ export class LyraDatePicker extends LyraElement {
|
|
|
183
270
|
/** Navigate the view to a date and focus it, clamped to `min`/`max`. */
|
|
184
271
|
goToDate(date) {
|
|
185
272
|
const d = typeof date === 'string' ? parseISO(date) : date;
|
|
186
|
-
if (!d)
|
|
273
|
+
if (!d || !Number.isFinite(d.getTime()))
|
|
187
274
|
return;
|
|
188
|
-
const clamped = clampDate(d, parseISO(this.min), parseISO(this.max));
|
|
275
|
+
const clamped = clampDate(new Date(d.getTime()), parseISO(this.min), parseISO(this.max));
|
|
189
276
|
this.viewDate = new Date(clamped.getFullYear(), clamped.getMonth(), 1);
|
|
190
277
|
this.focusedDate = clamped;
|
|
191
278
|
this.focusPending = true;
|
|
@@ -202,11 +289,11 @@ export class LyraDatePicker extends LyraElement {
|
|
|
202
289
|
viewDateForFocus(next) {
|
|
203
290
|
const firstMonth = new Date(this.viewDate.getFullYear(), this.viewDate.getMonth(), 1);
|
|
204
291
|
const nextMonth = new Date(next.getFullYear(), next.getMonth(), 1);
|
|
205
|
-
const lastMonth = addMonths(firstMonth, this.
|
|
292
|
+
const lastMonth = addMonths(firstMonth, this.visibleMonths - 1);
|
|
206
293
|
if (nextMonth < firstMonth)
|
|
207
294
|
return nextMonth;
|
|
208
295
|
if (nextMonth > lastMonth)
|
|
209
|
-
return addMonths(nextMonth, -(this.
|
|
296
|
+
return addMonths(nextMonth, -(this.visibleMonths - 1));
|
|
210
297
|
return firstMonth;
|
|
211
298
|
}
|
|
212
299
|
updated() {
|
|
@@ -217,7 +304,7 @@ export class LyraDatePicker extends LyraElement {
|
|
|
217
304
|
cell?.focus();
|
|
218
305
|
}
|
|
219
306
|
}
|
|
220
|
-
renderDay(date, shownMonth, selection, min, max, today, rowHasVisibleDay) {
|
|
307
|
+
renderDay(date, shownMonth, selection, min, max, today, rowHasVisibleDay, fallbackFocusDate, dayLabelFmt) {
|
|
221
308
|
const outside = date.getMonth() !== shownMonth;
|
|
222
309
|
// Outside-month days are empty placeholders by default (matches WA), keeping the
|
|
223
310
|
// 6-row grid aligned without low-contrast faded numbers.
|
|
@@ -238,9 +325,21 @@ export class LyraDatePicker extends LyraElement {
|
|
|
238
325
|
const isToday = isSameDay(date, today);
|
|
239
326
|
const isStart = from && isSameDay(date, from);
|
|
240
327
|
const isEnd = to && isSameDay(date, to);
|
|
241
|
-
const selected = this.
|
|
242
|
-
const inRange = this.
|
|
243
|
-
|
|
328
|
+
const selected = this.effectiveMode === 'single' ? isStart : isStart || isEnd;
|
|
329
|
+
const inRange = this.effectiveMode === 'range' && from && to && date > from && date < to;
|
|
330
|
+
// Falls back to the first *enabled* day across the visible month(s) (see
|
|
331
|
+
// firstEnabledDate()) when there's neither a focusedDate nor a selection,
|
|
332
|
+
// so the grid always has exactly one tabbable cell -- otherwise every
|
|
333
|
+
// cell computes `false` and keyboard users tabbing into an empty picker
|
|
334
|
+
// land nowhere. Must not just be "day 1 of the shown month" unconditionally:
|
|
335
|
+
// day 1 can itself be disabled (e.g. disable-past opened on any day other
|
|
336
|
+
// than the 1st), which would land the sole tabindex="0" cell on a button
|
|
337
|
+
// that can never actually receive focus.
|
|
338
|
+
const focused = this.focusedDate != null
|
|
339
|
+
? isSameDay(date, this.focusedDate)
|
|
340
|
+
: isStart
|
|
341
|
+
? true
|
|
342
|
+
: !from && fallbackFocusDate != null && isSameDay(date, fallbackFocusDate);
|
|
244
343
|
const parts = ['day'];
|
|
245
344
|
if (outside)
|
|
246
345
|
parts.push('day-outside');
|
|
@@ -248,7 +347,7 @@ export class LyraDatePicker extends LyraElement {
|
|
|
248
347
|
parts.push('day-today');
|
|
249
348
|
if (selected)
|
|
250
349
|
parts.push('day-selected');
|
|
251
|
-
if (isStart && this.
|
|
350
|
+
if (isStart && this.effectiveMode === 'range')
|
|
252
351
|
parts.push('day-range-start');
|
|
253
352
|
if (isEnd)
|
|
254
353
|
parts.push('day-range-end');
|
|
@@ -259,12 +358,7 @@ export class LyraDatePicker extends LyraElement {
|
|
|
259
358
|
role="gridcell"
|
|
260
359
|
data-date=${formatISO(date)}
|
|
261
360
|
aria-selected=${selected ? 'true' : 'false'}
|
|
262
|
-
aria-label=${
|
|
263
|
-
weekday: 'long',
|
|
264
|
-
year: 'numeric',
|
|
265
|
-
month: 'long',
|
|
266
|
-
day: 'numeric',
|
|
267
|
-
})}
|
|
361
|
+
aria-label=${dayLabelFmt.format(date)}
|
|
268
362
|
tabindex=${focused ? '0' : '-1'}
|
|
269
363
|
?disabled=${disabled}
|
|
270
364
|
@click=${() => this.selectDate(date)}
|
|
@@ -272,32 +366,45 @@ export class LyraDatePicker extends LyraElement {
|
|
|
272
366
|
${date.getDate()}
|
|
273
367
|
</button>`;
|
|
274
368
|
}
|
|
275
|
-
renderMonth(offset, selection, min, max, today, fdow, labels) {
|
|
369
|
+
renderMonth(offset, selection, min, max, today, fdow, labels, fallbackFocusDate, dayLabelFmt) {
|
|
276
370
|
const base = addMonths(this.viewDate, offset);
|
|
277
371
|
const year = base.getFullYear();
|
|
278
372
|
const month = base.getMonth();
|
|
279
373
|
const matrix = monthMatrix(year, month, fdow);
|
|
280
374
|
const isFirst = offset === 0;
|
|
281
|
-
const isLast = offset === this.
|
|
375
|
+
const isLast = offset === this.visibleMonths - 1;
|
|
376
|
+
const titleId = this.titleIds[offset];
|
|
282
377
|
return html `<div part="month">
|
|
283
378
|
<div part="header">
|
|
284
379
|
${isFirst
|
|
285
|
-
? html `<button
|
|
380
|
+
? html `<button
|
|
381
|
+
part="previous"
|
|
382
|
+
type="button"
|
|
383
|
+
aria-label=${this.previousLabel}
|
|
384
|
+
?disabled=${this.disabled || this.readonly}
|
|
385
|
+
@click=${() => this.nav(-1)}
|
|
386
|
+
>
|
|
286
387
|
${chevronIcon()}
|
|
287
388
|
</button>`
|
|
288
389
|
: html `<span></span>`}
|
|
289
|
-
<div part="title">${monthTitle(year, month, this.locale)}</div>
|
|
390
|
+
<div part="title" id=${titleId}>${monthTitle(year, month, this.locale)}</div>
|
|
290
391
|
${isLast
|
|
291
|
-
? html `<button
|
|
392
|
+
? html `<button
|
|
393
|
+
part="next"
|
|
394
|
+
type="button"
|
|
395
|
+
aria-label=${this.nextLabel}
|
|
396
|
+
?disabled=${this.disabled || this.readonly}
|
|
397
|
+
@click=${() => this.nav(1)}
|
|
398
|
+
>
|
|
292
399
|
${chevronIcon()}
|
|
293
400
|
</button>`
|
|
294
401
|
: html `<span></span>`}
|
|
295
402
|
</div>
|
|
296
403
|
<div part="weekdays">${labels.map((l) => html `<span part="weekday">${l}</span>`)}</div>
|
|
297
|
-
<div part="grid" role="grid" @keydown=${this.onGridKey}>
|
|
404
|
+
<div part="grid" role="grid" aria-labelledby=${titleId} @keydown=${this.onGridKey}>
|
|
298
405
|
${matrix.map((week) => {
|
|
299
406
|
const rowHasVisibleDay = week.some((d) => d.getMonth() === month);
|
|
300
|
-
return html `<div part="week" role="row">${week.map((d) => this.renderDay(d, month, selection, min, max, today, rowHasVisibleDay))}</div>`;
|
|
407
|
+
return html `<div part="week" role="row">${week.map((d) => this.renderDay(d, month, selection, min, max, today, rowHasVisibleDay, fallbackFocusDate, dayLabelFmt))}</div>`;
|
|
301
408
|
})}
|
|
302
409
|
</div>
|
|
303
410
|
</div>`;
|
|
@@ -309,10 +416,24 @@ export class LyraDatePicker extends LyraElement {
|
|
|
309
416
|
const today = new Date();
|
|
310
417
|
today.setHours(0, 0, 0, 0);
|
|
311
418
|
const fdow = this.fdow;
|
|
312
|
-
const labels = weekdayLabels(fdow, this.
|
|
419
|
+
const labels = weekdayLabels(fdow, this.effectiveWeekdayFormat, this.locale);
|
|
420
|
+
// Hoisted once per render and reused across every day cell, rather than
|
|
421
|
+
// each cell constructing its own Intl.DateTimeFormat via
|
|
422
|
+
// toLocaleDateString() -- mirrors how the weekday-header and month-title
|
|
423
|
+
// labels already share a single formatter instead of one per cell.
|
|
424
|
+
const dayLabelFmt = dateTimeFormat(this.locale, {
|
|
425
|
+
weekday: 'long',
|
|
426
|
+
year: 'numeric',
|
|
427
|
+
month: 'long',
|
|
428
|
+
day: 'numeric',
|
|
429
|
+
});
|
|
430
|
+
// Only bother scanning for a fallback focus day when it's actually
|
|
431
|
+
// needed: there's no point walking the visible days if a focusedDate or
|
|
432
|
+
// an existing selection already determines the sole tabbable cell.
|
|
433
|
+
const fallbackFocusDate = this.focusedDate || selection.from ? null : this.firstEnabledDate(min, max, today);
|
|
313
434
|
const monthEls = [];
|
|
314
|
-
for (let i = 0; i < this.
|
|
315
|
-
monthEls.push(this.renderMonth(i, selection, min, max, today, fdow, labels));
|
|
435
|
+
for (let i = 0; i < this.visibleMonths; i++) {
|
|
436
|
+
monthEls.push(this.renderMonth(i, selection, min, max, today, fdow, labels, fallbackFocusDate, dayLabelFmt));
|
|
316
437
|
}
|
|
317
438
|
return html `<div part="base">${monthEls}</div>`;
|
|
318
439
|
}
|
|
@@ -321,7 +442,7 @@ __decorate([
|
|
|
321
442
|
property()
|
|
322
443
|
], LyraDatePicker.prototype, "value", void 0);
|
|
323
444
|
__decorate([
|
|
324
|
-
property()
|
|
445
|
+
property({ converter: modeConverter })
|
|
325
446
|
], LyraDatePicker.prototype, "mode", void 0);
|
|
326
447
|
__decorate([
|
|
327
448
|
property()
|
|
@@ -336,7 +457,7 @@ __decorate([
|
|
|
336
457
|
property({ type: Boolean, reflect: true })
|
|
337
458
|
], LyraDatePicker.prototype, "readonly", void 0);
|
|
338
459
|
__decorate([
|
|
339
|
-
property({
|
|
460
|
+
property({ converter: monthsConverter })
|
|
340
461
|
], LyraDatePicker.prototype, "months", void 0);
|
|
341
462
|
__decorate([
|
|
342
463
|
property()
|
|
@@ -345,7 +466,7 @@ __decorate([
|
|
|
345
466
|
property({ attribute: 'first-day-of-week' })
|
|
346
467
|
], LyraDatePicker.prototype, "firstDayOfWeek", void 0);
|
|
347
468
|
__decorate([
|
|
348
|
-
property({ attribute: 'weekday-format' })
|
|
469
|
+
property({ attribute: 'weekday-format', converter: weekdayFormatConverter })
|
|
349
470
|
], LyraDatePicker.prototype, "weekdayFormat", void 0);
|
|
350
471
|
__decorate([
|
|
351
472
|
property({ type: Boolean, attribute: 'disable-past' })
|
|
@@ -356,6 +477,12 @@ __decorate([
|
|
|
356
477
|
__decorate([
|
|
357
478
|
property({ type: Boolean, attribute: 'with-outside-days' })
|
|
358
479
|
], LyraDatePicker.prototype, "withOutsideDays", void 0);
|
|
480
|
+
__decorate([
|
|
481
|
+
property({ attribute: 'previous-label' })
|
|
482
|
+
], LyraDatePicker.prototype, "previousLabel", void 0);
|
|
483
|
+
__decorate([
|
|
484
|
+
property({ attribute: 'next-label' })
|
|
485
|
+
], LyraDatePicker.prototype, "nextLabel", void 0);
|
|
359
486
|
__decorate([
|
|
360
487
|
state()
|
|
361
488
|
], LyraDatePicker.prototype, "viewDate", void 0);
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import './dialog.js';
|
|
2
|
+
export interface ConfirmOptions {
|
|
3
|
+
/** Dialog title -- rendered as a slotted `<h2>`, which also drives the dialog's accessible name (see dialog.ts). */
|
|
4
|
+
title: string;
|
|
5
|
+
/** Optional supporting text rendered below the title. */
|
|
6
|
+
description?: string;
|
|
7
|
+
/** Confirm button label. Defaults to `'Confirm'`. */
|
|
8
|
+
confirmLabel?: string;
|
|
9
|
+
/** Cancel button label. Defaults to `'Cancel'`. */
|
|
10
|
+
cancelLabel?: string;
|
|
11
|
+
/** `'danger'` fills the confirm button with `--lyra-color-danger` instead of `--lyra-color-brand` -- for destructive actions. */
|
|
12
|
+
tone?: 'neutral' | 'danger';
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Show a confirmation modal, resolving `true` only when the confirm button
|
|
16
|
+
* is pressed -- Escape, a backdrop click, and the cancel button all resolve
|
|
17
|
+
* `false`. A drop-in replacement for `window.confirm()`.
|
|
18
|
+
*
|
|
19
|
+
* Mounts a transient `<lyra-dialog>` for the duration of the call and
|
|
20
|
+
* removes it once settled, rather than reusing a persistent page-level
|
|
21
|
+
* region (contrast `lyra-toast`'s `toaster.ts`): a confirmation modal has no
|
|
22
|
+
* stacking/queueing concerns -- only one is ever meant to be open at a time
|
|
23
|
+
* -- so a mount-and-remove per call keeps its lifetime trivially tied to the
|
|
24
|
+
* returned promise, with nothing left mounted between calls.
|
|
25
|
+
*
|
|
26
|
+
* Every dismissal path (confirm button, cancel button, Escape, backdrop
|
|
27
|
+
* click) funnels through `<lyra-dialog>`'s own `close()`/`lyra-dialog-close`
|
|
28
|
+
* event, so there is exactly one place that resolves the promise and tears
|
|
29
|
+
* the dialog down.
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* const ok = await confirm({
|
|
33
|
+
* title: 'Delete conversation?',
|
|
34
|
+
* description: 'This cannot be undone.',
|
|
35
|
+
* confirmLabel: 'Delete',
|
|
36
|
+
* tone: 'danger',
|
|
37
|
+
* });
|
|
38
|
+
* if (ok) deleteConversation();
|
|
39
|
+
*/
|
|
40
|
+
export declare function confirm(options: ConfirmOptions): Promise<boolean>;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import './dialog.js';
|
|
2
|
+
// Plain inline-styled <button>s, not a shared lyra-button component -- none
|
|
3
|
+
// exists in this library yet. Every value below is still a --lyra-* token
|
|
4
|
+
// reference, never a raw literal, same requirement as a component's own
|
|
5
|
+
// styles.ts. Each filled tone uses its matching on-color token so standalone
|
|
6
|
+
// light/dark fallbacks and a consumer's Web Awesome theme stay paired.
|
|
7
|
+
const BUTTON_BASE_STYLE = 'font: inherit; font-size: 0.875rem; padding: var(--lyra-space-xs) var(--lyra-space-m); ' +
|
|
8
|
+
'border-radius: var(--lyra-radius); cursor: pointer; border: 1px solid var(--lyra-color-border);';
|
|
9
|
+
const CANCEL_STYLE = 'background: var(--lyra-color-surface); color: var(--lyra-color-text);';
|
|
10
|
+
const CONFIRM_TONE_STYLE = {
|
|
11
|
+
neutral: 'background: var(--lyra-color-brand); color: var(--lyra-color-on-brand); border-color: var(--lyra-color-brand);',
|
|
12
|
+
danger: 'background: var(--lyra-color-danger); color: var(--lyra-color-on-danger); border-color: var(--lyra-color-danger);',
|
|
13
|
+
};
|
|
14
|
+
function createButton(label, style, onClick) {
|
|
15
|
+
const button = document.createElement('button');
|
|
16
|
+
button.type = 'button';
|
|
17
|
+
button.textContent = label;
|
|
18
|
+
button.style.cssText = `${BUTTON_BASE_STYLE} ${style}`;
|
|
19
|
+
button.addEventListener('click', onClick);
|
|
20
|
+
return button;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Show a confirmation modal, resolving `true` only when the confirm button
|
|
24
|
+
* is pressed -- Escape, a backdrop click, and the cancel button all resolve
|
|
25
|
+
* `false`. A drop-in replacement for `window.confirm()`.
|
|
26
|
+
*
|
|
27
|
+
* Mounts a transient `<lyra-dialog>` for the duration of the call and
|
|
28
|
+
* removes it once settled, rather than reusing a persistent page-level
|
|
29
|
+
* region (contrast `lyra-toast`'s `toaster.ts`): a confirmation modal has no
|
|
30
|
+
* stacking/queueing concerns -- only one is ever meant to be open at a time
|
|
31
|
+
* -- so a mount-and-remove per call keeps its lifetime trivially tied to the
|
|
32
|
+
* returned promise, with nothing left mounted between calls.
|
|
33
|
+
*
|
|
34
|
+
* Every dismissal path (confirm button, cancel button, Escape, backdrop
|
|
35
|
+
* click) funnels through `<lyra-dialog>`'s own `close()`/`lyra-dialog-close`
|
|
36
|
+
* event, so there is exactly one place that resolves the promise and tears
|
|
37
|
+
* the dialog down.
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* const ok = await confirm({
|
|
41
|
+
* title: 'Delete conversation?',
|
|
42
|
+
* description: 'This cannot be undone.',
|
|
43
|
+
* confirmLabel: 'Delete',
|
|
44
|
+
* tone: 'danger',
|
|
45
|
+
* });
|
|
46
|
+
* if (ok) deleteConversation();
|
|
47
|
+
*/
|
|
48
|
+
export function confirm(options) {
|
|
49
|
+
const { title, description, confirmLabel = 'Confirm', cancelLabel = 'Cancel', tone = 'neutral' } = options;
|
|
50
|
+
return new Promise((resolve) => {
|
|
51
|
+
const dialog = document.createElement('lyra-dialog');
|
|
52
|
+
const heading = document.createElement('h2');
|
|
53
|
+
heading.textContent = title;
|
|
54
|
+
heading.style.cssText = 'margin: 0 0 var(--lyra-space-s) 0; font-size: 1.0625rem; font-weight: 600;';
|
|
55
|
+
dialog.appendChild(heading);
|
|
56
|
+
if (description) {
|
|
57
|
+
const desc = document.createElement('p');
|
|
58
|
+
desc.textContent = description;
|
|
59
|
+
desc.style.cssText = 'margin: var(--lyra-space-xs) 0 0 0; color: var(--lyra-color-text-quiet);';
|
|
60
|
+
dialog.appendChild(desc);
|
|
61
|
+
}
|
|
62
|
+
dialog.addEventListener('lyra-dialog-close', (e) => {
|
|
63
|
+
const reason = e.detail;
|
|
64
|
+
resolve(reason === 'confirm');
|
|
65
|
+
dialog.remove();
|
|
66
|
+
});
|
|
67
|
+
const cancelButton = createButton(cancelLabel, CANCEL_STYLE, () => dialog.close('cancel'));
|
|
68
|
+
cancelButton.slot = 'footer';
|
|
69
|
+
const confirmButton = createButton(confirmLabel, CONFIRM_TONE_STYLE[tone], () => dialog.close('confirm'));
|
|
70
|
+
confirmButton.slot = 'footer';
|
|
71
|
+
dialog.appendChild(cancelButton);
|
|
72
|
+
dialog.appendChild(confirmButton);
|
|
73
|
+
dialog.open = true;
|
|
74
|
+
document.body.appendChild(dialog);
|
|
75
|
+
});
|
|
76
|
+
}
|