@xaui/native 0.0.27 → 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 +6 -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,125 +1,37 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
|
|
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; }
|
|
2
|
+
|
|
3
|
+
var _chunkDHSTKO3Kcjs = require('../chunk-DHSTKO3K.cjs');
|
|
4
|
+
require('../chunk-HSPTLUFA.cjs');
|
|
29
5
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
Autocomplete: () => Autocomplete,
|
|
34
|
-
AutocompleteItem: () => AutocompleteItem
|
|
35
|
-
});
|
|
36
|
-
module.exports = __toCommonJS(autocomplete_exports);
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
var _chunkOQ2BLOOGcjs = require('../chunk-OQ2BLOOG.cjs');
|
|
37
9
|
|
|
38
10
|
// src/components/autocomplete/autocomplete.tsx
|
|
39
|
-
var
|
|
40
|
-
var
|
|
11
|
+
var _react = require('react'); var _react2 = _interopRequireDefault(_react);
|
|
12
|
+
var _reactnative = require('react-native');
|
|
41
13
|
|
|
42
14
|
// src/components/autocomplete/autocomplete-context.ts
|
|
43
|
-
|
|
44
|
-
var AutocompleteContext = (0,
|
|
15
|
+
|
|
16
|
+
var AutocompleteContext = _react.createContext.call(void 0, {
|
|
45
17
|
size: "md",
|
|
46
18
|
themeColor: "default",
|
|
47
19
|
isDisabled: false
|
|
48
20
|
});
|
|
49
21
|
|
|
50
22
|
// src/components/autocomplete/autocomplete.hook.ts
|
|
51
|
-
var import_react7 = require("react");
|
|
52
|
-
var import_core = require("@xaui/core");
|
|
53
|
-
var import_palette2 = require("@xaui/core/palette");
|
|
54
|
-
|
|
55
|
-
// src/core/theme-context.tsx
|
|
56
|
-
var import_react5 = __toESM(require("react"), 1);
|
|
57
|
-
var import_react_native2 = require("react-native");
|
|
58
|
-
var import_theme = require("@xaui/core/theme");
|
|
59
|
-
var import_palette = require("@xaui/core/palette");
|
|
60
|
-
|
|
61
|
-
// src/core/portal/portal.tsx
|
|
62
|
-
var import_react3 = require("react");
|
|
63
|
-
|
|
64
|
-
// src/core/portal/portal-context.ts
|
|
65
|
-
var import_react2 = require("react");
|
|
66
|
-
var PortalContext = (0, import_react2.createContext)(null);
|
|
67
|
-
|
|
68
|
-
// src/core/portal/portal.tsx
|
|
69
|
-
var portalId = 0;
|
|
70
|
-
var Portal = ({ children }) => {
|
|
71
|
-
const context = (0, import_react3.useContext)(PortalContext);
|
|
72
|
-
const keyRef = (0, import_react3.useRef)(`portal-${++portalId}`);
|
|
73
|
-
(0, import_react3.useLayoutEffect)(() => {
|
|
74
|
-
if (!context) return;
|
|
75
|
-
context.addPortal(keyRef.current, children);
|
|
76
|
-
}, [children, context]);
|
|
77
|
-
(0, import_react3.useEffect)(() => {
|
|
78
|
-
if (!context) return;
|
|
79
|
-
const key = keyRef.current;
|
|
80
|
-
return () => {
|
|
81
|
-
context.removePortal(key);
|
|
82
|
-
};
|
|
83
|
-
}, [context]);
|
|
84
|
-
return null;
|
|
85
|
-
};
|
|
86
|
-
|
|
87
|
-
// src/core/portal/portal-host.tsx
|
|
88
|
-
var import_react4 = __toESM(require("react"), 1);
|
|
89
|
-
var import_react_native = require("react-native");
|
|
90
|
-
var hostStyles = import_react_native.StyleSheet.create({
|
|
91
|
-
container: {
|
|
92
|
-
flex: 1
|
|
93
|
-
}
|
|
94
|
-
});
|
|
95
|
-
|
|
96
|
-
// src/core/theme-context.tsx
|
|
97
|
-
var XUIThemeContext = (0, import_react5.createContext)(null);
|
|
98
23
|
|
|
99
|
-
|
|
100
|
-
var
|
|
101
|
-
var import_react_native3 = require("react-native");
|
|
102
|
-
function useXUITheme() {
|
|
103
|
-
const theme = (0, import_react6.useContext)(XUIThemeContext);
|
|
104
|
-
if (!theme) {
|
|
105
|
-
throw new Error("useXUITheme must be used within XUIProvider");
|
|
106
|
-
}
|
|
107
|
-
return theme;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
// src/core/index.ts
|
|
111
|
-
var import_theme2 = require("@xaui/core/theme");
|
|
112
|
-
|
|
113
|
-
// src/components/autocomplete/autocomplete.hook.ts
|
|
24
|
+
var _core = require('@xaui/core');
|
|
25
|
+
var _palette = require('@xaui/core/palette');
|
|
114
26
|
var useAutocompleteColorScheme = (themeColor) => {
|
|
115
|
-
const theme = useXUITheme();
|
|
116
|
-
const safeThemeColor = (0,
|
|
27
|
+
const theme = _chunkOQ2BLOOGcjs.useXUITheme.call(void 0, );
|
|
28
|
+
const safeThemeColor = _core.getSafeThemeColor.call(void 0, themeColor);
|
|
117
29
|
const colorScheme = theme.colors[safeThemeColor];
|
|
118
30
|
return { theme, colorScheme };
|
|
119
31
|
};
|
|
120
32
|
var useAutocompleteSizeStyles = (size) => {
|
|
121
|
-
const theme = useXUITheme();
|
|
122
|
-
return (0,
|
|
33
|
+
const theme = _chunkOQ2BLOOGcjs.useXUITheme.call(void 0, );
|
|
34
|
+
return _react.useMemo.call(void 0, () => {
|
|
123
35
|
const sizes = {
|
|
124
36
|
xs: {
|
|
125
37
|
minHeight: 34,
|
|
@@ -154,8 +66,8 @@ var useAutocompleteSizeStyles = (size) => {
|
|
|
154
66
|
}, [size, theme]);
|
|
155
67
|
};
|
|
156
68
|
var useAutocompleteRadiusStyles = (radius) => {
|
|
157
|
-
const theme = useXUITheme();
|
|
158
|
-
const radiusStyles = (0,
|
|
69
|
+
const theme = _chunkOQ2BLOOGcjs.useXUITheme.call(void 0, );
|
|
70
|
+
const radiusStyles = _react.useMemo.call(void 0, () => {
|
|
159
71
|
const radii = {
|
|
160
72
|
none: theme.borderRadius.none,
|
|
161
73
|
sm: theme.borderRadius.sm,
|
|
@@ -165,7 +77,7 @@ var useAutocompleteRadiusStyles = (radius) => {
|
|
|
165
77
|
};
|
|
166
78
|
return { borderRadius: radii[radius] };
|
|
167
79
|
}, [radius, theme]);
|
|
168
|
-
const listboxRadius = (0,
|
|
80
|
+
const listboxRadius = _react.useMemo.call(void 0, () => {
|
|
169
81
|
const radii = {
|
|
170
82
|
none: theme.borderRadius.none,
|
|
171
83
|
sm: theme.borderRadius.sm,
|
|
@@ -179,10 +91,10 @@ var useAutocompleteRadiusStyles = (radius) => {
|
|
|
179
91
|
};
|
|
180
92
|
var useAutocompleteVariantStyles = (themeColor, variant, isInvalid) => {
|
|
181
93
|
const { theme, colorScheme } = useAutocompleteColorScheme(themeColor);
|
|
182
|
-
return (0,
|
|
94
|
+
return _react.useMemo.call(void 0, () => {
|
|
183
95
|
let borderColor = isInvalid ? theme.colors.danger.main : colorScheme.main;
|
|
184
96
|
if ((variant === "outlined" || variant === "faded") && themeColor === "default") {
|
|
185
|
-
borderColor =
|
|
97
|
+
borderColor = _palette.colors.gray[300];
|
|
186
98
|
}
|
|
187
99
|
const styles4 = {
|
|
188
100
|
outlined: {
|
|
@@ -214,7 +126,7 @@ var useAutocompleteVariantStyles = (themeColor, variant, isInvalid) => {
|
|
|
214
126
|
};
|
|
215
127
|
var useAutocompleteLabelStyle = (themeColor, isInvalid, labelSize) => {
|
|
216
128
|
const { theme, colorScheme } = useAutocompleteColorScheme(themeColor);
|
|
217
|
-
return (0,
|
|
129
|
+
return _react.useMemo.call(void 0, () => {
|
|
218
130
|
let baseColor = theme.colors.foreground;
|
|
219
131
|
if (isInvalid) {
|
|
220
132
|
baseColor = theme.colors.danger.main;
|
|
@@ -228,18 +140,18 @@ var useAutocompleteLabelStyle = (themeColor, isInvalid, labelSize) => {
|
|
|
228
140
|
}, [isInvalid, labelSize, theme, themeColor, colorScheme]);
|
|
229
141
|
};
|
|
230
142
|
var useAutocompleteHelperColor = (isInvalid) => {
|
|
231
|
-
const theme = useXUITheme();
|
|
232
|
-
return (0,
|
|
143
|
+
const theme = _chunkOQ2BLOOGcjs.useXUITheme.call(void 0, );
|
|
144
|
+
return _react.useMemo.call(void 0, () => {
|
|
233
145
|
if (isInvalid) {
|
|
234
146
|
return theme.colors.danger.main;
|
|
235
147
|
}
|
|
236
|
-
return
|
|
148
|
+
return _palette.colors.gray[600];
|
|
237
149
|
}, [isInvalid, theme]);
|
|
238
150
|
};
|
|
239
151
|
|
|
240
152
|
// src/components/autocomplete/autocomplete.style.ts
|
|
241
|
-
|
|
242
|
-
var styles =
|
|
153
|
+
|
|
154
|
+
var styles = _reactnative.StyleSheet.create({
|
|
243
155
|
container: {
|
|
244
156
|
gap: 6,
|
|
245
157
|
position: "relative"
|
|
@@ -326,16 +238,16 @@ var styles = import_react_native4.StyleSheet.create({
|
|
|
326
238
|
});
|
|
327
239
|
|
|
328
240
|
// src/components/autocomplete/autocomplete.state.hook.ts
|
|
329
|
-
|
|
241
|
+
|
|
330
242
|
var useAutocompleteOpenState = ({
|
|
331
243
|
isOpened,
|
|
332
244
|
isDisabled,
|
|
333
245
|
onOpenChange,
|
|
334
246
|
onClose
|
|
335
247
|
}) => {
|
|
336
|
-
const [internalIsOpen, setInternalIsOpen] = (0,
|
|
248
|
+
const [internalIsOpen, setInternalIsOpen] = _react.useState.call(void 0, false);
|
|
337
249
|
const isOpen = isOpened !== void 0 ? isOpened : internalIsOpen;
|
|
338
|
-
const setOpen = (0,
|
|
250
|
+
const setOpen = _react.useCallback.call(void 0,
|
|
339
251
|
(open) => {
|
|
340
252
|
if (isDisabled) {
|
|
341
253
|
return;
|
|
@@ -343,9 +255,9 @@ var useAutocompleteOpenState = ({
|
|
|
343
255
|
if (isOpened === void 0) {
|
|
344
256
|
setInternalIsOpen(open);
|
|
345
257
|
}
|
|
346
|
-
onOpenChange
|
|
258
|
+
_optionalChain([onOpenChange, 'optionalCall', _2 => _2(open)]);
|
|
347
259
|
if (!open) {
|
|
348
|
-
onClose
|
|
260
|
+
_optionalChain([onClose, 'optionalCall', _3 => _3()]);
|
|
349
261
|
}
|
|
350
262
|
},
|
|
351
263
|
[isDisabled, isOpened, onOpenChange, onClose]
|
|
@@ -358,20 +270,20 @@ var useAutocompleteInputState = ({
|
|
|
358
270
|
selectedKey,
|
|
359
271
|
onInputChange
|
|
360
272
|
}) => {
|
|
361
|
-
const [internalInputValue, setInternalInputValue] = (0,
|
|
362
|
-
defaultInputValue
|
|
273
|
+
const [internalInputValue, setInternalInputValue] = _react.useState.call(void 0,
|
|
274
|
+
_nullishCoalesce(defaultInputValue, () => ( ""))
|
|
363
275
|
);
|
|
364
276
|
const currentInputValue = inputValue !== void 0 ? inputValue : internalInputValue;
|
|
365
|
-
const updateInputValue = (0,
|
|
277
|
+
const updateInputValue = _react.useCallback.call(void 0,
|
|
366
278
|
(value) => {
|
|
367
279
|
if (inputValue === void 0) {
|
|
368
280
|
setInternalInputValue(value);
|
|
369
281
|
}
|
|
370
|
-
onInputChange
|
|
282
|
+
_optionalChain([onInputChange, 'optionalCall', _4 => _4(value)]);
|
|
371
283
|
},
|
|
372
284
|
[inputValue, onInputChange]
|
|
373
285
|
);
|
|
374
|
-
(0,
|
|
286
|
+
_react.useEffect.call(void 0, () => {
|
|
375
287
|
if (selectedKey === null && inputValue === void 0) {
|
|
376
288
|
setInternalInputValue("");
|
|
377
289
|
}
|
|
@@ -381,11 +293,11 @@ var useAutocompleteInputState = ({
|
|
|
381
293
|
var useAutocompleteSelection = ({
|
|
382
294
|
onSelectionChange
|
|
383
295
|
}) => {
|
|
384
|
-
const [currentSelectedKey, setCurrentSelectedKey] = (0,
|
|
385
|
-
const updateSelection = (0,
|
|
296
|
+
const [currentSelectedKey, setCurrentSelectedKey] = _react.useState.call(void 0, null);
|
|
297
|
+
const updateSelection = _react.useCallback.call(void 0,
|
|
386
298
|
(key) => {
|
|
387
299
|
setCurrentSelectedKey(key);
|
|
388
|
-
onSelectionChange
|
|
300
|
+
_optionalChain([onSelectionChange, 'optionalCall', _5 => _5(key)]);
|
|
389
301
|
},
|
|
390
302
|
[onSelectionChange]
|
|
391
303
|
);
|
|
@@ -406,35 +318,35 @@ var defaultFilterFunction = (textValue, inputValue) => {
|
|
|
406
318
|
};
|
|
407
319
|
|
|
408
320
|
// src/components/dialogs/autocomplete-dialog/autocomplete-dialog.tsx
|
|
409
|
-
var import_react12 = __toESM(require("react"), 1);
|
|
410
|
-
var import_react_native8 = require("react-native");
|
|
411
321
|
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
strokeLinejoin: "round"
|
|
424
|
-
}
|
|
425
|
-
));
|
|
426
|
-
}
|
|
322
|
+
|
|
323
|
+
|
|
324
|
+
|
|
325
|
+
|
|
326
|
+
|
|
327
|
+
|
|
328
|
+
|
|
329
|
+
|
|
330
|
+
|
|
331
|
+
|
|
332
|
+
|
|
427
333
|
|
|
428
334
|
// src/components/dialogs/autocomplete-dialog/autocomplete-dialog-header.tsx
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
335
|
+
|
|
336
|
+
|
|
337
|
+
|
|
338
|
+
|
|
339
|
+
|
|
340
|
+
|
|
341
|
+
|
|
342
|
+
|
|
343
|
+
var _icons = require('@xaui/icons');
|
|
432
344
|
|
|
433
345
|
// src/components/dialogs/autocomplete-dialog/autocomplete-dialog.style.ts
|
|
434
|
-
|
|
435
|
-
var styles2 =
|
|
346
|
+
|
|
347
|
+
var styles2 = _reactnative.StyleSheet.create({
|
|
436
348
|
backdrop: {
|
|
437
|
-
...
|
|
349
|
+
..._reactnative.StyleSheet.absoluteFillObject,
|
|
438
350
|
backgroundColor: "rgba(0, 0, 0, 0.5)"
|
|
439
351
|
},
|
|
440
352
|
dialogContainer: {
|
|
@@ -508,7 +420,7 @@ var styles2 = import_react_native5.StyleSheet.create({
|
|
|
508
420
|
});
|
|
509
421
|
|
|
510
422
|
// src/components/dialogs/autocomplete-dialog/autocomplete-dialog-header.tsx
|
|
511
|
-
|
|
423
|
+
|
|
512
424
|
var AutocompleteDialogHeader = ({
|
|
513
425
|
title,
|
|
514
426
|
inputValue,
|
|
@@ -522,24 +434,24 @@ var AutocompleteDialogHeader = ({
|
|
|
522
434
|
onFocus,
|
|
523
435
|
onBlur
|
|
524
436
|
}) => {
|
|
525
|
-
const theme = useXUITheme();
|
|
526
|
-
return /* @__PURE__ */
|
|
527
|
-
|
|
437
|
+
const theme = _chunkOQ2BLOOGcjs.useXUITheme.call(void 0, );
|
|
438
|
+
return /* @__PURE__ */ _react2.default.createElement(_reactnative.View, { style: styles2.header }, title ? /* @__PURE__ */ _react2.default.createElement(_reactnative.View, { style: styles2.titleRow }, /* @__PURE__ */ _react2.default.createElement(
|
|
439
|
+
_reactnative.Pressable,
|
|
528
440
|
{
|
|
529
441
|
style: styles2.backButton,
|
|
530
442
|
onPress: onClose,
|
|
531
443
|
accessibilityLabel: "Back",
|
|
532
444
|
accessibilityRole: "button"
|
|
533
445
|
},
|
|
534
|
-
/* @__PURE__ */
|
|
535
|
-
), /* @__PURE__ */
|
|
536
|
-
|
|
446
|
+
/* @__PURE__ */ _react2.default.createElement(_icons.ArrowBackIcon, { size: 20, color: theme.colors.foreground })
|
|
447
|
+
), /* @__PURE__ */ _react2.default.createElement(_reactnative.Text, { style: [styles2.title, { color: theme.colors.foreground }] }, title)) : null, /* @__PURE__ */ _react2.default.createElement(_reactnative.View, { style: styles2.inputContainer }, /* @__PURE__ */ _react2.default.createElement(_reactnative.Animated.View, { style: [styles2.inputWrapper, inputAnimatedStyle] }, /* @__PURE__ */ _react2.default.createElement(
|
|
448
|
+
_reactnative.TextInput,
|
|
537
449
|
{
|
|
538
450
|
ref: inputRef,
|
|
539
451
|
value: inputValue,
|
|
540
452
|
onChangeText: onInputChange,
|
|
541
453
|
placeholder,
|
|
542
|
-
placeholderTextColor: (0,
|
|
454
|
+
placeholderTextColor: _core.withOpacity.call(void 0, theme.colors.foreground, 0.5),
|
|
543
455
|
style: [
|
|
544
456
|
styles2.input,
|
|
545
457
|
{
|
|
@@ -554,42 +466,42 @@ var AutocompleteDialogHeader = ({
|
|
|
554
466
|
onFocus,
|
|
555
467
|
onBlur
|
|
556
468
|
}
|
|
557
|
-
), inputValue ? /* @__PURE__ */
|
|
558
|
-
|
|
469
|
+
), inputValue ? /* @__PURE__ */ _react2.default.createElement(
|
|
470
|
+
_reactnative.Pressable,
|
|
559
471
|
{
|
|
560
472
|
style: styles2.clearInputButton,
|
|
561
|
-
onPress: () => onInputChange
|
|
473
|
+
onPress: () => _optionalChain([onInputChange, 'optionalCall', _6 => _6("")]),
|
|
562
474
|
accessibilityLabel: "Clear input",
|
|
563
475
|
accessibilityRole: "button"
|
|
564
476
|
},
|
|
565
|
-
/* @__PURE__ */
|
|
477
|
+
/* @__PURE__ */ _react2.default.createElement(_icons.CloseIcon, { color: theme.colors.foreground })
|
|
566
478
|
) : null)));
|
|
567
479
|
};
|
|
568
480
|
|
|
569
481
|
// src/components/dialogs/autocomplete-dialog/autocomplete-dialog.animation.ts
|
|
570
|
-
|
|
571
|
-
|
|
482
|
+
|
|
483
|
+
|
|
572
484
|
var useAutocompleteDialogAnimation = ({
|
|
573
485
|
visible,
|
|
574
486
|
fadeAnim,
|
|
575
487
|
slideAnim,
|
|
576
488
|
scaleAnim
|
|
577
489
|
}) => {
|
|
578
|
-
(0,
|
|
490
|
+
_react.useEffect.call(void 0, () => {
|
|
579
491
|
if (visible) {
|
|
580
|
-
|
|
581
|
-
|
|
492
|
+
_reactnative.Animated.parallel([
|
|
493
|
+
_reactnative.Animated.timing(fadeAnim, {
|
|
582
494
|
toValue: 1,
|
|
583
495
|
duration: 250,
|
|
584
496
|
useNativeDriver: true
|
|
585
497
|
}),
|
|
586
|
-
|
|
498
|
+
_reactnative.Animated.spring(slideAnim, {
|
|
587
499
|
toValue: 1,
|
|
588
500
|
useNativeDriver: true,
|
|
589
501
|
tension: 65,
|
|
590
502
|
friction: 10
|
|
591
503
|
}),
|
|
592
|
-
|
|
504
|
+
_reactnative.Animated.spring(scaleAnim, {
|
|
593
505
|
toValue: 1,
|
|
594
506
|
useNativeDriver: true,
|
|
595
507
|
tension: 50,
|
|
@@ -622,20 +534,20 @@ var AutocompleteDialog = ({
|
|
|
622
534
|
onFocus,
|
|
623
535
|
onBlur
|
|
624
536
|
}) => {
|
|
625
|
-
const theme = useXUITheme();
|
|
626
|
-
const { width: screenWidth, height: screenHeight } = (0,
|
|
627
|
-
const fadeAnim = (0,
|
|
628
|
-
const slideAnim = (0,
|
|
629
|
-
const scaleAnim = (0,
|
|
630
|
-
const inputRef = (0,
|
|
631
|
-
const [keyboardHeight, setKeyboardHeight] = (0,
|
|
632
|
-
(0,
|
|
633
|
-
const showEvent =
|
|
634
|
-
const hideEvent =
|
|
635
|
-
const showSub =
|
|
537
|
+
const theme = _chunkOQ2BLOOGcjs.useXUITheme.call(void 0, );
|
|
538
|
+
const { width: screenWidth, height: screenHeight } = _reactnative.useWindowDimensions.call(void 0, );
|
|
539
|
+
const fadeAnim = _react.useRef.call(void 0, new _reactnative.Animated.Value(0)).current;
|
|
540
|
+
const slideAnim = _react.useRef.call(void 0, new _reactnative.Animated.Value(0)).current;
|
|
541
|
+
const scaleAnim = _react.useRef.call(void 0, new _reactnative.Animated.Value(0)).current;
|
|
542
|
+
const inputRef = _react.useRef.call(void 0, null);
|
|
543
|
+
const [keyboardHeight, setKeyboardHeight] = _react.useState.call(void 0, 0);
|
|
544
|
+
_react.useEffect.call(void 0, () => {
|
|
545
|
+
const showEvent = _reactnative.Platform.OS === "ios" ? "keyboardWillShow" : "keyboardDidShow";
|
|
546
|
+
const hideEvent = _reactnative.Platform.OS === "ios" ? "keyboardWillHide" : "keyboardDidHide";
|
|
547
|
+
const showSub = _reactnative.Keyboard.addListener(showEvent, (e) => {
|
|
636
548
|
setKeyboardHeight(e.endCoordinates.height);
|
|
637
549
|
});
|
|
638
|
-
const hideSub =
|
|
550
|
+
const hideSub = _reactnative.Keyboard.addListener(hideEvent, () => {
|
|
639
551
|
setKeyboardHeight(0);
|
|
640
552
|
});
|
|
641
553
|
return () => {
|
|
@@ -643,43 +555,43 @@ var AutocompleteDialog = ({
|
|
|
643
555
|
hideSub.remove();
|
|
644
556
|
};
|
|
645
557
|
}, []);
|
|
646
|
-
const items = (0,
|
|
647
|
-
() =>
|
|
648
|
-
|
|
558
|
+
const items = _react.useMemo.call(void 0,
|
|
559
|
+
() => _react2.default.Children.toArray(children).filter(
|
|
560
|
+
_react2.default.isValidElement
|
|
649
561
|
),
|
|
650
562
|
[children]
|
|
651
563
|
);
|
|
652
564
|
const checkmarkColor = theme.colors[themeColor].main;
|
|
653
565
|
const checkmarkBackgroundColor = theme.colors[themeColor].background;
|
|
654
566
|
useAutocompleteDialogAnimation({ visible, fadeAnim, slideAnim, scaleAnim });
|
|
655
|
-
(0,
|
|
567
|
+
_react.useEffect.call(void 0, () => {
|
|
656
568
|
if (!visible) return;
|
|
657
|
-
const sub =
|
|
658
|
-
onClose
|
|
569
|
+
const sub = _reactnative.BackHandler.addEventListener("hardwareBackPress", () => {
|
|
570
|
+
_optionalChain([onClose, 'optionalCall', _7 => _7()]);
|
|
659
571
|
return true;
|
|
660
572
|
});
|
|
661
573
|
return () => sub.remove();
|
|
662
574
|
}, [visible, onClose]);
|
|
663
|
-
const focusInput = (0,
|
|
664
|
-
const delay =
|
|
665
|
-
|
|
575
|
+
const focusInput = _react.useCallback.call(void 0, () => {
|
|
576
|
+
const delay = _reactnative.Platform.OS === "android" ? 300 : 100;
|
|
577
|
+
_reactnative.InteractionManager.runAfterInteractions(() => {
|
|
666
578
|
setTimeout(() => {
|
|
667
|
-
inputRef.current
|
|
579
|
+
_optionalChain([inputRef, 'access', _8 => _8.current, 'optionalAccess', _9 => _9.focus, 'call', _10 => _10()]);
|
|
668
580
|
}, delay);
|
|
669
581
|
});
|
|
670
582
|
}, []);
|
|
671
583
|
const handleCheckmarkPress = () => {
|
|
672
|
-
onCheckmark
|
|
673
|
-
|
|
584
|
+
_optionalChain([onCheckmark, 'optionalCall', _11 => _11()]);
|
|
585
|
+
_reactnative.Keyboard.dismiss();
|
|
674
586
|
};
|
|
675
|
-
(0,
|
|
587
|
+
_react.useEffect.call(void 0, () => {
|
|
676
588
|
if (!visible) {
|
|
677
|
-
|
|
589
|
+
_reactnative.Keyboard.dismiss();
|
|
678
590
|
return;
|
|
679
591
|
}
|
|
680
592
|
focusInput();
|
|
681
593
|
}, [focusInput, visible]);
|
|
682
|
-
const listBottomPadding = (0,
|
|
594
|
+
const listBottomPadding = _react.useMemo.call(void 0, () => {
|
|
683
595
|
const basePadding = showCheckmark ? 96 : 64;
|
|
684
596
|
return (keyboardHeight > 0 ? keyboardHeight : 0) + basePadding;
|
|
685
597
|
}, [keyboardHeight, showCheckmark]);
|
|
@@ -704,7 +616,7 @@ var AutocompleteDialog = ({
|
|
|
704
616
|
const inputAnimatedStyle = {
|
|
705
617
|
transform: [{ scaleX: scaleAnim }]
|
|
706
618
|
};
|
|
707
|
-
const listHeader = /* @__PURE__ */
|
|
619
|
+
const listHeader = /* @__PURE__ */ _react2.default.createElement(
|
|
708
620
|
AutocompleteDialogHeader,
|
|
709
621
|
{
|
|
710
622
|
title,
|
|
@@ -720,14 +632,14 @@ var AutocompleteDialog = ({
|
|
|
720
632
|
onBlur
|
|
721
633
|
}
|
|
722
634
|
);
|
|
723
|
-
return /* @__PURE__ */
|
|
724
|
-
|
|
635
|
+
return /* @__PURE__ */ _react2.default.createElement(_chunkOQ2BLOOGcjs.Portal, null, /* @__PURE__ */ _react2.default.createElement(_reactnative.View, { style: [overlayStyle, style] }, /* @__PURE__ */ _react2.default.createElement(_reactnative.Animated.View, { style: [styles2.backdrop, { opacity: fadeAnim }] }), /* @__PURE__ */ _react2.default.createElement(_reactnative.Animated.View, { style: [styles2.dialogContainer, containerAnimatedStyle] }, /* @__PURE__ */ _react2.default.createElement(
|
|
636
|
+
_reactnative.View,
|
|
725
637
|
{
|
|
726
638
|
style: [styles2.container, { backgroundColor: theme.colors.background }]
|
|
727
639
|
},
|
|
728
640
|
listHeader,
|
|
729
|
-
/* @__PURE__ */
|
|
730
|
-
|
|
641
|
+
/* @__PURE__ */ _react2.default.createElement(
|
|
642
|
+
_reactnative.FlatList,
|
|
731
643
|
{
|
|
732
644
|
data: items,
|
|
733
645
|
renderItem: ({ item }) => item,
|
|
@@ -741,8 +653,8 @@ var AutocompleteDialog = ({
|
|
|
741
653
|
showsVerticalScrollIndicator: false
|
|
742
654
|
}
|
|
743
655
|
),
|
|
744
|
-
showCheckmark ? /* @__PURE__ */
|
|
745
|
-
|
|
656
|
+
showCheckmark ? /* @__PURE__ */ _react2.default.createElement(_reactnative.View, { style: styles2.checkmarkButtonContainer }, /* @__PURE__ */ _react2.default.createElement(
|
|
657
|
+
_reactnative.Pressable,
|
|
746
658
|
{
|
|
747
659
|
style: [
|
|
748
660
|
styles2.checkmarkButton,
|
|
@@ -752,15 +664,15 @@ var AutocompleteDialog = ({
|
|
|
752
664
|
accessibilityLabel: "Confirm",
|
|
753
665
|
accessibilityRole: "button"
|
|
754
666
|
},
|
|
755
|
-
checkmarkIcon
|
|
667
|
+
_nullishCoalesce(checkmarkIcon, () => ( /* @__PURE__ */ _react2.default.createElement(_chunkDHSTKO3Kcjs.CheckmarkIcon, { color: checkmarkColor, size: 20 })))
|
|
756
668
|
)) : null
|
|
757
669
|
))));
|
|
758
670
|
};
|
|
759
671
|
|
|
760
672
|
// src/components/autocomplete/autocomplete-trigger.tsx
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
673
|
+
|
|
674
|
+
|
|
675
|
+
|
|
764
676
|
var AutocompleteTrigger = ({
|
|
765
677
|
triggerRef,
|
|
766
678
|
isDisabled,
|
|
@@ -783,8 +695,8 @@ var AutocompleteTrigger = ({
|
|
|
783
695
|
onLayout: handleTriggerLayout
|
|
784
696
|
}) => {
|
|
785
697
|
const renderLabel = isLabelInside && label;
|
|
786
|
-
return /* @__PURE__ */
|
|
787
|
-
|
|
698
|
+
return /* @__PURE__ */ _react2.default.createElement(
|
|
699
|
+
_reactnative.Pressable,
|
|
788
700
|
{
|
|
789
701
|
ref: triggerRef,
|
|
790
702
|
onPress: handleTriggerPress,
|
|
@@ -802,12 +714,12 @@ var AutocompleteTrigger = ({
|
|
|
802
714
|
isDisabled && styles.disabled,
|
|
803
715
|
style
|
|
804
716
|
],
|
|
805
|
-
accessibilityLabel: labelText
|
|
717
|
+
accessibilityLabel: _nullishCoalesce(labelText, () => ( (typeof label === "string" ? label : void 0))),
|
|
806
718
|
accessibilityRole: "button",
|
|
807
719
|
accessibilityState: { disabled: isDisabled }
|
|
808
720
|
},
|
|
809
|
-
/* @__PURE__ */
|
|
810
|
-
|
|
721
|
+
/* @__PURE__ */ _react2.default.createElement(_reactnative.View, { style: styles.triggerContent }, isLabelInside && renderLabel, /* @__PURE__ */ _react2.default.createElement(
|
|
722
|
+
_reactnative.Text,
|
|
811
723
|
{
|
|
812
724
|
style: [
|
|
813
725
|
styles.triggerText,
|
|
@@ -820,14 +732,14 @@ var AutocompleteTrigger = ({
|
|
|
820
732
|
},
|
|
821
733
|
displayValue
|
|
822
734
|
)),
|
|
823
|
-
isClearable && (currentSelectedKey || currentInputValue) ? /* @__PURE__ */
|
|
824
|
-
|
|
735
|
+
isClearable && (currentSelectedKey || currentInputValue) ? /* @__PURE__ */ _react2.default.createElement(
|
|
736
|
+
_reactnative.TouchableOpacity,
|
|
825
737
|
{
|
|
826
738
|
onPress: handleClear,
|
|
827
739
|
style: styles.clearButton,
|
|
828
740
|
hitSlop: { top: 8, right: 8, bottom: 8, left: 8 }
|
|
829
741
|
},
|
|
830
|
-
clearIcon
|
|
742
|
+
_nullishCoalesce(clearIcon, () => ( /* @__PURE__ */ _react2.default.createElement(_icons.CloseIcon, { color: theme.colors.foreground, size: 20 })))
|
|
831
743
|
) : null
|
|
832
744
|
);
|
|
833
745
|
};
|
|
@@ -878,21 +790,21 @@ var Autocomplete = ({
|
|
|
878
790
|
onOpenChange,
|
|
879
791
|
onClose
|
|
880
792
|
});
|
|
881
|
-
const triggerRef = (0,
|
|
882
|
-
const [triggerLayout, setTriggerLayout] = (0,
|
|
883
|
-
const handleTriggerLayout = (0,
|
|
884
|
-
triggerRef.current
|
|
793
|
+
const triggerRef = _react.useRef.call(void 0, null);
|
|
794
|
+
const [triggerLayout, setTriggerLayout] = _react.useState.call(void 0, );
|
|
795
|
+
const handleTriggerLayout = _react.useCallback.call(void 0, () => {
|
|
796
|
+
_optionalChain([triggerRef, 'access', _12 => _12.current, 'optionalAccess', _13 => _13.measureInWindow, 'call', _14 => _14((x, y, width, height) => {
|
|
885
797
|
setTriggerLayout({ x, y, width, height });
|
|
886
|
-
});
|
|
798
|
+
})]);
|
|
887
799
|
}, []);
|
|
888
|
-
const items = (0,
|
|
889
|
-
const elements =
|
|
800
|
+
const items = _react.useMemo.call(void 0, () => {
|
|
801
|
+
const elements = _react2.default.Children.toArray(children).filter(Boolean);
|
|
890
802
|
return elements.map((child, index) => {
|
|
891
|
-
if (!
|
|
803
|
+
if (!_react2.default.isValidElement(child)) {
|
|
892
804
|
return null;
|
|
893
805
|
}
|
|
894
|
-
const key = child.props.value
|
|
895
|
-
const labelText = getTextValue(child.props.label)
|
|
806
|
+
const key = _nullishCoalesce(child.props.value, () => ( String(index)));
|
|
807
|
+
const labelText = _nullishCoalesce(getTextValue(child.props.label), () => ( key));
|
|
896
808
|
return {
|
|
897
809
|
key,
|
|
898
810
|
element: child,
|
|
@@ -900,7 +812,7 @@ var Autocomplete = ({
|
|
|
900
812
|
};
|
|
901
813
|
}).filter((item) => item !== null);
|
|
902
814
|
}, [children]);
|
|
903
|
-
const filteredItems = (0,
|
|
815
|
+
const filteredItems = _react.useMemo.call(void 0, () => {
|
|
904
816
|
if (disableLocalFilter || !currentInputValue.trim()) {
|
|
905
817
|
return items;
|
|
906
818
|
}
|
|
@@ -908,7 +820,7 @@ var Autocomplete = ({
|
|
|
908
820
|
(item) => defaultFilterFunction(item.labelText, currentInputValue)
|
|
909
821
|
);
|
|
910
822
|
}, [disableLocalFilter, items, currentInputValue]);
|
|
911
|
-
const theme = useXUITheme();
|
|
823
|
+
const theme = _chunkOQ2BLOOGcjs.useXUITheme.call(void 0, );
|
|
912
824
|
const sizeStyles = useAutocompleteSizeStyles(size);
|
|
913
825
|
const { radiusStyles } = useAutocompleteRadiusStyles(radius);
|
|
914
826
|
const variantStyles = useAutocompleteVariantStyles(themeColor, variant, isInvalid);
|
|
@@ -919,11 +831,11 @@ var Autocomplete = ({
|
|
|
919
831
|
);
|
|
920
832
|
const helperColor = useAutocompleteHelperColor(isInvalid);
|
|
921
833
|
const selectedItem = items.find((item) => item.key === currentSelectedKey);
|
|
922
|
-
const displayValue = forceSelection ? selectedItem
|
|
923
|
-
const handleInputChange = (0,
|
|
834
|
+
const displayValue = forceSelection ? _optionalChain([selectedItem, 'optionalAccess', _15 => _15.labelText]) || placeholder : currentInputValue || placeholder;
|
|
835
|
+
const handleInputChange = _react.useCallback.call(void 0,
|
|
924
836
|
(text) => {
|
|
925
837
|
updateInputValue(text);
|
|
926
|
-
const selectedLabel = selectedItem
|
|
838
|
+
const selectedLabel = _nullishCoalesce(_optionalChain([selectedItem, 'optionalAccess', _16 => _16.labelText]), () => ( ""));
|
|
927
839
|
const shouldClearSelection = !text.trim() && !allowsCustomValue || currentSelectedKey !== null && text !== selectedLabel;
|
|
928
840
|
if (shouldClearSelection) {
|
|
929
841
|
updateSelection(null);
|
|
@@ -937,7 +849,7 @@ var Autocomplete = ({
|
|
|
937
849
|
currentSelectedKey
|
|
938
850
|
]
|
|
939
851
|
);
|
|
940
|
-
const handleItemSelection = (0,
|
|
852
|
+
const handleItemSelection = _react.useCallback.call(void 0,
|
|
941
853
|
(key, itemLabel) => {
|
|
942
854
|
if (isDisabled) {
|
|
943
855
|
return;
|
|
@@ -945,24 +857,24 @@ var Autocomplete = ({
|
|
|
945
857
|
updateSelection(key);
|
|
946
858
|
updateInputValue(itemLabel);
|
|
947
859
|
setTimeout(() => {
|
|
948
|
-
|
|
860
|
+
_reactnative.Keyboard.dismiss();
|
|
949
861
|
setOpen(false);
|
|
950
862
|
}, 50);
|
|
951
863
|
},
|
|
952
864
|
[isDisabled, updateSelection, updateInputValue, setOpen]
|
|
953
865
|
);
|
|
954
|
-
const handleCheckmark = (0,
|
|
866
|
+
const handleCheckmark = _react.useCallback.call(void 0, () => {
|
|
955
867
|
setOpen(false);
|
|
956
868
|
}, [setOpen]);
|
|
957
|
-
const handleClear = (0,
|
|
869
|
+
const handleClear = _react.useCallback.call(void 0, () => {
|
|
958
870
|
if (isDisabled) {
|
|
959
871
|
return;
|
|
960
872
|
}
|
|
961
873
|
updateSelection(null);
|
|
962
874
|
updateInputValue("");
|
|
963
|
-
onClear
|
|
875
|
+
_optionalChain([onClear, 'optionalCall', _17 => _17()]);
|
|
964
876
|
}, [isDisabled, updateSelection, updateInputValue, onClear]);
|
|
965
|
-
const handleTriggerPress = (0,
|
|
877
|
+
const handleTriggerPress = _react.useCallback.call(void 0, () => {
|
|
966
878
|
if (!isDisabled) {
|
|
967
879
|
if (selectedItem && !currentInputValue) {
|
|
968
880
|
updateInputValue(selectedItem.labelText);
|
|
@@ -973,15 +885,15 @@ var Autocomplete = ({
|
|
|
973
885
|
const listItems = filteredItems.map((item) => {
|
|
974
886
|
const itemProps = item.element.props;
|
|
975
887
|
const itemDisabled = isDisabled || itemProps.isDisabled;
|
|
976
|
-
const itemSelected = itemProps.isSelected
|
|
888
|
+
const itemSelected = _nullishCoalesce(itemProps.isSelected, () => ( currentSelectedKey === item.key));
|
|
977
889
|
const handleItemSelected = () => {
|
|
978
890
|
if (itemDisabled || itemProps.isReadOnly) {
|
|
979
891
|
return;
|
|
980
892
|
}
|
|
981
893
|
handleItemSelection(item.key, item.labelText);
|
|
982
|
-
itemProps.onSelected
|
|
894
|
+
_optionalChain([itemProps, 'access', _18 => _18.onSelected, 'optionalCall', _19 => _19()]);
|
|
983
895
|
};
|
|
984
|
-
return
|
|
896
|
+
return _react2.default.cloneElement(item.element, {
|
|
985
897
|
key: item.key,
|
|
986
898
|
isDisabled: itemDisabled,
|
|
987
899
|
isSelected: itemSelected,
|
|
@@ -992,10 +904,10 @@ var Autocomplete = ({
|
|
|
992
904
|
const isLabelInside = labelPlacement === "inside";
|
|
993
905
|
const isLabelOutsideLeft = labelPlacement === "outside-left";
|
|
994
906
|
const isLabelOutside = labelPlacement === "outside" || labelPlacement === "outside-top";
|
|
995
|
-
const renderLabel = label ? typeof label === "string" || typeof label === "number" ? /* @__PURE__ */
|
|
907
|
+
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;
|
|
996
908
|
const shouldShowHelper = Boolean(description || errorMessage);
|
|
997
909
|
const helperContent = isInvalid && errorMessage ? errorMessage : description;
|
|
998
|
-
const triggerContent = /* @__PURE__ */
|
|
910
|
+
const triggerContent = /* @__PURE__ */ _react2.default.createElement(
|
|
999
911
|
AutocompleteTrigger,
|
|
1000
912
|
{
|
|
1001
913
|
triggerRef,
|
|
@@ -1012,15 +924,15 @@ var Autocomplete = ({
|
|
|
1012
924
|
labelText: typeof label === "string" ? label : void 0,
|
|
1013
925
|
isLabelInside,
|
|
1014
926
|
clearIcon,
|
|
1015
|
-
style: customAppearance
|
|
1016
|
-
textStyle: customAppearance
|
|
927
|
+
style: _optionalChain([customAppearance, 'optionalAccess', _20 => _20.container]),
|
|
928
|
+
textStyle: _optionalChain([customAppearance, 'optionalAccess', _21 => _21.text]),
|
|
1017
929
|
onPress: handleTriggerPress,
|
|
1018
930
|
onClear: handleClear,
|
|
1019
931
|
onLayout: handleTriggerLayout
|
|
1020
932
|
}
|
|
1021
933
|
);
|
|
1022
934
|
const labelBlock = isLabelOutside || isLabelInside ? renderLabel : null;
|
|
1023
|
-
return /* @__PURE__ */
|
|
935
|
+
return /* @__PURE__ */ _react2.default.createElement(_reactnative.View, { style: [styles.container, fullWidth ? styles.fullWidth : styles.minWidth] }, isLabelOutside && labelBlock, isLabelOutsideLeft ? /* @__PURE__ */ _react2.default.createElement(_reactnative.View, { style: styles.outsideLeftRow }, renderLabel, triggerContent) : triggerContent, 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, /* @__PURE__ */ _react2.default.createElement(
|
|
1024
936
|
AutocompleteDialog,
|
|
1025
937
|
{
|
|
1026
938
|
visible: isOpen,
|
|
@@ -1034,17 +946,17 @@ var Autocomplete = ({
|
|
|
1034
946
|
onClose: () => setOpen(false),
|
|
1035
947
|
onCheckmark: handleCheckmark
|
|
1036
948
|
},
|
|
1037
|
-
/* @__PURE__ */
|
|
949
|
+
/* @__PURE__ */ _react2.default.createElement(AutocompleteContext.Provider, { value: { size, themeColor, isDisabled } }, showEmptyMessage ? /* @__PURE__ */ _react2.default.createElement(_reactnative.Text, { style: [styles.emptyMessage, { color: theme.colors.foreground }] }, "No results found") : listItems)
|
|
1038
950
|
));
|
|
1039
951
|
};
|
|
1040
952
|
|
|
1041
953
|
// src/components/autocomplete/autocomplete-item.tsx
|
|
1042
|
-
|
|
1043
|
-
|
|
954
|
+
|
|
955
|
+
|
|
1044
956
|
|
|
1045
957
|
// src/components/autocomplete/autocomplete-item.style.ts
|
|
1046
|
-
|
|
1047
|
-
var styles3 =
|
|
958
|
+
|
|
959
|
+
var styles3 = _reactnative.StyleSheet.create({
|
|
1048
960
|
item: {
|
|
1049
961
|
flexDirection: "row",
|
|
1050
962
|
alignItems: "center",
|
|
@@ -1066,11 +978,11 @@ var styles3 = import_react_native11.StyleSheet.create({
|
|
|
1066
978
|
});
|
|
1067
979
|
|
|
1068
980
|
// src/components/autocomplete/autocomplete-item.hook.ts
|
|
1069
|
-
|
|
1070
|
-
|
|
981
|
+
|
|
982
|
+
|
|
1071
983
|
var useAutocompleteItemSizeStyles = (size) => {
|
|
1072
|
-
const theme = useXUITheme();
|
|
1073
|
-
return (0,
|
|
984
|
+
const theme = _chunkOQ2BLOOGcjs.useXUITheme.call(void 0, );
|
|
985
|
+
return _react.useMemo.call(void 0, () => {
|
|
1074
986
|
const sizes = {
|
|
1075
987
|
xs: {
|
|
1076
988
|
paddingVertical: theme.spacing.sm,
|
|
@@ -1101,16 +1013,16 @@ var useAutocompleteItemSizeStyles = (size) => {
|
|
|
1101
1013
|
}, [size, theme]);
|
|
1102
1014
|
};
|
|
1103
1015
|
var useAutocompleteItemBackgroundColor = (themeColor, isSelected) => {
|
|
1104
|
-
const theme = useXUITheme();
|
|
1105
|
-
const safeThemeColor = (0,
|
|
1016
|
+
const theme = _chunkOQ2BLOOGcjs.useXUITheme.call(void 0, );
|
|
1017
|
+
const safeThemeColor = _core.getSafeThemeColor.call(void 0, themeColor);
|
|
1106
1018
|
const colorScheme = theme.colors[safeThemeColor];
|
|
1107
|
-
return (0,
|
|
1019
|
+
return _react.useMemo.call(void 0, () => {
|
|
1108
1020
|
return "transparent";
|
|
1109
1021
|
}, [isSelected, colorScheme]);
|
|
1110
1022
|
};
|
|
1111
1023
|
var useAutocompleteItemTextColors = () => {
|
|
1112
|
-
const theme = useXUITheme();
|
|
1113
|
-
return (0,
|
|
1024
|
+
const theme = _chunkOQ2BLOOGcjs.useXUITheme.call(void 0, );
|
|
1025
|
+
return _react.useMemo.call(void 0, () => {
|
|
1114
1026
|
return {
|
|
1115
1027
|
textColor: theme.colors.foreground,
|
|
1116
1028
|
descriptionColor: theme.colors.foreground
|
|
@@ -1118,10 +1030,10 @@ var useAutocompleteItemTextColors = () => {
|
|
|
1118
1030
|
}, [theme]);
|
|
1119
1031
|
};
|
|
1120
1032
|
var useAutocompleteItemCheckmarkColor = (themeColor) => {
|
|
1121
|
-
const theme = useXUITheme();
|
|
1122
|
-
const safeThemeColor = (0,
|
|
1033
|
+
const theme = _chunkOQ2BLOOGcjs.useXUITheme.call(void 0, );
|
|
1034
|
+
const safeThemeColor = _core.getSafeThemeColor.call(void 0, themeColor);
|
|
1123
1035
|
const colorScheme = theme.colors[safeThemeColor];
|
|
1124
|
-
return (0,
|
|
1036
|
+
return _react.useMemo.call(void 0, () => {
|
|
1125
1037
|
if (themeColor === "default") {
|
|
1126
1038
|
return theme.colors.primary.main;
|
|
1127
1039
|
}
|
|
@@ -1129,7 +1041,7 @@ var useAutocompleteItemCheckmarkColor = (themeColor) => {
|
|
|
1129
1041
|
}, [themeColor, colorScheme, theme]);
|
|
1130
1042
|
};
|
|
1131
1043
|
var useAutocompleteItemStyles = (isSelected, _isDisabled) => {
|
|
1132
|
-
const context = (0,
|
|
1044
|
+
const context = _react.useContext.call(void 0, AutocompleteContext);
|
|
1133
1045
|
const backgroundColor = useAutocompleteItemBackgroundColor(
|
|
1134
1046
|
context.themeColor,
|
|
1135
1047
|
isSelected
|
|
@@ -1158,19 +1070,19 @@ var AutocompleteItem = ({
|
|
|
1158
1070
|
customAppearance,
|
|
1159
1071
|
onSelected
|
|
1160
1072
|
}) => {
|
|
1161
|
-
const context = (0,
|
|
1162
|
-
const size = context
|
|
1163
|
-
const isItemDisabled = context
|
|
1073
|
+
const context = _react.useContext.call(void 0, AutocompleteContext);
|
|
1074
|
+
const size = _nullishCoalesce(_optionalChain([context, 'optionalAccess', _22 => _22.size]), () => ( defaultSize));
|
|
1075
|
+
const isItemDisabled = _optionalChain([context, 'optionalAccess', _23 => _23.isDisabled]) ? true : isDisabled;
|
|
1164
1076
|
const sizeStyles = useAutocompleteItemSizeStyles(size);
|
|
1165
1077
|
const { backgroundColor, labelColor, descriptionColor } = useAutocompleteItemStyles(isSelected, isItemDisabled);
|
|
1166
1078
|
const handlePress = () => {
|
|
1167
1079
|
if (isItemDisabled || isReadOnly) {
|
|
1168
1080
|
return;
|
|
1169
1081
|
}
|
|
1170
|
-
onSelected
|
|
1082
|
+
_optionalChain([onSelected, 'optionalCall', _24 => _24()]);
|
|
1171
1083
|
};
|
|
1172
|
-
return /* @__PURE__ */
|
|
1173
|
-
|
|
1084
|
+
return /* @__PURE__ */ _react2.default.createElement(
|
|
1085
|
+
_reactnative.Pressable,
|
|
1174
1086
|
{
|
|
1175
1087
|
onPress: handlePress,
|
|
1176
1088
|
disabled: isItemDisabled,
|
|
@@ -1182,22 +1094,22 @@ var AutocompleteItem = ({
|
|
|
1182
1094
|
backgroundColor
|
|
1183
1095
|
},
|
|
1184
1096
|
isItemDisabled && styles3.disabled,
|
|
1185
|
-
customAppearance
|
|
1097
|
+
_optionalChain([customAppearance, 'optionalAccess', _25 => _25.container])
|
|
1186
1098
|
]
|
|
1187
1099
|
},
|
|
1188
1100
|
startContent,
|
|
1189
|
-
/* @__PURE__ */
|
|
1190
|
-
|
|
1101
|
+
/* @__PURE__ */ _react2.default.createElement(_reactnative.View, { style: styles3.content }, /* @__PURE__ */ _react2.default.createElement(
|
|
1102
|
+
_reactnative.Text,
|
|
1191
1103
|
{
|
|
1192
1104
|
style: [
|
|
1193
1105
|
styles3.title,
|
|
1194
1106
|
{ fontSize: sizeStyles.titleSize, color: labelColor },
|
|
1195
|
-
customAppearance
|
|
1107
|
+
_optionalChain([customAppearance, 'optionalAccess', _26 => _26.text])
|
|
1196
1108
|
]
|
|
1197
1109
|
},
|
|
1198
1110
|
label
|
|
1199
|
-
), description && /* @__PURE__ */
|
|
1200
|
-
|
|
1111
|
+
), description && /* @__PURE__ */ _react2.default.createElement(
|
|
1112
|
+
_reactnative.Text,
|
|
1201
1113
|
{
|
|
1202
1114
|
style: [
|
|
1203
1115
|
styles3.description,
|
|
@@ -1209,8 +1121,7 @@ var AutocompleteItem = ({
|
|
|
1209
1121
|
endContent
|
|
1210
1122
|
);
|
|
1211
1123
|
};
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
});
|
|
1124
|
+
|
|
1125
|
+
|
|
1126
|
+
|
|
1127
|
+
exports.Autocomplete = Autocomplete; exports.AutocompleteItem = AutocompleteItem;
|