@deepnoid/ui 0.1.20 → 0.1.21

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 (102) hide show
  1. package/.turbo/turbo-build.log +149 -159
  2. package/dist/{chunk-JOCMCOEK.mjs → chunk-2Y7IBUAZ.mjs} +17 -6
  3. package/dist/{chunk-LNYMVBV5.mjs → chunk-7CFOD7G4.mjs} +11 -9
  4. package/dist/{chunk-YBDA3WQP.mjs → chunk-7KUFDVGL.mjs} +1 -1
  5. package/dist/{chunk-6KXBXGYR.mjs → chunk-HQLSHEK6.mjs} +1 -1
  6. package/dist/{chunk-EYVRTVRM.mjs → chunk-JHDYQCEE.mjs} +5 -5
  7. package/dist/{chunk-3DPVPTHL.mjs → chunk-MV7RSV4D.mjs} +3 -3
  8. package/dist/chunk-MW7CSRIE.mjs +348 -0
  9. package/dist/{chunk-ZUSUVPYV.mjs → chunk-OV7CZNXU.mjs} +5 -5
  10. package/dist/{chunk-OWG4RL2T.mjs → chunk-Q6BZ76DI.mjs} +2 -2
  11. package/dist/{chunk-63WXGSTV.mjs → chunk-QHWFHOW2.mjs} +24 -14
  12. package/dist/{chunk-EGHTZLZJ.mjs → chunk-UTC2D6GV.mjs} +5 -5
  13. package/dist/components/backdrop/backdrop.mjs +2 -2
  14. package/dist/components/backdrop/index.mjs +2 -2
  15. package/dist/components/breadcrumb/breadcrumb.mjs +6 -6
  16. package/dist/components/breadcrumb/index.mjs +6 -6
  17. package/dist/components/button/button.mjs +2 -2
  18. package/dist/components/button/icon-button.mjs +2 -2
  19. package/dist/components/button/index.mjs +5 -5
  20. package/dist/components/button/text-button.mjs +3 -3
  21. package/dist/components/checkbox/checkbox.mjs +3 -3
  22. package/dist/components/checkbox/index.mjs +3 -3
  23. package/dist/components/chip/chip.mjs +2 -2
  24. package/dist/components/chip/index.mjs +2 -2
  25. package/dist/components/dateTimePicker/calendar.mjs +2 -2
  26. package/dist/components/dateTimePicker/dateTimePicker.mjs +6 -6
  27. package/dist/components/dateTimePicker/index.mjs +6 -6
  28. package/dist/components/dateTimePicker/timePicker.mjs +4 -4
  29. package/dist/components/input/index.js +13 -2
  30. package/dist/components/input/index.mjs +3 -3
  31. package/dist/components/input/input.js +13 -2
  32. package/dist/components/input/input.mjs +3 -3
  33. package/dist/components/list/index.mjs +3 -3
  34. package/dist/components/list/list.mjs +2 -2
  35. package/dist/components/list/listItem.mjs +2 -2
  36. package/dist/components/modal/index.mjs +8 -8
  37. package/dist/components/modal/modal.mjs +8 -8
  38. package/dist/components/pagination/index.js +13 -2
  39. package/dist/components/pagination/index.mjs +4 -4
  40. package/dist/components/pagination/pagination.js +13 -2
  41. package/dist/components/pagination/pagination.mjs +4 -4
  42. package/dist/components/radio/index.mjs +3 -3
  43. package/dist/components/radio/radio.mjs +3 -3
  44. package/dist/components/select/index.d.mts +1 -1
  45. package/dist/components/select/index.d.ts +1 -1
  46. package/dist/components/select/index.js +301 -286
  47. package/dist/components/select/index.mjs +3 -4
  48. package/dist/components/select/select.d.mts +190 -177
  49. package/dist/components/select/select.d.ts +190 -177
  50. package/dist/components/select/select.js +301 -286
  51. package/dist/components/select/select.mjs +3 -4
  52. package/dist/components/table/index.js +43 -20
  53. package/dist/components/table/index.mjs +8 -8
  54. package/dist/components/table/table-body.d.mts +3 -2
  55. package/dist/components/table/table-body.d.ts +3 -2
  56. package/dist/components/table/table-body.js +23 -13
  57. package/dist/components/table/table-body.mjs +4 -4
  58. package/dist/components/table/table-head.d.mts +2 -2
  59. package/dist/components/table/table-head.d.ts +2 -2
  60. package/dist/components/table/table-head.js +2 -2
  61. package/dist/components/table/table-head.mjs +4 -4
  62. package/dist/components/table/table.d.mts +2 -1
  63. package/dist/components/table/table.d.ts +2 -1
  64. package/dist/components/table/table.js +43 -20
  65. package/dist/components/table/table.mjs +8 -8
  66. package/dist/components/tabs/index.mjs +2 -2
  67. package/dist/components/tabs/tabs.mjs +2 -2
  68. package/dist/components/toast/index.mjs +4 -4
  69. package/dist/components/toast/toast.mjs +3 -3
  70. package/dist/components/toast/use-toast.mjs +4 -4
  71. package/dist/components/tooltip/index.mjs +2 -2
  72. package/dist/components/tooltip/tooltip.mjs +2 -2
  73. package/dist/components/tree/index.mjs +3 -3
  74. package/dist/components/tree/tree.mjs +3 -3
  75. package/dist/index.js +490 -494
  76. package/dist/index.mjs +50 -52
  77. package/package.json +1 -1
  78. package/dist/chunk-BXXAMH3R.mjs +0 -255
  79. package/dist/chunk-OF3X4BXG.mjs +0 -76
  80. package/dist/chunk-S3QS5B7F.mjs +0 -61
  81. package/dist/components/select/option.d.mts +0 -17
  82. package/dist/components/select/option.d.ts +0 -17
  83. package/dist/components/select/option.js +0 -4359
  84. package/dist/components/select/option.mjs +0 -12
  85. package/dist/components/select/useSelect.d.mts +0 -31
  86. package/dist/components/select/useSelect.d.ts +0 -31
  87. package/dist/components/select/useSelect.js +0 -84
  88. package/dist/components/select/useSelect.mjs +0 -8
  89. package/dist/{chunk-OUAKGMDW.mjs → chunk-2DLKV6TT.mjs} +4 -4
  90. package/dist/{chunk-D6QI3DJG.mjs → chunk-7H5XPHY6.mjs} +4 -4
  91. package/dist/{chunk-Q72LZAPG.mjs → chunk-DUPQBPI2.mjs} +3 -3
  92. package/dist/{chunk-VQROXH43.mjs → chunk-EWZAHXN7.mjs} +3 -3
  93. package/dist/{chunk-6HX3PPL6.mjs → chunk-FBAR75U4.mjs} +3 -3
  94. package/dist/{chunk-Z2537DF6.mjs → chunk-IL5ENWCR.mjs} +3 -3
  95. package/dist/{chunk-WFMFC7R6.mjs → chunk-KCOHU7X7.mjs} +4 -4
  96. package/dist/{chunk-PNRS23HE.mjs → chunk-MQI5SZWO.mjs} +3 -3
  97. package/dist/{chunk-LL6F3WDX.mjs → chunk-P5QCU457.mjs} +3 -3
  98. package/dist/{chunk-PZIVMTKX.mjs → chunk-SDHQUYFI.mjs} +3 -3
  99. package/dist/{chunk-2YMAKIZ6.mjs → chunk-SSMMWMQC.mjs} +3 -3
  100. package/dist/{chunk-HIVPDIEP.mjs → chunk-UFVQPPPW.mjs} +3 -3
  101. package/dist/{chunk-BPVRXFIC.mjs → chunk-XGYQ6D3S.mjs} +3 -3
  102. package/dist/{chunk-QIRL6HY6.mjs → chunk-YIIFWADW.mjs} +4 -4
