asma-ui-core 3.71.0 → 3.73.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/feedback/minimizable-dialog/v2/MinimizableDialogV2.js +34 -27
- package/dist/datetime/components/time-picker/StyledTimePicker.js +75 -56
- package/dist/datetime/components/time-picker/StyledTimePicker.module.js +6 -6
- package/dist/datetime/components/time-picker/TimePickerPopper.js +21 -59
- package/dist/datetime/components/time-picker/components/TimePickerBody.js +24 -19
- package/dist/datetime/components/time-picker/components/TimePickerColumn.js +12 -11
- package/dist/datetime/components/time-picker/components/TimePickerPanel.js +50 -0
- package/dist/src/datetime/components/time-picker/StyledTimePicker.d.ts +2 -1
- package/dist/src/datetime/components/time-picker/components/TimePickerPanel.d.ts +12 -0
- package/package.json +1 -1
|
@@ -1,26 +1,33 @@
|
|
|
1
|
-
import { cn as
|
|
1
|
+
import { cn as s } from "../../../../helpers/cn.js";
|
|
2
2
|
import { StyledTooltip as j } from "../../../data-display/tooltip/StyledTooltip.js";
|
|
3
3
|
import { useMobileMediaQuery as B } from "../../../../hooks/useMediaQuery.hook.js";
|
|
4
4
|
import { useFocusTrap as D } from "../../../../hooks/useFocusTrap.hook.js";
|
|
5
5
|
import { CloseBtn as y } from "../components/CloseBtn.js";
|
|
6
6
|
import { MinimizeBtn as z } from "../components/MinimizeBtn.js";
|
|
7
7
|
import { FullScreenBtn as R } from "../components/FullscreenBtn.js";
|
|
8
|
-
import
|
|
8
|
+
import d from "./MinimizableDialogV2.module.js";
|
|
9
9
|
import { useTranslations as V } from "./useTranslations.js";
|
|
10
|
-
import { useControlledProps as
|
|
11
|
-
import
|
|
12
|
-
import { useRef as
|
|
13
|
-
import { Fragment as
|
|
10
|
+
import { useControlledProps as W } from "./useControlledProps.js";
|
|
11
|
+
import _ from "clsx";
|
|
12
|
+
import { useRef as $ } from "react";
|
|
13
|
+
import { Fragment as A, jsx as e, jsxs as o } from "react/jsx-runtime";
|
|
14
14
|
var ee = (f) => {
|
|
15
|
-
const { showCloseIcon:
|
|
15
|
+
const { showCloseIcon: h = !0, showMinimizeIcon: N = !0, showExpandIcon: w = !0, enableFullscreen: C = !0, title: n, label: m, children: F, open: u, onClose: T, classNameOverrides: c = {
|
|
16
16
|
maximized: "",
|
|
17
17
|
minimized: "",
|
|
18
18
|
fullscreen: ""
|
|
19
|
-
}, dataTest: M, actionNode: S, locale: k = "en", style: v } = f,
|
|
19
|
+
}, dataTest: M, actionNode: S, locale: k = "en", style: v } = f, a = B(), r = V(k), b = $(null), { minimized: i, setMinimized: x, fullScreen: l, setFullScreen: g } = W(f), t = l && !i, p = () => {
|
|
20
20
|
x(!1), T();
|
|
21
21
|
};
|
|
22
|
-
D(
|
|
23
|
-
const I = t ? {
|
|
22
|
+
D(u && t, b, p);
|
|
23
|
+
const I = t ? a ? {
|
|
24
|
+
inset: 0,
|
|
25
|
+
maxHeight: "100dvh",
|
|
26
|
+
maxWidth: "100dvw",
|
|
27
|
+
transform: "none",
|
|
28
|
+
height: "100dvh",
|
|
29
|
+
width: "100dvw"
|
|
30
|
+
} : {
|
|
24
31
|
right: "auto",
|
|
25
32
|
bottom: "auto",
|
|
26
33
|
left: "50%",
|
|
@@ -30,15 +37,15 @@ var ee = (f) => {
|
|
|
30
37
|
maxWidth: "min(1000px, calc(100vw - 32px))",
|
|
31
38
|
height: "95dvh"
|
|
32
39
|
} : void 0;
|
|
33
|
-
return
|
|
40
|
+
return u ? /* @__PURE__ */ o(A, { children: [
|
|
34
41
|
/* @__PURE__ */ e("div", {
|
|
35
42
|
style: {
|
|
36
43
|
zIndex: 51,
|
|
37
44
|
...v
|
|
38
45
|
},
|
|
39
|
-
className:
|
|
46
|
+
className: s(d["minimized-dialog"], !i && d.hidden, c.minimized),
|
|
40
47
|
children: /* @__PURE__ */ o("div", {
|
|
41
|
-
className:
|
|
48
|
+
className: _("flex items-center justify-between", !i && "hidden"),
|
|
42
49
|
"data-testid": M,
|
|
43
50
|
children: [/* @__PURE__ */ e("div", {
|
|
44
51
|
className: "max-w-[303px] truncate pr-1 text-lg font-semibold text-delta-800",
|
|
@@ -58,11 +65,11 @@ var ee = (f) => {
|
|
|
58
65
|
onClick: () => {
|
|
59
66
|
x(!i);
|
|
60
67
|
},
|
|
61
|
-
tooltipTitle:
|
|
68
|
+
tooltipTitle: r.expand
|
|
62
69
|
}), /* @__PURE__ */ e(y, {
|
|
63
|
-
showCloseIcon:
|
|
70
|
+
showCloseIcon: h,
|
|
64
71
|
onClick: p,
|
|
65
|
-
tooltipTitle:
|
|
72
|
+
tooltipTitle: r.close
|
|
66
73
|
})]
|
|
67
74
|
})]
|
|
68
75
|
})
|
|
@@ -83,50 +90,50 @@ var ee = (f) => {
|
|
|
83
90
|
role: t ? "dialog" : void 0,
|
|
84
91
|
"aria-modal": t ? !0 : void 0,
|
|
85
92
|
"aria-label": t && typeof n == "string" ? n : void 0,
|
|
86
|
-
className:
|
|
93
|
+
className: s(d.dialog, i && d.hidden, !l && c.maximized, l && c.fullscreen, t && "fixed z-[53] duration-0"),
|
|
87
94
|
children: [/* @__PURE__ */ o("div", {
|
|
88
|
-
className:
|
|
95
|
+
className: s("flex flex-col border-b-[1px] border-delta-200 px-4", a ? "py-3" : "py-4"),
|
|
89
96
|
children: [/* @__PURE__ */ o("div", {
|
|
90
97
|
className: "flex items-center justify-between",
|
|
91
98
|
children: [m ? /* @__PURE__ */ e("div", {
|
|
92
99
|
className: "text-sm text-delta-700",
|
|
93
100
|
children: m
|
|
94
101
|
}) : /* @__PURE__ */ e("div", {
|
|
95
|
-
className:
|
|
102
|
+
className: s("font-semibold text-delta-800", a ? "line-clamp-2 text-xl" : "line-clamp-1 text-2xl"),
|
|
96
103
|
children: n
|
|
97
104
|
}), /* @__PURE__ */ o("div", {
|
|
98
105
|
className: "flex items-center gap-x-1",
|
|
99
106
|
children: [
|
|
100
107
|
S,
|
|
101
108
|
/* @__PURE__ */ e(z, {
|
|
102
|
-
visibility: N && !
|
|
109
|
+
visibility: N && !a && !l,
|
|
103
110
|
type: "minimize",
|
|
104
111
|
onClick: () => {
|
|
105
112
|
x(!i);
|
|
106
113
|
},
|
|
107
|
-
tooltipTitle:
|
|
114
|
+
tooltipTitle: r.minimize
|
|
108
115
|
}),
|
|
109
116
|
/* @__PURE__ */ e(R, {
|
|
110
|
-
showFullScreenIcon: C && !
|
|
117
|
+
showFullScreenIcon: C && !a,
|
|
111
118
|
fullScreen: l,
|
|
112
119
|
onClick: () => {
|
|
113
120
|
g(!l);
|
|
114
121
|
},
|
|
115
|
-
tooltipTitle: l ?
|
|
122
|
+
tooltipTitle: l ? r.exitFullscreen : r.fullscreen
|
|
116
123
|
}),
|
|
117
124
|
/* @__PURE__ */ e(y, {
|
|
118
|
-
showCloseIcon:
|
|
125
|
+
showCloseIcon: h,
|
|
119
126
|
onClick: p,
|
|
120
|
-
tooltipTitle:
|
|
127
|
+
tooltipTitle: r.close
|
|
121
128
|
})
|
|
122
129
|
]
|
|
123
130
|
})]
|
|
124
131
|
}), m && /* @__PURE__ */ e("div", {
|
|
125
|
-
className:
|
|
132
|
+
className: s("font-semibold text-delta-800", a ? "line-clamp-2 text-xl" : "line-clamp-1 text-2xl"),
|
|
126
133
|
children: n
|
|
127
134
|
})]
|
|
128
135
|
}), /* @__PURE__ */ e("div", {
|
|
129
|
-
className:
|
|
136
|
+
className: s(i && "hidden", "flex flex-grow flex-col overflow-y-auto"),
|
|
130
137
|
children: F
|
|
131
138
|
})]
|
|
132
139
|
})
|
|
@@ -1,71 +1,90 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useIsMobileView as N } from "../../hooks/useWindowWidthSize.hook.js";
|
|
2
|
+
import { StyledDrawer as E } from "../../../components/navigation/drawer/StyledDrawer.js";
|
|
3
|
+
import { useBackNavigationClose as I } from "../../hooks/useBackNavigationClose.hook.js";
|
|
4
|
+
import { usePopupState as j } from "../../../hooks/usePopupState.js";
|
|
2
5
|
import { ClickAwayListener as D } from "../../../components/mui-compat/ClickAwayListener.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
+
import { TimePickerPanel as L } from "./components/TimePickerPanel.js";
|
|
7
|
+
import { TimePickerPopper as O } from "./TimePickerPopper.js";
|
|
8
|
+
import { getTimeFromValue as S } from "./helpers/getTimeFromValue.js";
|
|
9
|
+
import { TimePickerInput as B } from "./TimePickerInput.js";
|
|
6
10
|
import { useState as h } from "react";
|
|
7
|
-
import { jsx as o, jsxs as
|
|
8
|
-
import { format as v, isBefore as
|
|
9
|
-
var
|
|
10
|
-
const { value: a, onSelect:
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
},
|
|
14
|
-
|
|
15
|
-
|
|
11
|
+
import { jsx as o, jsxs as T } from "react/jsx-runtime";
|
|
12
|
+
import { format as v, isBefore as M, isValid as A } from "date-fns";
|
|
13
|
+
var Z = (i) => {
|
|
14
|
+
const { value: a, onSelect: r, notBeforeTime: m } = i, e = j({
|
|
15
|
+
variant: "popper",
|
|
16
|
+
popupId: "time-picker-popper"
|
|
17
|
+
}), V = N();
|
|
18
|
+
I({
|
|
19
|
+
open: V && e.isOpen,
|
|
20
|
+
onClose: e.close
|
|
21
|
+
});
|
|
22
|
+
const x = a ? v(a, "HH:mm") : "", [C, s] = h(x), [P, l] = h(!1), [b, n] = h(!0), c = P ? C : x, u = (t) => !t || !m || !A(m) || !M(t, m), k = c.length === 5 ? S(c, a) : null, g = k ? u(k) : !0, H = (t) => {
|
|
23
|
+
const p = t.target.value;
|
|
24
|
+
if (l(!0), s(p), p.length !== 5) {
|
|
16
25
|
n(!1);
|
|
17
26
|
return;
|
|
18
27
|
}
|
|
19
|
-
const
|
|
20
|
-
if (!
|
|
21
|
-
|
|
28
|
+
const d = S(p, a);
|
|
29
|
+
if (!d) {
|
|
30
|
+
r(void 0), n(!1);
|
|
22
31
|
return;
|
|
23
32
|
}
|
|
24
|
-
n(!0), u(
|
|
25
|
-
},
|
|
26
|
-
if (n(!0), u(
|
|
27
|
-
|
|
33
|
+
n(!0), u(d) ? (r(d), l(!1), e.close()) : r(void 0);
|
|
34
|
+
}, w = (t) => {
|
|
35
|
+
if (n(!0), u(t)) {
|
|
36
|
+
r(t), s(t ? v(t, "HH:mm") : ""), l(!1);
|
|
28
37
|
return;
|
|
29
38
|
}
|
|
30
|
-
|
|
31
|
-
},
|
|
32
|
-
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
})
|
|
60
|
-
...l,
|
|
61
|
-
popupState: e,
|
|
62
|
-
handleClear: L,
|
|
63
|
-
onSelect: (r) => I(r)
|
|
64
|
-
})]
|
|
39
|
+
r(void 0), s(t ? v(t, "HH:mm") : ""), l(!0);
|
|
40
|
+
}, y = () => {
|
|
41
|
+
r(void 0), s(""), l(!1), n(!0);
|
|
42
|
+
}, f = /* @__PURE__ */ o(B, {
|
|
43
|
+
...i,
|
|
44
|
+
popupState: e,
|
|
45
|
+
localValue: c,
|
|
46
|
+
isValidTime: b,
|
|
47
|
+
isValidEndTime: g,
|
|
48
|
+
handleChange: H
|
|
49
|
+
});
|
|
50
|
+
return i.disabled || i.readOnly ? f : V ? /* @__PURE__ */ T("div", {
|
|
51
|
+
className: "relative h-auto w-auto",
|
|
52
|
+
children: [/* @__PURE__ */ o("div", {
|
|
53
|
+
className: "m-0 flex h-fit items-center justify-center p-0",
|
|
54
|
+
children: f
|
|
55
|
+
}), /* @__PURE__ */ o(E, {
|
|
56
|
+
anchor: "bottom",
|
|
57
|
+
open: e.isOpen,
|
|
58
|
+
onClose: e.close,
|
|
59
|
+
anchorEl: e.anchorEl,
|
|
60
|
+
children: /* @__PURE__ */ o("div", {
|
|
61
|
+
className: "mx-auto w-full max-w-[360px] px-4 pb-[max(1rem,env(safe-area-inset-bottom))] pt-2",
|
|
62
|
+
children: /* @__PURE__ */ o(L, {
|
|
63
|
+
dataTest: i.dataTest,
|
|
64
|
+
value: a,
|
|
65
|
+
onSelect: w,
|
|
66
|
+
handleClear: y,
|
|
67
|
+
onConfirm: e.close
|
|
68
|
+
})
|
|
65
69
|
})
|
|
70
|
+
})]
|
|
71
|
+
}) : /* @__PURE__ */ o(D, {
|
|
72
|
+
mouseEvent: "onMouseDown",
|
|
73
|
+
onClickAway: e.close,
|
|
74
|
+
children: /* @__PURE__ */ T("div", {
|
|
75
|
+
className: "relative h-auto w-auto",
|
|
76
|
+
children: [/* @__PURE__ */ o("div", {
|
|
77
|
+
className: "m-0 flex h-fit items-center justify-center p-0",
|
|
78
|
+
children: f
|
|
79
|
+
}), e.isOpen && /* @__PURE__ */ o(O, {
|
|
80
|
+
...i,
|
|
81
|
+
popupState: e,
|
|
82
|
+
handleClear: y,
|
|
83
|
+
onSelect: w
|
|
84
|
+
})]
|
|
66
85
|
})
|
|
67
86
|
});
|
|
68
87
|
};
|
|
69
88
|
export {
|
|
70
|
-
|
|
89
|
+
Z as StyledTimePicker
|
|
71
90
|
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
var e = {
|
|
2
|
-
"styled-time-picker-root": "_styled-time-picker-
|
|
3
|
-
"styled-time-picker-root_column": "_styled-time-picker-
|
|
4
|
-
"styled-time-picker-root_cell": "_styled-time-picker-
|
|
5
|
-
"styled-time-picker-root_cell__cell-now": "_styled-time-picker-root_cell__cell-
|
|
6
|
-
"styled-time-picker-root_cell__cell-selected": "_styled-time-picker-root_cell__cell-
|
|
7
|
-
"time-picker-surface": "_time-picker-
|
|
2
|
+
"styled-time-picker-root": "_styled-time-picker-root_qcipa_1",
|
|
3
|
+
"styled-time-picker-root_column": "_styled-time-picker-root_column_qcipa_4",
|
|
4
|
+
"styled-time-picker-root_cell": "_styled-time-picker-root_cell_qcipa_7",
|
|
5
|
+
"styled-time-picker-root_cell__cell-now": "_styled-time-picker-root_cell__cell-now_qcipa_10",
|
|
6
|
+
"styled-time-picker-root_cell__cell-selected": "_styled-time-picker-root_cell__cell-selected_qcipa_13",
|
|
7
|
+
"time-picker-surface": "_time-picker-surface_qcipa_17"
|
|
8
8
|
};
|
|
9
9
|
export {
|
|
10
10
|
e as default
|
|
@@ -1,73 +1,35 @@
|
|
|
1
|
-
import { StyledButton as r } from "../../shared-components/button/StyledButton.js";
|
|
2
1
|
import { bindPopper as l } from "../../../hooks/usePopupState.js";
|
|
3
|
-
import { Paper as
|
|
2
|
+
import { Paper as n } from "../../../components/mui-compat/Paper.js";
|
|
4
3
|
import { Fade as c } from "../../../components/mui-compat/Fade.js";
|
|
5
|
-
import { Popper as
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
8
|
-
import
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
return /* @__PURE__ */ t(f, {
|
|
15
|
-
...l(e),
|
|
4
|
+
import { Popper as d } from "../../../components/mui-compat/Popper.js";
|
|
5
|
+
import f from "./StyledTimePicker.module.js";
|
|
6
|
+
import { TimePickerPanel as s } from "./components/TimePickerPanel.js";
|
|
7
|
+
import u from "clsx";
|
|
8
|
+
import { jsx as e } from "react/jsx-runtime";
|
|
9
|
+
var C = (o) => {
|
|
10
|
+
const { popupState: r, dataTest: t, value: i, onSelect: m, handleClear: p } = o;
|
|
11
|
+
return /* @__PURE__ */ e(d, {
|
|
12
|
+
...l(r),
|
|
16
13
|
transition: !0,
|
|
17
14
|
style: { zIndex: "1300" },
|
|
18
|
-
children: ({ TransitionProps:
|
|
19
|
-
...
|
|
15
|
+
children: ({ TransitionProps: a }) => /* @__PURE__ */ e(c, {
|
|
16
|
+
...a,
|
|
20
17
|
timeout: 350,
|
|
21
|
-
children: /* @__PURE__ */
|
|
18
|
+
children: /* @__PURE__ */ e(n, {
|
|
22
19
|
elevation: 0,
|
|
23
|
-
className:
|
|
20
|
+
className: u(f["time-picker-surface"]),
|
|
24
21
|
style: { paddingBottom: "1px" },
|
|
25
|
-
children:
|
|
26
|
-
dataTest:
|
|
22
|
+
children: /* @__PURE__ */ e(s, {
|
|
23
|
+
dataTest: t,
|
|
27
24
|
value: i,
|
|
28
|
-
onSelect:
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
marginTop: "12px",
|
|
33
|
-
marginBottom: "12px",
|
|
34
|
-
justifyContent: "space-between"
|
|
35
|
-
},
|
|
36
|
-
children: [/* @__PURE__ */ t(r, {
|
|
37
|
-
dataTest: "time-picker-erase-button",
|
|
38
|
-
"data-testid": "time-picker-erase-button",
|
|
39
|
-
variant: "text",
|
|
40
|
-
onClick: p,
|
|
41
|
-
size: "small",
|
|
42
|
-
disabled: !i,
|
|
43
|
-
style: {
|
|
44
|
-
minWidth: "40px",
|
|
45
|
-
marginLeft: "10px"
|
|
46
|
-
},
|
|
47
|
-
children: /* @__PURE__ */ t(x, {
|
|
48
|
-
width: 24,
|
|
49
|
-
height: 24
|
|
50
|
-
})
|
|
51
|
-
}), /* @__PURE__ */ t(r, {
|
|
52
|
-
dataTest: "time-picker-confirm-button",
|
|
53
|
-
"data-testid": "time-picker-confirm-button",
|
|
54
|
-
variant: "contained",
|
|
55
|
-
size: "small",
|
|
56
|
-
onClick: () => e.close(),
|
|
57
|
-
style: {
|
|
58
|
-
minWidth: "40px",
|
|
59
|
-
marginRight: "16px"
|
|
60
|
-
},
|
|
61
|
-
children: /* @__PURE__ */ t(k, {
|
|
62
|
-
width: 20,
|
|
63
|
-
height: 20
|
|
64
|
-
})
|
|
65
|
-
})]
|
|
66
|
-
})]
|
|
25
|
+
onSelect: m,
|
|
26
|
+
handleClear: p,
|
|
27
|
+
onConfirm: () => r.close()
|
|
28
|
+
})
|
|
67
29
|
})
|
|
68
30
|
})
|
|
69
31
|
});
|
|
70
32
|
};
|
|
71
33
|
export {
|
|
72
|
-
|
|
34
|
+
C as TimePickerPopper
|
|
73
35
|
};
|
|
@@ -1,24 +1,29 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { TimePickerColumn as
|
|
3
|
-
import { useEffect as
|
|
4
|
-
import { jsx as
|
|
5
|
-
var k = ({ value:
|
|
6
|
-
const
|
|
7
|
-
return
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
1
|
+
import f from "../StyledTimePicker.module.js";
|
|
2
|
+
import { TimePickerColumn as s } from "./TimePickerColumn.js";
|
|
3
|
+
import { useEffect as u, useRef as d } from "react";
|
|
4
|
+
import { jsx as m, jsxs as p } from "react/jsx-runtime";
|
|
5
|
+
var k = ({ value: l, onSelect: i, dataTest: n }) => {
|
|
6
|
+
const t = d(null);
|
|
7
|
+
return u(() => {
|
|
8
|
+
const r = t.current;
|
|
9
|
+
if (!r) return;
|
|
10
|
+
const c = r.querySelectorAll('[data-cell="selected"]');
|
|
11
|
+
(c.length ? c : r.querySelectorAll('[data-cell="now"]')).forEach((o) => {
|
|
12
|
+
const e = o.parentElement;
|
|
13
|
+
e && (e.scrollTop = o.offsetTop - e.offsetTop - (e.clientHeight - o.clientHeight) / 2);
|
|
14
|
+
});
|
|
15
|
+
}, [t]), /* @__PURE__ */ p("div", {
|
|
16
|
+
ref: t,
|
|
17
|
+
"data-test": n,
|
|
18
|
+
className: f["styled-time-picker-root"],
|
|
19
|
+
children: [/* @__PURE__ */ m(s, {
|
|
15
20
|
type: "hours",
|
|
16
|
-
value:
|
|
17
|
-
onSelect:
|
|
18
|
-
}), /* @__PURE__ */
|
|
21
|
+
value: l,
|
|
22
|
+
onSelect: i
|
|
23
|
+
}), /* @__PURE__ */ m(s, {
|
|
19
24
|
type: "minutes",
|
|
20
|
-
value:
|
|
21
|
-
onSelect:
|
|
25
|
+
value: l,
|
|
26
|
+
onSelect: i
|
|
22
27
|
})]
|
|
23
28
|
});
|
|
24
29
|
};
|
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
import r from "../StyledTimePicker.module.js";
|
|
2
|
-
import
|
|
3
|
-
import { jsx as
|
|
4
|
-
import { getHours as
|
|
5
|
-
var b = ({ type:
|
|
6
|
-
const s = /* @__PURE__ */ new Date(), t =
|
|
7
|
-
return /* @__PURE__ */
|
|
2
|
+
import a from "clsx";
|
|
3
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
4
|
+
import { getHours as _, getMinutes as k, set as w } from "date-fns";
|
|
5
|
+
var b = ({ type: m, value: o, onSelect: d }) => {
|
|
6
|
+
const s = /* @__PURE__ */ new Date(), t = m === "hours", u = t ? 24 : 12, p = t ? s.getHours() : s.getMinutes();
|
|
7
|
+
return /* @__PURE__ */ n("div", {
|
|
8
8
|
className: r["styled-time-picker-root_column"],
|
|
9
|
-
children: new Array(
|
|
10
|
-
const e = t ? i : i * 5,
|
|
11
|
-
return /* @__PURE__ */
|
|
9
|
+
children: new Array(u).fill(null).map((y, i) => {
|
|
10
|
+
const e = t ? i : i * 5, l = o && e === (t ? _(o) : k(o)), c = p == e;
|
|
11
|
+
return /* @__PURE__ */ n("button", {
|
|
12
12
|
type: "button",
|
|
13
|
-
|
|
13
|
+
"data-cell": l ? "selected" : c ? "now" : void 0,
|
|
14
|
+
className: a("border-0", r["styled-time-picker-root_cell"], c && r["styled-time-picker-root_cell__cell-now"], l && r["styled-time-picker-root_cell__cell-selected"]),
|
|
14
15
|
onClick: () => {
|
|
15
|
-
|
|
16
|
+
d(w(o ?? /* @__PURE__ */ new Date(), t ? { hours: e } : { minutes: e }));
|
|
16
17
|
},
|
|
17
18
|
children: e.toString().padStart(2, "0")
|
|
18
19
|
}, e);
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { StyledButton as e } from "../../../shared-components/button/StyledButton.js";
|
|
2
|
+
import { TimePickerBody as d } from "./TimePickerBody.js";
|
|
3
|
+
import { EraserIcon as s } from "../../../shared-components/EraserIcon.js";
|
|
4
|
+
import { CheckIcon as c } from "../../../shared-components/CheckIcon.js";
|
|
5
|
+
import { Fragment as p, jsx as t, jsxs as r } from "react/jsx-runtime";
|
|
6
|
+
var g = ({ dataTest: n, value: i, onSelect: a, handleClear: m, onConfirm: o }) => /* @__PURE__ */ r(p, { children: [/* @__PURE__ */ t(d, {
|
|
7
|
+
dataTest: `${n}-time-picker-body`,
|
|
8
|
+
value: i,
|
|
9
|
+
onSelect: a
|
|
10
|
+
}), /* @__PURE__ */ r("div", {
|
|
11
|
+
style: {
|
|
12
|
+
display: "flex",
|
|
13
|
+
marginTop: "12px",
|
|
14
|
+
marginBottom: "12px",
|
|
15
|
+
justifyContent: "space-between"
|
|
16
|
+
},
|
|
17
|
+
children: [/* @__PURE__ */ t(e, {
|
|
18
|
+
dataTest: "time-picker-erase-button",
|
|
19
|
+
"data-testid": "time-picker-erase-button",
|
|
20
|
+
variant: "text",
|
|
21
|
+
onClick: m,
|
|
22
|
+
size: "small",
|
|
23
|
+
disabled: !i,
|
|
24
|
+
style: {
|
|
25
|
+
minWidth: "40px",
|
|
26
|
+
marginLeft: "10px"
|
|
27
|
+
},
|
|
28
|
+
children: /* @__PURE__ */ t(s, {
|
|
29
|
+
width: 24,
|
|
30
|
+
height: 24
|
|
31
|
+
})
|
|
32
|
+
}), /* @__PURE__ */ t(e, {
|
|
33
|
+
dataTest: "time-picker-confirm-button",
|
|
34
|
+
"data-testid": "time-picker-confirm-button",
|
|
35
|
+
variant: "contained",
|
|
36
|
+
size: "small",
|
|
37
|
+
onClick: o,
|
|
38
|
+
style: {
|
|
39
|
+
minWidth: "40px",
|
|
40
|
+
marginRight: "16px"
|
|
41
|
+
},
|
|
42
|
+
children: /* @__PURE__ */ t(c, {
|
|
43
|
+
width: 20,
|
|
44
|
+
height: 20
|
|
45
|
+
})
|
|
46
|
+
})]
|
|
47
|
+
})] });
|
|
48
|
+
export {
|
|
49
|
+
g as TimePickerPanel
|
|
50
|
+
};
|
|
@@ -7,6 +7,7 @@ import { StyledTimePickerProps } from './types';
|
|
|
7
7
|
* The dropdown follows the **Menus** surface (delta-300 border + Menus shadow `0 2 4 rgba(34,33,51,
|
|
8
8
|
* .15)`): scrollable hour/minute columns of 36px cells — hover delta-50, "now" gama-50 (like the
|
|
9
9
|
* calendar "today"), selected gama-500 white — plus an eraser + confirm footer. State (Enabled/Focus/
|
|
10
|
-
* Error/Disabled) ← the field.
|
|
10
|
+
* Error/Disabled) ← the field. On mobile (≤768px) the same panel opens in a bottom-sheet `Drawer`
|
|
11
|
+
* instead of the popper, matching `StyledDatePicker`. Non-annotated props are behavioral.
|
|
11
12
|
*/
|
|
12
13
|
export declare const StyledTimePicker: React.FC<StyledTimePickerProps>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export interface TimePickerPanelProps {
|
|
2
|
+
dataTest: string;
|
|
3
|
+
value?: Date;
|
|
4
|
+
onSelect: (date: Date | undefined) => void;
|
|
5
|
+
handleClear: () => void;
|
|
6
|
+
onConfirm: () => void;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Hour/minute columns + eraser/confirm footer — the inner picker surface shared by the desktop
|
|
10
|
+
* popper (`TimePickerPopper`) and the mobile bottom-sheet drawer (`StyledTimePicker`).
|
|
11
|
+
*/
|
|
12
|
+
export declare const TimePickerPanel: React.FC<TimePickerPanelProps>;
|