asma-ui-core 3.106.0 → 3.107.0
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/components/feedback/minimizable-dialog/v2/MinimizableDialogV2.js +103 -92
- package/dist/datetime/components/date-picker/components/BaseDatePickerInput.js +66 -56
- package/dist/datetime/components/date-picker/components/DatePickerInputSingle.js +13 -12
- package/dist/datetime/components/time-picker/TimePickerInput.js +47 -39
- package/dist/datetime/helpers/getTitleLabelling.js +10 -0
- package/dist/src/datetime/components/date-picker/components/BaseDatePickerInput.d.ts +2 -0
- package/dist/src/datetime/components/date-picker/types.d.ts +6 -0
- package/dist/src/datetime/components/time-picker/types.d.ts +6 -1
- package/dist/src/datetime/helpers/getTitleLabelling.d.ts +12 -0
- package/package.json +1 -1
|
@@ -1,47 +1,53 @@
|
|
|
1
|
-
import { cn as
|
|
2
|
-
import { firstTabbable as
|
|
3
|
-
import { StyledTooltip as
|
|
4
|
-
import { DialogBusyContext as
|
|
5
|
-
import { useMobileMediaQuery as
|
|
6
|
-
import { useFocusTrap as
|
|
7
|
-
import { CloseBtn as
|
|
8
|
-
import { MinimizeBtn as
|
|
9
|
-
import { FullScreenBtn as
|
|
10
|
-
import
|
|
11
|
-
import { useTranslations as
|
|
12
|
-
import { useControlledProps as
|
|
13
|
-
import
|
|
14
|
-
import { useLayoutEffect as
|
|
15
|
-
import { Fragment as
|
|
16
|
-
var
|
|
17
|
-
const { showCloseIcon:
|
|
1
|
+
import { cn as s } from "../../../../helpers/cn.js";
|
|
2
|
+
import { firstTabbable as A } from "../../../../helpers/focusable.js";
|
|
3
|
+
import { StyledTooltip as te } from "../../../data-display/tooltip/StyledTooltip.js";
|
|
4
|
+
import { DialogBusyContext as $, useDialogBusyBoundary as ie } from "../../dialog/DialogBusyContext.js";
|
|
5
|
+
import { useMobileMediaQuery as le } from "../../../../hooks/useMediaQuery.hook.js";
|
|
6
|
+
import { useFocusTrap as ne } from "../../../../hooks/useFocusTrap.hook.js";
|
|
7
|
+
import { CloseBtn as O } from "../components/CloseBtn.js";
|
|
8
|
+
import { MinimizeBtn as V } from "../components/MinimizeBtn.js";
|
|
9
|
+
import { FullScreenBtn as oe } from "../components/FullscreenBtn.js";
|
|
10
|
+
import v from "./MinimizableDialogV2.module.js";
|
|
11
|
+
import { useTranslations as re } from "./useTranslations.js";
|
|
12
|
+
import { useControlledProps as se } from "./useControlledProps.js";
|
|
13
|
+
import ce from "clsx";
|
|
14
|
+
import { useId as q, useLayoutEffect as H, useRef as c } from "react";
|
|
15
|
+
import { Fragment as ae, jsx as e, jsxs as n } from "react/jsx-runtime";
|
|
16
|
+
var Se = (N) => {
|
|
17
|
+
const { showCloseIcon: R = !0, showMinimizeIcon: L = !0, showExpandIcon: W = !0, enableFullscreen: _ = !0, title: u, label: f, children: Q, open: o, onClose: U, classNameOverrides: h = {
|
|
18
18
|
maximized: "",
|
|
19
19
|
minimized: "",
|
|
20
20
|
fullscreen: ""
|
|
21
|
-
}, dataTest:
|
|
22
|
-
|
|
21
|
+
}, dataTest: G, actionNode: J, locale: K = "en", busyReason: X, style: C, initialFocusRef: S } = N, r = le(), i = re(K), a = c(null), p = c(null), F = c(null), T = c(null), b = c(!1), g = c(null), x = q(), I = q(), { minimized: t, setMinimized: M, fullScreen: l, setFullScreen: B } = se(N), d = l && !t, { busy: y, busyReason: E, contextValue: j } = ie(X ?? i.waitUntilSaved), z = () => {
|
|
22
|
+
y || (M(!1), U());
|
|
23
23
|
};
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}, [t]),
|
|
27
|
-
const
|
|
28
|
-
if (
|
|
29
|
-
|
|
30
|
-
|
|
24
|
+
H(() => {
|
|
25
|
+
a.current?.toggleAttribute("inert", t), p.current?.toggleAttribute("inert", !t);
|
|
26
|
+
}, [t]), H(() => {
|
|
27
|
+
const w = o && !b.current, m = !o && b.current;
|
|
28
|
+
if (b.current = o, m) {
|
|
29
|
+
const P = g.current;
|
|
30
|
+
g.current = null, (!document.activeElement || document.activeElement === document.body) && P?.isConnected && P.focus({ preventScroll: !0 });
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
if (!w) return;
|
|
34
|
+
g.current = document.activeElement instanceof HTMLElement ? document.activeElement : null;
|
|
35
|
+
const D = t ? p.current : a.current, ee = t ? T.current : F.current;
|
|
36
|
+
(S?.current ?? ee ?? (D ? A(D) : void 0))?.focus({ preventScroll: !0 });
|
|
31
37
|
}, [
|
|
32
|
-
|
|
38
|
+
S,
|
|
33
39
|
t,
|
|
34
|
-
|
|
40
|
+
o
|
|
35
41
|
]);
|
|
36
42
|
const k = () => {
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
-
const
|
|
40
|
-
|
|
43
|
+
const w = t ? a : p;
|
|
44
|
+
M(!t), requestAnimationFrame(() => {
|
|
45
|
+
const m = w.current;
|
|
46
|
+
m && (m.querySelector('[data-testid="toggle-minimize-btn"]') ?? A(m))?.focus({ preventScroll: !0 });
|
|
41
47
|
});
|
|
42
48
|
};
|
|
43
|
-
|
|
44
|
-
const
|
|
49
|
+
ne(o && d, a, z);
|
|
50
|
+
const Y = d ? r ? {
|
|
45
51
|
inset: 0,
|
|
46
52
|
maxHeight: "100dvh",
|
|
47
53
|
maxWidth: "100dvw",
|
|
@@ -58,115 +64,120 @@ var ge = (y) => {
|
|
|
58
64
|
maxWidth: "min(1000px, calc(100vw - 32px))",
|
|
59
65
|
height: "95dvh"
|
|
60
66
|
} : void 0;
|
|
61
|
-
|
|
67
|
+
if (!o) return null;
|
|
68
|
+
const Z = f ? `${I} ${x}` : x;
|
|
69
|
+
return /* @__PURE__ */ n(ae, { children: [
|
|
62
70
|
/* @__PURE__ */ e("div", {
|
|
63
|
-
ref:
|
|
71
|
+
ref: p,
|
|
64
72
|
style: {
|
|
65
73
|
zIndex: 51,
|
|
66
|
-
...
|
|
74
|
+
...C
|
|
67
75
|
},
|
|
68
|
-
className:
|
|
69
|
-
children: /* @__PURE__ */
|
|
70
|
-
className:
|
|
71
|
-
"data-testid":
|
|
76
|
+
className: s(v["minimized-dialog"], !t && v.hidden, h.minimized),
|
|
77
|
+
children: /* @__PURE__ */ n("div", {
|
|
78
|
+
className: ce("flex items-center justify-between", !t && "hidden"),
|
|
79
|
+
"data-testid": G,
|
|
72
80
|
children: [/* @__PURE__ */ e("div", {
|
|
73
81
|
className: "max-w-[303px] truncate pr-1 text-lg font-semibold text-delta-800",
|
|
74
|
-
children: /* @__PURE__ */ e(
|
|
75
|
-
title:
|
|
82
|
+
children: /* @__PURE__ */ e(te, {
|
|
83
|
+
title: u,
|
|
76
84
|
placement: "top",
|
|
77
85
|
children: /* @__PURE__ */ e("div", {
|
|
78
86
|
className: "truncate",
|
|
79
|
-
children:
|
|
87
|
+
children: u
|
|
80
88
|
})
|
|
81
89
|
})
|
|
82
|
-
}), /* @__PURE__ */
|
|
90
|
+
}), /* @__PURE__ */ n("div", {
|
|
83
91
|
className: "flex items-center gap-x-1",
|
|
84
|
-
children: [/* @__PURE__ */ e(
|
|
92
|
+
children: [/* @__PURE__ */ e(V, {
|
|
85
93
|
type: "expand",
|
|
86
|
-
visibility:
|
|
94
|
+
visibility: W,
|
|
87
95
|
onClick: k,
|
|
88
96
|
tooltipTitle: i.expand
|
|
89
|
-
}), /* @__PURE__ */ e(
|
|
90
|
-
buttonRef:
|
|
91
|
-
showCloseIcon:
|
|
92
|
-
onClick:
|
|
93
|
-
disabledReason:
|
|
97
|
+
}), /* @__PURE__ */ e(O, {
|
|
98
|
+
buttonRef: T,
|
|
99
|
+
showCloseIcon: R,
|
|
100
|
+
onClick: z,
|
|
101
|
+
disabledReason: y ? E : void 0,
|
|
94
102
|
tooltipTitle: i.close
|
|
95
103
|
})]
|
|
96
104
|
})]
|
|
97
105
|
})
|
|
98
106
|
}),
|
|
99
|
-
|
|
107
|
+
d && /* @__PURE__ */ e("div", {
|
|
100
108
|
className: "fixed inset-0 z-[52] bg-[rgb(98,110,126)] bg-opacity-70",
|
|
101
109
|
onClick: () => {
|
|
102
|
-
|
|
110
|
+
B(!1);
|
|
103
111
|
}
|
|
104
112
|
}),
|
|
105
|
-
/* @__PURE__ */
|
|
113
|
+
/* @__PURE__ */ n("div", {
|
|
106
114
|
style: {
|
|
107
115
|
zIndex: 51,
|
|
108
|
-
...
|
|
109
|
-
...
|
|
116
|
+
...C,
|
|
117
|
+
...Y
|
|
110
118
|
},
|
|
111
|
-
ref:
|
|
112
|
-
role:
|
|
113
|
-
"aria-modal":
|
|
114
|
-
"aria-
|
|
115
|
-
className:
|
|
116
|
-
children: [/* @__PURE__ */
|
|
117
|
-
className:
|
|
118
|
-
children: [/* @__PURE__ */
|
|
119
|
+
ref: a,
|
|
120
|
+
role: "dialog",
|
|
121
|
+
"aria-modal": d ? !0 : void 0,
|
|
122
|
+
"aria-labelledby": Z,
|
|
123
|
+
className: s(v.dialog, t && v.hidden, !l && h.maximized, l && h.fullscreen, d && "fixed z-[53] duration-0"),
|
|
124
|
+
children: [/* @__PURE__ */ n("div", {
|
|
125
|
+
className: s("flex flex-col border-b-[1px] border-delta-200 px-4", r ? "py-3" : "py-4"),
|
|
126
|
+
children: [/* @__PURE__ */ n("div", {
|
|
119
127
|
className: "flex items-center justify-between",
|
|
120
|
-
children: [
|
|
128
|
+
children: [f ? /* @__PURE__ */ e("div", {
|
|
129
|
+
id: I,
|
|
121
130
|
className: "text-sm text-delta-700",
|
|
122
|
-
children:
|
|
131
|
+
children: f
|
|
123
132
|
}) : /* @__PURE__ */ e("div", {
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
133
|
+
id: x,
|
|
134
|
+
className: s("font-semibold text-delta-800", r ? "line-clamp-2 text-xl" : "line-clamp-1 text-2xl"),
|
|
135
|
+
children: u
|
|
136
|
+
}), /* @__PURE__ */ n("div", {
|
|
127
137
|
className: "flex items-center gap-x-1",
|
|
128
138
|
children: [
|
|
129
|
-
/* @__PURE__ */ e(
|
|
130
|
-
value:
|
|
131
|
-
children:
|
|
139
|
+
/* @__PURE__ */ e($.Provider, {
|
|
140
|
+
value: j,
|
|
141
|
+
children: J
|
|
132
142
|
}),
|
|
133
|
-
/* @__PURE__ */ e(
|
|
134
|
-
visibility:
|
|
143
|
+
/* @__PURE__ */ e(V, {
|
|
144
|
+
visibility: L && !r && !l,
|
|
135
145
|
type: "minimize",
|
|
136
146
|
onClick: k,
|
|
137
147
|
tooltipTitle: i.minimize
|
|
138
148
|
}),
|
|
139
|
-
/* @__PURE__ */ e(
|
|
140
|
-
showFullScreenIcon:
|
|
149
|
+
/* @__PURE__ */ e(oe, {
|
|
150
|
+
showFullScreenIcon: _ && !r,
|
|
141
151
|
fullScreen: l,
|
|
142
152
|
onClick: () => {
|
|
143
|
-
|
|
153
|
+
B(!l);
|
|
144
154
|
},
|
|
145
155
|
tooltipTitle: l ? i.exitFullscreen : i.fullscreen
|
|
146
156
|
}),
|
|
147
|
-
/* @__PURE__ */ e(
|
|
148
|
-
buttonRef:
|
|
149
|
-
showCloseIcon:
|
|
150
|
-
onClick:
|
|
151
|
-
disabledReason:
|
|
157
|
+
/* @__PURE__ */ e(O, {
|
|
158
|
+
buttonRef: F,
|
|
159
|
+
showCloseIcon: R,
|
|
160
|
+
onClick: z,
|
|
161
|
+
disabledReason: y ? E : void 0,
|
|
152
162
|
tooltipTitle: i.close
|
|
153
163
|
})
|
|
154
164
|
]
|
|
155
165
|
})]
|
|
156
|
-
}),
|
|
157
|
-
|
|
158
|
-
|
|
166
|
+
}), f && /* @__PURE__ */ e("div", {
|
|
167
|
+
id: x,
|
|
168
|
+
className: s("font-semibold text-delta-800", r ? "line-clamp-2 text-xl" : "line-clamp-1 text-2xl"),
|
|
169
|
+
children: u
|
|
159
170
|
})]
|
|
160
171
|
}), /* @__PURE__ */ e("div", {
|
|
161
|
-
className:
|
|
162
|
-
children: /* @__PURE__ */ e(
|
|
163
|
-
value:
|
|
164
|
-
children:
|
|
172
|
+
className: s(t && "hidden", "flex flex-grow flex-col overflow-y-auto overscroll-contain"),
|
|
173
|
+
children: /* @__PURE__ */ e($.Provider, {
|
|
174
|
+
value: j,
|
|
175
|
+
children: Q
|
|
165
176
|
})
|
|
166
177
|
})]
|
|
167
178
|
})
|
|
168
|
-
] })
|
|
179
|
+
] });
|
|
169
180
|
};
|
|
170
181
|
export {
|
|
171
|
-
|
|
182
|
+
Se as MinimizableDialogV2
|
|
172
183
|
};
|
|
@@ -1,29 +1,30 @@
|
|
|
1
|
-
import { StyledInputField as
|
|
2
|
-
import { getValue as
|
|
3
|
-
import { DatePickerButton as
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
import { StyledInputField as K } from "../../../../components/inputs/input-field/StyledInputField.js";
|
|
2
|
+
import { getValue as h } from "../helpers.js";
|
|
3
|
+
import { DatePickerButton as Q } from "./DatePickerButton.js";
|
|
4
|
+
import { getTitleLabelling as X } from "../../../helpers/getTitleLabelling.js";
|
|
5
|
+
import { DATE_INPUT_FONT_FAMILY as Z } from "../../../../helpers/inputMask.js";
|
|
6
|
+
import { useDatePickerMask as $ } from "../hooks/useDatePickerMask.js";
|
|
7
|
+
import { defaultDatePickerValidationMessages as ee, useDatePickerValidation as te } from "../hooks/useDatePickerValidation.js";
|
|
8
|
+
import { useEffect as I, useId as ae, useState as N } from "react";
|
|
9
|
+
import { jsx as p, jsxs as V } from "react/jsx-runtime";
|
|
10
|
+
import { isValid as re, parse as oe } from "date-fns";
|
|
11
|
+
var he = (F) => {
|
|
12
|
+
const { onClick: w, inputClassName: H, dateFormat: r, selected: e, error: Y, helperText: A, errorText: B, onInputChange: v, hideCalendar: E, locale: o, disabledDays: l, label: g, title: u, inputAriaProps: O, readOnly: t, disallowPast: i, disallowFuture: s, validateOnCalendarClose: D, onValidatedOnce: x, hideDefaultHelperText: L, required: d, minDate: n, ...f } = F, { validationError: R, handleValidation: c, errHelperText: S, clearValidation: y } = te(ee), { maskRef: _ } = $(), T = ae(), [a, C] = N(e ? h(e, r) : ""), [P, j] = N({
|
|
12
13
|
selected: e,
|
|
13
14
|
dateFormat: r
|
|
14
15
|
});
|
|
15
|
-
(e !==
|
|
16
|
+
(e !== P.selected || r !== P.dateFormat) && (j({
|
|
16
17
|
selected: e,
|
|
17
18
|
dateFormat: r
|
|
18
|
-
}),
|
|
19
|
-
const
|
|
20
|
-
|
|
19
|
+
}), C(e ? h(e, r) : ""));
|
|
20
|
+
const q = o?.code?.startsWith("nb") ? "DD/MM/ÅÅÅÅ" : "DD/MM/YYYY", z = L ? void 0 : q, M = !!(R || Y), U = M ? B ?? S : A ?? z;
|
|
21
|
+
I(() => {
|
|
21
22
|
if (!e) {
|
|
22
|
-
|
|
23
|
+
y();
|
|
23
24
|
return;
|
|
24
25
|
}
|
|
25
26
|
c({
|
|
26
|
-
value:
|
|
27
|
+
value: h(e, r),
|
|
27
28
|
disabledDays: l,
|
|
28
29
|
localeCode: o?.code,
|
|
29
30
|
disallowPast: i,
|
|
@@ -41,13 +42,13 @@ var ce = (V) => {
|
|
|
41
42
|
d,
|
|
42
43
|
n,
|
|
43
44
|
c,
|
|
44
|
-
|
|
45
|
+
y
|
|
45
46
|
]);
|
|
46
|
-
const
|
|
47
|
-
const
|
|
48
|
-
|
|
47
|
+
const W = /\d/.test(a), G = (m) => {
|
|
48
|
+
const k = m.target.value;
|
|
49
|
+
C(k.replace(/\D/g, "").length ? k : "");
|
|
49
50
|
};
|
|
50
|
-
|
|
51
|
+
I(() => {
|
|
51
52
|
D && (c({
|
|
52
53
|
value: a,
|
|
53
54
|
disabledDays: l,
|
|
@@ -56,7 +57,7 @@ var ce = (V) => {
|
|
|
56
57
|
disallowFuture: s,
|
|
57
58
|
required: d,
|
|
58
59
|
minDate: n
|
|
59
|
-
}),
|
|
60
|
+
}), x?.());
|
|
60
61
|
}, [
|
|
61
62
|
D,
|
|
62
63
|
a,
|
|
@@ -66,10 +67,10 @@ var ce = (V) => {
|
|
|
66
67
|
s,
|
|
67
68
|
d,
|
|
68
69
|
n,
|
|
69
|
-
|
|
70
|
+
x,
|
|
70
71
|
c
|
|
71
72
|
]);
|
|
72
|
-
const
|
|
73
|
+
const J = () => {
|
|
73
74
|
if (c({
|
|
74
75
|
value: a,
|
|
75
76
|
disabledDays: l,
|
|
@@ -80,61 +81,70 @@ var ce = (V) => {
|
|
|
80
81
|
minDate: n
|
|
81
82
|
})) return;
|
|
82
83
|
if (!a.replace(/\D/g, "").length) {
|
|
83
|
-
|
|
84
|
+
v?.(void 0);
|
|
84
85
|
return;
|
|
85
86
|
}
|
|
86
|
-
const
|
|
87
|
-
|
|
88
|
-
},
|
|
89
|
-
return /* @__PURE__ */
|
|
87
|
+
const m = oe(a, "dd/MM/yyyy", /* @__PURE__ */ new Date());
|
|
88
|
+
v?.(re(m) ? m : void 0);
|
|
89
|
+
}, b = t ? 120 : 156;
|
|
90
|
+
return /* @__PURE__ */ V("div", {
|
|
90
91
|
className: "cursor-default",
|
|
91
|
-
children: [
|
|
92
|
+
children: [u && /* @__PURE__ */ p("div", {
|
|
93
|
+
id: T,
|
|
92
94
|
className: "pb-1 font-roboto font-semibold text-delta-800",
|
|
93
|
-
children:
|
|
94
|
-
}), /* @__PURE__ */
|
|
95
|
+
children: u
|
|
96
|
+
}), /* @__PURE__ */ V("div", {
|
|
95
97
|
className: "flex gap-1",
|
|
96
98
|
style: { height: t ? 40 : 75 },
|
|
97
|
-
children: [/* @__PURE__ */
|
|
98
|
-
style: { width:
|
|
99
|
-
children: /* @__PURE__ */
|
|
99
|
+
children: [/* @__PURE__ */ p("div", {
|
|
100
|
+
style: { width: b },
|
|
101
|
+
children: /* @__PURE__ */ p("div", {
|
|
100
102
|
className: "relative",
|
|
101
|
-
children: /* @__PURE__ */
|
|
102
|
-
...
|
|
103
|
-
label:
|
|
103
|
+
children: /* @__PURE__ */ p(K, {
|
|
104
|
+
...f,
|
|
105
|
+
label: g,
|
|
104
106
|
readOnly: t,
|
|
105
|
-
"data-testid":
|
|
107
|
+
"data-testid": f.dataTest,
|
|
106
108
|
autoComplete: "off",
|
|
107
|
-
inputRef: t ? void 0 :
|
|
108
|
-
placeholder: !t && !
|
|
109
|
+
inputRef: t ? void 0 : _,
|
|
110
|
+
placeholder: !t && !W ? " / / " : void 0,
|
|
109
111
|
size: "small",
|
|
110
112
|
value: t ? a.replaceAll("/", ".") : a,
|
|
111
|
-
className:
|
|
112
|
-
style: { width:
|
|
113
|
-
error:
|
|
114
|
-
onBlur: t ? void 0 :
|
|
115
|
-
helperText:
|
|
113
|
+
className: H,
|
|
114
|
+
style: { width: b },
|
|
115
|
+
error: M,
|
|
116
|
+
onBlur: t ? void 0 : J,
|
|
117
|
+
helperText: U,
|
|
116
118
|
slotProps: {
|
|
117
119
|
formHelperText: { sx: {
|
|
118
120
|
marginTop: "4px",
|
|
119
121
|
marginLeft: 0,
|
|
120
122
|
marginRight: 0
|
|
121
123
|
} },
|
|
122
|
-
htmlInput: {
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
124
|
+
htmlInput: {
|
|
125
|
+
...X({
|
|
126
|
+
title: u,
|
|
127
|
+
titleId: T,
|
|
128
|
+
label: g,
|
|
129
|
+
inputAriaProps: O
|
|
130
|
+
}),
|
|
131
|
+
...t ? {} : {
|
|
132
|
+
inputMode: "numeric",
|
|
133
|
+
style: { fontFamily: Z }
|
|
134
|
+
}
|
|
135
|
+
}
|
|
126
136
|
},
|
|
127
|
-
onChange:
|
|
137
|
+
onChange: G
|
|
128
138
|
})
|
|
129
139
|
})
|
|
130
|
-
}), !
|
|
131
|
-
onClick:
|
|
132
|
-
disabled: !!
|
|
140
|
+
}), !E && !t && /* @__PURE__ */ p(Q, {
|
|
141
|
+
onClick: w,
|
|
142
|
+
disabled: !!f.disabled,
|
|
133
143
|
localeCode: o?.code
|
|
134
144
|
})]
|
|
135
145
|
})]
|
|
136
146
|
});
|
|
137
147
|
};
|
|
138
148
|
export {
|
|
139
|
-
|
|
149
|
+
he as BaseDatePickerInput
|
|
140
150
|
};
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { BaseDatePickerInput as
|
|
2
|
-
import { jsx as
|
|
3
|
-
var
|
|
4
|
-
const { inputClassName: r, disabled: t, helperText: l, label: d, error:
|
|
5
|
-
return /* @__PURE__ */ v
|
|
1
|
+
import { BaseDatePickerInput as v } from "./BaseDatePickerInput.js";
|
|
2
|
+
import { jsx as w } from "react/jsx-runtime";
|
|
3
|
+
var j = ({ 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: C, disallowPast: h, required: x, minDate: D, validateOnCalendarClose: b, onValidatedOnce: I, onInputChange: P, selected: T, title: f, hideDefaultHelperText: g, inputAriaProps: O } = e;
|
|
5
|
+
return /* @__PURE__ */ w(v, {
|
|
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: (
|
|
13
|
-
selected:
|
|
14
|
-
error: !!
|
|
15
|
-
locale:
|
|
12
|
+
onInputChange: (k) => P?.(k),
|
|
13
|
+
selected: T,
|
|
14
|
+
error: !!i,
|
|
15
|
+
locale: n,
|
|
16
16
|
hideCalendar: o,
|
|
17
17
|
dateFormat: s,
|
|
18
18
|
disabledDays: p,
|
|
@@ -24,10 +24,11 @@ var F = ({ datePickerProps: e, onClick: a }) => {
|
|
|
24
24
|
minDate: D,
|
|
25
25
|
validateOnCalendarClose: b,
|
|
26
26
|
onValidatedOnce: I,
|
|
27
|
-
title:
|
|
28
|
-
hideDefaultHelperText:
|
|
27
|
+
title: f,
|
|
28
|
+
hideDefaultHelperText: g,
|
|
29
|
+
inputAriaProps: O
|
|
29
30
|
});
|
|
30
31
|
};
|
|
31
32
|
export {
|
|
32
|
-
|
|
33
|
+
j as DatePickerInputSingle
|
|
33
34
|
};
|
|
@@ -1,74 +1,82 @@
|
|
|
1
|
-
import { ClockOutlineIcon as
|
|
2
|
-
import { StyledInputField as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import { ClockOutlineIcon as P } from "../../../components/icons/clock-outline-icon/ClockOutlineIcon.js";
|
|
2
|
+
import { StyledInputField as y } from "../../../components/inputs/input-field/StyledInputField.js";
|
|
3
|
+
import { getTitleLabelling as R } from "../../helpers/getTitleLabelling.js";
|
|
4
|
+
import { useInputMask as v } from "../../../helpers/inputMask.js";
|
|
5
|
+
import { HelperText as w, defaultTimePickerHelperMessages as A } from "./components/HelperText.js";
|
|
6
|
+
import { useEffect as H, useId as M, useRef as V } from "react";
|
|
7
|
+
import { jsx as l, jsxs as j } from "react/jsx-runtime";
|
|
8
|
+
var q = (x) => {
|
|
9
|
+
const { placeholder: f, disabled: e, inputClassName: h, dataTest: p, width: o, error: g, helperText: T, label: m, locale: k = "en", popupState: i, handleChange: C, handleBlur: I, isValidTime: d, isValidEndTime: c, localValue: b, title: a, readOnly: t, inputAriaProps: E } = x, N = v({
|
|
9
10
|
mask: "xx:xx",
|
|
10
11
|
maskChar: "x",
|
|
11
12
|
showMask: !1
|
|
12
|
-
}),
|
|
13
|
-
return
|
|
14
|
-
|
|
15
|
-
}, []), /* @__PURE__ */
|
|
13
|
+
}), s = !d || !c || !!g, n = V(null), u = M();
|
|
14
|
+
return H(() => {
|
|
15
|
+
n.current && i.setAnchorEl(n.current);
|
|
16
|
+
}, []), /* @__PURE__ */ j("div", {
|
|
16
17
|
style: { height: t ? "40px" : "75px" },
|
|
17
|
-
children: [
|
|
18
|
+
children: [a && /* @__PURE__ */ l("div", {
|
|
19
|
+
id: u,
|
|
18
20
|
className: "pb-1 font-roboto font-semibold text-delta-800",
|
|
19
|
-
children:
|
|
20
|
-
}), /* @__PURE__ */
|
|
21
|
-
inputRef:
|
|
21
|
+
children: a
|
|
22
|
+
}), /* @__PURE__ */ l(y, {
|
|
23
|
+
inputRef: N,
|
|
22
24
|
autoComplete: "off",
|
|
23
25
|
type: "text",
|
|
24
|
-
dataTest:
|
|
25
|
-
"data-testid":
|
|
26
|
-
placeholder:
|
|
26
|
+
dataTest: p,
|
|
27
|
+
"data-testid": p,
|
|
28
|
+
placeholder: f,
|
|
27
29
|
size: "small",
|
|
28
|
-
error:
|
|
29
|
-
helperText: /* @__PURE__ */
|
|
30
|
-
isValidTime:
|
|
31
|
-
isValidEndTime:
|
|
32
|
-
error:
|
|
30
|
+
error: s,
|
|
31
|
+
helperText: /* @__PURE__ */ l(w, {
|
|
32
|
+
isValidTime: d,
|
|
33
|
+
isValidEndTime: c,
|
|
34
|
+
error: s,
|
|
33
35
|
localization: k,
|
|
34
|
-
helperText:
|
|
35
|
-
messages:
|
|
36
|
+
helperText: T,
|
|
37
|
+
messages: A
|
|
36
38
|
}),
|
|
37
|
-
onChange:
|
|
38
|
-
onBlur:
|
|
39
|
+
onChange: C,
|
|
40
|
+
onBlur: I,
|
|
39
41
|
slotProps: {
|
|
42
|
+
htmlInput: R({
|
|
43
|
+
title: a,
|
|
44
|
+
titleId: u,
|
|
45
|
+
label: m,
|
|
46
|
+
inputAriaProps: E
|
|
47
|
+
}),
|
|
40
48
|
input: {
|
|
41
|
-
ref:
|
|
49
|
+
ref: n,
|
|
42
50
|
onClick: (r) => {
|
|
43
|
-
!e && !t &&
|
|
51
|
+
!e && !t && i.open(r);
|
|
44
52
|
},
|
|
45
|
-
endAdornment: /* @__PURE__ */
|
|
53
|
+
endAdornment: /* @__PURE__ */ l(P, {
|
|
46
54
|
width: 24,
|
|
47
55
|
height: 24,
|
|
48
56
|
className: e ? "text-delta-300" : "text-delta-700",
|
|
49
57
|
onClick: (r) => {
|
|
50
|
-
r.stopPropagation(), !e && !t &&
|
|
58
|
+
r.stopPropagation(), !e && !t && i.open(r);
|
|
51
59
|
}
|
|
52
60
|
})
|
|
53
61
|
},
|
|
54
62
|
formHelperText: {
|
|
55
|
-
className:
|
|
63
|
+
className: s ? "ml-0 mr-[14px] mt-1 leading-[23.24px]" : "mx-[14px] mt-1 leading-[23.24px]",
|
|
56
64
|
hideErrorIcon: !0
|
|
57
65
|
}
|
|
58
66
|
},
|
|
59
67
|
value: b,
|
|
60
68
|
sx: {
|
|
61
|
-
maxWidth:
|
|
62
|
-
width:
|
|
63
|
-
minWidth:
|
|
69
|
+
maxWidth: o ?? 130,
|
|
70
|
+
width: o,
|
|
71
|
+
minWidth: o
|
|
64
72
|
},
|
|
65
73
|
disabled: e,
|
|
66
74
|
readOnly: t,
|
|
67
|
-
className:
|
|
68
|
-
label:
|
|
75
|
+
className: h,
|
|
76
|
+
label: m
|
|
69
77
|
})]
|
|
70
78
|
});
|
|
71
79
|
};
|
|
72
80
|
export {
|
|
73
|
-
|
|
81
|
+
q as TimePickerInput
|
|
74
82
|
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { AriaAttributes } from 'react';
|
|
1
2
|
import { DayPickerProps as ReactDayPickerProps, Matcher } from 'react-day-picker';
|
|
2
3
|
export interface IBaseDatePickerInput {
|
|
3
4
|
dataTest: string;
|
|
@@ -23,5 +24,6 @@ export interface IBaseDatePickerInput {
|
|
|
23
24
|
hideDefaultHelperText?: boolean;
|
|
24
25
|
required?: boolean;
|
|
25
26
|
minDate?: Date;
|
|
27
|
+
inputAriaProps?: AriaAttributes;
|
|
26
28
|
}
|
|
27
29
|
export declare const BaseDatePickerInput: React.FC<IBaseDatePickerInput>;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { AriaAttributes } from 'react';
|
|
1
2
|
import { DayPicker, Matcher } from 'react-day-picker';
|
|
2
3
|
export type CalendarProps = React.ComponentProps<typeof DayPicker>;
|
|
3
4
|
type CommonDatePickerProps = {
|
|
@@ -25,6 +26,11 @@ export interface DatePickerSingleFieldProps {
|
|
|
25
26
|
disallowPast?: boolean;
|
|
26
27
|
disallowFuture?: boolean;
|
|
27
28
|
hideDefaultHelperText?: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Extra ARIA attributes for the text input (e.g. `aria-label`, `aria-required`). Without them the
|
|
31
|
+
* input is named by `title`, which is otherwise plain text above the field.
|
|
32
|
+
*/
|
|
33
|
+
inputAriaProps?: AriaAttributes;
|
|
28
34
|
}
|
|
29
35
|
export interface DatePickerRangeFieldProps {
|
|
30
36
|
labelFrom?: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
1
|
+
import { AriaAttributes, ReactNode } from 'react';
|
|
2
2
|
/**
|
|
3
3
|
* @param notBeforeTime - Start time of the range. Selected time must be after this value.
|
|
4
4
|
*/
|
|
@@ -24,5 +24,10 @@ export interface StyledTimePickerProps {
|
|
|
24
24
|
* Unlike `notBeforeTime`, it never shows an error.
|
|
25
25
|
*/
|
|
26
26
|
minTime?: Date;
|
|
27
|
+
/**
|
|
28
|
+
* Extra ARIA attributes for the text input (e.g. `aria-label`, `aria-required`) — for a visible
|
|
29
|
+
* label rendered outside the picker. Without them the input is named by `title` or `label`.
|
|
30
|
+
*/
|
|
31
|
+
inputAriaProps?: AriaAttributes;
|
|
27
32
|
}
|
|
28
33
|
export type IPopupStateType = JSX.Element;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { AriaAttributes } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* ARIA naming for a datetime input that shows its `title` as plain text above the field: points the
|
|
4
|
+
* input at the title unless a floating `label` or an explicit name in `inputAriaProps` already names it
|
|
5
|
+
* (`aria-labelledby` would otherwise override that name). `inputAriaProps` are spread last.
|
|
6
|
+
*/
|
|
7
|
+
export declare const getTitleLabelling: ({ title, titleId, label, inputAriaProps, }: {
|
|
8
|
+
title?: string;
|
|
9
|
+
titleId: string;
|
|
10
|
+
label?: string;
|
|
11
|
+
inputAriaProps?: AriaAttributes;
|
|
12
|
+
}) => AriaAttributes;
|