@devalok/shilp-sutra 0.33.2 → 0.34.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_chunks/badge-group.js +306 -246
- package/dist/_chunks/chat.js +513 -0
- package/dist/_chunks/date-picker.js +748 -0
- package/dist/_chunks/document-preview.js +109 -90
- package/dist/_chunks/file-preview.js +492 -504
- package/dist/_chunks/framer.js +5564 -5613
- package/dist/_chunks/image-preview.js +127 -88
- package/dist/_chunks/keybinding.js +12 -14
- package/dist/_chunks/link-context.js +19 -16
- package/dist/_chunks/mention-suggestion.js +353 -350
- package/dist/_chunks/motion-provider.js +26 -20
- package/dist/_chunks/popover.js +127 -0
- package/dist/_chunks/primitives.js +7584 -6425
- package/dist/_chunks/rich-chat-input.js +2070 -0
- package/dist/_chunks/rolldown-runtime.js +21 -0
- package/dist/_chunks/shared.js +126 -0
- package/dist/_chunks/sonner.js +605 -734
- package/dist/_chunks/stat-row.js +418 -440
- package/dist/_chunks/tiptap.js +15850 -19964
- package/dist/_chunks/tree-view.js +231 -290
- package/dist/_chunks/use-calendar.js +161 -208
- package/dist/_chunks/vendor-client.js +314 -2199
- package/dist/_chunks/vendor-utils.js +1721 -2978
- package/dist/ai/ai-command-provider.js +23 -17
- package/dist/ai/block-renderer.js +68 -51
- package/dist/ai/blocks/index.js +2 -12
- package/dist/ai/command-bar.js +470 -519
- package/dist/ai/conversation.js +241 -227
- package/dist/ai/index.js +181 -167
- package/dist/ai/types.js +0 -1
- package/dist/composed/activity-feed.js +232 -202
- package/dist/composed/avatar-group.js +164 -222
- package/dist/composed/bulk-action-bar.js +174 -165
- package/dist/composed/command-palette.js +290 -308
- package/dist/composed/confirm-dialog.js +28 -48
- package/dist/composed/content-card.js +69 -108
- package/dist/composed/date-picker/index.js +3 -13
- package/dist/composed/deadline-indicator.js +68 -74
- package/dist/composed/emoji-picker.js +83 -110
- package/dist/composed/empty-state.js +64 -103
- package/dist/composed/error-boundary.js +129 -127
- package/dist/composed/file-preview.js +2 -12
- package/dist/composed/filter-bar.js +98 -130
- package/dist/composed/form-section.js +61 -45
- package/dist/composed/global-loading.js +34 -47
- package/dist/composed/index.js +34 -92
- package/dist/composed/inline-edit.js +92 -107
- package/dist/composed/lib/string-utils.js +8 -8
- package/dist/composed/loading-skeleton.js +103 -171
- package/dist/composed/markdown-viewer.js +187 -139
- package/dist/composed/master-detail.js +147 -156
- package/dist/composed/member-picker.js +46 -49
- package/dist/composed/multi-select-popover.js +181 -179
- package/dist/composed/page-header.js +54 -76
- package/dist/composed/page-skeletons.js +143 -127
- package/dist/composed/priority-indicator.js +105 -111
- package/dist/composed/responsive-overlay.js +36 -41
- package/dist/composed/rich-chat-input.js +2 -1860
- package/dist/composed/rich-text-editor.js +561 -424
- package/dist/composed/schedule-view.js +134 -185
- package/dist/composed/simple-tooltip.js +21 -21
- package/dist/composed/status-badge.js +133 -137
- package/dist/hooks/index.js +7 -12
- package/dist/hooks/use-color-mode.js +28 -25
- package/dist/hooks/use-mobile.js +13 -13
- package/dist/hooks/use-toast.js +2 -4
- package/dist/hooks/use-touch-device.js +9 -11
- package/dist/hooks/use-viewport-height.js +14 -14
- package/dist/motion/index.js +3 -11
- package/dist/motion/primitives-index.js +226 -186
- package/dist/shell/app-command-palette.js +203 -234
- package/dist/shell/bottom-navbar.js +150 -190
- package/dist/shell/command-registry.js +13 -14
- package/dist/shell/index.js +10 -20
- package/dist/shell/link-context.js +2 -5
- package/dist/shell/notification-center.js +238 -259
- package/dist/shell/notification-preferences.js +241 -184
- package/dist/shell/sidebar.js +251 -281
- package/dist/shell/top-bar.js +203 -237
- package/dist/tailwind/index.cjs +426 -451
- package/dist/tailwind/index.js +2 -4
- package/dist/tailwind/preset.d.ts.map +1 -1
- package/dist/tailwind/preset.js +443 -468
- package/dist/ui/accordion.js +52 -60
- package/dist/ui/alert-dialog.js +111 -156
- package/dist/ui/alert.js +177 -99
- package/dist/ui/aspect-ratio.js +13 -16
- package/dist/ui/autocomplete.js +112 -148
- package/dist/ui/avatar.js +196 -169
- package/dist/ui/badge-group.js +2 -7
- package/dist/ui/badge-indicator.js +42 -51
- package/dist/ui/badge.js +2 -15
- package/dist/ui/banner.js +76 -68
- package/dist/ui/breadcrumb.js +65 -84
- package/dist/ui/button-group.js +109 -102
- package/dist/ui/button-processing.js +69 -73
- package/dist/ui/button.js +393 -279
- package/dist/ui/card.js +151 -157
- package/dist/ui/charts/index.js +1002 -1319
- package/dist/ui/chat/index.js +2 -11
- package/dist/ui/checkbox.js +77 -100
- package/dist/ui/code.js +18 -32
- package/dist/ui/collapsible.js +21 -29
- package/dist/ui/color-input.js +453 -372
- package/dist/ui/color-swatch.js +60 -90
- package/dist/ui/combobox.js +244 -293
- package/dist/ui/container.js +18 -24
- package/dist/ui/context-menu.js +154 -203
- package/dist/ui/data-table-body.js +116 -213
- package/dist/ui/data-table-bulk-actions.js +43 -59
- package/dist/ui/data-table-card.js +84 -71
- package/dist/ui/data-table-context.js +39 -42
- package/dist/ui/data-table-header.js +98 -139
- package/dist/ui/data-table-pagination.js +69 -82
- package/dist/ui/data-table-toolbar.js +104 -130
- package/dist/ui/data-table.js +278 -354
- package/dist/ui/devalok-grain.js +77 -66
- package/dist/ui/dialog.js +122 -151
- package/dist/ui/dropdown-menu.js +152 -203
- package/dist/ui/file-upload.js +242 -266
- package/dist/ui/form.js +60 -56
- package/dist/ui/hover-card.js +54 -54
- package/dist/ui/icon-button.js +21 -26
- package/dist/ui/icon-context.js +17 -17
- package/dist/ui/icon-group.js +22 -29
- package/dist/ui/icon.js +201 -121
- package/dist/ui/index.js +74 -350
- package/dist/ui/input-otp.d.ts.map +1 -1
- package/dist/ui/input-otp.js +44 -48
- package/dist/ui/input.js +92 -169
- package/dist/ui/label.js +17 -22
- package/dist/ui/lib/date-utils.js +14 -11
- package/dist/ui/lib/motion.js +77 -36
- package/dist/ui/lib/utils.js +39 -16
- package/dist/ui/link.js +13 -24
- package/dist/ui/menubar.js +132 -210
- package/dist/ui/navigation-menu.js +164 -194
- package/dist/ui/number-input.js +72 -95
- package/dist/ui/pagination.js +122 -159
- package/dist/ui/popover.js +2 -131
- package/dist/ui/progress-ring.js +133 -143
- package/dist/ui/progress.js +51 -95
- package/dist/ui/radio.js +41 -50
- package/dist/ui/search-input.js +51 -53
- package/dist/ui/segmented-control.js +93 -114
- package/dist/ui/select.js +131 -157
- package/dist/ui/separator.js +15 -25
- package/dist/ui/sheet.js +135 -163
- package/dist/ui/sidebar.js +357 -600
- package/dist/ui/skeleton.js +179 -231
- package/dist/ui/slider.js +24 -34
- package/dist/ui/spinner.js +226 -205
- package/dist/ui/split-button.js +227 -276
- package/dist/ui/stack.js +56 -70
- package/dist/ui/stat-card.js +259 -251
- package/dist/ui/status-dot.js +67 -63
- package/dist/ui/stepper.js +119 -168
- package/dist/ui/switch.js +51 -54
- package/dist/ui/table.js +57 -90
- package/dist/ui/tabs.js +139 -156
- package/dist/ui/text.js +52 -59
- package/dist/ui/textarea.js +40 -57
- package/dist/ui/toast-types.js +0 -1
- package/dist/ui/toast.js +554 -536
- package/dist/ui/toaster.js +23 -33
- package/dist/ui/toggle-group.js +37 -41
- package/dist/ui/toggle.js +36 -40
- package/dist/ui/tooltip.js +80 -65
- package/dist/ui/tree-view/index.js +2 -6
- package/dist/ui/visually-hidden.js +12 -10
- package/llms-full.txt +1 -1
- package/llms.txt +12 -0
- package/package.json +3 -3
- package/dist/_chunks/date-time-picker.js +0 -851
- package/dist/_chunks/typing-indicator.js +0 -565
|
@@ -1,295 +1,236 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
expanded: w,
|
|
33
|
-
selected: y,
|
|
34
|
-
toggle: s,
|
|
35
|
-
select: o,
|
|
36
|
-
isExpanded: (n) => w.has(n),
|
|
37
|
-
isSelected: (n) => y.has(n),
|
|
38
|
-
expandAll: (n) => k(new Set(n)),
|
|
39
|
-
collapseAll: () => k(/* @__PURE__ */ new Set())
|
|
40
|
-
};
|
|
2
|
+
import { cn as e } from "../ui/lib/utils.js";
|
|
3
|
+
import { Icon as t } from "../ui/icon.js";
|
|
4
|
+
import { Checkbox as n } from "../ui/checkbox.js";
|
|
5
|
+
import * as r from "react";
|
|
6
|
+
import { useCallback as i, useState as a } from "react";
|
|
7
|
+
import { jsx as o, jsxs as s } from "react/jsx-runtime";
|
|
8
|
+
import { IconChevronRight as c } from "@tabler/icons-react";
|
|
9
|
+
//#region src/ui/tree-view/use-tree.ts
|
|
10
|
+
function l(e = {}) {
|
|
11
|
+
let { defaultExpanded: t, defaultSelected: n, multiSelect: r, onSelect: o, onExpand: s } = e, [c, l] = a(new Set(t ?? [])), [u, d] = a(new Set(n ?? []));
|
|
12
|
+
return {
|
|
13
|
+
expanded: c,
|
|
14
|
+
selected: u,
|
|
15
|
+
toggle: i((e) => {
|
|
16
|
+
l((t) => {
|
|
17
|
+
let n = new Set(t);
|
|
18
|
+
return n.has(e) ? n.delete(e) : n.add(e), s?.(Array.from(n)), n;
|
|
19
|
+
});
|
|
20
|
+
}, [s]),
|
|
21
|
+
select: i((e, t) => {
|
|
22
|
+
d((n) => {
|
|
23
|
+
let i;
|
|
24
|
+
return r && t?.ctrlKey ? (i = new Set(n), i.has(e) ? i.delete(e) : i.add(e)) : i = new Set([e]), o?.(Array.from(i)), i;
|
|
25
|
+
});
|
|
26
|
+
}, [r, o]),
|
|
27
|
+
isExpanded: (e) => c.has(e),
|
|
28
|
+
isSelected: (e) => u.has(e),
|
|
29
|
+
expandAll: (e) => l(new Set(e)),
|
|
30
|
+
collapseAll: () => l(/* @__PURE__ */ new Set())
|
|
31
|
+
};
|
|
41
32
|
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
children: /* @__PURE__ */ i("ul", { role: "group", className: "overflow-hidden m-0 p-0", children: l.Children.map(w, (e) => l.isValidElement(e) ? l.cloneElement(e, {
|
|
162
|
-
depth: k + 1
|
|
163
|
-
}) : e) })
|
|
164
|
-
}
|
|
165
|
-
)
|
|
166
|
-
]
|
|
167
|
-
}
|
|
168
|
-
);
|
|
169
|
-
}
|
|
170
|
-
);
|
|
171
|
-
R.displayName = "TreeItem";
|
|
172
|
-
const T = l.createContext(null);
|
|
173
|
-
function M() {
|
|
174
|
-
const t = l.useContext(T);
|
|
175
|
-
if (!t)
|
|
176
|
-
throw new Error("TreeItem must be used within a <TreeView>");
|
|
177
|
-
return t;
|
|
33
|
+
//#endregion
|
|
34
|
+
//#region src/ui/tree-view/tree-item.tsx
|
|
35
|
+
var u = r.forwardRef(({ itemId: i, label: a, icon: l, secondaryLabel: u, actions: d, disabled: p = !1, children: m, depth: h = 0, className: g }, _) => {
|
|
36
|
+
let v = f(), y = r.Children.count(m) > 0, b = v.tree.isExpanded(i), x = v.tree.isSelected(i), S = (e) => {
|
|
37
|
+
p || v.tree.select(i, e);
|
|
38
|
+
}, C = (e) => {
|
|
39
|
+
e.stopPropagation(), !p && v.tree.toggle(i);
|
|
40
|
+
}, w = (e) => {
|
|
41
|
+
p || ((e.key === "Enter" || e.key === " ") && (e.preventDefault(), v.tree.select(i)), e.key === "ArrowRight" && y && !b && (e.preventDefault(), e.stopPropagation(), v.tree.toggle(i)), e.key === "ArrowLeft" && y && b && (e.preventDefault(), e.stopPropagation(), v.tree.toggle(i)));
|
|
42
|
+
}, T = r.useMemo(() => {
|
|
43
|
+
if (!v.checkboxes || !y) return {
|
|
44
|
+
checked: x,
|
|
45
|
+
indeterminate: !1
|
|
46
|
+
};
|
|
47
|
+
let e = [], t = (n) => {
|
|
48
|
+
r.Children.forEach(n, (n) => {
|
|
49
|
+
r.isValidElement(n) && n.props.itemId && (e.push(n.props.itemId), n.props.children && t(n.props.children));
|
|
50
|
+
});
|
|
51
|
+
};
|
|
52
|
+
t(m);
|
|
53
|
+
let n = e.filter((e) => v.tree.isSelected(e)).length;
|
|
54
|
+
return n === 0 && !x ? {
|
|
55
|
+
checked: !1,
|
|
56
|
+
indeterminate: !1
|
|
57
|
+
} : n === e.length ? {
|
|
58
|
+
checked: !0,
|
|
59
|
+
indeterminate: !1
|
|
60
|
+
} : {
|
|
61
|
+
checked: !1,
|
|
62
|
+
indeterminate: !0
|
|
63
|
+
};
|
|
64
|
+
}, [
|
|
65
|
+
v.checkboxes,
|
|
66
|
+
y,
|
|
67
|
+
m,
|
|
68
|
+
x,
|
|
69
|
+
v.tree
|
|
70
|
+
]);
|
|
71
|
+
return /* @__PURE__ */ s("li", {
|
|
72
|
+
ref: _,
|
|
73
|
+
role: "treeitem",
|
|
74
|
+
"aria-expanded": y ? b : void 0,
|
|
75
|
+
"aria-selected": x,
|
|
76
|
+
"aria-level": h + 1,
|
|
77
|
+
"aria-disabled": p || void 0,
|
|
78
|
+
className: "list-none",
|
|
79
|
+
children: [/* @__PURE__ */ s("div", {
|
|
80
|
+
role: "presentation",
|
|
81
|
+
"data-tree-item": i,
|
|
82
|
+
tabIndex: p ? -1 : 0,
|
|
83
|
+
onClick: S,
|
|
84
|
+
onKeyDown: w,
|
|
85
|
+
style: { paddingLeft: h * 20 + 8 },
|
|
86
|
+
className: e("flex items-center gap-ds-02 py-ds-02 px-ds-02 rounded-ds-md cursor-pointer transition-colors duration-fast-01", "hover:bg-surface-raised", "focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-accent-9", x && "bg-accent-3 text-accent-11", p && "opacity-action-disabled cursor-not-allowed pointer-events-none", g),
|
|
87
|
+
children: [
|
|
88
|
+
y ? /* @__PURE__ */ o("button", {
|
|
89
|
+
type: "button",
|
|
90
|
+
tabIndex: -1,
|
|
91
|
+
"aria-hidden": "true",
|
|
92
|
+
onClick: C,
|
|
93
|
+
className: "flex shrink-0 items-center justify-center p-0 border-0 bg-transparent cursor-pointer",
|
|
94
|
+
children: /* @__PURE__ */ o(t, {
|
|
95
|
+
icon: c,
|
|
96
|
+
size: "sm",
|
|
97
|
+
className: e("transition-transform duration-moderate-02", b && "rotate-90")
|
|
98
|
+
})
|
|
99
|
+
}) : /* @__PURE__ */ o("span", {
|
|
100
|
+
className: "inline-block w-4 shrink-0",
|
|
101
|
+
"aria-hidden": "true"
|
|
102
|
+
}),
|
|
103
|
+
v.checkboxes && /* @__PURE__ */ o(n, {
|
|
104
|
+
checked: T.checked,
|
|
105
|
+
indeterminate: T.indeterminate,
|
|
106
|
+
disabled: p,
|
|
107
|
+
tabIndex: -1,
|
|
108
|
+
onClick: (e) => e.stopPropagation(),
|
|
109
|
+
onCheckedChange: () => {
|
|
110
|
+
p || v.tree.select(i);
|
|
111
|
+
},
|
|
112
|
+
className: "shrink-0"
|
|
113
|
+
}),
|
|
114
|
+
l && /* @__PURE__ */ o("span", {
|
|
115
|
+
className: "flex shrink-0 items-center text-surface-fg-subtle",
|
|
116
|
+
children: l
|
|
117
|
+
}),
|
|
118
|
+
/* @__PURE__ */ o("span", {
|
|
119
|
+
className: "truncate text-ds-sm",
|
|
120
|
+
children: a
|
|
121
|
+
}),
|
|
122
|
+
u && /* @__PURE__ */ o("span", {
|
|
123
|
+
className: "ml-auto truncate text-ds-xs text-surface-fg-muted",
|
|
124
|
+
children: u
|
|
125
|
+
}),
|
|
126
|
+
d && /* @__PURE__ */ o("span", {
|
|
127
|
+
className: "ml-auto flex shrink-0 items-center gap-ds-01",
|
|
128
|
+
onClick: (e) => e.stopPropagation(),
|
|
129
|
+
role: "presentation",
|
|
130
|
+
children: d
|
|
131
|
+
})
|
|
132
|
+
]
|
|
133
|
+
}), y && /* @__PURE__ */ o("div", {
|
|
134
|
+
role: "group",
|
|
135
|
+
className: e("grid transition-[grid-template-rows] duration-moderate-02 ease-productive-standard", b ? "grid-rows-[1fr]" : "grid-rows-[0fr]"),
|
|
136
|
+
children: /* @__PURE__ */ o("ul", {
|
|
137
|
+
role: "group",
|
|
138
|
+
className: "overflow-hidden m-0 p-0",
|
|
139
|
+
children: r.Children.map(m, (e) => r.isValidElement(e) ? r.cloneElement(e, { depth: h + 1 }) : e)
|
|
140
|
+
})
|
|
141
|
+
})]
|
|
142
|
+
});
|
|
143
|
+
});
|
|
144
|
+
u.displayName = "TreeItem";
|
|
145
|
+
//#endregion
|
|
146
|
+
//#region src/ui/tree-view/tree-view.tsx
|
|
147
|
+
var d = r.createContext(null);
|
|
148
|
+
function f() {
|
|
149
|
+
let e = r.useContext(d);
|
|
150
|
+
if (!e) throw Error("TreeItem must be used within a <TreeView>");
|
|
151
|
+
return e;
|
|
178
152
|
}
|
|
179
|
-
function
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
children: r.children && r.children.length > 0 ? V(r.children, x + 1) : void 0
|
|
189
|
-
},
|
|
190
|
-
r.id
|
|
191
|
-
));
|
|
153
|
+
function p(e, t = 0) {
|
|
154
|
+
return e.map((e) => /* @__PURE__ */ o(u, {
|
|
155
|
+
itemId: e.id,
|
|
156
|
+
label: e.label,
|
|
157
|
+
icon: e.icon,
|
|
158
|
+
disabled: e.disabled,
|
|
159
|
+
depth: t,
|
|
160
|
+
children: e.children && e.children.length > 0 ? p(e.children, t + 1) : void 0
|
|
161
|
+
}, e.id));
|
|
192
162
|
}
|
|
193
|
-
function
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
}
|
|
206
|
-
return !0;
|
|
207
|
-
});
|
|
163
|
+
function m(e) {
|
|
164
|
+
return Array.from(e.querySelectorAll("[data-tree-item]")).filter((t) => {
|
|
165
|
+
let n = t.parentElement;
|
|
166
|
+
for (; n && n !== e;) {
|
|
167
|
+
if (n.getAttribute("role") === "group") {
|
|
168
|
+
let e = n.parentElement;
|
|
169
|
+
if (e && e.classList.contains("grid-rows-[0fr]")) return !1;
|
|
170
|
+
}
|
|
171
|
+
n = n.parentElement;
|
|
172
|
+
}
|
|
173
|
+
return !0;
|
|
174
|
+
});
|
|
208
175
|
}
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
}
|
|
271
|
-
}
|
|
272
|
-
}, m = l.useMemo(
|
|
273
|
-
() => ({ tree: o, checkboxes: v }),
|
|
274
|
-
[o, v]
|
|
275
|
-
), S = t ? V(t) : y;
|
|
276
|
-
return /* @__PURE__ */ i(T.Provider, { value: m, children: /* @__PURE__ */ i(
|
|
277
|
-
"ul",
|
|
278
|
-
{
|
|
279
|
-
ref: d,
|
|
280
|
-
role: "tree",
|
|
281
|
-
"aria-multiselectable": f || void 0,
|
|
282
|
-
onKeyDown: p,
|
|
283
|
-
className: E("m-0 list-none p-0", k),
|
|
284
|
-
...C,
|
|
285
|
-
children: S
|
|
286
|
-
}
|
|
287
|
-
) });
|
|
288
|
-
}
|
|
289
|
-
);
|
|
290
|
-
G.displayName = "TreeView";
|
|
291
|
-
export {
|
|
292
|
-
R as T,
|
|
293
|
-
G as a,
|
|
294
|
-
q as u
|
|
295
|
-
};
|
|
176
|
+
var h = r.forwardRef(({ items: t, defaultExpanded: n, defaultSelected: i, multiSelect: a = !1, checkboxes: s = !1, onSelect: c, onExpand: u, className: f, children: h, ...g }, _) => {
|
|
177
|
+
let v = l({
|
|
178
|
+
defaultExpanded: n,
|
|
179
|
+
defaultSelected: i,
|
|
180
|
+
multiSelect: a,
|
|
181
|
+
onSelect: c,
|
|
182
|
+
onExpand: u
|
|
183
|
+
}), y = r.useRef(null), b = _ ?? y, x = (e) => {
|
|
184
|
+
let t = b.current;
|
|
185
|
+
if (!t) return;
|
|
186
|
+
let n = m(t), r = n.findIndex((e) => e === document.activeElement);
|
|
187
|
+
switch (e.key) {
|
|
188
|
+
case "ArrowDown":
|
|
189
|
+
e.preventDefault(), n[r + 1]?.focus();
|
|
190
|
+
break;
|
|
191
|
+
case "ArrowUp":
|
|
192
|
+
e.preventDefault(), n[r - 1]?.focus();
|
|
193
|
+
break;
|
|
194
|
+
case "ArrowRight": {
|
|
195
|
+
let t = n[r];
|
|
196
|
+
if (t) {
|
|
197
|
+
let i = t.getAttribute("data-tree-item");
|
|
198
|
+
i && v.isExpanded(i) && (e.preventDefault(), n[r + 1]?.focus());
|
|
199
|
+
}
|
|
200
|
+
break;
|
|
201
|
+
}
|
|
202
|
+
case "ArrowLeft": {
|
|
203
|
+
let t = n[r];
|
|
204
|
+
if (t) {
|
|
205
|
+
let n = t.getAttribute("data-tree-item"), r = t.closest("[role=\"treeitem\"]")?.parentElement?.closest("[role=\"treeitem\"]");
|
|
206
|
+
n && !v.isExpanded(n) && r && (e.preventDefault(), r.querySelector("[data-tree-item]")?.focus());
|
|
207
|
+
}
|
|
208
|
+
break;
|
|
209
|
+
}
|
|
210
|
+
case "Home":
|
|
211
|
+
e.preventDefault(), n[0]?.focus();
|
|
212
|
+
break;
|
|
213
|
+
case "End":
|
|
214
|
+
e.preventDefault(), n[n.length - 1]?.focus();
|
|
215
|
+
break;
|
|
216
|
+
}
|
|
217
|
+
}, S = r.useMemo(() => ({
|
|
218
|
+
tree: v,
|
|
219
|
+
checkboxes: s
|
|
220
|
+
}), [v, s]), C = t ? p(t) : h;
|
|
221
|
+
return /* @__PURE__ */ o(d.Provider, {
|
|
222
|
+
value: S,
|
|
223
|
+
children: /* @__PURE__ */ o("ul", {
|
|
224
|
+
ref: b,
|
|
225
|
+
role: "tree",
|
|
226
|
+
"aria-multiselectable": a || void 0,
|
|
227
|
+
onKeyDown: x,
|
|
228
|
+
className: e("m-0 list-none p-0", f),
|
|
229
|
+
...g,
|
|
230
|
+
children: C
|
|
231
|
+
})
|
|
232
|
+
});
|
|
233
|
+
});
|
|
234
|
+
h.displayName = "TreeView";
|
|
235
|
+
//#endregion
|
|
236
|
+
export { u as n, l as r, h as t };
|