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

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-3A5RK2R7.js +40 -0
  2. package/dist/chunk-6JAGPPZU.cjs +788 -0
  3. package/dist/chunk-7NQL5DXY.js +302 -0
  4. package/dist/chunk-FTPPUTWL.cjs +40 -0
  5. package/dist/chunk-GGP2ERSV.js +487 -0
  6. package/dist/chunk-KPKEZWZM.js +517 -0
  7. package/dist/chunk-LKRQUQZQ.cjs +487 -0
  8. package/dist/{chunk-LIEXFWTN.js → chunk-P5M5URAB.js} +29 -126
  9. package/dist/chunk-UR37LVPU.cjs +382 -0
  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 +31 -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 +31 -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 +71 -0
  56. package/dist/components/pager/pager.d.ts +71 -0
  57. package/dist/components/pager/pager.recipe.d.cts +15 -0
  58. package/dist/components/pager/pager.recipe.d.ts +15 -0
  59. package/dist/components/pager/pager.type.d.cts +108 -0
  60. package/dist/components/pager/pager.type.d.ts +108 -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 +90 -29
  84. package/dist/index.js +146 -85
  85. package/package.json +31 -1
  86. package/dist/chunk-K5UO3HBW.cjs +0 -1007
@@ -0,0 +1,517 @@
1
+ import { indexFromOffset, progressFromOffset } from "./chunk-3A5RK2R7.js";
2
+ import { useMergedRef } from "./chunk-NCTOTTVW.js";
3
+ import { useControllableState } from "./chunk-F6W3JQ7K.js";
4
+ import { createRecipe } from "./chunk-DKVXTMIJ.js";
5
+ import { createSlotContext } from "./chunk-TTZOIXKE.js";
6
+ import { useXAUITheme } from "./chunk-Z6JBWRPL.js";
7
+ import { useStyleProps } from "./chunk-M63GFNKV.js";
8
+
9
+ // src/components/pager/pager-content.tsx
10
+ import { Children, forwardRef, useEffect } from "react";
11
+ import Animated, { runOnJS, useAnimatedScrollHandler, useSharedValue } from "react-native-reanimated";
12
+
13
+ // src/components/pager/pager.context.ts
14
+ var [PagerProvider, usePager] = createSlotContext("Pager");
15
+
16
+ // src/components/pager/pager-content.tsx
17
+ import { jsx } from "react/jsx-runtime";
18
+ const _worklet_5592363110114_init_data = {
19
+ code: "function chunkKPKEZWZMJs1(event){const{isHorizontal,offset,indexFromOffset,step,count,settled,runOnJS,onSettle}=this.__closure;const travelled=isHorizontal?event.contentOffset.x:event.contentOffset.y;offset.set(travelled);const next=indexFromOffset(travelled,step,count);if(next!==settled.get()){settled.set(next);runOnJS(onSettle)(next);}}",
20
+ location: "/home/runner/work/xaui/xaui/packages/native/dist/chunk-KPKEZWZM.js",
21
+ sourceMap: "{\"version\":3,\"names\":[\"chunkKPKEZWZMJs1\",\"event\",\"isHorizontal\",\"offset\",\"indexFromOffset\",\"step\",\"count\",\"settled\",\"runOnJS\",\"onSettle\",\"__closure\",\"travelled\",\"contentOffset\",\"x\",\"y\",\"set\",\"next\",\"get\"],\"sources\":[\"/home/runner/work/xaui/xaui/packages/native/dist/chunk-KPKEZWZM.js\"],\"mappings\":\"AAiE6C,SAAAA,gBAAUA,CAAAC,KAAA,QAAAC,YAAA,CAAAC,MAAA,CAAAC,eAAA,CAAAC,IAAA,CAAAC,KAAA,CAAAC,OAAA,CAAAC,OAAA,CAAAC,QAAA,OAAAC,SAAA,CACjD,KAAM,CAAAC,SAAS,CAAGT,YAAY,CAAGD,KAAK,CAACW,aAAa,CAACC,CAAC,CAAGZ,KAAK,CAACW,aAAa,CAACE,CAAC,CAC9EX,MAAM,CAACY,GAAG,CAACJ,SAAS,CAAC,CACrB,KAAM,CAAAK,IAAI,CAAGZ,eAAe,CAACO,SAAS,CAAEN,IAAI,CAAEC,KAAK,CAAC,CACpD,GAAIU,IAAI,GAAKT,OAAO,CAACU,GAAG,CAAC,CAAC,CAAE,CAC1BV,OAAO,CAACQ,GAAG,CAACC,IAAI,CAAC,CACjBR,OAAO,CAACC,QAAQ,CAAC,CAACO,IAAI,CAAC,CACzB,CACF\",\"ignoreList\":[]}"
22
+ };
23
+ var PagerContent = forwardRef(function PagerContent2({
24
+ children,
25
+ style,
26
+ onLayout,
27
+ ...props
28
+ }, ref) {
29
+ const {
30
+ contentStyle,
31
+ orientation,
32
+ step,
33
+ track,
34
+ setTrack,
35
+ count,
36
+ setCount,
37
+ offset,
38
+ trackRef,
39
+ isDisabled,
40
+ onSettle
41
+ } = usePager();
42
+ const [styleProps, rest] = useStyleProps(props);
43
+ const scroller = useMergedRef(ref, trackRef);
44
+ const given = Children.count(children);
45
+ useEffect(() => {
46
+ if (given !== count) setCount(given);
47
+ }, [count, given, setCount]);
48
+ const handleLayout = event => {
49
+ onLayout?.(event);
50
+ const {
51
+ width,
52
+ height
53
+ } = event.nativeEvent.layout;
54
+ if (width !== track.width || height !== track.height) setTrack({
55
+ width,
56
+ height
57
+ });
58
+ };
59
+ const settled = useSharedValue(0);
60
+ const isHorizontal = orientation === "horizontal";
61
+ const scroll = useAnimatedScrollHandler(function chunkKPKEZWZMJs1Factory({
62
+ _worklet_5592363110114_init_data,
63
+ isHorizontal,
64
+ offset,
65
+ indexFromOffset,
66
+ step,
67
+ count,
68
+ settled,
69
+ runOnJS,
70
+ onSettle
71
+ }) {
72
+ const _e = [new global.Error(), -9, -27];
73
+ const chunkKPKEZWZMJs1 = function (event) {
74
+ const travelled = isHorizontal ? event.contentOffset.x : event.contentOffset.y;
75
+ offset.set(travelled);
76
+ const next = indexFromOffset(travelled, step, count);
77
+ if (next !== settled.get()) {
78
+ settled.set(next);
79
+ runOnJS(onSettle)(next);
80
+ }
81
+ };
82
+ chunkKPKEZWZMJs1.__closure = {
83
+ isHorizontal,
84
+ offset,
85
+ indexFromOffset,
86
+ step,
87
+ count,
88
+ settled,
89
+ runOnJS,
90
+ onSettle
91
+ };
92
+ chunkKPKEZWZMJs1.__workletHash = 5592363110114;
93
+ chunkKPKEZWZMJs1.__pluginVersion = "0.7.4";
94
+ chunkKPKEZWZMJs1.__initData = _worklet_5592363110114_init_data;
95
+ chunkKPKEZWZMJs1.__stackDetails = _e;
96
+ return chunkKPKEZWZMJs1;
97
+ }({
98
+ _worklet_5592363110114_init_data,
99
+ isHorizontal,
100
+ offset,
101
+ indexFromOffset,
102
+ step,
103
+ count,
104
+ settled,
105
+ runOnJS,
106
+ onSettle
107
+ }));
108
+ return /* @__PURE__ */jsx(Animated.ScrollView, {
109
+ ref: scroller,
110
+ horizontal: isHorizontal,
111
+ pagingEnabled: true,
112
+ showsHorizontalScrollIndicator: false,
113
+ showsVerticalScrollIndicator: false,
114
+ scrollEnabled: !isDisabled,
115
+ decelerationRate: "fast",
116
+ scrollEventThrottle: 16,
117
+ ...rest,
118
+ style: [contentStyle, styleProps, style],
119
+ onLayout: handleLayout,
120
+ onScroll: scroll,
121
+ children: step > 0 ? children : null
122
+ });
123
+ });
124
+ PagerContent.displayName = "XAUI.Pager.Content";
125
+
126
+ // src/components/pager/pager-indicator.tsx
127
+ import { forwardRef as forwardRef2 } from "react";
128
+ import { Pressable, View } from "react-native";
129
+ import Animated2, { interpolateColor, useAnimatedStyle } from "react-native-reanimated";
130
+ import { jsx as jsx2 } from "react/jsx-runtime";
131
+ var HIT_SLOP = 8;
132
+ var AnimatedPressable = Animated2.createAnimatedComponent(Pressable);
133
+ var PagerIndicator = forwardRef2(function PagerIndicator2({
134
+ children,
135
+ style,
136
+ ...props
137
+ }, ref) {
138
+ const {
139
+ indicatorStyle,
140
+ count
141
+ } = usePager();
142
+ const [styleProps, rest] = useStyleProps(props);
143
+ return /* @__PURE__ */jsx2(View, {
144
+ ref,
145
+ ...rest,
146
+ style: [indicatorStyle, styleProps, style],
147
+ children: children ?? Array.from({
148
+ length: count
149
+ }, (_, index) => /* @__PURE__ */jsx2(PagerDot, {
150
+ index
151
+ }, index))
152
+ });
153
+ });
154
+ PagerIndicator.displayName = "XAUI.Pager.Indicator";
155
+ const _worklet_3999860474786_init_data = {
156
+ code: "function chunkKPKEZWZMJs2(){const{progressFromOffset,offset,step,count,index,interpolateColor,restColor,active}=this.__closure;const distance=Math.abs(progressFromOffset(offset.get(),step,count)-index);const nearness=Math.max(0,1-distance);return{backgroundColor:interpolateColor(nearness,[0,1],[restColor,active])};}",
157
+ location: "/home/runner/work/xaui/xaui/packages/native/dist/chunk-KPKEZWZM.js",
158
+ sourceMap: "{\"version\":3,\"names\":[\"chunkKPKEZWZMJs2\",\"progressFromOffset\",\"offset\",\"step\",\"count\",\"index\",\"interpolateColor\",\"restColor\",\"active\",\"__closure\",\"distance\",\"Math\",\"abs\",\"get\",\"nearness\",\"max\",\"backgroundColor\"],\"sources\":[\"/home/runner/work/xaui/xaui/packages/native/dist/chunk-KPKEZWZM.js\"],\"mappings\":\"AA+HkC,SAAAA,gBAAMA,CAAA,QAAAC,kBAAA,CAAAC,MAAA,CAAAC,IAAA,CAAAC,KAAA,CAAAC,KAAA,CAAAC,gBAAA,CAAAC,SAAA,CAAAC,MAAA,OAAAC,SAAA,CACpC,KAAM,CAAAC,QAAQ,CAAGC,IAAI,CAACC,GAAG,CAACX,kBAAkB,CAACC,MAAM,CAACW,GAAG,CAAC,CAAC,CAAEV,IAAI,CAAEC,KAAK,CAAC,CAAGC,KAAK,CAAC,CAChF,KAAM,CAAAS,QAAQ,CAAGH,IAAI,CAACI,GAAG,CAAC,CAAC,CAAE,CAAC,CAAGL,QAAQ,CAAC,CAC1C,MAAO,CACLM,eAAe,CAAEV,gBAAgB,CAACQ,QAAQ,CAAE,CAAC,CAAC,CAAE,CAAC,CAAC,CAAE,CAACP,SAAS,CAAEC,MAAM,CAAC,CACzE,CAAC,CACH\",\"ignoreList\":[]}"
159
+ };
160
+ var PagerDot = forwardRef2(function PagerDot2({
161
+ index,
162
+ children,
163
+ style,
164
+ ...props
165
+ }, ref) {
166
+ const {
167
+ dotStyle,
168
+ dotInk,
169
+ offset,
170
+ step,
171
+ count,
172
+ index: current,
173
+ isDisabled,
174
+ goTo
175
+ } = usePager();
176
+ const [styleProps, rest] = useStyleProps(props);
177
+ const {
178
+ rest: restColor,
179
+ active
180
+ } = dotInk;
181
+ const travel = useAnimatedStyle(function chunkKPKEZWZMJs2Factory({
182
+ _worklet_3999860474786_init_data,
183
+ progressFromOffset,
184
+ offset,
185
+ step,
186
+ count,
187
+ index,
188
+ interpolateColor,
189
+ restColor,
190
+ active
191
+ }) {
192
+ const _e = [new global.Error(), -9, -27];
193
+ const chunkKPKEZWZMJs2 = function () {
194
+ const distance = Math.abs(progressFromOffset(offset.get(), step, count) - index);
195
+ const nearness = Math.max(0, 1 - distance);
196
+ return {
197
+ backgroundColor: interpolateColor(nearness, [0, 1], [restColor, active])
198
+ };
199
+ };
200
+ chunkKPKEZWZMJs2.__closure = {
201
+ progressFromOffset,
202
+ offset,
203
+ step,
204
+ count,
205
+ index,
206
+ interpolateColor,
207
+ restColor,
208
+ active
209
+ };
210
+ chunkKPKEZWZMJs2.__workletHash = 3999860474786;
211
+ chunkKPKEZWZMJs2.__pluginVersion = "0.7.4";
212
+ chunkKPKEZWZMJs2.__initData = _worklet_3999860474786_init_data;
213
+ chunkKPKEZWZMJs2.__stackDetails = _e;
214
+ return chunkKPKEZWZMJs2;
215
+ }({
216
+ _worklet_3999860474786_init_data,
217
+ progressFromOffset,
218
+ offset,
219
+ step,
220
+ count,
221
+ index,
222
+ interpolateColor,
223
+ restColor,
224
+ active
225
+ }));
226
+ return /* @__PURE__ */jsx2(AnimatedPressable, {
227
+ ref,
228
+ accessibilityRole: "button",
229
+ accessibilityState: {
230
+ selected: index === current,
231
+ disabled: isDisabled
232
+ },
233
+ accessibilityValue: {
234
+ now: index + 1,
235
+ min: 1,
236
+ max: count
237
+ },
238
+ disabled: isDisabled,
239
+ hitSlop: HIT_SLOP,
240
+ ...rest,
241
+ style: [dotStyle, travel, styleProps, style],
242
+ onPress: () => goTo(index),
243
+ children
244
+ });
245
+ });
246
+ PagerDot.displayName = "XAUI.Pager.Dot";
247
+
248
+ // src/components/pager/pager-page.tsx
249
+ import { forwardRef as forwardRef3 } from "react";
250
+ import { View as View2 } from "react-native";
251
+ import { jsx as jsx3 } from "react/jsx-runtime";
252
+ var PagerPage = forwardRef3(function PagerPage2({
253
+ children,
254
+ style,
255
+ ...props
256
+ }, ref) {
257
+ const {
258
+ pageStyle,
259
+ track
260
+ } = usePager();
261
+ const [styleProps, rest] = useStyleProps(props);
262
+ return /* @__PURE__ */jsx3(View2, {
263
+ ref,
264
+ ...rest,
265
+ style: [pageStyle, {
266
+ width: track.width,
267
+ height: track.height
268
+ }, styleProps, style],
269
+ children
270
+ });
271
+ });
272
+ PagerPage.displayName = "XAUI.Pager.Page";
273
+
274
+ // src/components/pager/pager.tsx
275
+ import { forwardRef as forwardRef4, useCallback, useMemo, useState } from "react";
276
+ import { StyleSheet, View as View3 } from "react-native";
277
+ import { useAnimatedRef, useSharedValue as useSharedValue2 } from "react-native-reanimated";
278
+
279
+ // src/components/pager/pager.recipe.ts
280
+ var SLOTS = ["root", "content", "page", "indicator", "dot", "dotActive"];
281
+ var VARIANT_TOKENS = {
282
+ primary: {
283
+ bgSelected: "accent"
284
+ },
285
+ secondary: {
286
+ bgSelected: "defaultForeground"
287
+ },
288
+ // The raised ground rather than the page's, which on a light theme is white: this is the
289
+ // pager over a photograph, where an accent dot disappears into whatever is behind it.
290
+ tertiary: {
291
+ bgSelected: "surface"
292
+ }
293
+ };
294
+ var SIZES = {
295
+ xs: {
296
+ dot: 5,
297
+ gap: 1
298
+ },
299
+ sm: {
300
+ dot: 6,
301
+ gap: 1.5
302
+ },
303
+ md: {
304
+ dot: 7,
305
+ gap: 1.5
306
+ },
307
+ lg: {
308
+ dot: 8,
309
+ gap: 2
310
+ }
311
+ };
312
+ function sizeAxis(step) {
313
+ const {
314
+ dot,
315
+ gap
316
+ } = step;
317
+ return theme => ({
318
+ indicator: {
319
+ gap: theme.spacing(gap)
320
+ },
321
+ dot: {
322
+ width: dot,
323
+ height: dot,
324
+ borderRadius: dot / 2
325
+ }
326
+ });
327
+ }
328
+ function orientationAxis(direction) {
329
+ return () => ({
330
+ indicator: {
331
+ flexDirection: direction
332
+ }
333
+ });
334
+ }
335
+ var pagerRecipe = createRecipe({
336
+ slots: SLOTS,
337
+ base: theme => ({
338
+ /**
339
+ * **The root has no size of its own**, and that is deliberate rather than missing.
340
+ *
341
+ * `flex: 1` here would have been the convenient default and it is a trap: React Native
342
+ * expands it to a zero flex-basis, which **overrides an explicit `height`** — so
343
+ * `<Pager height={240}>` would collapse to the height of its dots, and the prop the
344
+ * caller reached for would silently do nothing. It is the same reason there is no
345
+ * `fullWidth` on a `Button`: RN's own behaviour is the answer, and the caller says which
346
+ * of the two they want — `flex={1}` to fill a screen, `height={320}` inside a scroll
347
+ * view.
348
+ *
349
+ * The track keeps its `flex: 1`, so it takes whatever the root was given less the dots.
350
+ * Nothing sizes it from outside, which is why it is safe there and not here.
351
+ */
352
+ content: {
353
+ flex: 1
354
+ },
355
+ // A page is the size of the track on both axes, and that number is measured rather than
356
+ // named, so it arrives as an inline style instead of from here.
357
+ page: {
358
+ overflow: "hidden"
359
+ },
360
+ indicator: {
361
+ alignItems: "center",
362
+ justifyContent: "center"
363
+ },
364
+ /**
365
+ * A neutral fill rather than a faint version of the current one: a pale tint of the
366
+ * accent under the pages reads as a control that has half failed to load. A raw `color`
367
+ * reaches the current dot, which is the one it should move.
368
+ */
369
+ dot: {
370
+ backgroundColor: theme.colors.default
371
+ }
372
+ }),
373
+ variantTokens: VARIANT_TOKENS,
374
+ /**
375
+ * The current dot, **read as a value and never applied as a style**: the colour is
376
+ * interpolated on the UI thread, and `interpolateColor` needs a string rather than a
377
+ * `StyleSheet` id. The root flattens this slot into `dotInk`, so the recipe still owns it.
378
+ */
379
+ paint: (_theme, colors) => ({
380
+ dotActive: {
381
+ backgroundColor: colors.bgSelected
382
+ }
383
+ }),
384
+ variants: {
385
+ size: {
386
+ xs: sizeAxis(SIZES.xs),
387
+ sm: sizeAxis(SIZES.sm),
388
+ md: sizeAxis(SIZES.md),
389
+ lg: sizeAxis(SIZES.lg)
390
+ },
391
+ orientation: {
392
+ horizontal: orientationAxis("row"),
393
+ vertical: orientationAxis("column")
394
+ }
395
+ },
396
+ states: {
397
+ disabled: theme => ({
398
+ indicator: {
399
+ opacity: theme.opacity.disabled
400
+ }
401
+ })
402
+ },
403
+ defaultVariants: {
404
+ variant: "primary",
405
+ size: "md",
406
+ orientation: "horizontal"
407
+ }
408
+ });
409
+
410
+ // src/components/pager/pager.tsx
411
+ import { jsx as jsx4 } from "react/jsx-runtime";
412
+ var PagerRoot = forwardRef4(function Pager({
413
+ children,
414
+ variant,
415
+ size,
416
+ color,
417
+ orientation = "horizontal",
418
+ index: indexProp,
419
+ defaultIndex = 0,
420
+ onIndexChange,
421
+ isDisabled = false,
422
+ style,
423
+ ...props
424
+ }, ref) {
425
+ const theme = useXAUITheme();
426
+ const [styleProps, rest] = useStyleProps(props);
427
+ const [index, setIndex] = useControllableState({
428
+ value: indexProp,
429
+ defaultValue: defaultIndex,
430
+ onChange: onIndexChange
431
+ });
432
+ const [track, setTrack] = useState({
433
+ width: 0,
434
+ height: 0
435
+ });
436
+ const [count, setCount] = useState(0);
437
+ const trackRef = useAnimatedRef();
438
+ const offset = useSharedValue2(0);
439
+ const selection = {
440
+ variant,
441
+ size,
442
+ orientation
443
+ };
444
+ const states = {
445
+ disabled: isDisabled
446
+ };
447
+ const styles = pagerRecipe.resolve({
448
+ theme,
449
+ selection,
450
+ states
451
+ });
452
+ const tint = color ? pagerRecipe.tint({
453
+ theme,
454
+ color,
455
+ selection,
456
+ states
457
+ }) : void 0;
458
+ const step = orientation === "horizontal" ? track.width : track.height;
459
+ const goTo = useCallback(next => {
460
+ const distance = next * step;
461
+ trackRef.current?.scrollTo({
462
+ x: orientation === "horizontal" ? distance : 0,
463
+ y: orientation === "horizontal" ? 0 : distance,
464
+ animated: true
465
+ });
466
+ setIndex(next);
467
+ }, [orientation, setIndex, step, trackRef]);
468
+ const context = useMemo(() => {
469
+ const active = StyleSheet.flatten([styles.dotActive, tint?.dotActive]);
470
+ const at = StyleSheet.flatten([styles.dot]);
471
+ return {
472
+ contentStyle: styles.content,
473
+ pageStyle: styles.page,
474
+ indicatorStyle: styles.indicator,
475
+ dotStyle: styles.dot,
476
+ // Values rather than styles: the colour is interpolated on the UI thread, and
477
+ // `interpolateColor` needs strings. The fallbacks are the tokens the recipe named, for
478
+ // the platform colours `ColorValue` also covers.
479
+ dotInk: {
480
+ rest: typeof at.backgroundColor === "string" ? at.backgroundColor : theme.colors.default,
481
+ active: typeof active.backgroundColor === "string" ? active.backgroundColor : theme.colors.accent
482
+ },
483
+ orientation,
484
+ index,
485
+ count,
486
+ setCount,
487
+ track,
488
+ setTrack,
489
+ step,
490
+ offset,
491
+ goTo,
492
+ onSettle: setIndex,
493
+ trackRef,
494
+ isDisabled
495
+ };
496
+ }, [styles, tint, theme, orientation, index, count, track, setTrack, step, offset, goTo, setIndex, trackRef, isDisabled]);
497
+ const rootStyle = [styles.root, tint?.root, styleProps, style];
498
+ return /* @__PURE__ */jsx4(PagerProvider, {
499
+ value: context,
500
+ children: /* @__PURE__ */jsx4(View3, {
501
+ ref,
502
+ ...rest,
503
+ style: rootStyle,
504
+ children
505
+ })
506
+ });
507
+ });
508
+ PagerRoot.displayName = "XAUI.Pager.Root";
509
+
510
+ // src/components/pager/index.ts
511
+ var Pager2 = Object.assign(PagerRoot, {
512
+ Content: PagerContent,
513
+ Page: PagerPage,
514
+ Indicator: PagerIndicator,
515
+ Dot: PagerDot
516
+ });
517
+ export { usePager, PagerContent, PagerIndicator, PagerDot, PagerPage, pagerRecipe, PagerRoot, Pager2 as Pager };