@xaui/native 0.0.21 → 0.0.24

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.
Files changed (113) hide show
  1. package/README.md +195 -2
  2. package/dist/alert/index.js +1 -2
  3. package/dist/app-bar/index.cjs +217 -0
  4. package/dist/app-bar/index.d.cts +52 -0
  5. package/dist/app-bar/index.d.ts +52 -0
  6. package/dist/app-bar/index.js +142 -0
  7. package/dist/autocomplete/index.js +48 -36
  8. package/dist/avatar/index.js +1 -2
  9. package/dist/badge/index.js +1 -2
  10. package/dist/bottom-sheet/index.js +1 -2
  11. package/dist/bottom-tab-bar/index.cjs +571 -0
  12. package/dist/bottom-tab-bar/index.d.cts +211 -0
  13. package/dist/bottom-tab-bar/index.d.ts +211 -0
  14. package/dist/bottom-tab-bar/index.js +497 -0
  15. package/dist/button/index.d.cts +102 -5
  16. package/dist/button/index.d.ts +102 -5
  17. package/dist/button/index.js +2 -3
  18. package/dist/button.type-j1ZdkkSl.d.cts +4 -0
  19. package/dist/button.type-j1ZdkkSl.d.ts +4 -0
  20. package/dist/card/index.cjs +2 -0
  21. package/dist/card/index.d.cts +6 -1
  22. package/dist/card/index.d.ts +6 -1
  23. package/dist/card/index.js +4 -2
  24. package/dist/carousel/index.js +1 -1
  25. package/dist/chart/index.cjs +1067 -0
  26. package/dist/chart/index.d.cts +218 -0
  27. package/dist/chart/index.d.ts +218 -0
  28. package/dist/chart/index.js +1026 -0
  29. package/dist/checkbox/index.js +1 -2
  30. package/dist/chip/index.js +1 -2
  31. package/dist/chunk-3XSXTM3G.js +661 -0
  32. package/dist/chunk-4KSZLONZ.js +79 -0
  33. package/dist/{chunk-DXXNBF5P.js → chunk-CZFDZPAS.js} +0 -5
  34. package/dist/{chunk-LTKYHG5V.js → chunk-GHCVNQET.js} +12 -5
  35. package/dist/chunk-I4V5Y5GD.js +76 -0
  36. package/dist/{chunk-F7WH4DMG.js → chunk-UI5L26KD.js} +1 -1
  37. package/dist/{chunk-LUBWRVI2.js → chunk-ULJSCNPE.js} +1 -1
  38. package/dist/chunk-URBEEDFX.js +79 -0
  39. package/dist/core/index.js +3 -5
  40. package/dist/datepicker/index.js +1 -2
  41. package/dist/divider/index.js +2 -3
  42. package/dist/drawer/index.cjs +310 -0
  43. package/dist/drawer/index.d.cts +58 -0
  44. package/dist/drawer/index.d.ts +58 -0
  45. package/dist/drawer/index.js +236 -0
  46. package/dist/{accordion → expansion-panel}/index.cjs +45 -45
  47. package/dist/{accordion → expansion-panel}/index.d.cts +30 -30
  48. package/dist/{accordion → expansion-panel}/index.d.ts +30 -30
  49. package/dist/{accordion → expansion-panel}/index.js +40 -41
  50. package/dist/fab/index.d.cts +3 -3
  51. package/dist/fab/index.d.ts +3 -3
  52. package/dist/fab/index.js +3 -4
  53. package/dist/fab-menu/index.d.cts +2 -2
  54. package/dist/fab-menu/index.d.ts +2 -2
  55. package/dist/fab-menu/index.js +3 -4
  56. package/dist/{fab.type-Ba0QMprb.d.ts → fab.type-CgIYqQlT.d.ts} +1 -1
  57. package/dist/{fab.type-U09H8B7D.d.cts → fab.type-l2vjG8-p.d.cts} +1 -1
  58. package/dist/feature-discovery/index.cjs +531 -0
  59. package/dist/feature-discovery/index.d.cts +82 -0
  60. package/dist/feature-discovery/index.d.ts +82 -0
  61. package/dist/feature-discovery/index.js +464 -0
  62. package/dist/indicator/index.js +2 -3
  63. package/dist/input/index.cjs +258 -164
  64. package/dist/input/index.d.cts +15 -1
  65. package/dist/input/index.d.ts +15 -1
  66. package/dist/input/index.js +219 -126
  67. package/dist/list/index.js +1 -2
  68. package/dist/menu/index.js +2 -2
  69. package/dist/menubox/index.cjs +369 -0
  70. package/dist/menubox/index.d.cts +98 -0
  71. package/dist/menubox/index.d.ts +98 -0
  72. package/dist/menubox/index.js +296 -0
  73. package/dist/pager/index.cjs +243 -0
  74. package/dist/pager/index.d.cts +93 -0
  75. package/dist/pager/index.d.ts +93 -0
  76. package/dist/pager/index.js +205 -0
  77. package/dist/progress/index.js +1 -2
  78. package/dist/radio/index.cjs +537 -0
  79. package/dist/radio/index.d.cts +145 -0
  80. package/dist/radio/index.d.ts +145 -0
  81. package/dist/radio/index.js +464 -0
  82. package/dist/segment-button/index.js +2 -2
  83. package/dist/select/index.js +22 -10
  84. package/dist/skeleton/index.js +2 -2
  85. package/dist/slider/index.cjs +655 -0
  86. package/dist/slider/index.d.cts +171 -0
  87. package/dist/slider/index.d.ts +171 -0
  88. package/dist/slider/index.js +575 -0
  89. package/dist/stepper/index.cjs +624 -0
  90. package/dist/stepper/index.d.cts +137 -0
  91. package/dist/stepper/index.d.ts +137 -0
  92. package/dist/stepper/index.js +549 -0
  93. package/dist/switch/index.js +1 -2
  94. package/dist/tabs/index.cjs +523 -0
  95. package/dist/tabs/index.d.cts +176 -0
  96. package/dist/tabs/index.d.ts +176 -0
  97. package/dist/tabs/index.js +438 -0
  98. package/dist/timepicker/index.cjs +1280 -0
  99. package/dist/timepicker/index.d.cts +215 -0
  100. package/dist/timepicker/index.d.ts +215 -0
  101. package/dist/timepicker/index.js +1181 -0
  102. package/dist/toolbar/index.cjs +395 -0
  103. package/dist/toolbar/index.d.cts +100 -0
  104. package/dist/toolbar/index.d.ts +100 -0
  105. package/dist/toolbar/index.js +325 -0
  106. package/dist/typography/index.js +1 -2
  107. package/dist/view/index.cjs +16 -2
  108. package/dist/view/index.js +16 -2
  109. package/package.json +73 -8
  110. package/dist/button.type-D8tzEBo7.d.ts +0 -104
  111. package/dist/button.type-ikaWzhIg.d.cts +0 -104
  112. package/dist/chunk-GBHQCAKW.js +0 -19
  113. package/dist/chunk-JEGEPGVU.js +0 -287
