@xaui/native 0.9.1-alpha.41 → 0.9.1-alpha.43

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 (105) hide show
  1. package/dist/{chunk-TJ74XVZN.cjs → chunk-3JXI2IHV.cjs} +8 -8
  2. package/dist/{chunk-C5YLPCFC.cjs → chunk-4KSKQD37.cjs} +5 -5
  3. package/dist/{chunk-DA3OKXHV.cjs → chunk-54CWXA34.cjs} +59 -59
  4. package/dist/{chunk-XV735BSA.cjs → chunk-66FOASTP.cjs} +6 -6
  5. package/dist/{chunk-UFTCTTKK.js → chunk-6CO6FM67.js} +15 -15
  6. package/dist/{chunk-RU7JCMWC.cjs → chunk-76XDVA24.cjs} +6 -6
  7. package/dist/{chunk-G7P3ERYF.cjs → chunk-7KLBTMXV.cjs} +5 -5
  8. package/dist/{chunk-NWGLP6JX.cjs → chunk-7TOG4TVU.cjs} +15 -15
  9. package/dist/{chunk-ZFOOJK37.cjs → chunk-AAVCMCJ3.cjs} +2 -2
  10. package/dist/{chunk-T5FV5F7A.cjs → chunk-C5LONNXT.cjs} +6 -6
  11. package/dist/{chunk-XFPQFCEK.js → chunk-DY3SUG5P.js} +6 -6
  12. package/dist/{chunk-KCMYU7WF.js → chunk-EYD4H4X6.js} +1 -1
  13. package/dist/{chunk-DHGLGSH6.js → chunk-FBCWNXZC.js} +58 -58
  14. package/dist/{chunk-2XPG2243.js → chunk-GJSFKH4L.js} +16 -16
  15. package/dist/{chunk-DD4276RF.js → chunk-HA6BFY3A.js} +6 -6
  16. package/dist/{chunk-GFUZ3MUT.cjs → chunk-HOI5425P.cjs} +6 -6
  17. package/dist/chunk-J5WXI5NU.js +520 -0
  18. package/dist/{chunk-LRN3RNDO.js → chunk-JKP4TPIL.js} +16 -16
  19. package/dist/{chunk-6UEZJRVI.js → chunk-LIUO6D3D.js} +75 -75
  20. package/dist/{chunk-DIBUQ46Y.js → chunk-MXGER5PI.js} +5 -5
  21. package/dist/{chunk-EZEYMLO3.js → chunk-N5AEXTUM.js} +4 -4
  22. package/dist/chunk-NA262TF2.js +724 -0
  23. package/dist/{chunk-R73XQK7X.cjs → chunk-NCCRQK3P.cjs} +5 -5
  24. package/dist/{chunk-5VKYNBNA.js → chunk-NHZRQM5J.js} +4 -4
  25. package/dist/chunk-P2GKAAA3.cjs +442 -0
  26. package/dist/{chunk-VLKBESEV.cjs → chunk-QWMVMLSU.cjs} +5 -5
  27. package/dist/{chunk-GA6PBWNT.js → chunk-QZ24MZRX.js} +1 -1
  28. package/dist/{chunk-YVHT2UVW.js → chunk-R7BU4CPS.js} +1 -1
  29. package/dist/{chunk-6DOLGZVV.cjs → chunk-S4QUM4EE.cjs} +4 -4
  30. package/dist/{chunk-DG2I4PJG.js → chunk-SACDOFGF.js} +15 -15
  31. package/dist/{chunk-ABAGZTXZ.cjs → chunk-SIP5J7HU.cjs} +15 -15
  32. package/dist/{chunk-3E7CDKFO.cjs → chunk-TGMVEHV7.cjs} +61 -61
  33. package/dist/{chunk-YGYYJ3LQ.js → chunk-TRETQZEW.js} +5 -5
  34. package/dist/{chunk-UAWBAD4E.cjs → chunk-URA25DU4.cjs} +5 -5
  35. package/dist/{chunk-BRRXFOBY.js → chunk-USF6EWYR.js} +7 -7
  36. package/dist/{chunk-5R26NM4M.cjs → chunk-VPQPFLT5.cjs} +6 -6
  37. package/dist/{chunk-G3CCT4EY.js → chunk-VT34G7RT.js} +16 -16
  38. package/dist/{chunk-7YF5NAHQ.cjs → chunk-VZK3NLBH.cjs} +7 -7
  39. package/dist/{chunk-N3KTZMPG.js → chunk-XNMZQSY5.js} +5 -5
  40. package/dist/chunk-ZTBA7CNK.cjs +510 -0
  41. package/dist/components/accordion/index.cjs +5 -5
  42. package/dist/components/accordion/index.js +4 -4
  43. package/dist/components/alert/index.cjs +6 -6
  44. package/dist/components/alert/index.js +5 -5
  45. package/dist/components/avatar/index.cjs +4 -4
  46. package/dist/components/avatar/index.js +3 -3
  47. package/dist/components/badge/index.cjs +4 -4
  48. package/dist/components/badge/index.js +3 -3
  49. package/dist/components/bottom-sheet/index.cjs +37 -0
  50. package/dist/components/bottom-sheet/index.d.cts +230 -0
  51. package/dist/components/bottom-sheet/index.d.ts +230 -0
  52. package/dist/components/bottom-sheet/index.js +37 -0
  53. package/dist/components/button/index.cjs +5 -5
  54. package/dist/components/button/index.js +4 -4
  55. package/dist/components/card/index.cjs +5 -5
  56. package/dist/components/card/index.js +4 -4
  57. package/dist/components/checkbox/index.cjs +5 -5
  58. package/dist/components/checkbox/index.js +4 -4
  59. package/dist/components/chip/index.cjs +6 -6
  60. package/dist/components/chip/index.js +5 -5
  61. package/dist/components/divider/index.cjs +4 -4
  62. package/dist/components/divider/index.js +3 -3
  63. package/dist/components/field-group/index.cjs +5 -5
  64. package/dist/components/field-group/index.js +4 -4
  65. package/dist/components/input-otp/index.cjs +4 -4
  66. package/dist/components/input-otp/index.js +3 -3
  67. package/dist/components/menu/index.cjs +5 -5
  68. package/dist/components/menu/index.js +4 -4
  69. package/dist/components/popover/index.cjs +5 -5
  70. package/dist/components/popover/index.js +4 -4
  71. package/dist/components/radio/index.cjs +5 -5
  72. package/dist/components/radio/index.js +4 -4
  73. package/dist/components/select/index.cjs +5 -5
  74. package/dist/components/select/index.js +4 -4
  75. package/dist/components/slider/index.cjs +33 -0
  76. package/dist/components/slider/index.d.cts +284 -0
  77. package/dist/components/slider/index.d.ts +284 -0
  78. package/dist/components/slider/index.js +33 -0
  79. package/dist/components/spinner/index.cjs +1 -1
  80. package/dist/components/spinner/index.js +1 -1
  81. package/dist/components/switch/index.cjs +5 -5
  82. package/dist/components/switch/index.js +4 -4
  83. package/dist/components/tabs/index.cjs +5 -5
  84. package/dist/components/tabs/index.js +4 -4
  85. package/dist/components/text-area/index.cjs +5 -5
  86. package/dist/components/text-area/index.js +4 -4
  87. package/dist/components/text-field/index.cjs +4 -4
  88. package/dist/components/text-field/index.js +3 -3
  89. package/dist/components/typography/index.cjs +4 -4
  90. package/dist/components/typography/index.js +3 -3
  91. package/dist/index.cjs +85 -37
  92. package/dist/index.d.cts +2 -0
  93. package/dist/index.d.ts +2 -0
  94. package/dist/index.js +132 -84
  95. package/dist/system/index.cjs +11 -11
  96. package/dist/system/index.js +13 -13
  97. package/package.json +21 -1
  98. package/dist/{chunk-4CUZZWFW.js → chunk-26OGEFQI.js} +3 -3
  99. package/dist/{chunk-H7DS4IO7.js → chunk-346QBNUD.js} +4 -4
  100. package/dist/{chunk-J3MB4PI5.cjs → chunk-A7YB7YWX.cjs} +3 -3
  101. package/dist/{chunk-AMCSSOJT.cjs → chunk-BNFIFRQA.cjs} +3 -3
  102. package/dist/{chunk-6L2TS2R3.cjs → chunk-KSUV74BE.cjs} +3 -3
  103. package/dist/{chunk-HDVVZG4S.cjs → chunk-RKCWYUGA.cjs} +3 -3
  104. package/dist/{chunk-2NRZKJG7.js → chunk-S2WNWMNT.js} +4 -4
  105. package/dist/{chunk-73RKQC5X.js → chunk-SZLXPF3G.js} +3 -3
