@deepnoid/ui 0.1.199 → 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.
@@ -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
- const exists = selectedOptions.some((o) => o.value === option.value);
5257
- nextOptions = exists ? selectedOptions.filter((o) => o.value !== option.value) : [...selectedOptions, option];
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
- const displayValue = multiple ? selectedOptions.map((opt) => opt.label).join(", ") : ((_a = selectedOptions[0]) == null ? void 0 : _a.label) || "";
5292
- const selectedValue = multiple ? selectedOptions.map((opt) => opt.value).join(",") : ((_b = selectedOptions[0]) == null ? void 0 : _b.value) || "";
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: options.map((option) => {
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]", , "rounded-xl", "text-xl", "gap-[10px]"],
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,7 +1,7 @@
1
1
  "use client";
2
2
  import {
3
3
  select_default
4
- } from "../../chunk-4E5OF43U.mjs";
4
+ } from "../../chunk-75ZDPLJ4.mjs";
5
5
  import "../../chunk-ZYIIXWVY.mjs";
6
6
  import "../../chunk-YEYUS6DW.mjs";
7
7
  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 TreeNodeItem = (0, import_react.forwardRef)(
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 == node.selectedName ? "bg-neutral-soft" : ""
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
- TreeNodeItem.displayName = "TreeNodeItem";
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) => {
@@ -2,7 +2,7 @@
2
2
  import "../../chunk-MBLZYQCN.mjs";
3
3
  import {
4
4
  tree_default
5
- } from "../../chunk-STV6EZHD.mjs";
5
+ } from "../../chunk-VXO7B27Q.mjs";
6
6
  import "../../chunk-ZYIIXWVY.mjs";
7
7
  import "../../chunk-YEYUS6DW.mjs";
8
8
  import "../../chunk-5BT37SLM.mjs";
