@midas-ds/components 15.2.5 → 15.2.7

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.
@@ -0,0 +1,643 @@
1
+ import { jsx as n, jsxs as h } from "react/jsx-runtime";
2
+ import * as P from "react";
3
+ import S, { useMemo as F, useState as V, useCallback as D, useEffect as B, useRef as E } from "react";
4
+ import { c as M } from "./clsx-jbLnTBqA.js";
5
+ import { b as L } from "./utils-BJ6_Ry69.js";
6
+ import { a as O, $ as R, T as j } from "./Tag-DbNUEevV.js";
7
+ import { $ as G } from "./TextField-1_-3gKYa.js";
8
+ import { c as W } from "./Collection-CXAXUgCh.js";
9
+ import { L as H } from "./ListBox-TsgvK95f.js";
10
+ import { b as U, L as q, a as X } from "./ListBoxSection-C-7JFypr.js";
11
+ import { d as J } from "./useHover-BkQu__4t.js";
12
+ import { p as Q, q as Y } from "./Dialog-F3u8agGf.js";
13
+ import { $ as Z, a as ee } from "./ListKeyboardDelegate-RT2g6YNq.js";
14
+ import { h as te } from "./SelectionManager-bnxBDhgb.js";
15
+ import { a as C, c as le, e as ie } from "./mergeProps-oYrDoKjU.js";
16
+ import { $ as oe } from "./filterDOMProps-BSVCO5jK.js";
17
+ import { $ as ae } from "./useField-Bf6sH2Px.js";
18
+ import { $ as ne, a as re, b as se } from "./useFormValidation-BgOffXI-.js";
19
+ import { $ as ce } from "./useListState-DeBExb3v.js";
20
+ import { a as de } from "./VisuallyHidden-BCa6ThRH.js";
21
+ import { a as ue, L as fe } from "./Label-knQhhLVp.js";
22
+ import { T as me } from "./Text-6Fdknq88.js";
23
+ import { C as be } from "./Checkbox-CsITchPQ.js";
24
+ import { X as ge } from "./x-BXShoIAM.js";
25
+ import { u as A } from "./useLocalizedStringFormatter-m7LExKN3.js";
26
+ import { $ as pe } from "./useButton-aiD_OMdm.js";
27
+ import { C as he } from "./chevron-down-DgT-uSF9.js";
28
+ import { $ as ye, F as $e } from "./FieldError-DQ61agyq.js";
29
+ import './assets/Select2.css';function I(e) {
30
+ return null;
31
+ }
32
+ I.getCollectionNode = function* (t, a) {
33
+ let { childItems: r, title: i, children: o } = t, l = t.title || t.children, c = t.textValue || (typeof l == "string" ? l : "") || t["aria-label"] || "";
34
+ !c && !a?.suppressTextValueWarning && process.env.NODE_ENV !== "production" && console.warn("<Item> with non-plain text contents is unsupported by type to select for accessibility. Please add a `textValue` prop."), yield {
35
+ type: "item",
36
+ props: t,
37
+ rendered: l,
38
+ textValue: c,
39
+ "aria-label": t["aria-label"],
40
+ hasChildNodes: ve(t),
41
+ *childNodes() {
42
+ if (r) for (let s of r) yield {
43
+ type: "item",
44
+ value: s
45
+ };
46
+ else if (i) {
47
+ let s = [];
48
+ S.Children.forEach(o, (u) => {
49
+ s.push({
50
+ type: "item",
51
+ element: u
52
+ });
53
+ }), yield* s;
54
+ }
55
+ }
56
+ };
57
+ };
58
+ function ve(e) {
59
+ return e.hasChildItems != null ? e.hasChildItems : !!(e.childItems || e.title && S.Children.count(e.children) > 0);
60
+ }
61
+ let K = I;
62
+ function N(e) {
63
+ return null;
64
+ }
65
+ N.getCollectionNode = function* (t) {
66
+ let { children: a, title: r, items: i } = t;
67
+ yield {
68
+ type: "section",
69
+ props: t,
70
+ hasChildNodes: !0,
71
+ rendered: r,
72
+ "aria-label": t["aria-label"],
73
+ *childNodes() {
74
+ if (typeof a == "function") {
75
+ if (!i) throw new Error("props.children was a function but props.items is missing");
76
+ for (let o of i) yield {
77
+ type: "item",
78
+ value: o,
79
+ renderer: a
80
+ };
81
+ } else {
82
+ let o = [];
83
+ S.Children.forEach(a, (l) => {
84
+ o.push({
85
+ type: "item",
86
+ element: l
87
+ });
88
+ }), yield* o;
89
+ }
90
+ }
91
+ };
92
+ };
93
+ let Se = N;
94
+ const T = ({ item: e }) => /* @__PURE__ */ n(
95
+ q,
96
+ {
97
+ ...e.value,
98
+ textValue: e.textValue,
99
+ "aria-label": e.textValue,
100
+ children: e.rendered
101
+ }
102
+ ), xe = ({ section: e, state: t }) => /* @__PURE__ */ n(U, { ...e.value, children: t.collection.getChildren ? /* @__PURE__ */ n(W, { items: t.collection.getChildren(e.key), children: (a) => /* @__PURE__ */ n(T, { item: a }) }) : null }), we = ({
103
+ state: e,
104
+ ...t
105
+ }) => /* @__PURE__ */ n(
106
+ H,
107
+ {
108
+ ...t,
109
+ ...e,
110
+ escapeKeyBehavior: "none",
111
+ onSelectionChange: e.setSelectedKeys,
112
+ items: e.collection,
113
+ children: (a) => a.type === "section" ? /* @__PURE__ */ n(
114
+ xe,
115
+ {
116
+ state: e,
117
+ section: a
118
+ }
119
+ ) : /* @__PURE__ */ n(T, { item: a })
120
+ }
121
+ );
122
+ function Ce(e, t, a) {
123
+ const { disallowEmptySelection: r, isDisabled: i } = e, o = Z({ usage: "search", sensitivity: "base" }), l = F(
124
+ () => new ee(
125
+ t.collection,
126
+ t.disabledKeys,
127
+ null,
128
+ o
129
+ ),
130
+ [t.collection, t.disabledKeys, o]
131
+ ), { menuTriggerProps: c, menuProps: s } = Q(
132
+ {
133
+ isDisabled: i,
134
+ type: "listbox"
135
+ },
136
+ t,
137
+ a
138
+ ), u = (m) => {
139
+ const { selectedKeys: v, selectionMode: z } = t, w = v.values().next().value;
140
+ if (z === "single")
141
+ switch (m.key) {
142
+ case "ArrowLeft": {
143
+ m.preventDefault();
144
+ const $ = v.size > 0 ? l.getKeyAbove(w) : l.getFirstKey();
145
+ $ && t.setSelectedKeys([$]);
146
+ break;
147
+ }
148
+ case "ArrowRight": {
149
+ m.preventDefault();
150
+ const $ = v.size > 0 ? l.getKeyBelow(w) : l.getFirstKey();
151
+ $ && t.setSelectedKeys([$]);
152
+ break;
153
+ }
154
+ }
155
+ }, { typeSelectProps: d } = te({
156
+ keyboardDelegate: l,
157
+ selectionManager: t.selectionManager,
158
+ onTypeSelect(m) {
159
+ t.setSelectedKeys([m]);
160
+ }
161
+ }), { labelProps: y, fieldProps: g } = ae({
162
+ ...e,
163
+ labelElementType: "span"
164
+ });
165
+ d.onKeyDown = d.onKeyDownCapture, delete d.onKeyDownCapture;
166
+ const f = oe(e, { labelable: !0 }), p = C(d, c, g), x = le();
167
+ return {
168
+ labelProps: {
169
+ ...y,
170
+ onClick: () => {
171
+ e.isDisabled || (a.current?.focus(), J("keyboard"));
172
+ }
173
+ },
174
+ triggerProps: C(f, {
175
+ ...p,
176
+ onKeyDown: ie(
177
+ p.onKeyDown,
178
+ u,
179
+ e.onKeyDown
180
+ ),
181
+ onKeyUp: e.onKeyUp,
182
+ "aria-labelledby": [
183
+ p["aria-labelledby"],
184
+ p["aria-label"] && !p["aria-labelledby"] ? p.id : null,
185
+ x
186
+ ].filter(Boolean).join(" "),
187
+ onFocus(m) {
188
+ t.isFocused || (e.onFocus && e.onFocus(m), t.setFocused(!0));
189
+ },
190
+ onBlur(m) {
191
+ t.isOpen || (e.onBlur && e.onBlur(m), t.setFocused(!1));
192
+ }
193
+ }),
194
+ valueProps: {
195
+ id: x
196
+ },
197
+ menuProps: {
198
+ ...s,
199
+ disallowEmptySelection: r,
200
+ autoFocus: t.focusStrategy || !0,
201
+ shouldSelectOnPressUp: !0,
202
+ shouldFocusOnHover: !0,
203
+ onBlur: (m) => {
204
+ m.currentTarget.contains(m.relatedTarget) || (e.onBlur && e.onBlur(m), t.setFocused(!1));
205
+ },
206
+ "aria-labelledby": [
207
+ g["aria-labelledby"],
208
+ p["aria-label"] && !g["aria-labelledby"] ? p.id : null
209
+ ].filter(Boolean).join(" ")
210
+ }
211
+ };
212
+ }
213
+ function Ke(e) {
214
+ const {
215
+ collection: t,
216
+ disabledKeys: a,
217
+ selectionManager: r,
218
+ selectionManager: { setSelectedKeys: i, selectedKeys: o, selectionMode: l }
219
+ } = ce(e), c = [], s = o.size !== 0 ? Array.from(o).map((u) => {
220
+ const d = t.getItem(u);
221
+ return d || c.push(u), d;
222
+ }).filter(Boolean) : null;
223
+ return c.length && console.warn(
224
+ `Select: Keys "${c.join(
225
+ ", "
226
+ )}" passed to "selectedKeys" are not present in the collection.`
227
+ ), {
228
+ collection: t,
229
+ disabledKeys: a,
230
+ selectionManager: r,
231
+ selectionMode: l,
232
+ selectedKeys: o,
233
+ setSelectedKeys: i.bind(r),
234
+ selectedItems: s
235
+ };
236
+ }
237
+ function _e(e) {
238
+ const [t, a] = V(!1), r = Y(e), i = e.selectionMode === "single", o = Ke({
239
+ ...e,
240
+ onSelectionChange: (d) => {
241
+ e.onSelectionChange && e.onSelectionChange(d), i && r.close();
242
+ }
243
+ }), l = ne({
244
+ ...e,
245
+ validationBehavior: "native",
246
+ value: o.selectedKeys
247
+ }), c = o.collection.size === 0, s = !!o.selectedKeys.size, u = D(() => {
248
+ l.resetValidation(), l.commitValidation();
249
+ }, [l]);
250
+ return B(() => {
251
+ i && s && u();
252
+ }, [s, i, u]), {
253
+ ...o,
254
+ ...r,
255
+ close() {
256
+ r.close(), s && u();
257
+ },
258
+ open() {
259
+ c || r.open();
260
+ },
261
+ toggle(d) {
262
+ c || r.toggle(d);
263
+ },
264
+ isFocused: t,
265
+ setFocused: a,
266
+ ...l
267
+ };
268
+ }
269
+ function Pe(e, t = {}) {
270
+ const [a, r] = V({ width: 0, height: 0 }), i = t.delay === void 0 ? 500 : t.delay, o = !!t.includePadding;
271
+ return B(() => {
272
+ if (!e) return;
273
+ const l = new ResizeObserver(
274
+ Ve(([c]) => {
275
+ const { inlineSize: s, blockSize: u } = o ? c.borderBoxSize[0] : c.contentBoxSize[0];
276
+ r({ width: s, height: u });
277
+ }, i)
278
+ );
279
+ return l.observe(e), () => {
280
+ l.disconnect();
281
+ };
282
+ }, [i, e, o]), a;
283
+ }
284
+ function Ve(e, t) {
285
+ let a;
286
+ return (r, i) => {
287
+ clearTimeout(a), a = setTimeout(() => {
288
+ e(r, i);
289
+ }, t);
290
+ };
291
+ }
292
+ function Be({
293
+ autoComplete: e,
294
+ name: t,
295
+ isDisabled: a,
296
+ isRequired: r,
297
+ selectRef: i
298
+ }, o, l) {
299
+ const { visuallyHiddenProps: c } = de();
300
+ return re(i, o.selectedKeys, o.setSelectedKeys), se(
301
+ {
302
+ validationBehavior: "native",
303
+ focus: () => l.current?.focus()
304
+ },
305
+ o,
306
+ i
307
+ ), {
308
+ containerProps: {
309
+ ...c,
310
+ "aria-hidden": !0,
311
+ // @ts-expect-error - data-a11y-ignore is not a standard attribute
312
+ "data-react-aria-prevent-focus": !0,
313
+ "data-a11y-ignore": "aria-hidden-focus"
314
+ },
315
+ inputProps: {
316
+ style: { display: "none" }
317
+ },
318
+ selectProps: {
319
+ tabIndex: -1,
320
+ autoComplete: e,
321
+ disabled: a,
322
+ required: r,
323
+ name: t,
324
+ value: Array.from(o.selectedKeys).map((s) => s.toString()),
325
+ onChange: (s) => o.setSelectedKeys(s.target.value),
326
+ multiple: !0
327
+ }
328
+ };
329
+ }
330
+ function Me(e) {
331
+ const { state: t, triggerRef: a, name: r, isDisabled: i } = e, o = `${e.label}-hidden`, l = E(null), { containerProps: c, selectProps: s } = Be(
332
+ { ...e, selectRef: l },
333
+ t,
334
+ a
335
+ );
336
+ return t.collection.size <= 300 ? /* @__PURE__ */ n(
337
+ "div",
338
+ {
339
+ ...c,
340
+ "data-testid": "hidden-select-container",
341
+ children: /* @__PURE__ */ h("label", { children: [
342
+ o,
343
+ /* @__PURE__ */ h(
344
+ "select",
345
+ {
346
+ ...s,
347
+ ref: l,
348
+ children: [
349
+ /* @__PURE__ */ n("option", {}),
350
+ [...t.collection.getKeys()].map((u) => {
351
+ const d = t.collection.getItem(u);
352
+ return d && d.type === "item" ? /* @__PURE__ */ n(
353
+ "option",
354
+ {
355
+ value: d.key,
356
+ children: d.textValue
357
+ },
358
+ d.key
359
+ ) : null;
360
+ })
361
+ ]
362
+ }
363
+ )
364
+ ] })
365
+ }
366
+ ) : r ? /* @__PURE__ */ n(
367
+ "input",
368
+ {
369
+ type: "hidden",
370
+ autoComplete: s.autoComplete,
371
+ name: r,
372
+ disabled: i,
373
+ value: Array.from(t.selectedKeys).map((u) => u.toString()) ?? [""]
374
+ }
375
+ ) : null;
376
+ }
377
+ const Ae = "_wrapper_1rw0v_7", Ie = "_trigger_1rw0v_18", Ne = "_medium_1rw0v_32", Te = "_icon_1rw0v_68", ke = "_tagGroup_1rw0v_74", ze = "_triggerContainer_1rw0v_95", Fe = "_selectValueTag_1rw0v_101", De = "_clearButton_1rw0v_117", Ee = "_truncate_1rw0v_129", Le = "_selectAll_1rw0v_172", b = {
378
+ wrapper: Ae,
379
+ trigger: Ie,
380
+ medium: Ne,
381
+ icon: Te,
382
+ tagGroup: ke,
383
+ triggerContainer: ze,
384
+ selectValueTag: Fe,
385
+ clearButton: De,
386
+ truncate: Ee,
387
+ selectAll: Le
388
+ }, Oe = { clearAll: "Clear all", selectAll: "Select all", selectedItems: "Selected items", chosen: "chosen" }, Re = { clearAll: "Rensa alla", selectAll: "Välj alla", selectedItems: "Valda objekt", chosen: "valda" }, k = {
389
+ en: Oe,
390
+ sv: Re
391
+ }, je = ({
392
+ state: { selectedItems: e },
393
+ isDisabled: t,
394
+ parentWidth: a,
395
+ onClear: r,
396
+ triggerRef: i,
397
+ isClearable: o
398
+ }) => {
399
+ const l = A(k);
400
+ return /* @__PURE__ */ h(
401
+ "div",
402
+ {
403
+ className: b.selectValueTag,
404
+ "data-disabled": t || void 0,
405
+ children: [
406
+ /* @__PURE__ */ n(
407
+ "span",
408
+ {
409
+ className: b.truncate,
410
+ style: { maxWidth: a - 92 },
411
+ children: e?.length && e.length > 1 ? `${e.length} ${l.format("chosen")}` : e?.[0].textValue
412
+ }
413
+ ),
414
+ o && /* @__PURE__ */ n(
415
+ "button",
416
+ {
417
+ disabled: t,
418
+ "aria-label": l.format("clearAll"),
419
+ className: b.clearButton,
420
+ onClick: () => {
421
+ r(), i?.current?.focus();
422
+ },
423
+ children: /* @__PURE__ */ n(
424
+ ge,
425
+ {
426
+ width: 20,
427
+ height: 20
428
+ }
429
+ )
430
+ }
431
+ )
432
+ ]
433
+ }
434
+ );
435
+ }, Ge = ({
436
+ autoFocus: e,
437
+ excludeFromTabOrder: t,
438
+ isDisabled: a,
439
+ size: r = "large",
440
+ isOpen: i,
441
+ isInvalid: o,
442
+ selectionMode: l,
443
+ state: { selectedItems: c },
444
+ placeholder: s,
445
+ children: u,
446
+ triggerRef: d,
447
+ ...y
448
+ }) => {
449
+ const { buttonProps: g } = pe(
450
+ { autoFocus: e, excludeFromTabOrder: t, isDisabled: a, ...y },
451
+ d
452
+ ), f = l === "multiple";
453
+ return /* @__PURE__ */ h(
454
+ "div",
455
+ {
456
+ className: b.triggerContainer,
457
+ "data-disabled": a || void 0,
458
+ children: [
459
+ /* @__PURE__ */ h(
460
+ "button",
461
+ {
462
+ ...g,
463
+ autoFocus: e,
464
+ className: M(b.trigger, {
465
+ [b.medium]: r === "medium"
466
+ }),
467
+ "data-disabled": a || void 0,
468
+ "data-invalid": o || void 0,
469
+ "data-open": i || void 0,
470
+ ref: d,
471
+ type: "button",
472
+ children: [
473
+ f && !c ? /* @__PURE__ */ n("span", { children: s }) : null,
474
+ f ? null : /* @__PURE__ */ n("span", { children: c ? c[0].textValue : s }),
475
+ /* @__PURE__ */ n(
476
+ "div",
477
+ {
478
+ className: b.icon,
479
+ "aria-hidden": "true",
480
+ children: /* @__PURE__ */ n(he, { size: 20 })
481
+ }
482
+ )
483
+ ]
484
+ }
485
+ ),
486
+ u
487
+ ]
488
+ }
489
+ );
490
+ }, _ = ({
491
+ state: e,
492
+ errorMessage: t
493
+ }) => /* @__PURE__ */ n(ye.Provider, { value: { ...e.displayValidation }, children: /* @__PURE__ */ n($e, { children: t }) }), We = P.forwardRef(
494
+ ({ isClearable: e = !0, popover: t, ...a }, r) => {
495
+ const i = {
496
+ selectionMode: "single",
497
+ errorPosition: "top",
498
+ disallowEmptySelection: !e,
499
+ isClearable: e,
500
+ size: "large",
501
+ popover: t,
502
+ ...a
503
+ }, o = L(r), l = _e(i), c = A(k), { labelProps: s, triggerProps: u, valueProps: d, menuProps: y } = Ce(
504
+ i,
505
+ l,
506
+ o
507
+ ), { width: g } = Pe(o.current, {
508
+ includePadding: !0
509
+ });
510
+ return /* @__PURE__ */ h(
511
+ G,
512
+ {
513
+ ...i,
514
+ className: M(b.wrapper, i.className),
515
+ children: [
516
+ /* @__PURE__ */ n(
517
+ Me,
518
+ {
519
+ ...i,
520
+ state: l,
521
+ triggerRef: o
522
+ }
523
+ ),
524
+ /* @__PURE__ */ n(ue, { popover: t, children: i.label && /* @__PURE__ */ n(
525
+ fe,
526
+ {
527
+ ...s,
528
+ "data-disabled": i.isDisabled || void 0,
529
+ children: i.label
530
+ }
531
+ ) }),
532
+ i.description && /* @__PURE__ */ n(me, { slot: "description", children: i.description }),
533
+ i.errorPosition === "top" && /* @__PURE__ */ n(
534
+ _,
535
+ {
536
+ ...i,
537
+ state: l
538
+ }
539
+ ),
540
+ /* @__PURE__ */ n(
541
+ Ge,
542
+ {
543
+ ...i,
544
+ ...u,
545
+ isInvalid: l.displayValidation.isInvalid,
546
+ triggerRef: o,
547
+ state: l,
548
+ children: i.selectionMode === "multiple" && l.selectedItems ? /* @__PURE__ */ n("span", { ...d, children: /* @__PURE__ */ n(
549
+ je,
550
+ {
551
+ ...i,
552
+ state: l,
553
+ parentWidth: g,
554
+ onClear: () => l.selectionManager.clearSelection(),
555
+ triggerRef: o
556
+ }
557
+ ) }) : null
558
+ }
559
+ ),
560
+ i.errorPosition === "bottom" && /* @__PURE__ */ n(
561
+ _,
562
+ {
563
+ ...i,
564
+ state: l
565
+ }
566
+ ),
567
+ /* @__PURE__ */ h(
568
+ X,
569
+ {
570
+ isOpen: l.isOpen,
571
+ onOpenChange: (f) => {
572
+ f || l.close();
573
+ },
574
+ triggerRef: o,
575
+ style: { width: g },
576
+ children: [
577
+ i.isSelectableAll && /* @__PURE__ */ n(
578
+ be,
579
+ {
580
+ isSelected: l.selectionManager.isSelectAll,
581
+ isIndeterminate: !l.selectionManager.isSelectAll && !l.selectionManager.isEmpty,
582
+ className: b.selectAll,
583
+ onChange: () => l.selectionManager.toggleSelectAll(),
584
+ children: c.format("selectAll")
585
+ }
586
+ ),
587
+ /* @__PURE__ */ n(
588
+ we,
589
+ {
590
+ ...y,
591
+ state: l
592
+ }
593
+ )
594
+ ]
595
+ }
596
+ ),
597
+ i.showTags && !!l.selectedItems && /* @__PURE__ */ n(
598
+ O,
599
+ {
600
+ "aria-label": c.format("selectedItems"),
601
+ selectionBehavior: "toggle",
602
+ onRemove: (f) => l.selectionManager.toggleSelection(Array.from(f)[0]),
603
+ className: b.tagGroup,
604
+ children: /* @__PURE__ */ n(R, { items: l.selectedItems, children: (f) => /* @__PURE__ */ n(
605
+ j,
606
+ {
607
+ textValue: f.textValue,
608
+ id: f.key,
609
+ dismissable: !0,
610
+ isDisabled: i.isDisabled,
611
+ children: f.textValue
612
+ },
613
+ f.key
614
+ ) })
615
+ }
616
+ )
617
+ ]
618
+ }
619
+ );
620
+ }
621
+ ), He = P.forwardRef(
622
+ ({ options: e, ...t }, a) => /* @__PURE__ */ n(
623
+ We,
624
+ {
625
+ ...t,
626
+ items: e,
627
+ ref: a,
628
+ children: (r) => r.children ? /* @__PURE__ */ n(
629
+ Se,
630
+ {
631
+ items: r.children,
632
+ title: r.name,
633
+ children: (i) => /* @__PURE__ */ n(K, { textValue: i.textValue, children: i.name })
634
+ },
635
+ r.name
636
+ ) : /* @__PURE__ */ n(K, { textValue: r.textValue, children: r.name })
637
+ }
638
+ )
639
+ );
640
+ He.displayName = "Select";
641
+ export {
642
+ He as S
643
+ };
@@ -1 +1 @@
1
- "use strict";const t=require("react/jsx-runtime"),y=require("react"),x=require("./utils-ZN3Na38z.cjs"),l=require("./Input-CpMWCSE3.cjs"),u=require("./clsx-DKOfLqne.cjs"),i=require("./TextField.module-gwQfMD2x.cjs"),h=require("./Text-D29KP4_q.cjs"),F=require("./Button-CaPoPCq8.cjs"),T=require("./useLocalizedStringFormatter-Dfow0G-0.cjs"),f=require("./TextField-6v1u8c__.cjs"),b=require("./FieldError-DwYQXCwP.cjs"),g=require("./CharacterCounter-C8PalBAH.cjs"),N=require("./clsx-C11secjj.cjs"),m=require("./Label-DkNtFYv5.cjs");function S(e){const s=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const o=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(s,r,o.get?o:{enumerable:!0,get:()=>e[r]})}}return s.default=e,Object.freeze(s)}const d=S(y),$=d.forwardRef((e,s)=>{[e]=x.$64fa3d84918910a7$export$29f1550f4b0d4415(e,s,f.$bcdf0525bf22703d$export$2129e27b3ef0d483);const{label:r,description:o,errorMessage:a,showCounter:n,errorPosition:c="top",size:j="large",popover:w,children:q}=e;return t.jsxs(f.$bcdf0525bf22703d$export$2c73285ae9390cec,{...e,className:N.clsx(i.styles.textField,{[i.styles.medium]:j==="medium"}),children:[t.jsx(m.LabelWrapper,{popover:w,children:r&&t.jsx(m.Label,{children:r})}),o&&t.jsx(h.Text,{slot:"description",children:o}),n&&t.jsx(g.CharacterCounter,{isLonely:!o}),c==="top"&&t.jsx(b.FieldError,{"data-testid":"fieldError",children:a}),q,c==="bottom"&&t.jsx(b.FieldError,{"data-testid":"fieldError",className:i.styles.bottomError,children:a})]})}),P={hide:"Hide",show:"Show"},R={hide:"Dölj",show:"Visa"},v={en:P,sv:R},E=d.forwardRef((e,s)=>{[e,s]=x.$64fa3d84918910a7$export$29f1550f4b0d4415(e,s,l.$3985021b0ad6602f$export$37fb8590cf2c088c);const[r,o]=d.useState(!1),a=()=>o(c=>!c),n=T.useLocalizedStringFormatter(v);return t.jsxs(t.Fragment,{children:[r&&t.jsx(h.Text,{slot:"description",className:i.styles.passwordText,children:e.value}),t.jsx(F.Button,{variant:"tertiary",onPress:a,className:i.styles.passwordButton,children:r?n.format("hide"):n.format("show")})]})}),p=d.forwardRef(({skipContext:e=!1,...s},r)=>{const[o,a]=x.$64fa3d84918910a7$export$29f1550f4b0d4415(s,r,l.$3985021b0ad6602f$export$37fb8590cf2c088c),n=e?r:a,c=e?s:o;return t.jsxs("div",{className:i.styles.wrap,children:[t.jsx(l.$3985021b0ad6602f$export$f5b8910cec6cf069,{...c,ref:n,className:u.clsx(i.styles.input,c.className)}),c.type==="password"&&t.jsx(E,{...c})]})}),L=d.forwardRef(({className:e,list:s,type:r,min:o,max:a,...n},c)=>t.jsx($,{...n,children:t.jsx(p,{className:u.clsx(e),list:s,min:o,max:a,ref:c,type:r,skipContext:!0})})),B=d.forwardRef(({className:e,cols:s,rows:r,wrap:o,...a},n)=>t.jsx($,{...a,children:t.jsx(f.$216918bed6669f72$export$f5c9f3c2c4054eec,{className:u.clsx(i.styles.textArea,e),cols:s,ref:n,rows:r,wrap:o})}));exports.Input=p;exports.TextArea=B;exports.TextField=L;exports.TextFieldBase=$;
1
+ "use strict";const t=require("react/jsx-runtime"),y=require("react"),x=require("./utils-ZN3Na38z.cjs"),l=require("./Input-CpMWCSE3.cjs"),u=require("./clsx-DKOfLqne.cjs"),i=require("./TextField.module-DdsQxiiV.cjs"),h=require("./Text-D29KP4_q.cjs"),F=require("./Button-CaPoPCq8.cjs"),T=require("./useLocalizedStringFormatter-Dfow0G-0.cjs"),f=require("./TextField-6v1u8c__.cjs"),b=require("./FieldError-DwYQXCwP.cjs"),g=require("./CharacterCounter-C8PalBAH.cjs"),N=require("./clsx-C11secjj.cjs"),m=require("./Label-DkNtFYv5.cjs");function S(e){const s=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const o=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(s,r,o.get?o:{enumerable:!0,get:()=>e[r]})}}return s.default=e,Object.freeze(s)}const d=S(y),$=d.forwardRef((e,s)=>{[e]=x.$64fa3d84918910a7$export$29f1550f4b0d4415(e,s,f.$bcdf0525bf22703d$export$2129e27b3ef0d483);const{label:r,description:o,errorMessage:a,showCounter:n,errorPosition:c="top",size:j="large",popover:w,children:q}=e;return t.jsxs(f.$bcdf0525bf22703d$export$2c73285ae9390cec,{...e,className:N.clsx(i.styles.textField,{[i.styles.medium]:j==="medium"}),children:[t.jsx(m.LabelWrapper,{popover:w,children:r&&t.jsx(m.Label,{children:r})}),o&&t.jsx(h.Text,{slot:"description",children:o}),n&&t.jsx(g.CharacterCounter,{isLonely:!o}),c==="top"&&t.jsx(b.FieldError,{"data-testid":"fieldError",children:a}),q,c==="bottom"&&t.jsx(b.FieldError,{"data-testid":"fieldError",className:i.styles.bottomError,children:a})]})}),P={hide:"Hide",show:"Show"},R={hide:"Dölj",show:"Visa"},v={en:P,sv:R},E=d.forwardRef((e,s)=>{[e,s]=x.$64fa3d84918910a7$export$29f1550f4b0d4415(e,s,l.$3985021b0ad6602f$export$37fb8590cf2c088c);const[r,o]=d.useState(!1),a=()=>o(c=>!c),n=T.useLocalizedStringFormatter(v);return t.jsxs(t.Fragment,{children:[r&&t.jsx(h.Text,{slot:"description",className:i.styles.passwordText,children:e.value}),t.jsx(F.Button,{variant:"tertiary",onPress:a,className:i.styles.passwordButton,children:r?n.format("hide"):n.format("show")})]})}),p=d.forwardRef(({skipContext:e=!1,...s},r)=>{const[o,a]=x.$64fa3d84918910a7$export$29f1550f4b0d4415(s,r,l.$3985021b0ad6602f$export$37fb8590cf2c088c),n=e?r:a,c=e?s:o;return t.jsxs("div",{className:i.styles.wrap,children:[t.jsx(l.$3985021b0ad6602f$export$f5b8910cec6cf069,{...c,ref:n,className:u.clsx(i.styles.input,c.className)}),c.type==="password"&&t.jsx(E,{...c})]})}),L=d.forwardRef(({className:e,list:s,type:r,min:o,max:a,...n},c)=>t.jsx($,{...n,children:t.jsx(p,{className:u.clsx(e),list:s,min:o,max:a,ref:c,type:r,skipContext:!0})})),B=d.forwardRef(({className:e,cols:s,rows:r,wrap:o,...a},n)=>t.jsx($,{...a,children:t.jsx(f.$216918bed6669f72$export$f5c9f3c2c4054eec,{className:u.clsx(i.styles.textArea,e),cols:s,ref:n,rows:r,wrap:o})}));exports.Input=p;exports.TextArea=B;exports.TextField=L;exports.TextFieldBase=$;
@@ -3,7 +3,7 @@ import * as n from "react";
3
3
  import { $ as f } from "./utils-BJ6_Ry69.js";