@@ -0,0 +1,510 @@
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; }
2
+
3
+ var _chunk7EIHHOHPcjs = require('./chunk-7EIHHOHP.cjs');
4
+
5
+
6
+ var _chunk7GHM4GKLcjs = require('./chunk-7GHM4GKL.cjs');
7
+
8
+
9
+
10
+ var _chunkFNEUOBCVcjs = require('./chunk-FNEUOBCV.cjs');
11
+
12
+
13
+
14
+ var _chunk57SJ4LJFcjs = require('./chunk-57SJ4LJF.cjs');
15
+
16
+
17
+ var _chunkTK44VBIEcjs = require('./chunk-TK44VBIE.cjs');
18
+
19
+ // src/components/slider/slider-fill.tsx
20
+ var _react = require('react');
21
+ var _reactnative = require('react-native');
22
+
23
+ // src/components/slider/slider.context.ts
24
+ var [SliderProvider, useSlider] = _chunk7GHM4GKLcjs.createSlotContext.call(void 0, "Slider");
25
+
26
+ // src/components/slider/slider-fill.tsx
27
+ var _jsxruntime = require('react/jsx-runtime');
28
+ var SliderFill = _react.forwardRef.call(void 0, function SliderFill2({ style, ...props }, ref) {
29
+ const { fillStyle, fractions, trackLength, thumbSize, orientation } = useSlider();
30
+ const [styleProps, rest] = _chunkTK44VBIEcjs.useStyleProps.call(void 0, props);
31
+ const travel = Math.max(trackLength - thumbSize, 0);
32
+ const half = thumbSize / 2;
33
+ const from = fractions.length > 1 ? fractions[0] * travel + half : 0;
34
+ const to = fractions[fractions.length - 1] * travel + half;
35
+ const vertical = orientation === "vertical";
36
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
37
+ _reactnative.View,
38
+ {
39
+ ref,
40
+ ...rest,
41
+ style: [
42
+ fillStyle,
43
+ vertical ? { bottom: from, height: to - from, top: void 0 } : { start: from, width: to - from, end: void 0 },
44
+ styleProps,
45
+ style
46
+ ]
47
+ }
48
+ );
49
+ });
50
+ SliderFill.displayName = "XAUI.Slider.Fill";
51
+
52
+ // src/components/slider/slider-output.tsx
53
+
54
+
55
+
56
+ var SliderOutput = _react.forwardRef.call(void 0,
57
+ function SliderOutput2({ children, style, ...props }, ref) {
58
+ const { outputStyle, values } = useSlider();
59
+ const [styleProps, rest] = _chunkTK44VBIEcjs.useStyleProps.call(void 0, props);
60
+ const value = values.length > 1 ? [values[0], values[1]] : values[0];
61
+ const text = values.length > 1 ? `${values[0]} \u2013 ${values[1]}` : String(values[0]);
62
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reactnative.Text, { ref, ...rest, style: [outputStyle, styleProps, style], children: typeof children === "function" ? children(value) : _nullishCoalesce(children, () => ( text)) });
63
+ }
64
+ );
65
+ SliderOutput.displayName = "XAUI.Slider.Output";
66
+
67
+ // src/components/slider/slider-thumb.tsx
68
+
69
+ var _reactnativegesturehandler = require('react-native-gesture-handler');
70
+
71
+
72
+
73
+
74
+
75
+ var _reactnativereanimated = require('react-native-reanimated'); var _reactnativereanimated2 = _interopRequireDefault(_reactnativereanimated);
76
+
77
+ // src/components/slider/slider.animation.ts
78
+ var THUMB_PRESSED_SCALE = 1.15;
79
+ var THUMB_SPRING = { damping: 18, stiffness: 320, mass: 0.5 };
80
+
81
+ // src/components/slider/slider-thumb.tsx
82
+
83
+ function SliderThumb({
84
+ index = 0,
85
+ accessibilityValueText,
86
+ style,
87
+ ...props
88
+ }) {
89
+ const {
90
+ thumbStyle,
91
+ values,
92
+ min,
93
+ max,
94
+ step,
95
+ isDisabled,
96
+ fractions,
97
+ trackLength,
98
+ thumbSize,
99
+ orientation,
100
+ slideTo,
101
+ commit
102
+ } = useSlider();
103
+ const [styleProps, rest] = _chunkTK44VBIEcjs.useStyleProps.call(void 0, props);
104
+ const pressed = _reactnativereanimated.useSharedValue.call(void 0, 0);
105
+ const vertical = orientation === "vertical";
106
+ const travel = Math.max(trackLength - thumbSize, 0);
107
+ const value = _nullishCoalesce(values[index], () => ( values[0]));
108
+ const fraction = _nullishCoalesce(fractions[index], () => ( fractions[0]));
109
+ const start = _reactnativereanimated.useSharedValue.call(void 0, 0);
110
+ const move = _react.useCallback.call(void 0,
111
+ (along) => slideTo(index, travel === 0 ? 0 : along / travel),
112
+ [index, slideTo, travel]
113
+ );
114
+ const pan = _reactnativegesturehandler.Gesture.Pan().enabled(!isDisabled).onBegin(() => {
115
+ start.set(fraction * travel);
116
+ pressed.set(_reactnativereanimated.withSpring.call(void 0, 1, THUMB_SPRING));
117
+ }).onUpdate((event) => {
118
+ _reactnativereanimated.runOnJS.call(void 0, move)(
119
+ start.get() + (vertical ? -event.translationY : event.translationX)
120
+ );
121
+ }).onFinalize(() => {
122
+ pressed.set(_reactnativereanimated.withSpring.call(void 0, 0, THUMB_SPRING));
123
+ _reactnativereanimated.runOnJS.call(void 0, commit)();
124
+ });
125
+ const scale = _reactnativereanimated.useAnimatedStyle.call(void 0, () => ({
126
+ transform: [{ scale: 1 + pressed.get() * (THUMB_PRESSED_SCALE - 1) }]
127
+ }));
128
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reactnativegesturehandler.GestureDetector, { gesture: pan, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
129
+ _reactnativereanimated2.default.View,
130
+ {
131
+ accessibilityRole: "adjustable",
132
+ accessibilityValue: {
133
+ min,
134
+ max,
135
+ now: value,
136
+ text: _optionalChain([accessibilityValueText, 'optionalCall', _ => _(value)])
137
+ },
138
+ accessibilityActions: [{ name: "increment" }, { name: "decrement" }],
139
+ onAccessibilityAction: (event) => {
140
+ const delta = event.nativeEvent.actionName === "increment" ? step : -step;
141
+ const next = value + (step === 0 ? (max - min) / 10 : delta);
142
+ slideTo(index, max === min ? 0 : (next - min) / (max - min));
143
+ commit();
144
+ },
145
+ "aria-disabled": isDisabled || void 0,
146
+ ...rest,
147
+ style: [
148
+ thumbStyle,
149
+ vertical ? { bottom: fraction * travel } : { start: fraction * travel },
150
+ scale,
151
+ styleProps,
152
+ style
153
+ ]
154
+ }
155
+ ) });
156
+ }
157
+ SliderThumb.displayName = "XAUI.Slider.Thumb";
158
+
159
+ // src/components/slider/slider-track.tsx
160
+
161
+
162
+
163
+ var SliderTrack = _react.forwardRef.call(void 0, function SliderTrack2({ children, style, onLayout, ...props }, ref) {
164
+ const {
165
+ trackStyle,
166
+ trackLength,
167
+ thumbSize,
168
+ orientation,
169
+ isDisabled,
170
+ setTrackLength,
171
+ slideTo,
172
+ thumbFor,
173
+ commit
174
+ } = useSlider();
175
+ const [styleProps, rest] = _chunkTK44VBIEcjs.useStyleProps.call(void 0, props);
176
+ const vertical = orientation === "vertical";
177
+ const measure = _react.useCallback.call(void 0,
178
+ (event) => {
179
+ _optionalChain([onLayout, 'optionalCall', _2 => _2(event)]);
180
+ const { width, height } = event.nativeEvent.layout;
181
+ setTrackLength(vertical ? height : width);
182
+ },
183
+ [onLayout, setTrackLength, vertical]
184
+ );
185
+ const handlePress = _react.useCallback.call(void 0,
186
+ (event) => {
187
+ const travel = Math.max(trackLength - thumbSize, 1);
188
+ const along = vertical ? (
189
+ // Counted from the bottom: a press near the floor of a vertical rail is a small
190
+ // value, not a large one.
191
+ trackLength - event.nativeEvent.locationY
192
+ ) : event.nativeEvent.locationX;
193
+ const fraction = (along - thumbSize / 2) / travel;
194
+ slideTo(thumbFor(fraction), fraction);
195
+ commit();
196
+ },
197
+ [commit, slideTo, thumbFor, thumbSize, trackLength, vertical]
198
+ );
199
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
200
+ _reactnative.Pressable,
201
+ {
202
+ ref,
203
+ disabled: isDisabled,
204
+ onPress: handlePress,
205
+ ...rest,
206
+ onLayout: measure,
207
+ style: [trackStyle, styleProps, style],
208
+ children
209
+ }
210
+ );
211
+ });
212
+ SliderTrack.displayName = "XAUI.Slider.Track";
213
+
214
+ // src/components/slider/slider.tsx
215
+
216
+
217
+
218
+ // src/components/slider/slider.recipe.ts
219
+ var SLOTS = ["root", "output", "track", "fill", "thumb"];
220
+ var VARIANT_TOKENS = {
221
+ default: { bg: "default", bgSelected: "accent" }
222
+ };
223
+ var FILL_ALPHA = 0.35;
224
+ var SIZES = {
225
+ sm: { track: 6, thumb: 16, output: "xs" },
226
+ md: { track: 8, thumb: 20, output: "sm" },
227
+ lg: { track: 10, thumb: 24, output: "md" }
228
+ };
229
+ var VERTICAL_LENGTH = 220;
230
+ function rail(step, orientation) {
231
+ const { track, thumb, output } = step;
232
+ const vertical = orientation === "vertical";
233
+ const overhang = (thumb - track) / 2;
234
+ return (theme) => ({
235
+ root: vertical ? { flexDirection: "row", alignItems: "center" } : { flexDirection: "column", width: "100%" },
236
+ track: vertical ? {
237
+ width: track,
238
+ height: VERTICAL_LENGTH,
239
+ alignItems: "center",
240
+ // The room the knob needs, reserved by the rail rather than by a box around it.
241
+ // Without it the knob overhangs into whatever is beside the slider, and the
242
+ // layout has no idea the control is wider than its rail.
243
+ marginHorizontal: overhang
244
+ } : {
245
+ height: track,
246
+ width: "100%",
247
+ justifyContent: "center",
248
+ marginVertical: overhang
249
+ },
250
+ // Pulled back by the overhang so its centre sits on the rail's centre line.
251
+ thumb: vertical ? { width: thumb, height: thumb, borderRadius: thumb / 2, start: -overhang } : { width: thumb, height: thumb, borderRadius: thumb / 2, top: -overhang },
252
+ fill: vertical ? { start: 0, end: 0, bottom: 0 } : { top: 0, bottom: 0, start: 0 },
253
+ output: {
254
+ fontSize: theme.fontSizes[output],
255
+ lineHeight: theme.lineHeights[output]
256
+ }
257
+ });
258
+ }
259
+ var sliderRecipe = _chunkFNEUOBCVcjs.createRecipe.call(void 0, {
260
+ slots: SLOTS,
261
+ base: (theme) => ({
262
+ root: { gap: theme.spacing(2) },
263
+ output: {
264
+ fontFamily: theme.fontFamilies.body,
265
+ fontWeight: theme.fontWeights.medium,
266
+ color: theme.colors.muted
267
+ },
268
+ // `full` rather than a step of the radius scale: a rail's ends are semicircles at every
269
+ // thickness, and any fixed number is wrong for two of the three sizes.
270
+ track: { borderRadius: theme.radius.full },
271
+ fill: { position: "absolute", borderRadius: theme.radius.full },
272
+ /**
273
+ * The knob: a solid disc of the fill's own colour, lifted off the rail by a shadow.
274
+ *
275
+ * That is Material's slider thumb rather than the legacy component's, which drew a
276
+ * ring — the page's colour inside a two-point border. A ring reads as weak at sixteen
277
+ * points and disappears against a busy background, and its border is the same two
278
+ * points whether the knob is 16 or 24, so the smallest size is proportionally the
279
+ * thinnest. The disc is the same shape at every size, and it never has to fight the
280
+ * fill for contrast because the fill is a softened version of it.
281
+ */
282
+ thumb: { position: "absolute", ...theme.shadows.surface }
283
+ }),
284
+ variantTokens: VARIANT_TOKENS,
285
+ /**
286
+ * Three steps of one colour, not two.
287
+ *
288
+ * The rail is the theme's neutral; the reach is the colour at `FILL_ALPHA`; the knob is
289
+ * the colour at full. Read left to right that is grey, then a wash of the colour, then
290
+ * the colour — so the eye lands on the knob, which is the value, rather than on the bar
291
+ * behind it, which is only how far the value has come.
292
+ *
293
+ * Material's slider is the same relationship with the steps assigned differently: their
294
+ * inactive track is the soft one and their active track is full. Moving the soft step
295
+ * onto the *reach* rather than the remainder is where this stops being theirs — a filled
296
+ * bar at full strength competes with the handle for the eye, and the handle is the part
297
+ * you can move.
298
+ *
299
+ * Both the reach and the knob come off the same role, so a raw `color` moves all three
300
+ * steps at once and none of them can drift from the others.
301
+ */
302
+ paint: (_theme, colors) => ({
303
+ track: { backgroundColor: colors.bg },
304
+ fill: {
305
+ backgroundColor: colors.bgSelected ? _chunk57SJ4LJFcjs.alpha.call(void 0, colors.bgSelected, FILL_ALPHA) : void 0
306
+ },
307
+ thumb: { backgroundColor: colors.bgSelected }
308
+ }),
309
+ variants: {
310
+ // The axes select; the compound below is what paints. Both are declared so `size` and
311
+ // `orientation` are part of the cache key and a press still allocates nothing.
312
+ size: { sm: () => ({}), md: () => ({}), lg: () => ({}) },
313
+ orientation: { horizontal: () => ({}), vertical: () => ({}) },
314
+ radius: _chunkFNEUOBCVcjs.radiusAxis.call(void 0, "track", "fill")
315
+ },
316
+ compoundVariants: ["sm", "md", "lg"].flatMap(
317
+ (size) => ["horizontal", "vertical"].map((orientation) => ({
318
+ when: { size, orientation },
319
+ style: rail(SIZES[size], orientation)
320
+ }))
321
+ ),
322
+ states: {
323
+ /**
324
+ * Grey, and the colour goes entirely. A disabled slider still reports a value, so the
325
+ * bar has to stay legible — dimming the accent would leave a pale lavender that reads
326
+ * as an enabled slider seen through fog, where a neutral one reads as switched off.
327
+ */
328
+ disabled: (theme) => ({
329
+ root: { opacity: theme.opacity.disabled },
330
+ fill: { backgroundColor: theme.colors.defaultSoft },
331
+ thumb: { backgroundColor: theme.colors.muted }
332
+ })
333
+ },
334
+ defaultVariants: { variant: "default", size: "md", orientation: "horizontal" }
335
+ });
336
+
337
+ // src/components/slider/slider.utils.ts
338
+ function toFraction(value, { min, max }) {
339
+ if (max === min) return 0;
340
+ return clamp((value - min) / (max - min), 0, 1);
341
+ }
342
+ function fromFraction(fraction, range) {
343
+ const { min, max } = range;
344
+ return snap(min + clamp(fraction, 0, 1) * (max - min), range);
345
+ }
346
+ function snap(value, { min, max, step }) {
347
+ if (step <= 0) return clamp(value, min, max);
348
+ const steps = Math.round((clamp(value, min, max) - min) / step);
349
+ return clamp(round(min + steps * step, min, step), min, max);
350
+ }
351
+ function round(value, min, step) {
352
+ const factor = 10 ** Math.max(decimalsOf(step), decimalsOf(min));
353
+ return Math.round(value * factor) / factor;
354
+ }
355
+ function decimalsOf(step) {
356
+ const text = String(step);
357
+ const dot = text.indexOf(".");
358
+ return dot === -1 ? 0 : text.length - dot - 1;
359
+ }
360
+ function clamp(value, min, max) {
361
+ return Math.min(Math.max(value, min), max);
362
+ }
363
+ function toValues(value, range) {
364
+ return Array.isArray(value) ? [snap(value[0], range), snap(value[1], range)] : [snap(value, range)];
365
+ }
366
+ function fromValues(values) {
367
+ return values.length > 1 ? [values[0], values[1]] : values[0];
368
+ }
369
+ function withThumbAt(values, index, value, range) {
370
+ const next = [...values];
371
+ const lower = index > 0 ? values[index - 1] : range.min;
372
+ const upper = index < values.length - 1 ? values[index + 1] : range.max;
373
+ next[index] = snap(Math.min(Math.max(value, lower), upper), range);
374
+ return next;
375
+ }
376
+ function nearestThumb(values, value) {
377
+ let best = 0;
378
+ let distance = Math.abs(values[0] - value);
379
+ for (let i = 1; i < values.length; i += 1) {
380
+ const d = Math.abs(values[i] - value);
381
+ if (d < distance) {
382
+ best = i;
383
+ distance = d;
384
+ }
385
+ }
386
+ return best;
387
+ }
388
+
389
+ // src/components/slider/slider.tsx
390
+
391
+ var SliderRoot = _react.forwardRef.call(void 0, function Slider({
392
+ children,
393
+ size,
394
+ orientation = "horizontal",
395
+ radius,
396
+ color,
397
+ value: controlledValue,
398
+ defaultValue = 0,
399
+ onValueChange,
400
+ onValueCommit,
401
+ min = 0,
402
+ max = 100,
403
+ step = 1,
404
+ isDisabled = false,
405
+ style,
406
+ ...props
407
+ }, ref) {
408
+ const theme = _chunk57SJ4LJFcjs.useXAUITheme.call(void 0, );
409
+ const [styleProps, rest] = _chunkTK44VBIEcjs.useStyleProps.call(void 0, props);
410
+ const [trackLength, setTrackLength] = _react.useState.call(void 0, 0);
411
+ const range = { min, max, step };
412
+ const [raw, setValue] = _chunk7EIHHOHPcjs.useControllableState.call(void 0, {
413
+ value: controlledValue,
414
+ defaultValue,
415
+ onChange: onValueChange
416
+ });
417
+ const values = toValues(raw, range);
418
+ const selection = { size, orientation, radius };
419
+ const styles = sliderRecipe.resolve({
420
+ theme,
421
+ selection,
422
+ states: { disabled: isDisabled }
423
+ });
424
+ const tint = color ? sliderRecipe.tint({ theme, color, selection }) : void 0;
425
+ const slideTo = _react.useCallback.call(void 0,
426
+ (index, fraction) => {
427
+ const at = fromFraction(fraction, { min, max, step });
428
+ setValue(
429
+ (current) => fromValues(
430
+ withThumbAt(toValues(current, { min, max, step }), index, at, {
431
+ min,
432
+ max,
433
+ step
434
+ })
435
+ )
436
+ );
437
+ },
438
+ [max, min, setValue, step]
439
+ );
440
+ const thumbFor = _react.useCallback.call(void 0,
441
+ (fraction) => nearestThumb(values, fromFraction(fraction, { min, max, step })),
442
+ [max, min, step, values]
443
+ );
444
+ const commit = _react.useCallback.call(void 0,
445
+ () => _optionalChain([onValueCommit, 'optionalCall', _3 => _3(fromValues(values))]),
446
+ [onValueCommit, values]
447
+ );
448
+ const context = _react.useMemo.call(void 0, () => {
449
+ const thumb = _reactnative.StyleSheet.flatten([styles.thumb]);
450
+ return {
451
+ outputStyle: styles.output,
452
+ trackStyle: tint ? [styles.track, tint.track] : styles.track,
453
+ fillStyle: tint ? [styles.fill, tint.fill] : styles.fill,
454
+ thumbStyle: tint ? [styles.thumb, tint.thumb] : styles.thumb,
455
+ orientation,
456
+ values,
457
+ min,
458
+ max,
459
+ step,
460
+ isDisabled,
461
+ fractions: values.map((v) => toFraction(v, { min, max, step })),
462
+ trackLength,
463
+ setTrackLength,
464
+ // Read off the resolved style rather than recomputed: the knob's diameter is what
465
+ // the rail insets its travel by, and both have to be the same number or the knob
466
+ // overhangs the end.
467
+ thumbSize: typeof thumb.width === "number" ? thumb.width : 0,
468
+ slideTo,
469
+ thumbFor,
470
+ commit
471
+ };
472
+ }, [
473
+ styles,
474
+ tint,
475
+ values,
476
+ min,
477
+ max,
478
+ step,
479
+ isDisabled,
480
+ orientation,
481
+ trackLength,
482
+ slideTo,
483
+ thumbFor,
484
+ commit
485
+ ]);
486
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, SliderProvider, { value: context, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reactnative.View, { ref, ...rest, style: [styles.root, styleProps, style], children }) });
487
+ });
488
+ SliderRoot.displayName = "XAUI.Slider.Root";
489
+
490
+ // src/components/slider/index.ts
491
+ var Slider2 = Object.assign(SliderRoot, {
492
+ Output: SliderOutput,
493
+ Track: SliderTrack,
494
+ Fill: SliderFill,
495
+ Thumb: SliderThumb
496
+ });
497
+
498
+
499
+
500
+
501
+
502
+
503
+
504
+
505
+
506
+
507
+
508
+
509
+
510
+ exports.useSlider = useSlider; exports.SliderFill = SliderFill; exports.SliderOutput = SliderOutput; exports.SliderThumb = SliderThumb; exports.SliderTrack = SliderTrack; exports.sliderRecipe = sliderRecipe; exports.toFraction = toFraction; exports.fromFraction = fromFraction; exports.snap = snap; exports.SliderRoot = SliderRoot; exports.Slider = Slider2;
@@ -9,17 +9,17 @@
9
9
 
