asma-ui-core 3.108.4 → 3.110.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/asma-ui-core.css +1 -1
- package/dist/components/data-display/interactive-chip/StyledInteractiveChip.js +18 -18
- package/dist/components/feedback/minimizable-dialog/MinimizableDialog.js +17 -15
- package/dist/components/feedback/minimizable-dialog/v2/MinimizableDialogV2.js +26 -24
- package/dist/components/inputs/dynamic-select/components/DynamicInteractiveChipGroup.js +59 -55
- package/dist/components/inputs/dynamic-select/components/DynamicSelectAutocomplete.js +88 -84
- package/dist/components/inputs/dynamic-select/components/DynamicSelectReadOnlyValue.js +15 -11
- package/dist/components/inputs/dynamic-select/components/DynamicSelectTitle.js +9 -0
- package/dist/components/inputs/field-styles.js +16 -6
- package/dist/components/inputs/form-layout/StyledFieldPair.js +22 -0
- package/dist/components/inputs/form-layout/StyledFieldPair.module.js +8 -0
- package/dist/components/inputs/form-layout/StyledFormColumn.js +13 -0
- package/dist/components/inputs/input-field/StyledInputField.js +235 -198
- package/dist/components/inputs/phone-field/StyledPhoneField.js +41 -39
- package/dist/components/inputs/search-field/StyledSearchField.js +22 -20
- package/dist/components/inputs/select/StyledSelect.js +110 -108
- package/dist/components/inputs/select-autocomplete/StyledSelectAutocomplete.js +111 -108
- package/dist/components/inputs/slider/StyledSlider.js +2 -2
- package/dist/components/inputs/textarea/StyledTextarea.js +50 -52
- package/dist/components/inputs/textarea/StyledTextarea.module.js +3 -3
- package/dist/components/miscellaneous/StyledFormControl.js +29 -25
- package/dist/components/miscellaneous/StyledInputLabel.js +28 -18
- package/dist/datetime/components/date-picker/components/BaseDatePickerInput.js +137 -122
- package/dist/datetime/components/date-picker/components/DatePickerInputRangeCompact.js +17 -15
- package/dist/datetime/components/date-picker/components/DatePickerInputRangeCompact.module.js +2 -2
- package/dist/datetime/components/date-picker/components/DatePickerInputSingle.js +9 -8
- package/dist/datetime/components/date-picker/components/StyledCalendarPickerSelectMonth.js +17 -14
- package/dist/datetime/components/date-picker/components/StyledCalendarPickerSelectYear.js +14 -9
- package/dist/datetime/components/time-picker/StyledTimePicker.js +78 -74
- package/dist/datetime/components/time-picker/TimePickerInput.js +43 -41
- package/dist/datetime/components/time-picker/helpers/timePickerWidth.js +12 -0
- package/dist/helpers/CharacterCounter.js +21 -0
- package/dist/index.js +219 -211
- package/dist/src/components/inputs/dynamic-select/components/DynamicSelectReadOnlyValue.d.ts +2 -2
- package/dist/src/components/inputs/dynamic-select/components/DynamicSelectTitle.d.ts +14 -0
- package/dist/src/components/inputs/dynamic-select/types.d.ts +11 -2
- package/dist/src/components/inputs/field-styles.d.ts +22 -0
- package/dist/src/components/inputs/form-layout/StyledFieldPair.d.ts +18 -0
- package/dist/src/components/inputs/form-layout/StyledFormColumn.d.ts +12 -0
- package/dist/src/components/inputs/form-layout/index.d.ts +4 -0
- package/dist/src/components/inputs/input-field/StyledInputField.d.ts +19 -4
- package/dist/src/components/inputs/select/StyledSelect.d.ts +7 -2
- package/dist/src/components/inputs/select-autocomplete/StyledSelectAutocomplete.d.ts +5 -1
- package/dist/src/components/inputs/textarea/StyledTextarea.d.ts +6 -0
- package/dist/src/components/miscellaneous/StyledFormControl.d.ts +5 -2
- package/dist/src/components/miscellaneous/StyledInputLabel.d.ts +7 -5
- package/dist/src/datetime/components/date-picker/components/BaseDatePickerInput.d.ts +2 -0
- package/dist/src/datetime/components/date-picker/types.d.ts +3 -0
- package/dist/src/datetime/components/time-picker/helpers/timePickerWidth.d.ts +7 -0
- package/dist/src/datetime/components/time-picker/types.d.ts +3 -1
- package/dist/src/helpers/CharacterCounter.d.ts +16 -0
- package/dist/src/helpers/CharacterCounter.test.d.ts +1 -0
- package/dist/src/index.d.ts +1 -0
- package/dist/tailwind.config.d.ts +14 -0
- package/package.json +1 -1
- package/src/styles/fieldWidthTokens.css +8 -0
- package/src/styles/index.css +1 -0
- package/tw-configs/twConfigs.json +14 -0
|
@@ -1,115 +1,119 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
|
|
16
|
-
|
|
1
|
+
import { cn as g } from "../../../helpers/cn.js";
|
|
2
|
+
import { isOverlayBackEnabled as M, useBackCloses as A } from "../../../hooks/useBackCloses.hook.js";
|
|
3
|
+
import { useIsMobileView as q } from "../../hooks/useWindowWidthSize.hook.js";
|
|
4
|
+
import { StyledDrawer as F } from "../../../components/navigation/drawer/StyledDrawer.js";
|
|
5
|
+
import { useBackNavigationClose as K } from "../../hooks/useBackNavigationClose.hook.js";
|
|
6
|
+
import { usePopupState as W } from "../../../hooks/usePopupState.js";
|
|
7
|
+
import { ClickAwayListener as z } from "../../../components/mui-compat/ClickAwayListener.js";
|
|
8
|
+
import { isBeforeMinTime as w } from "./helpers/minTime.js";
|
|
9
|
+
import { TimePickerPanel as G } from "./components/TimePickerPanel.js";
|
|
10
|
+
import { TimePickerPopper as J } from "./TimePickerPopper.js";
|
|
11
|
+
import { getTimeFromValue as B } from "./helpers/getTimeFromValue.js";
|
|
12
|
+
import { timePickerWidthProps as O } from "./helpers/timePickerWidth.js";
|
|
13
|
+
import { TimePickerInput as Q } from "./TimePickerInput.js";
|
|
14
|
+
import { useEffect as R, useState as E } from "react";
|
|
15
|
+
import { jsx as r, jsxs as D } from "react/jsx-runtime";
|
|
16
|
+
import { format as V, isBefore as U, isValid as X } from "date-fns";
|
|
17
|
+
var fe = (o) => {
|
|
18
|
+
const { value: l, onSelect: n, notBeforeTime: d, minTime: c } = o, t = W({
|
|
17
19
|
variant: "popper",
|
|
18
20
|
popupId: "time-picker-popper"
|
|
19
|
-
}), m =
|
|
20
|
-
|
|
21
|
-
active:
|
|
22
|
-
requestClose:
|
|
23
|
-
}),
|
|
24
|
-
open: m &&
|
|
25
|
-
onClose:
|
|
21
|
+
}), m = q();
|
|
22
|
+
A({
|
|
23
|
+
active: t.isOpen,
|
|
24
|
+
requestClose: t.close
|
|
25
|
+
}), K({
|
|
26
|
+
open: m && t.isOpen && !M(),
|
|
27
|
+
onClose: t.close
|
|
26
28
|
});
|
|
27
|
-
const { isOpen:
|
|
28
|
-
|
|
29
|
-
if (!
|
|
30
|
-
const e = (
|
|
31
|
-
|
|
29
|
+
const { isOpen: P, anchorEl: x, close: h } = t;
|
|
30
|
+
R(() => {
|
|
31
|
+
if (!P || m) return;
|
|
32
|
+
const e = (i) => {
|
|
33
|
+
x?.contains(document.activeElement) && (i.key === "Escape" ? (i.preventDefault(), i.stopPropagation(), h()) : i.key === "Tab" && h());
|
|
32
34
|
};
|
|
33
35
|
return document.addEventListener("keydown", e), () => document.removeEventListener("keydown", e);
|
|
34
36
|
}, [
|
|
37
|
+
P,
|
|
35
38
|
x,
|
|
36
|
-
C,
|
|
37
39
|
h,
|
|
38
40
|
m
|
|
39
41
|
]);
|
|
40
|
-
const
|
|
41
|
-
const
|
|
42
|
-
if (a(!0), u(
|
|
43
|
-
|
|
42
|
+
const C = l ? V(l, "HH:mm") : "", [H, u] = E(C), [b, a] = E(!1), [L, s] = E(!0), v = b ? H : C, k = (e) => !e || !d || !X(d) || !U(e, d), f = v.length === 5 ? B(v, l) : null, N = f ? k(f) : !0, I = (e) => {
|
|
43
|
+
const i = e.target.value;
|
|
44
|
+
if (a(!0), u(i), i.length !== 5) {
|
|
45
|
+
s(!1);
|
|
44
46
|
return;
|
|
45
47
|
}
|
|
46
|
-
const p =
|
|
48
|
+
const p = B(i, l);
|
|
47
49
|
if (!p) {
|
|
48
|
-
n(void 0),
|
|
50
|
+
n(void 0), s(!1);
|
|
49
51
|
return;
|
|
50
52
|
}
|
|
51
|
-
|
|
52
|
-
},
|
|
53
|
-
if (!(e &&
|
|
54
|
-
if (
|
|
55
|
-
n(e), u(e ?
|
|
53
|
+
s(!0), !w(p, c) && (k(p) ? (n(p), a(!1), t.close()) : n(void 0));
|
|
54
|
+
}, T = (e) => {
|
|
55
|
+
if (!(e && w(e, c))) {
|
|
56
|
+
if (s(!0), k(e)) {
|
|
57
|
+
n(e), u(e ? V(e, "HH:mm") : ""), a(!1);
|
|
56
58
|
return;
|
|
57
59
|
}
|
|
58
|
-
n(void 0), u(e ?
|
|
60
|
+
n(void 0), u(e ? V(e, "HH:mm") : ""), a(!0);
|
|
59
61
|
}
|
|
60
|
-
},
|
|
61
|
-
|
|
62
|
-
},
|
|
63
|
-
n(void 0), u(""), a(!1),
|
|
64
|
-
}, y = /* @__PURE__ */ r(
|
|
65
|
-
...
|
|
66
|
-
popupState:
|
|
62
|
+
}, j = () => {
|
|
63
|
+
b && f && w(f, c) && a(!1);
|
|
64
|
+
}, S = () => {
|
|
65
|
+
n(void 0), u(""), a(!1), s(!0);
|
|
66
|
+
}, y = /* @__PURE__ */ r(Q, {
|
|
67
|
+
...o,
|
|
68
|
+
popupState: t,
|
|
67
69
|
localValue: v,
|
|
68
|
-
isValidTime:
|
|
69
|
-
isValidEndTime:
|
|
70
|
-
handleChange:
|
|
71
|
-
handleBlur:
|
|
70
|
+
isValidTime: L,
|
|
71
|
+
isValidEndTime: N,
|
|
72
|
+
handleChange: I,
|
|
73
|
+
handleBlur: j
|
|
72
74
|
});
|
|
73
|
-
return
|
|
74
|
-
className: "relative h-auto w-auto",
|
|
75
|
+
return o.disabled || o.readOnly ? y : m ? /* @__PURE__ */ D("div", {
|
|
76
|
+
className: g("relative h-auto", typeof o.width == "number" && "w-auto"),
|
|
77
|
+
...O(o.width),
|
|
75
78
|
children: [/* @__PURE__ */ r("div", {
|
|
76
79
|
className: "m-0 flex h-fit items-center justify-center p-0",
|
|
77
80
|
children: y
|
|
78
|
-
}), /* @__PURE__ */ r(
|
|
81
|
+
}), /* @__PURE__ */ r(F, {
|
|
79
82
|
anchor: "bottom",
|
|
80
|
-
open:
|
|
81
|
-
onClose:
|
|
82
|
-
anchorEl:
|
|
83
|
+
open: t.isOpen,
|
|
84
|
+
onClose: t.close,
|
|
85
|
+
anchorEl: t.anchorEl,
|
|
83
86
|
registerBackClose: !1,
|
|
84
87
|
children: /* @__PURE__ */ r("div", {
|
|
85
88
|
className: "mx-auto w-full max-w-[360px] px-4 pb-[max(1rem,env(safe-area-inset-bottom))] pt-2",
|
|
86
|
-
children: /* @__PURE__ */ r(
|
|
87
|
-
dataTest:
|
|
88
|
-
value:
|
|
89
|
+
children: /* @__PURE__ */ r(G, {
|
|
90
|
+
dataTest: o.dataTest,
|
|
91
|
+
value: l,
|
|
89
92
|
minTime: c,
|
|
90
|
-
onSelect:
|
|
91
|
-
handleClear:
|
|
92
|
-
onConfirm:
|
|
93
|
+
onSelect: T,
|
|
94
|
+
handleClear: S,
|
|
95
|
+
onConfirm: t.close
|
|
93
96
|
})
|
|
94
97
|
})
|
|
95
98
|
})]
|
|
96
|
-
}) : /* @__PURE__ */ r(
|
|
99
|
+
}) : /* @__PURE__ */ r(z, {
|
|
97
100
|
mouseEvent: "onMouseDown",
|
|
98
|
-
onClickAway:
|
|
99
|
-
children: /* @__PURE__ */
|
|
100
|
-
className: "relative h-auto w-auto",
|
|
101
|
+
onClickAway: t.close,
|
|
102
|
+
children: /* @__PURE__ */ D("div", {
|
|
103
|
+
className: g("relative h-auto", typeof o.width == "number" && "w-auto"),
|
|
104
|
+
...O(o.width),
|
|
101
105
|
children: [/* @__PURE__ */ r("div", {
|
|
102
106
|
className: "m-0 flex h-fit items-center justify-center p-0",
|
|
103
107
|
children: y
|
|
104
|
-
}),
|
|
105
|
-
...
|
|
106
|
-
popupState:
|
|
107
|
-
handleClear:
|
|
108
|
-
onSelect:
|
|
108
|
+
}), t.isOpen && /* @__PURE__ */ r(J, {
|
|
109
|
+
...o,
|
|
110
|
+
popupState: t,
|
|
111
|
+
handleClear: S,
|
|
112
|
+
onSelect: T
|
|
109
113
|
})]
|
|
110
114
|
})
|
|
111
115
|
});
|
|
112
116
|
};
|
|
113
117
|
export {
|
|
114
|
-
|
|
118
|
+
fe as StyledTimePicker
|
|
115
119
|
};
|
|
@@ -1,61 +1,63 @@
|
|
|
1
|
-
import { ClockOutlineIcon as
|
|
1
|
+
import { ClockOutlineIcon as E } from "../../../components/icons/clock-outline-icon/ClockOutlineIcon.js";
|
|
2
|
+
import { fieldLabelAboveClass as N } from "../../../components/inputs/field-styles.js";
|
|
2
3
|
import { StyledInputField as y } from "../../../components/inputs/input-field/StyledInputField.js";
|
|
3
|
-
import { getTitleLabelling as
|
|
4
|
-
import { useInputMask as
|
|
5
|
-
import { HelperText as w, defaultTimePickerHelperMessages as
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
4
|
+
import { getTitleLabelling as A } from "../../helpers/getTitleLabelling.js";
|
|
5
|
+
import { useInputMask as R } from "../../../helpers/inputMask.js";
|
|
6
|
+
import { HelperText as w, defaultTimePickerHelperMessages as H } from "./components/HelperText.js";
|
|
7
|
+
import { timePickerWidthProps as M } from "./helpers/timePickerWidth.js";
|
|
8
|
+
import { useEffect as V, useId as W, useRef as j } from "react";
|
|
9
|
+
import { jsx as o, jsxs as z } from "react/jsx-runtime";
|
|
10
|
+
var K = (f) => {
|
|
11
|
+
const { placeholder: h, disabled: e, inputClassName: x, dataTest: m, width: t, error: g, helperText: k, label: p, locale: T = "en", popupState: i, handleChange: C, handleBlur: I, isValidTime: d, isValidEndTime: c, localValue: P, title: l, readOnly: a, inputAriaProps: b } = f, v = R({
|
|
10
12
|
mask: "xx:xx",
|
|
11
13
|
maskChar: "x",
|
|
12
14
|
showMask: !1
|
|
13
|
-
}), s = !d || !c || !!g, n =
|
|
14
|
-
return
|
|
15
|
+
}), s = !d || !c || !!g, n = j(null), u = W();
|
|
16
|
+
return V(() => {
|
|
15
17
|
n.current && i.setAnchorEl(n.current);
|
|
16
|
-
}, []), /* @__PURE__ */
|
|
17
|
-
|
|
18
|
-
children: [
|
|
18
|
+
}, []), /* @__PURE__ */ z("div", {
|
|
19
|
+
...M(t),
|
|
20
|
+
children: [l && /* @__PURE__ */ o("div", {
|
|
19
21
|
id: u,
|
|
20
|
-
className:
|
|
21
|
-
children:
|
|
22
|
-
}), /* @__PURE__ */
|
|
23
|
-
inputRef:
|
|
22
|
+
className: N({ disabled: e }),
|
|
23
|
+
children: l
|
|
24
|
+
}), /* @__PURE__ */ o(y, {
|
|
25
|
+
inputRef: v,
|
|
24
26
|
autoComplete: "off",
|
|
25
27
|
type: "text",
|
|
26
|
-
dataTest:
|
|
27
|
-
"data-testid":
|
|
28
|
-
placeholder:
|
|
28
|
+
dataTest: m,
|
|
29
|
+
"data-testid": m,
|
|
30
|
+
placeholder: h,
|
|
29
31
|
size: "small",
|
|
30
32
|
error: s,
|
|
31
|
-
helperText: /* @__PURE__ */
|
|
33
|
+
helperText: /* @__PURE__ */ o(w, {
|
|
32
34
|
isValidTime: d,
|
|
33
35
|
isValidEndTime: c,
|
|
34
36
|
error: s,
|
|
35
|
-
localization:
|
|
36
|
-
helperText:
|
|
37
|
-
messages:
|
|
37
|
+
localization: T,
|
|
38
|
+
helperText: k,
|
|
39
|
+
messages: H
|
|
38
40
|
}),
|
|
39
41
|
onChange: C,
|
|
40
42
|
onBlur: I,
|
|
41
43
|
slotProps: {
|
|
42
|
-
htmlInput:
|
|
43
|
-
title:
|
|
44
|
+
htmlInput: A({
|
|
45
|
+
title: l,
|
|
44
46
|
titleId: u,
|
|
45
|
-
label:
|
|
46
|
-
inputAriaProps:
|
|
47
|
+
label: p,
|
|
48
|
+
inputAriaProps: b
|
|
47
49
|
}),
|
|
48
50
|
input: {
|
|
49
51
|
ref: n,
|
|
50
52
|
onClick: (r) => {
|
|
51
|
-
!e && !
|
|
53
|
+
!e && !a && i.open(r);
|
|
52
54
|
},
|
|
53
|
-
endAdornment: /* @__PURE__ */
|
|
55
|
+
endAdornment: /* @__PURE__ */ o(E, {
|
|
54
56
|
width: 24,
|
|
55
57
|
height: 24,
|
|
56
58
|
className: e ? "text-delta-300" : "text-delta-700",
|
|
57
59
|
onClick: (r) => {
|
|
58
|
-
r.stopPropagation(), !e && !
|
|
60
|
+
r.stopPropagation(), !e && !a && i.open(r);
|
|
59
61
|
}
|
|
60
62
|
})
|
|
61
63
|
},
|
|
@@ -64,19 +66,19 @@ var q = (x) => {
|
|
|
64
66
|
hideErrorIcon: !0
|
|
65
67
|
}
|
|
66
68
|
},
|
|
67
|
-
value:
|
|
68
|
-
sx: {
|
|
69
|
-
maxWidth:
|
|
70
|
-
width:
|
|
71
|
-
minWidth:
|
|
72
|
-
},
|
|
69
|
+
value: P,
|
|
70
|
+
sx: typeof t == "number" ? {
|
|
71
|
+
maxWidth: t,
|
|
72
|
+
width: t,
|
|
73
|
+
minWidth: t
|
|
74
|
+
} : void 0,
|
|
73
75
|
disabled: e,
|
|
74
|
-
readOnly:
|
|
75
|
-
className:
|
|
76
|
-
label:
|
|
76
|
+
readOnly: a,
|
|
77
|
+
className: x,
|
|
78
|
+
label: p
|
|
77
79
|
})]
|
|
78
80
|
});
|
|
79
81
|
};
|
|
80
82
|
export {
|
|
81
|
-
|
|
83
|
+
K as TimePickerInput
|
|
82
84
|
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { fieldWidthStyle as r } from "../../../../components/inputs/field-styles.js";
|
|
2
|
+
var o = (t) => {
|
|
3
|
+
if (typeof t == "number") return {};
|
|
4
|
+
const e = t ?? "xs";
|
|
5
|
+
return {
|
|
6
|
+
"data-field-width": e,
|
|
7
|
+
style: r(e)
|
|
8
|
+
};
|
|
9
|
+
};
|
|
10
|
+
export {
|
|
11
|
+
o as timePickerWidthProps
|
|
12
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { cn as c } from "./cn.js";
|
|
2
|
+
import { Fragment as i, jsx as n, jsxs as h } from "react/jsx-runtime";
|
|
3
|
+
var m = {
|
|
4
|
+
en: (r, a) => `${r} of ${a} characters`,
|
|
5
|
+
no: (r, a) => `${r} av ${a} tegn`
|
|
6
|
+
}, l = (r, a) => a - r <= Math.max(1, Math.min(10, Math.ceil(a * 0.2))), p = ({ id: r, length: a, limit: e, locale: o = "en", className: s }) => {
|
|
7
|
+
const t = m[o](a, e);
|
|
8
|
+
return /* @__PURE__ */ h(i, { children: [/* @__PURE__ */ n("span", {
|
|
9
|
+
id: r,
|
|
10
|
+
"aria-hidden": "true",
|
|
11
|
+
className: c("font-roboto text-sm leading-5 text-delta-600", s),
|
|
12
|
+
children: t
|
|
13
|
+
}), /* @__PURE__ */ n("span", {
|
|
14
|
+
"aria-live": "polite",
|
|
15
|
+
className: "sr-only",
|
|
16
|
+
children: l(a, e) ? t : ""
|
|
17
|
+
})] });
|
|
18
|
+
};
|
|
19
|
+
export {
|
|
20
|
+
p as CharacterCounter
|
|
21
|
+
};
|