asma-ui-core 3.87.4 → 3.88.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/components/CloseBtn.js +6 -5
- package/dist/components/feedback/minimizable-dialog/v2/MinimizableDialogV2.js +93 -82
- package/dist/components/inputs/phone-field/useCountryPicker.js +13 -13
- package/dist/components/inputs/select-autocomplete/StyledSelectAutocomplete.js +21 -21
- package/dist/datetime/components/date-picker/StyledDatePicker.js +18 -18
- package/dist/datetime/components/time-picker/StyledTimePicker.js +58 -58
- package/dist/src/components/feedback/minimizable-dialog/components/CloseBtn.d.ts +1 -0
- package/dist/src/components/feedback/minimizable-dialog/v2/types.d.ts +6 -1
- package/package.json +1 -1
|
@@ -1,18 +1,19 @@
|
|
|
1
|
-
import { CloseIcon as
|
|
2
|
-
import { StyledTooltip as
|
|
1
|
+
import { CloseIcon as i } from "../../../icons/close-icon/CloseIcon.js";
|
|
2
|
+
import { StyledTooltip as n } from "../../../data-display/tooltip/StyledTooltip.js";
|
|
3
3
|
import { StyledButton as a } from "../../../inputs/button/StyledButton.js";
|
|
4
4
|
import "react";
|
|
5
5
|
import { jsx as t } from "react/jsx-runtime";
|
|
6
|
-
var
|
|
6
|
+
var h = ({ showCloseIcon: e, tooltipTitle: r, onClick: o, buttonRef: l }) => e ? /* @__PURE__ */ t(n, {
|
|
7
7
|
title: r,
|
|
8
8
|
placement: "top",
|
|
9
9
|
children: /* @__PURE__ */ t("div", { children: /* @__PURE__ */ t(a, {
|
|
10
10
|
dataTest: "close-button",
|
|
11
|
+
refLink: l,
|
|
11
12
|
"aria-label": r,
|
|
12
13
|
variant: "textGray",
|
|
13
14
|
size: "small",
|
|
14
15
|
onClick: o,
|
|
15
|
-
endIcon: /* @__PURE__ */ t(
|
|
16
|
+
endIcon: /* @__PURE__ */ t(i, {
|
|
16
17
|
height: 20,
|
|
17
18
|
width: 20,
|
|
18
19
|
color: "text-delta-700"
|
|
@@ -20,5 +21,5 @@ var f = ({ showCloseIcon: e, tooltipTitle: r, onClick: o }) => e ? /* @__PURE__
|
|
|
20
21
|
}) })
|
|
21
22
|
}) : null;
|
|
22
23
|
export {
|
|
23
|
-
|
|
24
|
+
h as CloseBtn
|
|
24
25
|
};
|
|
@@ -1,37 +1,46 @@
|
|
|
1
|
-
import { cn as
|
|
2
|
-
import { firstTabbable as
|
|
3
|
-
import { StyledTooltip as
|
|
4
|
-
import { useMobileMediaQuery as
|
|
5
|
-
import { useFocusTrap as
|
|
6
|
-
import { CloseBtn as
|
|
7
|
-
import { MinimizeBtn as
|
|
8
|
-
import { FullScreenBtn as
|
|
9
|
-
import
|
|
10
|
-
import { useTranslations as
|
|
11
|
-
import { useControlledProps as
|
|
12
|
-
import
|
|
13
|
-
import { useLayoutEffect as
|
|
14
|
-
import { Fragment as
|
|
15
|
-
var
|
|
16
|
-
const { showCloseIcon:
|
|
1
|
+
import { cn as a } from "../../../../helpers/cn.js";
|
|
2
|
+
import { firstTabbable as M } from "../../../../helpers/focusable.js";
|
|
3
|
+
import { StyledTooltip as $ } from "../../../data-display/tooltip/StyledTooltip.js";
|
|
4
|
+
import { useMobileMediaQuery as H } from "../../../../hooks/useMediaQuery.hook.js";
|
|
5
|
+
import { useFocusTrap as L } from "../../../../hooks/useFocusTrap.hook.js";
|
|
6
|
+
import { CloseBtn as k } from "../components/CloseBtn.js";
|
|
7
|
+
import { MinimizeBtn as B } from "../components/MinimizeBtn.js";
|
|
8
|
+
import { FullScreenBtn as Q } from "../components/FullscreenBtn.js";
|
|
9
|
+
import p from "./MinimizableDialogV2.module.js";
|
|
10
|
+
import { useTranslations as G } from "./useTranslations.js";
|
|
11
|
+
import { useControlledProps as J } from "./useControlledProps.js";
|
|
12
|
+
import K from "clsx";
|
|
13
|
+
import { useLayoutEffect as I, useRef as u } from "react";
|
|
14
|
+
import { Fragment as U, jsx as e, jsxs as n } from "react/jsx-runtime";
|
|
15
|
+
var ue = (g) => {
|
|
16
|
+
const { showCloseIcon: z = !0, showMinimizeIcon: j = !0, showExpandIcon: A = !0, enableFullscreen: D = !0, title: o, label: x, children: O, open: m, onClose: q, classNameOverrides: h = {
|
|
17
17
|
maximized: "",
|
|
18
18
|
minimized: "",
|
|
19
19
|
fullscreen: ""
|
|
20
|
-
}, dataTest:
|
|
21
|
-
|
|
20
|
+
}, dataTest: E, actionNode: P, locale: V = "en", style: y, initialFocusRef: w } = g, r = H(), s = G(V), d = u(null), f = u(null), N = u(null), C = u(null), F = u(!1), { minimized: t, setMinimized: S, fullScreen: i, setFullScreen: R } = J(g), l = i && !t, v = () => {
|
|
21
|
+
S(!1), q();
|
|
22
22
|
};
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}, [
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
23
|
+
I(() => {
|
|
24
|
+
d.current?.toggleAttribute("inert", t), f.current?.toggleAttribute("inert", !t);
|
|
25
|
+
}, [t]), I(() => {
|
|
26
|
+
const b = m && !F.current;
|
|
27
|
+
if (F.current = m, !b) return;
|
|
28
|
+
const c = t ? f.current : d.current, _ = t ? C.current : N.current;
|
|
29
|
+
(w?.current ?? _ ?? (c ? M(c) : void 0))?.focus({ preventScroll: !0 });
|
|
30
|
+
}, [
|
|
31
|
+
w,
|
|
32
|
+
t,
|
|
33
|
+
m
|
|
34
|
+
]);
|
|
35
|
+
const T = () => {
|
|
36
|
+
const b = t ? d : f;
|
|
37
|
+
S(!t), requestAnimationFrame(() => {
|
|
38
|
+
const c = b.current;
|
|
39
|
+
c && (c.querySelector('[data-testid="toggle-minimize-btn"]') ?? M(c))?.focus({ preventScroll: !0 });
|
|
31
40
|
});
|
|
32
41
|
};
|
|
33
|
-
|
|
34
|
-
const
|
|
42
|
+
L(m && l, d, v);
|
|
43
|
+
const W = l ? r ? {
|
|
35
44
|
inset: 0,
|
|
36
45
|
maxHeight: "100dvh",
|
|
37
46
|
maxWidth: "100dvw",
|
|
@@ -48,38 +57,39 @@ var ae = (h) => {
|
|
|
48
57
|
maxWidth: "min(1000px, calc(100vw - 32px))",
|
|
49
58
|
height: "95dvh"
|
|
50
59
|
} : void 0;
|
|
51
|
-
return
|
|
60
|
+
return m ? /* @__PURE__ */ n(U, { children: [
|
|
52
61
|
/* @__PURE__ */ e("div", {
|
|
53
|
-
ref:
|
|
62
|
+
ref: f,
|
|
54
63
|
style: {
|
|
55
64
|
zIndex: 51,
|
|
56
|
-
...
|
|
65
|
+
...y
|
|
57
66
|
},
|
|
58
|
-
className:
|
|
59
|
-
children: /* @__PURE__ */
|
|
60
|
-
className:
|
|
61
|
-
"data-testid":
|
|
67
|
+
className: a(p["minimized-dialog"], !t && p.hidden, h.minimized),
|
|
68
|
+
children: /* @__PURE__ */ n("div", {
|
|
69
|
+
className: K("flex items-center justify-between", !t && "hidden"),
|
|
70
|
+
"data-testid": E,
|
|
62
71
|
children: [/* @__PURE__ */ e("div", {
|
|
63
72
|
className: "max-w-[303px] truncate pr-1 text-lg font-semibold text-delta-800",
|
|
64
|
-
children: /* @__PURE__ */ e(
|
|
65
|
-
title:
|
|
73
|
+
children: /* @__PURE__ */ e($, {
|
|
74
|
+
title: o,
|
|
66
75
|
placement: "top",
|
|
67
76
|
children: /* @__PURE__ */ e("div", {
|
|
68
77
|
className: "truncate",
|
|
69
|
-
children:
|
|
78
|
+
children: o
|
|
70
79
|
})
|
|
71
80
|
})
|
|
72
|
-
}), /* @__PURE__ */
|
|
81
|
+
}), /* @__PURE__ */ n("div", {
|
|
73
82
|
className: "flex items-center gap-x-1",
|
|
74
|
-
children: [/* @__PURE__ */ e(
|
|
83
|
+
children: [/* @__PURE__ */ e(B, {
|
|
75
84
|
type: "expand",
|
|
76
|
-
visibility:
|
|
77
|
-
onClick:
|
|
78
|
-
tooltipTitle:
|
|
79
|
-
}), /* @__PURE__ */ e(
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
85
|
+
visibility: A,
|
|
86
|
+
onClick: T,
|
|
87
|
+
tooltipTitle: s.expand
|
|
88
|
+
}), /* @__PURE__ */ e(k, {
|
|
89
|
+
buttonRef: C,
|
|
90
|
+
showCloseIcon: z,
|
|
91
|
+
onClick: v,
|
|
92
|
+
tooltipTitle: s.close
|
|
83
93
|
})]
|
|
84
94
|
})]
|
|
85
95
|
})
|
|
@@ -87,66 +97,67 @@ var ae = (h) => {
|
|
|
87
97
|
l && /* @__PURE__ */ e("div", {
|
|
88
98
|
className: "fixed inset-0 z-[52] bg-[rgb(98,110,126)] bg-opacity-70",
|
|
89
99
|
onClick: () => {
|
|
90
|
-
|
|
100
|
+
R(!1);
|
|
91
101
|
}
|
|
92
102
|
}),
|
|
93
|
-
/* @__PURE__ */
|
|
103
|
+
/* @__PURE__ */ n("div", {
|
|
94
104
|
style: {
|
|
95
105
|
zIndex: 51,
|
|
96
|
-
...
|
|
97
|
-
...
|
|
106
|
+
...y,
|
|
107
|
+
...W
|
|
98
108
|
},
|
|
99
|
-
ref:
|
|
109
|
+
ref: d,
|
|
100
110
|
role: l ? "dialog" : void 0,
|
|
101
111
|
"aria-modal": l ? !0 : void 0,
|
|
102
|
-
"aria-label": l && typeof
|
|
103
|
-
className:
|
|
104
|
-
children: [/* @__PURE__ */
|
|
105
|
-
className:
|
|
106
|
-
children: [/* @__PURE__ */
|
|
112
|
+
"aria-label": l && typeof o == "string" ? o : void 0,
|
|
113
|
+
className: a(p.dialog, t && p.hidden, !i && h.maximized, i && h.fullscreen, l && "fixed z-[53] duration-0"),
|
|
114
|
+
children: [/* @__PURE__ */ n("div", {
|
|
115
|
+
className: a("flex flex-col border-b-[1px] border-delta-200 px-4", r ? "py-3" : "py-4"),
|
|
116
|
+
children: [/* @__PURE__ */ n("div", {
|
|
107
117
|
className: "flex items-center justify-between",
|
|
108
|
-
children: [
|
|
118
|
+
children: [x ? /* @__PURE__ */ e("div", {
|
|
109
119
|
className: "text-sm text-delta-700",
|
|
110
|
-
children:
|
|
120
|
+
children: x
|
|
111
121
|
}) : /* @__PURE__ */ e("div", {
|
|
112
|
-
className:
|
|
113
|
-
children:
|
|
114
|
-
}), /* @__PURE__ */
|
|
122
|
+
className: a("font-semibold text-delta-800", r ? "line-clamp-2 text-xl" : "line-clamp-1 text-2xl"),
|
|
123
|
+
children: o
|
|
124
|
+
}), /* @__PURE__ */ n("div", {
|
|
115
125
|
className: "flex items-center gap-x-1",
|
|
116
126
|
children: [
|
|
117
|
-
|
|
118
|
-
/* @__PURE__ */ e(
|
|
119
|
-
visibility:
|
|
127
|
+
P,
|
|
128
|
+
/* @__PURE__ */ e(B, {
|
|
129
|
+
visibility: j && !r && !i,
|
|
120
130
|
type: "minimize",
|
|
121
|
-
onClick:
|
|
122
|
-
tooltipTitle:
|
|
131
|
+
onClick: T,
|
|
132
|
+
tooltipTitle: s.minimize
|
|
123
133
|
}),
|
|
124
|
-
/* @__PURE__ */ e(
|
|
125
|
-
showFullScreenIcon:
|
|
126
|
-
fullScreen:
|
|
134
|
+
/* @__PURE__ */ e(Q, {
|
|
135
|
+
showFullScreenIcon: D && !r,
|
|
136
|
+
fullScreen: i,
|
|
127
137
|
onClick: () => {
|
|
128
|
-
|
|
138
|
+
R(!i);
|
|
129
139
|
},
|
|
130
|
-
tooltipTitle:
|
|
140
|
+
tooltipTitle: i ? s.exitFullscreen : s.fullscreen
|
|
131
141
|
}),
|
|
132
|
-
/* @__PURE__ */ e(
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
142
|
+
/* @__PURE__ */ e(k, {
|
|
143
|
+
buttonRef: N,
|
|
144
|
+
showCloseIcon: z,
|
|
145
|
+
onClick: v,
|
|
146
|
+
tooltipTitle: s.close
|
|
136
147
|
})
|
|
137
148
|
]
|
|
138
149
|
})]
|
|
139
|
-
}),
|
|
140
|
-
className:
|
|
141
|
-
children:
|
|
150
|
+
}), x && /* @__PURE__ */ e("div", {
|
|
151
|
+
className: a("font-semibold text-delta-800", r ? "line-clamp-2 text-xl" : "line-clamp-1 text-2xl"),
|
|
152
|
+
children: o
|
|
142
153
|
})]
|
|
143
154
|
}), /* @__PURE__ */ e("div", {
|
|
144
|
-
className:
|
|
145
|
-
children:
|
|
155
|
+
className: a(t && "hidden", "flex flex-grow flex-col overflow-y-auto"),
|
|
156
|
+
children: O
|
|
146
157
|
})]
|
|
147
158
|
})
|
|
148
159
|
] }) : null;
|
|
149
160
|
};
|
|
150
161
|
export {
|
|
151
|
-
|
|
162
|
+
ue as MinimizableDialogV2
|
|
152
163
|
};
|
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
import { useMemo as m, useState as D } from "react";
|
|
2
|
-
function w(
|
|
2
|
+
function w(i, c) {
|
|
3
3
|
const o = c.trim();
|
|
4
4
|
if (o.length === 0) return !0;
|
|
5
5
|
const r = o.replace(/^\+/, "").replace(/\D/g, "");
|
|
6
|
-
return r.length === 0 && !new RegExp("\\p{L}", "u").test(o) ||
|
|
6
|
+
return r.length === 0 && !new RegExp("\\p{L}", "u").test(o) || i.name.toLocaleLowerCase().includes(o.toLocaleLowerCase()) ? !0 : r.length > 0 && i.dialCode.startsWith(r);
|
|
7
7
|
}
|
|
8
|
-
function C({ countries:
|
|
9
|
-
const [p, s] = D(null), n = m(() =>
|
|
8
|
+
function C({ countries: i, selectedIso2: c, query: o, listId: r, onSelect: b, onDismiss: v }) {
|
|
9
|
+
const [p, s] = D(null), n = m(() => i.filter((e) => w(e, o)), [i, o]), a = p === null || n.length === 0 ? null : Math.max(n.findIndex((e) => e.iso2 === p), 0), g = (e) => `${r}-option-${e}`, k = (e) => {
|
|
10
10
|
const t = e === 1 ? n[0] : n[n.length - 1], l = n.find((d) => d.iso2 === c) ?? t;
|
|
11
11
|
l !== void 0 && s(l.iso2);
|
|
12
12
|
}, h = (e) => {
|
|
13
13
|
if (n.length === 0) return;
|
|
14
|
-
const t = n.findIndex((d) => d.iso2 === c), l = n[((
|
|
14
|
+
const t = n.findIndex((d) => d.iso2 === c), l = n[((a ?? (t >= 0 ? t : e === 1 ? -1 : 0)) + e + n.length) % n.length];
|
|
15
15
|
l !== void 0 && s(l.iso2);
|
|
16
16
|
}, u = (e, t = !0) => {
|
|
17
|
-
t && s(null),
|
|
17
|
+
t && s(null), b(e, t);
|
|
18
18
|
}, f = () => {
|
|
19
|
-
s(null),
|
|
19
|
+
s(null), v();
|
|
20
20
|
};
|
|
21
21
|
return {
|
|
22
22
|
visible: n,
|
|
23
|
-
activeIndex:
|
|
24
|
-
optionId:
|
|
25
|
-
openWithKeyboard:
|
|
23
|
+
activeIndex: a,
|
|
24
|
+
optionId: g,
|
|
25
|
+
openWithKeyboard: k,
|
|
26
26
|
select: u,
|
|
27
27
|
dismiss: f,
|
|
28
28
|
handleKeyDown: (e) => {
|
|
@@ -48,18 +48,18 @@ function C({ countries: a, selectedIso2: c, query: o, listId: r, onSelect: v, on
|
|
|
48
48
|
case " ": {
|
|
49
49
|
if (o !== "") break;
|
|
50
50
|
e.preventDefault();
|
|
51
|
-
const t =
|
|
51
|
+
const t = a === null ? void 0 : n[a];
|
|
52
52
|
t !== void 0 && u(t.iso2, !1);
|
|
53
53
|
break;
|
|
54
54
|
}
|
|
55
55
|
case "Enter": {
|
|
56
56
|
e.preventDefault();
|
|
57
|
-
const t =
|
|
57
|
+
const t = a === null ? void 0 : n[a];
|
|
58
58
|
t !== void 0 && u(t.iso2);
|
|
59
59
|
break;
|
|
60
60
|
}
|
|
61
61
|
case "Escape":
|
|
62
|
-
e.preventDefault(), f();
|
|
62
|
+
e.preventDefault(), e.stopPropagation(), f();
|
|
63
63
|
break;
|
|
64
64
|
case "Tab":
|
|
65
65
|
f();
|
|
@@ -8,16 +8,16 @@ import { StyledCheckbox as ae } from "../checkbox/base-ui/StyledCheckbox.js";
|
|
|
8
8
|
import { TOP_LAYER_PROPS as ot, TOP_LAYER_RESET_STYLE as nt, getOpenModalDialogAncestor as at, shouldUsePopoverTopLayer as it, useTopLayerRef as ct } from "../../../hooks/useTopLayer.hook.js";
|
|
9
9
|
import { LoadingIcon as dt } from "../../../table/shared-components/LoadingIcon.js";
|
|
10
10
|
import z from "./StyledSelectAutocomplete.module.js";
|
|
11
|
-
import { useEffect as ie, useMemo as W, useRef as ce, useState as
|
|
11
|
+
import { useEffect as ie, useMemo as W, useRef as ce, useState as v } from "react";
|
|
12
12
|
import { jsx as o, jsxs as I } from "react/jsx-runtime";
|
|
13
13
|
import { FloatingPortal as ut, autoUpdate as pt, flip as ft, offset as mt, shift as ht, size as bt, useDismiss as gt, useFloating as xt, useInteractions as wt, useMergeRefs as de, useRole as yt } from "@floating-ui/react";
|
|
14
|
-
var kt = (l) => typeof l == "object" && l !== null && "label" in l ? String(l.label) : String(l),
|
|
15
|
-
function Ft({ dataTest: l, options: p, renderInput: ue, value: A, onChange: N, getOptionLabel: pe, getOptionKey: C, isOptionEqualToValue: H, renderOption: U, renderValue: V, filterOptions: _, loading: B, loadingText: fe = "Loading…", noOptionsText: me = "No options", disabled: M, readOnly: g, error: he, helperText: be, size: ge = "small", disableClearable: xe, disableCloseOnSelect: we, popupIcon: ye, autoHeight: ke, multiple:
|
|
16
|
-
const r =
|
|
14
|
+
var kt = (l) => typeof l == "object" && l !== null && "label" in l ? String(l.label) : String(l), Dt = (l) => typeof l == "object" && l !== null && "disabled" in l && !!l.disabled;
|
|
15
|
+
function Ft({ dataTest: l, options: p, renderInput: ue, value: A, onChange: N, getOptionLabel: pe, getOptionKey: C, isOptionEqualToValue: H, renderOption: U, renderValue: V, filterOptions: _, loading: B, loadingText: fe = "Loading…", noOptionsText: me = "No options", disabled: M, readOnly: g, error: he, helperText: be, size: ge = "small", disableClearable: xe, disableCloseOnSelect: we, popupIcon: ye, autoHeight: ke, multiple: De, allowSelectAll: T, selectAllLabel: ve = "Select all", fullWidth: Ie, classes: Ae, inputValue: R, onInputChange: Ne, open: Y, onOpen: Ce, onClose: Me, className: Re, wrapperClassName: Se, getOptionDisabled: Pe, slotProps: q }) {
|
|
16
|
+
const r = De === !0, d = pe ?? kt, S = (e, t) => H ? H(e, t) : e === t, [$e, Le] = v(!1), a = Y ?? $e, u = (e) => {
|
|
17
17
|
e && (g || M) || (Y === void 0 && Le(e), e ? Ce?.() : (x(null), Me?.()));
|
|
18
|
-
}, [Ee, G] =
|
|
18
|
+
}, [Ee, G] = v(""), b = R ?? Ee, P = (e, t, n) => {
|
|
19
19
|
R === void 0 && G(t), Ne?.(e, t, n);
|
|
20
|
-
}, [s, x] =
|
|
20
|
+
}, [s, x] = v(null), J = `${l}-listbox`, Q = ce([]), X = ce(null), [_e, Fe] = v(null), [Z, Oe] = v(null), i = r ? Array.isArray(A) ? A : [] : [], w = r ? null : A ?? null, K = !r && w !== null ? d(w) : "";
|
|
21
21
|
ie(() => {
|
|
22
22
|
R !== void 0 || r || G(K);
|
|
23
23
|
}, [
|
|
@@ -25,7 +25,7 @@ function Ft({ dataTest: l, options: p, renderInput: ue, value: A, onChange: N, g
|
|
|
25
25
|
r,
|
|
26
26
|
K
|
|
27
27
|
]);
|
|
28
|
-
const F = (e) => r ? i.some((t) => S(e, t)) : w !== null && S(e, w),
|
|
28
|
+
const F = (e) => r ? i.some((t) => S(e, t)) : w !== null && S(e, w), $ = (e) => Pe?.(e) ?? Dt(e), ee = W(() => {
|
|
29
29
|
const e = [...p];
|
|
30
30
|
if (_) return _(e, { inputValue: b });
|
|
31
31
|
const t = !r && w !== null ? d(w).toLowerCase() : null;
|
|
@@ -37,7 +37,7 @@ function Ft({ dataTest: l, options: p, renderInput: ue, value: A, onChange: N, g
|
|
|
37
37
|
b,
|
|
38
38
|
_,
|
|
39
39
|
A
|
|
40
|
-
]), f = W(() => ee.slice(0, 100), [ee]), te = f.flatMap((e, t) =>
|
|
40
|
+
]), f = W(() => ee.slice(0, 100), [ee]), te = f.flatMap((e, t) => $(e) ? [] : [t]), c = T && r ? [-1, ...te] : te, k = f.findIndex(F);
|
|
41
41
|
ie(() => {
|
|
42
42
|
if (!a) return;
|
|
43
43
|
const e = s ?? k;
|
|
@@ -69,21 +69,21 @@ function Ft({ dataTest: l, options: p, renderInput: ue, value: A, onChange: N, g
|
|
|
69
69
|
const n = c.indexOf(t ?? k);
|
|
70
70
|
return n === -1 ? c[e === 1 ? 0 : c.length - 1] ?? null : c[Math.min(Math.max(n + e, 0), c.length - 1)] ?? null;
|
|
71
71
|
});
|
|
72
|
-
},
|
|
72
|
+
}, D = (e, t, n = !r || !we) => {
|
|
73
73
|
if (r) {
|
|
74
74
|
const m = i.some((h) => S(t, h)), y = m ? i.filter((h) => !S(t, h)) : [...i, t];
|
|
75
|
-
N?.(e, y, m ? "removeOption" : "selectOption", { option: t }),
|
|
75
|
+
N?.(e, y, m ? "removeOption" : "selectOption", { option: t }), P(e, "", "reset"), n && u(!1);
|
|
76
76
|
} else
|
|
77
|
-
N?.(e, t, "selectOption", { option: t }),
|
|
77
|
+
N?.(e, t, "selectOption", { option: t }), P(e, d(t), "reset"), n && u(!1);
|
|
78
78
|
}, se = (e) => {
|
|
79
|
-
N?.(e, r ? [] : null, "clear", void 0),
|
|
79
|
+
N?.(e, r ? [] : null, "clear", void 0), P(e, "", "clear");
|
|
80
80
|
}, j = (e) => {
|
|
81
81
|
const t = p.length > 0 && i.length === p.length;
|
|
82
82
|
N?.(e, t ? [] : p, t ? "clear" : "selectOption", void 0);
|
|
83
83
|
}, Ye = (e) => {
|
|
84
84
|
if (e.key === "Backspace" && b === "" && oe) {
|
|
85
85
|
const t = i[i.length - 1];
|
|
86
|
-
r ? t !== void 0 &&
|
|
86
|
+
r ? t !== void 0 && D(e, t, !1) : se(e);
|
|
87
87
|
} else if (e.key === "Enter" && !a)
|
|
88
88
|
e.preventDefault(), u(!0);
|
|
89
89
|
else if (e.key === "Enter" && s === -1)
|
|
@@ -91,7 +91,7 @@ function Ft({ dataTest: l, options: p, renderInput: ue, value: A, onChange: N, g
|
|
|
91
91
|
else if (e.key === "Enter" && s != null && f[s] != null) {
|
|
92
92
|
e.preventDefault();
|
|
93
93
|
const t = f[s];
|
|
94
|
-
|
|
94
|
+
$(t) || D(e, t, !0);
|
|
95
95
|
} else if (e.key === "ArrowDown" || e.key === "ArrowUp") {
|
|
96
96
|
if (e.preventDefault(), !a) {
|
|
97
97
|
x(Be(e.key === "ArrowDown" ? 1 : -1)), u(!0);
|
|
@@ -105,8 +105,8 @@ function Ft({ dataTest: l, options: p, renderInput: ue, value: A, onChange: N, g
|
|
|
105
105
|
else if (e.key === " " && s != null && f[s] != null) {
|
|
106
106
|
e.preventDefault();
|
|
107
107
|
const t = f[s];
|
|
108
|
-
|
|
109
|
-
} else e.key === "Escape" ? (e.preventDefault(), u(!1)) : e.key === "Tab" && u(!1);
|
|
108
|
+
$(t) || D(e, t, !1);
|
|
109
|
+
} else e.key === "Escape" && a ? (e.preventDefault(), e.stopPropagation(), u(!1)) : e.key === "Tab" && u(!1);
|
|
110
110
|
}, oe = !xe && !g && !M && (r ? i.length > 0 : w !== null);
|
|
111
111
|
let ne;
|
|
112
112
|
a && s != null && (s === -1 || f[s] !== void 0) && (ne = s === -1 ? `${l}-select-all` : `${l}-option-${s}`);
|
|
@@ -117,7 +117,7 @@ function Ft({ dataTest: l, options: p, renderInput: ue, value: A, onChange: N, g
|
|
|
117
117
|
label: d(e),
|
|
118
118
|
readOnly: g,
|
|
119
119
|
deleteButtonTabIndex: -1,
|
|
120
|
-
onDelete: g ? void 0 : (n) =>
|
|
120
|
+
onDelete: g ? void 0 : (n) => D(n, e)
|
|
121
121
|
}, C ? C(e) : `${d(e)}-${t}`)) : void 0, Je = /* @__PURE__ */ I("span", {
|
|
122
122
|
className: "flex items-center gap-1",
|
|
123
123
|
children: [
|
|
@@ -168,7 +168,7 @@ function Ft({ dataTest: l, options: p, renderInput: ue, value: A, onChange: N, g
|
|
|
168
168
|
helperText: be,
|
|
169
169
|
value: b,
|
|
170
170
|
onChange: (e) => {
|
|
171
|
-
x(null),
|
|
171
|
+
x(null), P(e, e.target.value, "input"), a || u(!0);
|
|
172
172
|
},
|
|
173
173
|
onKeyDown: Ye,
|
|
174
174
|
slotProps: {
|
|
@@ -220,11 +220,11 @@ function Ft({ dataTest: l, options: p, renderInput: ue, value: A, onChange: N, g
|
|
|
220
220
|
]
|
|
221
221
|
}, m);
|
|
222
222
|
}, Ke = (e, t) => {
|
|
223
|
-
const n =
|
|
223
|
+
const n = $(e), m = {
|
|
224
224
|
...He({
|
|
225
225
|
onMouseDown: (h) => h.preventDefault(),
|
|
226
226
|
onClick: (h) => {
|
|
227
|
-
n ||
|
|
227
|
+
n || D(h, e);
|
|
228
228
|
},
|
|
229
229
|
onMouseMove: () => x(null)
|
|
230
230
|
}),
|
|
@@ -289,7 +289,7 @@ function Ft({ dataTest: l, options: p, renderInput: ue, value: A, onChange: N, g
|
|
|
289
289
|
}),
|
|
290
290
|
/* @__PURE__ */ o("span", {
|
|
291
291
|
className: "flex-1 truncate py-2",
|
|
292
|
-
children:
|
|
292
|
+
children: ve
|
|
293
293
|
})
|
|
294
294
|
]
|
|
295
295
|
}), B ? /* @__PURE__ */ o("li", {
|
|
@@ -5,44 +5,44 @@ import { DatePickerInputIndex as y } from "./components/DatePickerInputIndex.js"
|
|
|
5
5
|
import { useIsMobileView as x } from "../../hooks/useWindowWidthSize.hook.js";
|
|
6
6
|
import { StyledDrawer as b } from "../../../components/navigation/drawer/StyledDrawer.js";
|
|
7
7
|
import { useBackNavigationClose as h } from "../../hooks/useBackNavigationClose.hook.js";
|
|
8
|
-
import { useEffect as C, useState as
|
|
9
|
-
import { Fragment as
|
|
10
|
-
var L = (
|
|
11
|
-
const
|
|
12
|
-
|
|
8
|
+
import { useEffect as C, useState as s } from "react";
|
|
9
|
+
import { Fragment as D, jsx as t, jsxs as E } from "react/jsx-runtime";
|
|
10
|
+
var L = (p) => {
|
|
11
|
+
const i = x(), [e, c] = s(null), [m, d] = s(!1), [f, l] = s(!1), u = (r) => {
|
|
12
|
+
c(r.currentTarget), P(r, d);
|
|
13
13
|
}, o = () => {
|
|
14
|
-
|
|
14
|
+
l(!0), c(null);
|
|
15
15
|
};
|
|
16
16
|
C(() => {
|
|
17
17
|
if (!e) return;
|
|
18
|
-
const r = (
|
|
19
|
-
document.activeElement === e && (
|
|
18
|
+
const r = (n) => {
|
|
19
|
+
document.activeElement === e && (n.key === "Escape" ? (n.preventDefault(), n.stopPropagation(), o()) : n.key === "Tab" && o());
|
|
20
20
|
};
|
|
21
21
|
return document.addEventListener("keydown", r), () => document.removeEventListener("keydown", r);
|
|
22
22
|
}, [e]), h({
|
|
23
23
|
open: !!e,
|
|
24
24
|
onClose: o
|
|
25
25
|
});
|
|
26
|
-
const
|
|
27
|
-
...
|
|
26
|
+
const a = {
|
|
27
|
+
...p,
|
|
28
28
|
validateOnCalendarClose: f,
|
|
29
|
-
onValidatedOnce: () =>
|
|
29
|
+
onValidatedOnce: () => l(!1)
|
|
30
30
|
};
|
|
31
|
-
return /* @__PURE__ */
|
|
31
|
+
return /* @__PURE__ */ E(D, { children: [
|
|
32
32
|
/* @__PURE__ */ t(y, {
|
|
33
|
-
datePickerProps:
|
|
33
|
+
datePickerProps: a,
|
|
34
34
|
onClick: u
|
|
35
35
|
}),
|
|
36
|
-
!
|
|
37
|
-
datePickerProps: { ...
|
|
36
|
+
!i && /* @__PURE__ */ t(v, {
|
|
37
|
+
datePickerProps: { ...a },
|
|
38
38
|
popoverProps: {
|
|
39
39
|
open: !!e,
|
|
40
40
|
anchorEl: e,
|
|
41
41
|
onClose: o
|
|
42
42
|
},
|
|
43
|
-
positionAbove:
|
|
43
|
+
positionAbove: m
|
|
44
44
|
}),
|
|
45
|
-
|
|
45
|
+
i && /* @__PURE__ */ t(b, {
|
|
46
46
|
anchor: "bottom",
|
|
47
47
|
open: !!e,
|
|
48
48
|
onClose: o,
|
|
@@ -50,7 +50,7 @@ var L = (m) => {
|
|
|
50
50
|
children: /* @__PURE__ */ t("div", {
|
|
51
51
|
className: "mx-auto max-w-[360px] px-2 pb-[max(1.5rem,env(safe-area-inset-bottom))]",
|
|
52
52
|
children: /* @__PURE__ */ t(k, {
|
|
53
|
-
datePickerProps: { ...
|
|
53
|
+
datePickerProps: { ...a },
|
|
54
54
|
popoverProps: {
|
|
55
55
|
open: !!e,
|
|
56
56
|
anchorEl: e,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { useIsMobileView as
|
|
2
|
-
import { StyledDrawer as
|
|
1
|
+
import { useIsMobileView as N } from "../../hooks/useWindowWidthSize.hook.js";
|
|
2
|
+
import { StyledDrawer as O } from "../../../components/navigation/drawer/StyledDrawer.js";
|
|
3
3
|
import { useBackNavigationClose as I } from "../../hooks/useBackNavigationClose.hook.js";
|
|
4
4
|
import { usePopupState as j } from "../../../hooks/usePopupState.js";
|
|
5
5
|
import { ClickAwayListener as A } from "../../../components/mui-compat/ClickAwayListener.js";
|
|
@@ -7,97 +7,97 @@ import { TimePickerPanel as B } from "./components/TimePickerPanel.js";
|
|
|
7
7
|
import { TimePickerPopper as M } from "./TimePickerPopper.js";
|
|
8
8
|
import { getTimeFromValue as S } from "./helpers/getTimeFromValue.js";
|
|
9
9
|
import { TimePickerInput as F } from "./TimePickerInput.js";
|
|
10
|
-
import { useEffect as K, useState as
|
|
11
|
-
import { jsx as
|
|
12
|
-
import { format as
|
|
13
|
-
var
|
|
14
|
-
const { value: a, onSelect:
|
|
10
|
+
import { useEffect as K, useState as y } from "react";
|
|
11
|
+
import { jsx as r, jsxs as C } from "react/jsx-runtime";
|
|
12
|
+
import { format as k, isBefore as q, isValid as z } from "date-fns";
|
|
13
|
+
var oe = (i) => {
|
|
14
|
+
const { value: a, onSelect: n, notBeforeTime: u } = i, o = j({
|
|
15
15
|
variant: "popper",
|
|
16
16
|
popupId: "time-picker-popper"
|
|
17
|
-
}), c =
|
|
17
|
+
}), c = N();
|
|
18
18
|
I({
|
|
19
|
-
open: c &&
|
|
20
|
-
onClose:
|
|
19
|
+
open: c && o.isOpen,
|
|
20
|
+
onClose: o.close
|
|
21
21
|
});
|
|
22
|
-
const { isOpen:
|
|
22
|
+
const { isOpen: V, anchorEl: w, close: p } = o;
|
|
23
23
|
K(() => {
|
|
24
|
-
if (!
|
|
25
|
-
const e = (
|
|
26
|
-
|
|
24
|
+
if (!V || c) return;
|
|
25
|
+
const e = (t) => {
|
|
26
|
+
w?.contains(document.activeElement) && (t.key === "Escape" ? (t.preventDefault(), t.stopPropagation(), p()) : t.key === "Tab" && p());
|
|
27
27
|
};
|
|
28
28
|
return document.addEventListener("keydown", e), () => document.removeEventListener("keydown", e);
|
|
29
29
|
}, [
|
|
30
|
-
k,
|
|
31
30
|
V,
|
|
32
31
|
w,
|
|
32
|
+
p,
|
|
33
33
|
c
|
|
34
34
|
]);
|
|
35
|
-
const E = a ?
|
|
36
|
-
const
|
|
37
|
-
if (l(!0), m(
|
|
35
|
+
const E = a ? k(a, "HH:mm") : "", [b, m] = y(E), [g, l] = y(!1), [D, s] = y(!0), f = g ? b : E, d = (e) => !e || !u || !z(u) || !q(e, u), x = f.length === 5 ? S(f, a) : null, H = x ? d(x) : !0, L = (e) => {
|
|
36
|
+
const t = e.target.value;
|
|
37
|
+
if (l(!0), m(t), t.length !== 5) {
|
|
38
38
|
s(!1);
|
|
39
39
|
return;
|
|
40
40
|
}
|
|
41
|
-
const
|
|
42
|
-
if (!
|
|
43
|
-
|
|
41
|
+
const v = S(t, a);
|
|
42
|
+
if (!v) {
|
|
43
|
+
n(void 0), s(!1);
|
|
44
44
|
return;
|
|
45
45
|
}
|
|
46
|
-
s(!0),
|
|
47
|
-
},
|
|
48
|
-
if (s(!0),
|
|
49
|
-
|
|
46
|
+
s(!0), d(v) ? (n(v), l(!1), o.close()) : n(void 0);
|
|
47
|
+
}, P = (e) => {
|
|
48
|
+
if (s(!0), d(e)) {
|
|
49
|
+
n(e), m(e ? k(e, "HH:mm") : ""), l(!1);
|
|
50
50
|
return;
|
|
51
51
|
}
|
|
52
|
-
|
|
53
|
-
},
|
|
54
|
-
|
|
55
|
-
},
|
|
56
|
-
...
|
|
57
|
-
popupState:
|
|
58
|
-
localValue:
|
|
59
|
-
isValidTime:
|
|
60
|
-
isValidEndTime:
|
|
61
|
-
handleChange:
|
|
52
|
+
n(void 0), m(e ? k(e, "HH:mm") : ""), l(!0);
|
|
53
|
+
}, T = () => {
|
|
54
|
+
n(void 0), m(""), l(!1), s(!0);
|
|
55
|
+
}, h = /* @__PURE__ */ r(F, {
|
|
56
|
+
...i,
|
|
57
|
+
popupState: o,
|
|
58
|
+
localValue: f,
|
|
59
|
+
isValidTime: D,
|
|
60
|
+
isValidEndTime: H,
|
|
61
|
+
handleChange: L
|
|
62
62
|
});
|
|
63
|
-
return
|
|
63
|
+
return i.disabled || i.readOnly ? h : c ? /* @__PURE__ */ C("div", {
|
|
64
64
|
className: "relative h-auto w-auto",
|
|
65
|
-
children: [/* @__PURE__ */
|
|
65
|
+
children: [/* @__PURE__ */ r("div", {
|
|
66
66
|
className: "m-0 flex h-fit items-center justify-center p-0",
|
|
67
|
-
children:
|
|
68
|
-
}), /* @__PURE__ */
|
|
67
|
+
children: h
|
|
68
|
+
}), /* @__PURE__ */ r(O, {
|
|
69
69
|
anchor: "bottom",
|
|
70
|
-
open:
|
|
71
|
-
onClose:
|
|
72
|
-
anchorEl:
|
|
73
|
-
children: /* @__PURE__ */
|
|
70
|
+
open: o.isOpen,
|
|
71
|
+
onClose: o.close,
|
|
72
|
+
anchorEl: o.anchorEl,
|
|
73
|
+
children: /* @__PURE__ */ r("div", {
|
|
74
74
|
className: "mx-auto w-full max-w-[360px] px-4 pb-[max(1rem,env(safe-area-inset-bottom))] pt-2",
|
|
75
|
-
children: /* @__PURE__ */
|
|
76
|
-
dataTest:
|
|
75
|
+
children: /* @__PURE__ */ r(B, {
|
|
76
|
+
dataTest: i.dataTest,
|
|
77
77
|
value: a,
|
|
78
|
-
onSelect:
|
|
79
|
-
handleClear:
|
|
80
|
-
onConfirm:
|
|
78
|
+
onSelect: P,
|
|
79
|
+
handleClear: T,
|
|
80
|
+
onConfirm: o.close
|
|
81
81
|
})
|
|
82
82
|
})
|
|
83
83
|
})]
|
|
84
|
-
}) : /* @__PURE__ */
|
|
84
|
+
}) : /* @__PURE__ */ r(A, {
|
|
85
85
|
mouseEvent: "onMouseDown",
|
|
86
|
-
onClickAway:
|
|
86
|
+
onClickAway: o.close,
|
|
87
87
|
children: /* @__PURE__ */ C("div", {
|
|
88
88
|
className: "relative h-auto w-auto",
|
|
89
|
-
children: [/* @__PURE__ */
|
|
89
|
+
children: [/* @__PURE__ */ r("div", {
|
|
90
90
|
className: "m-0 flex h-fit items-center justify-center p-0",
|
|
91
|
-
children:
|
|
92
|
-
}),
|
|
93
|
-
...
|
|
94
|
-
popupState:
|
|
95
|
-
handleClear:
|
|
96
|
-
onSelect:
|
|
91
|
+
children: h
|
|
92
|
+
}), o.isOpen && /* @__PURE__ */ r(M, {
|
|
93
|
+
...i,
|
|
94
|
+
popupState: o,
|
|
95
|
+
handleClear: T,
|
|
96
|
+
onSelect: P
|
|
97
97
|
})]
|
|
98
98
|
})
|
|
99
99
|
});
|
|
100
100
|
};
|
|
101
101
|
export {
|
|
102
|
-
|
|
102
|
+
oe as StyledTimePicker
|
|
103
103
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
1
|
+
import { ReactNode, RefObject } from 'react';
|
|
2
2
|
export type ILocale = 'en' | 'no';
|
|
3
3
|
/**
|
|
4
4
|
* @figmaNode wXrXt5uKNNzV2DnQCgyYZH#20049-111828 (Design-System · "Dialog minimized")
|
|
@@ -32,6 +32,11 @@ export interface IMinimizableDialogV2Props {
|
|
|
32
32
|
locale?: ILocale;
|
|
33
33
|
dataTest: string;
|
|
34
34
|
style?: React.CSSProperties;
|
|
35
|
+
/**
|
|
36
|
+
* Overrides the Close button as the focus target when the dialog opens.
|
|
37
|
+
* Docked dialogs remain non-modal and do not trap subsequent keyboard navigation.
|
|
38
|
+
*/
|
|
39
|
+
initialFocusRef?: RefObject<HTMLElement | null>;
|
|
35
40
|
minimizedState?: boolean;
|
|
36
41
|
handleMinimizedState?: (minimized: boolean) => void;
|
|
37
42
|
enableFullscreen?: boolean;
|