10
10
 
11
11
 
12
- var _chunkG7P3ERYFcjs = require('../../chunk-G7P3ERYF.cjs');
12
+ var _chunk7KLBTMXVcjs = require('../../chunk-7KLBTMXV.cjs');
13
13
  require('../../chunk-EKS3W46M.cjs');
14
14
  require('../../chunk-4KFKWBN5.cjs');
15
15
  require('../../chunk-7EIHHOHP.cjs');
16
- require('../../chunk-3E7CDKFO.cjs');
16
+ require('../../chunk-TGMVEHV7.cjs');
17
17
  require('../../chunk-7DPL3ZDS.cjs');
18
18
  require('../../chunk-EJQCQPET.cjs');
19
- require('../../chunk-FNEUOBCV.cjs');
20
- require('../../chunk-57SJ4LJF.cjs');
21
19
  require('../../chunk-7GHM4GKL.cjs');
22
20
  require('../../chunk-H4E4HDEP.cjs');
21
+ require('../../chunk-FNEUOBCV.cjs');
22
+ require('../../chunk-57SJ4LJF.cjs');
23
23
  require('../../chunk-TK44VBIE.cjs');
24
24
 
25
25
 
@@ -32,4 +32,4 @@ require('../../chunk-TK44VBIE.cjs');
32
32
 
