@kumix/ui 0.3.7 → 0.3.9
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 +26 -25
- package/dist/cascader-types-BnH6wYD-.d.ts +183 -0
- package/dist/cascader-types-BnH6wYD-.d.ts.map +1 -0
- package/dist/components/agents/ai-sidebar.js +3 -5
- package/dist/components/agents/ai-sidebar.js.map +1 -1
- package/dist/components/motion/animated-sidebar.d.ts.map +1 -1
- package/dist/components/motion/animated-sidebar.js +12 -3
- package/dist/components/motion/animated-sidebar.js.map +1 -1
- package/dist/components/motion/attachment-upload.d.ts.map +1 -1
- package/dist/components/motion/attachment-upload.js +9 -5
- package/dist/components/motion/attachment-upload.js.map +1 -1
- package/dist/components/motion/bottom-sheet.d.ts.map +1 -1
- package/dist/components/motion/bottom-sheet.js +77 -74
- package/dist/components/motion/bottom-sheet.js.map +1 -1
- package/dist/components/motion/center-morph-modal.d.ts.map +1 -1
- package/dist/components/motion/center-morph-modal.js +82 -88
- package/dist/components/motion/center-morph-modal.js.map +1 -1
- package/dist/components/motion/combobox/content.js +1 -1
- package/dist/components/motion/combobox/context.d.ts +6 -0
- package/dist/components/motion/combobox/context.d.ts.map +1 -1
- package/dist/components/motion/combobox/context.js +1 -233
- package/dist/components/motion/combobox/list.js +1 -1
- package/dist/components/motion/combobox/trigger.js +7 -8
- package/dist/components/motion/combobox/trigger.js.map +1 -1
- package/dist/components/motion/combobox.js +1 -1
- package/dist/components/motion/command-palette.d.ts.map +1 -1
- package/dist/components/motion/command-palette.js +62 -45
- package/dist/components/motion/command-palette.js.map +1 -1
- package/dist/components/motion/drawer.d.ts.map +1 -1
- package/dist/components/motion/drawer.js +30 -30
- package/dist/components/motion/drawer.js.map +1 -1
- package/dist/components/motion/loader.js +20 -22
- package/dist/components/motion/loader.js.map +1 -1
- package/dist/components/motion/morphing-modal.d.ts.map +1 -1
- package/dist/components/motion/morphing-modal.js +83 -83
- package/dist/components/motion/morphing-modal.js.map +1 -1
- package/dist/components/motion/morphing-search.d.ts +28 -0
- package/dist/components/motion/morphing-search.d.ts.map +1 -0
- package/dist/components/motion/morphing-search.js +422 -0
- package/dist/components/motion/morphing-search.js.map +1 -0
- package/dist/components/motion/project-folder.js +20 -20
- package/dist/components/motion/project-folder.js.map +1 -1
- package/dist/components/reui/alert.d.ts +1 -1
- package/dist/components/reui/badge.d.ts +1 -1
- package/dist/components/reui/cascader/cascader-async.d.ts +90 -0
- package/dist/components/reui/cascader/cascader-async.d.ts.map +1 -0
- package/dist/components/reui/cascader/cascader-async.js +549 -0
- package/dist/components/reui/cascader/cascader-async.js.map +1 -0
- package/dist/components/reui/cascader/cascader-columns.d.ts +29 -0
- package/dist/components/reui/cascader/cascader-columns.d.ts.map +1 -0
- package/dist/components/reui/cascader/cascader-columns.js +135 -0
- package/dist/components/reui/cascader/cascader-columns.js.map +1 -0
- package/dist/components/reui/cascader/cascader-context.d.ts +193 -0
- package/dist/components/reui/cascader/cascader-context.d.ts.map +1 -0
- package/dist/components/reui/cascader/cascader-context.js +59 -0
- package/dist/components/reui/cascader/cascader-context.js.map +1 -0
- package/dist/components/reui/cascader/cascader-footer.d.ts +85 -0
- package/dist/components/reui/cascader/cascader-footer.d.ts.map +1 -0
- package/dist/components/reui/cascader/cascader-footer.js +456 -0
- package/dist/components/reui/cascader/cascader-footer.js.map +1 -0
- package/dist/components/reui/cascader/cascader-i18n.d.ts +17 -0
- package/dist/components/reui/cascader/cascader-i18n.d.ts.map +1 -0
- package/dist/components/reui/cascader/cascader-i18n.js +68 -0
- package/dist/components/reui/cascader/cascader-i18n.js.map +1 -0
- package/dist/components/reui/cascader/cascader-item.d.ts +115 -0
- package/dist/components/reui/cascader/cascader-item.d.ts.map +1 -0
- package/dist/components/reui/cascader/cascader-item.js +530 -0
- package/dist/components/reui/cascader/cascader-item.js.map +1 -0
- package/dist/components/reui/cascader/cascader-lib.d.ts +141 -0
- package/dist/components/reui/cascader/cascader-lib.d.ts.map +1 -0
- package/dist/components/reui/cascader/cascader-lib.js +576 -0
- package/dist/components/reui/cascader/cascader-lib.js.map +1 -0
- package/dist/components/reui/cascader/cascader-nav.d.ts +59 -0
- package/dist/components/reui/cascader/cascader-nav.d.ts.map +1 -0
- package/dist/components/reui/cascader/cascader-nav.js +312 -0
- package/dist/components/reui/cascader/cascader-nav.js.map +1 -0
- package/dist/components/reui/cascader/cascader-types.d.ts +2 -0
- package/dist/components/reui/cascader/cascader-types.js +2 -0
- package/dist/components/reui/cascader/cascader-virtual.d.ts +65 -0
- package/dist/components/reui/cascader/cascader-virtual.d.ts.map +1 -0
- package/dist/components/reui/cascader/cascader-virtual.js +240 -0
- package/dist/components/reui/cascader/cascader-virtual.js.map +1 -0
- package/dist/components/reui/cascader/cascader.d.ts +322 -0
- package/dist/components/reui/cascader/cascader.d.ts.map +1 -0
- package/dist/components/reui/cascader/cascader.js +1459 -0
- package/dist/components/reui/cascader/cascader.js.map +1 -0
- package/dist/components/reui/event-calendar/event-calendar-event.d.ts +28 -47
- package/dist/components/reui/event-calendar/event-calendar-event.d.ts.map +1 -1
- package/dist/components/reui/event-calendar/event-calendar-event.js +26 -44
- package/dist/components/reui/event-calendar/event-calendar-event.js.map +1 -1
- package/dist/components/reui/event-calendar/event-calendar-nav.js +1 -1
- package/dist/components/reui/event-calendar/event-calendar-types.d.ts +19 -57
- package/dist/components/reui/event-calendar/event-calendar-types.d.ts.map +1 -1
- package/dist/components/reui/filters/filters-advanced.d.ts +52 -0
- package/dist/components/reui/filters/filters-advanced.d.ts.map +1 -0
- package/dist/components/reui/filters/filters-advanced.js +1191 -0
- package/dist/components/reui/filters/filters-advanced.js.map +1 -0
- package/dist/components/reui/filters/filters-builder.d.ts +43 -0
- package/dist/components/reui/filters/filters-builder.d.ts.map +1 -0
- package/dist/components/reui/filters/filters-builder.js +152 -0
- package/dist/components/reui/filters/filters-builder.js.map +1 -0
- package/dist/components/reui/filters/filters-chip.d.ts +79 -0
- package/dist/components/reui/filters/filters-chip.d.ts.map +1 -0
- package/dist/components/reui/filters/filters-chip.js +553 -0
- package/dist/components/reui/filters/filters-chip.js.map +1 -0
- package/dist/components/reui/filters/filters-context.d.ts +290 -0
- package/dist/components/reui/filters/filters-context.d.ts.map +1 -0
- package/dist/components/reui/filters/filters-context.js +277 -0
- package/dist/components/reui/filters/filters-context.js.map +1 -0
- package/dist/components/reui/filters/filters-date.d.ts +43 -0
- package/dist/components/reui/filters/filters-date.d.ts.map +1 -0
- package/dist/components/reui/filters/filters-date.js +143 -0
- package/dist/components/reui/filters/filters-date.js.map +1 -0
- package/dist/components/reui/filters/filters-dnd.d.ts +101 -0
- package/dist/components/reui/filters/filters-dnd.d.ts.map +1 -0
- package/dist/components/reui/filters/filters-dnd.js +454 -0
- package/dist/components/reui/filters/filters-dnd.js.map +1 -0
- package/dist/components/reui/filters/filters-draft.d.ts +2 -0
- package/dist/components/reui/filters/filters-draft.js +128 -0
- package/dist/components/reui/filters/filters-draft.js.map +1 -0
- package/dist/components/reui/filters/filters-editors.d.ts +91 -0
- package/dist/components/reui/filters/filters-editors.d.ts.map +1 -0
- package/dist/components/reui/filters/filters-editors.js +773 -0
- package/dist/components/reui/filters/filters-editors.js.map +1 -0
- package/dist/components/reui/filters/filters-i18n.d.ts +24 -0
- package/dist/components/reui/filters/filters-i18n.d.ts.map +1 -0
- package/dist/components/reui/filters/filters-i18n.js +127 -0
- package/dist/components/reui/filters/filters-i18n.js.map +1 -0
- package/dist/components/reui/filters/filters-lib.d.ts +171 -0
- package/dist/components/reui/filters/filters-lib.d.ts.map +1 -0
- package/dist/components/reui/filters/filters-lib.js +336 -0
- package/dist/components/reui/filters/filters-lib.js.map +1 -0
- package/dist/components/reui/filters/filters-operators.d.ts +49 -0
- package/dist/components/reui/filters/filters-operators.d.ts.map +1 -0
- package/dist/components/reui/filters/filters-operators.js +300 -0
- package/dist/components/reui/filters/filters-operators.js.map +1 -0
- package/dist/components/reui/filters/filters-query.d.ts +132 -0
- package/dist/components/reui/filters/filters-query.d.ts.map +1 -0
- package/dist/components/reui/filters/filters-query.js +476 -0
- package/dist/components/reui/filters/filters-query.js.map +1 -0
- package/dist/components/reui/filters/filters-types.d.ts +452 -0
- package/dist/components/reui/filters/filters-types.d.ts.map +1 -0
- package/dist/components/reui/filters/filters-types.js +2 -0
- package/dist/components/reui/filters/filters.d.ts +114 -0
- package/dist/components/reui/filters/filters.d.ts.map +1 -0
- package/dist/components/reui/filters/filters.js +638 -0
- package/dist/components/reui/filters/filters.js.map +1 -0
- package/dist/components/reui/gantt/gantt-bar.js +1 -1
- package/dist/components/reui/gantt/gantt-nav.js +1 -1
- package/dist/components/reui/gantt/gantt-types.d.ts +25 -71
- package/dist/components/reui/gantt/gantt-types.d.ts.map +1 -1
- package/dist/components/reui/gantt/gantt-view.js +1 -1
- package/dist/components/ui/button.d.ts +1 -1
- package/dist/components/ui/checkbox.js +1 -1
- package/dist/components/ui/checkbox.js.map +1 -1
- package/dist/components/ui/field.js +2 -2
- package/dist/components/ui/field.js.map +1 -1
- package/dist/components/ui/radio-group.js +1 -1
- package/dist/components/ui/radio-group.js.map +1 -1
- package/dist/components/ui/sidebar.js +1 -1
- package/dist/components/ui/switch.js +1 -1
- package/dist/components/ui/switch.js.map +1 -1
- package/dist/context-BizvUNZv.js +298 -0
- package/dist/context-BizvUNZv.js.map +1 -0
- package/dist/filters-draft-DEAl3TO-.d.ts +70 -0
- package/dist/filters-draft-DEAl3TO-.d.ts.map +1 -0
- package/dist/hooks/use-on-open.d.ts +18 -0
- package/dist/hooks/use-on-open.d.ts.map +1 -0
- package/dist/hooks/use-on-open.js +27 -0
- package/dist/hooks/use-on-open.js.map +1 -0
- package/dist/hooks/use-row-cursor.d.ts +39 -0
- package/dist/hooks/use-row-cursor.d.ts.map +1 -0
- package/dist/hooks/use-row-cursor.js +77 -0
- package/dist/hooks/use-row-cursor.js.map +1 -0
- package/dist/lib/text-shimmer.d.ts +2 -2
- package/dist/lib/text-shimmer.d.ts.map +1 -1
- package/dist/lib/text-shimmer.js +2 -2
- package/dist/lib/text-shimmer.js.map +1 -1
- package/dist/presence-gate-BekdC4Bo.js +24 -0
- package/dist/presence-gate-BekdC4Bo.js.map +1 -0
- package/package.json +11 -11
- package/dist/components/motion/combobox/context.js.map +0 -1
- package/dist/components/reui/filters.d.ts +0 -176
- package/dist/components/reui/filters.d.ts.map +0 -1
- package/dist/components/reui/filters.js +0 -1223
- package/dist/components/reui/filters.js.map +0 -1
package/README.md
CHANGED
|
@@ -4,16 +4,16 @@ 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/custom/*` | Hand-written Kumix-specific components
|
|
14
|
-
| `src/hooks/*` | Package helpers (+ ReUI `use-file-upload`, beUI helpers)
|
|
15
|
-
| `src/lib/*` | Shared utilities (beUI `ease`, `tick-sound`, `text-shimmer`, `favicon`) | — |
|
|
16
|
-
| `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/custom/*` | Hand-written Kumix-specific components | — |
|
|
14
|
+
| `src/hooks/*` | Package helpers (+ ReUI `use-file-upload`, beUI helpers) | — |
|
|
15
|
+
| `src/lib/*` | Shared utilities (beUI `ease`, `tick-sound`, `text-shimmer`, `favicon`, `presence-gate`) | — |
|
|
16
|
+
| `src/style.css` · `src/theme.css` | Tailwind entry + design tokens | — |
|
|
17
17
|
|
|
18
18
|
For **previews, props, and usage examples** of each component, use the upstream docs:
|
|
19
19
|
|
|
@@ -40,7 +40,7 @@ bun add @base-ui/react class-variance-authority lucide-react motion react @kumix
|
|
|
40
40
|
|
|
41
41
|
| Peer | Used by |
|
|
42
42
|
| --------------------------------------------------- | ---------------------------------------------- |
|
|
43
|
-
| `next-themes` | `use-meta-color`
|
|
43
|
+
| `next-themes` | `use-meta-color`, `motion/theme-toggle` |
|
|
44
44
|
| `@shadcn/react` | `message-scroller`, `questionnaire` |
|
|
45
45
|
| `@tanstack/react-table` · `@tanstack/react-virtual` | data-grid |
|
|
46
46
|
| `@dnd-kit/*` | kanban, sortable, data-grid DnD |
|
|
@@ -112,29 +112,30 @@ Mapped from source:
|
|
|
112
112
|
|
|
113
113
|
Base UI / shadcn base-nova. Preview: [ui.shadcn.com](https://ui.shadcn.com/docs/components).
|
|
114
114
|
|
|
115
|
-
`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` · `tooltip`
|
|
115
|
+
`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`
|
|
116
116
|
|
|
117
117
|
### ReUI (`components/reui`)
|
|
118
118
|
|
|
119
119
|
Extended patterns. Preview: [reui.io](https://reui.io/docs).
|
|
120
120
|
|
|
121
|
-
| Module
|
|
122
|
-
|
|
|
123
|
-
| `alert` · `badge`
|
|
124
|
-
| `autocomplete`
|
|
125
|
-
| `
|
|
126
|
-
| `
|
|
127
|
-
| `
|
|
128
|
-
| `
|
|
129
|
-
| `
|
|
130
|
-
| `
|
|
131
|
-
| `
|
|
121
|
+
| Module | Notes |
|
|
122
|
+
| ---------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------ |
|
|
123
|
+
| `alert` · `badge` | Extended variants (info/success/warning/…) |
|
|
124
|
+
| `autocomplete` | Base UI autocomplete |
|
|
125
|
+
| `cascader/*` | Multi-column cascading select, i18n, async |
|
|
126
|
+
| `data-grid/*` | Table, pagination, filters, DnD, virtual |
|
|
127
|
+
| `date-selector` | Day / month / quarter / range |
|
|
128
|
+
| `event-calendar/*` | Month, week, day, agenda, resource |
|
|
129
|
+
| `filters/*` | Advanced filter builder (chip, date, DnD) |
|
|
130
|
+
| `frame` | Nested panel layout |
|
|
131
|
+
| `gantt/*` | Day–year scales, resources, DnD |
|
|
132
|
+
| `icon-stack` · `icon-tile` · `kanban` · `number-field` · `phone-input` · `rating` · `scrollspy` · `sortable` · `stepper` · `timeline` · `tree` | — |
|
|
132
133
|
|
|
133
134
|
### beUI (`components/motion`)
|
|
134
135
|
|
|
135
136
|
Animated components built with [Motion](https://motion.dev). Preview: [beui.dev](https://beui.dev/components/motion). Bundled — `motion`, `lenis`, `@paper-design/shaders-react` are included, no extra installs needed.
|
|
136
137
|
|
|
137
|
-
`action-swap` · `animated-badge` · `animated-number` · `animated-sidebar` · `animated-toast-stack` · `attachment-upload` · `availability-scheduler/*` (copy-menu, day-row, time-select) · `bloom-menu` · `bottom-sheet` · `bounce-sidebar` · `bouncy-accordion` · `button/*` (base, stateful, magnetic, `ButtonLink`) · `center-morph-modal` · `checkbox` · `chromatic-text-reveal` · `command-palette` · `context-menu` · `cylinder-carousel` · `dock` · `drawer` · `dynamic-island` · `expandable-action-bar` · `expandable-tabs` · `feedback-widget` · `file-upload` · `hold-action-button` · `infinite-masonry` · `input` · `loader` · `magnetic` · `marquee` · `morphing-modal` · `morphing-tabs` · `not-found/*` (glitch, magnetic, spotlight, stacked, terminal) · `notification-stack` · `number-ticker` · `otp-input` · `overflow-actions` · `parallax` · `popover` · `popover-morph` · `preview-rail` · `pull-to-refresh` · `radio` · `range-slider` (5 variants) · `scroll-progress` · `scroll-reveal` · `scroll-to` · `select` · `select-morph` · `shader-background` · `shared-layout-bg` · `slide-action-button` · `smooth-scroll` · `swipeable-list` · `switch` · `table/*` (virtualized, editable, async) · `tabs` · `text-cascade` · `text-reveal` · `text-shimmer` · `theme-toggle` · `tilt-card` · `tooltip` · `wheel-picker`
|
|
138
|
+
`action-swap` (4 variants: base, blur, cascade, roll) · `animated-badge` · `animated-number` · `animated-sidebar` · `animated-toast-stack` · `attachment-upload` · `availability-scheduler/*` (copy-menu, day-row, time-select) · `bloom-menu` · `bottom-sheet` · `bounce-sidebar` · `bouncy-accordion` · `button/*` (base, stateful, magnetic, `ButtonLink`) · `center-morph-modal` · `checkbox` · `chromatic-text-reveal` · `combobox` + `combobox/*` (trigger, list, content, context) · `command-palette` · `context-menu` · `cylinder-carousel` · `dock` · `drawer` · `dynamic-island` · `expandable-action-bar` · `expandable-tabs` · `feedback-widget` · `file-upload` · `hold-action-button` · `infinite-masonry` · `input` · `loader` · `magnetic` · `marquee` · `morphing-modal` · `morphing-search` · `morphing-tabs` · `not-found/*` (glitch, magnetic, spotlight, stacked, terminal) · `notification-stack` · `number-ticker` · `otp-input` · `overflow-actions` · `parallax` · `popover` · `popover-morph` · `preview-rail` · `project-folder` · `pull-to-refresh` · `radio` · `range-slider` (5 variants) · `scroll-progress` · `scroll-reveal` · `scroll-to` · `select` · `select-morph` · `shader-background` · `shared-layout-bg` · `signup-form` · `slide-action-button` · `smooth-scroll` · `swipeable-list` · `switch` · `table/*` (virtualized, editable, async) · `tabs` · `text-cascade` · `text-reveal` · `text-scramble` · `text-shimmer` · `theme-toggle` · `tilt-card` · `tooltip` · `wheel-picker`
|
|
138
139
|
|
|
139
140
|
### beUI — AI Agents (`components/agents`)
|
|
140
141
|
|
|
@@ -152,7 +153,7 @@ Hand-written Kumix-specific composite components (not from any registry).
|
|
|
152
153
|
|
|
153
154
|
### Hooks
|
|
154
155
|
|
|
155
|
-
`use-body-classes` · `use-copy-to-clipboard` · `use-file-upload` · `use-hover-capable` · `use-hydrated` · `use-intersection-observer` · `use-is-mac` · `use-media-query` · `use-meta-color` · `use-mobile` · `use-mutation-observer` · `use-scroll-position` · `use-slider` · `use-slider-input` · `use-viewport`
|
|
156
|
+
`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-mutation-observer` · `use-scroll-position` · `use-slider` · `use-slider-input` · `use-tap-gesture` · `use-touch-capable` · `use-viewport`
|
|
156
157
|
|
|
157
158
|
- `useIsMobile` (`use-mobile`) — fixed `768px` breakpoint; used by `sidebar` / `date-selector`. First paint may be `false` until mount.
|
|
158
159
|
- `useMediaQuery` — arbitrary query string; SSR-safe via `useSyncExternalStore` (server snapshot `false`).
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
import * as React$1 from "react";
|
|
2
|
+
//#region src/components/reui/cascader/cascader-types.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* A node in the cascader tree. Two input shapes normalize to one internal
|
|
5
|
+
* index: nested (nodes carry `children`), or flat adjacency plus the root's
|
|
6
|
+
* `getParent`, which skips the re-nesting step for large datasets.
|
|
7
|
+
*/
|
|
8
|
+
interface CascaderNode<T = unknown> {
|
|
9
|
+
/** Stable id. Also the committed selection value. */
|
|
10
|
+
value: string;
|
|
11
|
+
label: string;
|
|
12
|
+
icon?: React$1.ReactNode;
|
|
13
|
+
description?: string;
|
|
14
|
+
children?: CascaderNode<T>[];
|
|
15
|
+
/** Declares a branch before load; async nodes read as leaves without it. */
|
|
16
|
+
hasChildren?: boolean;
|
|
17
|
+
/** Trailing count. Defaults to known children; set it for async nodes. */
|
|
18
|
+
count?: number;
|
|
19
|
+
disabled?: boolean;
|
|
20
|
+
keywords?: string[];
|
|
21
|
+
/**
|
|
22
|
+
* Only read on a node nested inside a `getChildren` result. For the level a
|
|
23
|
+
* node OWNS the authoritative signal is that level's `CascaderLoadResult`.
|
|
24
|
+
*/
|
|
25
|
+
hasMore?: boolean;
|
|
26
|
+
data?: T;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* One footer ACTION. Deliberately not a `CascaderNode`, so a command can never
|
|
30
|
+
* be passed where an option is expected and join the ring, filter or selection.
|
|
31
|
+
*/
|
|
32
|
+
interface CascaderActionItem {
|
|
33
|
+
/** Stable key. Falls back to the label when it is a string, then the index. */
|
|
34
|
+
value?: string;
|
|
35
|
+
label: React$1.ReactNode;
|
|
36
|
+
icon?: React$1.ReactNode;
|
|
37
|
+
disabled?: boolean;
|
|
38
|
+
/** Ignored when `items` is present - a flyout opens instead. */
|
|
39
|
+
onSelect?: () => void;
|
|
40
|
+
/** Turns the row into a submenu trigger. One level deep on purpose. */
|
|
41
|
+
items?: CascaderActionItem[];
|
|
42
|
+
/** Consecutive entries sharing a heading are drawn under one. */
|
|
43
|
+
group?: string;
|
|
44
|
+
}
|
|
45
|
+
/** Panel layout. See the docs for the keyboard map of each. */
|
|
46
|
+
type CascaderMode = "drill" | "columns" | "tree";
|
|
47
|
+
type CascaderSearchScope = "level" | "deep";
|
|
48
|
+
/**
|
|
49
|
+
* Which nodes may be committed. The predicate arm is generic over the payload
|
|
50
|
+
* rather than quantified per call: a per-call `<T>` would force every predicate
|
|
51
|
+
* to accept EVERY payload, so `(node: CascaderNode<Member>) => boolean` could
|
|
52
|
+
* never satisfy it.
|
|
53
|
+
*/
|
|
54
|
+
type CascaderSelectable<T = unknown> = "leaf" | "any" | ((node: CascaderNode<T>) => boolean);
|
|
55
|
+
type CascaderCollapse = "middle" | "start" | "none";
|
|
56
|
+
type CascaderValueDisplay = "path" | "leaf" | "count";
|
|
57
|
+
type CascaderChangeReason = "select" | "deselect" | "clear";
|
|
58
|
+
/** Second argument to `onValueChange`: resolved nodes, so no re-lookup. */
|
|
59
|
+
interface CascaderChangeDetails<T = unknown> {
|
|
60
|
+
/** The node committed or toggled. Null when the selection was cleared. */
|
|
61
|
+
node: CascaderNode<T> | null;
|
|
62
|
+
/** Ancestor chain of `node`, root first, node last. */
|
|
63
|
+
path: CascaderNode<T>[];
|
|
64
|
+
nodes: CascaderNode<T>[];
|
|
65
|
+
reason: CascaderChangeReason;
|
|
66
|
+
}
|
|
67
|
+
/** Normalized tree, built once per `items` identity, shared by every mode. */
|
|
68
|
+
interface CascaderIndex<T = unknown> {
|
|
69
|
+
byValue: Map<string, CascaderNode<T>>;
|
|
70
|
+
/** Children by parent value. Root children are keyed by `ROOT_KEY`. */
|
|
71
|
+
childrenOf: Map<string, CascaderNode<T>[]>;
|
|
72
|
+
parentOf: Map<string, string | null>;
|
|
73
|
+
/** Zero-based depth by node value. */
|
|
74
|
+
depthOf: Map<string, number>;
|
|
75
|
+
/** Top level nodes, in input order. */
|
|
76
|
+
roots: CascaderNode<T>[];
|
|
77
|
+
/** Every node in a stable, depth-first order. Used by deep search. */
|
|
78
|
+
all: CascaderNode<T>[];
|
|
79
|
+
}
|
|
80
|
+
interface CascaderFlatNode<T = unknown> {
|
|
81
|
+
node: CascaderNode<T>;
|
|
82
|
+
depth: number;
|
|
83
|
+
/** Known children, or a declared `hasChildren`. */
|
|
84
|
+
branch: boolean;
|
|
85
|
+
expanded: boolean;
|
|
86
|
+
/** Sibling count, plus one when the level has a paging row. */
|
|
87
|
+
setSize: number;
|
|
88
|
+
/** One-based index among siblings. */
|
|
89
|
+
posInSet: number;
|
|
90
|
+
}
|
|
91
|
+
/** One segment of a rendered path, after collapsing. */
|
|
92
|
+
type CascaderPathSegment<T = unknown> = {
|
|
93
|
+
type: "node";
|
|
94
|
+
node: CascaderNode<T>;
|
|
95
|
+
} | {
|
|
96
|
+
type: "ellipsis";
|
|
97
|
+
hidden: CascaderNode<T>[];
|
|
98
|
+
};
|
|
99
|
+
/**
|
|
100
|
+
* Async load state for one node's children. Deliberately WITHOUT a `status`
|
|
101
|
+
* field: "declared a branch, never fetched" and "fetched and genuinely empty"
|
|
102
|
+
* are told apart by MAP MEMBERSHIP, and a second source of that truth would
|
|
103
|
+
* eventually disagree with the first.
|
|
104
|
+
*/
|
|
105
|
+
interface CascaderLoadState {
|
|
106
|
+
loading: boolean;
|
|
107
|
+
error: boolean;
|
|
108
|
+
hasMore: boolean;
|
|
109
|
+
/** Opaque cursor handed back to `getChildren` for the next page. */
|
|
110
|
+
cursor?: string;
|
|
111
|
+
}
|
|
112
|
+
/** Why a level was fetched. `resolve`: `resolveValue` hit an unloaded node. */
|
|
113
|
+
type CascaderLoadReason = "level" | "more" | "prefetch" | "retry" | "resolve";
|
|
114
|
+
/** Argument handed to `getChildren`. */
|
|
115
|
+
interface CascaderLoadContext {
|
|
116
|
+
/** Aborted when the request is superseded or the popup closes. */
|
|
117
|
+
signal: AbortSignal;
|
|
118
|
+
cursor?: string;
|
|
119
|
+
reason?: CascaderLoadReason;
|
|
120
|
+
}
|
|
121
|
+
/** Value returned by `getChildren`. A bare array is also accepted. */
|
|
122
|
+
interface CascaderLoadResult<T = unknown> {
|
|
123
|
+
items: CascaderNode<T>[];
|
|
124
|
+
nextCursor?: string;
|
|
125
|
+
/** Defaults to whether `nextCursor` was supplied. */
|
|
126
|
+
hasMore?: boolean;
|
|
127
|
+
}
|
|
128
|
+
/** Argument handed to `onSearch`. */
|
|
129
|
+
interface CascaderSearchContext {
|
|
130
|
+
signal: AbortSignal;
|
|
131
|
+
/** The path the user is searching within, deepest last. */
|
|
132
|
+
path: string[];
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Every user facing string, so the primitive ships no hardcoded copy. The
|
|
136
|
+
* callbacks take plain labels, not nodes: a `CascaderNode<T>` parameter would
|
|
137
|
+
* force this object to carry the item generic. `*Announcement` is live-region.
|
|
138
|
+
*/
|
|
139
|
+
interface CascaderLabels {
|
|
140
|
+
search: string | ((parentLabel?: string) => string);
|
|
141
|
+
back: string;
|
|
142
|
+
/** A level's FIRST page. `loadingMore` is the next, `loadMore` its idle row. */
|
|
143
|
+
loading: string;
|
|
144
|
+
loadingMore: string;
|
|
145
|
+
loadMore: string;
|
|
146
|
+
error: string;
|
|
147
|
+
retry: string;
|
|
148
|
+
empty: string;
|
|
149
|
+
/** Rendered by `CascaderValue` when `display="count"`. */
|
|
150
|
+
selectedCount: (count: number) => string;
|
|
151
|
+
breadcrumbLabel: string;
|
|
152
|
+
chipsLabel: string;
|
|
153
|
+
removeChip: (label: string) => string;
|
|
154
|
+
/** Trail separator. Not every locale writes one with a slash. */
|
|
155
|
+
pathSeparator: string;
|
|
156
|
+
/** Names the root level wherever there is no parent node to name it. */
|
|
157
|
+
rootLevel: string;
|
|
158
|
+
itemCount: (count: number) => string;
|
|
159
|
+
/** Appended to a branch row's name outside tree mode: it opens another list. */
|
|
160
|
+
branchAffordance: string;
|
|
161
|
+
/** Columns-trail rows are plain buttons, so they carry no `aria-selected`. */
|
|
162
|
+
selectedState: string;
|
|
163
|
+
/** Same for the mixed state, which a `role="button"` row may not carry. */
|
|
164
|
+
partiallySelectedState: string;
|
|
165
|
+
columnsLabel: string;
|
|
166
|
+
actionsLabel: string;
|
|
167
|
+
submenuAffordance: string;
|
|
168
|
+
panelLabel: string;
|
|
169
|
+
/** Read per mode AND per direction: the level keys mirror in RTL. */
|
|
170
|
+
keyboardHint: (mode: CascaderMode, dir: "ltr" | "rtl") => string;
|
|
171
|
+
rootAnnouncement: (count: number) => string;
|
|
172
|
+
expandedAnnouncement: (label: string, count: number) => string;
|
|
173
|
+
collapsedAnnouncement: (label: string) => string;
|
|
174
|
+
levelAnnouncement: (parentLabel: string, depth: number, count: number) => string;
|
|
175
|
+
resultsAnnouncement: (count: number) => string;
|
|
176
|
+
maxReachedAnnouncement: (max: number) => string;
|
|
177
|
+
/** `count` is the descendants swept along; `selecting` is the direction. */
|
|
178
|
+
cascadeAnnouncement: (label: string, count: number, selecting: boolean) => string;
|
|
179
|
+
searchingAnnouncement: string;
|
|
180
|
+
}
|
|
181
|
+
//#endregion
|
|
182
|
+
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 };
|
|
183
|
+
//# sourceMappingURL=cascader-types-BnH6wYD-.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cascader-types-BnH6wYD-.d.ts","names":[],"sources":["../src/components/reui/cascader/cascader-types.tsx"],"mappings":";;;;;;;UASiB,aAAa;;EAE5B;EACA;EACA,OAAO,QAAM;EACb;EACA,WAAW,aAAa;;EAExB;;EAEA;EACA;EACA;;;;;EAKA;EACA,OAAO;;;;;;UAOQ;;EAEf;EACA,OAAO,QAAM;EACb,OAAO,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;;UAGH,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;;EAEf,QAAQ;EACR;EACA,SAAS;;;UAIM,mBAAmB;EAClC,OAAO,aAAa;EACpB;;EAEA;;;UAIe;EACf,QAAQ;;EAER;;;;;;;UAQe;EACf,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"}
|
|
@@ -343,10 +343,8 @@ function AISidebar({ items, defaultItems = [], onItemsChange, onMove, onMoveErro
|
|
|
343
343
|
if (items) setInternalItems(items);
|
|
344
344
|
}, [items]);
|
|
345
345
|
const flat = useMemo(() => flattenResources(renderedItems, expandedIds), [expandedIds, renderedItems]);
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
setFocusedId(flat[0]?.item.id ?? null);
|
|
349
|
-
}, [flat, focusedId]);
|
|
346
|
+
const focusedRow = focusedId !== null && flat.some((row) => row.item.id === focusedId) ? focusedId : flat[0]?.item.id ?? null;
|
|
347
|
+
if (focusedId !== focusedRow) setFocusedId(focusedRow);
|
|
350
348
|
useEffect(() => {
|
|
351
349
|
if (!menuOpenId) return;
|
|
352
350
|
const frame = requestAnimationFrame(() => {
|
|
@@ -568,7 +566,7 @@ function AISidebar({ items, defaultItems = [], onItemsChange, onMove, onMoveErro
|
|
|
568
566
|
row,
|
|
569
567
|
active: selectedId === row.item.id,
|
|
570
568
|
expanded: expandedIds.has(row.item.id),
|
|
571
|
-
focused:
|
|
569
|
+
focused: focusedRow === row.item.id,
|
|
572
570
|
draggingId,
|
|
573
571
|
dropTarget,
|
|
574
572
|
menuOpen: menuOpenId === row.item.id,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ai-sidebar.js","names":[],"sources":["../../../src/components/agents/ai-sidebar.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n type DragEvent,\n type KeyboardEvent,\n type ReactNode,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport {\n ArrowDown,\n ArrowUp,\n Bookmark,\n FileText,\n Folder,\n FolderInput,\n FolderOpen,\n type LucideIcon,\n MoreHorizontal,\n Pencil,\n Undo2,\n} from \"lucide-react\";\nimport { AnimatePresence, motion, useReducedMotion } from \"motion/react\";\n\nimport { cn } from \"@kumix/utils\";\nimport { useTouchCapable } from \"../../hooks/use-touch-capable\";\nimport { EASE_OUT, SPRING_LAYOUT } from \"../../lib/ease\";\nimport { MorphPopover, MorphPopoverContent, MorphPopoverTrigger } from \"../motion/popover-morph\";\n\nexport type SidebarResourceKind = \"folder\" | \"project\" | \"file\" | \"bookmark\";\n\nexport interface SidebarResource {\n id: string;\n label: string;\n kind: SidebarResourceKind;\n children?: SidebarResource[];\n disabled?: boolean;\n}\n\nexport type SidebarResourceDropPosition = \"before\" | \"inside\" | \"after\";\n\nexport interface SidebarResourceMove {\n itemId: string;\n targetId: string | null;\n position: SidebarResourceDropPosition;\n}\n\n/**\n * The moves this row can make right now, the same four the keyboard offers on\n * `Alt+Shift+Arrow`. A pointer drag is the fast path for them; a finger has no\n * drag to give, so the row menu carries them too. Absent keys are moves this\n * row cannot make from where it sits.\n */\nexport interface SidebarResourceMoveCommands {\n up?: () => void;\n down?: () => void;\n into?: { label: string; run: () => void };\n out?: () => void;\n}\n\nexport interface SidebarResourceMenuControls {\n close: () => void;\n rename: () => void;\n moves: SidebarResourceMoveCommands;\n}\n\nexport interface AISidebarProps {\n items?: SidebarResource[];\n defaultItems?: SidebarResource[];\n onItemsChange?: (items: SidebarResource[]) => void;\n /** Reject the promise to roll the optimistic move back. */\n onMove?: (move: SidebarResourceMove) => void | Promise<void>;\n onMoveError?: (error: unknown, move: SidebarResourceMove) => void;\n onRename?: (item: SidebarResource, label: string) => void | Promise<void>;\n activeId?: string | null;\n defaultActiveId?: string | null;\n onActiveChange?: (id: string) => void;\n defaultExpandedIds?: string[];\n renderIcon?: (item: SidebarResource) => ReactNode;\n renderMenu?: (item: SidebarResource, controls: SidebarResourceMenuControls) => ReactNode;\n ariaLabel?: string;\n className?: string;\n}\n\ninterface FlatResource {\n item: SidebarResource;\n depth: number;\n parentId: string | null;\n}\n\ninterface DropTarget {\n id: string | null;\n position: SidebarResourceDropPosition;\n}\n\nconst ROW_REVEAL = {\n duration: 0.16,\n ease: EASE_OUT,\n} as const;\n\nfunction canContain(item: SidebarResource) {\n return item.kind === \"folder\" || item.kind === \"project\";\n}\n\nfunction flattenResources(\n items: SidebarResource[],\n expanded: Set<string>,\n depth = 0,\n parentId: string | null = null,\n): FlatResource[] {\n return items.flatMap((item) => {\n const row = { item, depth, parentId };\n if (!item.children?.length || !expanded.has(item.id)) return [row];\n return [row, ...flattenResources(item.children, expanded, depth + 1, item.id)];\n });\n}\n\nfunction findResource(items: SidebarResource[], id: string): SidebarResource | undefined {\n for (const item of items) {\n if (item.id === id) return item;\n const child = item.children ? findResource(item.children, id) : undefined;\n if (child) return child;\n }\n}\n\nfunction containsResource(item: SidebarResource, id: string): boolean {\n return item.id === id || item.children?.some((child) => containsResource(child, id)) === true;\n}\n\nfunction removeResource(\n items: SidebarResource[],\n id: string,\n): { items: SidebarResource[]; removed?: SidebarResource } {\n let removed: SidebarResource | undefined;\n const next: SidebarResource[] = [];\n\n for (const item of items) {\n if (item.id === id) {\n removed = item;\n continue;\n }\n\n if (item.children?.length) {\n const childResult = removeResource(item.children, id);\n if (childResult.removed) {\n removed = childResult.removed;\n next.push({ ...item, children: childResult.items });\n continue;\n }\n }\n\n next.push(item);\n }\n\n return { items: next, removed };\n}\n\nfunction insertResource(\n items: SidebarResource[],\n resource: SidebarResource,\n targetId: string | null,\n position: SidebarResourceDropPosition,\n): SidebarResource[] {\n if (targetId === null) return [...items, resource];\n\n const next: SidebarResource[] = [];\n for (const item of items) {\n if (item.id === targetId) {\n if (position === \"before\") next.push(resource, item);\n else if (position === \"after\") next.push(item, resource);\n else next.push({ ...item, children: [...(item.children ?? []), resource] });\n continue;\n }\n\n if (item.children?.length) {\n next.push({\n ...item,\n children: insertResource(item.children, resource, targetId, position),\n });\n } else {\n next.push(item);\n }\n }\n return next;\n}\n\nfunction moveResource(\n items: SidebarResource[],\n move: SidebarResourceMove,\n): SidebarResource[] | null {\n const source = findResource(items, move.itemId);\n if (!source || source.disabled) return null;\n if (move.targetId && containsResource(source, move.targetId)) return null;\n\n const target = move.targetId ? findResource(items, move.targetId) : undefined;\n if (move.position === \"inside\" && (!target || target.disabled || !canContain(target)))\n return null;\n\n const removed = removeResource(items, move.itemId);\n if (!removed.removed) return null;\n return insertResource(removed.items, removed.removed, move.targetId, move.position);\n}\n\nfunction renameResource(items: SidebarResource[], id: string, label: string): SidebarResource[] {\n return items.map((item) => ({\n ...item,\n label: item.id === id ? label : item.label,\n children: item.children ? renameResource(item.children, id, label) : undefined,\n }));\n}\n\nfunction defaultIcon(item: SidebarResource, expanded: boolean) {\n const Icon =\n item.kind === \"folder\" || item.kind === \"project\"\n ? expanded\n ? FolderOpen\n : Folder\n : item.kind === \"bookmark\"\n ? Bookmark\n : FileText;\n return <Icon className=\"size-4\" />;\n}\n\nfunction MarqueeLabel({ active, children }: { active: boolean; children: string }) {\n const reduce = useReducedMotion() ?? false;\n const viewportRef = useRef<HTMLSpanElement>(null);\n const labelRef = useRef<HTMLSpanElement>(null);\n const [distance, setDistance] = useState(0);\n\n useEffect(() => {\n const measure = () => {\n const viewport = viewportRef.current;\n const label = labelRef.current;\n if (!viewport || !label) return;\n setDistance(label.scrollWidth > viewport.clientWidth ? label.scrollWidth + 24 : 0);\n };\n measure();\n const observer = new ResizeObserver(measure);\n if (viewportRef.current) observer.observe(viewportRef.current);\n if (labelRef.current) observer.observe(labelRef.current);\n return () => observer.disconnect();\n }, []);\n\n const running = active && distance > 0 && !reduce;\n\n return (\n <span ref={viewportRef} className=\"block min-w-0 flex-1 overflow-hidden\">\n <motion.span\n className=\"flex w-max items-center gap-6 whitespace-nowrap\"\n animate={{ x: running ? [0, -distance] : 0 }}\n transition={\n running\n ? {\n duration: Math.max(2.4, distance / 34),\n ease: \"linear\",\n repeat: Number.POSITIVE_INFINITY,\n repeatDelay: 2,\n }\n : ROW_REVEAL\n }\n >\n <span ref={labelRef}>{children}</span>\n {running ? <span aria-hidden=\"true\">{children}</span> : null}\n </motion.span>\n </span>\n );\n}\n\nfunction ResourceMenuAction({\n icon: Icon,\n onSelect,\n children,\n}: {\n icon: LucideIcon;\n onSelect: () => void;\n children: ReactNode;\n}) {\n return (\n <button\n type=\"button\"\n onClick={onSelect}\n className=\"flex h-8 w-full items-center gap-2 rounded-lg px-2.5 text-left text-foreground text-xs outline-none transition-colors hover:bg-muted focus-visible:bg-muted focus-visible:ring-2 focus-visible:ring-ring\"\n >\n <Icon aria-hidden=\"true\" className=\"size-3.5 shrink-0\" />\n <span className=\"min-w-0 truncate\">{children}</span>\n </button>\n );\n}\n\ninterface ResourceRowProps {\n row: FlatResource;\n active: boolean;\n expanded: boolean;\n focused: boolean;\n draggingId: string | null;\n dropTarget: DropTarget | null;\n menuOpen: boolean;\n moves: SidebarResourceMoveCommands;\n renaming: boolean;\n onDragEnd: () => void;\n onDragOver: (event: DragEvent<HTMLDivElement>, row: FlatResource) => void;\n onDragStart: (event: DragEvent<HTMLDivElement>, id: string) => void;\n onDrop: (event: DragEvent<HTMLDivElement>) => void;\n onFocus: () => void;\n onKeyDown: (event: KeyboardEvent<HTMLDivElement>) => void;\n onMenuOpenChange: (open: boolean) => void;\n onRenameCancel: () => void;\n onRenameCommit: (label: string) => void;\n onRenameStart: () => void;\n onSelect: () => void;\n onToggle: () => void;\n renderIcon?: (item: SidebarResource) => ReactNode;\n renderMenu?: AISidebarProps[\"renderMenu\"];\n setRef: (node: HTMLDivElement | null) => void;\n}\n\nfunction ResourceRow({\n row,\n active,\n expanded,\n focused,\n draggingId,\n dropTarget,\n menuOpen,\n moves,\n renaming,\n onDragEnd,\n onDragOver,\n onDragStart,\n onDrop,\n onFocus,\n onKeyDown,\n onMenuOpenChange,\n onRenameCancel,\n onRenameCommit,\n onRenameStart,\n onSelect,\n onToggle,\n renderIcon,\n renderMenu,\n setRef,\n}: ResourceRowProps) {\n const reduce = useReducedMotion() ?? false;\n const canTouch = useTouchCapable();\n const [hovered, setHovered] = useState(false);\n const inputRef = useRef<HTMLInputElement>(null);\n const skipRenameBlurRef = useRef(false);\n const draggedRef = useRef(false);\n const [draft, setDraft] = useState(row.item.label);\n const acceptsChildren = canContain(row.item);\n const isDragging = draggingId === row.item.id;\n const dropPosition = dropTarget?.id === row.item.id ? dropTarget.position : null;\n\n useEffect(() => {\n if (!renaming) return;\n skipRenameBlurRef.current = false;\n setDraft(row.item.label);\n requestAnimationFrame(() => {\n inputRef.current?.focus();\n inputRef.current?.select();\n });\n }, [renaming, row.item.label]);\n\n const runFromMenu = (action: () => void) => () => {\n onMenuOpenChange(false);\n action();\n };\n\n const menu = renderMenu?.(row.item, {\n close: () => onMenuOpenChange(false),\n rename: () => {\n onMenuOpenChange(false);\n onRenameStart();\n },\n moves,\n }) ?? (\n <>\n <ResourceMenuAction icon={Pencil} onSelect={runFromMenu(onRenameStart)}>\n Rename\n </ResourceMenuAction>\n {moves.up || moves.down || moves.into || moves.out ? (\n <div aria-hidden=\"true\" className=\"my-1 h-px bg-border\" />\n ) : null}\n {moves.up ? (\n <ResourceMenuAction icon={ArrowUp} onSelect={runFromMenu(moves.up)}>\n Move up\n </ResourceMenuAction>\n ) : null}\n {moves.down ? (\n <ResourceMenuAction icon={ArrowDown} onSelect={runFromMenu(moves.down)}>\n Move down\n </ResourceMenuAction>\n ) : null}\n {moves.into ? (\n <ResourceMenuAction icon={FolderInput} onSelect={runFromMenu(moves.into.run)}>\n Move into {moves.into.label}\n </ResourceMenuAction>\n ) : null}\n {moves.out ? (\n <ResourceMenuAction icon={Undo2} onSelect={runFromMenu(moves.out)}>\n Move out\n </ResourceMenuAction>\n ) : null}\n </>\n );\n\n return (\n <motion.div\n ref={setRef}\n layout=\"position\"\n transition={reduce ? { duration: 0 } : SPRING_LAYOUT}\n role=\"treeitem\"\n aria-level={row.depth + 1}\n aria-selected={acceptsChildren ? undefined : active}\n aria-expanded={acceptsChildren ? expanded : undefined}\n aria-disabled={row.item.disabled || undefined}\n tabIndex={focused ? 0 : -1}\n draggable={!row.item.disabled && !renaming}\n data-menu-open={menuOpen || undefined}\n data-drop={dropPosition ?? undefined}\n data-dragging={isDragging || undefined}\n onFocus={onFocus}\n onKeyDown={onKeyDown}\n onClick={(event) => {\n if (event.defaultPrevented || draggedRef.current || renaming || row.item.disabled) return;\n if (acceptsChildren) onToggle();\n else onSelect();\n }}\n onDoubleClick={(event) => {\n if (acceptsChildren || row.item.disabled) return;\n event.preventDefault();\n onRenameStart();\n }}\n onMouseEnter={() => setHovered(true)}\n onMouseLeave={() => setHovered(false)}\n onDragStartCapture={(event) => {\n draggedRef.current = true;\n onDragStart(event, row.item.id);\n }}\n onDragEndCapture={() => {\n onDragEnd();\n requestAnimationFrame(() => {\n draggedRef.current = false;\n });\n }}\n onDragOver={(event) => onDragOver(event, row)}\n onDrop={onDrop}\n className={cn(\n \"group/resource relative flex min-h-9 min-w-0 cursor-pointer items-center gap-2.5 rounded-xl pr-3 text-sm outline-none\",\n \"text-muted-foreground transition-colors hover:bg-muted hover:text-foreground\",\n \"focus-visible:bg-muted/70 focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset\",\n \"data-[menu-open=true]:bg-muted data-[menu-open=true]:text-foreground\",\n \"data-[dragging=true]:opacity-40\",\n \"data-[drop=inside]:bg-primary/10 data-[drop=inside]:ring-1 data-[drop=inside]:ring-primary/45\",\n \"data-[drop=before]:before:absolute data-[drop=before]:before:-top-0.5 data-[drop=before]:before:right-2 data-[drop=before]:before:left-2 data-[drop=before]:before:h-0.5 data-[drop=before]:before:rounded-full data-[drop=before]:before:bg-primary\",\n \"data-[drop=after]:after:absolute data-[drop=after]:after:right-2 data-[drop=after]:after:-bottom-0.5 data-[drop=after]:after:left-2 data-[drop=after]:after:h-0.5 data-[drop=after]:after:rounded-full data-[drop=after]:after:bg-primary\",\n !acceptsChildren && active && \"bg-muted text-foreground\",\n row.item.disabled && \"cursor-not-allowed opacity-45\",\n )}\n style={{ paddingLeft: `${12 + row.depth * 16}px` }}\n >\n <span aria-hidden=\"true\" className=\"grid size-5 shrink-0 place-items-center\">\n {renderIcon?.(row.item) ?? defaultIcon(row.item, expanded)}\n </span>\n\n {renaming ? (\n <input\n ref={inputRef}\n value={draft}\n aria-label={`Rename ${row.item.label}`}\n onChange={(event) => setDraft(event.target.value)}\n draggable={false}\n onClick={(event) => event.stopPropagation()}\n onDoubleClick={(event) => event.stopPropagation()}\n onBlur={() => {\n if (!skipRenameBlurRef.current) onRenameCommit(draft);\n }}\n onKeyDown={(event) => {\n event.stopPropagation();\n if (event.key === \"Enter\") {\n skipRenameBlurRef.current = true;\n onRenameCommit(draft);\n }\n if (event.key === \"Escape\") {\n skipRenameBlurRef.current = true;\n onRenameCancel();\n }\n }}\n className=\"mx-1 h-7 min-w-0 flex-1 rounded-md border border-border bg-background px-2 text-foreground text-sm outline-none focus-visible:ring-2 focus-visible:ring-ring\"\n />\n ) : (\n <MarqueeLabel active={hovered || menuOpen}>{row.item.label}</MarqueeLabel>\n )}\n\n {!renaming && !row.item.disabled ? (\n <MorphPopover open={menuOpen} onOpenChange={onMenuOpenChange}>\n <MorphPopoverTrigger>\n <button\n type=\"button\"\n draggable={false}\n tabIndex={-1}\n aria-label={`Actions for ${row.item.label}`}\n onClick={(event) => event.stopPropagation()}\n className={cn(\n \"grid size-7 shrink-0 place-items-center rounded-lg outline-none transition-opacity hover:bg-foreground/5 focus-visible:opacity-100 focus-visible:ring-2 focus-visible:ring-ring group-hover/resource:opacity-100 group-data-[menu-open=true]/resource:opacity-100\",\n // A finger never hovers, and this menu is the only path to\n // rename and move without a drag — keep it on screen there.\n canTouch ? \"opacity-100\" : \"opacity-0\",\n )}\n >\n <MoreHorizontal aria-hidden=\"true\" className=\"size-4\" />\n </button>\n </MorphPopoverTrigger>\n <MorphPopoverContent\n side=\"bottom\"\n align=\"end\"\n sideOffset={8}\n radius={12}\n className=\"w-40 p-1.5\"\n >\n <div data-sidebar-resource-menu={row.item.id}>{menu}</div>\n </MorphPopoverContent>\n </MorphPopover>\n ) : null}\n </motion.div>\n );\n}\n\nexport function AISidebar({\n items,\n defaultItems = [],\n onItemsChange,\n onMove,\n onMoveError,\n onRename,\n activeId,\n defaultActiveId = null,\n onActiveChange,\n defaultExpandedIds = [],\n renderIcon,\n renderMenu,\n ariaLabel = \"Resources\",\n className,\n}: AISidebarProps) {\n const [internalItems, setInternalItems] = useState(items ?? defaultItems);\n const [internalActiveId, setInternalActiveId] = useState(defaultActiveId);\n const [expandedIds, setExpandedIds] = useState(() => new Set(defaultExpandedIds));\n const [focusedId, setFocusedId] = useState<string | null>(activeId ?? defaultActiveId);\n const [draggingId, setDraggingId] = useState<string | null>(null);\n const [dropTarget, setDropTarget] = useState<DropTarget | null>(null);\n const [menuOpenId, setMenuOpenId] = useState<string | null>(null);\n const [renamingId, setRenamingId] = useState<string | null>(null);\n const [announcement, setAnnouncement] = useState(\"\");\n const rowRefs = useRef(new Map<string, HTMLDivElement>());\n const movePendingRef = useRef(false);\n const renderedItems = internalItems;\n const selectedId = activeId ?? internalActiveId;\n\n useEffect(() => {\n if (items) setInternalItems(items);\n }, [items]);\n\n const flat = useMemo(\n () => flattenResources(renderedItems, expandedIds),\n [expandedIds, renderedItems],\n );\n\n useEffect(() => {\n if (focusedId && flat.some((row) => row.item.id === focusedId)) return;\n setFocusedId(flat[0]?.item.id ?? null);\n }, [flat, focusedId]);\n\n useEffect(() => {\n if (!menuOpenId) return;\n const frame = requestAnimationFrame(() => {\n const menus = Array.from(\n document.querySelectorAll<HTMLElement>(\"[data-sidebar-resource-menu]\"),\n );\n menus\n .find((menu) => menu.dataset.sidebarResourceMenu === menuOpenId)\n ?.querySelector<HTMLElement>(\"button, a[href]\")\n ?.focus();\n });\n return () => cancelAnimationFrame(frame);\n }, [menuOpenId]);\n\n const updateItems = useCallback(\n (next: SidebarResource[]) => {\n setInternalItems(next);\n onItemsChange?.(next);\n },\n [onItemsChange],\n );\n\n const performMove = useCallback(\n async (move: SidebarResourceMove) => {\n if (movePendingRef.current) {\n setAnnouncement(\"Wait for the current move to finish.\");\n return;\n }\n const before = renderedItems;\n const next = moveResource(before, move);\n if (!next || next === before) return;\n\n movePendingRef.current = true;\n updateItems(next);\n setDropTarget(null);\n setDraggingId(null);\n const moved = findResource(before, move.itemId);\n const target = move.targetId ? findResource(before, move.targetId) : null;\n setAnnouncement(\n target\n ? `Moved ${moved?.label ?? \"item\"} ${move.position} ${target.label}.`\n : `Moved ${moved?.label ?? \"item\"} to the top level.`,\n );\n\n try {\n await onMove?.(move);\n } catch (error) {\n updateItems(before);\n setAnnouncement(`Move failed. ${moved?.label ?? \"Item\"} was restored.`);\n onMoveError?.(error, move);\n } finally {\n movePendingRef.current = false;\n }\n },\n [onMove, onMoveError, renderedItems, updateItems],\n );\n\n const focusRow = useCallback((id: string) => {\n setFocusedId(id);\n requestAnimationFrame(() => rowRefs.current.get(id)?.focus());\n }, []);\n\n const select = useCallback(\n (id: string) => {\n if (activeId === undefined) setInternalActiveId(id);\n onActiveChange?.(id);\n },\n [activeId, onActiveChange],\n );\n\n const toggle = useCallback((id: string) => {\n setExpandedIds((current) => {\n const next = new Set(current);\n if (next.has(id)) next.delete(id);\n else next.add(id);\n return next;\n });\n }, []);\n\n // The same four moves `Alt+Shift+Arrow` performs, handed to the row menu so\n // they survive on a device with no drag and no modifier keys.\n const moveCommands = useCallback(\n (row: FlatResource): SidebarResourceMoveCommands => {\n if (row.item.disabled) return {};\n const index = flat.findIndex(({ item }) => item.id === row.item.id);\n const previous = flat[index - 1];\n const next = flat[index + 1];\n const parentId = row.parentId;\n const commands: SidebarResourceMoveCommands = {};\n\n if (previous) {\n commands.up = () =>\n void performMove({\n itemId: row.item.id,\n targetId: previous.item.id,\n position: \"before\",\n });\n }\n if (next) {\n commands.down = () =>\n void performMove({\n itemId: row.item.id,\n targetId: next.item.id,\n position: \"after\",\n });\n }\n // Only offer the reparent when it lands somewhere new — the row above a\n // folder's first child is the folder it already lives in.\n if (previous && canContain(previous.item) && previous.item.id !== parentId) {\n commands.into = {\n label: previous.item.label,\n run: () => {\n setExpandedIds((current) => new Set(current).add(previous.item.id));\n void performMove({\n itemId: row.item.id,\n targetId: previous.item.id,\n position: \"inside\",\n });\n },\n };\n }\n if (parentId) {\n commands.out = () =>\n void performMove({\n itemId: row.item.id,\n targetId: parentId,\n position: \"after\",\n });\n }\n\n return commands;\n },\n [flat, performMove],\n );\n\n const handleKeyDown = useCallback(\n (event: KeyboardEvent<HTMLDivElement>, row: FlatResource) => {\n const index = flat.findIndex(({ item }) => item.id === row.item.id);\n const previous = flat[index - 1];\n const next = flat[index + 1];\n const moveModifier = event.altKey && event.shiftKey;\n\n if (event.key === \"ArrowDown\" && !moveModifier && next) {\n event.preventDefault();\n focusRow(next.item.id);\n return;\n }\n if (event.key === \"ArrowUp\" && !moveModifier && previous) {\n event.preventDefault();\n focusRow(previous.item.id);\n return;\n }\n if (event.key === \"Home\" && flat[0]) {\n event.preventDefault();\n focusRow(flat[0].item.id);\n return;\n }\n if (event.key === \"End\" && flat.at(-1)) {\n event.preventDefault();\n focusRow(flat.at(-1)?.item.id ?? row.item.id);\n return;\n }\n\n if (row.item.disabled) {\n if (event.key === \"ArrowLeft\" && row.parentId) {\n event.preventDefault();\n focusRow(row.parentId);\n } else if (\n moveModifier ||\n [\"ArrowRight\", \"Enter\", \" \", \"F2\", \"ContextMenu\"].includes(event.key) ||\n (event.shiftKey && event.key === \"F10\")\n ) {\n event.preventDefault();\n }\n return;\n }\n\n if (moveModifier && event.key === \"ArrowUp\" && previous) {\n event.preventDefault();\n void performMove({ itemId: row.item.id, targetId: previous.item.id, position: \"before\" });\n return;\n }\n if (moveModifier && event.key === \"ArrowDown\" && next) {\n event.preventDefault();\n void performMove({ itemId: row.item.id, targetId: next.item.id, position: \"after\" });\n return;\n }\n if (moveModifier && event.key === \"ArrowRight\" && previous && canContain(previous.item)) {\n event.preventDefault();\n setExpandedIds((current) => new Set(current).add(previous.item.id));\n void performMove({ itemId: row.item.id, targetId: previous.item.id, position: \"inside\" });\n return;\n }\n if (moveModifier && event.key === \"ArrowLeft\" && row.parentId) {\n event.preventDefault();\n void performMove({ itemId: row.item.id, targetId: row.parentId, position: \"after\" });\n return;\n }\n\n if (event.key === \"ArrowRight\" && canContain(row.item)) {\n event.preventDefault();\n if (!expandedIds.has(row.item.id)) toggle(row.item.id);\n else if (next?.parentId === row.item.id) focusRow(next.item.id);\n } else if (event.key === \"ArrowLeft\") {\n event.preventDefault();\n if (expandedIds.has(row.item.id)) toggle(row.item.id);\n else if (row.parentId) focusRow(row.parentId);\n } else if (event.key === \"Enter\" || event.key === \" \") {\n event.preventDefault();\n if (canContain(row.item)) toggle(row.item.id);\n else select(row.item.id);\n } else if (event.key === \"F2\") {\n event.preventDefault();\n setRenamingId(row.item.id);\n } else if (event.key === \"ContextMenu\" || (event.shiftKey && event.key === \"F10\")) {\n event.preventDefault();\n setMenuOpenId(row.item.id);\n }\n },\n [expandedIds, flat, focusRow, performMove, select, toggle],\n );\n\n return (\n <>\n <div\n role=\"tree\"\n aria-label={ariaLabel}\n aria-multiselectable=\"false\"\n onDragOver={(event) => {\n if (!draggingId || event.target !== event.currentTarget) return;\n event.preventDefault();\n setDropTarget({ id: null, position: \"after\" });\n }}\n onDrop={(event) => {\n event.preventDefault();\n if (draggingId && dropTarget) {\n void performMove({\n itemId: draggingId,\n targetId: dropTarget.id,\n position: dropTarget.position,\n });\n }\n }}\n className={cn(\n \"relative flex min-w-0 flex-col gap-0.5 [overflow-anchor:none] group-data-[state=collapsed]/sidebar:hidden\",\n draggingId && \"select-none pb-9\",\n className,\n )}\n >\n <AnimatePresence initial={false}>\n {flat.map((row) => (\n <ResourceRow\n key={row.item.id}\n row={row}\n active={selectedId === row.item.id}\n expanded={expandedIds.has(row.item.id)}\n focused={focusedId === row.item.id}\n draggingId={draggingId}\n dropTarget={dropTarget}\n menuOpen={menuOpenId === row.item.id}\n moves={moveCommands(row)}\n renaming={renamingId === row.item.id}\n onFocus={() => setFocusedId(row.item.id)}\n onSelect={() => select(row.item.id)}\n onToggle={() => toggle(row.item.id)}\n onKeyDown={(event) => handleKeyDown(event, row)}\n onRenameStart={() => setRenamingId(row.item.id)}\n onRenameCancel={() => setRenamingId(null)}\n onRenameCommit={(label) => {\n const trimmed = label.trim();\n setRenamingId(null);\n if (!trimmed || trimmed === row.item.label) return;\n const before = renderedItems;\n updateItems(renameResource(before, row.item.id, trimmed));\n void Promise.resolve(onRename?.(row.item, trimmed)).catch(() => {\n updateItems(before);\n setAnnouncement(`Rename failed. ${row.item.label} was restored.`);\n });\n }}\n onMenuOpenChange={(open) => {\n setMenuOpenId(open ? row.item.id : null);\n if (!open) focusRow(row.item.id);\n }}\n onDragStart={(event, id) => {\n setDraggingId(id);\n event.dataTransfer.effectAllowed = \"move\";\n event.dataTransfer.setData(\"text/plain\", id);\n }}\n onDragEnd={() => {\n setDraggingId(null);\n setDropTarget(null);\n }}\n onDragOver={(event, targetRow) => {\n if (!draggingId || draggingId === targetRow.item.id) return;\n const source = findResource(renderedItems, draggingId);\n if (source && containsResource(source, targetRow.item.id)) return;\n event.preventDefault();\n event.stopPropagation();\n const rect = event.currentTarget.getBoundingClientRect();\n const ratio = (event.clientY - rect.top) / rect.height;\n const position =\n !targetRow.item.disabled &&\n canContain(targetRow.item) &&\n ratio >= 0.25 &&\n ratio <= 0.75\n ? \"inside\"\n : ratio < 0.5\n ? \"before\"\n : \"after\";\n setDropTarget({ id: targetRow.item.id, position });\n }}\n onDrop={(event) => {\n event.preventDefault();\n event.stopPropagation();\n if (draggingId && dropTarget) {\n void performMove({\n itemId: draggingId,\n targetId: dropTarget.id,\n position: dropTarget.position,\n });\n }\n }}\n renderIcon={renderIcon}\n renderMenu={renderMenu}\n setRef={(node) => {\n if (node) rowRefs.current.set(row.item.id, node);\n else rowRefs.current.delete(row.item.id);\n }}\n />\n ))}\n </AnimatePresence>\n\n {draggingId ? (\n <div\n aria-hidden=\"true\"\n data-active={dropTarget?.id === null || undefined}\n className=\"absolute inset-x-1 bottom-0 flex h-8 items-center justify-center rounded-lg border border-border border-dashed text-[10px] text-muted-foreground data-[active=true]:border-primary/50 data-[active=true]:bg-primary/10 data-[active=true]:text-foreground\"\n >\n Move to top level\n </div>\n ) : null}\n </div>\n <span className=\"sr-only\" aria-live=\"polite\">\n {announcement}\n </span>\n </>\n );\n}\n"],"mappings":";;;;;;;;;;AAkGA,MAAM,aAAa;CACjB,UAAU;CACV,MAAM;AACR;AAEA,SAAS,WAAW,MAAuB;CACzC,OAAO,KAAK,SAAS,YAAY,KAAK,SAAS;AACjD;AAEA,SAAS,iBACP,OACA,UACA,QAAQ,GACR,WAA0B,MACV;CAChB,OAAO,MAAM,SAAS,SAAS;EAC7B,MAAM,MAAM;GAAE;GAAM;GAAO;EAAS;EACpC,IAAI,CAAC,KAAK,UAAU,UAAU,CAAC,SAAS,IAAI,KAAK,EAAE,GAAG,OAAO,CAAC,GAAG;EACjE,OAAO,CAAC,KAAK,GAAG,iBAAiB,KAAK,UAAU,UAAU,QAAQ,GAAG,KAAK,EAAE,CAAC;CAC/E,CAAC;AACH;AAEA,SAAS,aAAa,OAA0B,IAAyC;CACvF,KAAK,MAAM,QAAQ,OAAO;EACxB,IAAI,KAAK,OAAO,IAAI,OAAO;EAC3B,MAAM,QAAQ,KAAK,WAAW,aAAa,KAAK,UAAU,EAAE,IAAI,KAAA;EAChE,IAAI,OAAO,OAAO;CACpB;AACF;AAEA,SAAS,iBAAiB,MAAuB,IAAqB;CACpE,OAAO,KAAK,OAAO,MAAM,KAAK,UAAU,MAAM,UAAU,iBAAiB,OAAO,EAAE,CAAC,MAAM;AAC3F;AAEA,SAAS,eACP,OACA,IACyD;CACzD,IAAI;CACJ,MAAM,OAA0B,CAAC;CAEjC,KAAK,MAAM,QAAQ,OAAO;EACxB,IAAI,KAAK,OAAO,IAAI;GAClB,UAAU;GACV;EACF;EAEA,IAAI,KAAK,UAAU,QAAQ;GACzB,MAAM,cAAc,eAAe,KAAK,UAAU,EAAE;GACpD,IAAI,YAAY,SAAS;IACvB,UAAU,YAAY;IACtB,KAAK,KAAK;KAAE,GAAG;KAAM,U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AC;IACnD;IACA,SAAS,UAAU;KACjB,MAAM,eAAe;KACrB,MAAM,gBAAgB;KACtB,IAAI,cAAc,YAChB,YAAiB;MACf,QAAQ;MACR,UAAU,WAAW;MACrB,UAAU,WAAW;KACvB,CAAC;IAEL;IACY;IACA;IACZ,SAAS,SAAS;KAChB,IAAI,MAAM,QAAQ,QAAQ,IAAI,IAAI,KAAK,IAAI,IAAI;UAC1C,QAAQ,QAAQ,OAAO,IAAI,KAAK,EAAE;IACzC;GACD,GA5EM,IAAI,KAAK,EA4Ef,CACF;EACc,CAAA,GAEhB,aACC,oBAAC,OAAD;GACE,eAAY;GACZ,eAAa,YAAY,OAAO,QAAQ,KAAA;GACxC,WAAU;GACX,UAAA;EAEI,CAAA,IACH,IACD;CACL,CAAA,GAAA,oBAAC,QAAD;EAAM,WAAU;EAAU,aAAU;EACjC,UAAA;CACG,CAAA,CACN,EAAA,CAAA;AAEN"}
|
|
1
|
+
{"version":3,"file":"ai-sidebar.js","names":[],"sources":["../../../src/components/agents/ai-sidebar.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n type DragEvent,\n type KeyboardEvent,\n type ReactNode,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport {\n ArrowDown,\n ArrowUp,\n Bookmark,\n FileText,\n Folder,\n FolderInput,\n FolderOpen,\n type LucideIcon,\n MoreHorizontal,\n Pencil,\n Undo2,\n} from \"lucide-react\";\nimport { AnimatePresence, motion, useReducedMotion } from \"motion/react\";\n\nimport { cn } from \"@kumix/utils\";\nimport { useTouchCapable } from \"../../hooks/use-touch-capable\";\nimport { EASE_OUT, SPRING_LAYOUT } from \"../../lib/ease\";\nimport { MorphPopover, MorphPopoverContent, MorphPopoverTrigger } from \"../motion/popover-morph\";\n\nexport type SidebarResourceKind = \"folder\" | \"project\" | \"file\" | \"bookmark\";\n\nexport interface SidebarResource {\n id: string;\n label: string;\n kind: SidebarResourceKind;\n children?: SidebarResource[];\n disabled?: boolean;\n}\n\nexport type SidebarResourceDropPosition = \"before\" | \"inside\" | \"after\";\n\nexport interface SidebarResourceMove {\n itemId: string;\n targetId: string | null;\n position: SidebarResourceDropPosition;\n}\n\n/**\n * The moves this row can make right now, the same four the keyboard offers on\n * `Alt+Shift+Arrow`. A pointer drag is the fast path for them; a finger has no\n * drag to give, so the row menu carries them too. Absent keys are moves this\n * row cannot make from where it sits.\n */\nexport interface SidebarResourceMoveCommands {\n up?: () => void;\n down?: () => void;\n into?: { label: string; run: () => void };\n out?: () => void;\n}\n\nexport interface SidebarResourceMenuControls {\n close: () => void;\n rename: () => void;\n moves: SidebarResourceMoveCommands;\n}\n\nexport interface AISidebarProps {\n items?: SidebarResource[];\n defaultItems?: SidebarResource[];\n onItemsChange?: (items: SidebarResource[]) => void;\n /** Reject the promise to roll the optimistic move back. */\n onMove?: (move: SidebarResourceMove) => void | Promise<void>;\n onMoveError?: (error: unknown, move: SidebarResourceMove) => void;\n onRename?: (item: SidebarResource, label: string) => void | Promise<void>;\n activeId?: string | null;\n defaultActiveId?: string | null;\n onActiveChange?: (id: string) => void;\n defaultExpandedIds?: string[];\n renderIcon?: (item: SidebarResource) => ReactNode;\n renderMenu?: (item: SidebarResource, controls: SidebarResourceMenuControls) => ReactNode;\n ariaLabel?: string;\n className?: string;\n}\n\ninterface FlatResource {\n item: SidebarResource;\n depth: number;\n parentId: string | null;\n}\n\ninterface DropTarget {\n id: string | null;\n position: SidebarResourceDropPosition;\n}\n\nconst ROW_REVEAL = {\n duration: 0.16,\n ease: EASE_OUT,\n} as const;\n\nfunction canContain(item: SidebarResource) {\n return item.kind === \"folder\" || item.kind === \"project\";\n}\n\nfunction flattenResources(\n items: SidebarResource[],\n expanded: Set<string>,\n depth = 0,\n parentId: string | null = null,\n): FlatResource[] {\n return items.flatMap((item) => {\n const row = { item, depth, parentId };\n if (!item.children?.length || !expanded.has(item.id)) return [row];\n return [row, ...flattenResources(item.children, expanded, depth + 1, item.id)];\n });\n}\n\nfunction findResource(items: SidebarResource[], id: string): SidebarResource | undefined {\n for (const item of items) {\n if (item.id === id) return item;\n const child = item.children ? findResource(item.children, id) : undefined;\n if (child) return child;\n }\n}\n\nfunction containsResource(item: SidebarResource, id: string): boolean {\n return item.id === id || item.children?.some((child) => containsResource(child, id)) === true;\n}\n\nfunction removeResource(\n items: SidebarResource[],\n id: string,\n): { items: SidebarResource[]; removed?: SidebarResource } {\n let removed: SidebarResource | undefined;\n const next: SidebarResource[] = [];\n\n for (const item of items) {\n if (item.id === id) {\n removed = item;\n continue;\n }\n\n if (item.children?.length) {\n const childResult = removeResource(item.children, id);\n if (childResult.removed) {\n removed = childResult.removed;\n next.push({ ...item, children: childResult.items });\n continue;\n }\n }\n\n next.push(item);\n }\n\n return { items: next, removed };\n}\n\nfunction insertResource(\n items: SidebarResource[],\n resource: SidebarResource,\n targetId: string | null,\n position: SidebarResourceDropPosition,\n): SidebarResource[] {\n if (targetId === null) return [...items, resource];\n\n const next: SidebarResource[] = [];\n for (const item of items) {\n if (item.id === targetId) {\n if (position === \"before\") next.push(resource, item);\n else if (position === \"after\") next.push(item, resource);\n else next.push({ ...item, children: [...(item.children ?? []), resource] });\n continue;\n }\n\n if (item.children?.length) {\n next.push({\n ...item,\n children: insertResource(item.children, resource, targetId, position),\n });\n } else {\n next.push(item);\n }\n }\n return next;\n}\n\nfunction moveResource(\n items: SidebarResource[],\n move: SidebarResourceMove,\n): SidebarResource[] | null {\n const source = findResource(items, move.itemId);\n if (!source || source.disabled) return null;\n if (move.targetId && containsResource(source, move.targetId)) return null;\n\n const target = move.targetId ? findResource(items, move.targetId) : undefined;\n if (move.position === \"inside\" && (!target || target.disabled || !canContain(target)))\n return null;\n\n const removed = removeResource(items, move.itemId);\n if (!removed.removed) return null;\n return insertResource(removed.items, removed.removed, move.targetId, move.position);\n}\n\nfunction renameResource(items: SidebarResource[], id: string, label: string): SidebarResource[] {\n return items.map((item) => ({\n ...item,\n label: item.id === id ? label : item.label,\n children: item.children ? renameResource(item.children, id, label) : undefined,\n }));\n}\n\nfunction defaultIcon(item: SidebarResource, expanded: boolean) {\n const Icon =\n item.kind === \"folder\" || item.kind === \"project\"\n ? expanded\n ? FolderOpen\n : Folder\n : item.kind === \"bookmark\"\n ? Bookmark\n : FileText;\n return <Icon className=\"size-4\" />;\n}\n\nfunction MarqueeLabel({ active, children }: { active: boolean; children: string }) {\n const reduce = useReducedMotion() ?? false;\n const viewportRef = useRef<HTMLSpanElement>(null);\n const labelRef = useRef<HTMLSpanElement>(null);\n const [distance, setDistance] = useState(0);\n\n useEffect(() => {\n const measure = () => {\n const viewport = viewportRef.current;\n const label = labelRef.current;\n if (!viewport || !label) return;\n setDistance(label.scrollWidth > viewport.clientWidth ? label.scrollWidth + 24 : 0);\n };\n measure();\n const observer = new ResizeObserver(measure);\n if (viewportRef.current) observer.observe(viewportRef.current);\n if (labelRef.current) observer.observe(labelRef.current);\n return () => observer.disconnect();\n }, []);\n\n const running = active && distance > 0 && !reduce;\n\n return (\n <span ref={viewportRef} className=\"block min-w-0 flex-1 overflow-hidden\">\n <motion.span\n className=\"flex w-max items-center gap-6 whitespace-nowrap\"\n animate={{ x: running ? [0, -distance] : 0 }}\n transition={\n running\n ? {\n duration: Math.max(2.4, distance / 34),\n ease: \"linear\",\n repeat: Number.POSITIVE_INFINITY,\n repeatDelay: 2,\n }\n : ROW_REVEAL\n }\n >\n <span ref={labelRef}>{children}</span>\n {running ? <span aria-hidden=\"true\">{children}</span> : null}\n </motion.span>\n </span>\n );\n}\n\nfunction ResourceMenuAction({\n icon: Icon,\n onSelect,\n children,\n}: {\n icon: LucideIcon;\n onSelect: () => void;\n children: ReactNode;\n}) {\n return (\n <button\n type=\"button\"\n onClick={onSelect}\n className=\"flex h-8 w-full items-center gap-2 rounded-lg px-2.5 text-left text-foreground text-xs outline-none transition-colors hover:bg-muted focus-visible:bg-muted focus-visible:ring-2 focus-visible:ring-ring\"\n >\n <Icon aria-hidden=\"true\" className=\"size-3.5 shrink-0\" />\n <span className=\"min-w-0 truncate\">{children}</span>\n </button>\n );\n}\n\ninterface ResourceRowProps {\n row: FlatResource;\n active: boolean;\n expanded: boolean;\n focused: boolean;\n draggingId: string | null;\n dropTarget: DropTarget | null;\n menuOpen: boolean;\n moves: SidebarResourceMoveCommands;\n renaming: boolean;\n onDragEnd: () => void;\n onDragOver: (event: DragEvent<HTMLDivElement>, row: FlatResource) => void;\n onDragStart: (event: DragEvent<HTMLDivElement>, id: string) => void;\n onDrop: (event: DragEvent<HTMLDivElement>) => void;\n onFocus: () => void;\n onKeyDown: (event: KeyboardEvent<HTMLDivElement>) => void;\n onMenuOpenChange: (open: boolean) => void;\n onRenameCancel: () => void;\n onRenameCommit: (label: string) => void;\n onRenameStart: () => void;\n onSelect: () => void;\n onToggle: () => void;\n renderIcon?: (item: SidebarResource) => ReactNode;\n renderMenu?: AISidebarProps[\"renderMenu\"];\n setRef: (node: HTMLDivElement | null) => void;\n}\n\nfunction ResourceRow({\n row,\n active,\n expanded,\n focused,\n draggingId,\n dropTarget,\n menuOpen,\n moves,\n renaming,\n onDragEnd,\n onDragOver,\n onDragStart,\n onDrop,\n onFocus,\n onKeyDown,\n onMenuOpenChange,\n onRenameCancel,\n onRenameCommit,\n onRenameStart,\n onSelect,\n onToggle,\n renderIcon,\n renderMenu,\n setRef,\n}: ResourceRowProps) {\n const reduce = useReducedMotion() ?? false;\n const canTouch = useTouchCapable();\n const [hovered, setHovered] = useState(false);\n const inputRef = useRef<HTMLInputElement>(null);\n const skipRenameBlurRef = useRef(false);\n const draggedRef = useRef(false);\n const [draft, setDraft] = useState(row.item.label);\n const acceptsChildren = canContain(row.item);\n const isDragging = draggingId === row.item.id;\n const dropPosition = dropTarget?.id === row.item.id ? dropTarget.position : null;\n\n useEffect(() => {\n if (!renaming) return;\n skipRenameBlurRef.current = false;\n setDraft(row.item.label);\n requestAnimationFrame(() => {\n inputRef.current?.focus();\n inputRef.current?.select();\n });\n }, [renaming, row.item.label]);\n\n const runFromMenu = (action: () => void) => () => {\n onMenuOpenChange(false);\n action();\n };\n\n const menu = renderMenu?.(row.item, {\n close: () => onMenuOpenChange(false),\n rename: () => {\n onMenuOpenChange(false);\n onRenameStart();\n },\n moves,\n }) ?? (\n <>\n <ResourceMenuAction icon={Pencil} onSelect={runFromMenu(onRenameStart)}>\n Rename\n </ResourceMenuAction>\n {moves.up || moves.down || moves.into || moves.out ? (\n <div aria-hidden=\"true\" className=\"my-1 h-px bg-border\" />\n ) : null}\n {moves.up ? (\n <ResourceMenuAction icon={ArrowUp} onSelect={runFromMenu(moves.up)}>\n Move up\n </ResourceMenuAction>\n ) : null}\n {moves.down ? (\n <ResourceMenuAction icon={ArrowDown} onSelect={runFromMenu(moves.down)}>\n Move down\n </ResourceMenuAction>\n ) : null}\n {moves.into ? (\n <ResourceMenuAction icon={FolderInput} onSelect={runFromMenu(moves.into.run)}>\n Move into {moves.into.label}\n </ResourceMenuAction>\n ) : null}\n {moves.out ? (\n <ResourceMenuAction icon={Undo2} onSelect={runFromMenu(moves.out)}>\n Move out\n </ResourceMenuAction>\n ) : null}\n </>\n );\n\n return (\n <motion.div\n ref={setRef}\n layout=\"position\"\n transition={reduce ? { duration: 0 } : SPRING_LAYOUT}\n role=\"treeitem\"\n aria-level={row.depth + 1}\n aria-selected={acceptsChildren ? undefined : active}\n aria-expanded={acceptsChildren ? expanded : undefined}\n aria-disabled={row.item.disabled || undefined}\n tabIndex={focused ? 0 : -1}\n draggable={!row.item.disabled && !renaming}\n data-menu-open={menuOpen || undefined}\n data-drop={dropPosition ?? undefined}\n data-dragging={isDragging || undefined}\n onFocus={onFocus}\n onKeyDown={onKeyDown}\n onClick={(event) => {\n if (event.defaultPrevented || draggedRef.current || renaming || row.item.disabled) return;\n if (acceptsChildren) onToggle();\n else onSelect();\n }}\n onDoubleClick={(event) => {\n if (acceptsChildren || row.item.disabled) return;\n event.preventDefault();\n onRenameStart();\n }}\n onMouseEnter={() => setHovered(true)}\n onMouseLeave={() => setHovered(false)}\n onDragStartCapture={(event) => {\n draggedRef.current = true;\n onDragStart(event, row.item.id);\n }}\n onDragEndCapture={() => {\n onDragEnd();\n requestAnimationFrame(() => {\n draggedRef.current = false;\n });\n }}\n onDragOver={(event) => onDragOver(event, row)}\n onDrop={onDrop}\n className={cn(\n \"group/resource relative flex min-h-9 min-w-0 cursor-pointer items-center gap-2.5 rounded-xl pr-3 text-sm outline-none\",\n \"text-muted-foreground transition-colors hover:bg-muted hover:text-foreground\",\n \"focus-visible:bg-muted/70 focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset\",\n \"data-[menu-open=true]:bg-muted data-[menu-open=true]:text-foreground\",\n \"data-[dragging=true]:opacity-40\",\n \"data-[drop=inside]:bg-primary/10 data-[drop=inside]:ring-1 data-[drop=inside]:ring-primary/45\",\n \"data-[drop=before]:before:absolute data-[drop=before]:before:-top-0.5 data-[drop=before]:before:right-2 data-[drop=before]:before:left-2 data-[drop=before]:before:h-0.5 data-[drop=before]:before:rounded-full data-[drop=before]:before:bg-primary\",\n \"data-[drop=after]:after:absolute data-[drop=after]:after:right-2 data-[drop=after]:after:-bottom-0.5 data-[drop=after]:after:left-2 data-[drop=after]:after:h-0.5 data-[drop=after]:after:rounded-full data-[drop=after]:after:bg-primary\",\n !acceptsChildren && active && \"bg-muted text-foreground\",\n row.item.disabled && \"cursor-not-allowed opacity-45\",\n )}\n style={{ paddingLeft: `${12 + row.depth * 16}px` }}\n >\n <span aria-hidden=\"true\" className=\"grid size-5 shrink-0 place-items-center\">\n {renderIcon?.(row.item) ?? defaultIcon(row.item, expanded)}\n </span>\n\n {renaming ? (\n <input\n ref={inputRef}\n value={draft}\n aria-label={`Rename ${row.item.label}`}\n onChange={(event) => setDraft(event.target.value)}\n draggable={false}\n onClick={(event) => event.stopPropagation()}\n onDoubleClick={(event) => event.stopPropagation()}\n onBlur={() => {\n if (!skipRenameBlurRef.current) onRenameCommit(draft);\n }}\n onKeyDown={(event) => {\n event.stopPropagation();\n if (event.key === \"Enter\") {\n skipRenameBlurRef.current = true;\n onRenameCommit(draft);\n }\n if (event.key === \"Escape\") {\n skipRenameBlurRef.current = true;\n onRenameCancel();\n }\n }}\n className=\"mx-1 h-7 min-w-0 flex-1 rounded-md border border-border bg-background px-2 text-foreground text-sm outline-none focus-visible:ring-2 focus-visible:ring-ring\"\n />\n ) : (\n <MarqueeLabel active={hovered || menuOpen}>{row.item.label}</MarqueeLabel>\n )}\n\n {!renaming && !row.item.disabled ? (\n <MorphPopover open={menuOpen} onOpenChange={onMenuOpenChange}>\n <MorphPopoverTrigger>\n <button\n type=\"button\"\n draggable={false}\n tabIndex={-1}\n aria-label={`Actions for ${row.item.label}`}\n onClick={(event) => event.stopPropagation()}\n className={cn(\n \"grid size-7 shrink-0 place-items-center rounded-lg outline-none transition-opacity hover:bg-foreground/5 focus-visible:opacity-100 focus-visible:ring-2 focus-visible:ring-ring group-hover/resource:opacity-100 group-data-[menu-open=true]/resource:opacity-100\",\n // A finger never hovers, and this menu is the only path to\n // rename and move without a drag — keep it on screen there.\n canTouch ? \"opacity-100\" : \"opacity-0\",\n )}\n >\n <MoreHorizontal aria-hidden=\"true\" className=\"size-4\" />\n </button>\n </MorphPopoverTrigger>\n <MorphPopoverContent\n side=\"bottom\"\n align=\"end\"\n sideOffset={8}\n radius={12}\n className=\"w-40 p-1.5\"\n >\n <div data-sidebar-resource-menu={row.item.id}>{menu}</div>\n </MorphPopoverContent>\n </MorphPopover>\n ) : null}\n </motion.div>\n );\n}\n\nexport function AISidebar({\n items,\n defaultItems = [],\n onItemsChange,\n onMove,\n onMoveError,\n onRename,\n activeId,\n defaultActiveId = null,\n onActiveChange,\n defaultExpandedIds = [],\n renderIcon,\n renderMenu,\n ariaLabel = \"Resources\",\n className,\n}: AISidebarProps) {\n const [internalItems, setInternalItems] = useState(items ?? defaultItems);\n const [internalActiveId, setInternalActiveId] = useState(defaultActiveId);\n const [expandedIds, setExpandedIds] = useState(() => new Set(defaultExpandedIds));\n const [focusedId, setFocusedId] = useState<string | null>(activeId ?? defaultActiveId);\n const [draggingId, setDraggingId] = useState<string | null>(null);\n const [dropTarget, setDropTarget] = useState<DropTarget | null>(null);\n const [menuOpenId, setMenuOpenId] = useState<string | null>(null);\n const [renamingId, setRenamingId] = useState<string | null>(null);\n const [announcement, setAnnouncement] = useState(\"\");\n const rowRefs = useRef(new Map<string, HTMLDivElement>());\n const movePendingRef = useRef(false);\n const renderedItems = internalItems;\n const selectedId = activeId ?? internalActiveId;\n\n useEffect(() => {\n if (items) setInternalItems(items);\n }, [items]);\n\n const flat = useMemo(\n () => flattenResources(renderedItems, expandedIds),\n [expandedIds, renderedItems],\n );\n\n // Which row carries the roving tabindex is resolved during render, never in\n // a passive effect: an effect lands after the browser paints, so the first\n // commit — and, on a server-rendered page, the markup itself — would have no\n // tabbable row and Tab would skip the whole tree. The same hole opens again\n // whenever a collapse or a rolled-back move takes the focused row out of it.\n const focusedRow =\n focusedId !== null && flat.some((row) => row.item.id === focusedId)\n ? focusedId\n : (flat[0]?.item.id ?? null);\n if (focusedId !== focusedRow) setFocusedId(focusedRow);\n\n useEffect(() => {\n if (!menuOpenId) return;\n const frame = requestAnimationFrame(() => {\n const menus = Array.from(\n document.querySelectorAll<HTMLElement>(\"[data-sidebar-resource-menu]\"),\n );\n menus\n .find((menu) => menu.dataset.sidebarResourceMenu === menuOpenId)\n ?.querySelector<HTMLElement>(\"button, a[href]\")\n ?.focus();\n });\n return () => cancelAnimationFrame(frame);\n }, [menuOpenId]);\n\n const updateItems = useCallback(\n (next: SidebarResource[]) => {\n setInternalItems(next);\n onItemsChange?.(next);\n },\n [onItemsChange],\n );\n\n const performMove = useCallback(\n async (move: SidebarResourceMove) => {\n if (movePendingRef.current) {\n setAnnouncement(\"Wait for the current move to finish.\");\n return;\n }\n const before = renderedItems;\n const next = moveResource(before, move);\n if (!next || next === before) return;\n\n movePendingRef.current = true;\n updateItems(next);\n setDropTarget(null);\n setDraggingId(null);\n const moved = findResource(before, move.itemId);\n const target = move.targetId ? findResource(before, move.targetId) : null;\n setAnnouncement(\n target\n ? `Moved ${moved?.label ?? \"item\"} ${move.position} ${target.label}.`\n : `Moved ${moved?.label ?? \"item\"} to the top level.`,\n );\n\n try {\n await onMove?.(move);\n } catch (error) {\n updateItems(before);\n setAnnouncement(`Move failed. ${moved?.label ?? \"Item\"} was restored.`);\n onMoveError?.(error, move);\n } finally {\n movePendingRef.current = false;\n }\n },\n [onMove, onMoveError, renderedItems, updateItems],\n );\n\n const focusRow = useCallback((id: string) => {\n setFocusedId(id);\n requestAnimationFrame(() => rowRefs.current.get(id)?.focus());\n }, []);\n\n const select = useCallback(\n (id: string) => {\n if (activeId === undefined) setInternalActiveId(id);\n onActiveChange?.(id);\n },\n [activeId, onActiveChange],\n );\n\n const toggle = useCallback((id: string) => {\n setExpandedIds((current) => {\n const next = new Set(current);\n if (next.has(id)) next.delete(id);\n else next.add(id);\n return next;\n });\n }, []);\n\n // The same four moves `Alt+Shift+Arrow` performs, handed to the row menu so\n // they survive on a device with no drag and no modifier keys.\n const moveCommands = useCallback(\n (row: FlatResource): SidebarResourceMoveCommands => {\n if (row.item.disabled) return {};\n const index = flat.findIndex(({ item }) => item.id === row.item.id);\n const previous = flat[index - 1];\n const next = flat[index + 1];\n const parentId = row.parentId;\n const commands: SidebarResourceMoveCommands = {};\n\n if (previous) {\n commands.up = () =>\n void performMove({\n itemId: row.item.id,\n targetId: previous.item.id,\n position: \"before\",\n });\n }\n if (next) {\n commands.down = () =>\n void performMove({\n itemId: row.item.id,\n targetId: next.item.id,\n position: \"after\",\n });\n }\n // Only offer the reparent when it lands somewhere new — the row above a\n // folder's first child is the folder it already lives in.\n if (previous && canContain(previous.item) && previous.item.id !== parentId) {\n commands.into = {\n label: previous.item.label,\n run: () => {\n setExpandedIds((current) => new Set(current).add(previous.item.id));\n void performMove({\n itemId: row.item.id,\n targetId: previous.item.id,\n position: \"inside\",\n });\n },\n };\n }\n if (parentId) {\n commands.out = () =>\n void performMove({\n itemId: row.item.id,\n targetId: parentId,\n position: \"after\",\n });\n }\n\n return commands;\n },\n [flat, performMove],\n );\n\n const handleKeyDown = useCallback(\n (event: KeyboardEvent<HTMLDivElement>, row: FlatResource) => {\n const index = flat.findIndex(({ item }) => item.id === row.item.id);\n const previous = flat[index - 1];\n const next = flat[index + 1];\n const moveModifier = event.altKey && event.shiftKey;\n\n if (event.key === \"ArrowDown\" && !moveModifier && next) {\n event.preventDefault();\n focusRow(next.item.id);\n return;\n }\n if (event.key === \"ArrowUp\" && !moveModifier && previous) {\n event.preventDefault();\n focusRow(previous.item.id);\n return;\n }\n if (event.key === \"Home\" && flat[0]) {\n event.preventDefault();\n focusRow(flat[0].item.id);\n return;\n }\n if (event.key === \"End\" && flat.at(-1)) {\n event.preventDefault();\n focusRow(flat.at(-1)?.item.id ?? row.item.id);\n return;\n }\n\n if (row.item.disabled) {\n if (event.key === \"ArrowLeft\" && row.parentId) {\n event.preventDefault();\n focusRow(row.parentId);\n } else if (\n moveModifier ||\n [\"ArrowRight\", \"Enter\", \" \", \"F2\", \"ContextMenu\"].includes(event.key) ||\n (event.shiftKey && event.key === \"F10\")\n ) {\n event.preventDefault();\n }\n return;\n }\n\n if (moveModifier && event.key === \"ArrowUp\" && previous) {\n event.preventDefault();\n void performMove({ itemId: row.item.id, targetId: previous.item.id, position: \"before\" });\n return;\n }\n if (moveModifier && event.key === \"ArrowDown\" && next) {\n event.preventDefault();\n void performMove({ itemId: row.item.id, targetId: next.item.id, position: \"after\" });\n return;\n }\n if (moveModifier && event.key === \"ArrowRight\" && previous && canContain(previous.item)) {\n event.preventDefault();\n setExpandedIds((current) => new Set(current).add(previous.item.id));\n void performMove({ itemId: row.item.id, targetId: previous.item.id, position: \"inside\" });\n return;\n }\n if (moveModifier && event.key === \"ArrowLeft\" && row.parentId) {\n event.preventDefault();\n void performMove({ itemId: row.item.id, targetId: row.parentId, position: \"after\" });\n return;\n }\n\n if (event.key === \"ArrowRight\" && canContain(row.item)) {\n event.preventDefault();\n if (!expandedIds.has(row.item.id)) toggle(row.item.id);\n else if (next?.parentId === row.item.id) focusRow(next.item.id);\n } else if (event.key === \"ArrowLeft\") {\n event.preventDefault();\n if (expandedIds.has(row.item.id)) toggle(row.item.id);\n else if (row.parentId) focusRow(row.parentId);\n } else if (event.key === \"Enter\" || event.key === \" \") {\n event.preventDefault();\n if (canContain(row.item)) toggle(row.item.id);\n else select(row.item.id);\n } else if (event.key === \"F2\") {\n event.preventDefault();\n setRenamingId(row.item.id);\n } else if (event.key === \"ContextMenu\" || (event.shiftKey && event.key === \"F10\")) {\n event.preventDefault();\n setMenuOpenId(row.item.id);\n }\n },\n [expandedIds, flat, focusRow, performMove, select, toggle],\n );\n\n return (\n <>\n <div\n role=\"tree\"\n aria-label={ariaLabel}\n aria-multiselectable=\"false\"\n onDragOver={(event) => {\n if (!draggingId || event.target !== event.currentTarget) return;\n event.preventDefault();\n setDropTarget({ id: null, position: \"after\" });\n }}\n onDrop={(event) => {\n event.preventDefault();\n if (draggingId && dropTarget) {\n void performMove({\n itemId: draggingId,\n targetId: dropTarget.id,\n position: dropTarget.position,\n });\n }\n }}\n className={cn(\n \"relative flex min-w-0 flex-col gap-0.5 [overflow-anchor:none] group-data-[state=collapsed]/sidebar:hidden\",\n draggingId && \"select-none pb-9\",\n className,\n )}\n >\n <AnimatePresence initial={false}>\n {flat.map((row) => (\n <ResourceRow\n key={row.item.id}\n row={row}\n active={selectedId === row.item.id}\n expanded={expandedIds.has(row.item.id)}\n focused={focusedRow === row.item.id}\n draggingId={draggingId}\n dropTarget={dropTarget}\n menuOpen={menuOpenId === row.item.id}\n moves={moveCommands(row)}\n renaming={renamingId === row.item.id}\n onFocus={() => setFocusedId(row.item.id)}\n onSelect={() => select(row.item.id)}\n onToggle={() => toggle(row.item.id)}\n onKeyDown={(event) => handleKeyDown(event, row)}\n onRenameStart={() => setRenamingId(row.item.id)}\n onRenameCancel={() => setRenamingId(null)}\n onRenameCommit={(label) => {\n const trimmed = label.trim();\n setRenamingId(null);\n if (!trimmed || trimmed === row.item.label) return;\n const before = renderedItems;\n updateItems(renameResource(before, row.item.id, trimmed));\n void Promise.resolve(onRename?.(row.item, trimmed)).catch(() => {\n updateItems(before);\n setAnnouncement(`Rename failed. ${row.item.label} was restored.`);\n });\n }}\n onMenuOpenChange={(open) => {\n setMenuOpenId(open ? row.item.id : null);\n if (!open) focusRow(row.item.id);\n }}\n onDragStart={(event, id) => {\n setDraggingId(id);\n event.dataTransfer.effectAllowed = \"move\";\n event.dataTransfer.setData(\"text/plain\", id);\n }}\n onDragEnd={() => {\n setDraggingId(null);\n setDropTarget(null);\n }}\n onDragOver={(event, targetRow) => {\n if (!draggingId || draggingId === targetRow.item.id) return;\n const source = findResource(renderedItems, draggingId);\n if (source && containsResource(source, targetRow.item.id)) return;\n event.preventDefault();\n event.stopPropagation();\n const rect = event.currentTarget.getBoundingClientRect();\n const ratio = (event.clientY - rect.top) / rect.height;\n const position =\n !targetRow.item.disabled &&\n canContain(targetRow.item) &&\n ratio >= 0.25 &&\n ratio <= 0.75\n ? \"inside\"\n : ratio < 0.5\n ? \"before\"\n : \"after\";\n setDropTarget({ id: targetRow.item.id, position });\n }}\n onDrop={(event) => {\n event.preventDefault();\n event.stopPropagation();\n if (draggingId && dropTarget) {\n void performMove({\n itemId: draggingId,\n targetId: dropTarget.id,\n position: dropTarget.position,\n });\n }\n }}\n renderIcon={renderIcon}\n renderMenu={renderMenu}\n setRef={(node) => {\n if (node) rowRefs.current.set(row.item.id, node);\n else rowRefs.current.delete(row.item.id);\n }}\n />\n ))}\n </AnimatePresence>\n\n {draggingId ? (\n <div\n aria-hidden=\"true\"\n data-active={dropTarget?.id === null || undefined}\n className=\"absolute inset-x-1 bottom-0 flex h-8 items-center justify-center rounded-lg border border-border border-dashed text-[10px] text-muted-foreground data-[active=true]:border-primary/50 data-[active=true]:bg-primary/10 data-[active=true]:text-foreground\"\n >\n Move to top level\n </div>\n ) : null}\n </div>\n <span className=\"sr-only\" aria-live=\"polite\">\n {announcement}\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B,UAAU,WAAW;KACvB,CAAC;IAEL;IACY;IACA;IACZ,SAAS,SAAS;KAChB,IAAI,MAAM,QAAQ,QAAQ,IAAI,IAAI,KAAK,IAAI,IAAI;UAC1C,QAAQ,QAAQ,OAAO,IAAI,KAAK,EAAE;IACzC;GACD,GA5EM,IAAI,KAAK,EA4Ef,CACF;EACc,CAAA,GAEhB,aACC,oBAAC,OAAD;GACE,eAAY;GACZ,eAAa,YAAY,OAAO,QAAQ,KAAA;GACxC,WAAU;GACX,UAAA;EAEI,CAAA,IACH,IACD;CACL,CAAA,GAAA,oBAAC,QAAD;EAAM,WAAU;EAAU,aAAU;EACjC,UAAA;CACG,CAAA,CACN,EAAA,CAAA;AAEN"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"animated-sidebar.d.ts","names":[],"sources":["../../../src/components/motion/animated-sidebar.tsx"],"mappings":";;;KA+BK;KACA;KACA;KACA;UAyGK;EACR;EACA;EACA;EACA;EACA;EACA,UAAU;EACV,gBAAgB;EAChB,OAAO;EACP;EACA,YAAY,MAAM,UAAU;;iBAad,sBAAkB;KAgB7B,uBAAuB;EAC1B;EACA;EACA;;UAGe,qCAAqC,eAAe;EACnE;EACA;EACA,gBAAgB;EAChB;EACA;EACA,sBAAsB;EACtB,QAAQ;;iBAGM,0BACd,UACA,MACA,aACA,cACA,YACA,mBACA,oBACA,WACA,UACG,SACF,+CAA4B,IAAA;
|
|
1
|
+
{"version":3,"file":"animated-sidebar.d.ts","names":[],"sources":["../../../src/components/motion/animated-sidebar.tsx"],"mappings":";;;KA+BK;KACA;KACA;KACA;UAyGK;EACR;EACA;EACA;EACA;EACA;EACA,UAAU;EACV,gBAAgB;EAChB,OAAO;EACP;EACA,YAAY,MAAM,UAAU;;iBAad,sBAAkB;KAgB7B,uBAAuB;EAC1B;EACA;EACA;;UAGe,qCAAqC,eAAe;EACnE;EACA;EACA,gBAAgB;EAChB;EACA;EACA,sBAAsB;EACtB,QAAQ;;iBAGM,0BACd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Sidebar({ ariaLabel, children, className, side }) {
|
|
|
175
175
|
const context = useAnimatedSidebar();
|
|
176
176
|
const panelRef = useRef(null);
|
|
177
177
|
const [mounted, setMounted] = useState(false);
|
|
178
|
+
const [hidden, setHidden] = useState(!context.openMobile);
|
|
179
|
+
const openMobileRef = useRef(context.openMobile);
|
|
178
180
|
useEffect(() => setMounted(true), []);
|
|
181
|
+
useEffect(() => {
|
|
182
|
+
openMobileRef.current = context.openMobile;
|
|
183
|
+
if (context.openMobile) setHidden(false);
|
|
184
|
+
}, [context.openMobile]);
|
|
179
185
|
useEffect(() => {
|
|
180
186
|
if (!context.openMobile) return;
|
|
181
187
|
const body = document.body;
|
|
@@ -208,7 +214,7 @@ function MobileSidebar({ ariaLabel, children, className, side }) {
|
|
|
208
214
|
}, [context.openMobile, context.triggerRef]);
|
|
209
215
|
if (!mounted) return null;
|
|
210
216
|
return createPortal(/* @__PURE__ */ jsxs("div", {
|
|
211
|
-
className: cn("pointer-events-none fixed
|
|
217
|
+
className: cn("pointer-events-none fixed top-0 left-0 z-50 size-0 md:hidden", hidden && !context.openMobile ? "invisible" : "visible"),
|
|
212
218
|
children: [/* @__PURE__ */ jsx(motion.button, {
|
|
213
219
|
type: "button",
|
|
214
220
|
"aria-label": "Close sidebar",
|
|
@@ -217,7 +223,7 @@ function MobileSidebar({ ariaLabel, children, className, side }) {
|
|
|
217
223
|
animate: { opacity: context.openMobile ? 1 : 0 },
|
|
218
224
|
transition: context.reduce ? REDUCED_TRANSITION : PANEL_TRANSITION,
|
|
219
225
|
onClick: () => context.setOpenMobile(false),
|
|
220
|
-
className: cn("
|
|
226
|
+
className: cn("fixed inset-0 bg-black/40", context.openMobile ? "pointer-events-auto" : "pointer-events-none")
|
|
221
227
|
}), /* @__PURE__ */ jsx(motion.div, {
|
|
222
228
|
ref: panelRef,
|
|
223
229
|
role: "dialog",
|
|
@@ -235,6 +241,9 @@ function MobileSidebar({ ariaLabel, children, className, side }) {
|
|
|
235
241
|
x: context.reduce ? 0 : context.openMobile ? "0%" : side === "left" ? "-100%" : "100%"
|
|
236
242
|
},
|
|
237
243
|
transition: context.reduce ? REDUCED_TRANSITION : PANEL_TRANSITION,
|
|
244
|
+
onAnimationComplete: () => {
|
|
245
|
+
if (!openMobileRef.current) setHidden(true);
|
|
246
|
+
},
|
|
238
247
|
onKeyDown: (event) => {
|
|
239
248
|
if (event.key === "Escape") {
|
|
240
249
|
event.preventDefault();
|
|
@@ -258,7 +267,7 @@ function MobileSidebar({ ariaLabel, children, className, side }) {
|
|
|
258
267
|
first.focus();
|
|
259
268
|
}
|
|
260
269
|
},
|
|
261
|
-
className: cn("pointer-events-auto
|
|
270
|
+
className: cn("pointer-events-auto fixed inset-y-0 flex h-dvh w-(--sidebar-width-mobile) max-w-[88vw] flex-col overflow-hidden", "border-border bg-background shadow-2xl will-change-transform", side === "left" ? "left-0 border-r" : "right-0 border-l", !context.openMobile && "pointer-events-none", className),
|
|
262
271
|
children: /* @__PURE__ */ jsx(AnimatedSidebarPanelContext.Provider, {
|
|
263
272
|
value: {
|
|
264
273
|
collapsed: false,
|