@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
@@ -1,51 +1,19 @@
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/menubox/index.ts
31
- var menubox_exports = {};
32
- __export(menubox_exports, {
33
- MenuBox: () => MenuBox,
34
- MenuBoxItem: () => MenuBoxItem
35
- });
36
- module.exports = __toCommonJS(menubox_exports);
3
+
4
+ var _chunkOQ2BLOOGcjs = require('../chunk-OQ2BLOOG.cjs');
37
5
 
38
6
  // src/components/menubox/menubox.tsx
39
- var import_react7 = __toESM(require("react"), 1);
40
- var import_react_native5 = require("react-native");
7
+ var _react = require('react'); var _react2 = _interopRequireDefault(_react);
8
+ var _reactnative = require('react-native');
41
9
 
42
10
  // src/components/menubox/menubox-context.ts
43
- var import_react = require("react");
44
- var MenuBoxContext = (0, import_react.createContext)(null);
11
+
12
+ var MenuBoxContext = _react.createContext.call(void 0, null);
45
13
 
46
14
  // src/components/menubox/menubox.style.ts
47
- var import_react_native = require("react-native");
48
- var styles = import_react_native.StyleSheet.create({
15
+
16
+ var styles = _reactnative.StyleSheet.create({
49
17
  container: {
50
18
  overflow: "hidden"
51
19
  },
@@ -73,45 +41,6 @@ var styles = import_react_native.StyleSheet.create({
73
41
  }
74
42
  });
75
43
 
76
- // src/core/theme-context.tsx
77
- var import_react5 = __toESM(require("react"), 1);
78
- var import_react_native3 = require("react-native");
79
- var import_theme = require("@xaui/core/theme");
80
- var import_palette = require("@xaui/core/palette");
81
-
82
- // src/core/portal/portal.tsx
83
- var import_react3 = require("react");
84
-
85
- // src/core/portal/portal-context.ts
86
- var import_react2 = require("react");
87
- var PortalContext = (0, import_react2.createContext)(null);
88
-
89
- // src/core/portal/portal-host.tsx
90
- var import_react4 = __toESM(require("react"), 1);
91
- var import_react_native2 = require("react-native");
92
- var hostStyles = import_react_native2.StyleSheet.create({
93
- container: {
94
- flex: 1
95
- }
96
- });
97
-
98
- // src/core/theme-context.tsx
99
- var XUIThemeContext = (0, import_react5.createContext)(null);
100
-
101
- // src/core/theme-hooks.ts
102
- var import_react6 = require("react");
103
- var import_react_native4 = require("react-native");
104
- function useXUITheme() {
105
- const theme = (0, import_react6.useContext)(XUIThemeContext);
106
- if (!theme) {
107
- throw new Error("useXUITheme must be used within XUIProvider");
108
- }
109
- return theme;
110
- }
111
-
112
- // src/core/index.ts
113
- var import_theme2 = require("@xaui/core/theme");
114
-
115
44
  // src/components/menubox/menubox.tsx
116
45
  var MenuBox = ({
117
46
  children,
@@ -122,12 +51,12 @@ var MenuBox = ({
122
51
  style,
123
52
  backgroundColor
124
53
  }) => {
125
- const theme = useXUITheme();
126
- const itemCount = import_react7.Children.count(children);
127
- const itemKeys = (0, import_react7.useMemo)(() => {
54
+ const theme = _chunkOQ2BLOOGcjs.useXUITheme.call(void 0, );
55
+ const itemCount = _react.Children.count(children);
56
+ const itemKeys = _react.useMemo.call(void 0, () => {
128
57
  const keys = [];
129
- import_react7.Children.forEach(children, (child) => {
130
- if ((0, import_react7.isValidElement)(child)) {
58
+ _react.Children.forEach(children, (child) => {
59
+ if (_react.isValidElement.call(void 0, child)) {
131
60
  const props = child.props;
132
61
  if (props.itemKey) {
133
62
  keys.push(props.itemKey);
@@ -139,8 +68,8 @@ var MenuBox = ({
139
68
  const getItemIndex = (itemKey) => {
140
69
  return itemKeys.indexOf(itemKey);
141
70
  };
142
- const bgColor = backgroundColor ?? theme.colors.default.background;
143
- const contextValue = (0, import_react7.useMemo)(
71
+ const bgColor = _nullishCoalesce(backgroundColor, () => ( theme.colors.default.background));
72
+ const contextValue = _react.useMemo.call(void 0,
144
73
  () => ({
145
74
  size,
146
75
  radius,
@@ -152,18 +81,18 @@ var MenuBox = ({
152
81
  }),
153
82
  [size, radius, themeColor, bgColor, itemCount, spacing, getItemIndex]
154
83
  );
155
- return /* @__PURE__ */ import_react7.default.createElement(MenuBoxContext.Provider, { value: contextValue }, /* @__PURE__ */ import_react7.default.createElement(import_react_native5.View, { style: [styles.container, style] }, children));
84
+ return /* @__PURE__ */ _react2.default.createElement(MenuBoxContext.Provider, { value: contextValue }, /* @__PURE__ */ _react2.default.createElement(_reactnative.View, { style: [styles.container, style] }, children));
156
85
  };
157
86
 
158
87
  // src/components/menubox/menubox-item.tsx
159
- var import_react9 = __toESM(require("react"), 1);
160
- var import_react_native7 = require("react-native");
88
+
89
+
161
90
 
162
91
  // src/components/menubox/menubox.hook.ts
163
- var import_react8 = require("react");
92
+
164
93
  var useMenuBoxItemSizeStyles = (size) => {
165
- const theme = useXUITheme();
166
- return (0, import_react8.useMemo)(() => {
94
+ const theme = _chunkOQ2BLOOGcjs.useXUITheme.call(void 0, );
95
+ return _react.useMemo.call(void 0, () => {
167
96
  const sizes = {
168
97
  xs: {
169
98
  paddingVertical: theme.spacing.sm,
@@ -194,8 +123,8 @@ var useMenuBoxItemSizeStyles = (size) => {
194
123
  }, [size, theme]);
195
124
  };
196
125
  var useMenuBoxRadiusStyles = (radius, isFirst, isLast) => {
197
- const theme = useXUITheme();
198
- return (0, import_react8.useMemo)(() => {
126
+ const theme = _chunkOQ2BLOOGcjs.useXUITheme.call(void 0, );
127
+ return _react.useMemo.call(void 0, () => {
199
128
  const radiusMap = {
200
129
  none: theme.borderRadius.none,
201
130
  sm: theme.borderRadius.md,
@@ -214,16 +143,16 @@ var useMenuBoxRadiusStyles = (radius, isFirst, isLast) => {
214
143
  };
215
144
 
216
145
  // src/components/menubox/menubox.animation.ts
217
- var import_react_native6 = require("react-native");
146
+
218
147
  var runMenuBoxPressInAnimation = (animatedScale, animatedOpacity) => {
219
- import_react_native6.Animated.parallel([
220
- import_react_native6.Animated.spring(animatedScale, {
148
+ _reactnative.Animated.parallel([
149
+ _reactnative.Animated.spring(animatedScale, {
221
150
  toValue: 0.99,
222
151
  useNativeDriver: true,
223
152
  speed: 50,
224
153
  bounciness: 0
225
154
  }),
226
- import_react_native6.Animated.timing(animatedOpacity, {
155
+ _reactnative.Animated.timing(animatedOpacity, {
227
156
  toValue: 0.8,
228
157
  duration: 100,
229
158
  useNativeDriver: true
@@ -231,14 +160,14 @@ var runMenuBoxPressInAnimation = (animatedScale, animatedOpacity) => {
231
160
  ]).start();
232
161
  };
233
162
  var runMenuBoxPressOutAnimation = (animatedScale, animatedOpacity) => {
234
- import_react_native6.Animated.parallel([
235
- import_react_native6.Animated.spring(animatedScale, {
163
+ _reactnative.Animated.parallel([
164
+ _reactnative.Animated.spring(animatedScale, {
236
165
  toValue: 1,
237
166
  useNativeDriver: true,
238
167
  speed: 50,
239
168
  bounciness: 0
240
169
  }),
241
- import_react_native6.Animated.timing(animatedOpacity, {
170
+ _reactnative.Animated.timing(animatedOpacity, {
242
171
  toValue: 1,
243
172
  duration: 100,
244
173
  useNativeDriver: true
@@ -248,10 +177,10 @@ var runMenuBoxPressOutAnimation = (animatedScale, animatedOpacity) => {
248
177
 
249
178
  // src/components/menubox/menubox-item.tsx
250
179
  var MenuBoxItem = (props) => {
251
- const context = (0, import_react9.useContext)(MenuBoxContext);
252
- const theme = useXUITheme();
253
- const animatedScale = import_react9.default.useRef(new import_react_native7.Animated.Value(1)).current;
254
- const animatedOpacity = import_react9.default.useRef(new import_react_native7.Animated.Value(1)).current;
180
+ const context = _react.useContext.call(void 0, MenuBoxContext);
181
+ const theme = _chunkOQ2BLOOGcjs.useXUITheme.call(void 0, );
182
+ const animatedScale = _react2.default.useRef(new _reactnative.Animated.Value(1)).current;
183
+ const animatedOpacity = _react2.default.useRef(new _reactnative.Animated.Value(1)).current;
255
184
  const {
256
185
  itemKey,
257
186
  title,
@@ -262,12 +191,12 @@ var MenuBoxItem = (props) => {
262
191
  customAppearance,
263
192
  onPress
264
193
  } = props;
265
- const size = context?.size ?? "md";
266
- const radius = context?.radius ?? "lg";
267
- const itemBackgroundColor = context?.backgroundColor ?? (theme.mode === "dark" ? theme.colors.default.background : theme.colors.background);
268
- const spacing = context?.spacing ?? 0;
269
- const itemCount = context?.itemCount ?? 1;
270
- const index = context?.getItemIndex(itemKey) ?? 0;
194
+ const size = _nullishCoalesce(_optionalChain([context, 'optionalAccess', _ => _.size]), () => ( "md"));
195
+ const radius = _nullishCoalesce(_optionalChain([context, 'optionalAccess', _2 => _2.radius]), () => ( "lg"));
196
+ const itemBackgroundColor = _nullishCoalesce(_optionalChain([context, 'optionalAccess', _3 => _3.backgroundColor]), () => ( (theme.mode === "dark" ? theme.colors.default.background : theme.colors.background)));
197
+ const spacing = _nullishCoalesce(_optionalChain([context, 'optionalAccess', _4 => _4.spacing]), () => ( 0));
198
+ const itemCount = _nullishCoalesce(_optionalChain([context, 'optionalAccess', _5 => _5.itemCount]), () => ( 1));
199
+ const index = _nullishCoalesce(_optionalChain([context, 'optionalAccess', _6 => _6.getItemIndex, 'call', _7 => _7(itemKey)]), () => ( 0));
271
200
  const isFirst = index === 0;
272
201
  const isLast = index === itemCount - 1;
273
202
  const sizeStyles = useMenuBoxItemSizeStyles(size);
@@ -278,7 +207,7 @@ var MenuBoxItem = (props) => {
278
207
  if (isDisabled) {
279
208
  return;
280
209
  }
281
- onPress?.({});
210
+ _optionalChain([onPress, 'optionalCall', _8 => _8({})]);
282
211
  };
283
212
  const handlePressIn = () => {
284
213
  if (!isDisabled) {
@@ -292,13 +221,13 @@ var MenuBoxItem = (props) => {
292
221
  };
293
222
  const renderTitle = () => {
294
223
  if (typeof title === "string" || typeof title === "number") {
295
- return /* @__PURE__ */ import_react9.default.createElement(
296
- import_react_native7.Text,
224
+ return /* @__PURE__ */ _react2.default.createElement(
225
+ _reactnative.Text,
297
226
  {
298
227
  style: [
299
228
  styles.title,
300
229
  { fontSize: sizeStyles.titleSize, color: titleColor },
301
- customAppearance?.title
230
+ _optionalChain([customAppearance, 'optionalAccess', _9 => _9.title])
302
231
  ],
303
232
  numberOfLines: 1
304
233
  },
@@ -310,13 +239,13 @@ var MenuBoxItem = (props) => {
310
239
  const renderDescription = () => {
311
240
  if (!description) return null;
312
241
  if (typeof description === "string" || typeof description === "number") {
313
- return /* @__PURE__ */ import_react9.default.createElement(
314
- import_react_native7.Text,
242
+ return /* @__PURE__ */ _react2.default.createElement(
243
+ _reactnative.Text,
315
244
  {
316
245
  style: [
317
246
  styles.description,
318
247
  { fontSize: sizeStyles.descriptionSize, color: descriptionColor },
319
- customAppearance?.description
248
+ _optionalChain([customAppearance, 'optionalAccess', _10 => _10.description])
320
249
  ],
321
250
  numberOfLines: 1
322
251
  },
@@ -325,8 +254,8 @@ var MenuBoxItem = (props) => {
325
254
  }
326
255
  return description;
327
256
  };
328
- const content = /* @__PURE__ */ import_react9.default.createElement(
329
- import_react_native7.Animated.View,
257
+ const content = /* @__PURE__ */ _react2.default.createElement(
258
+ _reactnative.Animated.View,
330
259
  {
331
260
  style: [
332
261
  styles.item,
@@ -339,15 +268,15 @@ var MenuBoxItem = (props) => {
339
268
  },
340
269
  radiusStyles,
341
270
  isDisabled && styles.disabled,
342
- customAppearance?.container
271
+ _optionalChain([customAppearance, 'optionalAccess', _11 => _11.container])
343
272
  ]
344
273
  },
345
- startContent && /* @__PURE__ */ import_react9.default.createElement(import_react_native7.View, { style: customAppearance?.content }, startContent),
346
- /* @__PURE__ */ import_react9.default.createElement(import_react_native7.View, { style: [styles.content, customAppearance?.content] }, renderTitle(), renderDescription()),
347
- endContent && /* @__PURE__ */ import_react9.default.createElement(import_react_native7.View, { style: customAppearance?.content }, endContent)
274
+ startContent && /* @__PURE__ */ _react2.default.createElement(_reactnative.View, { style: _optionalChain([customAppearance, 'optionalAccess', _12 => _12.content]) }, startContent),
275
+ /* @__PURE__ */ _react2.default.createElement(_reactnative.View, { style: [styles.content, _optionalChain([customAppearance, 'optionalAccess', _13 => _13.content])] }, renderTitle(), renderDescription()),
276
+ endContent && /* @__PURE__ */ _react2.default.createElement(_reactnative.View, { style: _optionalChain([customAppearance, 'optionalAccess', _14 => _14.content]) }, endContent)
348
277
  );
349
- return /* @__PURE__ */ import_react9.default.createElement(
350
- import_react_native7.Pressable,
278
+ return /* @__PURE__ */ _react2.default.createElement(
279
+ _reactnative.Pressable,
351
280
  {
352
281
  onPress: handlePress,
353
282
  onPressIn: handlePressIn,
@@ -362,8 +291,7 @@ var MenuBoxItem = (props) => {
362
291
  content
363
292
  );
364
293
  };
365
- // Annotate the CommonJS export names for ESM import in node:
366
- 0 && (module.exports = {
367
- MenuBox,
368
- MenuBoxItem
369
- });
294
+
295
+
296
+
297
+ exports.MenuBox = MenuBox; exports.MenuBoxItem = MenuBoxItem;
@@ -1,6 +1,7 @@
1
+ import "../chunk-DXXNBF5P.js";
1
2
  import {
2
3
  useXUITheme
3
- } from "../chunk-4KSZLONZ.js";
4
+ } from "../chunk-LTKYHG5V.js";
4
5
 
5
6
  // src/components/menubox/menubox.tsx
6
7
  import React, { useMemo, Children, isValidElement } from "react";
@@ -1,47 +1,10 @@
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);
29
-
30
- // src/components/pager/index.ts
31
- var pager_exports = {};
32
- __export(pager_exports, {
33
- Pager: () => Pager,
34
- PagerItem: () => PagerItem
35
- });
36
- module.exports = __toCommonJS(pager_exports);
37
-
38
- // src/components/pager/pager.tsx
39
- var import_react = __toESM(require("react"), 1);
40
- var import_react_native2 = require("react-native");
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; }// src/components/pager/pager.tsx
2
+ var _react = require('react'); var _react2 = _interopRequireDefault(_react);
3
+ var _reactnative = require('react-native');
41
4
 
42
5
  // src/components/pager/pager.style.ts
43
- var import_react_native = require("react-native");
44
- var styles = import_react_native.StyleSheet.create({
6
+
7
+ var styles = _reactnative.StyleSheet.create({
45
8
  container: {
46
9
  width: "100%"
47
10
  },
@@ -94,8 +57,8 @@ function clampPage(page, max) {
94
57
  return Math.max(0, Math.min(page, max));
95
58
  }
96
59
  function toPages(children) {
97
- return import_react.default.Children.toArray(children).flatMap((child, index) => {
98
- if (!import_react.default.isValidElement(child) || child.type !== PagerItem) {
60
+ return _react2.default.Children.toArray(children).flatMap((child, index) => {
61
+ if (!_react2.default.isValidElement(child) || child.type !== PagerItem) {
99
62
  return [];
100
63
  }
101
64
  return [
@@ -119,45 +82,45 @@ var Pager = ({
119
82
  customAppearance
120
83
  }) => {
121
84
  const isPagerFullscreen = isFullscreen || isfullscreen === true;
122
- const pages = (0, import_react.useMemo)(() => toPages(children), [children]);
85
+ const pages = _react.useMemo.call(void 0, () => toPages(children), [children]);
123
86
  const maxPage = Math.max(0, pages.length - 1);
124
87
  const isControlled = controlledPage !== void 0;
125
- const [internalPage, setInternalPage] = (0, import_react.useState)(clampPage(defaultPage, maxPage));
126
- const [containerWidth, setContainerWidth] = (0, import_react.useState)(0);
127
- const scrollViewRef = (0, import_react.useRef)(null);
128
- const initialScrollAppliedRef = (0, import_react.useRef)(false);
88
+ const [internalPage, setInternalPage] = _react.useState.call(void 0, clampPage(defaultPage, maxPage));
89
+ const [containerWidth, setContainerWidth] = _react.useState.call(void 0, 0);
90
+ const scrollViewRef = _react.useRef.call(void 0, null);
91
+ const initialScrollAppliedRef = _react.useRef.call(void 0, false);
129
92
  const activePage = clampPage(
130
- isControlled ? controlledPage ?? 0 : internalPage,
93
+ isControlled ? _nullishCoalesce(controlledPage, () => ( 0)) : internalPage,
131
94
  maxPage
132
95
  );
133
- (0, import_react.useEffect)(() => {
96
+ _react.useEffect.call(void 0, () => {
134
97
  if (isControlled || pages.length === 0) return;
135
98
  setInternalPage((prev) => clampPage(prev, maxPage));
136
99
  }, [isControlled, maxPage, pages.length]);
137
- (0, import_react.useEffect)(() => {
100
+ _react.useEffect.call(void 0, () => {
138
101
  if (containerWidth <= 0) return;
139
102
  if (pages.length <= 1) return;
140
103
  const x = activePage * containerWidth;
141
104
  if (!initialScrollAppliedRef.current) {
142
105
  initialScrollAppliedRef.current = true;
143
- scrollViewRef.current?.scrollTo({ x, animated: false });
106
+ _optionalChain([scrollViewRef, 'access', _2 => _2.current, 'optionalAccess', _3 => _3.scrollTo, 'call', _4 => _4({ x, animated: false })]);
144
107
  return;
145
108
  }
146
- scrollViewRef.current?.scrollTo({ x, animated: true });
109
+ _optionalChain([scrollViewRef, 'access', _5 => _5.current, 'optionalAccess', _6 => _6.scrollTo, 'call', _7 => _7({ x, animated: true })]);
147
110
  }, [activePage, containerWidth, pages.length]);
148
- const handleLayout = (0, import_react.useCallback)((event) => {
111
+ const handleLayout = _react.useCallback.call(void 0, (event) => {
149
112
  setContainerWidth(event.nativeEvent.layout.width);
150
113
  }, []);
151
- const commitPageChange = (0, import_react.useCallback)(
114
+ const commitPageChange = _react.useCallback.call(void 0,
152
115
  (nextPage) => {
153
116
  if (!isControlled) {
154
117
  setInternalPage(nextPage);
155
118
  }
156
- onPageChange?.(nextPage);
119
+ _optionalChain([onPageChange, 'optionalCall', _8 => _8(nextPage)]);
157
120
  },
158
121
  [isControlled, onPageChange]
159
122
  );
160
- const handleMomentumScrollEnd = (0, import_react.useCallback)(
123
+ const handleMomentumScrollEnd = _react.useCallback.call(void 0,
161
124
  (event) => {
162
125
  if (containerWidth <= 0 || pages.length === 0) return;
163
126
  const rawPage = Math.round(event.nativeEvent.contentOffset.x / containerWidth);
@@ -168,18 +131,18 @@ var Pager = ({
168
131
  },
169
132
  [activePage, commitPageChange, containerWidth, maxPage, pages.length]
170
133
  );
171
- return /* @__PURE__ */ import_react.default.createElement(
172
- import_react_native2.View,
134
+ return /* @__PURE__ */ _react2.default.createElement(
135
+ _reactnative.View,
173
136
  {
174
137
  onLayout: handleLayout,
175
138
  style: [
176
139
  styles.container,
177
140
  isPagerFullscreen && styles.fullscreenContainer,
178
- customAppearance?.container
141
+ _optionalChain([customAppearance, 'optionalAccess', _9 => _9.container])
179
142
  ]
180
143
  },
181
- /* @__PURE__ */ import_react.default.createElement(
182
- import_react_native2.ScrollView,
144
+ /* @__PURE__ */ _react2.default.createElement(
145
+ _reactnative.ScrollView,
183
146
  {
184
147
  ref: scrollViewRef,
185
148
  horizontal: true,
@@ -189,46 +152,46 @@ var Pager = ({
189
152
  onMomentumScrollEnd: handleMomentumScrollEnd,
190
153
  style: [
191
154
  isPagerFullscreen && styles.fullscreenScrollView,
192
- customAppearance?.scrollView
155
+ _optionalChain([customAppearance, 'optionalAccess', _10 => _10.scrollView])
193
156
  ]
194
157
  },
195
- pages.map((pagerPage) => /* @__PURE__ */ import_react.default.createElement(
196
- import_react_native2.View,
158
+ pages.map((pagerPage) => /* @__PURE__ */ _react2.default.createElement(
159
+ _reactnative.View,
197
160
  {
198
161
  key: pagerPage.key,
199
162
  style: [
200
163
  styles.page,
201
164
  isPagerFullscreen && styles.fullscreenPage,
202
- customAppearance?.page,
165
+ _optionalChain([customAppearance, 'optionalAccess', _11 => _11.page]),
203
166
  containerWidth > 0 && { width: containerWidth }
204
167
  ]
205
168
  },
206
169
  pagerPage.content
207
170
  ))
208
171
  ),
209
- showIndicator && pages.length > 1 && /* @__PURE__ */ import_react.default.createElement(
210
- import_react_native2.View,
172
+ showIndicator && pages.length > 1 && /* @__PURE__ */ _react2.default.createElement(
173
+ _reactnative.View,
211
174
  {
212
175
  style: [
213
176
  styles.indicatorContainer,
214
- customAppearance?.indicatorContainer,
177
+ _optionalChain([customAppearance, 'optionalAccess', _12 => _12.indicatorContainer]),
215
178
  isPagerFullscreen && styles.fullscreenIndicatorContainer
216
179
  ]
217
180
  },
218
181
  pages.map((_, index) => {
219
182
  const isActive = index === activePage;
220
183
  if (renderIndicator) {
221
- return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, { key: `indicator-${String(index)}` }, renderIndicator({ index, isActive, total: pages.length }));
184
+ return /* @__PURE__ */ _react2.default.createElement(_react2.default.Fragment, { key: `indicator-${String(index)}` }, renderIndicator({ index, isActive, total: pages.length }));
222
185
  }
223
- return /* @__PURE__ */ import_react.default.createElement(
224
- import_react_native2.View,
186
+ return /* @__PURE__ */ _react2.default.createElement(
187
+ _reactnative.View,
225
188
  {
226
189
  key: `indicator-${String(index)}`,
227
190
  style: [
228
191
  styles.indicator,
229
- customAppearance?.indicator,
192
+ _optionalChain([customAppearance, 'optionalAccess', _13 => _13.indicator]),
230
193
  isActive && styles.activeIndicator,
231
- isActive && customAppearance?.activeIndicator
194
+ isActive && _optionalChain([customAppearance, 'optionalAccess', _14 => _14.activeIndicator])
232
195
  ]
233
196
  }
234
197
  );
@@ -236,8 +199,7 @@ var Pager = ({
236
199
  )
237
200
  );
238
201
  };
239
- // Annotate the CommonJS export names for ESM import in node:
240
- 0 && (module.exports = {
241
- Pager,
242
- PagerItem
243
- });
202
+
203
+
204
+
205
+ exports.Pager = Pager; exports.PagerItem = PagerItem;