@xaui/native 0.9.1-alpha.91 → 0.9.1-alpha.93

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 (86) hide show
  1. package/dist/chunk-2SHWOFQV.js +495 -0
  2. package/dist/chunk-3A5RK2R7.js +40 -0
  3. package/dist/chunk-6JAGPPZU.cjs +788 -0
  4. package/dist/chunk-7NQL5DXY.js +302 -0
  5. package/dist/chunk-FTPPUTWL.cjs +40 -0
  6. package/dist/chunk-GGP2ERSV.js +487 -0
  7. package/dist/chunk-LKRQUQZQ.cjs +487 -0
  8. package/dist/chunk-OPLPLFGK.cjs +493 -0
  9. package/dist/{chunk-LIEXFWTN.js → chunk-P5M5URAB.js} +29 -126
  10. package/dist/chunk-XWIPLZTD.cjs +302 -0
  11. package/dist/components/carousel/index.cjs +3 -2
  12. package/dist/components/carousel/index.js +2 -1
  13. package/dist/components/index.d.cts +3 -0
  14. package/dist/components/index.d.ts +3 -0
  15. package/dist/components/number-pad/index.cjs +40 -0
  16. package/dist/components/number-pad/index.d.cts +60 -0
  17. package/dist/components/number-pad/index.d.ts +60 -0
  18. package/dist/components/number-pad/index.js +40 -0
  19. package/dist/components/number-pad/number-pad-action.d.cts +24 -0
  20. package/dist/components/number-pad/number-pad-action.d.ts +24 -0
  21. package/dist/components/number-pad/number-pad-backspace.d.cts +18 -0
  22. package/dist/components/number-pad/number-pad-backspace.d.ts +18 -0
  23. package/dist/components/number-pad/number-pad-cell.d.cts +7 -0
  24. package/dist/components/number-pad/number-pad-cell.d.ts +7 -0
  25. package/dist/components/number-pad/number-pad-icon.d.cts +13 -0
  26. package/dist/components/number-pad/number-pad-icon.d.ts +13 -0
  27. package/dist/components/number-pad/number-pad-key.d.cts +24 -0
  28. package/dist/components/number-pad/number-pad-key.d.ts +24 -0
  29. package/dist/components/number-pad/number-pad-label.d.cts +14 -0
  30. package/dist/components/number-pad/number-pad-label.d.ts +14 -0
  31. package/dist/components/number-pad/number-pad.context.d.cts +18 -0
  32. package/dist/components/number-pad/number-pad.context.d.ts +18 -0
  33. package/dist/components/number-pad/number-pad.d.cts +57 -0
  34. package/dist/components/number-pad/number-pad.d.ts +57 -0
  35. package/dist/components/number-pad/number-pad.recipe.d.cts +11 -0
  36. package/dist/components/number-pad/number-pad.recipe.d.ts +11 -0
  37. package/dist/components/number-pad/number-pad.style.d.cts +13 -0
  38. package/dist/components/number-pad/number-pad.style.d.ts +13 -0
  39. package/dist/components/number-pad/number-pad.type.d.cts +135 -0
  40. package/dist/components/number-pad/number-pad.type.d.ts +135 -0
  41. package/dist/components/number-pad/number-pad.utils.d.cts +34 -0
  42. package/dist/components/number-pad/number-pad.utils.d.ts +34 -0
  43. package/dist/components/pager/index.cjs +33 -0
  44. package/dist/components/pager/index.d.cts +60 -0
  45. package/dist/components/pager/index.d.ts +60 -0
  46. package/dist/components/pager/index.js +33 -0
  47. package/dist/components/pager/pager-content.d.cts +24 -0
  48. package/dist/components/pager/pager-content.d.ts +24 -0
  49. package/dist/components/pager/pager-indicator.d.cts +47 -0
  50. package/dist/components/pager/pager-indicator.d.ts +47 -0
  51. package/dist/components/pager/pager-page.d.cts +16 -0
  52. package/dist/components/pager/pager-page.d.ts +16 -0
  53. package/dist/components/pager/pager.context.d.cts +7 -0
  54. package/dist/components/pager/pager.context.d.ts +7 -0
  55. package/dist/components/pager/pager.d.cts +70 -0
  56. package/dist/components/pager/pager.d.ts +70 -0
  57. package/dist/components/pager/pager.recipe.d.cts +33 -0
  58. package/dist/components/pager/pager.recipe.d.ts +33 -0
  59. package/dist/components/pager/pager.type.d.cts +107 -0
  60. package/dist/components/pager/pager.type.d.ts +107 -0
  61. package/dist/components/rating/index.cjs +30 -0
  62. package/dist/components/rating/index.d.cts +41 -0
  63. package/dist/components/rating/index.d.ts +41 -0
  64. package/dist/components/rating/index.js +30 -0
  65. package/dist/components/rating/rating-icon.d.cts +16 -0
  66. package/dist/components/rating/rating-icon.d.ts +16 -0
  67. package/dist/components/rating/rating-item.d.cts +23 -0
  68. package/dist/components/rating/rating-item.d.ts +23 -0
  69. package/dist/components/rating/rating-star.d.cts +19 -0
  70. package/dist/components/rating/rating-star.d.ts +19 -0
  71. package/dist/components/rating/rating.context.d.cts +16 -0
  72. package/dist/components/rating/rating.context.d.ts +16 -0
  73. package/dist/components/rating/rating.d.cts +59 -0
  74. package/dist/components/rating/rating.d.ts +59 -0
  75. package/dist/components/rating/rating.recipe.d.cts +11 -0
  76. package/dist/components/rating/rating.recipe.d.ts +11 -0
  77. package/dist/components/rating/rating.style.d.cts +24 -0
  78. package/dist/components/rating/rating.style.d.ts +24 -0
  79. package/dist/components/rating/rating.type.d.cts +108 -0
  80. package/dist/components/rating/rating.type.d.ts +108 -0
  81. package/dist/components/rating/rating.utils.d.cts +28 -0
  82. package/dist/components/rating/rating.utils.d.ts +28 -0
  83. package/dist/index.cjs +91 -28
  84. package/dist/index.js +148 -85
  85. package/package.json +31 -1
  86. package/dist/chunk-K5UO3HBW.cjs +0 -1007
