@asanchez-sa/abby 0.0.0-stage → 0.1.1
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 +245 -2
- package/dist/_virtual/_rolldown/runtime.js +26 -0
- package/dist/agents/approvals.d.ts +46 -0
- package/dist/agents/approvals.js +58 -0
- package/dist/agents/changes.d.ts +21 -0
- package/dist/agents/changes.js +21 -0
- package/dist/agents/hooks.d.ts +20 -0
- package/dist/agents/hooks.js +58 -0
- package/dist/agents/index.d.ts +11 -0
- package/dist/agents/index.js +9 -0
- package/dist/agents/run-tool.d.ts +44 -0
- package/dist/agents/run-tool.js +79 -0
- package/dist/agents/ui-sdk.d.ts +5 -0
- package/dist/agents/ui-sdk.js +3 -0
- package/dist/behaviors/canvas/index.d.ts +2 -0
- package/dist/behaviors/canvas/index.js +1 -0
- package/dist/behaviors/canvas/ui-sdk.d.ts +2 -0
- package/dist/behaviors/canvas/ui-sdk.js +1 -0
- package/dist/behaviors/drag-and-drop/index.d.ts +2 -0
- package/dist/behaviors/drag-and-drop/index.js +1 -0
- package/dist/behaviors/drag-and-drop/ui-sdk.d.ts +2 -0
- package/dist/behaviors/drag-and-drop/ui-sdk.js +1 -0
- package/dist/behaviors/dragging/index.d.ts +2 -0
- package/dist/behaviors/dragging/index.js +1 -0
- package/dist/behaviors/dragging/ui-sdk.d.ts +2 -0
- package/dist/behaviors/dragging/ui-sdk.js +1 -0
- package/dist/behaviors/focus/index.d.ts +2 -0
- package/dist/behaviors/focus/index.js +1 -0
- package/dist/behaviors/focus/ui-sdk.d.ts +2 -0
- package/dist/behaviors/focus/ui-sdk.js +1 -0
- package/dist/behaviors/lists/index.d.ts +3 -0
- package/dist/behaviors/lists/index.js +3 -0
- package/dist/behaviors/lists/ui-sdk.d.ts +3 -0
- package/dist/behaviors/lists/ui-sdk.js +3 -0
- package/dist/behaviors/popups/index.d.ts +3 -0
- package/dist/behaviors/popups/index.js +3 -0
- package/dist/behaviors/popups/ui-sdk.d.ts +3 -0
- package/dist/behaviors/popups/ui-sdk.js +3 -0
- package/dist/behaviors/preferences/index.d.ts +3 -0
- package/dist/behaviors/preferences/index.js +3 -0
- package/dist/behaviors/preferences/ui-sdk.d.ts +3 -0
- package/dist/behaviors/preferences/ui-sdk.js +3 -0
- package/dist/behaviors/selection/index.d.ts +3 -0
- package/dist/behaviors/selection/index.js +3 -0
- package/dist/behaviors/selection/indicator.d.ts +13 -0
- package/dist/behaviors/selection/indicator.js +20 -0
- package/dist/behaviors/selection/ui-sdk.d.ts +2 -0
- package/dist/behaviors/selection/ui-sdk.js +1 -0
- package/dist/behaviors/transitions/index.d.ts +3 -0
- package/dist/behaviors/transitions/index.js +3 -0
- package/dist/behaviors/transitions/ui-sdk.d.ts +3 -0
- package/dist/behaviors/transitions/ui-sdk.js +3 -0
- package/dist/behaviors/trees/index.d.ts +2 -0
- package/dist/behaviors/trees/index.js +1 -0
- package/dist/behaviors/trees/ui-sdk.d.ts +2 -0
- package/dist/behaviors/trees/ui-sdk.js +1 -0
- package/dist/components/accordion/accordion.d.ts +13 -0
- package/dist/components/accordion/accordion.js +165 -0
- package/dist/components/alert/alert.d.ts +13 -0
- package/dist/components/alert/alert.js +131 -0
- package/dist/components/alert-dialog/alert-dialog.d.ts +15 -0
- package/dist/components/alert-dialog/alert-dialog.js +257 -0
- package/dist/components/aspect-ratio/aspect-ratio.d.ts +7 -0
- package/dist/components/aspect-ratio/aspect-ratio.js +57 -0
- package/dist/components/attachment/attachment.d.ts +48 -0
- package/dist/components/attachment/attachment.js +372 -0
- package/dist/components/autocomplete/autocomplete.d.ts +32 -0
- package/dist/components/autocomplete/autocomplete.js +466 -0
- package/dist/components/avatar/avatar.d.ts +6 -0
- package/dist/components/avatar/avatar.js +100 -0
- package/dist/components/avatar-group/avatar-group.d.ts +9 -0
- package/dist/components/avatar-group/avatar-group.js +75 -0
- package/dist/components/badge/badge.d.ts +15 -0
- package/dist/components/badge/badge.js +31 -0
- package/dist/components/breadcrumb/breadcrumb.d.ts +24 -0
- package/dist/components/breadcrumb/breadcrumb.js +279 -0
- package/dist/components/bubble/bubble.d.ts +26 -0
- package/dist/components/bubble/bubble.js +173 -0
- package/dist/components/button/button.d.ts +18 -0
- package/dist/components/button/button.js +91 -0
- package/dist/components/button-group/button-group.d.ts +15 -0
- package/dist/components/button-group/button-group.js +71 -0
- package/dist/components/calendar/calendar.d.ts +29 -0
- package/dist/components/calendar/calendar.js +453 -0
- package/dist/components/card/card.d.ts +14 -0
- package/dist/components/card/card.js +213 -0
- package/dist/components/carousel/carousel.d.ts +16 -0
- package/dist/components/carousel/carousel.js +364 -0
- package/dist/components/chain-of-thought/chain-of-thought.d.ts +72 -0
- package/dist/components/chain-of-thought/chain-of-thought.js +491 -0
- package/dist/components/chat/chat.d.ts +48 -0
- package/dist/components/chat/chat.js +207 -0
- package/dist/components/checkbox/checkbox.d.ts +10 -0
- package/dist/components/checkbox/checkbox.js +118 -0
- package/dist/components/checkpoint/checkpoint.d.ts +24 -0
- package/dist/components/checkpoint/checkpoint.js +178 -0
- package/dist/components/choice-cards/choice-cards.d.ts +38 -0
- package/dist/components/choice-cards/choice-cards.js +255 -0
- package/dist/components/code-block/code-block.d.ts +58 -0
- package/dist/components/code-block/code-block.js +506 -0
- package/dist/components/code-block/highlighter.js +96 -0
- package/dist/components/code-block/use-highlighted-code.d.ts +11 -0
- package/dist/components/code-block/use-highlighted-code.js +54 -0
- package/dist/components/collapsible/collapsible.d.ts +10 -0
- package/dist/components/collapsible/collapsible.js +92 -0
- package/dist/components/color-picker/color-picker.d.ts +17 -0
- package/dist/components/color-picker/color-picker.js +395 -0
- package/dist/components/combobox/combobox.d.ts +54 -0
- package/dist/components/combobox/combobox.js +683 -0
- package/dist/components/command/command.d.ts +23 -0
- package/dist/components/command/command.js +373 -0
- package/dist/components/command-dock/command-dock.d.ts +118 -0
- package/dist/components/command-dock/command-dock.js +944 -0
- package/dist/components/confirmation/confirmation.d.ts +58 -0
- package/dist/components/confirmation/confirmation.js +181 -0
- package/dist/components/context/context.d.ts +82 -0
- package/dist/components/context/context.js +490 -0
- package/dist/components/date-input/date-input.d.ts +16 -0
- package/dist/components/date-input/date-input.js +89 -0
- package/dist/components/date-picker/date-picker.d.ts +28 -0
- package/dist/components/date-picker/date-picker.js +361 -0
- package/dist/components/dialog/dialog.d.ts +14 -0
- package/dist/components/dialog/dialog.js +261 -0
- package/dist/components/drawer/drawer.d.ts +16 -0
- package/dist/components/drawer/drawer.js +309 -0
- package/dist/components/empty/empty.d.ts +18 -0
- package/dist/components/empty/empty.js +192 -0
- package/dist/components/field/field.d.ts +15 -0
- package/dist/components/field/field.js +261 -0
- package/dist/components/file-input/file-input.d.ts +12 -0
- package/dist/components/file-input/file-input.js +216 -0
- package/dist/components/file-tree/file-tree.d.ts +45 -0
- package/dist/components/file-tree/file-tree.js +283 -0
- package/dist/components/hover-card/hover-card.d.ts +10 -0
- package/dist/components/hover-card/hover-card.js +118 -0
- package/dist/components/icon/icon.d.ts +14 -0
- package/dist/components/icon/icon.js +60 -0
- package/dist/components/image-cropper/image-cropper.d.ts +15 -0
- package/dist/components/image-cropper/image-cropper.js +334 -0
- package/dist/components/inline-citation/inline-citation.d.ts +46 -0
- package/dist/components/inline-citation/inline-citation.js +269 -0
- package/dist/components/input/input.d.ts +9 -0
- package/dist/components/input/input.js +43 -0
- package/dist/components/input-group/input-group.d.ts +42 -0
- package/dist/components/input-group/input-group.js +192 -0
- package/dist/components/item/item.d.ts +32 -0
- package/dist/components/item/item.js +394 -0
- package/dist/components/kbd/kbd.d.ts +9 -0
- package/dist/components/kbd/kbd.js +75 -0
- package/dist/components/label/label.d.ts +6 -0
- package/dist/components/label/label.js +40 -0
- package/dist/components/link/link.d.ts +21 -0
- package/dist/components/link/link.js +126 -0
- package/dist/components/listbox/listbox.d.ts +20 -0
- package/dist/components/listbox/listbox.js +199 -0
- package/dist/components/marker/marker.d.ts +11 -0
- package/dist/components/marker/marker.js +88 -0
- package/dist/components/menu/menu.d.ts +38 -0
- package/dist/components/menu/menu.js +553 -0
- package/dist/components/menubar/menubar.d.ts +9 -0
- package/dist/components/menubar/menubar.js +47 -0
- package/dist/components/message/message.d.ts +44 -0
- package/dist/components/message/message.js +328 -0
- package/dist/components/message-scroller/message-scroller.d.ts +111 -0
- package/dist/components/message-scroller/message-scroller.js +957 -0
- package/dist/components/meter/meter.d.ts +8 -0
- package/dist/components/meter/meter.js +162 -0
- package/dist/components/model-selector/model-selector.d.ts +155 -0
- package/dist/components/model-selector/model-selector.js +905 -0
- package/dist/components/native-select/native-select.d.ts +27 -0
- package/dist/components/native-select/native-select.js +226 -0
- package/dist/components/navigation-menu/navigation-menu.d.ts +29 -0
- package/dist/components/navigation-menu/navigation-menu.js +318 -0
- package/dist/components/not-label.js +9 -0
- package/dist/components/note-editor/blocks.d.ts +22 -0
- package/dist/components/note-editor/blocks.js +245 -0
- package/dist/components/note-editor/diff.d.ts +19 -0
- package/dist/components/note-editor/diff.js +64 -0
- package/dist/components/note-editor/editor.js +249 -0
- package/dist/components/note-editor/note-editor.d.ts +109 -0
- package/dist/components/note-editor/note-editor.js +954 -0
- package/dist/components/note-editor/parts/comments.d.ts +24 -0
- package/dist/components/note-editor/parts/comments.js +337 -0
- package/dist/components/note-editor/parts/header.d.ts +25 -0
- package/dist/components/note-editor/parts/header.js +263 -0
- package/dist/components/note-editor/parts/history.d.ts +56 -0
- package/dist/components/note-editor/parts/history.js +409 -0
- package/dist/components/note-editor/parts/presence.d.ts +31 -0
- package/dist/components/note-editor/parts/presence.js +140 -0
- package/dist/components/note-editor/parts/suggestions.d.ts +45 -0
- package/dist/components/note-editor/parts/suggestions.js +316 -0
- package/dist/components/note-editor/parts/toolbar.d.ts +38 -0
- package/dist/components/note-editor/parts/toolbar.js +687 -0
- package/dist/components/note-editor/people.d.ts +84 -0
- package/dist/components/note-editor/people.js +276 -0
- package/dist/components/note-editor/person.d.ts +11 -0
- package/dist/components/note-editor/person.js +15 -0
- package/dist/components/note-place/note-place.d.ts +42 -0
- package/dist/components/note-place/note-place.js +256 -0
- package/dist/components/note-status/note-status.d.ts +59 -0
- package/dist/components/note-status/note-status.js +380 -0
- package/dist/components/number-input/number-input.d.ts +12 -0
- package/dist/components/number-input/number-input.js +252 -0
- package/dist/components/otp-input/otp-input.d.ts +12 -0
- package/dist/components/otp-input/otp-input.js +136 -0
- package/dist/components/pagination/pagination.d.ts +23 -0
- package/dist/components/pagination/pagination.js +218 -0
- package/dist/components/password-input/password-input.d.ts +11 -0
- package/dist/components/password-input/password-input.js +117 -0
- package/dist/components/plan/plan.d.ts +51 -0
- package/dist/components/plan/plan.js +320 -0
- package/dist/components/popover/popover.d.ts +16 -0
- package/dist/components/popover/popover.js +268 -0
- package/dist/components/preferences/preferences.d.ts +5 -0
- package/dist/components/preferences/preferences.js +18 -0
- package/dist/components/progress/progress.d.ts +8 -0
- package/dist/components/progress/progress.js +162 -0
- package/dist/components/prompt-input/prompt-input.d.ts +247 -0
- package/dist/components/prompt-input/prompt-input.js +1367 -0
- package/dist/components/questionnaire/questionnaire.d.ts +174 -0
- package/dist/components/questionnaire/questionnaire.js +1628 -0
- package/dist/components/queue/queue.d.ts +82 -0
- package/dist/components/queue/queue.js +471 -0
- package/dist/components/radio/radio.d.ts +7 -0
- package/dist/components/radio/radio.js +101 -0
- package/dist/components/rating/rating.d.ts +10 -0
- package/dist/components/rating/rating.js +95 -0
- package/dist/components/reasoning/reasoning.d.ts +50 -0
- package/dist/components/reasoning/reasoning.js +233 -0
- package/dist/components/resizable/resizable.d.ts +6 -0
- package/dist/components/resizable/resizable.js +100 -0
- package/dist/components/scroll-area/scroll-area.d.ts +17 -0
- package/dist/components/scroll-area/scroll-area.js +211 -0
- package/dist/components/segmented-control/segmented-control.d.ts +16 -0
- package/dist/components/segmented-control/segmented-control.js +142 -0
- package/dist/components/select/select.d.ts +43 -0
- package/dist/components/select/select.js +577 -0
- package/dist/components/separator/separator.d.ts +4 -0
- package/dist/components/separator/separator.js +38 -0
- package/dist/components/sheet/sheet.d.ts +24 -0
- package/dist/components/sheet/sheet.js +330 -0
- package/dist/components/sidebar/sidebar.d.ts +138 -0
- package/dist/components/sidebar/sidebar.js +1374 -0
- package/dist/components/skeleton/skeleton.d.ts +4 -0
- package/dist/components/skeleton/skeleton.js +40 -0
- package/dist/components/slider/slider.d.ts +9 -0
- package/dist/components/slider/slider.js +193 -0
- package/dist/components/sources/sources.d.ts +35 -0
- package/dist/components/sources/sources.js +209 -0
- package/dist/components/spinner/spinner.d.ts +11 -0
- package/dist/components/spinner/spinner.js +59 -0
- package/dist/components/stack-trace/parse-stack-trace.d.ts +21 -0
- package/dist/components/stack-trace/parse-stack-trace.js +61 -0
- package/dist/components/stack-trace/stack-trace.d.ts +79 -0
- package/dist/components/stack-trace/stack-trace.js +434 -0
- package/dist/components/subagent/subagent.d.ts +71 -0
- package/dist/components/subagent/subagent.js +450 -0
- package/dist/components/suggestion/suggestion.d.ts +21 -0
- package/dist/components/suggestion/suggestion.js +130 -0
- package/dist/components/switch/switch.d.ts +6 -0
- package/dist/components/switch/switch.js +70 -0
- package/dist/components/table/table.d.ts +19 -0
- package/dist/components/table/table.js +284 -0
- package/dist/components/table-of-contents/spy.js +84 -0
- package/dist/components/table-of-contents/table-of-contents.d.ts +92 -0
- package/dist/components/table-of-contents/table-of-contents.js +787 -0
- package/dist/components/tabs/tabs.d.ts +25 -0
- package/dist/components/tabs/tabs.js +273 -0
- package/dist/components/task/task.d.ts +40 -0
- package/dist/components/task/task.js +262 -0
- package/dist/components/terminal/terminal.d.ts +82 -0
- package/dist/components/terminal/terminal.js +457 -0
- package/dist/components/test-results/test-results.d.ts +127 -0
- package/dist/components/test-results/test-results.js +687 -0
- package/dist/components/textarea/textarea.d.ts +8 -0
- package/dist/components/textarea/textarea.js +43 -0
- package/dist/components/time-input/time-input.d.ts +7 -0
- package/dist/components/time-input/time-input.js +82 -0
- package/dist/components/timeline/timeline.d.ts +19 -0
- package/dist/components/timeline/timeline.js +247 -0
- package/dist/components/toast/toast.d.ts +12 -0
- package/dist/components/toast/toast.js +285 -0
- package/dist/components/toggle/toggle.d.ts +15 -0
- package/dist/components/toggle/toggle.js +137 -0
- package/dist/components/token-input/token-input.d.ts +7 -0
- package/dist/components/token-input/token-input.js +117 -0
- package/dist/components/tool/tool.d.ts +66 -0
- package/dist/components/tool/tool.js +413 -0
- package/dist/components/toolbar/toolbar.d.ts +91 -0
- package/dist/components/toolbar/toolbar.js +655 -0
- package/dist/components/tooltip/tooltip.d.ts +8 -0
- package/dist/components/tooltip/tooltip.js +97 -0
- package/dist/components/trace/trace.d.ts +31 -0
- package/dist/components/trace/trace.js +309 -0
- package/dist/components/tree/tree.d.ts +13 -0
- package/dist/components/tree/tree.js +258 -0
- package/dist/components/trigger-menu/trigger-menu.d.ts +30 -0
- package/dist/components/trigger-menu/trigger-menu.js +352 -0
- package/dist/components/usage/usage.d.ts +132 -0
- package/dist/components/usage/usage.js +1368 -0
- package/dist/components/waterfall/waterfall.d.ts +20 -0
- package/dist/components/waterfall/waterfall.js +360 -0
- package/dist/components/week-strip/week-strip.d.ts +177 -0
- package/dist/components/week-strip/week-strip.js +1081 -0
- package/dist/core/index.d.ts +7 -0
- package/dist/core/index.js +27 -0
- package/dist/core/ui-sdk.d.ts +3 -0
- package/dist/core/ui-sdk.js +3 -0
- package/dist/core/use-primitive-state.d.ts +14 -0
- package/dist/core/use-primitive-state.js +25 -0
- package/dist/styles/LICENSE-shadcn.md +21 -0
- package/dist/styles/color-scheme.css +32 -0
- package/dist/styles/components.css +303 -0
- package/dist/styles/index.css +41 -0
- package/dist/styles/tokens.css +474 -0
- package/dist/styles/typeset/shadcn.css +506 -0
- package/dist/styles/typeset.css +70 -0
- package/dist/styles/utilities.css +555 -0
- package/dist/tools/observe/index.d.ts +2 -0
- package/dist/tools/observe/index.js +3 -0
- package/dist/tools/observe/ui-sdk.d.ts +1 -0
- package/dist/tools/observe/ui-sdk.js +2 -0
- package/dist/tools/testing/check-agent.d.ts +28 -0
- package/dist/tools/testing/check-agent.js +42 -0
- package/dist/tools/testing/index.d.ts +4 -0
- package/dist/tools/testing/index.js +4 -0
- package/dist/tools/testing/ui-sdk.d.ts +1 -0
- package/dist/tools/testing/ui-sdk.js +2 -0
- package/dist/utilities/cn/index.d.ts +12 -0
- package/dist/utilities/cn/index.js +47 -0
- package/dist/utilities/color/index.d.ts +2 -0
- package/dist/utilities/color/index.js +3 -0
- package/dist/utilities/color/ui-sdk.d.ts +1 -0
- package/dist/utilities/color/ui-sdk.js +2 -0
- package/dist/utilities/date/index.d.ts +2 -0
- package/dist/utilities/date/index.js +6 -0
- package/dist/utilities/date/ui-sdk.d.ts +1 -0
- package/dist/utilities/date/ui-sdk.js +2 -0
- package/dist/utilities/image/index.d.ts +2 -0
- package/dist/utilities/image/index.js +3 -0
- package/dist/utilities/image/ui-sdk.d.ts +1 -0
- package/dist/utilities/image/ui-sdk.js +2 -0
- package/dist/utilities/mobile/index.d.ts +2 -0
- package/dist/utilities/mobile/index.js +1 -0
- package/dist/utilities/mobile/ui-sdk.d.ts +2 -0
- package/dist/utilities/mobile/ui-sdk.js +1 -0
- package/dist/utilities/number/index.d.ts +2 -0
- package/dist/utilities/number/index.js +3 -0
- package/dist/utilities/number/ui-sdk.d.ts +1 -0
- package/dist/utilities/number/ui-sdk.js +2 -0
- package/dist/utilities/platform/index.d.ts +3 -0
- package/dist/utilities/platform/index.js +14 -0
- package/dist/utilities/platform/ui-sdk.d.ts +3 -0
- package/dist/utilities/platform/ui-sdk.js +3 -0
- package/dist/utilities/storage/index.d.ts +2 -0
- package/dist/utilities/storage/index.js +1 -0
- package/dist/utilities/storage/ui-sdk.d.ts +2 -0
- package/dist/utilities/storage/ui-sdk.js +1 -0
- package/dist/utilities/text/index.d.ts +3 -0
- package/dist/utilities/text/index.js +3 -0
- package/dist/utilities/text/ui-sdk.d.ts +3 -0
- package/dist/utilities/text/ui-sdk.js +3 -0
- package/package.json +192 -4
- package/skills/agent-ready-ui/SKILL.md +229 -0
- package/skills/blocks/SKILL.md +262 -0
- package/skills/compose-screens/SKILL.md +354 -0
- package/skills/note-editor/SKILL.md +493 -0
- package/skills/note-status/SKILL.md +295 -0
- package/skills/setup/SKILL.md +136 -0
- package/skills/theming/SKILL.md +216 -0
- package/src/blocks/notes/adapters.ts +77 -0
- package/src/blocks/notes/data.ts +508 -0
- package/src/blocks/notes/notes-block.tsx +244 -0
- package/src/blocks/notes/parts/home.tsx +219 -0
- package/src/blocks/notes/parts/no-access.tsx +84 -0
- package/src/blocks/notes/parts/note-screen.tsx +412 -0
- package/src/blocks/notes/parts/notes-sidebar.tsx +277 -0
- package/src/blocks/notes/parts/panels.tsx +393 -0
- package/src/blocks/notes/parts/place.ts +15 -0
- package/src/blocks/notes/parts/review-dialog.tsx +159 -0
- package/src/blocks/notes/parts/share.tsx +172 -0
- package/src/blocks/notes/texts.ts +135 -0
- package/src/blocks/shell/adapters.ts +69 -0
- package/src/blocks/shell/data.ts +281 -0
- package/src/blocks/shell/parts/compose.tsx +292 -0
- package/src/blocks/shell/parts/home.tsx +203 -0
- package/src/blocks/shell/parts/marks.tsx +144 -0
- package/src/blocks/shell/parts/rail.tsx +166 -0
- package/src/blocks/shell/parts/rooms-column.tsx +326 -0
- package/src/blocks/shell/shell-block.tsx +210 -0
- package/src/blocks/shell/texts.ts +80 -0
|
@@ -0,0 +1,1081 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { createChange, createController, definePrimitive } from "../../core/ui-sdk.js";
|
|
3
|
+
import { usePrimitiveState } from "../../core/use-primitive-state.js";
|
|
4
|
+
import "../../behaviors/focus/index.js";
|
|
5
|
+
import { createRovingFocus } from "../../behaviors/focus/ui-sdk.js";
|
|
6
|
+
import { core_exports } from "../../core/index.js";
|
|
7
|
+
import { cn, cnState, cva } from "../../utilities/cn/index.js";
|
|
8
|
+
import { date_exports } from "../../utilities/date/index.js";
|
|
9
|
+
import "../../utilities/platform/index.js";
|
|
10
|
+
import { createTypeahead, isTypeaheadKey, pageLocale } from "../../utilities/text/ui-sdk.js";
|
|
11
|
+
import "../../utilities/text/index.js";
|
|
12
|
+
import { announce } from "../../utilities/platform/ui-sdk.js";
|
|
13
|
+
import { buttonLook } from "../button/button.js";
|
|
14
|
+
import { Icon } from "../icon/icon.js";
|
|
15
|
+
import { c } from "react/compiler-runtime";
|
|
16
|
+
import { createContext, use } from "react";
|
|
17
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
18
|
+
import { ArrowLeft01Icon, ArrowRight01Icon } from "@hugeicons/core-free-icons";
|
|
19
|
+
// src/components/week-strip/week-strip.tsx
|
|
20
|
+
const SCROLL_LENGTH = 14;
|
|
21
|
+
function matches(date, matchers) {
|
|
22
|
+
if (!matchers) return false;
|
|
23
|
+
return (Array.isArray(matchers) ? matchers : [matchers]).some((matcher) => {
|
|
24
|
+
if (typeof matcher === "string") return matcher === date;
|
|
25
|
+
if (typeof matcher === "function") return matcher(date);
|
|
26
|
+
if ("weekday" in matcher) return matcher.weekday.includes((0, date_exports.weekday)(date));
|
|
27
|
+
if ("before" in matcher) return date < matcher.before;
|
|
28
|
+
if ("after" in matcher) return date > matcher.after;
|
|
29
|
+
return date >= matcher.from && date <= matcher.to;
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
const localeOf = (state) => state.locale ?? void 0;
|
|
33
|
+
const weekStartOf = (state) => state.weekStartsOn === "auto" ? (0, date_exports.firstDayOfWeek)(localeOf(state)) : state.weekStartsOn;
|
|
34
|
+
/** The first day shown: the week's first day, or `start` in scroll mode. */
|
|
35
|
+
const firstDayOf = (state) => state.scroll ? state.start : (0, date_exports.startOfWeek)(state.week, weekStartOf(state));
|
|
36
|
+
function daysOf(state) {
|
|
37
|
+
const first = firstDayOf(state);
|
|
38
|
+
const length = state.scroll ? Math.max(1, Math.floor(state.length)) : 7;
|
|
39
|
+
return Array.from({ length }, (_, index) => (0, date_exports.addDays)(first, index));
|
|
40
|
+
}
|
|
41
|
+
/** The day that takes the tab stop: the selected one, else today, else the first that can be picked. */
|
|
42
|
+
function stopOf(state) {
|
|
43
|
+
const days = daysOf(state);
|
|
44
|
+
if (state.value && days.includes(state.value)) return state.value;
|
|
45
|
+
if (state.today && days.includes(state.today)) return state.today;
|
|
46
|
+
return days.find((day) => !matches(day, state.unavailable)) ?? days[0];
|
|
47
|
+
}
|
|
48
|
+
function nameOf(state, date, mark) {
|
|
49
|
+
return [
|
|
50
|
+
(0, date_exports.formatDate)(date, localeOf(state)),
|
|
51
|
+
mark?.label,
|
|
52
|
+
mark?.description
|
|
53
|
+
].filter(Boolean).join(", ");
|
|
54
|
+
}
|
|
55
|
+
function rangeOf(state) {
|
|
56
|
+
const days = daysOf(state);
|
|
57
|
+
return (0, date_exports.formatDateRange)(days[0], days.at(-1), localeOf(state), {
|
|
58
|
+
day: "numeric",
|
|
59
|
+
month: "long",
|
|
60
|
+
year: "numeric"
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
function monthsOf(state) {
|
|
64
|
+
const days = daysOf(state);
|
|
65
|
+
return (0, date_exports.formatDateRange)(days[0], days.at(-1), localeOf(state), {
|
|
66
|
+
month: "long",
|
|
67
|
+
year: "numeric"
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
const present = (on) => on ? "" : void 0;
|
|
71
|
+
const reducedMotion = (el) => el.ownerDocument.defaultView?.matchMedia("(prefers-reduced-motion: reduce)").matches ?? true;
|
|
72
|
+
/**
|
|
73
|
+
* Not exported: its inferred type names ui-sdk types that aren't public, so
|
|
74
|
+
* the declaration build can't describe it from another module.
|
|
75
|
+
*/
|
|
76
|
+
const weekStrip = definePrimitive({
|
|
77
|
+
name: "week-strip",
|
|
78
|
+
options: {
|
|
79
|
+
value: "string",
|
|
80
|
+
defaultValue: "string",
|
|
81
|
+
onValueChange: "callback",
|
|
82
|
+
week: "string",
|
|
83
|
+
defaultWeek: "string",
|
|
84
|
+
onWeekChange: "callback",
|
|
85
|
+
scroll: "boolean",
|
|
86
|
+
start: "string",
|
|
87
|
+
length: "number",
|
|
88
|
+
weekStartsOn: "value",
|
|
89
|
+
locale: "string",
|
|
90
|
+
timeZone: "string",
|
|
91
|
+
today: "string",
|
|
92
|
+
unavailable: "value",
|
|
93
|
+
faded: "value",
|
|
94
|
+
marks: "value",
|
|
95
|
+
disabled: "boolean",
|
|
96
|
+
controller: "value"
|
|
97
|
+
},
|
|
98
|
+
controlled: ["value", "week"],
|
|
99
|
+
state: (options) => {
|
|
100
|
+
const today = options.today ?? (0, date_exports.todayDate)(options.timeZone);
|
|
101
|
+
const value = options.value ?? options.defaultValue ?? null;
|
|
102
|
+
return {
|
|
103
|
+
value,
|
|
104
|
+
week: options.week ?? options.defaultWeek ?? value ?? today,
|
|
105
|
+
focused: null,
|
|
106
|
+
scroll: options.scroll ?? false,
|
|
107
|
+
start: options.start ?? today,
|
|
108
|
+
length: options.length ?? SCROLL_LENGTH,
|
|
109
|
+
weekStartsOn: options.weekStartsOn ?? "auto",
|
|
110
|
+
locale: options.locale ?? null,
|
|
111
|
+
today: options.today ?? null,
|
|
112
|
+
unavailable: options.unavailable ?? null,
|
|
113
|
+
faded: options.faded ?? null,
|
|
114
|
+
marks: options.marks ?? null,
|
|
115
|
+
disabled: options.disabled ?? false
|
|
116
|
+
};
|
|
117
|
+
},
|
|
118
|
+
sync: (options) => ({
|
|
119
|
+
...options.value === void 0 ? {} : { value: options.value },
|
|
120
|
+
...options.week === void 0 ? {} : { week: options.week },
|
|
121
|
+
...options.start === void 0 ? {} : { start: options.start },
|
|
122
|
+
...options.locale === void 0 ? {} : { locale: options.locale },
|
|
123
|
+
...options.today === void 0 ? {} : { today: options.today },
|
|
124
|
+
scroll: options.scroll ?? false,
|
|
125
|
+
length: options.length ?? SCROLL_LENGTH,
|
|
126
|
+
weekStartsOn: options.weekStartsOn ?? "auto",
|
|
127
|
+
unavailable: options.unavailable ?? null,
|
|
128
|
+
faded: options.faded ?? null,
|
|
129
|
+
marks: options.marks ?? null,
|
|
130
|
+
disabled: options.disabled ?? false
|
|
131
|
+
}),
|
|
132
|
+
api: (context) => {
|
|
133
|
+
const { store } = context;
|
|
134
|
+
const change = createChange(context);
|
|
135
|
+
const showWeek = (date, reason, event) => {
|
|
136
|
+
const state = store.get();
|
|
137
|
+
if (state.scroll || state.disabled || !(0, date_exports.isISODate)(date)) return false;
|
|
138
|
+
const start = weekStartOf(state);
|
|
139
|
+
const week = (0, date_exports.startOfWeek)(date, start);
|
|
140
|
+
if (week === (0, date_exports.startOfWeek)(state.week, start)) return true;
|
|
141
|
+
return change("week", week, {
|
|
142
|
+
reason,
|
|
143
|
+
event
|
|
144
|
+
});
|
|
145
|
+
};
|
|
146
|
+
const pickable = (date) => {
|
|
147
|
+
const state = store.get();
|
|
148
|
+
if (state.disabled || !(0, date_exports.isISODate)(date) || matches(date, state.unavailable)) return false;
|
|
149
|
+
return !state.scroll || daysOf(state).includes(date);
|
|
150
|
+
};
|
|
151
|
+
const select = (date, reason, event) => {
|
|
152
|
+
if (!pickable(date) || !change("value", date, {
|
|
153
|
+
reason,
|
|
154
|
+
event
|
|
155
|
+
})) return false;
|
|
156
|
+
if (!daysOf(store.get()).includes(date)) showWeek(date, "imperative");
|
|
157
|
+
return true;
|
|
158
|
+
};
|
|
159
|
+
const step = (by, reason, event) => {
|
|
160
|
+
const state = store.get();
|
|
161
|
+
const target = (0, date_exports.addDays)(firstDayOf(state), by);
|
|
162
|
+
const pressed = event instanceof Event;
|
|
163
|
+
const shown = showWeek(target, pressed ? reason : "imperative", pressed ? event : void 0);
|
|
164
|
+
if (shown && pressed) announce(rangeOf({
|
|
165
|
+
...state,
|
|
166
|
+
week: target
|
|
167
|
+
}), { doc: context.element("root")?.ownerDocument });
|
|
168
|
+
return shown;
|
|
169
|
+
};
|
|
170
|
+
const roving = createRovingFocus(context, {
|
|
171
|
+
slot: "day",
|
|
172
|
+
key: "focused",
|
|
173
|
+
remember: false,
|
|
174
|
+
disabled: (item) => matches(item.key, store.get().unavailable),
|
|
175
|
+
focusable: () => !store.get().disabled,
|
|
176
|
+
preferred: (item) => item.key === stopOf(store.get()),
|
|
177
|
+
claims: (state, item) => !state.disabled && item.key === stopOf(state),
|
|
178
|
+
move: (event, { from, rtl }) => {
|
|
179
|
+
if (event.altKey || event.ctrlKey || event.metaKey) return void 0;
|
|
180
|
+
const state = store.get();
|
|
181
|
+
const days = daysOf(state);
|
|
182
|
+
const forward = rtl ? -1 : 1;
|
|
183
|
+
const target = {
|
|
184
|
+
ArrowRight: (0, date_exports.addDays)(from.key, forward),
|
|
185
|
+
ArrowLeft: (0, date_exports.addDays)(from.key, -forward),
|
|
186
|
+
Home: days[0],
|
|
187
|
+
End: days.at(-1),
|
|
188
|
+
PageDown: (0, date_exports.addDays)(from.key, 7),
|
|
189
|
+
PageUp: (0, date_exports.addDays)(from.key, -7)
|
|
190
|
+
}[event.key];
|
|
191
|
+
if (target === void 0) return void 0;
|
|
192
|
+
if (days.includes(target)) return target;
|
|
193
|
+
if (state.scroll) {
|
|
194
|
+
if (event.key === "PageDown") return days.at(-1);
|
|
195
|
+
if (event.key === "PageUp") return days[0];
|
|
196
|
+
return from.key;
|
|
197
|
+
}
|
|
198
|
+
return showWeek(target, "list-navigation", event) ? target : from.key;
|
|
199
|
+
}
|
|
200
|
+
});
|
|
201
|
+
const typeahead = createTypeahead();
|
|
202
|
+
context.onDestroy(typeahead.reset);
|
|
203
|
+
const typeTo = (event, day) => {
|
|
204
|
+
const state = store.get();
|
|
205
|
+
if (state.disabled || !isTypeaheadKey(event)) return;
|
|
206
|
+
if (event.key === " ") event.preventDefault();
|
|
207
|
+
const items = roving.items();
|
|
208
|
+
const labels = items.map((item) => matches(item.key, state.unavailable) ? "" : (0, date_exports.formatDate)(item.key, localeOf(state), { weekday: "long" }));
|
|
209
|
+
const index = typeahead(event.key, labels, items.findIndex((item) => item.el === day));
|
|
210
|
+
if (index !== -1) roving.focus(items[index].key);
|
|
211
|
+
};
|
|
212
|
+
return {
|
|
213
|
+
getValue: () => store.get().value,
|
|
214
|
+
setValue: (value) => value === null ? change("value", null, { reason: "imperative" }) : select(value, "imperative"),
|
|
215
|
+
getWeek: () => firstDayOf(store.get()),
|
|
216
|
+
setWeek: (date) => showWeek(date, "imperative"),
|
|
217
|
+
previous: (event) => step(-7, "previous-press", event),
|
|
218
|
+
next: (event) => step(7, "next-press", event),
|
|
219
|
+
focus: (date) => roving.focus(date ?? stopOf(store.get())),
|
|
220
|
+
/** The days shown, with the names screen readers and agents hear. */
|
|
221
|
+
items: () => {
|
|
222
|
+
const state = store.get();
|
|
223
|
+
return daysOf(state).map((date) => ({
|
|
224
|
+
value: date,
|
|
225
|
+
label: nameOf(state, date, state.marks?.(date))
|
|
226
|
+
}));
|
|
227
|
+
},
|
|
228
|
+
internal: {
|
|
229
|
+
roving,
|
|
230
|
+
select,
|
|
231
|
+
keydown(event) {
|
|
232
|
+
const day = event.target?.closest("[data-slot=\"week-strip-day\"]");
|
|
233
|
+
const date = day?.dataset.value;
|
|
234
|
+
if (event.defaultPrevented || !day || !date) return;
|
|
235
|
+
if (event.key === "Enter" || event.key === " " && !typeahead.active()) {
|
|
236
|
+
event.preventDefault();
|
|
237
|
+
select(date, "item-press", event);
|
|
238
|
+
return;
|
|
239
|
+
}
|
|
240
|
+
if (roving.keydown(event, day)) return;
|
|
241
|
+
typeTo(event, day);
|
|
242
|
+
},
|
|
243
|
+
/** What only the browser knows: the page's language and today's date. */
|
|
244
|
+
readClient(el) {
|
|
245
|
+
const options = context.options();
|
|
246
|
+
store.set({
|
|
247
|
+
...options.locale === void 0 ? { locale: pageLocale(el) ?? null } : {},
|
|
248
|
+
...options.today === void 0 ? { today: (0, date_exports.todayDate)(options.timeZone) } : {}
|
|
249
|
+
});
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
};
|
|
253
|
+
},
|
|
254
|
+
slots: (slot) => ({
|
|
255
|
+
root: slot({
|
|
256
|
+
role: "group",
|
|
257
|
+
state: (state) => ({
|
|
258
|
+
value: state.value,
|
|
259
|
+
days: daysOf(state),
|
|
260
|
+
scroll: state.scroll,
|
|
261
|
+
disabled: state.disabled
|
|
262
|
+
}),
|
|
263
|
+
attrs: (state) => ({
|
|
264
|
+
"data-scroll": present(state.scroll),
|
|
265
|
+
"data-disabled": present(state.disabled)
|
|
266
|
+
}),
|
|
267
|
+
bind: (el, part) => part.api.internal.readClient(el)
|
|
268
|
+
}),
|
|
269
|
+
heading: slot({ state: (state) => ({ label: monthsOf(state) }) }),
|
|
270
|
+
previous: slot({
|
|
271
|
+
present: (state) => !state.scroll,
|
|
272
|
+
state: (state) => ({ disabled: state.disabled }),
|
|
273
|
+
attrs: (state) => ({
|
|
274
|
+
type: "button",
|
|
275
|
+
"aria-disabled": state.disabled ? "true" : void 0,
|
|
276
|
+
"data-disabled": present(state.disabled)
|
|
277
|
+
}),
|
|
278
|
+
press: ({ api }, event) => void api.previous(event)
|
|
279
|
+
}),
|
|
280
|
+
next: slot({
|
|
281
|
+
present: (state) => !state.scroll,
|
|
282
|
+
state: (state) => ({ disabled: state.disabled }),
|
|
283
|
+
attrs: (state) => ({
|
|
284
|
+
type: "button",
|
|
285
|
+
"aria-disabled": state.disabled ? "true" : void 0,
|
|
286
|
+
"data-disabled": present(state.disabled)
|
|
287
|
+
}),
|
|
288
|
+
press: ({ api }, event) => void api.next(event)
|
|
289
|
+
}),
|
|
290
|
+
days: slot({
|
|
291
|
+
role: "listbox",
|
|
292
|
+
keys: [
|
|
293
|
+
"ArrowLeft",
|
|
294
|
+
"ArrowRight",
|
|
295
|
+
"Home",
|
|
296
|
+
"End",
|
|
297
|
+
"PageUp",
|
|
298
|
+
"PageDown",
|
|
299
|
+
"Enter",
|
|
300
|
+
" ",
|
|
301
|
+
"typeahead"
|
|
302
|
+
],
|
|
303
|
+
state: (state) => ({
|
|
304
|
+
days: daysOf(state),
|
|
305
|
+
scroll: state.scroll
|
|
306
|
+
}),
|
|
307
|
+
attrs: (state) => ({
|
|
308
|
+
"aria-label": rangeOf(state),
|
|
309
|
+
"aria-orientation": "horizontal",
|
|
310
|
+
"aria-disabled": state.disabled ? "true" : void 0,
|
|
311
|
+
"data-scroll": present(state.scroll)
|
|
312
|
+
}),
|
|
313
|
+
on: { keydown: (event, { api }) => api.internal.keydown(event) },
|
|
314
|
+
bind: (el, part) => {
|
|
315
|
+
let shown = null;
|
|
316
|
+
const reveal = () => {
|
|
317
|
+
const state = part.store.get();
|
|
318
|
+
const target = state.value ?? state.today;
|
|
319
|
+
if (!state.scroll || !target || target === shown) return;
|
|
320
|
+
const first = shown === null;
|
|
321
|
+
shown = target;
|
|
322
|
+
el.querySelector(`[data-slot="week-strip-day"][data-value="${target}"]`)?.scrollIntoView({
|
|
323
|
+
block: "nearest",
|
|
324
|
+
inline: first ? "center" : "nearest",
|
|
325
|
+
behavior: first || reducedMotion(el) ? "instant" : "smooth"
|
|
326
|
+
});
|
|
327
|
+
};
|
|
328
|
+
reveal();
|
|
329
|
+
return part.store.subscribe(reveal);
|
|
330
|
+
}
|
|
331
|
+
}),
|
|
332
|
+
day: slot({
|
|
333
|
+
role: "option",
|
|
334
|
+
focus: "roving",
|
|
335
|
+
props: { value: "string" },
|
|
336
|
+
state: (state, { key }) => {
|
|
337
|
+
const marks = state.marks?.(key);
|
|
338
|
+
const unavailable = matches(key, state.unavailable);
|
|
339
|
+
return {
|
|
340
|
+
date: key,
|
|
341
|
+
name: nameOf(state, key, marks),
|
|
342
|
+
weekday: (0, date_exports.formatDate)(key, localeOf(state), { weekday: "short" }),
|
|
343
|
+
label: (0, date_exports.formatDate)(key, localeOf(state), { day: "numeric" }),
|
|
344
|
+
selected: state.value === key,
|
|
345
|
+
today: state.today === key,
|
|
346
|
+
unavailable,
|
|
347
|
+
disabled: unavailable || state.disabled,
|
|
348
|
+
faded: matches(key, state.faded),
|
|
349
|
+
scroll: state.scroll,
|
|
350
|
+
marks
|
|
351
|
+
};
|
|
352
|
+
},
|
|
353
|
+
attrs: (state, part) => {
|
|
354
|
+
const unavailable = matches(part.key, state.unavailable);
|
|
355
|
+
const disabled = unavailable || state.disabled;
|
|
356
|
+
return {
|
|
357
|
+
"aria-selected": String(state.value === part.key),
|
|
358
|
+
"aria-disabled": disabled ? "true" : void 0,
|
|
359
|
+
"aria-current": state.today === part.key ? "date" : void 0,
|
|
360
|
+
tabindex: part.api.internal.roving.tabIndex(state, part),
|
|
361
|
+
"data-value": part.key,
|
|
362
|
+
"data-selected": present(state.value === part.key),
|
|
363
|
+
"data-today": present(state.today === part.key),
|
|
364
|
+
"data-unavailable": present(unavailable),
|
|
365
|
+
"data-disabled": present(disabled),
|
|
366
|
+
"data-faded": present(matches(part.key, state.faded))
|
|
367
|
+
};
|
|
368
|
+
},
|
|
369
|
+
press: ({ api, key }, event) => void api.internal.select(key, "item-press", event),
|
|
370
|
+
bind: (el, part) => part.api.internal.roving.bind(el, part)
|
|
371
|
+
})
|
|
372
|
+
}),
|
|
373
|
+
agent: {
|
|
374
|
+
actions: [
|
|
375
|
+
"setValue",
|
|
376
|
+
"setWeek",
|
|
377
|
+
"previous",
|
|
378
|
+
"next"
|
|
379
|
+
],
|
|
380
|
+
items: (api) => api.items()
|
|
381
|
+
}
|
|
382
|
+
});
|
|
383
|
+
/** Drives a week strip from anywhere: pass it as `controller`. */
|
|
384
|
+
function createWeekStripController() {
|
|
385
|
+
return createController();
|
|
386
|
+
}
|
|
387
|
+
const WeekStripContext = createContext(null);
|
|
388
|
+
function useWeekStripContext() {
|
|
389
|
+
const context = use(WeekStripContext);
|
|
390
|
+
if (!context) throw new Error("WeekStrip parts must be used within a WeekStrip.");
|
|
391
|
+
return context;
|
|
392
|
+
}
|
|
393
|
+
/**
|
|
394
|
+
* The strip's state and the methods that change it, for a component inside
|
|
395
|
+
* `WeekStrip`. It re-renders when the state changes.
|
|
396
|
+
*/
|
|
397
|
+
function useWeekStrip() {
|
|
398
|
+
const $ = c(17);
|
|
399
|
+
const { handle } = useWeekStripContext();
|
|
400
|
+
const state = usePrimitiveState(handle);
|
|
401
|
+
const t0 = state.value;
|
|
402
|
+
let t1;
|
|
403
|
+
if ($[0] !== state) {
|
|
404
|
+
t1 = firstDayOf(state);
|
|
405
|
+
$[0] = state;
|
|
406
|
+
$[1] = t1;
|
|
407
|
+
} else t1 = $[1];
|
|
408
|
+
let t2;
|
|
409
|
+
if ($[2] !== state) {
|
|
410
|
+
t2 = daysOf(state);
|
|
411
|
+
$[2] = state;
|
|
412
|
+
$[3] = t2;
|
|
413
|
+
} else t2 = $[3];
|
|
414
|
+
let t3;
|
|
415
|
+
let t4;
|
|
416
|
+
if ($[4] !== handle.api) {
|
|
417
|
+
t3 = () => handle.api.previous();
|
|
418
|
+
t4 = () => handle.api.next();
|
|
419
|
+
$[4] = handle.api;
|
|
420
|
+
$[5] = t3;
|
|
421
|
+
$[6] = t4;
|
|
422
|
+
} else {
|
|
423
|
+
t3 = $[5];
|
|
424
|
+
t4 = $[6];
|
|
425
|
+
}
|
|
426
|
+
let t5;
|
|
427
|
+
if ($[7] !== handle.api.focus || $[8] !== handle.api.setValue || $[9] !== handle.api.setWeek || $[10] !== state.today || $[11] !== state.value || $[12] !== t1 || $[13] !== t2 || $[14] !== t3 || $[15] !== t4) {
|
|
428
|
+
t5 = {
|
|
429
|
+
value: t0,
|
|
430
|
+
week: t1,
|
|
431
|
+
days: t2,
|
|
432
|
+
today: state.today,
|
|
433
|
+
setValue: handle.api.setValue,
|
|
434
|
+
setWeek: handle.api.setWeek,
|
|
435
|
+
previous: t3,
|
|
436
|
+
next: t4,
|
|
437
|
+
focus: handle.api.focus
|
|
438
|
+
};
|
|
439
|
+
$[7] = handle.api.focus;
|
|
440
|
+
$[8] = handle.api.setValue;
|
|
441
|
+
$[9] = handle.api.setWeek;
|
|
442
|
+
$[10] = state.today;
|
|
443
|
+
$[11] = state.value;
|
|
444
|
+
$[12] = t1;
|
|
445
|
+
$[13] = t2;
|
|
446
|
+
$[14] = t3;
|
|
447
|
+
$[15] = t4;
|
|
448
|
+
$[16] = t5;
|
|
449
|
+
} else t5 = $[16];
|
|
450
|
+
return t5;
|
|
451
|
+
}
|
|
452
|
+
/**
|
|
453
|
+
* Previous, the heading and Next share the first row, and anything else takes
|
|
454
|
+
* a row of its own, as in Calendar.
|
|
455
|
+
*/
|
|
456
|
+
const weekStripLayout = "grid grid-cols-[auto_1fr_auto] items-center gap-y-2 [&>*:not([data-slot=week-strip-previous],[data-slot=week-strip-heading],[data-slot=week-strip-next])]:col-span-full";
|
|
457
|
+
/** What a strip with no children shows: Previous, the heading, Next and the days, or only the days in scroll mode. */
|
|
458
|
+
function weekStripParts(scroll) {
|
|
459
|
+
if (scroll) return /* @__PURE__ */ jsx(WeekStripDays, {});
|
|
460
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
461
|
+
/* @__PURE__ */ jsx(WeekStripPrevious, {}),
|
|
462
|
+
/* @__PURE__ */ jsx(WeekStripHeading, {}),
|
|
463
|
+
/* @__PURE__ */ jsx(WeekStripNext, {}),
|
|
464
|
+
/* @__PURE__ */ jsx(WeekStripDays, {})
|
|
465
|
+
] });
|
|
466
|
+
}
|
|
467
|
+
/** Without children it renders Previous, the heading, Next and the days; in scroll mode, only the days. */
|
|
468
|
+
function WeekStrip(t0) {
|
|
469
|
+
const $ = c(55);
|
|
470
|
+
let children;
|
|
471
|
+
let className;
|
|
472
|
+
let controller;
|
|
473
|
+
let defaultValue;
|
|
474
|
+
let defaultWeek;
|
|
475
|
+
let disabled;
|
|
476
|
+
let faded;
|
|
477
|
+
let length;
|
|
478
|
+
let locale;
|
|
479
|
+
let marks;
|
|
480
|
+
let onValueChange;
|
|
481
|
+
let onWeekChange;
|
|
482
|
+
let props;
|
|
483
|
+
let scroll;
|
|
484
|
+
let start;
|
|
485
|
+
let t1;
|
|
486
|
+
let t2;
|
|
487
|
+
let timeZone;
|
|
488
|
+
let today;
|
|
489
|
+
let unavailable;
|
|
490
|
+
let value;
|
|
491
|
+
let week;
|
|
492
|
+
let weekStartsOn;
|
|
493
|
+
if ($[0] !== t0) {
|
|
494
|
+
({value, defaultValue, onValueChange, week, defaultWeek, onWeekChange, scroll, start, length, weekStartsOn, locale, timeZone, today, unavailable, faded, marks, disabled, controller, label: t1, size: t2, className, children, ...props} = t0);
|
|
495
|
+
$[0] = t0;
|
|
496
|
+
$[1] = children;
|
|
497
|
+
$[2] = className;
|
|
498
|
+
$[3] = controller;
|
|
499
|
+
$[4] = defaultValue;
|
|
500
|
+
$[5] = defaultWeek;
|
|
501
|
+
$[6] = disabled;
|
|
502
|
+
$[7] = faded;
|
|
503
|
+
$[8] = length;
|
|
504
|
+
$[9] = locale;
|
|
505
|
+
$[10] = marks;
|
|
506
|
+
$[11] = onValueChange;
|
|
507
|
+
$[12] = onWeekChange;
|
|
508
|
+
$[13] = props;
|
|
509
|
+
$[14] = scroll;
|
|
510
|
+
$[15] = start;
|
|
511
|
+
$[16] = t1;
|
|
512
|
+
$[17] = t2;
|
|
513
|
+
$[18] = timeZone;
|
|
514
|
+
$[19] = today;
|
|
515
|
+
$[20] = unavailable;
|
|
516
|
+
$[21] = value;
|
|
517
|
+
$[22] = week;
|
|
518
|
+
$[23] = weekStartsOn;
|
|
519
|
+
} else {
|
|
520
|
+
children = $[1];
|
|
521
|
+
className = $[2];
|
|
522
|
+
controller = $[3];
|
|
523
|
+
defaultValue = $[4];
|
|
524
|
+
defaultWeek = $[5];
|
|
525
|
+
disabled = $[6];
|
|
526
|
+
faded = $[7];
|
|
527
|
+
length = $[8];
|
|
528
|
+
locale = $[9];
|
|
529
|
+
marks = $[10];
|
|
530
|
+
onValueChange = $[11];
|
|
531
|
+
onWeekChange = $[12];
|
|
532
|
+
props = $[13];
|
|
533
|
+
scroll = $[14];
|
|
534
|
+
start = $[15];
|
|
535
|
+
t1 = $[16];
|
|
536
|
+
t2 = $[17];
|
|
537
|
+
timeZone = $[18];
|
|
538
|
+
today = $[19];
|
|
539
|
+
unavailable = $[20];
|
|
540
|
+
value = $[21];
|
|
541
|
+
week = $[22];
|
|
542
|
+
weekStartsOn = $[23];
|
|
543
|
+
}
|
|
544
|
+
const label = t1 === void 0 ? "Day" : t1;
|
|
545
|
+
const size = t2 === void 0 ? "md" : t2;
|
|
546
|
+
let t3;
|
|
547
|
+
if ($[24] !== controller || $[25] !== defaultValue || $[26] !== defaultWeek || $[27] !== disabled || $[28] !== faded || $[29] !== length || $[30] !== locale || $[31] !== marks || $[32] !== onValueChange || $[33] !== onWeekChange || $[34] !== scroll || $[35] !== start || $[36] !== timeZone || $[37] !== today || $[38] !== unavailable || $[39] !== value || $[40] !== week || $[41] !== weekStartsOn) {
|
|
548
|
+
t3 = {
|
|
549
|
+
value,
|
|
550
|
+
defaultValue,
|
|
551
|
+
onValueChange,
|
|
552
|
+
week,
|
|
553
|
+
defaultWeek,
|
|
554
|
+
onWeekChange,
|
|
555
|
+
scroll,
|
|
556
|
+
start,
|
|
557
|
+
length,
|
|
558
|
+
weekStartsOn,
|
|
559
|
+
locale,
|
|
560
|
+
timeZone,
|
|
561
|
+
today,
|
|
562
|
+
unavailable,
|
|
563
|
+
faded,
|
|
564
|
+
marks,
|
|
565
|
+
disabled,
|
|
566
|
+
controller
|
|
567
|
+
};
|
|
568
|
+
$[24] = controller;
|
|
569
|
+
$[25] = defaultValue;
|
|
570
|
+
$[26] = defaultWeek;
|
|
571
|
+
$[27] = disabled;
|
|
572
|
+
$[28] = faded;
|
|
573
|
+
$[29] = length;
|
|
574
|
+
$[30] = locale;
|
|
575
|
+
$[31] = marks;
|
|
576
|
+
$[32] = onValueChange;
|
|
577
|
+
$[33] = onWeekChange;
|
|
578
|
+
$[34] = scroll;
|
|
579
|
+
$[35] = start;
|
|
580
|
+
$[36] = timeZone;
|
|
581
|
+
$[37] = today;
|
|
582
|
+
$[38] = unavailable;
|
|
583
|
+
$[39] = value;
|
|
584
|
+
$[40] = week;
|
|
585
|
+
$[41] = weekStartsOn;
|
|
586
|
+
$[42] = t3;
|
|
587
|
+
} else t3 = $[42];
|
|
588
|
+
const handle = (0, core_exports.usePrimitive)(weekStrip, t3);
|
|
589
|
+
let t4;
|
|
590
|
+
if ($[43] === Symbol.for("react.memo_cache_sentinel")) {
|
|
591
|
+
t4 = {};
|
|
592
|
+
$[43] = t4;
|
|
593
|
+
} else t4 = $[43];
|
|
594
|
+
const t5 = props["aria-labelledby"] ? void 0 : label;
|
|
595
|
+
let t6;
|
|
596
|
+
if ($[44] !== className) {
|
|
597
|
+
t6 = cnState([weekStripLayout, "w-full min-w-0 text-sm"], className);
|
|
598
|
+
$[44] = className;
|
|
599
|
+
$[45] = t6;
|
|
600
|
+
} else t6 = $[45];
|
|
601
|
+
let t7;
|
|
602
|
+
if ($[46] !== children || $[47] !== handle || $[48] !== size) {
|
|
603
|
+
t7 = (state) => /* @__PURE__ */ jsx(WeekStripContext, {
|
|
604
|
+
value: {
|
|
605
|
+
handle,
|
|
606
|
+
size
|
|
607
|
+
},
|
|
608
|
+
children: typeof children === "function" ? children(state) : children ?? weekStripParts(state.scroll)
|
|
609
|
+
});
|
|
610
|
+
$[46] = children;
|
|
611
|
+
$[47] = handle;
|
|
612
|
+
$[48] = size;
|
|
613
|
+
$[49] = t7;
|
|
614
|
+
} else t7 = $[49];
|
|
615
|
+
let t8;
|
|
616
|
+
if ($[50] !== props || $[51] !== t5 || $[52] !== t6 || $[53] !== t7) {
|
|
617
|
+
t8 = {
|
|
618
|
+
"aria-label": t5,
|
|
619
|
+
className: t6,
|
|
620
|
+
children: t7,
|
|
621
|
+
...props
|
|
622
|
+
};
|
|
623
|
+
$[50] = props;
|
|
624
|
+
$[51] = t5;
|
|
625
|
+
$[52] = t6;
|
|
626
|
+
$[53] = t7;
|
|
627
|
+
$[54] = t8;
|
|
628
|
+
} else t8 = $[54];
|
|
629
|
+
return (0, core_exports.usePart)(handle, "root", t4, t8, "div");
|
|
630
|
+
}
|
|
631
|
+
/** The month or months shown, like "November 2026". Children replace the text. */
|
|
632
|
+
function WeekStripHeading(t0) {
|
|
633
|
+
const $ = c(13);
|
|
634
|
+
let children;
|
|
635
|
+
let className;
|
|
636
|
+
let props;
|
|
637
|
+
if ($[0] !== t0) {
|
|
638
|
+
({className, children, ...props} = t0);
|
|
639
|
+
$[0] = t0;
|
|
640
|
+
$[1] = children;
|
|
641
|
+
$[2] = className;
|
|
642
|
+
$[3] = props;
|
|
643
|
+
} else {
|
|
644
|
+
children = $[1];
|
|
645
|
+
className = $[2];
|
|
646
|
+
props = $[3];
|
|
647
|
+
}
|
|
648
|
+
let t1;
|
|
649
|
+
if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
|
|
650
|
+
t1 = {};
|
|
651
|
+
$[4] = t1;
|
|
652
|
+
} else t1 = $[4];
|
|
653
|
+
let t2;
|
|
654
|
+
if ($[5] !== className) {
|
|
655
|
+
t2 = cnState("px-2 text-center text-sm font-medium select-none", className);
|
|
656
|
+
$[5] = className;
|
|
657
|
+
$[6] = t2;
|
|
658
|
+
} else t2 = $[6];
|
|
659
|
+
let t3;
|
|
660
|
+
if ($[7] !== children) {
|
|
661
|
+
t3 = (state) => typeof children === "function" ? children(state) : children ?? state.label;
|
|
662
|
+
$[7] = children;
|
|
663
|
+
$[8] = t3;
|
|
664
|
+
} else t3 = $[8];
|
|
665
|
+
let t4;
|
|
666
|
+
if ($[9] !== props || $[10] !== t2 || $[11] !== t3) {
|
|
667
|
+
t4 = {
|
|
668
|
+
className: t2,
|
|
669
|
+
children: t3,
|
|
670
|
+
...props
|
|
671
|
+
};
|
|
672
|
+
$[9] = props;
|
|
673
|
+
$[10] = t2;
|
|
674
|
+
$[11] = t3;
|
|
675
|
+
$[12] = t4;
|
|
676
|
+
} else t4 = $[12];
|
|
677
|
+
return (0, core_exports.usePart)(weekStrip, "heading", t1, t4, "h2");
|
|
678
|
+
}
|
|
679
|
+
/** A ghost icon button that shows the week before. Its arrow follows the reading direction. */
|
|
680
|
+
function WeekStripPrevious(t0) {
|
|
681
|
+
const $ = c(19);
|
|
682
|
+
let children;
|
|
683
|
+
let className;
|
|
684
|
+
let props;
|
|
685
|
+
let t1;
|
|
686
|
+
let t2;
|
|
687
|
+
let t3;
|
|
688
|
+
if ($[0] !== t0) {
|
|
689
|
+
({variant: t1, size: t2, label: t3, className, children, ...props} = t0);
|
|
690
|
+
$[0] = t0;
|
|
691
|
+
$[1] = children;
|
|
692
|
+
$[2] = className;
|
|
693
|
+
$[3] = props;
|
|
694
|
+
$[4] = t1;
|
|
695
|
+
$[5] = t2;
|
|
696
|
+
$[6] = t3;
|
|
697
|
+
} else {
|
|
698
|
+
children = $[1];
|
|
699
|
+
className = $[2];
|
|
700
|
+
props = $[3];
|
|
701
|
+
t1 = $[4];
|
|
702
|
+
t2 = $[5];
|
|
703
|
+
t3 = $[6];
|
|
704
|
+
}
|
|
705
|
+
const variant = t1 === void 0 ? "ghost" : t1;
|
|
706
|
+
const size = t2 === void 0 ? "icon-sm" : t2;
|
|
707
|
+
const label = t3 === void 0 ? "Previous week" : t3;
|
|
708
|
+
let t4;
|
|
709
|
+
if ($[7] === Symbol.for("react.memo_cache_sentinel")) {
|
|
710
|
+
t4 = {};
|
|
711
|
+
$[7] = t4;
|
|
712
|
+
} else t4 = $[7];
|
|
713
|
+
let t5;
|
|
714
|
+
if ($[8] !== className || $[9] !== size || $[10] !== variant) {
|
|
715
|
+
t5 = cnState(buttonLook({
|
|
716
|
+
variant,
|
|
717
|
+
size
|
|
718
|
+
}), className);
|
|
719
|
+
$[8] = className;
|
|
720
|
+
$[9] = size;
|
|
721
|
+
$[10] = variant;
|
|
722
|
+
$[11] = t5;
|
|
723
|
+
} else t5 = $[11];
|
|
724
|
+
let t6;
|
|
725
|
+
if ($[12] !== children) {
|
|
726
|
+
t6 = children ?? /* @__PURE__ */ jsx(Icon, {
|
|
727
|
+
icon: ArrowLeft01Icon,
|
|
728
|
+
className: "rtl:rotate-180"
|
|
729
|
+
});
|
|
730
|
+
$[12] = children;
|
|
731
|
+
$[13] = t6;
|
|
732
|
+
} else t6 = $[13];
|
|
733
|
+
let t7;
|
|
734
|
+
if ($[14] !== label || $[15] !== props || $[16] !== t5 || $[17] !== t6) {
|
|
735
|
+
t7 = {
|
|
736
|
+
"aria-label": label,
|
|
737
|
+
className: t5,
|
|
738
|
+
children: t6,
|
|
739
|
+
...props
|
|
740
|
+
};
|
|
741
|
+
$[14] = label;
|
|
742
|
+
$[15] = props;
|
|
743
|
+
$[16] = t5;
|
|
744
|
+
$[17] = t6;
|
|
745
|
+
$[18] = t7;
|
|
746
|
+
} else t7 = $[18];
|
|
747
|
+
return (0, core_exports.usePart)(weekStrip, "previous", t4, t7, "button");
|
|
748
|
+
}
|
|
749
|
+
/** A ghost icon button that shows the week after. Its arrow follows the reading direction. */
|
|
750
|
+
function WeekStripNext(t0) {
|
|
751
|
+
const $ = c(19);
|
|
752
|
+
let children;
|
|
753
|
+
let className;
|
|
754
|
+
let props;
|
|
755
|
+
let t1;
|
|
756
|
+
let t2;
|
|
757
|
+
let t3;
|
|
758
|
+
if ($[0] !== t0) {
|
|
759
|
+
({variant: t1, size: t2, label: t3, className, children, ...props} = t0);
|
|
760
|
+
$[0] = t0;
|
|
761
|
+
$[1] = children;
|
|
762
|
+
$[2] = className;
|
|
763
|
+
$[3] = props;
|
|
764
|
+
$[4] = t1;
|
|
765
|
+
$[5] = t2;
|
|
766
|
+
$[6] = t3;
|
|
767
|
+
} else {
|
|
768
|
+
children = $[1];
|
|
769
|
+
className = $[2];
|
|
770
|
+
props = $[3];
|
|
771
|
+
t1 = $[4];
|
|
772
|
+
t2 = $[5];
|
|
773
|
+
t3 = $[6];
|
|
774
|
+
}
|
|
775
|
+
const variant = t1 === void 0 ? "ghost" : t1;
|
|
776
|
+
const size = t2 === void 0 ? "icon-sm" : t2;
|
|
777
|
+
const label = t3 === void 0 ? "Next week" : t3;
|
|
778
|
+
let t4;
|
|
779
|
+
if ($[7] === Symbol.for("react.memo_cache_sentinel")) {
|
|
780
|
+
t4 = {};
|
|
781
|
+
$[7] = t4;
|
|
782
|
+
} else t4 = $[7];
|
|
783
|
+
let t5;
|
|
784
|
+
if ($[8] !== className || $[9] !== size || $[10] !== variant) {
|
|
785
|
+
t5 = cnState(buttonLook({
|
|
786
|
+
variant,
|
|
787
|
+
size
|
|
788
|
+
}), className);
|
|
789
|
+
$[8] = className;
|
|
790
|
+
$[9] = size;
|
|
791
|
+
$[10] = variant;
|
|
792
|
+
$[11] = t5;
|
|
793
|
+
} else t5 = $[11];
|
|
794
|
+
let t6;
|
|
795
|
+
if ($[12] !== children) {
|
|
796
|
+
t6 = children ?? /* @__PURE__ */ jsx(Icon, {
|
|
797
|
+
icon: ArrowRight01Icon,
|
|
798
|
+
className: "rtl:rotate-180"
|
|
799
|
+
});
|
|
800
|
+
$[12] = children;
|
|
801
|
+
$[13] = t6;
|
|
802
|
+
} else t6 = $[13];
|
|
803
|
+
let t7;
|
|
804
|
+
if ($[14] !== label || $[15] !== props || $[16] !== t5 || $[17] !== t6) {
|
|
805
|
+
t7 = {
|
|
806
|
+
"aria-label": label,
|
|
807
|
+
className: t5,
|
|
808
|
+
children: t6,
|
|
809
|
+
...props
|
|
810
|
+
};
|
|
811
|
+
$[14] = label;
|
|
812
|
+
$[15] = props;
|
|
813
|
+
$[16] = t5;
|
|
814
|
+
$[17] = t6;
|
|
815
|
+
$[18] = t7;
|
|
816
|
+
} else t7 = $[18];
|
|
817
|
+
return (0, core_exports.usePart)(weekStrip, "next", t4, t7, "button");
|
|
818
|
+
}
|
|
819
|
+
const weekStripDaysVariants = cva("", { variants: { scroll: {
|
|
820
|
+
false: "grid grid-cols-7 gap-1",
|
|
821
|
+
true: "no-scrollbar flex snap-x snap-mandatory scroll-px-1 gap-1 overflow-x-auto p-1 scroll-fade-x"
|
|
822
|
+
} } });
|
|
823
|
+
/** The listbox of days. Without children it renders a `WeekStripDay` for each day shown. */
|
|
824
|
+
function WeekStripDays(t0) {
|
|
825
|
+
const $ = c(13);
|
|
826
|
+
let children;
|
|
827
|
+
let className;
|
|
828
|
+
let props;
|
|
829
|
+
if ($[0] !== t0) {
|
|
830
|
+
({className, children, ...props} = t0);
|
|
831
|
+
$[0] = t0;
|
|
832
|
+
$[1] = children;
|
|
833
|
+
$[2] = className;
|
|
834
|
+
$[3] = props;
|
|
835
|
+
} else {
|
|
836
|
+
children = $[1];
|
|
837
|
+
className = $[2];
|
|
838
|
+
props = $[3];
|
|
839
|
+
}
|
|
840
|
+
let t1;
|
|
841
|
+
if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
|
|
842
|
+
t1 = {};
|
|
843
|
+
$[4] = t1;
|
|
844
|
+
} else t1 = $[4];
|
|
845
|
+
let t2;
|
|
846
|
+
if ($[5] !== className) {
|
|
847
|
+
t2 = (state) => cn(weekStripDaysVariants({ scroll: state.scroll }), typeof className === "function" ? className(state) : className);
|
|
848
|
+
$[5] = className;
|
|
849
|
+
$[6] = t2;
|
|
850
|
+
} else t2 = $[6];
|
|
851
|
+
let t3;
|
|
852
|
+
if ($[7] !== children) {
|
|
853
|
+
t3 = (state_0) => typeof children === "function" ? children(state_0) : children ?? state_0.days.map(_temp);
|
|
854
|
+
$[7] = children;
|
|
855
|
+
$[8] = t3;
|
|
856
|
+
} else t3 = $[8];
|
|
857
|
+
let t4;
|
|
858
|
+
if ($[9] !== props || $[10] !== t2 || $[11] !== t3) {
|
|
859
|
+
t4 = {
|
|
860
|
+
className: t2,
|
|
861
|
+
children: t3,
|
|
862
|
+
...props
|
|
863
|
+
};
|
|
864
|
+
$[9] = props;
|
|
865
|
+
$[10] = t2;
|
|
866
|
+
$[11] = t3;
|
|
867
|
+
$[12] = t4;
|
|
868
|
+
} else t4 = $[12];
|
|
869
|
+
return (0, core_exports.usePart)(weekStrip, "days", t1, t4, "div");
|
|
870
|
+
}
|
|
871
|
+
function _temp(day) {
|
|
872
|
+
return /* @__PURE__ */ jsx(WeekStripDay, { value: day }, day);
|
|
873
|
+
}
|
|
874
|
+
const weekStripDayVariants = cva([
|
|
875
|
+
"relative flex cursor-default flex-col items-center justify-center rounded-lg tabular-nums select-none focus-ring focus-visible:z-10",
|
|
876
|
+
"not-data-selected:not-data-disabled:hover:bg-accent",
|
|
877
|
+
"data-today:not-data-selected:ring-1 data-today:not-data-selected:ring-input data-today:not-data-selected:ring-inset",
|
|
878
|
+
"data-faded:not-data-selected:text-muted-foreground",
|
|
879
|
+
"data-selected:bg-primary data-selected:text-primary-foreground",
|
|
880
|
+
"data-disabled:opacity-50"
|
|
881
|
+
], {
|
|
882
|
+
variants: {
|
|
883
|
+
size: {
|
|
884
|
+
sm: "gap-0 py-1",
|
|
885
|
+
md: "gap-0.5 py-1.5"
|
|
886
|
+
},
|
|
887
|
+
scroll: {
|
|
888
|
+
false: "min-w-0",
|
|
889
|
+
true: "shrink-0 snap-start"
|
|
890
|
+
}
|
|
891
|
+
},
|
|
892
|
+
compoundVariants: [{
|
|
893
|
+
scroll: true,
|
|
894
|
+
size: "sm",
|
|
895
|
+
className: "w-10"
|
|
896
|
+
}, {
|
|
897
|
+
scroll: true,
|
|
898
|
+
size: "md",
|
|
899
|
+
className: "w-12"
|
|
900
|
+
}]
|
|
901
|
+
});
|
|
902
|
+
/**
|
|
903
|
+
* One day: its weekday, its number and its marks. Its name, the full date with
|
|
904
|
+
* the mark's label, is read by screen readers whatever the children draw.
|
|
905
|
+
*/
|
|
906
|
+
function WeekStripDay(t0) {
|
|
907
|
+
const $ = c(17);
|
|
908
|
+
let children;
|
|
909
|
+
let className;
|
|
910
|
+
let props;
|
|
911
|
+
let value;
|
|
912
|
+
if ($[0] !== t0) {
|
|
913
|
+
({value, className, children, ...props} = t0);
|
|
914
|
+
$[0] = t0;
|
|
915
|
+
$[1] = children;
|
|
916
|
+
$[2] = className;
|
|
917
|
+
$[3] = props;
|
|
918
|
+
$[4] = value;
|
|
919
|
+
} else {
|
|
920
|
+
children = $[1];
|
|
921
|
+
className = $[2];
|
|
922
|
+
props = $[3];
|
|
923
|
+
value = $[4];
|
|
924
|
+
}
|
|
925
|
+
const { size } = useWeekStripContext();
|
|
926
|
+
let t1;
|
|
927
|
+
if ($[5] !== value) {
|
|
928
|
+
t1 = { value };
|
|
929
|
+
$[5] = value;
|
|
930
|
+
$[6] = t1;
|
|
931
|
+
} else t1 = $[6];
|
|
932
|
+
let t2;
|
|
933
|
+
if ($[7] !== className || $[8] !== size) {
|
|
934
|
+
t2 = (state) => cn(weekStripDayVariants({
|
|
935
|
+
size,
|
|
936
|
+
scroll: state.scroll
|
|
937
|
+
}), typeof className === "function" ? className(state) : className);
|
|
938
|
+
$[7] = className;
|
|
939
|
+
$[8] = size;
|
|
940
|
+
$[9] = t2;
|
|
941
|
+
} else t2 = $[9];
|
|
942
|
+
let t3;
|
|
943
|
+
if ($[10] !== children || $[11] !== size) {
|
|
944
|
+
t3 = (state_0) => /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("span", {
|
|
945
|
+
className: "sr-only",
|
|
946
|
+
children: state_0.name
|
|
947
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
948
|
+
"aria-hidden": "true",
|
|
949
|
+
className: "flex min-w-0 flex-col items-center",
|
|
950
|
+
children: typeof children === "function" ? children(state_0) : children ?? /* @__PURE__ */ jsx(WeekStripDayFace, {
|
|
951
|
+
state: state_0,
|
|
952
|
+
size
|
|
953
|
+
})
|
|
954
|
+
})] });
|
|
955
|
+
$[10] = children;
|
|
956
|
+
$[11] = size;
|
|
957
|
+
$[12] = t3;
|
|
958
|
+
} else t3 = $[12];
|
|
959
|
+
let t4;
|
|
960
|
+
if ($[13] !== props || $[14] !== t2 || $[15] !== t3) {
|
|
961
|
+
t4 = {
|
|
962
|
+
className: t2,
|
|
963
|
+
children: t3,
|
|
964
|
+
...props
|
|
965
|
+
};
|
|
966
|
+
$[13] = props;
|
|
967
|
+
$[14] = t2;
|
|
968
|
+
$[15] = t3;
|
|
969
|
+
$[16] = t4;
|
|
970
|
+
} else t4 = $[16];
|
|
971
|
+
return (0, core_exports.usePart)(weekStrip, "day", t1, t4, "div");
|
|
972
|
+
}
|
|
973
|
+
function WeekStripDayFace(t0) {
|
|
974
|
+
const $ = c(13);
|
|
975
|
+
const { state, size } = t0;
|
|
976
|
+
let t1;
|
|
977
|
+
if ($[0] !== state.weekday) {
|
|
978
|
+
t1 = /* @__PURE__ */ jsx("span", {
|
|
979
|
+
className: "text-xs text-muted-foreground in-data-selected:text-primary-foreground",
|
|
980
|
+
children: state.weekday
|
|
981
|
+
});
|
|
982
|
+
$[0] = state.weekday;
|
|
983
|
+
$[1] = t1;
|
|
984
|
+
} else t1 = $[1];
|
|
985
|
+
const t2 = size === "md" ? "text-base" : "text-sm";
|
|
986
|
+
let t3;
|
|
987
|
+
if ($[2] !== t2) {
|
|
988
|
+
t3 = cn("font-medium", t2);
|
|
989
|
+
$[2] = t2;
|
|
990
|
+
$[3] = t3;
|
|
991
|
+
} else t3 = $[3];
|
|
992
|
+
let t4;
|
|
993
|
+
if ($[4] !== state.label || $[5] !== t3) {
|
|
994
|
+
t4 = /* @__PURE__ */ jsx("span", {
|
|
995
|
+
className: t3,
|
|
996
|
+
children: state.label
|
|
997
|
+
});
|
|
998
|
+
$[4] = state.label;
|
|
999
|
+
$[5] = t3;
|
|
1000
|
+
$[6] = t4;
|
|
1001
|
+
} else t4 = $[6];
|
|
1002
|
+
let t5;
|
|
1003
|
+
if ($[7] !== state.marks) {
|
|
1004
|
+
t5 = /* @__PURE__ */ jsx(WeekStripMarks, { marks: state.marks });
|
|
1005
|
+
$[7] = state.marks;
|
|
1006
|
+
$[8] = t5;
|
|
1007
|
+
} else t5 = $[8];
|
|
1008
|
+
let t6;
|
|
1009
|
+
if ($[9] !== t1 || $[10] !== t4 || $[11] !== t5) {
|
|
1010
|
+
t6 = /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
1011
|
+
t1,
|
|
1012
|
+
t4,
|
|
1013
|
+
t5
|
|
1014
|
+
] });
|
|
1015
|
+
$[9] = t1;
|
|
1016
|
+
$[10] = t4;
|
|
1017
|
+
$[11] = t5;
|
|
1018
|
+
$[12] = t6;
|
|
1019
|
+
} else t6 = $[12];
|
|
1020
|
+
return t6;
|
|
1021
|
+
}
|
|
1022
|
+
const toneClasses = {
|
|
1023
|
+
primary: "bg-primary in-data-selected:bg-primary-foreground",
|
|
1024
|
+
muted: "bg-muted-foreground in-data-selected:bg-primary-foreground",
|
|
1025
|
+
destructive: "bg-destructive",
|
|
1026
|
+
"chart-1": "bg-chart-1",
|
|
1027
|
+
"chart-2": "bg-chart-2",
|
|
1028
|
+
"chart-3": "bg-chart-3",
|
|
1029
|
+
"chart-4": "bg-chart-4",
|
|
1030
|
+
"chart-5": "bg-chart-5"
|
|
1031
|
+
};
|
|
1032
|
+
const dotClasses = "size-1.5 shrink-0 rounded-full in-data-selected:ring-1 in-data-selected:ring-primary-foreground";
|
|
1033
|
+
/**
|
|
1034
|
+
* A day's marks: its label, else up to three dots, and its corner dot. It
|
|
1035
|
+
* keeps its height without marks, so every day lines up. Decorative: the
|
|
1036
|
+
* day's name carries what they mean.
|
|
1037
|
+
*/
|
|
1038
|
+
function WeekStripMarks(t0) {
|
|
1039
|
+
const $ = c(10);
|
|
1040
|
+
const { marks, className } = t0;
|
|
1041
|
+
const corner = marks?.corner === true ? "destructive" : marks?.corner || void 0;
|
|
1042
|
+
let t1;
|
|
1043
|
+
if ($[0] !== className) {
|
|
1044
|
+
t1 = cn("flex h-3 max-w-full items-center justify-center gap-0.5", className);
|
|
1045
|
+
$[0] = className;
|
|
1046
|
+
$[1] = t1;
|
|
1047
|
+
} else t1 = $[1];
|
|
1048
|
+
let t2;
|
|
1049
|
+
if ($[2] !== marks) {
|
|
1050
|
+
t2 = marks?.label ? /* @__PURE__ */ jsx("span", {
|
|
1051
|
+
className: "truncate px-0.5 text-xs leading-none text-muted-foreground in-data-selected:text-primary-foreground",
|
|
1052
|
+
children: marks.label
|
|
1053
|
+
}) : marks?.dots?.slice(0, 3).map(_temp2);
|
|
1054
|
+
$[2] = marks;
|
|
1055
|
+
$[3] = t2;
|
|
1056
|
+
} else t2 = $[3];
|
|
1057
|
+
let t3;
|
|
1058
|
+
if ($[4] !== corner) {
|
|
1059
|
+
t3 = corner && /* @__PURE__ */ jsx("span", { className: cn("absolute end-1 top-1", dotClasses, toneClasses[corner]) });
|
|
1060
|
+
$[4] = corner;
|
|
1061
|
+
$[5] = t3;
|
|
1062
|
+
} else t3 = $[5];
|
|
1063
|
+
let t4;
|
|
1064
|
+
if ($[6] !== t1 || $[7] !== t2 || $[8] !== t3) {
|
|
1065
|
+
t4 = /* @__PURE__ */ jsxs("span", {
|
|
1066
|
+
"data-slot": "week-strip-marks",
|
|
1067
|
+
"aria-hidden": "true",
|
|
1068
|
+
className: t1,
|
|
1069
|
+
children: [t2, t3]
|
|
1070
|
+
});
|
|
1071
|
+
$[6] = t1;
|
|
1072
|
+
$[7] = t2;
|
|
1073
|
+
$[8] = t3;
|
|
1074
|
+
$[9] = t4;
|
|
1075
|
+
} else t4 = $[9];
|
|
1076
|
+
return t4;
|
|
1077
|
+
}
|
|
1078
|
+
function _temp2(tone, index) {
|
|
1079
|
+
return /* @__PURE__ */ jsx("span", { className: cn(dotClasses, toneClasses[tone]) }, `${tone}-${index}`);
|
|
1080
|
+
}
|
|
1081
|
+
export { WeekStrip, WeekStripDay, WeekStripDays, WeekStripHeading, WeekStripMarks, WeekStripNext, WeekStripPrevious, createWeekStripController, useWeekStrip, weekStripLayout, weekStripParts };
|