@kaanolin/react 1.1.2

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 (112) hide show
  1. package/dist/Badge-BdwYClmA.js +46 -0
  2. package/dist/Badge-D-fw1KUp.cjs +1 -0
  3. package/dist/Button-DeGRO_vB.cjs +1 -0
  4. package/dist/Button-DqS-IYl4.js +412 -0
  5. package/dist/Card-D4IOT1yc.js +218 -0
  6. package/dist/Card-JKuBVmXq.cjs +1 -0
  7. package/dist/DatePickerRange-BPYe2jNs.cjs +1 -0
  8. package/dist/DatePickerRange-DVctX_Qb.js +5029 -0
  9. package/dist/Input-BpWJLED2.js +223 -0
  10. package/dist/Input-CstnV1U8.cjs +1 -0
  11. package/dist/InputGroup-SVC5Ep6J.js +97 -0
  12. package/dist/InputGroup-whgNDsHd.cjs +1 -0
  13. package/dist/Modal-DAyvQW7Z.js +260 -0
  14. package/dist/Modal-DQLhEOJ2.cjs +1 -0
  15. package/dist/Select-1U2YyMRi.cjs +1 -0
  16. package/dist/Select-C2A4HgEF.js +551 -0
  17. package/dist/Textarea-BHhXafu9.js +117 -0
  18. package/dist/Textarea-Ceix8Thf.cjs +1 -0
  19. package/dist/_shared/form-field.styles.d.ts +7 -0
  20. package/dist/_shared/form-field.styles.d.ts.map +1 -0
  21. package/dist/_shared/icons.d.ts +2 -0
  22. package/dist/_shared/icons.d.ts.map +1 -0
  23. package/dist/_shared/index.d.ts +3 -0
  24. package/dist/_shared/index.d.ts.map +1 -0
  25. package/dist/badge/Badge.d.ts +8 -0
  26. package/dist/badge/Badge.d.ts.map +1 -0
  27. package/dist/badge/Badge.styles.d.ts +5 -0
  28. package/dist/badge/Badge.styles.d.ts.map +1 -0
  29. package/dist/badge/index.d.ts +3 -0
  30. package/dist/badge/index.d.ts.map +1 -0
  31. package/dist/badge.cjs +1 -0
  32. package/dist/badge.js +5 -0
  33. package/dist/button/Button.d.ts +22 -0
  34. package/dist/button/Button.d.ts.map +1 -0
  35. package/dist/button/Button.styles.d.ts +21 -0
  36. package/dist/button/Button.styles.d.ts.map +1 -0
  37. package/dist/button/index.d.ts +3 -0
  38. package/dist/button/index.d.ts.map +1 -0
  39. package/dist/button.cjs +1 -0
  40. package/dist/button.js +10 -0
  41. package/dist/card/Card.d.ts +26 -0
  42. package/dist/card/Card.d.ts.map +1 -0
  43. package/dist/card/Card.styles.d.ts +28 -0
  44. package/dist/card/Card.styles.d.ts.map +1 -0
  45. package/dist/card/index.d.ts +3 -0
  46. package/dist/card/index.d.ts.map +1 -0
  47. package/dist/card.cjs +1 -0
  48. package/dist/card.js +20 -0
  49. package/dist/cx-C5SviAs-.cjs +1 -0
  50. package/dist/cx-CMoRfr5S.js +2304 -0
  51. package/dist/date-picker-range/DatePickerRange.d.ts +36 -0
  52. package/dist/date-picker-range/DatePickerRange.d.ts.map +1 -0
  53. package/dist/date-picker-range/DatePickerRange.styles.d.ts +16 -0
  54. package/dist/date-picker-range/DatePickerRange.styles.d.ts.map +1 -0
  55. package/dist/date-picker-range/index.d.ts +3 -0
  56. package/dist/date-picker-range/index.d.ts.map +1 -0
  57. package/dist/date-picker-range.cjs +1 -0
  58. package/dist/date-picker-range.js +11 -0
  59. package/dist/form-field.styles-BHdf4QA5.cjs +1 -0
  60. package/dist/form-field.styles-Bt9srSak.js +32 -0
  61. package/dist/icons-BFvETcdo.js +22 -0
  62. package/dist/icons-jGx5qsVM.cjs +1 -0
  63. package/dist/index.cjs +1 -0
  64. package/dist/index.d.ts +21 -0
  65. package/dist/index.d.ts.map +1 -0
  66. package/dist/index.js +94 -0
  67. package/dist/input/Input.d.ts +22 -0
  68. package/dist/input/Input.d.ts.map +1 -0
  69. package/dist/input/Input.styles.d.ts +18 -0
  70. package/dist/input/Input.styles.d.ts.map +1 -0
  71. package/dist/input/index.d.ts +6 -0
  72. package/dist/input/index.d.ts.map +1 -0
  73. package/dist/input-group/InputGroup.d.ts +36 -0
  74. package/dist/input-group/InputGroup.d.ts.map +1 -0
  75. package/dist/input-group/InputGroup.styles.d.ts +7 -0
  76. package/dist/input-group/InputGroup.styles.d.ts.map +1 -0
  77. package/dist/input-group/index.d.ts +3 -0
  78. package/dist/input-group/index.d.ts.map +1 -0
  79. package/dist/input-group.cjs +1 -0
  80. package/dist/input-group.js +7 -0
  81. package/dist/input.cjs +1 -0
  82. package/dist/input.js +23 -0
  83. package/dist/modal/Modal.d.ts +37 -0
  84. package/dist/modal/Modal.d.ts.map +1 -0
  85. package/dist/modal/Modal.styles.d.ts +16 -0
  86. package/dist/modal/Modal.styles.d.ts.map +1 -0
  87. package/dist/modal/index.d.ts +3 -0
  88. package/dist/modal/index.d.ts.map +1 -0
  89. package/dist/modal.cjs +1 -0
  90. package/dist/modal.js +21 -0
  91. package/dist/select/Select.d.ts +51 -0
  92. package/dist/select/Select.d.ts.map +1 -0
  93. package/dist/select/Select.styles.d.ts +20 -0
  94. package/dist/select/Select.styles.d.ts.map +1 -0
  95. package/dist/select/index.d.ts +3 -0
  96. package/dist/select/index.d.ts.map +1 -0
  97. package/dist/select.cjs +1 -0
  98. package/dist/select.js +14 -0
  99. package/dist/styles/colors.css +391 -0
  100. package/dist/styles/index.css +487 -0
  101. package/dist/styles/shadows.css +32 -0
  102. package/dist/styles/spacing.css +20 -0
  103. package/dist/styles/typography.css +44 -0
  104. package/dist/textarea/Textarea.d.ts +18 -0
  105. package/dist/textarea/Textarea.d.ts.map +1 -0
  106. package/dist/textarea/Textarea.styles.d.ts +6 -0
  107. package/dist/textarea/Textarea.styles.d.ts.map +1 -0
  108. package/dist/textarea/index.d.ts +3 -0
  109. package/dist/textarea/index.d.ts.map +1 -0
  110. package/dist/textarea.cjs +1 -0
  111. package/dist/textarea.js +5 -0
  112. package/package.json +162 -0
