@deepnoid/ui 0.1.199 → 0.1.201
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 +185 -185
- package/dist/{chunk-4E5OF43U.mjs → chunk-75ZDPLJ4.mjs} +33 -10
- package/dist/{chunk-STV6EZHD.mjs → chunk-F6BQCZ54.mjs} +27 -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 +4 -4
- 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.mjs +3 -3
- package/dist/components/toast/index.mjs +2 -2
- package/dist/components/toast/use-toast.mjs +2 -2
- package/dist/components/tree/index.js +25 -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 +28 -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 +58 -16
- package/dist/index.mjs +36 -36
- package/package.json +1 -1
- package/dist/{chunk-SSGCTWWW.mjs → chunk-L3A3IEKZ.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
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import "../../chunk-DX3KXNP6.mjs";
|
|
3
|
-
import {
|
|
4
|
-
table_default
|
|
5
|
-
} from "../../chunk-KYWCJIXI.mjs";
|
|
6
3
|
import {
|
|
7
4
|
definition_table_default
|
|
8
5
|
} from "../../chunk-DS5CGU2X.mjs";
|
|
6
|
+
import {
|
|
7
|
+
table_default
|
|
8
|
+
} from "../../chunk-KYWCJIXI.mjs";
|
|
9
9
|
import "../../chunk-7B7LRG5J.mjs";
|
|
10
10
|
import "../../chunk-VVCSY7DG.mjs";
|
|
11
11
|
import "../../chunk-F3HENRVM.mjs";
|
|
@@ -3,11 +3,11 @@ import "../../chunk-LUWGOKLG.mjs";
|
|
|
3
3
|
import {
|
|
4
4
|
ToastProvider,
|
|
5
5
|
useToast
|
|
6
|
-
} from "../../chunk-
|
|
7
|
-
import "../../chunk-ZOTHPHXA.mjs";
|
|
6
|
+
} from "../../chunk-L3A3IEKZ.mjs";
|
|
8
7
|
import {
|
|
9
8
|
toast_default
|
|
10
9
|
} 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-ZOTHPHXA.mjs";
|
|
5
|
+
} from "../../chunk-L3A3IEKZ.mjs";
|
|
7
6
|
import "../../chunk-4F7SIDZB.mjs";
|
|
7
|
+
import "../../chunk-ZOTHPHXA.mjs";
|
|
8
8
|
import "../../chunk-ZYIIXWVY.mjs";
|
|
9
9
|
import "../../chunk-YEYUS6DW.mjs";
|
|
10
10
|
import "../../chunk-E3G5QXSH.mjs";
|
|
@@ -5179,11 +5179,22 @@ 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 || !selectedName) 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)(() => {
|
|
5194
|
+
if (!selectedName) return false;
|
|
5195
|
+
return hasSelectedInChildren(node.children);
|
|
5196
|
+
});
|
|
5197
|
+
const hasOpenedInitially = (0, import_react.useRef)(false);
|
|
5187
5198
|
const hasMore = (0, import_react.useMemo)(() => {
|
|
5188
5199
|
if (node.isLeaf) return false;
|
|
5189
5200
|
if (Array.isArray(children)) return children.length > 0;
|
|
@@ -5196,7 +5207,6 @@ var TreeNodeItem = (0, import_react.forwardRef)(
|
|
|
5196
5207
|
setChildren(result);
|
|
5197
5208
|
} catch (e) {
|
|
5198
5209
|
console.error("Failed to load child nodes ", e);
|
|
5199
|
-
} finally {
|
|
5200
5210
|
}
|
|
5201
5211
|
}
|
|
5202
5212
|
setIsOpen((prev) => !prev);
|
|
@@ -5211,6 +5221,14 @@ var TreeNodeItem = (0, import_react.forwardRef)(
|
|
|
5211
5221
|
e.preventDefault();
|
|
5212
5222
|
(_a = node.onRightClick) == null ? void 0 : _a.call(node, e);
|
|
5213
5223
|
};
|
|
5224
|
+
(0, import_react.useEffect)(() => {
|
|
5225
|
+
if (!selectedName) return;
|
|
5226
|
+
if (!hasOpenedInitially.current) {
|
|
5227
|
+
const shouldOpen = hasSelectedInChildren(children);
|
|
5228
|
+
setIsOpen(shouldOpen);
|
|
5229
|
+
hasOpenedInitially.current = true;
|
|
5230
|
+
}
|
|
5231
|
+
}, [selectedName, children, hasSelectedInChildren]);
|
|
5214
5232
|
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
5215
5233
|
"div",
|
|
5216
5234
|
{
|
|
@@ -5226,7 +5244,7 @@ var TreeNodeItem = (0, import_react.forwardRef)(
|
|
|
5226
5244
|
className: clsx(
|
|
5227
5245
|
slots.node({ class: classNames == null ? void 0 : classNames.node }),
|
|
5228
5246
|
slots.clickable({ class: classNames == null ? void 0 : classNames.clickable }),
|
|
5229
|
-
selectedName
|
|
5247
|
+
selectedName === node.selectedName ? "bg-neutral-soft" : ""
|
|
5230
5248
|
),
|
|
5231
5249
|
onClick: handleClick,
|
|
5232
5250
|
onContextMenu: handleRightClick,
|
|
@@ -5263,7 +5281,8 @@ var TreeNodeItem = (0, import_react.forwardRef)(
|
|
|
5263
5281
|
);
|
|
5264
5282
|
}
|
|
5265
5283
|
);
|
|
5266
|
-
|
|
5284
|
+
TreeNodeItemBase.displayName = "TreeNodeItem";
|
|
5285
|
+
var TreeNodeItem = (0, import_react.memo)(TreeNodeItemBase);
|
|
5267
5286
|
var Tree = ({ headerContent, group, groupIcon, fileIcon, selectedName, classNames, onExpand }) => {
|
|
5268
5287
|
const slots = (0, import_react.useMemo)(() => treeStyle(), []);
|
|
5269
5288
|
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,22 @@ 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 || !selectedName) 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)(() => {
|
|
5194
|
+
if (!selectedName) return false;
|
|
5195
|
+
return hasSelectedInChildren(node.children);
|
|
5196
|
+
});
|
|
5197
|
+
const hasOpenedInitially = (0, import_react.useRef)(false);
|
|
5186
5198
|
const hasMore = (0, import_react.useMemo)(() => {
|
|
5187
5199
|
if (node.isLeaf) return false;
|
|
5188
5200
|
if (Array.isArray(children)) return children.length > 0;
|
|
@@ -5195,7 +5207,6 @@ var TreeNodeItem = (0, import_react.forwardRef)(
|
|
|
5195
5207
|
setChildren(result);
|
|
5196
5208
|
} catch (e) {
|
|
5197
5209
|
console.error("Failed to load child nodes ", e);
|
|
5198
|
-
} finally {
|
|
5199
5210
|
}
|
|
5200
5211
|
}
|
|
5201
5212
|
setIsOpen((prev) => !prev);
|
|
@@ -5210,6 +5221,14 @@ var TreeNodeItem = (0, import_react.forwardRef)(
|
|
|
5210
5221
|
e.preventDefault();
|
|
5211
5222
|
(_a = node.onRightClick) == null ? void 0 : _a.call(node, e);
|
|
5212
5223
|
};
|
|
5224
|
+
(0, import_react.useEffect)(() => {
|
|
5225
|
+
if (!selectedName) return;
|
|
5226
|
+
if (!hasOpenedInitially.current) {
|
|
5227
|
+
const shouldOpen = hasSelectedInChildren(children);
|
|
5228
|
+
setIsOpen(shouldOpen);
|
|
5229
|
+
hasOpenedInitially.current = true;
|
|
5230
|
+
}
|
|
5231
|
+
}, [selectedName, children, hasSelectedInChildren]);
|
|
5213
5232
|
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
5214
5233
|
"div",
|
|
5215
5234
|
{
|
|
@@ -5225,7 +5244,7 @@ var TreeNodeItem = (0, import_react.forwardRef)(
|
|
|
5225
5244
|
className: clsx(
|
|
5226
5245
|
slots.node({ class: classNames == null ? void 0 : classNames.node }),
|
|
5227
5246
|
slots.clickable({ class: classNames == null ? void 0 : classNames.clickable }),
|
|
5228
|
-
selectedName
|
|
5247
|
+
selectedName === node.selectedName ? "bg-neutral-soft" : ""
|
|
5229
5248
|
),
|
|
5230
5249
|
onClick: handleClick,
|
|
5231
5250
|
onContextMenu: handleRightClick,
|
|
@@ -5262,7 +5281,8 @@ var TreeNodeItem = (0, import_react.forwardRef)(
|
|
|
5262
5281
|
);
|
|
5263
5282
|
}
|
|
5264
5283
|
);
|
|
5265
|
-
|
|
5284
|
+
TreeNodeItemBase.displayName = "TreeNodeItem";
|
|
5285
|
+
var TreeNodeItem = (0, import_react.memo)(TreeNodeItemBase);
|
|
5266
5286
|
var Tree = ({ headerContent, group, groupIcon, fileIcon, selectedName, classNames, onExpand }) => {
|
|
5267
5287
|
const slots = (0, import_react.useMemo)(() => treeStyle(), []);
|
|
5268
5288
|
const handleClick = (e) => {
|
|
@@ -5332,5 +5352,6 @@ var treeStyle = tv({
|
|
|
5332
5352
|
});
|
|
5333
5353
|
// Annotate the CommonJS export names for ESM import in node:
|
|
5334
5354
|
0 && (module.exports = {
|
|
5335
|
-
Tree
|
|
5355
|
+
Tree,
|
|
5356
|
+
TreeNodeItem
|
|
5336
5357
|
});
|
|
@@ -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-F6BQCZ54.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
|
@@ -9358,8 +9358,9 @@ var DefinitionTableStyle = tv({
|
|
|
9358
9358
|
var import_react21 = require("react");
|
|
9359
9359
|
var import_react_dom = require("react-dom");
|
|
9360
9360
|
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
9361
|
+
var ALL_OPTION_VALUE = "__ALL__";
|
|
9361
9362
|
var Select = (0, import_react21.forwardRef)((originalProps, ref) => {
|
|
9362
|
-
var _a, _b;
|
|
9363
|
+
var _a, _b, _c;
|
|
9363
9364
|
const [props, variantProps] = mapPropsVariants(originalProps, select.variantKeys);
|
|
9364
9365
|
const {
|
|
9365
9366
|
label,
|
|
@@ -9370,6 +9371,7 @@ var Select = (0, import_react21.forwardRef)((originalProps, ref) => {
|
|
|
9370
9371
|
defaultSelectedOptions,
|
|
9371
9372
|
onChange,
|
|
9372
9373
|
multiple,
|
|
9374
|
+
enableSelectAll,
|
|
9373
9375
|
dropdownIconName = "brace-up",
|
|
9374
9376
|
optionIconName,
|
|
9375
9377
|
optionIconPlacement,
|
|
@@ -9411,10 +9413,14 @@ var Select = (0, import_react21.forwardRef)((originalProps, ref) => {
|
|
|
9411
9413
|
};
|
|
9412
9414
|
};
|
|
9413
9415
|
const handleChangeOption = (option) => {
|
|
9414
|
-
let nextOptions;
|
|
9416
|
+
let nextOptions = [];
|
|
9415
9417
|
if (multiple) {
|
|
9416
|
-
|
|
9417
|
-
|
|
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
|
+
}
|
|
9418
9424
|
} else {
|
|
9419
9425
|
nextOptions = [option];
|
|
9420
9426
|
closeSelect();
|
|
@@ -9448,10 +9454,26 @@ var Select = (0, import_react21.forwardRef)((originalProps, ref) => {
|
|
|
9448
9454
|
}
|
|
9449
9455
|
}, [originalProps.value, defaultSelectedOptions, options]);
|
|
9450
9456
|
const position = targetRect ? calculatePositionWithScroll(targetRect, optionWrapperHeight) : null;
|
|
9451
|
-
|
|
9452
|
-
|
|
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) || "";
|
|
9453
9471
|
const renderOptions = () => {
|
|
9454
9472
|
if (!isVisible) return null;
|
|
9473
|
+
const renderedOptions = [...options];
|
|
9474
|
+
if (multiple && enableSelectAll) {
|
|
9475
|
+
renderedOptions.unshift({ label: allOptionValue, value: ALL_OPTION_VALUE });
|
|
9476
|
+
}
|
|
9455
9477
|
return (0, import_react_dom.createPortal)(
|
|
9456
9478
|
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
9457
9479
|
"div",
|
|
@@ -9469,8 +9491,8 @@ var Select = (0, import_react21.forwardRef)((originalProps, ref) => {
|
|
|
9469
9491
|
transform: isOpen ? "translateY(0)" : "translateY(-0.25rem)",
|
|
9470
9492
|
transition: "opacity 150ms ease-out, transform 150ms ease-out"
|
|
9471
9493
|
},
|
|
9472
|
-
children:
|
|
9473
|
-
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);
|
|
9474
9496
|
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
9475
9497
|
"div",
|
|
9476
9498
|
{
|
|
@@ -9581,7 +9603,8 @@ var select = tv({
|
|
|
9581
9603
|
"placeholder:text-neutral-main",
|
|
9582
9604
|
"text-body-foreground",
|
|
9583
9605
|
"group-has-[p.error]/select:text-danger-main",
|
|
9584
|
-
"group-has-[p.error]/select:placeholder:text-danger-main"
|
|
9606
|
+
"group-has-[p.error]/select:placeholder:text-danger-main",
|
|
9607
|
+
"truncate"
|
|
9585
9608
|
],
|
|
9586
9609
|
optionsWrapper: ["bg-body-background", "overflow-auto", "flex", "flex-col", "gap-[10px]"],
|
|
9587
9610
|
option: [
|
|
@@ -9680,7 +9703,7 @@ var select = tv({
|
|
|
9680
9703
|
selectWrapper: ["w-[240px]", "h-[50px]", "rounded-xl", "px-[10px]"],
|
|
9681
9704
|
select: ["text-xl"],
|
|
9682
9705
|
optionsWrapper: ["shadow-drop-xl", "rounded-xl", "p-[10px]"],
|
|
9683
|
-
option: ["px-[10px]", "py-[11.5px]",
|
|
9706
|
+
option: ["px-[10px]", "py-[11.5px]", "rounded-xl", "text-xl", "gap-[10px]"],
|
|
9684
9707
|
helperMessage: ["text-md"],
|
|
9685
9708
|
errorMessage: ["text-md"]
|
|
9686
9709
|
}
|
|
@@ -12194,11 +12217,22 @@ var timePickerStyle = tv({
|
|
|
12194
12217
|
// src/components/tree/tree.tsx
|
|
12195
12218
|
var import_react36 = require("react");
|
|
12196
12219
|
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
12197
|
-
var
|
|
12220
|
+
var TreeNodeItemBase = (0, import_react36.forwardRef)(
|
|
12198
12221
|
({ node, depth, fileIcon, selectedName, classNames, onExpand }, ref) => {
|
|
12199
|
-
const [isOpen, setIsOpen] = (0, import_react36.useState)(false);
|
|
12200
|
-
const [children, setChildren] = (0, import_react36.useState)(node.children);
|
|
12201
12222
|
const slots = (0, import_react36.useMemo)(() => treeStyle(), []);
|
|
12223
|
+
const hasSelectedInChildren = (0, import_react36.useCallback)(
|
|
12224
|
+
(children2) => {
|
|
12225
|
+
if (!children2 || !selectedName) 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)(() => {
|
|
12232
|
+
if (!selectedName) return false;
|
|
12233
|
+
return hasSelectedInChildren(node.children);
|
|
12234
|
+
});
|
|
12235
|
+
const hasOpenedInitially = (0, import_react36.useRef)(false);
|
|
12202
12236
|
const hasMore = (0, import_react36.useMemo)(() => {
|
|
12203
12237
|
if (node.isLeaf) return false;
|
|
12204
12238
|
if (Array.isArray(children)) return children.length > 0;
|
|
@@ -12211,7 +12245,6 @@ var TreeNodeItem = (0, import_react36.forwardRef)(
|
|
|
12211
12245
|
setChildren(result);
|
|
12212
12246
|
} catch (e) {
|
|
12213
12247
|
console.error("Failed to load child nodes ", e);
|
|
12214
|
-
} finally {
|
|
12215
12248
|
}
|
|
12216
12249
|
}
|
|
12217
12250
|
setIsOpen((prev) => !prev);
|
|
@@ -12226,6 +12259,14 @@ var TreeNodeItem = (0, import_react36.forwardRef)(
|
|
|
12226
12259
|
e.preventDefault();
|
|
12227
12260
|
(_a = node.onRightClick) == null ? void 0 : _a.call(node, e);
|
|
12228
12261
|
};
|
|
12262
|
+
(0, import_react36.useEffect)(() => {
|
|
12263
|
+
if (!selectedName) return;
|
|
12264
|
+
if (!hasOpenedInitially.current) {
|
|
12265
|
+
const shouldOpen = hasSelectedInChildren(children);
|
|
12266
|
+
setIsOpen(shouldOpen);
|
|
12267
|
+
hasOpenedInitially.current = true;
|
|
12268
|
+
}
|
|
12269
|
+
}, [selectedName, children, hasSelectedInChildren]);
|
|
12229
12270
|
return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(
|
|
12230
12271
|
"div",
|
|
12231
12272
|
{
|
|
@@ -12241,7 +12282,7 @@ var TreeNodeItem = (0, import_react36.forwardRef)(
|
|
|
12241
12282
|
className: clsx(
|
|
12242
12283
|
slots.node({ class: classNames == null ? void 0 : classNames.node }),
|
|
12243
12284
|
slots.clickable({ class: classNames == null ? void 0 : classNames.clickable }),
|
|
12244
|
-
selectedName
|
|
12285
|
+
selectedName === node.selectedName ? "bg-neutral-soft" : ""
|
|
12245
12286
|
),
|
|
12246
12287
|
onClick: handleClick,
|
|
12247
12288
|
onContextMenu: handleRightClick,
|
|
@@ -12278,7 +12319,8 @@ var TreeNodeItem = (0, import_react36.forwardRef)(
|
|
|
12278
12319
|
);
|
|
12279
12320
|
}
|
|
12280
12321
|
);
|
|
12281
|
-
|
|
12322
|
+
TreeNodeItemBase.displayName = "TreeNodeItem";
|
|
12323
|
+
var TreeNodeItem = (0, import_react36.memo)(TreeNodeItemBase);
|
|
12282
12324
|
var Tree = ({ headerContent, group, groupIcon, fileIcon, selectedName, classNames, onExpand }) => {
|
|
12283
12325
|
const slots = (0, import_react36.useMemo)(() => treeStyle(), []);
|
|
12284
12326
|
const handleClick = (e) => {
|