enefit-design-system 0.9.2-ds.0 → 0.9.2-ds.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Accordion/Accordion.js +3 -2
- package/dist/Autocomplete/Autocomplete.js +3 -2
- package/dist/Badge/Badge.js +1 -0
- package/dist/Calendar/CalendarHeader.js +3 -2
- package/dist/Calendar/Day/CalendarCell.js +3 -2
- package/dist/Calendar/Day/CalendarGrid.js +3 -2
- package/dist/Calendar/Month/MonthCell.js +3 -2
- package/dist/Calendar/Year/YearCell.js +3 -2
- package/dist/Checkbox/Checkbox.js +1 -0
- package/dist/CheckboxGroup/CheckboxGroup.js +1 -0
- package/dist/Choice/Choice.js +1 -0
- package/dist/ChoiceCard/ChoiceCard.js +1 -0
- package/dist/DatePicker/DatePicker.js +1 -0
- package/dist/DatePicker/DatePickerSegment.js +1 -0
- package/dist/DsCheckbox/DsCheckbox.js +141 -161
- package/dist/DsChoice/DsChoice.js +105 -125
- package/dist/DsForm/fields.js +159 -138
- package/dist/DsForm/hooks.d.ts +28 -2
- package/dist/DsForm/hooks.js +44 -32
- package/dist/DsForm/types.d.ts +9 -0
- package/dist/DsForm/utils.js +28 -21
- package/dist/DsInput/DsInput.browser.test.d.ts +1 -0
- package/dist/DsRadio/DsRadio.js +115 -137
- package/dist/DsSwitch/DsSwitch.js +123 -144
- package/dist/FormFields/FormFields.js +1 -0
- package/dist/FormFields/fields.js +3 -2
- package/dist/InfoHint/InfoHint.js +1 -0
- package/dist/Modal/ModalDialog.js +3 -2
- package/dist/Notification/Notification.js +3 -2
- package/dist/Notification/NotificationDescription.js +3 -2
- package/dist/Notification/NotificationTitle.js +4 -3
- package/dist/Phone/Phone.js +3 -2
- package/dist/Phone/PhoneSelect.js +1 -0
- package/dist/Phone/PhoneTrigger.js +1 -0
- package/dist/Radio/Radio.js +1 -0
- package/dist/RadioGroup/RadioGroup.js +3 -2
- package/dist/Searchfield/Searchfield.js +1 -0
- package/dist/Select/Select.js +1 -0
- package/dist/Select/SelectListOption.js +3 -2
- package/dist/Slider/Slider.js +3 -2
- package/dist/Slider/SliderThumb.js +3 -2
- package/dist/Switch/Switch.js +1 -0
- package/dist/SwitchGroup/SwitchGroup.js +1 -0
- package/dist/Tab/Tab.js +1 -0
- package/dist/Table/TableCell.js +3 -2
- package/dist/Table/TableFooterCell.js +3 -2
- package/dist/Table/TableHeaderCell.js +3 -2
- package/dist/Textarea/Textarea.js +7 -6
- package/dist/Textfield/Textfield.js +1 -0
- package/dist/Toast/Toast.js +1 -0
- package/dist/styles.css +1 -1
- package/dist/utils/dsValidate.js +115 -58
- package/package.json +1 -1
|
@@ -36,6 +36,7 @@ import "../DsCheckbox/DsCheckbox.js";
|
|
|
36
36
|
import "../DsChoice/DsChoice.js";
|
|
37
37
|
import "../DsForm/DsForm.js";
|
|
38
38
|
import "../DsForm/DsFormContext.js";
|
|
39
|
+
import "../utils/dsValidate.js";
|
|
39
40
|
import "../DsInput/DsInput.js";
|
|
40
41
|
import "../DsInputDate/DsInputDate.js";
|
|
41
42
|
import "../DsInputFile/DsInputFile.js";
|
|
@@ -99,7 +100,7 @@ import "../FileUpload/FileUpload.js";
|
|
|
99
100
|
import "../FormFields/FormFields.js";
|
|
100
101
|
import { useId as N } from "../external/@react-aria/utils/dist/useId.js";
|
|
101
102
|
import { usePress as k } from "../external/@react-aria/interactions/dist/usePress.js";
|
|
102
|
-
const
|
|
103
|
+
const Dr = (v) => {
|
|
103
104
|
const m = q(T), { mode: u, selectedKeys: e, setSelectedKeys: a } = m ?? {}, {
|
|
104
105
|
id: r = "",
|
|
105
106
|
title: C,
|
|
@@ -181,5 +182,5 @@ const jr = (v) => {
|
|
|
181
182
|
] });
|
|
182
183
|
};
|
|
183
184
|
export {
|
|
184
|
-
|
|
185
|
+
Dr as default
|
|
185
186
|
};
|
|
@@ -35,6 +35,7 @@ import "../DsCheckbox/DsCheckbox.js";
|
|
|
35
35
|
import "../DsChoice/DsChoice.js";
|
|
36
36
|
import "../DsForm/DsForm.js";
|
|
37
37
|
import "../DsForm/DsFormContext.js";
|
|
38
|
+
import "../utils/dsValidate.js";
|
|
38
39
|
import "../DsInput/DsInput.js";
|
|
39
40
|
import "../DsInputDate/DsInputDate.js";
|
|
40
41
|
import "../DsInputFile/DsInputFile.js";
|
|
@@ -101,7 +102,7 @@ import { useFilter as H } from "../external/@react-aria/i18n/dist/useFilter.js";
|
|
|
101
102
|
import { useComboBoxState as J } from "../external/@react-stately/combobox/dist/useComboBoxState.js";
|
|
102
103
|
import { useComboBox as Q } from "../external/@react-aria/combobox/dist/useComboBox.js";
|
|
103
104
|
import { useButton as U } from "../external/@react-aria/button/dist/useButton.js";
|
|
104
|
-
const
|
|
105
|
+
const Ge = (e) => {
|
|
105
106
|
const { contains: S } = H({ sensitivity: "base" }), o = J({ ...e, defaultFilter: S }), m = r(null), c = r(null), d = r(null), u = r(null), f = r(null), R = r(null), { isNonModal: y = !0, isDisabled: B = !1 } = e, {
|
|
106
107
|
descriptionProps: b,
|
|
107
108
|
inputProps: C,
|
|
@@ -253,5 +254,5 @@ const qe = (e) => {
|
|
|
253
254
|
] });
|
|
254
255
|
};
|
|
255
256
|
export {
|
|
256
|
-
|
|
257
|
+
Ge as default
|
|
257
258
|
};
|
package/dist/Badge/Badge.js
CHANGED
|
@@ -39,6 +39,7 @@ import "../DsCheckbox/DsCheckbox.js";
|
|
|
39
39
|
import "../DsChoice/DsChoice.js";
|
|
40
40
|
import "../DsForm/DsForm.js";
|
|
41
41
|
import "../DsForm/DsFormContext.js";
|
|
42
|
+
import "../utils/dsValidate.js";
|
|
42
43
|
import "../DsInput/DsInput.js";
|
|
43
44
|
import "../DsInputDate/DsInputDate.js";
|
|
44
45
|
import "../DsInputFile/DsInputFile.js";
|
|
@@ -36,6 +36,7 @@ import "../DsCheckbox/DsCheckbox.js";
|
|
|
36
36
|
import "../DsChoice/DsChoice.js";
|
|
37
37
|
import "../DsForm/DsForm.js";
|
|
38
38
|
import "../DsForm/DsFormContext.js";
|
|
39
|
+
import "../utils/dsValidate.js";
|
|
39
40
|
import "../DsInput/DsInput.js";
|
|
40
41
|
import "../DsInputDate/DsInputDate.js";
|
|
41
42
|
import "../DsInputFile/DsInputFile.js";
|
|
@@ -98,7 +99,7 @@ import "../Card/CardFooter.js";
|
|
|
98
99
|
import "../FileUpload/FileUpload.js";
|
|
99
100
|
import "../FormFields/FormFields.js";
|
|
100
101
|
/* empty css */
|
|
101
|
-
const
|
|
102
|
+
const it = ({
|
|
102
103
|
title: i,
|
|
103
104
|
prevButtonProps: o,
|
|
104
105
|
nextButtonProps: m
|
|
@@ -148,5 +149,5 @@ const tt = ({
|
|
|
148
149
|
)
|
|
149
150
|
] });
|
|
150
151
|
export {
|
|
151
|
-
|
|
152
|
+
it as default
|
|
152
153
|
};
|
|
@@ -35,6 +35,7 @@ import "../../DsCheckbox/DsCheckbox.js";
|
|
|
35
35
|
import "../../DsChoice/DsChoice.js";
|
|
36
36
|
import "../../DsForm/DsForm.js";
|
|
37
37
|
import "../../DsForm/DsFormContext.js";
|
|
38
|
+
import "../../utils/dsValidate.js";
|
|
38
39
|
import "../../DsInput/DsInput.js";
|
|
39
40
|
import "../../DsInputDate/DsInputDate.js";
|
|
40
41
|
import "../../DsInputFile/DsInputFile.js";
|
|
@@ -99,7 +100,7 @@ import "../../FormFields/FormFields.js";
|
|
|
99
100
|
/* empty css */
|
|
100
101
|
import { today as $, getLocalTimeZone as x } from "../../external/@internationalized/date/dist/queries.js";
|
|
101
102
|
import { useCalendarCell as g } from "../../external/@react-aria/calendar/dist/useCalendarCell.js";
|
|
102
|
-
const
|
|
103
|
+
const dt = ({ state: i, date: t }) => {
|
|
103
104
|
const o = f(null), {
|
|
104
105
|
cellProps: m,
|
|
105
106
|
buttonProps: p,
|
|
@@ -134,5 +135,5 @@ const nt = ({ state: i, date: t }) => {
|
|
|
134
135
|
) });
|
|
135
136
|
};
|
|
136
137
|
export {
|
|
137
|
-
|
|
138
|
+
dt as default
|
|
138
139
|
};
|
|
@@ -36,6 +36,7 @@ import "../../DsCheckbox/DsCheckbox.js";
|
|
|
36
36
|
import "../../DsChoice/DsChoice.js";
|
|
37
37
|
import "../../DsForm/DsForm.js";
|
|
38
38
|
import "../../DsForm/DsFormContext.js";
|
|
39
|
+
import "../../utils/dsValidate.js";
|
|
39
40
|
import "../../DsInput/DsInput.js";
|
|
40
41
|
import "../../DsInputDate/DsInputDate.js";
|
|
41
42
|
import "../../DsInputFile/DsInputFile.js";
|
|
@@ -101,7 +102,7 @@ import g from "./CalendarCell.js";
|
|
|
101
102
|
/* empty css */
|
|
102
103
|
import { useLocale as _ } from "../../external/@react-aria/i18n/dist/context.js";
|
|
103
104
|
import { useCalendarGrid as u } from "../../external/@react-aria/calendar/dist/useCalendarGrid.js";
|
|
104
|
-
const
|
|
105
|
+
const ht = ({ state: o, ...e }) => {
|
|
105
106
|
const { locale: a } = _(), { gridProps: s, headerProps: l, weekDays: d } = u(e, o), n = h(o.visibleRange.start, a);
|
|
106
107
|
return /* @__PURE__ */ f("table", { ...s, className: "eds-calendargrid__table", children: [
|
|
107
108
|
/* @__PURE__ */ r("thead", { ...l, children: /* @__PURE__ */ r("tr", { className: "eds-calendargrid__row", children: d.map((t, i) => /* @__PURE__ */ r("th", { className: "eds-calendargrid__cell", children: /* @__PURE__ */ r(
|
|
@@ -140,5 +141,5 @@ const ft = ({ state: o, ...e }) => {
|
|
|
140
141
|
] });
|
|
141
142
|
};
|
|
142
143
|
export {
|
|
143
|
-
|
|
144
|
+
ht as default
|
|
144
145
|
};
|
|
@@ -36,6 +36,7 @@ import "../../DsCheckbox/DsCheckbox.js";
|
|
|
36
36
|
import "../../DsChoice/DsChoice.js";
|
|
37
37
|
import "../../DsForm/DsForm.js";
|
|
38
38
|
import "../../DsForm/DsFormContext.js";
|
|
39
|
+
import "../../utils/dsValidate.js";
|
|
39
40
|
import "../../DsInput/DsInput.js";
|
|
40
41
|
import "../../DsInputDate/DsInputDate.js";
|
|
41
42
|
import "../../DsInputFile/DsInputFile.js";
|
|
@@ -101,7 +102,7 @@ import { isPeriodUnavailable as C, focusCell as m } from "../_utils/calendarUtil
|
|
|
101
102
|
/* empty css */
|
|
102
103
|
import { useCalendarCell as A } from "../../external/@react-aria/calendar/dist/useCalendarCell.js";
|
|
103
104
|
import { mergeProps as L } from "../../external/@react-aria/utils/dist/mergeProps.js";
|
|
104
|
-
const
|
|
105
|
+
const Cr = ({
|
|
105
106
|
monthNumber: i,
|
|
106
107
|
monthName: s,
|
|
107
108
|
state: o,
|
|
@@ -169,5 +170,5 @@ const yr = ({
|
|
|
169
170
|
) });
|
|
170
171
|
};
|
|
171
172
|
export {
|
|
172
|
-
|
|
173
|
+
Cr as default
|
|
173
174
|
};
|
|
@@ -35,6 +35,7 @@ import "../../DsCheckbox/DsCheckbox.js";
|
|
|
35
35
|
import "../../DsChoice/DsChoice.js";
|
|
36
36
|
import "../../DsForm/DsForm.js";
|
|
37
37
|
import "../../DsForm/DsFormContext.js";
|
|
38
|
+
import "../../utils/dsValidate.js";
|
|
38
39
|
import "../../DsInput/DsInput.js";
|
|
39
40
|
import "../../DsInputDate/DsInputDate.js";
|
|
40
41
|
import "../../DsInputFile/DsInputFile.js";
|
|
@@ -102,7 +103,7 @@ import { today as y, getLocalTimeZone as F } from "../../external/@international
|
|
|
102
103
|
import { isPeriodUnavailable as Y, focusCell as v } from "../_utils/calendarUtils.js";
|
|
103
104
|
import { useCalendarCell as L } from "../../external/@react-aria/calendar/dist/useCalendarCell.js";
|
|
104
105
|
import { mergeProps as N } from "../../external/@react-aria/utils/dist/mergeProps.js";
|
|
105
|
-
const
|
|
106
|
+
const vo = ({
|
|
106
107
|
year: t,
|
|
107
108
|
state: o,
|
|
108
109
|
onChange: d,
|
|
@@ -169,5 +170,5 @@ const Yo = ({
|
|
|
169
170
|
) });
|
|
170
171
|
};
|
|
171
172
|
export {
|
|
172
|
-
|
|
173
|
+
vo as default
|
|
173
174
|
};
|
|
@@ -39,6 +39,7 @@ import "../DsCheckbox/DsCheckbox.js";
|
|
|
39
39
|
import "../DsChoice/DsChoice.js";
|
|
40
40
|
import "../DsForm/DsForm.js";
|
|
41
41
|
import "../DsForm/DsFormContext.js";
|
|
42
|
+
import "../utils/dsValidate.js";
|
|
42
43
|
import "../DsInput/DsInput.js";
|
|
43
44
|
import "../DsInputDate/DsInputDate.js";
|
|
44
45
|
import "../DsInputFile/DsInputFile.js";
|
|
@@ -34,6 +34,7 @@ import "../DsCheckbox/DsCheckbox.js";
|
|
|
34
34
|
import "../DsChoice/DsChoice.js";
|
|
35
35
|
import "../DsForm/DsForm.js";
|
|
36
36
|
import "../DsForm/DsFormContext.js";
|
|
37
|
+
import "../utils/dsValidate.js";
|
|
37
38
|
import "../DsInput/DsInput.js";
|
|
38
39
|
import "../DsInputDate/DsInputDate.js";
|
|
39
40
|
import "../DsInputFile/DsInputFile.js";
|
package/dist/Choice/Choice.js
CHANGED
|
@@ -38,6 +38,7 @@ import "../DsCheckbox/DsCheckbox.js";
|
|
|
38
38
|
import "../DsChoice/DsChoice.js";
|
|
39
39
|
import "../DsForm/DsForm.js";
|
|
40
40
|
import "../DsForm/DsFormContext.js";
|
|
41
|
+
import "../utils/dsValidate.js";
|
|
41
42
|
import "../DsInput/DsInput.js";
|
|
42
43
|
import "../DsInputDate/DsInputDate.js";
|
|
43
44
|
import "../DsInputFile/DsInputFile.js";
|
|
@@ -37,6 +37,7 @@ import "../DsCheckbox/DsCheckbox.js";
|
|
|
37
37
|
import "../DsChoice/DsChoice.js";
|
|
38
38
|
import "../DsForm/DsForm.js";
|
|
39
39
|
import "../DsForm/DsFormContext.js";
|
|
40
|
+
import "../utils/dsValidate.js";
|
|
40
41
|
import "../DsInput/DsInput.js";
|
|
41
42
|
import "../DsInputDate/DsInputDate.js";
|
|
42
43
|
import "../DsInputFile/DsInputFile.js";
|
|
@@ -36,6 +36,7 @@ import "../DsCheckbox/DsCheckbox.js";
|
|
|
36
36
|
import "../DsChoice/DsChoice.js";
|
|
37
37
|
import "../DsForm/DsForm.js";
|
|
38
38
|
import "../DsForm/DsFormContext.js";
|
|
39
|
+
import "../utils/dsValidate.js";
|
|
39
40
|
import "../DsInput/DsInput.js";
|
|
40
41
|
import "../DsInputDate/DsInputDate.js";
|
|
41
42
|
import "../DsInputFile/DsInputFile.js";
|
|
@@ -35,6 +35,7 @@ import "../DsCheckbox/DsCheckbox.js";
|
|
|
35
35
|
import "../DsChoice/DsChoice.js";
|
|
36
36
|
import "../DsForm/DsForm.js";
|
|
37
37
|
import "../DsForm/DsFormContext.js";
|
|
38
|
+
import "../utils/dsValidate.js";
|
|
38
39
|
import "../DsInput/DsInput.js";
|
|
39
40
|
import "../DsInputDate/DsInputDate.js";
|
|
40
41
|
import "../DsInputFile/DsInputFile.js";
|
|
@@ -1,188 +1,168 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs as
|
|
3
|
-
import { createContext as W, forwardRef as X, useContext as Y, useEffect as
|
|
4
|
-
import { DsInputLabel as
|
|
5
|
-
import { DsInputMessages as
|
|
6
|
-
import { useDsInputIds as
|
|
7
|
-
import { DsIcon as
|
|
8
|
-
import { cn as
|
|
9
|
-
import { useDsForwardedRef as
|
|
10
|
-
import { useDsValidate as
|
|
2
|
+
import { jsxs as B, jsx as s } from "react/jsx-runtime";
|
|
3
|
+
import { createContext as W, forwardRef as X, useContext as Y, useEffect as $, useState as Z, useRef as O, useMemo as ee } from "react";
|
|
4
|
+
import { DsInputLabel as H } from "../DsInputLabel/DsInputLabel.js";
|
|
5
|
+
import { DsInputMessages as J } from "../DsInputMessages/DsInputMessages.js";
|
|
6
|
+
import { useDsInputIds as K } from "../utils/dsInputs.js";
|
|
7
|
+
import { DsIcon as P } from "../DsIcon/DsIcon.js";
|
|
8
|
+
import { cn as V } from "../utils/dsClass.js";
|
|
9
|
+
import { useDsForwardedRef as se } from "../utils/dsForwardedRef.js";
|
|
10
|
+
import { useDsValidate as oe, useDsFieldContext as re, useDsGroupValidate as ne } from "../utils/dsValidate.js";
|
|
11
11
|
/* empty css */
|
|
12
|
-
const
|
|
13
|
-
label:
|
|
14
|
-
description:
|
|
15
|
-
errorMessage:
|
|
16
|
-
errorMessages:
|
|
17
|
-
validate:
|
|
18
|
-
required:
|
|
19
|
-
disabled:
|
|
20
|
-
readOnly:
|
|
21
|
-
size:
|
|
22
|
-
className:
|
|
23
|
-
id:
|
|
24
|
-
name:
|
|
25
|
-
value:
|
|
26
|
-
checked:
|
|
27
|
-
defaultChecked:
|
|
28
|
-
onChange:
|
|
29
|
-
indeterminate:
|
|
30
|
-
...
|
|
31
|
-
},
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
}, [
|
|
36
|
-
const
|
|
37
|
-
errorMessage: typeof
|
|
38
|
-
errorMessages:
|
|
39
|
-
validate:
|
|
40
|
-
enabled: !
|
|
41
|
-
}),
|
|
12
|
+
const M = W(null), te = X(function({
|
|
13
|
+
label: C,
|
|
14
|
+
description: g,
|
|
15
|
+
errorMessage: d,
|
|
16
|
+
errorMessages: p,
|
|
17
|
+
validate: x,
|
|
18
|
+
required: t,
|
|
19
|
+
disabled: v,
|
|
20
|
+
readOnly: l,
|
|
21
|
+
size: y,
|
|
22
|
+
className: D = "",
|
|
23
|
+
id: w,
|
|
24
|
+
name: _,
|
|
25
|
+
value: a,
|
|
26
|
+
checked: z,
|
|
27
|
+
defaultChecked: I,
|
|
28
|
+
onChange: G,
|
|
29
|
+
indeterminate: h = !1,
|
|
30
|
+
...i
|
|
31
|
+
}, E) {
|
|
32
|
+
const o = Y(M), u = t ?? o?.required, f = v ?? o?.disabled, k = _ ?? o?.name, N = y ?? o?.size ?? "default", { id: q, errorId: m, descriptionId: S } = K(w), c = se(E);
|
|
33
|
+
$(() => {
|
|
34
|
+
c.current && (c.current.indeterminate = h);
|
|
35
|
+
}, [h]);
|
|
36
|
+
const r = o != null, R = r && a != null ? o?.value?.includes(a) ?? !1 : z, F = oe(c, {
|
|
37
|
+
errorMessage: typeof d == "string" ? d : void 0,
|
|
38
|
+
errorMessages: p,
|
|
39
|
+
validate: x,
|
|
40
|
+
enabled: !r
|
|
41
|
+
}), e = d != null && d !== "" ? d : void 0, n = r ? e : e ?? F.error ?? void 0, b = n != null && n !== "", j = V(
|
|
42
42
|
"ds-checkbox",
|
|
43
|
-
`ds-checkbox--${
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
),
|
|
49
|
-
return /* @__PURE__ */
|
|
50
|
-
/* @__PURE__ */
|
|
51
|
-
/* @__PURE__ */
|
|
43
|
+
`ds-checkbox--${N}`,
|
|
44
|
+
f && "ds-checkbox--disabled",
|
|
45
|
+
b && "ds-checkbox--error",
|
|
46
|
+
h && "ds-checkbox--indeterminate",
|
|
47
|
+
D
|
|
48
|
+
), Q = V(b && m, g && S) || void 0, U = r ? void 0 : u;
|
|
49
|
+
return /* @__PURE__ */ B("div", { className: j, children: [
|
|
50
|
+
/* @__PURE__ */ B("label", { className: "ds-checkbox__row", htmlFor: q, children: [
|
|
51
|
+
/* @__PURE__ */ s(
|
|
52
52
|
"input",
|
|
53
53
|
{
|
|
54
|
-
...
|
|
55
|
-
ref:
|
|
56
|
-
id:
|
|
54
|
+
...i,
|
|
55
|
+
ref: c,
|
|
56
|
+
id: q,
|
|
57
57
|
type: "checkbox",
|
|
58
|
-
name:
|
|
59
|
-
value:
|
|
60
|
-
checked:
|
|
61
|
-
defaultChecked:
|
|
62
|
-
required:
|
|
63
|
-
disabled:
|
|
64
|
-
readOnly:
|
|
65
|
-
"aria-invalid":
|
|
66
|
-
"aria-required":
|
|
67
|
-
"aria-describedby":
|
|
58
|
+
name: k,
|
|
59
|
+
value: a,
|
|
60
|
+
checked: R,
|
|
61
|
+
defaultChecked: R == null ? I : void 0,
|
|
62
|
+
required: U,
|
|
63
|
+
disabled: f,
|
|
64
|
+
readOnly: l,
|
|
65
|
+
"aria-invalid": b || void 0,
|
|
66
|
+
"aria-required": u || void 0,
|
|
67
|
+
"aria-describedby": Q,
|
|
68
68
|
className: "ds-checkbox__input",
|
|
69
|
-
onChange: (
|
|
70
|
-
const
|
|
71
|
-
|
|
69
|
+
onChange: (A) => {
|
|
70
|
+
const L = A.currentTarget.checked;
|
|
71
|
+
r && a != null && o?.onItemChange?.(a, L), G?.(L, A);
|
|
72
72
|
}
|
|
73
73
|
}
|
|
74
74
|
),
|
|
75
|
-
/* @__PURE__ */
|
|
76
|
-
/* @__PURE__ */
|
|
77
|
-
|
|
75
|
+
/* @__PURE__ */ s("span", { className: "ds-checkbox__box", "aria-hidden": "true", children: h ? /* @__PURE__ */ s("span", { className: "ds-checkbox__indeterminate", children: /* @__PURE__ */ s(P, { icon: "minus", size: "small", "aria-hidden": "true" }) }) : /* @__PURE__ */ s("span", { className: "ds-checkbox__check", children: /* @__PURE__ */ s(P, { icon: "check", size: "small", "aria-hidden": "true" }) }) }),
|
|
76
|
+
/* @__PURE__ */ s(
|
|
77
|
+
H,
|
|
78
78
|
{
|
|
79
79
|
as: "span",
|
|
80
|
-
required:
|
|
81
|
-
readOnly:
|
|
80
|
+
required: r ? void 0 : u,
|
|
81
|
+
readOnly: l,
|
|
82
82
|
layout: "inline",
|
|
83
83
|
className: "ds-checkbox__label",
|
|
84
|
-
size:
|
|
85
|
-
children:
|
|
84
|
+
size: N,
|
|
85
|
+
children: C
|
|
86
86
|
}
|
|
87
87
|
)
|
|
88
88
|
] }),
|
|
89
|
-
/* @__PURE__ */
|
|
90
|
-
|
|
89
|
+
/* @__PURE__ */ s(
|
|
90
|
+
J,
|
|
91
91
|
{
|
|
92
|
-
errorMessage:
|
|
93
|
-
description:
|
|
94
|
-
errorId:
|
|
95
|
-
descriptionId:
|
|
92
|
+
errorMessage: n,
|
|
93
|
+
description: g,
|
|
94
|
+
errorId: m,
|
|
95
|
+
descriptionId: S
|
|
96
96
|
}
|
|
97
97
|
)
|
|
98
98
|
] });
|
|
99
99
|
});
|
|
100
|
-
function
|
|
101
|
-
name:
|
|
102
|
-
value:
|
|
103
|
-
defaultValue:
|
|
104
|
-
onChange:
|
|
105
|
-
label:
|
|
106
|
-
description:
|
|
107
|
-
errorMessage:
|
|
108
|
-
errorMessages:
|
|
109
|
-
required:
|
|
110
|
-
disabled:
|
|
111
|
-
size:
|
|
112
|
-
className:
|
|
113
|
-
items:
|
|
114
|
-
children:
|
|
115
|
-
optionalLabel:
|
|
100
|
+
function pe({
|
|
101
|
+
name: T,
|
|
102
|
+
value: C,
|
|
103
|
+
defaultValue: g,
|
|
104
|
+
onChange: d,
|
|
105
|
+
label: p,
|
|
106
|
+
description: x,
|
|
107
|
+
errorMessage: t,
|
|
108
|
+
errorMessages: v,
|
|
109
|
+
required: l,
|
|
110
|
+
disabled: y,
|
|
111
|
+
size: D,
|
|
112
|
+
className: w = "",
|
|
113
|
+
items: _,
|
|
114
|
+
children: a,
|
|
115
|
+
optionalLabel: z
|
|
116
116
|
}) {
|
|
117
|
-
const
|
|
118
|
-
|
|
119
|
-
),
|
|
120
|
-
() =>
|
|
121
|
-
[
|
|
122
|
-
),
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
const
|
|
117
|
+
const I = C !== void 0, [G, h] = Z(
|
|
118
|
+
g ?? []
|
|
119
|
+
), i = I ? C : G, { errorId: E, descriptionId: o } = K(), u = O(null), f = re(), k = ee(
|
|
120
|
+
() => f.errorMessages || v ? { ...f.errorMessages, ...v } : void 0,
|
|
121
|
+
[f.errorMessages, v]
|
|
122
|
+
), N = ne({
|
|
123
|
+
fieldsetRef: u,
|
|
124
|
+
errorMessages: k,
|
|
125
|
+
isEmpty: i.length === 0
|
|
126
|
+
}), q = (e, n) => {
|
|
127
|
+
const b = n ? Array.from(/* @__PURE__ */ new Set([...i, e])) : i.filter((j) => j !== e);
|
|
128
|
+
I || h(b), d?.(b);
|
|
129
|
+
}, m = typeof t == "string" && t !== "" ? t : void 0;
|
|
130
|
+
$(() => {
|
|
131
|
+
const e = u.current;
|
|
128
132
|
if (!e) return;
|
|
129
|
-
const
|
|
133
|
+
const n = e.querySelector(
|
|
130
134
|
'input[type="checkbox"]'
|
|
131
135
|
);
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
) :
|
|
135
|
-
}, [
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
const r = (f) => {
|
|
139
|
-
f.preventDefault();
|
|
140
|
-
const d = f.target;
|
|
141
|
-
if (d.tagName !== "INPUT" || d.type !== "checkbox") return;
|
|
142
|
-
const A = d.validity;
|
|
143
|
-
if (i) {
|
|
144
|
-
const k = Object.keys(i).find(
|
|
145
|
-
(j) => A[j]
|
|
146
|
-
);
|
|
147
|
-
if (k && i[k]) {
|
|
148
|
-
p(i[k]);
|
|
149
|
-
return;
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
p(d.validationMessage);
|
|
153
|
-
};
|
|
154
|
-
return e.addEventListener("invalid", r, !0), () => {
|
|
155
|
-
e.removeEventListener("invalid", r, !0);
|
|
156
|
-
};
|
|
157
|
-
}, [i]), F(() => {
|
|
158
|
-
t.length > 0 && p("");
|
|
159
|
-
}, [t.length]);
|
|
160
|
-
const o = (c != null && c !== "" ? c : void 0) ?? (w || void 0), x = o != null && o !== "", P = g != null && g !== "", S = G(x && V, P && s) || void 0;
|
|
161
|
-
return /* @__PURE__ */ U(
|
|
136
|
+
n && (m ? n.setCustomValidity(m) : l && i.length === 0 ? n.setCustomValidity(
|
|
137
|
+
k?.valueMissing || "This field is required"
|
|
138
|
+
) : n.setCustomValidity(""));
|
|
139
|
+
}, [l, i.length, m, k]);
|
|
140
|
+
const c = (t != null && t !== "" ? t : void 0) ?? (N || void 0), r = c != null && c !== "", R = x != null && x !== "", F = V(r && E, R && o) || void 0;
|
|
141
|
+
return /* @__PURE__ */ B(
|
|
162
142
|
"fieldset",
|
|
163
143
|
{
|
|
164
|
-
ref:
|
|
165
|
-
className:
|
|
166
|
-
disabled:
|
|
167
|
-
"aria-describedby":
|
|
168
|
-
"aria-invalid":
|
|
144
|
+
ref: u,
|
|
145
|
+
className: V("ds-checkbox-group", r && "ds-checkbox-group--error", w),
|
|
146
|
+
disabled: y || void 0,
|
|
147
|
+
"aria-describedby": F,
|
|
148
|
+
"aria-invalid": r || void 0,
|
|
169
149
|
children: [
|
|
170
|
-
|
|
171
|
-
|
|
150
|
+
p != null && p !== "" ? /* @__PURE__ */ s(
|
|
151
|
+
H,
|
|
172
152
|
{
|
|
173
153
|
as: "legend",
|
|
174
|
-
required:
|
|
175
|
-
optionalLabel:
|
|
176
|
-
size:
|
|
177
|
-
children:
|
|
154
|
+
required: l,
|
|
155
|
+
optionalLabel: z,
|
|
156
|
+
size: D,
|
|
157
|
+
children: p
|
|
178
158
|
}
|
|
179
159
|
) : null,
|
|
180
|
-
/* @__PURE__ */
|
|
181
|
-
|
|
160
|
+
/* @__PURE__ */ s(
|
|
161
|
+
M.Provider,
|
|
182
162
|
{
|
|
183
|
-
value: { name:
|
|
184
|
-
children: /* @__PURE__ */
|
|
185
|
-
|
|
163
|
+
value: { name: T, value: i, onItemChange: q, disabled: y, required: l, size: D },
|
|
164
|
+
children: /* @__PURE__ */ s("div", { className: "ds-checkbox-group__items", children: _ ? _.map((e) => /* @__PURE__ */ s(
|
|
165
|
+
te,
|
|
186
166
|
{
|
|
187
167
|
value: e.value,
|
|
188
168
|
label: e.label,
|
|
@@ -190,16 +170,16 @@ function be({
|
|
|
190
170
|
disabled: e.disabled
|
|
191
171
|
},
|
|
192
172
|
e.value
|
|
193
|
-
)) :
|
|
173
|
+
)) : a })
|
|
194
174
|
}
|
|
195
175
|
),
|
|
196
|
-
/* @__PURE__ */
|
|
197
|
-
|
|
176
|
+
/* @__PURE__ */ s(
|
|
177
|
+
J,
|
|
198
178
|
{
|
|
199
|
-
errorMessage:
|
|
200
|
-
description:
|
|
201
|
-
errorId:
|
|
202
|
-
descriptionId:
|
|
179
|
+
errorMessage: c,
|
|
180
|
+
description: x,
|
|
181
|
+
errorId: E,
|
|
182
|
+
descriptionId: o
|
|
203
183
|
}
|
|
204
184
|
)
|
|
205
185
|
]
|
|
@@ -207,7 +187,7 @@ function be({
|
|
|
207
187
|
);
|
|
208
188
|
}
|
|
209
189
|
export {
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
190
|
+
te as DsCheckbox,
|
|
191
|
+
pe as DsCheckboxGroup,
|
|
192
|
+
te as default
|
|
213
193
|
};
|