@@ -0,0 +1,493 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ function _interopRequireDefault(obj) {
7
+ return obj && obj.__esModule ? obj : {
8
+ default: obj
9
+ };
10
+ }
11
+ function _nullishCoalesce(lhs, rhsFn) {
12
+ if (lhs != null) {
13
+ return lhs;
14
+ } else {
15
+ return rhsFn();
16
+ }
17
+ }
18
+ function _optionalChain(ops) {
19
+ let lastAccessLHS = undefined;
20
+ let value = ops[0];
21
+ let i = 1;
22
+ while (i < ops.length) {
23
+ const op = ops[i];
24
+ const fn = ops[i + 1];
25
+ i += 2;
26
+ if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) {
27
+ return undefined;
28
+ }
29
+ if (op === 'access' || op === 'optionalAccess') {
30
+ lastAccessLHS = value;
31
+ value = fn(value);
32
+ } else if (op === 'call' || op === 'optionalCall') {
33
+ value = fn((...args) => value.call(lastAccessLHS, ...args));
34
+ lastAccessLHS = undefined;
35
+ }
36
+ }
37
+ return value;
38
+ }
39
+ var _chunkFTPPUTWLcjs = require('./chunk-FTPPUTWL.cjs');
40
+ var _chunkWFEMJCXOcjs = require('./chunk-WFEMJCXO.cjs');
41
+ var _chunk7EIHHOHPcjs = require('./chunk-7EIHHOHP.cjs');
42
+ var _chunkSL3V7R2Ycjs = require('./chunk-SL3V7R2Y.cjs');
43
+ var _chunkCDRGTUYFcjs = require('./chunk-CDRGTUYF.cjs');
44
+ var _chunkIIAQISBGcjs = require('./chunk-IIAQISBG.cjs');
45
+ var _chunkTK44VBIEcjs = require('./chunk-TK44VBIE.cjs');
46
+
47
+ // src/components/pager/pager-content.tsx
48
+ var _react = require('react');
49
+ var _reactnativereanimated = require('react-native-reanimated');
50
+ var _reactnativereanimated2 = _interopRequireDefault(_reactnativereanimated);
51
+
52
+ // src/components/pager/pager.context.ts
53
+ var [PagerProvider, usePager] = _chunkCDRGTUYFcjs.createSlotContext.call(void 0, "Pager");
54
+
55
+ // src/components/pager/pager-content.tsx
56
+ var _jsxruntime = require('react/jsx-runtime');
57
+ var PagerContent = _react.forwardRef.call(void 0, function PagerContent2({
58
+ children,
59
+ style,
60
+ onLayout,
61
+ ...props
62
+ }, ref) {
63
+ const {
64
+ contentStyle,
65
+ orientation,
66
+ step,
67
+ track,
68
+ setTrack,
69
+ count,
70
+ setCount,
71
+ offset,
72
+ trackRef,
73
+ isDisabled,
74
+ onSettle
75
+ } = usePager();
76
+ const [styleProps, rest] = _chunkTK44VBIEcjs.useStyleProps.call(void 0, props);
77
+ const scroller = _chunkWFEMJCXOcjs.useMergedRef.call(void 0, ref, trackRef);
78
+ const given = _react.Children.count(children);
79
+ _react.useEffect.call(void 0, () => {
80
+ if (given !== count) setCount(given);
81
+ }, [count, given, setCount]);
82
+ const handleLayout = event => {
83
+ _optionalChain([onLayout, 'optionalCall', _2 => _2(event)]);
84
+ const {
85
+ width,
86
+ height
87
+ } = event.nativeEvent.layout;
88
+ if (width !== track.width || height !== track.height) setTrack({
89
+ width,
90
+ height
91
+ });
92
+ };
93
+ const settled = _reactnativereanimated.useSharedValue.call(void 0, 0);
94
+ const isHorizontal = orientation === "horizontal";
95
+ const scroll = _reactnativereanimated.useAnimatedScrollHandler.call(void 0, event => {
96
+ const travelled = isHorizontal ? event.contentOffset.x : event.contentOffset.y;
97
+ offset.set(travelled);
98
+ const next = _chunkFTPPUTWLcjs.indexFromOffset.call(void 0, travelled, step, count);
99
+ if (next !== settled.get()) {
100
+ settled.set(next);
101
+ _reactnativereanimated.runOnJS.call(void 0, onSettle)(next);
102
+ }
103
+ });
104
+ return /* @__PURE__ */_jsxruntime.jsx.call(void 0, _reactnativereanimated2.default.ScrollView, {
105
+ ref: scroller,
106
+ horizontal: isHorizontal,
107
+ pagingEnabled: true,
108
+ showsHorizontalScrollIndicator: false,
109
+ showsVerticalScrollIndicator: false,
110
+ scrollEnabled: !isDisabled,
111
+ decelerationRate: "fast",
112
+ scrollEventThrottle: 16,
113
+ ...rest,
114
+ style: [contentStyle, styleProps, style],
115
+ onLayout: handleLayout,
116
+ onScroll: scroll,
117
+ children: step > 0 ? children : null
118
+ });
119
+ });
120
+ PagerContent.displayName = "XAUI.Pager.Content";
121
+
122
+ // src/components/pager/pager-indicator.tsx
123
+
124
+ var _reactnative = require('react-native');
125
+
126
+ // src/components/pager/pager.recipe.ts
127
+ var SLOTS = ["root", "content", "page", "indicator", "dot"];
128
+ var VARIANT_TOKENS = {
129
+ primary: {
130
+ bgSelected: "accent"
131
+ },
132
+ // The page's own ink, for an indicator that has to read as chrome rather than as accent.
133
+ secondary: {
134
+ bgSelected: "foreground"
135
+ },
136
+ // The raised ground — white on a light theme. A pager over a *photograph* wants
137
+ // `color="#ffffff"` instead: a photograph is a photograph in both colour modes, and this
138
+ // token flips with the theme.
139
+ tertiary: {
140
+ bgSelected: "surface"
141
+ }
142
+ };
143
+ var DOT_REST_OPACITY = 0.3;
144
+ var SIZES = {
145
+ xs: {
146
+ dot: 5,
147
+ gap: 1
148
+ },
149
+ sm: {
150
+ dot: 6,
151
+ gap: 1.5
152
+ },
153
+ md: {
154
+ dot: 7,
155
+ gap: 1.5
156
+ },
157
+ lg: {
158
+ dot: 8,
159
+ gap: 2
160
+ }
161
+ };
162
+ function sizeAxis(step) {
163
+ const {
164
+ dot,
165
+ gap
166
+ } = step;
167
+ return theme => ({
168
+ indicator: {
169
+ gap: theme.spacing(gap)
170
+ },
171
+ dot: {
172
+ width: dot,
173
+ height: dot,
174
+ borderRadius: dot / 2
175
+ }
176
+ });
177
+ }
178
+ function orientationAxis(direction) {
179
+ return () => ({
180
+ indicator: {
181
+ flexDirection: direction
182
+ }
183
+ });
184
+ }
185
+ var pagerRecipe = _chunkSL3V7R2Ycjs.createRecipe.call(void 0, {
186
+ slots: SLOTS,
187
+ base: () => ({
188
+ /**
189
+ * **The root has no size of its own**, and that is deliberate rather than missing.
190
+ *
191
+ * `flex: 1` here would have been the convenient default and it is a trap: React Native
192
+ * expands it to a zero flex-basis, which **overrides an explicit `height`** — so
193
+ * `<Pager height={240}>` would collapse to the height of its dots, and the prop the
194
+ * caller reached for would silently do nothing. It is the same reason there is no
195
+ * `fullWidth` on a `Button`: RN's own behaviour is the answer, and the caller says which
196
+ * of the two they want — `flex={1}` to fill a screen, `height={320}` inside a scroll
197
+ * view.
198
+ *
199
+ * The track keeps its `flex: 1`, so it takes whatever the root was given less the dots.
200
+ * Nothing sizes it from outside, which is why it is safe there and not here.
201
+ */
202
+ content: {
203
+ flex: 1
204
+ },
205
+ // A page is the size of the track on both axes, and that number is measured rather than
206
+ // named, so it arrives as an inline style instead of from here.
207
+ page: {
208
+ overflow: "hidden"
209
+ },
210
+ indicator: {
211
+ alignItems: "center",
212
+ justifyContent: "center"
213
+ }
214
+ }),
215
+ variantTokens: VARIANT_TOKENS,
216
+ /**
217
+ * Every dot takes the same colour. What separates the current one from the rest is its
218
+ * opacity, animated on the UI thread — so this is a plain style rather than a value the
219
+ * root has to flatten and hand to a worklet.
220
+ */
221
+ paint: (_theme, colors) => ({
222
+ dot: {
223
+ backgroundColor: colors.bgSelected
224
+ }
225
+ }),
226
+ variants: {
227
+ size: {
228
+ xs: sizeAxis(SIZES.xs),
229
+ sm: sizeAxis(SIZES.sm),
230
+ md: sizeAxis(SIZES.md),
231
+ lg: sizeAxis(SIZES.lg)
232
+ },
233
+ orientation: {
234
+ horizontal: orientationAxis("row"),
235
+ vertical: orientationAxis("column")
236
+ }
237
+ },
238
+ states: {
239
+ disabled: theme => ({
240
+ indicator: {
241
+ opacity: theme.opacity.disabled
242
+ }
243
+ })
244
+ },
245
+ defaultVariants: {
246
+ variant: "primary",
247
+ size: "md",
248
+ orientation: "horizontal"
249
+ }
250
+ });
251
+
252
+ // src/components/pager/pager-indicator.tsx
253
+
254
+ var HIT_SLOP = 8;
255
+ var AnimatedPressable = _reactnativereanimated2.default.createAnimatedComponent(_reactnative.Pressable);
256
+ var PagerIndicator = _react.forwardRef.call(void 0, function PagerIndicator2({
257
+ children,
258
+ style,
259
+ ...props
260
+ }, ref) {
261
+ const {
262
+ indicatorStyle,
263
+ count
264
+ } = usePager();
265
+ const [styleProps, rest] = _chunkTK44VBIEcjs.useStyleProps.call(void 0, props);
266
+ return /* @__PURE__ */_jsxruntime.jsx.call(void 0, _reactnative.View, {
267
+ ref,
268
+ ...rest,
269
+ style: [indicatorStyle, styleProps, style],
270
+ children: _nullishCoalesce(children, () => Array.from({
271
+ length: count
272
+ }, (_, index) => /* @__PURE__ */_jsxruntime.jsx.call(void 0, PagerDot, {
273
+ index
274
+ }, index)))
275
+ });
276
+ });
277
+ PagerIndicator.displayName = "XAUI.Pager.Indicator";
278
+ const _worklet_9864592886974_init_data = {
279
+ code: "function chunkOPLPLFGKCjs1(){const{_chunkFTPPUTWLcjs,offset,step,count,index,_reactnativereanimated,DOT_REST_OPACITY}=this.__closure;const distance=Math.abs(_chunkFTPPUTWLcjs.progressFromOffset.call(void 0,offset.get(),step,count)-index);const nearness=Math.max(0,1-distance);return{opacity:_reactnativereanimated.interpolate.call(void 0,nearness,[0,1],[DOT_REST_OPACITY,1])};}",
280
+ location: "/home/runner/work/xaui/xaui/packages/native/dist/chunk-OPLPLFGK.cjs",
281
+ sourceMap: "{\"version\":3,\"names\":[\"chunkOPLPLFGKCjs1\",\"_chunkFTPPUTWLcjs\",\"offset\",\"step\",\"count\",\"index\",\"_reactnativereanimated\",\"DOT_REST_OPACITY\",\"__closure\",\"distance\",\"Math\",\"abs\",\"progressFromOffset\",\"call\",\"get\",\"nearness\",\"max\",\"opacity\",\"interpolate\"],\"sources\":[\"/home/runner/work/xaui/xaui/packages/native/dist/chunk-OPLPLFGK.cjs\"],\"mappings\":\"AA4MsE,SAAAA,iBAAMA,CAAA,QAAAC,iBAAA,CAAAC,MAAA,CAAAC,IAAA,CAAAC,KAAA,CAAAC,KAAA,CAAAC,sBAAA,CAAAC,gBAAA,OAAAC,SAAA,CAExE,KAAM,CAAAC,QAAQ,CAAGC,IAAI,CAACC,GAAG,CAACV,iBAAiB,CAACW,kBAAkB,CAACC,IAAI,CAAC,IAAK,EAAC,CAAEX,MAAM,CAACY,GAAG,CAAC,CAAC,CAAEX,IAAI,CAAEC,KAAK,CAAC,CAAGC,KAAK,CAAC,CAC/G,KAAM,CAAAU,QAAQ,CAAGL,IAAI,CAACM,GAAG,CAAC,CAAC,CAAE,CAAC,CAAGP,QAAQ,CAAC,CAC1C,MAAO,CAAEQ,OAAO,CAAEX,sBAAsB,CAACY,WAAW,CAACL,IAAI,CAAC,IAAK,EAAC,CAAEE,QAAQ,CAAE,CAAC,CAAC,CAAE,CAAC,CAAC,CAAE,CAACR,gBAAgB,CAAE,CAAC,CAAC,CAAE,CAAC,CAC9G\",\"ignoreList\":[]}"
282
+ };
283
+ var PagerDot = _react.forwardRef.call(void 0, function PagerDot2({
284
+ index,
285
+ children,
286
+ style,
287
+ ...props
288
+ }, ref) {
289
+ const {
290
+ dotStyle,
291
+ offset,
292
+ step,
293
+ count,
294
+ index: current,
295
+ isDisabled,
296
+ goTo
297
+ } = usePager();
298
+ const [styleProps, rest] = _chunkTK44VBIEcjs.useStyleProps.call(void 0, props);
299
+ const travel = _reactnativereanimated.useAnimatedStyle.call(void 0, function chunkOPLPLFGKCjs1Factory({
300
+ _worklet_9864592886974_init_data,
301
+ _chunkFTPPUTWLcjs,
302
+ offset,
303
+ step,
304
+ count,
305
+ index,
306
+ _reactnativereanimated,
307
+ DOT_REST_OPACITY
308
+ }) {
309
+ const _e = [new global.Error(), -8, -27];
310
+ const chunkOPLPLFGKCjs1 = function () {
311
+ const distance = Math.abs(_chunkFTPPUTWLcjs.progressFromOffset.call(void 0, offset.get(), step, count) - index);
312
+ const nearness = Math.max(0, 1 - distance);
313
+ return {
314
+ opacity: _reactnativereanimated.interpolate.call(void 0, nearness, [0, 1], [DOT_REST_OPACITY, 1])
315
+ };
316
+ };
317
+ chunkOPLPLFGKCjs1.__closure = {
318
+ _chunkFTPPUTWLcjs,
319
+ offset,
320
+ step,
321
+ count,
322
+ index,
323
+ _reactnativereanimated,
324
+ DOT_REST_OPACITY
325
+ };
326
+ chunkOPLPLFGKCjs1.__workletHash = 9864592886974;
327
+ chunkOPLPLFGKCjs1.__pluginVersion = "0.7.4";
328
+ chunkOPLPLFGKCjs1.__initData = _worklet_9864592886974_init_data;
329
+ chunkOPLPLFGKCjs1.__stackDetails = _e;
330
+ return chunkOPLPLFGKCjs1;
331
+ }({
332
+ _worklet_9864592886974_init_data,
333
+ _chunkFTPPUTWLcjs,
334
+ offset,
335
+ step,
336
+ count,
337
+ index,
338
+ _reactnativereanimated,
339
+ DOT_REST_OPACITY
340
+ }), [offset, step, count, index]);
341
+ return /* @__PURE__ */_jsxruntime.jsx.call(void 0, AnimatedPressable, {
342
+ ref,
343
+ accessibilityRole: "button",
344
+ accessibilityState: {
345
+ selected: index === current,
346
+ disabled: isDisabled
347
+ },
348
+ accessibilityValue: {
349
+ now: index + 1,
350
+ min: 1,
351
+ max: count
352
+ },
353
+ disabled: isDisabled,
354
+ hitSlop: HIT_SLOP,
355
+ ...rest,
356
+ style: [dotStyle, travel, styleProps, style],
357
+ onPress: () => goTo(index),
358
+ children
359
+ });
360
+ });
361
+ PagerDot.displayName = "XAUI.Pager.Dot";
362
+
363
+ // src/components/pager/pager-page.tsx
364
+
365
+ var PagerPage = _react.forwardRef.call(void 0, function PagerPage2({
366
+ children,
367
+ style,
368
+ ...props
369
+ }, ref) {
370
+ const {
371
+ pageStyle,
372
+ track
373
+ } = usePager();
374
+ const [styleProps, rest] = _chunkTK44VBIEcjs.useStyleProps.call(void 0, props);
375
+ return /* @__PURE__ */_jsxruntime.jsx.call(void 0, _reactnative.View, {
376
+ ref,
377
+ ...rest,
378
+ style: [pageStyle, {
379
+ width: track.width,
380
+ height: track.height
381
+ }, styleProps, style],
382
+ children
383
+ });
384
+ });
385
+ PagerPage.displayName = "XAUI.Pager.Page";
386
+
387
+ // src/components/pager/pager.tsx
388
+
389
+ var PagerRoot = _react.forwardRef.call(void 0, function Pager({
390
+ children,
391
+ variant,
392
+ size,
393
+ color,
394
+ orientation = "horizontal",
395
+ index: indexProp,
396
+ defaultIndex = 0,
397
+ onIndexChange,
398
+ isDisabled = false,
399
+ style,
400
+ ...props
401
+ }, ref) {
402
+ const theme = _chunkIIAQISBGcjs.useXAUITheme.call(void 0);
403
+ const [styleProps, rest] = _chunkTK44VBIEcjs.useStyleProps.call(void 0, props);
404
+ const [index, setIndex] = _chunk7EIHHOHPcjs.useControllableState.call(void 0, {
405
+ value: indexProp,
406
+ defaultValue: defaultIndex,
407
+ onChange: onIndexChange
408
+ });
409
+ const [track, setTrack] = _react.useState.call(void 0, {
410
+ width: 0,
411
+ height: 0
412
+ });
413
+ const [count, setCount] = _react.useState.call(void 0, 0);
414
+ const trackRef = _reactnativereanimated.useAnimatedRef.call(void 0);
415
+ const offset = _reactnativereanimated.useSharedValue.call(void 0, 0);
416
+ const selection = {
417
+ variant,
418
+ size,
419
+ orientation
420
+ };
421
+ const states = {
422
+ disabled: isDisabled
423
+ };
424
+ const styles = pagerRecipe.resolve({
425
+ theme,
426
+ selection,
427
+ states
428
+ });
429
+ const tint = color ? pagerRecipe.tint({
430
+ theme,
431
+ color,
432
+ selection,
433
+ states
434
+ }) : void 0;
435
+ const step = orientation === "horizontal" ? track.width : track.height;
436
+ const goTo = _react.useCallback.call(void 0, next => {
437
+ const distance = next * step;
438
+ _optionalChain([trackRef, 'access', _3 => _3.current, 'optionalAccess', _4 => _4.scrollTo, 'call', _5 => _5({
439
+ x: orientation === "horizontal" ? distance : 0,
440
+ y: orientation === "horizontal" ? 0 : distance,
441
+ animated: true
442
+ })]);
443
+ setIndex(next);
444
+ }, [orientation, setIndex, step, trackRef]);
445
+ const context = _react.useMemo.call(void 0, () => ({
446
+ contentStyle: styles.content,
447
+ pageStyle: styles.page,
448
+ indicatorStyle: styles.indicator,
449
+ // One colour for every dot; the current one is told apart by its opacity, which the dot
450
+ // animates itself. Nothing here has to be flattened into a value for a worklet.
451
+ dotStyle: tint ? [styles.dot, tint.dot] : styles.dot,
452
+ orientation,
453
+ index,
454
+ count,
455
+ setCount,
456
+ track,
457
+ setTrack,
458
+ step,
459
+ offset,
460
+ goTo,
461
+ onSettle: setIndex,
462
+ trackRef,
463
+ isDisabled
464
+ }), [styles, tint, orientation, index, count, track, setTrack, step, offset, goTo, setIndex, trackRef, isDisabled]);
465
+ const rootStyle = [styles.root, _optionalChain([tint, 'optionalAccess', _6 => _6.root]), styleProps, style];
466
+ return /* @__PURE__ */_jsxruntime.jsx.call(void 0, PagerProvider, {
467
+ value: context,
468
+ children: /* @__PURE__ */_jsxruntime.jsx.call(void 0, _reactnative.View, {
469
+ ref,
470
+ ...rest,
471
+ style: rootStyle,
472
+ children
473
+ })
474
+ });
475
+ });
476
+ PagerRoot.displayName = "XAUI.Pager.Root";
477
+
478
+ // src/components/pager/index.ts
479
+ var Pager2 = Object.assign(PagerRoot, {
480
+ Content: PagerContent,
481
+ Page: PagerPage,
482
+ Indicator: PagerIndicator,
483
+ Dot: PagerDot
484
+ });
485
+ exports.usePager = usePager;
486
+ exports.PagerContent = PagerContent;
487
+ exports.DOT_REST_OPACITY = DOT_REST_OPACITY;
488
+ exports.pagerRecipe = pagerRecipe;
489
+ exports.PagerIndicator = PagerIndicator;
490
+ exports.PagerDot = PagerDot;
491
+ exports.PagerPage = PagerPage;
492
+ exports.PagerRoot = PagerRoot;
493
+ exports.Pager = Pager2;