33
33
 
34
34
 
35
- exports.Accordion = _chunkG7P3ERYFcjs.Accordion; exports.AccordionContent = _chunkG7P3ERYFcjs.AccordionContent; exports.AccordionIndicator = _chunkG7P3ERYFcjs.AccordionIndicator; exports.AccordionItem = _chunkG7P3ERYFcjs.AccordionItem; exports.AccordionRoot = _chunkG7P3ERYFcjs.AccordionRoot; exports.AccordionTrigger = _chunkG7P3ERYFcjs.AccordionTrigger; exports.accordionLayoutTransition = _chunkG7P3ERYFcjs.LAYOUT; exports.accordionRecipe = _chunkG7P3ERYFcjs.accordionRecipe; exports.useAccordion = _chunkG7P3ERYFcjs.useAccordion; exports.useAccordionItem = _chunkG7P3ERYFcjs.useAccordionItem;
35
+ exports.Accordion = _chunk7KLBTMXVcjs.Accordion; exports.AccordionContent = _chunk7KLBTMXVcjs.AccordionContent; exports.AccordionIndicator = _chunk7KLBTMXVcjs.AccordionIndicator; exports.AccordionItem = _chunk7KLBTMXVcjs.AccordionItem; exports.AccordionRoot = _chunk7KLBTMXVcjs.AccordionRoot; exports.AccordionTrigger = _chunk7KLBTMXVcjs.AccordionTrigger; exports.accordionLayoutTransition = _chunk7KLBTMXVcjs.LAYOUT; exports.accordionRecipe = _chunk7KLBTMXVcjs.accordionRecipe; exports.useAccordion = _chunk7KLBTMXVcjs.useAccordion; exports.useAccordionItem = _chunk7KLBTMXVcjs.useAccordionItem;
@@ -9,17 +9,17 @@ import {
9
9
  accordionRecipe,
10
10
  useAccordion,
11
11
  useAccordionItem
12
- } from "../../chunk-2XPG2243.js";
12
+ } from "../../chunk-GJSFKH4L.js";
13
13
  import "../../chunk-64MXEVT3.js";
