@kumix/ui 0.4.1 → 0.4.2
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 +37 -30
- package/dist/{cascader-types-DVT-znZ-.d.ts → cascader-types-zhnUQ4sP.d.ts} +11 -3
- package/dist/cascader-types-zhnUQ4sP.d.ts.map +1 -0
- package/dist/components/agents/agent-code.js +1 -1
- package/dist/components/charts/candlestick-chart/context.d.ts.map +1 -1
- package/dist/components/charts/donut-chart/context.d.ts.map +1 -1
- package/dist/components/charts/liquidity-heatmap.d.ts.map +1 -1
- package/dist/components/charts/order-book.d.ts.map +1 -1
- package/dist/components/charts/treemap.d.ts.map +1 -1
- package/dist/components/charts/volume-profile.d.ts.map +1 -1
- package/dist/components/motion/action-swap.d.ts +1 -1
- package/dist/components/motion/action-swap.d.ts.map +1 -1
- package/dist/components/motion/action-swap.js +43 -20
- package/dist/components/motion/action-swap.js.map +1 -1
- package/dist/components/motion/animated-badge.d.ts +1 -1
- package/dist/components/motion/animated-badge.d.ts.map +1 -1
- package/dist/components/motion/animated-badge.js +60 -101
- package/dist/components/motion/animated-badge.js.map +1 -1
- package/dist/components/motion/animated-sidebar.js +1 -1
- package/dist/components/motion/animated-toast-stack.js +1 -1
- package/dist/components/motion/attachment-upload.js +1 -1
- package/dist/components/motion/availability-scheduler/copy-menu.js +1 -1
- package/dist/components/motion/availability-scheduler/day-row.js +1 -1
- package/dist/components/motion/availability-scheduler/index.js +1 -1
- package/dist/components/motion/bloom-menu.d.ts.map +1 -1
- package/dist/components/motion/bloom-menu.js +73 -8
- package/dist/components/motion/bloom-menu.js.map +1 -1
- package/dist/components/motion/bottom-sheet.d.ts.map +1 -1
- package/dist/components/motion/bottom-sheet.js +6 -10
- package/dist/components/motion/bottom-sheet.js.map +1 -1
- package/dist/components/motion/bouncy-accordion.d.ts.map +1 -1
- package/dist/components/motion/bouncy-accordion.js +35 -22
- package/dist/components/motion/bouncy-accordion.js.map +1 -1
- package/dist/components/motion/center-morph-modal.js +1 -1
- package/dist/components/motion/color-picker.d.ts.map +1 -1
- package/dist/components/motion/command-palette.js +1 -1
- package/dist/components/motion/context-menu.js +1 -1
- package/dist/components/motion/date-range-picker.d.ts.map +1 -1
- package/dist/components/motion/drawer.d.ts +1 -1
- package/dist/components/motion/drawer.d.ts.map +1 -1
- package/dist/components/motion/drawer.js +10 -10
- package/dist/components/motion/drawer.js.map +1 -1
- package/dist/components/motion/expandable-action-bar.d.ts.map +1 -1
- package/dist/components/motion/feedback-widget.js +4 -1
- package/dist/components/motion/feedback-widget.js.map +1 -1
- package/dist/components/motion/morphing-lightbox.d.ts.map +1 -1
- package/dist/components/motion/morphing-lightbox.js +1 -1
- package/dist/components/motion/morphing-modal.d.ts +6 -1
- package/dist/components/motion/morphing-modal.d.ts.map +1 -1
- package/dist/components/motion/morphing-modal.js +37 -5
- package/dist/components/motion/morphing-modal.js.map +1 -1
- package/dist/components/motion/morphing-search.js +1 -1
- package/dist/components/motion/morphing-tabs.js +1 -1
- package/dist/components/motion/otp-input.js +19 -11
- package/dist/components/motion/otp-input.js.map +1 -1
- package/dist/components/motion/popover-morph.d.ts +4 -3
- package/dist/components/motion/popover-morph.d.ts.map +1 -1
- package/dist/components/motion/popover-morph.js +47 -55
- package/dist/components/motion/popover-morph.js.map +1 -1
- package/dist/components/motion/popover.js +7 -1
- package/dist/components/motion/popover.js.map +1 -1
- package/dist/components/motion/prediction-market-card.js +1 -1
- package/dist/components/motion/prediction-market.js +1 -1
- package/dist/components/motion/project-folder.js +1 -1
- package/dist/components/motion/radio.d.ts +5 -1
- package/dist/components/motion/radio.d.ts.map +1 -1
- package/dist/components/motion/radio.js +53 -5
- package/dist/components/motion/radio.js.map +1 -1
- package/dist/components/motion/select-morph.d.ts +1 -1
- package/dist/components/motion/select-morph.d.ts.map +1 -1
- package/dist/components/motion/select-morph.js +89 -21
- package/dist/components/motion/select-morph.js.map +1 -1
- package/dist/components/motion/select.d.ts.map +1 -1
- package/dist/components/motion/select.js +153 -135
- package/dist/components/motion/select.js.map +1 -1
- package/dist/components/motion/shader-background.d.ts +3 -2
- package/dist/components/motion/shader-background.d.ts.map +1 -1
- package/dist/components/motion/shader-background.js +9 -3
- package/dist/components/motion/shader-background.js.map +1 -1
- package/dist/components/motion/shared-layout-bg.d.ts.map +1 -1
- package/dist/components/motion/shared-layout-bg.js +17 -3
- package/dist/components/motion/shared-layout-bg.js.map +1 -1
- package/dist/components/motion/swipeable-list.d.ts.map +1 -1
- package/dist/components/motion/swipeable-list.js +61 -4
- package/dist/components/motion/swipeable-list.js.map +1 -1
- package/dist/components/motion/table/row-handle.js +1 -1
- package/dist/components/motion/table/table-header.js +1 -1
- package/dist/components/motion/tabs.d.ts +12 -3
- package/dist/components/motion/tabs.d.ts.map +1 -1
- package/dist/components/motion/tabs.js +248 -26
- package/dist/components/motion/tabs.js.map +1 -1
- package/dist/components/motion/theme-toggle.js +1 -1
- package/dist/components/reui/alert.d.ts +1 -1
- package/dist/components/reui/autocomplete.d.ts +1 -1
- package/dist/components/reui/autocomplete.d.ts.map +1 -1
- package/dist/components/reui/autocomplete.js +1 -1
- package/dist/components/reui/autocomplete.js.map +1 -1
- package/dist/components/reui/badge.d.ts +2 -2
- package/dist/components/reui/cascader/cascader-async.d.ts +21 -5
- package/dist/components/reui/cascader/cascader-async.d.ts.map +1 -1
- package/dist/components/reui/cascader/cascader-async.js +61 -34
- package/dist/components/reui/cascader/cascader-async.js.map +1 -1
- package/dist/components/reui/cascader/cascader-columns.d.ts.map +1 -1
- package/dist/components/reui/cascader/cascader-columns.js +5 -2
- package/dist/components/reui/cascader/cascader-columns.js.map +1 -1
- package/dist/components/reui/cascader/cascader-context.d.ts +3 -1
- package/dist/components/reui/cascader/cascader-context.d.ts.map +1 -1
- package/dist/components/reui/cascader/cascader-context.js.map +1 -1
- package/dist/components/reui/cascader/cascader-i18n.d.ts +1 -1
- package/dist/components/reui/cascader/cascader-item.d.ts +1 -1
- package/dist/components/reui/cascader/cascader-lib.d.ts +34 -8
- package/dist/components/reui/cascader/cascader-lib.d.ts.map +1 -1
- package/dist/components/reui/cascader/cascader-lib.js +145 -29
- package/dist/components/reui/cascader/cascader-lib.js.map +1 -1
- package/dist/components/reui/cascader/cascader-nav.d.ts +1 -1
- package/dist/components/reui/cascader/cascader-types.d.ts +1 -1
- package/dist/components/reui/cascader/cascader.d.ts +13 -8
- package/dist/components/reui/cascader/cascader.d.ts.map +1 -1
- package/dist/components/reui/cascader/cascader.js +31 -16
- package/dist/components/reui/cascader/cascader.js.map +1 -1
- package/dist/components/reui/code-block/code-block.d.ts.map +1 -1
- package/dist/components/reui/color-picker.js +1 -1
- package/dist/components/reui/data-grid/data-grid-cell-selection.d.ts.map +1 -1
- package/dist/components/reui/data-grid/data-grid-cell-selection.js +1 -0
- package/dist/components/reui/data-grid/data-grid-cell-selection.js.map +1 -1
- package/dist/components/reui/data-grid/data-grid-column-filter.d.ts.map +1 -1
- package/dist/components/reui/data-grid/data-grid-column-filter.js +1 -0
- package/dist/components/reui/data-grid/data-grid-column-filter.js.map +1 -1
- package/dist/components/reui/data-grid/data-grid-column-header.d.ts +6 -8
- package/dist/components/reui/data-grid/data-grid-column-header.d.ts.map +1 -1
- package/dist/components/reui/data-grid/data-grid-column-header.js +7 -8
- package/dist/components/reui/data-grid/data-grid-column-header.js.map +1 -1
- package/dist/components/reui/data-grid/data-grid-column-visibility.d.ts.map +1 -1
- package/dist/components/reui/data-grid/data-grid-column-visibility.js +1 -0
- package/dist/components/reui/data-grid/data-grid-column-visibility.js.map +1 -1
- package/dist/components/reui/data-grid/data-grid-pagination.d.ts.map +1 -1
- package/dist/components/reui/data-grid/data-grid-pagination.js +1 -0
- package/dist/components/reui/data-grid/data-grid-pagination.js.map +1 -1
- package/dist/components/reui/data-grid/data-grid-scroll-area.d.ts.map +1 -1
- package/dist/components/reui/data-grid/data-grid-scroll-area.js +1 -0
- package/dist/components/reui/data-grid/data-grid-scroll-area.js.map +1 -1
- package/dist/components/reui/data-grid/data-grid-table-dnd-rows.d.ts.map +1 -1
- package/dist/components/reui/data-grid/data-grid-table-dnd-rows.js +3 -2
- package/dist/components/reui/data-grid/data-grid-table-dnd-rows.js.map +1 -1
- package/dist/components/reui/data-grid/data-grid-table-dnd.d.ts.map +1 -1
- package/dist/components/reui/data-grid/data-grid-table-dnd.js +2 -1
- package/dist/components/reui/data-grid/data-grid-table-dnd.js.map +1 -1
- package/dist/components/reui/data-grid/data-grid-table-virtual.d.ts.map +1 -1
- package/dist/components/reui/data-grid/data-grid-table-virtual.js +2 -1
- package/dist/components/reui/data-grid/data-grid-table-virtual.js.map +1 -1
- package/dist/components/reui/data-grid/data-grid-table.d.ts +6 -11
- package/dist/components/reui/data-grid/data-grid-table.d.ts.map +1 -1
- package/dist/components/reui/data-grid/data-grid-table.js +22 -22
- package/dist/components/reui/data-grid/data-grid-table.js.map +1 -1
- package/dist/components/reui/data-grid/data-grid.d.ts +16 -1
- package/dist/components/reui/data-grid/data-grid.d.ts.map +1 -1
- package/dist/components/reui/data-grid/data-grid.js +80 -22
- package/dist/components/reui/data-grid/data-grid.js.map +1 -1
- package/dist/components/reui/date-selector.d.ts.map +1 -1
- package/dist/components/reui/date-selector.js +21 -15
- package/dist/components/reui/date-selector.js.map +1 -1
- package/dist/components/reui/event-calendar/event-calendar-agenda-view.js +3 -5
- package/dist/components/reui/event-calendar/event-calendar-agenda-view.js.map +1 -1
- package/dist/components/reui/event-calendar/event-calendar-nav.d.ts.map +1 -1
- package/dist/components/reui/event-calendar/event-calendar-nav.js +2 -2
- package/dist/components/reui/event-calendar/event-calendar-nav.js.map +1 -1
- package/dist/components/reui/event-calendar/event-calendar.d.ts.map +1 -1
- package/dist/components/reui/event-calendar/event-calendar.js +34 -31
- package/dist/components/reui/event-calendar/event-calendar.js.map +1 -1
- package/dist/components/reui/file-type.d.ts +302 -6
- package/dist/components/reui/file-type.d.ts.map +1 -1
- package/dist/components/reui/file-type.js +416 -13
- package/dist/components/reui/file-type.js.map +1 -1
- package/dist/components/reui/filters/filters-builder.d.ts +1 -1
- package/dist/components/reui/filters/filters-lib.d.ts +1 -1
- package/dist/components/reui/frame.d.ts +1 -1
- package/dist/components/reui/gantt/gantt-nav.d.ts.map +1 -1
- package/dist/components/reui/gantt/gantt-nav.js +2 -2
- package/dist/components/reui/gantt/gantt-nav.js.map +1 -1
- package/dist/components/reui/gantt/gantt.d.ts.map +1 -1
- package/dist/components/reui/gantt/gantt.js +5 -2
- package/dist/components/reui/gantt/gantt.js.map +1 -1
- package/dist/components/reui/icon-tile.d.ts +2 -2
- package/dist/components/reui/number-field.d.ts +3 -3
- package/dist/components/reui/phone-input.js +30 -27
- package/dist/components/reui/phone-input.js.map +1 -1
- package/dist/components/reui/rating.d.ts +1 -1
- package/dist/components/reui/time-picker.js +1 -1
- package/dist/components/ui/attachment.d.ts +2 -2
- package/dist/components/ui/badge.d.ts +1 -1
- package/dist/components/ui/bubble.d.ts +1 -1
- package/dist/components/ui/button.d.ts +2 -2
- package/dist/components/ui/chart.d.ts.map +1 -1
- package/dist/components/ui/code-block.d.ts +29 -0
- package/dist/components/ui/code-block.d.ts.map +1 -0
- package/dist/components/ui/code-block.js +124 -0
- package/dist/components/ui/code-block.js.map +1 -0
- package/dist/components/ui/empty.d.ts +1 -1
- package/dist/components/ui/item.d.ts +2 -2
- package/dist/components/ui/marker.d.ts +1 -1
- package/dist/components/ui/sidebar.d.ts +1 -1
- package/dist/components/ui/toggle.d.ts +1 -1
- package/dist/components/ui/trace.d.ts +21 -0
- package/dist/components/ui/trace.d.ts.map +1 -0
- package/dist/components/ui/trace.js +77 -0
- package/dist/components/ui/trace.js.map +1 -0
- package/dist/context-BYXeJQnz.d.ts.map +1 -1
- package/dist/{copy-menu-BXUh52bu.js → copy-menu-DOg9Jh-U.js} +2 -2
- package/dist/{copy-menu-BXUh52bu.js.map → copy-menu-DOg9Jh-U.js.map} +1 -1
- package/dist/hooks/use-focus-trap.d.ts +22 -0
- package/dist/hooks/use-focus-trap.d.ts.map +1 -0
- package/dist/hooks/use-focus-trap.js +80 -0
- package/dist/hooks/use-focus-trap.js.map +1 -0
- package/dist/hooks/use-highlighted-code.d.ts +5 -0
- package/dist/hooks/use-highlighted-code.d.ts.map +1 -0
- package/dist/hooks/use-highlighted-code.js +128 -0
- package/dist/hooks/use-highlighted-code.js.map +1 -0
- package/dist/hooks/use-listbox.d.ts +29 -0
- package/dist/hooks/use-listbox.d.ts.map +1 -0
- package/dist/hooks/use-listbox.js +75 -0
- package/dist/hooks/use-listbox.js.map +1 -0
- package/dist/tooltip-C01qUgsW.d.ts.map +1 -1
- package/package.json +8 -8
- package/dist/cascader-types-DVT-znZ-.d.ts.map +0 -1
package/README.md
CHANGED
|
@@ -4,17 +4,17 @@ React UI kit for Kumix products. Built on **Base UI**, **Tailwind CSS**, **class
|
|
|
4
4
|
|
|
5
5
|
## Sources
|
|
6
6
|
|
|
7
|
-
| Path | Origin
|
|
8
|
-
| --------------------------------- |
|
|
9
|
-
| `src/components/ui/*` | [shadcn/ui](https://ui.shadcn.com/) (base-nova style)
|
|
10
|
-
| `src/components/reui/*` | [ReUI](https://reui.io/) registry (`@reui/*`)
|
|
11
|
-
| `src/components/motion/*` | [beUI](https://beui.dev/) registry (`@beui/*`, Motion-based)
|
|
12
|
-
| `src/components/agents/*` | [beUI](https://beui.dev/) AI agent components (`@beui/*`)
|
|
13
|
-
| `src/components/charts/*` | Financial & data visualization charts
|
|
14
|
-
| `src/components/custom/*` | Hand-written Kumix-specific components
|
|
15
|
-
| `src/hooks/*` | Package helpers (+ ReUI `use-file-upload`, beUI helpers)
|
|
16
|
-
| `src/lib/*` | Shared utilities (beUI `ease`, `tick-sound`, `text-shimmer`, `favicon`, `presence-gate`, `touch`, `command-search`) | — |
|
|
17
|
-
| `src/style.css` · `src/theme.css` | Tailwind entry + design tokens
|
|
7
|
+
| Path | Origin | Docs / previews |
|
|
8
|
+
| --------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
|
|
9
|
+
| `src/components/ui/*` | [shadcn/ui](https://ui.shadcn.com/) (base-nova style) | [ui.shadcn.com/docs/components](https://ui.shadcn.com/docs/components) |
|
|
10
|
+
| `src/components/reui/*` | [ReUI](https://reui.io/) registry (`@reui/*`) | [reui.io/docs](https://reui.io/docs) · [components](https://reui.io/components) |
|
|
11
|
+
| `src/components/motion/*` | [beUI](https://beui.dev/) registry (`@beui/*`, Motion-based) | [beui.dev/components/motion](https://beui.dev/components/motion) |
|
|
12
|
+
| `src/components/agents/*` | [beUI](https://beui.dev/) AI agent components (`@beui/*`) | [beui.dev/components/agents](https://beui.dev/components/agents) |
|
|
13
|
+
| `src/components/charts/*` | Financial & data visualization charts | — |
|
|
14
|
+
| `src/components/custom/*` | Hand-written Kumix-specific components | — |
|
|
15
|
+
| `src/hooks/*` | Package helpers (+ ReUI `use-file-upload`, beUI helpers) | — |
|
|
16
|
+
| `src/lib/*` | Shared utilities (beUI `ease`, `tick-sound`, `text-shimmer`, `favicon`, `presence-gate`, `touch`, `command-search`, `highlighter`) | — |
|
|
17
|
+
| `src/style.css` · `src/theme.css` | Tailwind entry + design tokens | — |
|
|
18
18
|
|
|
19
19
|
For **previews, props, and usage examples** of each component, use the upstream docs:
|
|
20
20
|
|
|
@@ -39,23 +39,23 @@ bun add @base-ui/react class-variance-authority lucide-react motion react @kumix
|
|
|
39
39
|
|
|
40
40
|
**Feature peers** (optional — needed at runtime only if you import those components):
|
|
41
41
|
|
|
42
|
-
| Peer | Used by
|
|
43
|
-
| --------------------------------------------------- |
|
|
44
|
-
| `next-themes` | `use-meta-color`, `motion/theme-toggle`
|
|
45
|
-
| `@shadcn/react` | `message-scroller`, `questionnaire`
|
|
46
|
-
| `@tanstack/react-table` · `@tanstack/react-virtual` | data-grid
|
|
47
|
-
| `@dnd-kit/*` | kanban, sortable, data-grid DnD
|
|
48
|
-
| `date-fns` · `@date-fns/tz` | calendar, event-calendar, gantt, date-selector
|
|
49
|
-
| `recharts` | chart
|
|
50
|
-
| `cmdk` | command
|
|
51
|
-
| `embla-carousel-react` | carousel
|
|
52
|
-
| `input-otp` | input-otp
|
|
53
|
-
| `react-day-picker` | calendar
|
|
54
|
-
| `react-phone-number-input` | phone-input
|
|
55
|
-
| `react-resizable-panels` | resizable
|
|
56
|
-
| `@headless-tree/core` | tree
|
|
57
|
-
| `shiki` | `agents/code-block`, `reui/code-block`
|
|
58
|
-
| `@floating-ui/dom` | `motion/tooltip`
|
|
42
|
+
| Peer | Used by |
|
|
43
|
+
| --------------------------------------------------- | ----------------------------------------------------------------------------- |
|
|
44
|
+
| `next-themes` | `use-meta-color`, `motion/theme-toggle` |
|
|
45
|
+
| `@shadcn/react` | `message-scroller`, `questionnaire` |
|
|
46
|
+
| `@tanstack/react-table` · `@tanstack/react-virtual` | data-grid |
|
|
47
|
+
| `@dnd-kit/*` | kanban, sortable, data-grid DnD |
|
|
48
|
+
| `date-fns` · `@date-fns/tz` | calendar, event-calendar, gantt, date-selector |
|
|
49
|
+
| `recharts` | chart |
|
|
50
|
+
| `cmdk` | command |
|
|
51
|
+
| `embla-carousel-react` | carousel |
|
|
52
|
+
| `input-otp` | input-otp |
|
|
53
|
+
| `react-day-picker` | calendar |
|
|
54
|
+
| `react-phone-number-input` | phone-input |
|
|
55
|
+
| `react-resizable-panels` | resizable |
|
|
56
|
+
| `@headless-tree/core` | tree |
|
|
57
|
+
| `shiki` | `agents/code-block`, `reui/code-block`, `ui/code-block` via `lib/highlighter` |
|
|
58
|
+
| `@floating-ui/dom` | `motion/tooltip` |
|
|
59
59
|
|
|
60
60
|
## Import paths
|
|
61
61
|
|
|
@@ -118,7 +118,7 @@ Mapped from source:
|
|
|
118
118
|
|
|
119
119
|
Base UI / shadcn base-nova. Preview: [ui.shadcn.com](https://ui.shadcn.com/docs/components).
|
|
120
120
|
|
|
121
|
-
`accordion` · `alert` · `alert-dialog` · `aspect-ratio` · `attachment` · `avatar` · `badge` · `breadcrumb` · `bubble` · `button` · `button-group` · `calendar` · `card` · `carousel` · `chart` · `checkbox` · `collapsible` · `combobox` · `command` · `context-menu` · `dialog` · `direction` · `drawer` · `dropdown-menu` · `empty` · `field` · `hover-card` · `input` · `input-group` · `input-otp` · `item` · `kbd` · `label` · `marker` · `menubar` · `message` · `message-scroller` · `native-select` · `navigation-menu` · `pagination` · `popover` · `progress` · `questionnaire` · `radio-group` · `resizable` · `scroll-area` · `select` · `separator` · `sheet` · `sidebar` · `skeleton` · `slider` · `spinner` · `switch` · `table` · `tabs` · `textarea` · `toggle` · `toggle-group` · `toast` · `tooltip`
|
|
121
|
+
`accordion` · `alert` · `alert-dialog` · `aspect-ratio` · `attachment` · `avatar` · `badge` · `breadcrumb` · `bubble` · `button` · `button-group` · `calendar` · `card` · `carousel` · `chart` · `checkbox` · `code-block` · `collapsible` · `combobox` · `command` · `context-menu` · `dialog` · `direction` · `drawer` · `dropdown-menu` · `empty` · `field` · `hover-card` · `input` · `input-group` · `input-otp` · `item` · `kbd` · `label` · `marker` · `menubar` · `message` · `message-scroller` · `native-select` · `navigation-menu` · `pagination` · `popover` · `progress` · `questionnaire` · `radio-group` · `resizable` · `scroll-area` · `select` · `separator` · `sheet` · `sidebar` · `skeleton` · `slider` · `spinner` · `switch` · `table` · `tabs` · `textarea` · `toggle` · `toggle-group` · `toast` · `tooltip` · `trace`
|
|
122
122
|
|
|
123
123
|
### ReUI (`components/reui`)
|
|
124
124
|
|
|
@@ -164,14 +164,21 @@ Hand-written Kumix-specific composite components (not from any registry).
|
|
|
164
164
|
|
|
165
165
|
`toast` — Global toast system: `ToastContainer` (mount once) + `showToast` / `toastSuccess` / `toastError` / `toastInfo` / `toastLoading` (call anywhere). Wraps `motion/animated-toast-stack`.
|
|
166
166
|
|
|
167
|
+
`code-block` — Copy button, line numbers (`lineNumbers`, `startLine`), wrap mode, `variant` (`default`/`destructive`), `size` (`default`/`sm`). Pair with `use-highlighted-code` for streaming Shiki syntax highlighting.
|
|
168
|
+
|
|
169
|
+
`trace` — Collapsible trace lines for agent runs / stack traces: `Trace`, `TraceLine` (status `running`/`error`/`pending`), `TraceIcon`, `TraceTitle`, `TraceDescription`, `TraceCollapsible` (+ `Trigger`/`Content`).
|
|
170
|
+
|
|
167
171
|
### Hooks
|
|
168
172
|
|
|
169
|
-
`use-body-classes` · `use-copy-to-clipboard` · `use-dismiss` · `use-favicon` · `use-file-upload` · `use-hover-capable` · `use-hover-gesture` · `use-hydrated` · `use-intersection-observer` · `use-is-mac` · `use-media-query` · `use-meta-color` · `use-mobile` · `use-modal-scope` · `use-mutation-observer` · `use-on-open` · `use-row-cursor` · `use-scroll-position` · `use-slider` · `use-slider-input` · `use-tap-gesture` · `use-touch-capable` · `use-viewport`
|
|
173
|
+
`use-body-classes` · `use-copy-to-clipboard` · `use-dismiss` · `use-favicon` · `use-file-upload` · `use-focus-trap` · `use-highlighted-code` · `use-hover-capable` · `use-hover-gesture` · `use-hydrated` · `use-intersection-observer` · `use-is-mac` · `use-listbox` · `use-media-query` · `use-meta-color` · `use-mobile` · `use-modal-scope` · `use-mutation-observer` · `use-on-open` · `use-row-cursor` · `use-scroll-position` · `use-slider` · `use-slider-input` · `use-tap-gesture` · `use-touch-capable` · `use-viewport`
|
|
170
174
|
|
|
171
175
|
- `useIsMobile` (`use-mobile`) — fixed `768px` breakpoint; used by `sidebar` / `date-selector`. First paint may be `false` until mount.
|
|
172
176
|
- `useMediaQuery` — arbitrary query string; SSR-safe via `useSyncExternalStore` (server snapshot `false`).
|
|
173
177
|
- `useHoverCapable` — detects pointer/hover capability; used by beUI tilt-card.
|
|
174
178
|
- `useSlider` — shared slider input logic; used by beUI range-sliders.
|
|
179
|
+
- `useFocusTrap` — stack-aware focus trap for overlays rendered in place (drawer, bottom-sheet): moves focus in on open, Tab cycles inside, Escape closes, focus returns on close. Innermost trap wins when stacked.
|
|
180
|
+
- `useListbox` — popup listbox keyboard model: arrows/Home/End over enabled rows, 500ms typeahead, DOM focus follows the active option. Used by `motion/select` and `motion/select-morph`.
|
|
181
|
+
- `useHighlightedCode` — streaming Shiki syntax highlight: tokenizes only new lines as code streams, re-tokenizes the tail each render. Pair with `ui/code-block`.
|
|
175
182
|
|
|
176
183
|
## Styling
|
|
177
184
|
|
|
@@ -77,6 +77,11 @@ interface CascaderIndex<T = unknown> {
|
|
|
77
77
|
roots: CascaderNode<T>[];
|
|
78
78
|
/** Every node in a stable, depth-first order. Used by deep search. */
|
|
79
79
|
all: CascaderNode<T>[];
|
|
80
|
+
/** Resolved chain nodes listed last in a level that may still return them. */
|
|
81
|
+
pinned?: ReadonlySet<string>;
|
|
82
|
+
/** Resolved chain nodes whose level loaded completely without them: they
|
|
83
|
+
* keep their path for the trigger, and are no row, hit or cascade child. */
|
|
84
|
+
hidden?: ReadonlySet<string>;
|
|
80
85
|
}
|
|
81
86
|
interface CascaderFlatNode<T = unknown> {
|
|
82
87
|
node: CascaderNode<T>;
|
|
@@ -112,9 +117,12 @@ interface CascaderLoadState {
|
|
|
112
117
|
}
|
|
113
118
|
/** Why a level was fetched. `resolve`: `resolveValue` hit an unloaded node. */
|
|
114
119
|
type CascaderLoadReason = "level" | "more" | "prefetch" | "retry" | "resolve";
|
|
115
|
-
/** Argument handed to `getChildren`. */
|
|
120
|
+
/** Argument handed to `getChildren` and `resolveValue`. */
|
|
116
121
|
interface CascaderLoadContext {
|
|
117
|
-
/**
|
|
122
|
+
/**
|
|
123
|
+
* Aborted when the request is superseded, `loadKey` changes or the cascader
|
|
124
|
+
* unmounts, and for a `getChildren` load also when the popup closes.
|
|
125
|
+
*/
|
|
118
126
|
signal: AbortSignal;
|
|
119
127
|
cursor?: string;
|
|
120
128
|
reason?: CascaderLoadReason;
|
|
@@ -183,4 +191,4 @@ interface CascaderLabels {
|
|
|
183
191
|
}
|
|
184
192
|
//#endregion
|
|
185
193
|
export { CascaderSelectable as _, CascaderFlatNode as a, CascaderLoadContext as c, CascaderLoadState as d, CascaderMode as f, CascaderSearchScope as g, CascaderSearchContext as h, CascaderCollapse as i, CascaderLoadReason as l, CascaderPathSegment as m, CascaderChangeDetails as n, CascaderIndex as o, CascaderNode as p, CascaderChangeReason as r, CascaderLabels as s, CascaderActionItem as t, CascaderLoadResult as u, CascaderValueDisplay as v };
|
|
186
|
-
//# sourceMappingURL=cascader-types-
|
|
194
|
+
//# sourceMappingURL=cascader-types-zhnUQ4sP.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cascader-types-zhnUQ4sP.d.ts","names":["React"],"sources":["../src/components/reui/cascader/cascader-types.tsx"],"mappings":";;;;;;;UASiB,aAAa;;EAE5B;EACA;EACA,OAAOA,QAAM;EACb;EACA,WAAW,aAAa;;EAExB;;EAEA;;EAEA;EACA;;;;;EAKA;EACA,OAAO;;;;;;UAOQ;;EAEf;EACA,OAAOA,QAAM;EACb,OAAOA,QAAM;EACb;;EAEA;;EAEA,QAAQ;;EAER;;;KAIU;KAEA;;;;;;;KAQA,mBAAmB,kCAAkC,MAAM,aAAa;KAExE;KAEA;KAEA;;UAGK,sBAAsB;;EAErC,MAAM,aAAa;;EAEnB,MAAM,aAAa;EACnB,OAAO,aAAa;EACpB,QAAQ;;;UAIO,cAAc;EAC7B,SAAS,YAAY,aAAa;;EAElC,YAAY,YAAY,aAAa;EACrC,UAAU;;EAEV,SAAS;;EAET,OAAO,aAAa;;EAEpB,KAAK,aAAa;;EAElB,SAAS;;;EAGT,SAAS;;UAGM,iBAAiB;EAChC,MAAM,aAAa;EACnB;;EAEA;EACA;;EAEA;;EAEA;;;KAIU,oBAAoB;EAC1B;EAAc,MAAM,aAAa;;EACjC;EAAkB,QAAQ,aAAa;;;;;;;;UAQ5B;EACf;EACA;EACA;;EAEA;;;KAIU;;UAGK;;;;;EAKf,QAAQ;EACR;EACA,SAAS;;;UAIM,mBAAmB;EAClC,OAAO,aAAa;EACpB;;EAEA;;;UAIe;EACf,QAAQ;;;EAGR;;;;;;;UAQe;;EAEf,mBAAmB;EACnB;;EAEA;EACA;EACA;EACA;EACA;EACA;;EAEA,gBAAgB;EAChB;EACA;EACA,aAAa;;EAEb;;EAEA;EACA,YAAY;;EAEZ;;EAEA;;EAEA;EACA;EACA;EACA;EACA;;EAEA,eAAe,MAAM,cAAc;EACnC,mBAAmB;EACnB,uBAAuB,eAAe;EACtC,wBAAwB;EACxB,oBAAoB,qBAAqB,eAAe;EACxD,sBAAsB;EACtB,yBAAyB;;EAEzB,sBAAsB,eAAe,eAAe;EACpD"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { Fragment, useEffect, useState } from "react";
|
|
3
3
|
import { cn } from "@kumix/utils";
|
|
4
|
-
import { createHighlighter } from "shiki";
|
|
5
4
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
import { createHighlighter } from "shiki";
|
|
6
6
|
//#region src/components/agents/agent-code.tsx
|
|
7
7
|
const LIGHT_THEME = "github-light-high-contrast";
|
|
8
8
|
const DARK_THEME = "github-dark-high-contrast";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.d.ts","names":[],"sources":["../../../../src/components/charts/candlestick-chart/context.tsx"],"mappings":";;YAcY;;EAEV;;EAEA;EACA;EACA;EACA;EACA;EACA;;iBAGe;EACf,kBAAkB;;EAElB;;;;;EAKA;EACA;EACA,oBAAoB;EACpB,eAAe;EACf,gBAAgB;;EAEhB;EACA;EACA,WAAW;;wBAUG,sBACd,SACA,WACA,UACA,iBACA,kBACA,aACA,cACA,SACC;;;;EAcoC,YAAA;;;;;;EAtCf,cAAA;EACC,eAAA;;;;YAsEb,mBAAmB,kBAAkB;qBAEpC,oCAAkB
|
|
1
|
+
{"version":3,"file":"context.d.ts","names":[],"sources":["../../../../src/components/charts/candlestick-chart/context.tsx"],"mappings":";;YAcY;;EAEV;;EAEA;EACA;EACA;EACA;EACA;EACA;;iBAGe;EACf,kBAAkB;;EAElB;;;;;EAKA;EACA;EACA,oBAAoB;EACpB,eAAe;EACf,gBAAgB;;EAEhB;EACA;EACA,WAAW;;wBAUG,sBACd,SACA,WACA,UACA,iBACA,kBACA,aACA,cACA,SACC;;;;EAcoC,YAAA;;;;;;EAtCf,cAAA;EACC,eAAA;;;;YAsEb,mBAAmB,kBAAkB;qBAEpC,oCAAkB;;;;EAnCQ,YAAA;;;;;;EAtCf,cAAA;EACC,eAAA;;;;wBA0ET;;;;EArCuB,YAAA;;;;;;EAtCf,cAAA;EACC,eAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.d.ts","names":["_$__model0.PlacedSegment"],"sources":["../../../../src/components/charts/donut-chart/context.tsx"],"mappings":";;;iBAgBiB;EACf,mBAAmB;;EAEnB;;EAEA;;EAEA;EACA;EACA,kBAAkB;;EAElB,YAAY;;EAEZ;EACA,eAAe;;EAEf;EACA;EACA,WAAW;;wBAKG,gBACd,UACA,WACA,KACA,UACA,iBACA,gBACA,UACA,YACA,aACA,SACC;
|
|
1
|
+
{"version":3,"file":"context.d.ts","names":["_$__model0.PlacedSegment"],"sources":["../../../../src/components/charts/donut-chart/context.tsx"],"mappings":";;;iBAgBiB;EACf,mBAAmB;;EAEnB;;EAEA;;EAEA;EACA;EACA,kBAAkB;;EAElB,YAAY;;EAEZ;EACA,eAAe;;EAEf;EACA;EACA,WAAW;;wBAKG,gBACd,UACA,WACA,KACA,UACA,iBACA,gBACA,UACA,YACA,aACA,SACC;E,QAAAA;;;;;EAekC,YAAA;EAtCnB,YAAA;;EAGM,cAAA;;;;;YAwDZ,aAAa,kBAAkB;qBAC9B,8BAAY;E,QAAZA;;;;;EAtBwB,YAAA;EAtCnB,YAAA;;EAGM,cAAA;;;;;wBA2DR;E,QAAAA;;;;;EAxBqB,YAAA;EAtCnB,YAAA;;EAGM,cAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"liquidity-heatmap.d.ts","names":[],"sources":["../../../src/components/charts/liquidity-heatmap/model.ts","../../../src/components/charts/liquidity-heatmap.tsx"],"mappings":";;UAAiB;;EAEf;EACA;EACA;IAAmB;IAAe;;EAClC;;;;UCmBQ;;EAER,oBAAoB;;EAEpB;EACA;EACA;EACA,eAAe;EACf,cAAc;EACd,WAAW;EACX;;wBAWc
|
|
1
|
+
{"version":3,"file":"liquidity-heatmap.d.ts","names":[],"sources":["../../../src/components/charts/liquidity-heatmap/model.ts","../../../src/components/charts/liquidity-heatmap.tsx"],"mappings":";;UAAiB;;EAEf;EACA;EACA;IAAmB;IAAe;;EAClC;;;;UCmBQ;;EAER,oBAAoB;;EAEpB;EACA;EACA;EACA,eAAe;EACf,cAAc;EACd,WAAW;EACX;;wBAWc;;;;;;;;;;EAPD;EACH;EACO,cAAC;EACF,aAAC;;wBASH,mBACd,WACA,SACA,MACA,OACA,aAAa,gBACb,YAAY,eACZ,UACA,aACC,wCAAqB,IAAA;wBAoBR,uBAAuB;EAAe;oBAAoB,IAAA;wBA6O1D,yBAAyB;EAAe;oBAAoB,IAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"order-book.d.ts","names":["_$__order_book0.OrderBookDepthSummaryData"],"sources":["../../../src/components/charts/order-book.tsx"],"mappings":";;;YAkBY;EAAmB;EAAe;;;YAOlC;EAAyB;EAAqB;;iBAEzC;;EAEf,eAAe;;EAEf,eAAe;;EAEf;;EAEA;EACA;EACA;EACA;EACA,eAAe;EACf,cAAc;;;;;EAKd,cAAc;EACd,qBAAqB;EACrB,uBAAuB,OAAO;;EAE9B,iBAAiB,OAAO,YAAY;EACpC,WAAW;EACX;;wBAyEc;;;;;
|
|
1
|
+
{"version":3,"file":"order-book.d.ts","names":["_$__order_book0.OrderBookDepthSummaryData"],"sources":["../../../src/components/charts/order-book.tsx"],"mappings":";;;YAkBY;EAAmB;EAAe;;;YAOlC;EAAyB;EAAqB;;iBAEzC;;EAEf,eAAe;;EAEf,eAAe;;EAEf;;EAEA;EACA;EACA;EACA;EACA,eAAe;EACf,cAAc;;;;;EAKd,cAAc;EACd,qBAAqB;EACrB,uBAAuB,OAAO;;EAE9B,iBAAiB,OAAO,YAAY;EACpC,WAAW;EACX;;wBAyEc;;;;;E,SAAAA;EA3B6B,iBAAA,OAAA;EAhDnB,iBAAA,OAAA,YAAU;;;;EAVZ,cAAA;EACD,aAAA;;;;;;;;;;;wBA2FP,YAAY,UAAU,WAAW,UAAyB,SAAS,iCAAc,IAAA;wBA2BjF,kBAAkB;EAAe;oBAAoB,IAAA;wBAiBrD,gBAAgB,MAAM;EAAe;EAAqB;oBAAoB,IAAA;wBA6D9E,kBAAkB;EAAe;oBAAoB,IAAA;;wBAyBrD,mBAAmB;EAAe;oBAAoB,IAAA;;;;;wBA+BtD,wBACd,aACA,UACA;EAEA,cAAc;;EAEd,YAAY,SAAS,YAAY,kBAAkB,8BAA8B;EACjF;oBACD,IAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"treemap.d.ts","names":["_$__model0.TreemapTile","_$__model0.ResolvedNode","_$__model0.TreemapItem"],"sources":["../../../src/components/charts/treemap/context.ts","../../../src/components/charts/treemap.tsx"],"mappings":";;;;;;UAsBiB,qBAAqB;;EAEpC,eAAe;EACf;EACA,eAAe;;EAEf;EACA;EACA;EACA;EACA,kBAAkB;;wBAgEJ;
|
|
1
|
+
{"version":3,"file":"treemap.d.ts","names":["_$__model0.TreemapTile","_$__model0.ResolvedNode","_$__model0.TreemapItem"],"sources":["../../../src/components/charts/treemap/context.ts","../../../src/components/charts/treemap.tsx"],"mappings":";;;;;;UAsBiB,qBAAqB;;EAEpC,eAAe;EACf;EACA,eAAe;;EAEf;EACA;EACA;EACA;EACA,kBAAkB;;wBAgEJ;E,OAAAA;;;;;;;;;;EAtEQ,cAAA;;EAsCa,YAAA;;;;;;;;;;EAKK,iBAAA,YAAM,MAAQ;;;;E,OAAAC;;;;;;;wBC5DxC,UACd,MACA,OACA,aACA,QACA,WACA,UACA,iBACA,gBACA,WACA,aACG,SACF,+BAAY,IAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"volume-profile.d.ts","names":[],"sources":["../../../src/components/charts/volume-profile/context.ts","../../../src/components/charts/volume-profile.tsx"],"mappings":";;;;;UAoBiB,2BAA2B;;EAE1C,eAAe;EACf;EACA;EACA,eAAe;EACf,gBAAgB;;;EAGhB;EACA;EACA;EACA;EACA;EACA,kBAAkB;;wBAoEJ;;;EA7EQ,cAAA;EACE,eAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAqCW,YAAA
|
|
1
|
+
{"version":3,"file":"volume-profile.d.ts","names":[],"sources":["../../../src/components/charts/volume-profile/context.ts","../../../src/components/charts/volume-profile.tsx"],"mappings":";;;;;UAoBiB,2BAA2B;;EAE1C,eAAe;EACf;EACA;EACA,eAAe;EACf,gBAAgB;;;EAGhB;EACA;EACA;EACA;EACA;EACA,kBAAkB;;wBAoEJ;;;EA7EQ,cAAA;EACE,eAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAqCW,YAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBClDrB,gBACd,MACA,OACA,MACA,aACA,cACA,WACA,OACA,UACA,UACA,iBACA,gBACA,WACA,aACG,SACF,qCAAkB,IAAA"}
|
|
@@ -35,6 +35,6 @@ export interface ActionSwapIconProps {
|
|
|
35
35
|
}
|
|
36
36
|
export declare function ActionSwapText({ value, children, animation, className }: ActionSwapTextProps): import("react").JSX.Element;
|
|
37
37
|
export declare function ActionSwapIcon({ value, children, animation, className }: ActionSwapIconProps): import("react").JSX.Element;
|
|
38
|
-
export declare function ActionSwapButton({ items, value, defaultValue, onValueChange, variant, size, animation, iconOnly, cycle, className, disabled, onClick, ...rest }: ActionSwapButtonProps): import("react").JSX.Element | null;
|
|
38
|
+
export declare function ActionSwapButton({ items, value, defaultValue, onValueChange, variant, size, animation, iconOnly, cycle, className, disabled, onClick, style, ...rest }: ActionSwapButtonProps): import("react").JSX.Element | null;
|
|
39
39
|
//#endregion
|
|
40
40
|
//# sourceMappingURL=action-swap.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"action-swap.d.ts","names":[],"sources":["../../../src/components/motion/action-swap.tsx"],"mappings":";;;YAeY;EACV;EACA,OAAO;EACP,OAAO;EACP;;YAGU;YACA;YACA;iBAKK,8BACP,KAAK;EACb,OAAO;EACP;EACA;EACA,iBAAiB,eAAe,MAAM;EACtC,UAAU;EACV,OAAO;EACP,YAAY;EACZ;EACA;;iBAGe;EACf;EACA,UAAU;EACV,YAAY;EACZ;;iBAGe;EACf;EACA,UAAU;EACV,YAAY;EACZ;;
|
|
1
|
+
{"version":3,"file":"action-swap.d.ts","names":[],"sources":["../../../src/components/motion/action-swap.tsx"],"mappings":";;;YAeY;EACV;EACA,OAAO;EACP,OAAO;EACP;;YAGU;YACA;YACA;iBAKK,8BACP,KAAK;EACb,OAAO;EACP;EACA;EACA,iBAAiB,eAAe,MAAM;EACtC,UAAU;EACV,OAAO;EACP,YAAY;EACZ;EACA;;iBAGe;EACf;EACA,UAAU;EACV,YAAY;EACZ;;iBAGe;EACf;EACA,UAAU;EACV,YAAY;EACZ;;wBAoHc,iBACd,OACA,UACA,WACA,aACC,sCAAmB,IAAA;wBAgFN,iBACd,OACA,UACA,WACA,aACC,sCAAmB,IAAA;wBA0BN,mBACd,OACA,OACA,cACA,eACA,SACA,MACA,WACA,UACA,OACA,WACA,UACA,SACA,UACG,QACF,wCAAqB,IAAA"}
|
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { EASE_OUT, SPRING_PRESS, SPRING_SWAP } from "../../lib/ease.js";
|
|
2
|
+
import { EASE_OUT, SPRING_LAYOUT, SPRING_PRESS, SPRING_SWAP } from "../../lib/ease.js";
|
|
3
3
|
import { useState } from "react";
|
|
4
4
|
import { cn } from "@kumix/utils";
|
|
5
5
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
6
6
|
import { AnimatePresence, motion, useReducedMotion } from "motion/react";
|
|
7
7
|
//#region src/components/motion/action-swap.tsx
|
|
8
|
-
const BLUR_TRANSITION =
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
const BLUR_TRANSITION = SPRING_SWAP;
|
|
9
|
+
const BLUR_EXIT_TRANSITION = {
|
|
10
|
+
duration: .16,
|
|
11
|
+
ease: EASE_OUT
|
|
11
12
|
};
|
|
12
13
|
const ROLL_TRANSITION = SPRING_SWAP;
|
|
13
14
|
const ROLL_EXIT_TRANSITION = {
|
|
14
15
|
duration: .14,
|
|
15
16
|
ease: EASE_OUT
|
|
16
17
|
};
|
|
17
|
-
const SWAP_BLUR = "blur(
|
|
18
|
+
const SWAP_BLUR = "blur(2px)";
|
|
18
19
|
const ROLL_BLUR = "blur(3px)";
|
|
19
20
|
const CASCADE_STAGGER = .025;
|
|
20
21
|
const CASCADE_LETTER_VARIANTS = {
|
|
@@ -47,7 +48,7 @@ const TEXT_VARIANTS = {
|
|
|
47
48
|
blur: {
|
|
48
49
|
initial: {
|
|
49
50
|
opacity: 0,
|
|
50
|
-
scale: .
|
|
51
|
+
scale: .9,
|
|
51
52
|
filter: SWAP_BLUR
|
|
52
53
|
},
|
|
53
54
|
animate: {
|
|
@@ -58,9 +59,9 @@ const TEXT_VARIANTS = {
|
|
|
58
59
|
},
|
|
59
60
|
exit: {
|
|
60
61
|
opacity: 0,
|
|
61
|
-
scale: .
|
|
62
|
+
scale: .96,
|
|
62
63
|
filter: SWAP_BLUR,
|
|
63
|
-
transition:
|
|
64
|
+
transition: BLUR_EXIT_TRANSITION
|
|
64
65
|
}
|
|
65
66
|
},
|
|
66
67
|
roll: {
|
|
@@ -100,7 +101,7 @@ const ICON_VARIANTS = {
|
|
|
100
101
|
opacity: 0,
|
|
101
102
|
scale: .25,
|
|
102
103
|
filter: SWAP_BLUR,
|
|
103
|
-
transition:
|
|
104
|
+
transition: BLUR_EXIT_TRANSITION
|
|
104
105
|
}
|
|
105
106
|
},
|
|
106
107
|
roll: {
|
|
@@ -217,7 +218,7 @@ function ActionSwapIcon({ value, children, animation = "blur", className }) {
|
|
|
217
218
|
})
|
|
218
219
|
});
|
|
219
220
|
}
|
|
220
|
-
function ActionSwapButton({ items, value, defaultValue, onValueChange, variant = "secondary", size = "md", animation = "blur", iconOnly = size === "icon", cycle = true, className, disabled, onClick, ...rest }) {
|
|
221
|
+
function ActionSwapButton({ items, value, defaultValue, onValueChange, variant = "secondary", size = "md", animation = "blur", iconOnly = size === "icon", cycle = true, className, disabled, onClick, style, ...rest }) {
|
|
221
222
|
const reduce = useReducedMotion();
|
|
222
223
|
const [internalValue, setInternalValue] = useState(defaultValue ?? items[0]?.id);
|
|
223
224
|
const currentValue = value ?? internalValue;
|
|
@@ -227,11 +228,21 @@ function ActionSwapButton({ items, value, defaultValue, onValueChange, variant =
|
|
|
227
228
|
const nextItem = cycle && items.length > 0 ? items[(activeIndex + 1) % items.length] : void 0;
|
|
228
229
|
if (!activeItem) return null;
|
|
229
230
|
const accessibleLabel = activeItem.ariaLabel ?? (iconOnly && typeof activeItem.label === "string" ? activeItem.label : void 0);
|
|
231
|
+
const layoutTransition = reduce ? { duration: 0 } : SPRING_LAYOUT;
|
|
230
232
|
return /* @__PURE__ */ jsxs(motion.button, {
|
|
231
233
|
type: "button",
|
|
232
234
|
disabled,
|
|
235
|
+
layout: true,
|
|
236
|
+
layoutDependency: activeItem.id,
|
|
233
237
|
whileTap: reduce || disabled ? void 0 : { scale: .97 },
|
|
234
|
-
transition:
|
|
238
|
+
transition: {
|
|
239
|
+
...SPRING_PRESS,
|
|
240
|
+
layout: layoutTransition
|
|
241
|
+
},
|
|
242
|
+
style: {
|
|
243
|
+
borderRadius: 9999,
|
|
244
|
+
...style
|
|
245
|
+
},
|
|
235
246
|
className: cn("inline-flex items-center justify-center overflow-hidden font-medium transition-colors", "disabled:pointer-events-none disabled:opacity-50", VARIANT_CLASS[variant], SIZE_CLASS[size], className),
|
|
236
247
|
"aria-label": accessibleLabel,
|
|
237
248
|
onClick: (event) => {
|
|
@@ -241,15 +252,27 @@ function ActionSwapButton({ items, value, defaultValue, onValueChange, variant =
|
|
|
241
252
|
onValueChange?.(nextItem.id, nextItem);
|
|
242
253
|
},
|
|
243
254
|
...rest,
|
|
244
|
-
children: [hasIcon ? /* @__PURE__ */ jsx(
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
255
|
+
children: [hasIcon ? /* @__PURE__ */ jsx(motion.span, {
|
|
256
|
+
layout: "position",
|
|
257
|
+
layoutDependency: activeItem.id,
|
|
258
|
+
transition: layoutTransition,
|
|
259
|
+
className: "inline-flex shrink-0",
|
|
260
|
+
children: /* @__PURE__ */ jsx(ActionSwapIcon, {
|
|
261
|
+
value: activeItem.id,
|
|
262
|
+
animation,
|
|
263
|
+
className: "h-4 w-4",
|
|
264
|
+
children: activeItem.icon ?? null
|
|
265
|
+
})
|
|
266
|
+
}) : null, !iconOnly ? /* @__PURE__ */ jsx(motion.span, {
|
|
267
|
+
layout: "position",
|
|
268
|
+
layoutDependency: activeItem.id,
|
|
269
|
+
transition: layoutTransition,
|
|
270
|
+
className: "inline-flex min-w-0 max-w-full",
|
|
271
|
+
children: /* @__PURE__ */ jsx(ActionSwapText, {
|
|
272
|
+
value: activeItem.id,
|
|
273
|
+
animation,
|
|
274
|
+
children: activeItem.label
|
|
275
|
+
})
|
|
253
276
|
}) : null]
|
|
254
277
|
});
|
|
255
278
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"action-swap.js","names":[],"sources":["../../../src/components/motion/action-swap.tsx"],"sourcesContent":["\"use client\";\n\nimport type { ReactNode } from \"react\";\nimport { useState } from \"react\";\nimport {\n AnimatePresence,\n type HTMLMotionProps,\n motion,\n useReducedMotion,\n type Variants,\n} from \"motion/react\";\n\nimport { cn } from \"@kumix/utils\";\nimport { EASE_OUT, SPRING_PRESS, SPRING_SWAP } from \"../../lib/ease\";\n\nexport type ActionSwapItem = {\n id: string;\n label: ReactNode;\n icon?: ReactNode;\n ariaLabel?: string;\n};\n\nexport type ActionSwapButtonVariant = \"primary\" | \"secondary\" | \"outline\" | \"ghost\";\nexport type ActionSwapButtonSize = \"sm\" | \"md\" | \"lg\" | \"icon\";\nexport type ActionSwapAnimation = \"blur\" | \"roll\" | \"cascade\";\n\n/** Animations with a single-element variant set (cascade animates per letter). */\ntype CoreAnimation = \"blur\" | \"roll\";\n\nexport interface ActionSwapButtonProps\n extends Omit<HTMLMotionProps<\"button\">, \"children\" | \"onChange\"> {\n items: ActionSwapItem[];\n value?: string;\n defaultValue?: string;\n onValueChange?: (value: string, item: ActionSwapItem) => void;\n variant?: ActionSwapButtonVariant;\n size?: ActionSwapButtonSize;\n animation?: ActionSwapAnimation;\n iconOnly?: boolean;\n cycle?: boolean;\n}\n\nexport interface ActionSwapTextProps {\n value: string;\n children: ReactNode;\n animation?: ActionSwapAnimation;\n className?: string;\n}\n\nexport interface ActionSwapIconProps {\n value: string;\n children: ReactNode;\n animation?: ActionSwapAnimation;\n className?: string;\n}\n\nconst BLUR_TRANSITION = { duration: 0.2, ease: \"easeInOut\" } as const;\nconst ROLL_TRANSITION = SPRING_SWAP;\nconst ROLL_EXIT_TRANSITION = { duration: 0.14, ease: EASE_OUT } as const;\nconst SWAP_BLUR = \"blur(8px)\";\nconst ROLL_BLUR = \"blur(3px)\";\n\n// Cascade rolls the label one letter at a time, left to right. The leaving\n// and landing strings overlap as independent layers (no shared cells), so\n// proportional glyph widths never jitter. Exits cascade at half the enter\n// stagger so the tail of the old label lingers briefly.\nconst CASCADE_STAGGER = 0.025;\n\nconst CASCADE_LETTER_VARIANTS: Variants = {\n initial: { opacity: 0, y: \"105%\", filter: ROLL_BLUR },\n animate: (delay: number = 0) => ({\n opacity: 1,\n y: \"0%\",\n filter: \"blur(0px)\",\n transition: { ...SPRING_SWAP, delay },\n }),\n exit: (delay: number = 0) => ({\n opacity: 0,\n y: \"-105%\",\n filter: ROLL_BLUR,\n transition: { duration: 0.16, ease: EASE_OUT, delay: delay * 0.5 },\n }),\n};\n\nconst TEXT_VARIANTS: Record<CoreAnimation, Variants> = {\n blur: {\n initial: { opacity: 0, scale: 0.94, filter: SWAP_BLUR },\n animate: {\n opacity: 1,\n scale: 1,\n filter: \"blur(0px)\",\n transition: BLUR_TRANSITION,\n },\n exit: {\n opacity: 0,\n scale: 0.94,\n filter: SWAP_BLUR,\n transition: BLUR_TRANSITION,\n },\n },\n roll: {\n initial: { opacity: 0, y: \"90%\", filter: ROLL_BLUR },\n animate: {\n opacity: 1,\n y: \"0%\",\n filter: \"blur(0px)\",\n transition: ROLL_TRANSITION,\n },\n exit: {\n opacity: 0,\n y: \"-90%\",\n filter: ROLL_BLUR,\n transition: ROLL_EXIT_TRANSITION,\n },\n },\n};\n\nconst ICON_VARIANTS: Record<CoreAnimation, Variants> = {\n blur: {\n initial: { opacity: 0, scale: 0.25, filter: SWAP_BLUR },\n animate: {\n opacity: 1,\n scale: 1,\n filter: \"blur(0px)\",\n transition: BLUR_TRANSITION,\n },\n exit: {\n opacity: 0,\n scale: 0.25,\n filter: SWAP_BLUR,\n transition: BLUR_TRANSITION,\n },\n },\n roll: {\n initial: { opacity: 0, y: 12, filter: ROLL_BLUR },\n animate: {\n opacity: 1,\n y: 0,\n filter: \"blur(0px)\",\n transition: ROLL_TRANSITION,\n },\n exit: {\n opacity: 0,\n y: -12,\n filter: ROLL_BLUR,\n transition: ROLL_EXIT_TRANSITION,\n },\n },\n};\n\nconst VARIANT_CLASS: Record<ActionSwapButtonVariant, string> = {\n primary: \"bg-primary text-primary-foreground hover:bg-primary/90\",\n secondary: \"border border-border bg-card text-foreground hover:border-border\",\n outline: \"border border-border bg-transparent text-foreground hover:bg-muted/60\",\n ghost: \"text-muted-foreground hover:bg-muted/60 hover:text-foreground\",\n};\n\nconst SIZE_CLASS: Record<ActionSwapButtonSize, string> = {\n sm: \"h-8 gap-1.5 rounded-full px-3 text-xs\",\n md: \"h-10 gap-2 rounded-full px-4 text-sm\",\n lg: \"h-12 gap-2.5 rounded-full px-5 text-base\",\n icon: \"h-10 w-10 rounded-full\",\n};\n\nexport function ActionSwapText({\n value,\n children,\n animation = \"blur\",\n className,\n}: ActionSwapTextProps) {\n const reduce = useReducedMotion();\n\n // Cascade needs a plain string to split into letters; non-string content\n // and reduced motion fall back to the closest single-element animation.\n const label = typeof children === \"string\" ? children : null;\n const cascade = animation === \"cascade\" && label !== null && !reduce;\n const coreAnimation: CoreAnimation = animation === \"cascade\" ? \"roll\" : animation;\n\n return (\n <span\n className={cn(\n \"relative -my-[0.08em] inline-block max-w-full whitespace-nowrap py-[0.08em] align-bottom\",\n className,\n )}\n style={{\n clipPath: \"inset(0 -999px)\",\n WebkitClipPath: \"inset(0 -999px)\",\n }}\n >\n <span aria-hidden className=\"invisible inline-block whitespace-nowrap\">\n {cascade\n ? label.split(\"\").map((char, index) => (\n <span key={index} className=\"inline-block whitespace-pre\">\n {char}\n </span>\n ))\n : children}\n </span>\n {cascade ? (\n <>\n {/* Letters are decorative fragments; readers get the whole label. */}\n <span className=\"sr-only\">{label}</span>\n <AnimatePresence initial={false}>\n <motion.span\n key={`cascade-${value}`}\n aria-hidden\n initial=\"initial\"\n animate=\"animate\"\n exit=\"exit\"\n className=\"absolute top-[0.08em] left-0 inline-block whitespace-pre\"\n >\n {label.split(\"\").map((char, i) => (\n <motion.span\n key={i}\n custom={i * CASCADE_STAGGER}\n variants={CASCADE_LETTER_VARIANTS}\n // Own states: a label that swaps away and straight back\n // re-enters mid-exit, and only owned targets are restored.\n initial=\"initial\"\n animate=\"animate\"\n exit=\"exit\"\n className=\"inline-block whitespace-pre will-change-[opacity,filter,transform]\"\n >\n {char}\n </motion.span>\n ))}\n </motion.span>\n </AnimatePresence>\n </>\n ) : (\n <AnimatePresence initial={false}>\n <motion.span\n key={`${animation}-${value}`}\n variants={TEXT_VARIANTS[coreAnimation]}\n initial={reduce ? false : \"initial\"}\n animate={reduce ? { opacity: 1, filter: \"blur(0px)\", scale: 1, y: 0 } : \"animate\"}\n exit={reduce ? undefined : \"exit\"}\n // Truncation lives on the layer that holds the text — the layer\n // moves as a whole, so clipping it never eats the roll.\n className=\"absolute top-[0.08em] left-0 inline-block max-w-full truncate will-change-[opacity,filter,transform]\"\n >\n {children}\n </motion.span>\n </AnimatePresence>\n )}\n </span>\n );\n}\n\nexport function ActionSwapIcon({\n value,\n children,\n animation = \"blur\",\n className,\n}: ActionSwapIconProps) {\n const reduce = useReducedMotion();\n // Icons are single elements — cascade maps to its closest motion, roll.\n const coreAnimation: CoreAnimation = animation === \"cascade\" ? \"roll\" : animation;\n\n return (\n <span\n className={cn(\"relative inline-grid shrink-0 place-items-center overflow-hidden\", className)}\n >\n <AnimatePresence mode=\"popLayout\" initial={false}>\n <motion.span\n key={`${animation}-${value}`}\n aria-hidden\n variants={ICON_VARIANTS[coreAnimation]}\n initial={reduce ? false : \"initial\"}\n animate={reduce ? { opacity: 1, filter: \"blur(0px)\", scale: 1, y: 0 } : \"animate\"}\n exit={reduce ? undefined : \"exit\"}\n className=\"col-start-1 row-start-1 inline-flex items-center justify-center will-change-[opacity,filter,transform]\"\n >\n {children}\n </motion.span>\n </AnimatePresence>\n </span>\n );\n}\n\nexport function ActionSwapButton({\n items,\n value,\n defaultValue,\n onValueChange,\n variant = \"secondary\",\n size = \"md\",\n animation = \"blur\",\n iconOnly = size === \"icon\",\n cycle = true,\n className,\n disabled,\n onClick,\n ...rest\n}: ActionSwapButtonProps) {\n const reduce = useReducedMotion();\n const [internalValue, setInternalValue] = useState(defaultValue ?? items[0]?.id);\n const currentValue = value ?? internalValue;\n const activeIndex = Math.max(\n 0,\n items.findIndex((item) => item.id === currentValue),\n );\n const activeItem = items[activeIndex] ?? items[0];\n const hasIcon = items.some((item) => item.icon);\n const nextItem = cycle && items.length > 0 ? items[(activeIndex + 1) % items.length] : undefined;\n\n if (!activeItem) return null;\n\n const accessibleLabel =\n activeItem.ariaLabel ??\n (iconOnly && typeof activeItem.label === \"string\" ? activeItem.label : undefined);\n\n return (\n <motion.button\n type=\"button\"\n disabled={disabled}\n whileTap={reduce || disabled ? undefined : { scale: 0.97 }}\n transition={SPRING_PRESS}\n className={cn(\n \"inline-flex items-center justify-center overflow-hidden font-medium transition-colors\",\n \"disabled:pointer-events-none disabled:opacity-50\",\n VARIANT_CLASS[variant],\n SIZE_CLASS[size],\n className,\n )}\n aria-label={accessibleLabel}\n onClick={(event) => {\n onClick?.(event);\n if (event.defaultPrevented || disabled || !cycle || !nextItem) return;\n if (value === undefined) setInternalValue(nextItem.id);\n onValueChange?.(nextItem.id, nextItem);\n }}\n {...rest}\n >\n {hasIcon ? (\n <ActionSwapIcon value={activeItem.id} animation={animation} className=\"h-4 w-4\">\n {activeItem.icon ?? null}\n </ActionSwapIcon>\n ) : null}\n {!iconOnly ? (\n <ActionSwapText value={activeItem.id} animation={animation}>\n {activeItem.label}\n </ActionSwapText>\n ) : null}\n </motion.button>\n );\n}\n"],"mappings":";;;;;;;AAwDA,MAAM,kBAAkB;CAAE,UAAU;CAAK,MAAM;AAAY;AAC3D,MAAM,kBAAkB;AACxB,MAAM,uBAAuB;CAAE,UAAU;CAAM,MAAM;AAAS;AAC9D,MAAM,YAAY;AAClB,MAAM,YAAY;AAMlB,MAAM,kBAAkB;AAExB,MAAM,0BAAoC;CACxC,SAAS;EAAE,SAAS;EAAG,GAAG;EAAQ,QAAQ;CAAU;CACpD,UAAU,QAAgB,OAAO;EAC/B,SAAS;EACT,GAAG;EACH,QAAQ;EACR,YAAY;GAAE,GAAG;GAAa;EAAM;CACtC;CACA,OAAO,QAAgB,OAAO;EAC5B,SAAS;EACT,GAAG;EACH,QAAQ;EACR,YAAY;GAAE,UAAU;GAAM,MAAM;GAAU,OAAO,QAAQ;EAAI;CACnE;AACF;AAEA,MAAM,gBAAiD;CACrD,MAAM;EACJ,SAAS;GAAE,SAAS;GAAG,OAAO;GAAM,QAAQ;EAAU;EACt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AAU;GACnE,UAAA,WAAW,QAAQ;EACN,CAAA,IACd,MACH,CAAC,WACA,oBAAC,gBAAD;GAAgB,OAAO,WAAW;GAAe;GAC9C,UAAA,WAAW;EACE,CAAA,IACd,IACS;;AAEnB"}
|
|
1
|
+
{"version":3,"file":"action-swap.js","names":[],"sources":["../../../src/components/motion/action-swap.tsx"],"sourcesContent":["\"use client\";\n\nimport type { ReactNode } from \"react\";\nimport { useState } from \"react\";\nimport {\n AnimatePresence,\n type HTMLMotionProps,\n motion,\n useReducedMotion,\n type Variants,\n} from \"motion/react\";\n\nimport { cn } from \"@kumix/utils\";\nimport { EASE_OUT, SPRING_LAYOUT, SPRING_PRESS, SPRING_SWAP } from \"../../lib/ease\";\n\nexport type ActionSwapItem = {\n id: string;\n label: ReactNode;\n icon?: ReactNode;\n ariaLabel?: string;\n};\n\nexport type ActionSwapButtonVariant = \"primary\" | \"secondary\" | \"outline\" | \"ghost\";\nexport type ActionSwapButtonSize = \"sm\" | \"md\" | \"lg\" | \"icon\";\nexport type ActionSwapAnimation = \"blur\" | \"roll\" | \"cascade\";\n\n/** Animations with a single-element variant set (cascade animates per letter). */\ntype CoreAnimation = \"blur\" | \"roll\";\n\nexport interface ActionSwapButtonProps\n extends Omit<HTMLMotionProps<\"button\">, \"children\" | \"onChange\"> {\n items: ActionSwapItem[];\n value?: string;\n defaultValue?: string;\n onValueChange?: (value: string, item: ActionSwapItem) => void;\n variant?: ActionSwapButtonVariant;\n size?: ActionSwapButtonSize;\n animation?: ActionSwapAnimation;\n iconOnly?: boolean;\n cycle?: boolean;\n}\n\nexport interface ActionSwapTextProps {\n value: string;\n children: ReactNode;\n animation?: ActionSwapAnimation;\n className?: string;\n}\n\nexport interface ActionSwapIconProps {\n value: string;\n children: ReactNode;\n animation?: ActionSwapAnimation;\n className?: string;\n}\n\n// The arriving layer springs in, so a second press mid-swap bends it toward\n// the new target instead of restarting. The leaving layer is a little quicker,\n// still long enough to cross the arrival so the swap reads as one morph.\nconst BLUR_TRANSITION = SPRING_SWAP;\nconst BLUR_EXIT_TRANSITION = { duration: 0.16, ease: EASE_OUT } as const;\nconst ROLL_TRANSITION = SPRING_SWAP;\nconst ROLL_EXIT_TRANSITION = { duration: 0.14, ease: EASE_OUT } as const;\n// A light blur softens the crossing without smearing small glyphs.\nconst SWAP_BLUR = \"blur(2px)\";\nconst ROLL_BLUR = \"blur(3px)\";\n\n// Cascade rolls the label one letter at a time, left to right. The leaving\n// and landing strings overlap as independent layers (no shared cells), so\n// proportional glyph widths never jitter. Exits cascade at half the enter\n// stagger so the tail of the old label lingers briefly.\nconst CASCADE_STAGGER = 0.025;\n\nconst CASCADE_LETTER_VARIANTS: Variants = {\n initial: { opacity: 0, y: \"105%\", filter: ROLL_BLUR },\n animate: (delay: number = 0) => ({\n opacity: 1,\n y: \"0%\",\n filter: \"blur(0px)\",\n transition: { ...SPRING_SWAP, delay },\n }),\n exit: (delay: number = 0) => ({\n opacity: 0,\n y: \"-105%\",\n filter: ROLL_BLUR,\n transition: { duration: 0.16, ease: EASE_OUT, delay: delay * 0.5 },\n }),\n};\n\nconst TEXT_VARIANTS: Record<CoreAnimation, Variants> = {\n blur: {\n initial: { opacity: 0, scale: 0.9, filter: SWAP_BLUR },\n animate: {\n opacity: 1,\n scale: 1,\n filter: \"blur(0px)\",\n transition: BLUR_TRANSITION,\n },\n exit: {\n opacity: 0,\n scale: 0.96,\n filter: SWAP_BLUR,\n transition: BLUR_EXIT_TRANSITION,\n },\n },\n roll: {\n initial: { opacity: 0, y: \"90%\", filter: ROLL_BLUR },\n animate: {\n opacity: 1,\n y: \"0%\",\n filter: \"blur(0px)\",\n transition: ROLL_TRANSITION,\n },\n exit: {\n opacity: 0,\n y: \"-90%\",\n filter: ROLL_BLUR,\n transition: ROLL_EXIT_TRANSITION,\n },\n },\n};\n\nconst ICON_VARIANTS: Record<CoreAnimation, Variants> = {\n blur: {\n initial: { opacity: 0, scale: 0.25, filter: SWAP_BLUR },\n animate: {\n opacity: 1,\n scale: 1,\n filter: \"blur(0px)\",\n transition: BLUR_TRANSITION,\n },\n exit: {\n opacity: 0,\n scale: 0.25,\n filter: SWAP_BLUR,\n transition: BLUR_EXIT_TRANSITION,\n },\n },\n roll: {\n initial: { opacity: 0, y: 12, filter: ROLL_BLUR },\n animate: {\n opacity: 1,\n y: 0,\n filter: \"blur(0px)\",\n transition: ROLL_TRANSITION,\n },\n exit: {\n opacity: 0,\n y: -12,\n filter: ROLL_BLUR,\n transition: ROLL_EXIT_TRANSITION,\n },\n },\n};\n\nconst VARIANT_CLASS: Record<ActionSwapButtonVariant, string> = {\n primary: \"bg-primary text-primary-foreground hover:bg-primary/90\",\n secondary: \"border border-border bg-card text-foreground hover:border-border\",\n outline: \"border border-border bg-transparent text-foreground hover:bg-muted/60\",\n ghost: \"text-muted-foreground hover:bg-muted/60 hover:text-foreground\",\n};\n\nconst SIZE_CLASS: Record<ActionSwapButtonSize, string> = {\n sm: \"h-8 gap-1.5 rounded-full px-3 text-xs\",\n md: \"h-10 gap-2 rounded-full px-4 text-sm\",\n lg: \"h-12 gap-2.5 rounded-full px-5 text-base\",\n icon: \"h-10 w-10 rounded-full\",\n};\n\nexport function ActionSwapText({\n value,\n children,\n animation = \"blur\",\n className,\n}: ActionSwapTextProps) {\n const reduce = useReducedMotion();\n\n // Cascade needs a plain string to split into letters; non-string content\n // and reduced motion fall back to the closest single-element animation.\n const label = typeof children === \"string\" ? children : null;\n const cascade = animation === \"cascade\" && label !== null && !reduce;\n const coreAnimation: CoreAnimation = animation === \"cascade\" ? \"roll\" : animation;\n\n return (\n <span\n className={cn(\n \"relative -my-[0.08em] inline-block max-w-full whitespace-nowrap py-[0.08em] align-bottom\",\n className,\n )}\n style={{\n clipPath: \"inset(0 -999px)\",\n WebkitClipPath: \"inset(0 -999px)\",\n }}\n >\n <span aria-hidden className=\"invisible inline-block whitespace-nowrap\">\n {cascade\n ? label.split(\"\").map((char, index) => (\n <span key={index} className=\"inline-block whitespace-pre\">\n {char}\n </span>\n ))\n : children}\n </span>\n {cascade ? (\n <>\n {/* Letters are decorative fragments; readers get the whole label. */}\n <span className=\"sr-only\">{label}</span>\n <AnimatePresence initial={false}>\n <motion.span\n key={`cascade-${value}`}\n aria-hidden\n initial=\"initial\"\n animate=\"animate\"\n exit=\"exit\"\n className=\"absolute top-[0.08em] left-0 inline-block whitespace-pre\"\n >\n {label.split(\"\").map((char, i) => (\n <motion.span\n key={i}\n custom={i * CASCADE_STAGGER}\n variants={CASCADE_LETTER_VARIANTS}\n // Own states: a label that swaps away and straight back\n // re-enters mid-exit, and only owned targets are restored.\n initial=\"initial\"\n animate=\"animate\"\n exit=\"exit\"\n className=\"inline-block whitespace-pre will-change-[opacity,filter,transform]\"\n >\n {char}\n </motion.span>\n ))}\n </motion.span>\n </AnimatePresence>\n </>\n ) : (\n <AnimatePresence initial={false}>\n <motion.span\n key={`${animation}-${value}`}\n variants={TEXT_VARIANTS[coreAnimation]}\n initial={reduce ? false : \"initial\"}\n animate={reduce ? { opacity: 1, filter: \"blur(0px)\", scale: 1, y: 0 } : \"animate\"}\n exit={reduce ? undefined : \"exit\"}\n // Truncation lives on the layer that holds the text — the layer\n // moves as a whole, so clipping it never eats the roll.\n className=\"absolute top-[0.08em] left-0 inline-block max-w-full truncate will-change-[opacity,filter,transform]\"\n >\n {children}\n </motion.span>\n </AnimatePresence>\n )}\n </span>\n );\n}\n\nexport function ActionSwapIcon({\n value,\n children,\n animation = \"blur\",\n className,\n}: ActionSwapIconProps) {\n const reduce = useReducedMotion();\n // Icons are single elements — cascade maps to its closest motion, roll.\n const coreAnimation: CoreAnimation = animation === \"cascade\" ? \"roll\" : animation;\n\n return (\n <span\n className={cn(\"relative inline-grid shrink-0 place-items-center overflow-hidden\", className)}\n >\n <AnimatePresence mode=\"popLayout\" initial={false}>\n <motion.span\n key={`${animation}-${value}`}\n aria-hidden\n variants={ICON_VARIANTS[coreAnimation]}\n initial={reduce ? false : \"initial\"}\n animate={reduce ? { opacity: 1, filter: \"blur(0px)\", scale: 1, y: 0 } : \"animate\"}\n exit={reduce ? undefined : \"exit\"}\n className=\"col-start-1 row-start-1 inline-flex items-center justify-center will-change-[opacity,filter,transform]\"\n >\n {children}\n </motion.span>\n </AnimatePresence>\n </span>\n );\n}\n\nexport function ActionSwapButton({\n items,\n value,\n defaultValue,\n onValueChange,\n variant = \"secondary\",\n size = \"md\",\n animation = \"blur\",\n iconOnly = size === \"icon\",\n cycle = true,\n className,\n disabled,\n onClick,\n style,\n ...rest\n}: ActionSwapButtonProps) {\n const reduce = useReducedMotion();\n const [internalValue, setInternalValue] = useState(defaultValue ?? items[0]?.id);\n const currentValue = value ?? internalValue;\n const activeIndex = Math.max(\n 0,\n items.findIndex((item) => item.id === currentValue),\n );\n const activeItem = items[activeIndex] ?? items[0];\n const hasIcon = items.some((item) => item.icon);\n const nextItem = cycle && items.length > 0 ? items[(activeIndex + 1) % items.length] : undefined;\n\n if (!activeItem) return null;\n\n const accessibleLabel =\n activeItem.ariaLabel ??\n (iconOnly && typeof activeItem.label === \"string\" ? activeItem.label : undefined);\n const layoutTransition = reduce ? { duration: 0 } : SPRING_LAYOUT;\n\n return (\n <motion.button\n type=\"button\"\n disabled={disabled}\n // A label of a different length resizes the button: glide the width on\n // the soft layout spring, and only when the value changes, so unrelated\n // page reflow never animates the button.\n layout\n layoutDependency={activeItem.id}\n whileTap={reduce || disabled ? undefined : { scale: 0.97 }}\n transition={{ ...SPRING_PRESS, layout: layoutTransition }}\n // Layout animations only correct a radius set inline.\n style={{ borderRadius: 9999, ...style }}\n className={cn(\n \"inline-flex items-center justify-center overflow-hidden font-medium transition-colors\",\n \"disabled:pointer-events-none disabled:opacity-50\",\n VARIANT_CLASS[variant],\n SIZE_CLASS[size],\n className,\n )}\n aria-label={accessibleLabel}\n onClick={(event) => {\n onClick?.(event);\n if (event.defaultPrevented || disabled || !cycle || !nextItem) return;\n if (value === undefined) setInternalValue(nextItem.id);\n onValueChange?.(nextItem.id, nextItem);\n }}\n {...rest}\n >\n {/* Position-only layout keeps the contents from stretching with the\n button while its width glides. */}\n {hasIcon ? (\n <motion.span\n layout=\"position\"\n layoutDependency={activeItem.id}\n transition={layoutTransition}\n className=\"inline-flex shrink-0\"\n >\n <ActionSwapIcon value={activeItem.id} animation={animation} className=\"h-4 w-4\">\n {activeItem.icon ?? null}\n </ActionSwapIcon>\n </motion.span>\n ) : null}\n {!iconOnly ? (\n <motion.span\n layout=\"position\"\n layoutDependency={activeItem.id}\n transition={layoutTransition}\n className=\"inline-flex min-w-0 max-w-full\"\n >\n <ActionSwapText value={activeItem.id} animation={animation}>\n {activeItem.label}\n </ActionSwapText>\n </motion.span>\n ) : null}\n </motion.button>\n );\n}\n"],"mappings":";;;;;;;AA2DA,MAAM,kBAAkB;AACxB,MAAM,uBAAuB;CAAE,UAAU;CAAM,MAAM;AAAS;AAC9D,MAAM,kBAAkB;AACxB,MAAM,uBAAuB;CAAE,UAAU;CAAM,MAAM;AAAS;AAE9D,MAAM,YAAY;AAClB,MAAM,YAAY;AAMlB,MAAM,kBAAkB;AAExB,MAAM,0BAAoC;CACxC,SAAS;EAAE,SAAS;EAAG,GAAG;EAAQ,QAAQ;CAAU;CACpD,UAAU,QAAgB,OAAO;EAC/B,SAAS;EACT,GAAG;EACH,QAAQ;EACR,YAAY;GAAE,GAAG;GAAa;EAAM;CACtC;CACA,OAAO,QAAgB,OAAO;EAC5B,SAAS;EACT,GAAG;EACH,QAAQ;EACR,YAAY;GAAE,UAAU;GAAM,MAAM;GAAU,OAAO,QAAQ;EAAI;CACnE;AACF;AAEA,MAAM,gBAAiD;CACrD,MAAM;EACJ,SAAS;GAAE,SAAS;GAAG,OAAO;GAAK,QAAQ;EAAU;EACrD,SAAS;GACP,SAAS;GACT,OAAO;GACP,QAAQ;GACR,YAAY;EACd;EACA,MAAM;GACJ,SAAS;GACT,OAAO;GACP,QAAQ;GACR,YAAY;EACd;CACF;CACA,MAAM;EACJ,SAAS;GAAE,SAAS;GAAG,GAAG;GAAO,Q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;GACZ,WAAU;GAEV,UAAA,oBAAC,gBAAD;IAAgB,OAAO,WAAW;IAAe;IAAW,WAAU;IACnE,UAAA,WAAW,QAAQ;GACN,CAAA;EACL,CAAA,IACX,MACH,CAAC,WACA,oBAAC,OAAO,MAAR;GACE,QAAO;GACP,kBAAkB,WAAW;GAC7B,YAAY;GACZ,WAAU;GAEV,UAAA,oBAAC,gBAAD;IAAgB,OAAO,WAAW;IAAe;IAC9C,UAAA,WAAW;GACE,CAAA;EACL,CAAA,IACX,IACS;;AAEnB"}
|
|
@@ -12,6 +12,6 @@ export interface AnimatedBadgeProps extends Omit<HTMLMotionProps<"span">, "child
|
|
|
12
12
|
pulse?: boolean;
|
|
13
13
|
contentKey?: string | number;
|
|
14
14
|
}
|
|
15
|
-
export declare function AnimatedBadge({ status, size, children, icon, showIcon, pulse, contentKey, className, ...rest }: AnimatedBadgeProps): import("react").JSX.Element;
|
|
15
|
+
export declare function AnimatedBadge({ status, size, children, icon, showIcon, pulse, contentKey, className, style, ...rest }: AnimatedBadgeProps): import("react").JSX.Element;
|
|
16
16
|
//#endregion
|
|
17
17
|
//# sourceMappingURL=animated-badge.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"animated-badge.d.ts","names":[],"sources":["../../../src/components/motion/animated-badge.tsx"],"mappings":";;;YAeY;YAEA;iBAEK,2BAA2B,KAAK;EAC/C,SAAS;EACT,OAAO;EACP,WAAW;EACX,OAAO;EACP;EACA;EACA;;
|
|
1
|
+
{"version":3,"file":"animated-badge.d.ts","names":[],"sources":["../../../src/components/motion/animated-badge.tsx"],"mappings":";;;YAeY;YAEA;iBAEK,2BAA2B,KAAK;EAC/C,SAAS;EACT,OAAO;EACP,WAAW;EACX,OAAO;EACP;EACA;EACA;;wBA2Ec,gBACd,QACA,MACA,UACA,MACA,UACA,OACA,YACA,WACA,UACG,QACF,qCAAkB,IAAA"}
|