@xaui/native 0.0.26 → 0.0.28
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/LICENSE +21 -0
- package/README.md +105 -228
- package/dist/alert/index.cjs +92 -166
- package/dist/alert/index.js +2 -1
- package/dist/app-bar/index.cjs +24 -98
- package/dist/app-bar/index.js +2 -1
- package/dist/autocomplete/index.cjs +192 -281
- package/dist/autocomplete/index.js +36 -48
- package/dist/avatar/index.cjs +59 -133
- package/dist/avatar/index.js +2 -1
- package/dist/badge/index.cjs +26 -99
- package/dist/badge/index.js +2 -1
- package/dist/bottom-sheet/index.cjs +5 -456
- package/dist/bottom-sheet/index.js +4 -363
- package/dist/bottom-tab-bar/index.cjs +93 -167
- package/dist/bottom-tab-bar/index.js +2 -2
- package/dist/button/index.cjs +73 -525
- package/dist/button/index.js +3 -2
- package/dist/card/index.cjs +76 -169
- package/dist/card/index.js +2 -2
- package/dist/carousel/index.cjs +68 -145
- package/dist/carousel/index.js +1 -1
- package/dist/chart/index.cjs +132 -173
- package/dist/checkbox/index.cjs +70 -143
- package/dist/checkbox/index.js +2 -1
- package/dist/chip/index.cjs +89 -164
- package/dist/chip/index.js +2 -1
- package/dist/chunk-BD72HIPR.cjs +75 -0
- package/dist/chunk-DHSTKO3K.cjs +19 -0
- package/dist/{chunk-CZFDZPAS.js → chunk-DXXNBF5P.js} +5 -0
- package/dist/{chunk-UI5L26KD.js → chunk-F7WH4DMG.js} +1 -1
- package/dist/chunk-GBHQCAKW.js +19 -0
- package/dist/chunk-HC2SSHNU.js +368 -0
- package/dist/chunk-HSPTLUFA.cjs +7 -0
- package/dist/chunk-JEGEPGVU.js +287 -0
- package/dist/chunk-KTLGDLCB.cjs +287 -0
- package/dist/{chunk-GHCVNQET.js → chunk-LTKYHG5V.js} +5 -12
- package/dist/{chunk-ULJSCNPE.js → chunk-LUBWRVI2.js} +1 -1
- package/dist/chunk-OQ2BLOOG.cjs +138 -0
- package/dist/chunk-QMYWIWSX.cjs +384 -0
- package/dist/chunk-XFPPR2VB.cjs +368 -0
- package/dist/core/index.cjs +22 -168
- package/dist/core/index.d.cts +1 -1
- package/dist/core/index.d.ts +1 -1
- package/dist/core/index.js +5 -3
- package/dist/datepicker/index.cjs +239 -320
- package/dist/datepicker/index.js +2 -1
- package/dist/divider/index.cjs +5 -145
- package/dist/divider/index.js +3 -2
- package/dist/drawer/index.cjs +39 -112
- package/dist/drawer/index.js +2 -1
- package/dist/expansion-panel/index.cjs +91 -230
- package/dist/expansion-panel/index.js +3 -2
- package/dist/fab/index.cjs +6 -722
- package/dist/fab/index.js +4 -3
- package/dist/fab-menu/index.cjs +81 -814
- package/dist/fab-menu/index.js +4 -3
- package/dist/feature-discovery/index.cjs +72 -139
- package/dist/feature-discovery/index.js +2 -2
- package/dist/index.cjs +1 -18
- package/dist/indicator/index.cjs +5 -445
- package/dist/indicator/index.js +3 -2
- package/dist/input/index.cjs +214 -282
- package/dist/input/index.js +2 -2
- package/dist/list/index.cjs +71 -146
- package/dist/list/index.js +2 -1
- package/dist/menu/index.cjs +59 -127
- package/dist/menu/index.js +2 -2
- package/dist/menubox/index.cjs +60 -132
- package/dist/menubox/index.js +2 -1
- package/dist/pager/index.cjs +42 -80
- package/dist/progress/index.cjs +43 -114
- package/dist/progress/index.js +2 -1
- package/dist/radio/index.cjs +82 -154
- package/dist/radio/index.js +2 -1
- package/dist/segment-button/index.cjs +60 -147
- package/dist/segment-button/index.js +2 -2
- package/dist/select/index.cjs +149 -224
- package/dist/select/index.js +10 -22
- package/dist/skeleton/index.cjs +23 -94
- package/dist/skeleton/index.js +2 -2
- package/dist/slider/index.cjs +77 -156
- package/dist/slider/index.js +2 -1
- package/dist/snackbar/index.cjs +420 -0
- package/dist/snackbar/index.d.cts +175 -0
- package/dist/snackbar/index.d.ts +175 -0
- package/dist/snackbar/index.js +420 -0
- package/dist/stepper/index.cjs +121 -195
- package/dist/stepper/index.js +2 -1
- package/dist/switch/index.cjs +48 -121
- package/dist/switch/index.js +2 -1
- package/dist/tabs/index.cjs +67 -151
- package/dist/tabs/index.js +2 -1
- package/dist/timepicker/index.cjs +135 -593
- package/dist/timepicker/index.js +24 -383
- package/dist/toolbar/index.cjs +59 -128
- package/dist/toolbar/index.js +2 -1
- package/dist/typography/index.cjs +37 -92
- package/dist/typography/index.d.cts +1 -1
- package/dist/typography/index.d.ts +1 -1
- package/dist/typography/index.js +20 -1
- package/dist/view/index.cjs +178 -223
- package/package.json +7 -1
- package/dist/chunk-3XSXTM3G.js +0 -661
- package/dist/chunk-4KSZLONZ.js +0 -79
- package/dist/chunk-I4V5Y5GD.js +0 -76
- package/dist/chunk-URBEEDFX.js +0 -79
|
@@ -1,119 +1,24 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 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; }
|
|
29
2
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
__export(timepicker_exports, {
|
|
33
|
-
TimePicker: () => TimePicker,
|
|
34
|
-
TimePickerDialog: () => TimePickerDialog,
|
|
35
|
-
TimePickerTrigger: () => TimePickerTrigger,
|
|
36
|
-
angleToHour: () => angleToHour,
|
|
37
|
-
angleToMinute: () => angleToMinute,
|
|
38
|
-
calculateAngleFromPosition: () => calculateAngleFromPosition,
|
|
39
|
-
clampHour: () => clampHour,
|
|
40
|
-
clampMinute: () => clampMinute,
|
|
41
|
-
formatTimeValue: () => formatTimeValue,
|
|
42
|
-
getCurrentTime: () => getCurrentTime,
|
|
43
|
-
getHourAngle: () => getHourAngle,
|
|
44
|
-
getMinuteAngle: () => getMinuteAngle,
|
|
45
|
-
isTimeInRange: () => isTimeInRange,
|
|
46
|
-
to12HourFormat: () => to12HourFormat,
|
|
47
|
-
to24HourFormat: () => to24HourFormat
|
|
48
|
-
});
|
|
49
|
-
module.exports = __toCommonJS(timepicker_exports);
|
|
3
|
+
var _chunkXFPPR2VBcjs = require('../chunk-XFPPR2VB.cjs');
|
|
4
|
+
require('../chunk-HSPTLUFA.cjs');
|
|
50
5
|
|
|
51
|
-
// src/components/timepicker/timepicker.tsx
|
|
52
|
-
var import_react7 = __toESM(require("react"), 1);
|
|
53
|
-
var import_react_native5 = require("react-native");
|
|
54
|
-
var import_react_native_reanimated = __toESM(require("react-native-reanimated"), 1);
|
|
55
6
|
|
|
56
|
-
|
|
57
|
-
var import_react6 = require("react");
|
|
58
|
-
var import_core = require("@xaui/core");
|
|
7
|
+
var _chunkOQ2BLOOGcjs = require('../chunk-OQ2BLOOG.cjs');
|
|
59
8
|
|
|
60
|
-
// src/
|
|
61
|
-
var
|
|
62
|
-
var
|
|
63
|
-
var import_theme = require("@xaui/core/theme");
|
|
64
|
-
var import_palette = require("@xaui/core/palette");
|
|
9
|
+
// src/components/timepicker/timepicker.tsx
|
|
10
|
+
var _react = require('react'); var _react2 = _interopRequireDefault(_react);
|
|
11
|
+
var _reactnative = require('react-native');
|
|
65
12
|
|
|
66
|
-
// src/core/portal/portal.tsx
|
|
67
|
-
var import_react2 = require("react");
|
|
68
13
|
|
|
69
|
-
// src/core/portal/portal-context.ts
|
|
70
|
-
var import_react = require("react");
|
|
71
|
-
var PortalContext = (0, import_react.createContext)(null);
|
|
72
14
|
|
|
73
|
-
// src/core/portal/portal.tsx
|
|
74
|
-
var portalId = 0;
|
|
75
|
-
var Portal = ({ children }) => {
|
|
76
|
-
const context = (0, import_react2.useContext)(PortalContext);
|
|
77
|
-
const keyRef = (0, import_react2.useRef)(`portal-${++portalId}`);
|
|
78
|
-
(0, import_react2.useLayoutEffect)(() => {
|
|
79
|
-
if (!context) return;
|
|
80
|
-
context.addPortal(keyRef.current, children);
|
|
81
|
-
}, [children, context]);
|
|
82
|
-
(0, import_react2.useEffect)(() => {
|
|
83
|
-
if (!context) return;
|
|
84
|
-
const key = keyRef.current;
|
|
85
|
-
return () => {
|
|
86
|
-
context.removePortal(key);
|
|
87
|
-
};
|
|
88
|
-
}, [context]);
|
|
89
|
-
return null;
|
|
90
|
-
};
|
|
91
15
|
|
|
92
|
-
// src/core/portal/portal-host.tsx
|
|
93
|
-
var import_react3 = __toESM(require("react"), 1);
|
|
94
|
-
var import_react_native = require("react-native");
|
|
95
|
-
var hostStyles = import_react_native.StyleSheet.create({
|
|
96
|
-
container: {
|
|
97
|
-
flex: 1
|
|
98
|
-
}
|
|
99
|
-
});
|
|
100
16
|
|
|
101
|
-
|
|
102
|
-
var XUIThemeContext = (0, import_react4.createContext)(null);
|
|
17
|
+
var _reactnativereanimated = require('react-native-reanimated'); var _reactnativereanimated2 = _interopRequireDefault(_reactnativereanimated);
|
|
103
18
|
|
|
104
|
-
// src/
|
|
105
|
-
var import_react5 = require("react");
|
|
106
|
-
var import_react_native3 = require("react-native");
|
|
107
|
-
function useXUITheme() {
|
|
108
|
-
const theme = (0, import_react5.useContext)(XUIThemeContext);
|
|
109
|
-
if (!theme) {
|
|
110
|
-
throw new Error("useXUITheme must be used within XUIProvider");
|
|
111
|
-
}
|
|
112
|
-
return theme;
|
|
113
|
-
}
|
|
19
|
+
// src/components/timepicker/timepicker.hook.ts
|
|
114
20
|
|
|
115
|
-
|
|
116
|
-
var import_theme2 = require("@xaui/core/theme");
|
|
21
|
+
var _core = require('@xaui/core');
|
|
117
22
|
|
|
118
23
|
// src/components/timepicker/timepicker.utils.ts
|
|
119
24
|
var to12HourFormat = (hours) => {
|
|
@@ -197,9 +102,9 @@ var clampMinute = (minute) => {
|
|
|
197
102
|
|
|
198
103
|
// src/components/timepicker/timepicker.hook.ts
|
|
199
104
|
var useTimePickerState = (initialValue, is24Hour = false, onChange) => {
|
|
200
|
-
const [time, setTime] = (0,
|
|
201
|
-
const [mode, setMode] = (0,
|
|
202
|
-
const { hours: displayHours, period } = (0,
|
|
105
|
+
const [time, setTime] = _react.useState.call(void 0, initialValue || getCurrentTime());
|
|
106
|
+
const [mode, setMode] = _react.useState.call(void 0, "hour");
|
|
107
|
+
const { hours: displayHours, period } = _react.useMemo.call(void 0,
|
|
203
108
|
() => is24Hour ? { hours: time.hours, period: "AM" } : to12HourFormat(time.hours),
|
|
204
109
|
[time.hours, is24Hour]
|
|
205
110
|
);
|
|
@@ -209,7 +114,7 @@ var useTimePickerState = (initialValue, is24Hour = false, onChange) => {
|
|
|
209
114
|
hours: hour
|
|
210
115
|
};
|
|
211
116
|
setTime(newTime);
|
|
212
|
-
onChange
|
|
117
|
+
_optionalChain([onChange, 'optionalCall', _2 => _2(newTime)]);
|
|
213
118
|
setMode("minute");
|
|
214
119
|
};
|
|
215
120
|
const handleMinuteChange = (minute) => {
|
|
@@ -218,7 +123,7 @@ var useTimePickerState = (initialValue, is24Hour = false, onChange) => {
|
|
|
218
123
|
minutes: minute
|
|
219
124
|
};
|
|
220
125
|
setTime(newTime);
|
|
221
|
-
onChange
|
|
126
|
+
_optionalChain([onChange, 'optionalCall', _3 => _3(newTime)]);
|
|
222
127
|
};
|
|
223
128
|
const handlePeriodToggle = (newPeriod) => {
|
|
224
129
|
if (is24Hour) return;
|
|
@@ -228,12 +133,12 @@ var useTimePickerState = (initialValue, is24Hour = false, onChange) => {
|
|
|
228
133
|
hours: newHours
|
|
229
134
|
};
|
|
230
135
|
setTime(newTime);
|
|
231
|
-
onChange
|
|
136
|
+
_optionalChain([onChange, 'optionalCall', _4 => _4(newTime)]);
|
|
232
137
|
};
|
|
233
138
|
const handleManualInput = (hours, minutes) => {
|
|
234
139
|
const newTime = { hours, minutes };
|
|
235
140
|
setTime(newTime);
|
|
236
|
-
onChange
|
|
141
|
+
_optionalChain([onChange, 'optionalCall', _5 => _5(newTime)]);
|
|
237
142
|
};
|
|
238
143
|
const toggleMode = () => {
|
|
239
144
|
setMode((prev) => prev === "hour" ? "minute" : "hour");
|
|
@@ -252,19 +157,19 @@ var useTimePickerState = (initialValue, is24Hour = false, onChange) => {
|
|
|
252
157
|
};
|
|
253
158
|
};
|
|
254
159
|
var useTimePickerColors = (themeColor) => {
|
|
255
|
-
const theme = useXUITheme();
|
|
256
|
-
const colorScheme = theme.colors[(0,
|
|
257
|
-
return (0,
|
|
160
|
+
const theme = _chunkOQ2BLOOGcjs.useXUITheme.call(void 0, );
|
|
161
|
+
const colorScheme = theme.colors[_core.getSafeThemeColor.call(void 0, themeColor)];
|
|
162
|
+
return _react.useMemo.call(void 0, () => {
|
|
258
163
|
return {
|
|
259
164
|
background: theme.colors.background,
|
|
260
|
-
surface: (0,
|
|
165
|
+
surface: _core.withOpacity.call(void 0, colorScheme.main, 0.12),
|
|
261
166
|
primary: colorScheme.main,
|
|
262
167
|
onPrimary: colorScheme.foreground,
|
|
263
168
|
text: theme.colors.foreground,
|
|
264
|
-
textSecondary: (0,
|
|
265
|
-
border: (0,
|
|
266
|
-
clockFace: (0,
|
|
267
|
-
selectedDigit: (0,
|
|
169
|
+
textSecondary: _core.withOpacity.call(void 0, theme.colors.foreground, 0.6),
|
|
170
|
+
border: _core.withOpacity.call(void 0, theme.colors.foreground, 0.12),
|
|
171
|
+
clockFace: _core.withOpacity.call(void 0, colorScheme.main, 0.08),
|
|
172
|
+
selectedDigit: _core.withOpacity.call(void 0, colorScheme.main, 0.12)
|
|
268
173
|
};
|
|
269
174
|
}, [
|
|
270
175
|
colorScheme.main,
|
|
@@ -275,8 +180,8 @@ var useTimePickerColors = (themeColor) => {
|
|
|
275
180
|
};
|
|
276
181
|
|
|
277
182
|
// src/components/timepicker/timepicker.style.ts
|
|
278
|
-
|
|
279
|
-
var styles =
|
|
183
|
+
|
|
184
|
+
var styles = _reactnative.StyleSheet.create({
|
|
280
185
|
container: {
|
|
281
186
|
padding: 24,
|
|
282
187
|
alignItems: "center"
|
|
@@ -482,33 +387,33 @@ var TimePicker = ({
|
|
|
482
387
|
handleManualInput,
|
|
483
388
|
setMode
|
|
484
389
|
} = useTimePickerState(value, is24Hour, onChange);
|
|
485
|
-
const
|
|
486
|
-
const hourAngle = (0,
|
|
390
|
+
const colors = useTimePickerColors(themeColor);
|
|
391
|
+
const hourAngle = _react.useMemo.call(void 0,
|
|
487
392
|
() => getHourAngle(displayHours, is24Hour),
|
|
488
393
|
[displayHours, is24Hour]
|
|
489
394
|
);
|
|
490
|
-
const minuteAngle = (0,
|
|
395
|
+
const minuteAngle = _react.useMemo.call(void 0, () => getMinuteAngle(time.minutes), [time.minutes]);
|
|
491
396
|
const currentAngle = mode === "hour" ? hourAngle : minuteAngle;
|
|
492
|
-
const handRotation = (0,
|
|
493
|
-
const [hourInput, setHourInput] = (0,
|
|
397
|
+
const handRotation = _reactnativereanimated.useSharedValue.call(void 0, currentAngle);
|
|
398
|
+
const [hourInput, setHourInput] = _react.useState.call(void 0,
|
|
494
399
|
displayHours.toString().padStart(2, "0")
|
|
495
400
|
);
|
|
496
|
-
const [minuteInput, setMinuteInput] = (0,
|
|
401
|
+
const [minuteInput, setMinuteInput] = _react.useState.call(void 0,
|
|
497
402
|
time.minutes.toString().padStart(2, "0")
|
|
498
403
|
);
|
|
499
|
-
(0,
|
|
500
|
-
handRotation.value = (0,
|
|
404
|
+
_react.useEffect.call(void 0, () => {
|
|
405
|
+
handRotation.value = _reactnativereanimated.withTiming.call(void 0, currentAngle - 180, {
|
|
501
406
|
duration: 120,
|
|
502
|
-
easing:
|
|
407
|
+
easing: _reactnativereanimated.Easing.out(_reactnativereanimated.Easing.cubic)
|
|
503
408
|
});
|
|
504
409
|
}, [currentAngle, handRotation]);
|
|
505
|
-
(0,
|
|
410
|
+
_react.useEffect.call(void 0, () => {
|
|
506
411
|
setHourInput(displayHours.toString().padStart(2, "0"));
|
|
507
412
|
}, [displayHours]);
|
|
508
|
-
(0,
|
|
413
|
+
_react.useEffect.call(void 0, () => {
|
|
509
414
|
setMinuteInput(time.minutes.toString().padStart(2, "0"));
|
|
510
415
|
}, [time.minutes]);
|
|
511
|
-
const handStyle = (0,
|
|
416
|
+
const handStyle = _reactnativereanimated.useAnimatedStyle.call(void 0, () => ({
|
|
512
417
|
transform: [{ rotate: `${handRotation.value}deg` }]
|
|
513
418
|
}));
|
|
514
419
|
const commitHourInput = () => {
|
|
@@ -552,46 +457,46 @@ var TimePicker = ({
|
|
|
552
457
|
const innerY = innerRadius * Math.sin(radian);
|
|
553
458
|
const outerSelected = outerValue === displayHours;
|
|
554
459
|
const innerSelected = innerValue === displayHours;
|
|
555
|
-
return /* @__PURE__ */
|
|
556
|
-
|
|
460
|
+
return /* @__PURE__ */ _react2.default.createElement(_react2.default.Fragment, { key: `hour-24-slot-${slot}` }, /* @__PURE__ */ _react2.default.createElement(
|
|
461
|
+
_reactnative.Pressable,
|
|
557
462
|
{
|
|
558
463
|
onPress: () => handleHourChange(outerValue),
|
|
559
464
|
style: [
|
|
560
465
|
styles.clockNumber,
|
|
561
466
|
{
|
|
562
467
|
transform: [{ translateX: outerX }, { translateY: outerY }],
|
|
563
|
-
backgroundColor: outerSelected ?
|
|
468
|
+
backgroundColor: outerSelected ? colors.primary : "transparent"
|
|
564
469
|
}
|
|
565
470
|
]
|
|
566
471
|
},
|
|
567
|
-
/* @__PURE__ */
|
|
568
|
-
|
|
472
|
+
/* @__PURE__ */ _react2.default.createElement(
|
|
473
|
+
_reactnative.Text,
|
|
569
474
|
{
|
|
570
475
|
style: [
|
|
571
476
|
styles.clockNumberText,
|
|
572
|
-
{ color: outerSelected ?
|
|
477
|
+
{ color: outerSelected ? colors.onPrimary : colors.text }
|
|
573
478
|
]
|
|
574
479
|
},
|
|
575
480
|
outerValue
|
|
576
481
|
)
|
|
577
|
-
), /* @__PURE__ */
|
|
578
|
-
|
|
482
|
+
), /* @__PURE__ */ _react2.default.createElement(
|
|
483
|
+
_reactnative.Pressable,
|
|
579
484
|
{
|
|
580
485
|
onPress: () => handleHourChange(innerValue),
|
|
581
486
|
style: [
|
|
582
487
|
styles.clockNumber,
|
|
583
488
|
{
|
|
584
489
|
transform: [{ translateX: innerX }, { translateY: innerY }],
|
|
585
|
-
backgroundColor: innerSelected ?
|
|
490
|
+
backgroundColor: innerSelected ? colors.primary : "transparent"
|
|
586
491
|
}
|
|
587
492
|
]
|
|
588
493
|
},
|
|
589
|
-
/* @__PURE__ */
|
|
590
|
-
|
|
494
|
+
/* @__PURE__ */ _react2.default.createElement(
|
|
495
|
+
_reactnative.Text,
|
|
591
496
|
{
|
|
592
497
|
style: [
|
|
593
498
|
styles.clockNumberText,
|
|
594
|
-
{ color: innerSelected ?
|
|
499
|
+
{ color: innerSelected ? colors.onPrimary : colors.text }
|
|
595
500
|
]
|
|
596
501
|
},
|
|
597
502
|
innerValue === 0 ? 24 : innerValue
|
|
@@ -609,8 +514,8 @@ var TimePicker = ({
|
|
|
609
514
|
const x = radius * Math.cos(radian);
|
|
610
515
|
const y = radius * Math.sin(radian);
|
|
611
516
|
const isSelected = mode === "hour" ? value2 === displayHours : value2 === time.minutes;
|
|
612
|
-
return /* @__PURE__ */
|
|
613
|
-
|
|
517
|
+
return /* @__PURE__ */ _react2.default.createElement(
|
|
518
|
+
_reactnative.Pressable,
|
|
614
519
|
{
|
|
615
520
|
key: `${mode}-${value2}`,
|
|
616
521
|
onPress: () => {
|
|
@@ -624,16 +529,16 @@ var TimePicker = ({
|
|
|
624
529
|
styles.clockNumber,
|
|
625
530
|
{
|
|
626
531
|
transform: [{ translateX: x }, { translateY: y }],
|
|
627
|
-
backgroundColor: isSelected ?
|
|
532
|
+
backgroundColor: isSelected ? colors.primary : "transparent"
|
|
628
533
|
}
|
|
629
534
|
]
|
|
630
535
|
},
|
|
631
|
-
/* @__PURE__ */
|
|
632
|
-
|
|
536
|
+
/* @__PURE__ */ _react2.default.createElement(
|
|
537
|
+
_reactnative.Text,
|
|
633
538
|
{
|
|
634
539
|
style: [
|
|
635
540
|
styles.clockNumberText,
|
|
636
|
-
{ color: isSelected ?
|
|
541
|
+
{ color: isSelected ? colors.onPrimary : colors.text }
|
|
637
542
|
]
|
|
638
543
|
},
|
|
639
544
|
mode === "minute" && value2 < 10 ? `0${value2}` : value2
|
|
@@ -641,19 +546,19 @@ var TimePicker = ({
|
|
|
641
546
|
);
|
|
642
547
|
});
|
|
643
548
|
};
|
|
644
|
-
return /* @__PURE__ */
|
|
645
|
-
|
|
549
|
+
return /* @__PURE__ */ _react2.default.createElement(_reactnative.View, { style: [styles.container, style] }, /* @__PURE__ */ _react2.default.createElement(_reactnative.View, { style: styles.header }, /* @__PURE__ */ _react2.default.createElement(_reactnative.Text, { style: [styles.headerTitle, { color: colors.textSecondary }] }, "Select time"), /* @__PURE__ */ _react2.default.createElement(
|
|
550
|
+
_reactnative.View,
|
|
646
551
|
{
|
|
647
552
|
style: [styles.timeDisplay, !is24Hour && styles.timeDisplayWithPeriod]
|
|
648
553
|
},
|
|
649
|
-
/* @__PURE__ */
|
|
650
|
-
|
|
554
|
+
/* @__PURE__ */ _react2.default.createElement(_reactnative.View, { style: styles.timeSection }, /* @__PURE__ */ _react2.default.createElement(
|
|
555
|
+
_reactnative.TextInput,
|
|
651
556
|
{
|
|
652
557
|
style: [
|
|
653
558
|
styles.timeDigit,
|
|
654
559
|
{
|
|
655
|
-
color: mode === "hour" ?
|
|
656
|
-
backgroundColor: mode === "hour" ?
|
|
560
|
+
color: mode === "hour" ? colors.primary : colors.text,
|
|
561
|
+
backgroundColor: mode === "hour" ? colors.selectedDigit : "transparent"
|
|
657
562
|
}
|
|
658
563
|
],
|
|
659
564
|
value: hourInput,
|
|
@@ -675,14 +580,14 @@ var TimePicker = ({
|
|
|
675
580
|
maxLength: 2,
|
|
676
581
|
selectTextOnFocus: true
|
|
677
582
|
}
|
|
678
|
-
), /* @__PURE__ */
|
|
679
|
-
|
|
583
|
+
), /* @__PURE__ */ _react2.default.createElement(_reactnative.Text, { style: [styles.timeSeparator, { color: colors.text }] }, ":"), /* @__PURE__ */ _react2.default.createElement(
|
|
584
|
+
_reactnative.TextInput,
|
|
680
585
|
{
|
|
681
586
|
style: [
|
|
682
587
|
styles.timeDigit,
|
|
683
588
|
{
|
|
684
|
-
color: mode === "minute" ?
|
|
685
|
-
backgroundColor: mode === "minute" ?
|
|
589
|
+
color: mode === "minute" ? colors.primary : colors.text,
|
|
590
|
+
backgroundColor: mode === "minute" ? colors.selectedDigit : "transparent"
|
|
686
591
|
}
|
|
687
592
|
],
|
|
688
593
|
value: minuteInput,
|
|
@@ -703,53 +608,53 @@ var TimePicker = ({
|
|
|
703
608
|
selectTextOnFocus: true
|
|
704
609
|
}
|
|
705
610
|
)),
|
|
706
|
-
!is24Hour && /* @__PURE__ */
|
|
707
|
-
|
|
611
|
+
!is24Hour && /* @__PURE__ */ _react2.default.createElement(_reactnative.View, { style: styles.periodSelector }, /* @__PURE__ */ _react2.default.createElement(
|
|
612
|
+
_reactnative.Pressable,
|
|
708
613
|
{
|
|
709
614
|
onPress: () => handlePeriodToggle("AM"),
|
|
710
615
|
style: [
|
|
711
616
|
styles.periodButton,
|
|
712
617
|
{
|
|
713
|
-
backgroundColor: period === "AM" ?
|
|
714
|
-
borderColor: period === "AM" ?
|
|
618
|
+
backgroundColor: period === "AM" ? colors.surface : "transparent",
|
|
619
|
+
borderColor: period === "AM" ? colors.primary : colors.border
|
|
715
620
|
}
|
|
716
621
|
]
|
|
717
622
|
},
|
|
718
|
-
/* @__PURE__ */
|
|
719
|
-
|
|
623
|
+
/* @__PURE__ */ _react2.default.createElement(
|
|
624
|
+
_reactnative.Text,
|
|
720
625
|
{
|
|
721
626
|
style: [
|
|
722
627
|
styles.periodText,
|
|
723
|
-
{ color: period === "AM" ?
|
|
628
|
+
{ color: period === "AM" ? colors.primary : colors.text }
|
|
724
629
|
]
|
|
725
630
|
},
|
|
726
631
|
"AM"
|
|
727
632
|
)
|
|
728
|
-
), /* @__PURE__ */
|
|
729
|
-
|
|
633
|
+
), /* @__PURE__ */ _react2.default.createElement(
|
|
634
|
+
_reactnative.Pressable,
|
|
730
635
|
{
|
|
731
636
|
onPress: () => handlePeriodToggle("PM"),
|
|
732
637
|
style: [
|
|
733
638
|
styles.periodButton,
|
|
734
639
|
{
|
|
735
|
-
backgroundColor: period === "PM" ?
|
|
736
|
-
borderColor: period === "PM" ?
|
|
640
|
+
backgroundColor: period === "PM" ? colors.surface : "transparent",
|
|
641
|
+
borderColor: period === "PM" ? colors.primary : colors.border
|
|
737
642
|
}
|
|
738
643
|
]
|
|
739
644
|
},
|
|
740
|
-
/* @__PURE__ */
|
|
741
|
-
|
|
645
|
+
/* @__PURE__ */ _react2.default.createElement(
|
|
646
|
+
_reactnative.Text,
|
|
742
647
|
{
|
|
743
648
|
style: [
|
|
744
649
|
styles.periodText,
|
|
745
|
-
{ color: period === "PM" ?
|
|
650
|
+
{ color: period === "PM" ? colors.primary : colors.text }
|
|
746
651
|
]
|
|
747
652
|
},
|
|
748
653
|
"PM"
|
|
749
654
|
)
|
|
750
655
|
))
|
|
751
|
-
)), /* @__PURE__ */
|
|
752
|
-
|
|
656
|
+
)), /* @__PURE__ */ _react2.default.createElement(_reactnative.View, { style: styles.clockContainer }, /* @__PURE__ */ _react2.default.createElement(_reactnative.View, { style: [styles.clockFace, { backgroundColor: colors.clockFace }] }, renderClockNumbers(), /* @__PURE__ */ _react2.default.createElement(_reactnative.View, { style: [styles.clockCenter, { backgroundColor: colors.primary }] }), /* @__PURE__ */ _react2.default.createElement(
|
|
657
|
+
_reactnativereanimated2.default.View,
|
|
753
658
|
{
|
|
754
659
|
style: [
|
|
755
660
|
styles.clockHand,
|
|
@@ -762,389 +667,27 @@ var TimePicker = ({
|
|
|
762
667
|
handStyle
|
|
763
668
|
]
|
|
764
669
|
},
|
|
765
|
-
/* @__PURE__ */
|
|
766
|
-
|
|
670
|
+
/* @__PURE__ */ _react2.default.createElement(
|
|
671
|
+
_reactnative.View,
|
|
767
672
|
{
|
|
768
673
|
style: [
|
|
769
674
|
styles.clockHandLine,
|
|
770
|
-
{ height: "100%", backgroundColor:
|
|
675
|
+
{ height: "100%", backgroundColor: colors.primary }
|
|
771
676
|
]
|
|
772
677
|
}
|
|
773
678
|
),
|
|
774
|
-
/* @__PURE__ */
|
|
775
|
-
|
|
679
|
+
/* @__PURE__ */ _react2.default.createElement(
|
|
680
|
+
_reactnative.View,
|
|
776
681
|
{
|
|
777
|
-
style: [styles.clockHandDot, { backgroundColor:
|
|
682
|
+
style: [styles.clockHandDot, { backgroundColor: colors.primary }]
|
|
778
683
|
}
|
|
779
684
|
)
|
|
780
685
|
))));
|
|
781
686
|
};
|
|
782
687
|
|
|
783
688
|
// src/components/timepicker/timepicker-dialog.tsx
|
|
784
|
-
var import_react10 = __toESM(require("react"), 1);
|
|
785
|
-
var import_react_native10 = require("react-native");
|
|
786
|
-
|
|
787
|
-
// src/components/bottom-sheet/bottom-sheet.tsx
|
|
788
|
-
var import_react9 = __toESM(require("react"), 1);
|
|
789
|
-
var import_react_native9 = require("react-native");
|
|
790
689
|
|
|
791
|
-
// src/components/bottom-sheet/bottom-sheet.hook.ts
|
|
792
|
-
var import_react8 = require("react");
|
|
793
|
-
var import_react_native7 = require("react-native");
|
|
794
|
-
var import_core4 = require("@xaui/core");
|
|
795
|
-
|
|
796
|
-
// src/components/bottom-sheet/bottom-sheet.animation.ts
|
|
797
|
-
var import_react_native6 = require("react-native");
|
|
798
|
-
var SPRING_CONFIG = {
|
|
799
|
-
useNativeDriver: true,
|
|
800
|
-
speed: 14,
|
|
801
|
-
bounciness: 4
|
|
802
|
-
};
|
|
803
|
-
var TIMING_CONFIG = {
|
|
804
|
-
duration: 280,
|
|
805
|
-
easing: import_react_native6.Easing.bezier(0.2, 0, 0, 1),
|
|
806
|
-
useNativeDriver: true
|
|
807
|
-
};
|
|
808
|
-
var runOpenAnimation = (translateY, backdropOpacity, targetTranslateY) => {
|
|
809
|
-
const animation = import_react_native6.Animated.parallel([
|
|
810
|
-
import_react_native6.Animated.spring(translateY, {
|
|
811
|
-
...SPRING_CONFIG,
|
|
812
|
-
toValue: targetTranslateY
|
|
813
|
-
}),
|
|
814
|
-
import_react_native6.Animated.timing(backdropOpacity, {
|
|
815
|
-
...TIMING_CONFIG,
|
|
816
|
-
toValue: 1
|
|
817
|
-
})
|
|
818
|
-
]);
|
|
819
|
-
animation.start();
|
|
820
|
-
return animation;
|
|
821
|
-
};
|
|
822
|
-
var runCloseAnimation = (translateY, backdropOpacity, screenHeight, onComplete) => {
|
|
823
|
-
const animation = import_react_native6.Animated.parallel([
|
|
824
|
-
import_react_native6.Animated.timing(translateY, {
|
|
825
|
-
...TIMING_CONFIG,
|
|
826
|
-
toValue: screenHeight
|
|
827
|
-
}),
|
|
828
|
-
import_react_native6.Animated.timing(backdropOpacity, {
|
|
829
|
-
...TIMING_CONFIG,
|
|
830
|
-
toValue: 0
|
|
831
|
-
})
|
|
832
|
-
]);
|
|
833
|
-
animation.start(({ finished }) => {
|
|
834
|
-
if (finished && onComplete) {
|
|
835
|
-
onComplete();
|
|
836
|
-
}
|
|
837
|
-
});
|
|
838
|
-
return animation;
|
|
839
|
-
};
|
|
840
|
-
var runSnapAnimation = (translateY, targetTranslateY) => {
|
|
841
|
-
const animation = import_react_native6.Animated.spring(translateY, {
|
|
842
|
-
...SPRING_CONFIG,
|
|
843
|
-
toValue: targetTranslateY
|
|
844
|
-
});
|
|
845
|
-
animation.start();
|
|
846
|
-
return animation;
|
|
847
|
-
};
|
|
848
690
|
|
|
849
|
-
// src/components/bottom-sheet/bottom-sheet.hook.ts
|
|
850
|
-
var DISMISS_VELOCITY_THRESHOLD = 0.5;
|
|
851
|
-
var DISMISS_DISTANCE_FRACTION = 0.3;
|
|
852
|
-
var SCREEN_HEIGHT = import_react_native7.Dimensions.get("window").height;
|
|
853
|
-
var getTranslateYForSnap = (snapFraction) => SCREEN_HEIGHT * (1 - snapFraction);
|
|
854
|
-
var useBottomSheetAnimation = ({
|
|
855
|
-
isOpen,
|
|
856
|
-
snapPoints,
|
|
857
|
-
initialSnapIndex,
|
|
858
|
-
enableSwipeToDismiss,
|
|
859
|
-
disableAnimation,
|
|
860
|
-
onClose,
|
|
861
|
-
onSnapChange
|
|
862
|
-
}) => {
|
|
863
|
-
const [shouldRender, setShouldRender] = (0, import_react8.useState)(false);
|
|
864
|
-
const currentSnapIndex = (0, import_react8.useRef)(initialSnapIndex);
|
|
865
|
-
const animationRef = (0, import_react8.useRef)(null);
|
|
866
|
-
const translateY = (0, import_react8.useRef)(new import_react_native7.Animated.Value(SCREEN_HEIGHT)).current;
|
|
867
|
-
const backdropOpacity = (0, import_react8.useRef)(new import_react_native7.Animated.Value(0)).current;
|
|
868
|
-
const sortedSnapPoints = (0, import_react8.useMemo)(
|
|
869
|
-
() => [...snapPoints].sort((a, b) => a - b),
|
|
870
|
-
[snapPoints]
|
|
871
|
-
);
|
|
872
|
-
const snapTranslateValues = (0, import_react8.useMemo)(
|
|
873
|
-
() => sortedSnapPoints.map(getTranslateYForSnap),
|
|
874
|
-
[sortedSnapPoints]
|
|
875
|
-
);
|
|
876
|
-
const open = (0, import_react8.useCallback)(() => {
|
|
877
|
-
setShouldRender(true);
|
|
878
|
-
const targetIndex = Math.min(initialSnapIndex, sortedSnapPoints.length - 1);
|
|
879
|
-
currentSnapIndex.current = targetIndex;
|
|
880
|
-
if (disableAnimation) {
|
|
881
|
-
translateY.setValue(snapTranslateValues[targetIndex]);
|
|
882
|
-
backdropOpacity.setValue(1);
|
|
883
|
-
return;
|
|
884
|
-
}
|
|
885
|
-
translateY.setValue(SCREEN_HEIGHT);
|
|
886
|
-
backdropOpacity.setValue(0);
|
|
887
|
-
animationRef.current?.stop();
|
|
888
|
-
animationRef.current = runOpenAnimation(
|
|
889
|
-
translateY,
|
|
890
|
-
backdropOpacity,
|
|
891
|
-
snapTranslateValues[targetIndex]
|
|
892
|
-
);
|
|
893
|
-
}, [
|
|
894
|
-
initialSnapIndex,
|
|
895
|
-
sortedSnapPoints,
|
|
896
|
-
snapTranslateValues,
|
|
897
|
-
disableAnimation,
|
|
898
|
-
translateY,
|
|
899
|
-
backdropOpacity
|
|
900
|
-
]);
|
|
901
|
-
const close = (0, import_react8.useCallback)(() => {
|
|
902
|
-
if (disableAnimation) {
|
|
903
|
-
translateY.setValue(SCREEN_HEIGHT);
|
|
904
|
-
backdropOpacity.setValue(0);
|
|
905
|
-
setShouldRender(false);
|
|
906
|
-
onClose?.();
|
|
907
|
-
return;
|
|
908
|
-
}
|
|
909
|
-
animationRef.current?.stop();
|
|
910
|
-
animationRef.current = runCloseAnimation(
|
|
911
|
-
translateY,
|
|
912
|
-
backdropOpacity,
|
|
913
|
-
SCREEN_HEIGHT,
|
|
914
|
-
() => {
|
|
915
|
-
setShouldRender(false);
|
|
916
|
-
onClose?.();
|
|
917
|
-
}
|
|
918
|
-
);
|
|
919
|
-
}, [disableAnimation, translateY, backdropOpacity, onClose]);
|
|
920
|
-
const snapTo = (0, import_react8.useCallback)(
|
|
921
|
-
(index) => {
|
|
922
|
-
const clampedIndex = Math.max(0, Math.min(index, sortedSnapPoints.length - 1));
|
|
923
|
-
currentSnapIndex.current = clampedIndex;
|
|
924
|
-
onSnapChange?.(clampedIndex);
|
|
925
|
-
if (disableAnimation) {
|
|
926
|
-
translateY.setValue(snapTranslateValues[clampedIndex]);
|
|
927
|
-
return;
|
|
928
|
-
}
|
|
929
|
-
animationRef.current?.stop();
|
|
930
|
-
animationRef.current = runSnapAnimation(
|
|
931
|
-
translateY,
|
|
932
|
-
snapTranslateValues[clampedIndex]
|
|
933
|
-
);
|
|
934
|
-
},
|
|
935
|
-
[
|
|
936
|
-
sortedSnapPoints,
|
|
937
|
-
snapTranslateValues,
|
|
938
|
-
disableAnimation,
|
|
939
|
-
translateY,
|
|
940
|
-
onSnapChange
|
|
941
|
-
]
|
|
942
|
-
);
|
|
943
|
-
(0, import_react8.useEffect)(() => {
|
|
944
|
-
if (isOpen) {
|
|
945
|
-
open();
|
|
946
|
-
} else if (shouldRender) {
|
|
947
|
-
close();
|
|
948
|
-
}
|
|
949
|
-
}, [isOpen]);
|
|
950
|
-
const panResponder = (0, import_react8.useMemo)(
|
|
951
|
-
() => import_react_native7.PanResponder.create({
|
|
952
|
-
onStartShouldSetPanResponder: () => true,
|
|
953
|
-
onMoveShouldSetPanResponder: (_, gestureState) => Math.abs(gestureState.dy) > 5,
|
|
954
|
-
onPanResponderMove: (_, gestureState) => {
|
|
955
|
-
const currentTranslate = snapTranslateValues[currentSnapIndex.current];
|
|
956
|
-
const newTranslateY = currentTranslate + gestureState.dy;
|
|
957
|
-
const maxExpanded = snapTranslateValues[snapTranslateValues.length - 1];
|
|
958
|
-
const clamped = Math.max(maxExpanded, newTranslateY);
|
|
959
|
-
translateY.setValue(clamped);
|
|
960
|
-
},
|
|
961
|
-
onPanResponderRelease: (_, gestureState) => {
|
|
962
|
-
const currentTranslate = snapTranslateValues[currentSnapIndex.current];
|
|
963
|
-
const finalPosition = currentTranslate + gestureState.dy;
|
|
964
|
-
if (enableSwipeToDismiss && (gestureState.vy > DISMISS_VELOCITY_THRESHOLD || finalPosition > SCREEN_HEIGHT * (1 - sortedSnapPoints[0] * DISMISS_DISTANCE_FRACTION))) {
|
|
965
|
-
close();
|
|
966
|
-
return;
|
|
967
|
-
}
|
|
968
|
-
if (gestureState.vy < -DISMISS_VELOCITY_THRESHOLD) {
|
|
969
|
-
const nextIndex = Math.min(
|
|
970
|
-
currentSnapIndex.current + 1,
|
|
971
|
-
sortedSnapPoints.length - 1
|
|
972
|
-
);
|
|
973
|
-
snapTo(nextIndex);
|
|
974
|
-
return;
|
|
975
|
-
}
|
|
976
|
-
if (gestureState.vy > DISMISS_VELOCITY_THRESHOLD) {
|
|
977
|
-
const prevIndex = Math.max(currentSnapIndex.current - 1, 0);
|
|
978
|
-
if (prevIndex === currentSnapIndex.current && enableSwipeToDismiss) {
|
|
979
|
-
close();
|
|
980
|
-
return;
|
|
981
|
-
}
|
|
982
|
-
snapTo(prevIndex);
|
|
983
|
-
return;
|
|
984
|
-
}
|
|
985
|
-
let closestIndex = 0;
|
|
986
|
-
let minDistance = Infinity;
|
|
987
|
-
snapTranslateValues.forEach((snapVal, index) => {
|
|
988
|
-
const distance = Math.abs(finalPosition - snapVal);
|
|
989
|
-
if (distance < minDistance) {
|
|
990
|
-
minDistance = distance;
|
|
991
|
-
closestIndex = index;
|
|
992
|
-
}
|
|
993
|
-
});
|
|
994
|
-
snapTo(closestIndex);
|
|
995
|
-
}
|
|
996
|
-
}),
|
|
997
|
-
[
|
|
998
|
-
snapTranslateValues,
|
|
999
|
-
sortedSnapPoints,
|
|
1000
|
-
enableSwipeToDismiss,
|
|
1001
|
-
translateY,
|
|
1002
|
-
close,
|
|
1003
|
-
snapTo
|
|
1004
|
-
]
|
|
1005
|
-
);
|
|
1006
|
-
return {
|
|
1007
|
-
shouldRender,
|
|
1008
|
-
translateY,
|
|
1009
|
-
backdropOpacity,
|
|
1010
|
-
panResponder,
|
|
1011
|
-
close,
|
|
1012
|
-
snapTo,
|
|
1013
|
-
screenHeight: SCREEN_HEIGHT
|
|
1014
|
-
};
|
|
1015
|
-
};
|
|
1016
|
-
var useBottomSheetStyles = (themeColor, radius) => {
|
|
1017
|
-
const theme = useXUITheme();
|
|
1018
|
-
const safeThemeColor = (0, import_core4.getSafeThemeColor)(themeColor);
|
|
1019
|
-
const colorScheme = theme.colors[safeThemeColor];
|
|
1020
|
-
const sheetStyles = (0, import_react8.useMemo)(
|
|
1021
|
-
() => ({
|
|
1022
|
-
backgroundColor: colorScheme.background ?? theme.colors.background ?? "#ffffff",
|
|
1023
|
-
borderTopLeftRadius: theme.borderRadius[radius],
|
|
1024
|
-
borderTopRightRadius: theme.borderRadius[radius]
|
|
1025
|
-
}),
|
|
1026
|
-
[theme, colorScheme, radius]
|
|
1027
|
-
);
|
|
1028
|
-
const handleIndicatorColor = (0, import_react8.useMemo)(
|
|
1029
|
-
() => theme.mode === "dark" ? `${colorScheme.main}60` : `${colorScheme.main}40`,
|
|
1030
|
-
[theme, colorScheme]
|
|
1031
|
-
);
|
|
1032
|
-
return { sheetStyles, handleIndicatorColor };
|
|
1033
|
-
};
|
|
1034
|
-
|
|
1035
|
-
// src/components/bottom-sheet/bottom-sheet.style.ts
|
|
1036
|
-
var import_react_native8 = require("react-native");
|
|
1037
|
-
var styles2 = import_react_native8.StyleSheet.create({
|
|
1038
|
-
backdrop: {
|
|
1039
|
-
position: "absolute",
|
|
1040
|
-
top: 0,
|
|
1041
|
-
left: 0,
|
|
1042
|
-
right: 0,
|
|
1043
|
-
bottom: 0,
|
|
1044
|
-
backgroundColor: "rgba(0, 0, 0, 0.5)"
|
|
1045
|
-
},
|
|
1046
|
-
container: {
|
|
1047
|
-
position: "absolute",
|
|
1048
|
-
left: 0,
|
|
1049
|
-
right: 0,
|
|
1050
|
-
bottom: 0
|
|
1051
|
-
},
|
|
1052
|
-
sheet: {
|
|
1053
|
-
overflow: "hidden"
|
|
1054
|
-
},
|
|
1055
|
-
handle: {
|
|
1056
|
-
alignItems: "center",
|
|
1057
|
-
justifyContent: "center",
|
|
1058
|
-
paddingVertical: 10
|
|
1059
|
-
},
|
|
1060
|
-
handleIndicator: {
|
|
1061
|
-
width: 36,
|
|
1062
|
-
height: 4,
|
|
1063
|
-
borderRadius: 2
|
|
1064
|
-
},
|
|
1065
|
-
content: {
|
|
1066
|
-
flex: 1
|
|
1067
|
-
}
|
|
1068
|
-
});
|
|
1069
|
-
|
|
1070
|
-
// src/components/bottom-sheet/bottom-sheet.tsx
|
|
1071
|
-
var BottomSheet = ({
|
|
1072
|
-
children,
|
|
1073
|
-
isOpen,
|
|
1074
|
-
snapPoints = [0.4, 0.9],
|
|
1075
|
-
initialSnapIndex = 0,
|
|
1076
|
-
themeColor = "default",
|
|
1077
|
-
radius = "lg",
|
|
1078
|
-
showBackdrop = true,
|
|
1079
|
-
closeOnBackdropPress = true,
|
|
1080
|
-
enableSwipeToDismiss = true,
|
|
1081
|
-
showHandle = true,
|
|
1082
|
-
disableAnimation = false,
|
|
1083
|
-
style,
|
|
1084
|
-
handleContent,
|
|
1085
|
-
onClose,
|
|
1086
|
-
onSnapChange
|
|
1087
|
-
}) => {
|
|
1088
|
-
const {
|
|
1089
|
-
shouldRender,
|
|
1090
|
-
translateY,
|
|
1091
|
-
backdropOpacity,
|
|
1092
|
-
panResponder,
|
|
1093
|
-
close,
|
|
1094
|
-
screenHeight
|
|
1095
|
-
} = useBottomSheetAnimation({
|
|
1096
|
-
isOpen,
|
|
1097
|
-
snapPoints,
|
|
1098
|
-
initialSnapIndex,
|
|
1099
|
-
enableSwipeToDismiss,
|
|
1100
|
-
disableAnimation,
|
|
1101
|
-
onClose,
|
|
1102
|
-
onSnapChange
|
|
1103
|
-
});
|
|
1104
|
-
const { sheetStyles, handleIndicatorColor } = useBottomSheetStyles(
|
|
1105
|
-
themeColor,
|
|
1106
|
-
radius
|
|
1107
|
-
);
|
|
1108
|
-
if (!shouldRender) {
|
|
1109
|
-
return null;
|
|
1110
|
-
}
|
|
1111
|
-
const handleBackdropPress = () => {
|
|
1112
|
-
if (closeOnBackdropPress) {
|
|
1113
|
-
close();
|
|
1114
|
-
}
|
|
1115
|
-
};
|
|
1116
|
-
return /* @__PURE__ */ import_react9.default.createElement(Portal, null, showBackdrop && /* @__PURE__ */ import_react9.default.createElement(import_react_native9.Animated.View, { style: [styles2.backdrop, { opacity: backdropOpacity }] }, /* @__PURE__ */ import_react9.default.createElement(import_react_native9.Pressable, { style: styles2.backdrop, onPress: handleBackdropPress })), /* @__PURE__ */ import_react9.default.createElement(
|
|
1117
|
-
import_react_native9.Animated.View,
|
|
1118
|
-
{
|
|
1119
|
-
style: [
|
|
1120
|
-
styles2.container,
|
|
1121
|
-
{
|
|
1122
|
-
height: screenHeight,
|
|
1123
|
-
transform: [{ translateY }]
|
|
1124
|
-
}
|
|
1125
|
-
]
|
|
1126
|
-
},
|
|
1127
|
-
/* @__PURE__ */ import_react9.default.createElement(
|
|
1128
|
-
import_react_native9.View,
|
|
1129
|
-
{
|
|
1130
|
-
style: [styles2.sheet, { height: screenHeight }, sheetStyles, style],
|
|
1131
|
-
...panResponder.panHandlers
|
|
1132
|
-
},
|
|
1133
|
-
showHandle && /* @__PURE__ */ import_react9.default.createElement(import_react_native9.View, { style: styles2.handle }, handleContent ?? /* @__PURE__ */ import_react9.default.createElement(
|
|
1134
|
-
import_react_native9.View,
|
|
1135
|
-
{
|
|
1136
|
-
style: [
|
|
1137
|
-
styles2.handleIndicator,
|
|
1138
|
-
{ backgroundColor: handleIndicatorColor }
|
|
1139
|
-
]
|
|
1140
|
-
}
|
|
1141
|
-
)),
|
|
1142
|
-
/* @__PURE__ */ import_react9.default.createElement(import_react_native9.View, { style: styles2.content }, children)
|
|
1143
|
-
)
|
|
1144
|
-
));
|
|
1145
|
-
};
|
|
1146
|
-
|
|
1147
|
-
// src/components/timepicker/timepicker-dialog.tsx
|
|
1148
691
|
var TimePickerDialog = ({
|
|
1149
692
|
isOpen,
|
|
1150
693
|
onClose,
|
|
@@ -1157,23 +700,23 @@ var TimePickerDialog = ({
|
|
|
1157
700
|
onConfirm,
|
|
1158
701
|
onCancel
|
|
1159
702
|
}) => {
|
|
1160
|
-
const [tempValue, setTempValue] = (0,
|
|
1161
|
-
const
|
|
703
|
+
const [tempValue, setTempValue] = _react.useState.call(void 0, value);
|
|
704
|
+
const colors = useTimePickerColors(themeColor);
|
|
1162
705
|
const handleChange = (time) => {
|
|
1163
706
|
setTempValue(time);
|
|
1164
|
-
onChange
|
|
707
|
+
_optionalChain([onChange, 'optionalCall', _6 => _6(time)]);
|
|
1165
708
|
};
|
|
1166
709
|
const handleConfirm = () => {
|
|
1167
710
|
if (tempValue) {
|
|
1168
|
-
onConfirm
|
|
711
|
+
_optionalChain([onConfirm, 'optionalCall', _7 => _7(tempValue)]);
|
|
1169
712
|
}
|
|
1170
713
|
onClose();
|
|
1171
714
|
};
|
|
1172
715
|
const handleCancel = () => {
|
|
1173
|
-
onCancel
|
|
716
|
+
_optionalChain([onCancel, 'optionalCall', _8 => _8()]);
|
|
1174
717
|
onClose();
|
|
1175
718
|
};
|
|
1176
|
-
return /* @__PURE__ */
|
|
719
|
+
return /* @__PURE__ */ _react2.default.createElement(_chunkXFPPR2VBcjs.BottomSheet, { isOpen, onClose, snapPoints: [0.7] }, /* @__PURE__ */ _react2.default.createElement(_reactnative.View, null, /* @__PURE__ */ _react2.default.createElement(
|
|
1177
720
|
TimePicker,
|
|
1178
721
|
{
|
|
1179
722
|
value: tempValue,
|
|
@@ -1181,27 +724,27 @@ var TimePickerDialog = ({
|
|
|
1181
724
|
is24Hour,
|
|
1182
725
|
themeColor
|
|
1183
726
|
}
|
|
1184
|
-
), /* @__PURE__ */
|
|
1185
|
-
|
|
727
|
+
), /* @__PURE__ */ _react2.default.createElement(_reactnative.View, { style: styles.actions }, /* @__PURE__ */ _react2.default.createElement(
|
|
728
|
+
_reactnative.Pressable,
|
|
1186
729
|
{
|
|
1187
730
|
onPress: handleCancel,
|
|
1188
731
|
style: [styles.actionButton, { backgroundColor: "transparent" }]
|
|
1189
732
|
},
|
|
1190
|
-
/* @__PURE__ */
|
|
1191
|
-
), /* @__PURE__ */
|
|
1192
|
-
|
|
733
|
+
/* @__PURE__ */ _react2.default.createElement(_reactnative.Text, { style: [styles.actionButtonText, { color: colors.primary }] }, cancelText)
|
|
734
|
+
), /* @__PURE__ */ _react2.default.createElement(
|
|
735
|
+
_reactnative.Pressable,
|
|
1193
736
|
{
|
|
1194
737
|
onPress: handleConfirm,
|
|
1195
738
|
style: [styles.actionButton, { backgroundColor: "transparent" }]
|
|
1196
739
|
},
|
|
1197
|
-
/* @__PURE__ */
|
|
740
|
+
/* @__PURE__ */ _react2.default.createElement(_reactnative.Text, { style: [styles.actionButtonText, { color: colors.primary }] }, confirmText)
|
|
1198
741
|
))));
|
|
1199
742
|
};
|
|
1200
743
|
|
|
1201
744
|
// src/components/timepicker/timepicker-trigger.tsx
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
var
|
|
745
|
+
|
|
746
|
+
|
|
747
|
+
var _icons = require('@xaui/icons');
|
|
1205
748
|
var TimePickerTrigger = ({
|
|
1206
749
|
value,
|
|
1207
750
|
placeholder = "Select time",
|
|
@@ -1216,23 +759,23 @@ var TimePickerTrigger = ({
|
|
|
1216
759
|
onPress,
|
|
1217
760
|
onClear
|
|
1218
761
|
}) => {
|
|
1219
|
-
const theme = useXUITheme();
|
|
1220
|
-
const
|
|
762
|
+
const theme = _chunkOQ2BLOOGcjs.useXUITheme.call(void 0, );
|
|
763
|
+
const colors = useTimePickerColors(themeColor);
|
|
1221
764
|
const hasValue = Boolean(value);
|
|
1222
|
-
const displayValue = (0,
|
|
765
|
+
const displayValue = _react.useMemo.call(void 0, () => {
|
|
1223
766
|
if (!value) return placeholder;
|
|
1224
767
|
return formatTimeValue(value, is24Hour);
|
|
1225
768
|
}, [value, placeholder, is24Hour]);
|
|
1226
769
|
const triggerStyle = {
|
|
1227
|
-
borderColor:
|
|
1228
|
-
backgroundColor:
|
|
770
|
+
borderColor: colors.border,
|
|
771
|
+
backgroundColor: colors.background
|
|
1229
772
|
};
|
|
1230
773
|
const triggerTextStyle = {
|
|
1231
|
-
color: hasValue ? theme.colors.foreground :
|
|
774
|
+
color: hasValue ? theme.colors.foreground : colors.textSecondary
|
|
1232
775
|
};
|
|
1233
776
|
const isBlocked = isDisabled || isReadOnly;
|
|
1234
|
-
return /* @__PURE__ */
|
|
1235
|
-
|
|
777
|
+
return /* @__PURE__ */ _react2.default.createElement(
|
|
778
|
+
_reactnative.Pressable,
|
|
1236
779
|
{
|
|
1237
780
|
onPress: isBlocked ? void 0 : onPress,
|
|
1238
781
|
disabled: isBlocked,
|
|
@@ -1240,8 +783,8 @@ var TimePickerTrigger = ({
|
|
|
1240
783
|
accessibilityRole: "button",
|
|
1241
784
|
accessibilityState: { disabled: isBlocked }
|
|
1242
785
|
},
|
|
1243
|
-
/* @__PURE__ */
|
|
1244
|
-
|
|
786
|
+
/* @__PURE__ */ _react2.default.createElement(_reactnative.View, { style: styles.triggerContent }, /* @__PURE__ */ _react2.default.createElement(
|
|
787
|
+
_reactnative.Text,
|
|
1245
788
|
{
|
|
1246
789
|
style: [styles.triggerText, triggerTextStyle, textStyle],
|
|
1247
790
|
numberOfLines: 1,
|
|
@@ -1249,32 +792,31 @@ var TimePickerTrigger = ({
|
|
|
1249
792
|
},
|
|
1250
793
|
displayValue
|
|
1251
794
|
)),
|
|
1252
|
-
isClearable && hasValue && !isBlocked ? /* @__PURE__ */
|
|
1253
|
-
|
|
795
|
+
isClearable && hasValue && !isBlocked ? /* @__PURE__ */ _react2.default.createElement(
|
|
796
|
+
_reactnative.TouchableOpacity,
|
|
1254
797
|
{
|
|
1255
798
|
onPress: onClear,
|
|
1256
799
|
style: styles.clearButton,
|
|
1257
800
|
hitSlop: { top: 8, right: 8, bottom: 8, left: 8 }
|
|
1258
801
|
},
|
|
1259
|
-
/* @__PURE__ */
|
|
1260
|
-
) : icon
|
|
802
|
+
/* @__PURE__ */ _react2.default.createElement(_icons.CloseIcon, { color: theme.colors.foreground, size: 20 })
|
|
803
|
+
) : _nullishCoalesce(icon, () => ( /* @__PURE__ */ _react2.default.createElement(_icons.TimeIcon, { color: theme.colors.foreground, size: 20 })))
|
|
1261
804
|
);
|
|
1262
805
|
};
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
});
|
|
806
|
+
|
|
807
|
+
|
|
808
|
+
|
|
809
|
+
|
|
810
|
+
|
|
811
|
+
|
|
812
|
+
|
|
813
|
+
|
|
814
|
+
|
|
815
|
+
|
|
816
|
+
|
|
817
|
+
|
|
818
|
+
|
|
819
|
+
|
|
820
|
+
|
|
821
|
+
|
|
822
|
+
exports.TimePicker = TimePicker; exports.TimePickerDialog = TimePickerDialog; exports.TimePickerTrigger = TimePickerTrigger; exports.angleToHour = angleToHour; exports.angleToMinute = angleToMinute; exports.calculateAngleFromPosition = calculateAngleFromPosition; exports.clampHour = clampHour; exports.clampMinute = clampMinute; exports.formatTimeValue = formatTimeValue; exports.getCurrentTime = getCurrentTime; exports.getHourAngle = getHourAngle; exports.getMinuteAngle = getMinuteAngle; exports.isTimeInRange = isTimeInRange; exports.to12HourFormat = to12HourFormat; exports.to24HourFormat = to24HourFormat;
|