@xaui/native 0.0.26 → 0.0.28

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (107) 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 +59 -127
  68. package/dist/menu/index.js +2 -2
  69. package/dist/menubox/index.cjs +60 -132
  70. package/dist/menubox/index.js +2 -1
  71. package/dist/pager/index.cjs +42 -80
  72. package/dist/progress/index.cjs +43 -114
  73. package/dist/progress/index.js +2 -1
  74. package/dist/radio/index.cjs +82 -154
  75. package/dist/radio/index.js +2 -1
  76. package/dist/segment-button/index.cjs +60 -147
  77. package/dist/segment-button/index.js +2 -2
  78. package/dist/select/index.cjs +149 -224
  79. package/dist/select/index.js +10 -22
  80. package/dist/skeleton/index.cjs +23 -94
  81. package/dist/skeleton/index.js +2 -2
  82. package/dist/slider/index.cjs +77 -156
  83. package/dist/slider/index.js +2 -1
  84. package/dist/snackbar/index.cjs +420 -0
  85. package/dist/snackbar/index.d.cts +175 -0
  86. package/dist/snackbar/index.d.ts +175 -0
  87. package/dist/snackbar/index.js +420 -0
  88. package/dist/stepper/index.cjs +121 -195
  89. package/dist/stepper/index.js +2 -1
  90. package/dist/switch/index.cjs +48 -121
  91. package/dist/switch/index.js +2 -1
  92. package/dist/tabs/index.cjs +67 -151
  93. package/dist/tabs/index.js +2 -1
  94. package/dist/timepicker/index.cjs +135 -593
  95. package/dist/timepicker/index.js +24 -383
  96. package/dist/toolbar/index.cjs +59 -128
  97. package/dist/toolbar/index.js +2 -1
  98. package/dist/typography/index.cjs +37 -92
  99. package/dist/typography/index.d.cts +1 -1
  100. package/dist/typography/index.d.ts +1 -1
  101. package/dist/typography/index.js +20 -1
  102. package/dist/view/index.cjs +178 -223
  103. package/package.json +7 -1
  104. package/dist/chunk-3XSXTM3G.js +0 -661
  105. package/dist/chunk-4KSZLONZ.js +0 -79
  106. package/dist/chunk-I4V5Y5GD.js +0 -76
  107. package/dist/chunk-URBEEDFX.js +0 -79
@@ -1,95 +1,23 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }require('../chunk-HSPTLUFA.cjs');
29
2
 
30
- // src/components/switch/index.ts
31
- var switch_exports = {};
32
- __export(switch_exports, {
33
- Switch: () => Switch
34
- });
35
- module.exports = __toCommonJS(switch_exports);
3
+
4
+ var _chunkOQ2BLOOGcjs = require('../chunk-OQ2BLOOG.cjs');
36
5
 
37
6
  // src/components/switch/switch.tsx
38
- var import_react7 = __toESM(require("react"), 1);
39
- var import_react_native6 = require("react-native");
7
+ var _react = require('react'); var _react2 = _interopRequireDefault(_react);
8
+ var _reactnative = require('react-native');
40
9
 
41
10
  // src/components/switch/switch.hook.ts
42
- var import_react6 = require("react");
43
- var import_core = require("@xaui/core");
44
-
45
- // src/core/theme-context.tsx
46
- var import_react4 = __toESM(require("react"), 1);
47
- var import_react_native2 = require("react-native");
48
- var import_theme = require("@xaui/core/theme");
49
- var import_palette = require("@xaui/core/palette");
50
-
51
- // src/core/portal/portal.tsx
52
- var import_react2 = require("react");
53
-
54
- // src/core/portal/portal-context.ts
55
- var import_react = require("react");
56
- var PortalContext = (0, import_react.createContext)(null);
57
-
58
- // src/core/portal/portal-host.tsx
59
- var import_react3 = __toESM(require("react"), 1);
60
- var import_react_native = require("react-native");
61
- var hostStyles = import_react_native.StyleSheet.create({
62
- container: {
63
- flex: 1
64
- }
65
- });
66
-
67
- // src/core/theme-context.tsx
68
- var XUIThemeContext = (0, import_react4.createContext)(null);
69
-
70
- // src/core/theme-hooks.ts
71
- var import_react5 = require("react");
72
- var import_react_native3 = require("react-native");
73
- function useXUITheme() {
74
- const theme = (0, import_react5.useContext)(XUIThemeContext);
75
- if (!theme) {
76
- throw new Error("useXUITheme must be used within XUIProvider");
77
- }
78
- return theme;
79
- }
80
-
81
- // src/core/index.ts
82
- var import_theme2 = require("@xaui/core/theme");
83
11
 
