@midas-ds/components 17.28.0 → 17.28.1
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 +6 -0
- package/calendar/index.js +1 -1
- package/checkbox/index.js +1 -1
- package/chunks/{calendar-BZPktkdE.js → calendar-Bl_obez5.js} +1 -1
- package/chunks/checkbox-Bqd8B58G.js +110 -0
- package/chunks/{date-picker-BomOO1LI.js → date-picker-DZivTUB_.js} +1 -1
- package/chunks/radio-BD1EuxSa.js +53 -0
- package/chunks/{select-KQzDIamx.js → select-oLCNpryY.js} +1 -1
- package/chunks/splitDataAttributes-_JTFOOIb.js +8 -0
- package/chunks/{table-zT6eQ3ZZ.js → table-CmNWoAYO.js} +1 -1
- package/date-picker/index.js +1 -1
- package/index.js +7 -7
- package/package.json +1 -1
- package/radio/Radio.d.ts +1 -1
- package/radio/Radio.stories.d.ts +1 -1
- package/radio/RadioGroup.stories.d.ts +1 -1
- package/radio/index.js +1 -1
- package/select/index.js +1 -1
- package/table/index.js +1 -1
- package/utils/splitDataAttributes.d.ts +9 -0
- package/chunks/checkbox-DcXA9GSd.js +0 -105
- package/chunks/radio-C-MUMGu7.js +0 -48
package/CHANGELOG.md
CHANGED
package/calendar/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as e, t } from "../chunks/calendar-
|
|
1
|
+
import { n as e, t } from "../chunks/calendar-Bl_obez5.js";
|
|
2
2
|
export { e as Calendar, t as RangeCalendar };
|
package/checkbox/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { i as e, n as t, r as n, t as r } from "../chunks/checkbox-
|
|
1
|
+
import { i as e, n as t, r as n, t as r } from "../chunks/checkbox-Bqd8B58G.js";
|
|
2
2
|
export { t as Checkbox, n as CheckboxButton, e as CheckboxField, r as CheckboxGroup };
|
|
@@ -4,7 +4,7 @@ import { t as r } from "./chevron-right-DwqboCdU.js";
|
|
|
4
4
|
import { n as i } from "./button-CenXTGXL.js";
|
|
5
5
|
import { t as a } from "./heading-BEl_z-5T.js";
|
|
6
6
|
import { t as o } from "./field-error-LtNtEKDp.js";
|
|
7
|
-
import { n as s } from "./select-
|
|
7
|
+
import { n as s } from "./select-oLCNpryY.js";
|
|
8
8
|
import { a as c, c as l, o as u } from "./list-box-BN_MSiOD.js";
|
|
9
9
|
import * as d from "react";
|
|
10
10
|
import { Calendar as f, CalendarCell as p, CalendarGrid as m, CalendarMonthPicker as h, CalendarYearPicker as g, RangeCalendar as _, RangeCalendarContext as v, Select as y } from "react-aria-components";
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { t as e } from "./clsx-Di52oYUU.js";
|
|
3
|
+
import { t } from "./createLucideIcon-BgluSHFG.js";
|
|
4
|
+
import { t as n } from "./check-DV00NPU0.js";
|
|
5
|
+
import { t as r } from "./useLocalizedStringFormatter-CeyBc0x0.js";
|
|
6
|
+
import { n as i, t as a } from "./label-LWlgvAwz.js";
|
|
7
|
+
import { t as o } from "./text-DwmZ-ew8.js";
|
|
8
|
+
import { t as s } from "./field-error-LtNtEKDp.js";
|
|
9
|
+
import { t as c } from "./splitDataAttributes-_JTFOOIb.js";
|
|
10
|
+
import * as l from "react";
|
|
11
|
+
import { forwardRef as u, useContext as d } from "react";
|
|
12
|
+
import { CheckboxButton as f, CheckboxField as p, CheckboxGroup as m, CheckboxGroupStateContext as h, composeRenderProps as g } from "react-aria-components";
|
|
13
|
+
import { Fragment as _, jsx as v, jsxs as y } from "react/jsx-runtime";
|
|
14
|
+
import { variables as b } from "@midas-ds/theme";
|
|
15
|
+
import '../assets/checkbox.css';var x = t("minus", [["path", {
|
|
16
|
+
d: "M5 12h14",
|
|
17
|
+
key: "1ays0h"
|
|
18
|
+
}]]), S = {
|
|
19
|
+
indicator: "_indicator_3jfn4_1",
|
|
20
|
+
checkboxButton: "_checkboxButton_3jfn4_27",
|
|
21
|
+
checkboxField: "_checkboxField_3jfn4_144",
|
|
22
|
+
checkboxGroup: "_checkboxGroup_3jfn4_155",
|
|
23
|
+
checkboxList: "_checkboxList_3jfn4_166"
|
|
24
|
+
}, C = ({ className: t, ...n }) => /* @__PURE__ */ v(p, {
|
|
25
|
+
className: e(S.checkboxField, t),
|
|
26
|
+
...n
|
|
27
|
+
}), w = u(({ className: t, ...n }, r) => /* @__PURE__ */ v(f, {
|
|
28
|
+
className: e(S.checkboxButton, t),
|
|
29
|
+
ref: r,
|
|
30
|
+
...n
|
|
31
|
+
})), T = u(({ className: e, description: t, errorMessage: r, errorPosition: i = "top", children: a, ...l }, u) => {
|
|
32
|
+
let [d, f] = c(l);
|
|
33
|
+
return /* @__PURE__ */ y(C, {
|
|
34
|
+
...f,
|
|
35
|
+
children: [
|
|
36
|
+
t && /* @__PURE__ */ v(o, {
|
|
37
|
+
slot: "description",
|
|
38
|
+
children: t
|
|
39
|
+
}),
|
|
40
|
+
i === "top" && /* @__PURE__ */ v(s, { children: r }),
|
|
41
|
+
/* @__PURE__ */ v(w, {
|
|
42
|
+
...d,
|
|
43
|
+
ref: u,
|
|
44
|
+
className: e,
|
|
45
|
+
children: ({ isIndeterminate: e }) => /* @__PURE__ */ y(_, { children: [/* @__PURE__ */ v("div", {
|
|
46
|
+
className: S.indicator,
|
|
47
|
+
children: v(e ? x : n, {
|
|
48
|
+
size: 14,
|
|
49
|
+
color: b.iconOnColor
|
|
50
|
+
})
|
|
51
|
+
}), a] })
|
|
52
|
+
}),
|
|
53
|
+
i === "bottom" && /* @__PURE__ */ v(s, { children: r })
|
|
54
|
+
]
|
|
55
|
+
});
|
|
56
|
+
});
|
|
57
|
+
T.displayName = "Checkbox";
|
|
58
|
+
//#endregion
|
|
59
|
+
//#region src/checkbox/useSelectAll.ts
|
|
60
|
+
var E = (e, t) => {
|
|
61
|
+
let n = t?.value ?? [], r = l.Children.toArray(e).filter((e) => l.isValidElement(e) && e.type === T), i = r.filter((e) => !e.props.isDisabled).map((e) => e.props.value || ""), a = r.filter((e) => e.props.isDisabled).map((e) => e.props.value || "").filter((e) => n.includes(e)), o = n.filter((e) => i.includes(e)).length, s = o === 0, c = o === i.length;
|
|
62
|
+
return {
|
|
63
|
+
allSelected: c,
|
|
64
|
+
someSelected: !s && !c,
|
|
65
|
+
checkboxValues: i,
|
|
66
|
+
disabledSelectedValues: a
|
|
67
|
+
};
|
|
68
|
+
}, D = {
|
|
69
|
+
en: { selectAll: "Select all" },
|
|
70
|
+
sv: { selectAll: "Välj alla" }
|
|
71
|
+
}, O = ({ checkboxes: e, label: t }) => {
|
|
72
|
+
let n = d(h), i = r(D), { allSelected: a, someSelected: o, checkboxValues: s, disabledSelectedValues: c } = E(e, n);
|
|
73
|
+
return /* @__PURE__ */ v(h.Provider, {
|
|
74
|
+
value: null,
|
|
75
|
+
children: /* @__PURE__ */ v(T, {
|
|
76
|
+
isSelected: a,
|
|
77
|
+
isIndeterminate: o,
|
|
78
|
+
isReadOnly: n?.isReadOnly,
|
|
79
|
+
isDisabled: n?.isDisabled,
|
|
80
|
+
onChange: (e) => {
|
|
81
|
+
n?.setValue(e ? [...s, ...c] : c);
|
|
82
|
+
},
|
|
83
|
+
children: t || i.format("selectAll")
|
|
84
|
+
})
|
|
85
|
+
});
|
|
86
|
+
}, k = ({ label: t, description: n, errorMessage: r, errorPosition: c = "top", popover: l, showSelectAll: u, selectAllLabel: d, className: f, children: p, ...h }) => /* @__PURE__ */ v(m, {
|
|
87
|
+
...h,
|
|
88
|
+
className: e(S.checkboxGroup, f),
|
|
89
|
+
children: g(p, (e) => /* @__PURE__ */ y(_, { children: [
|
|
90
|
+
/* @__PURE__ */ v(i, {
|
|
91
|
+
popover: l,
|
|
92
|
+
children: t && /* @__PURE__ */ v(a, { children: t })
|
|
93
|
+
}),
|
|
94
|
+
n && /* @__PURE__ */ v(o, {
|
|
95
|
+
slot: "description",
|
|
96
|
+
children: n
|
|
97
|
+
}),
|
|
98
|
+
c === "top" && r && /* @__PURE__ */ v(s, { children: r }),
|
|
99
|
+
/* @__PURE__ */ y("div", {
|
|
100
|
+
className: S.checkboxList,
|
|
101
|
+
children: [u && /* @__PURE__ */ v(O, {
|
|
102
|
+
label: d,
|
|
103
|
+
checkboxes: e
|
|
104
|
+
}), e]
|
|
105
|
+
}),
|
|
106
|
+
c === "bottom" && r && /* @__PURE__ */ v(s, { children: r })
|
|
107
|
+
] }))
|
|
108
|
+
});
|
|
109
|
+
//#endregion
|
|
110
|
+
export { C as i, T as n, w as r, k as t };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { n as e } from "./clsx-Di52oYUU.js";
|
|
3
3
|
import { t } from "./createLucideIcon-BgluSHFG.js";
|
|
4
|
-
import { n, t as r } from "./calendar-
|
|
4
|
+
import { n, t as r } from "./calendar-Bl_obez5.js";
|
|
5
5
|
import { t as i } from "./useLocalizedStringFormatter-CeyBc0x0.js";
|
|
6
6
|
import { n as a } from "./button-CenXTGXL.js";
|
|
7
7
|
import { n as o, t as s } from "./label-LWlgvAwz.js";
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { t as e } from "./clsx-Di52oYUU.js";
|
|
2
|
+
import { n as t, t as n } from "./label-LWlgvAwz.js";
|
|
3
|
+
import { t as r } from "./text-DwmZ-ew8.js";
|
|
4
|
+
import { t as i } from "./field-error-LtNtEKDp.js";
|
|
5
|
+
import { t as a } from "./splitDataAttributes-_JTFOOIb.js";
|
|
6
|
+
import { Group as o, RadioButton as s, RadioField as c, RadioGroup as l, composeRenderProps as u } from "react-aria-components";
|
|
7
|
+
import { Fragment as d, jsx as f, jsxs as p } from "react/jsx-runtime";
|
|
8
|
+
import '../assets/radio.css';//#region src/radio/RadioField.tsx
|
|
9
|
+
var m = (e) => /* @__PURE__ */ f(c, { ...e }), h = {
|
|
10
|
+
radioGroup: "_radioGroup_1l7aa_1",
|
|
11
|
+
wrap: "_wrap_1l7aa_12",
|
|
12
|
+
radioButton: "_radioButton_1l7aa_25"
|
|
13
|
+
}, g = ({ className: t, ...n }) => /* @__PURE__ */ f(s, {
|
|
14
|
+
className: e(h.radioButton, t),
|
|
15
|
+
...n
|
|
16
|
+
}), _ = ({ children: e, className: t, ...n }) => {
|
|
17
|
+
let [r, i] = a(n);
|
|
18
|
+
return /* @__PURE__ */ f(m, {
|
|
19
|
+
...i,
|
|
20
|
+
children: /* @__PURE__ */ f(g, {
|
|
21
|
+
...r,
|
|
22
|
+
className: t,
|
|
23
|
+
children: e
|
|
24
|
+
})
|
|
25
|
+
});
|
|
26
|
+
}, v = ({ label: a, description: s, errorMessage: c, children: m, className: g, errorPosition: _ = "top", popover: v, ...y }) => /* @__PURE__ */ f(l, {
|
|
27
|
+
...y,
|
|
28
|
+
className: e(h.radioGroup, g),
|
|
29
|
+
children: u(m, (e) => /* @__PURE__ */ p(d, { children: [
|
|
30
|
+
/* @__PURE__ */ f(t, {
|
|
31
|
+
popover: v,
|
|
32
|
+
children: a && /* @__PURE__ */ f(n, { children: a })
|
|
33
|
+
}),
|
|
34
|
+
s && /* @__PURE__ */ f(r, {
|
|
35
|
+
slot: "description",
|
|
36
|
+
children: s
|
|
37
|
+
}),
|
|
38
|
+
_ === "top" && /* @__PURE__ */ f(i, {
|
|
39
|
+
"data-testid": "fieldError",
|
|
40
|
+
children: c
|
|
41
|
+
}),
|
|
42
|
+
/* @__PURE__ */ f(o, {
|
|
43
|
+
className: h.wrap,
|
|
44
|
+
children: e
|
|
45
|
+
}),
|
|
46
|
+
_ === "bottom" && /* @__PURE__ */ f(i, {
|
|
47
|
+
"data-testid": "fieldError",
|
|
48
|
+
children: c
|
|
49
|
+
})
|
|
50
|
+
] }))
|
|
51
|
+
});
|
|
52
|
+
//#endregion
|
|
53
|
+
export { m as i, _ as n, g as r, v as t };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { n as e, t } from "./clsx-Di52oYUU.js";
|
|
2
2
|
import { t as n } from "./chevron-down-CP7nEDei.js";
|
|
3
|
-
import { n as r } from "./checkbox-
|
|
3
|
+
import { n as r } from "./checkbox-Bqd8B58G.js";
|
|
4
4
|
import { t as i } from "./x-BJAOO5a5.js";
|
|
5
5
|
import { t as a } from "./useLocalizedStringFormatter-CeyBc0x0.js";
|
|
6
6
|
import { n as o, t as s } from "./label-LWlgvAwz.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { t as e } from "./clsx-Di52oYUU.js";
|
|
3
3
|
import { t } from "./createLucideIcon-BgluSHFG.js";
|
|
4
|
-
import { n } from "./checkbox-
|
|
4
|
+
import { n } from "./checkbox-Bqd8B58G.js";
|
|
5
5
|
import { Button as r, Cell as i, Collection as a, Column as o, Row as s, Table as c, TableBody as l, TableHeader as u, useTableOptions as d } from "react-aria-components";
|
|
6
6
|
import { Fragment as f, jsx as p, jsxs as m } from "react/jsx-runtime";
|
|
7
7
|
import '../assets/table.css';var h = t("arrow-down", [["path", {
|
package/date-picker/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as e, t } from "../chunks/date-picker-
|
|
1
|
+
import { n as e, t } from "../chunks/date-picker-DZivTUB_.js";
|
|
2
2
|
export { e as DatePicker, t as DateRangePicker };
|
package/index.js
CHANGED
|
@@ -4,12 +4,12 @@ import { n as e, t } from "./chunks/accordion-DIVTJU3O.js";
|
|
|
4
4
|
import { t as n } from "./chunks/clsx-Di52oYUU.js";
|
|
5
5
|
import { t as r } from "./chunks/spinner-LdHPVms_.js";
|
|
6
6
|
import { n as i, t as a } from "./chunks/link-BAgs4RwY.js";
|
|
7
|
-
import { a as o, i as s, n as c, o as l, r as u, t as d } from "./chunks/table-
|
|
7
|
+
import { a as o, i as s, n as c, o as l, r as u, t as d } from "./chunks/table-CmNWoAYO.js";
|
|
8
8
|
import { t as f } from "./chunks/link-button-BuPMEGUj.js";
|
|
9
|
-
import { n as p, t as m } from "./chunks/date-picker-
|
|
10
|
-
import { n as h, t as g } from "./chunks/calendar-
|
|
9
|
+
import { n as p, t as m } from "./chunks/date-picker-DZivTUB_.js";
|
|
10
|
+
import { n as h, t as g } from "./chunks/calendar-Bl_obez5.js";
|
|
11
11
|
import { a as _, i as v, n as y, r as b, t as x } from "./chunks/layout-Db5um0f7.js";
|
|
12
|
-
import { i as S, n as C, r as w, t as T } from "./chunks/checkbox-
|
|
12
|
+
import { i as S, n as C, r as w, t as T } from "./chunks/checkbox-Bqd8B58G.js";
|
|
13
13
|
import { n as E, t as D } from "./chunks/color-scheme-switch-DVZjdwc9.js";
|
|
14
14
|
import { t as O } from "./chunks/search-field-BvfOHvUI.js";
|
|
15
15
|
import { n as k, t as A } from "./chunks/file-list-TmEuO1fJ.js";
|
|
@@ -23,7 +23,7 @@ import { t as B } from "./chunks/popover-DGcogqbS.js";
|
|
|
23
23
|
import { n as V, r as H, t as U } from "./chunks/modal-C-UsxdO0.js";
|
|
24
24
|
import { t as W } from "./chunks/text-DwmZ-ew8.js";
|
|
25
25
|
import { t as G } from "./chunks/field-error-LtNtEKDp.js";
|
|
26
|
-
import { n as K, t as q } from "./chunks/select-
|
|
26
|
+
import { n as K, t as q } from "./chunks/select-oLCNpryY.js";
|
|
27
27
|
import { a as J, c as Y, i as X, n as Z, o as Q, r as $, s as ee, t as te } from "./chunks/list-box-BN_MSiOD.js";
|
|
28
28
|
import { n as ne, r as re, t as ie } from "./chunks/tag-BIcqtf7b.js";
|
|
29
29
|
import { a as ae, c as oe, i as se, l as ce, n as le, o as ue, r as de, s as fe, t as pe } from "./chunks/card-zIYA-SQh.js";
|
|
@@ -40,7 +40,7 @@ import { t as Ne } from "./chunks/info-banner-osR4e6nB.js";
|
|
|
40
40
|
import { n as Pe, t as Fe } from "./chunks/tooltip-BkesIUIF.js";
|
|
41
41
|
import { n as Ie, t as Le } from "./chunks/logo-DyZ2pXt7.js";
|
|
42
42
|
import { t as Re } from "./chunks/progress-bar-7w_kWo2f.js";
|
|
43
|
-
import { i as ze, n as Be, r as Ve, t as He } from "./chunks/radio-
|
|
43
|
+
import { i as ze, n as Be, r as Ve, t as He } from "./chunks/radio-BD1EuxSa.js";
|
|
44
44
|
import { t as Ue } from "./chunks/skeleton-B_BPRPJy.js";
|
|
45
45
|
import { t as We } from "./chunks/stack-LF3ExhH9.js";
|
|
46
46
|
import { i as Ge, n as Ke, r as qe, t as Je } from "./chunks/tabs-Co09VWvC.js";
|
|
@@ -61,7 +61,7 @@ var ot = {
|
|
|
61
61
|
description: "Midas Components",
|
|
62
62
|
homepage: "https://designsystem.migrationsverket.se/",
|
|
63
63
|
license: "CC0-1.0",
|
|
64
|
-
version: "17.28.
|
|
64
|
+
version: "17.28.1",
|
|
65
65
|
module: "./index.js",
|
|
66
66
|
type: "module",
|
|
67
67
|
main: "./index.js",
|
package/package.json
CHANGED
package/radio/Radio.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { RadioFieldProps } from 'react-aria-components';
|
|
2
2
|
export type RadioProps = RadioFieldProps;
|
|
3
|
-
export declare const Radio: ({ children, className, ...
|
|
3
|
+
export declare const Radio: ({ children, className, ...props }: RadioProps) => import('react').JSX.Element;
|
package/radio/Radio.stories.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ declare const _default: {
|
|
|
7
7
|
children: string;
|
|
8
8
|
isDisabled: false;
|
|
9
9
|
};
|
|
10
|
-
component: ({ children, className, ...
|
|
10
|
+
component: ({ children, className, ...props }: import('./Radio').RadioProps) => import('react').JSX.Element;
|
|
11
11
|
decorators: (Story: import('storybook/internal/csf').PartialStoryFn<import('@storybook/react').ReactRenderer, {
|
|
12
12
|
className?: import('react-aria-components').ClassNameOrFunction<import('react-aria-components').RadioFieldRenderProps> | undefined;
|
|
13
13
|
inputRef?: import('react').Ref<HTMLInputElement | null> | undefined;
|
|
@@ -4,7 +4,7 @@ declare const _default: {
|
|
|
4
4
|
title: string;
|
|
5
5
|
component: import('react').FC<import('./RadioGroup').RadioGroupProps>;
|
|
6
6
|
subcomponents: {
|
|
7
|
-
Radio: ({ children, className, ...
|
|
7
|
+
Radio: ({ children, className, ...props }: import('./Radio').RadioProps) => import('react').JSX.Element;
|
|
8
8
|
};
|
|
9
9
|
tags: string[];
|
|
10
10
|
args: {
|
package/radio/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { i as e, n as t, r as n, t as r } from "../chunks/radio-
|
|
1
|
+
import { i as e, n as t, r as n, t as r } from "../chunks/radio-BD1EuxSa.js";
|
|
2
2
|
export { t as Radio, n as RadioButton, e as RadioField, r as RadioGroup };
|
package/select/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as e, t } from "../chunks/select-
|
|
1
|
+
import { n as e, t } from "../chunks/select-oLCNpryY.js";
|
|
2
2
|
export { t as Select, e as SelectTrigger };
|
package/table/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as e, i as t, n, o as r, r as i, t as a } from "../chunks/table-
|
|
1
|
+
import { a as e, i as t, n, o as r, r as i, t as a } from "../chunks/table-CmNWoAYO.js";
|
|
2
2
|
export { a as Cell, n as Column, i as Row, t as Table, e as TableBody, r as TableHeader };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Splits `data-*` attributes (e.g. `data-testid`) off a component's props.
|
|
3
|
+
*
|
|
4
|
+
* For components that render a field wrapper around the element the user
|
|
5
|
+
* interacts with, like Radio and Checkbox: the data attributes belong on the
|
|
6
|
+
* interactive element, so tests that click by test id hit the label rather
|
|
7
|
+
* than the wrapper.
|
|
8
|
+
*/
|
|
9
|
+
export declare function splitDataAttributes<T extends object>(props: T): readonly [Record<`data-${string}`, unknown>, T];
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import { t as e } from "./clsx-Di52oYUU.js";
|
|
3
|
-
import { t } from "./createLucideIcon-BgluSHFG.js";
|
|
4
|
-
import { t as n } from "./check-DV00NPU0.js";
|
|
5
|
-
import { t as r } from "./useLocalizedStringFormatter-CeyBc0x0.js";
|
|
6
|
-
import { n as i, t as a } from "./label-LWlgvAwz.js";
|
|
7
|
-
import { t as o } from "./text-DwmZ-ew8.js";
|
|
8
|
-
import { t as s } from "./field-error-LtNtEKDp.js";
|
|
9
|
-
import * as c from "react";
|
|
10
|
-
import { forwardRef as l, useContext as u } from "react";
|
|
11
|
-
import { CheckboxButton as d, CheckboxField as f, CheckboxGroup as p, CheckboxGroupStateContext as m, composeRenderProps as h } from "react-aria-components";
|
|
12
|
-
import { Fragment as g, jsx as _, jsxs as v } from "react/jsx-runtime";
|
|
13
|
-
import { variables as y } from "@midas-ds/theme";
|
|
14
|
-
import '../assets/checkbox.css';var b = t("minus", [["path", {
|
|
15
|
-
d: "M5 12h14",
|
|
16
|
-
key: "1ays0h"
|
|
17
|
-
}]]), x = {
|
|
18
|
-
indicator: "_indicator_3jfn4_1",
|
|
19
|
-
checkboxButton: "_checkboxButton_3jfn4_27",
|
|
20
|
-
checkboxField: "_checkboxField_3jfn4_144",
|
|
21
|
-
checkboxGroup: "_checkboxGroup_3jfn4_155",
|
|
22
|
-
checkboxList: "_checkboxList_3jfn4_166"
|
|
23
|
-
}, S = ({ className: t, ...n }) => /* @__PURE__ */ _(f, {
|
|
24
|
-
className: e(x.checkboxField, t),
|
|
25
|
-
...n
|
|
26
|
-
}), C = l(({ className: t, ...n }, r) => /* @__PURE__ */ _(d, {
|
|
27
|
-
className: e(x.checkboxButton, t),
|
|
28
|
-
ref: r,
|
|
29
|
-
...n
|
|
30
|
-
})), w = l(({ className: e, description: t, errorMessage: r, errorPosition: i = "top", children: a, ...c }, l) => /* @__PURE__ */ v(S, {
|
|
31
|
-
...c,
|
|
32
|
-
children: [
|
|
33
|
-
t && /* @__PURE__ */ _(o, {
|
|
34
|
-
slot: "description",
|
|
35
|
-
children: t
|
|
36
|
-
}),
|
|
37
|
-
i === "top" && /* @__PURE__ */ _(s, { children: r }),
|
|
38
|
-
/* @__PURE__ */ _(C, {
|
|
39
|
-
ref: l,
|
|
40
|
-
className: e,
|
|
41
|
-
children: ({ isIndeterminate: e }) => /* @__PURE__ */ v(g, { children: [/* @__PURE__ */ _("div", {
|
|
42
|
-
className: x.indicator,
|
|
43
|
-
children: _(e ? b : n, {
|
|
44
|
-
size: 14,
|
|
45
|
-
color: y.iconOnColor
|
|
46
|
-
})
|
|
47
|
-
}), a] })
|
|
48
|
-
}),
|
|
49
|
-
i === "bottom" && /* @__PURE__ */ _(s, { children: r })
|
|
50
|
-
]
|
|
51
|
-
}));
|
|
52
|
-
w.displayName = "Checkbox";
|
|
53
|
-
//#endregion
|
|
54
|
-
//#region src/checkbox/useSelectAll.ts
|
|
55
|
-
var T = (e, t) => {
|
|
56
|
-
let n = t?.value ?? [], r = c.Children.toArray(e).filter((e) => c.isValidElement(e) && e.type === w), i = r.filter((e) => !e.props.isDisabled).map((e) => e.props.value || ""), a = r.filter((e) => e.props.isDisabled).map((e) => e.props.value || "").filter((e) => n.includes(e)), o = n.filter((e) => i.includes(e)).length, s = o === 0, l = o === i.length;
|
|
57
|
-
return {
|
|
58
|
-
allSelected: l,
|
|
59
|
-
someSelected: !s && !l,
|
|
60
|
-
checkboxValues: i,
|
|
61
|
-
disabledSelectedValues: a
|
|
62
|
-
};
|
|
63
|
-
}, E = {
|
|
64
|
-
en: { selectAll: "Select all" },
|
|
65
|
-
sv: { selectAll: "Välj alla" }
|
|
66
|
-
}, D = ({ checkboxes: e, label: t }) => {
|
|
67
|
-
let n = u(m), i = r(E), { allSelected: a, someSelected: o, checkboxValues: s, disabledSelectedValues: c } = T(e, n);
|
|
68
|
-
return /* @__PURE__ */ _(m.Provider, {
|
|
69
|
-
value: null,
|
|
70
|
-
children: /* @__PURE__ */ _(w, {
|
|
71
|
-
isSelected: a,
|
|
72
|
-
isIndeterminate: o,
|
|
73
|
-
isReadOnly: n?.isReadOnly,
|
|
74
|
-
isDisabled: n?.isDisabled,
|
|
75
|
-
onChange: (e) => {
|
|
76
|
-
n?.setValue(e ? [...s, ...c] : c);
|
|
77
|
-
},
|
|
78
|
-
children: t || i.format("selectAll")
|
|
79
|
-
})
|
|
80
|
-
});
|
|
81
|
-
}, O = ({ label: t, description: n, errorMessage: r, errorPosition: c = "top", popover: l, showSelectAll: u, selectAllLabel: d, className: f, children: m, ...y }) => /* @__PURE__ */ _(p, {
|
|
82
|
-
...y,
|
|
83
|
-
className: e(x.checkboxGroup, f),
|
|
84
|
-
children: h(m, (e) => /* @__PURE__ */ v(g, { children: [
|
|
85
|
-
/* @__PURE__ */ _(i, {
|
|
86
|
-
popover: l,
|
|
87
|
-
children: t && /* @__PURE__ */ _(a, { children: t })
|
|
88
|
-
}),
|
|
89
|
-
n && /* @__PURE__ */ _(o, {
|
|
90
|
-
slot: "description",
|
|
91
|
-
children: n
|
|
92
|
-
}),
|
|
93
|
-
c === "top" && r && /* @__PURE__ */ _(s, { children: r }),
|
|
94
|
-
/* @__PURE__ */ v("div", {
|
|
95
|
-
className: x.checkboxList,
|
|
96
|
-
children: [u && /* @__PURE__ */ _(D, {
|
|
97
|
-
label: d,
|
|
98
|
-
checkboxes: e
|
|
99
|
-
}), e]
|
|
100
|
-
}),
|
|
101
|
-
c === "bottom" && r && /* @__PURE__ */ _(s, { children: r })
|
|
102
|
-
] }))
|
|
103
|
-
});
|
|
104
|
-
//#endregion
|
|
105
|
-
export { S as i, w as n, C as r, O as t };
|
package/chunks/radio-C-MUMGu7.js
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { t as e } from "./clsx-Di52oYUU.js";
|
|
2
|
-
import { n as t, t as n } from "./label-LWlgvAwz.js";
|
|
3
|
-
import { t as r } from "./text-DwmZ-ew8.js";
|
|
4
|
-
import { t as i } from "./field-error-LtNtEKDp.js";
|
|
5
|
-
import { Group as a, RadioButton as o, RadioField as s, RadioGroup as c, composeRenderProps as l } from "react-aria-components";
|
|
6
|
-
import { Fragment as u, jsx as d, jsxs as f } from "react/jsx-runtime";
|
|
7
|
-
import '../assets/radio.css';//#region src/radio/RadioField.tsx
|
|
8
|
-
var p = (e) => /* @__PURE__ */ d(s, { ...e }), m = {
|
|
9
|
-
radioGroup: "_radioGroup_1l7aa_1",
|
|
10
|
-
wrap: "_wrap_1l7aa_12",
|
|
11
|
-
radioButton: "_radioButton_1l7aa_25"
|
|
12
|
-
}, h = ({ className: t, ...n }) => /* @__PURE__ */ d(o, {
|
|
13
|
-
className: e(m.radioButton, t),
|
|
14
|
-
...n
|
|
15
|
-
}), g = ({ children: e, className: t, ...n }) => /* @__PURE__ */ d(p, {
|
|
16
|
-
...n,
|
|
17
|
-
children: /* @__PURE__ */ d(h, {
|
|
18
|
-
className: t,
|
|
19
|
-
children: e
|
|
20
|
-
})
|
|
21
|
-
}), _ = ({ label: o, description: s, errorMessage: p, children: h, className: g, errorPosition: _ = "top", popover: v, ...y }) => /* @__PURE__ */ d(c, {
|
|
22
|
-
...y,
|
|
23
|
-
className: e(m.radioGroup, g),
|
|
24
|
-
children: l(h, (e) => /* @__PURE__ */ f(u, { children: [
|
|
25
|
-
/* @__PURE__ */ d(t, {
|
|
26
|
-
popover: v,
|
|
27
|
-
children: o && /* @__PURE__ */ d(n, { children: o })
|
|
28
|
-
}),
|
|
29
|
-
s && /* @__PURE__ */ d(r, {
|
|
30
|
-
slot: "description",
|
|
31
|
-
children: s
|
|
32
|
-
}),
|
|
33
|
-
_ === "top" && /* @__PURE__ */ d(i, {
|
|
34
|
-
"data-testid": "fieldError",
|
|
35
|
-
children: p
|
|
36
|
-
}),
|
|
37
|
-
/* @__PURE__ */ d(a, {
|
|
38
|
-
className: m.wrap,
|
|
39
|
-
children: e
|
|
40
|
-
}),
|
|
41
|
-
_ === "bottom" && /* @__PURE__ */ d(i, {
|
|
42
|
-
"data-testid": "fieldError",
|
|
43
|
-
children: p
|
|
44
|
-
})
|
|
45
|
-
] }))
|
|
46
|
-
});
|
|
47
|
-
//#endregion
|
|
48
|
-
export { p as i, g as n, h as r, _ as t };
|