@midas-ds/components 17.11.5 → 17.11.6

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/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## 17.11.6 (2026-04-14)
2
+
3
+ ### 🩹 Fixes
4
+
5
+ - **components, date-picker:** add forwardRef and generic type ([eba8d627dac](https://github.com/migrationsverket/midas/commit/eba8d627dac))
6
+
1
7
  ## 17.11.5 (2026-04-14)
2
8
 
3
9
  ### 🩹 Fixes
@@ -0,0 +1,202 @@
1
+ 'use client';
2
+ import { jsx as e, jsxs as h } from "react/jsx-runtime";
3
+ import * as f from "react";
4
+ import { Group as B, DatePickerStateContext as M, DateRangePickerStateContext as N, Popover as S, Dialog as R, DatePicker as w, DateRangePicker as G } from "react-aria-components";
5
+ import { a as k } from "./clsx-AexbMWKp.js";
6
+ import { C as L, R as I } from "./RangeCalendar-DxLInTav.js";
7
+ import { D as P, a as v } from "./DateInput-NzWcnB4y.js";
8
+ import { F as _ } from "./FieldError-krpMBtie.js";
9
+ import { a as g, L as y } from "./Label-Cg0aAlnt.js";
10
+ import { T as D } from "./Text-D0r_W4lH.js";
11
+ import { C as O } from "./ClearButton-DkC8PIMi.js";
12
+ import { FocusScope as V, useFocusManager as T } from "@react-aria/focus";
13
+ import { B as $ } from "./Button-GCROAMSl.js";
14
+ import { c as A } from "./createLucideIcon-CP-mMPfa.js";
15
+ import { u as j } from "./useLocalizedStringFormatter-BHvsRxDk.js";
16
+ import { D as E } from "./DateInputDivider-BHAwPkIR.js";
17
+ import '../assets/DateRangePicker.css';const W = [
18
+ ["path", { d: "M8 2v4", key: "1cmpym" }],
19
+ ["path", { d: "M16 2v4", key: "4m81vk" }],
20
+ ["rect", { width: "18", height: "18", x: "3", y: "4", rx: "2", key: "1hopcy" }],
21
+ ["path", { d: "M3 10h18", key: "8toen8" }],
22
+ ["path", { d: "M8 14h.01", key: "6423bh" }],
23
+ ["path", { d: "M12 14h.01", key: "1etili" }],
24
+ ["path", { d: "M16 14h.01", key: "1gbofw" }],
25
+ ["path", { d: "M8 18h.01", key: "lrp35t" }],
26
+ ["path", { d: "M12 18h.01", key: "mhygvu" }],
27
+ ["path", { d: "M16 18h.01", key: "kzsmim" }]
28
+ ], q = A("calendar-days", W), H = { clear: "Clear date", "open-calendar": "Open calendar" }, J = { clear: "Rensa datum", "open-calendar": "Öppna kalender" }, C = {
29
+ en: H,
30
+ sv: J
31
+ }, K = "_datePicker_13jtn_1", Q = "_inputField_13jtn_8", U = "_medium_13jtn_24", X = "_readOnly_13jtn_47", Y = "_buttonGroup_13jtn_52", Z = "_iconButton_13jtn_58", z = "_popover_13jtn_81 _dropdownAnimation_1ljkv_4", ee = "_dialog_13jtn_85", a = {
32
+ datePicker: K,
33
+ inputField: Q,
34
+ medium: U,
35
+ readOnly: X,
36
+ buttonGroup: Y,
37
+ iconButton: Z,
38
+ popover: z,
39
+ dialog: ee
40
+ }, te = (t) => !!t && !!t.value && Object.prototype.hasOwnProperty.call(t.value, "start"), ae = ({
41
+ isClearable: t,
42
+ isDisabled: c,
43
+ isReadOnly: i,
44
+ size: n
45
+ }) => {
46
+ const r = f.useContext(M), s = f.useContext(N), l = j(C), d = T(), o = s ?? r, u = te(o) ? !!o.value.start && o.value.end : !!o?.value;
47
+ return t && u && !i ? /* @__PURE__ */ e(
48
+ O,
49
+ {
50
+ onPress: () => {
51
+ o?.setValue(null), d?.focusFirst();
52
+ },
53
+ size: n,
54
+ isDisabled: c,
55
+ "aria-label": l.format("clear"),
56
+ className: k(a.iconButton, {
57
+ [a.medium]: n === "medium"
58
+ })
59
+ }
60
+ ) : null;
61
+ }, b = ({
62
+ children: t,
63
+ isDisabled: c,
64
+ isInvalid: i,
65
+ isReadOnly: n,
66
+ size: r = "large",
67
+ isClearable: s = !1
68
+ }) => {
69
+ const l = j(C);
70
+ return /* @__PURE__ */ e(
71
+ B,
72
+ {
73
+ className: k(a.inputField, {
74
+ [a.medium]: r === "medium",
75
+ [a.readOnly]: n
76
+ }),
77
+ children: /* @__PURE__ */ h(V, { children: [
78
+ t,
79
+ /* @__PURE__ */ h("div", { className: a.buttonGroup, children: [
80
+ /* @__PURE__ */ e(
81
+ ae,
82
+ {
83
+ isClearable: s,
84
+ isDisabled: c,
85
+ isReadOnly: n,
86
+ size: r
87
+ }
88
+ ),
89
+ /* @__PURE__ */ e(
90
+ $,
91
+ {
92
+ variant: "icon",
93
+ "aria-label": l.format("open-calendar"),
94
+ className: k(a.iconButton, {
95
+ [a.medium]: r === "medium",
96
+ [a.readOnly]: n
97
+ }),
98
+ "data-invalid": i || void 0,
99
+ size: r,
100
+ children: /* @__PURE__ */ e(
101
+ q,
102
+ {
103
+ "aria-hidden": !0,
104
+ size: 20
105
+ }
106
+ )
107
+ }
108
+ )
109
+ ] })
110
+ ] })
111
+ }
112
+ );
113
+ }, x = ({
114
+ children: t
115
+ }) => /* @__PURE__ */ e(S, { className: a.popover, children: /* @__PURE__ */ e(R, { className: a.dialog, children: t }) }), fe = f.forwardRef(
116
+ ({
117
+ className: t,
118
+ description: c,
119
+ errorMessage: i,
120
+ errorPosition: n = "top",
121
+ label: r,
122
+ popover: s,
123
+ isClearable: l = !1,
124
+ isReadOnly: d,
125
+ isDisabled: o,
126
+ size: u,
127
+ ...m
128
+ }, p) => /* @__PURE__ */ h(
129
+ w,
130
+ {
131
+ className: k(a.datePicker, t),
132
+ isReadOnly: d,
133
+ isDisabled: o,
134
+ ref: p,
135
+ ...m,
136
+ children: [
137
+ /* @__PURE__ */ e(g, { popover: s, children: r && /* @__PURE__ */ e(y, { children: r }) }),
138
+ c && /* @__PURE__ */ e(D, { slot: "description", children: c }),
139
+ n === "top" && /* @__PURE__ */ e(_, { children: i }),
140
+ /* @__PURE__ */ e(
141
+ b,
142
+ {
143
+ isClearable: l,
144
+ isReadOnly: d,
145
+ isDisabled: o,
146
+ size: u,
147
+ ...m,
148
+ children: /* @__PURE__ */ e(P, { children: (F) => /* @__PURE__ */ e(v, { segment: F }) })
149
+ }
150
+ ),
151
+ n === "bottom" && /* @__PURE__ */ e(_, { children: i }),
152
+ /* @__PURE__ */ e(x, { children: /* @__PURE__ */ e(L, {}) })
153
+ ]
154
+ }
155
+ )
156
+ ), Pe = ({
157
+ className: t,
158
+ description: c,
159
+ errorMessage: i,
160
+ errorPosition: n = "top",
161
+ label: r,
162
+ popover: s,
163
+ isClearable: l = !1,
164
+ isReadOnly: d,
165
+ isDisabled: o,
166
+ size: u,
167
+ ...m
168
+ }) => /* @__PURE__ */ h(
169
+ G,
170
+ {
171
+ className: k(a.datePicker, t),
172
+ isReadOnly: d,
173
+ isDisabled: o,
174
+ ...m,
175
+ children: [
176
+ /* @__PURE__ */ e(g, { popover: s, children: r && /* @__PURE__ */ e(y, { children: r }) }),
177
+ c && /* @__PURE__ */ e(D, { slot: "description", children: c }),
178
+ n === "top" && /* @__PURE__ */ e(_, { children: i }),
179
+ /* @__PURE__ */ h(
180
+ b,
181
+ {
182
+ isClearable: l,
183
+ isReadOnly: d,
184
+ isDisabled: o,
185
+ size: u,
186
+ ...m,
187
+ children: [
188
+ /* @__PURE__ */ e(P, { slot: "start", children: (p) => /* @__PURE__ */ e(v, { segment: p }) }),
189
+ /* @__PURE__ */ e(E, {}),
190
+ /* @__PURE__ */ e(P, { slot: "end", children: (p) => /* @__PURE__ */ e(v, { segment: p }) })
191
+ ]
192
+ }
193
+ ),
194
+ n === "bottom" && /* @__PURE__ */ e(_, { children: i }),
195
+ /* @__PURE__ */ e(x, { children: /* @__PURE__ */ e(I, {}) })
196
+ ]
197
+ }
198
+ );
199
+ export {
200
+ fe as D,
201
+ Pe as a
202
+ };
@@ -2,7 +2,7 @@ import { DatePickerProps as AriaDatePickerProps, DateValue, ValidationResult } f
2
2
  import { InfoPopoverProps } from '../label';
3
3
  import { Size } from '../common/types';
4
4
  import * as React from 'react';
5
- export interface DatePickerProps extends AriaDatePickerProps<DateValue> {
5
+ export interface DatePickerProps<T extends DateValue> extends AriaDatePickerProps<T> {
6
6
  description?: string;
7
7
  errorMessage?: string | ((validation: ValidationResult) => string);
8
8
  errorPosition?: 'top' | 'bottom';
@@ -18,4 +18,6 @@ export interface DatePickerProps extends AriaDatePickerProps<DateValue> {
18
18
  */
19
19
  isClearable?: boolean;
20
20
  }
21
- export declare const DatePicker: React.FC<DatePickerProps>;
21
+ export declare const DatePicker: <T extends DateValue>(props: DatePickerProps<T> & {
22
+ ref?: React.Ref<HTMLDivElement>;
23
+ }) => React.ReactElement | null;
@@ -1,8 +1,9 @@
1
1
  import { Meta, StoryObj } from '@storybook/react-vite';
2
+ import { CalendarDate } from '@internationalized/date';
2
3
  import { DatePicker } from './DatePicker';
3
- declare const meta: Meta<typeof DatePicker>;
4
+ declare const meta: Meta<typeof DatePicker<CalendarDate>>;
4
5
  export default meta;
5
- type Story = StoryObj<typeof DatePicker>;
6
+ type Story = StoryObj<typeof DatePicker<CalendarDate>>;
6
7
  export declare const Primary: Story;
7
8
  export declare const WithTime: Story;
8
9
  export declare const Disabled: Story;
@@ -1,7 +1,8 @@
1
+ import { DateValue } from 'react-aria-components';
1
2
  import { DatePickerProps } from './DatePicker';
2
3
  import * as React from 'react';
3
- interface DatePickerInputFieldProps extends Pick<DatePickerProps, 'isDisabled' | 'isInvalid' | 'isReadOnly' | 'size' | 'isClearable'> {
4
+ interface DatePickerInputFieldProps extends Pick<DatePickerProps<DateValue>, 'isDisabled' | 'isInvalid' | 'isReadOnly' | 'size' | 'isClearable'> {
4
5
  children?: React.ReactNode;
5
6
  }
6
- export declare const DatePickerInputField: React.FC<DatePickerInputFieldProps>;
7
+ export declare const DatePickerInputField: ({ children, isDisabled, isInvalid, isReadOnly, size, isClearable, }: DatePickerInputFieldProps) => import("react/jsx-runtime").JSX.Element;
7
8
  export {};
@@ -1,4 +1,4 @@
1
- import { D as r, a as t } from "../chunks/DateRangePicker-BItgKNh8.js";
1
+ import { D as r, a as t } from "../chunks/DateRangePicker-DWxApt5r.js";
2
2
  export {
3
3
  r as DatePicker,
4
4
  t as DateRangePicker
package/index.js CHANGED
@@ -14,7 +14,7 @@ import { C as N } from "./chunks/ComboBox-DQOqOcic.js";
14
14
  import { D as z } from "./chunks/DateField-moMaM1xn.js";
15
15
  import { D as Q, a as V } from "./chunks/DateInput-NzWcnB4y.js";
16
16
  import { D as j } from "./chunks/DateInputDivider-BHAwPkIR.js";
17
- import { D as J, a as K } from "./chunks/DateRangePicker-BItgKNh8.js";
17
+ import { D as J, a as K } from "./chunks/DateRangePicker-DWxApt5r.js";
18
18
  import { F as W } from "./chunks/FieldError-krpMBtie.js";
19
19
  import { F as Y, a as _ } from "./chunks/FileListItem-CKF9HPjw.js";
20
20
  import { D as oo, F as ao } from "./chunks/FileUpload-D6oyWcDA.js";
@@ -52,7 +52,7 @@ import { c as ja } from "./chunks/clsx-AexbMWKp.js";
52
52
  import { DialogTrigger as Ja, MenuTrigger as Ka, RouterProvider as Ua } from "react-aria-components";
53
53
  import { u as Xa } from "./chunks/useLocalizedStringFormatter-BHvsRxDk.js";
54
54
  import { useToastState as _a } from "react-stately";
55
- const o = "17.11.5", a = {
55
+ const o = "17.11.6", a = {
56
56
  version: o
57
57
  }, r = a.version;
58
58
  export {
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": "17.11.5",
17
+ "version": "17.11.6",
18
18
  "module": "./index.js",
19
19
  "type": "module",
20
20
  "main": "./index.js",
@@ -1,199 +0,0 @@
1
- 'use client';
2
- import { jsx as e, jsxs as h } from "react/jsx-runtime";
3
- import { Group as F, DatePickerStateContext as B, DateRangePickerStateContext as M, Popover as N, Dialog as S, DatePicker as R, DateRangePicker as G } from "react-aria-components";
4
- import { a as k } from "./clsx-AexbMWKp.js";
5
- import { C as L, R as w } from "./RangeCalendar-DxLInTav.js";
6
- import { D as f, a as P } from "./DateInput-NzWcnB4y.js";
7
- import { F as _ } from "./FieldError-krpMBtie.js";
8
- import { a as g, L as y } from "./Label-Cg0aAlnt.js";
9
- import { T as D } from "./Text-D0r_W4lH.js";
10
- import * as v from "react";
11
- import { C as I } from "./ClearButton-DkC8PIMi.js";
12
- import { FocusScope as O, useFocusManager as V } from "@react-aria/focus";
13
- import { B as T } from "./Button-GCROAMSl.js";
14
- import { c as $ } from "./createLucideIcon-CP-mMPfa.js";
15
- import { u as j } from "./useLocalizedStringFormatter-BHvsRxDk.js";
16
- import { D as A } from "./DateInputDivider-BHAwPkIR.js";
17
- import '../assets/DateRangePicker.css';const E = [
18
- ["path", { d: "M8 2v4", key: "1cmpym" }],
19
- ["path", { d: "M16 2v4", key: "4m81vk" }],
20
- ["rect", { width: "18", height: "18", x: "3", y: "4", rx: "2", key: "1hopcy" }],
21
- ["path", { d: "M3 10h18", key: "8toen8" }],
22
- ["path", { d: "M8 14h.01", key: "6423bh" }],
23
- ["path", { d: "M12 14h.01", key: "1etili" }],
24
- ["path", { d: "M16 14h.01", key: "1gbofw" }],
25
- ["path", { d: "M8 18h.01", key: "lrp35t" }],
26
- ["path", { d: "M12 18h.01", key: "mhygvu" }],
27
- ["path", { d: "M16 18h.01", key: "kzsmim" }]
28
- ], W = $("calendar-days", E), q = { clear: "Clear date", "open-calendar": "Open calendar" }, H = { clear: "Rensa datum", "open-calendar": "Öppna kalender" }, C = {
29
- en: q,
30
- sv: H
31
- }, J = "_datePicker_13jtn_1", K = "_inputField_13jtn_8", Q = "_medium_13jtn_24", U = "_readOnly_13jtn_47", X = "_buttonGroup_13jtn_52", Y = "_iconButton_13jtn_58", Z = "_popover_13jtn_81 _dropdownAnimation_1ljkv_4", z = "_dialog_13jtn_85", a = {
32
- datePicker: J,
33
- inputField: K,
34
- medium: Q,
35
- readOnly: U,
36
- buttonGroup: X,
37
- iconButton: Y,
38
- popover: Z,
39
- dialog: z
40
- }, ee = (t) => !!t && !!t.value && Object.prototype.hasOwnProperty.call(t.value, "start"), te = ({
41
- isClearable: t,
42
- isDisabled: c,
43
- isReadOnly: i,
44
- size: n
45
- }) => {
46
- const o = v.useContext(B), s = v.useContext(M), l = j(C), d = V(), r = s ?? o, u = ee(r) ? !!r.value.start && r.value.end : !!r?.value;
47
- return t && u && !i ? /* @__PURE__ */ e(
48
- I,
49
- {
50
- onPress: () => {
51
- r?.setValue(null), d?.focusFirst();
52
- },
53
- size: n,
54
- isDisabled: c,
55
- "aria-label": l.format("clear"),
56
- className: k(a.iconButton, {
57
- [a.medium]: n === "medium"
58
- })
59
- }
60
- ) : null;
61
- }, b = ({
62
- children: t,
63
- isDisabled: c,
64
- isInvalid: i,
65
- isReadOnly: n,
66
- size: o = "large",
67
- isClearable: s = !1
68
- }) => {
69
- const l = j(C);
70
- return /* @__PURE__ */ e(
71
- F,
72
- {
73
- className: k(a.inputField, {
74
- [a.medium]: o === "medium",
75
- [a.readOnly]: n
76
- }),
77
- children: /* @__PURE__ */ h(O, { children: [
78
- t,
79
- /* @__PURE__ */ h("div", { className: a.buttonGroup, children: [
80
- /* @__PURE__ */ e(
81
- te,
82
- {
83
- isClearable: s,
84
- isDisabled: c,
85
- isReadOnly: n,
86
- size: o
87
- }
88
- ),
89
- /* @__PURE__ */ e(
90
- T,
91
- {
92
- variant: "icon",
93
- "aria-label": l.format("open-calendar"),
94
- className: k(a.iconButton, {
95
- [a.medium]: o === "medium",
96
- [a.readOnly]: n
97
- }),
98
- "data-invalid": i || void 0,
99
- size: o,
100
- children: /* @__PURE__ */ e(
101
- W,
102
- {
103
- "aria-hidden": !0,
104
- size: 20
105
- }
106
- )
107
- }
108
- )
109
- ] })
110
- ] })
111
- }
112
- );
113
- }, x = ({
114
- children: t
115
- }) => /* @__PURE__ */ e(N, { className: a.popover, children: /* @__PURE__ */ e(S, { className: a.dialog, children: t }) }), _e = ({
116
- className: t,
117
- description: c,
118
- errorMessage: i,
119
- errorPosition: n = "top",
120
- label: o,
121
- popover: s,
122
- isClearable: l = !1,
123
- isReadOnly: d,
124
- isDisabled: r,
125
- size: u,
126
- ...m
127
- }) => /* @__PURE__ */ h(
128
- R,
129
- {
130
- className: k(a.datePicker, t),
131
- isReadOnly: d,
132
- isDisabled: r,
133
- ...m,
134
- children: [
135
- /* @__PURE__ */ e(g, { popover: s, children: o && /* @__PURE__ */ e(y, { children: o }) }),
136
- c && /* @__PURE__ */ e(D, { slot: "description", children: c }),
137
- n === "top" && /* @__PURE__ */ e(_, { children: i }),
138
- /* @__PURE__ */ e(
139
- b,
140
- {
141
- isClearable: l,
142
- isReadOnly: d,
143
- isDisabled: r,
144
- size: u,
145
- ...m,
146
- children: /* @__PURE__ */ e(f, { children: (p) => /* @__PURE__ */ e(P, { segment: p }) })
147
- }
148
- ),
149
- n === "bottom" && /* @__PURE__ */ e(_, { children: i }),
150
- /* @__PURE__ */ e(x, { children: /* @__PURE__ */ e(L, {}) })
151
- ]
152
- }
153
- ), fe = ({
154
- className: t,
155
- description: c,
156
- errorMessage: i,
157
- errorPosition: n = "top",
158
- label: o,
159
- popover: s,
160
- isClearable: l = !1,
161
- isReadOnly: d,
162
- isDisabled: r,
163
- size: u,
164
- ...m
165
- }) => /* @__PURE__ */ h(
166
- G,
167
- {
168
- className: k(a.datePicker, t),
169
- isReadOnly: d,
170
- isDisabled: r,
171
- ...m,
172
- children: [
173
- /* @__PURE__ */ e(g, { popover: s, children: o && /* @__PURE__ */ e(y, { children: o }) }),
174
- c && /* @__PURE__ */ e(D, { slot: "description", children: c }),
175
- n === "top" && /* @__PURE__ */ e(_, { children: i }),
176
- /* @__PURE__ */ h(
177
- b,
178
- {
179
- isClearable: l,
180
- isReadOnly: d,
181
- isDisabled: r,
182
- size: u,
183
- ...m,
184
- children: [
185
- /* @__PURE__ */ e(f, { slot: "start", children: (p) => /* @__PURE__ */ e(P, { segment: p }) }),
186
- /* @__PURE__ */ e(A, {}),
187
- /* @__PURE__ */ e(f, { slot: "end", children: (p) => /* @__PURE__ */ e(P, { segment: p }) })
188
- ]
189
- }
190
- ),
191
- n === "bottom" && /* @__PURE__ */ e(_, { children: i }),
192
- /* @__PURE__ */ e(x, { children: /* @__PURE__ */ e(w, {}) })
193
- ]
194
- }
195
- );
196
- export {
197
- _e as D,
198
- fe as a
199
- };