@wipco/sdui 0.50.1 → 1.0.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/{DatePicker-BK_jsV7i.d.ts → DatePicker-C_TT_SOw.d.ts} +25 -0
- package/dist/{chunk-OEWTVLPZ.js → chunk-2HLXCKK7.js} +2 -2
- package/dist/{chunk-PWVHAUJC.js → chunk-2YP5N4VV.js} +6 -4
- package/dist/{chunk-QTHYLNJW.js → chunk-37SFFW37.js} +2 -13
- package/dist/{chunk-YQOMSWW5.js → chunk-5WW4MBRO.js} +1 -1
- package/dist/{chunk-LIOS3PF2.js → chunk-5XPZ3RSA.js} +3 -4
- package/dist/{chunk-ZD3VNVRF.js → chunk-7BGDSSAN.js} +5 -13
- package/dist/{chunk-Y2LIEWQX.js → chunk-7FZTUI6U.js} +6 -5
- package/dist/{chunk-HJ5VSXR4.js → chunk-7P7N43JV.js} +2 -2
- package/dist/{chunk-55VB6SDU.js → chunk-A5XQOEVH.js} +23 -20
- package/dist/{chunk-77LKJCMM.js → chunk-A6LAIGUS.js} +20 -108
- package/dist/{chunk-YXS5FXVS.js → chunk-AC5TI3BE.js} +7 -16
- package/dist/{chunk-AIOJYVJ2.js → chunk-AXGF4M57.js} +1 -1
- package/dist/{chunk-5MPK3NZK.js → chunk-B6WMC2AN.js} +3 -3
- package/dist/{chunk-C6ZV4VBN.js → chunk-C37U3GCC.js} +4 -4
- package/dist/{chunk-265YPW4W.js → chunk-DMLDKW7K.js} +1 -1
- package/dist/{chunk-FZ72IDVF.js → chunk-E6ISNQK3.js} +2 -2
- package/dist/{chunk-STX2AX6Y.js → chunk-FLAN7CV3.js} +7 -39
- package/dist/{chunk-IV5YTVHR.js → chunk-GE6BYNQJ.js} +18 -33
- package/dist/{chunk-ZX36LKJ7.js → chunk-GTGS2QRL.js} +7 -6
- package/dist/{chunk-NL3I6F2I.js → chunk-HBBTENSV.js} +3 -3
- package/dist/{chunk-RUU7WBGR.js → chunk-I45EUZC6.js} +19 -9
- package/dist/{chunk-JBKNIALK.js → chunk-I5SD7XRA.js} +9 -6
- package/dist/{chunk-X7GHY2RI.js → chunk-IFKYGJXP.js} +14 -42
- package/dist/{chunk-J3YMUR6R.js → chunk-IZ3JA2BR.js} +3 -3
- package/dist/{chunk-AUW5RP24.js → chunk-JIV4YHCZ.js} +7 -6
- package/dist/{chunk-M6KM3FJS.js → chunk-JYAR7D5U.js} +2 -2
- package/dist/{chunk-DKPNFEVU.js → chunk-KO6OEY3G.js} +19 -6
- package/dist/{chunk-JHHMFL5D.js → chunk-LFEJLOFN.js} +28 -16
- package/dist/chunk-MMIGOPO5.js +111 -0
- package/dist/{chunk-YSSNP6JM.js → chunk-N25YP7ID.js} +6 -21
- package/dist/{chunk-F2W2FWOT.js → chunk-N5RKM6IC.js} +7 -7
- package/dist/{chunk-C4HYWZML.js → chunk-O4IISNE7.js} +1 -1
- package/dist/chunk-Q4SWUINA.js +51 -0
- package/dist/{chunk-TUOG7EEI.js → chunk-RNOUXUBO.js} +418 -22
- package/dist/{chunk-4VZI3PLI.js → chunk-RYHEV5E3.js} +15 -39
- package/dist/{chunk-AVRNQOB5.js → chunk-SAPBDJJQ.js} +14 -13
- package/dist/{chunk-OPJ4DYNI.js → chunk-SJ3737RA.js} +156 -158
- package/dist/{chunk-UMANGYRD.js → chunk-TFGNKFL2.js} +1 -1
- package/dist/{chunk-KYGSMUUU.js → chunk-VY7MVBSE.js} +2 -2
- package/dist/{chunk-VDBUXYEB.js → chunk-WOYMEEPH.js} +8 -8
- package/dist/{chunk-I5Z2RVDF.js → chunk-WSLT32Q4.js} +278 -30
- package/dist/{chunk-NYUHSMUU.js → chunk-XGFDY43I.js} +2 -2
- package/dist/{chunk-ODKZF4IT.js → chunk-YOZN35HD.js} +17 -9
- package/dist/{chunk-EKP6Z3G6.js → chunk-YVTV4ZV6.js} +1 -1
- package/dist/{chunk-6BCWFPNJ.js → chunk-YWUDBLO6.js} +2 -2
- package/dist/chunk-Z4PYMTTS.js +41 -0
- package/dist/{chunk-WXIQLWIX.js → chunk-ZFNFPXPR.js} +2 -2
- package/dist/{chunk-7GOWOSX6.js → chunk-ZORQPB6B.js} +11 -5
- package/dist/index.d.ts +1096 -941
- package/dist/index.js +369 -610
- package/dist/meta.d.ts +13 -12
- package/dist/meta.js +84 -16
- package/dist/rich/ExcelUploadCard.d.ts +7 -0
- package/dist/rich/ExcelUploadCard.js +17 -13
- package/dist/rich.d.ts +1 -1
- package/dist/rich.js +25 -12
- package/dist/styles.css +10 -2
- package/dist/{types-D14eqLpf.d.ts → types-C7y9CpgF.d.ts} +7 -5
- package/dist/widgets/ApprovalLineEditor.js +7 -6
- package/dist/widgets/ApprovalOverridesEditor.d.ts +11 -1
- package/dist/widgets/ApprovalOverridesEditor.js +9 -8
- package/dist/widgets/ApprovalStepper.js +3 -3
- package/dist/widgets/AutocompleteField.d.ts +1 -0
- package/dist/widgets/AutocompleteField.js +7 -6
- package/dist/widgets/ColumnBoard.js +3 -3
- package/dist/widgets/DiffView.js +3 -3
- package/dist/widgets/Disclosure.js +3 -3
- package/dist/widgets/EventCalendar.d.ts +16 -1
- package/dist/widgets/EventCalendar.js +3 -3
- package/dist/widgets/FileDropzone.js +7 -6
- package/dist/widgets/ImageLightbox.js +5 -4
- package/dist/widgets/InlineEdit.js +3 -3
- package/dist/widgets/JsonField.js +3 -3
- package/dist/widgets/LiveClock.js +2 -2
- package/dist/widgets/OptionSchemaEditor.js +4 -4
- package/dist/widgets/OptionValueFields.d.ts +5 -0
- package/dist/widgets/OptionValueFields.js +4 -4
- package/dist/widgets/OrgChart.js +4 -3
- package/dist/widgets/OrgChartBoard.d.ts +93 -4
- package/dist/widgets/OrgChartBoard.js +9 -6
- package/dist/widgets/PeriodFilter.js +4 -4
- package/dist/widgets/PermissionMatrixEditor.d.ts +16 -0
- package/dist/widgets/PermissionMatrixEditor.js +4 -4
- package/dist/widgets/PositionSelect.d.ts +6 -1
- package/dist/widgets/PositionSelect.js +5 -4
- package/dist/widgets/PrintSheet.js +3 -3
- package/dist/widgets/ProfileEditDiffCard.d.ts +6 -0
- package/dist/widgets/ProfileEditDiffCard.js +4 -4
- package/dist/widgets/QRDisplay.js +4 -4
- package/dist/widgets/RankBoard.d.ts +6 -0
- package/dist/widgets/RankBoard.js +6 -5
- package/dist/widgets/RecordSheet.js +2 -2
- package/dist/widgets/RoleMemberPicker.d.ts +11 -5
- package/dist/widgets/RoleMemberPicker.js +5 -4
- package/dist/widgets/SearchableMultiPicker.js +5 -5
- package/dist/widgets/SecureScreen.d.ts +12 -0
- package/dist/widgets/SecureScreen.js +3 -3
- package/dist/widgets/StackedMeter.js +2 -2
- package/dist/widgets/StagePeriodEditor.js +4 -5
- package/dist/widgets/Strip.js +2 -2
- package/dist/widgets/SummaryTable.js +2 -2
- package/dist/widgets/TagMultiSelect.d.ts +0 -1
- package/dist/widgets/TagMultiSelect.js +4 -4
- package/dist/widgets/Timeline.js +4 -4
- package/dist/widgets/TreePicker.js +6 -6
- package/dist/widgets/TreeView.js +5 -5
- package/dist/widgets/index.d.ts +3 -3
- package/dist/widgets/index.js +81 -79
- package/package.json +1 -1
- package/dist/chunk-EKVA7T7P.js +0 -198
package/dist/widgets/index.js
CHANGED
|
@@ -1,83 +1,85 @@
|
|
|
1
|
-
import { SecureScreen } from '../chunk-
|
|
2
|
-
export { SecureScreen } from '../chunk-
|
|
3
|
-
import { StackedMeter } from '../chunk-
|
|
4
|
-
export { StackedMeter } from '../chunk-
|
|
5
|
-
import { StagePeriodEditor } from '../chunk-
|
|
6
|
-
export { StagePeriodEditor } from '../chunk-
|
|
7
|
-
import { Strip } from '../chunk-
|
|
8
|
-
export { Strip } from '../chunk-
|
|
9
|
-
import { SummaryTable } from '../chunk-
|
|
10
|
-
export { SummaryTable } from '../chunk-
|
|
11
|
-
import { Timeline } from '../chunk-
|
|
12
|
-
export { Timeline } from '../chunk-
|
|
13
|
-
import { TreePicker } from '../chunk-
|
|
14
|
-
export { TreePicker } from '../chunk-
|
|
15
|
-
import { TreeView } from '../chunk-
|
|
16
|
-
export { TreeView, buildTreeNodes } from '../chunk-
|
|
17
|
-
import { PositionSelect } from '../chunk-
|
|
18
|
-
export { PositionSelect } from '../chunk-
|
|
19
|
-
import { PrintSheet } from '../chunk-
|
|
20
|
-
export { PrintSheet } from '../chunk-
|
|
21
|
-
import { QRDisplay } from '../chunk-
|
|
22
|
-
export { QRDisplay } from '../chunk-
|
|
23
|
-
import { ProfileEditDiffCard } from '../chunk-
|
|
24
|
-
export { ProfileEditDiffCard } from '../chunk-
|
|
25
|
-
import { RankBoard } from '../chunk-
|
|
26
|
-
export { RankBoard } from '../chunk-
|
|
27
|
-
import { RecordSheet } from '../chunk-
|
|
28
|
-
export { RecordSheet } from '../chunk-
|
|
29
|
-
import { RoleMemberPicker } from '../chunk-
|
|
30
|
-
export { RoleMemberPicker } from '../chunk-
|
|
31
|
-
import { SearchableMultiPicker } from '../chunk-
|
|
32
|
-
export { SearchableMultiPicker } from '../chunk-
|
|
33
|
-
import { JsonField } from '../chunk-
|
|
34
|
-
export { JsonField } from '../chunk-
|
|
35
|
-
import { LiveClock } from '../chunk-
|
|
36
|
-
export { LiveClock } from '../chunk-
|
|
37
|
-
import { OptionSchemaEditor } from '../chunk-
|
|
38
|
-
export { OptionSchemaEditor } from '../chunk-
|
|
39
|
-
import { OptionValueFields } from '../chunk-
|
|
40
|
-
export { OptionValueFields } from '../chunk-
|
|
41
|
-
import { OrgChart } from '../chunk-
|
|
42
|
-
export { OrgChart } from '../chunk-
|
|
43
|
-
import { OrgChartBoard } from '../chunk-
|
|
44
|
-
export { OrgChartBoard } from '../chunk-
|
|
45
|
-
import
|
|
46
|
-
|
|
47
|
-
import {
|
|
48
|
-
export {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
export {
|
|
52
|
-
import {
|
|
53
|
-
export {
|
|
54
|
-
import {
|
|
55
|
-
export {
|
|
56
|
-
import {
|
|
57
|
-
export {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
export {
|
|
61
|
-
import {
|
|
62
|
-
export {
|
|
63
|
-
import '../chunk-
|
|
64
|
-
|
|
65
|
-
import '../chunk-
|
|
66
|
-
import '../chunk-
|
|
67
|
-
import
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
import '../chunk-
|
|
1
|
+
import { SecureScreen } from '../chunk-I45EUZC6.js';
|
|
2
|
+
export { SecureScreen } from '../chunk-I45EUZC6.js';
|
|
3
|
+
import { StackedMeter } from '../chunk-JIV4YHCZ.js';
|
|
4
|
+
export { StackedMeter } from '../chunk-JIV4YHCZ.js';
|
|
5
|
+
import { StagePeriodEditor } from '../chunk-5XPZ3RSA.js';
|
|
6
|
+
export { StagePeriodEditor } from '../chunk-5XPZ3RSA.js';
|
|
7
|
+
import { Strip } from '../chunk-AXGF4M57.js';
|
|
8
|
+
export { Strip } from '../chunk-AXGF4M57.js';
|
|
9
|
+
import { SummaryTable } from '../chunk-2YP5N4VV.js';
|
|
10
|
+
export { SummaryTable } from '../chunk-2YP5N4VV.js';
|
|
11
|
+
import { Timeline } from '../chunk-GTGS2QRL.js';
|
|
12
|
+
export { Timeline } from '../chunk-GTGS2QRL.js';
|
|
13
|
+
import { TreePicker } from '../chunk-7BGDSSAN.js';
|
|
14
|
+
export { TreePicker } from '../chunk-7BGDSSAN.js';
|
|
15
|
+
import { TreeView } from '../chunk-C37U3GCC.js';
|
|
16
|
+
export { TreeView, buildTreeNodes } from '../chunk-C37U3GCC.js';
|
|
17
|
+
import { PositionSelect } from '../chunk-IFKYGJXP.js';
|
|
18
|
+
export { PositionSelect } from '../chunk-IFKYGJXP.js';
|
|
19
|
+
import { PrintSheet } from '../chunk-E6ISNQK3.js';
|
|
20
|
+
export { PrintSheet } from '../chunk-E6ISNQK3.js';
|
|
21
|
+
import { QRDisplay } from '../chunk-IZ3JA2BR.js';
|
|
22
|
+
export { QRDisplay } from '../chunk-IZ3JA2BR.js';
|
|
23
|
+
import { ProfileEditDiffCard } from '../chunk-YOZN35HD.js';
|
|
24
|
+
export { ProfileEditDiffCard } from '../chunk-YOZN35HD.js';
|
|
25
|
+
import { RankBoard } from '../chunk-RYHEV5E3.js';
|
|
26
|
+
export { RankBoard } from '../chunk-RYHEV5E3.js';
|
|
27
|
+
import { RecordSheet } from '../chunk-O4IISNE7.js';
|
|
28
|
+
export { RecordSheet } from '../chunk-O4IISNE7.js';
|
|
29
|
+
import { RoleMemberPicker } from '../chunk-A5XQOEVH.js';
|
|
30
|
+
export { RoleMemberPicker } from '../chunk-A5XQOEVH.js';
|
|
31
|
+
import { SearchableMultiPicker } from '../chunk-AC5TI3BE.js';
|
|
32
|
+
export { SearchableMultiPicker } from '../chunk-AC5TI3BE.js';
|
|
33
|
+
import { JsonField } from '../chunk-ZFNFPXPR.js';
|
|
34
|
+
export { JsonField } from '../chunk-ZFNFPXPR.js';
|
|
35
|
+
import { LiveClock } from '../chunk-DMLDKW7K.js';
|
|
36
|
+
export { LiveClock } from '../chunk-DMLDKW7K.js';
|
|
37
|
+
import { OptionSchemaEditor } from '../chunk-B6WMC2AN.js';
|
|
38
|
+
export { OPTION_TYPES, OptionSchemaEditor } from '../chunk-B6WMC2AN.js';
|
|
39
|
+
import { OptionValueFields } from '../chunk-7FZTUI6U.js';
|
|
40
|
+
export { OptionValueFields } from '../chunk-7FZTUI6U.js';
|
|
41
|
+
import { OrgChart } from '../chunk-A6LAIGUS.js';
|
|
42
|
+
export { OrgChart } from '../chunk-A6LAIGUS.js';
|
|
43
|
+
import { OrgChartBoard } from '../chunk-SJ3737RA.js';
|
|
44
|
+
export { OrgChartBoard } from '../chunk-SJ3737RA.js';
|
|
45
|
+
import '../chunk-Z4PYMTTS.js';
|
|
46
|
+
import '../chunk-MMIGOPO5.js';
|
|
47
|
+
import { PermissionMatrixEditor } from '../chunk-LFEJLOFN.js';
|
|
48
|
+
export { PermissionMatrixEditor } from '../chunk-LFEJLOFN.js';
|
|
49
|
+
import { PeriodFilter } from '../chunk-HBBTENSV.js';
|
|
50
|
+
export { PeriodFilter } from '../chunk-HBBTENSV.js';
|
|
51
|
+
export { AutocompleteField, endpointSearchFn, toAutocompleteOptions } from '../chunk-N25YP7ID.js';
|
|
52
|
+
import { ColumnBoard } from '../chunk-YWUDBLO6.js';
|
|
53
|
+
export { ColumnBoard } from '../chunk-YWUDBLO6.js';
|
|
54
|
+
import { DiffView } from '../chunk-JYAR7D5U.js';
|
|
55
|
+
export { DiffView } from '../chunk-JYAR7D5U.js';
|
|
56
|
+
import { Disclosure } from '../chunk-2HLXCKK7.js';
|
|
57
|
+
export { Disclosure } from '../chunk-2HLXCKK7.js';
|
|
58
|
+
import { EventCalendar } from '../chunk-ZORQPB6B.js';
|
|
59
|
+
export { EventCalendar, statusToneOf } from '../chunk-ZORQPB6B.js';
|
|
60
|
+
export { FileDropzone, unwrapUploaded } from '../chunk-N5RKM6IC.js';
|
|
61
|
+
import { ImageLightbox } from '../chunk-VY7MVBSE.js';
|
|
62
|
+
export { ImageLightbox } from '../chunk-VY7MVBSE.js';
|
|
63
|
+
import { InlineEdit } from '../chunk-7P7N43JV.js';
|
|
64
|
+
export { InlineEdit } from '../chunk-7P7N43JV.js';
|
|
65
|
+
import '../chunk-TFGNKFL2.js';
|
|
66
|
+
import '../chunk-37SFFW37.js';
|
|
67
|
+
import '../chunk-SAPBDJJQ.js';
|
|
68
|
+
import { ApprovalOverridesEditor } from '../chunk-GE6BYNQJ.js';
|
|
69
|
+
export { ApprovalOverridesEditor } from '../chunk-GE6BYNQJ.js';
|
|
70
|
+
import { TagMultiSelect } from '../chunk-I5SD7XRA.js';
|
|
71
|
+
export { TagMultiSelect, pickSeedValues } from '../chunk-I5SD7XRA.js';
|
|
72
|
+
import { ApprovalLineEditor } from '../chunk-FLAN7CV3.js';
|
|
73
|
+
export { ApprovalLineEditor } from '../chunk-FLAN7CV3.js';
|
|
74
|
+
import '../chunk-Q4SWUINA.js';
|
|
75
|
+
import '../chunk-WOYMEEPH.js';
|
|
76
|
+
import '../chunk-WSLT32Q4.js';
|
|
75
77
|
import '../chunk-XQPTSEJC.js';
|
|
76
|
-
import '../chunk-
|
|
77
|
-
import { ApprovalStepper } from '../chunk-
|
|
78
|
-
export { ApprovalStepper } from '../chunk-
|
|
79
|
-
import '../chunk-
|
|
80
|
-
import '../chunk-
|
|
78
|
+
import '../chunk-KO6OEY3G.js';
|
|
79
|
+
import { ApprovalStepper } from '../chunk-XGFDY43I.js';
|
|
80
|
+
export { ApprovalStepper } from '../chunk-XGFDY43I.js';
|
|
81
|
+
import '../chunk-RNOUXUBO.js';
|
|
82
|
+
import '../chunk-5WW4MBRO.js';
|
|
81
83
|
|
|
82
84
|
// src/widgets/index.ts
|
|
83
85
|
var widgetComponents = {
|
package/package.json
CHANGED
package/dist/chunk-EKVA7T7P.js
DELETED
|
@@ -1,198 +0,0 @@
|
|
|
1
|
-
import { useDismiss, usePopoverAnchor, usePortalTo, HoistedStyle, AnchoredPopoverStyles, anchorStyle, focusStaysInside } from './chunk-I5Z2RVDF.js';
|
|
2
|
-
import { Icon } from './chunk-TUOG7EEI.js';
|
|
3
|
-
import { boxed } from './chunk-YQOMSWW5.js';
|
|
4
|
-
import { useState, useRef, useEffect, useMemo, useCallback } from 'react';
|
|
5
|
-
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
6
|
-
|
|
7
|
-
var HM_RE = /^\d{2}:\d{2}$/;
|
|
8
|
-
var LIST_HEIGHT = 260;
|
|
9
|
-
var MINUTES_PER_DAY = 24 * 60;
|
|
10
|
-
function maskHm(text) {
|
|
11
|
-
const digits = text.replace(/\D/g, "").slice(0, 4);
|
|
12
|
-
if (digits.length <= 2) return digits;
|
|
13
|
-
return `${digits.slice(0, 2)}:${digits.slice(2)}`;
|
|
14
|
-
}
|
|
15
|
-
function parseHm(value) {
|
|
16
|
-
if (typeof value !== "string" || !HM_RE.test(value)) return void 0;
|
|
17
|
-
const h = Number(value.slice(0, 2));
|
|
18
|
-
const m = Number(value.slice(3, 5));
|
|
19
|
-
if (h > 23 || m > 59) return void 0;
|
|
20
|
-
return h * 60 + m;
|
|
21
|
-
}
|
|
22
|
-
function formatHm(minutes) {
|
|
23
|
-
const h = Math.floor(minutes / 60) % 24;
|
|
24
|
-
const m = minutes % 60;
|
|
25
|
-
return `${String(h).padStart(2, "0")}:${String(m).padStart(2, "0")}`;
|
|
26
|
-
}
|
|
27
|
-
function buildOptions(step, min, max) {
|
|
28
|
-
const safeStep = Number.isFinite(step) && step >= 1 ? Math.min(Math.floor(step), 720) : 30;
|
|
29
|
-
const from = min ?? 0;
|
|
30
|
-
const to = max ?? MINUTES_PER_DAY - 1;
|
|
31
|
-
const out = [];
|
|
32
|
-
for (let m = Math.ceil(from / safeStep) * safeStep; m <= to; m += safeStep) out.push(formatHm(m));
|
|
33
|
-
return out;
|
|
34
|
-
}
|
|
35
|
-
function TimePickerImpl({
|
|
36
|
-
value,
|
|
37
|
-
onChange,
|
|
38
|
-
min,
|
|
39
|
-
max,
|
|
40
|
-
step = 30,
|
|
41
|
-
placeholder,
|
|
42
|
-
invalid = false,
|
|
43
|
-
disabled = false,
|
|
44
|
-
size = "md"
|
|
45
|
-
}) {
|
|
46
|
-
const [open, setOpen] = useState(false);
|
|
47
|
-
const [innerValue, setInnerValue] = useState("");
|
|
48
|
-
const hostRef = useRef(null);
|
|
49
|
-
const popRef = useRef(null);
|
|
50
|
-
const inputRef = useRef(null);
|
|
51
|
-
const isControlled = value !== void 0;
|
|
52
|
-
const currentValue = (isControlled ? value : innerValue) ?? "";
|
|
53
|
-
const [text, setText] = useState(currentValue);
|
|
54
|
-
useEffect(() => {
|
|
55
|
-
setText(currentValue);
|
|
56
|
-
}, [currentValue]);
|
|
57
|
-
const minMinutes = useMemo(() => parseHm(min), [min]);
|
|
58
|
-
const maxMinutes = useMemo(() => parseHm(max), [max]);
|
|
59
|
-
const options = useMemo(() => buildOptions(step, minMinutes, maxMinutes), [step, minMinutes, maxMinutes]);
|
|
60
|
-
const dismiss = useCallback((reason) => {
|
|
61
|
-
setOpen(false);
|
|
62
|
-
if (reason === "escape") inputRef.current?.focus();
|
|
63
|
-
}, []);
|
|
64
|
-
useDismiss(open, hostRef, popRef, dismiss);
|
|
65
|
-
const anchor = usePopoverAnchor(open, hostRef, popRef, LIST_HEIGHT);
|
|
66
|
-
const portal = usePortalTo();
|
|
67
|
-
const isInvalid = Boolean(invalid);
|
|
68
|
-
const commit = (next) => {
|
|
69
|
-
if (!isControlled) setInnerValue(next);
|
|
70
|
-
onChange?.(next);
|
|
71
|
-
};
|
|
72
|
-
const handleTextChange = (raw) => {
|
|
73
|
-
const masked = maskHm(raw);
|
|
74
|
-
setText(masked);
|
|
75
|
-
if (masked === "") {
|
|
76
|
-
commit("");
|
|
77
|
-
return;
|
|
78
|
-
}
|
|
79
|
-
const minutes = parseHm(masked);
|
|
80
|
-
if (minutes === void 0) return;
|
|
81
|
-
if (minMinutes !== void 0 && minutes < minMinutes) return;
|
|
82
|
-
if (maxMinutes !== void 0 && minutes > maxMinutes) return;
|
|
83
|
-
commit(masked);
|
|
84
|
-
};
|
|
85
|
-
const focusList = () => {
|
|
86
|
-
const list = popRef.current;
|
|
87
|
-
if (!list) return;
|
|
88
|
-
(list.querySelector('[aria-selected="true"]') ?? list.querySelector('[role="option"]'))?.focus();
|
|
89
|
-
};
|
|
90
|
-
const handleKeyDown = (event) => {
|
|
91
|
-
if (event.key === "ArrowDown") {
|
|
92
|
-
event.preventDefault();
|
|
93
|
-
if (open) focusList();
|
|
94
|
-
else setOpen(true);
|
|
95
|
-
return;
|
|
96
|
-
}
|
|
97
|
-
if (event.key === "Enter" && open) {
|
|
98
|
-
event.preventDefault();
|
|
99
|
-
setOpen(false);
|
|
100
|
-
}
|
|
101
|
-
};
|
|
102
|
-
const handleOptionKeyDown = (index) => (event) => {
|
|
103
|
-
const step2 = event.key === "ArrowDown" ? 1 : event.key === "ArrowUp" ? -1 : 0;
|
|
104
|
-
if (step2 !== 0) {
|
|
105
|
-
event.preventDefault();
|
|
106
|
-
const next = Math.min(Math.max(index + step2, 0), options.length - 1);
|
|
107
|
-
popRef.current?.querySelectorAll('[role="option"]')[next]?.focus();
|
|
108
|
-
return;
|
|
109
|
-
}
|
|
110
|
-
if (event.key === "Home" || event.key === "End") {
|
|
111
|
-
event.preventDefault();
|
|
112
|
-
const target = event.key === "Home" ? 0 : options.length - 1;
|
|
113
|
-
popRef.current?.querySelectorAll('[role="option"]')[target]?.focus();
|
|
114
|
-
}
|
|
115
|
-
};
|
|
116
|
-
const pick = (option) => {
|
|
117
|
-
setText(option);
|
|
118
|
-
commit(option);
|
|
119
|
-
setOpen(false);
|
|
120
|
-
inputRef.current?.focus();
|
|
121
|
-
};
|
|
122
|
-
const handleBlur = (event) => {
|
|
123
|
-
if (focusStaysInside(event.relatedTarget, hostRef, popRef)) return;
|
|
124
|
-
if (text !== currentValue) setText(currentValue);
|
|
125
|
-
setOpen(false);
|
|
126
|
-
};
|
|
127
|
-
const classes = ["wp-input", "wp-input--mono", "wp-tp-input"];
|
|
128
|
-
if (size !== "md") classes.push(`wp-input--${size}`);
|
|
129
|
-
if (isInvalid) classes.push("wp-input--invalid");
|
|
130
|
-
return /* @__PURE__ */ jsxs("div", { ref: hostRef, className: "wp-tp-host", onBlur: handleBlur, children: [
|
|
131
|
-
/* @__PURE__ */ jsx(HoistedStyle, { id: "wp-timepicker", css: TP_CSS }),
|
|
132
|
-
/* @__PURE__ */ jsx(AnchoredPopoverStyles, {}),
|
|
133
|
-
/* @__PURE__ */ jsxs("div", { className: "wp-inputwrap wp-inputwrap--lead", children: [
|
|
134
|
-
/* @__PURE__ */ jsx("span", { className: "wp-inputwrap__lead", children: /* @__PURE__ */ jsx(Icon, { name: "clock", size: size === "lg" ? 16 : 15 }) }),
|
|
135
|
-
/* @__PURE__ */ jsx(
|
|
136
|
-
"input",
|
|
137
|
-
{
|
|
138
|
-
ref: inputRef,
|
|
139
|
-
type: "text",
|
|
140
|
-
className: classes.join(" "),
|
|
141
|
-
inputMode: "numeric",
|
|
142
|
-
autoComplete: "off",
|
|
143
|
-
spellCheck: false,
|
|
144
|
-
maxLength: 5,
|
|
145
|
-
placeholder: placeholder ?? "HH:MM",
|
|
146
|
-
value: text,
|
|
147
|
-
disabled,
|
|
148
|
-
"aria-invalid": isInvalid || void 0,
|
|
149
|
-
"aria-haspopup": "listbox",
|
|
150
|
-
"aria-expanded": open,
|
|
151
|
-
onChange: (event) => handleTextChange(event.target.value),
|
|
152
|
-
onKeyDown: handleKeyDown,
|
|
153
|
-
onPointerDown: () => {
|
|
154
|
-
if (!disabled && !open) setOpen(true);
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
)
|
|
158
|
-
] }),
|
|
159
|
-
portal(
|
|
160
|
-
anchor,
|
|
161
|
-
/* @__PURE__ */ jsx(
|
|
162
|
-
"div",
|
|
163
|
-
{
|
|
164
|
-
ref: popRef,
|
|
165
|
-
className: "wp-anchored-pop wp-tp-pop",
|
|
166
|
-
style: anchorStyle(anchor),
|
|
167
|
-
role: "listbox",
|
|
168
|
-
"aria-label": "\uC2DC\uAC01 \uC120\uD0DD",
|
|
169
|
-
children: options.map((option, index) => /* @__PURE__ */ jsx(
|
|
170
|
-
"button",
|
|
171
|
-
{
|
|
172
|
-
type: "button",
|
|
173
|
-
role: "option",
|
|
174
|
-
"aria-selected": option === currentValue,
|
|
175
|
-
className: option === currentValue ? "wp-tp-opt wp-tp-opt--on" : "wp-tp-opt",
|
|
176
|
-
onKeyDown: handleOptionKeyDown(index),
|
|
177
|
-
onClick: () => pick(option),
|
|
178
|
-
children: option
|
|
179
|
-
},
|
|
180
|
-
option
|
|
181
|
-
))
|
|
182
|
-
}
|
|
183
|
-
)
|
|
184
|
-
)
|
|
185
|
-
] });
|
|
186
|
-
}
|
|
187
|
-
var TP_CSS = `
|
|
188
|
-
.wp-tp-host{position:relative}
|
|
189
|
-
.wp-tp-input{padding-right:6px;min-width:calc(5ch + 36px)}
|
|
190
|
-
.wp-tp-pop{padding:var(--wp-space-1);max-height:260px;overflow-y:auto;overscroll-behavior:contain}
|
|
191
|
-
.wp-tp-opt{display:block;width:100%;padding:6px 10px;border:none;background:transparent;border-radius:var(--wp-radius-sm);font:inherit;font-family:var(--wp-font-mono);font-size:12.5px;color:var(--wp-text-default);text-align:left;cursor:pointer}
|
|
192
|
-
.wp-tp-opt:hover{background:var(--wp-surface-hover)}
|
|
193
|
-
.wp-tp-opt:focus-visible{outline:2px solid var(--wp-border-focus);outline-offset:-2px}
|
|
194
|
-
.wp-tp-opt--on{background:var(--wp-action-primary-bg);color:var(--wp-action-primary-fg);font-weight:500}
|
|
195
|
-
`;
|
|
196
|
-
var TimePicker = boxed(TimePickerImpl, "TimePicker");
|
|
197
|
-
|
|
198
|
-
export { TimePicker };
|