@temp-spotwork/ui 1.4.7 → 1.5.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/atoms/avatar/Avatar.stories.js +1 -1
- package/dist/components/atoms/badge/badge.stories.js +1 -1
- package/dist/components/atoms/card-content/label-value-pair/label-value-pair.stories.js +1 -1
- package/dist/components/atoms/form/chips/chips.stories.js +1 -1
- package/dist/components/atoms/form/dropdown-search/dropdown-search.stories.js +1 -1
- package/dist/components/atoms/form/stepper/Stepper.stories.js +1 -1
- package/dist/components/atoms/form/textarea/RichTextarea.stories.d.ts +11 -0
- package/dist/components/atoms/form/textarea/RichTextarea.stories.js +67 -0
- package/dist/components/atoms/form/textarea/Textarea.stories.d.ts +4 -0
- package/dist/components/atoms/form/textarea/Textarea.stories.js +57 -12
- package/dist/components/atoms/form/textarea/index.d.ts +2 -0
- package/dist/components/atoms/form/textarea/index.js +2 -0
- package/dist/components/atoms/form/textarea/rich-textarea.d.ts +53 -0
- package/dist/components/atoms/form/textarea/rich-textarea.js +275 -0
- package/dist/components/atoms/form/textarea/textarea.js +1 -5
- package/dist/components/atoms/form/time-picker/time-picker-dropdown.d.ts +5 -0
- package/dist/components/atoms/form/time-picker/time-picker-dropdown.js +78 -59
- package/dist/components/atoms/form/time-picker/time-picker-input.d.ts +9 -0
- package/dist/components/atoms/form/time-picker/time-picker-input.js +39 -36
- package/dist/components/atoms/form/time-picker/time-picker.d.ts +16 -0
- package/dist/components/atoms/form/time-picker/time-picker.js +39 -33
- package/dist/components/atoms/form/time-picker/time-picker.stories.d.ts +7 -0
- package/dist/components/atoms/form/time-picker/time-picker.stories.js +197 -87
- package/dist/components/atoms/icons/icons.stories.js +1 -1
- package/dist/components/atoms/message/message.stories.js +1 -1
- package/dist/components/atoms/small-large-text/small-large-text.js +3 -2
- package/dist/components/atoms/tab/Tab.stories.js +1 -1
- package/dist/components/molecules/alert/alert.js +3 -2
- package/dist/components/molecules/button/Button.stories.js +1 -1
- package/dist/components/molecules/collapsible-card/Collapsiblecard.stories.js +1 -1
- package/dist/components/molecules/conversation/message-editor/MessageEditor.stories.js +1 -1
- package/dist/components/molecules/conversation/message-group-composer/MessageGroupComposer.stories.js +1 -1
- package/dist/components/molecules/datatables/cell/Cell.stories.js +1 -1
- package/dist/components/molecules/datatables/row/Row.stories.js +1 -1
- package/dist/components/molecules/datatables/row-header/RowHeader.stories.js +1 -1
- package/dist/components/molecules/dataviz/donut-chart/DonutChart.stories.js +1 -1
- package/dist/components/molecules/dataviz/dot-matrix/DotMatrix.stories.js +1 -1
- package/dist/components/molecules/dataviz/single-stacked-bar/SingleStackedBar.stories.js +1 -1
- package/dist/components/molecules/dialog/dialog.d.ts +4 -1
- package/dist/components/molecules/dialog/dialog.js +22 -18
- package/dist/components/molecules/dialog/dialog.stories.d.ts +9 -0
- package/dist/components/molecules/dialog/dialog.stories.js +57 -0
- package/dist/components/molecules/drawer/drawer.js +13 -12
- package/dist/components/molecules/filter/date-selector/DateSelector.stories.d.ts +4 -0
- package/dist/components/molecules/filter/date-selector/DateSelector.stories.js +64 -11
- package/dist/components/molecules/filter/date-selector/date-selector.d.ts +6 -1
- package/dist/components/molecules/filter/date-selector/date-selector.js +75 -68
- package/dist/components/molecules/filter/range-selector/RangeSelector.stories.js +1 -1
- package/dist/components/molecules/form/radiogroup/radiogroup.stories.js +1 -1
- package/dist/components/molecules/link/Link.stories.js +1 -1
- package/dist/components/molecules/navigation/header/Header.stories.js +1 -1
- package/dist/components/molecules/notifications/content/Content.stories.js +1 -1
- package/dist/components/molecules/snackbar/Snackbar.stories.js +1 -1
- package/dist/components/molecules/snackbar/index.js +1 -1
- package/dist/components/molecules/snackbar/snackbar.js +3 -2
- package/dist/components/molecules/tab-group/tabgroup.stories.js +1 -1
- package/dist/{index-DfdAzObv.js → index-CktvVE7I.js} +4 -1
- package/dist/main.d.ts +2 -0
- package/dist/main.js +107 -105
- package/dist/{snackbar-BaF8Ts3S.js → snackbar-CgqDB5xn.js} +5 -4
- package/package.json +1 -1
|
@@ -1,66 +1,78 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { forwardRef as
|
|
1
|
+
import { jsxs as P, jsx as l } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as V, useRef as h, useState as j, useImperativeHandle as W, useEffect as b } from "react";
|
|
3
3
|
import { Typography as x } from "../../../styles/typography/typography.js";
|
|
4
|
-
import { m as
|
|
4
|
+
import { m as q } from "../../../../index-CYyrKZeH.js";
|
|
5
5
|
import { t as S } from "../../../../bundle-mjs-CAy1p0fn.js";
|
|
6
|
-
import { Icons as
|
|
6
|
+
import { Icons as k } from "../../icons/icons.js";
|
|
7
7
|
import "../../icons/iconsSVGs/Large/Profile.js";
|
|
8
8
|
import "../../icons/iconsSVGs/Small/Profile.js";
|
|
9
|
-
import { outlinedBorder as
|
|
9
|
+
import { outlinedBorder as F } from "../../../styles/defaults/defaults.js";
|
|
10
10
|
import { t as d } from "../../../../toDate-DF9e2eS8.js";
|
|
11
|
-
import { i as
|
|
12
|
-
import { m as
|
|
13
|
-
function
|
|
11
|
+
import { i as G } from "../../../../isBefore-D0yKF9R5.js";
|
|
12
|
+
import { m as J } from "../../../../constants-BfMb81ht.js";
|
|
13
|
+
function K(t) {
|
|
14
14
|
return (r) => {
|
|
15
15
|
const n = Math[t], s = n(r);
|
|
16
16
|
return s === 0 ? 0 : s;
|
|
17
17
|
};
|
|
18
18
|
}
|
|
19
|
-
function
|
|
19
|
+
function Q(t, r) {
|
|
20
20
|
return +d(t) - +d(r);
|
|
21
21
|
}
|
|
22
|
-
function
|
|
23
|
-
const s =
|
|
24
|
-
return
|
|
22
|
+
function X(t, r, n) {
|
|
23
|
+
const s = Q(t, r) / J;
|
|
24
|
+
return K(n == null ? void 0 : n.roundingMethod)(s);
|
|
25
25
|
}
|
|
26
|
-
function
|
|
26
|
+
function L(t) {
|
|
27
27
|
const r = d(t);
|
|
28
28
|
return r.setSeconds(0, 0), r;
|
|
29
29
|
}
|
|
30
|
-
function
|
|
30
|
+
function Y(t, r) {
|
|
31
31
|
const n = d(t), s = d(r);
|
|
32
32
|
return n.getTime() > s.getTime();
|
|
33
33
|
}
|
|
34
|
-
function
|
|
35
|
-
const n =
|
|
34
|
+
function Z(t, r) {
|
|
35
|
+
const n = L(t), s = L(r);
|
|
36
36
|
return +n == +s;
|
|
37
37
|
}
|
|
38
|
-
const
|
|
39
|
-
({
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
38
|
+
const me = V(
|
|
39
|
+
({
|
|
40
|
+
isOpened: t,
|
|
41
|
+
value: r,
|
|
42
|
+
onOptionClick: n,
|
|
43
|
+
timezone: s,
|
|
44
|
+
dateToCompare: M,
|
|
45
|
+
notRenderTimeDifference: $,
|
|
46
|
+
label: y,
|
|
47
|
+
min: I,
|
|
48
|
+
max: T,
|
|
49
|
+
options: w,
|
|
50
|
+
dropdownPlacement: B = "bottom"
|
|
51
|
+
}, O) => {
|
|
52
|
+
const c = h(null), f = h(null), i = h(), a = h(1), [A, C] = j(!1), [H, N] = j(!1), R = () => {
|
|
53
|
+
if (c.current && f.current) {
|
|
54
|
+
const e = c.current.clientHeight, o = f.current.offsetTop, u = f.current.clientHeight, U = o - (e - -20 * 2) / 2 + u / 2, _ = c.current.scrollHeight - e, z = Math.max(0, Math.min(U, _));
|
|
55
|
+
c.current.scrollTop = z;
|
|
44
56
|
}
|
|
45
57
|
};
|
|
46
|
-
|
|
47
|
-
scrollToSelectedValue:
|
|
58
|
+
W(O, () => ({
|
|
59
|
+
scrollToSelectedValue: R
|
|
48
60
|
})), b(() => {
|
|
49
|
-
t &&
|
|
61
|
+
t && R();
|
|
50
62
|
}, [t, r]), b(() => {
|
|
51
|
-
const e =
|
|
63
|
+
const e = c.current;
|
|
52
64
|
if (!e) return;
|
|
53
65
|
const o = () => {
|
|
54
|
-
|
|
66
|
+
C(e.scrollTop === 0), N(e.scrollTop === e.scrollHeight - e.clientHeight);
|
|
55
67
|
};
|
|
56
68
|
return o(), e.addEventListener("scroll", o), () => {
|
|
57
69
|
e.removeEventListener("scroll", o);
|
|
58
70
|
};
|
|
59
|
-
}, [t,
|
|
71
|
+
}, [t, C, N]);
|
|
60
72
|
const m = (e) => {
|
|
61
|
-
if (
|
|
73
|
+
if (c.current) {
|
|
62
74
|
const u = 2 * a.current;
|
|
63
|
-
|
|
75
|
+
c.current.scrollTop += e === "up" ? -u : u;
|
|
64
76
|
}
|
|
65
77
|
}, D = (e) => {
|
|
66
78
|
a.current = 0.5, m(e), i.current = setInterval(() => {
|
|
@@ -72,21 +84,28 @@ const de = z(
|
|
|
72
84
|
b(() => () => {
|
|
73
85
|
i.current && clearInterval(i.current);
|
|
74
86
|
}, []);
|
|
75
|
-
const
|
|
76
|
-
const u =
|
|
87
|
+
const E = (e, o) => {
|
|
88
|
+
const u = X(e, o, {
|
|
77
89
|
roundingMethod: "round"
|
|
78
|
-
}),
|
|
79
|
-
return
|
|
80
|
-
},
|
|
81
|
-
return t ? /* @__PURE__ */
|
|
90
|
+
}), v = Math.round(u * 100 / 60) / 100;
|
|
91
|
+
return v <= 0 ? "" : `+${v} hours`;
|
|
92
|
+
}, g = (e) => !!(I && G(e, I) || T && Y(e, T));
|
|
93
|
+
return t ? /* @__PURE__ */ P(
|
|
82
94
|
"div",
|
|
83
95
|
{
|
|
96
|
+
"data-testid": "time-picker-dropdown",
|
|
84
97
|
className: S(
|
|
85
|
-
"absolute
|
|
86
|
-
|
|
98
|
+
"absolute bg-surface-default rounded-lg border-[0.15rem] outline-none w-[20rem] p-md",
|
|
99
|
+
{
|
|
100
|
+
top: "bottom-full left-0 mb-1",
|
|
101
|
+
bottom: "top-full left-0 mt-1",
|
|
102
|
+
left: "top-0 right-full mr-1",
|
|
103
|
+
right: "top-0 left-full ml-1"
|
|
104
|
+
}[B],
|
|
105
|
+
F.active
|
|
87
106
|
),
|
|
88
107
|
children: [
|
|
89
|
-
/* @__PURE__ */
|
|
108
|
+
/* @__PURE__ */ l(
|
|
90
109
|
"button",
|
|
91
110
|
{
|
|
92
111
|
type: "button",
|
|
@@ -96,22 +115,22 @@ const de = z(
|
|
|
96
115
|
onMouseUp: p,
|
|
97
116
|
onMouseLeave: p,
|
|
98
117
|
disabled: A,
|
|
99
|
-
children: /* @__PURE__ */
|
|
118
|
+
children: /* @__PURE__ */ l(k, { id: `${y}-dropdown-scroll-up`, disabled: !0, icon: "ChevronUp", color: A ? "disabled" : "active" })
|
|
100
119
|
}
|
|
101
120
|
),
|
|
102
|
-
/* @__PURE__ */
|
|
121
|
+
/* @__PURE__ */ l(
|
|
103
122
|
"div",
|
|
104
123
|
{
|
|
105
|
-
ref:
|
|
124
|
+
ref: c,
|
|
106
125
|
className: "max-h-[20rem] overflow-y-auto flex flex-col gap-xs",
|
|
107
126
|
style: { scrollbarWidth: "none", msOverflowStyle: "none" },
|
|
108
127
|
children: w == null ? void 0 : w.map((e) => {
|
|
109
128
|
if (typeof e == "string")
|
|
110
|
-
return /* @__PURE__ */
|
|
129
|
+
return /* @__PURE__ */ l(
|
|
111
130
|
"div",
|
|
112
131
|
{
|
|
113
132
|
className: S("flex flex-row items-center gap-xs justify-between py-xxs px-sm"),
|
|
114
|
-
children: /* @__PURE__ */
|
|
133
|
+
children: /* @__PURE__ */ l(
|
|
115
134
|
x,
|
|
116
135
|
{
|
|
117
136
|
swStyle: 1,
|
|
@@ -124,33 +143,33 @@ const de = z(
|
|
|
124
143
|
`dropdown-option-${e}`
|
|
125
144
|
);
|
|
126
145
|
{
|
|
127
|
-
const o =
|
|
128
|
-
return /* @__PURE__ */
|
|
146
|
+
const o = Z(e, r);
|
|
147
|
+
return /* @__PURE__ */ P(
|
|
129
148
|
"div",
|
|
130
149
|
{
|
|
131
150
|
ref: o ? f : null,
|
|
132
151
|
className: S(
|
|
133
152
|
"flex flex-row items-center gap-xs justify-between py-xxs px-sm rounded cursor-pointer hover:bg-surface-active hover:outline-none focus:bg-surface-active focus:outline-none",
|
|
134
153
|
o && "bg-surface-active",
|
|
135
|
-
|
|
154
|
+
g(e) && "cursor-not-allowed"
|
|
136
155
|
),
|
|
137
156
|
onClick: () => n(e),
|
|
138
157
|
children: [
|
|
139
|
-
/* @__PURE__ */
|
|
158
|
+
/* @__PURE__ */ l(
|
|
140
159
|
x,
|
|
141
160
|
{
|
|
142
161
|
swStyle: 5,
|
|
143
|
-
children:
|
|
144
|
-
color:
|
|
162
|
+
children: q(e).tz(s).format("hh:mm A"),
|
|
163
|
+
color: g(e) ? "disabled" : o ? "active" : "default",
|
|
145
164
|
className: "whitespace-nowrap overflow-hidden text-ellipsis"
|
|
146
165
|
}
|
|
147
166
|
),
|
|
148
|
-
M &&
|
|
167
|
+
M && !$ && /* @__PURE__ */ l(
|
|
149
168
|
x,
|
|
150
169
|
{
|
|
151
170
|
swStyle: 1,
|
|
152
|
-
children:
|
|
153
|
-
color:
|
|
171
|
+
children: E(e, M),
|
|
172
|
+
color: g(e) ? "disabled" : o ? "active" : "default",
|
|
154
173
|
className: "whitespace-nowrap overflow-hidden text-ellipsis"
|
|
155
174
|
}
|
|
156
175
|
)
|
|
@@ -162,7 +181,7 @@ const de = z(
|
|
|
162
181
|
})
|
|
163
182
|
}
|
|
164
183
|
),
|
|
165
|
-
/* @__PURE__ */
|
|
184
|
+
/* @__PURE__ */ l(
|
|
166
185
|
"button",
|
|
167
186
|
{
|
|
168
187
|
type: "button",
|
|
@@ -171,14 +190,14 @@ const de = z(
|
|
|
171
190
|
onMouseDown: () => D("down"),
|
|
172
191
|
onMouseUp: p,
|
|
173
192
|
onMouseLeave: p,
|
|
174
|
-
disabled:
|
|
175
|
-
children: /* @__PURE__ */
|
|
176
|
-
|
|
193
|
+
disabled: H,
|
|
194
|
+
children: /* @__PURE__ */ l(
|
|
195
|
+
k,
|
|
177
196
|
{
|
|
178
197
|
id: `${y}-dropdown-scroll-down`,
|
|
179
198
|
disabled: !0,
|
|
180
199
|
icon: "ChevronDown",
|
|
181
|
-
color:
|
|
200
|
+
color: H ? "disabled" : "active"
|
|
182
201
|
}
|
|
183
202
|
)
|
|
184
203
|
}
|
|
@@ -189,5 +208,5 @@ const de = z(
|
|
|
189
208
|
}
|
|
190
209
|
);
|
|
191
210
|
export {
|
|
192
|
-
|
|
211
|
+
me as TimePickerDropdown
|
|
193
212
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
+
import { SvgKey } from '../../icons/iconMap';
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* TimePickerInput Component
|
|
@@ -102,6 +103,14 @@ type TimePickerInputProps = {
|
|
|
102
103
|
* The list of possible values for the input.
|
|
103
104
|
*/
|
|
104
105
|
options: (Date | string)[];
|
|
106
|
+
/**
|
|
107
|
+
* Optional height for the input button container.
|
|
108
|
+
*/
|
|
109
|
+
inputHeight: string;
|
|
110
|
+
/**
|
|
111
|
+
* Optional icon rendered on the right side of the input.
|
|
112
|
+
*/
|
|
113
|
+
icon?: SvgKey;
|
|
105
114
|
};
|
|
106
115
|
export declare const TimePickerInput: React.ForwardRefExoticComponent<TimePickerInputProps & React.RefAttributes<HTMLButtonElement>>;
|
|
107
116
|
export {};
|
|
@@ -1,48 +1,50 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { forwardRef as
|
|
1
|
+
import { jsxs as X, jsx as M } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as Y, useRef as z, useState as B, useEffect as I, useCallback as O } from "react";
|
|
3
3
|
import "../../../../purify.es-eYFoHPwR.js";
|
|
4
|
-
import { styleMap as
|
|
4
|
+
import { styleMap as ee } from "../../../styles/typography/style.js";
|
|
5
5
|
import "../../../styles/colors/colormap.js";
|
|
6
|
-
import { t as
|
|
7
|
-
import { Icons as
|
|
6
|
+
import { t as L } from "../../../../bundle-mjs-CAy1p0fn.js";
|
|
7
|
+
import { Icons as te } from "../../icons/icons.js";
|
|
8
8
|
import "../../icons/iconsSVGs/Large/Profile.js";
|
|
9
9
|
import "../../icons/iconsSVGs/Small/Profile.js";
|
|
10
|
-
import { outlinedBorder as
|
|
10
|
+
import { outlinedBorder as P } from "../../../styles/defaults/defaults.js";
|
|
11
11
|
import { m as c } from "../../../../index-CYyrKZeH.js";
|
|
12
|
-
import { getLabelColor as
|
|
13
|
-
const
|
|
12
|
+
import { getLabelColor as se, getBorderClasses as ne } from "../utils-for-forms/state-functions.js";
|
|
13
|
+
const de = Y(
|
|
14
14
|
({
|
|
15
15
|
value: o,
|
|
16
16
|
error: v = !1,
|
|
17
17
|
warning: A = !1,
|
|
18
18
|
disabled: f = !1,
|
|
19
|
-
label:
|
|
19
|
+
label: U,
|
|
20
20
|
isOpened: r,
|
|
21
21
|
focus: T,
|
|
22
|
-
onFocus:
|
|
22
|
+
onFocus: $,
|
|
23
23
|
onBlur: m,
|
|
24
24
|
setIsOpened: _,
|
|
25
25
|
selectValue: N,
|
|
26
26
|
onScrollToSelectedValue: E,
|
|
27
|
-
autoFocus:
|
|
27
|
+
autoFocus: K = !1,
|
|
28
28
|
step: R = 5,
|
|
29
29
|
min: p,
|
|
30
30
|
max: y,
|
|
31
31
|
timezone: i,
|
|
32
|
-
options: S
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
options: S,
|
|
33
|
+
inputHeight: Z,
|
|
34
|
+
icon: j
|
|
35
|
+
}, q) => {
|
|
36
|
+
const g = "__:__ __", V = z(null), [n, a] = B(c(o).tz(i).format("hh:mm A")), F = se(r || T, A, v, f), G = ne(T || r, A, v, f), H = f ? `bg-surface-disabled ${P.disabled}` : "", J = () => {
|
|
35
37
|
_(!0), r || setTimeout(() => {
|
|
36
38
|
var e;
|
|
37
39
|
(e = V.current) == null || e.select();
|
|
38
40
|
}, 0);
|
|
39
|
-
},
|
|
41
|
+
}, Q = () => {
|
|
40
42
|
m == null || m();
|
|
41
43
|
};
|
|
42
|
-
|
|
44
|
+
I(() => {
|
|
43
45
|
r || a(c(o).tz(i).format("hh:mm A"));
|
|
44
46
|
}, [r, o]);
|
|
45
|
-
const
|
|
47
|
+
const x = O(
|
|
46
48
|
(e) => {
|
|
47
49
|
if (r)
|
|
48
50
|
try {
|
|
@@ -62,10 +64,10 @@ const pe = W(
|
|
|
62
64
|
},
|
|
63
65
|
[r, S, i, p, y, N, E, R, o]
|
|
64
66
|
);
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
}, [n, r, S, i, p, y,
|
|
68
|
-
const
|
|
67
|
+
I(() => {
|
|
68
|
+
x(n);
|
|
69
|
+
}, [n, r, S, i, p, y, x]);
|
|
70
|
+
const W = (e) => {
|
|
69
71
|
var h;
|
|
70
72
|
if (e.key === "Enter" || e.key === "Escape" || e.key === "Tab") {
|
|
71
73
|
a(c(o).tz(i).format("hh:mm A")), e.key === "Escape" && ((h = V.current) == null || h.blur(), e.target.selectionStart = 0, e.target.selectionEnd = 0, m == null || m(), _(!1));
|
|
@@ -204,18 +206,19 @@ const pe = W(
|
|
|
204
206
|
}, 0);
|
|
205
207
|
}
|
|
206
208
|
};
|
|
207
|
-
return /* @__PURE__ */
|
|
209
|
+
return /* @__PURE__ */ X(
|
|
208
210
|
"button",
|
|
209
211
|
{
|
|
210
|
-
ref:
|
|
212
|
+
ref: q,
|
|
211
213
|
type: "button",
|
|
212
|
-
autoFocus:
|
|
213
|
-
className:
|
|
214
|
-
"px-md
|
|
215
|
-
|
|
216
|
-
|
|
214
|
+
autoFocus: K,
|
|
215
|
+
className: L(
|
|
216
|
+
"px-md w-full flex flex-row justify-between items-center gap-md",
|
|
217
|
+
G,
|
|
218
|
+
H
|
|
217
219
|
),
|
|
218
|
-
|
|
220
|
+
style: { height: Z },
|
|
221
|
+
onClick: J,
|
|
219
222
|
disabled: f,
|
|
220
223
|
children: [
|
|
221
224
|
/* @__PURE__ */ M(
|
|
@@ -225,24 +228,24 @@ const pe = W(
|
|
|
225
228
|
type: "text",
|
|
226
229
|
maxLength: 8,
|
|
227
230
|
value: n,
|
|
228
|
-
onKeyDown:
|
|
231
|
+
onKeyDown: W,
|
|
229
232
|
readOnly: !r || f || !T,
|
|
230
|
-
onFocus:
|
|
231
|
-
onBlur:
|
|
232
|
-
className:
|
|
233
|
+
onFocus: $,
|
|
234
|
+
onBlur: Q,
|
|
235
|
+
className: L(
|
|
233
236
|
"reset-input",
|
|
234
|
-
`${
|
|
237
|
+
`${P.none} ${ee[5]} bg-transparent w-full`,
|
|
235
238
|
f ? "text-glyph-disabled" : ""
|
|
236
239
|
),
|
|
237
240
|
placeholder: g
|
|
238
241
|
}
|
|
239
242
|
),
|
|
240
|
-
/* @__PURE__ */ M("div", { children: /* @__PURE__ */ M(
|
|
243
|
+
j && /* @__PURE__ */ M("div", { children: /* @__PURE__ */ M(te, { id: `${U}-clock`, disabled: !0, icon: j, color: F }) })
|
|
241
244
|
]
|
|
242
245
|
}
|
|
243
246
|
);
|
|
244
247
|
}
|
|
245
248
|
);
|
|
246
249
|
export {
|
|
247
|
-
|
|
250
|
+
de as TimePickerInput
|
|
248
251
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
+
import { SvgKey } from '../../icons/iconMap';
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* A TimePicker component that allows users to select a time using either a dropdown or direct input.
|
|
@@ -107,5 +108,20 @@ export type TimePickerProps = {
|
|
|
107
108
|
* Optional className to apply to the time picker container.
|
|
108
109
|
*/
|
|
109
110
|
className?: string;
|
|
111
|
+
/**
|
|
112
|
+
* Optional height for the time picker input button (e.g. "3rem", "48px").
|
|
113
|
+
* @default "4rem"
|
|
114
|
+
*/
|
|
115
|
+
inputHeight?: string;
|
|
116
|
+
/**
|
|
117
|
+
* Optional icon displayed at the right side of the input.
|
|
118
|
+
* @default "Clock"
|
|
119
|
+
*/
|
|
120
|
+
icon?: SvgKey;
|
|
121
|
+
/**
|
|
122
|
+
* Controls where the dropdown opens relative to the input trigger.
|
|
123
|
+
* @default "bottom"
|
|
124
|
+
*/
|
|
125
|
+
dropdownPlacement?: 'top' | 'bottom' | 'left' | 'right';
|
|
110
126
|
};
|
|
111
127
|
export declare const TimePicker: React.ForwardRefExoticComponent<TimePickerProps & React.RefAttributes<HTMLButtonElement>>;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { jsxs as A, jsx as S } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
3
|
-
import { Typography as
|
|
4
|
-
import { getLabelColor as
|
|
5
|
-
import { FormHelperText as
|
|
6
|
-
import { TimePickerInput as
|
|
7
|
-
import { TimePickerDropdown as
|
|
2
|
+
import W, { useState as Y, useEffect as P, useRef as x, useMemo as X } from "react";
|
|
3
|
+
import { Typography as Z } from "../../../styles/typography/typography.js";
|
|
4
|
+
import { getLabelColor as B, getHelperTextColor as b } from "../utils-for-forms/state-functions.js";
|
|
5
|
+
import { FormHelperText as ee } from "../form-helper-text/form-helper-text.js";
|
|
6
|
+
import { TimePickerInput as te } from "./time-picker-input.js";
|
|
7
|
+
import { TimePickerDropdown as oe } from "./time-picker-dropdown.js";
|
|
8
8
|
import { m as n } from "../../../../index-CYyrKZeH.js";
|
|
9
|
-
import { t as
|
|
10
|
-
const
|
|
9
|
+
import { t as ne } from "../../../../bundle-mjs-CAy1p0fn.js";
|
|
10
|
+
const pe = W.forwardRef(
|
|
11
11
|
({
|
|
12
12
|
value: c,
|
|
13
13
|
selectValue: O,
|
|
@@ -25,11 +25,14 @@ const fe = K.forwardRef(
|
|
|
25
25
|
dateToCompare: p,
|
|
26
26
|
daySeparatorFormat: z = "literal",
|
|
27
27
|
notRenderTimeDifference: N = !1,
|
|
28
|
-
className: _
|
|
29
|
-
|
|
30
|
-
|
|
28
|
+
className: _,
|
|
29
|
+
inputHeight: j = "4rem",
|
|
30
|
+
icon: H = "Clock",
|
|
31
|
+
dropdownPlacement: $ = "bottom"
|
|
32
|
+
}, F) => {
|
|
33
|
+
const [d, D] = Y(!1), [a, C] = Y(c), [v, I] = Y(!1);
|
|
31
34
|
P(() => {
|
|
32
|
-
|
|
35
|
+
C(c);
|
|
33
36
|
}, [c]);
|
|
34
37
|
const T = x(null), R = x(null), o = E || n.tz.guess();
|
|
35
38
|
P(() => {
|
|
@@ -38,19 +41,19 @@ const fe = K.forwardRef(
|
|
|
38
41
|
};
|
|
39
42
|
return document.addEventListener("mousedown", t), () => document.removeEventListener("mousedown", t);
|
|
40
43
|
}, [d, a, O]);
|
|
41
|
-
const
|
|
44
|
+
const q = B(d || v, m, f, h), G = b(m, f, h), J = (t) => {
|
|
42
45
|
O(t), D(!1);
|
|
43
|
-
},
|
|
46
|
+
}, K = () => {
|
|
44
47
|
var t;
|
|
45
48
|
(t = R.current) == null || t.scrollToSelectedValue();
|
|
46
|
-
}, V =
|
|
47
|
-
const t = p ? n.tz(p, o) : null, r = n.tz(c, o),
|
|
48
|
-
let e =
|
|
49
|
+
}, V = X(() => {
|
|
50
|
+
const t = p ? n.tz(p, o) : null, r = n.tz(c, o), Q = s ? n.tz(s, o) : r.startOf("day"), w = l ? n.tz(l, o) : r.endOf("day");
|
|
51
|
+
let e = Q;
|
|
49
52
|
if (s) {
|
|
50
53
|
const g = e.minutes() % i;
|
|
51
54
|
if (g !== 0) {
|
|
52
|
-
const
|
|
53
|
-
e = e.add(
|
|
55
|
+
const U = i - g;
|
|
56
|
+
e = e.add(U, "minutes");
|
|
54
57
|
}
|
|
55
58
|
}
|
|
56
59
|
const M = /* @__PURE__ */ new Set([]);
|
|
@@ -62,22 +65,22 @@ const fe = K.forwardRef(
|
|
|
62
65
|
), e.isSameOrBefore(w) && M.add(e.toDate()), e = n(e).tz(o).add(i, "minutes");
|
|
63
66
|
return Array.from(M);
|
|
64
67
|
}, [c, i, s, l, p, z, o]);
|
|
65
|
-
return /* @__PURE__ */ A("div", { className:
|
|
66
|
-
u && /* @__PURE__ */ S(
|
|
68
|
+
return /* @__PURE__ */ A("div", { className: ne("w-[13.5rem]", _), children: [
|
|
69
|
+
u && /* @__PURE__ */ S(Z, { swStyle: 3, color: q, children: u }),
|
|
67
70
|
/* @__PURE__ */ A("div", { className: "relative", ref: T, id: a.toISOString() + Math.random(), children: [
|
|
68
71
|
/* @__PURE__ */ S(
|
|
69
|
-
|
|
72
|
+
te,
|
|
70
73
|
{
|
|
71
|
-
ref:
|
|
74
|
+
ref: F,
|
|
72
75
|
value: a,
|
|
73
76
|
options: V,
|
|
74
|
-
selectValue:
|
|
77
|
+
selectValue: C,
|
|
75
78
|
error: f,
|
|
76
79
|
warning: m,
|
|
77
80
|
disabled: h,
|
|
78
81
|
label: u,
|
|
79
82
|
isOpened: d,
|
|
80
|
-
focus:
|
|
83
|
+
focus: v,
|
|
81
84
|
onFocus: () => I(!0),
|
|
82
85
|
onBlur: () => {
|
|
83
86
|
I(!1), y == null || y();
|
|
@@ -85,42 +88,45 @@ const fe = K.forwardRef(
|
|
|
85
88
|
setIsOpened: D,
|
|
86
89
|
autoFocus: L,
|
|
87
90
|
step: i,
|
|
88
|
-
onScrollToSelectedValue:
|
|
91
|
+
onScrollToSelectedValue: K,
|
|
89
92
|
min: s,
|
|
90
93
|
max: l,
|
|
91
|
-
timezone: o
|
|
94
|
+
timezone: o,
|
|
95
|
+
inputHeight: j,
|
|
96
|
+
icon: H
|
|
92
97
|
}
|
|
93
98
|
),
|
|
94
99
|
/* @__PURE__ */ S(
|
|
95
|
-
|
|
100
|
+
oe,
|
|
96
101
|
{
|
|
97
102
|
ref: R,
|
|
98
103
|
isOpened: d,
|
|
99
104
|
value: a,
|
|
100
105
|
timezone: o,
|
|
101
|
-
onOptionClick:
|
|
106
|
+
onOptionClick: J,
|
|
102
107
|
dateToCompare: p,
|
|
103
108
|
notRenderTimeDifference: N,
|
|
104
109
|
label: u,
|
|
105
110
|
min: s,
|
|
106
111
|
max: l,
|
|
107
112
|
step: i,
|
|
108
|
-
options: V
|
|
113
|
+
options: V,
|
|
114
|
+
dropdownPlacement: $
|
|
109
115
|
}
|
|
110
116
|
)
|
|
111
117
|
] }),
|
|
112
118
|
k && /* @__PURE__ */ S(
|
|
113
|
-
|
|
119
|
+
ee,
|
|
114
120
|
{
|
|
115
121
|
helperText: k,
|
|
116
122
|
warning: m,
|
|
117
123
|
error: f,
|
|
118
|
-
helperTextAndIconColor:
|
|
124
|
+
helperTextAndIconColor: G
|
|
119
125
|
}
|
|
120
126
|
)
|
|
121
127
|
] });
|
|
122
128
|
}
|
|
123
129
|
);
|
|
124
130
|
export {
|
|
125
|
-
|
|
131
|
+
pe as TimePicker
|
|
126
132
|
};
|
|
@@ -28,3 +28,10 @@ export declare const MidnightMinus1Hour: Story;
|
|
|
28
28
|
export declare const MidnightMinus1HourAnd18HoursMaxUpperBound: Story;
|
|
29
29
|
export declare const Noon: Story;
|
|
30
30
|
export declare const FifteenMinutesStep: Story;
|
|
31
|
+
export declare const CustomInputHeight: Story;
|
|
32
|
+
export declare const WithoutIcon: Story;
|
|
33
|
+
export declare const WithCustomIcon: Story;
|
|
34
|
+
export declare const DropdownOpensBottom: Story;
|
|
35
|
+
export declare const DropdownOpensTop: Story;
|
|
36
|
+
export declare const DropdownOpensLeft: Story;
|
|
37
|
+
export declare const DropdownOpensRight: Story;
|