14
14
  import "../../chunk-FHUYHV6J.js";
15
15
  import "../../chunk-F6W3JQ7K.js";
16
- import "../../chunk-6UEZJRVI.js";
16
+ import "../../chunk-LIUO6D3D.js";
17
17
  import "../../chunk-423RQBOX.js";
18
18
  import "../../chunk-EGLLDKN6.js";
19
- import "../../chunk-4GTAZM2C.js";
20
- import "../../chunk-A3EGFI6T.js";
21
19
  import "../../chunk-K72UDPVN.js";
22
20
  import "../../chunk-36PRYGAM.js";
21
+ import "../../chunk-4GTAZM2C.js";
22
+ import "../../chunk-A3EGFI6T.js";
23
23
  import "../../chunk-M63GFNKV.js";
24
24
  export {
25
25
  Accordion,
@@ -2,19 +2,19 @@
2
2
 
3
3
 
4
4
 
5
- var _chunkXV735BSAcjs = require('../../chunk-XV735BSA.cjs');
6
- require('../../chunk-ZFOOJK37.cjs');
5
+ var _chunk66FOASTPcjs = require('../../chunk-66FOASTP.cjs');
6
+ require('../../chunk-AAVCMCJ3.cjs');
7
7
  require('../../chunk-4KFKWBN5.cjs');
8
- require('../../chunk-3E7CDKFO.cjs');
8
+ require('../../chunk-TGMVEHV7.cjs');
9
9
  require('../../chunk-7DPL3ZDS.cjs');
10
10
  require('../../chunk-EJQCQPET.cjs');
11
- require('../../chunk-FNEUOBCV.cjs');
12
- require('../../chunk-57SJ4LJF.cjs');
13
11
  require('../../chunk-7GHM4GKL.cjs');
14
12
  require('../../chunk-H4E4HDEP.cjs');
13
+ require('../../chunk-FNEUOBCV.cjs');
14
+ require('../../chunk-57SJ4LJF.cjs');
15
15
  require('../../chunk-TK44VBIE.cjs');
16
16
 
17
17
 
18
18
 
19
19
 
20
- exports.Alert = _chunkXV735BSAcjs.Alert; exports.alertRecipe = _chunkXV735BSAcjs.alertRecipe; exports.useAlert = _chunkXV735BSAcjs.useAlert;
20
+ exports.Alert = _chunk66FOASTPcjs.Alert; exports.alertRecipe = _chunk66FOASTPcjs.alertRecipe; exports.useAlert = _chunk66FOASTPcjs.useAlert;
@@ -2,16 +2,16 @@ import {
2
2
  Alert,
3
3
  alertRecipe,
4
4
  useAlert
5
- } from "../../chunk-DD4276RF.js";
6
- import "../../chunk-KCMYU7WF.js";
5
+ } from "../../chunk-HA6BFY3A.js";
6
+ import "../../chunk-EYD4H4X6.js";
7
7
  import "../../chunk-FHUYHV6J.js";
