@xaui/native 0.0.27 → 0.0.29

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 (109) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +105 -228
  3. package/dist/alert/index.cjs +92 -166
  4. package/dist/alert/index.js +2 -1
  5. package/dist/app-bar/index.cjs +24 -98
  6. package/dist/app-bar/index.js +2 -1
  7. package/dist/autocomplete/index.cjs +192 -281
  8. package/dist/autocomplete/index.js +36 -48
  9. package/dist/avatar/index.cjs +59 -133
  10. package/dist/avatar/index.js +2 -1
  11. package/dist/badge/index.cjs +26 -99
  12. package/dist/badge/index.js +2 -1
  13. package/dist/bottom-sheet/index.cjs +5 -456
  14. package/dist/bottom-sheet/index.js +4 -363
  15. package/dist/bottom-tab-bar/index.cjs +93 -167
  16. package/dist/bottom-tab-bar/index.js +2 -2
  17. package/dist/button/index.cjs +73 -525
  18. package/dist/button/index.js +3 -2
  19. package/dist/card/index.cjs +76 -169
  20. package/dist/card/index.js +2 -2
  21. package/dist/carousel/index.cjs +68 -145
  22. package/dist/carousel/index.js +1 -1
  23. package/dist/chart/index.cjs +132 -173
  24. package/dist/checkbox/index.cjs +70 -143
  25. package/dist/checkbox/index.js +2 -1
  26. package/dist/chip/index.cjs +89 -164
  27. package/dist/chip/index.js +2 -1
  28. package/dist/chunk-BD72HIPR.cjs +75 -0
  29. package/dist/chunk-DHSTKO3K.cjs +19 -0
  30. package/dist/{chunk-CZFDZPAS.js → chunk-DXXNBF5P.js} +5 -0
  31. package/dist/{chunk-UI5L26KD.js → chunk-F7WH4DMG.js} +1 -1
  32. package/dist/chunk-GBHQCAKW.js +19 -0
  33. package/dist/chunk-HC2SSHNU.js +368 -0
  34. package/dist/chunk-HSPTLUFA.cjs +7 -0
  35. package/dist/chunk-JEGEPGVU.js +287 -0
  36. package/dist/chunk-KTLGDLCB.cjs +287 -0
  37. package/dist/{chunk-GHCVNQET.js → chunk-LTKYHG5V.js} +5 -12
  38. package/dist/{chunk-ULJSCNPE.js → chunk-LUBWRVI2.js} +1 -1
  39. package/dist/chunk-OQ2BLOOG.cjs +138 -0
  40. package/dist/chunk-QMYWIWSX.cjs +384 -0
  41. package/dist/chunk-XFPPR2VB.cjs +368 -0
  42. package/dist/core/index.cjs +22 -168
  43. package/dist/core/index.d.cts +1 -1
  44. package/dist/core/index.d.ts +1 -1
  45. package/dist/core/index.js +5 -3
  46. package/dist/datepicker/index.cjs +239 -320
  47. package/dist/datepicker/index.js +2 -1
  48. package/dist/divider/index.cjs +5 -145
  49. package/dist/divider/index.js +3 -2
  50. package/dist/drawer/index.cjs +39 -112
  51. package/dist/drawer/index.js +2 -1
  52. package/dist/expansion-panel/index.cjs +91 -230
  53. package/dist/expansion-panel/index.js +3 -2
  54. package/dist/fab/index.cjs +6 -722
  55. package/dist/fab/index.js +4 -3
  56. package/dist/fab-menu/index.cjs +81 -814
  57. package/dist/fab-menu/index.js +4 -3
  58. package/dist/feature-discovery/index.cjs +72 -139
  59. package/dist/feature-discovery/index.js +2 -2
  60. package/dist/index.cjs +1 -18
  61. package/dist/indicator/index.cjs +5 -445
  62. package/dist/indicator/index.js +3 -2
  63. package/dist/input/index.cjs +214 -282
  64. package/dist/input/index.js +2 -2
  65. package/dist/list/index.cjs +71 -146
  66. package/dist/list/index.js +2 -1
  67. package/dist/menu/index.cjs +71 -127
  68. package/dist/menu/index.d.cts +8 -0
  69. package/dist/menu/index.d.ts +8 -0
  70. package/dist/menu/index.js +15 -3
  71. package/dist/menubox/index.cjs +60 -132
  72. package/dist/menubox/index.js +2 -1
  73. package/dist/pager/index.cjs +42 -80
  74. package/dist/progress/index.cjs +43 -114
  75. package/dist/progress/index.js +2 -1
  76. package/dist/radio/index.cjs +82 -154
  77. package/dist/radio/index.js +2 -1
  78. package/dist/segment-button/index.cjs +60 -147
  79. package/dist/segment-button/index.js +2 -2
  80. package/dist/select/index.cjs +149 -224
  81. package/dist/select/index.js +10 -22
  82. package/dist/skeleton/index.cjs +23 -94
  83. package/dist/skeleton/index.js +2 -2
  84. package/dist/slider/index.cjs +77 -156
  85. package/dist/slider/index.js +2 -1
  86. package/dist/snackbar/index.cjs +420 -0
  87. package/dist/snackbar/index.d.cts +175 -0
  88. package/dist/snackbar/index.d.ts +175 -0
  89. package/dist/snackbar/index.js +420 -0
  90. package/dist/stepper/index.cjs +121 -195
  91. package/dist/stepper/index.js +2 -1
  92. package/dist/switch/index.cjs +48 -121
  93. package/dist/switch/index.js +2 -1
  94. package/dist/tabs/index.cjs +67 -151
  95. package/dist/tabs/index.js +2 -1
  96. package/dist/timepicker/index.cjs +135 -593
  97. package/dist/timepicker/index.js +24 -383
  98. package/dist/toolbar/index.cjs +59 -128
  99. package/dist/toolbar/index.js +2 -1
  100. package/dist/typography/index.cjs +37 -92
  101. package/dist/typography/index.d.cts +1 -1
  102. package/dist/typography/index.d.ts +1 -1
  103. package/dist/typography/index.js +20 -1
  104. package/dist/view/index.cjs +178 -223
  105. package/package.json +6 -1
  106. package/dist/chunk-3XSXTM3G.js +0 -661
  107. package/dist/chunk-4KSZLONZ.js +0 -79
  108. package/dist/chunk-I4V5Y5GD.js +0 -76
  109. package/dist/chunk-URBEEDFX.js +0 -79
