@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.
- package/.turbo/turbo-build.log +135 -135
- package/dist/chunk-62X5AX5B.mjs +297 -0
- package/dist/{chunk-VCVQMPC7.mjs → chunk-AIIMJZ7L.mjs} +69 -39
- package/dist/{chunk-NKH3OF6I.mjs → chunk-BCMVEGJG.mjs} +1 -1
- package/dist/{chunk-QM4ZSQYX.mjs → chunk-CVQM3T2X.mjs} +1 -1
- package/dist/{chunk-272FMLIL.mjs → chunk-IEJRE6LT.mjs} +7 -4
- package/dist/{chunk-CEZQCD6Z.mjs → chunk-LWRK5TPZ.mjs} +12 -11
- package/dist/{chunk-GLMM253Q.mjs → chunk-P67LLF3G.mjs} +5 -5
- package/dist/components/fileUpload/fileUpload.js +62 -39
- package/dist/components/fileUpload/fileUpload.mjs +2 -2
- package/dist/components/fileUpload/index.js +62 -39
- package/dist/components/fileUpload/index.mjs +2 -2
- package/dist/components/input/index.js +62 -39
- package/dist/components/input/index.mjs +1 -1
- package/dist/components/input/input.d.mts +21 -14
- package/dist/components/input/input.d.ts +21 -14
- package/dist/components/input/input.js +62 -39
- package/dist/components/input/input.mjs +1 -1
- package/dist/components/pagination/index.js +62 -39
- package/dist/components/pagination/index.mjs +2 -2
- package/dist/components/pagination/pagination.js +62 -39
- package/dist/components/pagination/pagination.mjs +2 -2
- package/dist/components/select/index.js +7 -4
- package/dist/components/select/index.mjs +1 -1
- package/dist/components/select/select.d.mts +9 -0
- package/dist/components/select/select.d.ts +9 -0
- package/dist/components/select/select.js +7 -4
- package/dist/components/select/select.mjs +1 -1
- package/dist/components/table/index.js +77 -53
- package/dist/components/table/index.mjs +4 -4
- package/dist/components/table/table-body.js +12 -11
- package/dist/components/table/table-body.mjs +1 -1
- package/dist/components/table/table.d.mts +2 -1
- package/dist/components/table/table.d.ts +2 -1
- package/dist/components/table/table.js +77 -53
- package/dist/components/table/table.mjs +4 -4
- package/dist/components/textarea/index.js +255 -138
- package/dist/components/textarea/index.mjs +2 -1
- package/dist/components/textarea/textarea.d.mts +157 -150
- package/dist/components/textarea/textarea.d.ts +157 -150
- package/dist/components/textarea/textarea.js +255 -138
- package/dist/components/textarea/textarea.mjs +2 -1
- package/dist/index.js +299 -195
- package/dist/index.mjs +7 -7
- package/package.json +1 -1
- package/dist/chunk-BKE6QF6W.mjs +0 -209
|
@@ -0,0 +1,297 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
clsx
|
|
4
|
+
} from "./chunk-27Y6K5NK.mjs";
|
|
5
|
+
import {
|
|
6
|
+
mapPropsVariants
|
|
7
|
+
} from "./chunk-E3G5QXSH.mjs";
|
|
8
|
+
|
|
9
|
+
// src/components/textarea/textarea.tsx
|
|
10
|
+
import {
|
|
11
|
+
forwardRef,
|
|
12
|
+
useCallback,
|
|
13
|
+
useEffect,
|
|
14
|
+
useImperativeHandle,
|
|
15
|
+
useMemo,
|
|
16
|
+
useRef,
|
|
17
|
+
useState
|
|
18
|
+
} from "react";
|
|
19
|
+
import { tv } from "tailwind-variants";
|
|
20
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
21
|
+
var Textarea = forwardRef((originalProps, ref) => {
|
|
22
|
+
var _a, _b;
|
|
23
|
+
const [props, variantProps] = mapPropsVariants(originalProps, textareaStyle.variantKeys);
|
|
24
|
+
const { classNames, label, helperMessage, errorMessage, ...textareaProps } = props;
|
|
25
|
+
const [length, setLength] = useState(((_b = (_a = originalProps.value) == null ? void 0 : _a.toString()) != null ? _b : "").length);
|
|
26
|
+
const innerRef = useRef(null);
|
|
27
|
+
useImperativeHandle(ref, () => innerRef.current);
|
|
28
|
+
const autoResize = useCallback(() => {
|
|
29
|
+
const el = innerRef.current;
|
|
30
|
+
if (el) {
|
|
31
|
+
el.style.height = "auto";
|
|
32
|
+
el.style.height = el.scrollHeight + "px";
|
|
33
|
+
}
|
|
34
|
+
}, []);
|
|
35
|
+
const handleChange = useCallback(
|
|
36
|
+
(e) => {
|
|
37
|
+
var _a2;
|
|
38
|
+
setLength(e.target.value.length);
|
|
39
|
+
(_a2 = originalProps.onChange) == null ? void 0 : _a2.call(originalProps, e);
|
|
40
|
+
autoResize();
|
|
41
|
+
},
|
|
42
|
+
[originalProps, autoResize]
|
|
43
|
+
);
|
|
44
|
+
useEffect(() => {
|
|
45
|
+
autoResize();
|
|
46
|
+
}, [originalProps.value, autoResize]);
|
|
47
|
+
const slots = useMemo(() => textareaStyle({ ...variantProps }), [variantProps]);
|
|
48
|
+
return /* @__PURE__ */ jsxs(
|
|
49
|
+
"div",
|
|
50
|
+
{
|
|
51
|
+
className: clsx(
|
|
52
|
+
slots.base({ class: classNames == null ? void 0 : classNames.base }),
|
|
53
|
+
variantProps.direction === "horizon" ? slots.horizon({ class: classNames == null ? void 0 : classNames.horizon }) : slots.vertical({ class: classNames == null ? void 0 : classNames.vertical })
|
|
54
|
+
),
|
|
55
|
+
children: [
|
|
56
|
+
label && /* @__PURE__ */ jsx("label", { className: slots.label({ class: classNames == null ? void 0 : classNames.label }), children: label }),
|
|
57
|
+
/* @__PURE__ */ jsxs(
|
|
58
|
+
"div",
|
|
59
|
+
{
|
|
60
|
+
className: clsx(
|
|
61
|
+
slots.wrapper({ class: classNames == null ? void 0 : classNames.wrapper }),
|
|
62
|
+
textareaProps.readOnly ? slots.readonlyWrapper({ class: classNames == null ? void 0 : classNames.readonlyWrapper }) : ""
|
|
63
|
+
),
|
|
64
|
+
children: [
|
|
65
|
+
/* @__PURE__ */ jsx(
|
|
66
|
+
"textarea",
|
|
67
|
+
{
|
|
68
|
+
ref: innerRef,
|
|
69
|
+
...textareaProps,
|
|
70
|
+
readOnly: props.readOnly,
|
|
71
|
+
onChange: handleChange,
|
|
72
|
+
className: slots.textarea({ class: classNames == null ? void 0 : classNames.textarea })
|
|
73
|
+
}
|
|
74
|
+
),
|
|
75
|
+
/* @__PURE__ */ jsxs("div", { className: "flex justify-between", children: [
|
|
76
|
+
helperMessage && !errorMessage && /* @__PURE__ */ jsx(
|
|
77
|
+
"p",
|
|
78
|
+
{
|
|
79
|
+
className: clsx(
|
|
80
|
+
slots.helperMessage({ class: classNames == null ? void 0 : classNames.helperMessage }),
|
|
81
|
+
textareaProps.readOnly ? slots.readonly({ class: classNames == null ? void 0 : classNames.readonly }) : ""
|
|
82
|
+
),
|
|
83
|
+
children: helperMessage
|
|
84
|
+
}
|
|
85
|
+
),
|
|
86
|
+
errorMessage && /* @__PURE__ */ jsx("p", { className: clsx("error", slots.errorMessage({ class: classNames == null ? void 0 : classNames.errorMessage })), children: errorMessage }),
|
|
87
|
+
textareaProps.maxLength !== void 0 && /* @__PURE__ */ jsxs(
|
|
88
|
+
"p",
|
|
89
|
+
{
|
|
90
|
+
className: clsx(
|
|
91
|
+
slots.helperMessage({ class: classNames == null ? void 0 : classNames.helperMessage }),
|
|
92
|
+
textareaProps.readOnly ? slots.readonly({ class: classNames == null ? void 0 : classNames.readonly }) : ""
|
|
93
|
+
),
|
|
94
|
+
children: [
|
|
95
|
+
length,
|
|
96
|
+
" / ",
|
|
97
|
+
textareaProps.maxLength
|
|
98
|
+
]
|
|
99
|
+
}
|
|
100
|
+
)
|
|
101
|
+
] })
|
|
102
|
+
]
|
|
103
|
+
}
|
|
104
|
+
)
|
|
105
|
+
]
|
|
106
|
+
}
|
|
107
|
+
);
|
|
108
|
+
});
|
|
109
|
+
Textarea.displayName = "Textarea";
|
|
110
|
+
var textarea_default = Textarea;
|
|
111
|
+
var textareaStyle = tv({
|
|
112
|
+
slots: {
|
|
113
|
+
base: ["group/textarea", "flex", "select-none"],
|
|
114
|
+
vertical: ["flex-col"],
|
|
115
|
+
horizon: ["flex-row", "gap-0"],
|
|
116
|
+
label: ["flex", "items-center", "font-bold", "text-body-foreground", "min-w-[80px]"],
|
|
117
|
+
wrapper: ["flex", "flex-col"],
|
|
118
|
+
textarea: [
|
|
119
|
+
"w-full",
|
|
120
|
+
"h-full",
|
|
121
|
+
"bg-transparent",
|
|
122
|
+
"text-neutral-main",
|
|
123
|
+
"placeholder:!text-neutral-main",
|
|
124
|
+
"outline-none",
|
|
125
|
+
"resize-none",
|
|
126
|
+
"focus:ring-0",
|
|
127
|
+
"group-has-[:hover]/textarea:!text-neutral-dark",
|
|
128
|
+
"group-has-[:hover]/textarea:placeholder:!text-neutral-dark",
|
|
129
|
+
"group-has-[:focus]/textarea:!text-neutral-dark",
|
|
130
|
+
"group-has-[:focus]/textarea:placeholder:!text-neutral-dark",
|
|
131
|
+
"group-has-[p.error]/textarea:bg-danger-soft",
|
|
132
|
+
"group-has-[p.error]/textarea:text-danger-main",
|
|
133
|
+
"group-has-[p.error]/textarea:placeholder:!text-danger-main"
|
|
134
|
+
],
|
|
135
|
+
helperMessage: [
|
|
136
|
+
"text-neutral-main",
|
|
137
|
+
"group-has-[:hover]/textarea:text-neutral-dark",
|
|
138
|
+
"group-has-[p.error]/textarea:text-danger-main"
|
|
139
|
+
],
|
|
140
|
+
errorMessage: ["text-danger-main"],
|
|
141
|
+
readonlyWrapper: [
|
|
142
|
+
"pointer-events-none",
|
|
143
|
+
"[&>textarea]:!text-body-foreground",
|
|
144
|
+
"[&>textarea]:placeholder:!text-body-foreground"
|
|
145
|
+
],
|
|
146
|
+
readonly: []
|
|
147
|
+
},
|
|
148
|
+
variants: {
|
|
149
|
+
variant: {
|
|
150
|
+
solid: {
|
|
151
|
+
textarea: ["border-transparent", "bg-trans-soft"],
|
|
152
|
+
readonlyWrapper: ["[&>textarea]:!bg-trans-light"]
|
|
153
|
+
},
|
|
154
|
+
outline: {
|
|
155
|
+
textarea: [
|
|
156
|
+
"border-neutral-light",
|
|
157
|
+
"group-has-[:hover]/textarea:bg-trans-soft",
|
|
158
|
+
"group-has-[:focus]/textarea:bg-body-background",
|
|
159
|
+
"group-has-[p.error]/textarea:border-danger-main"
|
|
160
|
+
],
|
|
161
|
+
readonlyWrapper: ["[&>textarea]:!bg-trans-soft"]
|
|
162
|
+
}
|
|
163
|
+
},
|
|
164
|
+
color: {
|
|
165
|
+
primary: {
|
|
166
|
+
helperMessage: [
|
|
167
|
+
"group-has-[:focus]/textarea:!text-primary-main",
|
|
168
|
+
"group-has-[:focus]/textarea:!text-primary-main",
|
|
169
|
+
"group-has-[:focus]/textarea:hover:!text-primary-main",
|
|
170
|
+
"group-has-[:focus:hover]/textarea:!text-primary-main",
|
|
171
|
+
"group-has-[p.error]:not(textarea:focus):hover/textarea:!text-primary-main"
|
|
172
|
+
],
|
|
173
|
+
readonly: ["!text-primary-main"]
|
|
174
|
+
},
|
|
175
|
+
secondary: {
|
|
176
|
+
helperMessage: [
|
|
177
|
+
"group-has-[:focus]/textarea:text-secondary-main",
|
|
178
|
+
"group-has-[:focus]/textarea:text-secondary-main",
|
|
179
|
+
"group-has-[:focus]/textarea:hover:text-secondary-main",
|
|
180
|
+
"group-has-[:focus:hover]/textarea:text-secondary-main",
|
|
181
|
+
"group-has-[p.error]:not(textarea:focus):hover/textarea:!text-secondary-main"
|
|
182
|
+
],
|
|
183
|
+
readonly: ["!text-secondary-main"]
|
|
184
|
+
}
|
|
185
|
+
},
|
|
186
|
+
size: {
|
|
187
|
+
sm: {
|
|
188
|
+
base: ["text-sm", "gap-[4px]"],
|
|
189
|
+
label: ["text-sm"],
|
|
190
|
+
wrapper: ["gap-[4px]"],
|
|
191
|
+
textarea: ["w-[240px]", "h-[24px]", "rounded-sm", "p-[8px]", "gap-[4px]"],
|
|
192
|
+
helperMessage: ["text-sm"],
|
|
193
|
+
errorMessage: ["text-sm"]
|
|
194
|
+
},
|
|
195
|
+
md: {
|
|
196
|
+
base: ["text-md", "gap-[6px]"],
|
|
197
|
+
label: ["text-md"],
|
|
198
|
+
wrapper: ["gap-[6px]"],
|
|
199
|
+
textarea: ["w-[240px]", "h-[32px]", "rounded-md", "p-[8px]", "gap-[6px]"],
|
|
200
|
+
helperMessage: ["text-sm"],
|
|
201
|
+
errorMessage: ["text-sm"]
|
|
202
|
+
},
|
|
203
|
+
lg: {
|
|
204
|
+
base: ["text-lg", "gap-[8px]"],
|
|
205
|
+
label: ["text-lg"],
|
|
206
|
+
wrapper: ["gap-[8px]"],
|
|
207
|
+
textarea: ["w-[240px]", "h-[40px]", "rounded-lg", "p-[10px]", "gap-[8px]"],
|
|
208
|
+
helperMessage: ["text-md"],
|
|
209
|
+
errorMessage: ["text-md"]
|
|
210
|
+
},
|
|
211
|
+
xl: {
|
|
212
|
+
base: ["text-xl", "gap-[10px]"],
|
|
213
|
+
label: ["text-xl"],
|
|
214
|
+
wrapper: ["gap-[10px]"],
|
|
215
|
+
textarea: ["w-[240px]", "h-[50px]", "rounded-lg", "p-[10px]", "gap-[10px]"],
|
|
216
|
+
helperMessage: ["text-md"],
|
|
217
|
+
errorMessage: ["text-md"]
|
|
218
|
+
}
|
|
219
|
+
},
|
|
220
|
+
direction: {
|
|
221
|
+
vertical: "",
|
|
222
|
+
horizon: ""
|
|
223
|
+
},
|
|
224
|
+
full: {
|
|
225
|
+
true: {
|
|
226
|
+
base: ["w-full"],
|
|
227
|
+
wrapper: ["flex-1"],
|
|
228
|
+
textarea: ["w-full"]
|
|
229
|
+
}
|
|
230
|
+
},
|
|
231
|
+
disabled: {
|
|
232
|
+
true: {
|
|
233
|
+
textarea: [
|
|
234
|
+
"bg-neutral-soft",
|
|
235
|
+
"pointer-events-none",
|
|
236
|
+
"text-neutral-light",
|
|
237
|
+
"placeholder:!text-neutral-light",
|
|
238
|
+
"group-has-[p.error]/textarea:text-danger-light",
|
|
239
|
+
"group-has-[p.error]/textarea:border-danger-light",
|
|
240
|
+
"group-has-[p.error]/textarea:placeholder:!text-danger-light"
|
|
241
|
+
],
|
|
242
|
+
helperMessage: ["!text-neutral-light", "group-has-[p.error]/textarea:!text-danger-light"],
|
|
243
|
+
errorMessage: ["!text-danger-light"]
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
},
|
|
247
|
+
compoundVariants: [
|
|
248
|
+
{
|
|
249
|
+
variant: "outline",
|
|
250
|
+
size: "sm",
|
|
251
|
+
class: {
|
|
252
|
+
textarea: ["border-sm"]
|
|
253
|
+
}
|
|
254
|
+
},
|
|
255
|
+
{
|
|
256
|
+
variant: "outline",
|
|
257
|
+
size: "md",
|
|
258
|
+
class: {
|
|
259
|
+
textarea: ["border-md"]
|
|
260
|
+
}
|
|
261
|
+
},
|
|
262
|
+
{
|
|
263
|
+
variant: "outline",
|
|
264
|
+
size: "lg",
|
|
265
|
+
class: {
|
|
266
|
+
textarea: ["border-lg"]
|
|
267
|
+
}
|
|
268
|
+
},
|
|
269
|
+
{
|
|
270
|
+
variant: "outline",
|
|
271
|
+
size: "xl",
|
|
272
|
+
class: {
|
|
273
|
+
textarea: ["border-xl"]
|
|
274
|
+
}
|
|
275
|
+
},
|
|
276
|
+
{
|
|
277
|
+
disabled: true,
|
|
278
|
+
variant: ["outline"],
|
|
279
|
+
class: {
|
|
280
|
+
textarea: ["!bg-body-background", "group-has-[p.error]/input:border-danger-light"]
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
],
|
|
284
|
+
defaultVariants: {
|
|
285
|
+
variant: "solid",
|
|
286
|
+
color: "primary",
|
|
287
|
+
size: "md",
|
|
288
|
+
direction: "vertical",
|
|
289
|
+
fullWidth: false,
|
|
290
|
+
disabled: false,
|
|
291
|
+
readonly: false
|
|
292
|
+
}
|
|
293
|
+
});
|
|
294
|
+
|
|
295
|
+
export {
|
|
296
|
+
textarea_default
|
|
297
|
+
};
|
|
@@ -13,7 +13,14 @@ import {
|
|
|
13
13
|
} from "./chunk-E3G5QXSH.mjs";
|
|
14
14
|
|
|
15
15
|
// src/components/input/input.tsx
|
|
16
|
-
import
|
|
16
|
+
import {
|
|
17
|
+
forwardRef,
|
|
18
|
+
useRef,
|
|
19
|
+
useCallback,
|
|
20
|
+
useMemo,
|
|
21
|
+
isValidElement,
|
|
22
|
+
cloneElement
|
|
23
|
+
} from "react";
|
|
17
24
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
18
25
|
var Input = forwardRef((originalProps, ref) => {
|
|
19
26
|
const [props, variantProps] = mapPropsVariants(originalProps, inputStyle.variantKeys);
|
|
@@ -22,19 +29,22 @@ var Input = forwardRef((originalProps, ref) => {
|
|
|
22
29
|
const slots = useMemo(() => inputStyle({ ...variantProps }), [variantProps]);
|
|
23
30
|
const getContentProps = useCallback(
|
|
24
31
|
() => ({
|
|
25
|
-
className:
|
|
32
|
+
className: clsx(
|
|
33
|
+
slots.content({ class: classNames == null ? void 0 : classNames.content }),
|
|
34
|
+
inputProps.readOnly ? slots.readonly({ class: classNames == null ? void 0 : classNames.readonly }) : ""
|
|
35
|
+
),
|
|
26
36
|
size: originalProps.size
|
|
27
37
|
}),
|
|
28
38
|
[slots, classNames, originalProps.size]
|
|
29
39
|
);
|
|
30
40
|
const renderStartContent = () => {
|
|
31
|
-
if (
|
|
41
|
+
if (isValidElement(startContent)) {
|
|
32
42
|
const existingProps = startContent.props;
|
|
33
43
|
const mergedProps = {
|
|
34
44
|
...getContentProps(),
|
|
35
45
|
className: `${getContentProps().className || ""} ${existingProps.className || ""}`.trim()
|
|
36
46
|
};
|
|
37
|
-
return
|
|
47
|
+
return cloneElement(startContent, mergedProps);
|
|
38
48
|
} else {
|
|
39
49
|
const contentProps = getContentProps();
|
|
40
50
|
return /* @__PURE__ */ jsx("div", { ...contentProps, children: startContent });
|
|
@@ -53,13 +63,13 @@ var Input = forwardRef((originalProps, ref) => {
|
|
|
53
63
|
}
|
|
54
64
|
);
|
|
55
65
|
const renderContentWithIcon = () => {
|
|
56
|
-
if (
|
|
66
|
+
if (isValidElement(endContent)) {
|
|
57
67
|
const existingProps = endContent.props;
|
|
58
68
|
const mergedProps = {
|
|
59
69
|
...getContentProps(),
|
|
60
70
|
className: `${getContentProps().className || ""} ${existingProps.className || ""}`.trim()
|
|
61
71
|
};
|
|
62
|
-
return
|
|
72
|
+
return cloneElement(endContent, mergedProps);
|
|
63
73
|
} else if (errorMessage) {
|
|
64
74
|
const iconProps = { ...getContentProps(), className: getContentProps().className };
|
|
65
75
|
return /* @__PURE__ */ jsx("div", { ...iconProps, children: /* @__PURE__ */ jsx(Icon_default, { name: "exclamation-circle", fill: true, size: originalProps.size }) });
|
|
@@ -94,20 +104,17 @@ var Input = forwardRef((originalProps, ref) => {
|
|
|
94
104
|
{
|
|
95
105
|
className: clsx(
|
|
96
106
|
slots.inputWrapper({ class: classNames == null ? void 0 : classNames.inputWrapper }),
|
|
97
|
-
inputProps.readOnly ? slots.
|
|
107
|
+
inputProps.readOnly ? slots.readonlyWrapper({ class: classNames == null ? void 0 : classNames.readonlyWrapper }) : ""
|
|
98
108
|
),
|
|
99
109
|
children: [
|
|
100
110
|
startContent && renderStartContent(),
|
|
101
111
|
/* @__PURE__ */ jsx(
|
|
102
112
|
"input",
|
|
103
113
|
{
|
|
104
|
-
...inputProps,
|
|
105
114
|
ref: ref || inputRef,
|
|
115
|
+
...inputProps,
|
|
106
116
|
readOnly: props.readOnly,
|
|
107
|
-
className: clsx(
|
|
108
|
-
slots.input({ class: classNames == null ? void 0 : classNames.input }),
|
|
109
|
-
inputProps.readOnly ? "!text-body-foreground placeholder:!text-body-foreground" : ""
|
|
110
|
-
),
|
|
117
|
+
className: clsx(slots.input({ class: classNames == null ? void 0 : classNames.input })),
|
|
111
118
|
size: 0
|
|
112
119
|
}
|
|
113
120
|
),
|
|
@@ -115,7 +122,16 @@ var Input = forwardRef((originalProps, ref) => {
|
|
|
115
122
|
]
|
|
116
123
|
}
|
|
117
124
|
),
|
|
118
|
-
helperMessage && !errorMessage && /* @__PURE__ */ jsx(
|
|
125
|
+
helperMessage && !errorMessage && /* @__PURE__ */ jsx(
|
|
126
|
+
"p",
|
|
127
|
+
{
|
|
128
|
+
className: clsx(
|
|
129
|
+
slots.helperMessage({ class: classNames == null ? void 0 : classNames.helperMessage }),
|
|
130
|
+
inputProps.readOnly ? slots.readonly({ class: classNames == null ? void 0 : classNames.readonly }) : ""
|
|
131
|
+
),
|
|
132
|
+
children: helperMessage
|
|
133
|
+
}
|
|
134
|
+
),
|
|
119
135
|
errorMessage && /* @__PURE__ */ jsx("p", { className: clsx("error", slots.errorMessage({ class: classNames == null ? void 0 : classNames.errorMessage })), children: errorMessage })
|
|
120
136
|
] })
|
|
121
137
|
]
|
|
@@ -127,12 +143,12 @@ var input_default = Input;
|
|
|
127
143
|
var inputStyle = tv(
|
|
128
144
|
{
|
|
129
145
|
slots: {
|
|
130
|
-
base: ["group/input", "flex select-none"],
|
|
146
|
+
base: ["group/input", "flex", "select-none"],
|
|
131
147
|
vertical: ["flex-col"],
|
|
132
148
|
horizon: ["flex-row", "gap-0"],
|
|
133
149
|
label: ["flex", "items-center", "font-bold", "text-body-foreground", "min-w-[80px]"],
|
|
134
150
|
innerWrapper: ["flex", "flex-col"],
|
|
135
|
-
inputWrapper: ["flex", "items-center", "duration-200", "group-has-[p.error]/input
|
|
151
|
+
inputWrapper: ["flex", "items-center", "duration-200", "group-has-[p.error]/input:!bg-danger-soft"],
|
|
136
152
|
input: [
|
|
137
153
|
"w-full",
|
|
138
154
|
"h-full",
|
|
@@ -141,8 +157,8 @@ var inputStyle = tv(
|
|
|
141
157
|
"placeholder:text-neutral-main",
|
|
142
158
|
"outline-none",
|
|
143
159
|
"focus:ring-0",
|
|
144
|
-
"group-has-[:hover]/input
|
|
145
|
-
"group-has-[:hover]/input:placeholder
|
|
160
|
+
"group-has-[:hover]/input:!text-neutral-dark",
|
|
161
|
+
"group-has-[:hover]/input:placeholder:!text-neutral-dark",
|
|
146
162
|
"group-has-[:focus]/input:text-neutral-dark",
|
|
147
163
|
"group-has-[:focus]/input:placeholder:text-neutral-dark",
|
|
148
164
|
"group-has-[p.error]/input:text-danger-main",
|
|
@@ -158,13 +174,22 @@ var inputStyle = tv(
|
|
|
158
174
|
],
|
|
159
175
|
helperMessage: ["text-neutral-main", "group-has-[:hover]/input:text-neutral-dark"],
|
|
160
176
|
errorMessage: ["text-danger-main"],
|
|
161
|
-
|
|
177
|
+
readonlyWrapper: [
|
|
178
|
+
"pointer-events-none",
|
|
179
|
+
"!text-body-foreground",
|
|
180
|
+
"placeholder:!text-body-foreground",
|
|
181
|
+
"group-has-[p.error]/input:!text-danger-main",
|
|
182
|
+
"group-has-[p.error]/input:placeholder:!text-danger-main",
|
|
183
|
+
"[&>input]:!text-body-foreground",
|
|
184
|
+
"[&>input]:placeholder:!text-body-foreground"
|
|
185
|
+
],
|
|
186
|
+
readonly: []
|
|
162
187
|
},
|
|
163
188
|
variants: {
|
|
164
189
|
variant: {
|
|
165
190
|
solid: {
|
|
166
191
|
inputWrapper: ["border-transparent", "bg-trans-soft"],
|
|
167
|
-
|
|
192
|
+
readonlyWrapper: ["!bg-trans-light"]
|
|
168
193
|
},
|
|
169
194
|
outline: {
|
|
170
195
|
inputWrapper: [
|
|
@@ -173,7 +198,7 @@ var inputStyle = tv(
|
|
|
173
198
|
"group-has-[:focus]/input:bg-body-background",
|
|
174
199
|
"group-has-[p.error]/input:border-danger-main"
|
|
175
200
|
],
|
|
176
|
-
|
|
201
|
+
readonlyWrapper: ["!bg-trans-soft"]
|
|
177
202
|
},
|
|
178
203
|
underline: {
|
|
179
204
|
inputWrapper: [
|
|
@@ -183,30 +208,31 @@ var inputStyle = tv(
|
|
|
183
208
|
"group-has-[:focus]/input:bg-body-background",
|
|
184
209
|
"group-has-[p.error]/input:border-danger-main"
|
|
185
210
|
],
|
|
186
|
-
|
|
211
|
+
readonlyWrapper: ["!bg-trans-soft"]
|
|
187
212
|
}
|
|
188
213
|
},
|
|
189
214
|
color: {
|
|
190
215
|
primary: {
|
|
191
216
|
content: [
|
|
192
|
-
"group-has-[:focus]/input
|
|
193
|
-
"
|
|
217
|
+
"group-has-[:focus]/input:!text-primary-main",
|
|
218
|
+
"group-has-[p.error]:not(input:focus):hover/input:!text-primary-main"
|
|
194
219
|
],
|
|
195
220
|
helperMessage: [
|
|
196
|
-
"group-has-[:focus]/input
|
|
197
|
-
"group-has-[:focus:hover]/input
|
|
198
|
-
"group-has-[:focus]/input:hover
|
|
199
|
-
]
|
|
221
|
+
"group-has-[:focus]/input:!text-primary-main",
|
|
222
|
+
"group-has-[:focus:hover]/input:!text-primary-main",
|
|
223
|
+
"group-has-[:focus]/input:hover:!text-primary-main"
|
|
224
|
+
],
|
|
225
|
+
readonly: ["!text-primary-main"]
|
|
200
226
|
},
|
|
201
227
|
secondary: {
|
|
202
228
|
content: [
|
|
203
|
-
"group-has-[:focus]/input
|
|
204
|
-
"
|
|
229
|
+
"group-has-[:focus]/input:!text-secondary-main",
|
|
230
|
+
"group-has-[p.error]:not(input:focus):hover/input:!text-secondary-main"
|
|
205
231
|
],
|
|
206
232
|
helperMessage: [
|
|
207
|
-
"group-has-[:focus]/input
|
|
208
|
-
"group-has-[:focus:hover]/input
|
|
209
|
-
"group-has-[:focus]/input:hover
|
|
233
|
+
"group-has-[:focus]/input:!text-secondary-main",
|
|
234
|
+
"group-has-[:focus:hover]/input:!text-secondary-main",
|
|
235
|
+
"group-has-[:focus]/input:hover:!text-secondary-main"
|
|
210
236
|
]
|
|
211
237
|
}
|
|
212
238
|
},
|
|
@@ -257,14 +283,14 @@ var inputStyle = tv(
|
|
|
257
283
|
},
|
|
258
284
|
disabled: {
|
|
259
285
|
true: {
|
|
260
|
-
inputWrapper: ["!bg-neutral-soft", "pointer-events-none", "
|
|
286
|
+
inputWrapper: ["!bg-neutral-soft", "pointer-events-none", "group-has-[p.error]/input:!text-danger-light"],
|
|
261
287
|
input: [
|
|
262
|
-
"text-neutral-light",
|
|
263
|
-
"placeholder
|
|
264
|
-
"group-has-[p.error]/input
|
|
265
|
-
"group-has-[p.error]/input:placeholder
|
|
288
|
+
"!text-neutral-light",
|
|
289
|
+
"placeholder:!text-neutral-light",
|
|
290
|
+
"group-has-[p.error]/input:!text-danger-light",
|
|
291
|
+
"group-has-[p.error]/input:placeholder:!text-danger-light"
|
|
266
292
|
],
|
|
267
|
-
content: ["text-neutral-light", "group-has-[p.error]/input:text-danger-light"],
|
|
293
|
+
content: ["!text-neutral-light", "group-has-[p.error]/input:text-danger-light"],
|
|
268
294
|
helperMessage: ["!text-neutral-light"],
|
|
269
295
|
errorMessage: ["!text-danger-light"]
|
|
270
296
|
}
|
|
@@ -331,7 +357,11 @@ var inputStyle = tv(
|
|
|
331
357
|
disabled: true,
|
|
332
358
|
variant: ["outline", "underline"],
|
|
333
359
|
class: {
|
|
334
|
-
inputWrapper: ["!bg-body-background", "group-has-[p.error]/input
|
|
360
|
+
inputWrapper: ["!bg-body-background", "group-has-[p.error]/input:!border-danger-light"],
|
|
361
|
+
content: [
|
|
362
|
+
"group-has-[p.error]/input:!text-danger-light",
|
|
363
|
+
"group-has-[p.error]/input:placeholder:!text-danger-light"
|
|
364
|
+
]
|
|
335
365
|
}
|
|
336
366
|
}
|
|
337
367
|
],
|
|
@@ -231,13 +231,16 @@ var select = tv({
|
|
|
231
231
|
variants: {
|
|
232
232
|
color: {
|
|
233
233
|
primary: {
|
|
234
|
-
selectWrapper: ["
|
|
235
|
-
|
|
234
|
+
selectWrapper: ["text-primary-main"],
|
|
235
|
+
select: ["text-primary-main"],
|
|
236
|
+
option: ["hover:bg-primary-soft", "hover:text-primary-main"],
|
|
237
|
+
helperMessage: ["text-primary-main"]
|
|
236
238
|
},
|
|
237
239
|
secondary: {
|
|
238
|
-
selectWrapper: ["
|
|
240
|
+
selectWrapper: ["text-secondary-main"],
|
|
239
241
|
select: ["text-secondary-main"],
|
|
240
|
-
option: ["hover:bg-secondary-soft", "hover:text-secondary-main"]
|
|
242
|
+
option: ["hover:bg-secondary-soft", "hover:text-secondary-main"],
|
|
243
|
+
helperMessage: ["text-secondary-main"]
|
|
241
244
|
}
|
|
242
245
|
},
|
|
243
246
|
size: {
|
|
@@ -27,11 +27,12 @@ var TableBody = ({
|
|
|
27
27
|
classNames,
|
|
28
28
|
className
|
|
29
29
|
}) => {
|
|
30
|
-
const getCellStyle = (
|
|
31
|
-
width:
|
|
32
|
-
minWidth:
|
|
33
|
-
maxWidth:
|
|
34
|
-
height:
|
|
30
|
+
const getCellStyle = (column) => ({
|
|
31
|
+
width: column.width ? `${column.width}px` : void 0,
|
|
32
|
+
minWidth: column.minWidth ? `${column.minWidth}px` : void 0,
|
|
33
|
+
maxWidth: column.maxWidth ? `${column.maxWidth}px` : void 0,
|
|
34
|
+
height: column.height ? `${column.height}px` : void 0,
|
|
35
|
+
textAlign: column.align || "center"
|
|
35
36
|
});
|
|
36
37
|
const renderTdSkeleton = (key) => /* @__PURE__ */ jsx("td", { className: slots.td({ class: classNames == null ? void 0 : classNames.td }), children: /* @__PURE__ */ jsx(skeleton_default, { color, className: "h-full w-full", rounded: "lg", speed: "fast" }) }, key);
|
|
37
38
|
const renderCheckboxCell = (rowIndex) => /* @__PURE__ */ jsx("td", { className: clsx(slots.td({ class: classNames == null ? void 0 : classNames.td }), "text-center"), children: /* @__PURE__ */ jsx(
|
|
@@ -48,16 +49,16 @@ var TableBody = ({
|
|
|
48
49
|
] }, `skeleton-${rowIndex}`);
|
|
49
50
|
const renderEmptyRow = () => /* @__PURE__ */ jsx("tr", { className: slots.tr({ class: classNames == null ? void 0 : classNames.tr }), children: /* @__PURE__ */ jsx("td", { colSpan: columns.length + (rowCheckbox ? 1 : 0), className: slots.empty({ class: classNames == null ? void 0 : classNames.empty }), children: emptyContent }) });
|
|
50
51
|
const renderDataRow = (row, rowIndex) => /* @__PURE__ */ jsxs("tr", { className: slots.tr({ class: classNames == null ? void 0 : classNames.tr }), onClick: () => onRowClick == null ? void 0 : onRowClick(row), children: [
|
|
51
|
-
columns.map((
|
|
52
|
+
columns.map((column, colIdx) => {
|
|
52
53
|
var _a;
|
|
53
|
-
const value = row[
|
|
54
|
-
const formattedValue = ((_a =
|
|
55
|
-
const content =
|
|
54
|
+
const value = row[column.field];
|
|
55
|
+
const formattedValue = ((_a = column.valueFormatter) == null ? void 0 : _a.call(column, { value, field: column.field })) || value;
|
|
56
|
+
const content = column.renderCell ? column.renderCell({ id: row.id, field: column.field, value, formattedValue, row }) : formattedValue;
|
|
56
57
|
return /* @__PURE__ */ jsx(
|
|
57
58
|
"td",
|
|
58
59
|
{
|
|
59
|
-
className: clsx(slots.td({ class: classNames == null ? void 0 : classNames.td }),
|
|
60
|
-
style: getCellStyle(
|
|
60
|
+
className: clsx(slots.td({ class: classNames == null ? void 0 : classNames.td }), column.className),
|
|
61
|
+
style: getCellStyle(column),
|
|
61
62
|
children: content
|
|
62
63
|
},
|
|
63
64
|
`${rowIndex}-${colIdx}`
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
table_body_default
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-LWRK5TPZ.mjs";
|
|
5
5
|
import {
|
|
6
6
|
table_head_default
|
|
7
7
|
} from "./chunk-P7YYNA6L.mjs";
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
} from "./chunk-M37VBNB3.mjs";
|
|
11
11
|
import {
|
|
12
12
|
pagination_default
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-CVQM3T2X.mjs";
|
|
14
14
|
import {
|
|
15
15
|
clsx
|
|
16
16
|
} from "./chunk-27Y6K5NK.mjs";
|
|
@@ -36,7 +36,7 @@ var Table = forwardRef((originalProps, ref) => {
|
|
|
36
36
|
columns,
|
|
37
37
|
rowCheckbox = false,
|
|
38
38
|
onRowClick,
|
|
39
|
-
totalData,
|
|
39
|
+
totalData = 0,
|
|
40
40
|
pagination,
|
|
41
41
|
onPageChange,
|
|
42
42
|
emptyContent,
|
|
@@ -46,8 +46,8 @@ var Table = forwardRef((originalProps, ref) => {
|
|
|
46
46
|
size,
|
|
47
47
|
skeletonRow
|
|
48
48
|
} = { ...props, ...variantProps };
|
|
49
|
-
const { page = 1, perPage =
|
|
50
|
-
const showPagination = pagination &&
|
|
49
|
+
const { page = 1, perPage = 15 } = pagination || {};
|
|
50
|
+
const showPagination = pagination && totalData > 0 && !isLoading;
|
|
51
51
|
const [checkedRows, setCheckedRows] = useState(/* @__PURE__ */ new Set());
|
|
52
52
|
const divRef = useRef(null);
|
|
53
53
|
useImperativeHandle(
|