4
4
  import { $ as h, a as F } from "./Input-B6G4aU36.js";
5
5
  import { c as l } from "./clsx-jbLnTBqA.js";
6
- import { s as d } from "./TextField.module-D9xjQoiS.js";
6
+ import { s as d } from "./TextField.module-DZslrEPC.js";
7
7
  import { T as $ } from "./Text-6Fdknq88.js";
8
8
  import { B as T } from "./Button-Bb0wSnh4.js";
9
9
  import { u as g } from "./useLocalizedStringFormatter-m7LExKN3.js";
@@ -0,0 +1,13 @@
1
+ import './assets/TextField.css';const t = "_textField_tqy18_1", o = "_bottomError_tqy18_20", s = "_textArea_tqy18_29", _ = "_input_tqy18_30", r = "_wrap_tqy18_87", e = "_medium_tqy18_92", n = "_passwordText_tqy18_120", a = "_passwordButton_tqy18_167", p = {
2
+ textField: t,
3
+ bottomError: o,
4
+ textArea: s,
5
+ input: _,
6
+ wrap: r,
7
+ medium: e,
8
+ passwordText: n,
9
+ passwordButton: a
10
+ };
11
+ export {
12
+ p as s
13
+ };
@@ -0,0 +1 @@
1
+ "use strict";require('./assets/TextField.css');const t="_textField_tqy18_1",o="_bottomError_tqy18_20",s="_textArea_tqy18_29",_="_input_tqy18_30",r="_wrap_tqy18_87",e="_medium_tqy18_92",n="_passwordText_tqy18_120",a="_passwordButton_tqy18_167",d={textField:t,bottomError:o,textArea:s,input:_,wrap:r,medium:e,passwordText:n,passwordButton:a};exports.styles=d;