@deepnoid/ui 0.1.25 → 0.1.27
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/.turbo/turbo-build.log +149 -145
- package/dist/chunk-6TIIBU7J.mjs +35 -0
- package/dist/{chunk-IVK24VIL.mjs → chunk-C7OF5HJF.mjs} +1 -1
- package/dist/{chunk-MSAULFDB.mjs → chunk-E4UUZOR4.mjs} +16 -16
- package/dist/{chunk-P5PJTJLY.mjs → chunk-GRA2LU42.mjs} +18 -18
- package/dist/{chunk-Y27H2AMV.mjs → chunk-IRAHS4WS.mjs} +2 -2
- package/dist/chunk-PX4PFLJ3.mjs +178 -0
- package/dist/{chunk-EAK5DVWA.mjs → chunk-UNH3BCGN.mjs} +8 -1
- package/dist/{chunk-6EU5GUL5.mjs → chunk-XA6PVFTW.mjs} +5 -5
- package/dist/components/breadcrumb/breadcrumb.js +2 -2
- package/dist/components/breadcrumb/breadcrumb.mjs +1 -1
- package/dist/components/breadcrumb/index.js +2 -2
- package/dist/components/breadcrumb/index.mjs +1 -1
- package/dist/components/input/index.js +18 -18
- package/dist/components/input/index.mjs +1 -1
- package/dist/components/input/input.d.mts +44 -44
- package/dist/components/input/input.d.ts +44 -44
- package/dist/components/input/input.js +18 -18
- package/dist/components/input/input.mjs +1 -1
- package/dist/components/pagination/index.js +18 -18
- package/dist/components/pagination/index.mjs +2 -2
- package/dist/components/pagination/pagination.js +18 -18
- package/dist/components/pagination/pagination.mjs +2 -2
- package/dist/components/select/index.js +16 -16
- package/dist/components/select/index.mjs +1 -1
- package/dist/components/select/select.d.mts +38 -38
- package/dist/components/select/select.d.ts +38 -38
- package/dist/components/select/select.js +16 -16
- package/dist/components/select/select.mjs +1 -1
- package/dist/components/table/definition-table.d.mts +51 -0
- package/dist/components/table/definition-table.d.ts +51 -0
- package/dist/components/table/definition-table.js +351 -0
- package/dist/components/table/definition-table.mjs +9 -0
- package/dist/components/table/form-table.d.mts +1 -1
- package/dist/components/table/form-table.d.ts +1 -1
- package/dist/components/table/form-table.mjs +43 -3
- package/dist/components/table/index.d.mts +1 -1
- package/dist/components/table/index.d.ts +1 -1
- package/dist/components/table/index.js +40 -47
- package/dist/components/table/index.mjs +9 -9
- package/dist/components/table/table-head.js +8 -1
- package/dist/components/table/table-head.mjs +1 -1
- package/dist/components/table/table.js +26 -19
- package/dist/components/table/table.mjs +5 -5
- package/dist/components/toast/index.mjs +2 -2
- package/dist/components/toast/use-toast.mjs +2 -2
- package/dist/components/tree/index.d.mts +1 -0
- package/dist/components/tree/index.d.ts +1 -0
- package/dist/components/tree/index.js +138 -60
- package/dist/components/tree/index.mjs +1 -1
- package/dist/components/tree/tree.d.mts +17 -10
- package/dist/components/tree/tree.d.ts +17 -10
- package/dist/components/tree/tree.js +143 -60
- package/dist/components/tree/tree.mjs +3 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +196 -125
- package/dist/index.mjs +31 -31
- package/package.json +1 -1
- package/dist/chunk-ICZTNO4V.mjs +0 -49
- package/dist/chunk-K4QY2F5J.mjs +0 -99
- package/dist/{chunk-UAHTRCKG.mjs → chunk-YBDA3WQP.mjs} +3 -3
|
@@ -102,6 +102,7 @@ var require_plugin = __commonJS({
|
|
|
102
102
|
// src/components/tree/tree.tsx
|
|
103
103
|
var tree_exports = {};
|
|
104
104
|
__export(tree_exports, {
|
|
105
|
+
Tree: () => Tree,
|
|
105
106
|
default: () => tree_default
|
|
106
107
|
});
|
|
107
108
|
module.exports = __toCommonJS(tree_exports);
|
|
@@ -4336,74 +4337,152 @@ function toVal(mix) {
|
|
|
4336
4337
|
|
|
4337
4338
|
// src/components/tree/tree.tsx
|
|
4338
4339
|
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
4339
|
-
var TreeNodeItem = (0, import_react.forwardRef)(
|
|
4340
|
-
|
|
4341
|
-
|
|
4342
|
-
|
|
4343
|
-
|
|
4344
|
-
|
|
4345
|
-
|
|
4346
|
-
|
|
4347
|
-
|
|
4348
|
-
|
|
4349
|
-
|
|
4350
|
-
|
|
4351
|
-
|
|
4352
|
-
|
|
4353
|
-
|
|
4354
|
-
|
|
4355
|
-
|
|
4356
|
-
|
|
4357
|
-
|
|
4340
|
+
var TreeNodeItem = (0, import_react.forwardRef)(
|
|
4341
|
+
({ node, depth, fileIcon, isLoading, classNames, onExpand }, ref) => {
|
|
4342
|
+
const [isOpen, setIsOpen] = (0, import_react.useState)(false);
|
|
4343
|
+
const [children, setChildren] = (0, import_react.useState)(node.children);
|
|
4344
|
+
const [isLoadingChildren, setIsLoadingChildren] = (0, import_react.useState)(false);
|
|
4345
|
+
const slots = (0, import_react.useMemo)(() => treeStyle(), []);
|
|
4346
|
+
const hasMore = (0, import_react.useMemo)(() => {
|
|
4347
|
+
if (node.isLeaf) return false;
|
|
4348
|
+
if (Array.isArray(children)) return children.length > 0;
|
|
4349
|
+
return typeof onExpand === "function";
|
|
4350
|
+
}, [node.isLeaf, children, onExpand]);
|
|
4351
|
+
const toggleOpen = (0, import_react.useCallback)(async () => {
|
|
4352
|
+
if (!isOpen && !children && onExpand && !node.isLeaf) {
|
|
4353
|
+
setIsLoadingChildren(true);
|
|
4354
|
+
try {
|
|
4355
|
+
const result = await onExpand(node);
|
|
4356
|
+
setChildren(result);
|
|
4357
|
+
} catch (e) {
|
|
4358
|
+
console.error("Failed to load child nodes ", e);
|
|
4359
|
+
} finally {
|
|
4360
|
+
setIsLoadingChildren(false);
|
|
4361
|
+
}
|
|
4362
|
+
}
|
|
4363
|
+
setIsOpen((prev) => !prev);
|
|
4364
|
+
}, [isOpen, children, onExpand, node]);
|
|
4365
|
+
const handleClick = () => {
|
|
4366
|
+
var _a;
|
|
4367
|
+
toggleOpen();
|
|
4368
|
+
(_a = node.onClick) == null ? void 0 : _a.call(node);
|
|
4369
|
+
};
|
|
4370
|
+
const handleRightClick = (e) => {
|
|
4371
|
+
var _a;
|
|
4372
|
+
e.preventDefault();
|
|
4373
|
+
(_a = node.onRightClick) == null ? void 0 : _a.call(node, e);
|
|
4374
|
+
};
|
|
4375
|
+
const marginClass = depth > 1 ? hasMore ? "ml-[30px]" : "ml-[55px]" : hasMore ? "" : "ml-[25px]";
|
|
4376
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
4377
|
+
"div",
|
|
4378
|
+
{
|
|
4379
|
+
ref,
|
|
4380
|
+
className: clsx(
|
|
4381
|
+
marginClass,
|
|
4382
|
+
"transition-all duration-150 ease-out",
|
|
4383
|
+
isLoading ? "-translate-y-2 opacity-0" : "translate-y-0 opacity-100"
|
|
4384
|
+
),
|
|
4385
|
+
children: [
|
|
4386
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
4387
|
+
"div",
|
|
4358
4388
|
{
|
|
4359
|
-
|
|
4360
|
-
|
|
4389
|
+
className: slots.group({ class: classNames == null ? void 0 : classNames.group }),
|
|
4390
|
+
onClick: handleClick,
|
|
4391
|
+
onContextMenu: handleRightClick,
|
|
4392
|
+
children: [
|
|
4393
|
+
hasMore && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
4394
|
+
Icon_default,
|
|
4395
|
+
{
|
|
4396
|
+
name: "right-chevron",
|
|
4397
|
+
className: clsx(
|
|
4398
|
+
"text-neutral-main cursor-pointer transition-transform duration-150",
|
|
4399
|
+
isOpen ? "rotate-90" : "rotate-0"
|
|
4400
|
+
)
|
|
4401
|
+
}
|
|
4402
|
+
),
|
|
4403
|
+
fileIcon,
|
|
4404
|
+
node.label
|
|
4405
|
+
]
|
|
4361
4406
|
}
|
|
4362
4407
|
),
|
|
4363
|
-
|
|
4364
|
-
|
|
4365
|
-
|
|
4366
|
-
|
|
4367
|
-
|
|
4368
|
-
|
|
4369
|
-
|
|
4370
|
-
|
|
4371
|
-
|
|
4372
|
-
|
|
4373
|
-
}
|
|
4374
|
-
|
|
4375
|
-
|
|
4376
|
-
|
|
4377
|
-
|
|
4378
|
-
|
|
4379
|
-
|
|
4380
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { children: [
|
|
4381
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: slots.wrapper({ class: classNames == null ? void 0 : classNames.wrapper }), children: [
|
|
4382
|
-
groupIcon,
|
|
4383
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: slots.label({ class: classNames == null ? void 0 : classNames.label }), onClick, children: label })
|
|
4384
|
-
] }),
|
|
4385
|
-
data.map((node) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
4386
|
-
TreeNodeItem,
|
|
4387
|
-
{
|
|
4388
|
-
node,
|
|
4389
|
-
depth: 1,
|
|
4390
|
-
classNames,
|
|
4391
|
-
fileIcon,
|
|
4392
|
-
isLoading
|
|
4393
|
-
},
|
|
4394
|
-
node.id
|
|
4395
|
-
))
|
|
4396
|
-
] })
|
|
4397
|
-
] });
|
|
4408
|
+
isOpen && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { children: [
|
|
4409
|
+
isLoadingChildren && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "text-neutral py-1 text-sm", children: "loading..." }),
|
|
4410
|
+
children == null ? void 0 : children.map((child) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
4411
|
+
TreeNodeItem,
|
|
4412
|
+
{
|
|
4413
|
+
node: child,
|
|
4414
|
+
depth: depth + 1,
|
|
4415
|
+
classNames,
|
|
4416
|
+
fileIcon,
|
|
4417
|
+
onExpand
|
|
4418
|
+
},
|
|
4419
|
+
child.id
|
|
4420
|
+
))
|
|
4421
|
+
] })
|
|
4422
|
+
]
|
|
4423
|
+
}
|
|
4424
|
+
);
|
|
4398
4425
|
}
|
|
4399
4426
|
);
|
|
4400
4427
|
TreeNodeItem.displayName = "TreeNodeItem";
|
|
4428
|
+
var Tree = ({
|
|
4429
|
+
headerContent,
|
|
4430
|
+
group,
|
|
4431
|
+
groupIcon,
|
|
4432
|
+
fileIcon,
|
|
4433
|
+
isLoading = false,
|
|
4434
|
+
classNames,
|
|
4435
|
+
onExpand
|
|
4436
|
+
}) => {
|
|
4437
|
+
const slots = (0, import_react.useMemo)(() => treeStyle(), []);
|
|
4438
|
+
const [isOpen, setIsOpen] = (0, import_react.useState)(true);
|
|
4439
|
+
const handleToggle = () => {
|
|
4440
|
+
var _a;
|
|
4441
|
+
setIsOpen((prev) => !prev);
|
|
4442
|
+
(_a = group.onClick) == null ? void 0 : _a.call(group);
|
|
4443
|
+
};
|
|
4444
|
+
const handleRightClick = (e) => {
|
|
4445
|
+
var _a;
|
|
4446
|
+
e.preventDefault();
|
|
4447
|
+
(_a = group.onRightClick) == null ? void 0 : _a.call(group, e);
|
|
4448
|
+
};
|
|
4449
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: slots.base({ class: classNames == null ? void 0 : classNames.base }), children: [
|
|
4450
|
+
headerContent && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { children: headerContent }),
|
|
4451
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: slots.wrapper({ class: classNames == null ? void 0 : classNames.wrapper }), children: [
|
|
4452
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
4453
|
+
"div",
|
|
4454
|
+
{
|
|
4455
|
+
className: slots.group({ class: classNames == null ? void 0 : classNames.group }),
|
|
4456
|
+
onClick: handleToggle,
|
|
4457
|
+
onContextMenu: handleRightClick,
|
|
4458
|
+
children: [
|
|
4459
|
+
groupIcon,
|
|
4460
|
+
group.label
|
|
4461
|
+
]
|
|
4462
|
+
}
|
|
4463
|
+
),
|
|
4464
|
+
isOpen && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { children: group.data.map((node) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
4465
|
+
TreeNodeItem,
|
|
4466
|
+
{
|
|
4467
|
+
node,
|
|
4468
|
+
depth: 1,
|
|
4469
|
+
classNames,
|
|
4470
|
+
fileIcon,
|
|
4471
|
+
isLoading,
|
|
4472
|
+
onExpand
|
|
4473
|
+
},
|
|
4474
|
+
node.id
|
|
4475
|
+
)) })
|
|
4476
|
+
] })
|
|
4477
|
+
] });
|
|
4478
|
+
};
|
|
4401
4479
|
Tree.displayName = "Tree";
|
|
4402
4480
|
var tree_default = Tree;
|
|
4403
4481
|
var treeStyle = tv({
|
|
4404
4482
|
slots: {
|
|
4405
4483
|
base: ["border", "border-neutral-light", "rounded-xl", "p-[20px]", "flex", "flex-col", "gap-[20px]", "select-none"],
|
|
4406
|
-
wrapper: [
|
|
4484
|
+
wrapper: ["flex", "flex-col", "gap-[5px]"],
|
|
4485
|
+
group: [
|
|
4407
4486
|
"flex",
|
|
4408
4487
|
"items-center",
|
|
4409
4488
|
"gap-[5px]",
|
|
@@ -4412,8 +4491,12 @@ var treeStyle = tv({
|
|
|
4412
4491
|
"text-body-foreground",
|
|
4413
4492
|
"hover:bg-neutral-soft",
|
|
4414
4493
|
"p-[5px]",
|
|
4415
|
-
"rounded-[5px]"
|
|
4416
|
-
|
|
4417
|
-
|
|
4494
|
+
"rounded-[5px]",
|
|
4495
|
+
"cursor-pointer"
|
|
4496
|
+
]
|
|
4418
4497
|
}
|
|
4419
4498
|
});
|
|
4499
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
4500
|
+
0 && (module.exports = {
|
|
4501
|
+
Tree
|
|
4502
|
+
});
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
|
+
Tree,
|
|
3
4
|
tree_default
|
|
4
|
-
} from "../../chunk-
|
|
5
|
+
} from "../../chunk-PX4PFLJ3.mjs";
|
|
5
6
|
import "../../chunk-ZYIIXWVY.mjs";
|
|
6
7
|
import "../../chunk-HWL7TPUN.mjs";
|
|
7
8
|
import "../../chunk-3IU2RPSM.mjs";
|
|
@@ -9,5 +10,6 @@ import "../../chunk-4ZJFD3L3.mjs";
|
|
|
9
10
|
import "../../chunk-27Y6K5NK.mjs";
|
|
10
11
|
import "../../chunk-AC6TWLRT.mjs";
|
|
11
12
|
export {
|
|
13
|
+
Tree,
|
|
12
14
|
tree_default as default
|
|
13
15
|
};
|
package/dist/index.d.mts
CHANGED
|
@@ -9,7 +9,7 @@ export { default as Input } from './components/input/input.mjs';
|
|
|
9
9
|
export { default as Tabs, TabsDataType } from './components/tabs/tabs.mjs';
|
|
10
10
|
export { default as Textarea } from './components/textarea/textarea.mjs';
|
|
11
11
|
export { default as Table, TableColumn, TableRow } from './components/table/table.mjs';
|
|
12
|
-
export { default as
|
|
12
|
+
export { default as DefinitionTable } from './components/table/definition-table.mjs';
|
|
13
13
|
export { default as Select } from './components/select/select.mjs';
|
|
14
14
|
export { default as CheckBox } from './components/checkbox/checkbox.mjs';
|
|
15
15
|
export { default as Chip } from './components/chip/chip.mjs';
|
package/dist/index.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ export { default as Input } from './components/input/input.js';
|
|
|
9
9
|
export { default as Tabs, TabsDataType } from './components/tabs/tabs.js';
|
|
10
10
|
export { default as Textarea } from './components/textarea/textarea.js';
|
|
11
11
|
export { default as Table, TableColumn, TableRow } from './components/table/table.js';
|
|
12
|
-
export { default as
|
|
12
|
+
export { default as DefinitionTable } from './components/table/definition-table.js';
|
|
13
13
|
export { default as Select } from './components/select/select.js';
|
|
14
14
|
export { default as CheckBox } from './components/checkbox/checkbox.js';
|
|
15
15
|
export { default as Chip } from './components/chip/chip.js';
|