@@ -1,104 +0,0 @@
1
- import { ReactNode } from 'react';
2
- import { ViewStyle, TextStyle, GestureResponderEvent } from 'react-native';
3
- import { T as ThemeColor, S as Size } from './index-BOw6tbkc.cjs';
4
-
5
- type ButtonVariant = 'solid' | 'outlined' | 'flat' | 'light' | 'faded';
6
- type ButtonRadius = 'none' | 'sm' | 'md' | 'lg' | 'full';
7
- type SpinnerPlacement = 'start' | 'end';
8
- type ElevationLevel = 0 | 1 | 2 | 3 | 4;
9
- type ButtonCustomAppearance = {
10
- /**
11
- * Custom styles for the outer container
12
- */
13
- container?: ViewStyle;
14
- /**
15
- * Custom styles for the button
16
- */
17
- button?: ViewStyle;
18
- /**
19
- * Custom styles for the button text
20
- */
21
- text?: TextStyle;
22
- };
23
- type ButtonProps = {
24
- /**
25
- * The content to display in the button.
26
- */
27
- children: ReactNode;
28
- /**
29
- * The theme color of the button.
30
- * @default 'default'
31
- */
32
- themeColor?: ThemeColor;
33
- /**
34
- * The variant of the button.
35
- * @default 'solid'
36
- */
37
- variant?: ButtonVariant;
38
- /**
39
- * The size of the button.
40
- * @default 'md'
41
- */
42
- size?: Size;
43
- /**
44
- * The border radius of the button.
45
- * @default 'md'
46
- */
47
- radius?: ButtonRadius;
48
- /**
49
- * Content to display at the start of the button.
50
- */
51
- startContent?: ReactNode;
52
- /**
53
- * Content to display at the end of the button.
54
- */
55
- endContent?: ReactNode;
56
- /**
57
- * The placement of the spinner when isLoading is true.
58
- * @default 'start'
59
- */
60
- spinnerPlacement?: SpinnerPlacement;
61
- /**
62
- * Whether the button should take the full width of its container.
63
- * @default false
64
- */
65
- fullWidth?: boolean;
66
- /**
67
- * Whether the button is disabled.
68
- * @default false
69
- */
70
- isDisabled?: boolean;
71
- /**
72
- * Whether the button is in a loading state.
73
- * @default false
74
- */
75
- isLoading?: boolean;
76
- /**
77
- * Android elevation level from 0 to 4.
78
- * Does not apply to `outlined` and `light` variants.
79
- * @default 0
80
- */
81
- elevation?: ElevationLevel;
82
- /**
83
- * Custom appearance styles for button parts
84
- */
85
- customAppearance?: ButtonCustomAppearance;
86
- /**
87
- * Callback fired when the button is pressed.
88
- */
89
- onPress?: (event: GestureResponderEvent) => void;
90
- /**
91
- * Callback fired when the button is long pressed.
92
- */
93
- onLongPress?: (event: GestureResponderEvent) => void;
94
- /**
95
- * Callback fired when the button press starts.
96
- */
97
- onPressIn?: (event: GestureResponderEvent) => void;
98
- /**
99
- * Callback fired when the button press ends.
100
- */
101
- onPressOut?: (event: GestureResponderEvent) => void;
102
- };
103
-
104
- export type { ButtonRadius as B, ElevationLevel as E, SpinnerPlacement as S, ButtonProps as a, ButtonVariant as b };
@@ -1,19 +0,0 @@
1
- // src/components/select/checkmark-icon.tsx
2
- import React from "react";
3
- import Svg, { Polyline } from "react-native-svg";
4
- function CheckmarkIcon({ color, size }) {
5
- return /* @__PURE__ */ React.createElement(Svg, { width: size, height: size, viewBox: "0 0 17 18", fill: "none" }, /* @__PURE__ */ React.createElement(
6
- Polyline,
7
- {
8
- points: "1 9 7 14 15 4",
9
- stroke: color,
10
- strokeWidth: 2,
11
- strokeLinecap: "round",
12
- strokeLinejoin: "round"
13
- }
14
- ));
15
- }
16
-
17
- export {
18
- CheckmarkIcon
19
- };
@@ -1,287 +0,0 @@
1
- import {
2
- ActivityIndicator
3
- } from "./chunk-F7WH4DMG.js";
4
- import {
5
- useXUITheme
6
- } from "./chunk-LTKYHG5V.js";
7
-
8
- // src/components/fab/fab.tsx
9
- import React from "react";
10
- import { Pressable, Text, View, Animated as Animated2 } from "react-native";
11
-
12
- // src/components/fab/fab.style.ts
13
- import { StyleSheet } from "react-native";
14
- var styles = StyleSheet.create({
15
- container: {
16
- alignSelf: "flex-start"
17
- },
18
- fab: {
19
- flexDirection: "row",
20
- alignItems: "center",
21
- justifyContent: "center",
22
- overflow: "hidden"
23
- },
24
- contentContainer: {
25
- flexDirection: "row",
26
- alignItems: "center",
27
- justifyContent: "center",
28
- gap: 12
29
- },
30
- label: {
31
- fontWeight: "500"
32
- },
33
- disabled: {
34
- opacity: 0.5
35
- }
36
- });
37
-
38
- // src/components/fab/fab.hook.ts
39
- import { useMemo } from "react";
40
- import { getSafeThemeColor } from "@xaui/core";
41
- function useFabSizeStyles(size) {
42
- const theme = useXUITheme();
43
- const sizeStyles = useMemo(() => {
44
- const sizes = {
45
- sm: {
46
- width: 40,
47
- height: 40,
48
- borderRadius: theme.borderRadius.lg,
49
- iconSize: 24,
50
- fontSize: theme.fontSizes.sm
51
- },
52
- md: {
53
- width: 56,
54
- height: 56,
55
- borderRadius: theme.borderRadius.xl,
56
- iconSize: 24,
57
- fontSize: theme.fontSizes.md
58
- },
59
- lg: {
60
- width: 96,
61
- height: 96,
62
- borderRadius: theme.borderRadius["2xl"],
63
- iconSize: 36,
64
- fontSize: theme.fontSizes.lg
65
- }
66
- };
67
- return sizes[size];
68
- }, [size, theme]);
69
- const extendedSizeStyles = useMemo(() => {
70
- const sizes = {
71
- sm: {
72
- height: 40,
73
- borderRadius: theme.borderRadius.lg,
74
- paddingHorizontal: theme.spacing.md,
75
- iconSize: 20,
76
- fontSize: theme.fontSizes.sm
77
- },
78
- md: {
79
- height: 56,
80
- borderRadius: theme.borderRadius.xl,
81
- paddingHorizontal: theme.spacing.lg,
82
- iconSize: 24,
83
- fontSize: theme.fontSizes.md
84
- },
85
- lg: {
86
- height: 80,
87
- borderRadius: theme.borderRadius["2xl"],
88
- paddingHorizontal: theme.spacing.xl,
89
- iconSize: 28,
90
- fontSize: theme.fontSizes.lg
91
- }
92
- };
93
- return sizes[size];
94
- }, [size, theme]);
95
- return { sizeStyles, extendedSizeStyles };
96
- }
97
- function useFabVariantStyles(themeColor, variant, elevation = 0) {
98
- const theme = useXUITheme();
99
- const safeThemeColor = getSafeThemeColor(themeColor);
100
- const colorScheme = theme.colors[safeThemeColor];
101
- const variantStyles = useMemo(() => {
102
- const variantMap = {
103
- solid: {
104
- backgroundColor: colorScheme.main,
105
- borderWidth: 0
106
- },
107
- flat: {
108
- backgroundColor: colorScheme.background,
109
- borderWidth: 0
110
- },
111
- outlined: {
112
- backgroundColor: "transparent",
113
- borderWidth: theme.borderWidth.md,
114
- borderColor: colorScheme.main
115
- }
116
- };
117
- const baseStyle = variantMap[variant];
118
- const shouldApplyElevation = variant !== "outlined";
119
- const shadowStyles = elevation === 0 ? {} : elevation === 1 ? theme.shadows.sm : elevation === 2 ? theme.shadows.md : elevation === 3 ? theme.shadows.lg : theme.shadows.xl;
120
- return {
121
- ...baseStyle,
122
- ...shouldApplyElevation ? shadowStyles : {},
123
- ...shouldApplyElevation && elevation > 0 ? { elevation } : {}
124
- };
125
- }, [variant, colorScheme, theme, elevation]);
126
- return variantStyles;
127
- }
128
- function useFabIconColor(themeColor, variant) {
129
- const theme = useXUITheme();
130
- const safeThemeColor = getSafeThemeColor(themeColor);
131
- const colorScheme = theme.colors[safeThemeColor];
132
- const iconColor = useMemo(() => {
133
- if (variant === "solid") {
134
- return colorScheme.foreground;
135
- }
136
- return colorScheme.main;
137
- }, [variant, colorScheme]);
138
- return { iconColor };
139
- }
140
- function useFabRadiusValue(radius, fallback) {
141
- const theme = useXUITheme();
142
- return useMemo(() => {
143
- if (!radius) return fallback;
144
- const radiusMap = {
145
- none: theme.borderRadius.none,
146
- sm: theme.borderRadius.sm,
147
- md: theme.borderRadius.md,
148
- lg: theme.borderRadius.lg,
149
- full: theme.borderRadius.full
150
- };
151
- return radiusMap[radius];
152
- }, [fallback, radius, theme]);
153
- }
154
-
155
- // src/components/fab/fab.animation.ts
156
- import { Animated } from "react-native";
157
- var runFabPressInAnimation = (animatedScale, animatedOpacity) => {
158
- Animated.parallel([
159
- Animated.spring(animatedScale, {
160
- toValue: 0.92,
161
- useNativeDriver: true,
162
- speed: 50,
163
- bounciness: 0
164
- }),
165
- Animated.timing(animatedOpacity, {
166
- toValue: 0.85,
167
- duration: 100,
168
- useNativeDriver: true
169
- })
170
- ]).start();
171
- };
172
- var runFabPressOutAnimation = (animatedScale, animatedOpacity) => {
173
- Animated.parallel([
174
- Animated.spring(animatedScale, {
175
- toValue: 1,
176
- useNativeDriver: true,
177
- speed: 50,
178
- bounciness: 0
179
- }),
180
- Animated.timing(animatedOpacity, {
181
- toValue: 1,
182
- duration: 100,
183
- useNativeDriver: true
184
- })
185
- ]).start();
186
- };
187
-
188
- // src/components/fab/fab.tsx
189
- var Fab = ({
190
- icon,
191
- label,
192
- themeColor = "primary",
193
- variant = "solid",
194
- size = "md",
195
- radius,
196
- isDisabled = false,
197
- isLoading = false,
198
- elevation = 0,
199
- customAppearance,
200
- onPress,
201
- onLongPress,
202
- onPressIn,
203
- onPressOut
204
- }) => {
205
- const animatedScale = React.useRef(new Animated2.Value(1)).current;
206
- const animatedOpacity = React.useRef(new Animated2.Value(1)).current;
207
- const { sizeStyles, extendedSizeStyles } = useFabSizeStyles(size);
208
- const variantStyles = useFabVariantStyles(themeColor, variant, elevation);
209
- const { iconColor } = useFabIconColor(themeColor, variant);
210
- const isExtended = !!label;
211
- const resolvedRadius = useFabRadiusValue(
212
- radius,
213
- isExtended ? extendedSizeStyles.borderRadius : sizeStyles.borderRadius
214
- );
215
- const handlePressIn = (event) => {
216
- if (!isDisabled && !isLoading) {
217
- runFabPressInAnimation(animatedScale, animatedOpacity);
218
- }
219
- onPressIn?.(event);
220
- };
221
- const handlePressOut = (event) => {
222
- if (!isDisabled && !isLoading) {
223
- runFabPressOutAnimation(animatedScale, animatedOpacity);
224
- }
225
- onPressOut?.(event);
226
- };
227
- const fabDimensionStyles = isExtended ? {
228
- height: extendedSizeStyles.height,
229
- borderRadius: resolvedRadius,
230
- paddingHorizontal: extendedSizeStyles.paddingHorizontal
231
- } : {
232
- width: sizeStyles.width,
233
- height: sizeStyles.height,
234
- borderRadius: resolvedRadius
235
- };
236
- return /* @__PURE__ */ React.createElement(View, { style: [styles.container, customAppearance?.container] }, /* @__PURE__ */ React.createElement(
237
- Pressable,
238
- {
239
- onPress: isDisabled || isLoading ? void 0 : onPress,
240
- onLongPress: isDisabled || isLoading ? void 0 : onLongPress,
241
- onPressIn: handlePressIn,
242
- onPressOut: handlePressOut,
243
- disabled: isDisabled || isLoading
244
- },
245
- /* @__PURE__ */ React.createElement(
246
- Animated2.View,
247
- {
248
- style: [
249
- styles.fab,
250
- fabDimensionStyles,
251
- variantStyles,
252
- isDisabled && styles.disabled,
253
- {
254
- transform: [{ scale: animatedScale }],
255
- opacity: animatedOpacity
256
- },
257
- customAppearance?.fab
258
- ]
259
- },
260
- isLoading ? /* @__PURE__ */ React.createElement(
261
- ActivityIndicator,
262
- {
263
- variant: "circular",
264
- themeColor: variant === "solid" ? void 0 : themeColor,
265
- color: variant === "solid" ? iconColor : void 0,
266
- size: isExtended ? extendedSizeStyles.iconSize : sizeStyles.iconSize
267
- }
268
- ) : /* @__PURE__ */ React.createElement(View, { style: styles.contentContainer }, icon, isExtended && /* @__PURE__ */ React.createElement(
269
- Text,
270
- {
271
- style: [
272
- styles.label,
273
- {
274
- fontSize: isExtended ? extendedSizeStyles.fontSize : sizeStyles.fontSize,
275
- color: iconColor
276
- }
277
- ]
278
- },
279
- label
280
- ))
281
- )
282
- ));
283
- };
284
-
285
- export {
286
- Fab
287
- };