@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
package/dist/index.mjs CHANGED
@@ -1,44 +1,40 @@
1
1
  "use client";
2
- import "./chunk-HIE2YRGA.mjs";
3
- import {
4
- tooltip_default
5
- } from "./chunk-Z2537DF6.mjs";
6
- import "./chunk-ZMOAFSYE.mjs";
7
- import "./chunk-WSIADHVC.mjs";
8
- import "./chunk-MBLZYQCN.mjs";
9
- import {
10
- tree_default
11
- } from "./chunk-BPVRXFIC.mjs";
12
- import "./chunk-RRAZM5D3.mjs";
13
- import {
14
- textarea_default
15
- } from "./chunk-BKE6QF6W.mjs";
16
- import "./chunk-3MY6LO7N.mjs";
17
- import {
18
- tabs_default
19
- } from "./chunk-2YMAKIZ6.mjs";
20
2
  import "./chunk-LUWGOKLG.mjs";
21
3
  import {
22
4
  ToastProvider,
23
5
  useToast
24
- } from "./chunk-YBDA3WQP.mjs";
6
+ } from "./chunk-7KUFDVGL.mjs";
25
7
  import "./chunk-ZOTHPHXA.mjs";
26
8
  import {
27
9
  toast_default
28
- } from "./chunk-OUAKGMDW.mjs";
29
- import "./chunk-LVFI2NOH.mjs";
10
+ } from "./chunk-2DLKV6TT.mjs";
11
+ import "./chunk-RRAZM5D3.mjs";
30
12
  import {
31
- switch_default
32
- } from "./chunk-Z74QNVPG.mjs";
13
+ textarea_default
14
+ } from "./chunk-BKE6QF6W.mjs";
15
+ import "./chunk-HIE2YRGA.mjs";
16
+ import {
17
+ tooltip_default
18
+ } from "./chunk-IL5ENWCR.mjs";
19
+ import "./chunk-ZMOAFSYE.mjs";
20
+ import "./chunk-WSIADHVC.mjs";
21
+ import "./chunk-MBLZYQCN.mjs";
22
+ import {
23
+ tree_default
24
+ } from "./chunk-XGYQ6D3S.mjs";
33
25
  import "./chunk-DX3KXNP6.mjs";
34
26
  import {
35
27
  form_table_default
36
28
  } from "./chunk-3BKCODIL.mjs";
37
29
  import {
38
30
  table_default
39
- } from "./chunk-LNYMVBV5.mjs";
40
- import "./chunk-63WXGSTV.mjs";
41
- import "./chunk-3DPVPTHL.mjs";
31
+ } from "./chunk-7CFOD7G4.mjs";
32
+ import "./chunk-QHWFHOW2.mjs";
33
+ import "./chunk-MV7RSV4D.mjs";
34
+ import "./chunk-3MY6LO7N.mjs";
35
+ import {
36
+ tabs_default
37
+ } from "./chunk-SSMMWMQC.mjs";
42
38
  import "./chunk-DQRAFUDA.mjs";
43
39
  import {
44
40
  scrollArea_default
@@ -46,60 +42,62 @@ import {
46
42
  import "./chunk-QCEKPS7U.mjs";
47
43
  import {
48
44
  select_default
49
- } from "./chunk-BXXAMH3R.mjs";
50
- import "./chunk-S3QS5B7F.mjs";
51
- import "./chunk-OF3X4BXG.mjs";
45
+ } from "./chunk-MW7CSRIE.mjs";
46
+ import "./chunk-LVFI2NOH.mjs";
47
+ import {
48
+ switch_default
49
+ } from "./chunk-Z74QNVPG.mjs";
52
50
  import "./chunk-DJOG6Z35.mjs";
53
51
  import {
54
52
  modal_default
55
- } from "./chunk-ZUSUVPYV.mjs";
53
+ } from "./chunk-OV7CZNXU.mjs";
56
54
  import "./chunk-7B7LRG5J.mjs";
57
55
  import {
58
56
  pagination_default
59
- } from "./chunk-EGHTZLZJ.mjs";
57
+ } from "./chunk-UTC2D6GV.mjs";
60
58
  import "./chunk-F3HENRVM.mjs";
61
59
  import "./chunk-TPFN22HR.mjs";