@@ -105,7 +105,7 @@ __export(select_exports, {
105
105
  default: () => select_default
106
106
  });
107
107
  module.exports = __toCommonJS(select_exports);
108
- var import_react2 = require("react");
108
+ var import_react = require("react");
109
109
  var import_react_dom = require("react-dom");
110
110
 
111
111
  // src/utils/tailwind-variants.ts
@@ -345,62 +345,6 @@ var mapPropsVariants = (props, variantKeys, removeVariantProps = true) => {
345
345
  }
346
346
  };
347
347
 
348
- // src/components/select/useSelect.tsx
349
- var import_react = require("react");
350
- var useSelect = ({ options, defaultOption, onChange }) => {
351
- const [selectedOption, setSelectedOption] = (0, import_react.useState)(defaultOption);
352
- const [targetRect, setTargetRect] = (0, import_react.useState)(null);
353
- const [optionWrapperHeight, setOptionWrapperHeight] = (0, import_react.useState)(0);
354
- const selectWrapperRef = (0, import_react.useRef)(null);
355
- const optionWrapperRef = (0, import_react.useRef)(null);
356
- const calculatePositionWithScroll = (targetRect2, optionWrapperHeight2) => {
357
- const scrollTop = window.scrollY || document.documentElement.scrollTop || document.body.scrollTop;
358
- const scrollLeft = window.scrollX || document.documentElement.scrollLeft || document.body.scrollLeft;
359
- const spaceBelow = window.innerHeight - (targetRect2.y + targetRect2.height + 4);
360
- const spaceAbove = targetRect2.y - 4;
361
- const top = spaceBelow < optionWrapperHeight2 && spaceAbove > optionWrapperHeight2 ? targetRect2.y - optionWrapperHeight2 - 4 : targetRect2.y + targetRect2.height + 4;
362
- return {
363
- top: top + scrollTop,
364
- left: targetRect2.x + scrollLeft
365
- };
366
- };
367
- const handleToggleSelect = () => {
368
- if (selectWrapperRef.current) {
369
- const rect = selectWrapperRef.current.getBoundingClientRect();
370
- setTargetRect((prevRect) => prevRect ? null : { x: rect.x, y: rect.y, width: rect.width, height: rect.height });
371
- }
372
- };
373
- const handleChangeOption = (option) => {
374
- onChange == null ? void 0 : onChange(option);
375
- setSelectedOption(option);
376
- handleToggleSelect();
377
- };
378
- (0, import_react.useEffect)(() => {
379
- const onClickOutside = (e) => {
380
- if (optionWrapperRef.current && !optionWrapperRef.current.contains(e.target)) {
381
- setTargetRect(null);
382
- }
383
- };
384
- window.addEventListener("mousedown", onClickOutside);
385
- return () => window.removeEventListener("mousedown", onClickOutside);
386
- }, []);
387
- (0, import_react.useEffect)(() => {
388
- if (optionWrapperRef.current) {
389
- setOptionWrapperHeight(optionWrapperRef.current.getBoundingClientRect().height);
390
- }
391
- }, [targetRect]);
392
- return {
393
- selectedOption,
394
- targetRect,
395
- optionWrapperHeight,
396
- selectWrapperRef,
397
- optionWrapperRef,
398
- handleToggleSelect,
399
- handleChangeOption,
400
- calculatePositionWithScroll
401
- };
402
- };
403
-
404
348
  // src/components/icon/template.tsx
