inconel 0.1.0

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/index.js ADDED
@@ -0,0 +1,767 @@
1
+ import { jsx as s, jsxs as k } from "react/jsx-runtime";
2
+ import { forwardRef as ze, useId as Me, useState as F, useRef as xe, useMemo as Ae, useEffect as G, useCallback as ae, useImperativeHandle as Qe } from "react";
3
+ import { useFloating as Re, autoUpdate as Ze, offset as en, flip as nn, shift as tn, size as rn } from "@floating-ui/react";
4
+ import { useVirtualizer as ln } from "@tanstack/react-virtual";
5
+ import { createPortal as on } from "react-dom";
6
+ function Ce({
7
+ hint: t,
8
+ errorMessage: c,
9
+ hintId: l,
10
+ errorId: i,
11
+ className: o
12
+ }) {
13
+ return c ? /* @__PURE__ */ s(
14
+ "p",
15
+ {
16
+ id: i,
17
+ className: ["inconel-field-feedback", "is-error", o ?? ""].join(
18
+ " "
19
+ ),
20
+ role: "alert",
21
+ children: c
22
+ }
23
+ ) : t ? /* @__PURE__ */ s(
24
+ "p",
25
+ {
26
+ id: l,
27
+ className: ["inconel-field-feedback", "is-hint", o ?? ""].join(
28
+ " "
29
+ ),
30
+ children: t
31
+ }
32
+ ) : null;
33
+ }
34
+ const cn = [
35
+ "number",
36
+ "currency",
37
+ "percent"
38
+ ], sn = [
39
+ "text",
40
+ "email",
41
+ "password"
42
+ ];
43
+ function ie(t) {
44
+ return cn.some((c) => c === t);
45
+ }
46
+ function Ke(t) {
47
+ return sn.some((c) => c === t);
48
+ }
49
+ function Xe(t) {
50
+ const c = new Intl.NumberFormat(t).formatToParts(1000.1);
51
+ return {
52
+ group: c.find((l) => l.type === "group")?.value ?? ".",
53
+ decimal: c.find((l) => l.type === "decimal")?.value ?? ","
54
+ };
55
+ }
56
+ function an(t, c) {
57
+ if (!t || t === "-") return null;
58
+ const { group: l, decimal: i } = Xe(c), o = t.split(l).join("").replace(i, "."), u = Number(o);
59
+ return Number.isNaN(u) ? null : u;
60
+ }
61
+ function un(t, c, l) {
62
+ const i = 10 ** c;
63
+ return l === "ceil" ? Math.ceil(t * i) / i : l === "round" ? Math.round(t * i) / i : t >= 0 ? Math.floor(t * i) / i : Math.ceil(t * i) / i;
64
+ }
65
+ function _e(t, c) {
66
+ const l = String(t ?? "").replace(/\D/g, "");
67
+ let i = 0, o = "";
68
+ for (const u of c)
69
+ if (u === "X") {
70
+ if (i >= l.length) break;
71
+ o += l[i++];
72
+ } else i < l.length && (o += u);
73
+ return o;
74
+ }
75
+ function Ye(t, c, l, i, o, u) {
76
+ return t == null || t === "" ? "" : c === "phone" && u ? _e(t, u) : !ie(c) || typeof t != "number" || Number.isNaN(t) ? String(t) : new Intl.NumberFormat(l, {
77
+ style: c === "currency" ? "currency" : c === "percent" ? "percent" : "decimal",
78
+ currency: c === "currency" ? o : void 0,
79
+ minimumFractionDigits: i,
80
+ maximumFractionDigits: i
81
+ }).format(t);
82
+ }
83
+ function dn(t, {
84
+ required: c,
85
+ type: l,
86
+ min: i,
87
+ max: o,
88
+ mask: u,
89
+ messages: m
90
+ }) {
91
+ if (c && (t == null || t === ""))
92
+ return m.required ?? null;
93
+ if (t == null || t === "")
94
+ return null;
95
+ if (l === "email" && !/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(String(t)))
96
+ return m.invalidEmail ?? null;
97
+ if (l === "phone") {
98
+ const I = String(t).replace(/\D/g, ""), T = u ? (u.match(/X/g) ?? []).length : I.startsWith("0") ? 11 : 10;
99
+ if (I.length !== T) return m.invalidPhone ?? null;
100
+ }
101
+ if (Ke(l)) {
102
+ if (typeof i == "number" && String(t).length < i)
103
+ return m.minLength?.replace("{min}", String(i)) ?? null;
104
+ if (typeof o == "number" && String(t).length > o)
105
+ return m.maxLength?.replace("{max}", String(o)) ?? null;
106
+ }
107
+ if (ie(l)) {
108
+ if (typeof t != "number" || Number.isNaN(t))
109
+ return m.invalidNumber ?? null;
110
+ if (typeof i == "number" && t < i)
111
+ return m.minNumber?.replace("{min}", String(i)) ?? null;
112
+ if (typeof o == "number" && t > o)
113
+ return m.maxNumber?.replace("{max}", String(o)) ?? null;
114
+ }
115
+ return null;
116
+ }
117
+ const yn = ze(function({
118
+ id: c,
119
+ label: l,
120
+ hint: i,
121
+ errorMessage: o,
122
+ startAdornment: u,
123
+ endAdornment: m,
124
+ fullWidth: I = !1,
125
+ inputClassName: T,
126
+ labelClassName: D,
127
+ className: O,
128
+ required: M,
129
+ disabled: h,
130
+ value: V,
131
+ defaultValue: C = "",
132
+ onChange: $,
133
+ onBlur: S,
134
+ onFocus: Y,
135
+ onKeyDown: W,
136
+ onMouseEnter: J,
137
+ onMouseLeave: ke,
138
+ type: p = "text",
139
+ locale: K = "tr-TR",
140
+ currency: Q = "TRY",
141
+ decimalScale: R = 0,
142
+ roundMode: Te = "floor",
143
+ roundOnBlur: le = !1,
144
+ min: H,
145
+ max: oe,
146
+ allowNegative: ue = !1,
147
+ debounceMs: de = 0,
148
+ validateOnSubmit: fe = !1,
149
+ validationMessages: y,
150
+ mask: a,
151
+ limit: j,
152
+ isClearable: Ve = !1,
153
+ readOnly: pe = !1,
154
+ clearButtonLabel: me,
155
+ readOnlyEmptyValue: $e = null,
156
+ autoComplete: B = "off",
157
+ "aria-describedby": he,
158
+ ...ge
159
+ }, be) {
160
+ const ye = Me(), X = c ?? `inconel-input-${ye.replace(/:/g, "")}`, P = `${X}-hint`, Z = `${X}-error`, d = V !== void 0, [Ie, L] = F(C), g = d ? V : Ie, [b, w] = F(""), [je, we] = F(!1), [Be, ee] = F(null), A = xe(null), Ne = y ?? {}, N = o ?? Be, U = (n) => dn(n, {
161
+ required: !!M,
162
+ type: p,
163
+ min: H,
164
+ max: oe,
165
+ mask: a,
166
+ messages: Ne
167
+ }), q = Ae(
168
+ () => Ye(
169
+ g,
170
+ p,
171
+ K,
172
+ R,
173
+ Q,
174
+ a
175
+ ),
176
+ [g, Q, R, K, a, p]
177
+ ), x = (n, f, v = null) => ({
178
+ rawValue: n,
179
+ formattedValue: Ye(
180
+ n,
181
+ p,
182
+ K,
183
+ R,
184
+ Q,
185
+ a
186
+ ),
187
+ error: !!U(n),
188
+ char: v,
189
+ eventType: f
190
+ }), _ = (n, f = !1) => {
191
+ d || L(n.rawValue), A.current && clearTimeout(A.current), $ && (f || de <= 0 ? $(n) : A.current = setTimeout(() => $(n), de));
192
+ };
193
+ G(() => () => {
194
+ A.current && clearTimeout(A.current);
195
+ }, []), G(() => {
196
+ fe && ee(U(g));
197
+ }, [fe]);
198
+ const ne = (n) => {
199
+ if (p === "phone" && a) return n.replace(/\D/g, "");
200
+ if (ie(p)) {
201
+ const f = an(n, K);
202
+ return f === null ? n === "" ? null : n : ue ? f : Math.abs(f);
203
+ }
204
+ return n;
205
+ }, ce = (n) => {
206
+ const f = n.replace(/\D/g, "");
207
+ if (j && (ie(p) || p === "phone") && f.length > j || j && Ke(p) && n.length > j) return;
208
+ const v = ne(n);
209
+ typeof v == "number" && (typeof H == "number" && v < H || typeof oe == "number" && v > oe) || (w(
210
+ p === "phone" && a ? _e(v, a) : n
211
+ ), _(x(v, "change", n.slice(-1) || null)));
212
+ }, Fe = [
213
+ he,
214
+ i && !N ? P : void 0,
215
+ N ? Z : void 0
216
+ ].filter(Boolean).join(" ") || void 0;
217
+ return pe ? /* @__PURE__ */ k("div", { className: ["inconel-field", I ? "inconel-field--full-width" : "", O ?? ""].join(" "), children: [
218
+ l && /* @__PURE__ */ s("span", { className: ["inconel-field__label", D ?? ""].join(" "), children: l }),
219
+ /* @__PURE__ */ s("div", { className: "inconel-input-readonly", "aria-label": l, children: q || $e })
220
+ ] }) : /* @__PURE__ */ k("div", { className: ["inconel-field", I ? "inconel-field--full-width" : "", O ?? ""].join(" "), children: [
221
+ l && /* @__PURE__ */ k("label", { className: ["inconel-field__label", D ?? ""].join(" "), htmlFor: X, children: [
222
+ l,
223
+ M && /* @__PURE__ */ s("span", { className: "inconel-field__required", "aria-hidden": "true", children: " *" })
224
+ ] }),
225
+ /* @__PURE__ */ k("div", { className: ["inconel-input-control", N ? "is-invalid" : "", h ? "is-disabled" : ""].join(" "), children: [
226
+ u && /* @__PURE__ */ s("span", { className: "inconel-input-adornment", "aria-hidden": "true", children: u }),
227
+ /* @__PURE__ */ s(
228
+ "input",
229
+ {
230
+ ...ge,
231
+ ref: be,
232
+ id: X,
233
+ type: p === "password" || p === "email" ? p : "text",
234
+ inputMode: ie(p) ? "decimal" : p === "phone" ? "tel" : void 0,
235
+ value: je ? b : q,
236
+ required: M,
237
+ disabled: h,
238
+ autoComplete: B,
239
+ "aria-invalid": !!N,
240
+ "aria-describedby": Fe,
241
+ className: ["inconel-input", T ?? ""].join(" "),
242
+ onChange: (n) => ce(n.target.value),
243
+ onFocus: (n) => {
244
+ if (h) return;
245
+ we(!0);
246
+ const f = p === "phone" && a ? _e(g, a) : ie(p) ? String(g ?? "").replace(".", Xe(K).decimal) : String(g ?? "");
247
+ w(f), Y?.(x(g, "focus"), n);
248
+ },
249
+ onBlur: (n) => {
250
+ we(!1), A.current && clearTimeout(A.current);
251
+ let f = ne(b);
252
+ typeof f == "number" && (f = un(f, R, le ? Te : "floor")), ee(U(f));
253
+ const v = x(f, "blur");
254
+ _(v, !0), S?.(v, n);
255
+ },
256
+ onKeyDown: (n) => {
257
+ !ue && (n.key === "-" || n.key === "Subtract") && n.preventDefault(), W?.(x(g, "keydown", n.key), n);
258
+ },
259
+ onMouseEnter: (n) => J?.(x(g, "mouseenter"), n),
260
+ onMouseLeave: (n) => ke?.(x(g, "mouseleave"), n)
261
+ }
262
+ ),
263
+ Ve && !h && q && me && /* @__PURE__ */ s(
264
+ "button",
265
+ {
266
+ type: "button",
267
+ className: "inconel-input-clear",
268
+ "aria-label": me,
269
+ onClick: () => {
270
+ w(""), ee(U(null)), _(x(null, "clear"), !0);
271
+ },
272
+ children: "×"
273
+ }
274
+ ),
275
+ m && /* @__PURE__ */ s("span", { className: "inconel-input-adornment", "aria-hidden": "true", children: m })
276
+ ] }),
277
+ /* @__PURE__ */ s(
278
+ Ce,
279
+ {
280
+ hint: i,
281
+ errorMessage: N,
282
+ hintId: P,
283
+ errorId: Z
284
+ }
285
+ )
286
+ ] });
287
+ });
288
+ function z(...t) {
289
+ return t.filter(Boolean).join(" ");
290
+ }
291
+ function fn({
292
+ id: t,
293
+ name: c,
294
+ label: l,
295
+ options: i,
296
+ value: o,
297
+ onChange: u,
298
+ optionLabel: m,
299
+ optionValue: I,
300
+ getOptionSearchText: T,
301
+ isOptionDisabled: D = () => !1,
302
+ placeholder: O,
303
+ isClearable: M = !1,
304
+ isDisabled: h = !1,
305
+ isReadOnly: V = !1,
306
+ isRequired: C = !1,
307
+ isLoading: $ = !1,
308
+ loadOptions: S,
309
+ loadOptionsDebounceMs: Y = 250,
310
+ hint: W,
311
+ errorMessage: J,
312
+ asyncErrorMessage: ke,
313
+ loadingMessage: p,
314
+ noOptionsMessage: K,
315
+ clearButtonLabel: Q,
316
+ openMenuButtonLabel: R,
317
+ closeMenuButtonLabel: Te,
318
+ searchLocale: le,
319
+ menuPortalTarget: H,
320
+ virtualize: oe = !1,
321
+ virtualizationThreshold: ue = 100,
322
+ optionHeight: de = 44,
323
+ className: fe,
324
+ classNames: y = {},
325
+ styles: a = {},
326
+ onInputChange: j,
327
+ onMenuOpen: Ve,
328
+ onMenuClose: pe
329
+ }, me) {
330
+ const $e = Me(), B = t ?? `inconel-select-${$e.replace(/:/g, "")}`, he = `${B}-label`, ge = `${B}-listbox`, be = `${B}-message`, ye = `${B}-hint`, X = xe(null), P = xe(null), Z = xe(null), [d, Ie] = F(!1), [L, g] = F(""), [b, w] = F(0), [je, we] = F(null), [Be, ee] = F(!1), [A, Ne] = F(!1);
331
+ G(() => {
332
+ if (!S) return;
333
+ const e = new AbortController(), r = window.setTimeout(async () => {
334
+ ee(!0), Ne(!1);
335
+ try {
336
+ const E = await S(
337
+ L,
338
+ e.signal
339
+ );
340
+ e.signal.aborted || we(E);
341
+ } catch {
342
+ e.signal.aborted || Ne(!0);
343
+ } finally {
344
+ e.signal.aborted || ee(!1);
345
+ }
346
+ }, Y);
347
+ return () => {
348
+ window.clearTimeout(r), e.abort();
349
+ };
350
+ }, [L, S, Y]);
351
+ const N = S ? je ?? i : i, U = $ || Be, q = ae(
352
+ (e) => typeof m == "function" ? m(e) : String(e[m]),
353
+ [m]
354
+ ), x = ae(
355
+ (e) => {
356
+ if (T) return T(e);
357
+ const r = q(e);
358
+ return typeof r == "string" || typeof r == "number" ? String(r) : "";
359
+ },
360
+ [q, T]
361
+ ), _ = ae(
362
+ (e) => {
363
+ const r = typeof I == "function" ? I(e) : e[I];
364
+ if (typeof r != "string" && typeof r != "number")
365
+ throw new TypeError("optionValue must resolve to a string or number.");
366
+ return r;
367
+ },
368
+ [I]
369
+ ), ne = Ae(() => {
370
+ const e = /* @__PURE__ */ new Set();
371
+ return N.map(_).filter((r) => e.has(r) ? !0 : (e.add(r), !1));
372
+ }, [N, _]);
373
+ G(() => {
374
+ ne.length && console.warn(
375
+ `Duplicate optionValue found in Select "${l}":`,
376
+ ne
377
+ );
378
+ }, [ne, l]);
379
+ const ce = [...i, ...N].find(
380
+ (e) => _(e) === o
381
+ ), Fe = ce ? x(ce) : "", n = Ae(() => {
382
+ const e = L.trim().toLocaleLowerCase(le);
383
+ return !e || S ? N : N.filter(
384
+ (r) => x(r).toLocaleLowerCase(le).includes(e)
385
+ );
386
+ }, [N, x, L, S, le]), { refs: f, floatingStyles: v } = Re({
387
+ open: d,
388
+ placement: "bottom-start",
389
+ strategy: H ? "fixed" : "absolute",
390
+ whileElementsMounted: Ze,
391
+ middleware: [
392
+ en(8),
393
+ nn({ padding: 12 }),
394
+ tn({ padding: 12 }),
395
+ rn({
396
+ padding: 12,
397
+ apply({ availableHeight: e, rects: r, elements: E }) {
398
+ Object.assign(E.floating.style, {
399
+ maxHeight: `${Math.min(230, e)}px`,
400
+ width: `${r.reference.width}px`
401
+ });
402
+ }
403
+ })
404
+ ]
405
+ }), ve = oe || n.length >= ue, Ee = ln({
406
+ count: n.length,
407
+ getScrollElement: () => Z.current,
408
+ estimateSize: () => de,
409
+ overscan: 5,
410
+ enabled: ve && d
411
+ }), te = ae(() => {
412
+ Ie(!1), g(""), j?.(""), pe?.();
413
+ }, [j, pe]), se = () => {
414
+ h || V || (d || Ve?.(), Ie(!0));
415
+ }, Se = ae(() => {
416
+ h || V || (u(null, null), g(""), w(0), j?.(""), P.current?.focus());
417
+ }, [h, V, u, j]);
418
+ Qe(
419
+ me,
420
+ () => ({
421
+ focus: () => P.current?.focus(),
422
+ blur: () => P.current?.blur(),
423
+ clear: Se
424
+ }),
425
+ [Se]
426
+ ), G(() => {
427
+ const e = (r) => {
428
+ const E = r.target;
429
+ !X.current?.contains(E) && !Z.current?.contains(E) && te();
430
+ };
431
+ return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
432
+ }, [te]), G(() => {
433
+ b >= n.length && w(0);
434
+ }, [b, n.length]), G(() => {
435
+ ve && d && n[b] && Ee.scrollToIndex(b, { align: "auto" });
436
+ }, [
437
+ b,
438
+ n,
439
+ d,
440
+ ve,
441
+ Ee
442
+ ]);
443
+ const He = (e) => {
444
+ D(e) || (u(_(e), e), te(), P.current?.focus());
445
+ }, qe = (e) => {
446
+ if (!n.length) return;
447
+ let r = b;
448
+ do
449
+ r = (r + e + n.length) % n.length;
450
+ while (D(n[r]) && r !== b);
451
+ w(r);
452
+ }, De = (e = !1) => {
453
+ const r = n.map((E, re) => ({ option: E, index: re }));
454
+ return e && r.reverse(), r.find(({ option: E }) => !D(E))?.index ?? 0;
455
+ }, Ge = (e) => {
456
+ if (e.key === "Backspace" && !L && o !== null && M) {
457
+ e.preventDefault(), Se();
458
+ return;
459
+ }
460
+ if (e.key === "ArrowDown" || e.key === "ArrowUp")
461
+ e.preventDefault(), d ? qe(e.key === "ArrowDown" ? 1 : -1) : (se(), w(De(e.key === "ArrowUp")));
462
+ else if (e.key === "Home" && d)
463
+ e.preventDefault(), w(De());
464
+ else if (e.key === "End" && d)
465
+ e.preventDefault(), w(De(!0));
466
+ else if (e.key === "Enter" && d) {
467
+ e.preventDefault();
468
+ const r = n[b];
469
+ r && He(r);
470
+ } else e.key === "Escape" && d ? (e.preventDefault(), te()) : e.key === "Tab" && te();
471
+ }, Pe = (e, r, E) => {
472
+ const re = _(e), Ue = D(e);
473
+ return /* @__PURE__ */ k(
474
+ "div",
475
+ {
476
+ id: `${B}-option-${r}`,
477
+ role: "option",
478
+ "aria-selected": re === o,
479
+ "aria-disabled": Ue,
480
+ "aria-posinset": r + 1,
481
+ "aria-setsize": n.length,
482
+ className: z(
483
+ "inconel-select-option",
484
+ r === b && "is-active",
485
+ re === o && "is-selected",
486
+ Ue && "is-disabled",
487
+ y.option
488
+ ),
489
+ style: { ...E, ...a.option },
490
+ onMouseEnter: () => w(r),
491
+ onMouseDown: (Je) => Je.preventDefault(),
492
+ onClick: () => He(e),
493
+ children: [
494
+ /* @__PURE__ */ s("span", { children: q(e) }),
495
+ re === o && /* @__PURE__ */ s("span", { "aria-hidden": "true", children: "✓" })
496
+ ]
497
+ },
498
+ re
499
+ );
500
+ }, Oe = U ? /* @__PURE__ */ k(
501
+ "div",
502
+ {
503
+ role: "status",
504
+ className: z("inconel-select-message", y.message),
505
+ style: a.message,
506
+ children: [
507
+ /* @__PURE__ */ s("span", { className: "inconel-select-spinner", "aria-hidden": "true" }),
508
+ p
509
+ ]
510
+ }
511
+ ) : A ? /* @__PURE__ */ s(
512
+ "div",
513
+ {
514
+ role: "alert",
515
+ className: z("inconel-select-message inconel-select-message-error", y.message),
516
+ style: a.message,
517
+ children: ke
518
+ }
519
+ ) : n.length === 0 ? /* @__PURE__ */ s(
520
+ "div",
521
+ {
522
+ className: z("inconel-select-message", y.message),
523
+ style: a.message,
524
+ children: K
525
+ }
526
+ ) : ve ? /* @__PURE__ */ s(
527
+ "div",
528
+ {
529
+ role: "presentation",
530
+ className: "inconel-select-virtual-content",
531
+ style: { height: Ee.getTotalSize() },
532
+ children: Ee.getVirtualItems().map(
533
+ (e) => Pe(n[e.index], e.index, {
534
+ position: "absolute",
535
+ top: 0,
536
+ left: 0,
537
+ width: "100%",
538
+ height: e.size,
539
+ transform: `translateY(${e.start}px)`
540
+ })
541
+ )
542
+ }
543
+ ) : n.map((e, r) => Pe(e, r)), Le = d ? /* @__PURE__ */ s(
544
+ "div",
545
+ {
546
+ ref: (e) => {
547
+ Z.current = e, f.setFloating(e);
548
+ },
549
+ id: ge,
550
+ role: "listbox",
551
+ "aria-labelledby": he,
552
+ className: z(
553
+ "inconel-select-menu",
554
+ H && "inconel-select-menu-portal",
555
+ y.menu
556
+ ),
557
+ style: { ...v, ...a.menu },
558
+ children: Oe
559
+ }
560
+ ) : null, We = J ? be : W ? ye : void 0;
561
+ return /* @__PURE__ */ k(
562
+ "div",
563
+ {
564
+ ref: X,
565
+ className: z("inconel-select-field", fe, y.root),
566
+ style: a.root,
567
+ children: [
568
+ /* @__PURE__ */ k(
569
+ "label",
570
+ {
571
+ id: he,
572
+ htmlFor: B,
573
+ className: y.label,
574
+ style: a.label,
575
+ children: [
576
+ l,
577
+ C && /* @__PURE__ */ s("span", { "aria-hidden": "true", children: " *" })
578
+ ]
579
+ }
580
+ ),
581
+ /* @__PURE__ */ k(
582
+ "div",
583
+ {
584
+ ref: f.setReference,
585
+ className: z(
586
+ "inconel-select-control",
587
+ d && "is-open",
588
+ h && "is-disabled",
589
+ !!J && "has-error",
590
+ y.control
591
+ ),
592
+ style: a.control,
593
+ children: [
594
+ /* @__PURE__ */ s(
595
+ "input",
596
+ {
597
+ ref: P,
598
+ id: B,
599
+ role: "combobox",
600
+ "aria-expanded": d,
601
+ "aria-controls": ge,
602
+ "aria-autocomplete": "list",
603
+ "aria-activedescendant": d && n[b] ? `${B}-option-${b}` : void 0,
604
+ "aria-describedby": We,
605
+ "aria-invalid": !!J,
606
+ "aria-required": C,
607
+ "aria-busy": U,
608
+ required: C,
609
+ disabled: h,
610
+ readOnly: V,
611
+ autoComplete: "off",
612
+ placeholder: O,
613
+ value: L || Fe,
614
+ className: y.input,
615
+ style: a.input,
616
+ onChange: (e) => {
617
+ g(e.target.value), w(0), j?.(e.target.value), se();
618
+ },
619
+ onClick: se,
620
+ onFocus: (e) => {
621
+ se(), ce && !L && e.currentTarget.select();
622
+ },
623
+ onKeyDown: Ge
624
+ }
625
+ ),
626
+ U && /* @__PURE__ */ s("span", { className: "inconel-select-spinner", "aria-hidden": "true" }),
627
+ M && o !== null && !h && !V && Q && /* @__PURE__ */ s(
628
+ "button",
629
+ {
630
+ type: "button",
631
+ className: z("inconel-select-clear", y.clearButton),
632
+ style: a.clearButton,
633
+ "aria-label": Q,
634
+ onClick: Se,
635
+ children: "×"
636
+ }
637
+ ),
638
+ /* @__PURE__ */ s(
639
+ "button",
640
+ {
641
+ type: "button",
642
+ className: z("inconel-select-toggle", y.toggleButton),
643
+ style: a.toggleButton,
644
+ "aria-label": d ? Te : R,
645
+ "aria-expanded": d,
646
+ disabled: h,
647
+ tabIndex: -1,
648
+ onClick: () => d ? te() : se(),
649
+ children: /* @__PURE__ */ s(
650
+ "svg",
651
+ {
652
+ "aria-hidden": "true",
653
+ viewBox: "0 0 20 20",
654
+ width: "20",
655
+ height: "20",
656
+ fill: "none",
657
+ children: /* @__PURE__ */ s(
658
+ "path",
659
+ {
660
+ d: "m5 7.5 5 5 5-5",
661
+ stroke: "currentColor",
662
+ strokeWidth: "1.75",
663
+ strokeLinecap: "round",
664
+ strokeLinejoin: "round"
665
+ }
666
+ )
667
+ }
668
+ )
669
+ }
670
+ )
671
+ ]
672
+ }
673
+ ),
674
+ c && /* @__PURE__ */ s(
675
+ "input",
676
+ {
677
+ type: "hidden",
678
+ name: c,
679
+ value: o ?? "",
680
+ required: C
681
+ }
682
+ ),
683
+ /* @__PURE__ */ s(
684
+ Ce,
685
+ {
686
+ hint: W,
687
+ errorMessage: J,
688
+ hintId: ye,
689
+ errorId: be
690
+ }
691
+ ),
692
+ H && Le ? on(Le, H) : Le
693
+ ]
694
+ }
695
+ );
696
+ }
697
+ const In = ze(fn), wn = ze(
698
+ function({
699
+ id: c,
700
+ label: l,
701
+ hint: i,
702
+ errorMessage: o,
703
+ fullWidth: u = !1,
704
+ resize: m = "vertical",
705
+ className: I,
706
+ required: T,
707
+ disabled: D,
708
+ "aria-describedby": O,
709
+ style: M,
710
+ ...h
711
+ }, V) {
712
+ const C = Me(), $ = c ?? `inconel-textarea-${C.replace(/:/g, "")}`, S = `${$}-hint`, Y = `${$}-error`, W = [
713
+ O,
714
+ i && !o ? S : void 0,
715
+ o ? Y : void 0
716
+ ].filter(Boolean).join(" ") || void 0;
717
+ return /* @__PURE__ */ k(
718
+ "div",
719
+ {
720
+ className: [
721
+ "inconel-field",
722
+ u ? "inconel-field--full-width" : "",
723
+ I ?? ""
724
+ ].join(" "),
725
+ children: [
726
+ l && /* @__PURE__ */ k("label", { className: "inconel-field__label", htmlFor: $, children: [
727
+ l,
728
+ T && /* @__PURE__ */ s("span", { "aria-hidden": "true", children: " *" })
729
+ ] }),
730
+ /* @__PURE__ */ s(
731
+ "textarea",
732
+ {
733
+ ...h,
734
+ ref: V,
735
+ id: $,
736
+ required: T,
737
+ disabled: D,
738
+ "aria-invalid": !!o,
739
+ "aria-describedby": W,
740
+ className: [
741
+ "inconel-textarea",
742
+ o ? "is-invalid" : ""
743
+ ].join(" "),
744
+ style: { ...M, resize: m }
745
+ }
746
+ ),
747
+ /* @__PURE__ */ s(
748
+ Ce,
749
+ {
750
+ hint: i,
751
+ errorMessage: o,
752
+ hintId: S,
753
+ errorId: Y
754
+ }
755
+ )
756
+ ]
757
+ }
758
+ );
759
+ }
760
+ );
761
+ export {
762
+ Ce as FieldFeedback,
763
+ yn as Input,
764
+ In as Select,
765
+ wn as Textarea
766
+ };
767
+ //# sourceMappingURL=index.js.map