62
60
  import {
63
61
  radio_default
64
- } from "./chunk-QIRL6HY6.mjs";
62
+ } from "./chunk-YIIFWADW.mjs";
65
63
  import "./chunk-2GCSFWHD.mjs";
66
64
  import {
67
65
  input_default
68
- } from "./chunk-JOCMCOEK.mjs";
66
+ } from "./chunk-2Y7IBUAZ.mjs";
69
67
  import "./chunk-QZ3LVYJW.mjs";
70
68
  import "./chunk-MGEWSREV.mjs";
71
69
  import {
72
70
  chip_default
73
- } from "./chunk-6HX3PPL6.mjs";
71
+ } from "./chunk-FBAR75U4.mjs";
74
72
  import "./chunk-75HLCORR.mjs";
75
73
  import {
76
74
  dateTimePicker_default
77
- } from "./chunk-EYVRTVRM.mjs";
78
- import "./chunk-Q72LZAPG.mjs";
79
- import "./chunk-OWG4RL2T.mjs";
75
+ } from "./chunk-JHDYQCEE.mjs";
76
+ import "./chunk-DUPQBPI2.mjs";
77
+ import "./chunk-Q6BZ76DI.mjs";
80
78
  import "./chunk-7MVEAQ7Z.mjs";
81
79
  import {
82
80
  listItem_default
83
- } from "./chunk-PZIVMTKX.mjs";
81
+ } from "./chunk-SDHQUYFI.mjs";
84
82
  import {
85
83
  list_default
86
- } from "./chunk-HIVPDIEP.mjs";
84
+ } from "./chunk-UFVQPPPW.mjs";
87
85
  import "./chunk-FWJ2ZKH6.mjs";
88
86
  import "./chunk-P732YGHO.mjs";
89
87
  import "./chunk-KYIODWXL.mjs";
90
88
  import {
91
89
  breadcrumb_default
92
- } from "./chunk-6KXBXGYR.mjs";
90
+ } from "./chunk-HQLSHEK6.mjs";
93
91
  import "./chunk-MY5U63QO.mjs";
94
92
  import {
95
93
  button_group_default
96
94
  } from "./chunk-LPZOH3RP.mjs";
97
95
  import {
98
96
  button_default
99
- } from "./chunk-PNRS23HE.mjs";
97
+ } from "./chunk-MQI5SZWO.mjs";
100
98
  import {
101
99
  icon_button_default
102
- } from "./chunk-VQROXH43.mjs";
100
+ } from "./chunk-EWZAHXN7.mjs";
103
101
  import "./chunk-6WSACUIB.mjs";
104
102
  import "./chunk-LXHUO6VM.mjs";
105
103
  import "./chunk-6PNKRBUT.mjs";
@@ -110,27 +108,27 @@ import {
110
108
  } from "./chunk-HWL7TPUN.mjs";
111
109
  import {
112
110
  text_button_default
113
- } from "./chunk-WFMFC7R6.mjs";
111
+ } from "./chunk-KCOHU7X7.mjs";
114
112
  import {
115
113
  checkbox_default
116
- } from "./chunk-D6QI3DJG.mjs";
117
- import "./chunk-7USF56CT.mjs";
118
- import "./chunk-IZM66FHP.mjs";
119
- import "./chunk-SE5TU755.mjs";
120
- import {
121
- backdrop_default
122
- } from "./chunk-LL6F3WDX.mjs";
114
+ } from "./chunk-7H5XPHY6.mjs";
115
+ import "./chunk-E3G5QXSH.mjs";
123
116
  import "./chunk-7DLOYKVC.mjs";
124
117
  import {
125
118
  avatar_default
126
119
  } from "./chunk-XQGD4ZIX.mjs";
127
120
  import "./chunk-3IU2RPSM.mjs";
121
+ import "./chunk-SE5TU755.mjs";
122
+ import {
123
+ backdrop_default
124
+ } from "./chunk-P5QCU457.mjs";
125
+ import "./chunk-27Y6K5NK.mjs";
128
126
  import {
129
127
  deepnoidUi,
130
128
  tv
131
129
  } from "./chunk-4ZJFD3L3.mjs";