8
- import "../../chunk-6UEZJRVI.js";
8
+ import "../../chunk-LIUO6D3D.js";
9
9
  import "../../chunk-423RQBOX.js";
10
10
  import "../../chunk-EGLLDKN6.js";
11
- import "../../chunk-4GTAZM2C.js";
12
- import "../../chunk-A3EGFI6T.js";
13
11
  import "../../chunk-K72UDPVN.js";
14
12
  import "../../chunk-36PRYGAM.js";
13
+ import "../../chunk-4GTAZM2C.js";
14
+ import "../../chunk-A3EGFI6T.js";
15
15
  import "../../chunk-M63GFNKV.js";
16
16
  export {
17
17
  Alert,
@@ -2,15 +2,15 @@
2
2
 
3
3
 
4
4
 
5
- var _chunkNWGLP6JXcjs = require('../../chunk-NWGLP6JX.cjs');
5
+ var _chunk7TOG4TVUcjs = require('../../chunk-7TOG4TVU.cjs');
6
6
  require('../../chunk-4KFKWBN5.cjs');
7
- require('../../chunk-FNEUOBCV.cjs');
8
- require('../../chunk-57SJ4LJF.cjs');
9
7
  require('../../chunk-7GHM4GKL.cjs');
10
8
  require('../../chunk-H4E4HDEP.cjs');
9
+ require('../../chunk-FNEUOBCV.cjs');
10
+ require('../../chunk-57SJ4LJF.cjs');
11
11
  require('../../chunk-TK44VBIE.cjs');
12
12
 
13
13
 
14
14
 
15
15
 
16
- exports.Avatar = _chunkNWGLP6JXcjs.Avatar; exports.avatarRecipe = _chunkNWGLP6JXcjs.avatarRecipe; exports.useAvatar = _chunkNWGLP6JXcjs.useAvatar;
16
+ exports.Avatar = _chunk7TOG4TVUcjs.Avatar; exports.avatarRecipe = _chunk7TOG4TVUcjs.avatarRecipe; exports.useAvatar = _chunk7TOG4TVUcjs.useAvatar;
@@ -2,12 +2,12 @@ import {
2
2
  Avatar,
3
3
  avatarRecipe,
4
4
  useAvatar
5
- } from "../../chunk-UFTCTTKK.js";
5
+ } from "../../chunk-6CO6FM67.js";
6
6
  import "../../chunk-FHUYHV6J.js";