@@ -0,0 +1,551 @@
1
+ import { jsxs as k, jsx as o } from "react/jsx-runtime";
2
+ import * as t from "react";
3
+ import { c as n } from "./cx-CMoRfr5S.js";
4
+ import { cva as y } from "class-variance-authority";
5
+ import { r as le, a as oe, l as ae, h as ne } from "./form-field.styles-Bt9srSak.js";
6
+ import { H as ie } from "./icons-BFvETcdo.js";
7
+ const ce = y(
8
+ [
9
+ "flex",
10
+ "w-full",
11
+ "items-center",
12
+ "justify-between",
13
+ "gap-2",
14
+ "rounded-lg",
15
+ "border",
16
+ "border-border-primary",
17
+ "bg-bg-primary",
18
+ "text-text-primary",
19
+ "font-body",
20
+ "shadow-xs",
21
+ "outline-none",
22
+ "transition-colors",
23
+ "cursor-pointer",
24
+ "focus:ring-4"
25
+ ],
26
+ {
27
+ variants: {
28
+ size: {
29
+ small: ["text-sm", "py-2", "px-3", "h-10"],
30
+ medium: ["text-md", "py-2.5", "px-3.5", "h-11"],
31
+ large: ["text-lg", "py-3", "px-4", "h-12"]
32
+ },
33
+ variant: {
34
+ default: ["focus:border-brand-300", "focus:ring-focus-ring/24"],
35
+ error: [
36
+ "border-border-error_subtle",
37
+ "focus:border-border-error",
38
+ "focus:ring-focus-ring-error/24"
39
+ ],
40
+ success: [
41
+ "border-border-brand",
42
+ "focus:border-border-brand_alt",
43
+ "focus:ring-focus-ring/24"
44
+ ]
45
+ },
46
+ disabled: {
47
+ false: null,
48
+ true: [
49
+ "bg-bg-disabled",
50
+ "border-border-disabled",
51
+ "text-text-disabled",
52
+ "cursor-not-allowed",
53
+ "pointer-events-none",
54
+ "shadow-none",
55
+ "focus:ring-0"
56
+ ]
57
+ },
58
+ open: {
59
+ false: null,
60
+ true: ["ring-4", "ring-focus-ring/24", "border-brand-300"]
61
+ }
62
+ },
63
+ compoundVariants: [
64
+ {
65
+ open: !0,
66
+ variant: "error",
67
+ class: ["ring-focus-ring-error/24", "border-border-error"]
68
+ },
69
+ {
70
+ open: !0,
71
+ variant: "success",
72
+ class: ["ring-focus-ring/24", "border-border-brand_alt"]
73
+ }
74
+ ],
75
+ defaultVariants: {
76
+ size: "medium",
77
+ variant: "default",
78
+ disabled: !1,
79
+ open: !1
80
+ }
81
+ }
82
+ ), de = y(
83
+ [
84
+ "size-5",
85
+ "shrink-0",
86
+ "text-fg-quaternary",
87
+ "transition-transform",
88
+ "duration-200"
89
+ ],
90
+ {
91
+ variants: {
92
+ open: {
93
+ false: null,
94
+ true: ["rotate-180"]
95
+ },
96
+ disabled: {
97
+ false: null,
98
+ true: ["text-fg-disabled"]
99
+ }
100
+ },
101
+ defaultVariants: { open: !1, disabled: !1 }
102
+ }
103
+ ), ue = y([
104
+ "absolute",
105
+ "z-50",
106
+ "mt-1",
107
+ "w-full",
108
+ "bg-bg-primary",
109
+ "border",
110
+ "border-border-secondary",
111
+ "rounded-lg",
112
+ "shadow-lg",
113
+ "overflow-hidden",
114
+ "py-1"
115
+ ]), fe = y(["max-h-60", "overflow-y-auto"]), be = y(
116
+ [
117
+ "flex",
118
+ "items-center",
119
+ "justify-between",
120
+ "w-full",
121
+ "px-3.5",
122
+ "py-2.5",
123
+ "text-sm",
124
+ "text-text-primary",
125
+ "cursor-pointer",
126
+ "transition-colors",
127
+ "outline-none"
128
+ ],
129
+ {
130
+ variants: {
131
+ highlighted: {
132
+ false: null,
133
+ true: ["bg-bg-primary_hover"]
134
+ },
135
+ selected: {
136
+ false: null,
137
+ true: null
138
+ },
139
+ disabled: {
140
+ false: null,
141
+ true: [
142
+ "text-text-disabled",
143
+ "cursor-not-allowed",
144
+ "pointer-events-none"
145
+ ]
146
+ }
147
+ },
148
+ defaultVariants: { highlighted: !1, selected: !1, disabled: !1 }
149
+ }
150
+ ), pe = y([
151
+ "px-3.5",
152
+ "py-2",
153
+ "text-xs",
154
+ "font-medium",
155
+ "text-text-tertiary",
156
+ "select-none"
157
+ ]), me = y([
158
+ "border-t",
159
+ "border-border-secondary",
160
+ "my-1"
161
+ ]), F = t.createContext(null);
162
+ function he() {
163
+ const r = t.useContext(F);
164
+ if (!r)
165
+ throw new Error("Select sub-components must be used within <Select>");
166
+ return r;
167
+ }
168
+ const xe = t.forwardRef(
169
+ ({
170
+ value: r,
171
+ defaultValue: i,
172
+ onValueChange: a,
173
+ placeholder: I = "Select...",
174
+ label: v,
175
+ helperText: b,
176
+ tooltip: d,
177
+ isRequired: w,
178
+ hideRequiredIndicator: V,
179
+ className: C,
180
+ id: $,
181
+ children: P,
182
+ onOpenChange: p,
183
+ size: U,
184
+ variant: T,
185
+ disabled: N = !1
186
+ }, J) => {
187
+ const m = $ || t.useId(), K = `${m}-listbox`, [s, _] = t.useState(!1), [Q, X] = t.useState(i), [c, h] = t.useState(null), [, Y] = t.useReducer((e) => e + 1, 0), u = r !== void 0 ? r : Q, j = t.useRef(null), z = t.useRef(null), L = t.useRef(/* @__PURE__ */ new Map()), Z = t.useRef(0), H = t.useRef(""), q = t.useRef(
188
+ void 0
189
+ ), S = t.useCallback(() => Array.from(L.current.values()).filter((e) => !e.disabled).sort((e, l) => e.index - l.index), []), O = t.useCallback(() => {
190
+ if (!u) return null;
191
+ const e = L.current.get(u);
192
+ return (e == null ? void 0 : e.label) ?? null;
193
+ }, [u]), x = t.useCallback(() => {
194
+ _(!1), h(null), p == null || p(!1);
195
+ }, [p]), R = t.useCallback(() => {
196
+ N || (_(!0), p == null || p(!0));
197
+ }, [N, p]);
198
+ t.useEffect(() => {
199
+ if (!s) return;
200
+ const e = S();
201
+ e.length !== 0 && (u && e.some((l) => l.value === u) ? h(u) : h(e[0].value));
202
+ }, [s, u, S]);
203
+ const E = t.useCallback(
204
+ (e) => {
205
+ var l;
206
+ r === void 0 && X(e), a == null || a(e), x(), (l = j.current) == null || l.focus();
207
+ },
208
+ [r, a, x]
209
+ ), A = t.useCallback(
210
+ (e, l, f) => {
211
+ const g = Z.current++;
212
+ return L.current.set(e, {
213
+ value: e,
214
+ label: l,
215
+ disabled: f,
216
+ index: g
217
+ }), Y(), g;
218
+ },
219
+ []
220
+ ), B = t.useCallback((e) => {
221
+ L.current.delete(e);
222
+ }, []);
223
+ t.useEffect(() => {
224
+ if (!s || !c || !z.current) return;
225
+ const e = z.current.querySelector(
226
+ `[data-value="${CSS.escape(c)}"]`
227
+ );
228
+ e && typeof e.scrollIntoView == "function" && e.scrollIntoView({ block: "nearest" });
229
+ }, [s, c]);
230
+ const G = t.useCallback(
231
+ (e) => {
232
+ clearTimeout(q.current), H.current += e.toLowerCase();
233
+ const f = S().find(
234
+ (g) => g.label.toLowerCase().startsWith(H.current)
235
+ );
236
+ f && h(f.value), q.current = setTimeout(() => {
237
+ H.current = "";
238
+ }, 500);
239
+ },
240
+ [S]
241
+ ), W = t.useCallback(
242
+ (e) => {
243
+ var g;
244
+ const l = S(), f = l.findIndex(
245
+ (D) => D.value === c
246
+ );
247
+ switch (e.key) {
248
+ case "ArrowDown": {
249
+ if (e.preventDefault(), !s) {
250
+ R();
251
+ return;
252
+ }
253
+ const D = f < l.length - 1 ? f + 1 : 0;
254
+ h(l[D].value);
255
+ break;
256
+ }
257
+ case "ArrowUp": {
258
+ if (e.preventDefault(), !s) {
259
+ R();
260
+ return;
261
+ }
262
+ const D = f > 0 ? f - 1 : l.length - 1;
263
+ h(l[D].value);
264
+ break;
265
+ }
266
+ case "Enter":
267
+ case " ": {
268
+ if (e.preventDefault(), !s) {
269
+ R();
270
+ return;
271
+ }
272
+ c && E(c);
273
+ break;
274
+ }
275
+ case "Escape": {
276
+ e.preventDefault(), x(), (g = j.current) == null || g.focus();
277
+ break;
278
+ }
279
+ case "Tab": {
280
+ x();
281
+ break;
282
+ }
283
+ case "Home": {
284
+ e.preventDefault(), s && l.length && h(l[0].value);
285
+ break;
286
+ }
287
+ case "End": {
288
+ e.preventDefault(), s && l.length && h(l[l.length - 1].value);
289
+ break;
290
+ }
291
+ default:
292
+ e.key.length === 1 && !e.ctrlKey && !e.metaKey && s && (e.preventDefault(), G(e.key));
293
+ }
294
+ },
295
+ [
296
+ s,
297
+ c,
298
+ S,
299
+ R,
300
+ x,
301
+ E,
302
+ G
303
+ ]
304
+ ), ee = () => {
305
+ s ? x() : R();
306
+ }, M = O(), te = !!M, re = T === "error", se = t.useMemo(
307
+ () => ({
308
+ selectId: m,
309
+ selectedValue: u,
310
+ highlightedValue: c,
311
+ onSelect: E,
312
+ registerItem: A,
313
+ unregisterItem: B
314
+ }),
315
+ [
316
+ m,
317
+ u,
318
+ c,
319
+ E,
320
+ A,
321
+ B
322
+ ]
323
+ );
324
+ return /* @__PURE__ */ k("div", { ref: J, className: "flex w-full flex-col items-start gap-1.5", children: [
325
+ v && /* @__PURE__ */ k("label", { htmlFor: m, className: n(ae()), children: [
326
+ v,
327
+ w && !V && /* @__PURE__ */ o("span", { className: n(le()), children: "*" }),
328
+ d && /* @__PURE__ */ o(
329
+ "span",
330
+ {
331
+ className: n(oe()),
332
+ title: d,
333
+ role: "img",
334
+ "aria-label": d,
335
+ children: /* @__PURE__ */ o(ie, {})
336
+ }
337
+ )
338
+ ] }),
339
+ /* @__PURE__ */ k("div", { className: "relative w-full", children: [
340
+ /* @__PURE__ */ k(
341
+ "button",
342
+ {
343
+ ref: j,
344
+ type: "button",
345
+ id: m,
346
+ role: "combobox",
347
+ "aria-haspopup": "listbox",
348
+ "aria-expanded": s,
349
+ "aria-controls": s ? K : void 0,
350
+ "aria-describedby": b ? `${m}-helper` : void 0,
351
+ "aria-required": w || void 0,
352
+ "aria-invalid": re || void 0,
353
+ disabled: !!N,
354
+ onClick: ee,
355
+ onKeyDown: W,
356
+ className: n(
357
+ ce({
358
+ size: U,
359
+ variant: T,
360
+ disabled: !!N,
361
+ open: s
362
+ }),
363
+ C
364
+ ),
365
+ children: [
366
+ /* @__PURE__ */ o(
367
+ "span",
368
+ {
369
+ className: n(
370
+ "truncate text-left",
371
+ !te && "text-text-placeholder"
372
+ ),
373
+ children: M ?? I
374
+ }
375
+ ),
376
+ /* @__PURE__ */ o(
377
+ we,
378
+ {
379
+ className: n(
380
+ de({ open: s, disabled: !!N })
381
+ )
382
+ }
383
+ )
384
+ ]
385
+ }
386
+ ),
387
+ s && /* @__PURE__ */ o(
388
+ "div",
389
+ {
390
+ className: "fixed inset-0 z-40",
391
+ onClick: x,
392
+ "aria-hidden": "true",
393
+ "data-testid": "select-overlay"
394
+ }
395
+ ),
396
+ /* @__PURE__ */ o(F.Provider, { value: se, children: /* @__PURE__ */ o(
397
+ "ul",
398
+ {
399
+ ref: z,
400
+ id: K,
401
+ role: "listbox",
402
+ "aria-activedescendant": s && c ? `${m}-option-${c}` : void 0,
403
+ tabIndex: -1,
404
+ onKeyDown: W,
405
+ className: n(
406
+ ue(),
407
+ !s && "hidden"
408
+ ),
409
+ "aria-hidden": !s || void 0,
410
+ children: /* @__PURE__ */ o("div", { className: n(fe()), children: P })
411
+ }
412
+ ) })
413
+ ] }),
414
+ b && /* @__PURE__ */ o(
415
+ "p",
416
+ {
417
+ id: `${m}-helper`,
418
+ className: n(ne({ variant: T })),
419
+ children: b
420
+ }
421
+ )
422
+ ] });
423
+ }
424
+ );
425
+ xe.displayName = "Select";
426
+ const ge = t.forwardRef(
427
+ ({ value: r, disabled: i = !1, children: a, className: I, ...v }, b) => {
428
+ const d = he(), w = d.selectedValue === r, V = d.highlightedValue === r, C = typeof a == "string" ? a : typeof a == "number" ? String(a) : r;
429
+ t.useEffect(() => (d.registerItem(r, C, i), () => d.unregisterItem(r)), [r, C, i]);
430
+ const $ = () => {
431
+ i || d.onSelect(r);
432
+ };
433
+ return /* @__PURE__ */ k(
434
+ "li",
435
+ {
436
+ ref: b,
437
+ id: `${d.selectId}-option-${r}`,
438
+ role: "option",
439
+ "aria-selected": w,
440
+ "aria-disabled": i || void 0,
441
+ "data-value": r,
442
+ onClick: $,
443
+ className: n(
444
+ be({
445
+ highlighted: V,
446
+ selected: w,
447
+ disabled: i
448
+ }),
449
+ I
450
+ ),
451
+ ...v,
452
+ children: [
453
+ /* @__PURE__ */ o("span", { className: "truncate", children: a }),
454
+ w && /* @__PURE__ */ o(
455
+ Se,
456
+ {
457
+ className: "size-5 shrink-0 text-brand-600",
458
+ "aria-hidden": "true"
459
+ }
460
+ )
461
+ ]
462
+ }
463
+ );
464
+ }
465
+ );
466
+ ge.displayName = "SelectItem";
467
+ const ye = t.forwardRef(
468
+ ({ label: r, children: i, className: a, ...I }, v) => {
469
+ const b = t.useId();
470
+ return /* @__PURE__ */ k(
471
+ "div",
472
+ {
473
+ ref: v,
474
+ role: "group",
475
+ "aria-labelledby": b,
476
+ ...I,
477
+ children: [
478
+ /* @__PURE__ */ o(
479
+ "div",
480
+ {
481
+ id: b,
482
+ className: n(pe(), a),
483
+ children: r
484
+ }
485
+ ),
486
+ i
487
+ ]
488
+ }
489
+ );
490
+ }
491
+ );
492
+ ye.displayName = "SelectGroup";
493
+ const ve = t.forwardRef(({ className: r, ...i }, a) => /* @__PURE__ */ o(
494
+ "hr",
495
+ {
496
+ ref: a,
497
+ className: n(me(), r),
498
+ "aria-hidden": "true",
499
+ ...i
500
+ }
501
+ ));
502
+ ve.displayName = "SelectSeparator";
503
+ function we(r) {
504
+ return /* @__PURE__ */ o(
505
+ "svg",
506
+ {
507
+ width: "20",
508
+ height: "20",
509
+ viewBox: "0 0 24 24",
510
+ fill: "none",
511
+ stroke: "currentColor",
512
+ strokeWidth: "2",
513
+ strokeLinecap: "round",
514
+ strokeLinejoin: "round",
515
+ "aria-hidden": "true",
516
+ ...r,
517
+ children: /* @__PURE__ */ o("polyline", { points: "6 9 12 15 18 9" })
518
+ }
519
+ );
520
+ }
521
+ function Se(r) {
522
+ return /* @__PURE__ */ o(
523
+ "svg",
524
+ {
525
+ width: "20",
526
+ height: "20",
527
+ viewBox: "0 0 24 24",
528
+ fill: "none",
529
+ stroke: "currentColor",
530
+ strokeWidth: "2",
531
+ strokeLinecap: "round",
532
+ strokeLinejoin: "round",
533
+ "aria-hidden": "true",
534
+ ...r,
535
+ children: /* @__PURE__ */ o("polyline", { points: "20 6 9 17 4 12" })
536
+ }
537
+ );
538
+ }
539
+ export {
540
+ xe as S,
541
+ ye as a,
542
+ ge as b,
543
+ ve as c,
544
+ fe as d,
545
+ ue as e,
546
+ pe as f,
547
+ be as g,
548
+ me as h,
549
+ ce as i,
550
+ de as s
551
+ };
@@ -0,0 +1,117 @@
1
+ import { jsxs as n, jsx as r } from "react/jsx-runtime";
2
+ import * as c from "react";
3
+ import { c as e } from "./cx-CMoRfr5S.js";
4
+ import { cva as h } from "class-variance-authority";
5
+ import { r as v, a as N, l as w, h as S } from "./form-field.styles-Bt9srSak.js";
6
+ import { H as z } from "./icons-BFvETcdo.js";
7
+ const I = h(
8
+ [
9
+ "flex",
10
+ "w-full",
11
+ "rounded-lg",
12
+ "border",
13
+ "border-border-primary",
14
+ "bg-bg-primary",
15
+ "text-text-primary",
16
+ "font-body",
17
+ "shadow-xs",
18
+ "outline-none",
19
+ "transition-colors",
20
+ "resize-y",
21
+ "placeholder:text-text-placeholder",
22
+ "focus:ring-4"
23
+ ],
24
+ {
25
+ variants: {
26
+ size: {
27
+ small: ["text-sm", "py-2", "px-3"],
28
+ medium: ["text-md", "py-2.5", "px-3.5"],
29
+ large: ["text-lg", "py-3", "px-4"]
30
+ },
31
+ variant: {
32
+ default: ["focus:border-brand-300", "focus:ring-focus-ring/24"],
33
+ error: [
34
+ "border-border-error_subtle",
35
+ "focus:border-border-error",
36
+ "focus:ring-focus-ring-error/24"
37
+ ],
38
+ success: [
39
+ "border-border-brand",
40
+ "focus:border-border-brand_alt",
41
+ "focus:ring-focus-ring/24"
42
+ ]
43
+ },
44
+ disabled: {
45
+ false: null,
46
+ true: [
47
+ "bg-bg-disabled",
48
+ "border-border-disabled",
49
+ "text-text-disabled",
50
+ "cursor-not-allowed",
51
+ "pointer-events-none",
52
+ "shadow-none",
53
+ "resize-none",
54
+ "focus:ring-0"
55
+ ]
56
+ }
57
+ },
58
+ defaultVariants: {
59
+ size: "medium",
60
+ variant: "default",
61
+ disabled: !1
62
+ }
63
+ }
64
+ ), T = c.forwardRef(
65
+ ({
66
+ className: b,
67
+ size: m,
68
+ variant: s,
69
+ disabled: d = !1,
70
+ label: t,
71
+ helperText: o,
72
+ id: f,
73
+ tooltip: l,
74
+ isRequired: i,
75
+ hideRequiredIndicator: u,
76
+ rows: p = 4,
77
+ ...x
78
+ }, g) => {
79
+ const a = f || c.useId(), y = s === "error";
80
+ return /* @__PURE__ */ n("div", { className: "flex w-full flex-col items-start gap-1.5", children: [
81
+ t && /* @__PURE__ */ n("label", { htmlFor: a, className: e(w()), children: [
82
+ t,
83
+ i && !u && /* @__PURE__ */ r("span", { className: e(v()), children: "*" }),
84
+ l && /* @__PURE__ */ r(
85
+ "span",
86
+ {
87
+ className: e(N()),
88
+ title: l,
89
+ role: "img",
90
+ "aria-label": l,
91
+ children: /* @__PURE__ */ r(z, {})
92
+ }
93
+ )
94
+ ] }),
95
+ /* @__PURE__ */ r(
96
+ "textarea",
97
+ {
98
+ id: a,
99
+ className: e(I({ size: m, variant: s, disabled: !!d }), b),
100
+ ref: g,
101
+ rows: p,
102
+ disabled: !!d,
103
+ required: i || void 0,
104
+ "aria-invalid": y || void 0,
105
+ "aria-describedby": o ? `${a}-helper` : void 0,
106
+ ...x
107
+ }
108
+ ),
109
+ o && /* @__PURE__ */ r("p", { id: `${a}-helper`, className: e(S({ variant: s })), children: o })
110
+ ] });
111
+ }
112
+ );
113
+ T.displayName = "Textarea";
114
+ export {
115
+ T,
116
+ I as t
117
+ };
@@ -0,0 +1 @@
1
+ "use strict";const s=require("react/jsx-runtime"),v=require("react"),o=require("./cx-C5SviAs-.cjs"),N=require("class-variance-authority"),i=require("./form-field.styles-BHdf4QA5.cjs"),S=require("./icons-jGx5qsVM.cjs");function q(r){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const e in r)if(e!=="default"){const a=Object.getOwnPropertyDescriptor(r,e);Object.defineProperty(t,e,a.get?a:{enumerable:!0,get:()=>r[e]})}}return t.default=r,Object.freeze(t)}const b=q(v),x=N.cva(["flex","w-full","rounded-lg","border","border-border-primary","bg-bg-primary","text-text-primary","font-body","shadow-xs","outline-none","transition-colors","resize-y","placeholder:text-text-placeholder","focus:ring-4"],{variants:{size:{small:["text-sm","py-2","px-3"],medium:["text-md","py-2.5","px-3.5"],large:["text-lg","py-3","px-4"]},variant:{default:["focus:border-brand-300","focus:ring-focus-ring/24"],error:["border-border-error_subtle","focus:border-border-error","focus:ring-focus-ring-error/24"],success:["border-border-brand","focus:border-border-brand_alt","focus:ring-focus-ring/24"]},disabled:{false:null,true:["bg-bg-disabled","border-border-disabled","text-text-disabled","cursor-not-allowed","pointer-events-none","shadow-none","resize-none","focus:ring-0"]}},defaultVariants:{size:"medium",variant:"default",disabled:!1}}),f=b.forwardRef(({className:r,size:t,variant:e,disabled:a=!1,label:d,helperText:n,id:m,tooltip:c,isRequired:u,hideRequiredIndicator:p,rows:g=4,...y},h)=>{const l=m||b.useId(),j=e==="error";return s.jsxs("div",{className:"flex w-full flex-col items-start gap-1.5",children:[d&&s.jsxs("label",{htmlFor:l,className:o.cx(i.labelStyles()),children:[d,u&&!p&&s.jsx("span",{className:o.cx(i.requiredIndicatorStyles()),children:"*"}),c&&s.jsx("span",{className:o.cx(i.labelTooltipStyles()),title:c,role:"img","aria-label":c,children:s.jsx(S.HelpCircleIcon,{})})]}),s.jsx("textarea",{id:l,className:o.cx(x({size:t,variant:e,disabled:!!a}),r),ref:h,rows:g,disabled:!!a,required:u||void 0,"aria-invalid":j||void 0,"aria-describedby":n?`${l}-helper`:void 0,...y}),n&&s.jsx("p",{id:`${l}-helper`,className:o.cx(i.helperTextStyles({variant:e})),children:n})]})});f.displayName="Textarea";exports.Textarea=f;exports.textareaStyles=x;
@@ -0,0 +1,7 @@
1
+ export declare const labelStyles: (props?: import('class-variance-authority/types').ClassProp | undefined) => string;
2
+ export declare const requiredIndicatorStyles: (props?: import('class-variance-authority/types').ClassProp | undefined) => string;
3
+ export declare const labelTooltipStyles: (props?: import('class-variance-authority/types').ClassProp | undefined) => string;
4
+ export declare const helperTextStyles: (props?: ({
5
+ variant?: "default" | "error" | "success" | null | undefined;
6
+ } & import('class-variance-authority/types').ClassProp) | undefined) => string;
7
+ //# sourceMappingURL=form-field.styles.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"form-field.styles.d.ts","sourceRoot":"","sources":["../../src/_shared/form-field.styles.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,WAAW,oFAQtB,CAAC;AAEH,eAAO,MAAM,uBAAuB,oFAA+B,CAAC;AAEpE,eAAO,MAAM,kBAAkB,oFAK7B,CAAC;AAIH,eAAO,MAAM,gBAAgB;;8EAW3B,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare const HelpCircleIcon: () => import("react/jsx-runtime").JSX.Element;
2
+ //# sourceMappingURL=icons.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"icons.d.ts","sourceRoot":"","sources":["../../src/_shared/icons.tsx"],"names":[],"mappings":"AAAA,eAAO,MAAM,cAAc,+CAe1B,CAAC"}
@@ -0,0 +1,3 @@
1
+ export { labelStyles, requiredIndicatorStyles, labelTooltipStyles, helperTextStyles, } from './form-field.styles';
2
+ export { HelpCircleIcon } from './icons';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/_shared/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,uBAAuB,EACvB,kBAAkB,EAClB,gBAAgB,GACjB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC"}