@asanchez-sa/abby 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +217 -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 +336 -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 +683 -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,1368 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn, cnState, cva } from "../../utilities/cn/index.js";
|
|
3
|
+
import { buttonVariants } from "../button/button.js";
|
|
4
|
+
import { Meter, MeterLabel, MeterTrack, MeterValue } from "../meter/meter.js";
|
|
5
|
+
import { Popover, PopoverContent, PopoverTrigger, createPopoverController } from "../popover/popover.js";
|
|
6
|
+
import { c } from "react/compiler-runtime";
|
|
7
|
+
import { createContext, useContext } from "react";
|
|
8
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
9
|
+
// src/components/usage/usage.tsx
|
|
10
|
+
const UsageContext = createContext(null);
|
|
11
|
+
/** The reading `Usage` shares with its parts. */
|
|
12
|
+
function useUsage() {
|
|
13
|
+
const usage = useContext(UsageContext);
|
|
14
|
+
if (!usage) throw new Error("Usage parts must be used within Usage");
|
|
15
|
+
return usage;
|
|
16
|
+
}
|
|
17
|
+
const grays = [
|
|
18
|
+
55,
|
|
19
|
+
38,
|
|
20
|
+
26,
|
|
21
|
+
18
|
|
22
|
+
];
|
|
23
|
+
const track = "color-mix(in oklab, var(--foreground) 12%, transparent)";
|
|
24
|
+
const gray = (age) => `color-mix(in oklab, var(--foreground) ${grays[Math.min(age - 1, grays.length - 1)]}%, transparent)`;
|
|
25
|
+
/** Sets `--usage-color` and `--usage-foreground` from the level, for the parts that draw. */
|
|
26
|
+
const levelColor = cva("", { variants: { level: {
|
|
27
|
+
idle: "[--usage-color:var(--muted-foreground)] [--usage-foreground:var(--background)]",
|
|
28
|
+
normal: "[--usage-color:var(--primary)] [--usage-foreground:var(--primary-foreground)]",
|
|
29
|
+
warning: "[--usage-color:var(--warning)] [--usage-foreground:var(--warning-foreground)]",
|
|
30
|
+
critical: "[--usage-color:var(--destructive)] [--usage-foreground:var(--destructive-foreground)]",
|
|
31
|
+
done: "[--usage-color:var(--success)] [--usage-foreground:var(--success-foreground)]"
|
|
32
|
+
} } });
|
|
33
|
+
/** A bar or an arc that follows a new value. Like a progress bar's width, the one size that animates. */
|
|
34
|
+
const follows = "duration-popup ease-out motion-reduce:transition-none";
|
|
35
|
+
/** The root: a Popover that shares the reading with its parts. */
|
|
36
|
+
function Usage(t0) {
|
|
37
|
+
const $ = c(52);
|
|
38
|
+
let givenLimit;
|
|
39
|
+
let givenSegments;
|
|
40
|
+
let props;
|
|
41
|
+
let t1;
|
|
42
|
+
let t2;
|
|
43
|
+
let t3;
|
|
44
|
+
let t4;
|
|
45
|
+
let t5;
|
|
46
|
+
let t6;
|
|
47
|
+
let t7;
|
|
48
|
+
if ($[0] !== t0) {
|
|
49
|
+
({limit: givenLimit, segments: givenSegments, value: t1, state: t2, warning: t3, critical: t4, label: t5, format: t6, locales: t7, ...props} = t0);
|
|
50
|
+
$[0] = t0;
|
|
51
|
+
$[1] = givenLimit;
|
|
52
|
+
$[2] = givenSegments;
|
|
53
|
+
$[3] = props;
|
|
54
|
+
$[4] = t1;
|
|
55
|
+
$[5] = t2;
|
|
56
|
+
$[6] = t3;
|
|
57
|
+
$[7] = t4;
|
|
58
|
+
$[8] = t5;
|
|
59
|
+
$[9] = t6;
|
|
60
|
+
$[10] = t7;
|
|
61
|
+
} else {
|
|
62
|
+
givenLimit = $[1];
|
|
63
|
+
givenSegments = $[2];
|
|
64
|
+
props = $[3];
|
|
65
|
+
t1 = $[4];
|
|
66
|
+
t2 = $[5];
|
|
67
|
+
t3 = $[6];
|
|
68
|
+
t4 = $[7];
|
|
69
|
+
t5 = $[8];
|
|
70
|
+
t6 = $[9];
|
|
71
|
+
t7 = $[10];
|
|
72
|
+
}
|
|
73
|
+
const value = t1 === void 0 ? 0 : t1;
|
|
74
|
+
const state = t2 === void 0 ? "active" : t2;
|
|
75
|
+
const warning = t3 === void 0 ? .7 : t3;
|
|
76
|
+
const critical = t4 === void 0 ? .9 : t4;
|
|
77
|
+
const label = t5 === void 0 ? "Context" : t5;
|
|
78
|
+
let t8;
|
|
79
|
+
if ($[11] !== t6) {
|
|
80
|
+
t8 = t6 === void 0 ? {
|
|
81
|
+
notation: "compact",
|
|
82
|
+
maximumFractionDigits: 1
|
|
83
|
+
} : t6;
|
|
84
|
+
$[11] = t6;
|
|
85
|
+
$[12] = t8;
|
|
86
|
+
} else t8 = $[12];
|
|
87
|
+
const formatOptions = t8;
|
|
88
|
+
const locales = t7 === void 0 ? "en" : t7;
|
|
89
|
+
const limit = Math.max(1, givenLimit);
|
|
90
|
+
let t9;
|
|
91
|
+
if ($[13] !== givenSegments || $[14] !== label || $[15] !== value) {
|
|
92
|
+
t9 = givenSegments ?? [{
|
|
93
|
+
label,
|
|
94
|
+
value
|
|
95
|
+
}];
|
|
96
|
+
$[13] = givenSegments;
|
|
97
|
+
$[14] = label;
|
|
98
|
+
$[15] = value;
|
|
99
|
+
$[16] = t9;
|
|
100
|
+
} else t9 = $[16];
|
|
101
|
+
const list = t9;
|
|
102
|
+
const used = list.reduce(_temp, 0);
|
|
103
|
+
const share = used / limit;
|
|
104
|
+
let t10;
|
|
105
|
+
if ($[17] !== critical || $[18] !== warning) {
|
|
106
|
+
t10 = (amount) => amount >= critical ? "critical" : amount >= warning ? "warning" : "normal";
|
|
107
|
+
$[17] = critical;
|
|
108
|
+
$[18] = warning;
|
|
109
|
+
$[19] = t10;
|
|
110
|
+
} else t10 = $[19];
|
|
111
|
+
const levelOf = t10;
|
|
112
|
+
const level = state === "idle" ? "idle" : state === "done" ? "done" : levelOf(share);
|
|
113
|
+
let t11;
|
|
114
|
+
if ($[20] !== formatOptions || $[21] !== locales) {
|
|
115
|
+
t11 = new Intl.NumberFormat(locales, formatOptions);
|
|
116
|
+
$[20] = formatOptions;
|
|
117
|
+
$[21] = locales;
|
|
118
|
+
$[22] = t11;
|
|
119
|
+
} else t11 = $[22];
|
|
120
|
+
const amounts = t11;
|
|
121
|
+
let t12;
|
|
122
|
+
if ($[23] !== locales) {
|
|
123
|
+
t12 = new Intl.NumberFormat(locales, {
|
|
124
|
+
style: "percent",
|
|
125
|
+
maximumFractionDigits: 0
|
|
126
|
+
});
|
|
127
|
+
$[23] = locales;
|
|
128
|
+
$[24] = t12;
|
|
129
|
+
} else t12 = $[24];
|
|
130
|
+
const percents = t12;
|
|
131
|
+
let t13;
|
|
132
|
+
if ($[25] !== list) {
|
|
133
|
+
let t14;
|
|
134
|
+
if ($[27] !== list.length) {
|
|
135
|
+
t14 = (segment_0, index) => {
|
|
136
|
+
const age = list.length - 1 - index;
|
|
137
|
+
return {
|
|
138
|
+
...segment_0,
|
|
139
|
+
value: Math.max(0, segment_0.value),
|
|
140
|
+
color: segment_0.color ?? (age === 0 ? "var(--usage-color)" : gray(age))
|
|
141
|
+
};
|
|
142
|
+
};
|
|
143
|
+
$[27] = list.length;
|
|
144
|
+
$[28] = t14;
|
|
145
|
+
} else t14 = $[28];
|
|
146
|
+
t13 = list.map(t14);
|
|
147
|
+
$[25] = list;
|
|
148
|
+
$[26] = t13;
|
|
149
|
+
} else t13 = $[26];
|
|
150
|
+
let t14;
|
|
151
|
+
if ($[29] !== amounts) {
|
|
152
|
+
t14 = (amount_0) => amounts.format(amount_0);
|
|
153
|
+
$[29] = amounts;
|
|
154
|
+
$[30] = t14;
|
|
155
|
+
} else t14 = $[30];
|
|
156
|
+
let t15;
|
|
157
|
+
if ($[31] !== percents) {
|
|
158
|
+
t15 = (amount_1) => percents.format(amount_1);
|
|
159
|
+
$[31] = percents;
|
|
160
|
+
$[32] = t15;
|
|
161
|
+
} else t15 = $[32];
|
|
162
|
+
let t16;
|
|
163
|
+
if ($[33] !== critical || $[34] !== label || $[35] !== level || $[36] !== levelOf || $[37] !== limit || $[38] !== locales || $[39] !== share || $[40] !== state || $[41] !== t13 || $[42] !== t14 || $[43] !== t15 || $[44] !== used || $[45] !== warning) {
|
|
164
|
+
t16 = {
|
|
165
|
+
label,
|
|
166
|
+
used,
|
|
167
|
+
limit,
|
|
168
|
+
share,
|
|
169
|
+
state,
|
|
170
|
+
level,
|
|
171
|
+
warning,
|
|
172
|
+
critical,
|
|
173
|
+
segments: t13,
|
|
174
|
+
format: t14,
|
|
175
|
+
formatPercent: t15,
|
|
176
|
+
levelOf,
|
|
177
|
+
locale: locales
|
|
178
|
+
};
|
|
179
|
+
$[33] = critical;
|
|
180
|
+
$[34] = label;
|
|
181
|
+
$[35] = level;
|
|
182
|
+
$[36] = levelOf;
|
|
183
|
+
$[37] = limit;
|
|
184
|
+
$[38] = locales;
|
|
185
|
+
$[39] = share;
|
|
186
|
+
$[40] = state;
|
|
187
|
+
$[41] = t13;
|
|
188
|
+
$[42] = t14;
|
|
189
|
+
$[43] = t15;
|
|
190
|
+
$[44] = used;
|
|
191
|
+
$[45] = warning;
|
|
192
|
+
$[46] = t16;
|
|
193
|
+
} else t16 = $[46];
|
|
194
|
+
const usage = t16;
|
|
195
|
+
let t17;
|
|
196
|
+
if ($[47] !== props) {
|
|
197
|
+
t17 = /* @__PURE__ */ jsx(Popover, { ...props });
|
|
198
|
+
$[47] = props;
|
|
199
|
+
$[48] = t17;
|
|
200
|
+
} else t17 = $[48];
|
|
201
|
+
let t18;
|
|
202
|
+
if ($[49] !== t17 || $[50] !== usage) {
|
|
203
|
+
t18 = /* @__PURE__ */ jsx(UsageContext.Provider, {
|
|
204
|
+
value: usage,
|
|
205
|
+
children: t17
|
|
206
|
+
});
|
|
207
|
+
$[49] = t17;
|
|
208
|
+
$[50] = usage;
|
|
209
|
+
$[51] = t18;
|
|
210
|
+
} else t18 = $[51];
|
|
211
|
+
return t18;
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* "Context: 62% used", "Context: not started", "Context: 62% used, finished".
|
|
215
|
+
* `shown` is the amount a trigger shows beside its drawing, which the name
|
|
216
|
+
* holds too so speech input can say it: "Context: 124K / 200K, 62% used".
|
|
217
|
+
*/
|
|
218
|
+
function _temp(sum, segment) {
|
|
219
|
+
return sum + Math.max(0, segment.value);
|
|
220
|
+
}
|
|
221
|
+
function getUsageLabel({ label, share, state, formatPercent }, shown) {
|
|
222
|
+
const reading = state === "idle" ? "not started" : `${formatPercent(share)} used`;
|
|
223
|
+
const name = shown ? `${label}: ${shown}, ${reading}` : `${label}: ${reading}`;
|
|
224
|
+
return state === "done" ? `${name}, finished` : name;
|
|
225
|
+
}
|
|
226
|
+
/** What a drawing shows: one piece per segment with something in it, and the free part last. */
|
|
227
|
+
function piecesOf(usage) {
|
|
228
|
+
if (usage.level === "idle") return {
|
|
229
|
+
pieces: [{
|
|
230
|
+
key: "free",
|
|
231
|
+
value: usage.limit,
|
|
232
|
+
color: track,
|
|
233
|
+
newest: false
|
|
234
|
+
}],
|
|
235
|
+
total: usage.limit
|
|
236
|
+
};
|
|
237
|
+
const filled = usage.segments.filter((segment) => segment.value > 0);
|
|
238
|
+
const pieces = filled.map((segment, index) => ({
|
|
239
|
+
key: segment.label,
|
|
240
|
+
value: segment.value,
|
|
241
|
+
color: segment.color,
|
|
242
|
+
newest: index === filled.length - 1
|
|
243
|
+
}));
|
|
244
|
+
if (usage.used < usage.limit) pieces.push({
|
|
245
|
+
key: "free",
|
|
246
|
+
value: usage.limit - usage.used,
|
|
247
|
+
color: track,
|
|
248
|
+
newest: false
|
|
249
|
+
});
|
|
250
|
+
return {
|
|
251
|
+
pieces,
|
|
252
|
+
total: Math.max(usage.used, usage.limit)
|
|
253
|
+
};
|
|
254
|
+
}
|
|
255
|
+
/** The newest piece breathes while the work runs. */
|
|
256
|
+
const breathes = (usage, piece) => usage.state === "active" && piece.newest && "motion-safe:animate-pulse";
|
|
257
|
+
/** Arcs around a circle, one per piece: the whole circle, or the open sweep of a gauge. */
|
|
258
|
+
function Arcs({ usage, center, radius, width, sweep = 1, start: rotation = -90, gap = 1.5 }) {
|
|
259
|
+
const { pieces, total } = piecesOf(usage);
|
|
260
|
+
const circumference = 2 * Math.PI * radius;
|
|
261
|
+
const length = circumference * sweep;
|
|
262
|
+
let start = 0;
|
|
263
|
+
return /* @__PURE__ */ jsx("g", {
|
|
264
|
+
transform: `rotate(${rotation} ${center} ${center})`,
|
|
265
|
+
children: pieces.map((piece) => {
|
|
266
|
+
const size = piece.value / total * length;
|
|
267
|
+
const drawn = Math.max(size - (pieces.length > 1 ? gap : 0), 0);
|
|
268
|
+
const offset = -start;
|
|
269
|
+
start += size;
|
|
270
|
+
return /* @__PURE__ */ jsx("circle", {
|
|
271
|
+
cx: center,
|
|
272
|
+
cy: center,
|
|
273
|
+
r: radius,
|
|
274
|
+
fill: "none",
|
|
275
|
+
strokeWidth: width,
|
|
276
|
+
className: cn("transition-[stroke-dasharray,stroke-dashoffset,stroke]", follows, breathes(usage, piece)),
|
|
277
|
+
style: {
|
|
278
|
+
stroke: piece.color,
|
|
279
|
+
strokeDasharray: `${drawn} ${circumference}`,
|
|
280
|
+
strokeDashoffset: offset
|
|
281
|
+
}
|
|
282
|
+
}, piece.key);
|
|
283
|
+
})
|
|
284
|
+
});
|
|
285
|
+
}
|
|
286
|
+
function RingDrawing(t0) {
|
|
287
|
+
const $ = c(15);
|
|
288
|
+
const { usage } = t0;
|
|
289
|
+
const done = usage.state === "done";
|
|
290
|
+
const t1 = done && "opacity-30";
|
|
291
|
+
let t2;
|
|
292
|
+
if ($[0] !== t1) {
|
|
293
|
+
t2 = cn("transition-opacity duration-popup ease-out motion-reduce:transition-none", t1);
|
|
294
|
+
$[0] = t1;
|
|
295
|
+
$[1] = t2;
|
|
296
|
+
} else t2 = $[1];
|
|
297
|
+
let t3;
|
|
298
|
+
if ($[2] !== usage) {
|
|
299
|
+
t3 = /* @__PURE__ */ jsx(Arcs, {
|
|
300
|
+
usage,
|
|
301
|
+
center: 16,
|
|
302
|
+
radius: 12.5,
|
|
303
|
+
width: 3
|
|
304
|
+
});
|
|
305
|
+
$[2] = usage;
|
|
306
|
+
$[3] = t3;
|
|
307
|
+
} else t3 = $[3];
|
|
308
|
+
let t4;
|
|
309
|
+
if ($[4] !== t2 || $[5] !== t3) {
|
|
310
|
+
t4 = /* @__PURE__ */ jsx("g", {
|
|
311
|
+
className: t2,
|
|
312
|
+
children: t3
|
|
313
|
+
});
|
|
314
|
+
$[4] = t2;
|
|
315
|
+
$[5] = t3;
|
|
316
|
+
$[6] = t4;
|
|
317
|
+
} else t4 = $[6];
|
|
318
|
+
const t5 = done && "scale-[1.85]";
|
|
319
|
+
let t6;
|
|
320
|
+
if ($[7] !== t5) {
|
|
321
|
+
t6 = cn("origin-center transition-[scale] duration-popup ease-out [transform-box:fill-box] motion-reduce:transition-none", t5);
|
|
322
|
+
$[7] = t5;
|
|
323
|
+
$[8] = t6;
|
|
324
|
+
} else t6 = $[8];
|
|
325
|
+
let t7;
|
|
326
|
+
if ($[9] === Symbol.for("react.memo_cache_sentinel")) {
|
|
327
|
+
t7 = { fill: "var(--usage-color)" };
|
|
328
|
+
$[9] = t7;
|
|
329
|
+
} else t7 = $[9];
|
|
330
|
+
let t8;
|
|
331
|
+
if ($[10] !== t6) {
|
|
332
|
+
t8 = /* @__PURE__ */ jsx("circle", {
|
|
333
|
+
cx: 16,
|
|
334
|
+
cy: 16,
|
|
335
|
+
r: 3.5,
|
|
336
|
+
className: t6,
|
|
337
|
+
style: t7
|
|
338
|
+
});
|
|
339
|
+
$[10] = t6;
|
|
340
|
+
$[11] = t8;
|
|
341
|
+
} else t8 = $[11];
|
|
342
|
+
let t9;
|
|
343
|
+
if ($[12] !== t4 || $[13] !== t8) {
|
|
344
|
+
t9 = /* @__PURE__ */ jsxs("svg", {
|
|
345
|
+
viewBox: "0 0 32 32",
|
|
346
|
+
className: "size-7",
|
|
347
|
+
"aria-hidden": "true",
|
|
348
|
+
children: [t4, t8]
|
|
349
|
+
});
|
|
350
|
+
$[12] = t4;
|
|
351
|
+
$[13] = t8;
|
|
352
|
+
$[14] = t9;
|
|
353
|
+
} else t9 = $[14];
|
|
354
|
+
return t9;
|
|
355
|
+
}
|
|
356
|
+
const dotCount = 12;
|
|
357
|
+
function DotsDrawing(t0) {
|
|
358
|
+
const $ = c(3);
|
|
359
|
+
const { usage } = t0;
|
|
360
|
+
const lit = usage.level === "idle" ? 0 : Math.min(dotCount, Math.ceil(usage.share * dotCount));
|
|
361
|
+
let t1;
|
|
362
|
+
if ($[0] !== lit || $[1] !== usage.state) {
|
|
363
|
+
t1 = /* @__PURE__ */ jsx("svg", {
|
|
364
|
+
viewBox: "0 0 32 32",
|
|
365
|
+
className: "size-7",
|
|
366
|
+
"aria-hidden": "true",
|
|
367
|
+
children: Array.from({ length: dotCount }, (_, index) => {
|
|
368
|
+
const angle = index / dotCount * 2 * Math.PI - Math.PI / 2;
|
|
369
|
+
const on = index < lit;
|
|
370
|
+
return /* @__PURE__ */ jsx("circle", {
|
|
371
|
+
cx: 16 + 12 * Math.cos(angle),
|
|
372
|
+
cy: 16 + 12 * Math.sin(angle),
|
|
373
|
+
r: 2,
|
|
374
|
+
className: cn("transition-colors motion-reduce:transition-none", on && usage.state === "active" && index === lit - 1 && "motion-safe:animate-pulse"),
|
|
375
|
+
style: { fill: on ? "var(--usage-color)" : track }
|
|
376
|
+
}, angle);
|
|
377
|
+
})
|
|
378
|
+
});
|
|
379
|
+
$[0] = lit;
|
|
380
|
+
$[1] = usage.state;
|
|
381
|
+
$[2] = t1;
|
|
382
|
+
} else t1 = $[2];
|
|
383
|
+
return t1;
|
|
384
|
+
}
|
|
385
|
+
function GaugeDrawing(t0) {
|
|
386
|
+
const $ = c(9);
|
|
387
|
+
const { usage } = t0;
|
|
388
|
+
let t1;
|
|
389
|
+
if ($[0] !== usage) {
|
|
390
|
+
t1 = /* @__PURE__ */ jsx("svg", {
|
|
391
|
+
viewBox: "0 0 44 44",
|
|
392
|
+
className: "size-11",
|
|
393
|
+
"aria-hidden": "true",
|
|
394
|
+
children: /* @__PURE__ */ jsx(Arcs, {
|
|
395
|
+
usage,
|
|
396
|
+
center: 22,
|
|
397
|
+
radius: 18,
|
|
398
|
+
width: 3.5,
|
|
399
|
+
sweep: .75,
|
|
400
|
+
start: 135
|
|
401
|
+
})
|
|
402
|
+
});
|
|
403
|
+
$[0] = usage;
|
|
404
|
+
$[1] = t1;
|
|
405
|
+
} else t1 = $[1];
|
|
406
|
+
let t2;
|
|
407
|
+
if ($[2] !== usage) {
|
|
408
|
+
t2 = usage.level === "idle" ? "–" : usage.formatPercent(usage.share);
|
|
409
|
+
$[2] = usage;
|
|
410
|
+
$[3] = t2;
|
|
411
|
+
} else t2 = $[3];
|
|
412
|
+
let t3;
|
|
413
|
+
if ($[4] !== t2) {
|
|
414
|
+
t3 = /* @__PURE__ */ jsx("span", {
|
|
415
|
+
"aria-hidden": "true",
|
|
416
|
+
className: "absolute inset-0 grid place-items-center text-xs font-medium tracking-tight tabular-nums",
|
|
417
|
+
children: t2
|
|
418
|
+
});
|
|
419
|
+
$[4] = t2;
|
|
420
|
+
$[5] = t3;
|
|
421
|
+
} else t3 = $[5];
|
|
422
|
+
let t4;
|
|
423
|
+
if ($[6] !== t1 || $[7] !== t3) {
|
|
424
|
+
t4 = /* @__PURE__ */ jsxs(Fragment$1, { children: [t1, t3] });
|
|
425
|
+
$[6] = t1;
|
|
426
|
+
$[7] = t3;
|
|
427
|
+
$[8] = t4;
|
|
428
|
+
} else t4 = $[8];
|
|
429
|
+
return t4;
|
|
430
|
+
}
|
|
431
|
+
function BarDrawing(t0) {
|
|
432
|
+
const $ = c(11);
|
|
433
|
+
const { usage } = t0;
|
|
434
|
+
let t1;
|
|
435
|
+
let t2;
|
|
436
|
+
let t3;
|
|
437
|
+
if ($[0] !== usage) {
|
|
438
|
+
const { pieces, total } = piecesOf(usage);
|
|
439
|
+
t1 = "true";
|
|
440
|
+
t2 = "flex h-1.5 w-12 gap-px overflow-hidden rounded-full";
|
|
441
|
+
let t4;
|
|
442
|
+
if ($[4] !== total || $[5] !== usage) {
|
|
443
|
+
t4 = (piece) => /* @__PURE__ */ jsx("span", {
|
|
444
|
+
className: cn("h-full transition-[width]", follows, breathes(usage, piece)),
|
|
445
|
+
style: {
|
|
446
|
+
width: `${piece.value / total * 100}%`,
|
|
447
|
+
background: piece.color
|
|
448
|
+
}
|
|
449
|
+
}, piece.key);
|
|
450
|
+
$[4] = total;
|
|
451
|
+
$[5] = usage;
|
|
452
|
+
$[6] = t4;
|
|
453
|
+
} else t4 = $[6];
|
|
454
|
+
t3 = pieces.map(t4);
|
|
455
|
+
$[0] = usage;
|
|
456
|
+
$[1] = t1;
|
|
457
|
+
$[2] = t2;
|
|
458
|
+
$[3] = t3;
|
|
459
|
+
} else {
|
|
460
|
+
t1 = $[1];
|
|
461
|
+
t2 = $[2];
|
|
462
|
+
t3 = $[3];
|
|
463
|
+
}
|
|
464
|
+
let t4;
|
|
465
|
+
if ($[7] !== t1 || $[8] !== t2 || $[9] !== t3) {
|
|
466
|
+
t4 = /* @__PURE__ */ jsx("span", {
|
|
467
|
+
"aria-hidden": t1,
|
|
468
|
+
className: t2,
|
|
469
|
+
children: t3
|
|
470
|
+
});
|
|
471
|
+
$[7] = t1;
|
|
472
|
+
$[8] = t2;
|
|
473
|
+
$[9] = t3;
|
|
474
|
+
$[10] = t4;
|
|
475
|
+
} else t4 = $[10];
|
|
476
|
+
return t4;
|
|
477
|
+
}
|
|
478
|
+
const cellCount = 20;
|
|
479
|
+
function CellsDrawing(t0) {
|
|
480
|
+
const $ = c(7);
|
|
481
|
+
const { usage } = t0;
|
|
482
|
+
const lit = usage.level === "idle" ? 0 : Math.min(cellCount, Math.ceil(usage.share * cellCount));
|
|
483
|
+
const total = Math.max(usage.used, usage.limit);
|
|
484
|
+
let t1;
|
|
485
|
+
if ($[0] !== total || $[1] !== usage.segments) {
|
|
486
|
+
t1 = (index) => {
|
|
487
|
+
const point = (index + .5) / cellCount * total;
|
|
488
|
+
let reached = 0;
|
|
489
|
+
for (const segment of usage.segments) {
|
|
490
|
+
reached = reached + segment.value;
|
|
491
|
+
if (point < reached) return segment.color;
|
|
492
|
+
}
|
|
493
|
+
return usage.segments.at(-1)?.color ?? "var(--usage-color)";
|
|
494
|
+
};
|
|
495
|
+
$[0] = total;
|
|
496
|
+
$[1] = usage.segments;
|
|
497
|
+
$[2] = t1;
|
|
498
|
+
} else t1 = $[2];
|
|
499
|
+
const colorAt = t1;
|
|
500
|
+
let t2;
|
|
501
|
+
if ($[3] !== colorAt || $[4] !== lit || $[5] !== usage.state) {
|
|
502
|
+
t2 = /* @__PURE__ */ jsx("span", {
|
|
503
|
+
"aria-hidden": "true",
|
|
504
|
+
className: "grid grid-flow-col grid-rows-2 gap-0.5",
|
|
505
|
+
children: Array.from({ length: cellCount }, (_, index_0) => {
|
|
506
|
+
const on = index_0 < lit;
|
|
507
|
+
return /* @__PURE__ */ jsx("span", {
|
|
508
|
+
className: cn("size-1.5 transition-colors motion-reduce:transition-none", on && usage.state === "active" && index_0 === lit - 1 && "motion-safe:animate-pulse"),
|
|
509
|
+
style: { background: on ? colorAt(index_0) : track }
|
|
510
|
+
}, index_0);
|
|
511
|
+
})
|
|
512
|
+
});
|
|
513
|
+
$[3] = colorAt;
|
|
514
|
+
$[4] = lit;
|
|
515
|
+
$[5] = usage.state;
|
|
516
|
+
$[6] = t2;
|
|
517
|
+
} else t2 = $[6];
|
|
518
|
+
return t2;
|
|
519
|
+
}
|
|
520
|
+
function PillDrawing(t0) {
|
|
521
|
+
const $ = c(2);
|
|
522
|
+
const { usage } = t0;
|
|
523
|
+
let t1;
|
|
524
|
+
if ($[0] !== usage) {
|
|
525
|
+
t1 = /* @__PURE__ */ jsx("svg", {
|
|
526
|
+
viewBox: "0 0 16 16",
|
|
527
|
+
className: "size-3.5",
|
|
528
|
+
"aria-hidden": "true",
|
|
529
|
+
children: /* @__PURE__ */ jsx(Arcs, {
|
|
530
|
+
usage,
|
|
531
|
+
center: 8,
|
|
532
|
+
radius: 6,
|
|
533
|
+
width: 2.5,
|
|
534
|
+
gap: 1
|
|
535
|
+
})
|
|
536
|
+
});
|
|
537
|
+
$[0] = usage;
|
|
538
|
+
$[1] = t1;
|
|
539
|
+
} else t1 = $[1];
|
|
540
|
+
return t1;
|
|
541
|
+
}
|
|
542
|
+
const triggerVariants = cva("relative tabular-nums", {
|
|
543
|
+
variants: { variant: {
|
|
544
|
+
ring: buttonVariants({
|
|
545
|
+
variant: "ghost",
|
|
546
|
+
size: "icon-sm"
|
|
547
|
+
}),
|
|
548
|
+
dots: buttonVariants({
|
|
549
|
+
variant: "ghost",
|
|
550
|
+
size: "icon-sm"
|
|
551
|
+
}),
|
|
552
|
+
gauge: buttonVariants({
|
|
553
|
+
variant: "ghost",
|
|
554
|
+
size: "icon-lg"
|
|
555
|
+
}),
|
|
556
|
+
bar: cn(buttonVariants({
|
|
557
|
+
variant: "ghost",
|
|
558
|
+
size: "sm"
|
|
559
|
+
}), "px-2"),
|
|
560
|
+
cells: cn(buttonVariants({
|
|
561
|
+
variant: "ghost",
|
|
562
|
+
size: "sm"
|
|
563
|
+
}), "px-2"),
|
|
564
|
+
pill: cn(buttonVariants({
|
|
565
|
+
variant: "outline",
|
|
566
|
+
size: "xs"
|
|
567
|
+
}), "gap-1.5 rounded-full")
|
|
568
|
+
} },
|
|
569
|
+
defaultVariants: { variant: "ring" }
|
|
570
|
+
});
|
|
571
|
+
/**
|
|
572
|
+
* The button that opens the figures. Without children it draws the reading as
|
|
573
|
+
* its `variant` says, and its name says it in words: "Context: 62% used".
|
|
574
|
+
*/
|
|
575
|
+
function UsageTrigger(t0) {
|
|
576
|
+
const $ = c(38);
|
|
577
|
+
let ariaLabel;
|
|
578
|
+
let children;
|
|
579
|
+
let className;
|
|
580
|
+
let props;
|
|
581
|
+
let t1;
|
|
582
|
+
let t2;
|
|
583
|
+
if ($[0] !== t0) {
|
|
584
|
+
({variant: t1, getLabel: t2, className, children, "aria-label": ariaLabel, ...props} = t0);
|
|
585
|
+
$[0] = t0;
|
|
586
|
+
$[1] = ariaLabel;
|
|
587
|
+
$[2] = children;
|
|
588
|
+
$[3] = className;
|
|
589
|
+
$[4] = props;
|
|
590
|
+
$[5] = t1;
|
|
591
|
+
$[6] = t2;
|
|
592
|
+
} else {
|
|
593
|
+
ariaLabel = $[1];
|
|
594
|
+
children = $[2];
|
|
595
|
+
className = $[3];
|
|
596
|
+
props = $[4];
|
|
597
|
+
t1 = $[5];
|
|
598
|
+
t2 = $[6];
|
|
599
|
+
}
|
|
600
|
+
const variant = t1 === void 0 ? "ring" : t1;
|
|
601
|
+
const getLabel = t2 === void 0 ? getUsageLabel : t2;
|
|
602
|
+
const usage = useUsage();
|
|
603
|
+
let t3;
|
|
604
|
+
if ($[7] !== usage) {
|
|
605
|
+
t3 = usage.level === "idle" ? "–" : usage.formatPercent(usage.share);
|
|
606
|
+
$[7] = usage;
|
|
607
|
+
$[8] = t3;
|
|
608
|
+
} else t3 = $[8];
|
|
609
|
+
const percent = t3;
|
|
610
|
+
let T0;
|
|
611
|
+
let shown;
|
|
612
|
+
let t4;
|
|
613
|
+
let t5;
|
|
614
|
+
let t6;
|
|
615
|
+
let t7;
|
|
616
|
+
if ($[9] !== ariaLabel || $[10] !== getLabel || $[11] !== usage || $[12] !== variant) {
|
|
617
|
+
shown = variant === "cells" ? usage.format(usage.used) : variant === "pill" ? `${usage.format(usage.used)} / ${usage.format(usage.limit)}` : void 0;
|
|
618
|
+
T0 = PopoverTrigger;
|
|
619
|
+
t4 = variant;
|
|
620
|
+
t5 = usage.level;
|
|
621
|
+
t6 = usage.state;
|
|
622
|
+
t7 = ariaLabel ?? getLabel(usage, shown);
|
|
623
|
+
$[9] = ariaLabel;
|
|
624
|
+
$[10] = getLabel;
|
|
625
|
+
$[11] = usage;
|
|
626
|
+
$[12] = variant;
|
|
627
|
+
$[13] = T0;
|
|
628
|
+
$[14] = shown;
|
|
629
|
+
$[15] = t4;
|
|
630
|
+
$[16] = t5;
|
|
631
|
+
$[17] = t6;
|
|
632
|
+
$[18] = t7;
|
|
633
|
+
} else {
|
|
634
|
+
T0 = $[13];
|
|
635
|
+
shown = $[14];
|
|
636
|
+
t4 = $[15];
|
|
637
|
+
t5 = $[16];
|
|
638
|
+
t6 = $[17];
|
|
639
|
+
t7 = $[18];
|
|
640
|
+
}
|
|
641
|
+
let t8;
|
|
642
|
+
if ($[19] !== className || $[20] !== usage.level || $[21] !== variant) {
|
|
643
|
+
t8 = cnState(cn(triggerVariants({ variant }), levelColor({ level: usage.level })), className);
|
|
644
|
+
$[19] = className;
|
|
645
|
+
$[20] = usage.level;
|
|
646
|
+
$[21] = variant;
|
|
647
|
+
$[22] = t8;
|
|
648
|
+
} else t8 = $[22];
|
|
649
|
+
let t9;
|
|
650
|
+
if ($[23] !== children || $[24] !== percent || $[25] !== shown || $[26] !== usage || $[27] !== variant) {
|
|
651
|
+
t9 = children ?? /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
652
|
+
variant === "ring" && /* @__PURE__ */ jsx(RingDrawing, { usage }),
|
|
653
|
+
variant === "dots" && /* @__PURE__ */ jsx(DotsDrawing, { usage }),
|
|
654
|
+
variant === "gauge" && /* @__PURE__ */ jsx(GaugeDrawing, { usage }),
|
|
655
|
+
variant === "bar" && /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(BarDrawing, { usage }), percent] }),
|
|
656
|
+
variant === "cells" && /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(CellsDrawing, { usage }), shown] }),
|
|
657
|
+
variant === "pill" && /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(PillDrawing, { usage }), shown] })
|
|
658
|
+
] });
|
|
659
|
+
$[23] = children;
|
|
660
|
+
$[24] = percent;
|
|
661
|
+
$[25] = shown;
|
|
662
|
+
$[26] = usage;
|
|
663
|
+
$[27] = variant;
|
|
664
|
+
$[28] = t9;
|
|
665
|
+
} else t9 = $[28];
|
|
666
|
+
let t10;
|
|
667
|
+
if ($[29] !== T0 || $[30] !== props || $[31] !== t4 || $[32] !== t5 || $[33] !== t6 || $[34] !== t7 || $[35] !== t8 || $[36] !== t9) {
|
|
668
|
+
t10 = /* @__PURE__ */ jsx(T0, {
|
|
669
|
+
"data-variant": t4,
|
|
670
|
+
"data-level": t5,
|
|
671
|
+
"data-state": t6,
|
|
672
|
+
"aria-label": t7,
|
|
673
|
+
className: t8,
|
|
674
|
+
...props,
|
|
675
|
+
children: t9
|
|
676
|
+
});
|
|
677
|
+
$[29] = T0;
|
|
678
|
+
$[30] = props;
|
|
679
|
+
$[31] = t4;
|
|
680
|
+
$[32] = t5;
|
|
681
|
+
$[33] = t6;
|
|
682
|
+
$[34] = t7;
|
|
683
|
+
$[35] = t8;
|
|
684
|
+
$[36] = t9;
|
|
685
|
+
$[37] = t10;
|
|
686
|
+
} else t10 = $[37];
|
|
687
|
+
return t10;
|
|
688
|
+
}
|
|
689
|
+
/** The popover, above the trigger by default. Its trigger names it, as ui-sdk does with no title. */
|
|
690
|
+
function UsageContent(t0) {
|
|
691
|
+
const $ = c(17);
|
|
692
|
+
let className;
|
|
693
|
+
let props;
|
|
694
|
+
let t1;
|
|
695
|
+
let t2;
|
|
696
|
+
let t3;
|
|
697
|
+
if ($[0] !== t0) {
|
|
698
|
+
({className, side: t1, align: t2, sideOffset: t3, ...props} = t0);
|
|
699
|
+
$[0] = t0;
|
|
700
|
+
$[1] = className;
|
|
701
|
+
$[2] = props;
|
|
702
|
+
$[3] = t1;
|
|
703
|
+
$[4] = t2;
|
|
704
|
+
$[5] = t3;
|
|
705
|
+
} else {
|
|
706
|
+
className = $[1];
|
|
707
|
+
props = $[2];
|
|
708
|
+
t1 = $[3];
|
|
709
|
+
t2 = $[4];
|
|
710
|
+
t3 = $[5];
|
|
711
|
+
}
|
|
712
|
+
const side = t1 === void 0 ? "top" : t1;
|
|
713
|
+
const align = t2 === void 0 ? "start" : t2;
|
|
714
|
+
const sideOffset = t3 === void 0 ? 8 : t3;
|
|
715
|
+
const usage = useUsage();
|
|
716
|
+
const t4 = usage.level;
|
|
717
|
+
const t5 = usage.state;
|
|
718
|
+
let t6;
|
|
719
|
+
if ($[6] !== className || $[7] !== usage.level) {
|
|
720
|
+
t6 = cnState(cn("gap-0 overflow-hidden data-[presentation=popover]:w-80 data-[presentation=popover]:p-0", levelColor({ level: usage.level })), className);
|
|
721
|
+
$[6] = className;
|
|
722
|
+
$[7] = usage.level;
|
|
723
|
+
$[8] = t6;
|
|
724
|
+
} else t6 = $[8];
|
|
725
|
+
let t7;
|
|
726
|
+
if ($[9] !== align || $[10] !== props || $[11] !== side || $[12] !== sideOffset || $[13] !== t6 || $[14] !== usage.level || $[15] !== usage.state) {
|
|
727
|
+
t7 = /* @__PURE__ */ jsx(PopoverContent, {
|
|
728
|
+
side,
|
|
729
|
+
align,
|
|
730
|
+
sideOffset,
|
|
731
|
+
"data-level": t4,
|
|
732
|
+
"data-state": t5,
|
|
733
|
+
className: t6,
|
|
734
|
+
...props
|
|
735
|
+
});
|
|
736
|
+
$[9] = align;
|
|
737
|
+
$[10] = props;
|
|
738
|
+
$[11] = side;
|
|
739
|
+
$[12] = sideOffset;
|
|
740
|
+
$[13] = t6;
|
|
741
|
+
$[14] = usage.level;
|
|
742
|
+
$[15] = usage.state;
|
|
743
|
+
$[16] = t7;
|
|
744
|
+
} else t7 = $[16];
|
|
745
|
+
return t7;
|
|
746
|
+
}
|
|
747
|
+
/** The label, the figure, the share and a bar with one piece per segment. Children go under it. */
|
|
748
|
+
function UsageSummary(t0) {
|
|
749
|
+
const $ = c(78);
|
|
750
|
+
let barLabel;
|
|
751
|
+
let children;
|
|
752
|
+
let className;
|
|
753
|
+
let props;
|
|
754
|
+
let title;
|
|
755
|
+
let unit;
|
|
756
|
+
if ($[0] !== t0) {
|
|
757
|
+
({title, unit, barLabel, className, children, ...props} = t0);
|
|
758
|
+
$[0] = t0;
|
|
759
|
+
$[1] = barLabel;
|
|
760
|
+
$[2] = children;
|
|
761
|
+
$[3] = className;
|
|
762
|
+
$[4] = props;
|
|
763
|
+
$[5] = title;
|
|
764
|
+
$[6] = unit;
|
|
765
|
+
} else {
|
|
766
|
+
barLabel = $[1];
|
|
767
|
+
children = $[2];
|
|
768
|
+
className = $[3];
|
|
769
|
+
props = $[4];
|
|
770
|
+
title = $[5];
|
|
771
|
+
unit = $[6];
|
|
772
|
+
}
|
|
773
|
+
const usage = useUsage();
|
|
774
|
+
let T0;
|
|
775
|
+
let T1;
|
|
776
|
+
let t1;
|
|
777
|
+
let t10;
|
|
778
|
+
let t11;
|
|
779
|
+
let t12;
|
|
780
|
+
let t13;
|
|
781
|
+
let t2;
|
|
782
|
+
let t3;
|
|
783
|
+
let t4;
|
|
784
|
+
let t5;
|
|
785
|
+
let t6;
|
|
786
|
+
let t7;
|
|
787
|
+
let t8;
|
|
788
|
+
let t9;
|
|
789
|
+
if ($[7] !== barLabel || $[8] !== className || $[9] !== props || $[10] !== title || $[11] !== unit || $[12] !== usage) {
|
|
790
|
+
const { pieces, total } = piecesOf(usage);
|
|
791
|
+
t9 = "usage-summary";
|
|
792
|
+
t10 = usage.level;
|
|
793
|
+
if ($[28] !== className) {
|
|
794
|
+
t11 = cn("flex flex-col gap-3 p-4", className);
|
|
795
|
+
$[28] = className;
|
|
796
|
+
$[29] = t11;
|
|
797
|
+
} else t11 = $[29];
|
|
798
|
+
t12 = props;
|
|
799
|
+
const t14 = title ?? usage.label;
|
|
800
|
+
let t15;
|
|
801
|
+
if ($[30] !== t14) {
|
|
802
|
+
t15 = /* @__PURE__ */ jsx("span", {
|
|
803
|
+
className: "text-sm text-muted-foreground",
|
|
804
|
+
children: t14
|
|
805
|
+
});
|
|
806
|
+
$[30] = t14;
|
|
807
|
+
$[31] = t15;
|
|
808
|
+
} else t15 = $[31];
|
|
809
|
+
let t16;
|
|
810
|
+
if ($[32] !== usage) {
|
|
811
|
+
t16 = usage.format(usage.used);
|
|
812
|
+
$[32] = usage;
|
|
813
|
+
$[33] = t16;
|
|
814
|
+
} else t16 = $[33];
|
|
815
|
+
let t17;
|
|
816
|
+
if ($[34] !== usage) {
|
|
817
|
+
t17 = usage.format(usage.limit);
|
|
818
|
+
$[34] = usage;
|
|
819
|
+
$[35] = t17;
|
|
820
|
+
} else t17 = $[35];
|
|
821
|
+
let t18;
|
|
822
|
+
if ($[36] !== unit) {
|
|
823
|
+
t18 = unit != null && /* @__PURE__ */ jsxs(Fragment$1, { children: [" ", unit] });
|
|
824
|
+
$[36] = unit;
|
|
825
|
+
$[37] = t18;
|
|
826
|
+
} else t18 = $[37];
|
|
827
|
+
let t19;
|
|
828
|
+
if ($[38] !== t17 || $[39] !== t18) {
|
|
829
|
+
t19 = /* @__PURE__ */ jsxs("span", {
|
|
830
|
+
className: "text-sm font-normal text-muted-foreground",
|
|
831
|
+
children: [
|
|
832
|
+
" ",
|
|
833
|
+
"/ ",
|
|
834
|
+
t17,
|
|
835
|
+
t18
|
|
836
|
+
]
|
|
837
|
+
});
|
|
838
|
+
$[38] = t17;
|
|
839
|
+
$[39] = t18;
|
|
840
|
+
$[40] = t19;
|
|
841
|
+
} else t19 = $[40];
|
|
842
|
+
let t20;
|
|
843
|
+
if ($[41] !== t16 || $[42] !== t19) {
|
|
844
|
+
t20 = /* @__PURE__ */ jsxs("span", {
|
|
845
|
+
className: "text-heading-2 tabular-nums",
|
|
846
|
+
children: [t16, t19]
|
|
847
|
+
});
|
|
848
|
+
$[41] = t16;
|
|
849
|
+
$[42] = t19;
|
|
850
|
+
$[43] = t20;
|
|
851
|
+
} else t20 = $[43];
|
|
852
|
+
let t21;
|
|
853
|
+
if ($[44] !== t15 || $[45] !== t20) {
|
|
854
|
+
t21 = /* @__PURE__ */ jsxs("div", {
|
|
855
|
+
className: "flex min-w-0 flex-col gap-0.5",
|
|
856
|
+
children: [t15, t20]
|
|
857
|
+
});
|
|
858
|
+
$[44] = t15;
|
|
859
|
+
$[45] = t20;
|
|
860
|
+
$[46] = t21;
|
|
861
|
+
} else t21 = $[46];
|
|
862
|
+
let t22;
|
|
863
|
+
if ($[47] !== usage) {
|
|
864
|
+
t22 = usage.level !== "idle" && /* @__PURE__ */ jsx("span", {
|
|
865
|
+
"data-slot": "usage-percent",
|
|
866
|
+
className: "shrink-0 rounded-full bg-(--usage-color) px-2 py-0.5 text-xs font-medium text-(--usage-foreground) tabular-nums",
|
|
867
|
+
children: usage.formatPercent(usage.share)
|
|
868
|
+
});
|
|
869
|
+
$[47] = usage;
|
|
870
|
+
$[48] = t22;
|
|
871
|
+
} else t22 = $[48];
|
|
872
|
+
if ($[49] !== t21 || $[50] !== t22) {
|
|
873
|
+
t13 = /* @__PURE__ */ jsxs("div", {
|
|
874
|
+
className: "flex items-start justify-between gap-3",
|
|
875
|
+
children: [t21, t22]
|
|
876
|
+
});
|
|
877
|
+
$[49] = t21;
|
|
878
|
+
$[50] = t22;
|
|
879
|
+
$[51] = t13;
|
|
880
|
+
} else t13 = $[51];
|
|
881
|
+
T1 = Meter;
|
|
882
|
+
t3 = usage.used;
|
|
883
|
+
t4 = usage.limit;
|
|
884
|
+
t5 = usage.locale;
|
|
885
|
+
if ($[52] !== usage) {
|
|
886
|
+
t6 = (amount) => `${usage.format(amount)} / ${usage.format(usage.limit)}`;
|
|
887
|
+
$[52] = usage;
|
|
888
|
+
$[53] = t6;
|
|
889
|
+
} else t6 = $[53];
|
|
890
|
+
t7 = barLabel ?? `${usage.label} total`;
|
|
891
|
+
t8 = "min-w-0";
|
|
892
|
+
T0 = MeterTrack;
|
|
893
|
+
t1 = "h-2 items-stretch gap-0.5 bg-transparent";
|
|
894
|
+
let t23;
|
|
895
|
+
if ($[54] !== total || $[55] !== usage) {
|
|
896
|
+
t23 = (piece) => /* @__PURE__ */ jsx("span", {
|
|
897
|
+
className: cn("rounded-xs transition-[width]", follows, breathes(usage, piece)),
|
|
898
|
+
style: {
|
|
899
|
+
width: `${piece.value / total * 100}%`,
|
|
900
|
+
background: piece.color
|
|
901
|
+
}
|
|
902
|
+
}, piece.key);
|
|
903
|
+
$[54] = total;
|
|
904
|
+
$[55] = usage;
|
|
905
|
+
$[56] = t23;
|
|
906
|
+
} else t23 = $[56];
|
|
907
|
+
t2 = pieces.map(t23);
|
|
908
|
+
$[7] = barLabel;
|
|
909
|
+
$[8] = className;
|
|
910
|
+
$[9] = props;
|
|
911
|
+
$[10] = title;
|
|
912
|
+
$[11] = unit;
|
|
913
|
+
$[12] = usage;
|
|
914
|
+
$[13] = T0;
|
|
915
|
+
$[14] = T1;
|
|
916
|
+
$[15] = t1;
|
|
917
|
+
$[16] = t10;
|
|
918
|
+
$[17] = t11;
|
|
919
|
+
$[18] = t12;
|
|
920
|
+
$[19] = t13;
|
|
921
|
+
$[20] = t2;
|
|
922
|
+
$[21] = t3;
|
|
923
|
+
$[22] = t4;
|
|
924
|
+
$[23] = t5;
|
|
925
|
+
$[24] = t6;
|
|
926
|
+
$[25] = t7;
|
|
927
|
+
$[26] = t8;
|
|
928
|
+
$[27] = t9;
|
|
929
|
+
} else {
|
|
930
|
+
T0 = $[13];
|
|
931
|
+
T1 = $[14];
|
|
932
|
+
t1 = $[15];
|
|
933
|
+
t10 = $[16];
|
|
934
|
+
t11 = $[17];
|
|
935
|
+
t12 = $[18];
|
|
936
|
+
t13 = $[19];
|
|
937
|
+
t2 = $[20];
|
|
938
|
+
t3 = $[21];
|
|
939
|
+
t4 = $[22];
|
|
940
|
+
t5 = $[23];
|
|
941
|
+
t6 = $[24];
|
|
942
|
+
t7 = $[25];
|
|
943
|
+
t8 = $[26];
|
|
944
|
+
t9 = $[27];
|
|
945
|
+
}
|
|
946
|
+
let t14;
|
|
947
|
+
if ($[57] !== T0 || $[58] !== t1 || $[59] !== t2) {
|
|
948
|
+
t14 = /* @__PURE__ */ jsx(T0, {
|
|
949
|
+
className: t1,
|
|
950
|
+
children: t2
|
|
951
|
+
});
|
|
952
|
+
$[57] = T0;
|
|
953
|
+
$[58] = t1;
|
|
954
|
+
$[59] = t2;
|
|
955
|
+
$[60] = t14;
|
|
956
|
+
} else t14 = $[60];
|
|
957
|
+
let t15;
|
|
958
|
+
if ($[61] !== T1 || $[62] !== t14 || $[63] !== t3 || $[64] !== t4 || $[65] !== t5 || $[66] !== t6 || $[67] !== t7 || $[68] !== t8) {
|
|
959
|
+
t15 = /* @__PURE__ */ jsx(T1, {
|
|
960
|
+
value: t3,
|
|
961
|
+
max: t4,
|
|
962
|
+
locale: t5,
|
|
963
|
+
format: t6,
|
|
964
|
+
"aria-label": t7,
|
|
965
|
+
className: t8,
|
|
966
|
+
children: t14
|
|
967
|
+
});
|
|
968
|
+
$[61] = T1;
|
|
969
|
+
$[62] = t14;
|
|
970
|
+
$[63] = t3;
|
|
971
|
+
$[64] = t4;
|
|
972
|
+
$[65] = t5;
|
|
973
|
+
$[66] = t6;
|
|
974
|
+
$[67] = t7;
|
|
975
|
+
$[68] = t8;
|
|
976
|
+
$[69] = t15;
|
|
977
|
+
} else t15 = $[69];
|
|
978
|
+
let t16;
|
|
979
|
+
if ($[70] !== children || $[71] !== t10 || $[72] !== t11 || $[73] !== t12 || $[74] !== t13 || $[75] !== t15 || $[76] !== t9) {
|
|
980
|
+
t16 = /* @__PURE__ */ jsxs("div", {
|
|
981
|
+
"data-slot": t9,
|
|
982
|
+
"data-level": t10,
|
|
983
|
+
className: t11,
|
|
984
|
+
...t12,
|
|
985
|
+
children: [
|
|
986
|
+
t13,
|
|
987
|
+
t15,
|
|
988
|
+
children
|
|
989
|
+
]
|
|
990
|
+
});
|
|
991
|
+
$[70] = children;
|
|
992
|
+
$[71] = t10;
|
|
993
|
+
$[72] = t11;
|
|
994
|
+
$[73] = t12;
|
|
995
|
+
$[74] = t13;
|
|
996
|
+
$[75] = t15;
|
|
997
|
+
$[76] = t9;
|
|
998
|
+
$[77] = t16;
|
|
999
|
+
} else t16 = $[77];
|
|
1000
|
+
return t16;
|
|
1001
|
+
}
|
|
1002
|
+
/** A row per segment, oldest first: its color, label, amount and share. Then what is free. */
|
|
1003
|
+
function UsageBreakdown(t0) {
|
|
1004
|
+
const $ = c(17);
|
|
1005
|
+
let className;
|
|
1006
|
+
let props;
|
|
1007
|
+
let t1;
|
|
1008
|
+
if ($[0] !== t0) {
|
|
1009
|
+
({freeLabel: t1, className, ...props} = t0);
|
|
1010
|
+
$[0] = t0;
|
|
1011
|
+
$[1] = className;
|
|
1012
|
+
$[2] = props;
|
|
1013
|
+
$[3] = t1;
|
|
1014
|
+
} else {
|
|
1015
|
+
className = $[1];
|
|
1016
|
+
props = $[2];
|
|
1017
|
+
t1 = $[3];
|
|
1018
|
+
}
|
|
1019
|
+
const freeLabel = t1 === void 0 ? "Free" : t1;
|
|
1020
|
+
const usage = useUsage();
|
|
1021
|
+
const free = Math.max(0, usage.limit - usage.used);
|
|
1022
|
+
let t2;
|
|
1023
|
+
if ($[4] !== className) {
|
|
1024
|
+
t2 = cn("flex flex-col gap-1.5 border-t px-4 py-3 text-sm", className);
|
|
1025
|
+
$[4] = className;
|
|
1026
|
+
$[5] = t2;
|
|
1027
|
+
} else t2 = $[5];
|
|
1028
|
+
let t3;
|
|
1029
|
+
if ($[6] !== usage) {
|
|
1030
|
+
t3 = usage.segments.map((segment) => /* @__PURE__ */ jsxs("li", {
|
|
1031
|
+
"data-slot": "usage-breakdown-row",
|
|
1032
|
+
className: "flex items-center gap-2",
|
|
1033
|
+
children: [
|
|
1034
|
+
/* @__PURE__ */ jsx("span", {
|
|
1035
|
+
"aria-hidden": "true",
|
|
1036
|
+
className: "size-2 shrink-0 rounded-xs",
|
|
1037
|
+
style: { background: segment.color }
|
|
1038
|
+
}),
|
|
1039
|
+
/* @__PURE__ */ jsx("span", {
|
|
1040
|
+
className: "min-w-0 flex-1 truncate",
|
|
1041
|
+
children: segment.label
|
|
1042
|
+
}),
|
|
1043
|
+
/* @__PURE__ */ jsx("span", {
|
|
1044
|
+
className: "text-muted-foreground tabular-nums",
|
|
1045
|
+
children: usage.format(segment.value)
|
|
1046
|
+
}),
|
|
1047
|
+
/* @__PURE__ */ jsx("span", {
|
|
1048
|
+
className: cn("text-muted-foreground tabular-nums", "w-10 text-end"),
|
|
1049
|
+
children: usage.formatPercent(segment.value / usage.limit)
|
|
1050
|
+
})
|
|
1051
|
+
]
|
|
1052
|
+
}, segment.label));
|
|
1053
|
+
$[6] = usage;
|
|
1054
|
+
$[7] = t3;
|
|
1055
|
+
} else t3 = $[7];
|
|
1056
|
+
let t4;
|
|
1057
|
+
if ($[8] !== free || $[9] !== freeLabel || $[10] !== usage) {
|
|
1058
|
+
t4 = freeLabel !== null && /* @__PURE__ */ jsxs("li", {
|
|
1059
|
+
"data-slot": "usage-breakdown-free",
|
|
1060
|
+
className: "flex items-center gap-2",
|
|
1061
|
+
children: [
|
|
1062
|
+
/* @__PURE__ */ jsx("span", {
|
|
1063
|
+
"aria-hidden": "true",
|
|
1064
|
+
className: "size-2 shrink-0 rounded-xs ring-1 ring-foreground/20 ring-inset"
|
|
1065
|
+
}),
|
|
1066
|
+
/* @__PURE__ */ jsx("span", {
|
|
1067
|
+
className: "min-w-0 flex-1 truncate",
|
|
1068
|
+
children: freeLabel
|
|
1069
|
+
}),
|
|
1070
|
+
/* @__PURE__ */ jsx("span", {
|
|
1071
|
+
className: "text-muted-foreground tabular-nums",
|
|
1072
|
+
children: usage.format(free)
|
|
1073
|
+
}),
|
|
1074
|
+
/* @__PURE__ */ jsx("span", {
|
|
1075
|
+
className: cn("text-muted-foreground tabular-nums", "w-10 text-end"),
|
|
1076
|
+
children: usage.formatPercent(free / usage.limit)
|
|
1077
|
+
})
|
|
1078
|
+
]
|
|
1079
|
+
});
|
|
1080
|
+
$[8] = free;
|
|
1081
|
+
$[9] = freeLabel;
|
|
1082
|
+
$[10] = usage;
|
|
1083
|
+
$[11] = t4;
|
|
1084
|
+
} else t4 = $[11];
|
|
1085
|
+
let t5;
|
|
1086
|
+
if ($[12] !== props || $[13] !== t2 || $[14] !== t3 || $[15] !== t4) {
|
|
1087
|
+
t5 = /* @__PURE__ */ jsxs("ul", {
|
|
1088
|
+
"data-slot": "usage-breakdown",
|
|
1089
|
+
className: t2,
|
|
1090
|
+
...props,
|
|
1091
|
+
children: [t3, t4]
|
|
1092
|
+
});
|
|
1093
|
+
$[12] = props;
|
|
1094
|
+
$[13] = t2;
|
|
1095
|
+
$[14] = t3;
|
|
1096
|
+
$[15] = t4;
|
|
1097
|
+
$[16] = t5;
|
|
1098
|
+
} else t5 = $[16];
|
|
1099
|
+
return t5;
|
|
1100
|
+
}
|
|
1101
|
+
/** A group in the popover, like a plan's limits, under a rule. */
|
|
1102
|
+
function UsageSection(t0) {
|
|
1103
|
+
const $ = c(16);
|
|
1104
|
+
let aside;
|
|
1105
|
+
let children;
|
|
1106
|
+
let className;
|
|
1107
|
+
let props;
|
|
1108
|
+
let title;
|
|
1109
|
+
if ($[0] !== t0) {
|
|
1110
|
+
({title, aside, className, children, ...props} = t0);
|
|
1111
|
+
$[0] = t0;
|
|
1112
|
+
$[1] = aside;
|
|
1113
|
+
$[2] = children;
|
|
1114
|
+
$[3] = className;
|
|
1115
|
+
$[4] = props;
|
|
1116
|
+
$[5] = title;
|
|
1117
|
+
} else {
|
|
1118
|
+
aside = $[1];
|
|
1119
|
+
children = $[2];
|
|
1120
|
+
className = $[3];
|
|
1121
|
+
props = $[4];
|
|
1122
|
+
title = $[5];
|
|
1123
|
+
}
|
|
1124
|
+
let t1;
|
|
1125
|
+
if ($[6] !== className) {
|
|
1126
|
+
t1 = cn("flex flex-col gap-3 border-t px-4 py-3", className);
|
|
1127
|
+
$[6] = className;
|
|
1128
|
+
$[7] = t1;
|
|
1129
|
+
} else t1 = $[7];
|
|
1130
|
+
let t2;
|
|
1131
|
+
if ($[8] !== aside || $[9] !== title) {
|
|
1132
|
+
t2 = (title != null || aside != null) && /* @__PURE__ */ jsxs("div", {
|
|
1133
|
+
className: "flex items-baseline justify-between gap-3 text-xs",
|
|
1134
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
1135
|
+
className: "font-medium text-muted-foreground",
|
|
1136
|
+
children: title
|
|
1137
|
+
}), aside != null && /* @__PURE__ */ jsx("span", {
|
|
1138
|
+
className: "text-muted-foreground",
|
|
1139
|
+
children: aside
|
|
1140
|
+
})]
|
|
1141
|
+
});
|
|
1142
|
+
$[8] = aside;
|
|
1143
|
+
$[9] = title;
|
|
1144
|
+
$[10] = t2;
|
|
1145
|
+
} else t2 = $[10];
|
|
1146
|
+
let t3;
|
|
1147
|
+
if ($[11] !== children || $[12] !== props || $[13] !== t1 || $[14] !== t2) {
|
|
1148
|
+
t3 = /* @__PURE__ */ jsxs("section", {
|
|
1149
|
+
"data-slot": "usage-section",
|
|
1150
|
+
className: t1,
|
|
1151
|
+
...props,
|
|
1152
|
+
children: [t2, children]
|
|
1153
|
+
});
|
|
1154
|
+
$[11] = children;
|
|
1155
|
+
$[12] = props;
|
|
1156
|
+
$[13] = t1;
|
|
1157
|
+
$[14] = t2;
|
|
1158
|
+
$[15] = t3;
|
|
1159
|
+
} else t3 = $[15];
|
|
1160
|
+
return t3;
|
|
1161
|
+
}
|
|
1162
|
+
const tickCount = 32;
|
|
1163
|
+
/**
|
|
1164
|
+
* One limit: its label, its value and ticks lit up to the share. Past the
|
|
1165
|
+
* limit, the ticks stay full and the value reads past it.
|
|
1166
|
+
*/
|
|
1167
|
+
function UsageMeter(t0) {
|
|
1168
|
+
const $ = c(53);
|
|
1169
|
+
let className;
|
|
1170
|
+
let display;
|
|
1171
|
+
let label;
|
|
1172
|
+
let note;
|
|
1173
|
+
let props;
|
|
1174
|
+
let t1;
|
|
1175
|
+
let value;
|
|
1176
|
+
if ($[0] !== t0) {
|
|
1177
|
+
({label, value, limit: t1, display, note, className, ...props} = t0);
|
|
1178
|
+
$[0] = t0;
|
|
1179
|
+
$[1] = className;
|
|
1180
|
+
$[2] = display;
|
|
1181
|
+
$[3] = label;
|
|
1182
|
+
$[4] = note;
|
|
1183
|
+
$[5] = props;
|
|
1184
|
+
$[6] = t1;
|
|
1185
|
+
$[7] = value;
|
|
1186
|
+
} else {
|
|
1187
|
+
className = $[1];
|
|
1188
|
+
display = $[2];
|
|
1189
|
+
label = $[3];
|
|
1190
|
+
note = $[4];
|
|
1191
|
+
props = $[5];
|
|
1192
|
+
t1 = $[6];
|
|
1193
|
+
value = $[7];
|
|
1194
|
+
}
|
|
1195
|
+
const givenLimit = t1 === void 0 ? 100 : t1;
|
|
1196
|
+
const usage = useUsage();
|
|
1197
|
+
const limit = Math.max(1, givenLimit);
|
|
1198
|
+
const share = value / limit;
|
|
1199
|
+
let T0;
|
|
1200
|
+
let lit;
|
|
1201
|
+
let t2;
|
|
1202
|
+
let t3;
|
|
1203
|
+
let t4;
|
|
1204
|
+
let t5;
|
|
1205
|
+
let t6;
|
|
1206
|
+
let t7;
|
|
1207
|
+
if ($[8] !== className || $[9] !== display || $[10] !== limit || $[11] !== share || $[12] !== usage || $[13] !== value) {
|
|
1208
|
+
const level = usage.levelOf(share);
|
|
1209
|
+
lit = Math.min(tickCount, Math.ceil(Math.max(0, share) * tickCount));
|
|
1210
|
+
let t8;
|
|
1211
|
+
if ($[22] !== display || $[23] !== limit || $[24] !== share || $[25] !== usage || $[26] !== value) {
|
|
1212
|
+
t8 = display ?? (limit === 100 ? usage.formatPercent(share) : `${usage.format(value)} / ${usage.format(limit)}`);
|
|
1213
|
+
$[22] = display;
|
|
1214
|
+
$[23] = limit;
|
|
1215
|
+
$[24] = share;
|
|
1216
|
+
$[25] = usage;
|
|
1217
|
+
$[26] = value;
|
|
1218
|
+
$[27] = t8;
|
|
1219
|
+
} else t8 = $[27];
|
|
1220
|
+
const text = t8;
|
|
1221
|
+
T0 = Meter;
|
|
1222
|
+
t2 = level;
|
|
1223
|
+
t3 = value;
|
|
1224
|
+
t4 = limit;
|
|
1225
|
+
t5 = usage.locale;
|
|
1226
|
+
if ($[28] !== text) {
|
|
1227
|
+
t6 = () => text;
|
|
1228
|
+
$[28] = text;
|
|
1229
|
+
$[29] = t6;
|
|
1230
|
+
} else t6 = $[29];
|
|
1231
|
+
t7 = cnState(cn("min-w-0 gap-y-1.5", levelColor({ level })), className);
|
|
1232
|
+
$[8] = className;
|
|
1233
|
+
$[9] = display;
|
|
1234
|
+
$[10] = limit;
|
|
1235
|
+
$[11] = share;
|
|
1236
|
+
$[12] = usage;
|
|
1237
|
+
$[13] = value;
|
|
1238
|
+
$[14] = T0;
|
|
1239
|
+
$[15] = lit;
|
|
1240
|
+
$[16] = t2;
|
|
1241
|
+
$[17] = t3;
|
|
1242
|
+
$[18] = t4;
|
|
1243
|
+
$[19] = t5;
|
|
1244
|
+
$[20] = t6;
|
|
1245
|
+
$[21] = t7;
|
|
1246
|
+
} else {
|
|
1247
|
+
T0 = $[14];
|
|
1248
|
+
lit = $[15];
|
|
1249
|
+
t2 = $[16];
|
|
1250
|
+
t3 = $[17];
|
|
1251
|
+
t4 = $[18];
|
|
1252
|
+
t5 = $[19];
|
|
1253
|
+
t6 = $[20];
|
|
1254
|
+
t7 = $[21];
|
|
1255
|
+
}
|
|
1256
|
+
let t8;
|
|
1257
|
+
if ($[30] !== label) {
|
|
1258
|
+
t8 = /* @__PURE__ */ jsx(MeterLabel, {
|
|
1259
|
+
className: "font-normal",
|
|
1260
|
+
children: label
|
|
1261
|
+
});
|
|
1262
|
+
$[30] = label;
|
|
1263
|
+
$[31] = t8;
|
|
1264
|
+
} else t8 = $[31];
|
|
1265
|
+
const t9 = share > 1 && "font-medium text-destructive";
|
|
1266
|
+
let t10;
|
|
1267
|
+
if ($[32] !== t9) {
|
|
1268
|
+
t10 = cn(t9);
|
|
1269
|
+
$[32] = t9;
|
|
1270
|
+
$[33] = t10;
|
|
1271
|
+
} else t10 = $[33];
|
|
1272
|
+
let t11;
|
|
1273
|
+
if ($[34] !== t10) {
|
|
1274
|
+
t11 = /* @__PURE__ */ jsx(MeterValue, { className: t10 });
|
|
1275
|
+
$[34] = t10;
|
|
1276
|
+
$[35] = t11;
|
|
1277
|
+
} else t11 = $[35];
|
|
1278
|
+
let t12;
|
|
1279
|
+
if ($[36] !== lit) {
|
|
1280
|
+
t12 = /* @__PURE__ */ jsx(MeterTrack, {
|
|
1281
|
+
className: "h-3 items-stretch justify-between rounded-none bg-transparent",
|
|
1282
|
+
children: Array.from({ length: tickCount }, (_, index) => /* @__PURE__ */ jsx("span", {
|
|
1283
|
+
className: "w-0.75 rounded-full transition-colors motion-reduce:transition-none",
|
|
1284
|
+
style: { background: index < lit ? "var(--usage-color)" : track }
|
|
1285
|
+
}, index))
|
|
1286
|
+
});
|
|
1287
|
+
$[36] = lit;
|
|
1288
|
+
$[37] = t12;
|
|
1289
|
+
} else t12 = $[37];
|
|
1290
|
+
let t13;
|
|
1291
|
+
if ($[38] !== note) {
|
|
1292
|
+
t13 = note != null && /* @__PURE__ */ jsx("span", {
|
|
1293
|
+
"data-slot": "usage-meter-note",
|
|
1294
|
+
className: "w-full text-xs text-muted-foreground",
|
|
1295
|
+
children: note
|
|
1296
|
+
});
|
|
1297
|
+
$[38] = note;
|
|
1298
|
+
$[39] = t13;
|
|
1299
|
+
} else t13 = $[39];
|
|
1300
|
+
let t14;
|
|
1301
|
+
if ($[40] !== T0 || $[41] !== props || $[42] !== t11 || $[43] !== t12 || $[44] !== t13 || $[45] !== t2 || $[46] !== t3 || $[47] !== t4 || $[48] !== t5 || $[49] !== t6 || $[50] !== t7 || $[51] !== t8) {
|
|
1302
|
+
t14 = /* @__PURE__ */ jsxs(T0, {
|
|
1303
|
+
"data-level": t2,
|
|
1304
|
+
value: t3,
|
|
1305
|
+
max: t4,
|
|
1306
|
+
locale: t5,
|
|
1307
|
+
format: t6,
|
|
1308
|
+
className: t7,
|
|
1309
|
+
...props,
|
|
1310
|
+
children: [
|
|
1311
|
+
t8,
|
|
1312
|
+
t11,
|
|
1313
|
+
t12,
|
|
1314
|
+
t13
|
|
1315
|
+
]
|
|
1316
|
+
});
|
|
1317
|
+
$[40] = T0;
|
|
1318
|
+
$[41] = props;
|
|
1319
|
+
$[42] = t11;
|
|
1320
|
+
$[43] = t12;
|
|
1321
|
+
$[44] = t13;
|
|
1322
|
+
$[45] = t2;
|
|
1323
|
+
$[46] = t3;
|
|
1324
|
+
$[47] = t4;
|
|
1325
|
+
$[48] = t5;
|
|
1326
|
+
$[49] = t6;
|
|
1327
|
+
$[50] = t7;
|
|
1328
|
+
$[51] = t8;
|
|
1329
|
+
$[52] = t14;
|
|
1330
|
+
} else t14 = $[52];
|
|
1331
|
+
return t14;
|
|
1332
|
+
}
|
|
1333
|
+
/** A muted band at the bottom, for an action like a Button. */
|
|
1334
|
+
function UsageFooter(t0) {
|
|
1335
|
+
const $ = c(8);
|
|
1336
|
+
let className;
|
|
1337
|
+
let props;
|
|
1338
|
+
if ($[0] !== t0) {
|
|
1339
|
+
({className, ...props} = t0);
|
|
1340
|
+
$[0] = t0;
|
|
1341
|
+
$[1] = className;
|
|
1342
|
+
$[2] = props;
|
|
1343
|
+
} else {
|
|
1344
|
+
className = $[1];
|
|
1345
|
+
props = $[2];
|
|
1346
|
+
}
|
|
1347
|
+
let t1;
|
|
1348
|
+
if ($[3] !== className) {
|
|
1349
|
+
t1 = cn("flex items-center justify-between gap-3 border-t bg-muted/60 px-4 py-3 text-sm text-muted-foreground", className);
|
|
1350
|
+
$[3] = className;
|
|
1351
|
+
$[4] = t1;
|
|
1352
|
+
} else t1 = $[4];
|
|
1353
|
+
let t2;
|
|
1354
|
+
if ($[5] !== props || $[6] !== t1) {
|
|
1355
|
+
t2 = /* @__PURE__ */ jsx("div", {
|
|
1356
|
+
"data-slot": "usage-footer",
|
|
1357
|
+
className: t1,
|
|
1358
|
+
...props
|
|
1359
|
+
});
|
|
1360
|
+
$[5] = props;
|
|
1361
|
+
$[6] = t1;
|
|
1362
|
+
$[7] = t2;
|
|
1363
|
+
} else t2 = $[7];
|
|
1364
|
+
return t2;
|
|
1365
|
+
}
|
|
1366
|
+
/** Opens and closes a `Usage` from anywhere: it's its Popover's controller. */
|
|
1367
|
+
const createUsageController = createPopoverController;
|
|
1368
|
+
export { Usage, UsageBreakdown, UsageContent, UsageFooter, UsageMeter, UsageSection, UsageSummary, UsageTrigger, createUsageController, getUsageLabel, useUsage };
|