@deepnoid/ui 0.1.26 → 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 +128 -124
- 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-PX4PFLJ3.mjs +178 -0
- package/dist/{chunk-EAK5DVWA.mjs → chunk-UNH3BCGN.mjs} +8 -1
- package/dist/{chunk-6OMHIMIA.mjs → chunk-XA6PVFTW.mjs} +2 -2
- 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 +7 -7
- 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 +4 -4
- package/dist/components/tree/index.d.mts +1 -0
- package/dist/components/tree/index.d.ts +1 -0
- package/dist/components/tree/index.js +124 -49
- 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 +129 -49
- 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 +180 -112
- package/dist/index.mjs +9 -9
- package/package.json +1 -1
- package/dist/chunk-ICZTNO4V.mjs +0 -49
- package/dist/chunk-TEQ723QO.mjs +0 -102
|
@@ -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);
|
|
@@ -4337,76 +4338,151 @@ function toVal(mix) {
|
|
|
4337
4338
|
// src/components/tree/tree.tsx
|
|
4338
4339
|
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
4339
4340
|
var TreeNodeItem = (0, import_react.forwardRef)(
|
|
4340
|
-
({ node, depth, fileIcon, isLoading, classNames }, ref) => {
|
|
4341
|
-
var _a;
|
|
4341
|
+
({ node, depth, fileIcon, isLoading, classNames, onExpand }, ref) => {
|
|
4342
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);
|
|
4343
4345
|
const slots = (0, import_react.useMemo)(() => treeStyle(), []);
|
|
4344
|
-
const
|
|
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
|
+
}
|
|
4345
4363
|
setIsOpen((prev) => !prev);
|
|
4346
|
-
}, []);
|
|
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]";
|
|
4347
4376
|
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
4348
4377
|
"div",
|
|
4349
4378
|
{
|
|
4350
4379
|
ref,
|
|
4351
4380
|
className: clsx(
|
|
4352
|
-
|
|
4381
|
+
marginClass,
|
|
4353
4382
|
"transition-all duration-150 ease-out",
|
|
4354
4383
|
isLoading ? "-translate-y-2 opacity-0" : "translate-y-0 opacity-100"
|
|
4355
4384
|
),
|
|
4356
4385
|
children: [
|
|
4357
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
4358
|
-
|
|
4359
|
-
|
|
4386
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
4387
|
+
"div",
|
|
4388
|
+
{
|
|
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
|
+
]
|
|
4406
|
+
}
|
|
4407
|
+
),
|
|
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,
|
|
4360
4412
|
{
|
|
4361
|
-
|
|
4362
|
-
|
|
4363
|
-
|
|
4364
|
-
|
|
4365
|
-
|
|
4366
|
-
|
|
4367
|
-
|
|
4368
|
-
|
|
4369
|
-
|
|
4370
|
-
] }),
|
|
4371
|
-
isOpen && ((_a = node.children) == null ? void 0 : _a.map((child) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(TreeNodeItem, { node: child, depth: depth + 1, classNames, fileIcon }, child.id)))
|
|
4413
|
+
node: child,
|
|
4414
|
+
depth: depth + 1,
|
|
4415
|
+
classNames,
|
|
4416
|
+
fileIcon,
|
|
4417
|
+
onExpand
|
|
4418
|
+
},
|
|
4419
|
+
child.id
|
|
4420
|
+
))
|
|
4421
|
+
] })
|
|
4372
4422
|
]
|
|
4373
4423
|
}
|
|
4374
4424
|
);
|
|
4375
4425
|
}
|
|
4376
4426
|
);
|
|
4377
|
-
var Tree = (0, import_react.forwardRef)(
|
|
4378
|
-
({ headerContent, group, groupIcon, fileIcon, isLoading, classNames }, ref) => {
|
|
4379
|
-
const { label, data, onClick } = group;
|
|
4380
|
-
const slots = (0, import_react.useMemo)(() => treeStyle(), []);
|
|
4381
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { ref, className: slots.base({ class: classNames == null ? void 0 : classNames.base }), children: [
|
|
4382
|
-
headerContent && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { children: headerContent }),
|
|
4383
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { children: [
|
|
4384
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: slots.wrapper({ class: classNames == null ? void 0 : classNames.wrapper }), children: [
|
|
4385
|
-
groupIcon,
|
|
4386
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: slots.label({ class: classNames == null ? void 0 : classNames.label }), onClick, children: label })
|
|
4387
|
-
] }),
|
|
4388
|
-
data.map((node) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
4389
|
-
TreeNodeItem,
|
|
4390
|
-
{
|
|
4391
|
-
node,
|
|
4392
|
-
depth: 1,
|
|
4393
|
-
classNames,
|
|
4394
|
-
fileIcon,
|
|
4395
|
-
isLoading
|
|
4396
|
-
},
|
|
4397
|
-
node.id
|
|
4398
|
-
))
|
|
4399
|
-
] })
|
|
4400
|
-
] });
|
|
4401
|
-
}
|
|
4402
|
-
);
|
|
4403
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
|
+
};
|
|
4404
4479
|
Tree.displayName = "Tree";
|
|
4405
4480
|
var tree_default = Tree;
|
|
4406
4481
|
var treeStyle = tv({
|
|
4407
4482
|
slots: {
|
|
4408
4483
|
base: ["border", "border-neutral-light", "rounded-xl", "p-[20px]", "flex", "flex-col", "gap-[20px]", "select-none"],
|
|
4409
|
-
wrapper: [
|
|
4484
|
+
wrapper: ["flex", "flex-col", "gap-[5px]"],
|
|
4485
|
+
group: [
|
|
4410
4486
|
"flex",
|
|
4411
4487
|
"items-center",
|
|
4412
4488
|
"gap-[5px]",
|
|
@@ -4415,8 +4491,12 @@ var treeStyle = tv({
|
|
|
4415
4491
|
"text-body-foreground",
|
|
4416
4492
|
"hover:bg-neutral-soft",
|
|
4417
4493
|
"p-[5px]",
|
|
4418
|
-
"rounded-[5px]"
|
|
4419
|
-
|
|
4420
|
-
|
|
4494
|
+
"rounded-[5px]",
|
|
4495
|
+
"cursor-pointer"
|
|
4496
|
+
]
|
|
4421
4497
|
}
|
|
4422
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';
|