@midas-ds/components 16.2.5 → 16.3.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.
Files changed (48) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/calendar/index.js +1 -1
  3. package/character-counter/CharacterCounter.d.ts +1 -3
  4. package/character-counter/index.js +1 -1
  5. package/checkbox/Checkbox.d.ts +3 -2
  6. package/checkbox/CheckboxGroupItem.d.ts +1 -1
  7. package/checkbox/CheckboxInner.d.ts +1 -2
  8. package/checkbox/SingleCheckbox.d.ts +1 -1
  9. package/checkbox/index.js +2 -2
  10. package/checkbox/types.d.ts +0 -1
  11. package/chunks/CharacterCounter-R6vh7AE5.js +22 -0
  12. package/chunks/Checkbox-BTAfwDxU.js +130 -0
  13. package/chunks/{CheckboxGroup-A7UJMi5J.js → CheckboxGroup-BQ8EpX7O.js} +2 -2
  14. package/chunks/{ComboBox-yl5zHYPk.js → ComboBox-DVK0dL2W.js} +1 -1
  15. package/chunks/{DateField-BsT1K-bB.js → DateField-06YL8tj_.js} +1 -1
  16. package/chunks/{DateRangePicker-BsK7pMRv.js → DateRangePicker-CZRWDV_g.js} +2 -2
  17. package/chunks/FieldError-Bra5aRT3.js +24 -0
  18. package/chunks/{Radio-CSFYbin8.js → Radio-BDHczAt5.js} +1 -1
  19. package/chunks/{RangeCalendar-BF-6p7u2.js → RangeCalendar-BSth1Fmv.js} +1 -1
  20. package/chunks/{SearchField-mBHZ9pFg.js → SearchField-DTkfUFwn.js} +1 -1
  21. package/chunks/{Select-Df4333VV.js → Select-C8Fr7Vn3.js} +2 -2
  22. package/chunks/{Select-BjD5iQvX.js → Select-CPM82ww2.js} +2 -2
  23. package/chunks/{Table-t3rVzb31.js → Table-BgsgXhC_.js} +1 -1
  24. package/chunks/TextArea-DQ_dAC-2.js +137 -0
  25. package/combobox/index.js +1 -1
  26. package/date-field/index.js +1 -1
  27. package/date-picker/index.js +1 -1
  28. package/field-error/FieldError.d.ts +1 -3
  29. package/field-error/index.js +1 -1
  30. package/index.js +14 -14
  31. package/legacy-select/Select.d.ts +4 -2
  32. package/legacy-select/index.js +1 -1
  33. package/legacy-select/types.d.ts +1 -2
  34. package/package.json +1 -1
  35. package/radio/index.js +1 -1
  36. package/search-field/index.js +1 -1
  37. package/select/index.js +1 -1
  38. package/table/index.js +1 -1
  39. package/textfield/Input.d.ts +1 -3
  40. package/textfield/PasswordField.d.ts +1 -1
  41. package/textfield/TextArea.d.ts +2 -5
  42. package/textfield/TextField.d.ts +2 -5
  43. package/textfield/TextFieldBase.d.ts +1 -1
  44. package/textfield/index.js +1 -1
  45. package/chunks/CharacterCounter-_m-SgTMV.js +0 -20
  46. package/chunks/Checkbox-gsEu5wcB.js +0 -119
  47. package/chunks/FieldError-Bc0acYNs.js +0 -21
  48. package/chunks/TextArea-B2BePnZz.js +0 -136
