asma-ui-core 3.125.0 → 3.126.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/data-display/interactive-chip/StyledInteractiveChip.js +6 -5
- package/dist/components/data-display/read-only-text/StyledReadOnlyText.js +56 -0
- package/dist/components/inputs/checkbox/base-ui/StyledCheckbox.module.js +12 -12
- package/dist/components/inputs/field-styles.js +1 -1
- package/dist/components/inputs/input-field/StyledInputField.js +226 -205
- package/dist/components/miscellaneous/StyledFormControlLabel.js +14 -14
- package/dist/datetime/components/date-picker/components/BaseDatePickerInput.js +81 -73
- package/dist/datetime/components/date-picker/components/DatePickerInputRangeCompact.js +28 -26
- package/dist/datetime/components/date-picker/components/DatePickerInputSingle.js +23 -21
- package/dist/datetime/components/time-picker/StyledTimePicker.js +25 -25
- package/dist/datetime/components/time-picker/TimePickerInput.js +41 -40
- package/dist/index.js +223 -221
- package/dist/src/components/data-display/read-only-text/StyledReadOnlyText.d.ts +38 -0
- package/dist/src/components/data-display/read-only-text/index.d.ts +1 -0
- package/dist/src/components/inputs/field-styles.d.ts +3 -1
- package/dist/src/components/inputs/input-field/StyledInputField.d.ts +14 -1
- package/dist/src/datetime/components/date-picker/components/BaseDatePickerInput.d.ts +2 -0
- package/dist/src/datetime/components/date-picker/types.d.ts +7 -0
- package/dist/src/datetime/components/time-picker/types.d.ts +2 -0
- package/dist/src/index.d.ts +1 -0
- package/dist/src/table/components/table-header/SortIndicator.d.ts +3 -2
- package/dist/table/components/StyledTable.module.js +53 -53
- package/dist/table/shared-components/StyledCheckbox.module.js +11 -11
- package/package.json +1 -1
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
import { cn as
|
|
1
|
+
import { cn as r } from "../../helpers/cn.js";
|
|
2
2
|
import { resolveSx as g } from "../../helpers/sx.js";
|
|
3
|
-
import { cloneElement as
|
|
4
|
-
import { jsx as
|
|
5
|
-
var
|
|
3
|
+
import { cloneElement as w, isValidElement as n, useId as C } from "react";
|
|
4
|
+
import { jsx as L, jsxs as A } from "react/jsx-runtime";
|
|
5
|
+
var E = {
|
|
6
6
|
end: "flex-row",
|
|
7
7
|
start: "flex-row-reverse",
|
|
8
8
|
top: "flex-col-reverse",
|
|
9
9
|
bottom: "flex-col"
|
|
10
|
-
},
|
|
11
|
-
const e =
|
|
10
|
+
}, O = ({ control: l, label: a, checked: i, disabled: d, name: m, value: c, labelPlacement: x = "end", className: f, sx: p, onChange: h }) => {
|
|
11
|
+
const e = n(l) ? l.props : {}, s = d ?? e.disabled ?? !1, u = !!e.readOnly, t = C(), b = e["aria-label"] != null || e["aria-labelledby"] != null, v = typeof a == "string" ? a.trim().length > 0 : a != null, o = n(l) && v && !b, y = n(l) ? w(l, {
|
|
12
12
|
checked: e.checked ?? i,
|
|
13
13
|
onChange: e.onChange ?? h,
|
|
14
14
|
disabled: s,
|
|
15
|
-
name: e.name ??
|
|
15
|
+
name: e.name ?? m,
|
|
16
16
|
value: e.value ?? c,
|
|
17
|
-
...
|
|
17
|
+
...o ? { "aria-labelledby": t } : {}
|
|
18
18
|
}) : l;
|
|
19
|
-
return /* @__PURE__ */
|
|
20
|
-
className:
|
|
19
|
+
return /* @__PURE__ */ A("label", {
|
|
20
|
+
className: r("m-0 inline-flex items-center gap-2 align-middle text-delta-800", s || u ? "cursor-default" : "cursor-pointer", E[x], f),
|
|
21
21
|
style: {
|
|
22
22
|
fontFamily: "Roboto, Helvetica, Arial, sans-serif",
|
|
23
23
|
...g(p)
|
|
24
24
|
},
|
|
25
|
-
children: [
|
|
26
|
-
id:
|
|
27
|
-
className:
|
|
25
|
+
children: [y, a != null && /* @__PURE__ */ L("span", {
|
|
26
|
+
id: o ? t : void 0,
|
|
27
|
+
className: r("text-sm leading-5 tracking-[0.00938em]", "max-xs:min-w-0 max-xs:hyphens-auto max-xs:![overflow-wrap:anywhere]", s && "text-delta-300"),
|
|
28
28
|
children: a
|
|
29
29
|
})]
|
|
30
30
|
});
|
|
31
31
|
};
|
|
32
32
|
export {
|
|
33
|
-
|
|
33
|
+
O as StyledFormControlLabel
|
|
34
34
|
};
|
|
@@ -1,140 +1,148 @@
|
|
|
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 A, useId as E, useRef as
|
|
10
|
-
import { jsx as
|
|
11
|
-
import { isValid as
|
|
12
|
-
var
|
|
13
|
-
const { onClick:
|
|
1
|
+
import { fieldLabelAboveClass as R, fieldWidthStyle as le } from "../../../../components/inputs/field-styles.js";
|
|
2
|
+
import { StyledInputField as oe } from "../../../../components/inputs/input-field/StyledInputField.js";
|
|
3
|
+
import { getValue as b } from "../helpers.js";
|
|
4
|
+
import { DatePickerButton as ie } from "./DatePickerButton.js";
|
|
5
|
+
import { getTitleLabelling as de } from "../../../helpers/getTitleLabelling.js";
|
|
6
|
+
import { DATE_INPUT_FONT_FAMILY as se } from "../../../../helpers/inputMask.js";
|
|
7
|
+
import { useDatePickerMask as ne } from "../hooks/useDatePickerMask.js";
|
|
8
|
+
import { defaultDatePickerValidationMessages as ce, useDatePickerValidation as ue } from "../hooks/useDatePickerValidation.js";
|
|
9
|
+
import { useEffect as A, useId as E, useRef as pe, useState as H } from "react";
|
|
10
|
+
import { jsx as a, jsxs as T } from "react/jsx-runtime";
|
|
11
|
+
import { isValid as me, parse as fe } from "date-fns";
|
|
12
|
+
var ke = (Y) => {
|
|
13
|
+
const { onClick: L, inputClassName: S, dateFormat: r, selected: e, error: _, helperText: j, errorText: q, onInputChange: C, hideCalendar: W, locale: l, disabledDays: s, label: h, title: v, inputAriaProps: z, readOnly: U, lockedReason: y, readOnlyReason: g, disallowPast: n, disallowFuture: c, validateOnCalendarClose: N, onValidatedOnce: P, hideDefaultHelperText: G, reserveHelperText: J, required: o, minDate: u, width: k = "s", ...p } = Y, i = !!U || !!y || !!g, M = !y && !!g, { validationError: K, handleValidation: m, errHelperText: Q, clearValidation: w } = ue(ce), { maskRef: X } = ne(), I = E(), V = E(), [t, B] = H(e ? b(e, r) : ""), D = pe(!1), [F, Z] = H({
|
|
14
14
|
selected: e,
|
|
15
|
-
dateFormat:
|
|
15
|
+
dateFormat: r
|
|
16
16
|
});
|
|
17
|
-
(e !==
|
|
17
|
+
(e !== F.selected || r !== F.dateFormat) && (Z({
|
|
18
18
|
selected: e,
|
|
19
|
-
dateFormat:
|
|
20
|
-
}),
|
|
21
|
-
const
|
|
19
|
+
dateFormat: r
|
|
20
|
+
}), B(e ? b(e, r) : ""));
|
|
21
|
+
const $ = l?.code?.startsWith("nb") ? "DD/MM/ÅÅÅÅ" : "DD/MM/YYYY", ee = G ? void 0 : $, O = !!(K || _), d = O ? q ?? Q : j ?? ee;
|
|
22
22
|
A(() => {
|
|
23
23
|
if (!e) {
|
|
24
|
-
|
|
24
|
+
D.current || w(), D.current = !1;
|
|
25
25
|
return;
|
|
26
26
|
}
|
|
27
|
-
|
|
28
|
-
value:
|
|
27
|
+
m({
|
|
28
|
+
value: b(e, r),
|
|
29
29
|
disabledDays: s,
|
|
30
30
|
localeCode: l?.code,
|
|
31
31
|
disallowPast: n,
|
|
32
32
|
disallowFuture: c,
|
|
33
33
|
required: o,
|
|
34
|
-
minDate:
|
|
34
|
+
minDate: u
|
|
35
35
|
});
|
|
36
36
|
}, [
|
|
37
37
|
e,
|
|
38
|
-
|
|
38
|
+
r,
|
|
39
39
|
s,
|
|
40
40
|
l?.code,
|
|
41
41
|
n,
|
|
42
42
|
c,
|
|
43
43
|
o,
|
|
44
|
-
m,
|
|
45
44
|
u,
|
|
46
|
-
|
|
45
|
+
m,
|
|
46
|
+
w
|
|
47
47
|
]);
|
|
48
|
-
const
|
|
49
|
-
const f =
|
|
50
|
-
|
|
48
|
+
const te = /\d/.test(t), ae = (x) => {
|
|
49
|
+
const f = x.target.value;
|
|
50
|
+
B(f.replace(/\D/g, "").length ? f : "");
|
|
51
51
|
};
|
|
52
52
|
A(() => {
|
|
53
|
-
|
|
53
|
+
N && (m({
|
|
54
54
|
value: t,
|
|
55
55
|
disabledDays: s,
|
|
56
56
|
localeCode: l?.code,
|
|
57
57
|
disallowPast: n,
|
|
58
58
|
disallowFuture: c,
|
|
59
59
|
required: o,
|
|
60
|
-
minDate:
|
|
61
|
-
}),
|
|
60
|
+
minDate: u
|
|
61
|
+
}), P?.());
|
|
62
62
|
}, [
|
|
63
|
-
|
|
63
|
+
N,
|
|
64
64
|
t,
|
|
65
65
|
s,
|
|
66
66
|
l?.code,
|
|
67
67
|
n,
|
|
68
68
|
c,
|
|
69
69
|
o,
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
70
|
+
u,
|
|
71
|
+
P,
|
|
72
|
+
m
|
|
73
73
|
]);
|
|
74
|
-
const
|
|
75
|
-
const
|
|
74
|
+
const re = () => {
|
|
75
|
+
const x = m({
|
|
76
76
|
value: t,
|
|
77
77
|
disabledDays: s,
|
|
78
78
|
localeCode: l?.code,
|
|
79
79
|
disallowPast: n,
|
|
80
80
|
disallowFuture: c,
|
|
81
81
|
required: o,
|
|
82
|
-
minDate:
|
|
82
|
+
minDate: u
|
|
83
83
|
});
|
|
84
84
|
if (!t.replace(/\D/g, "").length) {
|
|
85
|
-
|
|
85
|
+
D.current = !!e, C?.(void 0);
|
|
86
86
|
return;
|
|
87
87
|
}
|
|
88
|
-
if (
|
|
89
|
-
const f =
|
|
90
|
-
|
|
88
|
+
if (x) return;
|
|
89
|
+
const f = fe(t, "dd/MM/yyyy", /* @__PURE__ */ new Date());
|
|
90
|
+
C?.(me(f) ? f : void 0);
|
|
91
91
|
};
|
|
92
|
-
return /* @__PURE__ */
|
|
92
|
+
return /* @__PURE__ */ T("div", {
|
|
93
93
|
className: "cursor-default",
|
|
94
|
-
"data-field-width":
|
|
95
|
-
style:
|
|
94
|
+
"data-field-width": k,
|
|
95
|
+
style: le(k),
|
|
96
96
|
"data-helper-room-box": "",
|
|
97
97
|
children: [
|
|
98
|
-
v && /* @__PURE__ */
|
|
99
|
-
id:
|
|
100
|
-
className:
|
|
98
|
+
v && /* @__PURE__ */ a("div", {
|
|
99
|
+
id: I,
|
|
100
|
+
className: R({
|
|
101
|
+
disabled: p.disabled,
|
|
102
|
+
flush: M
|
|
103
|
+
}),
|
|
101
104
|
children: v
|
|
102
105
|
}),
|
|
103
|
-
h && /* @__PURE__ */
|
|
104
|
-
className:
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
106
|
+
h && /* @__PURE__ */ a("div", {
|
|
107
|
+
className: R({
|
|
108
|
+
disabled: p.disabled,
|
|
109
|
+
flush: M
|
|
110
|
+
}),
|
|
111
|
+
children: /* @__PURE__ */ T("label", {
|
|
112
|
+
htmlFor: V,
|
|
113
|
+
children: [h, o && /* @__PURE__ */ a("span", {
|
|
108
114
|
"aria-hidden": "true",
|
|
109
115
|
children: " *"
|
|
110
116
|
})]
|
|
111
117
|
})
|
|
112
118
|
}),
|
|
113
|
-
/* @__PURE__ */
|
|
119
|
+
/* @__PURE__ */ T("div", {
|
|
114
120
|
className: "flex items-start gap-1",
|
|
115
|
-
children: [/* @__PURE__ */
|
|
121
|
+
children: [/* @__PURE__ */ a("div", {
|
|
116
122
|
className: "min-w-0 flex-1",
|
|
117
|
-
children: /* @__PURE__ */
|
|
123
|
+
children: /* @__PURE__ */ a("div", {
|
|
118
124
|
className: "relative",
|
|
119
|
-
children: /* @__PURE__ */
|
|
125
|
+
children: /* @__PURE__ */ a(oe, {
|
|
120
126
|
...p,
|
|
121
|
-
id:
|
|
127
|
+
id: V,
|
|
122
128
|
readOnly: i,
|
|
129
|
+
lockedReason: y,
|
|
130
|
+
readOnlyReason: g,
|
|
123
131
|
"data-testid": p.dataTest,
|
|
124
132
|
autoComplete: "off",
|
|
125
|
-
inputRef: i ? void 0 :
|
|
126
|
-
placeholder: !i && !
|
|
133
|
+
inputRef: i ? void 0 : X,
|
|
134
|
+
placeholder: !i && !te ? " / / " : void 0,
|
|
127
135
|
size: "small",
|
|
128
136
|
value: i ? t.replaceAll("/", ".") : t,
|
|
129
|
-
className:
|
|
130
|
-
error:
|
|
131
|
-
onBlur: i ? void 0 :
|
|
132
|
-
helperText: d == null || d === "" ? d : /* @__PURE__ */
|
|
137
|
+
className: S,
|
|
138
|
+
error: O,
|
|
139
|
+
onBlur: i ? void 0 : re,
|
|
140
|
+
helperText: d == null || d === "" ? d : /* @__PURE__ */ a("span", {
|
|
133
141
|
className: "block truncate",
|
|
134
142
|
title: typeof d == "string" ? d : void 0,
|
|
135
143
|
children: d
|
|
136
144
|
}),
|
|
137
|
-
reserveHelperText:
|
|
145
|
+
reserveHelperText: J,
|
|
138
146
|
slotProps: {
|
|
139
147
|
formHelperText: { sx: {
|
|
140
148
|
marginTop: "4px",
|
|
@@ -143,23 +151,23 @@ var Te = (R) => {
|
|
|
143
151
|
} },
|
|
144
152
|
htmlInput: {
|
|
145
153
|
"aria-required": o ? !0 : void 0,
|
|
146
|
-
...
|
|
154
|
+
...de({
|
|
147
155
|
title: v,
|
|
148
|
-
titleId:
|
|
156
|
+
titleId: I,
|
|
149
157
|
label: h,
|
|
150
|
-
inputAriaProps:
|
|
158
|
+
inputAriaProps: z
|
|
151
159
|
}),
|
|
152
160
|
...i ? {} : {
|
|
153
161
|
inputMode: "numeric",
|
|
154
|
-
style: { fontFamily:
|
|
162
|
+
style: { fontFamily: se }
|
|
155
163
|
}
|
|
156
164
|
}
|
|
157
165
|
},
|
|
158
|
-
onChange:
|
|
166
|
+
onChange: ae
|
|
159
167
|
})
|
|
160
168
|
})
|
|
161
|
-
}), !
|
|
162
|
-
onClick:
|
|
169
|
+
}), !W && !i && /* @__PURE__ */ a(ie, {
|
|
170
|
+
onClick: L,
|
|
163
171
|
disabled: !!p.disabled,
|
|
164
172
|
localeCode: l?.code
|
|
165
173
|
})]
|
|
@@ -168,5 +176,5 @@ var Te = (R) => {
|
|
|
168
176
|
});
|
|
169
177
|
};
|
|
170
178
|
export {
|
|
171
|
-
|
|
179
|
+
ke as BaseDatePickerInput
|
|
172
180
|
};
|
|
@@ -1,65 +1,67 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { BaseDatePickerInput as
|
|
3
|
-
import
|
|
4
|
-
import { jsx as
|
|
5
|
-
import { addDays as
|
|
6
|
-
var
|
|
7
|
-
const { dataTest:
|
|
1
|
+
import x from "./DatePickerInputRangeCompact.module.js";
|
|
2
|
+
import { BaseDatePickerInput as g } from "./BaseDatePickerInput.js";
|
|
3
|
+
import k from "clsx";
|
|
4
|
+
import { jsx as h, jsxs as y } from "react/jsx-runtime";
|
|
5
|
+
import { addDays as b } from "date-fns";
|
|
6
|
+
var O = ({ datePickerProps: D, onClick: l }) => {
|
|
7
|
+
const { dataTest: C, className: F, inputClassName: i, disabled: a, readOnly: m, lockedReason: d, dateFormat: s, onInputChange: o, hideCalendar: n, locale: p, selected: t, disabledDays: T, validateOnCalendarClose: c, onValidatedOnce: f, width: u, ...e } = D;
|
|
8
8
|
return /* @__PURE__ */ y("div", {
|
|
9
|
-
"data-testid":
|
|
10
|
-
className: F
|
|
11
|
-
children: [/* @__PURE__ */ g
|
|
9
|
+
"data-testid": C,
|
|
10
|
+
className: k(F, x["styled-date-picker-input-range-compact"], a && x["range-compact-disabled"]),
|
|
11
|
+
children: [/* @__PURE__ */ h(g, {
|
|
12
12
|
dataTest: "styled-date-picker-input-range-from",
|
|
13
|
-
dateFormat:
|
|
13
|
+
dateFormat: s,
|
|
14
14
|
selected: t?.from,
|
|
15
15
|
inputClassName: i,
|
|
16
16
|
readOnly: m,
|
|
17
|
+
lockedReason: d,
|
|
17
18
|
disabled: !!a,
|
|
18
19
|
onClick: l,
|
|
19
20
|
onInputChange: (r) => {
|
|
20
21
|
r && t?.to && r.getTime() > t?.to.getTime() ? o?.({
|
|
21
22
|
from: r,
|
|
22
|
-
to:
|
|
23
|
+
to: b(r, 1)
|
|
23
24
|
}) : o?.({
|
|
24
25
|
from: r,
|
|
25
26
|
to: t?.to
|
|
26
27
|
});
|
|
27
28
|
},
|
|
28
|
-
hideCalendar:
|
|
29
|
+
hideCalendar: n,
|
|
29
30
|
locale: p,
|
|
30
|
-
disabledDays:
|
|
31
|
-
validateOnCalendarClose:
|
|
32
|
-
onValidatedOnce:
|
|
33
|
-
width:
|
|
31
|
+
disabledDays: T,
|
|
32
|
+
validateOnCalendarClose: c,
|
|
33
|
+
onValidatedOnce: f,
|
|
34
|
+
width: u,
|
|
34
35
|
label: e.labelFrom,
|
|
35
36
|
error: e.errorFrom,
|
|
36
37
|
helperText: e.helperTextFrom,
|
|
37
38
|
errorText: e.errorTextFrom,
|
|
38
39
|
title: e.titleFrom,
|
|
39
40
|
hideDefaultHelperText: e.hideDefaultHelperTextFrom
|
|
40
|
-
}), /* @__PURE__ */ g
|
|
41
|
+
}), /* @__PURE__ */ h(g, {
|
|
41
42
|
dataTest: "styled-date-picker-input-range-to",
|
|
42
|
-
dateFormat:
|
|
43
|
+
dateFormat: s,
|
|
43
44
|
selected: t?.to,
|
|
44
45
|
inputClassName: i,
|
|
45
46
|
readOnly: m,
|
|
47
|
+
lockedReason: d,
|
|
46
48
|
disabled: !!a,
|
|
47
49
|
onClick: l,
|
|
48
50
|
onInputChange: (r) => {
|
|
49
51
|
r && t?.from && r.getTime() < t?.from.getTime() ? o?.({
|
|
50
|
-
from:
|
|
52
|
+
from: b(r, -1),
|
|
51
53
|
to: r
|
|
52
54
|
}) : o?.({
|
|
53
55
|
from: t?.from,
|
|
54
56
|
to: r
|
|
55
57
|
});
|
|
56
58
|
},
|
|
57
|
-
hideCalendar:
|
|
59
|
+
hideCalendar: n,
|
|
58
60
|
locale: p,
|
|
59
|
-
disabledDays:
|
|
60
|
-
validateOnCalendarClose:
|
|
61
|
-
onValidatedOnce:
|
|
62
|
-
width:
|
|
61
|
+
disabledDays: T,
|
|
62
|
+
validateOnCalendarClose: c,
|
|
63
|
+
onValidatedOnce: f,
|
|
64
|
+
width: u,
|
|
63
65
|
label: e.labelTo,
|
|
64
66
|
error: e.errorTo,
|
|
65
67
|
helperText: e.helperTextTo,
|
|
@@ -70,5 +72,5 @@ var N = ({ datePickerProps: b, onClick: l }) => {
|
|
|
70
72
|
});
|
|
71
73
|
};
|
|
72
74
|
export {
|
|
73
|
-
|
|
75
|
+
O as DatePickerInputRangeCompact
|
|
74
76
|
};
|
|
@@ -1,36 +1,38 @@
|
|
|
1
|
-
import { BaseDatePickerInput as
|
|
2
|
-
import { jsx as
|
|
3
|
-
var
|
|
4
|
-
const { inputClassName: r, disabled: t, helperText: l, label: d, error:
|
|
5
|
-
return /* @__PURE__ */
|
|
1
|
+
import { BaseDatePickerInput as H } from "./BaseDatePickerInput.js";
|
|
2
|
+
import { jsx as R } from "react/jsx-runtime";
|
|
3
|
+
var A = ({ datePickerProps: e, onClick: a }) => {
|
|
4
|
+
const { inputClassName: r, disabled: t, helperText: l, label: d, error: n, locale: i, hideCalendar: o, dateFormat: s, disabledDays: p, dataTest: u, readOnly: c, lockedReason: m, readOnlyReason: h, errorText: x, disallowFuture: C, disallowPast: D, required: T, minDate: b, validateOnCalendarClose: I, onValidatedOnce: O, onInputChange: P, selected: f, title: g, hideDefaultHelperText: k, reserveHelperText: v, inputAriaProps: w, width: y } = e;
|
|
5
|
+
return /* @__PURE__ */ R(H, {
|
|
6
6
|
dataTest: u,
|
|
7
7
|
inputClassName: r,
|
|
8
|
-
readOnly:
|
|
8
|
+
readOnly: c,
|
|
9
|
+
lockedReason: m,
|
|
10
|
+
readOnlyReason: h,
|
|
9
11
|
disabled: !!t,
|
|
10
12
|
helperText: l,
|
|
11
13
|
onClick: a,
|
|
12
|
-
onInputChange: (
|
|
13
|
-
selected:
|
|
14
|
-
error: !!
|
|
15
|
-
locale:
|
|
14
|
+
onInputChange: (F) => P?.(F),
|
|
15
|
+
selected: f,
|
|
16
|
+
error: !!n,
|
|
17
|
+
locale: i,
|
|
16
18
|
hideCalendar: o,
|
|
17
19
|
dateFormat: s,
|
|
18
20
|
disabledDays: p,
|
|
19
21
|
label: d,
|
|
20
|
-
errorText:
|
|
21
|
-
disallowFuture:
|
|
22
|
-
disallowPast:
|
|
23
|
-
required:
|
|
24
|
-
minDate:
|
|
25
|
-
validateOnCalendarClose:
|
|
26
|
-
onValidatedOnce:
|
|
27
|
-
title:
|
|
28
|
-
hideDefaultHelperText:
|
|
22
|
+
errorText: x,
|
|
23
|
+
disallowFuture: C,
|
|
24
|
+
disallowPast: D,
|
|
25
|
+
required: T,
|
|
26
|
+
minDate: b,
|
|
27
|
+
validateOnCalendarClose: I,
|
|
28
|
+
onValidatedOnce: O,
|
|
29
|
+
title: g,
|
|
30
|
+
hideDefaultHelperText: k,
|
|
29
31
|
reserveHelperText: v,
|
|
30
32
|
inputAriaProps: w,
|
|
31
|
-
width:
|
|
33
|
+
width: y
|
|
32
34
|
});
|
|
33
35
|
};
|
|
34
36
|
export {
|
|
35
|
-
|
|
37
|
+
A as DatePickerInputSingle
|
|
36
38
|
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { cn as L } from "../../../helpers/cn.js";
|
|
2
|
-
import { isOverlayBackEnabled as K, useBackCloses as
|
|
3
|
-
import { useIsMobileView as
|
|
4
|
-
import { StyledDrawer as
|
|
5
|
-
import { useBackNavigationClose as
|
|
6
|
-
import { usePopupState as
|
|
7
|
-
import { ClickAwayListener as
|
|
2
|
+
import { isOverlayBackEnabled as K, useBackCloses as R } from "../../../hooks/useBackCloses.hook.js";
|
|
3
|
+
import { useIsMobileView as W } from "../../hooks/useWindowWidthSize.hook.js";
|
|
4
|
+
import { StyledDrawer as z } from "../../../components/navigation/drawer/StyledDrawer.js";
|
|
5
|
+
import { useBackNavigationClose as G } from "../../hooks/useBackNavigationClose.hook.js";
|
|
6
|
+
import { usePopupState as J } from "../../../hooks/usePopupState.js";
|
|
7
|
+
import { ClickAwayListener as Q } from "../../../components/mui-compat/ClickAwayListener.js";
|
|
8
8
|
import { isBeforeMinTime as T } from "./helpers/minTime.js";
|
|
9
9
|
import { TimePickerPanel as U } from "./components/TimePickerPanel.js";
|
|
10
10
|
import { TimePickerPopper as X } from "./TimePickerPopper.js";
|
|
@@ -15,59 +15,59 @@ import { useEffect as Z, useState as b } from "react";
|
|
|
15
15
|
import { jsx as n, jsxs as j } from "react/jsx-runtime";
|
|
16
16
|
import { format as S, isBefore as _, isValid as $ } from "date-fns";
|
|
17
17
|
var ve = (i) => {
|
|
18
|
-
const { value: s, onSelect: r, notBeforeTime: v, minTime: u, required:
|
|
18
|
+
const { value: s, onSelect: r, notBeforeTime: v, minTime: u, required: k } = i, o = J({
|
|
19
19
|
variant: "popper",
|
|
20
20
|
popupId: "time-picker-popper"
|
|
21
|
-
}), f =
|
|
22
|
-
|
|
21
|
+
}), f = W();
|
|
22
|
+
R({
|
|
23
23
|
active: o.isOpen,
|
|
24
24
|
requestClose: o.close
|
|
25
|
-
}),
|
|
25
|
+
}), G({
|
|
26
26
|
open: f && o.isOpen && !K(),
|
|
27
27
|
onClose: o.close
|
|
28
28
|
});
|
|
29
|
-
const { isOpen: x, anchorEl: g, close:
|
|
29
|
+
const { isOpen: x, anchorEl: g, close: w } = o;
|
|
30
30
|
Z(() => {
|
|
31
31
|
if (!x || f) return;
|
|
32
32
|
const e = (t) => {
|
|
33
|
-
g?.contains(document.activeElement) && (t.key === "Escape" ? (t.preventDefault(), t.stopPropagation(),
|
|
33
|
+
g?.contains(document.activeElement) && (t.key === "Escape" ? (t.preventDefault(), t.stopPropagation(), w()) : t.key === "Tab" && w());
|
|
34
34
|
};
|
|
35
35
|
return document.addEventListener("keydown", e), () => document.removeEventListener("keydown", e);
|
|
36
36
|
}, [
|
|
37
37
|
x,
|
|
38
38
|
g,
|
|
39
|
-
|
|
39
|
+
w,
|
|
40
40
|
f
|
|
41
41
|
]);
|
|
42
|
-
const B = s ? S(s, "HH:mm") : "", [y,
|
|
42
|
+
const B = s ? S(s, "HH:mm") : "", [y, d] = b(B), [E, a] = b(!1), [C, c] = b(!1), l = E ? y : B, p = (e) => !e || !v || !$(v) || !_(e, v), m = l.length === 5 ? V(l, s) : null, I = !C || l === "" || m !== null, A = !C || !m || p(m), O = !!k && C && l === "", N = (e) => {
|
|
43
43
|
if (e === "") return !0;
|
|
44
44
|
const t = V(e, s);
|
|
45
|
-
return t !== null &&
|
|
45
|
+
return t !== null && p(t);
|
|
46
46
|
}, q = (e) => {
|
|
47
47
|
const t = e.target.value;
|
|
48
|
-
if (a(!0),
|
|
48
|
+
if (a(!0), d(t), (O || N(t)) && c(!1), t.length !== 5) return;
|
|
49
49
|
const h = V(t, s);
|
|
50
50
|
if (!h) {
|
|
51
51
|
r(void 0);
|
|
52
52
|
return;
|
|
53
53
|
}
|
|
54
|
-
T(h, u) || (
|
|
54
|
+
T(h, u) || (p(h) ? (r(h), a(!1), o.close()) : r(void 0));
|
|
55
55
|
}, D = (e) => {
|
|
56
56
|
if (e && T(e, u)) return;
|
|
57
|
-
const t =
|
|
57
|
+
const t = p(e);
|
|
58
58
|
if (c(!t), t) {
|
|
59
|
-
r(e),
|
|
59
|
+
r(e), d(e ? S(e, "HH:mm") : ""), a(!1);
|
|
60
60
|
return;
|
|
61
61
|
}
|
|
62
|
-
r(void 0),
|
|
62
|
+
r(void 0), d(e ? S(e, "HH:mm") : ""), a(!0);
|
|
63
63
|
}, F = () => {
|
|
64
|
-
if (
|
|
64
|
+
if (k && l === "" && !o.isOpen) {
|
|
65
65
|
E && r(void 0), c(!0);
|
|
66
66
|
return;
|
|
67
67
|
}
|
|
68
68
|
E && (m && T(m, u) ? a(!1) : y === "" ? r(void 0) : N(y) || c(!0));
|
|
69
69
|
}, H = () => {
|
|
70
|
-
r(void 0),
|
|
70
|
+
r(void 0), d(""), a(!1), c(!!k);
|
|
71
71
|
}, P = /* @__PURE__ */ n(Y, {
|
|
72
72
|
...i,
|
|
73
73
|
popupState: o,
|
|
@@ -78,13 +78,13 @@ var ve = (i) => {
|
|
|
78
78
|
handleChange: q,
|
|
79
79
|
handleBlur: F
|
|
80
80
|
});
|
|
81
|
-
return i.disabled || i.readOnly ? P : f ? /* @__PURE__ */ j("div", {
|
|
81
|
+
return i.disabled || i.readOnly || i.lockedReason ? P : f ? /* @__PURE__ */ j("div", {
|
|
82
82
|
className: L("relative h-auto", typeof i.width == "number" && "w-auto"),
|
|
83
83
|
...M(i.width),
|
|
84
84
|
children: [/* @__PURE__ */ n("div", {
|
|
85
85
|
className: "m-0 flex h-fit items-center justify-center p-0",
|
|
86
86
|
children: P
|
|
87
|
-
}), /* @__PURE__ */ n(
|
|
87
|
+
}), /* @__PURE__ */ n(z, {
|
|
88
88
|
anchor: "bottom",
|
|
89
89
|
open: o.isOpen,
|
|
90
90
|
onClose: o.close,
|
|
@@ -102,7 +102,7 @@ var ve = (i) => {
|
|
|
102
102
|
})
|
|
103
103
|
})
|
|
104
104
|
})]
|
|
105
|
-
}) : /* @__PURE__ */ n(
|
|
105
|
+
}) : /* @__PURE__ */ n(Q, {
|
|
106
106
|
mouseEvent: "onMouseDown",
|
|
107
107
|
onClickAway: o.close,
|
|
108
108
|
children: /* @__PURE__ */ j("div", {
|