@expcat/tigercat-react 1.3.4 → 1.4.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/{chunk-3SV6J7I5.mjs → chunk-2L7QEOFD.mjs} +34 -25
- package/dist/{chunk-FNJDBFKM.mjs → chunk-2LYV6NBJ.mjs} +6 -1
- package/dist/{chunk-EEWHWEYO.js → chunk-2RBHQBSG.js} +2 -2
- package/dist/{chunk-Y5RQN5BO.mjs → chunk-376X7SDZ.mjs} +2 -2
- package/dist/{chunk-UXUYCWQC.js → chunk-3EDASNTG.js} +5 -5
- package/dist/{chunk-NPTXXUXF.mjs → chunk-3RBRWBUG.mjs} +9 -7
- package/dist/{chunk-PUZDW7NR.js → chunk-4AMSYFYC.js} +134 -20
- package/dist/{chunk-IG75YSX3.mjs → chunk-4MONGWU5.mjs} +4 -6
- package/dist/{chunk-3CJFNG54.mjs → chunk-56CTXEJS.mjs} +1 -1
- package/dist/{chunk-TMON4MPO.js → chunk-5ALMTE35.js} +9 -7
- package/dist/{chunk-MSHCPJIJ.mjs → chunk-6BOSSZM3.mjs} +8 -9
- package/dist/{chunk-SIY6FDKJ.js → chunk-7CHTTM6D.js} +339 -314
- package/dist/{chunk-RF2BA2N6.js → chunk-7PXALKLM.js} +4 -4
- package/dist/{chunk-DLKUDB2R.js → chunk-AF2AEZKM.js} +15 -3
- package/dist/{chunk-FB34UWF7.mjs → chunk-AVLIUHOS.mjs} +101 -40
- package/dist/{chunk-TSJYAEFZ.js → chunk-B63GEB2Y.js} +358 -305
- package/dist/{chunk-6I6X255M.js → chunk-BA6TJQZL.js} +12 -12
- package/dist/{chunk-LMTUM3J3.js → chunk-BEM7XG2L.js} +2 -4
- package/dist/{chunk-MB6U72CI.js → chunk-BEZO5IE4.js} +2 -2
- package/dist/{chunk-5OHVTGHS.mjs → chunk-BN4ZKCAI.mjs} +368 -315
- package/dist/{chunk-UHFHOTNI.js → chunk-BRA3PO53.js} +6 -7
- package/dist/{chunk-M7HBWFQO.js → chunk-BROIZ266.js} +11 -1
- package/dist/{chunk-SDZOVRVR.mjs → chunk-CAQPYJFA.mjs} +350 -325
- package/dist/{chunk-BFAZZUD6.js → chunk-CC5GFX6F.js} +5 -22
- package/dist/{chunk-LQT6ZGME.mjs → chunk-CME2IFUT.mjs} +15 -3
- package/dist/{chunk-KQ5I7PRM.js → chunk-CNNEUJR2.js} +28 -14
- package/dist/{chunk-EF5ZTNHX.js → chunk-D5MQBUP2.js} +16 -4
- package/dist/{chunk-RQXY2MGX.mjs → chunk-D7UR526A.mjs} +231 -184
- package/dist/{chunk-CBYJXDW4.js → chunk-DBMC6FPU.js} +16 -4
- package/dist/{chunk-WQ4FOHOU.mjs → chunk-DEIVWO2D.mjs} +3 -5
- package/dist/{chunk-7QZ4XT2P.mjs → chunk-DVEK5SO6.mjs} +3 -8
- package/dist/{chunk-TC6JLEGZ.js → chunk-EJKOUI26.js} +24 -7
- package/dist/{chunk-4GITZKAH.mjs → chunk-EPJ6W4VI.mjs} +14 -2
- package/dist/{chunk-KYP7U6FK.js → chunk-FZHBVHQ6.js} +34 -25
- package/dist/{chunk-WVVXZKNI.js → chunk-GDPU5MYA.js} +3 -8
- package/dist/{chunk-2GQCFTD7.mjs → chunk-H4MPPCTB.mjs} +23 -4
- package/dist/{chunk-YOAYDEWW.mjs → chunk-HHMYERHY.mjs} +3 -20
- package/dist/{chunk-LRPPXU74.mjs → chunk-I7FEGKX2.mjs} +19 -5
- package/dist/{chunk-F6IXIH6B.mjs → chunk-IZGXDHPB.mjs} +24 -5
- package/dist/{chunk-GQFVVAEF.js → chunk-J6OZWT3P.js} +5 -5
- package/dist/{chunk-IGAMV6ML.mjs → chunk-KDXKF6B2.mjs} +1 -1
- package/dist/{chunk-A42OLED6.mjs → chunk-KED5S2WG.mjs} +13 -2
- package/dist/{chunk-BJQIYELW.mjs → chunk-KGMVRIYC.mjs} +5 -5
- package/dist/{chunk-6GYT3EZD.mjs → chunk-KXT2TP6A.mjs} +3 -4
- package/dist/{chunk-BBLVRLXT.js → chunk-KYNWNTGO.js} +230 -146
- package/dist/{chunk-M73NMNZX.js → chunk-L24PPXLV.js} +17 -5
- package/dist/chunk-L3WPA2RP.js +25 -0
- package/dist/{chunk-V4JIZN3E.mjs → chunk-L6KSO66F.mjs} +4 -12
- package/dist/{chunk-4LX5UGPQ.js → chunk-LJRCEB7F.js} +168 -121
- package/dist/{chunk-F7H4ALKN.js → chunk-LZG24TDB.js} +8 -9
- package/dist/{chunk-ZYJTHGQW.js → chunk-M3FVPPMM.js} +9 -13
- package/dist/{chunk-GN3TSQWW.mjs → chunk-M6YXUNOU.mjs} +2 -2
- package/dist/{chunk-I373B74W.js → chunk-MC26ORSN.js} +102 -41
- package/dist/{chunk-5HFHHFQS.mjs → chunk-MTIGGMHG.mjs} +17 -5
- package/dist/{chunk-DKT2EYVM.mjs → chunk-MV2JQ6XQ.mjs} +3 -6
- package/dist/{chunk-HR5GBE3P.js → chunk-NDGA3N6H.js} +19 -7
- package/dist/{chunk-PU7KEYLP.mjs → chunk-NEZ445D4.mjs} +9 -9
- package/dist/{chunk-4U5HSR2H.js → chunk-NVI2P7VH.js} +3 -4
- package/dist/{chunk-NVEIVIAW.mjs → chunk-OFRKYQOZ.mjs} +133 -19
- package/dist/{chunk-AW5M3EL4.js → chunk-OS6M3IZF.js} +62 -12
- package/dist/{chunk-3ZNZLGQO.mjs → chunk-OXQOKKTP.mjs} +6 -7
- package/dist/{chunk-NMEVQPOD.js → chunk-PHAJXRGE.js} +2 -4
- package/dist/{chunk-WG3YS2QV.js → chunk-PT5T5F4H.js} +13 -2
- package/dist/{chunk-WNLUUD5N.mjs → chunk-QIL24WZD.mjs} +8 -12
- package/dist/{chunk-ZFMMAYSX.js → chunk-QLATA4UB.js} +4 -6
- package/dist/{chunk-2TZ3SBMU.mjs → chunk-RVLV63SI.mjs} +16 -11
- package/dist/{chunk-3QPCQH62.mjs → chunk-RYNLPRUM.mjs} +1 -1
- package/dist/{chunk-6GIJ7NFV.mjs → chunk-SDZKL3IB.mjs} +3 -5
- package/dist/{chunk-G5USITWF.js → chunk-SH4BZYXO.js} +27 -8
- package/dist/{chunk-L5AMVEQL.mjs → chunk-SLEXEH7R.mjs} +60 -10
- package/dist/{chunk-JLRRXRZO.js → chunk-SQONS5PH.js} +4 -7
- package/dist/chunk-SQTOVSDU.mjs +692 -0
- package/dist/{chunk-ITRYKHQJ.js → chunk-TEYL5X56.js} +19 -14
- package/dist/{chunk-KGSDDVRC.mjs → chunk-TNTOSFGN.mjs} +4 -4
- package/dist/{chunk-CY5GRTAX.js → chunk-UAM3RQY4.js} +24 -5
- package/dist/{chunk-XRNKHQTL.js → chunk-UEAXYZSE.js} +3 -2
- package/dist/{chunk-7ISEWLA3.js → chunk-UKQMF3JV.js} +21 -6
- package/dist/{chunk-ITVLIR7T.mjs → chunk-ULWT6W6M.mjs} +13 -20
- package/dist/{chunk-M5GSLKUX.mjs → chunk-VAIWWELW.mjs} +15 -3
- package/dist/{chunk-4SO4LANY.js → chunk-VC26SAXB.js} +340 -274
- package/dist/{chunk-SKMZTW3K.js → chunk-WCTNQYXO.js} +16 -23
- package/dist/{chunk-KXNWY2Q7.mjs → chunk-WFWEMXO7.mjs} +241 -157
- package/dist/chunk-WHYHLUXG.mjs +25 -0
- package/dist/{chunk-ONTRGV5T.js → chunk-WZUADPYB.js} +6 -14
- package/dist/{chunk-N4PP3ENO.js → chunk-XTQUPDRI.js} +2 -2
- package/dist/{chunk-XATXFVKR.mjs → chunk-Y7K27DVV.mjs} +4 -3
- package/dist/{chunk-WI4N5DD3.mjs → chunk-YH57D4AV.mjs} +16 -4
- package/dist/{chunk-3MRP3XYI.js → chunk-YRVAF2ID.js} +7 -2
- package/dist/{chunk-5XE5VBDS.mjs → chunk-YSGM22AH.mjs} +11 -1
- package/dist/{chunk-6TR7JB6C.js → chunk-ZDNQGS4O.js} +4 -4
- package/dist/{chunk-CHBUNQIJ.mjs → chunk-ZQSMJS2Q.mjs} +23 -6
- package/dist/{chunk-QQFLRNI3.mjs → chunk-ZRZB3C5J.mjs} +18 -3
- package/dist/components/ActivityFeed.js +4 -3
- package/dist/components/ActivityFeed.mjs +3 -2
- package/dist/components/Cascader.d.mts +3 -1
- package/dist/components/Cascader.d.ts +3 -1
- package/dist/components/Cascader.js +3 -2
- package/dist/components/Cascader.mjs +2 -1
- package/dist/components/ChatWindow.js +5 -5
- package/dist/components/ChatWindow.mjs +4 -4
- package/dist/components/Checkbox.js +4 -4
- package/dist/components/Checkbox.mjs +3 -3
- package/dist/components/CheckboxGroup.js +3 -3
- package/dist/components/CheckboxGroup.mjs +2 -2
- package/dist/components/CommentThread.js +4 -4
- package/dist/components/CommentThread.mjs +3 -3
- package/dist/components/CropUpload.js +4 -4
- package/dist/components/CropUpload.mjs +3 -3
- package/dist/components/DataTableWithToolbar.d.mts +2 -2
- package/dist/components/DataTableWithToolbar.d.ts +2 -2
- package/dist/components/DataTableWithToolbar.js +11 -11
- package/dist/components/DataTableWithToolbar.mjs +10 -10
- package/dist/components/DatePicker.d.mts +1 -0
- package/dist/components/DatePicker.d.ts +1 -0
- package/dist/components/DatePicker.js +3 -2
- package/dist/components/DatePicker.mjs +2 -1
- package/dist/components/Drawer.js +3 -3
- package/dist/components/Drawer.mjs +2 -2
- package/dist/components/FileManager.d.mts +2 -1
- package/dist/components/FileManager.d.ts +2 -1
- package/dist/components/FileManager.js +3 -2
- package/dist/components/FileManager.mjs +2 -1
- package/dist/components/Form.js +3 -2
- package/dist/components/Form.mjs +2 -1
- package/dist/components/FormItem.js +4 -3
- package/dist/components/FormItem.mjs +3 -2
- package/dist/components/FormWizard.js +4 -4
- package/dist/components/FormWizard.mjs +3 -3
- package/dist/components/Image.js +4 -4
- package/dist/components/Image.mjs +3 -3
- package/dist/components/ImageGroup.js +3 -3
- package/dist/components/ImageGroup.mjs +2 -2
- package/dist/components/ImagePreview.js +2 -2
- package/dist/components/ImagePreview.mjs +1 -1
- package/dist/components/ImageViewer.d.mts +1 -1
- package/dist/components/ImageViewer.d.ts +1 -1
- package/dist/components/ImageViewer.js +2 -2
- package/dist/components/ImageViewer.mjs +1 -1
- package/dist/components/InfiniteScroll.d.mts +2 -0
- package/dist/components/InfiniteScroll.d.ts +2 -0
- package/dist/components/InfiniteScroll.js +3 -2
- package/dist/components/InfiniteScroll.mjs +2 -1
- package/dist/components/Input.js +3 -2
- package/dist/components/Input.mjs +2 -1
- package/dist/components/InputNumber.js +3 -2
- package/dist/components/InputNumber.mjs +2 -1
- package/dist/components/List.d.mts +6 -2
- package/dist/components/List.d.ts +6 -2
- package/dist/components/List.js +3 -2
- package/dist/components/List.mjs +2 -1
- package/dist/components/Loading.js +3 -2
- package/dist/components/Loading.mjs +2 -1
- package/dist/components/MarkdownEditor.js +3 -3
- package/dist/components/MarkdownEditor.mjs +2 -2
- package/dist/components/Mentions.js +2 -2
- package/dist/components/Mentions.mjs +1 -1
- package/dist/components/Menu.d.mts +8 -80
- package/dist/components/Menu.d.ts +8 -80
- package/dist/components/Menu.js +2 -2
- package/dist/components/Menu.mjs +1 -1
- package/dist/components/MenuItem.d.mts +6 -2
- package/dist/components/MenuItem.d.ts +6 -2
- package/dist/components/MenuItem.js +2 -2
- package/dist/components/MenuItem.mjs +1 -1
- package/dist/components/MenuItemGroup.d.mts +6 -2
- package/dist/components/MenuItemGroup.d.ts +6 -2
- package/dist/components/MenuItemGroup.js +2 -2
- package/dist/components/MenuItemGroup.mjs +1 -1
- package/dist/components/Message.js +2 -2
- package/dist/components/Message.mjs +1 -1
- package/dist/components/Modal.js +3 -3
- package/dist/components/Modal.mjs +2 -2
- package/dist/components/Notification.js +2 -2
- package/dist/components/Notification.mjs +1 -1
- package/dist/components/NotificationCenter.js +5 -4
- package/dist/components/NotificationCenter.mjs +4 -3
- package/dist/components/NumberKeyboard.js +3 -2
- package/dist/components/NumberKeyboard.mjs +2 -1
- package/dist/components/Radio.js +4 -4
- package/dist/components/Radio.mjs +3 -3
- package/dist/components/RadioGroup.js +3 -3
- package/dist/components/RadioGroup.mjs +2 -2
- package/dist/components/RichTextEditor.js +3 -3
- package/dist/components/RichTextEditor.mjs +2 -2
- package/dist/components/Select.d.mts +3 -1
- package/dist/components/Select.d.ts +3 -1
- package/dist/components/Select.js +3 -2
- package/dist/components/Select.mjs +2 -1
- package/dist/components/Signature.d.mts +1 -0
- package/dist/components/Signature.d.ts +1 -0
- package/dist/components/Signature.js +3 -2
- package/dist/components/Signature.mjs +2 -1
- package/dist/components/Spotlight.js +4 -2
- package/dist/components/Spotlight.mjs +3 -1
- package/dist/components/Steps.js +2 -2
- package/dist/components/Steps.mjs +1 -1
- package/dist/components/StepsItem.js +2 -2
- package/dist/components/StepsItem.mjs +1 -1
- package/dist/components/SubMenu.d.mts +6 -2
- package/dist/components/SubMenu.d.ts +6 -2
- package/dist/components/SubMenu.js +2 -2
- package/dist/components/SubMenu.mjs +1 -1
- package/dist/components/Table.d.mts +2 -2
- package/dist/components/Table.d.ts +2 -2
- package/dist/components/Table.js +9 -9
- package/dist/components/Table.mjs +8 -8
- package/dist/components/Textarea.js +3 -3
- package/dist/components/Textarea.mjs +2 -2
- package/dist/components/TimePicker.d.mts +1 -0
- package/dist/components/TimePicker.d.ts +1 -0
- package/dist/components/TimePicker.js +4 -2
- package/dist/components/TimePicker.mjs +3 -1
- package/dist/components/Tour.js +3 -2
- package/dist/components/Tour.mjs +2 -1
- package/dist/components/Transfer.d.mts +3 -1
- package/dist/components/Transfer.d.ts +3 -1
- package/dist/components/Transfer.js +3 -2
- package/dist/components/Transfer.mjs +2 -1
- package/dist/components/Tree.d.mts +3 -1
- package/dist/components/Tree.d.ts +3 -1
- package/dist/components/Tree.js +3 -2
- package/dist/components/Tree.mjs +2 -1
- package/dist/components/TreeSelect.d.mts +3 -1
- package/dist/components/TreeSelect.d.ts +3 -1
- package/dist/components/TreeSelect.js +3 -2
- package/dist/components/TreeSelect.mjs +2 -1
- package/dist/components/Upload.js +3 -2
- package/dist/components/Upload.mjs +2 -1
- package/dist/components/VirtualTable.d.mts +3 -2
- package/dist/components/VirtualTable.d.ts +3 -2
- package/dist/components/VirtualTable.js +3 -2
- package/dist/components/VirtualTable.mjs +2 -1
- package/dist/index.d.mts +33 -7
- package/dist/index.d.ts +33 -7
- package/dist/index.js +54 -54
- package/dist/index.mjs +53 -53
- package/dist/{types-CHmCMNEM.d.mts → types-0oVwMXtR.d.mts} +1 -1
- package/dist/{types-CHmCMNEM.d.ts → types-0oVwMXtR.d.ts} +1 -1
- package/dist/types-DaC4a0Ny.d.mts +80 -0
- package/dist/types-DaC4a0Ny.d.ts +80 -0
- package/package.json +2 -2
- package/dist/chunk-UKGQ7256.js +0 -12
- package/dist/chunk-UQMPEMY7.mjs +0 -12
- package/dist/chunk-VNVGSPBI.mjs +0 -626
- package/dist/{chunk-OZD75CLT.js → chunk-ANBNSUSR.js} +3 -3
- package/dist/{chunk-I2AUOICV.mjs → chunk-M3MOSUZO.mjs} +3 -3
- package/dist/{chunk-UMZ3PMUJ.js → chunk-SXHCMZ6U.js} +2 -2
- package/dist/{chunk-BWDQZSAB.mjs → chunk-WTSG7QXK.mjs} +3 -3
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
|
-
var _react = require('react');
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
5
2
|
|
|
3
|
+
var _chunkL3WPA2RPjs = require('./chunk-L3WPA2RP.js');
|
|
6
4
|
|
|
7
5
|
|
|
6
|
+
var _chunkTDODFBBOjs = require('./chunk-TDODFBBO.js');
|
|
8
7
|
|
|
8
|
+
// src/components/TimePicker.tsx
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
@@ -16,7 +16,10 @@ var _react = require('react');
|
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
|
|
19
|
+
var _tigercatcore = require('@expcat/tigercat-core');
|
|
19
20
|
|
|
21
|
+
// src/components/TimePicker/state.ts
|
|
22
|
+
var _react = require('react');
|
|
20
23
|
|
|
21
24
|
|
|
22
25
|
|
|
@@ -37,19 +40,8 @@ var _react = require('react');
|
|
|
37
40
|
|
|
38
41
|
|
|
39
42
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
var Icon = ({ path, className }) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
43
|
-
"svg",
|
|
44
|
-
{
|
|
45
|
-
className,
|
|
46
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
47
|
-
viewBox: _tigercatcore.icon20ViewBox,
|
|
48
|
-
fill: "currentColor",
|
|
49
|
-
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "path", { fillRule: "evenodd", d: path, clipRule: "evenodd" })
|
|
50
|
-
}
|
|
51
|
-
);
|
|
52
|
-
var TimePicker = (allProps) => {
|
|
43
|
+
function useTimePickerState(allProps) {
|
|
44
|
+
const config = _chunkTDODFBBOjs.useTigerConfig.call(void 0, );
|
|
53
45
|
const {
|
|
54
46
|
size = "md",
|
|
55
47
|
format = "24",
|
|
@@ -77,43 +69,44 @@ var TimePicker = (allProps) => {
|
|
|
77
69
|
const divProps = (({ onChange: _omitOnChange, ...rest }) => rest)(restProps);
|
|
78
70
|
const isRangeMode = range === true;
|
|
79
71
|
const [isOpen, setIsOpen] = _react.useState.call(void 0, false);
|
|
80
|
-
const
|
|
81
|
-
if (
|
|
72
|
+
const normalizeRangeValue = (input) => {
|
|
73
|
+
if (Array.isArray(input)) return [_nullishCoalesce(input[0], () => ( null)), _nullishCoalesce(input[1], () => ( null))];
|
|
74
|
+
return [null, null];
|
|
75
|
+
};
|
|
76
|
+
const singleControlled = !isRangeMode && value !== void 0 && (typeof value === "string" || value === null) ? value : void 0;
|
|
77
|
+
const singleDefault = (() => {
|
|
82
78
|
const dv = defaultValue;
|
|
83
79
|
if (typeof dv === "string" || dv === null || dv === void 0) return _nullishCoalesce(dv, () => ( null));
|
|
84
80
|
return null;
|
|
85
|
-
});
|
|
86
|
-
const [
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
81
|
+
})();
|
|
82
|
+
const [singleValue, setSingleValue] = _chunkL3WPA2RPjs.useControlledState.call(void 0,
|
|
83
|
+
singleControlled,
|
|
84
|
+
singleDefault,
|
|
85
|
+
allProps.onChange
|
|
86
|
+
);
|
|
87
|
+
const [rangeValue, setRangeValue] = _chunkL3WPA2RPjs.useControlledState.call(void 0,
|
|
88
|
+
isRangeMode && value !== void 0 ? normalizeRangeValue(value) : void 0,
|
|
89
|
+
normalizeRangeValue(defaultValue),
|
|
90
|
+
allProps.onChange
|
|
91
|
+
);
|
|
91
92
|
const [activePart, setActivePart] = _react.useState.call(void 0, "start");
|
|
92
93
|
const panelRef = _react.useRef.call(void 0, null);
|
|
93
94
|
const inputWrapperRef = _react.useRef.call(void 0, null);
|
|
94
95
|
const inputRef = _react.useRef.call(void 0, null);
|
|
95
|
-
const
|
|
96
|
-
|
|
97
|
-
return [null, null];
|
|
98
|
-
};
|
|
99
|
-
const isControlled = value !== void 0;
|
|
100
|
-
const currentSingleValue = (() => {
|
|
101
|
-
if (isRangeMode) return null;
|
|
102
|
-
const v = value;
|
|
103
|
-
if (isControlled && (typeof v === "string" || v === null)) return v;
|
|
104
|
-
return internalSingleValue;
|
|
105
|
-
})();
|
|
106
|
-
const currentRangeValue = (() => {
|
|
107
|
-
if (!isRangeMode) return [null, null];
|
|
108
|
-
if (isControlled) return normalizeRangeValue(value);
|
|
109
|
-
return internalRangeValue;
|
|
110
|
-
})();
|
|
96
|
+
const currentSingleValue = isRangeMode ? null : singleValue;
|
|
97
|
+
const currentRangeValue = isRangeMode ? rangeValue : [null, null];
|
|
111
98
|
const activeValue = isRangeMode ? currentRangeValue[activePart === "start" ? 0 : 1] : currentSingleValue;
|
|
112
99
|
const parsedTime = _tigercatcore.parseTime.call(void 0, activeValue);
|
|
113
100
|
const [selectedHours, setSelectedHours] = _react.useState.call(void 0, _nullishCoalesce(_optionalChain([parsedTime, 'optionalAccess', _ => _.hours]), () => ( 0)));
|
|
114
101
|
const [selectedMinutes, setSelectedMinutes] = _react.useState.call(void 0, _nullishCoalesce(_optionalChain([parsedTime, 'optionalAccess', _2 => _2.minutes]), () => ( 0)));
|
|
115
102
|
const [selectedSeconds, setSelectedSeconds] = _react.useState.call(void 0, _nullishCoalesce(_optionalChain([parsedTime, 'optionalAccess', _3 => _3.seconds]), () => ( 0)));
|
|
116
103
|
const [selectedPeriod, setSelectedPeriod] = _react.useState.call(void 0, "AM");
|
|
104
|
+
const localeOverride = _react.useMemo.call(void 0, () => typeof locale === "string" ? { locale } : locale, [locale]);
|
|
105
|
+
const mergedLocale = _react.useMemo.call(void 0,
|
|
106
|
+
() => _tigercatcore.mergeTigerLocale.call(void 0, config.locale, localeOverride),
|
|
107
|
+
[config.locale, localeOverride]
|
|
108
|
+
);
|
|
109
|
+
const localeCode = _optionalChain([mergedLocale, 'optionalAccess', _4 => _4.locale]);
|
|
117
110
|
const syncFromActiveValue = _react.useCallback.call(void 0, () => {
|
|
118
111
|
const parsed = _tigercatcore.parseTime.call(void 0, activeValue);
|
|
119
112
|
if (!parsed) return;
|
|
@@ -129,11 +122,11 @@ var TimePicker = (allProps) => {
|
|
|
129
122
|
syncFromActiveValue();
|
|
130
123
|
}, [syncFromActiveValue]);
|
|
131
124
|
const labels = _react.useMemo.call(void 0,
|
|
132
|
-
() => _tigercatcore.getTimePickerLabels.call(void 0,
|
|
133
|
-
[
|
|
125
|
+
() => _tigercatcore.getTimePickerLabels.call(void 0, mergedLocale, labelsOverrides),
|
|
126
|
+
[mergedLocale, labelsOverrides]
|
|
134
127
|
);
|
|
135
128
|
const placeholder = _nullishCoalesce(allProps.placeholder, () => ( (isRangeMode ? labels.selectTimeRange : labels.selectTime)));
|
|
136
|
-
const periodLabels = _react.useMemo.call(void 0, () => _tigercatcore.getTimePeriodLabels.call(void 0,
|
|
129
|
+
const periodLabels = _react.useMemo.call(void 0, () => _tigercatcore.getTimePeriodLabels.call(void 0, localeCode), [localeCode]);
|
|
137
130
|
const displayValue = (() => {
|
|
138
131
|
if (!isRangeMode) {
|
|
139
132
|
return parsedTime ? _tigercatcore.formatTimeDisplayWithLocale.call(void 0,
|
|
@@ -142,7 +135,7 @@ var TimePicker = (allProps) => {
|
|
|
142
135
|
parsedTime.seconds,
|
|
143
136
|
format,
|
|
144
137
|
showSeconds,
|
|
145
|
-
|
|
138
|
+
localeCode
|
|
146
139
|
) : "";
|
|
147
140
|
}
|
|
148
141
|
const toDisplay = (timeStr) => {
|
|
@@ -154,7 +147,7 @@ var TimePicker = (allProps) => {
|
|
|
154
147
|
parsed.seconds,
|
|
155
148
|
format,
|
|
156
149
|
showSeconds,
|
|
157
|
-
|
|
150
|
+
localeCode
|
|
158
151
|
);
|
|
159
152
|
};
|
|
160
153
|
const start = toDisplay(currentRangeValue[0]);
|
|
@@ -182,27 +175,10 @@ var TimePicker = (allProps) => {
|
|
|
182
175
|
};
|
|
183
176
|
const closePanel = () => {
|
|
184
177
|
setIsOpen(false);
|
|
185
|
-
_optionalChain([inputRef, 'access',
|
|
178
|
+
_optionalChain([inputRef, 'access', _5 => _5.current, 'optionalAccess', _6 => _6.focus, 'call', _7 => _7()]);
|
|
186
179
|
};
|
|
187
180
|
const focusOptionInUnit = (unit, action) => {
|
|
188
|
-
|
|
189
|
-
if (!panel) return;
|
|
190
|
-
const nodes = Array.from(
|
|
191
|
-
panel.querySelectorAll(`button[data-tiger-timepicker-unit="${unit}"]`)
|
|
192
|
-
).filter((button) => !button.disabled);
|
|
193
|
-
if (nodes.length === 0) return;
|
|
194
|
-
const active = document.activeElement;
|
|
195
|
-
const activeIndex = active ? nodes.indexOf(active) : -1;
|
|
196
|
-
const selectedIndex = nodes.findIndex(
|
|
197
|
-
(button) => button.getAttribute("aria-selected") === "true"
|
|
198
|
-
);
|
|
199
|
-
const baseIndex = activeIndex >= 0 ? activeIndex : Math.max(0, selectedIndex);
|
|
200
|
-
let nextIndex = baseIndex;
|
|
201
|
-
if (action === "prev") nextIndex = Math.max(0, baseIndex - 1);
|
|
202
|
-
if (action === "next") nextIndex = Math.min(nodes.length - 1, baseIndex + 1);
|
|
203
|
-
if (action === "first") nextIndex = 0;
|
|
204
|
-
if (action === "last") nextIndex = nodes.length - 1;
|
|
205
|
-
_optionalChain([nodes, 'access', _7 => _7[nextIndex], 'optionalAccess', _8 => _8.focus, 'call', _9 => _9()]);
|
|
181
|
+
_tigercatcore.focusTimePickerOption.call(void 0, panelRef.current, unit, action);
|
|
206
182
|
};
|
|
207
183
|
const handlePanelKeyDown = (event) => {
|
|
208
184
|
if (event.key === "Escape") {
|
|
@@ -211,7 +187,7 @@ var TimePicker = (allProps) => {
|
|
|
211
187
|
return;
|
|
212
188
|
}
|
|
213
189
|
const active = document.activeElement;
|
|
214
|
-
const unit = _optionalChain([active, 'optionalAccess',
|
|
190
|
+
const unit = _optionalChain([active, 'optionalAccess', _8 => _8.getAttribute, 'call', _9 => _9("data-tiger-timepicker-unit")]);
|
|
215
191
|
if (!unit) return;
|
|
216
192
|
if (event.key === "ArrowUp") {
|
|
217
193
|
event.preventDefault();
|
|
@@ -266,11 +242,8 @@ var TimePicker = (allProps) => {
|
|
|
266
242
|
return;
|
|
267
243
|
}
|
|
268
244
|
let timeString = _tigercatcore.formatTime.call(void 0, hours, minutes, seconds, showSeconds);
|
|
269
|
-
if (
|
|
270
|
-
|
|
271
|
-
setInternalSingleValue(timeString);
|
|
272
|
-
}
|
|
273
|
-
_optionalChain([allProps, 'access', _12 => _12.onChange, 'optionalCall', _13 => _13(timeString)]);
|
|
245
|
+
if (!isRangeMode) {
|
|
246
|
+
setSingleValue(timeString);
|
|
274
247
|
return;
|
|
275
248
|
}
|
|
276
249
|
const index = activePart === "start" ? 0 : 1;
|
|
@@ -301,30 +274,20 @@ var TimePicker = (allProps) => {
|
|
|
301
274
|
if (activePart === "start" && endSeconds !== null && candidateSeconds > endSeconds) {
|
|
302
275
|
nextRange[1] = timeString;
|
|
303
276
|
}
|
|
304
|
-
|
|
305
|
-
setInternalRangeValue(nextRange);
|
|
306
|
-
}
|
|
307
|
-
_optionalChain([allProps, 'access', _14 => _14.onChange, 'optionalCall', _15 => _15(nextRange)]);
|
|
277
|
+
setRangeValue(nextRange);
|
|
308
278
|
if (activePart === "start" && nextRange[1] === null) {
|
|
309
279
|
setActivePart("end");
|
|
310
280
|
}
|
|
311
281
|
};
|
|
312
282
|
const clearTime = (event) => {
|
|
313
283
|
event.stopPropagation();
|
|
314
|
-
if (
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
}
|
|
318
|
-
_optionalChain([allProps, 'access', _16 => _16.onChange, 'optionalCall', _17 => _17(null)]);
|
|
319
|
-
_optionalChain([onClear, 'optionalCall', _18 => _18()]);
|
|
284
|
+
if (!isRangeMode) {
|
|
285
|
+
setSingleValue(null);
|
|
286
|
+
_optionalChain([onClear, 'optionalCall', _10 => _10()]);
|
|
320
287
|
return;
|
|
321
288
|
}
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
setInternalRangeValue(cleared);
|
|
325
|
-
}
|
|
326
|
-
_optionalChain([allProps, 'access', _19 => _19.onChange, 'optionalCall', _20 => _20(cleared)]);
|
|
327
|
-
_optionalChain([onClear, 'optionalCall', _21 => _21()]);
|
|
289
|
+
setRangeValue([null, null]);
|
|
290
|
+
_optionalChain([onClear, 'optionalCall', _11 => _11()]);
|
|
328
291
|
};
|
|
329
292
|
const setNow = () => {
|
|
330
293
|
const now = _tigercatcore.getCurrentTime.call(void 0, showSeconds);
|
|
@@ -378,38 +341,284 @@ var TimePicker = (allProps) => {
|
|
|
378
341
|
const firstHour = panel.querySelector(
|
|
379
342
|
'button[data-tiger-timepicker-unit="hour"]:not([disabled])'
|
|
380
343
|
);
|
|
381
|
-
_optionalChain([firstHour, 'optionalAccess',
|
|
344
|
+
_optionalChain([firstHour, 'optionalAccess', _12 => _12.focus, 'call', _13 => _13()]);
|
|
382
345
|
}, 0);
|
|
383
346
|
return () => window.clearTimeout(focusTimer);
|
|
384
347
|
}, [isOpen, activePart]);
|
|
385
348
|
const inputClasses = _tigercatcore.getTimePickerInputClasses.call(void 0, size, disabled || readonly);
|
|
386
349
|
const iconButtonClasses = _tigercatcore.getTimePickerIconButtonClasses.call(void 0, size);
|
|
387
|
-
return
|
|
388
|
-
|
|
350
|
+
return {
|
|
351
|
+
panelRef,
|
|
352
|
+
inputWrapperRef,
|
|
353
|
+
inputRef,
|
|
354
|
+
isOpen,
|
|
355
|
+
activePart,
|
|
356
|
+
setActivePart,
|
|
357
|
+
isRangeMode,
|
|
358
|
+
placeholder,
|
|
359
|
+
disabled,
|
|
360
|
+
readonly,
|
|
361
|
+
required,
|
|
362
|
+
name,
|
|
363
|
+
id,
|
|
364
|
+
format,
|
|
365
|
+
showSeconds,
|
|
366
|
+
locale: mergedLocale,
|
|
367
|
+
labelsOverrides,
|
|
368
|
+
containerClasses: _tigercatcore.classNames.call(void 0, _tigercatcore.timePickerBaseClasses, className),
|
|
369
|
+
divProps,
|
|
370
|
+
displayValue,
|
|
371
|
+
showClearButton,
|
|
372
|
+
inputClasses,
|
|
373
|
+
iconButtonClasses,
|
|
374
|
+
labels,
|
|
375
|
+
periodLabels,
|
|
376
|
+
hoursList,
|
|
377
|
+
minutesList,
|
|
378
|
+
secondsList,
|
|
379
|
+
selectedHours,
|
|
380
|
+
selectedMinutes,
|
|
381
|
+
selectedSeconds,
|
|
382
|
+
selectedPeriod,
|
|
383
|
+
togglePanel,
|
|
384
|
+
closePanel,
|
|
385
|
+
handleInputClick,
|
|
386
|
+
clearTime,
|
|
387
|
+
setNow,
|
|
388
|
+
handlePanelKeyDown,
|
|
389
|
+
selectHour,
|
|
390
|
+
selectMinute,
|
|
391
|
+
selectSecond,
|
|
392
|
+
selectPeriod,
|
|
393
|
+
isHourDisabled,
|
|
394
|
+
isMinuteDisabled
|
|
395
|
+
};
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
// src/components/TimePicker/render-mobile.tsx
|
|
399
|
+
|
|
400
|
+
|
|
401
|
+
|
|
402
|
+
|
|
403
|
+
|
|
404
|
+
|
|
405
|
+
var _jsxruntime = require('react/jsx-runtime');
|
|
406
|
+
function renderTimePickerMobile(ctx) {
|
|
407
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: _tigercatcore.timePickerMobileWheelClasses, children: [
|
|
408
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
409
|
+
"select",
|
|
410
|
+
{
|
|
411
|
+
className: _tigercatcore.timePickerMobileWheelSelectClasses,
|
|
412
|
+
value: ctx.format === "12" ? _tigercatcore.to12HourFormat.call(void 0, ctx.selectedHours).hours : ctx.selectedHours,
|
|
413
|
+
"aria-label": ctx.labels.hour,
|
|
414
|
+
onChange: (event) => ctx.selectHour(Number(event.target.value)),
|
|
415
|
+
children: ctx.hoursList.map((hour) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "option", { value: hour, disabled: ctx.isHourDisabled(hour), children: _tigercatcore.padTwo.call(void 0, hour) }, hour))
|
|
416
|
+
}
|
|
417
|
+
),
|
|
418
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
419
|
+
"select",
|
|
420
|
+
{
|
|
421
|
+
className: _tigercatcore.timePickerMobileWheelSelectClasses,
|
|
422
|
+
value: ctx.selectedMinutes,
|
|
423
|
+
"aria-label": ctx.labels.minute,
|
|
424
|
+
onChange: (event) => ctx.selectMinute(Number(event.target.value)),
|
|
425
|
+
children: ctx.minutesList.map((minute) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "option", { value: minute, disabled: ctx.isMinuteDisabled(minute), children: _tigercatcore.padTwo.call(void 0, minute) }, minute))
|
|
426
|
+
}
|
|
427
|
+
),
|
|
428
|
+
ctx.showSeconds && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
429
|
+
"select",
|
|
430
|
+
{
|
|
431
|
+
className: _tigercatcore.timePickerMobileWheelSelectClasses,
|
|
432
|
+
value: ctx.selectedSeconds,
|
|
433
|
+
"aria-label": ctx.labels.second,
|
|
434
|
+
onChange: (event) => ctx.selectSecond(Number(event.target.value)),
|
|
435
|
+
children: ctx.secondsList.map((second) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "option", { value: second, children: _tigercatcore.padTwo.call(void 0, second) }, second))
|
|
436
|
+
}
|
|
437
|
+
),
|
|
438
|
+
ctx.format === "12" && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
439
|
+
"select",
|
|
440
|
+
{
|
|
441
|
+
className: _tigercatcore.timePickerMobileWheelSelectClasses,
|
|
442
|
+
value: ctx.selectedPeriod,
|
|
443
|
+
"aria-label": "Period",
|
|
444
|
+
onChange: (event) => ctx.selectPeriod(event.target.value),
|
|
445
|
+
children: [
|
|
446
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "option", { value: "AM", children: ctx.periodLabels.am }),
|
|
447
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "option", { value: "PM", children: ctx.periodLabels.pm })
|
|
448
|
+
]
|
|
449
|
+
}
|
|
450
|
+
)
|
|
451
|
+
] });
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
// src/components/TimePicker/render-desktop.tsx
|
|
455
|
+
|
|
456
|
+
|
|
457
|
+
|
|
458
|
+
|
|
459
|
+
|
|
460
|
+
|
|
461
|
+
|
|
462
|
+
|
|
463
|
+
|
|
464
|
+
|
|
465
|
+
|
|
466
|
+
|
|
467
|
+
function renderTimePickerDesktop(ctx) {
|
|
468
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: _tigercatcore.timePickerDesktopPanelContentClasses, children: [
|
|
469
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: _tigercatcore.timePickerColumnClasses, children: [
|
|
470
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: _tigercatcore.timePickerColumnHeaderClasses, children: ctx.labels.hour }),
|
|
471
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: _tigercatcore.timePickerColumnListClasses, children: ctx.hoursList.map((hour) => {
|
|
472
|
+
const hours24 = ctx.format === "12" ? _tigercatcore.to24HourFormat.call(void 0, hour, ctx.selectedPeriod) : hour;
|
|
473
|
+
const isSelected = ctx.selectedHours === hours24;
|
|
474
|
+
const isDisabled = ctx.isHourDisabled(hour);
|
|
475
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
476
|
+
"button",
|
|
477
|
+
{
|
|
478
|
+
type: "button",
|
|
479
|
+
className: _tigercatcore.getTimePickerItemClasses.call(void 0, isSelected, isDisabled),
|
|
480
|
+
disabled: isDisabled,
|
|
481
|
+
onClick: () => ctx.selectHour(hour),
|
|
482
|
+
"data-tiger-timepicker-unit": "hour",
|
|
483
|
+
"aria-label": _tigercatcore.getTimePickerOptionAriaLabel.call(void 0,
|
|
484
|
+
hour,
|
|
485
|
+
"hour",
|
|
486
|
+
ctx.locale,
|
|
487
|
+
ctx.labelsOverrides
|
|
488
|
+
),
|
|
489
|
+
"aria-selected": isSelected,
|
|
490
|
+
children: _tigercatcore.padTwo.call(void 0, hour)
|
|
491
|
+
},
|
|
492
|
+
hour
|
|
493
|
+
);
|
|
494
|
+
}) })
|
|
495
|
+
] }),
|
|
496
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: _tigercatcore.timePickerColumnClasses, children: [
|
|
497
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: _tigercatcore.timePickerColumnHeaderClasses, children: ctx.labels.minute }),
|
|
498
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: _tigercatcore.timePickerColumnListClasses, children: ctx.minutesList.map((minute) => {
|
|
499
|
+
const isSelected = ctx.selectedMinutes === minute;
|
|
500
|
+
const isDisabled = ctx.isMinuteDisabled(minute);
|
|
501
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
502
|
+
"button",
|
|
503
|
+
{
|
|
504
|
+
type: "button",
|
|
505
|
+
className: _tigercatcore.getTimePickerItemClasses.call(void 0, isSelected, isDisabled),
|
|
506
|
+
disabled: isDisabled,
|
|
507
|
+
onClick: () => ctx.selectMinute(minute),
|
|
508
|
+
"data-tiger-timepicker-unit": "minute",
|
|
509
|
+
"aria-label": _tigercatcore.getTimePickerOptionAriaLabel.call(void 0,
|
|
510
|
+
minute,
|
|
511
|
+
"minute",
|
|
512
|
+
ctx.locale,
|
|
513
|
+
ctx.labelsOverrides
|
|
514
|
+
),
|
|
515
|
+
"aria-selected": isSelected,
|
|
516
|
+
children: _tigercatcore.padTwo.call(void 0, minute)
|
|
517
|
+
},
|
|
518
|
+
minute
|
|
519
|
+
);
|
|
520
|
+
}) })
|
|
521
|
+
] }),
|
|
522
|
+
ctx.showSeconds && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: _tigercatcore.timePickerColumnClasses, children: [
|
|
523
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: _tigercatcore.timePickerColumnHeaderClasses, children: ctx.labels.second }),
|
|
524
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: _tigercatcore.timePickerColumnListClasses, children: ctx.secondsList.map((second) => {
|
|
525
|
+
const isSelected = ctx.selectedSeconds === second;
|
|
526
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
527
|
+
"button",
|
|
528
|
+
{
|
|
529
|
+
type: "button",
|
|
530
|
+
className: _tigercatcore.getTimePickerItemClasses.call(void 0, isSelected, false),
|
|
531
|
+
onClick: () => ctx.selectSecond(second),
|
|
532
|
+
"data-tiger-timepicker-unit": "second",
|
|
533
|
+
"aria-label": _tigercatcore.getTimePickerOptionAriaLabel.call(void 0,
|
|
534
|
+
second,
|
|
535
|
+
"second",
|
|
536
|
+
ctx.locale,
|
|
537
|
+
ctx.labelsOverrides
|
|
538
|
+
),
|
|
539
|
+
"aria-selected": isSelected,
|
|
540
|
+
children: _tigercatcore.padTwo.call(void 0, second)
|
|
541
|
+
},
|
|
542
|
+
second
|
|
543
|
+
);
|
|
544
|
+
}) })
|
|
545
|
+
] }),
|
|
546
|
+
ctx.format === "12" && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: _tigercatcore.timePickerColumnClasses, children: [
|
|
547
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: _tigercatcore.timePickerColumnHeaderClasses, children: " " }),
|
|
548
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col", children: [
|
|
549
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
550
|
+
"button",
|
|
551
|
+
{
|
|
552
|
+
type: "button",
|
|
553
|
+
className: _tigercatcore.getTimePickerPeriodButtonClasses.call(void 0, ctx.selectedPeriod === "AM"),
|
|
554
|
+
onClick: () => ctx.selectPeriod("AM"),
|
|
555
|
+
"data-tiger-timepicker-unit": "period",
|
|
556
|
+
"aria-label": ctx.periodLabels.am,
|
|
557
|
+
"aria-selected": ctx.selectedPeriod === "AM",
|
|
558
|
+
children: ctx.periodLabels.am
|
|
559
|
+
}
|
|
560
|
+
),
|
|
561
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
562
|
+
"button",
|
|
563
|
+
{
|
|
564
|
+
type: "button",
|
|
565
|
+
className: _tigercatcore.getTimePickerPeriodButtonClasses.call(void 0, ctx.selectedPeriod === "PM"),
|
|
566
|
+
onClick: () => ctx.selectPeriod("PM"),
|
|
567
|
+
"data-tiger-timepicker-unit": "period",
|
|
568
|
+
"aria-label": ctx.periodLabels.pm,
|
|
569
|
+
"aria-selected": ctx.selectedPeriod === "PM",
|
|
570
|
+
children: ctx.periodLabels.pm
|
|
571
|
+
}
|
|
572
|
+
)
|
|
573
|
+
] })
|
|
574
|
+
] })
|
|
575
|
+
] });
|
|
576
|
+
}
|
|
577
|
+
|
|
578
|
+
// src/components/TimePicker/icons.tsx
|
|
579
|
+
|
|
580
|
+
|
|
581
|
+
var Icon = ({ path, className }) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
582
|
+
"svg",
|
|
583
|
+
{
|
|
584
|
+
className,
|
|
585
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
586
|
+
viewBox: _tigercatcore.icon20ViewBox,
|
|
587
|
+
fill: "currentColor",
|
|
588
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "path", { fillRule: "evenodd", d: path, clipRule: "evenodd" })
|
|
589
|
+
}
|
|
590
|
+
);
|
|
591
|
+
|
|
592
|
+
// src/components/TimePicker.tsx
|
|
593
|
+
|
|
594
|
+
var TimePicker = (allProps) => {
|
|
595
|
+
const ctx = useTimePickerState(allProps);
|
|
596
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: ctx.containerClasses, ...ctx.divProps, children: [
|
|
597
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { ref: ctx.inputWrapperRef, className: _tigercatcore.timePickerInputWrapperClasses, children: [
|
|
389
598
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
390
599
|
"input",
|
|
391
600
|
{
|
|
392
|
-
ref: inputRef,
|
|
601
|
+
ref: ctx.inputRef,
|
|
393
602
|
type: "text",
|
|
394
|
-
className: inputClasses,
|
|
395
|
-
value: displayValue,
|
|
396
|
-
placeholder,
|
|
397
|
-
disabled,
|
|
603
|
+
className: ctx.inputClasses,
|
|
604
|
+
value: ctx.displayValue,
|
|
605
|
+
placeholder: ctx.placeholder,
|
|
606
|
+
disabled: ctx.disabled,
|
|
398
607
|
readOnly: true,
|
|
399
|
-
required,
|
|
400
|
-
name,
|
|
401
|
-
id,
|
|
402
|
-
onClick: handleInputClick,
|
|
403
|
-
"aria-label": placeholder || labels.selectTime
|
|
608
|
+
required: ctx.required,
|
|
609
|
+
name: ctx.name,
|
|
610
|
+
id: ctx.id,
|
|
611
|
+
onClick: ctx.handleInputClick,
|
|
612
|
+
"aria-label": ctx.placeholder || ctx.labels.selectTime
|
|
404
613
|
}
|
|
405
614
|
),
|
|
406
|
-
showClearButton && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
615
|
+
ctx.showClearButton && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
407
616
|
"button",
|
|
408
617
|
{
|
|
409
618
|
type: "button",
|
|
410
619
|
className: _tigercatcore.timePickerClearButtonClasses,
|
|
411
|
-
onClick: clearTime,
|
|
412
|
-
"aria-label": labels.clear,
|
|
620
|
+
onClick: ctx.clearTime,
|
|
621
|
+
"aria-label": ctx.labels.clear,
|
|
413
622
|
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Icon, { path: _tigercatcore.TimePickerCloseIconPath, className: "w-4 h-4" })
|
|
414
623
|
}
|
|
415
624
|
),
|
|
@@ -417,203 +626,60 @@ var TimePicker = (allProps) => {
|
|
|
417
626
|
"button",
|
|
418
627
|
{
|
|
419
628
|
type: "button",
|
|
420
|
-
className: iconButtonClasses,
|
|
421
|
-
disabled: disabled || readonly,
|
|
422
|
-
onClick: togglePanel,
|
|
423
|
-
"aria-label": labels.toggle,
|
|
629
|
+
className: ctx.iconButtonClasses,
|
|
630
|
+
disabled: ctx.disabled || ctx.readonly,
|
|
631
|
+
onClick: ctx.togglePanel,
|
|
632
|
+
"aria-label": ctx.labels.toggle,
|
|
424
633
|
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Icon, { path: _tigercatcore.ClockIconPath, className: "w-5 h-5" })
|
|
425
634
|
}
|
|
426
635
|
)
|
|
427
636
|
] }),
|
|
428
|
-
isOpen && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
637
|
+
ctx.isOpen && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
429
638
|
"div",
|
|
430
639
|
{
|
|
431
|
-
ref: panelRef,
|
|
640
|
+
ref: ctx.panelRef,
|
|
432
641
|
className: _tigercatcore.timePickerPanelClasses,
|
|
433
642
|
role: "dialog",
|
|
434
|
-
"aria-label": labels.dialog,
|
|
435
|
-
onKeyDown: handlePanelKeyDown,
|
|
643
|
+
"aria-label": ctx.labels.dialog,
|
|
644
|
+
onKeyDown: ctx.handlePanelKeyDown,
|
|
436
645
|
children: [
|
|
437
|
-
isRangeMode && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: _tigercatcore.timePickerRangeHeaderClasses, children: [
|
|
646
|
+
ctx.isRangeMode && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: _tigercatcore.timePickerRangeHeaderClasses, children: [
|
|
438
647
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
439
648
|
"button",
|
|
440
649
|
{
|
|
441
650
|
type: "button",
|
|
442
|
-
className: _tigercatcore.getTimePickerRangeTabButtonClasses.call(void 0, activePart === "start"),
|
|
443
|
-
onClick: () => setActivePart("start"),
|
|
444
|
-
"aria-label": labels.start,
|
|
445
|
-
"aria-selected": activePart === "start",
|
|
446
|
-
children: labels.start
|
|
651
|
+
className: _tigercatcore.getTimePickerRangeTabButtonClasses.call(void 0, ctx.activePart === "start"),
|
|
652
|
+
onClick: () => ctx.setActivePart("start"),
|
|
653
|
+
"aria-label": ctx.labels.start,
|
|
654
|
+
"aria-selected": ctx.activePart === "start",
|
|
655
|
+
children: ctx.labels.start
|
|
447
656
|
}
|
|
448
657
|
),
|
|
449
658
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
450
659
|
"button",
|
|
451
660
|
{
|
|
452
661
|
type: "button",
|
|
453
|
-
className: _tigercatcore.getTimePickerRangeTabButtonClasses.call(void 0, activePart === "end"),
|
|
454
|
-
onClick: () => setActivePart("end"),
|
|
455
|
-
"aria-label": labels.end,
|
|
456
|
-
"aria-selected": activePart === "end",
|
|
457
|
-
children: labels.end
|
|
662
|
+
className: _tigercatcore.getTimePickerRangeTabButtonClasses.call(void 0, ctx.activePart === "end"),
|
|
663
|
+
onClick: () => ctx.setActivePart("end"),
|
|
664
|
+
"aria-label": ctx.labels.end,
|
|
665
|
+
"aria-selected": ctx.activePart === "end",
|
|
666
|
+
children: ctx.labels.end
|
|
458
667
|
}
|
|
459
668
|
)
|
|
460
669
|
] }),
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
className: _tigercatcore.timePickerMobileWheelSelectClasses,
|
|
466
|
-
value: format === "12" ? _tigercatcore.to12HourFormat.call(void 0, selectedHours).hours : selectedHours,
|
|
467
|
-
"aria-label": labels.hour,
|
|
468
|
-
onChange: (event) => selectHour(Number(event.target.value)),
|
|
469
|
-
children: hoursList.map((hour) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "option", { value: hour, disabled: isHourDisabled(hour), children: _tigercatcore.padTwo.call(void 0, hour) }, hour))
|
|
470
|
-
}
|
|
471
|
-
),
|
|
670
|
+
renderTimePickerMobile(ctx),
|
|
671
|
+
renderTimePickerDesktop(ctx),
|
|
672
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: _tigercatcore.timePickerFooterClasses, children: [
|
|
673
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "button", { type: "button", className: _tigercatcore.timePickerFooterButtonClasses, onClick: ctx.setNow, children: ctx.labels.now }),
|
|
472
674
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
473
|
-
"
|
|
474
|
-
{
|
|
475
|
-
className: _tigercatcore.timePickerMobileWheelSelectClasses,
|
|
476
|
-
value: selectedMinutes,
|
|
477
|
-
"aria-label": labels.minute,
|
|
478
|
-
onChange: (event) => selectMinute(Number(event.target.value)),
|
|
479
|
-
children: minutesList.map((minute) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "option", { value: minute, disabled: isMinuteDisabled(minute), children: _tigercatcore.padTwo.call(void 0, minute) }, minute))
|
|
480
|
-
}
|
|
481
|
-
),
|
|
482
|
-
showSeconds && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
483
|
-
"select",
|
|
484
|
-
{
|
|
485
|
-
className: _tigercatcore.timePickerMobileWheelSelectClasses,
|
|
486
|
-
value: selectedSeconds,
|
|
487
|
-
"aria-label": labels.second,
|
|
488
|
-
onChange: (event) => selectSecond(Number(event.target.value)),
|
|
489
|
-
children: secondsList.map((second) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "option", { value: second, children: _tigercatcore.padTwo.call(void 0, second) }, second))
|
|
490
|
-
}
|
|
491
|
-
),
|
|
492
|
-
format === "12" && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
493
|
-
"select",
|
|
675
|
+
"button",
|
|
494
676
|
{
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
children: [
|
|
500
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "option", { value: "AM", children: periodLabels.am }),
|
|
501
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "option", { value: "PM", children: periodLabels.pm })
|
|
502
|
-
]
|
|
677
|
+
type: "button",
|
|
678
|
+
className: _tigercatcore.timePickerFooterButtonClasses,
|
|
679
|
+
onClick: ctx.closePanel,
|
|
680
|
+
children: ctx.labels.ok
|
|
503
681
|
}
|
|
504
682
|
)
|
|
505
|
-
] }),
|
|
506
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: _tigercatcore.timePickerDesktopPanelContentClasses, children: [
|
|
507
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: _tigercatcore.timePickerColumnClasses, children: [
|
|
508
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: _tigercatcore.timePickerColumnHeaderClasses, children: labels.hour }),
|
|
509
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: _tigercatcore.timePickerColumnListClasses, children: hoursList.map((hour) => {
|
|
510
|
-
const hours24 = format === "12" ? _tigercatcore.to24HourFormat.call(void 0, hour, selectedPeriod) : hour;
|
|
511
|
-
const isSelected = selectedHours === hours24;
|
|
512
|
-
const isDisabled = isHourDisabled(hour);
|
|
513
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
514
|
-
"button",
|
|
515
|
-
{
|
|
516
|
-
type: "button",
|
|
517
|
-
className: _tigercatcore.getTimePickerItemClasses.call(void 0, isSelected, isDisabled),
|
|
518
|
-
disabled: isDisabled,
|
|
519
|
-
onClick: () => selectHour(hour),
|
|
520
|
-
"data-tiger-timepicker-unit": "hour",
|
|
521
|
-
"aria-label": _tigercatcore.getTimePickerOptionAriaLabel.call(void 0,
|
|
522
|
-
hour,
|
|
523
|
-
"hour",
|
|
524
|
-
locale,
|
|
525
|
-
labelsOverrides
|
|
526
|
-
),
|
|
527
|
-
"aria-selected": isSelected,
|
|
528
|
-
children: _tigercatcore.padTwo.call(void 0, hour)
|
|
529
|
-
},
|
|
530
|
-
hour
|
|
531
|
-
);
|
|
532
|
-
}) })
|
|
533
|
-
] }),
|
|
534
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: _tigercatcore.timePickerColumnClasses, children: [
|
|
535
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: _tigercatcore.timePickerColumnHeaderClasses, children: labels.minute }),
|
|
536
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: _tigercatcore.timePickerColumnListClasses, children: minutesList.map((minute) => {
|
|
537
|
-
const isSelected = selectedMinutes === minute;
|
|
538
|
-
const isDisabled = isMinuteDisabled(minute);
|
|
539
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
540
|
-
"button",
|
|
541
|
-
{
|
|
542
|
-
type: "button",
|
|
543
|
-
className: _tigercatcore.getTimePickerItemClasses.call(void 0, isSelected, isDisabled),
|
|
544
|
-
disabled: isDisabled,
|
|
545
|
-
onClick: () => selectMinute(minute),
|
|
546
|
-
"data-tiger-timepicker-unit": "minute",
|
|
547
|
-
"aria-label": _tigercatcore.getTimePickerOptionAriaLabel.call(void 0,
|
|
548
|
-
minute,
|
|
549
|
-
"minute",
|
|
550
|
-
locale,
|
|
551
|
-
labelsOverrides
|
|
552
|
-
),
|
|
553
|
-
"aria-selected": isSelected,
|
|
554
|
-
children: _tigercatcore.padTwo.call(void 0, minute)
|
|
555
|
-
},
|
|
556
|
-
minute
|
|
557
|
-
);
|
|
558
|
-
}) })
|
|
559
|
-
] }),
|
|
560
|
-
showSeconds && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: _tigercatcore.timePickerColumnClasses, children: [
|
|
561
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: _tigercatcore.timePickerColumnHeaderClasses, children: labels.second }),
|
|
562
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: _tigercatcore.timePickerColumnListClasses, children: secondsList.map((second) => {
|
|
563
|
-
const isSelected = selectedSeconds === second;
|
|
564
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
565
|
-
"button",
|
|
566
|
-
{
|
|
567
|
-
type: "button",
|
|
568
|
-
className: _tigercatcore.getTimePickerItemClasses.call(void 0, isSelected, false),
|
|
569
|
-
onClick: () => selectSecond(second),
|
|
570
|
-
"data-tiger-timepicker-unit": "second",
|
|
571
|
-
"aria-label": _tigercatcore.getTimePickerOptionAriaLabel.call(void 0,
|
|
572
|
-
second,
|
|
573
|
-
"second",
|
|
574
|
-
locale,
|
|
575
|
-
labelsOverrides
|
|
576
|
-
),
|
|
577
|
-
"aria-selected": isSelected,
|
|
578
|
-
children: _tigercatcore.padTwo.call(void 0, second)
|
|
579
|
-
},
|
|
580
|
-
second
|
|
581
|
-
);
|
|
582
|
-
}) })
|
|
583
|
-
] }),
|
|
584
|
-
format === "12" && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: _tigercatcore.timePickerColumnClasses, children: [
|
|
585
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: _tigercatcore.timePickerColumnHeaderClasses, children: " " }),
|
|
586
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col", children: [
|
|
587
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
588
|
-
"button",
|
|
589
|
-
{
|
|
590
|
-
type: "button",
|
|
591
|
-
className: _tigercatcore.getTimePickerPeriodButtonClasses.call(void 0, selectedPeriod === "AM"),
|
|
592
|
-
onClick: () => selectPeriod("AM"),
|
|
593
|
-
"data-tiger-timepicker-unit": "period",
|
|
594
|
-
"aria-label": periodLabels.am,
|
|
595
|
-
"aria-selected": selectedPeriod === "AM",
|
|
596
|
-
children: periodLabels.am
|
|
597
|
-
}
|
|
598
|
-
),
|
|
599
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
600
|
-
"button",
|
|
601
|
-
{
|
|
602
|
-
type: "button",
|
|
603
|
-
className: _tigercatcore.getTimePickerPeriodButtonClasses.call(void 0, selectedPeriod === "PM"),
|
|
604
|
-
onClick: () => selectPeriod("PM"),
|
|
605
|
-
"data-tiger-timepicker-unit": "period",
|
|
606
|
-
"aria-label": periodLabels.pm,
|
|
607
|
-
"aria-selected": selectedPeriod === "PM",
|
|
608
|
-
children: periodLabels.pm
|
|
609
|
-
}
|
|
610
|
-
)
|
|
611
|
-
] })
|
|
612
|
-
] })
|
|
613
|
-
] }),
|
|
614
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: _tigercatcore.timePickerFooterClasses, children: [
|
|
615
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "button", { type: "button", className: _tigercatcore.timePickerFooterButtonClasses, onClick: setNow, children: labels.now }),
|
|
616
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "button", { type: "button", className: _tigercatcore.timePickerFooterButtonClasses, onClick: closePanel, children: labels.ok })
|
|
617
683
|
] })
|
|
618
684
|
]
|
|
619
685
|
}
|