@vkzstudio/muza-ui 1.0.21 → 1.0.23
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/dist/components/Calendar/Calendar.d.ts +28 -3
- package/dist/components/Calendar/Calendar.d.ts.map +1 -1
- package/dist/components/Calendar/Calendar.js +209 -134
- package/dist/components/Calendar/CalendarBase.stories.d.ts +2 -0
- package/dist/components/Calendar/CalendarBase.stories.d.ts.map +1 -1
- package/dist/components/DatePicker/DatePicker.d.ts +5 -0
- package/dist/components/DatePicker/DatePicker.d.ts.map +1 -1
- package/dist/components/DatePicker/DatePicker.js +96 -77
- package/dist/components/DatePicker/DatePicker.stories.d.ts +3 -0
- package/dist/components/DatePicker/DatePicker.stories.d.ts.map +1 -1
- package/dist/components/Dialog/Dialog.js +8 -8
- package/dist/components/FileUpload/FileItem.js +1 -1
- package/dist/components/FileUpload/FileUpload.d.ts +5 -1
- package/dist/components/FileUpload/FileUpload.d.ts.map +1 -1
- package/dist/components/FileUpload/FileUpload.js +152 -121
- package/dist/components/FileUpload/FileUpload.stories.d.ts +2 -0
- package/dist/components/FileUpload/FileUpload.stories.d.ts.map +1 -1
- package/dist/components/Textarea/Textarea.d.ts.map +1 -1
- package/dist/components/Textarea/Textarea.js +85 -65
- package/dist/muza-ui.css +1 -1
- package/dist/translations/locales/cs.d.ts.map +1 -1
- package/dist/translations/locales/cs.js +1 -0
- package/dist/translations/locales/en.d.ts.map +1 -1
- package/dist/translations/locales/en.js +1 -0
- package/dist/translations/locales/sk.d.ts.map +1 -1
- package/dist/translations/locales/sk.js +1 -0
- package/dist/translations/types.d.ts +2 -0
- package/dist/translations/types.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import * as
|
|
3
|
-
import { cva as
|
|
4
|
-
import { useDropzone as
|
|
5
|
-
import { FileItem as
|
|
6
|
-
import { useMuzaTranslations as
|
|
7
|
-
import { Flex as
|
|
8
|
-
import { FormField as
|
|
9
|
-
import { cn as
|
|
10
|
-
import { CloudUploadOutline as
|
|
11
|
-
import { Typography as
|
|
12
|
-
const
|
|
1
|
+
import { jsxs as n, jsx as a, Fragment as pe } from "react/jsx-runtime";
|
|
2
|
+
import * as v from "react";
|
|
3
|
+
import { cva as Y } from "class-variance-authority";
|
|
4
|
+
import { useDropzone as ue } from "react-dropzone";
|
|
5
|
+
import { FileItem as Q } from "./FileItem.js";
|
|
6
|
+
import { useMuzaTranslations as fe } from "../../translations/TranslationContext.js";
|
|
7
|
+
import { Flex as W } from "../Flex/Flex.js";
|
|
8
|
+
import { FormField as ne } from "../FormField/FormField.js";
|
|
9
|
+
import { cn as X } from "../../utils/cn.js";
|
|
10
|
+
import { CloudUploadOutline as me } from "@solar-icons/react-perf";
|
|
11
|
+
import { Typography as M } from "../Typography/Typography.js";
|
|
12
|
+
const ge = Y(
|
|
13
13
|
[
|
|
14
14
|
"group relative cursor-pointer rounded-xl border-1 border-dashed transition-colors",
|
|
15
15
|
"p-4xl pt-3xl pr-4xl pb-3xl",
|
|
@@ -45,7 +45,7 @@ const de = G(
|
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
|
-
),
|
|
48
|
+
), xe = Y(
|
|
49
49
|
[
|
|
50
50
|
"text-center transition-colors",
|
|
51
51
|
"text-comp-file-upload-text-dark-secondary"
|
|
@@ -57,119 +57,139 @@ const de = G(
|
|
|
57
57
|
}
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
|
-
),
|
|
60
|
+
), he = v.forwardRef(
|
|
61
61
|
({
|
|
62
|
-
className:
|
|
63
|
-
onDrop:
|
|
64
|
-
accept:
|
|
65
|
-
multiple:
|
|
66
|
-
maxSize:
|
|
67
|
-
maxSizeErrorMessage:
|
|
68
|
-
|
|
62
|
+
className: U,
|
|
63
|
+
onDrop: z,
|
|
64
|
+
accept: m,
|
|
65
|
+
multiple: A = !0,
|
|
66
|
+
maxSize: y,
|
|
67
|
+
maxSizeErrorMessage: Z,
|
|
68
|
+
maxFiles: i,
|
|
69
|
+
maxFilesErrorMessage: q,
|
|
70
|
+
size: P = "base",
|
|
69
71
|
disabled: p = !1,
|
|
70
|
-
readOnly:
|
|
71
|
-
dropzoneOptions:
|
|
72
|
-
label:
|
|
73
|
-
title:
|
|
74
|
-
subtitle:
|
|
75
|
-
preselectedFiles:
|
|
76
|
-
fileStatus:
|
|
77
|
-
itemErrors:
|
|
78
|
-
itemHints:
|
|
79
|
-
error:
|
|
80
|
-
required:
|
|
81
|
-
disableRequiredAsterisk:
|
|
72
|
+
readOnly: g = !1,
|
|
73
|
+
dropzoneOptions: O,
|
|
74
|
+
label: V,
|
|
75
|
+
title: H,
|
|
76
|
+
subtitle: K,
|
|
77
|
+
preselectedFiles: D = [],
|
|
78
|
+
fileStatus: C = [],
|
|
79
|
+
itemErrors: S,
|
|
80
|
+
itemHints: F,
|
|
81
|
+
error: E,
|
|
82
|
+
required: k,
|
|
83
|
+
disableRequiredAsterisk: ee,
|
|
82
84
|
onError: t,
|
|
83
|
-
onDelete:
|
|
84
|
-
onChange:
|
|
85
|
-
preselectedUrls:
|
|
86
|
-
onDeleteUrl:
|
|
87
|
-
labelExtra:
|
|
88
|
-
infoTooltip:
|
|
89
|
-
...
|
|
90
|
-
},
|
|
91
|
-
const
|
|
85
|
+
onDelete: w,
|
|
86
|
+
onChange: u,
|
|
87
|
+
preselectedUrls: x = [],
|
|
88
|
+
onDeleteUrl: $,
|
|
89
|
+
labelExtra: te,
|
|
90
|
+
infoTooltip: oe,
|
|
91
|
+
...le
|
|
92
|
+
}, se) => {
|
|
93
|
+
const f = fe(), [h, _] = v.useState(D), [j, N] = v.useState(!1), [B, b] = v.useState(!1), T = h.length + x.length, re = H ?? f.fileUpload.title, I = i != null ? f.fileUpload.maxFilesError.replace("{count}", String(i)) : "", R = q ?? I, G = y ? f.fileUpload.maxSizeError.replace(
|
|
92
94
|
"{size}",
|
|
93
|
-
(
|
|
94
|
-
) : "",
|
|
95
|
-
onDrop: (e,
|
|
95
|
+
(y / (1024 * 1024)).toFixed(0)
|
|
96
|
+
) : "", J = Z ?? G, { getRootProps: ae, getInputProps: ie, isDragActive: de } = ue({
|
|
97
|
+
onDrop: (e, s) => {
|
|
96
98
|
try {
|
|
97
|
-
if (
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
99
|
+
if (N(!1), b(!1), s.length > 0) {
|
|
100
|
+
const o = s.some(
|
|
101
|
+
(l) => l.errors.some((r) => r.code === "file-too-large")
|
|
102
|
+
);
|
|
103
|
+
if (s.some(
|
|
104
|
+
(l) => l.errors.some((r) => r.code === "too-many-files")
|
|
105
|
+
)) {
|
|
106
|
+
b(!0);
|
|
107
|
+
const l = R || I;
|
|
108
|
+
t == null || t(l, s[0].file);
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
if (o) {
|
|
112
|
+
N(!0);
|
|
113
|
+
const l = J || G;
|
|
114
|
+
t == null || t(l, s[0].file);
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
if (i != null && T + e.length > i) {
|
|
119
|
+
b(!0);
|
|
120
|
+
const o = R || I;
|
|
121
|
+
t == null || t(o);
|
|
103
122
|
return;
|
|
104
123
|
}
|
|
105
|
-
|
|
106
|
-
const
|
|
107
|
-
o.map((
|
|
108
|
-
),
|
|
109
|
-
(
|
|
110
|
-
),
|
|
111
|
-
return
|
|
112
|
-
}),
|
|
124
|
+
_((o) => {
|
|
125
|
+
const c = new Set(
|
|
126
|
+
o.map((d) => `${d.name}-${d.size}-${d.lastModified}`)
|
|
127
|
+
), l = e.filter(
|
|
128
|
+
(d) => !c.has(`${d.name}-${d.size}-${d.lastModified}`)
|
|
129
|
+
), r = [...o, ...l];
|
|
130
|
+
return u == null || u(r), r;
|
|
131
|
+
}), z == null || z(e);
|
|
113
132
|
} catch (o) {
|
|
114
|
-
const
|
|
115
|
-
t == null || t(
|
|
133
|
+
const c = o instanceof Error ? o.message : f.fileUpload.processingError;
|
|
134
|
+
t == null || t(c);
|
|
116
135
|
}
|
|
117
136
|
},
|
|
118
|
-
accept: typeof
|
|
119
|
-
multiple:
|
|
120
|
-
maxSize:
|
|
137
|
+
accept: typeof m == "string" ? { [m]: [] } : m ? Object.fromEntries(m.map((e) => [e, []])) : void 0,
|
|
138
|
+
multiple: A,
|
|
139
|
+
maxSize: y,
|
|
140
|
+
maxFiles: i != null ? i - T : void 0,
|
|
121
141
|
disabled: p,
|
|
122
|
-
...
|
|
123
|
-
}),
|
|
124
|
-
return /* @__PURE__ */
|
|
125
|
-
(!
|
|
126
|
-
|
|
142
|
+
...O
|
|
143
|
+
}), L = g || !A && (h.length > 0 || x.length > 0) || i != null && T >= i;
|
|
144
|
+
return /* @__PURE__ */ n(W, { direction: "column", gap: "lg", children: [
|
|
145
|
+
(!L || V) && /* @__PURE__ */ a(
|
|
146
|
+
ne,
|
|
127
147
|
{
|
|
128
|
-
label:
|
|
129
|
-
required:
|
|
130
|
-
disableRequiredAsterisk:
|
|
131
|
-
labelExtra:
|
|
132
|
-
infoTooltip:
|
|
133
|
-
children: !
|
|
134
|
-
/* @__PURE__ */
|
|
148
|
+
label: V,
|
|
149
|
+
required: k,
|
|
150
|
+
disableRequiredAsterisk: ee,
|
|
151
|
+
labelExtra: te,
|
|
152
|
+
infoTooltip: oe,
|
|
153
|
+
children: !L && /* @__PURE__ */ n(pe, { children: [
|
|
154
|
+
/* @__PURE__ */ n(
|
|
135
155
|
"div",
|
|
136
156
|
{
|
|
137
|
-
ref:
|
|
157
|
+
ref: se,
|
|
138
158
|
tabIndex: p ? void 0 : 0,
|
|
139
|
-
className:
|
|
140
|
-
|
|
141
|
-
error:
|
|
159
|
+
className: X(
|
|
160
|
+
ge({
|
|
161
|
+
error: E || j || B,
|
|
142
162
|
disabled: p,
|
|
143
|
-
className:
|
|
144
|
-
isDragActive:
|
|
163
|
+
className: U,
|
|
164
|
+
isDragActive: de
|
|
145
165
|
})
|
|
146
166
|
),
|
|
147
|
-
...
|
|
148
|
-
...
|
|
167
|
+
...ae(),
|
|
168
|
+
...le,
|
|
149
169
|
children: [
|
|
150
170
|
/* @__PURE__ */ a(
|
|
151
171
|
"input",
|
|
152
172
|
{
|
|
153
|
-
...
|
|
154
|
-
"aria-required":
|
|
173
|
+
...ie({ required: k }),
|
|
174
|
+
"aria-required": k
|
|
155
175
|
}
|
|
156
176
|
),
|
|
157
|
-
/* @__PURE__ */ a(
|
|
158
|
-
/* @__PURE__ */
|
|
159
|
-
/* @__PURE__ */ a(
|
|
160
|
-
|
|
161
|
-
|
|
177
|
+
/* @__PURE__ */ a(me, { className: "inline size-comp-file-upload-ico-size" }),
|
|
178
|
+
/* @__PURE__ */ n("div", { children: [
|
|
179
|
+
/* @__PURE__ */ a(M, { size: "base", component: "p", weight: "medium", children: re }),
|
|
180
|
+
K && /* @__PURE__ */ a(
|
|
181
|
+
M,
|
|
162
182
|
{
|
|
163
183
|
size: "sm",
|
|
164
184
|
component: "p",
|
|
165
185
|
weight: "regular",
|
|
166
|
-
className:
|
|
167
|
-
|
|
186
|
+
className: X(
|
|
187
|
+
xe({
|
|
168
188
|
disabled: p,
|
|
169
|
-
className:
|
|
189
|
+
className: U
|
|
170
190
|
})
|
|
171
191
|
),
|
|
172
|
-
children:
|
|
192
|
+
children: K
|
|
173
193
|
}
|
|
174
194
|
)
|
|
175
195
|
] })
|
|
@@ -177,22 +197,33 @@ const de = G(
|
|
|
177
197
|
}
|
|
178
198
|
),
|
|
179
199
|
j && /* @__PURE__ */ a(
|
|
180
|
-
|
|
200
|
+
M,
|
|
201
|
+
{
|
|
202
|
+
size: "sm",
|
|
203
|
+
variant: "body",
|
|
204
|
+
component: "p",
|
|
205
|
+
weight: "regular",
|
|
206
|
+
className: "text-comp-file-upload-text-error-def",
|
|
207
|
+
children: J
|
|
208
|
+
}
|
|
209
|
+
),
|
|
210
|
+
B && /* @__PURE__ */ a(
|
|
211
|
+
M,
|
|
181
212
|
{
|
|
182
213
|
size: "sm",
|
|
183
214
|
variant: "body",
|
|
184
215
|
component: "p",
|
|
185
216
|
weight: "regular",
|
|
186
217
|
className: "text-comp-file-upload-text-error-def",
|
|
187
|
-
children:
|
|
218
|
+
children: R
|
|
188
219
|
}
|
|
189
220
|
)
|
|
190
221
|
] })
|
|
191
222
|
}
|
|
192
223
|
),
|
|
193
|
-
(
|
|
194
|
-
|
|
195
|
-
|
|
224
|
+
(x.length > 0 || h.length > 0) && /* @__PURE__ */ n(W, { component: "ul", direction: "column", gap: "md", children: [
|
|
225
|
+
x.map((e, s) => /* @__PURE__ */ a(
|
|
226
|
+
Q,
|
|
196
227
|
{
|
|
197
228
|
source: "url",
|
|
198
229
|
url: e.url,
|
|
@@ -200,36 +231,36 @@ const de = G(
|
|
|
200
231
|
type: e.type,
|
|
201
232
|
uploaded: !0,
|
|
202
233
|
disabled: p,
|
|
203
|
-
readOnly:
|
|
204
|
-
size:
|
|
205
|
-
onDelete: () =>
|
|
234
|
+
readOnly: g,
|
|
235
|
+
size: P,
|
|
236
|
+
onDelete: () => $ == null ? void 0 : $(e, s)
|
|
206
237
|
},
|
|
207
238
|
`url-${e.url}`
|
|
208
239
|
)),
|
|
209
|
-
|
|
210
|
-
const o =
|
|
211
|
-
return
|
|
212
|
-
|
|
240
|
+
h.map((e, s) => {
|
|
241
|
+
const o = C[s], c = o == null ? void 0 : o.uploaded;
|
|
242
|
+
return g && !c ? null : /* @__PURE__ */ a(
|
|
243
|
+
Q,
|
|
213
244
|
{
|
|
214
245
|
source: "file",
|
|
215
246
|
file: e,
|
|
216
|
-
uploaded:
|
|
247
|
+
uploaded: c,
|
|
217
248
|
progress: o == null ? void 0 : o.progress,
|
|
218
249
|
disabled: p,
|
|
219
|
-
readOnly:
|
|
220
|
-
error:
|
|
221
|
-
note:
|
|
250
|
+
readOnly: g,
|
|
251
|
+
error: S == null ? void 0 : S.get(e),
|
|
252
|
+
note: F == null ? void 0 : F.get(e),
|
|
222
253
|
onError: t,
|
|
223
|
-
size:
|
|
254
|
+
size: P,
|
|
224
255
|
onDelete: () => {
|
|
225
256
|
try {
|
|
226
|
-
|
|
227
|
-
const
|
|
228
|
-
return
|
|
229
|
-
}),
|
|
230
|
-
} catch (
|
|
231
|
-
const
|
|
232
|
-
t == null || t(
|
|
257
|
+
b(!1), N(!1), _((l) => {
|
|
258
|
+
const r = l.filter((d, ce) => ce !== s);
|
|
259
|
+
return u == null || u(r), r;
|
|
260
|
+
}), w == null || w(e, s);
|
|
261
|
+
} catch (l) {
|
|
262
|
+
const r = l instanceof Error ? l.message : f.fileUpload.deleteError;
|
|
263
|
+
t == null || t(r, e);
|
|
233
264
|
}
|
|
234
265
|
}
|
|
235
266
|
},
|
|
@@ -240,7 +271,7 @@ const de = G(
|
|
|
240
271
|
] });
|
|
241
272
|
}
|
|
242
273
|
);
|
|
243
|
-
|
|
274
|
+
he.displayName = "FileUpload";
|
|
244
275
|
export {
|
|
245
|
-
|
|
276
|
+
he as FileUpload
|
|
246
277
|
};
|
|
@@ -17,6 +17,8 @@ export declare const Disabled: Story;
|
|
|
17
17
|
export declare const WithErrorsAndHints: Story;
|
|
18
18
|
export declare const ReadOnly: Story;
|
|
19
19
|
export declare const UploadSimulation: Story;
|
|
20
|
+
export declare const WithMaxFiles: Story;
|
|
21
|
+
export declare const WithMaxFilesAndPreselected: Story;
|
|
20
22
|
export declare const PreselectedUrls: Story;
|
|
21
23
|
export declare const MixedFilesAndUrls: Story;
|
|
22
24
|
export declare const SingleFileWithUrl: Story;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FileUpload.stories.d.ts","sourceRoot":"","sources":["../../../src/components/FileUpload/FileUpload.stories.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAE3D,OAAO,EAAE,UAAU,EAAuB,MAAM,cAAc,CAAA;AAE9D,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,UAAU,
|
|
1
|
+
{"version":3,"file":"FileUpload.stories.d.ts","sourceRoot":"","sources":["../../../src/components/FileUpload/FileUpload.stories.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAE3D,OAAO,EAAE,UAAU,EAAuB,MAAM,cAAc,CAAA;AAE9D,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,UAAU,CAgMjC,CAAA;AAED,eAAe,IAAI,CAAA;AACnB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAA;AAElC,eAAO,MAAM,OAAO,EAAE,KAiBrB,CAAA;AAED,eAAO,MAAM,QAAQ,EAAE,KAgBtB,CAAA;AAED,eAAO,MAAM,KAAK,EAAE,KAmBnB,CAAA;AAED,eAAO,MAAM,sBAAsB,EAAE,KAoBpC,CAAA;AAED,eAAO,MAAM,gBAAgB,EAAE,KAsB9B,CAAA;AAED,eAAO,MAAM,aAAa,EAAE,KAkB3B,CAAA;AAED,eAAO,MAAM,UAAU,EAAE,KAiBxB,CAAA;AAED,eAAO,MAAM,mBAAmB,EAAE,KAqBjC,CAAA;AAED,eAAO,MAAM,UAAU,EAAE,KAexB,CAAA;AAED,eAAO,MAAM,aAAa,EAAE,KAiB3B,CAAA;AAED,eAAO,MAAM,QAAQ,EAAE,KAmBtB,CAAA;AAED,eAAO,MAAM,kBAAkB,EAAE,KA0ChC,CAAA;AAED,eAAO,MAAM,QAAQ,EAAE,KAoBtB,CAAA;AAED,eAAO,MAAM,gBAAgB,EAAE,KA0F9B,CAAA;AAED,eAAO,MAAM,YAAY,EAAE,KAiB1B,CAAA;AAED,eAAO,MAAM,0BAA0B,EAAE,KAuBxC,CAAA;AAmBD,eAAO,MAAM,eAAe,EAAE,KA0B7B,CAAA;AAED,eAAO,MAAM,iBAAiB,EAAE,KAoC/B,CAAA;AAED,eAAO,MAAM,iBAAiB,EAAE,KAsB/B,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Textarea.d.ts","sourceRoot":"","sources":["../../../src/components/Textarea/Textarea.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,SAAS,EAKf,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"Textarea.d.ts","sourceRoot":"","sources":["../../../src/components/Textarea/Textarea.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,SAAS,EAKf,MAAM,OAAO,CAAA;AA+Dd,wCAAwC;AACxC,MAAM,WAAW,aAAc,SAAQ,cAAc,CAAC,UAAU,CAAC;IAC/D,uEAAuE;IACvE,MAAM,CAAC,EAAE,MAAM,GAAG,UAAU,GAAG,YAAY,GAAG,MAAM,CAAA;IACpD,+CAA+C;IAC/C,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,6FAA6F;IAC7F,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,mDAAmD;IACnD,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,sFAAsF;IACtF,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,gGAAgG;IAChG,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,+EAA+E;IAC/E,uBAAuB,CAAC,EAAE,OAAO,CAAA;IACjC,0CAA0C;IAC1C,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,yEAAyE;IACzE,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,6EAA6E;IAC7E,UAAU,CAAC,EAAE,SAAS,CAAA;IACtB,gHAAgH;IAChH,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,6HAA6H;IAC7H,kBAAkB,CAAC,EAAE,OAAO,CAAA;CAC7B;AAED,eAAO,MAAM,QAAQ,4HA0GpB,CAAA"}
|
|
@@ -1,22 +1,20 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
import { cva as
|
|
1
|
+
import { jsxs as G, jsx as l } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as H, useId as U, useRef as W, useState as B } from "react";
|
|
3
|
+
import { cva as h } from "class-variance-authority";
|
|
4
4
|
import { FormField as D } from "../FormField/FormField.js";
|
|
5
|
-
import { cn as
|
|
6
|
-
import { typographyVariants as
|
|
7
|
-
const E =
|
|
5
|
+
import { cn as x } from "../../utils/cn.js";
|
|
6
|
+
import { typographyVariants as b } from "../Typography/Typography.js";
|
|
7
|
+
const E = h(
|
|
8
8
|
[
|
|
9
|
-
|
|
9
|
+
b({
|
|
10
10
|
variant: "body",
|
|
11
11
|
weight: "medium",
|
|
12
12
|
size: "base"
|
|
13
13
|
}),
|
|
14
|
-
"w-full
|
|
14
|
+
"w-full font-text text-comp-input-text-primary transition-colors outline-none",
|
|
15
15
|
"placeholder:font-regular placeholder:text-comp-input-text-placeholder",
|
|
16
|
-
"
|
|
17
|
-
"
|
|
18
|
-
"disabled:cursor-not-allowed disabled:border-comp-input-stroke-disabled disabled:bg-comp-input-fill-disabled",
|
|
19
|
-
"outline-none focus:border-comp-input-stroke-focused"
|
|
16
|
+
"mr-[calc(var(--spacing-xl)/2)] pt-xl pr-[calc(var(--spacing-comp-input-p-hor)-var(--spacing-xl)/2)] pb-[calc(var(--spacing-xl)/2)] pl-comp-input-p-hor",
|
|
17
|
+
"disabled:cursor-not-allowed"
|
|
20
18
|
],
|
|
21
19
|
{
|
|
22
20
|
variants: {
|
|
@@ -38,36 +36,57 @@ const E = B(
|
|
|
38
36
|
resize: "none"
|
|
39
37
|
}
|
|
40
38
|
}
|
|
41
|
-
), J =
|
|
39
|
+
), J = h(
|
|
40
|
+
[
|
|
41
|
+
"overflow-hidden rounded-xl border border-comp-input-stroke-def bg-comp-input-fill-def transition-colors",
|
|
42
|
+
"focus-within:border-comp-texteditor-stroke-focused",
|
|
43
|
+
"pb-[calc(var(--spacing-xl)/2)]",
|
|
44
|
+
// Offset scrollbar to make resize handle visible
|
|
45
|
+
"flex"
|
|
46
|
+
],
|
|
47
|
+
{
|
|
48
|
+
variants: {
|
|
49
|
+
state: {
|
|
50
|
+
default: "border-comp-texteditor-stroke-def hover:border-comp-texteditor-stroke-hover",
|
|
51
|
+
disabled: "cursor-not-allowed border-comp-input-stroke-disabled bg-comp-input-fill-disabled",
|
|
52
|
+
error: "border-comp-texteditor-stroke-error"
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
defaultVariants: {
|
|
56
|
+
state: "default"
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
), K = H(
|
|
42
60
|
({
|
|
43
|
-
className:
|
|
44
|
-
label:
|
|
45
|
-
hint:
|
|
46
|
-
id:
|
|
47
|
-
error:
|
|
48
|
-
resize:
|
|
49
|
-
autoResize:
|
|
50
|
-
errorMessage:
|
|
51
|
-
required:
|
|
52
|
-
disableRequiredAsterisk:
|
|
53
|
-
labelExtra:
|
|
54
|
-
infoTooltip:
|
|
55
|
-
showCharacterCount:
|
|
56
|
-
value:
|
|
61
|
+
className: g,
|
|
62
|
+
label: v,
|
|
63
|
+
hint: y,
|
|
64
|
+
id: w,
|
|
65
|
+
error: e,
|
|
66
|
+
resize: z,
|
|
67
|
+
autoResize: s,
|
|
68
|
+
errorMessage: c,
|
|
69
|
+
required: o,
|
|
70
|
+
disableRequiredAsterisk: k,
|
|
71
|
+
labelExtra: I,
|
|
72
|
+
infoTooltip: N,
|
|
73
|
+
showCharacterCount: R,
|
|
74
|
+
value: a,
|
|
57
75
|
defaultValue: d,
|
|
58
|
-
onChange:
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
76
|
+
onChange: n,
|
|
77
|
+
disabled: p,
|
|
78
|
+
...i
|
|
79
|
+
}, u) => {
|
|
80
|
+
const V = U(), r = w ?? V, F = `${r}-hint`, S = `${r}-label`, $ = W(null), m = (typeof u == "function" ? null : u) ?? $, f = a !== void 0, [j, A] = B(
|
|
62
81
|
() => String(d ?? "").length
|
|
63
|
-
), L =
|
|
64
|
-
const t =
|
|
65
|
-
t && (t.style.height = "auto", t.style.height = `${t.scrollHeight
|
|
66
|
-
},
|
|
82
|
+
), L = f ? String(a).length : j, T = () => {
|
|
83
|
+
const t = m.current;
|
|
84
|
+
t && (t.style.height = "auto", t.style.height = `${t.scrollHeight}px`);
|
|
85
|
+
}, C = R && i.maxLength != null ? /* @__PURE__ */ G(
|
|
67
86
|
"span",
|
|
68
87
|
{
|
|
69
|
-
className:
|
|
70
|
-
|
|
88
|
+
className: x(
|
|
89
|
+
b({
|
|
71
90
|
variant: "body",
|
|
72
91
|
weight: "regular",
|
|
73
92
|
size: "sm"
|
|
@@ -77,50 +96,51 @@ const E = B(
|
|
|
77
96
|
children: [
|
|
78
97
|
L,
|
|
79
98
|
"/",
|
|
80
|
-
|
|
99
|
+
i.maxLength
|
|
81
100
|
]
|
|
82
101
|
}
|
|
83
102
|
) : void 0;
|
|
84
|
-
return /* @__PURE__ */
|
|
103
|
+
return /* @__PURE__ */ l(
|
|
85
104
|
D,
|
|
86
105
|
{
|
|
87
|
-
label:
|
|
88
|
-
hint:
|
|
89
|
-
error:
|
|
90
|
-
required:
|
|
91
|
-
disableRequiredAsterisk:
|
|
92
|
-
htmlFor:
|
|
93
|
-
labelId:
|
|
94
|
-
hintId:
|
|
95
|
-
labelExtra:
|
|
96
|
-
infoTooltip:
|
|
97
|
-
labelRight:
|
|
98
|
-
children: /* @__PURE__ */
|
|
106
|
+
label: v,
|
|
107
|
+
hint: e && c ? c : y,
|
|
108
|
+
error: e,
|
|
109
|
+
required: o,
|
|
110
|
+
disableRequiredAsterisk: k,
|
|
111
|
+
htmlFor: r,
|
|
112
|
+
labelId: S,
|
|
113
|
+
hintId: F,
|
|
114
|
+
labelExtra: I,
|
|
115
|
+
infoTooltip: N,
|
|
116
|
+
labelRight: C,
|
|
117
|
+
children: /* @__PURE__ */ l("div", { className: J({ state: p ? "disabled" : e ? "error" : "default" }), children: /* @__PURE__ */ l(
|
|
99
118
|
"textarea",
|
|
100
119
|
{
|
|
101
120
|
"data-slot": "textarea",
|
|
102
|
-
ref:
|
|
103
|
-
id:
|
|
104
|
-
required:
|
|
105
|
-
"aria-required":
|
|
106
|
-
className:
|
|
107
|
-
E({ error:
|
|
108
|
-
|
|
121
|
+
ref: m,
|
|
122
|
+
id: r,
|
|
123
|
+
required: o,
|
|
124
|
+
"aria-required": o,
|
|
125
|
+
className: x(
|
|
126
|
+
E({ error: e, resize: z, autoResize: s }),
|
|
127
|
+
g
|
|
109
128
|
),
|
|
110
|
-
value:
|
|
129
|
+
value: a,
|
|
111
130
|
defaultValue: d,
|
|
112
131
|
onChange: (t) => {
|
|
113
|
-
|
|
132
|
+
f || A(t.target.value.length), n == null || n(t);
|
|
114
133
|
},
|
|
115
|
-
|
|
116
|
-
|
|
134
|
+
disabled: p,
|
|
135
|
+
...i,
|
|
136
|
+
onInput: s ? T : void 0
|
|
117
137
|
}
|
|
118
|
-
)
|
|
138
|
+
) })
|
|
119
139
|
}
|
|
120
140
|
);
|
|
121
141
|
}
|
|
122
142
|
);
|
|
123
|
-
|
|
143
|
+
K.displayName = "Textarea";
|
|
124
144
|
export {
|
|
125
|
-
|
|
145
|
+
K as Textarea
|
|
126
146
|
};
|