@deepnoid/ui 0.1.198 → 0.1.200
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 +177 -177
- package/dist/{chunk-4E5OF43U.mjs → chunk-75ZDPLJ4.mjs} +33 -10
- package/dist/{chunk-K7FQTARY.mjs → chunk-KYWCJIXI.mjs} +1 -0
- package/dist/{chunk-STV6EZHD.mjs → chunk-VXO7B27Q.mjs} +21 -7
- package/dist/{chunk-ZP2EQULZ.mjs → chunk-YBXBTE5T.mjs} +1 -1
- package/dist/components/picker/index.js +33 -10
- package/dist/components/picker/index.mjs +2 -2
- package/dist/components/picker/timePicker.js +33 -10
- package/dist/components/picker/timePicker.mjs +2 -2
- package/dist/components/select/index.d.mts +1 -1
- package/dist/components/select/index.d.ts +1 -1
- package/dist/components/select/index.js +33 -10
- package/dist/components/select/index.mjs +1 -1
- package/dist/components/select/select.d.mts +12 -9
- package/dist/components/select/select.d.ts +12 -9
- package/dist/components/select/select.js +33 -10
- package/dist/components/select/select.mjs +1 -1
- package/dist/components/table/index.js +1 -0
- package/dist/components/table/index.mjs +3 -3
- package/dist/components/table/table-body.js +1 -0
- package/dist/components/table/table-body.mjs +1 -1
- package/dist/components/table/table-head.js +1 -0
- package/dist/components/table/table-head.mjs +1 -1
- package/dist/components/table/table.js +1 -0
- package/dist/components/table/table.mjs +1 -1
- package/dist/components/toast/index.mjs +2 -2
- package/dist/components/toast/use-toast.mjs +2 -2
- package/dist/components/tree/index.js +19 -6
- package/dist/components/tree/index.mjs +1 -1
- package/dist/components/tree/tree.d.mts +11 -1
- package/dist/components/tree/tree.d.ts +11 -1
- package/dist/components/tree/tree.js +22 -7
- 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 +53 -16
- package/dist/index.mjs +19 -19
- package/package.json +1 -1
- package/dist/{chunk-L3A3IEKZ.mjs → chunk-SSGCTWWW.mjs} +3 -3
|
@@ -5198,8 +5198,9 @@ function toVal(mix) {
|
|
|
5198
5198
|
|
|
5199
5199
|
// src/components/select/select.tsx
|
|
5200
5200
|
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
5201
|
+
var ALL_OPTION_VALUE = "__ALL__";
|
|
5201
5202
|
var Select = (0, import_react.forwardRef)((originalProps, ref) => {
|
|
5202
|
-
var _a, _b;
|
|
5203
|
+
var _a, _b, _c;
|
|
5203
5204
|
const [props, variantProps] = mapPropsVariants(originalProps, select.variantKeys);
|
|
5204
5205
|
const {
|
|
5205
5206
|
label,
|
|
@@ -5210,6 +5211,7 @@ var Select = (0, import_react.forwardRef)((originalProps, ref) => {
|
|
|
5210
5211
|
defaultSelectedOptions,
|
|
5211
5212
|
onChange,
|
|
5212
5213
|
multiple,
|
|
5214
|
+
enableSelectAll,
|
|
5213
5215
|
dropdownIconName = "brace-up",
|
|
5214
5216
|
optionIconName,
|
|
5215
5217
|
optionIconPlacement,
|
|
@@ -5251,10 +5253,14 @@ var Select = (0, import_react.forwardRef)((originalProps, ref) => {
|
|
|
5251
5253
|
};
|
|
5252
5254
|
};
|
|
5253
5255
|
const handleChangeOption = (option) => {
|
|
5254
|
-
let nextOptions;
|
|
5256
|
+
let nextOptions = [];
|
|
5255
5257
|
if (multiple) {
|
|
5256
|
-
|
|
5257
|
-
|
|
5258
|
+
if (enableSelectAll && option.value === ALL_OPTION_VALUE) {
|
|
5259
|
+
nextOptions = selectedOptions.length === options.length ? [] : [...options];
|
|
5260
|
+
} else {
|
|
5261
|
+
const exists = selectedOptions.some((o) => o.value === option.value);
|
|
5262
|
+
nextOptions = exists ? selectedOptions.filter((o) => o.value !== option.value) : [...selectedOptions, option];
|
|
5263
|
+
}
|
|
5258
5264
|
} else {
|
|
5259
5265
|
nextOptions = [option];
|
|
5260
5266
|
closeSelect();
|
|
@@ -5288,10 +5294,26 @@ var Select = (0, import_react.forwardRef)((originalProps, ref) => {
|
|
|
5288
5294
|
}
|
|
5289
5295
|
}, [originalProps.value, defaultSelectedOptions, options]);
|
|
5290
5296
|
const position = targetRect ? calculatePositionWithScroll(targetRect, optionWrapperHeight) : null;
|
|
5291
|
-
|
|
5292
|
-
|
|
5297
|
+
let allOptionValue = "";
|
|
5298
|
+
if (multiple) {
|
|
5299
|
+
if (selectedOptions.length === 0) {
|
|
5300
|
+
allOptionValue = "\uC804\uCCB4 \uC120\uD0DD";
|
|
5301
|
+
} else if (selectedOptions.length === options.length) {
|
|
5302
|
+
allOptionValue = `\uC804\uCCB4 (${options.length}) \uC120\uD0DD\uB428`;
|
|
5303
|
+
} else {
|
|
5304
|
+
allOptionValue = `${selectedOptions.length} / ${options.length} \uC120\uD0DD\uB428`;
|
|
5305
|
+
}
|
|
5306
|
+
} else {
|
|
5307
|
+
allOptionValue = ((_a = selectedOptions[0]) == null ? void 0 : _a.label) || "";
|
|
5308
|
+
}
|
|
5309
|
+
const displayValue = multiple ? selectedOptions.map((opt) => opt.label).join(", ") : ((_b = selectedOptions[0]) == null ? void 0 : _b.label) || "";
|
|
5310
|
+
const selectedValue = multiple ? selectedOptions.map((opt) => opt.value).join(",") : ((_c = selectedOptions[0]) == null ? void 0 : _c.value) || "";
|
|
5293
5311
|
const renderOptions = () => {
|
|
5294
5312
|
if (!isVisible) return null;
|
|
5313
|
+
const renderedOptions = [...options];
|
|
5314
|
+
if (multiple && enableSelectAll) {
|
|
5315
|
+
renderedOptions.unshift({ label: allOptionValue, value: ALL_OPTION_VALUE });
|
|
5316
|
+
}
|
|
5295
5317
|
return (0, import_react_dom.createPortal)(
|
|
5296
5318
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
5297
5319
|
"div",
|
|
@@ -5309,8 +5331,8 @@ var Select = (0, import_react.forwardRef)((originalProps, ref) => {
|
|
|
5309
5331
|
transform: isOpen ? "translateY(0)" : "translateY(-0.25rem)",
|
|
5310
5332
|
transition: "opacity 150ms ease-out, transform 150ms ease-out"
|
|
5311
5333
|
},
|
|
5312
|
-
children:
|
|
5313
|
-
const isSelected = selectedOptions.some((o) => o.value === option.value);
|
|
5334
|
+
children: renderedOptions.map((option) => {
|
|
5335
|
+
const isSelected = option.value === ALL_OPTION_VALUE ? selectedOptions.length === options.length : selectedOptions.some((o) => o.value === option.value);
|
|
5314
5336
|
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
5315
5337
|
"div",
|
|
5316
5338
|
{
|
|
@@ -5421,7 +5443,8 @@ var select = tv({
|
|
|
5421
5443
|
"placeholder:text-neutral-main",
|
|
5422
5444
|
"text-body-foreground",
|
|
5423
5445
|
"group-has-[p.error]/select:text-danger-main",
|
|
5424
|
-
"group-has-[p.error]/select:placeholder:text-danger-main"
|
|
5446
|
+
"group-has-[p.error]/select:placeholder:text-danger-main",
|
|
5447
|
+
"truncate"
|
|
5425
5448
|
],
|
|
5426
5449
|
optionsWrapper: ["bg-body-background", "overflow-auto", "flex", "flex-col", "gap-[10px]"],
|
|
5427
5450
|
option: [
|
|
@@ -5520,7 +5543,7 @@ var select = tv({
|
|
|
5520
5543
|
selectWrapper: ["w-[240px]", "h-[50px]", "rounded-xl", "px-[10px]"],
|
|
5521
5544
|
select: ["text-xl"],
|
|
5522
5545
|
optionsWrapper: ["shadow-drop-xl", "rounded-xl", "p-[10px]"],
|
|
5523
|
-
option: ["px-[10px]", "py-[11.5px]",
|
|
5546
|
+
option: ["px-[10px]", "py-[11.5px]", "rounded-xl", "text-xl", "gap-[10px]"],
|
|
5524
5547
|
helperMessage: ["text-md"],
|
|
5525
5548
|
errorMessage: ["text-md"]
|
|
5526
5549
|
}
|
|
@@ -826,6 +826,7 @@ var TableBody = ({
|
|
|
826
826
|
"tr",
|
|
827
827
|
{
|
|
828
828
|
className: slots.tr({ class: classNames == null ? void 0 : classNames.tr }),
|
|
829
|
+
"data-checked": checkedRows.has(row.id),
|
|
829
830
|
onClick: typeof onRowClick === "function" ? (event) => onRowClick(row, rowIndex, event) : void 0,
|
|
830
831
|
children: [
|
|
831
832
|
columns.map((column, colIdx) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import "../../chunk-DX3KXNP6.mjs";
|
|
3
|
+
import {
|
|
4
|
+
table_default
|
|
5
|
+
} from "../../chunk-KYWCJIXI.mjs";
|
|
3
6
|
import {
|
|
4
7
|
definition_table_default
|
|
5
8
|
} from "../../chunk-DS5CGU2X.mjs";
|
|
6
|
-
import {
|
|
7
|
-
table_default
|
|
8
|
-
} from "../../chunk-K7FQTARY.mjs";
|
|
9
9
|
import "../../chunk-7B7LRG5J.mjs";
|
|
10
10
|
import "../../chunk-VVCSY7DG.mjs";
|
|
11
11
|
import "../../chunk-F3HENRVM.mjs";
|
|
@@ -6800,6 +6800,7 @@ var TableBody = ({
|
|
|
6800
6800
|
"tr",
|
|
6801
6801
|
{
|
|
6802
6802
|
className: slots.tr({ class: classNames == null ? void 0 : classNames.tr }),
|
|
6803
|
+
"data-checked": checkedRows.has(row.id),
|
|
6803
6804
|
onClick: typeof onRowClick === "function" ? (event) => onRowClick(row, rowIndex, event) : void 0,
|
|
6804
6805
|
children: [
|
|
6805
6806
|
columns.map((column, colIdx) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
@@ -723,6 +723,7 @@ var TableBody = ({
|
|
|
723
723
|
"tr",
|
|
724
724
|
{
|
|
725
725
|
className: slots.tr({ class: classNames == null ? void 0 : classNames.tr }),
|
|
726
|
+
"data-checked": checkedRows.has(row.id),
|
|
726
727
|
onClick: typeof onRowClick === "function" ? (event) => onRowClick(row, rowIndex, event) : void 0,
|
|
727
728
|
children: [
|
|
728
729
|
columns.map((column, colIdx) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
@@ -824,6 +824,7 @@ var TableBody = ({
|
|
|
824
824
|
"tr",
|
|
825
825
|
{
|
|
826
826
|
className: slots.tr({ class: classNames == null ? void 0 : classNames.tr }),
|
|
827
|
+
"data-checked": checkedRows.has(row.id),
|
|
827
828
|
onClick: typeof onRowClick === "function" ? (event) => onRowClick(row, rowIndex, event) : void 0,
|
|
828
829
|
children: [
|
|
829
830
|
columns.map((column, colIdx) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
@@ -3,11 +3,11 @@ import "../../chunk-LUWGOKLG.mjs";
|
|
|
3
3
|
import {
|
|
4
4
|
ToastProvider,
|
|
5
5
|
useToast
|
|
6
|
-
} from "../../chunk-
|
|
6
|
+
} from "../../chunk-SSGCTWWW.mjs";
|
|
7
|
+
import "../../chunk-ZOTHPHXA.mjs";
|
|
7
8
|
import {
|
|
8
9
|
toast_default
|
|
9
10
|
} from "../../chunk-4F7SIDZB.mjs";
|
|
10
|
-
import "../../chunk-ZOTHPHXA.mjs";
|
|
11
11
|
import "../../chunk-ZYIIXWVY.mjs";
|
|
12
12
|
import "../../chunk-YEYUS6DW.mjs";
|
|
13
13
|
import "../../chunk-E3G5QXSH.mjs";
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
import {
|
|
3
3
|
ToastProvider,
|
|
4
4
|
useToast
|
|
5
|
-
} from "../../chunk-
|
|
6
|
-
import "../../chunk-4F7SIDZB.mjs";
|
|
5
|
+
} from "../../chunk-SSGCTWWW.mjs";
|
|
7
6
|
import "../../chunk-ZOTHPHXA.mjs";
|
|
7
|
+
import "../../chunk-4F7SIDZB.mjs";
|
|
8
8
|
import "../../chunk-ZYIIXWVY.mjs";
|
|
9
9
|
import "../../chunk-YEYUS6DW.mjs";
|
|
10
10
|
import "../../chunk-E3G5QXSH.mjs";
|
|
@@ -5179,11 +5179,18 @@ function toVal(mix) {
|
|
|
5179
5179
|
|
|
5180
5180
|
// src/components/tree/tree.tsx
|
|
5181
5181
|
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
5182
|
-
var
|
|
5182
|
+
var TreeNodeItemBase = (0, import_react.forwardRef)(
|
|
5183
5183
|
({ node, depth, fileIcon, selectedName, classNames, onExpand }, ref) => {
|
|
5184
|
-
const [isOpen, setIsOpen] = (0, import_react.useState)(false);
|
|
5185
|
-
const [children, setChildren] = (0, import_react.useState)(node.children);
|
|
5186
5184
|
const slots = (0, import_react.useMemo)(() => treeStyle(), []);
|
|
5185
|
+
const hasSelectedInChildren = (0, import_react.useCallback)(
|
|
5186
|
+
(children2) => {
|
|
5187
|
+
if (!children2) return false;
|
|
5188
|
+
return children2.some((child) => child.selectedName === selectedName || hasSelectedInChildren(child.children));
|
|
5189
|
+
},
|
|
5190
|
+
[selectedName]
|
|
5191
|
+
);
|
|
5192
|
+
const [children, setChildren] = (0, import_react.useState)(node.children);
|
|
5193
|
+
const [isOpen, setIsOpen] = (0, import_react.useState)(() => hasSelectedInChildren(node.children));
|
|
5187
5194
|
const hasMore = (0, import_react.useMemo)(() => {
|
|
5188
5195
|
if (node.isLeaf) return false;
|
|
5189
5196
|
if (Array.isArray(children)) return children.length > 0;
|
|
@@ -5196,7 +5203,6 @@ var TreeNodeItem = (0, import_react.forwardRef)(
|
|
|
5196
5203
|
setChildren(result);
|
|
5197
5204
|
} catch (e) {
|
|
5198
5205
|
console.error("Failed to load child nodes ", e);
|
|
5199
|
-
} finally {
|
|
5200
5206
|
}
|
|
5201
5207
|
}
|
|
5202
5208
|
setIsOpen((prev) => !prev);
|
|
@@ -5211,6 +5217,12 @@ var TreeNodeItem = (0, import_react.forwardRef)(
|
|
|
5211
5217
|
e.preventDefault();
|
|
5212
5218
|
(_a = node.onRightClick) == null ? void 0 : _a.call(node, e);
|
|
5213
5219
|
};
|
|
5220
|
+
(0, import_react.useEffect)(() => {
|
|
5221
|
+
const shouldOpen = hasSelectedInChildren(children);
|
|
5222
|
+
if (shouldOpen !== isOpen) {
|
|
5223
|
+
setIsOpen(shouldOpen);
|
|
5224
|
+
}
|
|
5225
|
+
}, [selectedName, children, hasSelectedInChildren, isOpen]);
|
|
5214
5226
|
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
5215
5227
|
"div",
|
|
5216
5228
|
{
|
|
@@ -5226,7 +5238,7 @@ var TreeNodeItem = (0, import_react.forwardRef)(
|
|
|
5226
5238
|
className: clsx(
|
|
5227
5239
|
slots.node({ class: classNames == null ? void 0 : classNames.node }),
|
|
5228
5240
|
slots.clickable({ class: classNames == null ? void 0 : classNames.clickable }),
|
|
5229
|
-
selectedName
|
|
5241
|
+
selectedName === node.selectedName ? "bg-neutral-soft" : ""
|
|
5230
5242
|
),
|
|
5231
5243
|
onClick: handleClick,
|
|
5232
5244
|
onContextMenu: handleRightClick,
|
|
@@ -5263,7 +5275,8 @@ var TreeNodeItem = (0, import_react.forwardRef)(
|
|
|
5263
5275
|
);
|
|
5264
5276
|
}
|
|
5265
5277
|
);
|
|
5266
|
-
|
|
5278
|
+
TreeNodeItemBase.displayName = "TreeNodeItem";
|
|
5279
|
+
var TreeNodeItem = (0, import_react.memo)(TreeNodeItemBase);
|
|
5267
5280
|
var Tree = ({ headerContent, group, groupIcon, fileIcon, selectedName, classNames, onExpand }) => {
|
|
5268
5281
|
const slots = (0, import_react.useMemo)(() => treeStyle(), []);
|
|
5269
5282
|
const handleClick = (e) => {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as tailwind_variants from 'tailwind-variants';
|
|
2
2
|
import * as tailwind_merge from 'tailwind-merge';
|
|
3
3
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
|
+
import * as react from 'react';
|
|
4
5
|
import { ReactNode, MouseEvent } from 'react';
|
|
5
6
|
import { SlotsToClasses } from '../../utils/types.mjs';
|
|
6
7
|
|
|
@@ -13,6 +14,15 @@ type TreeNode = {
|
|
|
13
14
|
onClick?: (event: MouseEvent<HTMLDivElement>) => void;
|
|
14
15
|
onRightClick?: (event: MouseEvent<HTMLDivElement>) => void;
|
|
15
16
|
};
|
|
17
|
+
type Props = {
|
|
18
|
+
node: TreeNode;
|
|
19
|
+
depth: number;
|
|
20
|
+
fileIcon?: ReactNode;
|
|
21
|
+
selectedName?: string;
|
|
22
|
+
classNames?: SlotsToClasses<TreeSlots>;
|
|
23
|
+
onExpand?: (node: TreeNode) => Promise<TreeNode[]>;
|
|
24
|
+
};
|
|
25
|
+
declare const TreeNodeItem: react.NamedExoticComponent<Props & react.RefAttributes<HTMLDivElement>>;
|
|
16
26
|
interface TreeProps {
|
|
17
27
|
headerContent?: ReactNode;
|
|
18
28
|
group: {
|
|
@@ -95,4 +105,4 @@ declare const treeStyle: tailwind_variants.TVReturnType<{
|
|
|
95
105
|
}, undefined, unknown, unknown, undefined>>;
|
|
96
106
|
type TreeSlots = keyof ReturnType<typeof treeStyle>;
|
|
97
107
|
|
|
98
|
-
export { Tree, type TreeNode, type TreeProps, Tree as default };
|
|
108
|
+
export { Tree, type TreeNode, TreeNodeItem, type TreeProps, Tree as default };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as tailwind_variants from 'tailwind-variants';
|
|
2
2
|
import * as tailwind_merge from 'tailwind-merge';
|
|
3
3
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
|
+
import * as react from 'react';
|
|
4
5
|
import { ReactNode, MouseEvent } from 'react';
|
|
5
6
|
import { SlotsToClasses } from '../../utils/types.js';
|
|
6
7
|
|
|
@@ -13,6 +14,15 @@ type TreeNode = {
|
|
|
13
14
|
onClick?: (event: MouseEvent<HTMLDivElement>) => void;
|
|
14
15
|
onRightClick?: (event: MouseEvent<HTMLDivElement>) => void;
|
|
15
16
|
};
|
|
17
|
+
type Props = {
|
|
18
|
+
node: TreeNode;
|
|
19
|
+
depth: number;
|
|
20
|
+
fileIcon?: ReactNode;
|
|
21
|
+
selectedName?: string;
|
|
22
|
+
classNames?: SlotsToClasses<TreeSlots>;
|
|
23
|
+
onExpand?: (node: TreeNode) => Promise<TreeNode[]>;
|
|
24
|
+
};
|
|
25
|
+
declare const TreeNodeItem: react.NamedExoticComponent<Props & react.RefAttributes<HTMLDivElement>>;
|
|
16
26
|
interface TreeProps {
|
|
17
27
|
headerContent?: ReactNode;
|
|
18
28
|
group: {
|
|
@@ -95,4 +105,4 @@ declare const treeStyle: tailwind_variants.TVReturnType<{
|
|
|
95
105
|
}, undefined, unknown, unknown, undefined>>;
|
|
96
106
|
type TreeSlots = keyof ReturnType<typeof treeStyle>;
|
|
97
107
|
|
|
98
|
-
export { Tree, type TreeNode, type TreeProps, Tree as default };
|
|
108
|
+
export { Tree, type TreeNode, TreeNodeItem, type TreeProps, Tree as default };
|
|
@@ -103,6 +103,7 @@ var require_plugin = __commonJS({
|
|
|
103
103
|
var tree_exports = {};
|
|
104
104
|
__export(tree_exports, {
|
|
105
105
|
Tree: () => Tree,
|
|
106
|
+
TreeNodeItem: () => TreeNodeItem,
|
|
106
107
|
default: () => tree_default
|
|
107
108
|
});
|
|
108
109
|
module.exports = __toCommonJS(tree_exports);
|
|
@@ -5178,11 +5179,18 @@ function toVal(mix) {
|
|
|
5178
5179
|
|
|
5179
5180
|
// src/components/tree/tree.tsx
|
|
5180
5181
|
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
5181
|
-
var
|
|
5182
|
+
var TreeNodeItemBase = (0, import_react.forwardRef)(
|
|
5182
5183
|
({ node, depth, fileIcon, selectedName, classNames, onExpand }, ref) => {
|
|
5183
|
-
const [isOpen, setIsOpen] = (0, import_react.useState)(false);
|
|
5184
|
-
const [children, setChildren] = (0, import_react.useState)(node.children);
|
|
5185
5184
|
const slots = (0, import_react.useMemo)(() => treeStyle(), []);
|
|
5185
|
+
const hasSelectedInChildren = (0, import_react.useCallback)(
|
|
5186
|
+
(children2) => {
|
|
5187
|
+
if (!children2) return false;
|
|
5188
|
+
return children2.some((child) => child.selectedName === selectedName || hasSelectedInChildren(child.children));
|
|
5189
|
+
},
|
|
5190
|
+
[selectedName]
|
|
5191
|
+
);
|
|
5192
|
+
const [children, setChildren] = (0, import_react.useState)(node.children);
|
|
5193
|
+
const [isOpen, setIsOpen] = (0, import_react.useState)(() => hasSelectedInChildren(node.children));
|
|
5186
5194
|
const hasMore = (0, import_react.useMemo)(() => {
|
|
5187
5195
|
if (node.isLeaf) return false;
|
|
5188
5196
|
if (Array.isArray(children)) return children.length > 0;
|
|
@@ -5195,7 +5203,6 @@ var TreeNodeItem = (0, import_react.forwardRef)(
|
|
|
5195
5203
|
setChildren(result);
|
|
5196
5204
|
} catch (e) {
|
|
5197
5205
|
console.error("Failed to load child nodes ", e);
|
|
5198
|
-
} finally {
|
|
5199
5206
|
}
|
|
5200
5207
|
}
|
|
5201
5208
|
setIsOpen((prev) => !prev);
|
|
@@ -5210,6 +5217,12 @@ var TreeNodeItem = (0, import_react.forwardRef)(
|
|
|
5210
5217
|
e.preventDefault();
|
|
5211
5218
|
(_a = node.onRightClick) == null ? void 0 : _a.call(node, e);
|
|
5212
5219
|
};
|
|
5220
|
+
(0, import_react.useEffect)(() => {
|
|
5221
|
+
const shouldOpen = hasSelectedInChildren(children);
|
|
5222
|
+
if (shouldOpen !== isOpen) {
|
|
5223
|
+
setIsOpen(shouldOpen);
|
|
5224
|
+
}
|
|
5225
|
+
}, [selectedName, children, hasSelectedInChildren, isOpen]);
|
|
5213
5226
|
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
5214
5227
|
"div",
|
|
5215
5228
|
{
|
|
@@ -5225,7 +5238,7 @@ var TreeNodeItem = (0, import_react.forwardRef)(
|
|
|
5225
5238
|
className: clsx(
|
|
5226
5239
|
slots.node({ class: classNames == null ? void 0 : classNames.node }),
|
|
5227
5240
|
slots.clickable({ class: classNames == null ? void 0 : classNames.clickable }),
|
|
5228
|
-
selectedName
|
|
5241
|
+
selectedName === node.selectedName ? "bg-neutral-soft" : ""
|
|
5229
5242
|
),
|
|
5230
5243
|
onClick: handleClick,
|
|
5231
5244
|
onContextMenu: handleRightClick,
|
|
@@ -5262,7 +5275,8 @@ var TreeNodeItem = (0, import_react.forwardRef)(
|
|
|
5262
5275
|
);
|
|
5263
5276
|
}
|
|
5264
5277
|
);
|
|
5265
|
-
|
|
5278
|
+
TreeNodeItemBase.displayName = "TreeNodeItem";
|
|
5279
|
+
var TreeNodeItem = (0, import_react.memo)(TreeNodeItemBase);
|
|
5266
5280
|
var Tree = ({ headerContent, group, groupIcon, fileIcon, selectedName, classNames, onExpand }) => {
|
|
5267
5281
|
const slots = (0, import_react.useMemo)(() => treeStyle(), []);
|
|
5268
5282
|
const handleClick = (e) => {
|
|
@@ -5332,5 +5346,6 @@ var treeStyle = tv({
|
|
|
5332
5346
|
});
|
|
5333
5347
|
// Annotate the CommonJS export names for ESM import in node:
|
|
5334
5348
|
0 && (module.exports = {
|
|
5335
|
-
Tree
|
|
5349
|
+
Tree,
|
|
5350
|
+
TreeNodeItem
|
|
5336
5351
|
});
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
Tree,
|
|
4
|
+
TreeNodeItem,
|
|
4
5
|
tree_default
|
|
5
|
-
} from "../../chunk-
|
|
6
|
+
} from "../../chunk-VXO7B27Q.mjs";
|
|
6
7
|
import "../../chunk-ZYIIXWVY.mjs";
|
|
7
8
|
import "../../chunk-YEYUS6DW.mjs";
|
|
8
9
|
import "../../chunk-5BT37SLM.mjs";
|
|
@@ -11,5 +12,6 @@ import "../../chunk-27Y6K5NK.mjs";
|
|
|
11
12
|
import "../../chunk-AC6TWLRT.mjs";
|
|
12
13
|
export {
|
|
13
14
|
Tree,
|
|
15
|
+
TreeNodeItem,
|
|
14
16
|
tree_default as default
|
|
15
17
|
};
|
package/dist/index.d.mts
CHANGED
|
@@ -12,7 +12,7 @@ export { default as Tabs, TabsDataType } from './components/tabs/tabs.mjs';
|
|
|
12
12
|
export { default as Textarea, TextareaProps } from './components/textarea/textarea.mjs';
|
|
13
13
|
export { default as Table, TableColumn, TableProps, TableRef, TableRow } from './components/table/table.mjs';
|
|
14
14
|
export { default as DefinitionTable, DefinitionTableRow, DefinitionTableRowCell } from './components/table/definition-table.mjs';
|
|
15
|
-
export { default as Select, SelectOption, SelectProps } from './components/select/select.mjs';
|
|
15
|
+
export { MultiSelectValue, default as Select, SelectOption, SelectOptionValue, SelectProps } from './components/select/select.mjs';
|
|
16
16
|
export { default as CheckBox } from './components/checkbox/checkbox.mjs';
|
|
17
17
|
export { default as Chip } from './components/chip/chip.mjs';
|
|
18
18
|
export { default as Radio, RadioProps } from './components/radio/radio.mjs';
|
package/dist/index.d.ts
CHANGED
|
@@ -12,7 +12,7 @@ export { default as Tabs, TabsDataType } from './components/tabs/tabs.js';
|
|
|
12
12
|
export { default as Textarea, TextareaProps } from './components/textarea/textarea.js';
|
|
13
13
|
export { default as Table, TableColumn, TableProps, TableRef, TableRow } from './components/table/table.js';
|
|
14
14
|
export { default as DefinitionTable, DefinitionTableRow, DefinitionTableRowCell } from './components/table/definition-table.js';
|
|
15
|
-
export { default as Select, SelectOption, SelectProps } from './components/select/select.js';
|
|
15
|
+
export { MultiSelectValue, default as Select, SelectOption, SelectOptionValue, SelectProps } from './components/select/select.js';
|
|
16
16
|
export { default as CheckBox } from './components/checkbox/checkbox.js';
|
|
17
17
|
export { default as Chip } from './components/chip/chip.js';
|
|
18
18
|
export { default as Radio, RadioProps } from './components/radio/radio.js';
|
package/dist/index.js
CHANGED
|
@@ -8382,6 +8382,7 @@ var TableBody = ({
|
|
|
8382
8382
|
"tr",
|
|
8383
8383
|
{
|
|
8384
8384
|
className: slots.tr({ class: classNames == null ? void 0 : classNames.tr }),
|
|
8385
|
+
"data-checked": checkedRows.has(row.id),
|
|
8385
8386
|
onClick: typeof onRowClick === "function" ? (event) => onRowClick(row, rowIndex, event) : void 0,
|
|
8386
8387
|
children: [
|
|
8387
8388
|
columns.map((column, colIdx) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
@@ -9357,8 +9358,9 @@ var DefinitionTableStyle = tv({
|
|
|
9357
9358
|
var import_react21 = require("react");
|
|
9358
9359
|
var import_react_dom = require("react-dom");
|
|
9359
9360
|
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
9361
|
+
var ALL_OPTION_VALUE = "__ALL__";
|
|
9360
9362
|
var Select = (0, import_react21.forwardRef)((originalProps, ref) => {
|
|
9361
|
-
var _a, _b;
|
|
9363
|
+
var _a, _b, _c;
|
|
9362
9364
|
const [props, variantProps] = mapPropsVariants(originalProps, select.variantKeys);
|
|
9363
9365
|
const {
|
|
9364
9366
|
label,
|
|
@@ -9369,6 +9371,7 @@ var Select = (0, import_react21.forwardRef)((originalProps, ref) => {
|
|
|
9369
9371
|
defaultSelectedOptions,
|
|
9370
9372
|
onChange,
|
|
9371
9373
|
multiple,
|
|
9374
|
+
enableSelectAll,
|
|
9372
9375
|
dropdownIconName = "brace-up",
|
|
9373
9376
|
optionIconName,
|
|
9374
9377
|
optionIconPlacement,
|
|
@@ -9410,10 +9413,14 @@ var Select = (0, import_react21.forwardRef)((originalProps, ref) => {
|
|
|
9410
9413
|
};
|
|
9411
9414
|
};
|
|
9412
9415
|
const handleChangeOption = (option) => {
|
|
9413
|
-
let nextOptions;
|
|
9416
|
+
let nextOptions = [];
|
|
9414
9417
|
if (multiple) {
|
|
9415
|
-
|
|
9416
|
-
|
|
9418
|
+
if (enableSelectAll && option.value === ALL_OPTION_VALUE) {
|
|
9419
|
+
nextOptions = selectedOptions.length === options.length ? [] : [...options];
|
|
9420
|
+
} else {
|
|
9421
|
+
const exists = selectedOptions.some((o) => o.value === option.value);
|
|
9422
|
+
nextOptions = exists ? selectedOptions.filter((o) => o.value !== option.value) : [...selectedOptions, option];
|
|
9423
|
+
}
|
|
9417
9424
|
} else {
|
|
9418
9425
|
nextOptions = [option];
|
|
9419
9426
|
closeSelect();
|
|
@@ -9447,10 +9454,26 @@ var Select = (0, import_react21.forwardRef)((originalProps, ref) => {
|
|
|
9447
9454
|
}
|
|
9448
9455
|
}, [originalProps.value, defaultSelectedOptions, options]);
|
|
9449
9456
|
const position = targetRect ? calculatePositionWithScroll(targetRect, optionWrapperHeight) : null;
|
|
9450
|
-
|
|
9451
|
-
|
|
9457
|
+
let allOptionValue = "";
|
|
9458
|
+
if (multiple) {
|
|
9459
|
+
if (selectedOptions.length === 0) {
|
|
9460
|
+
allOptionValue = "\uC804\uCCB4 \uC120\uD0DD";
|
|
9461
|
+
} else if (selectedOptions.length === options.length) {
|
|
9462
|
+
allOptionValue = `\uC804\uCCB4 (${options.length}) \uC120\uD0DD\uB428`;
|
|
9463
|
+
} else {
|
|
9464
|
+
allOptionValue = `${selectedOptions.length} / ${options.length} \uC120\uD0DD\uB428`;
|
|
9465
|
+
}
|
|
9466
|
+
} else {
|
|
9467
|
+
allOptionValue = ((_a = selectedOptions[0]) == null ? void 0 : _a.label) || "";
|
|
9468
|
+
}
|
|
9469
|
+
const displayValue = multiple ? selectedOptions.map((opt) => opt.label).join(", ") : ((_b = selectedOptions[0]) == null ? void 0 : _b.label) || "";
|
|
9470
|
+
const selectedValue = multiple ? selectedOptions.map((opt) => opt.value).join(",") : ((_c = selectedOptions[0]) == null ? void 0 : _c.value) || "";
|
|
9452
9471
|
const renderOptions = () => {
|
|
9453
9472
|
if (!isVisible) return null;
|
|
9473
|
+
const renderedOptions = [...options];
|
|
9474
|
+
if (multiple && enableSelectAll) {
|
|
9475
|
+
renderedOptions.unshift({ label: allOptionValue, value: ALL_OPTION_VALUE });
|
|
9476
|
+
}
|
|
9454
9477
|
return (0, import_react_dom.createPortal)(
|
|
9455
9478
|
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
9456
9479
|
"div",
|
|
@@ -9468,8 +9491,8 @@ var Select = (0, import_react21.forwardRef)((originalProps, ref) => {
|
|
|
9468
9491
|
transform: isOpen ? "translateY(0)" : "translateY(-0.25rem)",
|
|
9469
9492
|
transition: "opacity 150ms ease-out, transform 150ms ease-out"
|
|
9470
9493
|
},
|
|
9471
|
-
children:
|
|
9472
|
-
const isSelected = selectedOptions.some((o) => o.value === option.value);
|
|
9494
|
+
children: renderedOptions.map((option) => {
|
|
9495
|
+
const isSelected = option.value === ALL_OPTION_VALUE ? selectedOptions.length === options.length : selectedOptions.some((o) => o.value === option.value);
|
|
9473
9496
|
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
9474
9497
|
"div",
|
|
9475
9498
|
{
|
|
@@ -9580,7 +9603,8 @@ var select = tv({
|
|
|
9580
9603
|
"placeholder:text-neutral-main",
|
|
9581
9604
|
"text-body-foreground",
|
|
9582
9605
|
"group-has-[p.error]/select:text-danger-main",
|
|
9583
|
-
"group-has-[p.error]/select:placeholder:text-danger-main"
|
|
9606
|
+
"group-has-[p.error]/select:placeholder:text-danger-main",
|
|
9607
|
+
"truncate"
|
|
9584
9608
|
],
|
|
9585
9609
|
optionsWrapper: ["bg-body-background", "overflow-auto", "flex", "flex-col", "gap-[10px]"],
|
|
9586
9610
|
option: [
|
|
@@ -9679,7 +9703,7 @@ var select = tv({
|
|
|
9679
9703
|
selectWrapper: ["w-[240px]", "h-[50px]", "rounded-xl", "px-[10px]"],
|
|
9680
9704
|
select: ["text-xl"],
|
|
9681
9705
|
optionsWrapper: ["shadow-drop-xl", "rounded-xl", "p-[10px]"],
|
|
9682
|
-
option: ["px-[10px]", "py-[11.5px]",
|
|
9706
|
+
option: ["px-[10px]", "py-[11.5px]", "rounded-xl", "text-xl", "gap-[10px]"],
|
|
9683
9707
|
helperMessage: ["text-md"],
|
|
9684
9708
|
errorMessage: ["text-md"]
|
|
9685
9709
|
}
|
|
@@ -12193,11 +12217,18 @@ var timePickerStyle = tv({
|
|
|
12193
12217
|
// src/components/tree/tree.tsx
|
|
12194
12218
|
var import_react36 = require("react");
|
|
12195
12219
|
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
12196
|
-
var
|
|
12220
|
+
var TreeNodeItemBase = (0, import_react36.forwardRef)(
|
|
12197
12221
|
({ node, depth, fileIcon, selectedName, classNames, onExpand }, ref) => {
|
|
12198
|
-
const [isOpen, setIsOpen] = (0, import_react36.useState)(false);
|
|
12199
|
-
const [children, setChildren] = (0, import_react36.useState)(node.children);
|
|
12200
12222
|
const slots = (0, import_react36.useMemo)(() => treeStyle(), []);
|
|
12223
|
+
const hasSelectedInChildren = (0, import_react36.useCallback)(
|
|
12224
|
+
(children2) => {
|
|
12225
|
+
if (!children2) return false;
|
|
12226
|
+
return children2.some((child) => child.selectedName === selectedName || hasSelectedInChildren(child.children));
|
|
12227
|
+
},
|
|
12228
|
+
[selectedName]
|
|
12229
|
+
);
|
|
12230
|
+
const [children, setChildren] = (0, import_react36.useState)(node.children);
|
|
12231
|
+
const [isOpen, setIsOpen] = (0, import_react36.useState)(() => hasSelectedInChildren(node.children));
|
|
12201
12232
|
const hasMore = (0, import_react36.useMemo)(() => {
|
|
12202
12233
|
if (node.isLeaf) return false;
|
|
12203
12234
|
if (Array.isArray(children)) return children.length > 0;
|
|
@@ -12210,7 +12241,6 @@ var TreeNodeItem = (0, import_react36.forwardRef)(
|
|
|
12210
12241
|
setChildren(result);
|
|
12211
12242
|
} catch (e) {
|
|
12212
12243
|
console.error("Failed to load child nodes ", e);
|
|
12213
|
-
} finally {
|
|
12214
12244
|
}
|
|
12215
12245
|
}
|
|
12216
12246
|
setIsOpen((prev) => !prev);
|
|
@@ -12225,6 +12255,12 @@ var TreeNodeItem = (0, import_react36.forwardRef)(
|
|
|
12225
12255
|
e.preventDefault();
|
|
12226
12256
|
(_a = node.onRightClick) == null ? void 0 : _a.call(node, e);
|
|
12227
12257
|
};
|
|
12258
|
+
(0, import_react36.useEffect)(() => {
|
|
12259
|
+
const shouldOpen = hasSelectedInChildren(children);
|
|
12260
|
+
if (shouldOpen !== isOpen) {
|
|
12261
|
+
setIsOpen(shouldOpen);
|
|
12262
|
+
}
|
|
12263
|
+
}, [selectedName, children, hasSelectedInChildren, isOpen]);
|
|
12228
12264
|
return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(
|
|
12229
12265
|
"div",
|
|
12230
12266
|
{
|
|
@@ -12240,7 +12276,7 @@ var TreeNodeItem = (0, import_react36.forwardRef)(
|
|
|
12240
12276
|
className: clsx(
|
|
12241
12277
|
slots.node({ class: classNames == null ? void 0 : classNames.node }),
|
|
12242
12278
|
slots.clickable({ class: classNames == null ? void 0 : classNames.clickable }),
|
|
12243
|
-
selectedName
|
|
12279
|
+
selectedName === node.selectedName ? "bg-neutral-soft" : ""
|
|
12244
12280
|
),
|
|
12245
12281
|
onClick: handleClick,
|
|
12246
12282
|
onContextMenu: handleRightClick,
|
|
@@ -12277,7 +12313,8 @@ var TreeNodeItem = (0, import_react36.forwardRef)(
|
|
|
12277
12313
|
);
|
|
12278
12314
|
}
|
|
12279
12315
|
);
|
|
12280
|
-
|
|
12316
|
+
TreeNodeItemBase.displayName = "TreeNodeItem";
|
|
12317
|
+
var TreeNodeItem = (0, import_react36.memo)(TreeNodeItemBase);
|
|
12281
12318
|
var Tree = ({ headerContent, group, groupIcon, fileIcon, selectedName, classNames, onExpand }) => {
|
|
12282
12319
|
const slots = (0, import_react36.useMemo)(() => treeStyle(), []);
|
|
12283
12320
|
const handleClick = (e) => {
|