@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,116 +1,26 @@
|
|
|
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);
|
|
29
|
-
|
|
30
|
-
// src/components/datepicker/index.ts
|
|
31
|
-
var datepicker_exports = {};
|
|
32
|
-
__export(datepicker_exports, {
|
|
33
|
-
DatePicker: () => DatePicker
|
|
34
|
-
});
|
|
35
|
-
module.exports = __toCommonJS(datepicker_exports);
|
|
36
|
-
|
|
37
|
-
// src/components/datepicker/datepicker.tsx
|
|
38
|
-
var import_react15 = __toESM(require("react"), 1);
|
|
39
|
-
var import_react_native13 = require("react-native");
|
|
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; }require('../chunk-HSPTLUFA.cjs');
|
|
40
2
|
|
|
41
|
-
// src/components/datepicker/datepicker.hook.ts
|
|
42
|
-
var import_react6 = require("react");
|
|
43
|
-
var import_core = require("@xaui/core");
|
|
44
|
-
var import_palette2 = require("@xaui/core/palette");
|
|
45
|
-
|
|
46
|
-
// src/core/theme-context.tsx
|
|
47
|
-
var import_react4 = __toESM(require("react"), 1);
|
|
48
|
-
var import_react_native2 = require("react-native");
|
|
49
|
-
var import_theme = require("@xaui/core/theme");
|
|
50
|
-
var import_palette = require("@xaui/core/palette");
|
|
51
3
|
|
|
52
|
-
// src/core/portal/portal.tsx
|
|
53
|
-
var import_react2 = require("react");
|
|
54
4
|
|
|
55
|
-
|
|
56
|
-
var import_react = require("react");
|
|
57
|
-
var PortalContext = (0, import_react.createContext)(null);
|
|
5
|
+
var _chunkOQ2BLOOGcjs = require('../chunk-OQ2BLOOG.cjs');
|
|
58
6
|
|
|
59
|
-
// src/
|
|
60
|
-
var
|
|
61
|
-
var
|
|
62
|
-
const context = (0, import_react2.useContext)(PortalContext);
|
|
63
|
-
const keyRef = (0, import_react2.useRef)(`portal-${++portalId}`);
|
|
64
|
-
(0, import_react2.useLayoutEffect)(() => {
|
|
65
|
-
if (!context) return;
|
|
66
|
-
context.addPortal(keyRef.current, children);
|
|
67
|
-
}, [children, context]);
|
|
68
|
-
(0, import_react2.useEffect)(() => {
|
|
69
|
-
if (!context) return;
|
|
70
|
-
const key = keyRef.current;
|
|
71
|
-
return () => {
|
|
72
|
-
context.removePortal(key);
|
|
73
|
-
};
|
|
74
|
-
}, [context]);
|
|
75
|
-
return null;
|
|
76
|
-
};
|
|
77
|
-
|
|
78
|
-
// src/core/portal/portal-host.tsx
|
|
79
|
-
var import_react3 = __toESM(require("react"), 1);
|
|
80
|
-
var import_react_native = require("react-native");
|
|
81
|
-
var hostStyles = import_react_native.StyleSheet.create({
|
|
82
|
-
container: {
|
|
83
|
-
flex: 1
|
|
84
|
-
}
|
|
85
|
-
});
|
|
86
|
-
|
|
87
|
-
// src/core/theme-context.tsx
|
|
88
|
-
var XUIThemeContext = (0, import_react4.createContext)(null);
|
|
89
|
-
|
|
90
|
-
// src/core/theme-hooks.ts
|
|
91
|
-
var import_react5 = require("react");
|
|
92
|
-
var import_react_native3 = require("react-native");
|
|
93
|
-
function useXUITheme() {
|
|
94
|
-
const theme = (0, import_react5.useContext)(XUIThemeContext);
|
|
95
|
-
if (!theme) {
|
|
96
|
-
throw new Error("useXUITheme must be used within XUIProvider");
|
|
97
|
-
}
|
|
98
|
-
return theme;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
// src/core/index.ts
|
|
102
|
-
var import_theme2 = require("@xaui/core/theme");
|
|
7
|
+
// src/components/datepicker/datepicker.tsx
|
|
8
|
+
var _react = require('react'); var _react2 = _interopRequireDefault(_react);
|
|
9
|
+
var _reactnative = require('react-native');
|
|
103
10
|
|
|
104
11
|
// src/components/datepicker/datepicker.hook.ts
|
|
12
|
+
|
|
13
|
+
var _core = require('@xaui/core');
|
|
14
|
+
var _palette = require('@xaui/core/palette');
|
|
105
15
|
var useDatePickerColorScheme = (themeColor) => {
|
|
106
|
-
const theme = useXUITheme();
|
|
107
|
-
const safeThemeColor = (0,
|
|
16
|
+
const theme = _chunkOQ2BLOOGcjs.useXUITheme.call(void 0, );
|
|
17
|
+
const safeThemeColor = _core.getSafeThemeColor.call(void 0, themeColor);
|
|
108
18
|
const colorScheme = theme.colors[safeThemeColor];
|
|
109
19
|
return { theme, colorScheme };
|
|
110
20
|
};
|
|
111
21
|
var useDatePickerSizeStyles = (size) => {
|
|
112
|
-
const theme = useXUITheme();
|
|
113
|
-
return (0,
|
|
22
|
+
const theme = _chunkOQ2BLOOGcjs.useXUITheme.call(void 0, );
|
|
23
|
+
return _react.useMemo.call(void 0, () => {
|
|
114
24
|
const sizes = {
|
|
115
25
|
xs: {
|
|
116
26
|
minHeight: 34,
|
|
@@ -145,8 +55,8 @@ var useDatePickerSizeStyles = (size) => {
|
|
|
145
55
|
}, [size, theme]);
|
|
146
56
|
};
|
|
147
57
|
var useDatePickerRadiusStyles = (radius) => {
|
|
148
|
-
const theme = useXUITheme();
|
|
149
|
-
return (0,
|
|
58
|
+
const theme = _chunkOQ2BLOOGcjs.useXUITheme.call(void 0, );
|
|
59
|
+
return _react.useMemo.call(void 0, () => {
|
|
150
60
|
const radii = {
|
|
151
61
|
none: theme.borderRadius.none,
|
|
152
62
|
sm: theme.borderRadius.sm,
|
|
@@ -159,10 +69,10 @@ var useDatePickerRadiusStyles = (radius) => {
|
|
|
159
69
|
};
|
|
160
70
|
var useDatePickerVariantStyles = (themeColor, variant, isInvalid) => {
|
|
161
71
|
const { theme, colorScheme } = useDatePickerColorScheme(themeColor);
|
|
162
|
-
return (0,
|
|
72
|
+
return _react.useMemo.call(void 0, () => {
|
|
163
73
|
let borderColor = isInvalid ? theme.colors.danger.main : colorScheme.main;
|
|
164
74
|
if ((variant === "outlined" || variant === "faded") && themeColor === "default") {
|
|
165
|
-
borderColor =
|
|
75
|
+
borderColor = _palette.colors.gray[300];
|
|
166
76
|
}
|
|
167
77
|
const variantStyles = {
|
|
168
78
|
outlined: {
|
|
@@ -194,7 +104,7 @@ var useDatePickerVariantStyles = (themeColor, variant, isInvalid) => {
|
|
|
194
104
|
};
|
|
195
105
|
var useDatePickerLabelStyle = (themeColor, isInvalid, labelSize) => {
|
|
196
106
|
const { theme, colorScheme } = useDatePickerColorScheme(themeColor);
|
|
197
|
-
return (0,
|
|
107
|
+
return _react.useMemo.call(void 0, () => {
|
|
198
108
|
let baseColor = theme.colors.foreground;
|
|
199
109
|
if (isInvalid) {
|
|
200
110
|
baseColor = theme.colors.danger.main;
|
|
@@ -208,32 +118,32 @@ var useDatePickerLabelStyle = (themeColor, isInvalid, labelSize) => {
|
|
|
208
118
|
}, [isInvalid, labelSize, theme, themeColor, colorScheme]);
|
|
209
119
|
};
|
|
210
120
|
var useDatePickerHelperColor = (isInvalid) => {
|
|
211
|
-
const theme = useXUITheme();
|
|
212
|
-
return (0,
|
|
121
|
+
const theme = _chunkOQ2BLOOGcjs.useXUITheme.call(void 0, );
|
|
122
|
+
return _react.useMemo.call(void 0, () => {
|
|
213
123
|
if (isInvalid) {
|
|
214
124
|
return theme.colors.danger.main;
|
|
215
125
|
}
|
|
216
|
-
return
|
|
126
|
+
return _palette.colors.gray[600];
|
|
217
127
|
}, [isInvalid, theme]);
|
|
218
128
|
};
|
|
219
129
|
|
|
220
130
|
// src/components/datepicker/datepicker.state.hook.ts
|
|
221
|
-
|
|
131
|
+
|
|
222
132
|
var useDatePickerState = ({
|
|
223
133
|
value,
|
|
224
134
|
defaultValue,
|
|
225
135
|
onChange
|
|
226
136
|
}) => {
|
|
227
|
-
const [internalValue, setInternalValue] = (0,
|
|
228
|
-
defaultValue
|
|
137
|
+
const [internalValue, setInternalValue] = _react.useState.call(void 0,
|
|
138
|
+
_nullishCoalesce(defaultValue, () => ( null))
|
|
229
139
|
);
|
|
230
140
|
const selectedDate = value !== void 0 ? value : internalValue;
|
|
231
|
-
const updateDate = (0,
|
|
141
|
+
const updateDate = _react.useCallback.call(void 0,
|
|
232
142
|
(date) => {
|
|
233
143
|
if (value === void 0) {
|
|
234
144
|
setInternalValue(date);
|
|
235
145
|
}
|
|
236
|
-
onChange
|
|
146
|
+
_optionalChain([onChange, 'optionalCall', _2 => _2(date)]);
|
|
237
147
|
},
|
|
238
148
|
[value, onChange]
|
|
239
149
|
);
|
|
@@ -245,16 +155,16 @@ var useDatePickerOpenState = ({
|
|
|
245
155
|
onOpen,
|
|
246
156
|
onClose
|
|
247
157
|
}) => {
|
|
248
|
-
const [isOpen, setInternalOpen] = (0,
|
|
249
|
-
const setOpen = (0,
|
|
158
|
+
const [isOpen, setInternalOpen] = _react.useState.call(void 0, false);
|
|
159
|
+
const setOpen = _react.useCallback.call(void 0,
|
|
250
160
|
(open) => {
|
|
251
161
|
if (isDisabled && open) return;
|
|
252
162
|
setInternalOpen(open);
|
|
253
|
-
onOpenChange
|
|
163
|
+
_optionalChain([onOpenChange, 'optionalCall', _3 => _3(open)]);
|
|
254
164
|
if (open) {
|
|
255
|
-
onOpen
|
|
165
|
+
_optionalChain([onOpen, 'optionalCall', _4 => _4()]);
|
|
256
166
|
} else {
|
|
257
|
-
onClose
|
|
167
|
+
_optionalChain([onClose, 'optionalCall', _5 => _5()]);
|
|
258
168
|
}
|
|
259
169
|
},
|
|
260
170
|
[isDisabled, onOpenChange, onOpen, onClose]
|
|
@@ -263,30 +173,30 @@ var useDatePickerOpenState = ({
|
|
|
263
173
|
};
|
|
264
174
|
var useDatePickerViewState = (initialDate) => {
|
|
265
175
|
const now = /* @__PURE__ */ new Date();
|
|
266
|
-
const [viewDate, setViewDate] = (0,
|
|
267
|
-
const [viewMode, setViewMode] = (0,
|
|
268
|
-
const goToPreviousMonth = (0,
|
|
176
|
+
const [viewDate, setViewDate] = _react.useState.call(void 0, _nullishCoalesce(initialDate, () => ( now)));
|
|
177
|
+
const [viewMode, setViewMode] = _react.useState.call(void 0, "calendar");
|
|
178
|
+
const goToPreviousMonth = _react.useCallback.call(void 0, () => {
|
|
269
179
|
setViewDate((prev) => new Date(prev.getFullYear(), prev.getMonth() - 1, 1));
|
|
270
180
|
}, []);
|
|
271
|
-
const goToNextMonth = (0,
|
|
181
|
+
const goToNextMonth = _react.useCallback.call(void 0, () => {
|
|
272
182
|
setViewDate((prev) => new Date(prev.getFullYear(), prev.getMonth() + 1, 1));
|
|
273
183
|
}, []);
|
|
274
|
-
const goToYear = (0,
|
|
184
|
+
const goToYear = _react.useCallback.call(void 0, (year) => {
|
|
275
185
|
setViewDate((prev) => new Date(year, prev.getMonth(), 1));
|
|
276
186
|
setViewMode("month");
|
|
277
187
|
}, []);
|
|
278
|
-
const goToMonth = (0,
|
|
188
|
+
const goToMonth = _react.useCallback.call(void 0, (month) => {
|
|
279
189
|
setViewDate((prev) => new Date(prev.getFullYear(), month, 1));
|
|
280
190
|
setViewMode("calendar");
|
|
281
191
|
}, []);
|
|
282
|
-
const goToToday = (0,
|
|
192
|
+
const goToToday = _react.useCallback.call(void 0, () => {
|
|
283
193
|
setViewDate(/* @__PURE__ */ new Date());
|
|
284
194
|
setViewMode("calendar");
|
|
285
195
|
}, []);
|
|
286
|
-
const toggleYearPicker = (0,
|
|
196
|
+
const toggleYearPicker = _react.useCallback.call(void 0, () => {
|
|
287
197
|
setViewMode((prev) => prev === "year" ? "calendar" : "year");
|
|
288
198
|
}, []);
|
|
289
|
-
const syncViewToDate = (0,
|
|
199
|
+
const syncViewToDate = _react.useCallback.call(void 0, (date) => {
|
|
290
200
|
setViewDate(date);
|
|
291
201
|
}, []);
|
|
292
202
|
return {
|
|
@@ -434,7 +344,7 @@ var DEFAULT_LABELS = {
|
|
|
434
344
|
};
|
|
435
345
|
var getDatePickerLabels = (locale) => {
|
|
436
346
|
const baseLocale = locale.split("-")[0].toLowerCase();
|
|
437
|
-
return LOCALE_LABELS[baseLocale]
|
|
347
|
+
return _nullishCoalesce(LOCALE_LABELS[baseLocale], () => ( DEFAULT_LABELS));
|
|
438
348
|
};
|
|
439
349
|
var getFirstDayOfWeek = (locale) => {
|
|
440
350
|
const mondayLocales = [
|
|
@@ -470,8 +380,8 @@ var getFirstDayOfWeek = (locale) => {
|
|
|
470
380
|
};
|
|
471
381
|
|
|
472
382
|
// src/components/datepicker/datepicker.style.ts
|
|
473
|
-
|
|
474
|
-
var styles =
|
|
383
|
+
|
|
384
|
+
var styles = _reactnative.StyleSheet.create({
|
|
475
385
|
container: {
|
|
476
386
|
gap: 6,
|
|
477
387
|
position: "relative"
|
|
@@ -521,13 +431,20 @@ var styles = import_react_native4.StyleSheet.create({
|
|
|
521
431
|
});
|
|
522
432
|
|
|
523
433
|
// src/components/dialogs/datepicker-dialog/datepicker-dialog.tsx
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
434
|
+
|
|
435
|
+
|
|
436
|
+
|
|
437
|
+
|
|
438
|
+
|
|
439
|
+
|
|
440
|
+
|
|
441
|
+
|
|
442
|
+
|
|
443
|
+
var _reactnativegesturehandler = require('react-native-gesture-handler');
|
|
527
444
|
|
|
528
445
|
// src/components/dialogs/datepicker-dialog/datepicker-dialog.animation.ts
|
|
529
|
-
|
|
530
|
-
|
|
446
|
+
|
|
447
|
+
|
|
531
448
|
var useDatePickerDialogAnimation = ({
|
|
532
449
|
visible,
|
|
533
450
|
fadeAnim,
|
|
@@ -535,26 +452,26 @@ var useDatePickerDialogAnimation = ({
|
|
|
535
452
|
scaleAnim,
|
|
536
453
|
onCloseComplete
|
|
537
454
|
}) => {
|
|
538
|
-
const [shouldRender, setShouldRender] = (0,
|
|
539
|
-
const isClosingRef = (0,
|
|
540
|
-
(0,
|
|
455
|
+
const [shouldRender, setShouldRender] = _react.useState.call(void 0, false);
|
|
456
|
+
const isClosingRef = _react.useRef.call(void 0, false);
|
|
457
|
+
_react.useEffect.call(void 0, () => {
|
|
541
458
|
if (visible) {
|
|
542
459
|
setShouldRender(true);
|
|
543
460
|
isClosingRef.current = false;
|
|
544
|
-
|
|
545
|
-
|
|
461
|
+
_reactnative.Animated.parallel([
|
|
462
|
+
_reactnative.Animated.timing(fadeAnim, {
|
|
546
463
|
toValue: 1,
|
|
547
464
|
duration: 220,
|
|
548
465
|
useNativeDriver: true
|
|
549
466
|
}),
|
|
550
|
-
|
|
467
|
+
_reactnative.Animated.spring(slideAnim, {
|
|
551
468
|
toValue: 1,
|
|
552
469
|
useNativeDriver: true,
|
|
553
470
|
damping: 20,
|
|
554
471
|
stiffness: 300,
|
|
555
472
|
mass: 0.8
|
|
556
473
|
}),
|
|
557
|
-
|
|
474
|
+
_reactnative.Animated.spring(scaleAnim, {
|
|
558
475
|
toValue: 1,
|
|
559
476
|
useNativeDriver: true,
|
|
560
477
|
damping: 18,
|
|
@@ -566,23 +483,23 @@ var useDatePickerDialogAnimation = ({
|
|
|
566
483
|
}
|
|
567
484
|
if (!shouldRender || isClosingRef.current) return;
|
|
568
485
|
isClosingRef.current = true;
|
|
569
|
-
|
|
570
|
-
|
|
486
|
+
_reactnative.Animated.parallel([
|
|
487
|
+
_reactnative.Animated.timing(fadeAnim, {
|
|
571
488
|
toValue: 0,
|
|
572
489
|
duration: 180,
|
|
573
|
-
easing:
|
|
490
|
+
easing: _reactnative.Easing.out(_reactnative.Easing.ease),
|
|
574
491
|
useNativeDriver: true
|
|
575
492
|
}),
|
|
576
|
-
|
|
493
|
+
_reactnative.Animated.timing(slideAnim, {
|
|
577
494
|
toValue: 0,
|
|
578
495
|
duration: 180,
|
|
579
|
-
easing:
|
|
496
|
+
easing: _reactnative.Easing.out(_reactnative.Easing.ease),
|
|
580
497
|
useNativeDriver: true
|
|
581
498
|
}),
|
|
582
|
-
|
|
499
|
+
_reactnative.Animated.timing(scaleAnim, {
|
|
583
500
|
toValue: 0,
|
|
584
501
|
duration: 180,
|
|
585
|
-
easing:
|
|
502
|
+
easing: _reactnative.Easing.out(_reactnative.Easing.ease),
|
|
586
503
|
useNativeDriver: true
|
|
587
504
|
})
|
|
588
505
|
]).start(() => {
|
|
@@ -596,9 +513,9 @@ var useDatePickerDialogAnimation = ({
|
|
|
596
513
|
var useViewTransitionAnimation = ({
|
|
597
514
|
fadeAnim
|
|
598
515
|
}) => {
|
|
599
|
-
const animate = (0,
|
|
516
|
+
const animate = _react.useCallback.call(void 0, () => {
|
|
600
517
|
fadeAnim.setValue(0);
|
|
601
|
-
|
|
518
|
+
_reactnative.Animated.timing(fadeAnim, {
|
|
602
519
|
toValue: 1,
|
|
603
520
|
duration: 200,
|
|
604
521
|
useNativeDriver: true
|
|
@@ -610,20 +527,20 @@ var useMonthSlideAnimation = ({
|
|
|
610
527
|
slideAnim,
|
|
611
528
|
fadeAnim
|
|
612
529
|
}) => {
|
|
613
|
-
const animate = (0,
|
|
530
|
+
const animate = _react.useCallback.call(void 0,
|
|
614
531
|
(direction) => {
|
|
615
532
|
const startX = direction === "right" ? 60 : -60;
|
|
616
533
|
slideAnim.setValue(startX);
|
|
617
534
|
fadeAnim.setValue(0);
|
|
618
|
-
|
|
619
|
-
|
|
535
|
+
_reactnative.Animated.parallel([
|
|
536
|
+
_reactnative.Animated.spring(slideAnim, {
|
|
620
537
|
toValue: 0,
|
|
621
538
|
useNativeDriver: true,
|
|
622
539
|
damping: 22,
|
|
623
540
|
stiffness: 280,
|
|
624
541
|
mass: 0.7
|
|
625
542
|
}),
|
|
626
|
-
|
|
543
|
+
_reactnative.Animated.timing(fadeAnim, {
|
|
627
544
|
toValue: 1,
|
|
628
545
|
duration: 180,
|
|
629
546
|
useNativeDriver: true
|
|
@@ -636,15 +553,18 @@ var useMonthSlideAnimation = ({
|
|
|
636
553
|
};
|
|
637
554
|
|
|
638
555
|
// src/components/dialogs/datepicker-dialog/datepicker-dialog-calendar.tsx
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
556
|
+
|
|
557
|
+
|
|
558
|
+
|
|
559
|
+
|
|
560
|
+
|
|
561
|
+
|
|
642
562
|
|
|
643
563
|
// src/components/dialogs/datepicker-dialog/datepicker-dialog.style.ts
|
|
644
|
-
|
|
645
|
-
var styles2 =
|
|
564
|
+
|
|
565
|
+
var styles2 = _reactnative.StyleSheet.create({
|
|
646
566
|
backdrop: {
|
|
647
|
-
...
|
|
567
|
+
..._reactnative.StyleSheet.absoluteFillObject,
|
|
648
568
|
backgroundColor: "rgba(0, 0, 0, 0.5)"
|
|
649
569
|
},
|
|
650
570
|
dialogContainer: {
|
|
@@ -851,16 +771,16 @@ var AnimatedDayCell = ({
|
|
|
851
771
|
themeColor,
|
|
852
772
|
onSelectDay
|
|
853
773
|
}) => {
|
|
854
|
-
const theme = useXUITheme();
|
|
855
|
-
const colorScheme = theme.colors[themeColor]
|
|
774
|
+
const theme = _chunkOQ2BLOOGcjs.useXUITheme.call(void 0, );
|
|
775
|
+
const colorScheme = _nullishCoalesce(theme.colors[themeColor], () => ( theme.colors.primary));
|
|
856
776
|
const isDefault = themeColor === "default";
|
|
857
777
|
const accentColor = isDefault ? theme.colors.foreground : colorScheme.main;
|
|
858
778
|
const accentFg = isDefault ? theme.colors.background : colorScheme.foreground;
|
|
859
|
-
const scaleAnim = (0,
|
|
860
|
-
(0,
|
|
779
|
+
const scaleAnim = _react.useRef.call(void 0, new _reactnative.Animated.Value(isSelected ? 1 : 0)).current;
|
|
780
|
+
_react.useEffect.call(void 0, () => {
|
|
861
781
|
if (isSelected) {
|
|
862
782
|
scaleAnim.setValue(0.92);
|
|
863
|
-
|
|
783
|
+
_reactnative.Animated.spring(scaleAnim, {
|
|
864
784
|
toValue: 1,
|
|
865
785
|
useNativeDriver: true,
|
|
866
786
|
damping: 20,
|
|
@@ -872,8 +792,8 @@ var AnimatedDayCell = ({
|
|
|
872
792
|
}
|
|
873
793
|
}, [isSelected, scaleAnim]);
|
|
874
794
|
const animatedStyle = isSelected ? { transform: [{ scale: scaleAnim }] } : void 0;
|
|
875
|
-
return /* @__PURE__ */
|
|
876
|
-
|
|
795
|
+
return /* @__PURE__ */ _react2.default.createElement(
|
|
796
|
+
_reactnative.Pressable,
|
|
877
797
|
{
|
|
878
798
|
style: [
|
|
879
799
|
styles2.dayCell,
|
|
@@ -895,8 +815,8 @@ var AnimatedDayCell = ({
|
|
|
895
815
|
disabled: isDisabled
|
|
896
816
|
}
|
|
897
817
|
},
|
|
898
|
-
isSelected ? /* @__PURE__ */
|
|
899
|
-
|
|
818
|
+
isSelected ? /* @__PURE__ */ _react2.default.createElement(
|
|
819
|
+
_reactnative.Animated.View,
|
|
900
820
|
{
|
|
901
821
|
style: [
|
|
902
822
|
styles2.selectedCellInner,
|
|
@@ -904,9 +824,9 @@ var AnimatedDayCell = ({
|
|
|
904
824
|
animatedStyle
|
|
905
825
|
]
|
|
906
826
|
},
|
|
907
|
-
/* @__PURE__ */
|
|
908
|
-
) : /* @__PURE__ */
|
|
909
|
-
|
|
827
|
+
/* @__PURE__ */ _react2.default.createElement(_reactnative.Text, { style: [styles2.dayText, { color: accentFg }] }, day)
|
|
828
|
+
) : /* @__PURE__ */ _react2.default.createElement(
|
|
829
|
+
_reactnative.Text,
|
|
910
830
|
{
|
|
911
831
|
style: [
|
|
912
832
|
styles2.dayText,
|
|
@@ -935,13 +855,13 @@ var DatePickerDialogCalendar = ({
|
|
|
935
855
|
onPreviousMonth,
|
|
936
856
|
onNextMonth
|
|
937
857
|
}) => {
|
|
938
|
-
const theme = useXUITheme();
|
|
939
|
-
const swipeHandledRef = (0,
|
|
940
|
-
const weekdays = (0,
|
|
858
|
+
const theme = _chunkOQ2BLOOGcjs.useXUITheme.call(void 0, );
|
|
859
|
+
const swipeHandledRef = _react.useRef.call(void 0, false);
|
|
860
|
+
const weekdays = _react.useMemo.call(void 0,
|
|
941
861
|
() => getWeekdayNames(locale, firstDayOfWeek),
|
|
942
862
|
[locale, firstDayOfWeek]
|
|
943
863
|
);
|
|
944
|
-
const days = (0,
|
|
864
|
+
const days = _react.useMemo.call(void 0,
|
|
945
865
|
() => getCalendarDays(
|
|
946
866
|
viewDate.getFullYear(),
|
|
947
867
|
viewDate.getMonth(),
|
|
@@ -951,7 +871,7 @@ var DatePickerDialogCalendar = ({
|
|
|
951
871
|
),
|
|
952
872
|
[viewDate, firstDayOfWeek, minDate, maxDate]
|
|
953
873
|
);
|
|
954
|
-
const weeks = (0,
|
|
874
|
+
const weeks = _react.useMemo.call(void 0, () => {
|
|
955
875
|
const result = [];
|
|
956
876
|
for (let i = 0; i < days.length; i += 7) {
|
|
957
877
|
result.push(days.slice(i, i + 7));
|
|
@@ -960,7 +880,7 @@ var DatePickerDialogCalendar = ({
|
|
|
960
880
|
}, [days]);
|
|
961
881
|
const onSwipeEnd = (event) => {
|
|
962
882
|
const { state, translationX, velocityX } = event.nativeEvent;
|
|
963
|
-
if (state !==
|
|
883
|
+
if (state !== _reactnativegesturehandler.State.END || swipeHandledRef.current) return;
|
|
964
884
|
const shouldSwipe = Math.abs(translationX) > 40 || Math.abs(velocityX) > 600;
|
|
965
885
|
if (!shouldSwipe) return;
|
|
966
886
|
swipeHandledRef.current = true;
|
|
@@ -971,20 +891,20 @@ var DatePickerDialogCalendar = ({
|
|
|
971
891
|
}
|
|
972
892
|
};
|
|
973
893
|
const onSwipeStateChange = (event) => {
|
|
974
|
-
if (event.nativeEvent.state ===
|
|
894
|
+
if (event.nativeEvent.state === _reactnativegesturehandler.State.BEGAN) {
|
|
975
895
|
swipeHandledRef.current = false;
|
|
976
896
|
}
|
|
977
897
|
onSwipeEnd(event);
|
|
978
898
|
};
|
|
979
|
-
return /* @__PURE__ */
|
|
980
|
-
|
|
899
|
+
return /* @__PURE__ */ _react2.default.createElement(
|
|
900
|
+
_reactnativegesturehandler.PanGestureHandler,
|
|
981
901
|
{
|
|
982
902
|
activeOffsetX: [-12, 12],
|
|
983
903
|
failOffsetY: [-12, 12],
|
|
984
904
|
onHandlerStateChange: onSwipeStateChange
|
|
985
905
|
},
|
|
986
|
-
/* @__PURE__ */
|
|
987
|
-
|
|
906
|
+
/* @__PURE__ */ _react2.default.createElement(_reactnative.View, { style: styles2.calendarGrid }, /* @__PURE__ */ _react2.default.createElement(_reactnative.View, { style: styles2.weekdayRow }, weekdays.map((day, index) => /* @__PURE__ */ _react2.default.createElement(_reactnative.View, { key: index, style: styles2.weekdayCell }, /* @__PURE__ */ _react2.default.createElement(
|
|
907
|
+
_reactnative.Text,
|
|
988
908
|
{
|
|
989
909
|
style: [
|
|
990
910
|
styles2.weekdayText,
|
|
@@ -992,7 +912,7 @@ var DatePickerDialogCalendar = ({
|
|
|
992
912
|
]
|
|
993
913
|
},
|
|
994
914
|
day
|
|
995
|
-
)))), weeks.map((week, weekIndex) => /* @__PURE__ */
|
|
915
|
+
)))), weeks.map((week, weekIndex) => /* @__PURE__ */ _react2.default.createElement(_reactnative.View, { key: weekIndex, style: styles2.dayRow }, week.map((dayInfo, dayIndex) => /* @__PURE__ */ _react2.default.createElement(
|
|
996
916
|
AnimatedDayCell,
|
|
997
917
|
{
|
|
998
918
|
key: dayIndex,
|
|
@@ -1011,12 +931,12 @@ var DatePickerDialogCalendar = ({
|
|
|
1011
931
|
};
|
|
1012
932
|
|
|
1013
933
|
// src/components/dialogs/datepicker-dialog/datepicker-dialog-header.tsx
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
var
|
|
1017
|
-
var
|
|
1018
|
-
var
|
|
1019
|
-
var
|
|
934
|
+
|
|
935
|
+
|
|
936
|
+
var _chevrondown = require('@xaui/icons/chevron-down');
|
|
937
|
+
var _chevronleft = require('@xaui/icons/chevron-left');
|
|
938
|
+
var _chevronright = require('@xaui/icons/chevron-right');
|
|
939
|
+
var _close = require('@xaui/icons/close');
|
|
1020
940
|
var DatePickerDialogHeader = ({
|
|
1021
941
|
viewDate,
|
|
1022
942
|
selectedDate,
|
|
@@ -1028,79 +948,79 @@ var DatePickerDialogHeader = ({
|
|
|
1028
948
|
onNextMonth,
|
|
1029
949
|
onToggleYearPicker
|
|
1030
950
|
}) => {
|
|
1031
|
-
const theme = useXUITheme();
|
|
1032
|
-
const colorScheme = theme.colors[themeColor]
|
|
1033
|
-
const dateText = (0,
|
|
951
|
+
const theme = _chunkOQ2BLOOGcjs.useXUITheme.call(void 0, );
|
|
952
|
+
const colorScheme = _nullishCoalesce(theme.colors[themeColor], () => ( theme.colors.primary));
|
|
953
|
+
const dateText = _react.useMemo.call(void 0, () => {
|
|
1034
954
|
if (!selectedDate) return "---";
|
|
1035
955
|
return formatDate(selectedDate, locale);
|
|
1036
956
|
}, [selectedDate, locale]);
|
|
1037
|
-
const monthYearLabel = (0,
|
|
957
|
+
const monthYearLabel = _react.useMemo.call(void 0, () => {
|
|
1038
958
|
const month = getMonthName(viewDate.getMonth(), locale);
|
|
1039
959
|
return `${month} ${viewDate.getFullYear()}`;
|
|
1040
960
|
}, [viewDate, locale]);
|
|
1041
|
-
return /* @__PURE__ */
|
|
1042
|
-
|
|
961
|
+
return /* @__PURE__ */ _react2.default.createElement(_react2.default.Fragment, null, /* @__PURE__ */ _react2.default.createElement(_reactnative.View, { style: [styles2.header, { backgroundColor: colorScheme.main }] }, /* @__PURE__ */ _react2.default.createElement(_reactnative.Text, { style: [styles2.headerLabel, { color: colorScheme.foreground }] }, selectDateLabel), /* @__PURE__ */ _react2.default.createElement(_reactnative.View, { style: styles2.headerDateRow }, /* @__PURE__ */ _react2.default.createElement(_reactnative.Text, { style: [styles2.headerDate, { color: colorScheme.foreground }] }, dateText), selectedDate ? /* @__PURE__ */ _react2.default.createElement(
|
|
962
|
+
_reactnative.Pressable,
|
|
1043
963
|
{
|
|
1044
964
|
onPress: onClearValue,
|
|
1045
965
|
hitSlop: { top: 8, right: 8, bottom: 8, left: 8 },
|
|
1046
966
|
accessibilityLabel: "Clear date",
|
|
1047
967
|
accessibilityRole: "button"
|
|
1048
968
|
},
|
|
1049
|
-
/* @__PURE__ */
|
|
1050
|
-
) : null)), /* @__PURE__ */
|
|
1051
|
-
|
|
969
|
+
/* @__PURE__ */ _react2.default.createElement(_close.CloseIcon, { size: 20, color: colorScheme.foreground })
|
|
970
|
+
) : null)), /* @__PURE__ */ _react2.default.createElement(_reactnative.View, { style: styles2.navigationRow }, /* @__PURE__ */ _react2.default.createElement(
|
|
971
|
+
_reactnative.Pressable,
|
|
1052
972
|
{
|
|
1053
973
|
style: styles2.monthYearButton,
|
|
1054
974
|
onPress: onToggleYearPicker,
|
|
1055
975
|
accessibilityLabel: `${monthYearLabel}, tap to change`,
|
|
1056
976
|
accessibilityRole: "button"
|
|
1057
977
|
},
|
|
1058
|
-
/* @__PURE__ */
|
|
1059
|
-
/* @__PURE__ */
|
|
1060
|
-
), /* @__PURE__ */
|
|
1061
|
-
|
|
978
|
+
/* @__PURE__ */ _react2.default.createElement(_reactnative.Text, { style: [styles2.monthYearText, { color: theme.colors.foreground }] }, monthYearLabel),
|
|
979
|
+
/* @__PURE__ */ _react2.default.createElement(_chevrondown.ChevronDownIcon, { size: 18, color: theme.colors.foreground })
|
|
980
|
+
), /* @__PURE__ */ _react2.default.createElement(_reactnative.View, { style: styles2.navButtons }, /* @__PURE__ */ _react2.default.createElement(
|
|
981
|
+
_reactnative.Pressable,
|
|
1062
982
|
{
|
|
1063
983
|
style: styles2.navButton,
|
|
1064
984
|
onPress: onPreviousMonth,
|
|
1065
985
|
accessibilityLabel: "Previous month",
|
|
1066
986
|
accessibilityRole: "button"
|
|
1067
987
|
},
|
|
1068
|
-
/* @__PURE__ */
|
|
1069
|
-
), /* @__PURE__ */
|
|
1070
|
-
|
|
988
|
+
/* @__PURE__ */ _react2.default.createElement(_chevronleft.ChevronLeftIcon, { size: 20, color: theme.colors.foreground })
|
|
989
|
+
), /* @__PURE__ */ _react2.default.createElement(
|
|
990
|
+
_reactnative.Pressable,
|
|
1071
991
|
{
|
|
1072
992
|
style: styles2.navButton,
|
|
1073
993
|
onPress: onNextMonth,
|
|
1074
994
|
accessibilityLabel: "Next month",
|
|
1075
995
|
accessibilityRole: "button"
|
|
1076
996
|
},
|
|
1077
|
-
/* @__PURE__ */
|
|
997
|
+
/* @__PURE__ */ _react2.default.createElement(_chevronright.ChevronRightIcon, { size: 20, color: theme.colors.foreground })
|
|
1078
998
|
))));
|
|
1079
999
|
};
|
|
1080
1000
|
|
|
1081
1001
|
// src/components/dialogs/datepicker-dialog/datepicker-dialog-month-picker.tsx
|
|
1082
|
-
|
|
1083
|
-
|
|
1002
|
+
|
|
1003
|
+
|
|
1084
1004
|
var DatePickerDialogMonthPicker = ({ viewDate, locale, themeColor, onSelectMonth }) => {
|
|
1085
|
-
const theme = useXUITheme();
|
|
1086
|
-
const colorScheme = theme.colors[themeColor]
|
|
1005
|
+
const theme = _chunkOQ2BLOOGcjs.useXUITheme.call(void 0, );
|
|
1006
|
+
const colorScheme = _nullishCoalesce(theme.colors[themeColor], () => ( theme.colors.primary));
|
|
1087
1007
|
const isDefault = themeColor === "default";
|
|
1088
1008
|
const accentColor = isDefault ? theme.colors.foreground : colorScheme.main;
|
|
1089
1009
|
const accentFg = isDefault ? theme.colors.background : colorScheme.foreground;
|
|
1090
|
-
const months = (0,
|
|
1010
|
+
const months = _react.useMemo.call(void 0, () => getMonthNames(locale), [locale]);
|
|
1091
1011
|
const currentMonth = viewDate.getMonth();
|
|
1092
|
-
const groupAnim = (0,
|
|
1093
|
-
(0,
|
|
1012
|
+
const groupAnim = _react.useRef.call(void 0, new _reactnative.Animated.Value(0)).current;
|
|
1013
|
+
_react.useEffect.call(void 0, () => {
|
|
1094
1014
|
groupAnim.setValue(0);
|
|
1095
|
-
|
|
1015
|
+
_reactnative.Animated.timing(groupAnim, {
|
|
1096
1016
|
toValue: 1,
|
|
1097
1017
|
duration: 220,
|
|
1098
|
-
easing:
|
|
1018
|
+
easing: _reactnative.Easing.out(_reactnative.Easing.cubic),
|
|
1099
1019
|
useNativeDriver: true
|
|
1100
1020
|
}).start();
|
|
1101
1021
|
}, [groupAnim]);
|
|
1102
|
-
return /* @__PURE__ */
|
|
1103
|
-
|
|
1022
|
+
return /* @__PURE__ */ _react2.default.createElement(_reactnative.View, { style: styles2.monthPickerContainer }, /* @__PURE__ */ _react2.default.createElement(
|
|
1023
|
+
_reactnative.Animated.View,
|
|
1104
1024
|
{
|
|
1105
1025
|
style: {
|
|
1106
1026
|
opacity: groupAnim,
|
|
@@ -1114,10 +1034,10 @@ var DatePickerDialogMonthPicker = ({ viewDate, locale, themeColor, onSelectMonth
|
|
|
1114
1034
|
]
|
|
1115
1035
|
}
|
|
1116
1036
|
},
|
|
1117
|
-
/* @__PURE__ */
|
|
1037
|
+
/* @__PURE__ */ _react2.default.createElement(_reactnative.View, { style: styles2.monthGrid }, months.map((name, index) => {
|
|
1118
1038
|
const isCurrentMonth = index === currentMonth;
|
|
1119
|
-
return /* @__PURE__ */
|
|
1120
|
-
|
|
1039
|
+
return /* @__PURE__ */ _react2.default.createElement(
|
|
1040
|
+
_reactnative.Pressable,
|
|
1121
1041
|
{
|
|
1122
1042
|
key: index,
|
|
1123
1043
|
style: [
|
|
@@ -1129,8 +1049,8 @@ var DatePickerDialogMonthPicker = ({ viewDate, locale, themeColor, onSelectMonth
|
|
|
1129
1049
|
accessibilityRole: "button",
|
|
1130
1050
|
accessibilityState: { selected: isCurrentMonth }
|
|
1131
1051
|
},
|
|
1132
|
-
/* @__PURE__ */
|
|
1133
|
-
|
|
1052
|
+
/* @__PURE__ */ _react2.default.createElement(
|
|
1053
|
+
_reactnative.Text,
|
|
1134
1054
|
{
|
|
1135
1055
|
style: [
|
|
1136
1056
|
styles2.monthText,
|
|
@@ -1149,35 +1069,35 @@ var DatePickerDialogMonthPicker = ({ viewDate, locale, themeColor, onSelectMonth
|
|
|
1149
1069
|
};
|
|
1150
1070
|
|
|
1151
1071
|
// src/components/dialogs/datepicker-dialog/datepicker-dialog-year-picker.tsx
|
|
1152
|
-
|
|
1153
|
-
|
|
1072
|
+
|
|
1073
|
+
|
|
1154
1074
|
var ITEM_HEIGHT = 48;
|
|
1155
1075
|
var NUM_COLUMNS = 4;
|
|
1156
1076
|
var DatePickerDialogYearPicker = ({ viewDate, themeColor, minDate, maxDate, onSelectYear }) => {
|
|
1157
|
-
const listRef = (0,
|
|
1158
|
-
const groupAnim = (0,
|
|
1159
|
-
const theme = useXUITheme();
|
|
1160
|
-
const colorScheme = theme.colors[themeColor]
|
|
1077
|
+
const listRef = _react.useRef.call(void 0, null);
|
|
1078
|
+
const groupAnim = _react.useRef.call(void 0, new _reactnative.Animated.Value(0)).current;
|
|
1079
|
+
const theme = _chunkOQ2BLOOGcjs.useXUITheme.call(void 0, );
|
|
1080
|
+
const colorScheme = _nullishCoalesce(theme.colors[themeColor], () => ( theme.colors.primary));
|
|
1161
1081
|
const isDefault = themeColor === "default";
|
|
1162
1082
|
const accentColor = isDefault ? theme.colors.foreground : colorScheme.main;
|
|
1163
1083
|
const accentFg = isDefault ? theme.colors.background : colorScheme.foreground;
|
|
1164
|
-
const years = (0,
|
|
1084
|
+
const years = _react.useMemo.call(void 0, () => getYearRange(minDate, maxDate), [minDate, maxDate]);
|
|
1165
1085
|
const currentYear = viewDate.getFullYear();
|
|
1166
|
-
const initialIndex = (0,
|
|
1086
|
+
const initialIndex = _react.useMemo.call(void 0, () => {
|
|
1167
1087
|
const index = years.indexOf(currentYear);
|
|
1168
1088
|
const rowIndex = Math.floor(index / NUM_COLUMNS);
|
|
1169
1089
|
return Math.max(0, rowIndex);
|
|
1170
1090
|
}, [years, currentYear]);
|
|
1171
|
-
(0,
|
|
1091
|
+
_react.useEffect.call(void 0, () => {
|
|
1172
1092
|
groupAnim.setValue(0);
|
|
1173
|
-
|
|
1093
|
+
_reactnative.Animated.timing(groupAnim, {
|
|
1174
1094
|
toValue: 1,
|
|
1175
1095
|
duration: 220,
|
|
1176
|
-
easing:
|
|
1096
|
+
easing: _reactnative.Easing.out(_reactnative.Easing.cubic),
|
|
1177
1097
|
useNativeDriver: true
|
|
1178
1098
|
}).start();
|
|
1179
1099
|
}, [groupAnim]);
|
|
1180
|
-
const getItemLayout = (0,
|
|
1100
|
+
const getItemLayout = _react.useCallback.call(void 0,
|
|
1181
1101
|
(_, index) => ({
|
|
1182
1102
|
length: ITEM_HEIGHT,
|
|
1183
1103
|
offset: ITEM_HEIGHT * index,
|
|
@@ -1185,11 +1105,11 @@ var DatePickerDialogYearPicker = ({ viewDate, themeColor, minDate, maxDate, onSe
|
|
|
1185
1105
|
}),
|
|
1186
1106
|
[]
|
|
1187
1107
|
);
|
|
1188
|
-
const renderYear = (0,
|
|
1108
|
+
const renderYear = _react.useCallback.call(void 0,
|
|
1189
1109
|
({ item }) => {
|
|
1190
1110
|
const isCurrentYear = item === currentYear;
|
|
1191
|
-
return /* @__PURE__ */
|
|
1192
|
-
|
|
1111
|
+
return /* @__PURE__ */ _react2.default.createElement(
|
|
1112
|
+
_reactnative.Pressable,
|
|
1193
1113
|
{
|
|
1194
1114
|
style: [
|
|
1195
1115
|
styles2.yearCell,
|
|
@@ -1200,8 +1120,8 @@ var DatePickerDialogYearPicker = ({ viewDate, themeColor, minDate, maxDate, onSe
|
|
|
1200
1120
|
accessibilityRole: "button",
|
|
1201
1121
|
accessibilityState: { selected: isCurrentYear }
|
|
1202
1122
|
},
|
|
1203
|
-
/* @__PURE__ */
|
|
1204
|
-
|
|
1123
|
+
/* @__PURE__ */ _react2.default.createElement(
|
|
1124
|
+
_reactnative.Text,
|
|
1205
1125
|
{
|
|
1206
1126
|
style: [
|
|
1207
1127
|
styles2.yearText,
|
|
@@ -1218,8 +1138,8 @@ var DatePickerDialogYearPicker = ({ viewDate, themeColor, minDate, maxDate, onSe
|
|
|
1218
1138
|
},
|
|
1219
1139
|
[currentYear, onSelectYear, accentColor, accentFg, theme.colors.foreground]
|
|
1220
1140
|
);
|
|
1221
|
-
return /* @__PURE__ */
|
|
1222
|
-
|
|
1141
|
+
return /* @__PURE__ */ _react2.default.createElement(_reactnative.View, { style: styles2.yearPickerContainer }, /* @__PURE__ */ _react2.default.createElement(
|
|
1142
|
+
_reactnative.Animated.View,
|
|
1223
1143
|
{
|
|
1224
1144
|
style: {
|
|
1225
1145
|
opacity: groupAnim,
|
|
@@ -1233,8 +1153,8 @@ var DatePickerDialogYearPicker = ({ viewDate, themeColor, minDate, maxDate, onSe
|
|
|
1233
1153
|
]
|
|
1234
1154
|
}
|
|
1235
1155
|
},
|
|
1236
|
-
/* @__PURE__ */
|
|
1237
|
-
|
|
1156
|
+
/* @__PURE__ */ _react2.default.createElement(
|
|
1157
|
+
_reactnative.FlatList,
|
|
1238
1158
|
{
|
|
1239
1159
|
ref: listRef,
|
|
1240
1160
|
data: years,
|
|
@@ -1266,20 +1186,20 @@ var DatePickerDialog = ({
|
|
|
1266
1186
|
onClearValue,
|
|
1267
1187
|
onClose
|
|
1268
1188
|
}) => {
|
|
1269
|
-
const theme = useXUITheme();
|
|
1270
|
-
const { width: screenWidth, height: screenHeight } = (0,
|
|
1271
|
-
const fadeAnim = (0,
|
|
1272
|
-
const slideAnim = (0,
|
|
1273
|
-
const scaleAnim = (0,
|
|
1274
|
-
const viewFadeAnim = (0,
|
|
1275
|
-
const monthSlideXAnim = (0,
|
|
1276
|
-
const monthFadeAnim = (0,
|
|
1277
|
-
const colorScheme = theme.colors[themeColor]
|
|
1189
|
+
const theme = _chunkOQ2BLOOGcjs.useXUITheme.call(void 0, );
|
|
1190
|
+
const { width: screenWidth, height: screenHeight } = _reactnative.useWindowDimensions.call(void 0, );
|
|
1191
|
+
const fadeAnim = _react.useRef.call(void 0, new _reactnative.Animated.Value(0)).current;
|
|
1192
|
+
const slideAnim = _react.useRef.call(void 0, new _reactnative.Animated.Value(0)).current;
|
|
1193
|
+
const scaleAnim = _react.useRef.call(void 0, new _reactnative.Animated.Value(0)).current;
|
|
1194
|
+
const viewFadeAnim = _react.useRef.call(void 0, new _reactnative.Animated.Value(1)).current;
|
|
1195
|
+
const monthSlideXAnim = _react.useRef.call(void 0, new _reactnative.Animated.Value(0)).current;
|
|
1196
|
+
const monthFadeAnim = _react.useRef.call(void 0, new _reactnative.Animated.Value(1)).current;
|
|
1197
|
+
const colorScheme = _nullishCoalesce(theme.colors[themeColor], () => ( theme.colors.primary));
|
|
1278
1198
|
const isDefault = themeColor === "default";
|
|
1279
1199
|
const accentColor = isDefault ? theme.colors.foreground : colorScheme.main;
|
|
1280
1200
|
const labels = getDatePickerLabels(locale);
|
|
1281
|
-
const resolvedTodayLabel = todayLabel
|
|
1282
|
-
const resolvedConfirmLabel = confirmLabel
|
|
1201
|
+
const resolvedTodayLabel = _nullishCoalesce(todayLabel, () => ( labels.today));
|
|
1202
|
+
const resolvedConfirmLabel = _nullishCoalesce(confirmLabel, () => ( labels.confirm));
|
|
1283
1203
|
const {
|
|
1284
1204
|
viewDate,
|
|
1285
1205
|
viewMode,
|
|
@@ -1291,7 +1211,7 @@ var DatePickerDialog = ({
|
|
|
1291
1211
|
toggleYearPicker,
|
|
1292
1212
|
syncViewToDate
|
|
1293
1213
|
} = useDatePickerViewState(selectedDate);
|
|
1294
|
-
const onCloseComplete = (0,
|
|
1214
|
+
const onCloseComplete = _react.useCallback.call(void 0, () => {
|
|
1295
1215
|
fadeAnim.setValue(0);
|
|
1296
1216
|
slideAnim.setValue(0);
|
|
1297
1217
|
scaleAnim.setValue(0);
|
|
@@ -1313,41 +1233,41 @@ var DatePickerDialog = ({
|
|
|
1313
1233
|
slideAnim: monthSlideXAnim,
|
|
1314
1234
|
fadeAnim: monthFadeAnim
|
|
1315
1235
|
});
|
|
1316
|
-
const prevViewModeRef = (0,
|
|
1317
|
-
(0,
|
|
1236
|
+
const prevViewModeRef = _react.useRef.call(void 0, viewMode);
|
|
1237
|
+
_react.useEffect.call(void 0, () => {
|
|
1318
1238
|
if (prevViewModeRef.current !== viewMode) {
|
|
1319
1239
|
prevViewModeRef.current = viewMode;
|
|
1320
1240
|
animateViewTransition();
|
|
1321
1241
|
}
|
|
1322
1242
|
}, [viewMode, animateViewTransition]);
|
|
1323
|
-
(0,
|
|
1243
|
+
_react.useEffect.call(void 0, () => {
|
|
1324
1244
|
if (visible && selectedDate) {
|
|
1325
1245
|
syncViewToDate(selectedDate);
|
|
1326
1246
|
}
|
|
1327
1247
|
}, [visible, selectedDate, syncViewToDate]);
|
|
1328
|
-
(0,
|
|
1248
|
+
_react.useEffect.call(void 0, () => {
|
|
1329
1249
|
if (!visible) return;
|
|
1330
|
-
const sub =
|
|
1250
|
+
const sub = _reactnative.BackHandler.addEventListener("hardwareBackPress", () => {
|
|
1331
1251
|
onClose();
|
|
1332
1252
|
return true;
|
|
1333
1253
|
});
|
|
1334
1254
|
return () => sub.remove();
|
|
1335
1255
|
}, [visible, onClose]);
|
|
1336
|
-
const handlePreviousMonth = (0,
|
|
1256
|
+
const handlePreviousMonth = _react.useCallback.call(void 0, () => {
|
|
1337
1257
|
goToPreviousMonth();
|
|
1338
1258
|
animateMonthSlide("left");
|
|
1339
1259
|
}, [goToPreviousMonth, animateMonthSlide]);
|
|
1340
|
-
const handleNextMonth = (0,
|
|
1260
|
+
const handleNextMonth = _react.useCallback.call(void 0, () => {
|
|
1341
1261
|
goToNextMonth();
|
|
1342
1262
|
animateMonthSlide("right");
|
|
1343
1263
|
}, [goToNextMonth, animateMonthSlide]);
|
|
1344
|
-
const handleDaySelect = (0,
|
|
1264
|
+
const handleDaySelect = _react.useCallback.call(void 0,
|
|
1345
1265
|
(date) => {
|
|
1346
1266
|
onDateSelect(date);
|
|
1347
1267
|
},
|
|
1348
1268
|
[onDateSelect]
|
|
1349
1269
|
);
|
|
1350
|
-
const handleTodayPress = (0,
|
|
1270
|
+
const handleTodayPress = _react.useCallback.call(void 0, () => {
|
|
1351
1271
|
const today = /* @__PURE__ */ new Date();
|
|
1352
1272
|
if (!isDateInRange(today, minDate, maxDate)) return;
|
|
1353
1273
|
goToToday();
|
|
@@ -1396,7 +1316,7 @@ var DatePickerDialog = ({
|
|
|
1396
1316
|
const renderContent = () => {
|
|
1397
1317
|
switch (viewMode) {
|
|
1398
1318
|
case "year":
|
|
1399
|
-
return /* @__PURE__ */
|
|
1319
|
+
return /* @__PURE__ */ _react2.default.createElement(
|
|
1400
1320
|
DatePickerDialogYearPicker,
|
|
1401
1321
|
{
|
|
1402
1322
|
viewDate,
|
|
@@ -1407,7 +1327,7 @@ var DatePickerDialog = ({
|
|
|
1407
1327
|
}
|
|
1408
1328
|
);
|
|
1409
1329
|
case "month":
|
|
1410
|
-
return /* @__PURE__ */
|
|
1330
|
+
return /* @__PURE__ */ _react2.default.createElement(
|
|
1411
1331
|
DatePickerDialogMonthPicker,
|
|
1412
1332
|
{
|
|
1413
1333
|
viewDate,
|
|
@@ -1418,7 +1338,7 @@ var DatePickerDialog = ({
|
|
|
1418
1338
|
);
|
|
1419
1339
|
case "calendar":
|
|
1420
1340
|
default:
|
|
1421
|
-
return /* @__PURE__ */
|
|
1341
|
+
return /* @__PURE__ */ _react2.default.createElement(_reactnative.Animated.View, { style: [viewTransitionStyle, monthSlideStyle] }, /* @__PURE__ */ _react2.default.createElement(
|
|
1422
1342
|
DatePickerDialogCalendar,
|
|
1423
1343
|
{
|
|
1424
1344
|
viewDate,
|
|
@@ -1435,23 +1355,23 @@ var DatePickerDialog = ({
|
|
|
1435
1355
|
));
|
|
1436
1356
|
}
|
|
1437
1357
|
};
|
|
1438
|
-
return /* @__PURE__ */
|
|
1439
|
-
|
|
1358
|
+
return /* @__PURE__ */ _react2.default.createElement(_chunkOQ2BLOOGcjs.Portal, null, /* @__PURE__ */ _react2.default.createElement(_reactnativegesturehandler.GestureHandlerRootView, { style: [overlayStyle, style] }, /* @__PURE__ */ _react2.default.createElement(_reactnative.View, { style: overlayStyle }, /* @__PURE__ */ _react2.default.createElement(_reactnative.Animated.View, { style: [styles2.backdrop, { opacity: fadeAnim }] }, /* @__PURE__ */ _react2.default.createElement(
|
|
1359
|
+
_reactnative.Pressable,
|
|
1440
1360
|
{
|
|
1441
1361
|
style: { flex: 1 },
|
|
1442
1362
|
onPress: onClose,
|
|
1443
1363
|
accessibilityLabel: "Close calendar",
|
|
1444
1364
|
accessibilityRole: "button"
|
|
1445
1365
|
}
|
|
1446
|
-
)), /* @__PURE__ */
|
|
1447
|
-
|
|
1366
|
+
)), /* @__PURE__ */ _react2.default.createElement(_reactnative.Animated.View, { style: [styles2.dialogContainer, containerAnimatedStyle] }, /* @__PURE__ */ _react2.default.createElement(
|
|
1367
|
+
_reactnative.View,
|
|
1448
1368
|
{
|
|
1449
1369
|
style: [
|
|
1450
1370
|
styles2.container,
|
|
1451
1371
|
{ backgroundColor: theme.colors.background }
|
|
1452
1372
|
]
|
|
1453
1373
|
},
|
|
1454
|
-
/* @__PURE__ */
|
|
1374
|
+
/* @__PURE__ */ _react2.default.createElement(
|
|
1455
1375
|
DatePickerDialogHeader,
|
|
1456
1376
|
{
|
|
1457
1377
|
viewDate,
|
|
@@ -1466,33 +1386,33 @@ var DatePickerDialog = ({
|
|
|
1466
1386
|
}
|
|
1467
1387
|
),
|
|
1468
1388
|
renderContent(),
|
|
1469
|
-
/* @__PURE__ */
|
|
1470
|
-
|
|
1389
|
+
/* @__PURE__ */ _react2.default.createElement(_reactnative.View, { style: styles2.footer }, /* @__PURE__ */ _react2.default.createElement(
|
|
1390
|
+
_reactnative.Pressable,
|
|
1471
1391
|
{
|
|
1472
1392
|
style: styles2.footerButton,
|
|
1473
1393
|
onPress: handleTodayPress,
|
|
1474
1394
|
accessibilityLabel: resolvedTodayLabel,
|
|
1475
1395
|
accessibilityRole: "button"
|
|
1476
1396
|
},
|
|
1477
|
-
/* @__PURE__ */
|
|
1478
|
-
), /* @__PURE__ */
|
|
1479
|
-
|
|
1397
|
+
/* @__PURE__ */ _react2.default.createElement(_reactnative.Text, { style: [styles2.footerButtonText, { color: accentColor }] }, resolvedTodayLabel)
|
|
1398
|
+
), /* @__PURE__ */ _react2.default.createElement(
|
|
1399
|
+
_reactnative.Pressable,
|
|
1480
1400
|
{
|
|
1481
1401
|
style: styles2.footerButton,
|
|
1482
1402
|
onPress: onClose,
|
|
1483
1403
|
accessibilityLabel: resolvedConfirmLabel,
|
|
1484
1404
|
accessibilityRole: "button"
|
|
1485
1405
|
},
|
|
1486
|
-
/* @__PURE__ */
|
|
1406
|
+
/* @__PURE__ */ _react2.default.createElement(_reactnative.Text, { style: [styles2.footerButtonText, { color: accentColor }] }, resolvedConfirmLabel)
|
|
1487
1407
|
))
|
|
1488
1408
|
)))));
|
|
1489
1409
|
};
|
|
1490
1410
|
|
|
1491
1411
|
// src/components/datepicker/datepicker-trigger.tsx
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
var
|
|
1495
|
-
|
|
1412
|
+
|
|
1413
|
+
|
|
1414
|
+
var _calendar = require('@xaui/icons/calendar');
|
|
1415
|
+
|
|
1496
1416
|
var DatePickerTrigger = ({
|
|
1497
1417
|
triggerRef,
|
|
1498
1418
|
isDisabled,
|
|
@@ -1514,8 +1434,8 @@ var DatePickerTrigger = ({
|
|
|
1514
1434
|
onLayout: handleTriggerLayout
|
|
1515
1435
|
}) => {
|
|
1516
1436
|
const renderLabel = isLabelInside && label;
|
|
1517
|
-
return /* @__PURE__ */
|
|
1518
|
-
|
|
1437
|
+
return /* @__PURE__ */ _react2.default.createElement(
|
|
1438
|
+
_reactnative.Pressable,
|
|
1519
1439
|
{
|
|
1520
1440
|
ref: triggerRef,
|
|
1521
1441
|
onPress: handleTriggerPress,
|
|
@@ -1533,12 +1453,12 @@ var DatePickerTrigger = ({
|
|
|
1533
1453
|
isDisabled && styles.disabled,
|
|
1534
1454
|
style
|
|
1535
1455
|
],
|
|
1536
|
-
accessibilityLabel: labelText
|
|
1456
|
+
accessibilityLabel: _nullishCoalesce(labelText, () => ( (typeof label === "string" ? label : void 0))),
|
|
1537
1457
|
accessibilityRole: "button",
|
|
1538
1458
|
accessibilityState: { disabled: isDisabled }
|
|
1539
1459
|
},
|
|
1540
|
-
/* @__PURE__ */
|
|
1541
|
-
|
|
1460
|
+
/* @__PURE__ */ _react2.default.createElement(_reactnative.View, { style: styles.triggerContent }, isLabelInside && renderLabel, /* @__PURE__ */ _react2.default.createElement(
|
|
1461
|
+
_reactnative.Text,
|
|
1542
1462
|
{
|
|
1543
1463
|
style: [
|
|
1544
1464
|
styles.triggerText,
|
|
@@ -1551,15 +1471,15 @@ var DatePickerTrigger = ({
|
|
|
1551
1471
|
},
|
|
1552
1472
|
displayValue
|
|
1553
1473
|
)),
|
|
1554
|
-
isClearable && hasValue ? /* @__PURE__ */
|
|
1555
|
-
|
|
1474
|
+
isClearable && hasValue ? /* @__PURE__ */ _react2.default.createElement(
|
|
1475
|
+
_reactnative.TouchableOpacity,
|
|
1556
1476
|
{
|
|
1557
1477
|
onPress: handleClear,
|
|
1558
1478
|
style: styles.clearButton,
|
|
1559
1479
|
hitSlop: { top: 8, right: 8, bottom: 8, left: 8 }
|
|
1560
1480
|
},
|
|
1561
|
-
/* @__PURE__ */
|
|
1562
|
-
) : calendarIcon
|
|
1481
|
+
/* @__PURE__ */ _react2.default.createElement(_close.CloseIcon, { color: theme.colors.foreground, size: 20 })
|
|
1482
|
+
) : _nullishCoalesce(calendarIcon, () => ( /* @__PURE__ */ _react2.default.createElement(_calendar.CalendarIcon, { color: theme.colors.foreground, size: 20 })))
|
|
1563
1483
|
);
|
|
1564
1484
|
};
|
|
1565
1485
|
|
|
@@ -1592,7 +1512,7 @@ var DatePicker = ({
|
|
|
1592
1512
|
onClose,
|
|
1593
1513
|
onOpenChange
|
|
1594
1514
|
}) => {
|
|
1595
|
-
const theme = useXUITheme();
|
|
1515
|
+
const theme = _chunkOQ2BLOOGcjs.useXUITheme.call(void 0, );
|
|
1596
1516
|
const { selectedDate, updateDate } = useDatePickerState({
|
|
1597
1517
|
value,
|
|
1598
1518
|
defaultValue,
|
|
@@ -1604,11 +1524,11 @@ var DatePicker = ({
|
|
|
1604
1524
|
onOpen,
|
|
1605
1525
|
onClose
|
|
1606
1526
|
});
|
|
1607
|
-
const triggerRef = (0,
|
|
1608
|
-
const handleTriggerLayout = (0,
|
|
1527
|
+
const triggerRef = _react.useRef.call(void 0, null);
|
|
1528
|
+
const handleTriggerLayout = _react.useCallback.call(void 0, () => {
|
|
1609
1529
|
}, []);
|
|
1610
|
-
const firstDayOfWeek = (0,
|
|
1611
|
-
() => firstDayOfWeekProp
|
|
1530
|
+
const firstDayOfWeek = _react.useMemo.call(void 0,
|
|
1531
|
+
() => _nullishCoalesce(firstDayOfWeekProp, () => ( getFirstDayOfWeek(locale))),
|
|
1612
1532
|
[firstDayOfWeekProp, locale]
|
|
1613
1533
|
);
|
|
1614
1534
|
const sizeStyles = useDatePickerSizeStyles(size);
|
|
@@ -1620,35 +1540,35 @@ var DatePicker = ({
|
|
|
1620
1540
|
sizeStyles.labelSize
|
|
1621
1541
|
);
|
|
1622
1542
|
const helperColor = useDatePickerHelperColor(isInvalid);
|
|
1623
|
-
const displayValue = (0,
|
|
1543
|
+
const displayValue = _react.useMemo.call(void 0, () => {
|
|
1624
1544
|
if (!selectedDate) return placeholder;
|
|
1625
1545
|
return formatDate(selectedDate, locale);
|
|
1626
1546
|
}, [selectedDate, locale, placeholder]);
|
|
1627
|
-
const handleTriggerPress = (0,
|
|
1547
|
+
const handleTriggerPress = _react.useCallback.call(void 0, () => {
|
|
1628
1548
|
if (!isDisabled && !isReadOnly) {
|
|
1629
1549
|
setOpen(true);
|
|
1630
1550
|
}
|
|
1631
1551
|
}, [isDisabled, isReadOnly, setOpen]);
|
|
1632
|
-
const handleClear = (0,
|
|
1552
|
+
const handleClear = _react.useCallback.call(void 0, () => {
|
|
1633
1553
|
if (isDisabled || isReadOnly) return;
|
|
1634
1554
|
updateDate(null);
|
|
1635
1555
|
}, [isDisabled, isReadOnly, updateDate]);
|
|
1636
|
-
const handleDateSelect = (0,
|
|
1556
|
+
const handleDateSelect = _react.useCallback.call(void 0,
|
|
1637
1557
|
(date) => {
|
|
1638
1558
|
updateDate(date);
|
|
1639
1559
|
},
|
|
1640
1560
|
[updateDate]
|
|
1641
1561
|
);
|
|
1642
|
-
const handleClose = (0,
|
|
1562
|
+
const handleClose = _react.useCallback.call(void 0, () => {
|
|
1643
1563
|
setOpen(false);
|
|
1644
1564
|
}, [setOpen]);
|
|
1645
1565
|
const isLabelInside = labelPlacement === "inside";
|
|
1646
1566
|
const isLabelOutsideLeft = labelPlacement === "outside-left";
|
|
1647
1567
|
const isLabelOutside = labelPlacement === "outside" || labelPlacement === "outside-top";
|
|
1648
|
-
const renderLabel = label ? typeof label === "string" || typeof label === "number" ? /* @__PURE__ */
|
|
1568
|
+
const renderLabel = label ? typeof label === "string" || typeof label === "number" ? /* @__PURE__ */ _react2.default.createElement(_reactnative.Text, { style: [styles.label, labelStyle] }, label) : /* @__PURE__ */ _react2.default.createElement(_reactnative.View, null, label) : null;
|
|
1649
1569
|
const shouldShowHelper = Boolean(description || errorMessage);
|
|
1650
1570
|
const helperContent = isInvalid && errorMessage ? errorMessage : description;
|
|
1651
|
-
const triggerContent = /* @__PURE__ */
|
|
1571
|
+
const triggerContent = /* @__PURE__ */ _react2.default.createElement(
|
|
1652
1572
|
DatePickerTrigger,
|
|
1653
1573
|
{
|
|
1654
1574
|
triggerRef,
|
|
@@ -1664,27 +1584,27 @@ var DatePicker = ({
|
|
|
1664
1584
|
labelText: typeof label === "string" ? label : void 0,
|
|
1665
1585
|
isLabelInside,
|
|
1666
1586
|
calendarIcon,
|
|
1667
|
-
style: customAppearance
|
|
1668
|
-
textStyle: customAppearance
|
|
1587
|
+
style: _optionalChain([customAppearance, 'optionalAccess', _6 => _6.trigger]),
|
|
1588
|
+
textStyle: _optionalChain([customAppearance, 'optionalAccess', _7 => _7.text]),
|
|
1669
1589
|
onPress: handleTriggerPress,
|
|
1670
1590
|
onClear: handleClear,
|
|
1671
1591
|
onLayout: handleTriggerLayout
|
|
1672
1592
|
}
|
|
1673
1593
|
);
|
|
1674
1594
|
const labelBlock = isLabelOutside || isLabelInside ? renderLabel : null;
|
|
1675
|
-
return /* @__PURE__ */
|
|
1676
|
-
|
|
1595
|
+
return /* @__PURE__ */ _react2.default.createElement(
|
|
1596
|
+
_reactnative.View,
|
|
1677
1597
|
{
|
|
1678
1598
|
style: [
|
|
1679
1599
|
styles.container,
|
|
1680
1600
|
fullWidth ? styles.fullWidth : styles.minWidth,
|
|
1681
|
-
customAppearance
|
|
1601
|
+
_optionalChain([customAppearance, 'optionalAccess', _8 => _8.container])
|
|
1682
1602
|
]
|
|
1683
1603
|
},
|
|
1684
1604
|
isLabelOutside && labelBlock,
|
|
1685
|
-
isLabelOutsideLeft ? /* @__PURE__ */
|
|
1686
|
-
shouldShowHelper && helperContent ? typeof helperContent === "string" || typeof helperContent === "number" ? /* @__PURE__ */
|
|
1687
|
-
/* @__PURE__ */
|
|
1605
|
+
isLabelOutsideLeft ? /* @__PURE__ */ _react2.default.createElement(_reactnative.View, { style: styles.outsideLeftRow }, renderLabel, triggerContent) : triggerContent,
|
|
1606
|
+
shouldShowHelper && helperContent ? typeof helperContent === "string" || typeof helperContent === "number" ? /* @__PURE__ */ _react2.default.createElement(_reactnative.Text, { style: [styles.helperText, { color: helperColor }] }, helperContent) : /* @__PURE__ */ _react2.default.createElement(_reactnative.View, null, helperContent) : null,
|
|
1607
|
+
/* @__PURE__ */ _react2.default.createElement(
|
|
1688
1608
|
DatePickerDialog,
|
|
1689
1609
|
{
|
|
1690
1610
|
visible: isOpen,
|
|
@@ -1694,7 +1614,7 @@ var DatePicker = ({
|
|
|
1694
1614
|
themeColor,
|
|
1695
1615
|
minDate,
|
|
1696
1616
|
maxDate,
|
|
1697
|
-
style: customAppearance
|
|
1617
|
+
style: _optionalChain([customAppearance, 'optionalAccess', _9 => _9.calendar]),
|
|
1698
1618
|
onDateSelect: handleDateSelect,
|
|
1699
1619
|
onClearValue: handleClear,
|
|
1700
1620
|
onClose: handleClose
|
|
@@ -1702,7 +1622,6 @@ var DatePicker = ({
|
|
|
1702
1622
|
)
|
|
1703
1623
|
);
|
|
1704
1624
|
};
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
});
|
|
1625
|
+
|
|
1626
|
+
|
|
1627
|
+
exports.DatePicker = DatePicker;
|