@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,490 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "../../utilities/cn/index.js";
|
|
3
|
+
import { Usage, UsageContent, UsageFooter, UsageSection, UsageSummary, UsageTrigger, useUsage } from "../usage/usage.js";
|
|
4
|
+
import { c } from "react/compiler-runtime";
|
|
5
|
+
import { createContext, useContext } from "react";
|
|
6
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
// src/components/context/context.tsx
|
|
8
|
+
const TokensContext = createContext(null);
|
|
9
|
+
/** What `Context` was given, plus the percent used. For a part of your own inside it. */
|
|
10
|
+
function useContextUsage() {
|
|
11
|
+
const value = useContext(TokensContext);
|
|
12
|
+
if (!value) throw new Error("Context parts must be used within Context");
|
|
13
|
+
return value;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* The root: a Usage whose limit is the window. It opens when the pointer rests
|
|
17
|
+
* on the trigger, as shadcn's hover card does, and when the trigger is pressed,
|
|
18
|
+
* so keyboard, touch and agents open it too.
|
|
19
|
+
*
|
|
20
|
+
* `usedTokens` is the reading, not the sum of `usage`: the AI SDK counts
|
|
21
|
+
* reasoning inside output and cached tokens inside input.
|
|
22
|
+
*/
|
|
23
|
+
function Context(t0) {
|
|
24
|
+
const $ = c(27);
|
|
25
|
+
let maxTokens;
|
|
26
|
+
let modelId;
|
|
27
|
+
let props;
|
|
28
|
+
let t1;
|
|
29
|
+
let t2;
|
|
30
|
+
let t3;
|
|
31
|
+
let usage;
|
|
32
|
+
let usedTokens;
|
|
33
|
+
if ($[0] !== t0) {
|
|
34
|
+
({usedTokens, maxTokens, usage, modelId, openOnHover: t1, delay: t2, closeDelay: t3, ...props} = t0);
|
|
35
|
+
$[0] = t0;
|
|
36
|
+
$[1] = maxTokens;
|
|
37
|
+
$[2] = modelId;
|
|
38
|
+
$[3] = props;
|
|
39
|
+
$[4] = t1;
|
|
40
|
+
$[5] = t2;
|
|
41
|
+
$[6] = t3;
|
|
42
|
+
$[7] = usage;
|
|
43
|
+
$[8] = usedTokens;
|
|
44
|
+
} else {
|
|
45
|
+
maxTokens = $[1];
|
|
46
|
+
modelId = $[2];
|
|
47
|
+
props = $[3];
|
|
48
|
+
t1 = $[4];
|
|
49
|
+
t2 = $[5];
|
|
50
|
+
t3 = $[6];
|
|
51
|
+
usage = $[7];
|
|
52
|
+
usedTokens = $[8];
|
|
53
|
+
}
|
|
54
|
+
const openOnHover = t1 === void 0 ? true : t1;
|
|
55
|
+
const delay = t2 === void 0 ? 10 : t2;
|
|
56
|
+
const closeDelay = t3 === void 0 ? 100 : t3;
|
|
57
|
+
const ratio = maxTokens > 0 ? usedTokens / maxTokens : 0;
|
|
58
|
+
let t4;
|
|
59
|
+
if ($[9] !== ratio) {
|
|
60
|
+
t4 = Math.round(ratio * 100);
|
|
61
|
+
$[9] = ratio;
|
|
62
|
+
$[10] = t4;
|
|
63
|
+
} else t4 = $[10];
|
|
64
|
+
const percent = Math.min(100, Math.max(0, t4));
|
|
65
|
+
let t5;
|
|
66
|
+
if ($[11] !== maxTokens || $[12] !== modelId || $[13] !== percent || $[14] !== usage || $[15] !== usedTokens) {
|
|
67
|
+
t5 = {
|
|
68
|
+
usedTokens,
|
|
69
|
+
maxTokens,
|
|
70
|
+
usage,
|
|
71
|
+
modelId,
|
|
72
|
+
percent
|
|
73
|
+
};
|
|
74
|
+
$[11] = maxTokens;
|
|
75
|
+
$[12] = modelId;
|
|
76
|
+
$[13] = percent;
|
|
77
|
+
$[14] = usage;
|
|
78
|
+
$[15] = usedTokens;
|
|
79
|
+
$[16] = t5;
|
|
80
|
+
} else t5 = $[16];
|
|
81
|
+
let t6;
|
|
82
|
+
if ($[17] !== closeDelay || $[18] !== delay || $[19] !== maxTokens || $[20] !== openOnHover || $[21] !== props || $[22] !== usedTokens) {
|
|
83
|
+
t6 = /* @__PURE__ */ jsx(Usage, {
|
|
84
|
+
limit: maxTokens,
|
|
85
|
+
value: usedTokens,
|
|
86
|
+
openOnHover,
|
|
87
|
+
delay,
|
|
88
|
+
closeDelay,
|
|
89
|
+
...props
|
|
90
|
+
});
|
|
91
|
+
$[17] = closeDelay;
|
|
92
|
+
$[18] = delay;
|
|
93
|
+
$[19] = maxTokens;
|
|
94
|
+
$[20] = openOnHover;
|
|
95
|
+
$[21] = props;
|
|
96
|
+
$[22] = usedTokens;
|
|
97
|
+
$[23] = t6;
|
|
98
|
+
} else t6 = $[23];
|
|
99
|
+
let t7;
|
|
100
|
+
if ($[24] !== t5 || $[25] !== t6) {
|
|
101
|
+
t7 = /* @__PURE__ */ jsx(TokensContext.Provider, {
|
|
102
|
+
value: t5,
|
|
103
|
+
children: t6
|
|
104
|
+
});
|
|
105
|
+
$[24] = t5;
|
|
106
|
+
$[25] = t6;
|
|
107
|
+
$[26] = t7;
|
|
108
|
+
} else t7 = $[26];
|
|
109
|
+
return t7;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Usage's trigger, a `pill` by default: a small ring and "10.7K / 128K". Its
|
|
113
|
+
* name says the share in words: "Context: 10.7K / 128K, 8% used".
|
|
114
|
+
*/
|
|
115
|
+
function ContextTrigger(t0) {
|
|
116
|
+
const $ = c(6);
|
|
117
|
+
let props;
|
|
118
|
+
let t1;
|
|
119
|
+
if ($[0] !== t0) {
|
|
120
|
+
({variant: t1, ...props} = t0);
|
|
121
|
+
$[0] = t0;
|
|
122
|
+
$[1] = props;
|
|
123
|
+
$[2] = t1;
|
|
124
|
+
} else {
|
|
125
|
+
props = $[1];
|
|
126
|
+
t1 = $[2];
|
|
127
|
+
}
|
|
128
|
+
const variant = t1 === void 0 ? "pill" : t1;
|
|
129
|
+
let t2;
|
|
130
|
+
if ($[3] !== props || $[4] !== variant) {
|
|
131
|
+
t2 = /* @__PURE__ */ jsx(UsageTrigger, {
|
|
132
|
+
variant,
|
|
133
|
+
...props
|
|
134
|
+
});
|
|
135
|
+
$[3] = props;
|
|
136
|
+
$[4] = variant;
|
|
137
|
+
$[5] = t2;
|
|
138
|
+
} else t2 = $[5];
|
|
139
|
+
return t2;
|
|
140
|
+
}
|
|
141
|
+
/** The popover: the header, the body and the footer, one under the other. */
|
|
142
|
+
function ContextContent(props) {
|
|
143
|
+
const $ = c(2);
|
|
144
|
+
let t0;
|
|
145
|
+
if ($[0] !== props) {
|
|
146
|
+
t0 = /* @__PURE__ */ jsx(UsageContent, { ...props });
|
|
147
|
+
$[0] = props;
|
|
148
|
+
$[1] = t0;
|
|
149
|
+
} else t0 = $[1];
|
|
150
|
+
return t0;
|
|
151
|
+
}
|
|
152
|
+
/** Usage's summary: the used and max tokens over a bar. Children replace it whole. */
|
|
153
|
+
function ContextContentHeader(t0) {
|
|
154
|
+
const $ = c(17);
|
|
155
|
+
let children;
|
|
156
|
+
let className;
|
|
157
|
+
let label;
|
|
158
|
+
let progressLabel;
|
|
159
|
+
let props;
|
|
160
|
+
if ($[0] !== t0) {
|
|
161
|
+
({className, children, label, progressLabel, ...props} = t0);
|
|
162
|
+
$[0] = t0;
|
|
163
|
+
$[1] = children;
|
|
164
|
+
$[2] = className;
|
|
165
|
+
$[3] = label;
|
|
166
|
+
$[4] = progressLabel;
|
|
167
|
+
$[5] = props;
|
|
168
|
+
} else {
|
|
169
|
+
children = $[1];
|
|
170
|
+
className = $[2];
|
|
171
|
+
label = $[3];
|
|
172
|
+
progressLabel = $[4];
|
|
173
|
+
props = $[5];
|
|
174
|
+
}
|
|
175
|
+
if (children != null) {
|
|
176
|
+
let t1;
|
|
177
|
+
if ($[6] !== className) {
|
|
178
|
+
t1 = cn("flex flex-col gap-3 p-4", className);
|
|
179
|
+
$[6] = className;
|
|
180
|
+
$[7] = t1;
|
|
181
|
+
} else t1 = $[7];
|
|
182
|
+
let t2;
|
|
183
|
+
if ($[8] !== children || $[9] !== props || $[10] !== t1) {
|
|
184
|
+
t2 = /* @__PURE__ */ jsx("div", {
|
|
185
|
+
"data-slot": "context-content-header",
|
|
186
|
+
className: t1,
|
|
187
|
+
...props,
|
|
188
|
+
children
|
|
189
|
+
});
|
|
190
|
+
$[8] = children;
|
|
191
|
+
$[9] = props;
|
|
192
|
+
$[10] = t1;
|
|
193
|
+
$[11] = t2;
|
|
194
|
+
} else t2 = $[11];
|
|
195
|
+
return t2;
|
|
196
|
+
}
|
|
197
|
+
let t1;
|
|
198
|
+
if ($[12] !== className || $[13] !== label || $[14] !== progressLabel || $[15] !== props) {
|
|
199
|
+
t1 = /* @__PURE__ */ jsx(UsageSummary, {
|
|
200
|
+
title: label,
|
|
201
|
+
barLabel: progressLabel,
|
|
202
|
+
className,
|
|
203
|
+
...props
|
|
204
|
+
});
|
|
205
|
+
$[12] = className;
|
|
206
|
+
$[13] = label;
|
|
207
|
+
$[14] = progressLabel;
|
|
208
|
+
$[15] = props;
|
|
209
|
+
$[16] = t1;
|
|
210
|
+
} else t1 = $[16];
|
|
211
|
+
return t1;
|
|
212
|
+
}
|
|
213
|
+
/** Holds the usage rows, under a rule. */
|
|
214
|
+
function ContextContentBody(t0) {
|
|
215
|
+
const $ = c(8);
|
|
216
|
+
let className;
|
|
217
|
+
let props;
|
|
218
|
+
if ($[0] !== t0) {
|
|
219
|
+
({className, ...props} = t0);
|
|
220
|
+
$[0] = t0;
|
|
221
|
+
$[1] = className;
|
|
222
|
+
$[2] = props;
|
|
223
|
+
} else {
|
|
224
|
+
className = $[1];
|
|
225
|
+
props = $[2];
|
|
226
|
+
}
|
|
227
|
+
let t1;
|
|
228
|
+
if ($[3] !== className) {
|
|
229
|
+
t1 = cn("gap-1 text-sm", className);
|
|
230
|
+
$[3] = className;
|
|
231
|
+
$[4] = t1;
|
|
232
|
+
} else t1 = $[4];
|
|
233
|
+
let t2;
|
|
234
|
+
if ($[5] !== props || $[6] !== t1) {
|
|
235
|
+
t2 = /* @__PURE__ */ jsx(UsageSection, {
|
|
236
|
+
className: t1,
|
|
237
|
+
...props
|
|
238
|
+
});
|
|
239
|
+
$[5] = props;
|
|
240
|
+
$[6] = t1;
|
|
241
|
+
$[7] = t2;
|
|
242
|
+
} else t2 = $[7];
|
|
243
|
+
return t2;
|
|
244
|
+
}
|
|
245
|
+
/** The total cost, in Usage's footer band. It draws nothing with no `cost` and no children. */
|
|
246
|
+
function ContextContentFooter(t0) {
|
|
247
|
+
const $ = c(12);
|
|
248
|
+
let children;
|
|
249
|
+
let cost;
|
|
250
|
+
let props;
|
|
251
|
+
let t1;
|
|
252
|
+
if ($[0] !== t0) {
|
|
253
|
+
({children, label: t1, cost, ...props} = t0);
|
|
254
|
+
$[0] = t0;
|
|
255
|
+
$[1] = children;
|
|
256
|
+
$[2] = cost;
|
|
257
|
+
$[3] = props;
|
|
258
|
+
$[4] = t1;
|
|
259
|
+
} else {
|
|
260
|
+
children = $[1];
|
|
261
|
+
cost = $[2];
|
|
262
|
+
props = $[3];
|
|
263
|
+
t1 = $[4];
|
|
264
|
+
}
|
|
265
|
+
const label = t1 === void 0 ? "Total cost" : t1;
|
|
266
|
+
if (children == null && cost == null) return null;
|
|
267
|
+
let t2;
|
|
268
|
+
if ($[5] !== children || $[6] !== cost || $[7] !== label) {
|
|
269
|
+
t2 = children ?? /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("span", { children: label }), /* @__PURE__ */ jsx("span", {
|
|
270
|
+
className: "text-foreground tabular-nums",
|
|
271
|
+
children: cost
|
|
272
|
+
})] });
|
|
273
|
+
$[5] = children;
|
|
274
|
+
$[6] = cost;
|
|
275
|
+
$[7] = label;
|
|
276
|
+
$[8] = t2;
|
|
277
|
+
} else t2 = $[8];
|
|
278
|
+
let t3;
|
|
279
|
+
if ($[9] !== props || $[10] !== t2) {
|
|
280
|
+
t3 = /* @__PURE__ */ jsx(UsageFooter, {
|
|
281
|
+
...props,
|
|
282
|
+
children: t2
|
|
283
|
+
});
|
|
284
|
+
$[9] = props;
|
|
285
|
+
$[10] = t2;
|
|
286
|
+
$[11] = t3;
|
|
287
|
+
} else t3 = $[11];
|
|
288
|
+
return t3;
|
|
289
|
+
}
|
|
290
|
+
/** One kind of token. With no tokens of its kind and no children it draws nothing. */
|
|
291
|
+
function UsageRow(t0) {
|
|
292
|
+
const $ = c(21);
|
|
293
|
+
let children;
|
|
294
|
+
let className;
|
|
295
|
+
let cost;
|
|
296
|
+
let label;
|
|
297
|
+
let props;
|
|
298
|
+
let slot;
|
|
299
|
+
let tokens;
|
|
300
|
+
if ($[0] !== t0) {
|
|
301
|
+
({slot, tokens, label, cost, className, children, ...props} = t0);
|
|
302
|
+
$[0] = t0;
|
|
303
|
+
$[1] = children;
|
|
304
|
+
$[2] = className;
|
|
305
|
+
$[3] = cost;
|
|
306
|
+
$[4] = label;
|
|
307
|
+
$[5] = props;
|
|
308
|
+
$[6] = slot;
|
|
309
|
+
$[7] = tokens;
|
|
310
|
+
} else {
|
|
311
|
+
children = $[1];
|
|
312
|
+
className = $[2];
|
|
313
|
+
cost = $[3];
|
|
314
|
+
label = $[4];
|
|
315
|
+
props = $[5];
|
|
316
|
+
slot = $[6];
|
|
317
|
+
tokens = $[7];
|
|
318
|
+
}
|
|
319
|
+
const { format } = useUsage();
|
|
320
|
+
if (children == null && !tokens) return null;
|
|
321
|
+
let t1;
|
|
322
|
+
if ($[8] !== className) {
|
|
323
|
+
t1 = cn("flex justify-between gap-3", className);
|
|
324
|
+
$[8] = className;
|
|
325
|
+
$[9] = t1;
|
|
326
|
+
} else t1 = $[9];
|
|
327
|
+
let t2;
|
|
328
|
+
if ($[10] !== children || $[11] !== cost || $[12] !== format || $[13] !== label || $[14] !== tokens) {
|
|
329
|
+
t2 = children ?? /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("span", {
|
|
330
|
+
className: "text-muted-foreground",
|
|
331
|
+
children: label
|
|
332
|
+
}), /* @__PURE__ */ jsxs("span", {
|
|
333
|
+
className: "tabular-nums",
|
|
334
|
+
children: [format(tokens ?? 0), cost != null && /* @__PURE__ */ jsxs("span", {
|
|
335
|
+
className: "ms-2 text-muted-foreground",
|
|
336
|
+
children: ["· ", cost]
|
|
337
|
+
})]
|
|
338
|
+
})] });
|
|
339
|
+
$[10] = children;
|
|
340
|
+
$[11] = cost;
|
|
341
|
+
$[12] = format;
|
|
342
|
+
$[13] = label;
|
|
343
|
+
$[14] = tokens;
|
|
344
|
+
$[15] = t2;
|
|
345
|
+
} else t2 = $[15];
|
|
346
|
+
let t3;
|
|
347
|
+
if ($[16] !== props || $[17] !== slot || $[18] !== t1 || $[19] !== t2) {
|
|
348
|
+
t3 = /* @__PURE__ */ jsx("div", {
|
|
349
|
+
"data-slot": slot,
|
|
350
|
+
className: t1,
|
|
351
|
+
...props,
|
|
352
|
+
children: t2
|
|
353
|
+
});
|
|
354
|
+
$[16] = props;
|
|
355
|
+
$[17] = slot;
|
|
356
|
+
$[18] = t1;
|
|
357
|
+
$[19] = t2;
|
|
358
|
+
$[20] = t3;
|
|
359
|
+
} else t3 = $[20];
|
|
360
|
+
return t3;
|
|
361
|
+
}
|
|
362
|
+
/** The input tokens of `usage`. Children replace the row's contents. */
|
|
363
|
+
function ContextInputUsage(t0) {
|
|
364
|
+
const $ = c(7);
|
|
365
|
+
let props;
|
|
366
|
+
let t1;
|
|
367
|
+
if ($[0] !== t0) {
|
|
368
|
+
({label: t1, ...props} = t0);
|
|
369
|
+
$[0] = t0;
|
|
370
|
+
$[1] = props;
|
|
371
|
+
$[2] = t1;
|
|
372
|
+
} else {
|
|
373
|
+
props = $[1];
|
|
374
|
+
t1 = $[2];
|
|
375
|
+
}
|
|
376
|
+
const label = t1 === void 0 ? "Input" : t1;
|
|
377
|
+
const { usage } = useContextUsage();
|
|
378
|
+
const t2 = usage?.inputTokens;
|
|
379
|
+
let t3;
|
|
380
|
+
if ($[3] !== label || $[4] !== props || $[5] !== t2) {
|
|
381
|
+
t3 = /* @__PURE__ */ jsx(UsageRow, {
|
|
382
|
+
slot: "context-input-usage",
|
|
383
|
+
tokens: t2,
|
|
384
|
+
label,
|
|
385
|
+
...props
|
|
386
|
+
});
|
|
387
|
+
$[3] = label;
|
|
388
|
+
$[4] = props;
|
|
389
|
+
$[5] = t2;
|
|
390
|
+
$[6] = t3;
|
|
391
|
+
} else t3 = $[6];
|
|
392
|
+
return t3;
|
|
393
|
+
}
|
|
394
|
+
/** The output tokens of `usage`. Children replace the row's contents. */
|
|
395
|
+
function ContextOutputUsage(t0) {
|
|
396
|
+
const $ = c(7);
|
|
397
|
+
let props;
|
|
398
|
+
let t1;
|
|
399
|
+
if ($[0] !== t0) {
|
|
400
|
+
({label: t1, ...props} = t0);
|
|
401
|
+
$[0] = t0;
|
|
402
|
+
$[1] = props;
|
|
403
|
+
$[2] = t1;
|
|
404
|
+
} else {
|
|
405
|
+
props = $[1];
|
|
406
|
+
t1 = $[2];
|
|
407
|
+
}
|
|
408
|
+
const label = t1 === void 0 ? "Output" : t1;
|
|
409
|
+
const { usage } = useContextUsage();
|
|
410
|
+
const t2 = usage?.outputTokens;
|
|
411
|
+
let t3;
|
|
412
|
+
if ($[3] !== label || $[4] !== props || $[5] !== t2) {
|
|
413
|
+
t3 = /* @__PURE__ */ jsx(UsageRow, {
|
|
414
|
+
slot: "context-output-usage",
|
|
415
|
+
tokens: t2,
|
|
416
|
+
label,
|
|
417
|
+
...props
|
|
418
|
+
});
|
|
419
|
+
$[3] = label;
|
|
420
|
+
$[4] = props;
|
|
421
|
+
$[5] = t2;
|
|
422
|
+
$[6] = t3;
|
|
423
|
+
} else t3 = $[6];
|
|
424
|
+
return t3;
|
|
425
|
+
}
|
|
426
|
+
/** The reasoning tokens of `usage`. Children replace the row's contents. */
|
|
427
|
+
function ContextReasoningUsage(t0) {
|
|
428
|
+
const $ = c(7);
|
|
429
|
+
let props;
|
|
430
|
+
let t1;
|
|
431
|
+
if ($[0] !== t0) {
|
|
432
|
+
({label: t1, ...props} = t0);
|
|
433
|
+
$[0] = t0;
|
|
434
|
+
$[1] = props;
|
|
435
|
+
$[2] = t1;
|
|
436
|
+
} else {
|
|
437
|
+
props = $[1];
|
|
438
|
+
t1 = $[2];
|
|
439
|
+
}
|
|
440
|
+
const label = t1 === void 0 ? "Reasoning" : t1;
|
|
441
|
+
const { usage } = useContextUsage();
|
|
442
|
+
const t2 = usage?.reasoningTokens;
|
|
443
|
+
let t3;
|
|
444
|
+
if ($[3] !== label || $[4] !== props || $[5] !== t2) {
|
|
445
|
+
t3 = /* @__PURE__ */ jsx(UsageRow, {
|
|
446
|
+
slot: "context-reasoning-usage",
|
|
447
|
+
tokens: t2,
|
|
448
|
+
label,
|
|
449
|
+
...props
|
|
450
|
+
});
|
|
451
|
+
$[3] = label;
|
|
452
|
+
$[4] = props;
|
|
453
|
+
$[5] = t2;
|
|
454
|
+
$[6] = t3;
|
|
455
|
+
} else t3 = $[6];
|
|
456
|
+
return t3;
|
|
457
|
+
}
|
|
458
|
+
/** The input tokens of `usage` read from the cache. Children replace the row's contents. */
|
|
459
|
+
function ContextCacheUsage(t0) {
|
|
460
|
+
const $ = c(7);
|
|
461
|
+
let props;
|
|
462
|
+
let t1;
|
|
463
|
+
if ($[0] !== t0) {
|
|
464
|
+
({label: t1, ...props} = t0);
|
|
465
|
+
$[0] = t0;
|
|
466
|
+
$[1] = props;
|
|
467
|
+
$[2] = t1;
|
|
468
|
+
} else {
|
|
469
|
+
props = $[1];
|
|
470
|
+
t1 = $[2];
|
|
471
|
+
}
|
|
472
|
+
const label = t1 === void 0 ? "Cache" : t1;
|
|
473
|
+
const { usage } = useContextUsage();
|
|
474
|
+
const t2 = usage?.cachedInputTokens;
|
|
475
|
+
let t3;
|
|
476
|
+
if ($[3] !== label || $[4] !== props || $[5] !== t2) {
|
|
477
|
+
t3 = /* @__PURE__ */ jsx(UsageRow, {
|
|
478
|
+
slot: "context-cache-usage",
|
|
479
|
+
tokens: t2,
|
|
480
|
+
label,
|
|
481
|
+
...props
|
|
482
|
+
});
|
|
483
|
+
$[3] = label;
|
|
484
|
+
$[4] = props;
|
|
485
|
+
$[5] = t2;
|
|
486
|
+
$[6] = t3;
|
|
487
|
+
} else t3 = $[6];
|
|
488
|
+
return t3;
|
|
489
|
+
}
|
|
490
|
+
export { Context, ContextCacheUsage, ContextContent, ContextContentBody, ContextContentFooter, ContextContentHeader, ContextInputUsage, ContextOutputUsage, ContextReasoningUsage, ContextTrigger, useContextUsage };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ComponentProps } from "react";
|
|
2
|
+
import { DateInput as DateInput$1, DateInputChangeOptions, DateInputController, DateInputGranularity, DateInputOptions, DateInputSegment as DateInputSegment$1, DateInputSegmentData, DateInputSegmentState, DateInputSegmentType, DateInputState, DateInputValueChangeReason, DateMatcher, DateMatchers, HourCycle, createDateInputController } from "@ui-sdk/react/date-input";
|
|
3
|
+
/**
|
|
4
|
+
* The box, with the look of `Input`. Focus goes to a segment inside it, so
|
|
5
|
+
* the box draws the ring. Without children it renders every segment.
|
|
6
|
+
*/
|
|
7
|
+
declare function DateInput({ className, children, ...props }: ComponentProps<typeof DateInput$1>): import("react").JSX.Element;
|
|
8
|
+
declare const segmentClasses = "h-5.5 w-[calc(2ch+4px)] rounded-sm border-0 bg-transparent px-0.5 py-0 text-center caret-transparent outline-none selection:bg-transparent placeholder:text-placeholder focus:bg-primary focus:text-primary-foreground focus:placeholder:text-primary-foreground data-[type=dayPeriod]:w-[calc(2.6ch+4px)] data-[type=year]:w-[calc(4ch+4px)] data-[type=hour]:tabular-nums data-[type=minute]:tabular-nums data-[type=second]:tabular-nums";
|
|
9
|
+
declare const segmentLiteralClasses = "px-px whitespace-pre text-muted-foreground";
|
|
10
|
+
type DateInputSegmentProps = ComponentProps<typeof DateInputSegment$1>;
|
|
11
|
+
/**
|
|
12
|
+
* A unit you type in, or the text between two of them. The focused unit is
|
|
13
|
+
* filled, since the ring around the box doesn't say which one has focus.
|
|
14
|
+
*/
|
|
15
|
+
declare function DateInputSegment({ className, ...props }: DateInputSegmentProps): import("react").JSX.Element;
|
|
16
|
+
export { DateInput, type DateInputChangeOptions, type DateInputController, type DateInputGranularity, type DateInputOptions, DateInputSegment, type DateInputSegmentData, type DateInputSegmentProps, type DateInputSegmentState, type DateInputSegmentType, type DateInputState, type DateInputValueChangeReason, type DateMatcher, type DateMatchers, type HourCycle, createDateInputController, segmentClasses, segmentLiteralClasses };
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cnState } from "../../utilities/cn/index.js";
|
|
3
|
+
import { inputClasses } from "../input/input.js";
|
|
4
|
+
import { c } from "react/compiler-runtime";
|
|
5
|
+
import { jsx } from "react/jsx-runtime";
|
|
6
|
+
import { DateInput as DateInput$1, DateInputSegment as DateInputSegment$1, createDateInputController } from "@ui-sdk/react/date-input";
|
|
7
|
+
// src/components/date-input/date-input.tsx
|
|
8
|
+
const segments = (state) => state.segments.map((segment) => /* @__PURE__ */ jsx(DateInputSegment, { segment }, segment.key));
|
|
9
|
+
/**
|
|
10
|
+
* The box, with the look of `Input`. Focus goes to a segment inside it, so
|
|
11
|
+
* the box draws the ring. Without children it renders every segment.
|
|
12
|
+
*/
|
|
13
|
+
function DateInput(t0) {
|
|
14
|
+
const $ = c(10);
|
|
15
|
+
let className;
|
|
16
|
+
let props;
|
|
17
|
+
let t1;
|
|
18
|
+
if ($[0] !== t0) {
|
|
19
|
+
({className, children: t1, ...props} = t0);
|
|
20
|
+
$[0] = t0;
|
|
21
|
+
$[1] = className;
|
|
22
|
+
$[2] = props;
|
|
23
|
+
$[3] = t1;
|
|
24
|
+
} else {
|
|
25
|
+
className = $[1];
|
|
26
|
+
props = $[2];
|
|
27
|
+
t1 = $[3];
|
|
28
|
+
}
|
|
29
|
+
const children = t1 === void 0 ? segments : t1;
|
|
30
|
+
let t2;
|
|
31
|
+
if ($[4] !== className) {
|
|
32
|
+
t2 = cnState([inputClasses, "flex cursor-text items-center tabular-nums focus-field-within data-invalid:border-destructive data-invalid:ring-3 data-invalid:ring-destructive/20 has-aria-invalid:border-destructive has-aria-invalid:ring-3 has-aria-invalid:ring-destructive/20"], className);
|
|
33
|
+
$[4] = className;
|
|
34
|
+
$[5] = t2;
|
|
35
|
+
} else t2 = $[5];
|
|
36
|
+
let t3;
|
|
37
|
+
if ($[6] !== children || $[7] !== props || $[8] !== t2) {
|
|
38
|
+
t3 = /* @__PURE__ */ jsx(DateInput$1, {
|
|
39
|
+
className: t2,
|
|
40
|
+
...props,
|
|
41
|
+
children
|
|
42
|
+
});
|
|
43
|
+
$[6] = children;
|
|
44
|
+
$[7] = props;
|
|
45
|
+
$[8] = t2;
|
|
46
|
+
$[9] = t3;
|
|
47
|
+
} else t3 = $[9];
|
|
48
|
+
return t3;
|
|
49
|
+
}
|
|
50
|
+
const segmentClasses = "h-5.5 w-[calc(2ch+4px)] rounded-sm border-0 bg-transparent px-0.5 py-0 text-center caret-transparent outline-none selection:bg-transparent placeholder:text-placeholder focus:bg-primary focus:text-primary-foreground focus:placeholder:text-primary-foreground data-[type=dayPeriod]:w-[calc(2.6ch+4px)] data-[type=year]:w-[calc(4ch+4px)] data-[type=hour]:tabular-nums data-[type=minute]:tabular-nums data-[type=second]:tabular-nums";
|
|
51
|
+
const segmentLiteralClasses = "px-px whitespace-pre text-muted-foreground";
|
|
52
|
+
/**
|
|
53
|
+
* A unit you type in, or the text between two of them. The focused unit is
|
|
54
|
+
* filled, since the ring around the box doesn't say which one has focus.
|
|
55
|
+
*/
|
|
56
|
+
function DateInputSegment(t0) {
|
|
57
|
+
const $ = c(9);
|
|
58
|
+
let className;
|
|
59
|
+
let props;
|
|
60
|
+
if ($[0] !== t0) {
|
|
61
|
+
({className, ...props} = t0);
|
|
62
|
+
$[0] = t0;
|
|
63
|
+
$[1] = className;
|
|
64
|
+
$[2] = props;
|
|
65
|
+
} else {
|
|
66
|
+
className = $[1];
|
|
67
|
+
props = $[2];
|
|
68
|
+
}
|
|
69
|
+
const t1 = props.segment.editable ? segmentClasses : segmentLiteralClasses;
|
|
70
|
+
let t2;
|
|
71
|
+
if ($[3] !== className || $[4] !== t1) {
|
|
72
|
+
t2 = cnState(t1, className);
|
|
73
|
+
$[3] = className;
|
|
74
|
+
$[4] = t1;
|
|
75
|
+
$[5] = t2;
|
|
76
|
+
} else t2 = $[5];
|
|
77
|
+
let t3;
|
|
78
|
+
if ($[6] !== props || $[7] !== t2) {
|
|
79
|
+
t3 = /* @__PURE__ */ jsx(DateInputSegment$1, {
|
|
80
|
+
className: t2,
|
|
81
|
+
...props
|
|
82
|
+
});
|
|
83
|
+
$[6] = props;
|
|
84
|
+
$[7] = t2;
|
|
85
|
+
$[8] = t3;
|
|
86
|
+
} else t3 = $[8];
|
|
87
|
+
return t3;
|
|
88
|
+
}
|
|
89
|
+
export { DateInput, DateInputSegment, createDateInputController, segmentClasses, segmentLiteralClasses };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { ButtonLook } from "../button/button.js";
|
|
2
|
+
import { CalendarDay, CalendarGrid, CalendarHeading, CalendarMonthSelect, CalendarNext, CalendarPrevious, CalendarWeekday, CalendarWeekdays, CalendarWeeks, CalendarYearSelect } from "../calendar/calendar.js";
|
|
3
|
+
import { ComponentProps } from "react";
|
|
4
|
+
import { DateMatcher, DateMatchers, DatePicker as DatePicker$1, DatePickerChangeOptions, DatePickerClear as DatePickerClear$1, DatePickerContent as DatePickerContent$1, DatePickerContentState, DatePickerController, DatePickerDismissReason, DatePickerHint as DatePickerHint$1, DatePickerHintState, DatePickerInput as DatePickerInput$1, DatePickerInputState, DatePickerMode, DatePickerMonthChangeReason, DatePickerOpenChangeReason, DatePickerOptions, DatePickerPreset as DatePickerPreset$1, DatePickerState, DatePickerTrigger as DatePickerTrigger$1, DatePickerTriggerState, DatePickerValue, DatePickerValueChangeReason, ISOMonth, createDatePickerController } from "@ui-sdk/react/date-picker";
|
|
5
|
+
/**
|
|
6
|
+
* The input and its buttons share a row, and the hint takes the next one.
|
|
7
|
+
* Without children it renders an input, or two in range mode, the trigger and
|
|
8
|
+
* the calendar. A `Field` names the one input; write a range's two inputs
|
|
9
|
+
* out to name each with `aria-label`.
|
|
10
|
+
*/
|
|
11
|
+
declare function DatePicker({ className, children, ...props }: ComponentProps<typeof DatePicker$1>): import("react").JSX.Element;
|
|
12
|
+
declare function DatePickerInput({ className, ...props }: ComponentProps<typeof DatePickerInput$1>): import("react").JSX.Element;
|
|
13
|
+
type DatePickerTriggerProps = ComponentProps<typeof DatePickerTrigger$1> & ButtonLook;
|
|
14
|
+
/** An outline icon button. Without children it draws a calendar icon. */
|
|
15
|
+
declare function DatePickerTrigger({ variant, size, className, children, ...props }: DatePickerTriggerProps): import("react").JSX.Element;
|
|
16
|
+
declare function DatePickerHint({ className, ...props }: ComponentProps<typeof DatePickerHint$1>): import("react").JSX.Element;
|
|
17
|
+
type DatePickerClearProps = ComponentProps<typeof DatePickerClear$1> & ButtonLook;
|
|
18
|
+
/**
|
|
19
|
+
* A ghost icon button with a cross, hidden while there's nothing to clear.
|
|
20
|
+
* Name it with `aria-label`.
|
|
21
|
+
*/
|
|
22
|
+
declare function DatePickerClear({ variant, size, className, children, ...props }: DatePickerClearProps): import("react").JSX.Element;
|
|
23
|
+
/** Without children it renders the heading, Previous, Next and a grid for each of the picker's `months`. */
|
|
24
|
+
declare function DatePickerContent({ className, sideOffset, children, ...props }: ComponentProps<typeof DatePickerContent$1>): import("react").JSX.Element;
|
|
25
|
+
type DatePickerPresetProps = ComponentProps<typeof DatePickerPreset$1> & ButtonLook;
|
|
26
|
+
/** A ghost button, filled while its value is the one selected. */
|
|
27
|
+
declare function DatePickerPreset({ variant, size, className, ...props }: DatePickerPresetProps): import("react").JSX.Element;
|
|
28
|
+
export { CalendarDay, CalendarGrid, CalendarHeading, CalendarMonthSelect, CalendarNext, CalendarPrevious, CalendarWeekday, CalendarWeekdays, CalendarWeeks, CalendarYearSelect, type DateMatcher, type DateMatchers, DatePicker, type DatePickerChangeOptions, DatePickerClear, type DatePickerClearProps, DatePickerContent, type DatePickerContentState, type DatePickerController, type DatePickerDismissReason, DatePickerHint, type DatePickerHintState, DatePickerInput, type DatePickerInputState, type DatePickerMode, type DatePickerMonthChangeReason, type DatePickerOpenChangeReason, type DatePickerOptions, DatePickerPreset, type DatePickerPresetProps, type DatePickerState, DatePickerTrigger, type DatePickerTriggerProps, type DatePickerTriggerState, type DatePickerValue, type DatePickerValueChangeReason, type ISOMonth, createDatePickerController };
|