asma-ui-core 3.126.1 → 3.126.2
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/feedback/dialog/StyledDialog.js +59 -59
- package/dist/components/feedback/dialog/dialog-footer/StyledDialogFooter.js +38 -38
- package/dist/components/feedback/minimizable-dialog/v2/MinimizableDialogV2.js +45 -45
- package/dist/components/inputs/form-layout/StyledFieldPair.js +16 -16
- package/dist/datetime/components/date-picker/components/BaseDatePickerInput.js +81 -80
- package/package.json +1 -1
|
@@ -2,145 +2,145 @@ import { fieldLabelAboveClass as R, fieldWidthStyle as le } from "../../../../co
|
|
|
2
2
|
import { StyledInputField as oe } from "../../../../components/inputs/input-field/StyledInputField.js";
|
|
3
3
|
import { getValue as b } from "../helpers.js";
|
|
4
4
|
import { DatePickerButton as ie } from "./DatePickerButton.js";
|
|
5
|
-
import { getTitleLabelling as
|
|
6
|
-
import { DATE_INPUT_FONT_FAMILY as
|
|
5
|
+
import { getTitleLabelling as se } from "../../../helpers/getTitleLabelling.js";
|
|
6
|
+
import { DATE_INPUT_FONT_FAMILY as de } from "../../../../helpers/inputMask.js";
|
|
7
7
|
import { useDatePickerMask as ne } from "../hooks/useDatePickerMask.js";
|
|
8
|
-
import { defaultDatePickerValidationMessages as ce, useDatePickerValidation as
|
|
8
|
+
import { defaultDatePickerValidationMessages as ce, useDatePickerValidation as me } from "../hooks/useDatePickerValidation.js";
|
|
9
9
|
import { useEffect as A, useId as E, useRef as pe, useState as H } from "react";
|
|
10
|
-
import { jsx as
|
|
11
|
-
import { isValid as
|
|
12
|
-
var
|
|
13
|
-
const { onClick: L, inputClassName: S, dateFormat:
|
|
10
|
+
import { jsx as r, jsxs as T } from "react/jsx-runtime";
|
|
11
|
+
import { isValid as ue, parse as fe } from "date-fns";
|
|
12
|
+
var Pe = (Y) => {
|
|
13
|
+
const { onClick: L, inputClassName: S, dateFormat: l, selected: e, error: _, helperText: j, errorText: q, onInputChange: C, hideCalendar: W, locale: o, disabledDays: d, label: h, title: x, inputAriaProps: z, readOnly: U, lockedReason: v, readOnlyReason: y, disallowPast: n, disallowFuture: c, validateOnCalendarClose: N, onValidatedOnce: w, hideDefaultHelperText: G, reserveHelperText: J, required: i, minDate: m, width: P = "s", ...p } = Y, a = !!U || !!v || !!y, k = !v && !!y, { validationError: K, handleValidation: u, errHelperText: Q, clearValidation: M } = me(ce), { maskRef: X } = ne(), I = E(), V = E(), [t, B] = H(e ? b(e, l) : ""), g = pe(!1), [F, Z] = H({
|
|
14
14
|
selected: e,
|
|
15
|
-
dateFormat:
|
|
15
|
+
dateFormat: l
|
|
16
16
|
});
|
|
17
|
-
(e !== F.selected ||
|
|
17
|
+
(e !== F.selected || l !== F.dateFormat) && (Z({
|
|
18
18
|
selected: e,
|
|
19
|
-
dateFormat:
|
|
20
|
-
}), B(e ? b(e,
|
|
21
|
-
const $ =
|
|
19
|
+
dateFormat: l
|
|
20
|
+
}), B(e ? b(e, l) : ""));
|
|
21
|
+
const $ = o?.code?.startsWith("nb") ? "DD/MM/ÅÅÅÅ" : "DD/MM/YYYY", ee = G ? void 0 : $, O = !!(K || _), s = O ? q ?? Q : j ?? ee;
|
|
22
22
|
A(() => {
|
|
23
23
|
if (!e) {
|
|
24
|
-
|
|
24
|
+
g.current || M(), g.current = !1;
|
|
25
25
|
return;
|
|
26
26
|
}
|
|
27
|
-
|
|
28
|
-
value: b(e,
|
|
29
|
-
disabledDays:
|
|
30
|
-
localeCode:
|
|
27
|
+
u({
|
|
28
|
+
value: b(e, l),
|
|
29
|
+
disabledDays: d,
|
|
30
|
+
localeCode: o?.code,
|
|
31
31
|
disallowPast: n,
|
|
32
32
|
disallowFuture: c,
|
|
33
|
-
required:
|
|
34
|
-
minDate:
|
|
33
|
+
required: i,
|
|
34
|
+
minDate: m
|
|
35
35
|
});
|
|
36
36
|
}, [
|
|
37
37
|
e,
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
38
|
+
l,
|
|
39
|
+
d,
|
|
40
|
+
o?.code,
|
|
41
41
|
n,
|
|
42
42
|
c,
|
|
43
|
-
|
|
44
|
-
u,
|
|
43
|
+
i,
|
|
45
44
|
m,
|
|
46
|
-
|
|
45
|
+
u,
|
|
46
|
+
M
|
|
47
47
|
]);
|
|
48
|
-
const
|
|
49
|
-
const f =
|
|
48
|
+
const ae = /\d/.test(t), te = (D) => {
|
|
49
|
+
const f = D.target.value;
|
|
50
50
|
B(f.replace(/\D/g, "").length ? f : "");
|
|
51
51
|
};
|
|
52
52
|
A(() => {
|
|
53
|
-
N && (
|
|
53
|
+
N && (u({
|
|
54
54
|
value: t,
|
|
55
|
-
disabledDays:
|
|
56
|
-
localeCode:
|
|
55
|
+
disabledDays: d,
|
|
56
|
+
localeCode: o?.code,
|
|
57
57
|
disallowPast: n,
|
|
58
58
|
disallowFuture: c,
|
|
59
|
-
required:
|
|
60
|
-
minDate:
|
|
61
|
-
}),
|
|
59
|
+
required: i,
|
|
60
|
+
minDate: m
|
|
61
|
+
}), w?.());
|
|
62
62
|
}, [
|
|
63
63
|
N,
|
|
64
64
|
t,
|
|
65
|
-
|
|
66
|
-
|
|
65
|
+
d,
|
|
66
|
+
o?.code,
|
|
67
67
|
n,
|
|
68
68
|
c,
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
69
|
+
i,
|
|
70
|
+
m,
|
|
71
|
+
w,
|
|
72
|
+
u
|
|
73
73
|
]);
|
|
74
74
|
const re = () => {
|
|
75
|
-
const
|
|
75
|
+
const D = u({
|
|
76
76
|
value: t,
|
|
77
|
-
disabledDays:
|
|
78
|
-
localeCode:
|
|
77
|
+
disabledDays: d,
|
|
78
|
+
localeCode: o?.code,
|
|
79
79
|
disallowPast: n,
|
|
80
80
|
disallowFuture: c,
|
|
81
|
-
required:
|
|
82
|
-
minDate:
|
|
81
|
+
required: i,
|
|
82
|
+
minDate: m
|
|
83
83
|
});
|
|
84
84
|
if (!t.replace(/\D/g, "").length) {
|
|
85
|
-
|
|
85
|
+
g.current = !!e, C?.(void 0);
|
|
86
86
|
return;
|
|
87
87
|
}
|
|
88
|
-
if (
|
|
88
|
+
if (D) return;
|
|
89
89
|
const f = fe(t, "dd/MM/yyyy", /* @__PURE__ */ new Date());
|
|
90
|
-
C?.(
|
|
90
|
+
C?.(ue(f) ? f : void 0);
|
|
91
91
|
};
|
|
92
92
|
return /* @__PURE__ */ T("div", {
|
|
93
93
|
className: "cursor-default",
|
|
94
|
-
"data-field-width":
|
|
95
|
-
style: le(
|
|
94
|
+
"data-field-width": P,
|
|
95
|
+
style: le(P),
|
|
96
96
|
"data-helper-room-box": "",
|
|
97
97
|
children: [
|
|
98
|
-
|
|
98
|
+
x && /* @__PURE__ */ r("div", {
|
|
99
99
|
id: I,
|
|
100
100
|
className: R({
|
|
101
101
|
disabled: p.disabled,
|
|
102
|
-
flush:
|
|
102
|
+
flush: k
|
|
103
103
|
}),
|
|
104
|
-
children:
|
|
104
|
+
children: x
|
|
105
105
|
}),
|
|
106
|
-
h && /* @__PURE__ */
|
|
106
|
+
h && /* @__PURE__ */ r("div", {
|
|
107
107
|
className: R({
|
|
108
108
|
disabled: p.disabled,
|
|
109
|
-
flush:
|
|
109
|
+
flush: k
|
|
110
110
|
}),
|
|
111
111
|
children: /* @__PURE__ */ T("label", {
|
|
112
112
|
htmlFor: V,
|
|
113
|
-
children: [h,
|
|
113
|
+
children: [h, i && /* @__PURE__ */ r("span", {
|
|
114
114
|
"aria-hidden": "true",
|
|
115
115
|
children: " *"
|
|
116
116
|
})]
|
|
117
117
|
})
|
|
118
118
|
}),
|
|
119
119
|
/* @__PURE__ */ T("div", {
|
|
120
|
-
className: "flex items-start gap-1",
|
|
121
|
-
children: [/* @__PURE__ */
|
|
122
|
-
className: "min-w-0 flex-1",
|
|
123
|
-
children: /* @__PURE__ */
|
|
120
|
+
className: "flex items-start gap-1 max-xs:flex-wrap max-xs:gap-y-1",
|
|
121
|
+
children: [/* @__PURE__ */ r("div", {
|
|
122
|
+
className: "min-w-0 flex-1 max-xs:min-w-min",
|
|
123
|
+
children: /* @__PURE__ */ r("div", {
|
|
124
124
|
className: "relative",
|
|
125
|
-
children: /* @__PURE__ */
|
|
125
|
+
children: /* @__PURE__ */ r(oe, {
|
|
126
126
|
...p,
|
|
127
127
|
id: V,
|
|
128
|
-
readOnly:
|
|
129
|
-
lockedReason:
|
|
130
|
-
readOnlyReason:
|
|
128
|
+
readOnly: a,
|
|
129
|
+
lockedReason: v,
|
|
130
|
+
readOnlyReason: y,
|
|
131
131
|
"data-testid": p.dataTest,
|
|
132
132
|
autoComplete: "off",
|
|
133
|
-
inputRef:
|
|
134
|
-
placeholder: !
|
|
133
|
+
inputRef: a ? void 0 : X,
|
|
134
|
+
placeholder: !a && !ae ? " / / " : void 0,
|
|
135
135
|
size: "small",
|
|
136
|
-
value:
|
|
136
|
+
value: a ? t.replaceAll("/", ".") : t,
|
|
137
137
|
className: S,
|
|
138
138
|
error: O,
|
|
139
|
-
onBlur:
|
|
140
|
-
helperText:
|
|
139
|
+
onBlur: a ? void 0 : re,
|
|
140
|
+
helperText: s == null || s === "" ? s : /* @__PURE__ */ r("span", {
|
|
141
141
|
className: "block truncate",
|
|
142
|
-
title: typeof
|
|
143
|
-
children:
|
|
142
|
+
title: typeof s == "string" ? s : void 0,
|
|
143
|
+
children: s
|
|
144
144
|
}),
|
|
145
145
|
reserveHelperText: J,
|
|
146
146
|
slotProps: {
|
|
@@ -150,31 +150,32 @@ var ke = (Y) => {
|
|
|
150
150
|
marginRight: 0
|
|
151
151
|
} },
|
|
152
152
|
htmlInput: {
|
|
153
|
-
"aria-required":
|
|
154
|
-
...
|
|
155
|
-
title:
|
|
153
|
+
"aria-required": i ? !0 : void 0,
|
|
154
|
+
...se({
|
|
155
|
+
title: x,
|
|
156
156
|
titleId: I,
|
|
157
157
|
label: h,
|
|
158
158
|
inputAriaProps: z
|
|
159
159
|
}),
|
|
160
|
-
...
|
|
160
|
+
...a ? {} : {
|
|
161
161
|
inputMode: "numeric",
|
|
162
|
-
style: { fontFamily:
|
|
162
|
+
style: { fontFamily: de }
|
|
163
163
|
}
|
|
164
|
-
}
|
|
164
|
+
},
|
|
165
|
+
input: a ? void 0 : { className: "max-xs:min-w-[calc(10ch+1rem)] max-xs:px-2" }
|
|
165
166
|
},
|
|
166
|
-
onChange:
|
|
167
|
+
onChange: te
|
|
167
168
|
})
|
|
168
169
|
})
|
|
169
|
-
}), !W && !
|
|
170
|
+
}), !W && !a && /* @__PURE__ */ r(ie, {
|
|
170
171
|
onClick: L,
|
|
171
172
|
disabled: !!p.disabled,
|
|
172
|
-
localeCode:
|
|
173
|
+
localeCode: o?.code
|
|
173
174
|
})]
|
|
174
175
|
})
|
|
175
176
|
]
|
|
176
177
|
});
|
|
177
178
|
};
|
|
178
179
|
export {
|
|
179
|
-
|
|
180
|
+
Pe as BaseDatePickerInput
|
|
180
181
|
};
|