7
- import "../../chunk-4GTAZM2C.js";
8
- import "../../chunk-A3EGFI6T.js";
9
7
  import "../../chunk-K72UDPVN.js";
10
8
  import "../../chunk-36PRYGAM.js";
9
+ import "../../chunk-4GTAZM2C.js";
10
+ import "../../chunk-A3EGFI6T.js";
11
11
  import "../../chunk-M63GFNKV.js";
12
12
  export {
13
13
  Avatar,
@@ -2,14 +2,14 @@
2
2
 
3
3
 
4
4
 
5
- var _chunkHDVVZG4Scjs = require('../../chunk-HDVVZG4S.cjs');
6
- require('../../chunk-FNEUOBCV.cjs');
7
- require('../../chunk-57SJ4LJF.cjs');
5
+ var _chunkRKCWYUGAcjs = require('../../chunk-RKCWYUGA.cjs');
8
6
  require('../../chunk-7GHM4GKL.cjs');
9
7
  require('../../chunk-H4E4HDEP.cjs');
8
+ require('../../chunk-FNEUOBCV.cjs');
9
+ require('../../chunk-57SJ4LJF.cjs');
10
10
  require('../../chunk-TK44VBIE.cjs');
11
11
 
12
12
 
13
13
 
14
14
 
15
- exports.Badge = _chunkHDVVZG4Scjs.Badge; exports.badgeRecipe = _chunkHDVVZG4Scjs.badgeRecipe; exports.placementInsets = _chunkHDVVZG4Scjs.placementInsets;
15
+ exports.Badge = _chunkRKCWYUGAcjs.Badge; exports.badgeRecipe = _chunkRKCWYUGAcjs.badgeRecipe; exports.placementInsets = _chunkRKCWYUGAcjs.placementInsets;
@@ -2,11 +2,11 @@ import {
2
2
  Badge,
3
3
  badgeRecipe,
4
4
  placementInsets
5
- } from "../../chunk-H7DS4IO7.js";
6
- import "../../chunk-4GTAZM2C.js";
7
- import "../../chunk-A3EGFI6T.js";
5
+ } from "../../chunk-346QBNUD.js";
8
6
  import "../../chunk-K72UDPVN.js";
9
7
  import "../../chunk-36PRYGAM.js";
8
+ import "../../chunk-4GTAZM2C.js";
9
+ import "../../chunk-A3EGFI6T.js";
10
10
  import "../../chunk-M63GFNKV.js";
11
11
  export {
12
12
  Badge,