@deepnoid/ui 0.1.30 → 0.1.32

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 (46) hide show
  1. package/.turbo/turbo-build.log +135 -135
  2. package/dist/chunk-62X5AX5B.mjs +297 -0
  3. package/dist/{chunk-VCVQMPC7.mjs → chunk-AIIMJZ7L.mjs} +69 -39
  4. package/dist/{chunk-NKH3OF6I.mjs → chunk-BCMVEGJG.mjs} +1 -1
  5. package/dist/{chunk-QM4ZSQYX.mjs → chunk-CVQM3T2X.mjs} +1 -1
  6. package/dist/{chunk-272FMLIL.mjs → chunk-IEJRE6LT.mjs} +7 -4
  7. package/dist/{chunk-CEZQCD6Z.mjs → chunk-LWRK5TPZ.mjs} +12 -11
  8. package/dist/{chunk-GLMM253Q.mjs → chunk-P67LLF3G.mjs} +5 -5
  9. package/dist/components/fileUpload/fileUpload.js +62 -39
  10. package/dist/components/fileUpload/fileUpload.mjs +2 -2
  11. package/dist/components/fileUpload/index.js +62 -39
  12. package/dist/components/fileUpload/index.mjs +2 -2
  13. package/dist/components/input/index.js +62 -39
  14. package/dist/components/input/index.mjs +1 -1
  15. package/dist/components/input/input.d.mts +21 -14
  16. package/dist/components/input/input.d.ts +21 -14
  17. package/dist/components/input/input.js +62 -39
  18. package/dist/components/input/input.mjs +1 -1
  19. package/dist/components/pagination/index.js +62 -39
  20. package/dist/components/pagination/index.mjs +2 -2
  21. package/dist/components/pagination/pagination.js +62 -39
  22. package/dist/components/pagination/pagination.mjs +2 -2
  23. package/dist/components/select/index.js +7 -4
  24. package/dist/components/select/index.mjs +1 -1
  25. package/dist/components/select/select.d.mts +9 -0
  26. package/dist/components/select/select.d.ts +9 -0
  27. package/dist/components/select/select.js +7 -4
  28. package/dist/components/select/select.mjs +1 -1
  29. package/dist/components/table/index.js +77 -53
  30. package/dist/components/table/index.mjs +4 -4
  31. package/dist/components/table/table-body.js +12 -11
  32. package/dist/components/table/table-body.mjs +1 -1
  33. package/dist/components/table/table.d.mts +2 -1
  34. package/dist/components/table/table.d.ts +2 -1
  35. package/dist/components/table/table.js +77 -53
  36. package/dist/components/table/table.mjs +4 -4
  37. package/dist/components/textarea/index.js +255 -138
  38. package/dist/components/textarea/index.mjs +2 -1
  39. package/dist/components/textarea/textarea.d.mts +157 -150
  40. package/dist/components/textarea/textarea.d.ts +157 -150
  41. package/dist/components/textarea/textarea.js +255 -138
  42. package/dist/components/textarea/textarea.mjs +2 -1
  43. package/dist/index.js +299 -195
  44. package/dist/index.mjs +7 -7
  45. package/package.json +1 -1
  46. package/dist/chunk-BKE6QF6W.mjs +0 -209
@@ -47,201 +47,318 @@ var mapPropsVariants = (props, variantKeys, removeVariantProps = true) => {
47
47
  }
48
48
  };
49
49
 
50
+ // src/utils/clsx.ts
51
+ function clsx(...args) {
52
+ var i = 0, tmp, x, str = "";
53
+ while (i < args.length) {
54
+ if (tmp = args[i++]) {
55
+ if (x = toVal(tmp)) {
56
+ str && (str += " ");
57
+ str += x;
58
+ }
59
+ }
60
+ }
61
+ return str;
62
+ }
63
+ function toVal(mix) {
64
+ var k, y, str = "";
65
+ if (typeof mix === "string" || typeof mix === "number") {
66
+ str += mix;
67
+ } else if (typeof mix === "object") {
68
+ if (Array.isArray(mix)) {
69
+ var len = mix.length;
70
+ for (k = 0; k < len; k++) {
71
+ if (mix[k]) {
72
+ if (y = toVal(mix[k])) {
73
+ str && (str += " ");
74
+ str += y;
75
+ }
76
+ }
77
+ }
78
+ } else {
79
+ for (y in mix) {
80
+ if (mix[y]) {
81
+ str && (str += " ");
82
+ str += y;
83
+ }
84
+ }
85
+ }
86
+ }
87
+ return str;
88
+ }
89
+
50
90
  // src/components/textarea/textarea.tsx