405
349
  var import_jsx_runtime = require("react/jsx-runtime");
406
350
  var template = {
@@ -4371,300 +4315,371 @@ var Icon = ({ name, size = "md", fill = false, className, onClick, ...props }) =
4371
4315
  };
4372
4316
  var Icon_default = Icon;
4373
4317
 
4374
- // src/components/select/option.tsx
4375
- var import_jsx_runtime3 = require("react/jsx-runtime");
4376
- var Option = (props) => {
4377
- const { base, option, icon } = optionStyle(props);
4378
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
4379
- "div",
4380
- {
4381
- title: props.option.value,
4382
- className: base(),
4383
- onClick: () => props.onClick(props.option),
4384
- ref: (node) => {
4385
- props.isSelected && (node == null ? void 0 : node.scrollIntoView());
4386
- },
4387
- children: [
4388
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: option(), children: props.children }),
4389
- props.isSelected && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: icon(), children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Icon_default, { name: "check", size: props.size }) })
4390
- ]
4318
+ // src/utils/clsx.ts
4319
+ function clsx(...args) {
4320
+ var i = 0, tmp, x, str = "";
4321
+ while (i < args.length) {
4322
+ if (tmp = args[i++]) {
4323
+ if (x = toVal(tmp)) {
4324
+ str && (str += " ");
4325
+ str += x;
4326
+ }
4391
4327
  }
4392
- );
4393
- };
4394
- var option_default = Option;
4395
- var optionStyle = tv({
4396
- slots: {
4397
- base: ["w-full", "flex", "items-center", "justify-between", , "overflow-hidden"],
4398
- option: ["text-ellipsis overflow-hidden "],
4399
- icon: ""
4400
- },
4401
- variants: {
4402
- variant: {
4403
- solid: {},
4404
- normal: {},
4405
- line: {}
4406
- },
4407
- color: {
4408
- primary: {
4409
- base: ["border-primary-main", "hover:bg-primary-soft", "hover:text-primary-main"],
4410
- icon: "text-primary-main"
4411
- },
4412
- secondary: {
4413
- base: ["border-secondary-main", "hover:bg-secondary-soft", "hover:text-secondary-main"],
4414
- icon: "text-secondary-main"
4328
+ }
4329
+ return str;
4330
+ }
4331
+ function toVal(mix) {
4332
+ var k, y, str = "";
4333
+ if (typeof mix === "string" || typeof mix === "number") {
4334
+ str += mix;
4335
+ } else if (typeof mix === "object") {
4336
+ if (Array.isArray(mix)) {
4337
+ var len = mix.length;
4338
+ for (k = 0; k < len; k++) {
4339
+ if (mix[k]) {
4340
+ if (y = toVal(mix[k])) {
4341
+ str && (str += " ");
4342
+ str += y;
4343
+ }
4344
+ }
4415
4345
  }
4416
- },
4417
- size: {
4418
- sm: {
4419
- base: "text-sm px-[6px] py-[4.5px]"
4420
- },
4421
- md: {
4422
- base: "text-md px-[8px] py-[6.5px]"
4423
- },
4424
- lg: {
4425
- base: "text-lg px-[10px] py-[8px]"
4426
- },
4427
- xl: {
4428
- base: "text-xl px-[10px] py-[8px]"
4346
+ } else {
4347
+ for (y in mix) {
4348
+ if (mix[y]) {
4349
+ str && (str += " ");
4350
+ str += y;
4351
+ }
4429
4352
  }
4430
4353
  }
4431
- },
4432
- defaultVariants: {
4433
- variant: "normal",
4434
- color: "primary",
4435
- size: "md"
4436
4354
  }
4437
- });
4355
+ return str;
4356
+ }
4438
4357
 
4439
4358
  // src/components/select/select.tsx
4440
- var import_jsx_runtime4 = require("react/jsx-runtime");
4441
- var Select = (0, import_react2.forwardRef)((originalProps, ref) => {
4359
+ var import_jsx_runtime3 = require("react/jsx-runtime");
4360
+ var Select = (0, import_react.forwardRef)((originalProps, ref) => {
4361
+ var _a;
4442
4362
  const [props, variantProps] = mapPropsVariants(originalProps, select.variantKeys);
4443
- const { classNames, options, defaultOption, onChange, ...inputProps } = props;
4444
- const slots = (0, import_react2.useMemo)(() => select({ ...variantProps }), [variantProps]);
4445
4363
  const {
4446
- targetRect,
4447
- selectedOption,
4448
- optionWrapperHeight,
4449
- selectWrapperRef,
4450
- optionWrapperRef,
4451
- handleToggleSelect,
4452
- handleChangeOption,
4453
- calculatePositionWithScroll
4454
- } = useSelect({
4364
+ label,
4455
4365
  options,
4456
- defaultOption,
4457
- onChange
4458
- });
4366
+ helperText,
4367
+ errorText,
4368
+ classNames,
4369
+ defaultSelectedOptions = [],
4370
+ onChange,
4371
+ multiple,
4372
+ ...inputProps
4373
+ } = props;
4374
+ const slots = (0, import_react.useMemo)(() => select({ ...variantProps }), [variantProps]);
4375
+ const [selectedOptions, setSelectedOptions] = (0, import_react.useState)(defaultSelectedOptions);
4376
+ const [targetRect, setTargetRect] = (0, import_react.useState)(null);
4377
+ const [optionWrapperHeight, setOptionWrapperHeight] = (0, import_react.useState)(0);
4378
+ const [isVisible, setIsVisible] = (0, import_react.useState)(false);
4379
+ const [isOpen, setIsOpen] = (0, import_react.useState)(false);
4380
+ const selectWrapperRef = (0, import_react.useRef)(null);
4381
+ const optionWrapperRef = (0, import_react.useRef)(null);
4382
+ const handleToggleSelect = () => {
4383
+ if (isOpen) {
4384
+ setIsOpen(false);
4385
+ setTimeout(() => setIsVisible(false), 150);
4386
+ } else {
4387
+ if (selectWrapperRef.current) {
4388
+ const rect = selectWrapperRef.current.getBoundingClientRect();
4389
+ setTargetRect(rect);
4390
+ setIsVisible(true);
4391
+ requestAnimationFrame(() => setIsOpen(true));
4392
+ }
4393
+ }
4394
+ };
4395
+ const calculatePositionWithScroll = (rect, height) => {
4396
+ const scrollTop = window.scrollY;
4397
+ const scrollLeft = window.scrollX;
4398
+ const spaceBelow = window.innerHeight - (rect.y + rect.height + 4);
4399
+ const spaceAbove = rect.y - 4;
4400
+ const top = spaceBelow < height && spaceAbove > height ? rect.y - height - 4 : rect.y + rect.height + 4;
4401
+ return {
4402
+ top: top + scrollTop,
4403
+ left: rect.x + scrollLeft
4404
+ };
4405
+ };
4406
+ const handleChangeOption = (option) => {
4407
+ let nextOptions;
4408
+ if (multiple) {
4409
+ const exists = selectedOptions.some((o) => o.key === option.key);
4410
+ nextOptions = exists ? selectedOptions.filter((o) => o.key !== option.key) : [...selectedOptions, option];
4411
+ } else {
4412
+ nextOptions = [option];
4413
+ setIsOpen(false);
4414
+ setTimeout(() => setIsVisible(false), 150);
4415
+ }
4416
+ setSelectedOptions(nextOptions);
4417
+ onChange == null ? void 0 : onChange(nextOptions);
4418
+ };
4419
+ (0, import_react.useEffect)(() => {
4420
+ const handleClickOutside = (e) => {
4421
+ var _a2;
4422
+ if (optionWrapperRef.current && !optionWrapperRef.current.contains(e.target) && !((_a2 = selectWrapperRef.current) == null ? void 0 : _a2.contains(e.target))) {
4423
+ setIsOpen(false);
4424
+ setTimeout(() => setIsVisible(false), 150);
4425
+ }
4426
+ };
4427
+ window.addEventListener("mousedown", handleClickOutside);
4428
+ return () => window.removeEventListener("mousedown", handleClickOutside);
4429
+ }, []);
4430
+ (0, import_react.useEffect)(() => {
4431
+ if (optionWrapperRef.current) {
4432
+ setOptionWrapperHeight(optionWrapperRef.current.getBoundingClientRect().height);
4433
+ }
4434
+ }, [targetRect]);
4459
4435
  const position = targetRect ? calculatePositionWithScroll(targetRect, optionWrapperHeight) : null;
4460
- const getBaseProps = (0, import_react2.useCallback)(
4461
- () => ({
4462
- className: slots.base({ class: classNames == null ? void 0 : classNames.base })
4463
- }),
4464
- [slots, classNames]
4465
- );
4466
- const getLabelProps = (0, import_react2.useCallback)(
4467
- () => ({
4468
- className: slots.label({ class: classNames == null ? void 0 : classNames.label })
4469
- }),
4470
- [slots, classNames]
4471
- );
4472
- const getSelectWrapperProps = (0, import_react2.useCallback)(
4473
- () => ({
4474
- className: slots.selectWrapper({ class: classNames == null ? void 0 : classNames.selectWrapper }),
4475
- ref: selectWrapperRef,
4476
- onClick: handleToggleSelect
4477
- }),
4478
- [slots, classNames]
4479
- );
4480
- const getSelectProps = (0, import_react2.useCallback)(
4481
- () => ({
4482
- ...inputProps,
4483
- ref,
4484
- className: slots.select({ class: classNames == null ? void 0 : classNames.select }),
4485
- value: (selectedOption == null ? void 0 : selectedOption.value) || "",
4486
- readOnly: true,
4487
- size: 0
4488
- }),
4489
- [slots, classNames, inputProps, selectedOption, ref]
4490
- );
4491
- const getOptionsWrapperProps = (0, import_react2.useCallback)(
4492
- () => ({
4493
- className: slots.optionsWrapper({ class: classNames == null ? void 0 : classNames.optionsWrapper }),
4494
- ref: optionWrapperRef
4495
- }),
4496
- [slots, classNames]
4497
- );
4498
- const getErrorMessageProps = (0, import_react2.useCallback)(
4499
- () => ({
4500
- className: slots.errorMessage({ class: classNames == null ? void 0 : classNames.errorMessage })
4501
- }),
4502
- [slots, classNames]
4503
- );
4504
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
4505
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { ...getBaseProps(), children: [
4506
- props.label && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("label", { ...getLabelProps(), children: props.label }),
4507
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { "data-expanded": !!targetRect, ...getSelectWrapperProps(), children: [
4508
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("input", { ...getSelectProps() }),
4509
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Icon_default, { name: !!targetRect ? "arrow-triangle-up" : "arrow-triangle-down", size: originalProps.size, fill: true })
4510
- ] }),
4511
- props.errorMessage && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { ...getErrorMessageProps(), children: props.errorMessage })
4512
- ] }),
4513
- targetRect && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_jsx_runtime4.Fragment, { children: (0, import_react_dom.createPortal)(
4514
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
4436
+ const displayValue = multiple ? selectedOptions.map((opt) => opt.value).join(", ") : ((_a = selectedOptions[0]) == null ? void 0 : _a.value) || "";
4437
+ const Option = ({
4438
+ option,
4439
+ isSelected,
4440
+ onClick
4441
+ }) => {
4442
+ const slot = select({ ...variantProps, isSelected });
4443
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { title: option.value, onClick, className: clsx(slot.option({ class: classNames == null ? void 0 : classNames.option })), children: [
4444
+ option.value,
4445
+ isSelected && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Icon_default, { name: "check", size: originalProps.size })
4446
+ ] });
4447
+ };
4448
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
4449
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
4450
+ "div",
4451
+ {
4452
+ className: clsx(
4453
+ slots.base({ class: classNames == null ? void 0 : classNames.base }),
4454
+ variantProps.direction === "horizon" ? slots.horizon({ class: classNames == null ? void 0 : classNames.horizon }) : slots.vertical({ class: classNames == null ? void 0 : classNames.vertical })
4455
+ ),
4456
+ children: [
4457
+ label && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("label", { className: slots.label({ class: classNames == null ? void 0 : classNames.label }), children: label }),
4458
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: slots.wrapper({ class: classNames == null ? void 0 : classNames.wrapper }), children: [
4459
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
4460
+ "div",
4461
+ {
4462
+ "data-expanded": isOpen,
4463
+ className: clsx(
4464
+ slots.selectWrapper({ class: classNames == null ? void 0 : classNames.selectWrapper }),
4465
+ inputProps.readOnly ? slots.readonly({ class: classNames == null ? void 0 : classNames.readonly }) : ""
4466
+ ),
4467
+ ref: selectWrapperRef,
4468
+ onClick: handleToggleSelect,
4469
+ children: [
4470
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
4471
+ "input",
4472
+ {
4473
+ ...inputProps,
4474
+ ref,
4475
+ className: clsx(
4476
+ slots.select({ class: classNames == null ? void 0 : classNames.select }),
4477
+ inputProps.readOnly ? "!text-body-foreground placeholder:text-body-foreground" : ""
4478
+ ),
4479
+ value: displayValue,
4480
+ readOnly: true,
4481
+ size: 0
4482
+ }
4483
+ ),
4484
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
4485
+ Icon_default,
4486
+ {
4487
+ name: "brace-up",
4488
+ size: originalProps.size,
4489
+ className: `transition-transform duration-200 ${isOpen ? "rotate-0" : "rotate-180"}`
4490
+ }
4491
+ )
4492
+ ]
4493
+ }
4494
+ ),
4495
+ helperText && !errorText && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: slots.helperText({ class: classNames == null ? void 0 : classNames.helperText }), children: helperText }),
4496
+ errorText && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: clsx("error", slots.errorText({ class: classNames == null ? void 0 : classNames.errorText })), children: errorText })
4497
+ ] })
4498
+ ]
4499
+ }
4500
+ ),
4501
+ isVisible && (0, import_react_dom.createPortal)(
4502
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
4515
4503
  "div",
4516
4504
  {
4517
- ...getOptionsWrapperProps(),
4505
+ ref: optionWrapperRef,
4506
+ className: slots.optionsWrapper({ class: classNames == null ? void 0 : classNames.optionsWrapper }),
4518
4507
  style: {
4519
4508
  position: "absolute",
4520
4509
  top: position == null ? void 0 : position.top,
4521
4510
  left: position == null ? void 0 : position.left,
4522
- width: targetRect.width
4511
+ width: targetRect == null ? void 0 : targetRect.width,
4512
+ zIndex: 1e3,
4513
+ opacity: isOpen ? 1 : 0,
4514
+ transform: isOpen ? "translateY(0)" : "translateY(-0.25rem)",
4515
+ transition: "opacity 150ms ease-out, transform 150ms ease-out"
4523
4516
  },
4524
- children: options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
4525
- option_default,
4526
- {
4527
- variant: originalProps.variant,
4528
- size: originalProps.size,
4529
- color: originalProps.color,
4530
- option,
4531
- isSelected: (selectedOption == null ? void 0 : selectedOption.key) === option.key,
4532
- onClick: () => handleChangeOption(option),
4533
- children: option.value
4534
- },
4535
- option.key
4536
- ))
4517
+ children: options.map((option) => {
4518
+ const isSelected = selectedOptions.some((o) => o.key === option.key);
4519
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
4520
+ Option,
4521
+ {
4522
+ option,
4523
+ isSelected,
4524
+ onClick: () => handleChangeOption(option)
4525
+ },
4526
+ option.key
4527
+ );
4528
+ })
4537
4529
  }
