@particle-academy/react-fancy 1.9.1 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/icons.cjs +14 -0
- package/dist/icons.cjs.map +1 -0
- package/dist/icons.d.cts +1 -0
- package/dist/icons.d.ts +1 -0
- package/dist/icons.js +3 -0
- package/dist/icons.js.map +1 -0
- package/dist/index.cjs +273 -92
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +36 -2
- package/dist/index.d.ts +36 -2
- package/dist/index.js +238 -39
- package/dist/index.js.map +1 -1
- package/docs/TreeNav.md +35 -0
- package/package.json +11 -1
- package/dist/styles.d.cts +0 -2
- package/dist/styles.d.ts +0 -2
package/dist/icons.cjs
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var lucideReact = require('lucide-react');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
Object.keys(lucideReact).forEach(function (k) {
|
|
8
|
+
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
9
|
+
enumerable: true,
|
|
10
|
+
get: function () { return lucideReact[k]; }
|
|
11
|
+
});
|
|
12
|
+
});
|
|
13
|
+
//# sourceMappingURL=icons.cjs.map
|
|
14
|
+
//# sourceMappingURL=icons.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"icons.cjs","sourcesContent":[]}
|
package/dist/icons.d.cts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from 'lucide-react';
|
package/dist/icons.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from 'lucide-react';
|
package/dist/icons.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"icons.js","sourcesContent":[]}
|
package/dist/index.cjs
CHANGED
|
@@ -3,31 +3,11 @@
|
|
|
3
3
|
var react = require('react');
|
|
4
4
|
var clsx = require('clsx');
|
|
5
5
|
var tailwindMerge = require('tailwind-merge');
|
|
6
|
-
var LucideIcons = require('lucide-react');
|
|
7
6
|
var jsxRuntime = require('react/jsx-runtime');
|
|
8
7
|
var reactDom = require('react-dom');
|
|
8
|
+
var lucideReact = require('lucide-react');
|
|
9
9
|
var marked = require('marked');
|
|
10
10
|
|
|
11
|
-
function _interopNamespace(e) {
|
|
12
|
-
if (e && e.__esModule) return e;
|
|
13
|
-
var n = Object.create(null);
|
|
14
|
-
if (e) {
|
|
15
|
-
Object.keys(e).forEach(function (k) {
|
|
16
|
-
if (k !== 'default') {
|
|
17
|
-
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
18
|
-
Object.defineProperty(n, k, d.get ? d : {
|
|
19
|
-
enumerable: true,
|
|
20
|
-
get: function () { return e[k]; }
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
n.default = e;
|
|
26
|
-
return Object.freeze(n);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
var LucideIcons__namespace = /*#__PURE__*/_interopNamespace(LucideIcons);
|
|
30
|
-
|
|
31
11
|
var __defProp = Object.defineProperty;
|
|
32
12
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
33
13
|
var __esm = (fn, res) => function __init() {
|
|
@@ -1195,22 +1175,31 @@ function search(query) {
|
|
|
1195
1175
|
function find(char) {
|
|
1196
1176
|
return EMOJI_ENTRIES.find((e) => e.char === char);
|
|
1197
1177
|
}
|
|
1178
|
+
|
|
1179
|
+
// src/components/Icon/icon-config.ts
|
|
1198
1180
|
var registry = /* @__PURE__ */ new Map();
|
|
1199
1181
|
var defaultSetName = "lucide";
|
|
1200
1182
|
function kebabToPascal(str) {
|
|
1201
1183
|
return str.split("-").map((part) => part.charAt(0).toUpperCase() + part.slice(1)).join("");
|
|
1202
1184
|
}
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
const
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1185
|
+
function registerIcons(icons) {
|
|
1186
|
+
let set = registry.get("lucide");
|
|
1187
|
+
if (!set) {
|
|
1188
|
+
const map2 = /* @__PURE__ */ new Map();
|
|
1189
|
+
set = {
|
|
1190
|
+
resolve: (name) => {
|
|
1191
|
+
const pascal = kebabToPascal(name);
|
|
1192
|
+
return map2.get(pascal) ?? null;
|
|
1193
|
+
},
|
|
1194
|
+
_map: map2
|
|
1195
|
+
};
|
|
1196
|
+
registry.set("lucide", set);
|
|
1211
1197
|
}
|
|
1212
|
-
|
|
1213
|
-
|
|
1198
|
+
const map = set._map;
|
|
1199
|
+
for (const [key, component] of Object.entries(icons)) {
|
|
1200
|
+
map.set(key, component);
|
|
1201
|
+
}
|
|
1202
|
+
}
|
|
1214
1203
|
function registerIconSet(name, set) {
|
|
1215
1204
|
registry.set(name, set);
|
|
1216
1205
|
}
|
|
@@ -4868,7 +4857,7 @@ var Callout = react.forwardRef(
|
|
|
4868
4857
|
"shrink-0 rounded p-0.5 opacity-70 transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-current"
|
|
4869
4858
|
),
|
|
4870
4859
|
"aria-label": "Dismiss",
|
|
4871
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
4860
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, { size: 16 })
|
|
4872
4861
|
}
|
|
4873
4862
|
)
|
|
4874
4863
|
]
|
|
@@ -5638,7 +5627,7 @@ function ModalHeader({ children, className }) {
|
|
|
5638
5627
|
onClick: close,
|
|
5639
5628
|
className: "rounded-lg p-1 text-zinc-400 transition-colors hover:bg-zinc-100 hover:text-zinc-600 dark:hover:bg-zinc-800 dark:hover:text-zinc-300",
|
|
5640
5629
|
"aria-label": "Close",
|
|
5641
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
5630
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, { size: 20 })
|
|
5642
5631
|
}
|
|
5643
5632
|
)
|
|
5644
5633
|
]
|
|
@@ -5815,10 +5804,10 @@ function ToastItem({ data, onDismiss }) {
|
|
|
5815
5804
|
),
|
|
5816
5805
|
children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-start gap-3", children: [
|
|
5817
5806
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("mt-0.5 shrink-0", VARIANT_ICON_COLORS[variant]), children: [
|
|
5818
|
-
variant === "success" && /* @__PURE__ */ jsxRuntime.jsx(
|
|
5819
|
-
variant === "error" && /* @__PURE__ */ jsxRuntime.jsx(
|
|
5820
|
-
variant === "warning" && /* @__PURE__ */ jsxRuntime.jsx(
|
|
5821
|
-
variant === "info" && /* @__PURE__ */ jsxRuntime.jsx(
|
|
5807
|
+
variant === "success" && /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Check, { size: 16 }),
|
|
5808
|
+
variant === "error" && /* @__PURE__ */ jsxRuntime.jsx(lucideReact.XCircle, { size: 16 }),
|
|
5809
|
+
variant === "warning" && /* @__PURE__ */ jsxRuntime.jsx(lucideReact.AlertTriangle, { size: 16 }),
|
|
5810
|
+
variant === "info" && /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Info, { size: 16 })
|
|
5822
5811
|
] }),
|
|
5823
5812
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex-1 min-w-0", children: [
|
|
5824
5813
|
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm font-medium text-zinc-900 dark:text-zinc-100", children: title }),
|
|
@@ -5831,7 +5820,7 @@ function ToastItem({ data, onDismiss }) {
|
|
|
5831
5820
|
onClick: () => onDismiss(id),
|
|
5832
5821
|
className: "shrink-0 rounded p-0.5 text-zinc-400 transition-colors hover:text-zinc-600 dark:hover:text-zinc-300",
|
|
5833
5822
|
"aria-label": "Dismiss",
|
|
5834
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
5823
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, { size: 14 })
|
|
5835
5824
|
}
|
|
5836
5825
|
)
|
|
5837
5826
|
] })
|
|
@@ -5898,7 +5887,7 @@ function CommandInput({
|
|
|
5898
5887
|
}) {
|
|
5899
5888
|
const { query, setQuery } = useCommand();
|
|
5900
5889
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-react-fancy-command-input": "", className: "flex items-center border-b border-zinc-200 px-4 dark:border-zinc-700", children: [
|
|
5901
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5890
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Search, { size: 16, className: "shrink-0 text-zinc-400" }),
|
|
5902
5891
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5903
5892
|
"input",
|
|
5904
5893
|
{
|
|
@@ -6251,7 +6240,7 @@ function AccordionTrigger({
|
|
|
6251
6240
|
),
|
|
6252
6241
|
children: [
|
|
6253
6242
|
children,
|
|
6254
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
6243
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronDown, { size: 16, className: cn("shrink-0 transition-transform duration-200", isOpen && "rotate-180") })
|
|
6255
6244
|
]
|
|
6256
6245
|
}
|
|
6257
6246
|
);
|
|
@@ -6338,7 +6327,7 @@ function BreadcrumbsDropdown({ items, activeLabel }) {
|
|
|
6338
6327
|
className: "flex items-center gap-1 rounded-lg px-2 py-1 text-sm font-medium text-zinc-900 hover:bg-zinc-100 dark:text-white dark:hover:bg-zinc-800",
|
|
6339
6328
|
children: [
|
|
6340
6329
|
activeLabel,
|
|
6341
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
6330
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronDown, { size: 14, className: cn("transition-transform", open && "rotate-180") })
|
|
6342
6331
|
]
|
|
6343
6332
|
}
|
|
6344
6333
|
),
|
|
@@ -6363,7 +6352,7 @@ function BreadcrumbsRoot({
|
|
|
6363
6352
|
}) {
|
|
6364
6353
|
const items = react.Children.toArray(children);
|
|
6365
6354
|
const [expanded, setExpanded] = react.useState(false);
|
|
6366
|
-
const sep = separator ?? /* @__PURE__ */ jsxRuntime.jsx(
|
|
6355
|
+
const sep = separator ?? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronRight, { size: 12, className: "text-zinc-400" });
|
|
6367
6356
|
const lastItem = items[items.length - 1];
|
|
6368
6357
|
const dropdownItems = items.map((child) => {
|
|
6369
6358
|
const el = child;
|
|
@@ -6467,7 +6456,7 @@ function NavbarToggle({ className }) {
|
|
|
6467
6456
|
),
|
|
6468
6457
|
"aria-label": "Toggle navigation",
|
|
6469
6458
|
"aria-expanded": mobileOpen,
|
|
6470
|
-
children: mobileOpen ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
6459
|
+
children: mobileOpen ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, { size: 20 }) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Menu, { size: 20 })
|
|
6471
6460
|
}
|
|
6472
6461
|
);
|
|
6473
6462
|
}
|
|
@@ -6547,7 +6536,7 @@ function Pagination({
|
|
|
6547
6536
|
onClick: () => onPageChange(page - 1),
|
|
6548
6537
|
className: cn(btnBase, btnDefault, page <= 1 && btnDisabled, "px-2"),
|
|
6549
6538
|
"aria-label": "Previous page",
|
|
6550
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
6539
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronLeft, { size: 16 })
|
|
6551
6540
|
}
|
|
6552
6541
|
),
|
|
6553
6542
|
pages.map(
|
|
@@ -6580,7 +6569,7 @@ function Pagination({
|
|
|
6580
6569
|
"px-2"
|
|
6581
6570
|
),
|
|
6582
6571
|
"aria-label": "Next page",
|
|
6583
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
6572
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronRight, { size: 16 })
|
|
6584
6573
|
}
|
|
6585
6574
|
)
|
|
6586
6575
|
] });
|
|
@@ -6795,7 +6784,7 @@ var Pillbox = react.forwardRef(
|
|
|
6795
6784
|
},
|
|
6796
6785
|
className: "text-zinc-400 hover:text-zinc-600 dark:hover:text-zinc-300",
|
|
6797
6786
|
"aria-label": `Remove ${item}`,
|
|
6798
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
6787
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, { size: 12 })
|
|
6799
6788
|
}
|
|
6800
6789
|
)
|
|
6801
6790
|
]
|
|
@@ -6970,7 +6959,7 @@ function FileUploadDropzone({
|
|
|
6970
6959
|
}
|
|
6971
6960
|
),
|
|
6972
6961
|
children ?? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
6973
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
6962
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Upload, { size: 32, strokeWidth: 1.5, className: "mb-2 text-zinc-400" }),
|
|
6974
6963
|
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-zinc-500", children: "Drop files here or click to browse" })
|
|
6975
6964
|
] })
|
|
6976
6965
|
]
|
|
@@ -6998,7 +6987,7 @@ function ThumbnailItem({ file, index, onRemove }) {
|
|
|
6998
6987
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "group relative flex w-20 flex-col items-center gap-1", children: [
|
|
6999
6988
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative h-20 w-20 overflow-hidden rounded-lg border border-zinc-200 bg-zinc-50 dark:border-zinc-700 dark:bg-zinc-800", children: [
|
|
7000
6989
|
isImage && objectUrl ? /* @__PURE__ */ jsxRuntime.jsx("img", { src: objectUrl, alt: file.name, className: "h-full w-full object-cover" }) : /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex h-full w-full flex-col items-center justify-center gap-1", children: [
|
|
7001
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
6990
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.File, { size: 20, className: "text-zinc-400" }),
|
|
7002
6991
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[10px] font-medium text-zinc-500", children: getExtension(file.name) })
|
|
7003
6992
|
] }),
|
|
7004
6993
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -7008,7 +6997,7 @@ function ThumbnailItem({ file, index, onRemove }) {
|
|
|
7008
6997
|
onClick: () => onRemove(index),
|
|
7009
6998
|
className: "absolute top-1 right-1 flex h-5 w-5 items-center justify-center rounded-full bg-black/60 text-white opacity-0 transition-opacity hover:bg-black/80 group-hover:opacity-100",
|
|
7010
6999
|
"aria-label": `Remove ${file.name}`,
|
|
7011
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
7000
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, { size: 10 })
|
|
7012
7001
|
}
|
|
7013
7002
|
)
|
|
7014
7003
|
] }),
|
|
@@ -7026,7 +7015,7 @@ function FileUploadList({ thumbnail, className }) {
|
|
|
7026
7015
|
{
|
|
7027
7016
|
className: "flex items-center gap-3 rounded-lg border border-zinc-200 px-3 py-2 text-sm dark:border-zinc-700",
|
|
7028
7017
|
children: [
|
|
7029
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
7018
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.File, { size: 16, className: "shrink-0 text-zinc-400" }),
|
|
7030
7019
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex-1 truncate", children: file.name }),
|
|
7031
7020
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "shrink-0 text-xs text-zinc-400", children: formatSize(file.size) }),
|
|
7032
7021
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -7036,7 +7025,7 @@ function FileUploadList({ thumbnail, className }) {
|
|
|
7036
7025
|
onClick: () => removeFile(i),
|
|
7037
7026
|
className: "shrink-0 text-zinc-400 hover:text-zinc-600 dark:hover:text-zinc-300",
|
|
7038
7027
|
"aria-label": `Remove ${file.name}`,
|
|
7039
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
7028
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, { size: 14 })
|
|
7040
7029
|
}
|
|
7041
7030
|
)
|
|
7042
7031
|
]
|
|
@@ -7149,15 +7138,15 @@ var TimePicker = react.forwardRef(
|
|
|
7149
7138
|
),
|
|
7150
7139
|
children: [
|
|
7151
7140
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col items-center", children: [
|
|
7152
|
-
/* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", onClick: () => changeHour(1), disabled, className: spinBtnClass, "aria-label": "Increase hour", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
7141
|
+
/* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", onClick: () => changeHour(1), disabled, className: spinBtnClass, "aria-label": "Increase hour", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronUp, { size: 14 }) }),
|
|
7153
7142
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: displayClass, children: pad(displayHour) }),
|
|
7154
|
-
/* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", onClick: () => changeHour(-1), disabled, className: spinBtnClass, "aria-label": "Decrease hour", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
7143
|
+
/* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", onClick: () => changeHour(-1), disabled, className: spinBtnClass, "aria-label": "Decrease hour", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronDown, { size: 14 }) })
|
|
7155
7144
|
] }),
|
|
7156
7145
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-lg text-zinc-400", children: ":" }),
|
|
7157
7146
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col items-center", children: [
|
|
7158
|
-
/* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", onClick: () => changeMinute(minuteStep), disabled, className: spinBtnClass, "aria-label": "Increase minute", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
7147
|
+
/* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", onClick: () => changeMinute(minuteStep), disabled, className: spinBtnClass, "aria-label": "Increase minute", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronUp, { size: 14 }) }),
|
|
7159
7148
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: displayClass, children: pad(minutes) }),
|
|
7160
|
-
/* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", onClick: () => changeMinute(-minuteStep), disabled, className: spinBtnClass, "aria-label": "Decrease minute", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
7149
|
+
/* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", onClick: () => changeMinute(-minuteStep), disabled, className: spinBtnClass, "aria-label": "Decrease minute", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronDown, { size: 14 }) })
|
|
7161
7150
|
] }),
|
|
7162
7151
|
format === "12h" && /* @__PURE__ */ jsxRuntime.jsx(
|
|
7163
7152
|
"button",
|
|
@@ -7328,7 +7317,7 @@ var Calendar = react.forwardRef(
|
|
|
7328
7317
|
onClick: prevMonth,
|
|
7329
7318
|
className: "rounded-lg p-1 text-zinc-400 hover:bg-zinc-100 dark:hover:bg-zinc-800",
|
|
7330
7319
|
"aria-label": "Previous month",
|
|
7331
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
7320
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronLeft, { size: 16 })
|
|
7332
7321
|
}
|
|
7333
7322
|
),
|
|
7334
7323
|
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-sm font-semibold", children: [
|
|
@@ -7343,7 +7332,7 @@ var Calendar = react.forwardRef(
|
|
|
7343
7332
|
onClick: nextMonth,
|
|
7344
7333
|
className: "rounded-lg p-1 text-zinc-400 hover:bg-zinc-100 dark:hover:bg-zinc-800",
|
|
7345
7334
|
"aria-label": "Next month",
|
|
7346
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
7335
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronRight, { size: 16 })
|
|
7347
7336
|
}
|
|
7348
7337
|
)
|
|
7349
7338
|
] }),
|
|
@@ -8997,7 +8986,7 @@ function MenuSubmenu({
|
|
|
8997
8986
|
children: [
|
|
8998
8987
|
icon && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex h-5 w-5 shrink-0 items-center justify-center", children: icon }),
|
|
8999
8988
|
/* @__PURE__ */ jsxRuntime.jsx("span", { children: label }),
|
|
9000
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
8989
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronDown, { className: "h-3.5 w-3.5 opacity-60" })
|
|
9001
8990
|
]
|
|
9002
8991
|
}
|
|
9003
8992
|
),
|
|
@@ -9030,7 +9019,7 @@ function MenuSubmenu({
|
|
|
9030
9019
|
icon && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex h-5 w-5 shrink-0 items-center justify-center", children: icon }),
|
|
9031
9020
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex-1 text-left", children: label }),
|
|
9032
9021
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
9033
|
-
|
|
9022
|
+
lucideReact.ChevronDown,
|
|
9034
9023
|
{
|
|
9035
9024
|
className: cn(
|
|
9036
9025
|
"h-3.5 w-3.5 opacity-60 transition-transform duration-200",
|
|
@@ -9197,7 +9186,7 @@ function SidebarSubmenu({
|
|
|
9197
9186
|
icon && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex h-5 w-5 shrink-0 items-center justify-center", children: icon }),
|
|
9198
9187
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex-1 text-left", children: label }),
|
|
9199
9188
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
9200
|
-
|
|
9189
|
+
lucideReact.ChevronDown,
|
|
9201
9190
|
{
|
|
9202
9191
|
className: cn(
|
|
9203
9192
|
"h-3.5 w-3.5 opacity-60 transition-transform duration-200",
|
|
@@ -9235,7 +9224,7 @@ function SidebarToggle({ className }) {
|
|
|
9235
9224
|
"hover:bg-zinc-100 hover:text-zinc-600 dark:hover:bg-zinc-800 dark:hover:text-zinc-300",
|
|
9236
9225
|
className
|
|
9237
9226
|
),
|
|
9238
|
-
children: collapsed ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
9227
|
+
children: collapsed ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.PanelLeftOpen, { className: "h-4 w-4" }) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.PanelLeftClose, { className: "h-4 w-4" })
|
|
9239
9228
|
}
|
|
9240
9229
|
);
|
|
9241
9230
|
}
|
|
@@ -9337,7 +9326,7 @@ function MobileMenuFlyout({
|
|
|
9337
9326
|
type: "button",
|
|
9338
9327
|
onClick: onClose,
|
|
9339
9328
|
className: "flex h-8 w-8 items-center justify-center rounded-md text-zinc-400 transition-colors hover:bg-zinc-100 hover:text-zinc-600 dark:hover:bg-zinc-800 dark:hover:text-zinc-300",
|
|
9340
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
9329
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, { className: "h-4 w-4" })
|
|
9341
9330
|
}
|
|
9342
9331
|
)
|
|
9343
9332
|
] }),
|
|
@@ -9797,10 +9786,10 @@ function CanvasControls({
|
|
|
9797
9786
|
className
|
|
9798
9787
|
),
|
|
9799
9788
|
children: [
|
|
9800
|
-
showZoomIn && /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", onClick: zoomIn, className: btnClass, "aria-label": "Zoom in", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
9801
|
-
showZoomOut && /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", onClick: zoomOut, className: btnClass, "aria-label": "Zoom out", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
9802
|
-
showReset && /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", onClick: reset, className: btnClass, "aria-label": "Reset view", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
9803
|
-
showFitAll && /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", onClick: fitAll, className: btnClass, "aria-label": "Fit all", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
9789
|
+
showZoomIn && /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", onClick: zoomIn, className: btnClass, "aria-label": "Zoom in", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ZoomIn, { size: 16 }) }),
|
|
9790
|
+
showZoomOut && /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", onClick: zoomOut, className: btnClass, "aria-label": "Zoom out", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ZoomOut, { size: 16 }) }),
|
|
9791
|
+
showReset && /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", onClick: reset, className: btnClass, "aria-label": "Reset view", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.RotateCcw, { size: 16 }) }),
|
|
9792
|
+
showFitAll && /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", onClick: fitAll, className: btnClass, "aria-label": "Fit all", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Maximize, { size: 16 }) })
|
|
9804
9793
|
]
|
|
9805
9794
|
}
|
|
9806
9795
|
);
|
|
@@ -10564,12 +10553,67 @@ function ChevronIcon({ open }) {
|
|
|
10564
10553
|
}
|
|
10565
10554
|
);
|
|
10566
10555
|
}
|
|
10556
|
+
function isDescendantOf(nodes, ancestorId, targetId) {
|
|
10557
|
+
function findNode(haystack, id) {
|
|
10558
|
+
for (const n of haystack) {
|
|
10559
|
+
if (n.id === id) return n;
|
|
10560
|
+
if (n.children) {
|
|
10561
|
+
const found = findNode(n.children, id);
|
|
10562
|
+
if (found) return found;
|
|
10563
|
+
}
|
|
10564
|
+
}
|
|
10565
|
+
return void 0;
|
|
10566
|
+
}
|
|
10567
|
+
function hasDescendant(node, id) {
|
|
10568
|
+
if (!node.children) return false;
|
|
10569
|
+
for (const child of node.children) {
|
|
10570
|
+
if (child.id === id) return true;
|
|
10571
|
+
if (hasDescendant(child, id)) return true;
|
|
10572
|
+
}
|
|
10573
|
+
return false;
|
|
10574
|
+
}
|
|
10575
|
+
const ancestor = findNode(nodes, ancestorId);
|
|
10576
|
+
return ancestor ? hasDescendant(ancestor, targetId) : false;
|
|
10577
|
+
}
|
|
10578
|
+
function computeDropPosition(e, isFolder) {
|
|
10579
|
+
const rect = e.currentTarget.getBoundingClientRect();
|
|
10580
|
+
const offsetY = e.clientY - rect.top;
|
|
10581
|
+
const third = rect.height / 3;
|
|
10582
|
+
if (offsetY < third) return "before";
|
|
10583
|
+
if (offsetY > third * 2) return "after";
|
|
10584
|
+
return isFolder ? "inside" : "after";
|
|
10585
|
+
}
|
|
10567
10586
|
function TreeNode({ node, depth }) {
|
|
10568
|
-
const {
|
|
10587
|
+
const {
|
|
10588
|
+
selectedId,
|
|
10589
|
+
onSelect,
|
|
10590
|
+
onNodeContextMenu,
|
|
10591
|
+
expandedIds,
|
|
10592
|
+
toggle,
|
|
10593
|
+
indentSize,
|
|
10594
|
+
showIcons,
|
|
10595
|
+
draggable,
|
|
10596
|
+
dragState,
|
|
10597
|
+
setDragState,
|
|
10598
|
+
onNodeMove,
|
|
10599
|
+
nodes,
|
|
10600
|
+
expandNode
|
|
10601
|
+
} = useTreeNav();
|
|
10569
10602
|
const isFolder = node.type === "folder" || node.children && node.children.length > 0;
|
|
10570
10603
|
const isExpanded = expandedIds.includes(node.id);
|
|
10571
10604
|
const isSelected = selectedId === node.id;
|
|
10572
10605
|
const paddingLeft = depth * indentSize + 4;
|
|
10606
|
+
const isDragging = dragState.draggedNodeId === node.id;
|
|
10607
|
+
const isDropTarget = dragState.dropTargetId === node.id;
|
|
10608
|
+
const dropPosition = isDropTarget ? dragState.dropPosition : null;
|
|
10609
|
+
const autoExpandTimer = react.useRef(null);
|
|
10610
|
+
const clearAutoExpand = react.useCallback(() => {
|
|
10611
|
+
if (autoExpandTimer.current) {
|
|
10612
|
+
clearTimeout(autoExpandTimer.current);
|
|
10613
|
+
autoExpandTimer.current = null;
|
|
10614
|
+
}
|
|
10615
|
+
}, []);
|
|
10616
|
+
react.useEffect(() => clearAutoExpand, [clearAutoExpand]);
|
|
10573
10617
|
const handleClick = () => {
|
|
10574
10618
|
if (node.disabled) return;
|
|
10575
10619
|
if (isFolder) {
|
|
@@ -10583,30 +10627,116 @@ function TreeNode({ node, depth }) {
|
|
|
10583
10627
|
onNodeContextMenu(e, node);
|
|
10584
10628
|
}
|
|
10585
10629
|
};
|
|
10586
|
-
|
|
10587
|
-
|
|
10588
|
-
|
|
10589
|
-
|
|
10590
|
-
|
|
10591
|
-
|
|
10592
|
-
|
|
10593
|
-
|
|
10594
|
-
|
|
10595
|
-
|
|
10596
|
-
|
|
10597
|
-
|
|
10598
|
-
|
|
10599
|
-
|
|
10600
|
-
|
|
10601
|
-
|
|
10602
|
-
|
|
10603
|
-
|
|
10604
|
-
|
|
10605
|
-
|
|
10630
|
+
const handleDragStart = react.useCallback((e) => {
|
|
10631
|
+
e.dataTransfer.setData("text/plain", node.id);
|
|
10632
|
+
e.dataTransfer.effectAllowed = "move";
|
|
10633
|
+
requestAnimationFrame(() => {
|
|
10634
|
+
setDragState({ draggedNodeId: node.id, dropTargetId: null, dropPosition: null });
|
|
10635
|
+
});
|
|
10636
|
+
}, [node.id, setDragState]);
|
|
10637
|
+
const handleDragEnd = react.useCallback(() => {
|
|
10638
|
+
clearAutoExpand();
|
|
10639
|
+
setDragState({ draggedNodeId: null, dropTargetId: null, dropPosition: null });
|
|
10640
|
+
}, [clearAutoExpand, setDragState]);
|
|
10641
|
+
const handleDragOver = react.useCallback((e) => {
|
|
10642
|
+
if (!dragState.draggedNodeId) return;
|
|
10643
|
+
const sourceId = dragState.draggedNodeId;
|
|
10644
|
+
if (sourceId === node.id) return;
|
|
10645
|
+
if (isDescendantOf(nodes, sourceId, node.id)) return;
|
|
10646
|
+
e.preventDefault();
|
|
10647
|
+
e.stopPropagation();
|
|
10648
|
+
e.dataTransfer.dropEffect = "move";
|
|
10649
|
+
const position = computeDropPosition(e, !!isFolder);
|
|
10650
|
+
if (isFolder && !isExpanded && position === "inside") {
|
|
10651
|
+
if (!autoExpandTimer.current) {
|
|
10652
|
+
autoExpandTimer.current = setTimeout(() => {
|
|
10653
|
+
expandNode(node.id);
|
|
10654
|
+
autoExpandTimer.current = null;
|
|
10655
|
+
}, 500);
|
|
10606
10656
|
}
|
|
10607
|
-
|
|
10608
|
-
|
|
10609
|
-
|
|
10657
|
+
} else {
|
|
10658
|
+
clearAutoExpand();
|
|
10659
|
+
}
|
|
10660
|
+
if (dragState.dropTargetId !== node.id || dragState.dropPosition !== position) {
|
|
10661
|
+
setDragState({ draggedNodeId: sourceId, dropTargetId: node.id, dropPosition: position });
|
|
10662
|
+
}
|
|
10663
|
+
}, [dragState, node.id, isFolder, isExpanded, nodes, setDragState, expandNode, clearAutoExpand]);
|
|
10664
|
+
const handleDragLeave = react.useCallback((e) => {
|
|
10665
|
+
if (!e.currentTarget.contains(e.relatedTarget)) {
|
|
10666
|
+
clearAutoExpand();
|
|
10667
|
+
if (dragState.dropTargetId === node.id) {
|
|
10668
|
+
setDragState({ ...dragState, dropTargetId: null, dropPosition: null });
|
|
10669
|
+
}
|
|
10670
|
+
}
|
|
10671
|
+
}, [dragState, node.id, setDragState, clearAutoExpand]);
|
|
10672
|
+
const handleDrop = react.useCallback((e) => {
|
|
10673
|
+
e.preventDefault();
|
|
10674
|
+
e.stopPropagation();
|
|
10675
|
+
clearAutoExpand();
|
|
10676
|
+
const sourceId = dragState.draggedNodeId;
|
|
10677
|
+
const position = dragState.dropPosition;
|
|
10678
|
+
if (!sourceId || !position) return;
|
|
10679
|
+
if (sourceId === node.id) return;
|
|
10680
|
+
if (isDescendantOf(nodes, sourceId, node.id)) return;
|
|
10681
|
+
onNodeMove?.(sourceId, node.id, position);
|
|
10682
|
+
setDragState({ draggedNodeId: null, dropTargetId: null, dropPosition: null });
|
|
10683
|
+
}, [dragState, node.id, nodes, onNodeMove, setDragState, clearAutoExpand]);
|
|
10684
|
+
const canDrag = draggable && !node.disabled;
|
|
10685
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
10686
|
+
"div",
|
|
10687
|
+
{
|
|
10688
|
+
"data-react-fancy-tree-node": "",
|
|
10689
|
+
onDragOver: draggable ? handleDragOver : void 0,
|
|
10690
|
+
onDragLeave: draggable ? handleDragLeave : void 0,
|
|
10691
|
+
onDrop: draggable ? handleDrop : void 0,
|
|
10692
|
+
children: [
|
|
10693
|
+
isDropTarget && dropPosition === "before" && /* @__PURE__ */ jsxRuntime.jsx(
|
|
10694
|
+
"div",
|
|
10695
|
+
{
|
|
10696
|
+
"data-react-fancy-tree-drop-indicator": "before",
|
|
10697
|
+
className: "pointer-events-none h-0.5 rounded-full bg-blue-500",
|
|
10698
|
+
style: { marginLeft: paddingLeft }
|
|
10699
|
+
}
|
|
10700
|
+
),
|
|
10701
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
10702
|
+
"button",
|
|
10703
|
+
{
|
|
10704
|
+
type: "button",
|
|
10705
|
+
draggable: canDrag,
|
|
10706
|
+
onDragStart: canDrag ? handleDragStart : void 0,
|
|
10707
|
+
onDragEnd: canDrag ? handleDragEnd : void 0,
|
|
10708
|
+
onClick: handleClick,
|
|
10709
|
+
onContextMenu: handleContextMenu,
|
|
10710
|
+
disabled: node.disabled,
|
|
10711
|
+
className: cn(
|
|
10712
|
+
"flex w-full items-center gap-1 rounded-md py-0.5 text-left text-[13px] transition-colors",
|
|
10713
|
+
isSelected ? "bg-blue-500/15 text-blue-600 dark:text-blue-400" : "text-zinc-700 hover:bg-zinc-100 dark:text-zinc-300 dark:hover:bg-zinc-800",
|
|
10714
|
+
node.disabled && "pointer-events-none opacity-40",
|
|
10715
|
+
isDragging && "opacity-50",
|
|
10716
|
+
canDrag && "cursor-grab active:cursor-grabbing",
|
|
10717
|
+
isDropTarget && dropPosition === "inside" && "bg-blue-500/10 ring-1 ring-blue-500/30 ring-inset"
|
|
10718
|
+
),
|
|
10719
|
+
style: { paddingLeft },
|
|
10720
|
+
children: [
|
|
10721
|
+
isFolder && /* @__PURE__ */ jsxRuntime.jsx(ChevronIcon, { open: isExpanded }),
|
|
10722
|
+
!isFolder && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "w-3.5 shrink-0" }),
|
|
10723
|
+
showIcons && (node.icon ?? (isFolder ? /* @__PURE__ */ jsxRuntime.jsx(FolderIcon, { open: isExpanded }) : /* @__PURE__ */ jsxRuntime.jsx(FileIcon, { ext: node.ext ?? node.label.split(".").pop() }))),
|
|
10724
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate", children: node.label })
|
|
10725
|
+
]
|
|
10726
|
+
}
|
|
10727
|
+
),
|
|
10728
|
+
isDropTarget && dropPosition === "after" && /* @__PURE__ */ jsxRuntime.jsx(
|
|
10729
|
+
"div",
|
|
10730
|
+
{
|
|
10731
|
+
"data-react-fancy-tree-drop-indicator": "after",
|
|
10732
|
+
className: "pointer-events-none h-0.5 rounded-full bg-blue-500",
|
|
10733
|
+
style: { marginLeft: paddingLeft }
|
|
10734
|
+
}
|
|
10735
|
+
),
|
|
10736
|
+
isFolder && isExpanded && node.children && /* @__PURE__ */ jsxRuntime.jsx("div", { "data-react-fancy-tree-node-children": "", children: node.children.map((child) => /* @__PURE__ */ jsxRuntime.jsx(TreeNode, { node: child, depth: depth + 1 }, child.id)) })
|
|
10737
|
+
]
|
|
10738
|
+
}
|
|
10739
|
+
);
|
|
10610
10740
|
}
|
|
10611
10741
|
TreeNode.displayName = "TreeNode";
|
|
10612
10742
|
function collectFolderIds(nodes) {
|
|
@@ -10619,11 +10749,18 @@ function collectFolderIds(nodes) {
|
|
|
10619
10749
|
}
|
|
10620
10750
|
return ids;
|
|
10621
10751
|
}
|
|
10752
|
+
var EMPTY_DRAG_STATE = {
|
|
10753
|
+
draggedNodeId: null,
|
|
10754
|
+
dropTargetId: null,
|
|
10755
|
+
dropPosition: null
|
|
10756
|
+
};
|
|
10622
10757
|
function TreeNavRoot({
|
|
10623
10758
|
nodes,
|
|
10624
10759
|
selectedId,
|
|
10625
10760
|
onSelect,
|
|
10626
10761
|
onNodeContextMenu,
|
|
10762
|
+
draggable = false,
|
|
10763
|
+
onNodeMove,
|
|
10627
10764
|
expandedIds: controlledExpanded,
|
|
10628
10765
|
defaultExpandedIds,
|
|
10629
10766
|
onExpandedChange,
|
|
@@ -10649,15 +10786,58 @@ function TreeNavRoot({
|
|
|
10649
10786
|
},
|
|
10650
10787
|
[expandedIds, isControlled, onExpandedChange]
|
|
10651
10788
|
);
|
|
10789
|
+
const expandNode = react.useCallback(
|
|
10790
|
+
(id) => {
|
|
10791
|
+
if (expandedIds.includes(id)) return;
|
|
10792
|
+
const next = [...expandedIds, id];
|
|
10793
|
+
if (!isControlled) {
|
|
10794
|
+
setInternalExpanded(next);
|
|
10795
|
+
}
|
|
10796
|
+
onExpandedChange?.(next);
|
|
10797
|
+
},
|
|
10798
|
+
[expandedIds, isControlled, onExpandedChange]
|
|
10799
|
+
);
|
|
10800
|
+
const [dragState, setDragState] = react.useState(EMPTY_DRAG_STATE);
|
|
10801
|
+
const handleDragEnd = react.useCallback(() => {
|
|
10802
|
+
setDragState(EMPTY_DRAG_STATE);
|
|
10803
|
+
}, []);
|
|
10652
10804
|
const ctx = react.useMemo(
|
|
10653
|
-
() => ({
|
|
10654
|
-
|
|
10805
|
+
() => ({
|
|
10806
|
+
selectedId,
|
|
10807
|
+
onSelect,
|
|
10808
|
+
onNodeContextMenu,
|
|
10809
|
+
expandedIds,
|
|
10810
|
+
toggle,
|
|
10811
|
+
indentSize,
|
|
10812
|
+
showIcons,
|
|
10813
|
+
draggable,
|
|
10814
|
+
dragState,
|
|
10815
|
+
setDragState,
|
|
10816
|
+
onNodeMove,
|
|
10817
|
+
nodes,
|
|
10818
|
+
expandNode
|
|
10819
|
+
}),
|
|
10820
|
+
[
|
|
10821
|
+
selectedId,
|
|
10822
|
+
onSelect,
|
|
10823
|
+
onNodeContextMenu,
|
|
10824
|
+
expandedIds,
|
|
10825
|
+
toggle,
|
|
10826
|
+
indentSize,
|
|
10827
|
+
showIcons,
|
|
10828
|
+
draggable,
|
|
10829
|
+
dragState,
|
|
10830
|
+
onNodeMove,
|
|
10831
|
+
nodes,
|
|
10832
|
+
expandNode
|
|
10833
|
+
]
|
|
10655
10834
|
);
|
|
10656
10835
|
return /* @__PURE__ */ jsxRuntime.jsx(TreeNavContext.Provider, { value: ctx, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
10657
10836
|
"nav",
|
|
10658
10837
|
{
|
|
10659
10838
|
"data-react-fancy-tree-nav": "",
|
|
10660
10839
|
className: cn("flex flex-col gap-0.5 py-1 text-sm", className),
|
|
10840
|
+
onDragEnd: draggable ? handleDragEnd : void 0,
|
|
10661
10841
|
children: nodes.map((node) => /* @__PURE__ */ jsxRuntime.jsx(TreeNode, { node, depth: 0 }, node.id))
|
|
10662
10842
|
}
|
|
10663
10843
|
) });
|
|
@@ -10735,6 +10915,7 @@ exports.find = find;
|
|
|
10735
10915
|
exports.registerExtension = registerExtension;
|
|
10736
10916
|
exports.registerExtensions = registerExtensions;
|
|
10737
10917
|
exports.registerIconSet = registerIconSet;
|
|
10918
|
+
exports.registerIcons = registerIcons;
|
|
10738
10919
|
exports.resolve = resolve;
|
|
10739
10920
|
exports.search = search;
|
|
10740
10921
|
exports.useAccordion = useAccordion;
|