132
- import "./chunk-27Y6K5NK.mjs";
133
- import "./chunk-E3G5QXSH.mjs";
130
+ import "./chunk-7USF56CT.mjs";
131
+ import "./chunk-IZM66FHP.mjs";
134
132
  import "./chunk-AC6TWLRT.mjs";
135
133
  export {
136
134
  avatar_default as Avatar,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deepnoid/ui",
3
- "version": "0.1.20",
3
+ "version": "0.1.21",
4
4
  "license": "MIT",
5
5
  "sideEffects": false,
6
6
  "exports": {
@@ -1,255 +0,0 @@
1
- "use client";
2
- import {
3
- useSelect
4
- } from "./chunk-S3QS5B7F.mjs";
5
- import {
6
- option_default
7
- } from "./chunk-OF3X4BXG.mjs";
8
- import {
9
- Icon_default
10
- } from "./chunk-HWL7TPUN.mjs";
11
- import {
12
- tv
13
- } from "./chunk-4ZJFD3L3.mjs";
14
- import {
15
- mapPropsVariants
16
- } from "./chunk-E3G5QXSH.mjs";
17
-
18
- // src/components/select/select.tsx
19
- import { forwardRef, useMemo, useCallback } from "react";
20
- import { createPortal } from "react-dom";
21
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
22
- var Select = forwardRef((originalProps, ref) => {
23
- const [props, variantProps] = mapPropsVariants(originalProps, select.variantKeys);
24
- const { classNames, options, defaultOption, onChange, ...inputProps } = props;
25
- const slots = useMemo(() => select({ ...variantProps }), [variantProps]);
26
- const {
27
- targetRect,
28
- selectedOption,
29
- optionWrapperHeight,
30
- selectWrapperRef,
31
- optionWrapperRef,
32
- handleToggleSelect,
33
- handleChangeOption,
34
- calculatePositionWithScroll
35
- } = useSelect({
36
- options,
37
- defaultOption,
38
- onChange
39
- });
40
- const position = targetRect ? calculatePositionWithScroll(targetRect, optionWrapperHeight) : null;
41
- const getBaseProps = useCallback(
42
- () => ({
43
- className: slots.base({ class: classNames == null ? void 0 : classNames.base })
44
- }),
45
- [slots, classNames]
46
- );
47
- const getLabelProps = useCallback(
48
- () => ({
49
- className: slots.label({ class: classNames == null ? void 0 : classNames.label })
50
- }),
51
- [slots, classNames]
52
- );
53
- const getSelectWrapperProps = useCallback(
54
- () => ({
55
- className: slots.selectWrapper({ class: classNames == null ? void 0 : classNames.selectWrapper }),
56
- ref: selectWrapperRef,
57
- onClick: handleToggleSelect
58
- }),
59
- [slots, classNames]
60
- );
61
- const getSelectProps = useCallback(
62
- () => ({
63
- ...inputProps,
64
- ref,
65
- className: slots.select({ class: classNames == null ? void 0 : classNames.select }),
66
- value: (selectedOption == null ? void 0 : selectedOption.value) || "",
67
- readOnly: true,
68
- size: 0
69
- }),
70
- [slots, classNames, inputProps, selectedOption, ref]
71
- );
72
- const getOptionsWrapperProps = useCallback(
73
- () => ({
74
- className: slots.optionsWrapper({ class: classNames == null ? void 0 : classNames.optionsWrapper }),
75
- ref: optionWrapperRef
76
- }),
77
- [slots, classNames]
78
- );
79
- const getErrorMessageProps = useCallback(
80
- () => ({
81
- className: slots.errorMessage({ class: classNames == null ? void 0 : classNames.errorMessage })
82
- }),
83
- [slots, classNames]
84
- );
85
- return /* @__PURE__ */ jsxs(Fragment, { children: [
86
- /* @__PURE__ */ jsxs("div", { ...getBaseProps(), children: [
87
- props.label && /* @__PURE__ */ jsx("label", { ...getLabelProps(), children: props.label }),
88
- /* @__PURE__ */ jsxs("div", { "data-expanded": !!targetRect, ...getSelectWrapperProps(), children: [
89
- /* @__PURE__ */ jsx("input", { ...getSelectProps() }),
90
- /* @__PURE__ */ jsx(Icon_default, { name: !!targetRect ? "arrow-triangle-up" : "arrow-triangle-down", size: originalProps.size, fill: true })
91
- ] }),
92
- props.errorMessage && /* @__PURE__ */ jsx("p", { ...getErrorMessageProps(), children: props.errorMessage })
93
- ] }),
94
- targetRect && /* @__PURE__ */ jsx(Fragment, { children: createPortal(
95
- /* @__PURE__ */ jsx(
96
- "div",
97
- {
98
- ...getOptionsWrapperProps(),
99
- style: {
100
- position: "absolute",
101
- top: position == null ? void 0 : position.top,
102
- left: position == null ? void 0 : position.left,
103
- width: targetRect.width
104
- },
105
- children: options.map((option) => /* @__PURE__ */ jsx(
106
- option_default,
107
- {
108
- variant: originalProps.variant,
109
- size: originalProps.size,
110
- color: originalProps.color,
111
- option,
112
- isSelected: (selectedOption == null ? void 0 : selectedOption.key) === option.key,
113
- onClick: () => handleChangeOption(option),
114
- children: option.value
115
- },
116
- option.key
117
- ))
118
- }
119
- ),
120
- document.body
121
- ) })
122
- ] });
123
- });
124
- Select.displayName = "Select";
125
- var select_default = Select;
126
- var select = tv({
127
- slots: {
128
- base: ["group/select", "flex flex-col"],
129
- label: ["flex", "items-center"],
130
- selectWrapper: [
131
- "flex",
132
- "items-center",
133
- "bg-transparent",
134
- "border-neutral-main",
135
- "transition duration-200",
136
- "group-has-[p]/select:border-danger-main",
137
- "group-has-[p]/select:text-danger-main",
138
- "group-has-[p]/select:bg-danger-soft"
139
- ],
140
- select: [
141
- "w-full",
142
- "bg-transparent",
143
- "text-foreground",
144
- "cursor-inherit",
145
- "cursor-pointer",
146
- "placeholder:text-neutral-main",
147
- "group-has-[p]/select:text-danger-main",
148
- "focus-visible:outline-none"
149
- ],
150
- optionsWrapper: ["w-[240px]", "border", "bg-background", "cursor-pointer", "overflow-y-auto"],
151
- errorMessage: ["text-danger-main"]
152
- },
153
- variants: {
154
- variant: {
155
- solid: {
156
- selectWrapper: "bg-trans-soft hover:bg-trans-light data-[expanded=true]:bg-trans-light group-has-[p]/select:bg-danger-soft"
157
- },
158
- normal: {
159
- selectWrapper: "border hover:bg-trans-soft data-[expanded=true]:bg-trans-soft"
160
- },
161
- line: {
162
- selectWrapper: "border-b !rounded-none hover:bg-trans-soft data-[expanded=true]:bg-trans-soft",
163
- optionsWrapper: "!rounded-none"
164
- }
165
- },
166
- color: {
167
- primary: {
168
- selectWrapper: "data-[expanded=true]:border-primary-main text-primary-main",
169
- optionsWrapper: "border-primary-main",
170
- select: "data-[expanded=true]:text-primary-main"
171
- },
172
- secondary: {
173
- selectWrapper: "data-[expanded=true]:border-secondary-main text-secondary-main",
174
- optionsWrapper: "border-secondary-main",
175
- select: "data-[expanded=true]:text-secondary-main"
176
- }
177
- },
178
- size: {
179
- sm: {
180
- base: "text-sm gap-[6px]",
181
- selectWrapper: "w-[240px] h-[24px] px-[6px] py-[4.5px] gap-[6px] rounded-sm",
182
- optionsWrapper: "max-h-[96px] rounded-sm",
183
- errorMessage: "text-sm"
184
- },
185
- md: {
186
- base: "text-md gap-[8px]",
187
- selectWrapper: "w-[240px] h-[30px] px-[8px] py-[6.5px] gap-[8px] rounded-md",
188
- optionsWrapper: "max-h-[120px] rounded-md",
189
- errorMessage: "text-md"
190
- },
191
- lg: {
192
- base: "text-lg gap-[10px]",
193
- selectWrapper: "w-[240px] h-[36px] px-[10px] py-[8px] gap-[10px] rounded-lg",
194
- optionsWrapper: "max-h-[144px] rounded-lg",
195
- errorMessage: "text-lg"
196
- },
197
- xl: {
198
- base: "text-lg gap-[10px]",
199
- selectWrapper: "w-[240px] h-[36px] px-[10px] py-[8px] gap-[10px] rounded-xl",
200
- optionsWrapper: "max-h-[144px] rounded-xl",
201
- errorMessage: "text-xl"
202
- }
203
- },
204
- radius: {
205
- default: "",
206
- none: {
207
- selectWrapper: "rounded-none",
208
- optionsWrapper: "rounded-none"
209
- },
210
- full: {
211
- selectWrapper: "rounded-full"
212
- }
213
- },
214
- fullWidth: {
215
- true: {
216
- selectWrapper: "w-full",
217
- optionsWrapper: "w-full"
218
- }
219
- },
220
- isDisabled: {
221
- true: {
222
- base: "cursor-default",
223
- selectWrapper: "bg-neutral-soft border-neutral-light text-neutral-light pointer-events-none",
224
- select: "text-neutral-light focus:text-neutral-light",
225
- label: "text-neutral-light"
226
- }
227
- },
228
- isRequired: {
229
- true: {
230
- label: "after:content-['*'] after:text-danger-main after:ml-0.5"
231
- }
232
- }
233
- },
234
- defaultVariants: {
235
- variant: "solid",
236
- color: "primary",
237
- size: "md",
238
- fullWidth: false,
239
- isDisabled: false,
240
- isRequired: false
241
- },
242
- compoundVariants: [
243
- {
244
- isDisabled: true,
245
- isRequired: true,
246
- class: {
247
- label: "after:text-danger-light"
248
- }
249
- }
250
- ]
251
- });
252
-
253
- export {
254
- select_default
255
- };
@@ -1,76 +0,0 @@
1
- "use client";
2
- import {
3
- Icon_default
4
- } from "./chunk-HWL7TPUN.mjs";
5
- import {
6
- tv
7
- } from "./chunk-4ZJFD3L3.mjs";
8
-
9
- // src/components/select/option.tsx
10
- import { jsx, jsxs } from "react/jsx-runtime";
11
- var Option = (props) => {
12
- const { base, option, icon } = optionStyle(props);
13
- return /* @__PURE__ */ jsxs(
14
- "div",
15
- {
16
- title: props.option.value,
17
- className: base(),
18
- onClick: () => props.onClick(props.option),
19
- ref: (node) => {
20
- props.isSelected && (node == null ? void 0 : node.scrollIntoView());
21
- },
22
- children: [
23
- /* @__PURE__ */ jsx("div", { className: option(), children: props.children }),
24
- props.isSelected && /* @__PURE__ */ jsx("div", { className: icon(), children: /* @__PURE__ */ jsx(Icon_default, { name: "check", size: props.size }) })
25
- ]
26
- }
27
- );
28
- };
29
- var option_default = Option;
30
- var optionStyle = tv({
31
- slots: {
32
- base: ["w-full", "flex", "items-center", "justify-between", , "overflow-hidden"],
33
- option: ["text-ellipsis overflow-hidden "],
34
- icon: ""
35
- },
36
- variants: {
37
- variant: {
38
- solid: {},
39
- normal: {},
40
- line: {}
41
- },
42
- color: {
43
- primary: {
44
- base: ["border-primary-main", "hover:bg-primary-soft", "hover:text-primary-main"],
45
- icon: "text-primary-main"
46
- },
47
- secondary: {
48
- base: ["border-secondary-main", "hover:bg-secondary-soft", "hover:text-secondary-main"],
49
- icon: "text-secondary-main"
50
- }
51
- },
52
- size: {
53
- sm: {
54
- base: "text-sm px-[6px] py-[4.5px]"
55
- },
56
- md: {
57
- base: "text-md px-[8px] py-[6.5px]"
58
- },
59
- lg: {
60
- base: "text-lg px-[10px] py-[8px]"
61
- },
62
- xl: {
63
- base: "text-xl px-[10px] py-[8px]"
64
- }
65
- }
66
- },
67
- defaultVariants: {
68
- variant: "normal",
69
- color: "primary",
70
- size: "md"
71
- }
72
- });
73
-
74
- export {
75
- option_default
76
- };
@@ -1,61 +0,0 @@
1
- "use client";
2
-
3
- // src/components/select/useSelect.tsx
4
- import { useState, useEffect, useRef } from "react";
5
- var useSelect = ({ options, defaultOption, onChange }) => {
6
- const [selectedOption, setSelectedOption] = useState(defaultOption);
7
- const [targetRect, setTargetRect] = useState(null);
8
- const [optionWrapperHeight, setOptionWrapperHeight] = useState(0);
9
- const selectWrapperRef = useRef(null);
10
- const optionWrapperRef = useRef(null);
11
- const calculatePositionWithScroll = (targetRect2, optionWrapperHeight2) => {
12
- const scrollTop = window.scrollY || document.documentElement.scrollTop || document.body.scrollTop;
13
- const scrollLeft = window.scrollX || document.documentElement.scrollLeft || document.body.scrollLeft;
14
- const spaceBelow = window.innerHeight - (targetRect2.y + targetRect2.height + 4);
15
- const spaceAbove = targetRect2.y - 4;
16
- const top = spaceBelow < optionWrapperHeight2 && spaceAbove > optionWrapperHeight2 ? targetRect2.y - optionWrapperHeight2 - 4 : targetRect2.y + targetRect2.height + 4;
17
- return {
18
- top: top + scrollTop,
19
- left: targetRect2.x + scrollLeft
20
- };
21
- };
22
- const handleToggleSelect = () => {
23
- if (selectWrapperRef.current) {
24
- const rect = selectWrapperRef.current.getBoundingClientRect();
25
- setTargetRect((prevRect) => prevRect ? null : { x: rect.x, y: rect.y, width: rect.width, height: rect.height });
26
- }
27
- };
28
- const handleChangeOption = (option) => {
29
- onChange == null ? void 0 : onChange(option);
30
- setSelectedOption(option);
31
- handleToggleSelect();
32
- };
33
- useEffect(() => {
34
- const onClickOutside = (e) => {
35
- if (optionWrapperRef.current && !optionWrapperRef.current.contains(e.target)) {
36
- setTargetRect(null);
37
- }
38
- };
39
- window.addEventListener("mousedown", onClickOutside);
40
- return () => window.removeEventListener("mousedown", onClickOutside);
41
- }, []);
42
- useEffect(() => {
43
- if (optionWrapperRef.current) {
44
- setOptionWrapperHeight(optionWrapperRef.current.getBoundingClientRect().height);
45
- }
46
- }, [targetRect]);
47
- return {
48
- selectedOption,
49
- targetRect,
50
- optionWrapperHeight,
51
- selectWrapperRef,
52
- optionWrapperRef,
53
- handleToggleSelect,
54
- handleChangeOption,
55
- calculatePositionWithScroll
56
- };
57
- };
58
-
59
- export {
60
- useSelect
61
- };
@@ -1,17 +0,0 @@
1
- import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { ComponentProps } from 'react';
3
- import { SelectOption } from './select.mjs';
4
- import { Size } from '../../utils/types.mjs';
5
- import 'tailwind-variants';
6
-
7
- interface OptionProps extends Omit<ComponentProps<"div">, "onClick"> {
8
- variant?: "solid" | "normal" | "line";
9
- color?: "primary" | "secondary";
10
- size?: Size;
11
- option: SelectOption;
12
- isSelected?: boolean;
13
- onClick: (option: SelectOption) => void;
14
- }
15
- declare const Option: (props: OptionProps) => react_jsx_runtime.JSX.Element;
16
-
17
- export { type OptionProps, Option as default };
@@ -1,17 +0,0 @@
1
- import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { ComponentProps } from 'react';
3
- import { SelectOption } from './select.js';
4
- import { Size } from '../../utils/types.js';
5
- import 'tailwind-variants';
6
-
7
- interface OptionProps extends Omit<ComponentProps<"div">, "onClick"> {
8
- variant?: "solid" | "normal" | "line";
9
- color?: "primary" | "secondary";
10
- size?: Size;
11
- option: SelectOption;
12
- isSelected?: boolean;
13
- onClick: (option: SelectOption) => void;
14
- }
15
- declare const Option: (props: OptionProps) => react_jsx_runtime.JSX.Element;
16
-
17
- export { type OptionProps, Option as default };