4538
4530
  ),
4539
4531
  document.body
4540
- ) })
4532
+ )
4541
4533
  ] });
4542
4534
  });
4543
4535
  Select.displayName = "Select";
4544
4536
  var select_default = Select;
4545
4537
  var select = tv({
4546
4538
  slots: {
4547
- base: ["group/select", "flex flex-col"],
4548
- label: ["flex", "items-center"],
4539
+ base: ["group/select", "flex"],
4540
+ vertical: ["flex-col"],
4541
+ horizon: ["flex-row", "gap-0"],
4542
+ label: ["flex", "items-center", "font-bold", "text-body-foreground", "min-w-[80px]"],
4543
+ wrapper: ["flex", "flex-col"],
4549
4544
  selectWrapper: [
4550
4545
  "flex",
4551
4546
  "items-center",
4552
- "bg-transparent",
4553
- "border-neutral-main",
4554
- "transition duration-200",
4555
- "group-has-[p]/select:border-danger-main",
4556
- "group-has-[p]/select:text-danger-main",
4557
- "group-has-[p]/select:bg-danger-soft"
4547
+ "justify-between",
4548
+ "border",
4549
+ "cursor-pointer",
4550
+ "text-neutral-main",
4551
+ "hover:bg-trans-soft",
4552
+ "group-has-[p.error]/select:border-danger-main",
4553
+ "group-has-[p.error]/select:bg-danger-soft",
4554
+ "group-has-[p.error]/select:text-danger-main",
4555
+ "group-has-[p.error]/select:hover:bg-danger-soft"
4558
4556
  ],
4559
4557
  select: [
4560
- "w-full",
4561
4558
  "bg-transparent",
4562
- "text-foreground",
4563
- "cursor-inherit",
4564
- "cursor-pointer",
4559
+ "w-full",
4560
+ "outline-none",
4565
4561
  "placeholder:text-neutral-main",
4566
- "group-has-[p]/select:text-danger-main",
4567
- "focus-visible:outline-none"
4562
+ "text-neutral-dark",
4563
+ "group-has-[p.error]/select:text-danger-main",
4564
+ "group-has-[p.error]/select:placeholder:text-danger-main"
4568
4565
  ],
4569
- optionsWrapper: ["w-[240px]", "border", "bg-background", "cursor-pointer", "overflow-y-auto"],
4570
- errorMessage: ["text-danger-main"]
4566
+ optionsWrapper: ["border", "rounded", "bg-white", "shadow", "overflow-auto"],
4567
+ option: ["flex", "justify-between", "items-center", "cursor-pointer"],
4568
+ helperText: ["text-neutral-main"],
4569
+ errorText: ["text-danger-main"],
4570
+ readonly: ["pointer-events-none", "!bg-trans-soft"]
4571
4571
  },
4572
4572
  variants: {
4573
- variant: {
4574
- solid: {
4575
- selectWrapper: "bg-trans-soft hover:bg-trans-light data-[expanded=true]:bg-trans-light group-has-[p]/select:bg-danger-soft"
4576
- },
4577
- normal: {
4578
- selectWrapper: "border hover:bg-trans-soft data-[expanded=true]:bg-trans-soft"
4579
- },
4580
- line: {
4581
- selectWrapper: "border-b !rounded-none hover:bg-trans-soft data-[expanded=true]:bg-trans-soft",
4582
- optionsWrapper: "!rounded-none"
4583
- }
4584
- },
4585
4573
  color: {
4586
4574
  primary: {
4587
- selectWrapper: "data-[expanded=true]:border-primary-main text-primary-main",
4588
- optionsWrapper: "border-primary-main",
4589
- select: "data-[expanded=true]:text-primary-main"
4575
+ selectWrapper: ["hover:text-primary-main"],
4576
+ option: ["hover:bg-primary-soft", "hover:text-primary-main"]
4590
4577
  },
4591
4578
  secondary: {
4592
- selectWrapper: "data-[expanded=true]:border-secondary-main text-secondary-main",
4593
- optionsWrapper: "border-secondary-main",
4594
- select: "data-[expanded=true]:text-secondary-main"
4579
+ selectWrapper: ["hover:text-secondary-main"],
4580
+ select: ["text-secondary-main"],
4581
+ option: ["hover:bg-secondary-soft", "hover:text-secondary-main"]
4595
4582
  }
4596
4583
  },
4597
4584
  size: {
4598
4585
  sm: {
4599
- base: "text-sm gap-[6px]",
4600
- selectWrapper: "w-[240px] h-[24px] px-[6px] py-[4.5px] gap-[6px] rounded-sm",
4601
- optionsWrapper: "max-h-[96px] rounded-sm",
4602
- errorMessage: "text-sm"
4586
+ base: ["text-sm", "gap-[4px]"],
4587
+ label: ["text-sm"],
4588
+ wrapper: ["gap-[4px]"],
4589
+ selectWrapper: ["w-[240px]", "h-[24px]", "rounded-sm", "px-[4px]"],
4590
+ select: ["text-sm"],
4591
+ option: ["px-[4px]", "py-[3px]", "text-sm"],
4592
+ helperText: ["text-sm"],
4593
+ errorText: ["text-sm"]
4603
4594
  },
4604
4595
  md: {
4605
- base: "text-md gap-[8px]",
4606
- selectWrapper: "w-[240px] h-[30px] px-[8px] py-[6.5px] gap-[8px] rounded-md",
4607
- optionsWrapper: "max-h-[120px] rounded-md",
4608
- errorMessage: "text-md"
4596
+ base: ["text-md", "gap-[6px]", "rounded-md"],
4597
+ label: ["text-md"],
4598
+ wrapper: ["gap-[6px]"],
4599
+ selectWrapper: ["w-[240px]", "h-[32px]", "rounded-md", "px-[6px]"],
4600
+ select: ["text-md"],
4601
+ option: ["px-[6px]", "py-[5.5px]", "text-md"],
4602
+ helperText: ["text-sm"],
4603
+ errorText: ["text-sm"]
4609
4604
  },
4610
4605
  lg: {
4611
- base: "text-lg gap-[10px]",
4612
- selectWrapper: "w-[240px] h-[36px] px-[10px] py-[8px] gap-[10px] rounded-lg",
4613
- optionsWrapper: "max-h-[144px] rounded-lg",
4614
- errorMessage: "text-lg"
4606
+ base: ["text-lg", "gap-[8px]"],
4607
+ label: ["text-lg"],
4608
+ wrapper: ["gap-[8px]"],
4609
+ selectWrapper: ["w-[240px]", "h-[40px]", "rounded-lg", "px-[8px]"],
4610
+ select: ["text-lg"],
4611
+ option: ["px-[8px]", "py-[8px]", "text-lg"],
4612
+ helperText: ["text-md"],
4613
+ errorText: ["text-md"]
4615
4614
  },
4616
4615
  xl: {
4617
- base: "text-lg gap-[10px]",
4618
- selectWrapper: "w-[240px] h-[36px] px-[10px] py-[8px] gap-[10px] rounded-xl",
4619
- optionsWrapper: "max-h-[144px] rounded-xl",
4620
- errorMessage: "text-xl"
4616
+ base: ["text-xl", "gap-[10px]"],
4617
+ label: ["text-xl"],
4618
+ wrapper: ["gap-[10px]"],
4619
+ selectWrapper: ["w-[240px]", "h-[50px]", "rounded-lg", "px-[10px]"],
4620
+ select: ["text-xl"],
4621
+ option: ["px-[10px]", "py-[11.5px]"],
4622
+ helperText: ["text-md"],
4623
+ errorText: ["text-md"]
4621
4624
  }
4622
4625
  },
4623
- radius: {
4624
- default: "",
4625
- none: {
4626
- selectWrapper: "rounded-none",
4627
- optionsWrapper: "rounded-none"
4628
- },
4629
- full: {
4630
- selectWrapper: "rounded-full"
4631
- }
4626
+ direction: {
4627
+ vertical: "",
4628
+ horizon: ""
4632
4629
  },
4633
- fullWidth: {
4630
+ full: {
4634
4631
  true: {
4635
- selectWrapper: "w-full",
4636
- optionsWrapper: "w-full"
4632
+ base: ["w-full"],
4633
+ wrapper: ["w-full"],
4634
+ selectWrapper: ["w-full"]
4637
4635
  }
4638
4636
  },
4639
- isDisabled: {
4637
+ disabled: {
4640
4638
  true: {
4641
- base: "cursor-default",
4642
- selectWrapper: "bg-neutral-soft border-neutral-light text-neutral-light pointer-events-none",
4643
- select: "text-neutral-light focus:text-neutral-light",
4644
- label: "text-neutral-light"
4639
+ base: ["pointer-events-none"],
4640
+ selectWrapper: [
4641
+ "bg-neutral-soft",
4642
+ "border-neutral-light",
4643
+ "group-has-[p.error]/select:text-danger-light",
4644
+ "group-has-[p.error]/select:bg-danger-soft",
4645
+ "group-has-[p.error]/select:border-danger-light"
4646
+ ],
4647
+ select: [
4648
+ "text-neutral-light",
4649
+ "placeholder:text-neutral-light",
4650
+ "group-has-[p.error]/select:text-danger-light",
4651
+ "group-has-[p.error]/select:placeholder:text-danger-light"
4652
+ ],
4653
+ helperText: ["!text-neutral-light"],
4654
+ errorText: ["!text-danger-light"]
4645
4655
  }
4646
4656
  },
4647
- isRequired: {
4648
- true: {
4649
- label: "after:content-['*'] after:text-danger-main after:ml-0.5"
4650
- }
4657
+ isSelected: {
4658
+ true: "",
4659
+ false: ""
4651
4660
  }
4652
4661
  },
4653
- defaultVariants: {
4654
- variant: "solid",
4655
- color: "primary",
4656
- size: "md",
4657
- fullWidth: false,
4658
- isDisabled: false,
4659
- isRequired: false
4660
- },
4661
4662
  compoundVariants: [
4662
4663
  {
4663
- isDisabled: true,
4664
- isRequired: true,
4664
+ color: "primary",
4665
+ isSelected: true,
4665
4666
  class: {
4666
- label: "after:text-danger-light"
4667
+ option: "bg-primary-soft text-primary-main"
4668
+ }
4669
+ },
4670
+ {
4671
+ color: "secondary",
4672
+ isSelected: true,
4673
+ class: {
4674
+ option: "bg-secondary-soft text-secondary-main"
4667
4675
  }
4668
4676
  }
4669
- ]
4677
+ ],
4678
+ defaultVariants: {
4679
+ color: "primary",
4680
+ size: "md",
4681
+ direction: "vertical",
4682
+ disabled: false,
4683
+ readonly: false
4684
+ }
4670
4685
  });