84
- // src/components/switch/switch.hook.ts
12
+ var _core = require('@xaui/core');
85
13
  var useSwitchColorScheme = (themeColor) => {
86
- const theme = useXUITheme();
87
- const safeThemeColor = (0, import_core.getSafeThemeColor)(themeColor);
14
+ const theme = _chunkOQ2BLOOGcjs.useXUITheme.call(void 0, );
15
+ const safeThemeColor = _core.getSafeThemeColor.call(void 0, themeColor);
88
16
  return theme.colors[safeThemeColor];
89
17
  };
90
18
  var useSwitchSizeStyles = (variant, size) => {
91
- const theme = useXUITheme();
92
- const sizeStyles = (0, import_react6.useMemo)(() => {
19
+ const theme = _chunkOQ2BLOOGcjs.useXUITheme.call(void 0, );
20
+ const sizeStyles = _react.useMemo.call(void 0, () => {
93
21
  if (variant === "overlap") {
94
22
  const sizes2 = {
95
23
  sm: {
@@ -144,8 +72,8 @@ var useSwitchSizeStyles = (variant, size) => {
144
72
  return sizeStyles;
145
73
  };
146
74
  var useSwitchRadiusStyles = (radius) => {
147
- const theme = useXUITheme();
148
- const radiusStyles = (0, import_react6.useMemo)(() => {
75
+ const theme = _chunkOQ2BLOOGcjs.useXUITheme.call(void 0, );
76
+ const radiusStyles = _react.useMemo.call(void 0, () => {
149
77
  const radii = {
150
78
  none: theme.borderRadius.none,
151
79
  sm: theme.borderRadius.sm,
@@ -155,7 +83,7 @@ var useSwitchRadiusStyles = (radius) => {
155
83
  };
156
84
  return { borderRadius: radii[radius] };
157
85
  }, [radius, theme]);
158
- const thumbRadius = (0, import_react6.useMemo)(() => {
86
+ const thumbRadius = _react.useMemo.call(void 0, () => {
159
87
  const radii = {
160
88
  none: theme.borderRadius.none,
161
89
  sm: theme.borderRadius.sm,
@@ -174,8 +102,8 @@ var useSwitchTrackStyles = ({
174
102
  sizeStyles,
175
103
  radiusStyles
176
104
  }) => {
177
- const theme = useXUITheme();
178
- const trackStyles = (0, import_react6.useMemo)(() => {
105
+ const theme = _chunkOQ2BLOOGcjs.useXUITheme.call(void 0, );
106
+ const trackStyles = _react.useMemo.call(void 0, () => {
179
107
  const backgroundColor = isSelected ? variant === "overlap" ? colorScheme.background : colorScheme.main : theme.colors.default.background;
180
108
  return {
181
109
  width: sizeStyles.trackWidth,
@@ -194,8 +122,8 @@ var useSwitchThumbStyles = ({
194
122
  sizeStyles,
195
123
  thumbRadius
196
124
  }) => {
197
- const theme = useXUITheme();
198
- const thumbStyles = (0, import_react6.useMemo)(() => {
125
+ const theme = _chunkOQ2BLOOGcjs.useXUITheme.call(void 0, );
126
+ const thumbStyles = _react.useMemo.call(void 0, () => {
199
127
  const baseStyle = {
200
128
  width: sizeStyles.thumbSize,
201
129
  height: sizeStyles.thumbSize,
@@ -211,7 +139,7 @@ var useSwitchThumbStyles = ({
211
139
  return thumbStyles;
212
140
  };
213
141
  var useSwitchContainerStyles = (labelAlignment) => {
214
- const containerStyles = (0, import_react6.useMemo)(() => {
142
+ const containerStyles = _react.useMemo.call(void 0, () => {
215
143
  const isJustified = labelAlignment === "justify-left" || labelAlignment === "justify-right";
216
144
  return {
217
145
  flexDirection: labelAlignment === "left" || labelAlignment === "justify-left" ? "row-reverse" : "row",
@@ -222,9 +150,9 @@ var useSwitchContainerStyles = (labelAlignment) => {
222
150
  };
223
151
 
224
152
  // src/components/switch/switch.animation.ts
225
- var import_react_native4 = require("react-native");
153
+
226
154
  var runThumbPositionAnimation = (thumbPosition, isSelected) => {
227
- import_react_native4.Animated.spring(thumbPosition, {
155
+ _reactnative.Animated.spring(thumbPosition, {
228
156
  toValue: isSelected ? 1 : 0,
229
157
  useNativeDriver: true,
230
158
  damping: 15,
@@ -232,24 +160,24 @@ var runThumbPositionAnimation = (thumbPosition, isSelected) => {
232
160
  }).start();
233
161
  };
234
162
  var runSwitchPressInAnimation = (animatedScale, animatedThumbScale, isOverlap) => {
235
- import_react_native4.Animated.parallel([
236
- import_react_native4.Animated.spring(animatedScale, {
163
+ _reactnative.Animated.parallel([
164
+ _reactnative.Animated.spring(animatedScale, {
237
165
  toValue: 0.95,
238
166
  useNativeDriver: true
239
167
  }),
240
- import_react_native4.Animated.spring(animatedThumbScale, {
168
+ _reactnative.Animated.spring(animatedThumbScale, {
241
169
  toValue: isOverlap ? 1.1 : 1.2,
242
170
  useNativeDriver: true
243
171
  })
244
172
  ]).start();
245
173
  };
246
174
  var runSwitchPressOutAnimation = (animatedScale, animatedThumbScale) => {
247
- import_react_native4.Animated.parallel([
248
- import_react_native4.Animated.spring(animatedScale, {
175
+ _reactnative.Animated.parallel([
176
+ _reactnative.Animated.spring(animatedScale, {
249
177
  toValue: 1,
250
178
  useNativeDriver: true
251
179
  }),
252
- import_react_native4.Animated.spring(animatedThumbScale, {
180
+ _reactnative.Animated.spring(animatedThumbScale, {
253
181
  toValue: 1,
254
182
  useNativeDriver: true
255
183
  })
@@ -257,8 +185,8 @@ var runSwitchPressOutAnimation = (animatedScale, animatedThumbScale) => {
257
185
  };
258
186
 
259
187
  // src/components/switch/switch.style.ts
260
- var import_react_native5 = require("react-native");
261
- var styles = import_react_native5.StyleSheet.create({
188
+
189
+ var styles = _reactnative.StyleSheet.create({
262
190
  container: {
263
191
  flexDirection: "row",
264
192
  alignItems: "center",
@@ -308,13 +236,13 @@ var Switch = ({
308
236
  style,
309
237
  onValueChange
310
238
  }) => {
311
- const theme = useXUITheme();
239
+ const theme = _chunkOQ2BLOOGcjs.useXUITheme.call(void 0, );
312
240
  const isControlled = typeof isSelectedProp === "boolean";
313
- const [internalSelected, setInternalSelected] = (0, import_react7.useState)(isSelectedProp ?? false);
241
+ const [internalSelected, setInternalSelected] = _react.useState.call(void 0, _nullishCoalesce(isSelectedProp, () => ( false)));
314
242
  const isSelected = isControlled ? isSelectedProp : internalSelected;
315
- const scale = (0, import_react7.useRef)(new import_react_native6.Animated.Value(1)).current;
316
- const thumbPosition = (0, import_react7.useRef)(new import_react_native6.Animated.Value(isSelected ? 1 : 0)).current;
317
- const thumbScale = (0, import_react7.useRef)(new import_react_native6.Animated.Value(1)).current;
243
+ const scale = _react.useRef.call(void 0, new _reactnative.Animated.Value(1)).current;
244
+ const thumbPosition = _react.useRef.call(void 0, new _reactnative.Animated.Value(isSelected ? 1 : 0)).current;
245
+ const thumbScale = _react.useRef.call(void 0, new _reactnative.Animated.Value(1)).current;
318
246
  const colorScheme = useSwitchColorScheme(themeColor);
319
247
  const sizeStyles = useSwitchSizeStyles(variant, size);
320
248
  const { radiusStyles, thumbRadius } = useSwitchRadiusStyles(radius);
@@ -333,26 +261,26 @@ var Switch = ({
333
261
  thumbRadius
334
262
  });
335
263
  const containerStyles = useSwitchContainerStyles(labelAlignment);
336
- const maxTranslateX = (0, import_react7.useMemo)(() => {
264
+ const maxTranslateX = _react.useMemo.call(void 0, () => {
337
265
  if (variant === "overlap") {
338
266
  return sizeStyles.trackWidth - sizeStyles.thumbSize;
339
267
  }
340
268
  return sizeStyles.trackWidth - sizeStyles.thumbSize - sizeStyles.padding * 2;
341
269
  }, [sizeStyles, variant]);
342
- const translateX = (0, import_react7.useMemo)(
270
+ const translateX = _react.useMemo.call(void 0,
343
271
  () => thumbPosition.interpolate({
344
272
  inputRange: [0, 1],
345
273
  outputRange: [0, maxTranslateX]
346
274
  }),
347
275
  [maxTranslateX, thumbPosition]
348
276
  );
349
- (0, import_react7.useEffect)(() => {
277
+ _react.useEffect.call(void 0, () => {
350
278
  runThumbPositionAnimation(thumbPosition, isSelected);
351
279
  }, [isSelected, thumbPosition]);
352
280
  const handlePress = () => {
353
281
  if (isDisabled) return;
354
282
  const nextValue = !isSelected;
355
- onValueChange?.(nextValue);
283
+ _optionalChain([onValueChange, 'optionalCall', _ => _(nextValue)]);
356
284
  if (!isControlled) {
357
285
  setInternalSelected(nextValue);
358
286
  }
@@ -365,8 +293,8 @@ var Switch = ({
365
293
  if (isDisabled) return;
366
294
  runSwitchPressOutAnimation(scale, thumbScale);
367
295
  };
368
- return /* @__PURE__ */ import_react7.default.createElement(
369
- import_react_native6.Pressable,
296
+ return /* @__PURE__ */ _react2.default.createElement(
297
+ _reactnative.Pressable,
370
298
  {
371
299
  onPress: handlePress,
372
300
  onPressIn: handlePressIn,
@@ -387,8 +315,8 @@ var Switch = ({
387
315
  style
388
316
  ]
389
317
  },
390
- /* @__PURE__ */ import_react7.default.createElement(
391
- import_react_native6.Animated.View,
318
+ /* @__PURE__ */ _react2.default.createElement(
319
+ _reactnative.Animated.View,
392
320
  {
393
321
  style: [
394
322
  styles.track,
@@ -398,8 +326,8 @@ var Switch = ({
398
326
  }
399
327
  ]
400
328
  },
401
- /* @__PURE__ */ import_react7.default.createElement(import_react_native6.View, { style: styles.thumbContainer }, /* @__PURE__ */ import_react7.default.createElement(
402
- import_react_native6.Animated.View,
329
+ /* @__PURE__ */ _react2.default.createElement(_reactnative.View, { style: styles.thumbContainer }, /* @__PURE__ */ _react2.default.createElement(
330
+ _reactnative.Animated.View,
403
331
  {
404
332
  style: [
405
333
  styles.thumb,
@@ -411,8 +339,8 @@ var Switch = ({
411
339
  }
412
340
  ))
413
341
  ),
414
- label && /* @__PURE__ */ import_react7.default.createElement(
415
- import_react_native6.Text,
342
+ label && /* @__PURE__ */ _react2.default.createElement(
343
+ _reactnative.Text,
416
344
  {
417
345
  style: [
418
346
  styles.label,
@@ -425,7 +353,6 @@ var Switch = ({
425
353
  )
426
354
  );
427
355
  };
428
- // Annotate the CommonJS export names for ESM import in node:
429
- 0 && (module.exports = {
430
- Switch
431
- });
356
+
357
+
358
+ exports.Switch = Switch;
@@ -1,6 +1,7 @@
1
+ import "../chunk-DXXNBF5P.js";
1
2
  import {
2
3
  useXUITheme
3
- } from "../chunk-GHCVNQET.js";
4
+ } from "../chunk-LTKYHG5V.js";
4
5
 
5
6
  // src/components/switch/switch.tsx
6
7
  import React, { useEffect, useMemo as useMemo2, useRef, useState } from "react";