51
91
  var import_jsx_runtime = require("react/jsx-runtime");
52
92
  var Textarea = (0, import_react.forwardRef)((originalProps, ref) => {
93
+ var _a, _b;
53
94
  const [props, variantProps] = mapPropsVariants(originalProps, textareaStyle.variantKeys);
54
- const { classNames, label, errorMessage, ...textareaProps } = props;
55
- const slots = (0, import_react.useMemo)(() => textareaStyle({ ...variantProps }), [variantProps]);
56
- const getBaseProps = (0, import_react.useCallback)(
57
- () => ({
58
- className: slots.base({ class: classNames == null ? void 0 : classNames.base })
59
- }),
60
- [slots, classNames]
61
- );
62
- const getLabelProps = (0, import_react.useCallback)(
63
- () => ({
64
- className: slots.label({ class: classNames == null ? void 0 : classNames.label })
65
- }),
66
- [slots, classNames]
67
- );
68
- const getInnerWrapperProps = (0, import_react.useCallback)(
69
- () => ({
70
- className: slots.innerWrapper({ class: classNames == null ? void 0 : classNames.innerWrapper })
71
- }),
72
- [slots, classNames]
73
- );
74
- const getTextareaWrapperProps = (0, import_react.useCallback)(
75
- () => ({
76
- className: slots.textareaWrapper({ class: classNames == null ? void 0 : classNames.textareaWrapper })
77
- }),
78
- [slots, classNames]
79
- );
80
- const getTextareaProps = (0, import_react.useCallback)(
81
- () => ({
82
- ...textareaProps,
83
- ref,
84
- className: slots.textarea({ class: classNames == null ? void 0 : classNames.textarea }),
85
- disabled: originalProps.isDisabled,
86
- required: originalProps.isRequired,
87
- size: 0
88
- }),
89
- [textareaProps, ref, slots, classNames == null ? void 0 : classNames.textarea, originalProps.isDisabled, originalProps.isRequired]
95
+ const { classNames, label, helperMessage, errorMessage, ...textareaProps } = props;
96
+ const [length, setLength] = (0, import_react.useState)(((_b = (_a = originalProps.value) == null ? void 0 : _a.toString()) != null ? _b : "").length);
97
+ const innerRef = (0, import_react.useRef)(null);
98
+ (0, import_react.useImperativeHandle)(ref, () => innerRef.current);
99
+ const autoResize = (0, import_react.useCallback)(() => {
100
+ const el = innerRef.current;
101
+ if (el) {
102
+ el.style.height = "auto";
103
+ el.style.height = el.scrollHeight + "px";
104
+ }
105
+ }, []);
106
+ const handleChange = (0, import_react.useCallback)(
107
+ (e) => {
108
+ var _a2;
109
+ setLength(e.target.value.length);
110
+ (_a2 = originalProps.onChange) == null ? void 0 : _a2.call(originalProps, e);
111
+ autoResize();
112
+ },
113
+ [originalProps, autoResize]
90
114
  );
91
- const getErrorMessageProps = (0, import_react.useCallback)(
92
- () => ({
93
- className: slots.errorMessage({ class: classNames == null ? void 0 : classNames.errorMessage })
94
- }),
95
- [slots, classNames]
115
+ (0, import_react.useEffect)(() => {
116
+ autoResize();
117
+ }, [originalProps.value, autoResize]);
118
+ const slots = (0, import_react.useMemo)(() => textareaStyle({ ...variantProps }), [variantProps]);
119
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
120
+ "div",
121
+ {
122
+ className: clsx(
123
+ slots.base({ class: classNames == null ? void 0 : classNames.base }),
124
+ variantProps.direction === "horizon" ? slots.horizon({ class: classNames == null ? void 0 : classNames.horizon }) : slots.vertical({ class: classNames == null ? void 0 : classNames.vertical })
125
+ ),
126
+ children: [
127
+ label && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", { className: slots.label({ class: classNames == null ? void 0 : classNames.label }), children: label }),
128
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
129
+ "div",
130
+ {
131
+ className: clsx(
132
+ slots.wrapper({ class: classNames == null ? void 0 : classNames.wrapper }),
133
+ textareaProps.readOnly ? slots.readonlyWrapper({ class: classNames == null ? void 0 : classNames.readonlyWrapper }) : ""
134
+ ),
135
+ children: [
136
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
137
+ "textarea",
138
+ {
139
+ ref: innerRef,
140
+ ...textareaProps,
141
+ readOnly: props.readOnly,
142
+ onChange: handleChange,
143
+ className: slots.textarea({ class: classNames == null ? void 0 : classNames.textarea })
144
+ }
145
+ ),
146
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex justify-between", children: [
147
+ helperMessage && !errorMessage && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
148
+ "p",
149
+ {
150
+ className: clsx(
151
+ slots.helperMessage({ class: classNames == null ? void 0 : classNames.helperMessage }),
152
+ textareaProps.readOnly ? slots.readonly({ class: classNames == null ? void 0 : classNames.readonly }) : ""
153
+ ),
154
+ children: helperMessage
155
+ }
156
+ ),
157
+ errorMessage && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: clsx("error", slots.errorMessage({ class: classNames == null ? void 0 : classNames.errorMessage })), children: errorMessage }),
158
+ textareaProps.maxLength !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
159
+ "p",
160
+ {
161
+ className: clsx(
162
+ slots.helperMessage({ class: classNames == null ? void 0 : classNames.helperMessage }),
163
+ textareaProps.readOnly ? slots.readonly({ class: classNames == null ? void 0 : classNames.readonly }) : ""
164
+ ),
165
+ children: [
166
+ length,
167
+ " / ",
168
+ textareaProps.maxLength
169
+ ]
170
+ }
171
+ )
172
+ ] })
173
+ ]
174
+ }
175
+ )
176
+ ]
177
+ }
96
178
  );
