@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.
Files changed (39) hide show
  1. package/.turbo/turbo-build.log +177 -177
  2. package/dist/{chunk-4E5OF43U.mjs → chunk-75ZDPLJ4.mjs} +33 -10
  3. package/dist/{chunk-K7FQTARY.mjs → chunk-KYWCJIXI.mjs} +1 -0
  4. package/dist/{chunk-STV6EZHD.mjs → chunk-VXO7B27Q.mjs} +21 -7
  5. package/dist/{chunk-ZP2EQULZ.mjs → chunk-YBXBTE5T.mjs} +1 -1
  6. package/dist/components/picker/index.js +33 -10
  7. package/dist/components/picker/index.mjs +2 -2
  8. package/dist/components/picker/timePicker.js +33 -10
  9. package/dist/components/picker/timePicker.mjs +2 -2
  10. package/dist/components/select/index.d.mts +1 -1
  11. package/dist/components/select/index.d.ts +1 -1
  12. package/dist/components/select/index.js +33 -10
  13. package/dist/components/select/index.mjs +1 -1
  14. package/dist/components/select/select.d.mts +12 -9
  15. package/dist/components/select/select.d.ts +12 -9
  16. package/dist/components/select/select.js +33 -10
  17. package/dist/components/select/select.mjs +1 -1
  18. package/dist/components/table/index.js +1 -0
  19. package/dist/components/table/index.mjs +3 -3
  20. package/dist/components/table/table-body.js +1 -0
  21. package/dist/components/table/table-body.mjs +1 -1
  22. package/dist/components/table/table-head.js +1 -0
  23. package/dist/components/table/table-head.mjs +1 -1
  24. package/dist/components/table/table.js +1 -0
  25. package/dist/components/table/table.mjs +1 -1
  26. package/dist/components/toast/index.mjs +2 -2
  27. package/dist/components/toast/use-toast.mjs +2 -2
  28. package/dist/components/tree/index.js +19 -6
  29. package/dist/components/tree/index.mjs +1 -1
  30. package/dist/components/tree/tree.d.mts +11 -1
  31. package/dist/components/tree/tree.d.ts +11 -1
  32. package/dist/components/tree/tree.js +22 -7
  33. package/dist/components/tree/tree.mjs +3 -1
  34. package/dist/index.d.mts +1 -1
  35. package/dist/index.d.ts +1 -1
  36. package/dist/index.js +53 -16
  37. package/dist/index.mjs +19 -19
  38. package/package.json +1 -1
  39. package/dist/{chunk-L3A3IEKZ.mjs → chunk-SSGCTWWW.mjs} +3 -3