package/CHANGELOG.md CHANGED
@@ -1,3 +1,13 @@
1
+ ## 16.3.0 (2026-01-13)
2
+
3
+ ### 🚀 Features
4
+
5
+ - **components:** add displayName to forwardRef components" ([474d161db5](https://github.com/migrationsverket/midas/commit/474d161db5))
6
+
7
+ ### 🔙 Rollback changes
8
+
9
+ - Revert "refactor: remove React.forwardRef" ([c4f26cd721](https://github.com/migrationsverket/midas/commit/c4f26cd721))
10
+
1
11
  ## 16.2.5 (2026-01-09)
2
12
 
3
13
  ### 🏭 Refactoring
package/calendar/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { C as r, R as n } from "../chunks/RangeCalendar-BF-6p7u2.js";
1
+ import { C as r, R as n } from "../chunks/RangeCalendar-BSth1Fmv.js";
2
2
  export {
3
3
  r as Calendar,
4
4
  n as RangeCalendar
@@ -1,7 +1,5 @@
1
- import { Ref } from 'react';
2
1
  import { InputProps } from 'react-aria-components';
3
2
  export interface CharacterCounterProps extends InputProps {
4
3
  isLonely?: boolean;
5
- ref?: Ref<HTMLInputElement>;
6
4
  }
7
- export declare const CharacterCounter: ({ ref, ...props }: CharacterCounterProps) => import("react/jsx-runtime").JSX.Element;
5
+ export declare const CharacterCounter: import('react').ForwardRefExoticComponent<CharacterCounterProps & import('react').RefAttributes<HTMLInputElement>>;
@@ -1,4 +1,4 @@
1
- import { C as e } from "../chunks/CharacterCounter-_m-SgTMV.js";
1
+ import { C as e } from "../chunks/CharacterCounter-R6vh7AE5.js";
2
2
  export {
3
3
  e as CharacterCounter
4
4
  };
@@ -1,2 +1,3 @@
1
- import { CheckboxProps } from './types';
2
- export declare const Checkbox: ({ ref, ...props }: CheckboxProps) => import("react/jsx-runtime").JSX.Element;
1
+ export declare const Checkbox: import('react').ForwardRefExoticComponent<import('react-aria').AriaCheckboxProps & import('react-aria-components').SlotProps & {
2
+ className?: string;
3
+ } & import('react').RefAttributes<HTMLLabelElement>>;
@@ -1,2 +1,2 @@
1
1
  import { CheckboxGroupItemProps } from './types';
2
- export declare const CheckBoxGroupItem: ({ ref, ...props }: CheckboxGroupItemProps) => import("react/jsx-runtime").JSX.Element;
2
+ export declare const CheckBoxGroupItem: import('react').ForwardRefExoticComponent<CheckboxGroupItemProps & import('react').RefAttributes<HTMLLabelElement>>;
@@ -1,2 +1 @@
1
- import { CheckboxInnerProps } from './types';
2
- export declare const CheckboxInner: ({ ref, ...props }: CheckboxInnerProps) => import("react/jsx-runtime").JSX.Element;
1
+ export declare const CheckboxInner: import('react').ForwardRefExoticComponent<import('./types').CheckboxComponentProps & import('react-aria').CheckboxAria & import('react').RefAttributes<HTMLLabelElement>>;
@@ -1,2 +1,2 @@
1
1
  import { CheckboxComponentProps } from './types';
2
- export declare const SingleCheckbox: ({ ref, ...props }: CheckboxComponentProps) => import("react/jsx-runtime").JSX.Element;
2
+ export declare const SingleCheckbox: import('react').ForwardRefExoticComponent<CheckboxComponentProps & import('react').RefAttributes<HTMLLabelElement>>;
package/checkbox/index.js CHANGED
@@ -1,5 +1,5 @@
1
- import { C as e } from "../chunks/Checkbox-gsEu5wcB.js";
2
- import { C } from "../chunks/CheckboxGroup-A7UJMi5J.js";
1
+ import { C as e } from "../chunks/Checkbox-BTAfwDxU.js";
2
+ import { C } from "../chunks/CheckboxGroup-BQ8EpX7O.js";
3
3
  export {
4
4
  e as Checkbox,
5
5
  C as CheckboxGroup
@@ -3,7 +3,6 @@ import { SlotProps } from 'react-aria-components';
3
3
  import { CheckboxGroupState } from 'react-stately';
4
4
  export type CheckboxProps = AriaCheckboxProps & SlotProps & {
5
5
  className?: string;
6
- ref?: React.Ref<HTMLLabelElement>;
7
6
  };
8
7
  export interface CheckboxComponentProps extends CheckboxProps {
9
8
  focusRingAria: FocusRingAria;
@@ -0,0 +1,22 @@
1
+ import { jsx as s } from "react/jsx-runtime";
2
+ import { forwardRef as i } from "react";
3
+ import { useContextProps as d, InputContext as h } from "react-aria-components";
4
+ import '../assets/CharacterCounter.css';const C = "_characterCounter_1f0mh_1", m = {
5
+ characterCounter: C
6
+ }, u = i((t, a) => {
7
+ [t] = d(t, a, h);
8
+ const { maxLength: e, value: n, isLonely: c } = t, { length: r } = n?.toString() ?? "", o = e !== void 0;
9
+ return /* @__PURE__ */ s(
10
+ "span",
11
+ {
12
+ className: m.characterCounter,
13
+ "data-exceeded": o && r > e || void 0,
14
+ "data-lonely": c || void 0,
15
+ children: o ? `${r} / ${e}` : r
16
+ }
17
+ );
18
+ });
19
+ u.displayName = "CharacterCounter";
20
+ export {
21
+ u as C
22
+ };
@@ -0,0 +1,130 @@
1
+ import { jsxs as C, jsx as t } from "react/jsx-runtime";
2
+ import f, { forwardRef as l, useContext as R, useRef as _ } from "react";
3
+ import { mergeProps as h, VisuallyHidden as I, useCheckboxGroupItem as y, useCheckbox as P, useHover as g, usePress as G, useFocusRing as N } from "react-aria";
4
+ import { useContextProps as z, CheckboxContext as B, useSlottedContext as S, FormContext as F } from "react-aria-components";
5
+ import { a as x } from "./clsx-AexbMWKp.js";
6
+ import { variables as m } from "@midas-ds/theme";
7
+ import { c as L } from "./createLucideIcon-D4r5Phnh.js";
8
+ import { C as D } from "./check-BxlvVsvD.js";
9
+ import { useToggleState as H } from "@react-stately/toggle";
10
+ import '../assets/Checkbox.css';const O = [["path", { d: "M5 12h14", key: "1ays0h" }]], j = L("minus", O), q = f.createContext(null), A = "_checkboxInner_tzrii_1", M = "_checkbox_tzrii_1", V = "_checkboxGroup_tzrii_143", w = "_checkboxList_tzrii_154", b = {
11
+ checkboxInner: A,
12
+ checkbox: M,
13
+ checkboxGroup: V,
14
+ checkboxList: w
15
+ }, u = l(
16
+ (e, o) => {
17
+ const { hoverProps: i, isHovered: c } = e.hoverResult, { pressProps: s, isPressed: n } = e.pressResult, { isFocused: a, isFocusVisible: r, focusProps: d } = e.focusRingAria;
18
+ return /* @__PURE__ */ C(
19
+ "label",
20
+ {
21
+ ref: o,
22
+ ...h(i, s, e.labelProps),
23
+ slot: e.slot || void 0,
24
+ className: x(b.checkbox, e.className),
25
+ "data-hovered": c || void 0,
26
+ "data-selected": e.isSelected || void 0,
27
+ "data-indeterminate": e.isIndeterminate || void 0,
28
+ "data-pressed": n || void 0,
29
+ "data-disabled": e.isDisabled || void 0,
30
+ "data-readonly": e.isReadOnly || void 0,
31
+ "data-invalid": e.isInvalid || void 0,
32
+ "data-focused": a || void 0,
33
+ "data-focus-visible": r || void 0,
34
+ "data-required": e.isRequired || void 0,
35
+ children: [
36
+ /* @__PURE__ */ t("div", { className: x(b.checkboxInner), children: e.isIndeterminate ? /* @__PURE__ */ t(
37
+ j,
38
+ {
39
+ size: 14,
40
+ color: m.iconOnColor
41
+ }
42
+ ) : /* @__PURE__ */ t(
43
+ D,
44
+ {
45
+ size: 14,
46
+ color: m.iconOnColor
47
+ }
48
+ ) }),
49
+ /* @__PURE__ */ t(I, { children: /* @__PURE__ */ t(
50
+ "input",
51
+ {
52
+ ...h(e.inputProps, d),
53
+ ref: e.inputRef
54
+ }
55
+ ) }),
56
+ e.children
57
+ ]
58
+ }
59
+ );
60
+ }
61
+ );
62
+ u.displayName = "CheckboxInner";
63
+ const v = l((e, o) => {
64
+ const i = y(
65
+ {
66
+ ...e,
67
+ value: e.value || ""
68
+ },
69
+ e.state,
70
+ e.inputRef
71
+ );
72
+ return /* @__PURE__ */ t(
73
+ u,
74
+ {
75
+ ...e,
76
+ ...i,
77
+ ref: o
78
+ }
79
+ );
80
+ });
81
+ v.displayName = "CheckBoxGroupItem";
82
+ const k = l((e, o) => {
83
+ const i = P(e, H(e), e.inputRef);
84
+ return /* @__PURE__ */ t(
85
+ u,
86
+ {
87
+ ...e,
88
+ ...i,
89
+ ref: o
90
+ }
91
+ );
92
+ });
93
+ k.displayName = "SingleCheckbox";
94
+ const T = l(
95
+ (e, o) => {
96
+ [e, o] = z(e, o, B);
97
+ const i = S(F), c = e.validationBehavior ?? i?.validationBehavior ?? "native", s = R(q), n = _(null), a = g(e), r = G({
98
+ ref: o,
99
+ isDisabled: e.isDisabled
100
+ }), d = N();
101
+ return s ? /* @__PURE__ */ t(
102
+ v,
103
+ {
104
+ ...e,
105
+ state: s,
106
+ inputRef: n,
107
+ hoverResult: a,
108
+ pressResult: r,
109
+ focusRingAria: d,
110
+ validationBehavior: c
111
+ }
112
+ ) : /* @__PURE__ */ t(
113
+ k,
114
+ {
115
+ ...e,
116
+ inputRef: n,
117
+ hoverResult: a,
118
+ pressResult: r,
119
+ focusRingAria: d,
120
+ validationBehavior: c
121
+ }
122
+ );
123
+ }
124
+ );
125
+ T.displayName = "Checkbox";
126
+ export {
127
+ T as C,
128
+ q as a,
129
+ b as s
130
+ };
@@ -4,9 +4,9 @@ import { useCheckboxGroupState as v } from "react-stately";
4
4
  import { a as k, L as S } from "./Label-Dup4lWaR.js";
5
5
  import { T as y } from "./Text-TWzJxnto.js";
6
6
  import * as r from "react";
7
- import { C as d, s as u, a as g } from "./Checkbox-gsEu5wcB.js";
7
+ import { C as d, s as u, a as g } from "./Checkbox-BTAfwDxU.js";
8
8
  import { FieldErrorContext as A } from "react-aria-components";
9
- import { F as P } from "./FieldError-Bc0acYNs.js";
9
+ import { F as P } from "./FieldError-Bra5aRT3.js";
10
10
  import { u as V } from "./useLocalizedStringFormatter-ZgRJmvHC.js";
11
11
  const F = (e, { value: t }) => {
12
12
  const a = r.Children.toArray(e).filter(
@@ -4,7 +4,7 @@ import { ComboBox as y, Input as B, Button as F, Collection as w } from "react-a
4
4
  import { c as s } from "./clsx-AexbMWKp.js";
5
5
  import { a as C, L as S } from "./Label-Dup4lWaR.js";
6
6
  import { T as u } from "./Text-TWzJxnto.js";
7
- import { F as h } from "./FieldError-Bc0acYNs.js";
7
+ import { F as h } from "./FieldError-Bra5aRT3.js";
8
8
  import { L as v } from "./ListBox-D5BBeZWL.js";
9
9
  import { a as R, L as N, b as E } from "./ListBoxSection-MZB_5DdD.js";
10
10
  import { C as I } from "./chevron-down-DgT-uSF9.js";
@@ -2,7 +2,7 @@ import { jsxs as F, jsx as e } from "react/jsx-runtime";
2
2
  import { DateField as u } from "react-aria-components";
3
3
  import { c as m } from "./clsx-AexbMWKp.js";
4
4
  import { a as _, D as f } from "./DateInputDivider-CkTB5q5k.js";
5
- import { F as s } from "./FieldError-Bc0acYNs.js";
5
+ import { F as s } from "./FieldError-Bra5aRT3.js";
6
6
  import { a as h, L as D } from "./Label-Dup4lWaR.js";
7
7
  import { T as b } from "./Text-TWzJxnto.js";
8
8
  import '../assets/DateField.css';const x = "_dateField_y3sba_1", y = "_inputField_y3sba_7", L = "_medium_y3sba_37", i = {
@@ -1,9 +1,9 @@
1
1
  import { jsxs as l, jsx as e } from "react/jsx-runtime";
2
2
  import { Group as P, Button as b, Popover as f, Dialog as v, DatePicker as x, DateRangePicker as F } from "react-aria-components";
3
3
  import { a as m } from "./clsx-AexbMWKp.js";
4
- import { C as M, R as N } from "./RangeCalendar-BF-6p7u2.js";
4
+ import { C as M, R as N } from "./RangeCalendar-BSth1Fmv.js";
5
5
  import { a as p, D as k, b as B } from "./DateInputDivider-CkTB5q5k.js";
6
- import { F as h } from "./FieldError-Bc0acYNs.js";
6
+ import { F as h } from "./FieldError-Bra5aRT3.js";
7
7
  import { a as u, L as y } from "./Label-Dup4lWaR.js";
8
8
  import { T as _ } from "./Text-TWzJxnto.js";
9
9
  import { c as C } from "./createLucideIcon-D4r5Phnh.js";
@@ -0,0 +1,24 @@
1
+ import { jsx as i } from "react/jsx-runtime";
2
+ import { forwardRef as n, useContext as f } from "react";
3
+ import { FieldErrorContext as c, FieldError as d } from "react-aria-components";
4
+ import { c as a } from "./clsx-AexbMWKp.js";
5
+ import { T as m } from "./Text-TWzJxnto.js";
6
+ import '../assets/FieldError.css';const E = "_fieldError_u3cks_1", u = {
7
+ fieldError: E
8
+ }, x = n(
9
+ (r, s) => {
10
+ const { children: o, isInvalid: l } = r, e = a(u.fieldError, r.className), t = f(c);
11
+ return !t && l && typeof o != "function" ? /* @__PURE__ */ i(m, { className: e, children: o }) : t?.isInvalid ? /* @__PURE__ */ i(
12
+ d,
13
+ {
14
+ ...r,
15
+ ref: s,
16
+ className: e
17
+ }
18
+ ) : null;
19
+ }
20
+ );
21
+ x.displayName = "FieldError";
22
+ export {
23
+ x as F
24
+ };
@@ -3,7 +3,7 @@ import { Radio as u, RadioGroup as _, Group as f } from "react-aria-components";
3
3
  import { c as p } from "./clsx-AexbMWKp.js";
4
4
  import { a as G, L as R } from "./Label-Dup4lWaR.js";
5
5
  import { T as h } from "./Text-TWzJxnto.js";
6
- import { F as t } from "./FieldError-Bc0acYNs.js";
6
+ import { F as t } from "./FieldError-Bra5aRT3.js";
7
7
  import '../assets/Radio.css';const x = "_radioGroup_1ls9z_1", w = "_wrap_1ls9z_12", z = "_radio_1ls9z_1", s = {
8
8
  radioGroup: x,
9
9
  wrap: w,
@@ -1,7 +1,7 @@
1
1
  import { jsx as e, jsxs as o } from "react/jsx-runtime";
2
2
  import { RangeCalendarContext as h, CalendarGrid as C, CalendarCell as g, Calendar as v, RangeCalendar as _ } from "react-aria-components";
3
3
  import { c as p, a as l } from "./clsx-AexbMWKp.js";
4
- import { F as c } from "./FieldError-Bc0acYNs.js";
4
+ import { F as c } from "./FieldError-Bra5aRT3.js";
5
5
  import * as y from "react";
6
6
  import { B as i } from "./Button-wBgWrXj3.js";
7
7
  import { H as f } from "./Heading-D8tNNJkt.js";
@@ -5,7 +5,7 @@ import { c as l } from "./clsx-AexbMWKp.js";
5
5
  import * as x from "react";
6
6
  import { useSearchFieldState as j } from "react-stately";
7
7
  import { useSearchField as C } from "react-aria";
8
- import { F as f } from "./FieldError-Bc0acYNs.js";
8
+ import { F as f } from "./FieldError-Bra5aRT3.js";
9
9
  import { c as p } from "./createLucideIcon-D4r5Phnh.js";
10
10
  import { X as B } from "./x-BXShoIAM.js";
11
11
  import { u as D } from "./useLocalizedStringFormatter-ZgRJmvHC.js";
@@ -4,9 +4,9 @@ import { FocusScope as b } from "@react-aria/focus";
4
4
  import { a as T, L as N } from "./Label-Dup4lWaR.js";
5
5
  import { a as y, c as h } from "./clsx-AexbMWKp.js";
6
6
  import { T as B } from "./Text-TWzJxnto.js";
7
- import { F as _ } from "./FieldError-Bc0acYNs.js";
7
+ import { F as _ } from "./FieldError-Bra5aRT3.js";
8
8
  import f, { useContext as p } from "react";
9
- import { C as L } from "./Checkbox-gsEu5wcB.js";
9
+ import { C as L } from "./Checkbox-BTAfwDxU.js";
10
10
  import { u } from "./useLocalizedStringFormatter-ZgRJmvHC.js";
11
11
  import { useFocusManager as M } from "react-aria";
12
12
  import { X as F } from "./x-BXShoIAM.js";
@@ -19,11 +19,11 @@ import { useFormValidation as ce } from "@react-aria/form";
19
19
  import { useVisuallyHidden as de } from "@react-aria/visually-hidden";
20
20
  import { a as ue, L as me } from "./Label-Dup4lWaR.js";
21
21
  import { T as ge } from "./Text-TWzJxnto.js";
22
- import { C as fe } from "./Checkbox-gsEu5wcB.js";
22
+ import { C as fe } from "./Checkbox-BTAfwDxU.js";
23
23
  import { X as pe } from "./x-BXShoIAM.js";
24
24
  import { u as B } from "./useLocalizedStringFormatter-ZgRJmvHC.js";
25
25
  import { C as ye } from "./chevron-down-DgT-uSF9.js";
26
- import { F as he } from "./FieldError-Bc0acYNs.js";
26
+ import { F as he } from "./FieldError-Bra5aRT3.js";
27
27
  import '../assets/Select2.css';const T = ({ item: e }) => /* @__PURE__ */ o(
28
28
  X,
29
29
  {
@@ -1,6 +1,6 @@
1
1
  import { jsx as e, jsxs as i, Fragment as b } from "react/jsx-runtime";
2
2
  import { Table as w, useTableOptions as u, TableHeader as g, Collection as p, Row as N, Button as k, Column as f, Cell as x, TableBody as T } from "react-aria-components";
3
- import { C as h } from "./Checkbox-gsEu5wcB.js";
3
+ import { C as h } from "./Checkbox-BTAfwDxU.js";
4
4
  import { c as a } from "./clsx-AexbMWKp.js";
5
5
  import { c as d } from "./createLucideIcon-D4r5Phnh.js";
6
6
  import '../assets/Table.css';const C = [
@@ -0,0 +1,137 @@
1
+ import { jsxs as c, jsx as s, Fragment as P } from "react/jsx-runtime";
2
+ import { forwardRef as l, useState as C } from "react";
3
+ import { useContextProps as p, TextFieldContext as b, TextField as g, InputContext as f, Input as I, TextArea as v } from "react-aria-components";
4
+ import { a as A, c as h } from "./clsx-AexbMWKp.js";
5
+ import { s as d } from "./TextField.module-DZslrEPC.js";
6
+ import { T as w } from "./Text-TWzJxnto.js";
7
+ import { B } from "./Button-wBgWrXj3.js";
8
+ import { u as L } from "./useLocalizedStringFormatter-ZgRJmvHC.js";
9
+ import { F as u } from "./FieldError-Bra5aRT3.js";
10
+ import { C as E } from "./CharacterCounter-R6vh7AE5.js";
11
+ import { a as S, L as $ } from "./Label-Dup4lWaR.js";
12
+ const x = l(
13
+ (e, a) => {
14
+ [e] = p(e, a, b);
15
+ const {
16
+ label: r,
17
+ description: o,
18
+ errorMessage: i,
19
+ showCounter: n,
20
+ errorPosition: t = "top",
21
+ size: m = "large",
22
+ popover: N,
23
+ children: y
24
+ } = e;
25
+ return /* @__PURE__ */ c(
26
+ g,
27
+ {
28
+ ...e,
29
+ className: A(d.textField, {
30
+ [d.medium]: m === "medium"
31
+ }),
32
+ children: [
33
+ /* @__PURE__ */ s(S, { popover: N, children: r && /* @__PURE__ */ s($, { children: r }) }),
34
+ o && /* @__PURE__ */ s(w, { slot: "description", children: o }),
35
+ n && /* @__PURE__ */ s(E, { isLonely: !o }),
36
+ t === "top" && /* @__PURE__ */ s(u, { "data-testid": "fieldError", children: i }),
37
+ y,
38
+ t === "bottom" && /* @__PURE__ */ s(
39
+ u,
40
+ {
41
+ "data-testid": "fieldError",
42
+ className: d.bottomError,
43
+ children: i
44
+ }
45
+ )
46
+ ]
47
+ }
48
+ );
49
+ }
50
+ );
51
+ x.displayName = "TextFieldBase";
52
+ const j = { hide: "Hide", show: "Show" }, z = { hide: "Dölj", show: "Visa" }, D = {
53
+ en: j,
54
+ sv: z
55
+ }, T = l(
56
+ (e, a) => {
57
+ [e, a] = p(e, a, f);
58
+ const [r, o] = C(!1), i = () => o((t) => !t), n = L(D);
59
+ return /* @__PURE__ */ c(P, { children: [
60
+ r && /* @__PURE__ */ s(
61
+ w,
62
+ {
63
+ slot: "description",
64
+ className: d.passwordText,
65
+ children: e.value
66
+ }
67
+ ),
68
+ /* @__PURE__ */ s(
69
+ B,
70
+ {
71
+ variant: "tertiary",
72
+ onPress: i,
73
+ className: d.passwordButton,
74
+ children: r ? n.format("hide") : n.format("show")
75
+ }
76
+ )
77
+ ] });
78
+ }
79
+ );
80
+ T.displayName = "PasswordField";
81
+ const F = l(
82
+ ({ skipContext: e = !1, ...a }, r) => {
83
+ const [o, i] = p(
84
+ a,
85
+ r,
86
+ f
87
+ ), n = e ? r : i, t = e ? a : o;
88
+ return /* @__PURE__ */ c("div", { className: d.wrap, children: [
89
+ /* @__PURE__ */ s(
90
+ I,
91
+ {
92
+ ...t,
93
+ ref: n,
94
+ className: h(d.input, t.className)
95
+ }
96
+ ),
97
+ t.type === "password" && /* @__PURE__ */ s(T, { ...t })
98
+ ] });
99
+ }
100
+ );
101
+ F.displayName = "Input";
102
+ const H = l(
103
+ ({ className: e, list: a, type: r, min: o, max: i, form: n, ...t }, m) => /* @__PURE__ */ s(x, { ...t, children: /* @__PURE__ */ s(
104
+ F,
105
+ {
106
+ className: h(e),
107
+ form: n,
108
+ list: a,
109
+ min: o,
110
+ max: i,
111
+ ref: m,
112
+ type: r,
113
+ skipContext: !0
114
+ }
115
+ ) })
116
+ );
117
+ H.displayName = "TextField";
118
+ const M = l(
119
+ ({ className: e, cols: a, form: r, rows: o, wrap: i, ...n }, t) => /* @__PURE__ */ s(x, { ...n, children: /* @__PURE__ */ s(
120
+ v,
121
+ {
122
+ className: h(d.textArea, e),
123
+ cols: a,
124
+ form: r,
125
+ ref: t,
126
+ rows: o,
127
+ wrap: i
128
+ }
129
+ ) })
130
+ );
131
+ M.displayName = "TextArea";
132
+ export {
133
+ F as I,
134
+ x as T,
135
+ H as a,
136
+ M as b
137
+ };
package/combobox/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { C as a, a as b, b as x } from "../chunks/ComboBox-yl5zHYPk.js";
1
+ import { C as a, a as b, b as x } from "../chunks/ComboBox-DVK0dL2W.js";
2
2
  export {
3
3
  a as ComboBox,
4
4
  b as ComboBoxItem,
@@ -1,4 +1,4 @@
1
- import { D as t } from "../chunks/DateField-BsT1K-bB.js";
1
+ import { D as t } from "../chunks/DateField-06YL8tj_.js";
2
2
  import { a as r, b as o, D as p } from "../chunks/DateInputDivider-CkTB5q5k.js";
3
3
  export {
4
4
  t as DateField,
@@ -1,4 +1,4 @@
1
- import { D as r, a as t } from "../chunks/DateRangePicker-BsK7pMRv.js";
1
+ import { D as r, a as t } from "../chunks/DateRangePicker-CZRWDV_g.js";
2
2
  export {
3
3
  r as DatePicker,
4
4
  t as DateRangePicker
@@ -1,7 +1,5 @@
1
- import { Ref } from 'react';
2
1
  import { FieldErrorProps as AriaFieldErrorProps } from 'react-aria-components';
3
2
  export interface FieldErrorProps extends AriaFieldErrorProps {
4
3
  isInvalid?: boolean;
5
- ref?: Ref<HTMLElement>;
6
4
  }
7
- export declare const FieldError: ({ ref, ...props }: FieldErrorProps) => import("react/jsx-runtime").JSX.Element | null;
5
+ export declare const FieldError: import('react').ForwardRefExoticComponent<FieldErrorProps & import('react').RefAttributes<HTMLElement>>;
@@ -1,4 +1,4 @@
1
- import { F as e } from "../chunks/FieldError-Bc0acYNs.js";
1
+ import { F as e } from "../chunks/FieldError-Bra5aRT3.js";
2
2
  export {
3
3
  e as FieldError
4
4
  };
package/index.js CHANGED
@@ -3,17 +3,17 @@ import { B as s, a as p } from "./chunks/BadgeContainer-CKVsfTlF.js";
3
3
  import { B as m } from "./chunks/Breadcrumbs-By2bMbQd.js";
4
4
  import { B as i } from "./chunks/Button-wBgWrXj3.js";
5
5
  import { B as d } from "./chunks/ButtonGroup-Dr6HOBo2.js";
6
- import { C as l, R as C } from "./chunks/RangeCalendar-BF-6p7u2.js";
6
+ import { C as l, R as C } from "./chunks/RangeCalendar-BSth1Fmv.js";
7
7
  import { C as g, d as u, c as B, a as c, e as L, f as S, b as D } from "./chunks/Card-ia98VoKL.js";
8
- import { C as G } from "./chunks/CharacterCounter-_m-SgTMV.js";
9
- import { C as R } from "./chunks/Checkbox-gsEu5wcB.js";
10
- import { C as M } from "./chunks/CheckboxGroup-A7UJMi5J.js";
8
+ import { C as G } from "./chunks/CharacterCounter-R6vh7AE5.js";
9
+ import { C as R } from "./chunks/Checkbox-BTAfwDxU.js";
10
+ import { C as M } from "./chunks/CheckboxGroup-BQ8EpX7O.js";
11
11
  import { C as v } from "./chunks/ColorSchemeSwitch-DugvPh6T.js";
12
- import { C as h, a as H, b as y } from "./chunks/ComboBox-yl5zHYPk.js";
13
- import { D as N } from "./chunks/DateField-BsT1K-bB.js";
12
+ import { C as h, a as H, b as y } from "./chunks/ComboBox-DVK0dL2W.js";
13
+ import { D as N } from "./chunks/DateField-06YL8tj_.js";
14
14
  import { a as Q, b as Z, D as j } from "./chunks/DateInputDivider-CkTB5q5k.js";
15
- import { D as z, a as J } from "./chunks/DateRangePicker-BsK7pMRv.js";
16
- import { F as O } from "./chunks/FieldError-Bc0acYNs.js";
15
+ import { D as z, a as J } from "./chunks/DateRangePicker-CZRWDV_g.js";
16
+ import { F as O } from "./chunks/FieldError-Bra5aRT3.js";
17
17
  import { D as V, F as W } from "./chunks/FileUpload-h1PxqQmb.js";
18
18
  import { G as Y } from "./chunks/Grid-B-WgMwON.js";
19
19
  import { G as $ } from "./chunks/GridItem-5t1Z14sM.js";
@@ -27,17 +27,17 @@ import { L as uo } from "./chunks/Logo-InDSslpO.js";
27
27
  import { M as co } from "./chunks/Dialog-DC0cGNj5.js";
28
28
  import { P as So } from "./chunks/Popover-BcEtFiU1.js";
29
29
  import { P as Io } from "./chunks/ProgressBar-CbwvcHvk.js";
30
- import { R as Po, a as Ro } from "./chunks/Radio-CSFYbin8.js";
31
- import { S as Mo } from "./chunks/SearchField-mBHZ9pFg.js";
32
- import { S as vo } from "./chunks/Select-Df4333VV.js";
33
- import { S as ho } from "./chunks/Select-BjD5iQvX.js";
30
+ import { R as Po, a as Ro } from "./chunks/Radio-BDHczAt5.js";
31
+ import { S as Mo } from "./chunks/SearchField-DTkfUFwn.js";
32
+ import { S as vo } from "./chunks/Select-C8Fr7Vn3.js";
33
+ import { S as ho } from "./chunks/Select-CPM82ww2.js";
34
34
  import { S as yo } from "./chunks/Skeleton-DqIHQLQl.js";
35
35
  import { S as No } from "./chunks/Spinner-BORNnHph.js";
36
- import { b as Qo, C as Zo, R as jo, T as qo, c as zo, a as Jo } from "./chunks/Table-t3rVzb31.js";
36
+ import { b as Qo, C as Zo, R as jo, T as qo, c as zo, a as Jo } from "./chunks/Table-BgsgXhC_.js";
37
37
  import { a as Oo, c as Uo, b as Vo, T as Wo } from "./chunks/TabList-D2XV5ixe.js";
38
38
  import { T as Yo, a as _o } from "./chunks/Tag-DxBoeE_n.js";
39
39
  import { T as oa } from "./chunks/Text-TWzJxnto.js";
40
- import { I as ra, b as ea, a as ta, T as sa } from "./chunks/TextArea-B2BePnZz.js";
40
+ import { I as ra, b as ea, a as ta, T as sa } from "./chunks/TextArea-DQ_dAC-2.js";
41
41
  import { G as xa, b as ma, T as fa, a as ia, t as na } from "./chunks/Toast-DTwUGSJ8.js";
42
42
  import { T as Ta, a as la } from "./chunks/ToggleButtonGroup-CXKTrLbb.js";
43
43
  import { T as ba, a as ga } from "./chunks/Tooltip-m032jGgF.js";
@@ -1,6 +1,8 @@
1
- import { SelectContainerProps } from './types';
1
+ import { SelectProps } from './types';
2
2
  import * as React from 'react';
3
3
  /**
4
4
  * @deprecated since v15.2.0 Kept for backwards compatibility, but will be removed in a future version. Use `Select` from `@midas-ds/components` instead.
5
5
  */
6
- export declare const Select: React.ForwardRefExoticComponent<Omit<SelectContainerProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
6
+ export declare const Select: React.ForwardRefExoticComponent<Omit<SelectProps, "children" | "items"> & {
7
+ options: import('..').ListBoxOption[];
8
+ } & React.RefAttributes<HTMLButtonElement>>;
@@ -1,4 +1,4 @@
1
- import { S as c } from "../chunks/Select-BjD5iQvX.js";
1
+ import { S as c } from "../chunks/Select-CPM82ww2.js";
2
2
  export {
3
3
  c as LegacySelect
4
4
  };
@@ -3,7 +3,7 @@ import { FormValidationState } from '@react-stately/form';
3
3
  import { OverlayTriggerProps } from '@react-types/overlays';
4
4
  import { ListState } from '@react-stately/list';
5
5
  import { AsyncLoadable, CollectionBase, FocusableProps, InputBase, LabelableProps, MultipleSelection, TextInputBase, Validation, Key, Node, CollectionChildren } from '@react-types/shared';
6
- import { HTMLAttributes, Ref } from 'react';
6
+ import { HTMLAttributes } from 'react';
7
7
  import { AriaListBoxOptions } from 'react-aria';
8
8
  import { AriaButtonProps } from '@react-types/button';
9
9
  import { AriaSelectProps } from '@react-types/select';
@@ -176,5 +176,4 @@ export interface SelectProps extends MultiSelectStateProps<ListBoxOption> {
176
176
  export type SelectContainerProps = Omit<SelectProps, 'children' | 'items'> & {
177
177
  /** Item objects in the collection. */
178
178
  options: ListBoxOption[];
179
- ref?: Ref<HTMLButtonElement>;
180
179
  };
package/package.json CHANGED
@@ -14,7 +14,7 @@
14
14
  "description": "Midas Components",
15
15
  "homepage": "https://designsystem.migrationsverket.se/",
16
16
  "license": "CC0-1.0",
17
- "version": "16.2.5",
17
+ "version": "16.3.0",
18
18
  "module": "./index.js",
19
19
  "type": "module",
20
20
  "main": "./index.js",
package/radio/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { R as r, a as R } from "../chunks/Radio-CSFYbin8.js";
1
+ import { R as r, a as R } from "../chunks/Radio-BDHczAt5.js";
2
2
  export {
3
3
  r as Radio,
4
4
  R as RadioGroup
@@ -1,4 +1,4 @@
1
- import { S as a } from "../chunks/SearchField-mBHZ9pFg.js";
1
+ import { S as a } from "../chunks/SearchField-DTkfUFwn.js";
2
2
  export {
3
3
  a as SearchField
4
4
  };
package/select/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { S as r } from "../chunks/Select-Df4333VV.js";
1
+ import { S as r } from "../chunks/Select-C8Fr7Vn3.js";
2
2
  export {
3
3
  r as Select
4
4
  };
package/table/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { b as l, C as s, R as o, T as b, c as T, a as r } from "../chunks/Table-t3rVzb31.js";
1
+ import { b as l, C as s, R as o, T as b, c as T, a as r } from "../chunks/Table-BgsgXhC_.js";
2
2
  export {
3
3
  l as Cell,
4
4
  s as Column,
@@ -1,10 +1,8 @@
1
1
  import { InputProps as AriaInputProps } from 'react-aria-components';
2
- import { Ref } from 'react';
3
2
  export interface InputProps extends AriaInputProps {
4
3
  /** If the component should use local props and ref instead of a parent context
5
4
  * @default false
6
5
  */
7
6
  skipContext?: boolean;
8
- ref?: Ref<HTMLInputElement>;
9
7
  }
10
- export declare const Input: ({ ref: localRef, skipContext, ...localProps }: InputProps) => import("react/jsx-runtime").JSX.Element;
8
+ export declare const Input: import('react').ForwardRefExoticComponent<InputProps & import('react').RefAttributes<HTMLInputElement>>;
@@ -1,2 +1,2 @@
1
1
  import { InputProps } from './Input';
2
- export declare const PasswordField: ({ ref, ...props }: InputProps) => import("react/jsx-runtime").JSX.Element;
2
+ export declare const PasswordField: import('react').ForwardRefExoticComponent<InputProps & import('react').RefAttributes<HTMLInputElement>>;
@@ -1,8 +1,5 @@
1
- import { Ref } from 'react';
2
1
  import { TextFieldBaseProps } from './TextFieldBase';
3
2
  import { TextAreaProps as AriaTextAreaProps } from 'react-aria-components';
4
3
  import { Complement } from '../utils/types';
5
- export interface TextAreaProps extends Omit<TextFieldBaseProps, 'type' | 'pattern'>, Complement<TextFieldBaseProps, AriaTextAreaProps> {
6
- ref?: Ref<HTMLTextAreaElement>;
7
- }
8
- export declare const TextArea: ({ className, form, rows, wrap, ref, ...rest }: TextAreaProps) => import("react/jsx-runtime").JSX.Element;
4
+ export type TextAreaProps = Omit<TextFieldBaseProps, 'type' | 'pattern'> & Complement<TextFieldBaseProps, AriaTextAreaProps>;
5
+ export declare const TextArea: import('react').ForwardRefExoticComponent<Omit<TextFieldBaseProps, "type" | "pattern"> & Complement<TextFieldBaseProps, AriaTextAreaProps> & import('react').RefAttributes<HTMLTextAreaElement>>;
@@ -1,8 +1,5 @@
1
- import { Ref } from 'react';
2
1
  import { TextFieldBaseProps } from './TextFieldBase';
3
2
  import { InputProps } from './Input';
4
3
  import { Complement } from '../utils/types';
5
- export interface TextFieldProps extends TextFieldBaseProps, Complement<TextFieldBaseProps, InputProps> {
6
- ref?: Ref<HTMLInputElement>;
7
- }
8
- export declare const TextField: ({ className, form, list, min, max, ref, type, ...rest }: TextFieldProps) => import("react/jsx-runtime").JSX.Element;
4
+ export type TextFieldProps = TextFieldBaseProps & Complement<TextFieldBaseProps, InputProps>;
5
+ export declare const TextField: import('react').ForwardRefExoticComponent<TextFieldBaseProps & Complement<TextFieldBaseProps, InputProps> & import('react').RefAttributes<HTMLInputElement>>;
@@ -23,4 +23,4 @@ export interface TextFieldBaseProps extends Omit<TextFieldProps, 'className'> {
23
23
  size?: Size;
24
24
  popover?: InfoPopoverProps;
25
25
  }
26
- export declare const TextFieldBase: (props: TextFieldBaseProps) => import("react/jsx-runtime").JSX.Element;
26
+ export declare const TextFieldBase: import('react').ForwardRefExoticComponent<TextFieldBaseProps & import('react').RefAttributes<HTMLDivElement>>;
@@ -1,4 +1,4 @@
1
- import { I as s, b as t, a as x, T } from "../chunks/TextArea-B2BePnZz.js";
1
+ import { I as s, b as t, a as x, T } from "../chunks/TextArea-DQ_dAC-2.js";
2
2
  export {
3
3
  s as Input,
4
4
  t as TextArea,
@@ -1,20 +0,0 @@
1
- import { jsx as s } from "react/jsx-runtime";
2
- import { useContextProps as h, InputContext as i } from "react-aria-components";
3
- import '../assets/CharacterCounter.css';const d = "_characterCounter_1f0mh_1", u = {
4
- characterCounter: d
5
- }, m = ({ ref: r, ...t }) => {
6
- [t] = h(t, r, i);
7
- const { maxLength: e, value: a, isLonely: c } = t, { length: n } = a?.toString() ?? "", o = e !== void 0;
8
- return /* @__PURE__ */ s(
9
- "span",
10
- {
11
- className: u.characterCounter,
12
- "data-exceeded": o && n > e || void 0,
13
- "data-lonely": c || void 0,
14
- children: o ? `${n} / ${e}` : n
15
- }
16
- );
17
- };
18
- export {
19
- m as C
20
- };
@@ -1,119 +0,0 @@
1
- import { jsxs as b, jsx as o } from "react/jsx-runtime";
2
- import v, { useContext as k, useRef as f } from "react";
3
- import { mergeProps as l, VisuallyHidden as C, useCheckboxGroupItem as _, useCheckbox as R, useHover as I, usePress as P, useFocusRing as g } from "react-aria";
4
- import { useContextProps as G, CheckboxContext as y, useSlottedContext as z, FormContext as B } from "react-aria-components";
5
- import { a as u } from "./clsx-AexbMWKp.js";
6
- import { variables as h } from "@midas-ds/theme";
7
- import { c as F } from "./createLucideIcon-D4r5Phnh.js";
8
- import { C as L } from "./check-BxlvVsvD.js";
9
- import { useToggleState as N } from "@react-stately/toggle";
10
- import '../assets/Checkbox.css';const S = [["path", { d: "M5 12h14", key: "1ays0h" }]], D = F("minus", S), H = v.createContext(null), O = "_checkboxInner_tzrii_1", j = "_checkbox_tzrii_1", q = "_checkboxGroup_tzrii_143", A = "_checkboxList_tzrii_154", x = {
11
- checkboxInner: O,
12
- checkbox: j,
13
- checkboxGroup: q,
14
- checkboxList: A
15
- }, m = ({ ref: t, ...e }) => {
16
- const { hoverProps: i, isHovered: c } = e.hoverResult, { pressProps: s, isPressed: n } = e.pressResult, { isFocused: a, isFocusVisible: r, focusProps: d } = e.focusRingAria;
17
- return /* @__PURE__ */ b(
18
- "label",
19
- {
20
- ref: t,
21
- ...l(i, s, e.labelProps),
22
- slot: e.slot || void 0,
23
- className: u(x.checkbox, e.className),
24
- "data-hovered": c || void 0,
25
- "data-selected": e.isSelected || void 0,
26
- "data-indeterminate": e.isIndeterminate || void 0,
27
- "data-pressed": n || void 0,
28
- "data-disabled": e.isDisabled || void 0,
29
- "data-readonly": e.isReadOnly || void 0,
30
- "data-invalid": e.isInvalid || void 0,
31
- "data-focused": a || void 0,
32
- "data-focus-visible": r || void 0,
33
- "data-required": e.isRequired || void 0,
34
- children: [
35
- /* @__PURE__ */ o("div", { className: u(x.checkboxInner), children: e.isIndeterminate ? /* @__PURE__ */ o(
36
- D,
37
- {
38
- size: 14,
39
- color: h.iconOnColor
40
- }
41
- ) : /* @__PURE__ */ o(
42
- L,
43
- {
44
- size: 14,
45
- color: h.iconOnColor
46
- }
47
- ) }),
48
- /* @__PURE__ */ o(C, { children: /* @__PURE__ */ o(
49
- "input",
50
- {
51
- ...l(e.inputProps, d),
52
- ref: e.inputRef
53
- }
54
- ) }),
55
- e.children
56
- ]
57
- }
58
- );
59
- }, M = ({ ref: t, ...e }) => {
60
- const i = _(
61
- {
62
- ...e,
63
- value: e.value || ""
64
- },
65
- e.state,
66
- e.inputRef
67
- );
68
- return /* @__PURE__ */ o(
69
- m,
70
- {
71
- ...e,
72
- ...i,
73
- ref: t
74
- }
75
- );
76
- }, V = ({ ref: t, ...e }) => {
77
- const i = R(e, N(e), e.inputRef);
78
- return /* @__PURE__ */ o(
79
- m,
80
- {
81
- ...e,
82
- ...i,
83
- ref: t
84
- }
85
- );
86
- }, Y = ({ ref: t, ...e }) => {
87
- [e, t] = G(e, t, y);
88
- const i = z(B), c = e.validationBehavior ?? i?.validationBehavior ?? "native", s = k(H), n = f(null), a = I(e), r = P({
89
- ref: t,
90
- isDisabled: e.isDisabled
91
- }), d = g();
92
- return s ? /* @__PURE__ */ o(
93
- M,
94
- {
95
- ...e,
96
- state: s,
97
- inputRef: n,
98
- hoverResult: a,
99
- pressResult: r,
100
- focusRingAria: d,
101
- validationBehavior: c
102
- }
103
- ) : /* @__PURE__ */ o(
104
- V,
105
- {
106
- ...e,
107
- inputRef: n,
108
- hoverResult: a,
109
- pressResult: r,
110
- focusRingAria: d,
111
- validationBehavior: c
112
- }
113
- );
114
- };
115
- export {
116
- Y as C,
117
- H as a,
118
- x as s
119
- };
@@ -1,21 +0,0 @@
1
- import { jsx as i } from "react/jsx-runtime";
2
- import { useContext as l } from "react";
3
- import { FieldErrorContext as c, FieldError as f } from "react-aria-components";
4
- import { c as m } from "./clsx-AexbMWKp.js";
5
- import { T as d } from "./Text-TWzJxnto.js";
6
- import '../assets/FieldError.css';const a = "_fieldError_u3cks_1", E = {
7
- fieldError: a
8
- }, v = ({ ref: s, ...r }) => {
9
- const { children: o, isInvalid: n } = r, t = m(E.fieldError, r.className), e = l(c);
10
- return !e && n && typeof o != "function" ? /* @__PURE__ */ i(d, { className: t, children: o }) : e?.isInvalid ? /* @__PURE__ */ i(
11
- f,
12
- {
13
- ...r,
14
- ref: s,
15
- className: t
16
- }
17
- ) : null;
18
- };
19
- export {
20
- v as F
21
- };
@@ -1,136 +0,0 @@
1
- import { jsxs as l, jsx as e, Fragment as T } from "react/jsx-runtime";
2
- import { TextField as F, useContextProps as h, InputContext as u, Input as N, TextArea as P } from "react-aria-components";
3
- import { a as b, c as m } from "./clsx-AexbMWKp.js";
4
- import { s as c } from "./TextField.module-DZslrEPC.js";
5
- import { useState as g } from "react";
6
- import { T as x } from "./Text-TWzJxnto.js";
7
- import { B as C } from "./Button-wBgWrXj3.js";
8
- import { u as v } from "./useLocalizedStringFormatter-ZgRJmvHC.js";
9
- import { F as p } from "./FieldError-Bc0acYNs.js";
10
- import { C as I } from "./CharacterCounter-_m-SgTMV.js";
11
- import { a as L, L as y } from "./Label-Dup4lWaR.js";
12
- const f = (t) => {
13
- const {
14
- label: s,
15
- description: r,
16
- errorMessage: a,
17
- showCounter: n,
18
- errorPosition: o = "top",
19
- size: i = "large",
20
- popover: d,
21
- children: w
22
- } = t;
23
- return /* @__PURE__ */ l(
24
- F,
25
- {
26
- ...t,
27
- className: b(c.textField, {
28
- [c.medium]: i === "medium"
29
- }),
30
- children: [
31
- /* @__PURE__ */ e(L, { popover: d, children: s && /* @__PURE__ */ e(y, { children: s }) }),
32
- r && /* @__PURE__ */ e(x, { slot: "description", children: r }),
33
- n && /* @__PURE__ */ e(I, { isLonely: !r }),
34
- o === "top" && /* @__PURE__ */ e(p, { "data-testid": "fieldError", children: a }),
35
- w,
36
- o === "bottom" && /* @__PURE__ */ e(
37
- p,
38
- {
39
- "data-testid": "fieldError",
40
- className: c.bottomError,
41
- children: a
42
- }
43
- )
44
- ]
45
- }
46
- );
47
- }, A = { hide: "Hide", show: "Show" }, B = { hide: "Dölj", show: "Visa" }, E = {
48
- en: A,
49
- sv: B
50
- }, S = ({ ref: t, ...s }) => {
51
- [s, t] = h(s, t, u);
52
- const [r, a] = g(!1), n = () => a((i) => !i), o = v(E);
53
- return /* @__PURE__ */ l(T, { children: [
54
- r && /* @__PURE__ */ e(
55
- x,
56
- {
57
- slot: "description",
58
- className: c.passwordText,
59
- children: s.value
60
- }
61
- ),
62
- /* @__PURE__ */ e(
63
- C,
64
- {
65
- variant: "tertiary",
66
- onPress: n,
67
- className: c.passwordButton,
68
- children: r ? o.format("hide") : o.format("show")
69
- }
70
- )
71
- ] });
72
- }, $ = ({
73
- ref: t,
74
- skipContext: s = !1,
75
- ...r
76
- }) => {
77
- const [a, n] = h(
78
- r,
79
- t,
80
- u
81
- ), o = s ? t : n, i = s ? r : a;
82
- return /* @__PURE__ */ l("div", { className: c.wrap, children: [
83
- /* @__PURE__ */ e(
84
- N,
85
- {
86
- ...i,
87
- ref: o,
88
- className: m(c.input, i.className)
89
- }
90
- ),
91
- i.type === "password" && /* @__PURE__ */ e(S, { ...i })
92
- ] });
93
- }, K = ({
94
- className: t,
95
- form: s,
96
- list: r,
97
- min: a,
98
- max: n,
99
- ref: o,
100
- type: i,
101
- ...d
102
- }) => /* @__PURE__ */ e(f, { ...d, children: /* @__PURE__ */ e(
103
- $,
104
- {
105
- className: m(t),
106
- form: s,
107
- list: r,
108
- min: a,
109
- max: n,
110
- ref: o,
111
- type: i,
112
- skipContext: !0
113
- }
114
- ) }), O = ({
115
- className: t,
116
- form: s,
117
- rows: r,
118
- wrap: a,
119
- ref: n,
120
- ...o
121
- }) => /* @__PURE__ */ e(f, { ...o, children: /* @__PURE__ */ e(
122
- P,
123
- {
124
- className: m(c.textArea, t),
125
- form: s,
126
- ref: n,
127
- rows: r,
128
- wrap: a
129
- }
130
- ) });
131
- export {
132
- $ as I,
133
- f as T,
134
- K as a,
135
- O as b
136
- };