asma-ui-core 3.120.0 → 3.121.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/dist/asma-ui-core.css +1 -1
- package/dist/components/inputs/checkbox/base-ui/StyledCheckbox.module.js +8 -8
- package/dist/components/inputs/radio-button/base-ui/StyledRadio.module.js +9 -9
- package/dist/components/miscellaneous/StyledInputLabel.js +20 -17
- package/dist/datetime/components/date-picker/components/BaseDatePickerInput.js +107 -100
- package/dist/datetime/components/date-picker/components/DatePickerInputSingle.js +11 -10
- package/dist/datetime/components/date-picker/hooks/useDatePickerValidation.js +13 -13
- package/dist/datetime/components/time-picker/StyledTimePicker.js +96 -91
- package/dist/datetime/components/time-picker/TimePickerInput.js +50 -45
- package/dist/datetime/components/time-picker/components/HelperText.js +22 -22
- package/dist/helpers/HelperRow.js +13 -10
- package/dist/helpers/helperTextRoom.js +27 -15
- package/dist/helpers/useHelperRowBudget.js +15 -15
- package/dist/src/datetime/components/date-picker/components/BaseDatePickerInput.d.ts +1 -0
- package/dist/src/datetime/components/date-picker/types.d.ts +2 -0
- package/dist/src/datetime/components/time-picker/TimePickerInput.d.ts +1 -0
- package/dist/src/datetime/components/time-picker/components/HelperText.d.ts +6 -1
- package/dist/src/datetime/components/time-picker/types.d.ts +3 -0
- package/dist/src/helpers/helperTextRoom.d.ts +10 -0
- package/dist/src/table/types.d.ts +5 -4
- package/dist/table/components/StyledTable.module.js +55 -55
- package/package.json +1 -1
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
var e = "
|
|
1
|
+
var e = "_CheckboxWrapper_svs38_1", _ = "_Checkbox_svs38_1", r = "_Indeterminate_svs38_33", s = "_ReadOnly_svs38_109", a = "_Indicator_svs38_118", v = "_HideWrapper_svs38_122", o = "_CheckboxHover_svs38_129", p = "_CheckboxRippleContainer_svs38_129", i = "_CheckboxRipple_svs38_129", l = "_ripple_svs38_1", d = {
|
|
2
2
|
CheckboxWrapper: e,
|
|
3
|
-
"size-small": "_size-
|
|
4
|
-
"size-medium": "_size-
|
|
3
|
+
"size-small": "_size-small_svs38_16",
|
|
4
|
+
"size-medium": "_size-medium_svs38_20",
|
|
5
5
|
Checkbox: _,
|
|
6
6
|
Indeterminate: r,
|
|
7
|
-
Error: "
|
|
8
|
-
ReadOnly:
|
|
7
|
+
Error: "_Error_svs38_60",
|
|
8
|
+
ReadOnly: s,
|
|
9
9
|
Indicator: a,
|
|
10
|
-
HideWrapper:
|
|
10
|
+
HideWrapper: v,
|
|
11
11
|
CheckboxHover: o,
|
|
12
12
|
CheckboxRippleContainer: p,
|
|
13
13
|
CheckboxRipple: i,
|
|
14
|
-
ripple:
|
|
14
|
+
ripple: l
|
|
15
15
|
};
|
|
16
16
|
export {
|
|
17
|
-
|
|
17
|
+
d as default
|
|
18
18
|
};
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
var a = "
|
|
1
|
+
var a = "_RadioWrapper_143d4_1", _ = "_RadioRippleContainer_143d4_27", d = "_RadioRipple_143d4_27", r = "_ripple_143d4_1", i = "_RadioHover_143d4_61", e = "_ReadOnly_143d4_78", o = "_Radio_143d4_1", p = "_Indicator_143d4_113", R = {
|
|
2
2
|
RadioWrapper: a,
|
|
3
|
-
"size-small": "_size-
|
|
3
|
+
"size-small": "_size-small_143d4_14",
|
|
4
4
|
RadioRippleContainer: _,
|
|
5
|
-
RadioRipple:
|
|
6
|
-
ripple:
|
|
7
|
-
RadioHover:
|
|
5
|
+
RadioRipple: d,
|
|
6
|
+
ripple: r,
|
|
7
|
+
RadioHover: i,
|
|
8
|
+
ReadOnly: e,
|
|
8
9
|
Radio: o,
|
|
9
|
-
Indicator:
|
|
10
|
-
Error: "
|
|
11
|
-
ReadOnly: n
|
|
10
|
+
Indicator: p,
|
|
11
|
+
Error: "_Error_143d4_134"
|
|
12
12
|
};
|
|
13
13
|
export {
|
|
14
|
-
|
|
14
|
+
R as default
|
|
15
15
|
};
|
|
@@ -1,31 +1,34 @@
|
|
|
1
|
-
import { cn as
|
|
1
|
+
import { cn as d } from "../../helpers/cn.js";
|
|
2
2
|
import { fieldLabelAboveClass as x, floatingLabelClass as h, floatingLabelLayoutStyle as v } from "../inputs/field-styles.js";
|
|
3
3
|
import { useFormControlContext as L } from "./FormControlContext.js";
|
|
4
|
-
import { jsx as n, jsxs as
|
|
5
|
-
var g = ({ children:
|
|
6
|
-
const e = L(),
|
|
4
|
+
import { jsx as n, jsxs as f } from "react/jsx-runtime";
|
|
5
|
+
var g = ({ children: r, htmlFor: l, id: s, required: b, disabled: a, error: u, size: c, shrink: m, labelPlacement: p = "above", className: o }) => {
|
|
6
|
+
const e = L(), i = m ?? (e ? e.focused || e.filled : !1), t = b ?? e?.required ?? !1;
|
|
7
7
|
return p === "above" ? /* @__PURE__ */ n("div", {
|
|
8
|
-
className:
|
|
9
|
-
children: /* @__PURE__ */
|
|
10
|
-
htmlFor:
|
|
8
|
+
className: d(x({ disabled: a ?? e?.disabled }), o),
|
|
9
|
+
children: /* @__PURE__ */ f("label", {
|
|
10
|
+
htmlFor: l,
|
|
11
11
|
id: s ?? e?.labelId,
|
|
12
|
-
children: [
|
|
12
|
+
children: [r, t && /* @__PURE__ */ n("span", {
|
|
13
13
|
"aria-hidden": "true",
|
|
14
14
|
children: " *"
|
|
15
15
|
})]
|
|
16
16
|
})
|
|
17
|
-
}) : /* @__PURE__ */
|
|
18
|
-
htmlFor:
|
|
17
|
+
}) : /* @__PURE__ */ f("label", {
|
|
18
|
+
htmlFor: l,
|
|
19
19
|
id: s ?? e?.labelId,
|
|
20
|
-
className:
|
|
21
|
-
shrink:
|
|
20
|
+
className: d(h({
|
|
21
|
+
shrink: i,
|
|
22
22
|
focused: e?.focused,
|
|
23
|
-
error:
|
|
23
|
+
error: u ?? e?.error,
|
|
24
24
|
disabled: a ?? e?.disabled,
|
|
25
|
-
size:
|
|
26
|
-
}),
|
|
27
|
-
style: v(
|
|
28
|
-
|
|
25
|
+
size: c ?? e?.size
|
|
26
|
+
}), o),
|
|
27
|
+
style: i ? v(!0) : {
|
|
28
|
+
top: "1.25rem",
|
|
29
|
+
transform: "translateY(-50%)"
|
|
30
|
+
},
|
|
31
|
+
children: [r, t && " *"]
|
|
29
32
|
});
|
|
30
33
|
};
|
|
31
34
|
export {
|
|
@@ -1,133 +1,140 @@
|
|
|
1
|
-
import { fieldLabelAboveClass as
|
|
2
|
-
import { StyledInputField as
|
|
3
|
-
import { getValue as
|
|
4
|
-
import { DatePickerButton as
|
|
5
|
-
import { getTitleLabelling as
|
|
6
|
-
import { DATE_INPUT_FONT_FAMILY as
|
|
7
|
-
import { useDatePickerMask as
|
|
8
|
-
import { defaultDatePickerValidationMessages as
|
|
9
|
-
import { useEffect as
|
|
10
|
-
import { jsx as
|
|
11
|
-
import { isValid as
|
|
12
|
-
var
|
|
13
|
-
const { onClick: Y, inputClassName: B, dateFormat: a, selected: e, error:
|
|
1
|
+
import { fieldLabelAboveClass as V, fieldWidthStyle as ee } from "../../../../components/inputs/field-styles.js";
|
|
2
|
+
import { StyledInputField as te } from "../../../../components/inputs/input-field/StyledInputField.js";
|
|
3
|
+
import { getValue as x } from "../helpers.js";
|
|
4
|
+
import { DatePickerButton as re } from "./DatePickerButton.js";
|
|
5
|
+
import { getTitleLabelling as ae } from "../../../helpers/getTitleLabelling.js";
|
|
6
|
+
import { DATE_INPUT_FONT_FAMILY as le } from "../../../../helpers/inputMask.js";
|
|
7
|
+
import { useDatePickerMask as ie } from "../hooks/useDatePickerMask.js";
|
|
8
|
+
import { defaultDatePickerValidationMessages as oe, useDatePickerValidation as de } from "../hooks/useDatePickerValidation.js";
|
|
9
|
+
import { useEffect as A, useId as E, useRef as se, useState as H } from "react";
|
|
10
|
+
import { jsx as r, jsxs as b } from "react/jsx-runtime";
|
|
11
|
+
import { isValid as ne, parse as ce } from "date-fns";
|
|
12
|
+
var Te = (R) => {
|
|
13
|
+
const { onClick: Y, inputClassName: B, dateFormat: a, selected: e, error: L, helperText: O, errorText: S, onInputChange: y, hideCalendar: _, locale: l, disabledDays: s, label: h, title: v, inputAriaProps: j, readOnly: i, disallowPast: n, disallowFuture: c, validateOnCalendarClose: T, onValidatedOnce: C, hideDefaultHelperText: q, reserveHelperText: W, required: o, minDate: m, width: N = "s", ...p } = R, { validationError: z, handleValidation: u, errHelperText: U, clearValidation: P } = de(oe), { maskRef: G } = ie(), M = E(), k = E(), [t, w] = H(e ? x(e, a) : ""), g = se(!1), [I, J] = H({
|
|
14
14
|
selected: e,
|
|
15
15
|
dateFormat: a
|
|
16
16
|
});
|
|
17
|
-
(e !==
|
|
17
|
+
(e !== I.selected || a !== I.dateFormat) && (J({
|
|
18
18
|
selected: e,
|
|
19
19
|
dateFormat: a
|
|
20
|
-
}),
|
|
21
|
-
const
|
|
22
|
-
|
|
20
|
+
}), w(e ? x(e, a) : ""));
|
|
21
|
+
const K = l?.code?.startsWith("nb") ? "DD/MM/ÅÅÅÅ" : "DD/MM/YYYY", Q = q ? void 0 : K, F = !!(z || L), d = F ? S ?? U : O ?? Q;
|
|
22
|
+
A(() => {
|
|
23
23
|
if (!e) {
|
|
24
|
-
|
|
24
|
+
g.current || P(), g.current = !1;
|
|
25
25
|
return;
|
|
26
26
|
}
|
|
27
|
-
|
|
28
|
-
value:
|
|
29
|
-
disabledDays:
|
|
30
|
-
localeCode:
|
|
31
|
-
disallowPast:
|
|
32
|
-
disallowFuture:
|
|
33
|
-
required:
|
|
34
|
-
minDate:
|
|
27
|
+
u({
|
|
28
|
+
value: x(e, a),
|
|
29
|
+
disabledDays: s,
|
|
30
|
+
localeCode: l?.code,
|
|
31
|
+
disallowPast: n,
|
|
32
|
+
disallowFuture: c,
|
|
33
|
+
required: o,
|
|
34
|
+
minDate: m
|
|
35
35
|
});
|
|
36
36
|
}, [
|
|
37
37
|
e,
|
|
38
38
|
a,
|
|
39
|
-
o,
|
|
40
|
-
r?.code,
|
|
41
39
|
s,
|
|
40
|
+
l?.code,
|
|
42
41
|
n,
|
|
43
|
-
i,
|
|
44
42
|
c,
|
|
45
|
-
|
|
46
|
-
|
|
43
|
+
o,
|
|
44
|
+
m,
|
|
45
|
+
u,
|
|
46
|
+
P
|
|
47
47
|
]);
|
|
48
|
-
const
|
|
49
|
-
const
|
|
50
|
-
|
|
48
|
+
const X = /\d/.test(t), Z = (D) => {
|
|
49
|
+
const f = D.target.value;
|
|
50
|
+
w(f.replace(/\D/g, "").length ? f : "");
|
|
51
51
|
};
|
|
52
|
-
|
|
53
|
-
|
|
52
|
+
A(() => {
|
|
53
|
+
T && (u({
|
|
54
54
|
value: t,
|
|
55
|
-
disabledDays:
|
|
56
|
-
localeCode:
|
|
57
|
-
disallowPast:
|
|
58
|
-
disallowFuture:
|
|
59
|
-
required:
|
|
60
|
-
minDate:
|
|
61
|
-
}),
|
|
55
|
+
disabledDays: s,
|
|
56
|
+
localeCode: l?.code,
|
|
57
|
+
disallowPast: n,
|
|
58
|
+
disallowFuture: c,
|
|
59
|
+
required: o,
|
|
60
|
+
minDate: m
|
|
61
|
+
}), C?.());
|
|
62
62
|
}, [
|
|
63
|
-
|
|
63
|
+
T,
|
|
64
64
|
t,
|
|
65
|
-
o,
|
|
66
|
-
r?.code,
|
|
67
65
|
s,
|
|
66
|
+
l?.code,
|
|
68
67
|
n,
|
|
69
|
-
i,
|
|
70
68
|
c,
|
|
71
|
-
|
|
72
|
-
|
|
69
|
+
o,
|
|
70
|
+
m,
|
|
71
|
+
C,
|
|
72
|
+
u
|
|
73
73
|
]);
|
|
74
|
-
const
|
|
75
|
-
|
|
74
|
+
const $ = () => {
|
|
75
|
+
const D = u({
|
|
76
76
|
value: t,
|
|
77
|
-
disabledDays:
|
|
78
|
-
localeCode:
|
|
79
|
-
disallowPast:
|
|
80
|
-
disallowFuture:
|
|
81
|
-
required:
|
|
82
|
-
minDate:
|
|
83
|
-
})
|
|
77
|
+
disabledDays: s,
|
|
78
|
+
localeCode: l?.code,
|
|
79
|
+
disallowPast: n,
|
|
80
|
+
disallowFuture: c,
|
|
81
|
+
required: o,
|
|
82
|
+
minDate: m
|
|
83
|
+
});
|
|
84
84
|
if (!t.replace(/\D/g, "").length) {
|
|
85
|
-
g?.(void 0);
|
|
85
|
+
g.current = !!e, y?.(void 0);
|
|
86
86
|
return;
|
|
87
87
|
}
|
|
88
|
-
|
|
89
|
-
|
|
88
|
+
if (D) return;
|
|
89
|
+
const f = ce(t, "dd/MM/yyyy", /* @__PURE__ */ new Date());
|
|
90
|
+
y?.(ne(f) ? f : void 0);
|
|
90
91
|
};
|
|
91
|
-
return /* @__PURE__ */
|
|
92
|
+
return /* @__PURE__ */ b("div", {
|
|
92
93
|
className: "cursor-default",
|
|
93
|
-
"data-field-width":
|
|
94
|
-
style:
|
|
94
|
+
"data-field-width": N,
|
|
95
|
+
style: ee(N),
|
|
96
|
+
"data-helper-room-box": "",
|
|
95
97
|
children: [
|
|
96
|
-
|
|
97
|
-
id:
|
|
98
|
-
className:
|
|
99
|
-
children:
|
|
98
|
+
v && /* @__PURE__ */ r("div", {
|
|
99
|
+
id: M,
|
|
100
|
+
className: V({ disabled: p.disabled }),
|
|
101
|
+
children: v
|
|
100
102
|
}),
|
|
101
|
-
|
|
102
|
-
className:
|
|
103
|
-
children: /* @__PURE__ */
|
|
104
|
-
htmlFor:
|
|
105
|
-
children: [
|
|
103
|
+
h && /* @__PURE__ */ r("div", {
|
|
104
|
+
className: V({ disabled: p.disabled }),
|
|
105
|
+
children: /* @__PURE__ */ b("label", {
|
|
106
|
+
htmlFor: k,
|
|
107
|
+
children: [h, o && /* @__PURE__ */ r("span", {
|
|
106
108
|
"aria-hidden": "true",
|
|
107
109
|
children: " *"
|
|
108
110
|
})]
|
|
109
111
|
})
|
|
110
112
|
}),
|
|
111
|
-
/* @__PURE__ */
|
|
113
|
+
/* @__PURE__ */ b("div", {
|
|
112
114
|
className: "flex items-start gap-1",
|
|
113
|
-
children: [/* @__PURE__ */
|
|
115
|
+
children: [/* @__PURE__ */ r("div", {
|
|
114
116
|
className: "min-w-0 flex-1",
|
|
115
|
-
children: /* @__PURE__ */
|
|
117
|
+
children: /* @__PURE__ */ r("div", {
|
|
116
118
|
className: "relative",
|
|
117
|
-
children: /* @__PURE__ */
|
|
118
|
-
...
|
|
119
|
-
id:
|
|
120
|
-
readOnly:
|
|
121
|
-
"data-testid":
|
|
119
|
+
children: /* @__PURE__ */ r(te, {
|
|
120
|
+
...p,
|
|
121
|
+
id: k,
|
|
122
|
+
readOnly: i,
|
|
123
|
+
"data-testid": p.dataTest,
|
|
122
124
|
autoComplete: "off",
|
|
123
|
-
inputRef:
|
|
124
|
-
placeholder: !
|
|
125
|
+
inputRef: i ? void 0 : G,
|
|
126
|
+
placeholder: !i && !X ? " / / " : void 0,
|
|
125
127
|
size: "small",
|
|
126
|
-
value:
|
|
128
|
+
value: i ? t.replaceAll("/", ".") : t,
|
|
127
129
|
className: B,
|
|
128
|
-
error:
|
|
129
|
-
onBlur:
|
|
130
|
-
helperText:
|
|
130
|
+
error: F,
|
|
131
|
+
onBlur: i ? void 0 : $,
|
|
132
|
+
helperText: d == null || d === "" ? d : /* @__PURE__ */ r("span", {
|
|
133
|
+
className: "block truncate",
|
|
134
|
+
title: typeof d == "string" ? d : void 0,
|
|
135
|
+
children: d
|
|
136
|
+
}),
|
|
137
|
+
reserveHelperText: W,
|
|
131
138
|
slotProps: {
|
|
132
139
|
formHelperText: { sx: {
|
|
133
140
|
marginTop: "4px",
|
|
@@ -135,31 +142,31 @@ var xe = (H) => {
|
|
|
135
142
|
marginRight: 0
|
|
136
143
|
} },
|
|
137
144
|
htmlInput: {
|
|
138
|
-
"aria-required":
|
|
139
|
-
...
|
|
140
|
-
title:
|
|
141
|
-
titleId:
|
|
142
|
-
label:
|
|
143
|
-
inputAriaProps:
|
|
145
|
+
"aria-required": o ? !0 : void 0,
|
|
146
|
+
...ae({
|
|
147
|
+
title: v,
|
|
148
|
+
titleId: M,
|
|
149
|
+
label: h,
|
|
150
|
+
inputAriaProps: j
|
|
144
151
|
}),
|
|
145
|
-
...
|
|
152
|
+
...i ? {} : {
|
|
146
153
|
inputMode: "numeric",
|
|
147
|
-
style: { fontFamily:
|
|
154
|
+
style: { fontFamily: le }
|
|
148
155
|
}
|
|
149
156
|
}
|
|
150
157
|
},
|
|
151
|
-
onChange:
|
|
158
|
+
onChange: Z
|
|
152
159
|
})
|
|
153
160
|
})
|
|
154
|
-
}), !
|
|
161
|
+
}), !_ && !i && /* @__PURE__ */ r(re, {
|
|
155
162
|
onClick: Y,
|
|
156
|
-
disabled: !!
|
|
157
|
-
localeCode:
|
|
163
|
+
disabled: !!p.disabled,
|
|
164
|
+
localeCode: l?.code
|
|
158
165
|
})]
|
|
159
166
|
})
|
|
160
167
|
]
|
|
161
168
|
});
|
|
162
169
|
};
|
|
163
170
|
export {
|
|
164
|
-
|
|
171
|
+
Te as BaseDatePickerInput
|
|
165
172
|
};
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { BaseDatePickerInput as
|
|
2
|
-
import { jsx as
|
|
1
|
+
import { BaseDatePickerInput as y } from "./BaseDatePickerInput.js";
|
|
2
|
+
import { jsx as F } from "react/jsx-runtime";
|
|
3
3
|
var q = ({ datePickerProps: e, onClick: a }) => {
|
|
4
|
-
const { inputClassName: r, disabled: t, helperText: l, label: d, error: i, locale: n, hideCalendar: o, dateFormat: s, disabledDays: p, dataTest: u, readOnly: m, errorText: c, disallowFuture: h, disallowPast:
|
|
5
|
-
return /* @__PURE__ */ y
|
|
4
|
+
const { inputClassName: r, disabled: t, helperText: l, label: d, error: i, locale: n, hideCalendar: o, dateFormat: s, disabledDays: p, dataTest: u, readOnly: m, errorText: c, disallowFuture: h, disallowPast: x, required: C, minDate: D, validateOnCalendarClose: T, onValidatedOnce: b, onInputChange: I, selected: P, title: f, hideDefaultHelperText: g, reserveHelperText: v, inputAriaProps: w, width: O } = e;
|
|
5
|
+
return /* @__PURE__ */ F(y, {
|
|
6
6
|
dataTest: u,
|
|
7
7
|
inputClassName: r,
|
|
8
8
|
readOnly: m,
|
|
9
9
|
disabled: !!t,
|
|
10
10
|
helperText: l,
|
|
11
11
|
onClick: a,
|
|
12
|
-
onInputChange: (k) =>
|
|
13
|
-
selected:
|
|
12
|
+
onInputChange: (k) => I?.(k),
|
|
13
|
+
selected: P,
|
|
14
14
|
error: !!i,
|
|
15
15
|
locale: n,
|
|
16
16
|
hideCalendar: o,
|
|
@@ -19,13 +19,14 @@ var q = ({ datePickerProps: e, onClick: a }) => {
|
|
|
19
19
|
label: d,
|
|
20
20
|
errorText: c,
|
|
21
21
|
disallowFuture: h,
|
|
22
|
-
disallowPast:
|
|
23
|
-
required:
|
|
22
|
+
disallowPast: x,
|
|
23
|
+
required: C,
|
|
24
24
|
minDate: D,
|
|
25
|
-
validateOnCalendarClose:
|
|
26
|
-
onValidatedOnce:
|
|
25
|
+
validateOnCalendarClose: T,
|
|
26
|
+
onValidatedOnce: b,
|
|
27
27
|
title: f,
|
|
28
28
|
hideDefaultHelperText: g,
|
|
29
|
+
reserveHelperText: v,
|
|
29
30
|
inputAriaProps: w,
|
|
30
31
|
width: O
|
|
31
32
|
});
|
|
@@ -15,7 +15,7 @@ var F = {
|
|
|
15
15
|
futureNotAllowed: "Future date is not allowed"
|
|
16
16
|
},
|
|
17
17
|
nb: {
|
|
18
|
-
required: "
|
|
18
|
+
required: "Obligatorisk",
|
|
19
19
|
minDate: "Sluttdato må være etter startdato",
|
|
20
20
|
invalidDay: "Ugyldig dag",
|
|
21
21
|
invalidMonth: "Ugyldig måned",
|
|
@@ -26,13 +26,13 @@ var F = {
|
|
|
26
26
|
pastNotAllowed: "Dato i fortiden er ikke tillatt",
|
|
27
27
|
futureNotAllowed: "Dato i fremtiden er ikke tillatt"
|
|
28
28
|
}
|
|
29
|
-
}, I = /^(\d{2})\/(\d{2})\/(\d{4})$/,
|
|
29
|
+
}, I = /^(\d{2})\/(\d{2})\/(\d{4})$/, $ = (D = F) => {
|
|
30
30
|
const [c, e] = y(!1), [p, t] = y(""), n = g(() => {
|
|
31
31
|
e(!1), t("");
|
|
32
32
|
}, []);
|
|
33
33
|
return {
|
|
34
34
|
validationError: c,
|
|
35
|
-
handleValidation: g(({ value: m, disabledDays: M, localeCode: h, disallowPast: k, disallowFuture: w, required: o, minDate:
|
|
35
|
+
handleValidation: g(({ value: m, disabledDays: M, localeCode: h, disallowPast: k, disallowFuture: w, required: o, minDate: f }) => {
|
|
36
36
|
const a = D[h === "nb" ? "nb" : "en"];
|
|
37
37
|
if (!m.replace(/\D/g, "").length)
|
|
38
38
|
return e(!!o), t(o ? a.required : ""), !!o;
|
|
@@ -46,18 +46,18 @@ var F = {
|
|
|
46
46
|
return e(!0), t(a.invalidMonth), !0;
|
|
47
47
|
if (l < 1900 || l > 2100)
|
|
48
48
|
return e(!0), t(a.invalidYear), !0;
|
|
49
|
-
const
|
|
50
|
-
if (!(
|
|
49
|
+
const s = new Date(l, d - 1, i);
|
|
50
|
+
if (!(s.getFullYear() === l && s.getMonth() === d - 1 && s.getDate() === i))
|
|
51
51
|
return e(!0), t(a.invalidDate), !0;
|
|
52
|
-
const
|
|
53
|
-
if (!U(
|
|
52
|
+
const u = x(`${r[1]}/${r[2]}/${r[3]}`, "dd/MM/yyyy", /* @__PURE__ */ new Date());
|
|
53
|
+
if (!U(u))
|
|
54
54
|
return e(!0), t(a.invalidDate), !0;
|
|
55
|
-
if (
|
|
55
|
+
if (f && b(u) <= b(f))
|
|
56
56
|
return e(!0), t(a.minDate), !0;
|
|
57
|
-
const
|
|
58
|
-
return
|
|
59
|
-
parsedDate:
|
|
60
|
-
disabledDays:
|
|
57
|
+
const v = Y(M, k, w);
|
|
58
|
+
return v.length && N({
|
|
59
|
+
parsedDate: u,
|
|
60
|
+
disabledDays: v
|
|
61
61
|
}) ? (t(a.dateDisabled), e(!0), !0) : (n(), !1);
|
|
62
62
|
}, [n, D]),
|
|
63
63
|
errHelperText: p,
|
|
@@ -66,5 +66,5 @@ var F = {
|
|
|
66
66
|
};
|
|
67
67
|
export {
|
|
68
68
|
F as defaultDatePickerValidationMessages,
|
|
69
|
-
|
|
69
|
+
$ as useDatePickerValidation
|
|
70
70
|
};
|