@@ -0,0 +1,384 @@
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(); } }
2
+
3
+ var _chunkOQ2BLOOGcjs = require('./chunk-OQ2BLOOG.cjs');
4
+
5
+ // src/components/indicator/indicator.tsx
6
+ var _react = require('react'); var _react2 = _interopRequireDefault(_react);
7
+ var _reactnative = require('react-native');
8
+
9
+ // src/components/indicator/circular-activity-indicator.tsx
10
+
11
+
12
+
13
+ // src/components/indicator/indicator.style.ts
14
+
15
+ var styles = _reactnative.StyleSheet.create({
16
+ container: {
17
+ flexShrink: 1,
18
+ flexBasis: "auto",
19
+ width: "100%",
20
+ justifyContent: "center"
21
+ },
22
+ layer: {
23
+ ..._reactnative.StyleSheet.absoluteFillObject,
24
+ justifyContent: "center",
25
+ alignItems: "center"
26
+ },
27
+ track: {
28
+ width: "100%",
29
+ overflow: "hidden"
30
+ },
31
+ progress: {
32
+ height: "100%"
33
+ }
34
+ });
35
+
36
+ // src/components/indicator/circular-activity-indicator.tsx
37
+ var _core = require('@xaui/core');
38
+ var DURATION = 1800;
39
+ var CircularActivityIndicator = ({
40
+ size = 40,
41
+ themeColor = "primary",
42
+ color,
43
+ backgroundColor,
44
+ disableAnimation = false,
45
+ showTrack = true
46
+ }) => {
47
+ const theme = _chunkOQ2BLOOGcjs.useXUITheme.call(void 0, );
48
+ const { current: timer } = _react.useRef.call(void 0, new _reactnative.Animated.Value(0));
49
+ const rotation = _react.useRef.call(void 0, void 0);
50
+ const startRotation = _react2.default.useCallback(() => {
51
+ if (rotation.current) {
52
+ timer.setValue(0);
53
+ _reactnative.Animated.loop(rotation.current).start();
54
+ }
55
+ }, [timer]);
56
+ const stopRotation = () => {
57
+ if (rotation.current) rotation.current.stop();
58
+ };
59
+ _react.useEffect.call(void 0, () => {
60
+ if (rotation.current === void 0) {
61
+ rotation.current = _reactnative.Animated.timing(timer, {
62
+ duration: DURATION,
63
+ easing: _reactnative.Easing.linear,
64
+ useNativeDriver: _reactnative.Platform.OS !== "web",
65
+ toValue: 1
66
+ });
67
+ }
68
+ if (!disableAnimation) startRotation();
69
+ else stopRotation();
70
+ }, [disableAnimation, startRotation, timer]);
71
+ const safeThemeColor = _core.getSafeThemeColor.call(void 0, themeColor);
72
+ const colorScheme = theme.colors[safeThemeColor];
73
+ const mainColor = color || colorScheme.main;
74
+ const trackColor = showTrack ? _nullishCoalesce(backgroundColor, () => ( colorScheme.background)) : "transparent";
75
+ const strokeWidth = size * 0.1;
76
+ const frames = 60 * DURATION / 1e3;
77
+ const easing = _reactnative.Easing.bezier(0.4, 0, 0.7, 1);
78
+ const containerStyle = {
79
+ width: size,
80
+ height: size / 2,
81
+ overflow: "hidden"
82
+ };
83
+ return /* @__PURE__ */ _react2.default.createElement(_reactnative.View, { style: [styles.container, { width: size, height: size }] }, /* @__PURE__ */ _react2.default.createElement(
84
+ _reactnative.View,
85
+ {
86
+ style: {
87
+ width: size,
88
+ height: size,
89
+ borderRadius: size / 2,
90
+ borderWidth: strokeWidth,
91
+ borderColor: trackColor
92
+ }
93
+ }
94
+ ), /* @__PURE__ */ _react2.default.createElement(
95
+ _reactnative.View,
96
+ {
97
+ style: {
98
+ width: size,
99
+ height: size,
100
+ position: "absolute"
101
+ }
102
+ },
103
+ [0, 1].map((index) => {
104
+ const inputRange = Array.from(
105
+ new Array(frames),
106
+ (_, frameIndex) => frameIndex / (frames - 1)
107
+ );
108
+ const outputRange = Array.from(new Array(frames), (_, frameIndex) => {
109
+ let progress = 2 * frameIndex / (frames - 1);
110
+ const rotationValue = index ? +(360 - 15) : -(180 - 15);
111
+ if (progress > 1) {
112
+ progress = 2 - progress;
113
+ }
114
+ const direction = index ? -1 : 1;
115
+ return `${direction * (180 - 30) * easing(progress) + rotationValue}deg`;
116
+ });
117
+ const layerStyle = {
118
+ width: size,
119
+ height: size,
120
+ transform: [
121
+ {
122
+ rotate: timer.interpolate({
123
+ inputRange: [0, 1],
124
+ outputRange: [`${0 + 30 + 15}deg`, `${2 * 360 + 30 + 15}deg`]
125
+ })
126
+ }
127
+ ]
128
+ };
129
+ const viewportStyle = {
130
+ width: size,
131
+ height: size,
132
+ transform: [
133
+ { translateY: index ? -size / 2 : 0 },
134
+ {
135
+ rotate: timer.interpolate({ inputRange, outputRange })
136
+ }
137
+ ]
138
+ };
139
+ const offsetStyle = index ? { top: size / 2 } : null;
140
+ const lineStyle = {
141
+ width: size,
142
+ height: size,
143
+ borderColor: mainColor,
144
+ borderWidth: strokeWidth,
145
+ borderRadius: size / 2
146
+ };
147
+ return /* @__PURE__ */ _react2.default.createElement(_reactnative.Animated.View, { key: index, style: [styles.layer] }, /* @__PURE__ */ _react2.default.createElement(_reactnative.Animated.View, { style: layerStyle }, /* @__PURE__ */ _react2.default.createElement(
148
+ _reactnative.Animated.View,
149
+ {
150
+ style: [containerStyle, offsetStyle],
151
+ collapsable: false
152
+ },
153
+ /* @__PURE__ */ _react2.default.createElement(_reactnative.Animated.View, { style: viewportStyle }, /* @__PURE__ */ _react2.default.createElement(_reactnative.Animated.View, { style: containerStyle, collapsable: false }, /* @__PURE__ */ _react2.default.createElement(_reactnative.Animated.View, { style: lineStyle })))
154
+ )));
155
+ })
156
+ ));
157
+ };
158
+
159
+ // src/components/indicator/linear-activity-indicator.tsx
160
+
161
+
162
+ var _reactnativereanimated = require('react-native-reanimated'); var _reactnativereanimated2 = _interopRequireDefault(_reactnativereanimated);
163
+
164
+ // src/components/indicator/indicator.hook.ts
165
+
166
+
167
+
168
+
169
+
170
+
171
+
172
+
173
+
174
+ var useLinearActivityIndicatorAnimation = (disableAnimation) => {
175
+ const primaryTranslateX = _reactnativereanimated.useSharedValue.call(void 0, 0);
176
+ const primaryScaleX = _reactnativereanimated.useSharedValue.call(void 0, 0.08);
177
+ const secondaryTranslateX = _reactnativereanimated.useSharedValue.call(void 0, 0);
178
+ const secondaryScaleX = _reactnativereanimated.useSharedValue.call(void 0, 0.08);
179
+ _react.useEffect.call(void 0, () => {
180
+ if (disableAnimation) {
181
+ _reactnativereanimated.cancelAnimation.call(void 0, primaryTranslateX);
182
+ _reactnativereanimated.cancelAnimation.call(void 0, primaryScaleX);
183
+ _reactnativereanimated.cancelAnimation.call(void 0, secondaryTranslateX);
184
+ _reactnativereanimated.cancelAnimation.call(void 0, secondaryScaleX);
185
+ return;
186
+ }
187
+ primaryTranslateX.value = _reactnativereanimated.withRepeat.call(void 0,
188
+ _reactnativereanimated.withSequence.call(void 0,
189
+ _reactnativereanimated.withTiming.call(void 0, 0, { duration: 0 }),
190
+ _reactnativereanimated.withTiming.call(void 0, 0, { duration: 400, easing: _reactnativereanimated.Easing.linear }),
191
+ _reactnativereanimated.withTiming.call(void 0, 0.836714, {
192
+ duration: 783,
193
+ easing: _reactnativereanimated.Easing.bezier(0.5, 0, 0.701732, 0.495819)
194
+ }),
195
+ _reactnativereanimated.withTiming.call(void 0, 2.00611, {
196
+ duration: 817,
197
+ easing: _reactnativereanimated.Easing.bezier(0.302435, 0.381352, 0.55, 0.956352)
198
+ })
199
+ ),
200
+ -1,
201
+ false
202
+ );
203
+ primaryScaleX.value = _reactnativereanimated.withRepeat.call(void 0,
204
+ _reactnativereanimated.withSequence.call(void 0,
205
+ _reactnativereanimated.withTiming.call(void 0, 0.08, { duration: 0 }),
206
+ _reactnativereanimated.withTiming.call(void 0, 0.08, { duration: 733, easing: _reactnativereanimated.Easing.linear }),
207
+ _reactnativereanimated.withTiming.call(void 0, 0.661479, {
208
+ duration: 650,
209
+ easing: _reactnativereanimated.Easing.bezier(0.334731, 0.12482, 0.785844, 1)
210
+ }),
211
+ _reactnativereanimated.withTiming.call(void 0, 0.08, {
212
+ duration: 617,
213
+ easing: _reactnativereanimated.Easing.bezier(0.06, 0.11, 0.6, 1)
214
+ })
215
+ ),
216
+ -1,
217
+ false
218
+ );
219
+ secondaryTranslateX.value = _reactnativereanimated.withRepeat.call(void 0,
220
+ _reactnativereanimated.withSequence.call(void 0,
221
+ _reactnativereanimated.withTiming.call(void 0, 0, { duration: 0 }),
222
+ _reactnativereanimated.withTiming.call(void 0, 0.376519, {
223
+ duration: 500,
224
+ easing: _reactnativereanimated.Easing.bezier(0.15, 0, 0.515058, 0.409685)
225
+ }),
226
+ _reactnativereanimated.withTiming.call(void 0, 0.843862, {
227
+ duration: 467,
228
+ easing: _reactnativereanimated.Easing.bezier(0.31033, 0.284058, 0.8, 0.733712)
229
+ }),
230
+ _reactnativereanimated.withTiming.call(void 0, 1.60278, {
231
+ duration: 1033,
232
+ easing: _reactnativereanimated.Easing.bezier(0.4, 0.627035, 0.6, 0.902026)
233
+ })
234
+ ),
235
+ -1,
236
+ false
237
+ );
238
+ secondaryScaleX.value = _reactnativereanimated.withRepeat.call(void 0,
239
+ _reactnativereanimated.withSequence.call(void 0,
240
+ _reactnativereanimated.withTiming.call(void 0, 0.08, { duration: 0 }),
241
+ _reactnativereanimated.withTiming.call(void 0, 0.457104, {
242
+ duration: 383,
243
+ easing: _reactnativereanimated.Easing.bezier(0.205028, 0.057051, 0.57661, 0.453971)
244
+ }),
245
+ _reactnativereanimated.withTiming.call(void 0, 0.72796, {
246
+ duration: 500,
247
+ easing: _reactnativereanimated.Easing.bezier(0.152313, 0.196432, 0.648374, 1.00432)
248
+ }),
249
+ _reactnativereanimated.withTiming.call(void 0, 0.08, {
250
+ duration: 1117,
251
+ easing: _reactnativereanimated.Easing.bezier(0.257759, -3163e-6, 0.211762, 1.38179)
252
+ })
253
+ ),
254
+ -1,
255
+ false
256
+ );
257
+ return () => {
258
+ _reactnativereanimated.cancelAnimation.call(void 0, primaryTranslateX);
259
+ _reactnativereanimated.cancelAnimation.call(void 0, primaryScaleX);
260
+ _reactnativereanimated.cancelAnimation.call(void 0, secondaryTranslateX);
261
+ _reactnativereanimated.cancelAnimation.call(void 0, secondaryScaleX);
262
+ };
263
+ }, [disableAnimation]);
264
+ return {
265
+ primaryTranslateX,
266
+ primaryScaleX,
267
+ secondaryTranslateX,
268
+ secondaryScaleX
269
+ };
270
+ };
271
+
272
+ // src/components/indicator/linear-activity-indicator.tsx
273
+ var LinearActivityIndicator = ({
274
+ size = 4,
275
+ themeColor = "primary",
276
+ color,
277
+ backgroundColor,
278
+ disableAnimation = false,
279
+ borderRadius = 0,
280
+ showTrack = true
281
+ }) => {
282
+ const theme = _chunkOQ2BLOOGcjs.useXUITheme.call(void 0, );
283
+ const { primaryTranslateX, primaryScaleX, secondaryTranslateX, secondaryScaleX } = useLinearActivityIndicatorAnimation(disableAnimation);
284
+ const colorScheme = theme.colors[themeColor];
285
+ const mainColor = color || colorScheme.main;
286
+ const trackColor = showTrack ? _nullishCoalesce(backgroundColor, () => ( colorScheme.background)) : "transparent";
287
+ const barStyle = {
288
+ ..._reactnative.StyleSheet.absoluteFillObject,
289
+ backgroundColor: mainColor,
290
+ borderRadius
291
+ };
292
+ const primaryStyle = _reactnativereanimated.useAnimatedStyle.call(void 0, () => ({
293
+ transform: [
294
+ { translateX: `${(primaryTranslateX.value - 1.45167) * 100}%` },
295
+ { scaleX: primaryScaleX.value }
296
+ ]
297
+ }));
298
+ const secondaryStyle = _reactnativereanimated.useAnimatedStyle.call(void 0, () => ({
299
+ transform: [
300
+ { translateX: `${(secondaryTranslateX.value - 0.548889) * 100}%` },
301
+ { scaleX: secondaryScaleX.value }
302
+ ]
303
+ }));
304
+ return /* @__PURE__ */ _react2.default.createElement(
305
+ _reactnative.View,
306
+ {
307
+ style: {
308
+ height: size,
309
+ width: "100%",
310
+ borderRadius,
311
+ backgroundColor: trackColor,
312
+ overflow: "hidden"
313
+ }
314
+ },
315
+ /* @__PURE__ */ _react2.default.createElement(_reactnativereanimated2.default.View, { style: [barStyle, primaryStyle] }),
316
+ /* @__PURE__ */ _react2.default.createElement(_reactnativereanimated2.default.View, { style: [barStyle, secondaryStyle] })
317
+ );
318
+ };
319
+
320
+ // src/components/indicator/indicator.tsx
321
+ var ActivityIndicator = (props) => {
322
+ const {
323
+ variant = "circular",
324
+ themeColor = "primary",
325
+ color,
326
+ backgroundColor,
327
+ size,
328
+ disableAnimation = false,
329
+ borderRadius,
330
+ showTrack
331
+ } = props;
332
+ const theme = _chunkOQ2BLOOGcjs.useXUITheme.call(void 0, );
333
+ const colorScheme = theme.colors[themeColor];
334
+ const mainColor = _nullishCoalesce(color, () => ( colorScheme.main));
335
+ const trackColor = _nullishCoalesce(backgroundColor, () => ( (showTrack ? colorScheme.background : "transparent")));
336
+ if (variant === "circular") {
337
+ const circleSize = _nullishCoalesce(size, () => ( 40));
338
+ return /* @__PURE__ */ _react2.default.createElement(
339
+ _reactnative.View,
340
+ {
341
+ style: [styles.container, { width: circleSize, height: circleSize }],
342
+ accessible: true,
343
+ accessibilityRole: "progressbar",
344
+ accessibilityLabel: "Loading"
345
+ },
346
+ /* @__PURE__ */ _react2.default.createElement(
347
+ CircularActivityIndicator,
348
+ {
349
+ size: circleSize,
350
+ themeColor,
351
+ color: mainColor,
352
+ backgroundColor: trackColor,
353
+ disableAnimation
354
+ }
355
+ )
356
+ );
357
+ }
358
+ const linearSize = _nullishCoalesce(size, () => ( 4));
359
+ return /* @__PURE__ */ _react2.default.createElement(
360
+ _reactnative.View,
361
+ {
362
+ style: styles.container,
363
+ accessible: true,
364
+ accessibilityRole: "progressbar",
365
+ accessibilityLabel: "Loading"
366
+ },
367
+ /* @__PURE__ */ _react2.default.createElement(
368
+ LinearActivityIndicator,
369
+ {
370
+ size: linearSize,
371
+ themeColor,
372
+ color: mainColor,
373
+ backgroundColor: trackColor,
374
+ disableAnimation,
375
+ borderRadius,
376
+ showTrack
377
+ }
378
+ )
379
+ );
380
+ };
381
+
382
+
383
+
384
+ exports.ActivityIndicator = ActivityIndicator;