@@ -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 TreeNodeItem = (0, import_react.forwardRef)(
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 == node.selectedName ? "bg-neutral-soft" : ""
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
- TreeNodeItem.displayName = "TreeNodeItem";
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-STV6EZHD.mjs";
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
@@ -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
- const exists = selectedOptions.some((o) => o.value === option.value);
9417
- nextOptions = exists ? selectedOptions.filter((o) => o.value !== option.value) : [...selectedOptions, option];
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
- const displayValue = multiple ? selectedOptions.map((opt) => opt.label).join(", ") : ((_a = selectedOptions[0]) == null ? void 0 : _a.label) || "";
9452
- const selectedValue = multiple ? selectedOptions.map((opt) => opt.value).join(",") : ((_b = selectedOptions[0]) == null ? void 0 : _b.value) || "";
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: options.map((option) => {
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]", , "rounded-xl", "text-xl", "gap-[10px]"],
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,18 @@ 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 TreeNodeItem = (0, import_react36.forwardRef)(
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) 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));
12202
12232
  const hasMore = (0, import_react36.useMemo)(() => {
12203
12233
  if (node.isLeaf) return false;
12204
12234
  if (Array.isArray(children)) return children.length > 0;
@@ -12211,7 +12241,6 @@ var TreeNodeItem = (0, import_react36.forwardRef)(
12211
12241
  setChildren(result);
12212
12242
  } catch (e) {
12213
12243
  console.error("Failed to load child nodes ", e);
12214
- } finally {
12215
12244
  }
12216
12245
  }
12217
12246
  setIsOpen((prev) => !prev);
@@ -12226,6 +12255,12 @@ var TreeNodeItem = (0, import_react36.forwardRef)(
12226
12255
  e.preventDefault();
12227
12256
  (_a = node.onRightClick) == null ? void 0 : _a.call(node, e);
12228
12257
  };
12258
+ (0, import_react36.useEffect)(() => {
12259
+ const shouldOpen = hasSelectedInChildren(children);
12260
+ if (shouldOpen !== isOpen) {
12261
+ setIsOpen(shouldOpen);
12262
+ }
12263
+ }, [selectedName, children, hasSelectedInChildren, isOpen]);
12229
12264
  return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(
12230
12265
  "div",
12231
12266
  {
@@ -12241,7 +12276,7 @@ var TreeNodeItem = (0, import_react36.forwardRef)(
12241
12276
  className: clsx(
12242
12277
  slots.node({ class: classNames == null ? void 0 : classNames.node }),
12243
12278
  slots.clickable({ class: classNames == null ? void 0 : classNames.clickable }),
12244
- selectedName == node.selectedName ? "bg-neutral-soft" : ""
12279
+ selectedName === node.selectedName ? "bg-neutral-soft" : ""
12245
12280
  ),
12246
12281
  onClick: handleClick,
12247
12282
  onContextMenu: handleRightClick,
@@ -12278,7 +12313,8 @@ var TreeNodeItem = (0, import_react36.forwardRef)(
12278
12313
  );
12279
12314
  }
12280
12315
  );
12281
- TreeNodeItem.displayName = "TreeNodeItem";
12316
+ TreeNodeItemBase.displayName = "TreeNodeItem";
12317
+ var TreeNodeItem = (0, import_react36.memo)(TreeNodeItemBase);
12282
12318
  var Tree = ({ headerContent, group, groupIcon, fileIcon, selectedName, classNames, onExpand }) => {
12283
12319
  const slots = (0, import_react36.useMemo)(() => treeStyle(), []);
12284
12320
  const handleClick = (e) => {
package/dist/index.mjs CHANGED
@@ -1,18 +1,22 @@
1
1
  "use client";
2
- import "./chunk-MBLZYQCN.mjs";
3
- import {
4
- tree_default
5
- } from "./chunk-STV6EZHD.mjs";
6
2
  import "./chunk-HIE2YRGA.mjs";
7
3
  import {
8
4
  tooltip_default
9
5
  } from "./chunk-5KC3IFNR.mjs";
10
6
  import "./chunk-ZMOAFSYE.mjs";
11
7
  import "./chunk-WSIADHVC.mjs";
12
- import "./chunk-DX3KXNP6.mjs";
8
+ import "./chunk-RRAZM5D3.mjs";
13
9
  import {
14
- table_default
15
- } from "./chunk-KYWCJIXI.mjs";
10
+ textarea_default
11
+ } from "./chunk-Q22PRT24.mjs";
12
+ import "./chunk-MBLZYQCN.mjs";
13
+ import {
14
+ tree_default
15
+ } from "./chunk-VXO7B27Q.mjs";
16
+ import "./chunk-3MY6LO7N.mjs";
17
+ import {
18
+ tabs_default
19
+ } from "./chunk-DW3BX4M2.mjs";
16
20
  import "./chunk-LUWGOKLG.mjs";
17
21
  import {
18
22
  ToastProvider,
@@ -22,29 +26,35 @@ import "./chunk-ZOTHPHXA.mjs";
22
26
  import {
23
27
  toast_default
24
28
  } from "./chunk-4F7SIDZB.mjs";
25
- import "./chunk-3MY6LO7N.mjs";
29
+ import "./chunk-DX3KXNP6.mjs";
26
30
  import {
27
- tabs_default
28
- } from "./chunk-DW3BX4M2.mjs";
29
- import "./chunk-RRAZM5D3.mjs";
31
+ table_default
32
+ } from "./chunk-KYWCJIXI.mjs";
33
+ import "./chunk-OLQOLLKG.mjs";
30
34
  import {
31
- textarea_default
32
- } from "./chunk-Q22PRT24.mjs";
35
+ starRating_default
36
+ } from "./chunk-OX4T7OBC.mjs";
37
+ import "./chunk-LVFI2NOH.mjs";
33
38
  import {
34
- definition_table_default
35
- } from "./chunk-DS5CGU2X.mjs";
39
+ switch_default
40
+ } from "./chunk-AGE57VDD.mjs";
36
41
  import "./chunk-MZ76AA76.mjs";
37
42
  import {
38
43
  skeleton_default
39
44
  } from "./chunk-6PN3DGOE.mjs";
40
- import "./chunk-LVFI2NOH.mjs";
41
45
  import {
42
- switch_default
43
- } from "./chunk-AGE57VDD.mjs";
44
- import "./chunk-4VWG4726.mjs";
46
+ definition_table_default
47
+ } from "./chunk-DS5CGU2X.mjs";
48
+ import "./chunk-TPFN22HR.mjs";
45
49
  import {
46
- timePicker_default
47
- } from "./chunk-ZP2EQULZ.mjs";
50
+ radio_default
51
+ } from "./chunk-PRNE3U26.mjs";
52
+ import "./chunk-7B7LRG5J.mjs";
53
+ import {
54
+ pagination_default
55
+ } from "./chunk-VVCSY7DG.mjs";
56
+ import "./chunk-F3HENRVM.mjs";
57
+ import "./chunk-4VWG4726.mjs";
48
58
  import {
49
59
  datePicker_default
50
60
  } from "./chunk-2EUKWA4W.mjs";
@@ -52,14 +62,13 @@ import "./chunk-FWFEKWWD.mjs";
52
62
  import {
53
63
  day_default
54
64
  } from "./chunk-XZYQFBCT.mjs";
65
+ import {
66
+ timePicker_default
67
+ } from "./chunk-YBXBTE5T.mjs";
55
68
  import "./chunk-QCEKPS7U.mjs";
56
69
  import {
57
70
  select_default
58
- } from "./chunk-4E5OF43U.mjs";
59
- import "./chunk-OLQOLLKG.mjs";
60
- import {
61
- starRating_default
62
- } from "./chunk-OX4T7OBC.mjs";
71
+ } from "./chunk-75ZDPLJ4.mjs";
63
72
  import "./chunk-7MVEAQ7Z.mjs";
64
73
  import {
65
74
  list_default
@@ -67,15 +76,6 @@ import {
67
76
  import {
68
77
  listItem_default
69
78
  } from "./chunk-K3M3QEEV.mjs";
70
- import "./chunk-TPFN22HR.mjs";
71
- import {
72
- radio_default
73
- } from "./chunk-PRNE3U26.mjs";
74
- import "./chunk-7B7LRG5J.mjs";
75
- import {
76
- pagination_default
77
- } from "./chunk-VVCSY7DG.mjs";
78
- import "./chunk-F3HENRVM.mjs";
79
79
  import "./chunk-DJOG6Z35.mjs";
80
80
  import {
81
81
  modal_default
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deepnoid/ui",
3
- "version": "0.1.199",
3
+ "version": "0.1.200",
4
4
  "license": "MIT",
5
5
  "sideEffects": false,
6
6
  "exports": {