@@ -16,8 +16,9 @@ import {
16
16
  import { forwardRef, useMemo, useState, useRef, useEffect } from "react";
17
17
  import { createPortal } from "react-dom";
18
18
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
19
+ var ALL_OPTION_VALUE = "__ALL__";
19
20
  var Select = forwardRef((originalProps, ref) => {
20
- var _a, _b;
21
+ var _a, _b, _c;
21
22
  const [props, variantProps] = mapPropsVariants(originalProps, select.variantKeys);
22
23
  const {
23
24
  label,
@@ -28,6 +29,7 @@ var Select = forwardRef((originalProps, ref) => {
28
29
  defaultSelectedOptions,
29
30
  onChange,
30
31
  multiple,
32
+ enableSelectAll,
31
33
  dropdownIconName = "brace-up",
32
34
  optionIconName,
33
35
  optionIconPlacement,
@@ -69,10 +71,14 @@ var Select = forwardRef((originalProps, ref) => {
69
71
  };
70
72
  };
71
73
  const handleChangeOption = (option) => {
72
- let nextOptions;
74
+ let nextOptions = [];
73
75
  if (multiple) {
74
- const exists = selectedOptions.some((o) => o.value === option.value);
75
- nextOptions = exists ? selectedOptions.filter((o) => o.value !== option.value) : [...selectedOptions, option];
76
+ if (enableSelectAll && option.value === ALL_OPTION_VALUE) {
77
+ nextOptions = selectedOptions.length === options.length ? [] : [...options];
78
+ } else {
79
+ const exists = selectedOptions.some((o) => o.value === option.value);
80
+ nextOptions = exists ? selectedOptions.filter((o) => o.value !== option.value) : [...selectedOptions, option];
81
+ }
76
82
  } else {
77
83
  nextOptions = [option];
78
84
  closeSelect();
@@ -106,10 +112,26 @@ var Select = forwardRef((originalProps, ref) => {
106
112
  }
107
113
  }, [originalProps.value, defaultSelectedOptions, options]);
108
114
  const position = targetRect ? calculatePositionWithScroll(targetRect, optionWrapperHeight) : null;
109
- const displayValue = multiple ? selectedOptions.map((opt) => opt.label).join(", ") : ((_a = selectedOptions[0]) == null ? void 0 : _a.label) || "";
110
- const selectedValue = multiple ? selectedOptions.map((opt) => opt.value).join(",") : ((_b = selectedOptions[0]) == null ? void 0 : _b.value) || "";
115
+ let allOptionValue = "";
116
+ if (multiple) {
117
+ if (selectedOptions.length === 0) {
118
+ allOptionValue = "\uC804\uCCB4 \uC120\uD0DD";
119
+ } else if (selectedOptions.length === options.length) {
120
+ allOptionValue = `\uC804\uCCB4 (${options.length}) \uC120\uD0DD\uB428`;
121
+ } else {
122
+ allOptionValue = `${selectedOptions.length} / ${options.length} \uC120\uD0DD\uB428`;
123
+ }
124
+ } else {
125
+ allOptionValue = ((_a = selectedOptions[0]) == null ? void 0 : _a.label) || "";
126
+ }
127
+ const displayValue = multiple ? selectedOptions.map((opt) => opt.label).join(", ") : ((_b = selectedOptions[0]) == null ? void 0 : _b.label) || "";
128
+ const selectedValue = multiple ? selectedOptions.map((opt) => opt.value).join(",") : ((_c = selectedOptions[0]) == null ? void 0 : _c.value) || "";
111
129
  const renderOptions = () => {
112
130
  if (!isVisible) return null;
131
+ const renderedOptions = [...options];
132
+ if (multiple && enableSelectAll) {
133
+ renderedOptions.unshift({ label: allOptionValue, value: ALL_OPTION_VALUE });
134
+ }
113
135
  return createPortal(
114
136
  /* @__PURE__ */ jsx(
115
137
  "div",
@@ -127,8 +149,8 @@ var Select = forwardRef((originalProps, ref) => {
127
149
  transform: isOpen ? "translateY(0)" : "translateY(-0.25rem)",
128
150
  transition: "opacity 150ms ease-out, transform 150ms ease-out"
129
151
  },
130
- children: options.map((option) => {
131
- const isSelected = selectedOptions.some((o) => o.value === option.value);
152
+ children: renderedOptions.map((option) => {
153
+ const isSelected = option.value === ALL_OPTION_VALUE ? selectedOptions.length === options.length : selectedOptions.some((o) => o.value === option.value);
132
154
  return /* @__PURE__ */ jsxs(
133
155
  "div",
134
156
  {
@@ -239,7 +261,8 @@ var select = tv({
239
261
  "placeholder:text-neutral-main",
240
262
  "text-body-foreground",
241
263
  "group-has-[p.error]/select:text-danger-main",
242
- "group-has-[p.error]/select:placeholder:text-danger-main"
264
+ "group-has-[p.error]/select:placeholder:text-danger-main",
265
+ "truncate"
243
266
  ],
244
267
  optionsWrapper: ["bg-body-background", "overflow-auto", "flex", "flex-col", "gap-[10px]"],
245
268
  option: [
@@ -338,7 +361,7 @@ var select = tv({
338
361
  selectWrapper: ["w-[240px]", "h-[50px]", "rounded-xl", "px-[10px]"],
339
362
  select: ["text-xl"],
340
363
  optionsWrapper: ["shadow-drop-xl", "rounded-xl", "p-[10px]"],
341
- option: ["px-[10px]", "py-[11.5px]", , "rounded-xl", "text-xl", "gap-[10px]"],
364
+ option: ["px-[10px]", "py-[11.5px]", "rounded-xl", "text-xl", "gap-[10px]"],
342
365
  helperMessage: ["text-md"],
343
366
  errorMessage: ["text-md"]
344
367
  }
@@ -122,6 +122,7 @@ var TableBody = ({
122
122
  "tr",
123
123
  {
124
124
  className: slots.tr({ class: classNames == null ? void 0 : classNames.tr }),
125
+ "data-checked": checkedRows.has(row.id),
125
126
  onClick: typeof onRowClick === "function" ? (event) => onRowClick(row, rowIndex, event) : void 0,
126
127
  children: [
127
128
  columns.map((column, colIdx) => /* @__PURE__ */ jsx(
@@ -10,13 +10,20 @@ import {
10
10
  } from "./chunk-27Y6K5NK.mjs";
11
11
 
12
12
  // src/components/tree/tree.tsx
13
- import { forwardRef, useMemo, useState, useCallback } from "react";
13
+ import { forwardRef, useMemo, useState, useCallback, useEffect, memo } from "react";
14
14
  import { jsx, jsxs } from "react/jsx-runtime";
15
- var TreeNodeItem = forwardRef(
15
+ var TreeNodeItemBase = forwardRef(
16
16
  ({ node, depth, fileIcon, selectedName, classNames, onExpand }, ref) => {
17
- const [isOpen, setIsOpen] = useState(false);
18
- const [children, setChildren] = useState(node.children);
19
17
  const slots = useMemo(() => treeStyle(), []);
18
+ const hasSelectedInChildren = useCallback(
19
+ (children2) => {
20
+ if (!children2) return false;
21
+ return children2.some((child) => child.selectedName === selectedName || hasSelectedInChildren(child.children));
22
+ },
23
+ [selectedName]
24
+ );
25
+ const [children, setChildren] = useState(node.children);
26
+ const [isOpen, setIsOpen] = useState(() => hasSelectedInChildren(node.children));
20
27
  const hasMore = useMemo(() => {
21
28
  if (node.isLeaf) return false;
22
29
  if (Array.isArray(children)) return children.length > 0;
@@ -29,7 +36,6 @@ var TreeNodeItem = forwardRef(
29
36
  setChildren(result);
30
37
  } catch (e) {
31
38
  console.error("Failed to load child nodes ", e);
32
- } finally {
33
39
  }
34
40
  }
35
41
  setIsOpen((prev) => !prev);
@@ -44,6 +50,12 @@ var TreeNodeItem = forwardRef(
44
50
  e.preventDefault();
45
51
  (_a = node.onRightClick) == null ? void 0 : _a.call(node, e);
46
52
  };
53
+ useEffect(() => {
54
+ const shouldOpen = hasSelectedInChildren(children);
55
+ if (shouldOpen !== isOpen) {
56
+ setIsOpen(shouldOpen);
57
+ }
58
+ }, [selectedName, children, hasSelectedInChildren, isOpen]);
47
59
  return /* @__PURE__ */ jsxs(
48
60
  "div",
49
61
  {
@@ -59,7 +71,7 @@ var TreeNodeItem = forwardRef(
59
71
  className: clsx(
60
72
  slots.node({ class: classNames == null ? void 0 : classNames.node }),
61
73
  slots.clickable({ class: classNames == null ? void 0 : classNames.clickable }),
62
- selectedName == node.selectedName ? "bg-neutral-soft" : ""
74
+ selectedName === node.selectedName ? "bg-neutral-soft" : ""
63
75
  ),
64
76
  onClick: handleClick,
65
77
  onContextMenu: handleRightClick,
@@ -96,7 +108,8 @@ var TreeNodeItem = forwardRef(
96
108
  );
97
109
  }
98
110
  );
99
- TreeNodeItem.displayName = "TreeNodeItem";
111
+ TreeNodeItemBase.displayName = "TreeNodeItem";
112
+ var TreeNodeItem = memo(TreeNodeItemBase);
100
113
  var Tree = ({ headerContent, group, groupIcon, fileIcon, selectedName, classNames, onExpand }) => {
101
114
  const slots = useMemo(() => treeStyle(), []);
102
115
  const handleClick = (e) => {
@@ -166,6 +179,7 @@ var treeStyle = tv({
166
179
  });
167
180
 
168
181
  export {
182
+ TreeNodeItem,
169
183
  Tree,
170
184
  tree_default
171
185
  };
@@ -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 {
6
6
  Icon_default
7
7
  } from "./chunk-YEYUS6DW.mjs";
@@ -7139,8 +7139,9 @@ var import_react_dom3 = require("react-dom");
7139
7139
  var import_react8 = require("react");
7140
7140
  var import_react_dom2 = require("react-dom");
7141
7141
  var import_jsx_runtime10 = require("react/jsx-runtime");
7142
+ var ALL_OPTION_VALUE = "__ALL__";
7142
7143
  var Select = (0, import_react8.forwardRef)((originalProps, ref) => {
7143
- var _a, _b;
7144
+ var _a, _b, _c;
7144
7145
  const [props, variantProps] = mapPropsVariants(originalProps, select.variantKeys);
7145
7146
  const {
7146
7147
  label,
@@ -7151,6 +7152,7 @@ var Select = (0, import_react8.forwardRef)((originalProps, ref) => {
7151
7152
  defaultSelectedOptions,
7152
7153
  onChange,
7153
7154
  multiple,
7155
+ enableSelectAll,
7154
7156
  dropdownIconName = "brace-up",
7155
7157
  optionIconName,
7156
7158
  optionIconPlacement,
@@ -7192,10 +7194,14 @@ var Select = (0, import_react8.forwardRef)((originalProps, ref) => {
7192
7194
  };
7193
7195
  };
7194
7196
  const handleChangeOption = (option) => {
7195
- let nextOptions;
7197
+ let nextOptions = [];
7196
7198
  if (multiple) {
7197
- const exists = selectedOptions.some((o) => o.value === option.value);
7198
- nextOptions = exists ? selectedOptions.filter((o) => o.value !== option.value) : [...selectedOptions, option];
7199
+ if (enableSelectAll && option.value === ALL_OPTION_VALUE) {
7200
+ nextOptions = selectedOptions.length === options.length ? [] : [...options];
7201
+ } else {
7202
+ const exists = selectedOptions.some((o) => o.value === option.value);
7203
+ nextOptions = exists ? selectedOptions.filter((o) => o.value !== option.value) : [...selectedOptions, option];
7204
+ }
7199
7205
  } else {
7200
7206
  nextOptions = [option];
7201
7207
  closeSelect();
@@ -7229,10 +7235,26 @@ var Select = (0, import_react8.forwardRef)((originalProps, ref) => {
7229
7235
  }
7230
7236
  }, [originalProps.value, defaultSelectedOptions, options]);
7231
7237
  const position = targetRect ? calculatePositionWithScroll(targetRect, optionWrapperHeight) : null;
7232
- const displayValue = multiple ? selectedOptions.map((opt) => opt.label).join(", ") : ((_a = selectedOptions[0]) == null ? void 0 : _a.label) || "";
7233
- const selectedValue = multiple ? selectedOptions.map((opt) => opt.value).join(",") : ((_b = selectedOptions[0]) == null ? void 0 : _b.value) || "";
7238
+ let allOptionValue = "";
7239
+ if (multiple) {
7240
+ if (selectedOptions.length === 0) {
7241
+ allOptionValue = "\uC804\uCCB4 \uC120\uD0DD";
7242
+ } else if (selectedOptions.length === options.length) {
7243
+ allOptionValue = `\uC804\uCCB4 (${options.length}) \uC120\uD0DD\uB428`;
7244
+ } else {
7245
+ allOptionValue = `${selectedOptions.length} / ${options.length} \uC120\uD0DD\uB428`;
7246
+ }
7247
+ } else {
7248
+ allOptionValue = ((_a = selectedOptions[0]) == null ? void 0 : _a.label) || "";
7249
+ }
7250
+ const displayValue = multiple ? selectedOptions.map((opt) => opt.label).join(", ") : ((_b = selectedOptions[0]) == null ? void 0 : _b.label) || "";
7251
+ const selectedValue = multiple ? selectedOptions.map((opt) => opt.value).join(",") : ((_c = selectedOptions[0]) == null ? void 0 : _c.value) || "";
7234
7252
  const renderOptions = () => {
7235
7253
  if (!isVisible) return null;
7254
+ const renderedOptions = [...options];
7255
+ if (multiple && enableSelectAll) {
7256
+ renderedOptions.unshift({ label: allOptionValue, value: ALL_OPTION_VALUE });
7257
+ }
7236
7258
  return (0, import_react_dom2.createPortal)(
7237
7259
  /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
7238
7260
  "div",
@@ -7250,8 +7272,8 @@ var Select = (0, import_react8.forwardRef)((originalProps, ref) => {
7250
7272
  transform: isOpen ? "translateY(0)" : "translateY(-0.25rem)",
7251
7273
  transition: "opacity 150ms ease-out, transform 150ms ease-out"
7252
7274
  },
7253
- children: options.map((option) => {
7254
- const isSelected = selectedOptions.some((o) => o.value === option.value);
7275
+ children: renderedOptions.map((option) => {
7276
+ const isSelected = option.value === ALL_OPTION_VALUE ? selectedOptions.length === options.length : selectedOptions.some((o) => o.value === option.value);
7255
7277
  return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
7256
7278
  "div",
7257
7279
  {
@@ -7362,7 +7384,8 @@ var select = tv({
7362
7384
  "placeholder:text-neutral-main",
7363
7385
  "text-body-foreground",
7364
7386
  "group-has-[p.error]/select:text-danger-main",
7365
- "group-has-[p.error]/select:placeholder:text-danger-main"
7387
+ "group-has-[p.error]/select:placeholder:text-danger-main",
7388
+ "truncate"
7366
7389
  ],
7367
7390
  optionsWrapper: ["bg-body-background", "overflow-auto", "flex", "flex-col", "gap-[10px]"],
7368
7391
  option: [
@@ -7461,7 +7484,7 @@ var select = tv({
7461
7484
  selectWrapper: ["w-[240px]", "h-[50px]", "rounded-xl", "px-[10px]"],
7462
7485
  select: ["text-xl"],
7463
7486
  optionsWrapper: ["shadow-drop-xl", "rounded-xl", "p-[10px]"],
7464
- option: ["px-[10px]", "py-[11.5px]", , "rounded-xl", "text-xl", "gap-[10px]"],
7487
+ option: ["px-[10px]", "py-[11.5px]", "rounded-xl", "text-xl", "gap-[10px]"],
7465
7488
  helperMessage: ["text-md"],
7466
7489
  errorMessage: ["text-md"]
7467
7490
  }
@@ -9,9 +9,9 @@ import {
9
9
  } from "../../chunk-XZYQFBCT.mjs";
10
10
  import {
11
11
  timePicker_default
12
- } from "../../chunk-ZP2EQULZ.mjs";
12
+ } from "../../chunk-YBXBTE5T.mjs";
13
13
  import "../../chunk-QCEKPS7U.mjs";
14
- import "../../chunk-4E5OF43U.mjs";
14
+ import "../../chunk-75ZDPLJ4.mjs";
15
15
  import "../../chunk-2GCSFWHD.mjs";
16
16
  import "../../chunk-3RTVVQA3.mjs";
17
17
  import "../../chunk-MY5U63QO.mjs";
@@ -5203,8 +5203,9 @@ function toVal(mix) {
5203
5203
 
5204
5204
  // src/components/select/select.tsx
5205
5205
  var import_jsx_runtime3 = require("react/jsx-runtime");
5206
+ var ALL_OPTION_VALUE = "__ALL__";
5206
5207
  var Select = (0, import_react.forwardRef)((originalProps, ref) => {
5207
- var _a, _b;
5208
+ var _a, _b, _c;
5208
5209
  const [props, variantProps] = mapPropsVariants(originalProps, select.variantKeys);
5209
5210
  const {
5210
5211
  label,
@@ -5215,6 +5216,7 @@ var Select = (0, import_react.forwardRef)((originalProps, ref) => {
5215
5216
  defaultSelectedOptions,
5216
5217
  onChange,
5217
5218
  multiple,
5219
+ enableSelectAll,
5218
5220
  dropdownIconName = "brace-up",
5219
5221
  optionIconName,
5220
5222
  optionIconPlacement,
@@ -5256,10 +5258,14 @@ var Select = (0, import_react.forwardRef)((originalProps, ref) => {
5256
5258
  };
5257
5259
  };
5258
5260
  const handleChangeOption = (option) => {
5259
- let nextOptions;
5261
+ let nextOptions = [];
5260
5262
  if (multiple) {
5261
- const exists = selectedOptions.some((o) => o.value === option.value);
5262
- nextOptions = exists ? selectedOptions.filter((o) => o.value !== option.value) : [...selectedOptions, option];
5263
+ if (enableSelectAll && option.value === ALL_OPTION_VALUE) {
5264
+ nextOptions = selectedOptions.length === options.length ? [] : [...options];
5265
+ } else {
5266
+ const exists = selectedOptions.some((o) => o.value === option.value);
5267
+ nextOptions = exists ? selectedOptions.filter((o) => o.value !== option.value) : [...selectedOptions, option];
5268
+ }
5263
5269
  } else {
5264
5270
  nextOptions = [option];
5265
5271
  closeSelect();
@@ -5293,10 +5299,26 @@ var Select = (0, import_react.forwardRef)((originalProps, ref) => {
5293
5299
  }
5294
5300
  }, [originalProps.value, defaultSelectedOptions, options]);
5295
5301
  const position = targetRect ? calculatePositionWithScroll(targetRect, optionWrapperHeight) : null;
5296
- const displayValue = multiple ? selectedOptions.map((opt) => opt.label).join(", ") : ((_a = selectedOptions[0]) == null ? void 0 : _a.label) || "";
5297
- const selectedValue = multiple ? selectedOptions.map((opt) => opt.value).join(",") : ((_b = selectedOptions[0]) == null ? void 0 : _b.value) || "";
5302
+ let allOptionValue = "";
5303
+ if (multiple) {
5304
+ if (selectedOptions.length === 0) {
5305
+ allOptionValue = "\uC804\uCCB4 \uC120\uD0DD";
5306
+ } else if (selectedOptions.length === options.length) {
5307
+ allOptionValue = `\uC804\uCCB4 (${options.length}) \uC120\uD0DD\uB428`;
5308
+ } else {
5309
+ allOptionValue = `${selectedOptions.length} / ${options.length} \uC120\uD0DD\uB428`;
5310
+ }
5311
+ } else {
5312
+ allOptionValue = ((_a = selectedOptions[0]) == null ? void 0 : _a.label) || "";
5313
+ }
5314
+ const displayValue = multiple ? selectedOptions.map((opt) => opt.label).join(", ") : ((_b = selectedOptions[0]) == null ? void 0 : _b.label) || "";
5315
+ const selectedValue = multiple ? selectedOptions.map((opt) => opt.value).join(",") : ((_c = selectedOptions[0]) == null ? void 0 : _c.value) || "";
5298
5316
  const renderOptions = () => {
5299
5317
  if (!isVisible) return null;
5318
+ const renderedOptions = [...options];
5319
+ if (multiple && enableSelectAll) {
5320
+ renderedOptions.unshift({ label: allOptionValue, value: ALL_OPTION_VALUE });
5321
+ }
5300
5322
  return (0, import_react_dom.createPortal)(
5301
5323
  /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
5302
5324
  "div",
@@ -5314,8 +5336,8 @@ var Select = (0, import_react.forwardRef)((originalProps, ref) => {
5314
5336
  transform: isOpen ? "translateY(0)" : "translateY(-0.25rem)",
5315
5337
  transition: "opacity 150ms ease-out, transform 150ms ease-out"
5316
5338
  },
5317
- children: options.map((option) => {
5318
- const isSelected = selectedOptions.some((o) => o.value === option.value);
5339
+ children: renderedOptions.map((option) => {
5340
+ const isSelected = option.value === ALL_OPTION_VALUE ? selectedOptions.length === options.length : selectedOptions.some((o) => o.value === option.value);
5319
5341
  return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
5320
5342
  "div",
5321
5343
  {
@@ -5426,7 +5448,8 @@ var select = tv({
5426
5448
  "placeholder:text-neutral-main",
5427
5449
  "text-body-foreground",
5428
5450
  "group-has-[p.error]/select:text-danger-main",
5429
- "group-has-[p.error]/select:placeholder:text-danger-main"
5451
+ "group-has-[p.error]/select:placeholder:text-danger-main",
5452
+ "truncate"
5430
5453
  ],
5431
5454
  optionsWrapper: ["bg-body-background", "overflow-auto", "flex", "flex-col", "gap-[10px]"],
5432
5455
  option: [
@@ -5525,7 +5548,7 @@ var select = tv({
5525
5548
  selectWrapper: ["w-[240px]", "h-[50px]", "rounded-xl", "px-[10px]"],
5526
5549
  select: ["text-xl"],
5527
5550
  optionsWrapper: ["shadow-drop-xl", "rounded-xl", "p-[10px]"],
5528
- option: ["px-[10px]", "py-[11.5px]", , "rounded-xl", "text-xl", "gap-[10px]"],
5551
+ option: ["px-[10px]", "py-[11.5px]", "rounded-xl", "text-xl", "gap-[10px]"],
5529
5552
  helperMessage: ["text-md"],
5530
5553
  errorMessage: ["text-md"]
5531
5554
  }
@@ -2,9 +2,9 @@
2
2
  import {
3
3
  timePickerStyle,
4
4
  timePicker_default
5
- } from "../../chunk-ZP2EQULZ.mjs";
5
+ } from "../../chunk-YBXBTE5T.mjs";
6
6
  import "../../chunk-QCEKPS7U.mjs";
7
- import "../../chunk-4E5OF43U.mjs";
7
+ import "../../chunk-75ZDPLJ4.mjs";
8
8
  import "../../chunk-ZYIIXWVY.mjs";
9
9
  import "../../chunk-YEYUS6DW.mjs";
10
10
  import "../../chunk-E3G5QXSH.mjs";
@@ -1,4 +1,4 @@
1
- export { default as Select, SelectOption, SelectProps } from './select.mjs';
1
+ export { MultiSelectValue, default as Select, SelectOption, SelectOptionValue, SelectProps } from './select.mjs';
2
2
  import 'tailwind-variants';
3
3
  import 'react';
4
4
  import '../../utils/types.mjs';
@@ -1,4 +1,4 @@
1
- export { default as Select, SelectOption, SelectProps } from './select.js';
1
+ export { MultiSelectValue, default as Select, SelectOption, SelectOptionValue, SelectProps } from './select.js';
2
2
  import 'tailwind-variants';
3
3
  import 'react';
4
4
  import '../../utils/types.js';
@@ -5200,8 +5200,9 @@ function toVal(mix) {
5200
5200
 
5201
5201
  // src/components/select/select.tsx
5202
5202
  var import_jsx_runtime3 = require("react/jsx-runtime");
5203
+ var ALL_OPTION_VALUE = "__ALL__";
5203
5204
  var Select = (0, import_react.forwardRef)((originalProps, ref) => {
5204
- var _a, _b;
5205
+ var _a, _b, _c;
5205
5206
  const [props, variantProps] = mapPropsVariants(originalProps, select.variantKeys);
5206
5207
  const {
5207
5208
  label,
@@ -5212,6 +5213,7 @@ var Select = (0, import_react.forwardRef)((originalProps, ref) => {
5212
5213
  defaultSelectedOptions,
5213
5214
  onChange,
5214
5215
  multiple,
5216
+ enableSelectAll,
5215
5217
  dropdownIconName = "brace-up",
5216
5218
  optionIconName,
5217
5219
  optionIconPlacement,
@@ -5253,10 +5255,14 @@ var Select = (0, import_react.forwardRef)((originalProps, ref) => {
5253
5255
  };
5254
5256
  };
5255
5257
  const handleChangeOption = (option) => {
5256
- let nextOptions;
5258
+ let nextOptions = [];
5257
5259
  if (multiple) {
5258
- const exists = selectedOptions.some((o) => o.value === option.value);
5259
- nextOptions = exists ? selectedOptions.filter((o) => o.value !== option.value) : [...selectedOptions, option];
5260
+ if (enableSelectAll && option.value === ALL_OPTION_VALUE) {
5261
+ nextOptions = selectedOptions.length === options.length ? [] : [...options];
5262
+ } else {
5263
+ const exists = selectedOptions.some((o) => o.value === option.value);
5264
+ nextOptions = exists ? selectedOptions.filter((o) => o.value !== option.value) : [...selectedOptions, option];
5265
+ }
5260
5266
  } else {
5261
5267
  nextOptions = [option];
5262
5268
  closeSelect();
@@ -5290,10 +5296,26 @@ var Select = (0, import_react.forwardRef)((originalProps, ref) => {
5290
5296
  }
5291
5297
  }, [originalProps.value, defaultSelectedOptions, options]);
5292
5298
  const position = targetRect ? calculatePositionWithScroll(targetRect, optionWrapperHeight) : null;
5293
- const displayValue = multiple ? selectedOptions.map((opt) => opt.label).join(", ") : ((_a = selectedOptions[0]) == null ? void 0 : _a.label) || "";
5294
- const selectedValue = multiple ? selectedOptions.map((opt) => opt.value).join(",") : ((_b = selectedOptions[0]) == null ? void 0 : _b.value) || "";
5299
+ let allOptionValue = "";
5300
+ if (multiple) {
5301
+ if (selectedOptions.length === 0) {
5302
+ allOptionValue = "\uC804\uCCB4 \uC120\uD0DD";
5303
+ } else if (selectedOptions.length === options.length) {
5304
+ allOptionValue = `\uC804\uCCB4 (${options.length}) \uC120\uD0DD\uB428`;
5305
+ } else {
5306
+ allOptionValue = `${selectedOptions.length} / ${options.length} \uC120\uD0DD\uB428`;
5307
+ }
5308
+ } else {
5309
+ allOptionValue = ((_a = selectedOptions[0]) == null ? void 0 : _a.label) || "";
5310
+ }
5311
+ const displayValue = multiple ? selectedOptions.map((opt) => opt.label).join(", ") : ((_b = selectedOptions[0]) == null ? void 0 : _b.label) || "";
5312
+ const selectedValue = multiple ? selectedOptions.map((opt) => opt.value).join(",") : ((_c = selectedOptions[0]) == null ? void 0 : _c.value) || "";
5295
5313
  const renderOptions = () => {
5296
5314
  if (!isVisible) return null;
5315
+ const renderedOptions = [...options];
5316
+ if (multiple && enableSelectAll) {
5317
+ renderedOptions.unshift({ label: allOptionValue, value: ALL_OPTION_VALUE });
5318
+ }
5297
5319
  return (0, import_react_dom.createPortal)(
5298
5320
  /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
5299
5321
  "div",
@@ -5311,8 +5333,8 @@ var Select = (0, import_react.forwardRef)((originalProps, ref) => {
5311
5333
  transform: isOpen ? "translateY(0)" : "translateY(-0.25rem)",
5312
5334
  transition: "opacity 150ms ease-out, transform 150ms ease-out"
5313
5335
  },
5314
- children: options.map((option) => {
5315
- const isSelected = selectedOptions.some((o) => o.value === option.value);
5336
+ children: renderedOptions.map((option) => {
5337
+ const isSelected = option.value === ALL_OPTION_VALUE ? selectedOptions.length === options.length : selectedOptions.some((o) => o.value === option.value);
5316
5338
  return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
5317
5339
  "div",
5318
5340
  {
@@ -5423,7 +5445,8 @@ var select = tv({
5423
5445
  "placeholder:text-neutral-main",
5424
5446
  "text-body-foreground",
5425
5447
  "group-has-[p.error]/select:text-danger-main",
5426
- "group-has-[p.error]/select:placeholder:text-danger-main"
5448
+ "group-has-[p.error]/select:placeholder:text-danger-main",
5449
+ "truncate"
5427
5450
  ],
5428
5451
  optionsWrapper: ["bg-body-background", "overflow-auto", "flex", "flex-col", "gap-[10px]"],
5429
5452
  option: [
@@ -5522,7 +5545,7 @@ var select = tv({
5522
5545
  selectWrapper: ["w-[240px]", "h-[50px]", "rounded-xl", "px-[10px]"],
5523
5546
  select: ["text-xl"],
5524
5547
  optionsWrapper: ["shadow-drop-xl", "rounded-xl", "p-[10px]"],
5525
- option: ["px-[10px]", "py-[11.5px]", , "rounded-xl", "text-xl", "gap-[10px]"],
5548
+ option: ["px-[10px]", "py-[11.5px]", "rounded-xl", "text-xl", "gap-[10px]"],
5526
5549
  helperMessage: ["text-md"],
5527
5550
  errorMessage: ["text-md"]
5528
5551
  }
@@ -2,7 +2,7 @@
2
2
  import "../../chunk-QCEKPS7U.mjs";
3
3
  import {
4
4
  select_default
5
- } from "../../chunk-4E5OF43U.mjs";
5
+ } from "../../chunk-75ZDPLJ4.mjs";
6
6
  import "../../chunk-ZYIIXWVY.mjs";
7
7
  import "../../chunk-YEYUS6DW.mjs";
8
8
  import "../../chunk-E3G5QXSH.mjs";
@@ -7,14 +7,16 @@ import { IconName } from '../icon/Icon.mjs';
7
7
  import 'react/jsx-runtime';
8
8
  import '../icon/template.mjs';
9
9
 
10
- interface SelectOption {
10
+ type SelectOptionValue = string | number;
11
+ type SelectOption = {
11
12
  label: string;
12
- value: string | number;
13
- }
13
+ value: SelectOptionValue;
14
+ };
15
+ type MultiSelectValue = SelectOptionValue[];
14
16
  type OptionIconPlacement = "start" | "end";
15
- interface Props extends Omit<ComponentPropsWithRef<"input">, "onChange" | keyof SelectVariantProps> {
17
+ interface Props extends Omit<ComponentPropsWithRef<"input">, "onChange" | "value" | keyof SelectVariantProps> {
16
18
  options: SelectOption[];
17
- value?: string | number;
19
+ value?: SelectOptionValue | MultiSelectValue;
18
20
  defaultSelectedOptions?: SelectOption[];
19
21
  label?: string;
20
22
  helperMessage?: string;
@@ -22,6 +24,7 @@ interface Props extends Omit<ComponentPropsWithRef<"input">, "onChange" | keyof
22
24
  classNames?: SlotsToClasses<SelectSlots>;
23
25
  onChange?: (options: SelectOption[]) => void;
24
26
  multiple?: boolean;
27
+ enableSelectAll?: boolean;
25
28
  dropdownIconName?: IconName;
26
29
  optionIconName?: IconName;
27
30
  optionIconPlacement?: OptionIconPlacement;
@@ -100,7 +103,7 @@ declare const select: tailwind_variants.TVReturnType<{
100
103
  selectWrapper: string[];
101
104
  select: string[];
102
105
  optionsWrapper: string[];
103
- option: (string | undefined)[];
106
+ option: string[];
104
107
  helperMessage: string[];
105
108
  errorMessage: string[];
106
109
  };
@@ -213,7 +216,7 @@ declare const select: tailwind_variants.TVReturnType<{
213
216
  selectWrapper: string[];
214
217
  select: string[];
215
218
  optionsWrapper: string[];
216
- option: (string | undefined)[];
219
+ option: string[];
217
220
  helperMessage: string[];
218
221
  errorMessage: string[];
219
222
  };
@@ -326,7 +329,7 @@ declare const select: tailwind_variants.TVReturnType<{
326
329
  selectWrapper: string[];
327
330
  select: string[];
328
331
  optionsWrapper: string[];
329
- option: (string | undefined)[];
332
+ option: string[];
330
333
  helperMessage: string[];
331
334
  errorMessage: string[];
332
335
  };
@@ -372,4 +375,4 @@ declare const select: tailwind_variants.TVReturnType<{
372
375
  type SelectVariantProps = VariantProps<typeof select>;
373
376
  type SelectSlots = keyof ReturnType<typeof select>;
374
377
 
375
- export { type SelectOption, type SelectProps, type SelectVariantProps, Select as default };
378
+ export { type MultiSelectValue, type SelectOption, type SelectOptionValue, type SelectProps, type SelectVariantProps, Select as default };
@@ -7,14 +7,16 @@ import { IconName } from '../icon/Icon.js';
7
7
  import 'react/jsx-runtime';
8
8
  import '../icon/template.js';
9
9
 
10
- interface SelectOption {
10
+ type SelectOptionValue = string | number;
11
+ type SelectOption = {
11
12
  label: string;
12
- value: string | number;
13
- }
13
+ value: SelectOptionValue;
14
+ };
15
+ type MultiSelectValue = SelectOptionValue[];
14
16
  type OptionIconPlacement = "start" | "end";
15
- interface Props extends Omit<ComponentPropsWithRef<"input">, "onChange" | keyof SelectVariantProps> {
17
+ interface Props extends Omit<ComponentPropsWithRef<"input">, "onChange" | "value" | keyof SelectVariantProps> {
16
18
  options: SelectOption[];
17
- value?: string | number;
19
+ value?: SelectOptionValue | MultiSelectValue;
18
20
  defaultSelectedOptions?: SelectOption[];
19
21
  label?: string;
20
22
  helperMessage?: string;
@@ -22,6 +24,7 @@ interface Props extends Omit<ComponentPropsWithRef<"input">, "onChange" | keyof
22
24
  classNames?: SlotsToClasses<SelectSlots>;
23
25
  onChange?: (options: SelectOption[]) => void;
24
26
  multiple?: boolean;
27
+ enableSelectAll?: boolean;
25
28
  dropdownIconName?: IconName;
26
29
  optionIconName?: IconName;
27
30
  optionIconPlacement?: OptionIconPlacement;
@@ -100,7 +103,7 @@ declare const select: tailwind_variants.TVReturnType<{
100
103
  selectWrapper: string[];
101
104
  select: string[];
102
105
  optionsWrapper: string[];
103
- option: (string | undefined)[];
106
+ option: string[];
104
107
  helperMessage: string[];
105
108
  errorMessage: string[];
106
109
  };
@@ -213,7 +216,7 @@ declare const select: tailwind_variants.TVReturnType<{
213
216
  selectWrapper: string[];
214
217
  select: string[];
215
218
  optionsWrapper: string[];
216
- option: (string | undefined)[];
219
+ option: string[];
217
220
  helperMessage: string[];
218
221
  errorMessage: string[];
219
222
  };
@@ -326,7 +329,7 @@ declare const select: tailwind_variants.TVReturnType<{
326
329
  selectWrapper: string[];
327
330
  select: string[];
328
331
  optionsWrapper: string[];
329
- option: (string | undefined)[];
332
+ option: string[];
330
333
  helperMessage: string[];
331
334
  errorMessage: string[];
332
335
  };
@@ -372,4 +375,4 @@ declare const select: tailwind_variants.TVReturnType<{
372
375
  type SelectVariantProps = VariantProps<typeof select>;
373
376
  type SelectSlots = keyof ReturnType<typeof select>;
374
377
 
375
- export { type SelectOption, type SelectProps, type SelectVariantProps, Select as default };
378
+ export { type MultiSelectValue, type SelectOption, type SelectOptionValue, type SelectProps, type SelectVariantProps, Select as default };