@xaui/native 0.9.1-alpha.7 → 0.9.1-alpha.9

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.
@@ -3,12 +3,8 @@
3
3
 
4
4
  var _chunk3QBT3Q65cjs = require('./chunk-3QBT3Q65.cjs');
5
5
 
6
- // src/system/icon/icon.tsx
7
- var _react = require('react');
8
- var _reactnative = require('react-native');
9
-
10
6
  // src/system/icon/icon-context.ts
11
-
7
+ var _react = require('react');
12
8
  var IconContext = _react.createContext.call(void 0, {});
13
9
  IconContext.displayName = "XAUI.Icon.Context";
14
10
  function useIconContext() {
@@ -16,6 +12,9 @@ function useIconContext() {
16
12
  }
17
13
 
18
14
  // src/system/icon/icon.tsx
15
+
16
+ var _reactnative = require('react-native');
17
+ var _jsxruntime = require('react/jsx-runtime');
19
18
  function Icon({
20
19
  as: Component,
21
20
  children,
@@ -29,7 +28,7 @@ function Icon({
29
28
  const resolvedSize = _nullishCoalesce(_nullishCoalesce(size, () => ( inherited.size)), () => ( theme.fontSizes.md));
30
29
  const resolvedColor = _nullishCoalesce(_nullishCoalesce(color, () => ( inherited.color)), () => ( theme.colors.foreground));
31
30
  if (Component) {
32
- return /* @__PURE__ */ React.createElement(Component, { size: resolvedSize, color: resolvedColor });
31
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Component, { size: resolvedSize, color: resolvedColor });
33
32
  }
34
33
  if (_react.isValidElement.call(void 0, children)) {
35
34
  return _react.cloneElement.call(void 0, children, {
@@ -39,7 +38,7 @@ function Icon({
39
38
  });
40
39
  }
41
40
  if (source) {
42
- return /* @__PURE__ */ React.createElement(
41
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
43
42
  _reactnative.Image,
44
43
  {
45
44
  source,
@@ -56,65 +55,28 @@ function Icon({
56
55
  }
57
56
  Icon.displayName = "XAUI.Icon";
58
57
 
59
- // src/system/portal/portal.tsx
60
-
61
-
62
- // src/system/portal/portal-context.ts
63
-
64
- var PortalContext = _react.createContext.call(void 0, null);
58
+ // src/system/slot/children-to-string.ts
65
59
 
66
- // src/system/portal/portal.tsx
67
- function Portal({ children }) {
68
- const context = _react.useContext.call(void 0, PortalContext);
69
- const key = _react.useId.call(void 0, );
70
- _react.useLayoutEffect.call(void 0, () => {
71
- _optionalChain([context, 'optionalAccess', _ => _.addPortal, 'call', _2 => _2(key, children)]);
72
- }, [children, context, key]);
73
- _react.useLayoutEffect.call(void 0, () => {
74
- return () => _optionalChain([context, 'optionalAccess', _3 => _3.removePortal, 'call', _4 => _4(key)]);
75
- }, [context, key]);
76
- return null;
60
+ function childrenToString(children) {
61
+ const text = stringify(children);
62
+ return text === null || text === "" ? null : text;
77
63
  }
78
- Portal.displayName = "XAUI.Portal";
79
-
80
- // src/system/portal/portal-host.tsx
81
-
82
-
83
- var styles = _reactnative.StyleSheet.create({
84
- container: { flex: 1 }
85
- });
86
- function PortalHost({ children }) {
87
- const [portals, setPortals] = _react.useState.call(void 0, /* @__PURE__ */ new Map());
88
- const addPortal = _react.useCallback.call(void 0, (key, element) => {
89
- setPortals((current) => new Map(current).set(key, element));
90
- }, []);
91
- const removePortal = _react.useCallback.call(void 0, (key) => {
92
- setPortals((current) => {
93
- if (!current.has(key)) return current;
94
- const next = new Map(current);
95
- next.delete(key);
96
- return next;
97
- });
98
- }, []);
99
- const methods = _react.useMemo.call(void 0,
100
- () => ({ addPortal, removePortal }),
101
- [addPortal, removePortal]
102
- );
103
- return /* @__PURE__ */ React.createElement(PortalContext.Provider, { value: methods }, /* @__PURE__ */ React.createElement(_reactnative.View, { style: styles.container }, children, Array.from(portals, ([key, element]) => /* @__PURE__ */ React.createElement(_react.Fragment, { key }, element))));
64
+ function stringify(node) {
65
+ if (node === null || node === void 0 || typeof node === "boolean") return "";
66
+ if (typeof node === "string") return node;
67
+ if (typeof node === "number") return String(node);
68
+ if (_react.isValidElement.call(void 0, node)) return null;
69
+ if (Array.isArray(node)) {
70
+ let text = "";
71
+ for (const child of node) {
72
+ const part = stringify(child);
73
+ if (part === null) return null;
74
+ text += part;
75
+ }
76
+ return text;
77
+ }
78
+ return null;
104
79
  }
105
- PortalHost.displayName = "XAUI.PortalHost";
106
-
107
- // src/system/pressable-feedback/pressable-feedback.tsx
108
-
109
-
110
-
111
-
112
-
113
-
114
- var _reactnativereanimated = require('react-native-reanimated'); var _reactnativereanimated2 = _interopRequireDefault(_reactnativereanimated);
115
-
116
- // src/system/pressable-feedback/pressable-feedback-context.ts
117
-
118
80
 
119
81
  // src/system/slot/create-slot-context.ts
120
82
 
@@ -127,7 +89,7 @@ function createSlotContext(name) {
127
89
  const error = new Error(
128
90
  `XAUI: use${name} must be called inside <${name}>. A slot reads the values its root resolved, so it can only be rendered as a child of one.`
129
91
  );
130
- _optionalChain([Error, 'access', _5 => _5.captureStackTrace, 'optionalCall', _6 => _6(
92
+ _optionalChain([Error, 'access', _ => _.captureStackTrace, 'optionalCall', _2 => _2(
131
93
  error,
132
94
  useSlotContext
133
95
  )]);
@@ -138,18 +100,84 @@ function createSlotContext(name) {
138
100
  return [Context.Provider, useSlotContext];
139
101
  }
140
102
 
141
- // src/system/pressable-feedback/pressable-feedback-context.ts
142
- var [FeedbackProvider, useFeedback] = createSlotContext("PressableFeedback");
143
- var DisableAllContext = _react.createContext.call(void 0, false);
144
-
145
- // src/system/pressable-feedback/pressable-feedback-highlight.tsx
146
-
147
-
103
+ // src/system/slot/merge-refs.ts
104
+ function mergeRefs(...refs) {
105
+ return (value) => {
106
+ for (const ref of refs) {
107
+ if (typeof ref === "function") ref(value);
108
+ else if (ref) ref.current = value;
109
+ }
110
+ };
111
+ }
148
112
 
113
+ // src/system/slot/merge-props.ts
114
+ var EVENT_HANDLER = /^on[A-Z]/;
115
+ function mergeProps(ours, theirs) {
116
+ const merged = { ...ours };
117
+ for (const key of Object.keys(theirs)) {
118
+ const ourValue = ours[key];
119
+ const theirValue = theirs[key];
120
+ if (EVENT_HANDLER.test(key)) {
121
+ merged[key] = composeHandlers(ourValue, theirValue);
122
+ } else if (key === "style") {
123
+ merged[key] = mergeStyles(ourValue, theirValue);
124
+ } else if (key === "ref") {
125
+ merged[key] = mergeRefs(
126
+ ourValue,
127
+ theirValue
128
+ );
129
+ } else {
130
+ merged[key] = theirValue;
131
+ }
132
+ }
133
+ return merged;
134
+ }
135
+ function composeHandlers(ours, theirs) {
136
+ if (typeof ours !== "function") return theirs;
137
+ if (typeof theirs !== "function") return ours;
138
+ return (...args) => {
139
+ ;
140
+ ours(...args);
141
+ return theirs(...args);
142
+ };
143
+ }
144
+ function mergeStyles(ours, theirs) {
145
+ if (typeof ours === "function" || typeof theirs === "function") {
146
+ return (state) => [
147
+ resolveStyle(ours, state),
148
+ resolveStyle(theirs, state)
149
+ ];
150
+ }
151
+ return [ours, theirs];
152
+ }
153
+ function resolveStyle(style, state) {
154
+ return typeof style === "function" ? style(state) : style;
155
+ }
149
156
 
157
+ // src/system/slot/slot.tsx
150
158
 
159
+ var Slot = _react.forwardRef.call(void 0, function Slot2({ children, ...ours }, ref) {
160
+ if (!_react.isValidElement.call(void 0, children)) {
161
+ throw new Error(
162
+ "XAUI: asChild expects exactly one React element as its child, and merges the component's props into it. Text, a fragment, several children or none give it nothing to merge into \u2014 drop `asChild` to render the component itself."
163
+ );
164
+ }
165
+ const child = children;
166
+ const merged = mergeProps(ours, child.props);
167
+ merged.ref = mergeRefs(ref, refOf(child));
168
+ return _react.cloneElement.call(void 0, child, merged);
169
+ });
170
+ Slot.displayName = "XAUI.Slot";
171
+ function refOf(element) {
172
+ const fromProps = element.props.ref;
173
+ const fromElement = element.ref;
174
+ return _nullishCoalesce(fromProps, () => ( fromElement));
175
+ }
151
176
 
177
+ // src/system/pressable-feedback/pressable-feedback-context.ts
152
178
 
179
+ var [FeedbackProvider, useFeedback] = createSlotContext("PressableFeedback");
180
+ var DisableAllContext = _react.createContext.call(void 0, false);
153
181
 
154
182
  // src/system/pressable-feedback/pressable-feedback.animation.ts
155
183
  var PRESS_SCALE = 0.975;
@@ -206,7 +234,24 @@ function resolveSlotAnimation(override, enabledByRoot, defaultOpacity, defaultDu
206
234
  };
207
235
  }
208
236
 
237
+ // src/system/pressable-feedback/pressable-feedback.tsx
238
+
239
+
240
+
241
+
242
+
243
+
244
+ var _reactnativereanimated = require('react-native-reanimated'); var _reactnativereanimated2 = _interopRequireDefault(_reactnativereanimated);
245
+
209
246
  // src/system/pressable-feedback/pressable-feedback-highlight.tsx
247
+
248
+
249
+
250
+
251
+
252
+
253
+
254
+
210
255
  function PressableFeedbackHighlight({
211
256
  style,
212
257
  animation: override
@@ -224,7 +269,7 @@ function PressableFeedbackHighlight({
224
269
  style
225
270
  ];
226
271
  if (!progress || !settings.enabled) {
227
- return /* @__PURE__ */ React.createElement(
272
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
228
273
  _reactnative.View,
229
274
  {
230
275
  pointerEvents: "none",
@@ -232,7 +277,7 @@ function PressableFeedbackHighlight({
232
277
  }
233
278
  );
234
279
  }
235
- return /* @__PURE__ */ React.createElement(
280
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
236
281
  AnimatedHighlight,
237
282
  {
238
283
  base,
@@ -252,10 +297,11 @@ function AnimatedHighlight({
252
297
  _react.useEffect.call(void 0, () => {
253
298
  shown.value = _reactnativereanimated.withTiming.call(void 0, isPressed ? 1 : 0, { duration });
254
299
  }, [isPressed, shown, duration]);
255
- const animatedStyle = _reactnativereanimated.useAnimatedStyle.call(void 0, () => ({
256
- opacity: shown.value * opacity
257
- }));
258
- return /* @__PURE__ */ React.createElement(_reactnativereanimated2.default.View, { pointerEvents: "none", style: [base, animatedStyle] });
300
+ const animatedStyle = _reactnativereanimated.useAnimatedStyle.call(void 0,
301
+ () => ({ opacity: shown.value * opacity }),
302
+ [shown, opacity]
303
+ );
304
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reactnativereanimated2.default.View, { pointerEvents: "none", style: [base, animatedStyle] });
259
305
  }
260
306
 
261
307
  // src/system/pressable-feedback/pressable-feedback-ripple.tsx
@@ -266,6 +312,7 @@ function AnimatedHighlight({
266
312
 
267
313
 
268
314
 
315
+
269
316
  function PressableFeedbackRipple({
270
317
  style,
271
318
  animation: override
@@ -279,7 +326,7 @@ function PressableFeedbackRipple({
279
326
  RIPPLE_DURATION
280
327
  );
281
328
  if (!progress || !pressCount || !origin || !size || !settings.enabled) return null;
282
- return /* @__PURE__ */ React.createElement(
329
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
283
330
  AnimatedRipple,
284
331
  {
285
332
  color: theme.colors.foreground,
@@ -303,38 +350,42 @@ function AnimatedRipple({
303
350
  const fromB = _reactnativereanimated.useSharedValue.call(void 0, { x: 0, y: 0 });
304
351
  const useA = _reactnativereanimated.useSharedValue.call(void 0, true);
305
352
  _reactnativereanimated.useAnimatedReaction.call(void 0,
306
- () => _nullishCoalesce(_optionalChain([pressCount, 'optionalAccess', _7 => _7.value]), () => ( 0)),
353
+ () => _nullishCoalesce(_optionalChain([pressCount, 'optionalAccess', _3 => _3.value]), () => ( 0)),
307
354
  (count, previous) => {
308
355
  if (previous === null || count === previous) return;
309
356
  const wave = useA.value ? waveA : waveB;
310
357
  const from = useA.value ? fromA : fromB;
311
- from.value = _nullishCoalesce(_optionalChain([origin, 'optionalAccess', _8 => _8.value]), () => ( { x: 0, y: 0 }));
358
+ from.value = _nullishCoalesce(_optionalChain([origin, 'optionalAccess', _4 => _4.value]), () => ( { x: 0, y: 0 }));
312
359
  wave.value = 0;
313
360
  wave.value = _reactnativereanimated.withTiming.call(void 0, 2, { duration: duration * 2 });
314
361
  useA.value = !useA.value;
315
- }
362
+ },
363
+ [pressCount, origin, duration, waveA, waveB, fromA, fromB, useA]
316
364
  );
317
- return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
318
- RippleWave,
319
- {
320
- wave: waveA,
321
- from: fromA,
322
- size,
323
- color,
324
- opacity,
325
- style
326
- }
327
- ), /* @__PURE__ */ React.createElement(
328
- RippleWave,
329
- {
330
- wave: waveB,
331
- from: fromB,
332
- size,
333
- color,
334
- opacity,
335
- style
336
- }
337
- ));
365
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
366
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
367
+ RippleWave,
368
+ {
369
+ wave: waveA,
370
+ from: fromA,
371
+ size,
372
+ color,
373
+ opacity,
374
+ style
375
+ }
376
+ ),
377
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
378
+ RippleWave,
379
+ {
380
+ wave: waveB,
381
+ from: fromB,
382
+ size,
383
+ color,
384
+ opacity,
385
+ style
386
+ }
387
+ )
388
+ ] });
338
389
  }
339
390
  function RippleWave({
340
391
  wave,
@@ -345,7 +396,7 @@ function RippleWave({
345
396
  style
346
397
  }) {
347
398
  const animatedStyle = _reactnativereanimated.useAnimatedStyle.call(void 0, () => {
348
- const within = _nullishCoalesce(_optionalChain([size, 'optionalAccess', _9 => _9.value]), () => ( { width: 0, height: 0 }));
399
+ const within = _nullishCoalesce(_optionalChain([size, 'optionalAccess', _5 => _5.value]), () => ( { width: 0, height: 0 }));
349
400
  const radius = Math.sqrt(within.width * within.width + within.height * within.height) * RIPPLE_COVERAGE;
350
401
  const at = from.value;
351
402
  return {
@@ -361,8 +412,8 @@ function RippleWave({
361
412
  { scale: _reactnativereanimated.interpolate.call(void 0, wave.value, [0, 1, 2], [0, 1, 1]) }
362
413
  ]
363
414
  };
364
- });
365
- return /* @__PURE__ */ React.createElement(
415
+ }, [wave, from, size, opacity]);
416
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
366
417
  _reactnativereanimated2.default.View,
367
418
  {
368
419
  pointerEvents: "none",
@@ -375,83 +426,8 @@ function RippleWave({
375
426
  );
376
427
  }
377
428
 
378
- // src/system/slot/slot.tsx
379
-
380
-
381
- // src/system/slot/merge-refs.ts
382
- function mergeRefs(...refs) {
383
- return (value) => {
384
- for (const ref of refs) {
385
- if (typeof ref === "function") ref(value);
386
- else if (ref) ref.current = value;
387
- }
388
- };
389
- }
390
-
391
- // src/system/slot/merge-props.ts
392
- var EVENT_HANDLER = /^on[A-Z]/;
393
- function mergeProps(ours, theirs) {
394
- const merged = { ...ours };
395
- for (const key of Object.keys(theirs)) {
396
- const ourValue = ours[key];
397
- const theirValue = theirs[key];
398
- if (EVENT_HANDLER.test(key)) {
399
- merged[key] = composeHandlers(ourValue, theirValue);
400
- } else if (key === "style") {
401
- merged[key] = mergeStyles(ourValue, theirValue);
402
- } else if (key === "ref") {
403
- merged[key] = mergeRefs(
404
- ourValue,
405
- theirValue
406
- );
407
- } else {
408
- merged[key] = theirValue;
409
- }
410
- }
411
- return merged;
412
- }
413
- function composeHandlers(ours, theirs) {
414
- if (typeof ours !== "function") return theirs;
415
- if (typeof theirs !== "function") return ours;
416
- return (...args) => {
417
- ;
418
- ours(...args);
419
- return theirs(...args);
420
- };
421
- }
422
- function mergeStyles(ours, theirs) {
423
- if (typeof ours === "function" || typeof theirs === "function") {
424
- return (state) => [
425
- resolveStyle(ours, state),
426
- resolveStyle(theirs, state)
427
- ];
428
- }
429
- return [ours, theirs];
430
- }
431
- function resolveStyle(style, state) {
432
- return typeof style === "function" ? style(state) : style;
433
- }
434
-
435
- // src/system/slot/slot.tsx
436
- var Slot = _react.forwardRef.call(void 0, function Slot2({ children, ...ours }, ref) {
437
- if (!_react.isValidElement.call(void 0, children)) {
438
- throw new Error(
439
- "XAUI: asChild expects exactly one React element as its child, and merges the component's props into it. Text, a fragment, several children or none give it nothing to merge into \u2014 drop `asChild` to render the component itself."
440
- );
441
- }
442
- const child = children;
443
- const merged = mergeProps(ours, child.props);
444
- merged.ref = mergeRefs(ref, refOf(child));
445
- return _react.cloneElement.call(void 0, child, merged);
446
- });
447
- Slot.displayName = "XAUI.Slot";
448
- function refOf(element) {
449
- const fromProps = element.props.ref;
450
- const fromElement = element.ref;
451
- return _nullishCoalesce(fromProps, () => ( fromElement));
452
- }
453
-
454
429
  // src/system/pressable-feedback/pressable-feedback.tsx
430
+
455
431
  var AnimatedPressable = _reactnativereanimated2.default.createAnimatedComponent(_reactnative.Pressable);
456
432
  var AnimatedSlot = _reactnativereanimated2.default.createAnimatedComponent(Slot);
457
433
  var PressableFeedback = _react.forwardRef.call(void 0,
@@ -459,7 +435,7 @@ var PressableFeedback = _react.forwardRef.call(void 0,
459
435
  const inheritedDisableAll = _react.useContext.call(void 0, DisableAllContext);
460
436
  const resolved = resolveAnimation(animation, inheritedDisableAll);
461
437
  const Feedback = resolved.none || feedbackVariant === "none" ? StaticFeedback : AnimatedFeedback;
462
- const body = /* @__PURE__ */ React.createElement(
438
+ const body2 = /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
463
439
  Feedback,
464
440
  {
465
441
  ref,
@@ -468,7 +444,7 @@ var PressableFeedback = _react.forwardRef.call(void 0,
468
444
  ...rest
469
445
  }
470
446
  );
471
- return resolved.disableAll ? /* @__PURE__ */ React.createElement(DisableAllContext.Provider, { value: true }, body) : body;
447
+ return resolved.disableAll ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, DisableAllContext.Provider, { value: true, children: body2 }) : body2;
472
448
  }
473
449
  );
474
450
  var StaticFeedback = _react.forwardRef.call(void 0, function StaticFeedback2({
@@ -483,7 +459,7 @@ var StaticFeedback = _react.forwardRef.call(void 0, function StaticFeedback2({
483
459
  }, ref) {
484
460
  const context = _react.useMemo.call(void 0, () => ({ isPressed, animation }), [isPressed, animation]);
485
461
  const Root = asChild ? Slot : _reactnative.Pressable;
486
- return /* @__PURE__ */ React.createElement(Root, { ref, style, disabled: isDisabled, ...rest }, /* @__PURE__ */ React.createElement(FeedbackProvider, { value: context }, /* @__PURE__ */ React.createElement(DefaultOverlay, { variant: feedbackVariant }), children));
462
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, FeedbackProvider, { value: context, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Root, { ref, style, disabled: isDisabled, ...rest, children: body(asChild, feedbackVariant, children) }) });
487
463
  });
488
464
  var AnimatedFeedback = _react.forwardRef.call(void 0, function AnimatedFeedback2({
489
465
  isPressed = false,
@@ -507,7 +483,8 @@ var AnimatedFeedback = _react.forwardRef.call(void 0, function AnimatedFeedback2
507
483
  });
508
484
  }, [isPressed, progress]);
509
485
  const animatedStyle = _reactnativereanimated.useAnimatedStyle.call(void 0,
510
- () => animation.scale ? { transform: [{ scale: 1 - (1 - PRESS_SCALE) * progress.value }] } : {}
486
+ () => animation.scale ? { transform: [{ scale: 1 - (1 - PRESS_SCALE) * progress.value }] } : {},
487
+ [animation.scale, progress]
511
488
  );
512
489
  const context = _react.useMemo.call(void 0,
513
490
  () => ({ isPressed, animation, progress, pressCount, origin, size }),
@@ -517,16 +494,16 @@ var AnimatedFeedback = _react.forwardRef.call(void 0, function AnimatedFeedback2
517
494
  const { locationX, locationY } = event.nativeEvent;
518
495
  origin.value = { x: locationX, y: locationY };
519
496
  pressCount.value += 1;
520
- _optionalChain([onPressIn, 'optionalCall', _10 => _10(event)]);
497
+ _optionalChain([onPressIn, 'optionalCall', _6 => _6(event)]);
521
498
  };
522
499
  const handleLayout = (event) => {
523
500
  const { width, height } = event.nativeEvent.layout;
524
501
  size.value = { width, height };
525
- _optionalChain([onLayout, 'optionalCall', _11 => _11(event)]);
502
+ _optionalChain([onLayout, 'optionalCall', _7 => _7(event)]);
526
503
  };
527
504
  const clip = feedbackVariant === "scale-ripple" ? { overflow: "hidden" } : null;
528
505
  const Root = asChild ? AnimatedSlot : AnimatedPressable;
529
- return /* @__PURE__ */ React.createElement(
506
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, FeedbackProvider, { value: context, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
530
507
  Root,
531
508
  {
532
509
  ref,
@@ -534,14 +511,21 @@ var AnimatedFeedback = _react.forwardRef.call(void 0, function AnimatedFeedback2
534
511
  disabled: isDisabled,
535
512
  onPressIn: handlePressIn,
536
513
  onLayout: handleLayout,
537
- ...rest
538
- },
539
- /* @__PURE__ */ React.createElement(FeedbackProvider, { value: context }, /* @__PURE__ */ React.createElement(DefaultOverlay, { variant: feedbackVariant }), children)
540
- );
514
+ ...rest,
515
+ children: body(asChild, feedbackVariant, children)
516
+ }
517
+ ) });
541
518
  });
519
+ function body(asChild, variant, children) {
520
+ if (asChild) return children;
521
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
522
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, DefaultOverlay, { variant }),
523
+ children
524
+ ] });
525
+ }
542
526
  function DefaultOverlay({ variant }) {
543
- if (variant === "scale-highlight") return /* @__PURE__ */ React.createElement(PressableFeedbackHighlight, null);
544
- if (variant === "scale-ripple") return /* @__PURE__ */ React.createElement(PressableFeedbackRipple, null);
527
+ if (variant === "scale-highlight") return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, PressableFeedbackHighlight, {});
528
+ if (variant === "scale-ripple") return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, PressableFeedbackRipple, {});
545
529
  return null;
546
530
  }
547
531
 
@@ -602,7 +586,7 @@ function resolveVariantColors(tokens, theme) {
602
586
  function activeStateFns(states, active) {
603
587
  const fns = [];
604
588
  for (const state of STATE_ORDER) {
605
- const fn = active[state] ? _optionalChain([states, 'optionalAccess', _12 => _12[state]]) : void 0;
589
+ const fn = active[state] ? _optionalChain([states, 'optionalAccess', _8 => _8[state]]) : void 0;
606
590
  if (fn) fns.push(fn);
607
591
  }
608
592
  return fns;
@@ -659,7 +643,7 @@ function cacheKey(theme, selection, states) {
659
643
  // src/system/recipe/create-recipe.ts
660
644
  function createRecipe(config) {
661
645
  const cache = createStyleCache(config.slots);
662
- const tokensFor = (variant) => variant === void 0 ? void 0 : _optionalChain([config, 'access', _13 => _13.variantTokens, 'optionalAccess', _14 => _14[variant]]);
646
+ const tokensFor = (variant) => variant === void 0 ? void 0 : _optionalChain([config, 'access', _9 => _9.variantTokens, 'optionalAccess', _10 => _10[variant]]);
663
647
  return {
664
648
  slots: config.slots,
665
649
  resolve({ theme, selection, states = {} }) {
@@ -694,32 +678,6 @@ function apply(fns, theme, colors) {
694
678
  return merged;
695
679
  }
696
680
 
697
- // src/system/slot/children-to-string.ts
698
-
699
- function childrenToString(children) {
700
- const text = stringify(children);
701
- return text === null || text === "" ? null : text;
702
- }
703
- function stringify(node) {
704
- if (node === null || node === void 0 || typeof node === "boolean") return "";
705
- if (typeof node === "string") return node;
706
- if (typeof node === "number") return String(node);
707
- if (_react.isValidElement.call(void 0, node)) return null;
708
- if (Array.isArray(node)) {
709
- let text = "";
710
- for (const child of node) {
711
- const part = stringify(child);
712
- if (part === null) return null;
713
- text += part;
714
- }
715
- return text;
716
- }
717
- return null;
718
- }
719
-
720
-
721
-
722
-
723
681
 
724
682
 
725
683
 
@@ -741,4 +699,4 @@ function stringify(node) {
741
699
 
742
700
 
743
701
 
744
- exports.mergeRefs = mergeRefs; exports.IconContext = IconContext; exports.useIconContext = useIconContext; exports.Icon = Icon; exports.PortalContext = PortalContext; exports.Portal = Portal; exports.PortalHost = PortalHost; exports.createSlotContext = createSlotContext; exports.useFeedback = useFeedback; exports.PRESS_SCALE = PRESS_SCALE; exports.PRESS_DURATION = PRESS_DURATION; exports.RELEASE_DURATION = RELEASE_DURATION; exports.HIGHLIGHT_OPACITY = HIGHLIGHT_OPACITY; exports.RIPPLE_OPACITY = RIPPLE_OPACITY; exports.RIPPLE_DURATION = RIPPLE_DURATION; exports.RIPPLE_COVERAGE = RIPPLE_COVERAGE; exports.resolveAnimation = resolveAnimation; exports.resolveSlotAnimation = resolveSlotAnimation; exports.mergeProps = mergeProps; exports.Slot = Slot; exports.PressableFeedback = PressableFeedback3; exports.createRecipe = createRecipe; exports.childrenToString = childrenToString;
702
+ exports.IconContext = IconContext; exports.useIconContext = useIconContext; exports.Icon = Icon; exports.childrenToString = childrenToString; exports.createSlotContext = createSlotContext; exports.mergeRefs = mergeRefs; exports.mergeProps = mergeProps; exports.Slot = Slot; exports.useFeedback = useFeedback; exports.PRESS_SCALE = PRESS_SCALE; exports.PRESS_DURATION = PRESS_DURATION; exports.RELEASE_DURATION = RELEASE_DURATION; exports.HIGHLIGHT_OPACITY = HIGHLIGHT_OPACITY; exports.RIPPLE_OPACITY = RIPPLE_OPACITY; exports.RIPPLE_DURATION = RIPPLE_DURATION; exports.RIPPLE_COVERAGE = RIPPLE_COVERAGE; exports.resolveAnimation = resolveAnimation; exports.resolveSlotAnimation = resolveSlotAnimation; exports.PressableFeedback = PressableFeedback3; exports.createRecipe = createRecipe;
@@ -0,0 +1,12 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
+
3
+
4
+
5
+ var _chunkV42SPPP3cjs = require('../../chunk-V42SPPP3.cjs');
6
+ require('../../chunk-VGWN4JTL.cjs');
7
+ require('../../chunk-3QBT3Q65.cjs');
8
+
9
+
10
+
11
+
12
+ exports.Button = _chunkV42SPPP3cjs.Button; exports.buttonRecipe = _chunkV42SPPP3cjs.buttonRecipe; exports.useButton = _chunkV42SPPP3cjs.useButton;