@xaui/native 0.0.8 → 0.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/accordion/index.cjs +108 -87
- package/dist/accordion/index.d.cts +48 -36
- package/dist/accordion/index.d.ts +48 -36
- package/dist/accordion/index.js +29 -26
- package/dist/alert/index.cjs +593 -0
- package/dist/alert/index.d.cts +90 -0
- package/dist/alert/index.d.ts +90 -0
- package/dist/alert/index.js +8 -0
- package/dist/autocomplete/index.cjs +1501 -0
- package/dist/autocomplete/index.d.cts +88 -0
- package/dist/autocomplete/index.d.ts +88 -0
- package/dist/autocomplete/index.js +12 -0
- package/dist/button/index.cjs +87 -69
- package/dist/button/index.js +2 -2
- package/dist/checkbox/index.cjs +48 -30
- package/dist/checkbox/index.js +1 -1
- package/dist/{chunk-B2VGVZ3J.js → chunk-63LRW4QD.js} +1 -1
- package/dist/chunk-GBHQCAKW.js +19 -0
- package/dist/{chunk-R34CVLCX.js → chunk-GNJIET26.js} +1 -1
- package/dist/chunk-NBRASCX4.js +145 -0
- package/dist/chunk-OFYJYQ2M.js +358 -0
- package/dist/chunk-RE3CO277.js +444 -0
- package/dist/chunk-SIXET7TJ.js +172 -0
- package/dist/chunk-SVYTCEGB.js +1138 -0
- package/dist/chunk-ZYTBRHLJ.js +150 -0
- package/dist/core/index.cjs +68 -10
- package/dist/core/index.d.cts +9 -1
- package/dist/core/index.d.ts +9 -1
- package/dist/core/index.js +5 -1
- package/dist/divider/index.cjs +31 -13
- package/dist/divider/index.js +2 -2
- package/dist/icon/index.cjs +680 -0
- package/dist/icon/index.d.cts +36 -0
- package/dist/icon/index.d.ts +36 -0
- package/dist/icon/index.js +15 -0
- package/dist/index.cjs +1990 -53
- package/dist/index.d.cts +4 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +21 -4
- package/dist/indicator/index.cjs +60 -42
- package/dist/indicator/index.js +2 -2
- package/dist/progress/index.cjs +45 -27
- package/dist/progress/index.js +1 -1
- package/dist/select/index.cjs +107 -89
- package/dist/select/index.js +10 -23
- package/dist/switch/index.cjs +58 -40
- package/dist/switch/index.js +1 -1
- package/dist/typography/index.cjs +223 -0
- package/dist/typography/index.d.cts +43 -0
- package/dist/typography/index.d.ts +43 -0
- package/dist/typography/index.js +7 -0
- package/dist/view/index.cjs +8 -2
- package/dist/view/index.d.cts +11 -1
- package/dist/view/index.d.ts +11 -1
- package/dist/view/index.js +8 -2
- package/package.json +21 -1
- package/dist/chunk-ORMNMNOK.js +0 -89
package/dist/accordion/index.cjs
CHANGED
|
@@ -36,8 +36,8 @@ __export(accordion_exports, {
|
|
|
36
36
|
module.exports = __toCommonJS(accordion_exports);
|
|
37
37
|
|
|
38
38
|
// src/components/accordion/accordion.tsx
|
|
39
|
-
var
|
|
40
|
-
var
|
|
39
|
+
var import_react14 = __toESM(require("react"), 1);
|
|
40
|
+
var import_react_native9 = require("react-native");
|
|
41
41
|
|
|
42
42
|
// src/components/accordion/accordion-context.ts
|
|
43
43
|
var import_react = require("react");
|
|
@@ -51,20 +51,38 @@ var useAccordionContext = () => {
|
|
|
51
51
|
};
|
|
52
52
|
|
|
53
53
|
// src/components/accordion/accordion.hook.ts
|
|
54
|
-
var
|
|
54
|
+
var import_react7 = require("react");
|
|
55
55
|
|
|
56
56
|
// src/core/theme-context.tsx
|
|
57
|
-
var
|
|
58
|
-
var
|
|
57
|
+
var import_react5 = __toESM(require("react"), 1);
|
|
58
|
+
var import_react_native2 = require("react-native");
|
|
59
59
|
var import_theme = require("@xaui/core/theme");
|
|
60
60
|
var import_palette = require("@xaui/core/palette");
|
|
61
|
-
var XUIThemeContext = (0, import_react2.createContext)(null);
|
|
62
61
|
|
|
63
|
-
// src/core/
|
|
62
|
+
// src/core/portal/portal.tsx
|
|
64
63
|
var import_react3 = require("react");
|
|
65
|
-
|
|
64
|
+
|
|
65
|
+
// src/core/portal/portal-context.ts
|
|
66
|
+
var import_react2 = require("react");
|
|
67
|
+
var PortalContext = (0, import_react2.createContext)(null);
|
|
68
|
+
|
|
69
|
+
// src/core/portal/portal-host.tsx
|
|
70
|
+
var import_react4 = __toESM(require("react"), 1);
|
|
71
|
+
var import_react_native = require("react-native");
|
|
72
|
+
var hostStyles = import_react_native.StyleSheet.create({
|
|
73
|
+
container: {
|
|
74
|
+
flex: 1
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
// src/core/theme-context.tsx
|
|
79
|
+
var XUIThemeContext = (0, import_react5.createContext)(null);
|
|
80
|
+
|
|
81
|
+
// src/core/theme-hooks.ts
|
|
82
|
+
var import_react6 = require("react");
|
|
83
|
+
var import_react_native3 = require("react-native");
|
|
66
84
|
function useXUITheme() {
|
|
67
|
-
const theme = (0,
|
|
85
|
+
const theme = (0, import_react6.useContext)(XUIThemeContext);
|
|
68
86
|
if (!theme) {
|
|
69
87
|
throw new Error("useXUITheme must be used within XUIProvider");
|
|
70
88
|
}
|
|
@@ -72,17 +90,20 @@ function useXUITheme() {
|
|
|
72
90
|
}
|
|
73
91
|
function useXUIPalette() {
|
|
74
92
|
const theme = useXUITheme();
|
|
75
|
-
return (0,
|
|
93
|
+
return (0, import_react6.useMemo)(() => theme.palette, [theme]);
|
|
76
94
|
}
|
|
77
95
|
|
|
78
96
|
// src/core/index.ts
|
|
79
97
|
var import_theme2 = require("@xaui/core/theme");
|
|
80
98
|
|
|
81
99
|
// src/components/accordion/accordion.hook.ts
|
|
82
|
-
var useAccordionStyles = ({
|
|
100
|
+
var useAccordionStyles = ({
|
|
101
|
+
variant,
|
|
102
|
+
fullWidth
|
|
103
|
+
}) => {
|
|
83
104
|
const theme = useXUITheme();
|
|
84
105
|
const palette2 = useXUIPalette();
|
|
85
|
-
const containerStyles = (0,
|
|
106
|
+
const containerStyles = (0, import_react7.useMemo)(() => {
|
|
86
107
|
const base = {};
|
|
87
108
|
if (fullWidth) {
|
|
88
109
|
base.width = "100%";
|
|
@@ -91,7 +112,7 @@ var useAccordionStyles = ({ variant, fullWidth }) => {
|
|
|
91
112
|
base.borderWidth = theme.borderWidth.md;
|
|
92
113
|
base.borderColor = theme.mode === "dark" ? palette2.gray[800] : theme.palette.gray[200];
|
|
93
114
|
base.borderRadius = theme.borderRadius.md;
|
|
94
|
-
base.
|
|
115
|
+
base.paddingHorizontal = theme.spacing.sm;
|
|
95
116
|
base.overflow = "hidden";
|
|
96
117
|
} else if (variant === "light") {
|
|
97
118
|
base.paddingHorizontal = theme.spacing.sm;
|
|
@@ -108,10 +129,10 @@ var useAccordionSelection = ({
|
|
|
108
129
|
defaultExpandedKeys,
|
|
109
130
|
onSelectionChange
|
|
110
131
|
}) => {
|
|
111
|
-
const [internalExpandedKeys, setInternalExpandedKeys] = (0,
|
|
132
|
+
const [internalExpandedKeys, setInternalExpandedKeys] = (0, import_react7.useState)(defaultExpandedKeys);
|
|
112
133
|
const isControlled = expandedKeys !== void 0;
|
|
113
134
|
const currentExpandedKeys = isControlled ? expandedKeys : internalExpandedKeys;
|
|
114
|
-
const toggleItem = (0,
|
|
135
|
+
const toggleItem = (0, import_react7.useCallback)(
|
|
115
136
|
(key) => {
|
|
116
137
|
const isExpanded = currentExpandedKeys.includes(key);
|
|
117
138
|
const newExpandedKeys = selectionMode === "toggle" ? isExpanded ? [] : [key] : isExpanded ? currentExpandedKeys.filter((k) => k !== key) : [...currentExpandedKeys, key];
|
|
@@ -131,7 +152,7 @@ var useAccordionContextValue = (config) => {
|
|
|
131
152
|
defaultExpandedKeys: config.defaultExpandedKeys,
|
|
132
153
|
onSelectionChange: config.onSelectionChange
|
|
133
154
|
});
|
|
134
|
-
return (0,
|
|
155
|
+
return (0, import_react7.useMemo)(
|
|
135
156
|
() => ({
|
|
136
157
|
variant: config.variant,
|
|
137
158
|
hideIndicator: config.hideIndicator,
|
|
@@ -156,12 +177,12 @@ var useAccordionContextValue = (config) => {
|
|
|
156
177
|
};
|
|
157
178
|
|
|
158
179
|
// src/components/accordion/accordion-item.tsx
|
|
159
|
-
var
|
|
160
|
-
var
|
|
180
|
+
var import_react10 = __toESM(require("react"), 1);
|
|
181
|
+
var import_react_native6 = require("react-native");
|
|
161
182
|
|
|
162
183
|
// src/components/accordion/accordion-item.style.ts
|
|
163
|
-
var
|
|
164
|
-
var styles =
|
|
184
|
+
var import_react_native4 = require("react-native");
|
|
185
|
+
var styles = import_react_native4.StyleSheet.create({
|
|
165
186
|
startContent: {
|
|
166
187
|
flexShrink: 0
|
|
167
188
|
},
|
|
@@ -184,61 +205,62 @@ var styles = import_react_native3.StyleSheet.create({
|
|
|
184
205
|
});
|
|
185
206
|
|
|
186
207
|
// src/components/accordion/accordion-item.hook.ts
|
|
187
|
-
var
|
|
188
|
-
var
|
|
208
|
+
var import_react8 = require("react");
|
|
209
|
+
var import_react_native5 = require("react-native");
|
|
189
210
|
var import_palette2 = require("@xaui/core/palette");
|
|
211
|
+
var import_core3 = require("@xaui/core");
|
|
190
212
|
var useAccordionItemState = (itemKey) => {
|
|
191
213
|
const context = useAccordionContext();
|
|
192
214
|
const resolvedItemKey = itemKey ?? "";
|
|
193
215
|
const isExpanded = resolvedItemKey ? context.expandedKeys.includes(resolvedItemKey) : false;
|
|
194
216
|
const isDisabled = resolvedItemKey ? context.disabledKeys.includes(resolvedItemKey) : false;
|
|
195
|
-
const handlePress = (0,
|
|
217
|
+
const handlePress = (0, import_react8.useCallback)(() => {
|
|
196
218
|
if (isDisabled || !resolvedItemKey) return;
|
|
197
219
|
context.toggleItem(resolvedItemKey);
|
|
198
220
|
}, [isDisabled, resolvedItemKey, context]);
|
|
199
221
|
return { ...context, resolvedItemKey, isExpanded, isDisabled, handlePress };
|
|
200
222
|
};
|
|
201
223
|
var useAccordionItemAnimation = (isExpanded, disableAnimation) => {
|
|
202
|
-
const [contentHeight, setContentHeight] = (0,
|
|
203
|
-
const [isMeasured, setIsMeasured] = (0,
|
|
204
|
-
const animatedHeight = (0,
|
|
205
|
-
const animatedRotation = (0,
|
|
206
|
-
const prevContentHeight = (0,
|
|
207
|
-
(0,
|
|
224
|
+
const [contentHeight, setContentHeight] = (0, import_react8.useState)(0);
|
|
225
|
+
const [isMeasured, setIsMeasured] = (0, import_react8.useState)(false);
|
|
226
|
+
const animatedHeight = (0, import_react8.useRef)(new import_react_native5.Animated.Value(isExpanded ? 1 : 0)).current;
|
|
227
|
+
const animatedRotation = (0, import_react8.useRef)(new import_react_native5.Animated.Value(isExpanded ? 1 : 0)).current;
|
|
228
|
+
const prevContentHeight = (0, import_react8.useRef)(contentHeight);
|
|
229
|
+
(0, import_react8.useEffect)(() => {
|
|
208
230
|
if (disableAnimation) {
|
|
209
231
|
animatedHeight.setValue(isExpanded ? 1 : 0);
|
|
210
232
|
animatedRotation.setValue(isExpanded ? 1 : 0);
|
|
211
233
|
return;
|
|
212
234
|
}
|
|
213
|
-
|
|
214
|
-
|
|
235
|
+
import_react_native5.Animated.parallel([
|
|
236
|
+
import_react_native5.Animated.timing(animatedHeight, {
|
|
215
237
|
toValue: isExpanded ? 1 : 0,
|
|
216
238
|
duration: 300,
|
|
217
|
-
easing:
|
|
239
|
+
easing: import_react_native5.Easing.bezier(0.4, 0, 0.2, 1),
|
|
218
240
|
useNativeDriver: false
|
|
219
241
|
}),
|
|
220
|
-
|
|
242
|
+
import_react_native5.Animated.timing(animatedRotation, {
|
|
221
243
|
toValue: isExpanded ? 1 : 0,
|
|
222
244
|
duration: 300,
|
|
223
|
-
easing:
|
|
245
|
+
easing: import_react_native5.Easing.bezier(0.4, 0, 0.2, 1),
|
|
224
246
|
useNativeDriver: true
|
|
225
247
|
})
|
|
226
248
|
]).start();
|
|
227
249
|
}, [isExpanded, disableAnimation, animatedHeight, animatedRotation]);
|
|
228
|
-
(0,
|
|
250
|
+
(0, import_react8.useEffect)(() => {
|
|
229
251
|
if (contentHeight <= 0 || contentHeight === prevContentHeight.current || !isExpanded)
|
|
230
252
|
return;
|
|
231
253
|
prevContentHeight.current = contentHeight;
|
|
232
254
|
if (!disableAnimation && isMeasured) {
|
|
233
|
-
|
|
255
|
+
import_react_native5.Animated.timing(animatedHeight, {
|
|
234
256
|
toValue: 1,
|
|
235
257
|
duration: 200,
|
|
236
|
-
easing:
|
|
258
|
+
easing: import_react_native5.Easing.out(import_react_native5.Easing.ease),
|
|
237
259
|
useNativeDriver: false
|
|
238
260
|
}).start();
|
|
239
261
|
}
|
|
240
262
|
}, [contentHeight, isExpanded, disableAnimation, isMeasured, animatedHeight]);
|
|
241
|
-
const onContentLayout = (0,
|
|
263
|
+
const onContentLayout = (0, import_react8.useCallback)((event) => {
|
|
242
264
|
const height = event.nativeEvent.layout.height;
|
|
243
265
|
if (height > 0) {
|
|
244
266
|
setContentHeight(height);
|
|
@@ -262,13 +284,13 @@ var useAccordionItemAnimation = (isExpanded, disableAnimation) => {
|
|
|
262
284
|
};
|
|
263
285
|
var useBaseStyles = (variant, isDisabled) => {
|
|
264
286
|
const theme = useXUITheme();
|
|
265
|
-
const baseStyles = (0,
|
|
287
|
+
const baseStyles = (0, import_react8.useMemo)(() => {
|
|
266
288
|
const base = { overflow: "hidden" };
|
|
267
289
|
if (variant === "splitted") {
|
|
268
290
|
base.paddingHorizontal = theme.spacing.md;
|
|
269
|
-
base.backgroundColor = theme.colors.default.background;
|
|
291
|
+
base.backgroundColor = (0, import_core3.addOpacityToColor)(theme.colors.default.background, 0.5);
|
|
270
292
|
base.borderRadius = theme.borderRadius.md;
|
|
271
|
-
base.marginBottom = theme.spacing.
|
|
293
|
+
base.marginBottom = theme.spacing.xs;
|
|
272
294
|
} else if (variant === "bordered") {
|
|
273
295
|
base.paddingHorizontal = theme.spacing.md;
|
|
274
296
|
}
|
|
@@ -281,7 +303,7 @@ var useBaseStyles = (variant, isDisabled) => {
|
|
|
281
303
|
};
|
|
282
304
|
var useTriggerStyles = (variant, isCompact) => {
|
|
283
305
|
const theme = useXUITheme();
|
|
284
|
-
const triggerStyles = (0,
|
|
306
|
+
const triggerStyles = (0, import_react8.useMemo)(() => {
|
|
285
307
|
const trigger = {
|
|
286
308
|
flexDirection: "row",
|
|
287
309
|
alignItems: "center",
|
|
@@ -297,7 +319,7 @@ var useTriggerStyles = (variant, isCompact) => {
|
|
|
297
319
|
};
|
|
298
320
|
var useTitleTextStyle = (isCompact) => {
|
|
299
321
|
const theme = useXUITheme();
|
|
300
|
-
const titleTextStyle = (0,
|
|
322
|
+
const titleTextStyle = (0, import_react8.useMemo)(
|
|
301
323
|
() => ({
|
|
302
324
|
fontSize: isCompact ? theme.fontSizes.md : theme.fontSizes.lg,
|
|
303
325
|
fontWeight: theme.fontWeights.medium,
|
|
@@ -309,7 +331,7 @@ var useTitleTextStyle = (isCompact) => {
|
|
|
309
331
|
};
|
|
310
332
|
var useSubtitleTextStyle = () => {
|
|
311
333
|
const theme = useXUITheme();
|
|
312
|
-
const subtitleTextStyle = (0,
|
|
334
|
+
const subtitleTextStyle = (0, import_react8.useMemo)(
|
|
313
335
|
() => ({
|
|
314
336
|
fontSize: theme.fontSizes.sm,
|
|
315
337
|
color: import_palette2.colors.gray[500],
|
|
@@ -321,9 +343,9 @@ var useSubtitleTextStyle = () => {
|
|
|
321
343
|
};
|
|
322
344
|
var useContentContainerStyle = (isCompact, variant) => {
|
|
323
345
|
const theme = useXUITheme();
|
|
324
|
-
const contentContainerStyle = (0,
|
|
346
|
+
const contentContainerStyle = (0, import_react8.useMemo)(
|
|
325
347
|
() => ({
|
|
326
|
-
paddingBottom: isCompact ? theme.spacing.
|
|
348
|
+
paddingBottom: isCompact ? theme.spacing.xs : theme.spacing.sm,
|
|
327
349
|
paddingHorizontal: variant === "light" ? theme.spacing.sm : 0
|
|
328
350
|
}),
|
|
329
351
|
[isCompact, variant, theme]
|
|
@@ -336,13 +358,13 @@ var useForegroundColor = () => {
|
|
|
336
358
|
};
|
|
337
359
|
|
|
338
360
|
// src/components/accordion/chevron-right-icon.tsx
|
|
339
|
-
var
|
|
361
|
+
var import_react9 = __toESM(require("react"), 1);
|
|
340
362
|
var import_react_native_svg = __toESM(require("react-native-svg"), 1);
|
|
341
363
|
var ChevronRightIcon = ({
|
|
342
364
|
color = "#000",
|
|
343
365
|
size = 20
|
|
344
366
|
}) => {
|
|
345
|
-
return /* @__PURE__ */
|
|
367
|
+
return /* @__PURE__ */ import_react9.default.createElement(import_react_native_svg.default, { width: size, height: size, viewBox: "0 0 24 24", fill: "none" }, /* @__PURE__ */ import_react9.default.createElement(
|
|
346
368
|
import_react_native_svg.Path,
|
|
347
369
|
{
|
|
348
370
|
d: "M9 18l6-6-6-6",
|
|
@@ -362,14 +384,7 @@ var AccordionItem = ({
|
|
|
362
384
|
subtitle,
|
|
363
385
|
startContent,
|
|
364
386
|
indicator,
|
|
365
|
-
|
|
366
|
-
headingStyle,
|
|
367
|
-
triggerStyle,
|
|
368
|
-
titleStyle,
|
|
369
|
-
subtitleStyle,
|
|
370
|
-
contentStyle,
|
|
371
|
-
startContentStyle,
|
|
372
|
-
indicatorStyle,
|
|
387
|
+
customAppearance,
|
|
373
388
|
onSelected
|
|
374
389
|
}) => {
|
|
375
390
|
const {
|
|
@@ -392,43 +407,50 @@ var AccordionItem = ({
|
|
|
392
407
|
const subtitleTextStyle = useSubtitleTextStyle();
|
|
393
408
|
const contentContainerStyle = useContentContainerStyle(isCompact, variant);
|
|
394
409
|
const foregroundColor = useForegroundColor();
|
|
395
|
-
return /* @__PURE__ */
|
|
396
|
-
|
|
410
|
+
return /* @__PURE__ */ import_react10.default.createElement(import_react_native6.View, { style: [baseStyles, customAppearance?.base] }, /* @__PURE__ */ import_react10.default.createElement(import_react_native6.View, { style: customAppearance?.heading }, /* @__PURE__ */ import_react10.default.createElement(
|
|
411
|
+
import_react_native6.Pressable,
|
|
397
412
|
{
|
|
398
|
-
style: [triggerStyles,
|
|
413
|
+
style: [triggerStyles, customAppearance?.trigger],
|
|
399
414
|
onPress: handlePress,
|
|
400
415
|
disabled: isDisabled,
|
|
401
416
|
accessibilityRole: "button",
|
|
402
417
|
accessibilityState: { expanded: isExpanded, disabled: isDisabled }
|
|
403
418
|
},
|
|
404
|
-
startContent && /* @__PURE__ */
|
|
405
|
-
/* @__PURE__ */
|
|
406
|
-
!hideIndicator && /* @__PURE__ */
|
|
407
|
-
|
|
419
|
+
startContent && /* @__PURE__ */ import_react10.default.createElement(import_react_native6.View, { style: [styles.startContent, customAppearance?.startContent] }, startContent),
|
|
420
|
+
/* @__PURE__ */ import_react10.default.createElement(import_react_native6.View, { style: styles.titleWrapper }, typeof title === "string" ? /* @__PURE__ */ import_react10.default.createElement(import_react_native6.Text, { style: [titleTextStyle, customAppearance?.title] }, title) : title, subtitle && (typeof subtitle === "string" ? /* @__PURE__ */ import_react10.default.createElement(import_react_native6.Text, { style: [subtitleTextStyle, customAppearance?.subtitle] }, subtitle) : subtitle)),
|
|
421
|
+
!hideIndicator && /* @__PURE__ */ import_react10.default.createElement(
|
|
422
|
+
import_react_native6.Animated.View,
|
|
408
423
|
{
|
|
409
424
|
style: [
|
|
410
425
|
styles.indicator,
|
|
411
|
-
|
|
426
|
+
customAppearance?.indicator,
|
|
412
427
|
{ transform: [{ rotate: rotationInterpolation }] }
|
|
413
428
|
]
|
|
414
429
|
},
|
|
415
|
-
indicator || /* @__PURE__ */
|
|
430
|
+
indicator || /* @__PURE__ */ import_react10.default.createElement(ChevronRightIcon, { color: foregroundColor })
|
|
416
431
|
)
|
|
417
|
-
)), /* @__PURE__ */
|
|
418
|
-
|
|
432
|
+
)), /* @__PURE__ */ import_react10.default.createElement(import_react_native6.View, { style: styles.hiddenMeasure, pointerEvents: "none" }, /* @__PURE__ */ import_react10.default.createElement(
|
|
433
|
+
import_react_native6.View,
|
|
434
|
+
{
|
|
435
|
+
onLayout: onContentLayout,
|
|
436
|
+
style: [contentContainerStyle, customAppearance?.content]
|
|
437
|
+
},
|
|
438
|
+
children
|
|
439
|
+
)), /* @__PURE__ */ import_react10.default.createElement(
|
|
440
|
+
import_react_native6.Animated.View,
|
|
419
441
|
{
|
|
420
442
|
style: [
|
|
421
443
|
styles.contentOverflow,
|
|
422
444
|
disableAnimation ? { height: isExpanded ? void 0 : 0 } : { height: heightInterpolation }
|
|
423
445
|
]
|
|
424
446
|
},
|
|
425
|
-
/* @__PURE__ */
|
|
447
|
+
/* @__PURE__ */ import_react10.default.createElement(import_react_native6.View, { style: [contentContainerStyle, customAppearance?.content] }, children)
|
|
426
448
|
));
|
|
427
449
|
};
|
|
428
450
|
AccordionItem.displayName = "AccordionItem";
|
|
429
451
|
|
|
430
452
|
// src/components/accordion/accordion.utils.ts
|
|
431
|
-
var
|
|
453
|
+
var import_react11 = __toESM(require("react"), 1);
|
|
432
454
|
var getItemKey = (value, fallback) => {
|
|
433
455
|
if (value === null || value === void 0) return String(fallback);
|
|
434
456
|
if (typeof value === "string" || typeof value === "number") return String(value);
|
|
@@ -438,7 +460,7 @@ var normalizeElementKey = (value) => {
|
|
|
438
460
|
if (typeof value !== "string") return value;
|
|
439
461
|
return value.startsWith(".$") ? value.slice(2) : value.startsWith(".") ? value.slice(1) : value;
|
|
440
462
|
};
|
|
441
|
-
var isAccordionItem = (value) =>
|
|
463
|
+
var isAccordionItem = (value) => import_react11.default.isValidElement(value) && (value.type === AccordionItem || typeof value.type === "function" && value.type.displayName === "AccordionItem");
|
|
442
464
|
var buildAccordionContextParams = (props) => {
|
|
443
465
|
return {
|
|
444
466
|
variant: props.variant || "light",
|
|
@@ -455,12 +477,12 @@ var buildAccordionContextParams = (props) => {
|
|
|
455
477
|
};
|
|
456
478
|
|
|
457
479
|
// src/components/divider/divider.tsx
|
|
458
|
-
var
|
|
459
|
-
var
|
|
480
|
+
var import_react13 = __toESM(require("react"), 1);
|
|
481
|
+
var import_react_native8 = require("react-native");
|
|
460
482
|
|
|
461
483
|
// src/components/divider/divider.style.ts
|
|
462
|
-
var
|
|
463
|
-
var styles2 =
|
|
484
|
+
var import_react_native7 = require("react-native");
|
|
485
|
+
var styles2 = import_react_native7.StyleSheet.create({
|
|
464
486
|
horizontal: {
|
|
465
487
|
height: 1,
|
|
466
488
|
flexShrink: 1,
|
|
@@ -474,21 +496,21 @@ var styles2 = import_react_native6.StyleSheet.create({
|
|
|
474
496
|
});
|
|
475
497
|
|
|
476
498
|
// src/components/divider/divider.hook.ts
|
|
477
|
-
var
|
|
478
|
-
var
|
|
499
|
+
var import_react12 = require("react");
|
|
500
|
+
var import_core5 = require("@xaui/core");
|
|
479
501
|
var useDividerColor = (themeColor, customColor) => {
|
|
480
502
|
const theme = useXUITheme();
|
|
481
|
-
const dividerColor = (0,
|
|
503
|
+
const dividerColor = (0, import_react12.useMemo)(() => {
|
|
482
504
|
if (customColor) {
|
|
483
505
|
return customColor;
|
|
484
506
|
}
|
|
485
|
-
const safeThemeColor = (0,
|
|
507
|
+
const safeThemeColor = (0, import_core5.getSafeThemeColor)(themeColor);
|
|
486
508
|
return theme.colors[safeThemeColor].main;
|
|
487
509
|
}, [customColor, themeColor, theme]);
|
|
488
510
|
return dividerColor;
|
|
489
511
|
};
|
|
490
512
|
var useDividerSize = (size, orientation) => {
|
|
491
|
-
const sizeStyles = (0,
|
|
513
|
+
const sizeStyles = (0, import_react12.useMemo)(() => {
|
|
492
514
|
if (orientation === "horizontal") {
|
|
493
515
|
return {
|
|
494
516
|
height: size
|
|
@@ -510,8 +532,8 @@ var Divider = ({
|
|
|
510
532
|
}) => {
|
|
511
533
|
const dividerColor = useDividerColor(themeColor, color);
|
|
512
534
|
const sizeStyles = useDividerSize(size, orientation);
|
|
513
|
-
return /* @__PURE__ */
|
|
514
|
-
|
|
535
|
+
return /* @__PURE__ */ import_react13.default.createElement(
|
|
536
|
+
import_react_native8.View,
|
|
515
537
|
{
|
|
516
538
|
style: [
|
|
517
539
|
orientation === "horizontal" ? styles2.horizontal : styles2.vertical,
|
|
@@ -529,8 +551,7 @@ var Accordion = (props) => {
|
|
|
529
551
|
variant = "light",
|
|
530
552
|
showDivider = false,
|
|
531
553
|
fullWidth = true,
|
|
532
|
-
|
|
533
|
-
itemStyle
|
|
554
|
+
customAppearance
|
|
534
555
|
} = props;
|
|
535
556
|
const { containerStyles, dividerColor } = useAccordionStyles({
|
|
536
557
|
variant,
|
|
@@ -538,15 +559,15 @@ var Accordion = (props) => {
|
|
|
538
559
|
});
|
|
539
560
|
const contextParams = buildAccordionContextParams(props);
|
|
540
561
|
const contextValue = useAccordionContextValue(contextParams);
|
|
541
|
-
const childrenArray =
|
|
542
|
-
return /* @__PURE__ */
|
|
562
|
+
const childrenArray = import_react14.default.Children.toArray(children);
|
|
563
|
+
return /* @__PURE__ */ import_react14.default.createElement(AccordionContext.Provider, { value: contextValue }, /* @__PURE__ */ import_react14.default.createElement(import_react_native9.View, { style: [containerStyles, customAppearance?.container] }, childrenArray.map((child, index) => {
|
|
543
564
|
const isLast = index === childrenArray.length - 1;
|
|
544
565
|
const showBottomDivider = (showDivider || variant === "bordered") && !isLast && variant !== "splitted";
|
|
545
566
|
const resolvedChildKey = isAccordionItem(child) ? getItemKey(child.props.itemKey ?? normalizeElementKey(child.key), index) : getItemKey(
|
|
546
|
-
|
|
567
|
+
import_react14.default.isValidElement(child) ? normalizeElementKey(child.key) : void 0,
|
|
547
568
|
index
|
|
548
569
|
);
|
|
549
|
-
return /* @__PURE__ */
|
|
570
|
+
return /* @__PURE__ */ import_react14.default.createElement(import_react_native9.View, { key: resolvedChildKey, style: customAppearance?.item }, isAccordionItem(child) ? import_react14.default.cloneElement(child, { itemKey: resolvedChildKey }) : child, showBottomDivider && /* @__PURE__ */ import_react14.default.createElement(Divider, { color: dividerColor, size: 2 }));
|
|
550
571
|
})));
|
|
551
572
|
};
|
|
552
573
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -6,6 +6,16 @@ type AccordionSelectionMode = 'toggle' | 'multiple';
|
|
|
6
6
|
type AccordionEvents = {
|
|
7
7
|
onSelectionChange?: (selectedKeys: string[]) => void;
|
|
8
8
|
};
|
|
9
|
+
type AccordionCustomAppearance = {
|
|
10
|
+
/**
|
|
11
|
+
* Custom styles for the container
|
|
12
|
+
*/
|
|
13
|
+
container?: ViewStyle;
|
|
14
|
+
/**
|
|
15
|
+
* Custom styles for individual items
|
|
16
|
+
*/
|
|
17
|
+
item?: ViewStyle;
|
|
18
|
+
};
|
|
9
19
|
type AccordionProps = {
|
|
10
20
|
/**
|
|
11
21
|
* List of AccordionItem components
|
|
@@ -62,13 +72,9 @@ type AccordionProps = {
|
|
|
62
72
|
*/
|
|
63
73
|
isCompact?: boolean;
|
|
64
74
|
/**
|
|
65
|
-
* Custom styles for
|
|
75
|
+
* Custom appearance styles for all accordion parts
|
|
66
76
|
*/
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* Custom styles for individual items
|
|
70
|
-
*/
|
|
71
|
-
itemStyle?: ViewStyle;
|
|
77
|
+
customAppearance?: AccordionCustomAppearance;
|
|
72
78
|
} & AccordionEvents;
|
|
73
79
|
|
|
74
80
|
declare const Accordion: React.FC<AccordionProps>;
|
|
@@ -76,64 +82,70 @@ declare const Accordion: React.FC<AccordionProps>;
|
|
|
76
82
|
type AccordionItemEvents = {
|
|
77
83
|
onSelected?: (isSelected: boolean) => void;
|
|
78
84
|
};
|
|
79
|
-
type
|
|
85
|
+
type AccordionItemCustomAppearance = {
|
|
80
86
|
/**
|
|
81
|
-
*
|
|
87
|
+
* Custom styles for the base container
|
|
82
88
|
*/
|
|
83
|
-
|
|
89
|
+
base?: ViewStyle;
|
|
84
90
|
/**
|
|
85
|
-
*
|
|
91
|
+
* Custom styles for the header container
|
|
86
92
|
*/
|
|
87
|
-
|
|
93
|
+
heading?: ViewStyle;
|
|
88
94
|
/**
|
|
89
|
-
*
|
|
95
|
+
* Custom styles for the trigger button
|
|
90
96
|
*/
|
|
91
|
-
|
|
97
|
+
trigger?: ViewStyle;
|
|
92
98
|
/**
|
|
93
|
-
*
|
|
99
|
+
* Custom styles for the title text
|
|
94
100
|
*/
|
|
95
|
-
|
|
101
|
+
title?: TextStyle;
|
|
96
102
|
/**
|
|
97
|
-
*
|
|
103
|
+
* Custom styles for the subtitle text
|
|
98
104
|
*/
|
|
99
|
-
|
|
105
|
+
subtitle?: TextStyle;
|
|
100
106
|
/**
|
|
101
|
-
* Custom
|
|
102
|
-
* @default ChevronRight icon
|
|
107
|
+
* Custom styles for the content container
|
|
103
108
|
*/
|
|
104
|
-
|
|
109
|
+
content?: ViewStyle;
|
|
105
110
|
/**
|
|
106
|
-
* Custom styles for the
|
|
111
|
+
* Custom styles for the start content container
|
|
107
112
|
*/
|
|
108
|
-
|
|
113
|
+
startContent?: ViewStyle;
|
|
109
114
|
/**
|
|
110
|
-
* Custom styles for the
|
|
115
|
+
* Custom styles for the indicator
|
|
111
116
|
*/
|
|
112
|
-
|
|
117
|
+
indicator?: ViewStyle;
|
|
118
|
+
};
|
|
119
|
+
type AccordionItemProps = {
|
|
113
120
|
/**
|
|
114
|
-
*
|
|
121
|
+
* Unique key for the accordion item
|
|
115
122
|
*/
|
|
116
|
-
|
|
123
|
+
itemKey?: string;
|
|
117
124
|
/**
|
|
118
|
-
*
|
|
125
|
+
* Content to display when accordion item is expanded
|
|
119
126
|
*/
|
|
120
|
-
|
|
127
|
+
children: ReactNode;
|
|
121
128
|
/**
|
|
122
|
-
*
|
|
129
|
+
* Title displayed in the accordion header
|
|
123
130
|
*/
|
|
124
|
-
|
|
131
|
+
title: ReactNode;
|
|
125
132
|
/**
|
|
126
|
-
*
|
|
133
|
+
* Optional subtitle displayed below the title
|
|
127
134
|
*/
|
|
128
|
-
|
|
135
|
+
subtitle?: ReactNode;
|
|
129
136
|
/**
|
|
130
|
-
*
|
|
137
|
+
* Content displayed at the start of the header (left side)
|
|
131
138
|
*/
|
|
132
|
-
|
|
139
|
+
startContent?: ReactNode;
|
|
133
140
|
/**
|
|
134
|
-
* Custom
|
|
141
|
+
* Custom indicator for the expanded/collapsed state
|
|
142
|
+
* @default ChevronRight icon
|
|
143
|
+
*/
|
|
144
|
+
indicator?: ReactNode;
|
|
145
|
+
/**
|
|
146
|
+
* Custom appearance styles for all accordion item parts
|
|
135
147
|
*/
|
|
136
|
-
|
|
148
|
+
customAppearance?: AccordionItemCustomAppearance;
|
|
137
149
|
} & AccordionItemEvents;
|
|
138
150
|
|
|
139
151
|
declare const AccordionItem: React.FC<AccordionItemProps>;
|