97
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { ...getBaseProps(), children: [
98
- props.label && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", { ...getLabelProps(), children: props.label }),
99
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { ...getInnerWrapperProps(), children: [
100
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { ...getTextareaWrapperProps(), children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("textarea", { ...getTextareaProps() }) }),
101
- props.errorMessage && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { ...getErrorMessageProps(), children: props.errorMessage })
102
- ] })
103
- ] });
104
179
  });
105
180
  Textarea.displayName = "Textarea";
106
181
  var textarea_default = Textarea;
107
182
  var textareaStyle = (0, import_tailwind_variants.tv)({
108
183
  slots: {
109
- base: ["group/textarea", "flex", "flex-col", "gap-[10px]", "select-none"],
110
- label: ["flex", "items-center"],
111
- innerWrapper: ["flex", "flex-col", "gap-[6px]"],
112
- textareaWrapper: [
113
- "flex",
114
- "bg-transparent",
115
- "border-neutral-main",
116
- "group-has-[p]/textarea:border-danger-main",
117
- "group-has-[p]/textarea:bg-danger-soft",
118
- "transition duration-200"
119
- ],
184
+ base: ["group/textarea", "flex", "select-none"],
185
+ vertical: ["flex-col"],
186
+ horizon: ["flex-row", "gap-0"],
187
+ label: ["flex", "items-center", "font-bold", "text-body-foreground", "min-w-[80px]"],
188
+ wrapper: ["flex", "flex-col"],
120
189
  textarea: [
121
190
  "w-full",
191
+ "h-full",
122
192
  "bg-transparent",
123
- "placeholder:text-neutral-main",
124
- "focus-visible:outline-none",
125
- "resize-none"
193
+ "text-neutral-main",
194
+ "placeholder:!text-neutral-main",
195
+ "outline-none",
196
+ "resize-none",
197
+ "focus:ring-0",
198
+ "group-has-[:hover]/textarea:!text-neutral-dark",
199
+ "group-has-[:hover]/textarea:placeholder:!text-neutral-dark",
200
+ "group-has-[:focus]/textarea:!text-neutral-dark",
201
+ "group-has-[:focus]/textarea:placeholder:!text-neutral-dark",
202
+ "group-has-[p.error]/textarea:bg-danger-soft",
203
+ "group-has-[p.error]/textarea:text-danger-main",
204
+ "group-has-[p.error]/textarea:placeholder:!text-danger-main"
205
+ ],
206
+ helperMessage: [
207
+ "text-neutral-main",
208
+ "group-has-[:hover]/textarea:text-neutral-dark",
209
+ "group-has-[p.error]/textarea:text-danger-main"
210
+ ],
211
+ errorMessage: ["text-danger-main"],
212
+ readonlyWrapper: [
213
+ "pointer-events-none",
214
+ "[&>textarea]:!text-body-foreground",
215
+ "[&>textarea]:placeholder:!text-body-foreground"
126
216
  ],
127
- errorMessage: ["text-danger-main"]
217
+ readonly: []
128
218
  },
129
219
  variants: {
130
220
  variant: {
131
221
  solid: {
132
- textareaWrapper: ["bg-trans-soft", "hover:bg-trans-light", "has-[:focus]:bg-trans-light"]
222
+ textarea: ["border-transparent", "bg-trans-soft"],
223
+ readonlyWrapper: ["[&>textarea]:!bg-trans-light"]
133
224
  },
134
- line: {
135
- textareaWrapper: ["border", "hover:bg-trans-soft", "has-[:focus]:bg-trans-soft"]
225
+ outline: {
226
+ textarea: [
227
+ "border-neutral-light",
228
+ "group-has-[:hover]/textarea:bg-trans-soft",
229
+ "group-has-[:focus]/textarea:bg-body-background",
230
+ "group-has-[p.error]/textarea:border-danger-main"
231
+ ],
232
+ readonlyWrapper: ["[&>textarea]:!bg-trans-soft"]
136
233
  }
137
234
  },
138
235
  color: {
139
- primary: {},
140
- secondary: {}
236
+ primary: {
237
+ helperMessage: [
238
+ "group-has-[:focus]/textarea:!text-primary-main",
239
+ "group-has-[:focus]/textarea:!text-primary-main",
240
+ "group-has-[:focus]/textarea:hover:!text-primary-main",
241
+ "group-has-[:focus:hover]/textarea:!text-primary-main",
242
+ "group-has-[p.error]:not(textarea:focus):hover/textarea:!text-primary-main"
243
+ ],
244
+ readonly: ["!text-primary-main"]
245
+ },
246
+ secondary: {
247
+ helperMessage: [
248
+ "group-has-[:focus]/textarea:text-secondary-main",
249
+ "group-has-[:focus]/textarea:text-secondary-main",
250
+ "group-has-[:focus]/textarea:hover:text-secondary-main",
251
+ "group-has-[:focus:hover]/textarea:text-secondary-main",
252
+ "group-has-[p.error]:not(textarea:focus):hover/textarea:!text-secondary-main"
253
+ ],
254
+ readonly: ["!text-secondary-main"]
255
+ }
141
256
  },
142
257
  size: {
143
258
  sm: {
144
- base: "gap-[6px]",
145
- textareaWrapper: "w-[240px] rounded-sm p-[6px]",
146
- textarea: "text-sm rounded-sm",
147
- label: "text-sm",
148
- errorMessage: "text-sm"
259
+ base: ["text-sm", "gap-[4px]"],
260
+ label: ["text-sm"],
261
+ wrapper: ["gap-[4px]"],
262
+ textarea: ["w-[240px]", "h-[24px]", "rounded-sm", "p-[8px]", "gap-[4px]"],
263
+ helperMessage: ["text-sm"],
264
+ errorMessage: ["text-sm"]
149
265
  },
150
266
  md: {
151
- base: "gap-[8px]",
152
- textareaWrapper: "w-[240px] rounded-md p-[8px]",
153
- textarea: "text-md rounded-md",
154
- label: "text-md",
155
- errorMessage: "text-md"
267
+ base: ["text-md", "gap-[6px]"],
268
+ label: ["text-md"],
269
+ wrapper: ["gap-[6px]"],
270
+ textarea: ["w-[240px]", "h-[32px]", "rounded-md", "p-[8px]", "gap-[6px]"],
271
+ helperMessage: ["text-sm"],
272
+ errorMessage: ["text-sm"]
156
273
  },
157
274
  lg: {
158
- base: "gap-[10px]",
159
- textareaWrapper: "w-[240px] rounded-lg p-[10px]",
160
- textarea: "text-lg rounded-lg",
161
- label: "text-lg",
162
- errorMessage: "text-lg"
275
+ base: ["text-lg", "gap-[8px]"],
276
+ label: ["text-lg"],
277
+ wrapper: ["gap-[8px]"],
278
+ textarea: ["w-[240px]", "h-[40px]", "rounded-lg", "p-[10px]", "gap-[8px]"],
279
+ helperMessage: ["text-md"],
280
+ errorMessage: ["text-md"]
163
281
  },
164
282
  xl: {
165
- base: "gap-[10px]",
166
- textareaWrapper: "w-[240px] rounded-xl p-[10px]",
167
- textarea: "text-xl rounded-xl",
168
- label: "text-xl",
169
- errorMessage: "text-xl"
170
- }
171
- },
172
- radius: {
173
- default: {},
174
- none: {
175
- textareaWrapper: "rounded-none",
176
- textarea: "rounded-none"
177
- },
178
- full: {
179
- textareaWrapper: "rounded-full",
180
- textarea: "rounded-full"
283
+ base: ["text-xl", "gap-[10px]"],
284
+ label: ["text-xl"],
285
+ wrapper: ["gap-[10px]"],
286
+ textarea: ["w-[240px]", "h-[50px]", "rounded-lg", "p-[10px]", "gap-[10px]"],
287
+ helperMessage: ["text-md"],
288
+ errorMessage: ["text-md"]
181
289
  }
182
290
  },
183
- fullWidth: {
184
- true: {
185
- base: "w-full",
186
- textareaWrapper: "w-full",
187
- textarea: "w-full"
188
- }
291
+ direction: {
292
+ vertical: "",
293
+ horizon: ""
189
294
  },
190
- isDisabled: {
295
+ full: {
191
296
  true: {
192
- base: ["opacity-disabled", "pointer-events-none"],
193
- textareaWrapper: ["bg-neutral-soft", "border-neutral-light", "pointer-events-none"],
194
- textarea: ["text-neutral-light placeholder:text-neutral-light", "border-neutral-light"],
195
- label: ["text-neutral-light", "pointer-events-none"],
196
- errorMessage: "text-danger-light"
297
+ base: ["w-full"],
298
+ wrapper: ["flex-1"],
299
+ textarea: ["w-full"]
197
300
  }
198
301
  },
199
- isRequired: {
302
+ disabled: {
200
303
  true: {
201
- label: ["after:content-['*']", "after:text-danger-main", "after:ml-0.5"]
304
+ textarea: [
305
+ "bg-neutral-soft",
306
+ "pointer-events-none",
307
+ "text-neutral-light",
308
+ "placeholder:!text-neutral-light",
309
+ "group-has-[p.error]/textarea:text-danger-light",
310
+ "group-has-[p.error]/textarea:border-danger-light",
311
+ "group-has-[p.error]/textarea:placeholder:!text-danger-light"
312
+ ],
313
+ helperMessage: ["!text-neutral-light", "group-has-[p.error]/textarea:!text-danger-light"],
314
+ errorMessage: ["!text-danger-light"]
202
315
  }
203
316
  }
204
317
  },
205
- defaultVariants: {
206
- variant: "solid",
207
- color: "primary",
208
- size: "md",
209
- fullWidth: false,
210
- isDisabled: false,
211
- isRequired: false
212
- },
213
318
  compoundVariants: [
214
- // variants & color
215
319
  {
216
- variant: "line",
217
- color: "primary",
320
+ variant: "outline",
321
+ size: "sm",
322
+ class: {
323
+ textarea: ["border-sm"]
324
+ }
325
+ },
326
+ {
327
+ variant: "outline",
328
+ size: "md",
218
329
  class: {
219
- textareaWrapper: "has-[:focus]:border-primary-main"
330
+ textarea: ["border-md"]
220
331
  }
221
332
  },
222
333
  {
223
- variant: "line",
224
- color: "secondary",
334
+ variant: "outline",
335
+ size: "lg",
225
336
  class: {
226
- textareaWrapper: "has-[:focus]:border-secondary-main",
227
- textarea: "focus:bg-secondary-main"
337
+ textarea: ["border-lg"]
228
338
  }
229
339
  },
230
- // Variants & isDisabled
231
340
  {
232
- variant: "line",
233
- isDisabled: true,
341
+ variant: "outline",
342
+ size: "xl",
234
343
  class: {
235
- textareaWrapper: "bg-neutral-soft"
344
+ textarea: ["border-xl"]
236
345
  }
237
346
  },
238
- // isRequired & isDisabled
239
347
  {
240
- isRequired: true,
241
- isDisabled: true,
348
+ disabled: true,
349
+ variant: ["outline"],
242
350
  class: {
243
- label: "after:text-danger-light"
351
+ textarea: ["!bg-body-background", "group-has-[p.error]/input:border-danger-light"]
244
352
  }
245
353
  }
246
- ]
354
+ ],
355
+ defaultVariants: {
356
+ variant: "solid",
357
+ color: "primary",
358
+ size: "md",
359
+ direction: "vertical",
360
+ fullWidth: false,
361
+ disabled: false,
362
+ readonly: false
363
+ }
247
364
  });
@@ -1,7 +1,8 @@
1
1
  "use client";
2
2
  import {
3
3
  textarea_default
4
- } from "../../chunk-BKE6QF6W.mjs";
4
+ } from "../../chunk-62X5AX5B.mjs";
5
+ import "../../chunk-27Y6K5NK.mjs";
5
6
  import "../../chunk-E3G5QXSH.mjs";
6
7
  import "../../chunk-AC6TWLRT.mjs";
7
8
  export {