@xaui/native 0.9.1-alpha.1 → 0.9.1-alpha.10

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.
package/dist/index.cjs CHANGED
@@ -1,14 +1,15 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); 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
2
 
3
- var _chunkKFCORXWWcjs = require('./chunk-KFCORXWW.cjs');
4
3
 
5
4
 
6
5
 
7
6
 
7
+ var _chunkERCOAOO6cjs = require('./chunk-ERCOAOO6.cjs');
8
8
 
9
9
 
10
10
 
11
11
 
12
+ var _chunkLMUPNKPHcjs = require('./chunk-LMUPNKPH.cjs');
12
13
 
13
14
 
14
15
 
@@ -16,10 +17,8 @@ var _chunkKFCORXWWcjs = require('./chunk-KFCORXWW.cjs');
16
17
 
17
18
 
18
19
 
19
- var _chunkNHPQQQ7Pcjs = require('./chunk-NHPQQQ7P.cjs');
20
20
 
21
21
 
22
- var _chunkM7P46XKIcjs = require('./chunk-M7P46XKI.cjs');
23
22
 
24
23
 
25
24
 
@@ -32,9 +31,121 @@ var _chunkM7P46XKIcjs = require('./chunk-M7P46XKI.cjs');
32
31
 
33
32
 
34
33
 
34
+ var _chunk7D262JCJcjs = require('./chunk-7D262JCJ.cjs');
35
35
 
36
36
 
37
37
 
38
38
 
39
39
 
40
- exports.ThemeContext = _chunkNHPQQQ7Pcjs.ThemeContext; exports.XAUIProvider = _chunkNHPQQQ7Pcjs.XAUIProvider; exports.buildRadius = _chunkNHPQQQ7Pcjs.buildRadius; exports.buildShadows = _chunkNHPQQQ7Pcjs.buildShadows; exports.createRecipe = _chunkKFCORXWWcjs.createRecipe; exports.createTheme = _chunkNHPQQQ7Pcjs.createTheme; exports.defaultTheme = _chunkNHPQQQ7Pcjs.defaultTheme; exports.deriveColors = _chunkNHPQQQ7Pcjs.deriveColors; exports.deriveTint = _chunkM7P46XKIcjs.deriveTint; exports.palette = _chunkNHPQQQ7Pcjs.palette; exports.primitives = _chunkNHPQQQ7Pcjs.primitives; exports.sourceKeys = _chunkNHPQQQ7Pcjs.sourceKeys; exports.tokens = _chunkNHPQQQ7Pcjs.tokens; exports.useColorMode = _chunkNHPQQQ7Pcjs.useColorMode; exports.useThemeColor = _chunkNHPQQQ7Pcjs.useThemeColor; exports.useXAUITheme = _chunkNHPQQQ7Pcjs.useXAUITheme;
40
+
41
+
42
+
43
+
44
+
45
+
46
+ var _chunk2FEDC7U5cjs = require('./chunk-2FEDC7U5.cjs');
47
+
48
+
49
+
50
+
51
+
52
+
53
+ var _chunk3QBT3Q65cjs = require('./chunk-3QBT3Q65.cjs');
54
+
55
+ // src/hooks/use-controllable-state.ts
56
+ var _react = require('react');
57
+ function useControllableState({
58
+ value,
59
+ defaultValue,
60
+ onChange
61
+ }) {
62
+ const [uncontrolled, setUncontrolled] = _react.useState.call(void 0, defaultValue);
63
+ const isControlled = value !== void 0;
64
+ const current = isControlled ? value : uncontrolled;
65
+ useControlWarning(isControlled);
66
+ const latest = _react.useRef.call(void 0, current);
67
+ latest.current = current;
68
+ const onChangeRef = _react.useRef.call(void 0, onChange);
69
+ onChangeRef.current = onChange;
70
+ const controlled = _react.useRef.call(void 0, isControlled);
71
+ controlled.current = isControlled;
72
+ const set = _react.useCallback.call(void 0, (next) => {
73
+ const resolved = typeof next === "function" ? next(latest.current) : next;
74
+ if (resolved === latest.current) return;
75
+ if (!controlled.current) setUncontrolled(resolved);
76
+ _optionalChain([onChangeRef, 'access', _ => _.current, 'optionalCall', _2 => _2(resolved)]);
77
+ }, []);
78
+ return [current, set];
79
+ }
80
+ function useControlWarning(isControlled) {
81
+ const wasControlled = _react.useRef.call(void 0, isControlled);
82
+ if (wasControlled.current !== isControlled) {
83
+ _chunkERCOAOO6cjs.warnDev.call(void 0,
84
+ `a component switched from ${wasControlled.current ? "controlled" : "uncontrolled"} to ${isControlled ? "controlled" : "uncontrolled"}. Decide for the life of the component: pass \`value\` always, or never. Passing \`undefined\` for a value you do control reads as "uncontrolled" here.`
85
+ );
86
+ wasControlled.current = isControlled;
87
+ }
88
+ }
89
+
90
+ // src/hooks/use-merged-ref.ts
91
+
92
+ function useMergedRef(...refs) {
93
+ return _react.useMemo.call(void 0, () => _chunk7D262JCJcjs.mergeRefs.call(void 0, ...refs), refs);
94
+ }
95
+
96
+ // src/hooks/use-previous.ts
97
+
98
+ function usePrevious(value) {
99
+ const previous = _react.useRef.call(void 0, void 0);
100
+ _react.useEffect.call(void 0, () => {
101
+ previous.current = value;
102
+ }, [value]);
103
+ return previous.current;
104
+ }
105
+
106
+
107
+
108
+
109
+
110
+
111
+
112
+
113
+
114
+
115
+
116
+
117
+
118
+
119
+
120
+
121
+
122
+
123
+
124
+
125
+
126
+
127
+
128
+
129
+
130
+
131
+
132
+
133
+
134
+
135
+
136
+
137
+
138
+
139
+
140
+
141
+
142
+
143
+
144
+
145
+
146
+
147
+
148
+
149
+
150
+
151
+ exports.Button = _chunkERCOAOO6cjs.Button; exports.HIGHLIGHT_OPACITY = _chunk7D262JCJcjs.HIGHLIGHT_OPACITY; exports.Icon = _chunk7D262JCJcjs.Icon; exports.IconContext = _chunk7D262JCJcjs.IconContext; exports.PRESS_DURATION = _chunk7D262JCJcjs.PRESS_DURATION; exports.PRESS_SCALE = _chunk7D262JCJcjs.PRESS_SCALE; exports.Portal = _chunkLMUPNKPHcjs.Portal; exports.PortalContext = _chunkLMUPNKPHcjs.PortalContext; exports.PortalHost = _chunkLMUPNKPHcjs.PortalHost; exports.PressableFeedback = _chunk7D262JCJcjs.PressableFeedback; exports.RELEASE_DURATION = _chunk7D262JCJcjs.RELEASE_DURATION; exports.RIPPLE_COVERAGE = _chunk7D262JCJcjs.RIPPLE_COVERAGE; exports.RIPPLE_DURATION = _chunk7D262JCJcjs.RIPPLE_DURATION; exports.RIPPLE_OPACITY = _chunk7D262JCJcjs.RIPPLE_OPACITY; exports.Slot = _chunk7D262JCJcjs.Slot; exports.ThemeContext = _chunk3QBT3Q65cjs.ThemeContext; exports.XAUIProvider = _chunk2FEDC7U5cjs.XAUIProvider; exports.buildRadius = _chunk2FEDC7U5cjs.buildRadius; exports.buildShadows = _chunk2FEDC7U5cjs.buildShadows; exports.buttonRecipe = _chunkERCOAOO6cjs.buttonRecipe; exports.childrenToString = _chunk7D262JCJcjs.childrenToString; exports.createRecipe = _chunk7D262JCJcjs.createRecipe; exports.createSlotContext = _chunk7D262JCJcjs.createSlotContext; exports.createTheme = _chunk2FEDC7U5cjs.createTheme; exports.defaultTheme = _chunk2FEDC7U5cjs.defaultTheme; exports.deriveColors = _chunk2FEDC7U5cjs.deriveColors; exports.deriveTint = _chunk3QBT3Q65cjs.deriveTint; exports.mergeProps = _chunk7D262JCJcjs.mergeProps; exports.mergeRefs = _chunk7D262JCJcjs.mergeRefs; exports.palette = _chunk2FEDC7U5cjs.palette; exports.primitives = _chunk2FEDC7U5cjs.primitives; exports.resolveAnimation = _chunk7D262JCJcjs.resolveAnimation; exports.resolveSlotAnimation = _chunk7D262JCJcjs.resolveSlotAnimation; exports.sourceKeys = _chunk2FEDC7U5cjs.sourceKeys; exports.tokens = _chunk2FEDC7U5cjs.tokens; exports.useButton = _chunkERCOAOO6cjs.useButton; exports.useColorMode = _chunk3QBT3Q65cjs.useColorMode; exports.useControllableState = useControllableState; exports.useFeedback = _chunk7D262JCJcjs.useFeedback; exports.useIconContext = _chunk7D262JCJcjs.useIconContext; exports.useMergedRef = useMergedRef; exports.usePressState = _chunkERCOAOO6cjs.usePressState; exports.usePrevious = usePrevious; exports.useThemeColor = _chunk3QBT3Q65cjs.useThemeColor; exports.useXAUITheme = _chunk3QBT3Q65cjs.useXAUITheme;
package/dist/index.d.cts CHANGED
@@ -1,5 +1,74 @@
1
- export { Axes, CompoundVariant, Recipe, RecipeConfig, ResolveArgs, ResolvedSelection, ResolvedStyles, Selection, SlotStyle, SlotStyles, StateName, States, StyleFn, TintArgs, VariantColors, VariantRole, VariantTokens, createRecipe } from './system/index.cjs';
1
+ export { Button, ButtonContextValue, ButtonIconProps, ButtonLabelProps, ButtonProps, ButtonSize, ButtonSlot, ButtonSpinnerProps, ButtonVariant, buttonRecipe, useButton } from './components/button/index.cjs';
2
+ import { RefCallback } from 'react';
3
+ import { PossibleRef } from './system/index.cjs';
4
+ export { AsChildProps, HIGHLIGHT_OPACITY, Icon, IconContext, MergeableProps, PRESS_DURATION, PRESS_SCALE, Portal, PortalContext, PortalHost, PortalHostProps, PortalMethods, PortalProps, PressableFeedback, PressableFeedbackHighlightProps, PressableFeedbackRippleProps, RELEASE_DURATION, RIPPLE_COVERAGE, RIPPLE_DURATION, RIPPLE_OPACITY, Slot, SlotProps, childrenToString, createSlotContext, mergeProps, mergeRefs, resolveAnimation, resolveSlotAnimation, useFeedback, useIconContext } from './system/index.cjs';
5
+ import { GestureResponderEvent } from 'react-native';
6
+ export { A as AnimationConfig, c as AnimationProp, h as Axes, C as CompoundVariant, F as FeedbackContext, d as FeedbackVariant, I as IconComponentProps, a as IconContextValue, b as IconProps, P as PressableFeedbackProps, f as Recipe, i as RecipeConfig, g as ResolveArgs, R as ResolvedAnimation, j as ResolvedSelection, k as ResolvedStyles, l as Selection, S as SlotAnimation, m as SlotStyle, n as SlotStyles, o as StateName, p as States, q as StyleFn, T as TintArgs, V as VariantColors, r as VariantRole, s as VariantTokens, e as createRecipe } from './create-recipe-BjSP0zL_.cjs';
2
7
  export { ColorModePreference, PaletteFamily, PaletteShade, ThemeContext, XAUIProvider, XAUIProviderProps, XAUITint, buildRadius, buildShadows, createTheme, defaultTheme, deriveColors, deriveTint, palette, primitives, sourceKeys, tokens, useColorMode, useThemeColor, useXAUITheme } from './theme/index.cjs';
3
- export { C as ColorMode, F as FontSizeKey, a as FontWeightKey, R as RadiusKey, S as Size, X as XAUIColors, b as XAUIDerivedColors, c as XAUIPrimitiveColors, d as XAUIRadius, e as XAUIShadow, f as XAUISourceColors, g as XAUITheme, h as XAUIThemeConfig, i as XAUIThemeSet } from './theme.type-B3ODSLbB.cjs';
4
- import 'react-native';
5
- import 'react';
8
+ export { C as ColorMode, F as FontSizeKey, a as FontWeightKey, R as RadiusKey, S as Size, X as XAUIColors, b as XAUIDerivedColors, c as XAUIPrimitiveColors, d as XAUIRadius, e as XAUIShadow, f as XAUISourceColors, g as XAUITheme, h as XAUIThemeConfig, i as XAUIThemeSet } from './theme.type-C9bFJKFm.cjs';
9
+ import 'react-native-reanimated';
10
+
11
+ type ControllableStateOptions<T> = {
12
+ /** Present means controlled: the caller owns the value and this never stores one. */
13
+ value?: T;
14
+ /** The starting value when uncontrolled. */
15
+ defaultValue: T;
16
+ /** Called with every new value, controlled or not. */
17
+ onChange?: (value: T) => void;
18
+ };
19
+ /**
20
+ * One state that works both ways, so a component never has two code paths for "the
21
+ * caller drives this" and "we do".
22
+ *
23
+ * The setter is stable across renders and reads the current value from a ref, so a
24
+ * handler built on it can be passed to a memoized child without rebuilding it on every
25
+ * render — which is the whole reason components reach for this rather than a local
26
+ * `useState` plus an `if`.
27
+ */
28
+ declare function useControllableState<T>({ value, defaultValue, onChange, }: ControllableStateOptions<T>): [T, (next: T | ((current: T) => T)) => void];
29
+
30
+ /**
31
+ * `mergeRefs` for a component that renders: memoized on the refs it was given, so React
32
+ * does not detach and reattach every one of them on each render — which it does whenever
33
+ * a ref callback changes identity, and which costs a node measurement every time.
34
+ */
35
+ declare function useMergedRef<T>(...refs: Array<PossibleRef<T>>): RefCallback<T>;
36
+
37
+ /**
38
+ * `null` as much as `undefined`: that is how `PressableProps` types its handlers, and a
39
+ * root forwarding what it was given should not have to launder them first.
40
+ */
41
+ type PressHandlers = {
42
+ onPressIn?: PressHandler | null;
43
+ onPressOut?: PressHandler | null;
44
+ };
45
+ type PressHandler = (event: GestureResponderEvent) => void;
46
+ /**
47
+ * The press state a root owns, with the handlers that maintain it.
48
+ *
49
+ * It exists because every pressable component needs the same three things and gets one
50
+ * of them wrong on its own: the state has to be *up here* — the recipe resolves on it
51
+ * (R5) — the caller's handlers must be **composed, never replaced**, and the returned
52
+ * handlers must keep their identity so passing them down does not defeat a memo.
53
+ *
54
+ * ```tsx
55
+ * const [isPressed, pressHandlers] = usePressState(props)
56
+ * const styles = recipe.resolve({ theme, selection, states: { pressed: isPressed } })
57
+ * <PressableFeedback isPressed={isPressed} {...pressHandlers} />
58
+ * ```
59
+ */
60
+ declare function usePressState(handlers?: PressHandlers): [boolean, {
61
+ onPressIn: PressHandler;
62
+ onPressOut: PressHandler;
63
+ }];
64
+
65
+ /**
66
+ * The value from the render before this one, `undefined` on the first.
67
+ *
68
+ * Written in an effect rather than during render on purpose: reading it mid-render would
69
+ * make "previous" mean something different depending on whether React re-ran the render,
70
+ * which under StrictMode it does.
71
+ */
72
+ declare function usePrevious<T>(value: T): T | undefined;
73
+
74
+ export { type ControllableStateOptions, PossibleRef, type PressHandlers, useControllableState, useMergedRef, usePressState, usePrevious };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,74 @@
1
- export { Axes, CompoundVariant, Recipe, RecipeConfig, ResolveArgs, ResolvedSelection, ResolvedStyles, Selection, SlotStyle, SlotStyles, StateName, States, StyleFn, TintArgs, VariantColors, VariantRole, VariantTokens, createRecipe } from './system/index.js';
1
+ export { Button, ButtonContextValue, ButtonIconProps, ButtonLabelProps, ButtonProps, ButtonSize, ButtonSlot, ButtonSpinnerProps, ButtonVariant, buttonRecipe, useButton } from './components/button/index.js';
2
+ import { RefCallback } from 'react';
3
+ import { PossibleRef } from './system/index.js';
4
+ export { AsChildProps, HIGHLIGHT_OPACITY, Icon, IconContext, MergeableProps, PRESS_DURATION, PRESS_SCALE, Portal, PortalContext, PortalHost, PortalHostProps, PortalMethods, PortalProps, PressableFeedback, PressableFeedbackHighlightProps, PressableFeedbackRippleProps, RELEASE_DURATION, RIPPLE_COVERAGE, RIPPLE_DURATION, RIPPLE_OPACITY, Slot, SlotProps, childrenToString, createSlotContext, mergeProps, mergeRefs, resolveAnimation, resolveSlotAnimation, useFeedback, useIconContext } from './system/index.js';
5
+ import { GestureResponderEvent } from 'react-native';
6
+ export { A as AnimationConfig, c as AnimationProp, h as Axes, C as CompoundVariant, F as FeedbackContext, d as FeedbackVariant, I as IconComponentProps, a as IconContextValue, b as IconProps, P as PressableFeedbackProps, f as Recipe, i as RecipeConfig, g as ResolveArgs, R as ResolvedAnimation, j as ResolvedSelection, k as ResolvedStyles, l as Selection, S as SlotAnimation, m as SlotStyle, n as SlotStyles, o as StateName, p as States, q as StyleFn, T as TintArgs, V as VariantColors, r as VariantRole, s as VariantTokens, e as createRecipe } from './create-recipe-Dn9kj5Rs.js';
2
7
  export { ColorModePreference, PaletteFamily, PaletteShade, ThemeContext, XAUIProvider, XAUIProviderProps, XAUITint, buildRadius, buildShadows, createTheme, defaultTheme, deriveColors, deriveTint, palette, primitives, sourceKeys, tokens, useColorMode, useThemeColor, useXAUITheme } from './theme/index.js';
3
- export { C as ColorMode, F as FontSizeKey, a as FontWeightKey, R as RadiusKey, S as Size, X as XAUIColors, b as XAUIDerivedColors, c as XAUIPrimitiveColors, d as XAUIRadius, e as XAUIShadow, f as XAUISourceColors, g as XAUITheme, h as XAUIThemeConfig, i as XAUIThemeSet } from './theme.type-B3ODSLbB.js';
4
- import 'react-native';
5
- import 'react';
8
+ export { C as ColorMode, F as FontSizeKey, a as FontWeightKey, R as RadiusKey, S as Size, X as XAUIColors, b as XAUIDerivedColors, c as XAUIPrimitiveColors, d as XAUIRadius, e as XAUIShadow, f as XAUISourceColors, g as XAUITheme, h as XAUIThemeConfig, i as XAUIThemeSet } from './theme.type-C9bFJKFm.js';
9
+ import 'react-native-reanimated';
10
+
11
+ type ControllableStateOptions<T> = {
12
+ /** Present means controlled: the caller owns the value and this never stores one. */
13
+ value?: T;
14
+ /** The starting value when uncontrolled. */
15
+ defaultValue: T;
16
+ /** Called with every new value, controlled or not. */
17
+ onChange?: (value: T) => void;
18
+ };
19
+ /**
20
+ * One state that works both ways, so a component never has two code paths for "the
21
+ * caller drives this" and "we do".
22
+ *
23
+ * The setter is stable across renders and reads the current value from a ref, so a
24
+ * handler built on it can be passed to a memoized child without rebuilding it on every
25
+ * render — which is the whole reason components reach for this rather than a local
26
+ * `useState` plus an `if`.
27
+ */
28
+ declare function useControllableState<T>({ value, defaultValue, onChange, }: ControllableStateOptions<T>): [T, (next: T | ((current: T) => T)) => void];
29
+
30
+ /**
31
+ * `mergeRefs` for a component that renders: memoized on the refs it was given, so React
32
+ * does not detach and reattach every one of them on each render — which it does whenever
33
+ * a ref callback changes identity, and which costs a node measurement every time.
34
+ */
35
+ declare function useMergedRef<T>(...refs: Array<PossibleRef<T>>): RefCallback<T>;
36
+
37
+ /**
38
+ * `null` as much as `undefined`: that is how `PressableProps` types its handlers, and a
39
+ * root forwarding what it was given should not have to launder them first.
40
+ */
41
+ type PressHandlers = {
42
+ onPressIn?: PressHandler | null;
43
+ onPressOut?: PressHandler | null;
44
+ };
45
+ type PressHandler = (event: GestureResponderEvent) => void;
46
+ /**
47
+ * The press state a root owns, with the handlers that maintain it.
48
+ *
49
+ * It exists because every pressable component needs the same three things and gets one
50
+ * of them wrong on its own: the state has to be *up here* — the recipe resolves on it
51
+ * (R5) — the caller's handlers must be **composed, never replaced**, and the returned
52
+ * handlers must keep their identity so passing them down does not defeat a memo.
53
+ *
54
+ * ```tsx
55
+ * const [isPressed, pressHandlers] = usePressState(props)
56
+ * const styles = recipe.resolve({ theme, selection, states: { pressed: isPressed } })
57
+ * <PressableFeedback isPressed={isPressed} {...pressHandlers} />
58
+ * ```
59
+ */
60
+ declare function usePressState(handlers?: PressHandlers): [boolean, {
61
+ onPressIn: PressHandler;
62
+ onPressOut: PressHandler;
63
+ }];
64
+
65
+ /**
66
+ * The value from the render before this one, `undefined` on the first.
67
+ *
68
+ * Written in an effect rather than during render on purpose: reading it mid-render would
69
+ * make "previous" mean something different depending on whether React re-ran the render,
70
+ * which under StrictMode it does.
71
+ */
72
+ declare function usePrevious<T>(value: T): T | undefined;
73
+
74
+ export { type ControllableStateOptions, PossibleRef, type PressHandlers, useControllableState, useMergedRef, usePressState, usePrevious };
package/dist/index.js CHANGED
@@ -1,8 +1,38 @@
1
1
  import {
2
- createRecipe
3
- } from "./chunk-N357EQCZ.js";
2
+ Button,
3
+ buttonRecipe,
4
+ useButton,
5
+ usePressState,
6
+ warnDev
7
+ } from "./chunk-EQGTD5F6.js";
8
+ import {
9
+ Portal,
10
+ PortalContext,
11
+ PortalHost
12
+ } from "./chunk-3TIDEII6.js";
13
+ import {
14
+ HIGHLIGHT_OPACITY,
15
+ Icon,
16
+ IconContext,
17
+ PRESS_DURATION,
18
+ PRESS_SCALE,
19
+ PressableFeedback,
20
+ RELEASE_DURATION,
21
+ RIPPLE_COVERAGE,
22
+ RIPPLE_DURATION,
23
+ RIPPLE_OPACITY,
24
+ Slot,
25
+ childrenToString,
26
+ createRecipe,
27
+ createSlotContext,
28
+ mergeProps,
29
+ mergeRefs,
30
+ resolveAnimation,
31
+ resolveSlotAnimation,
32
+ useFeedback,
33
+ useIconContext
34
+ } from "./chunk-66OVPWF4.js";
4
35
  import {
5
- ThemeContext,
6
36
  XAUIProvider,
7
37
  buildRadius,
8
38
  buildShadows,
@@ -12,29 +42,110 @@ import {
12
42
  palette,
13
43
  primitives,
14
44
  sourceKeys,
15
- tokens,
45
+ tokens
46
+ } from "./chunk-7XGOXTGT.js";
47
+ import {
48
+ ThemeContext,
49
+ deriveTint,
16
50
  useColorMode,
17
51
  useThemeColor,
18
52
  useXAUITheme
19
- } from "./chunk-PBVPOX7D.js";
20
- import {
21
- deriveTint
22
- } from "./chunk-RBNCR5KB.js";
53
+ } from "./chunk-X2K2FX3W.js";
54
+
55
+ // src/hooks/use-controllable-state.ts
56
+ import { useCallback, useRef, useState } from "react";
57
+ function useControllableState({
58
+ value,
59
+ defaultValue,
60
+ onChange
61
+ }) {
62
+ const [uncontrolled, setUncontrolled] = useState(defaultValue);
63
+ const isControlled = value !== void 0;
64
+ const current = isControlled ? value : uncontrolled;
65
+ useControlWarning(isControlled);
66
+ const latest = useRef(current);
67
+ latest.current = current;
68
+ const onChangeRef = useRef(onChange);
69
+ onChangeRef.current = onChange;
70
+ const controlled = useRef(isControlled);
71
+ controlled.current = isControlled;
72
+ const set = useCallback((next) => {
73
+ const resolved = typeof next === "function" ? next(latest.current) : next;
74
+ if (resolved === latest.current) return;
75
+ if (!controlled.current) setUncontrolled(resolved);
76
+ onChangeRef.current?.(resolved);
77
+ }, []);
78
+ return [current, set];
79
+ }
80
+ function useControlWarning(isControlled) {
81
+ const wasControlled = useRef(isControlled);
82
+ if (wasControlled.current !== isControlled) {
83
+ warnDev(
84
+ `a component switched from ${wasControlled.current ? "controlled" : "uncontrolled"} to ${isControlled ? "controlled" : "uncontrolled"}. Decide for the life of the component: pass \`value\` always, or never. Passing \`undefined\` for a value you do control reads as "uncontrolled" here.`
85
+ );
86
+ wasControlled.current = isControlled;
87
+ }
88
+ }
89
+
90
+ // src/hooks/use-merged-ref.ts
91
+ import { useMemo } from "react";
92
+ function useMergedRef(...refs) {
93
+ return useMemo(() => mergeRefs(...refs), refs);
94
+ }
95
+
96
+ // src/hooks/use-previous.ts
97
+ import { useEffect, useRef as useRef2 } from "react";
98
+ function usePrevious(value) {
99
+ const previous = useRef2(void 0);
100
+ useEffect(() => {
101
+ previous.current = value;
102
+ }, [value]);
103
+ return previous.current;
104
+ }
23
105
  export {
106
+ Button,
107
+ HIGHLIGHT_OPACITY,
108
+ Icon,
109
+ IconContext,
110
+ PRESS_DURATION,
111
+ PRESS_SCALE,
112
+ Portal,
113
+ PortalContext,
114
+ PortalHost,
115
+ PressableFeedback,
116
+ RELEASE_DURATION,
117
+ RIPPLE_COVERAGE,
118
+ RIPPLE_DURATION,
119
+ RIPPLE_OPACITY,
120
+ Slot,
24
121
  ThemeContext,
25
122
  XAUIProvider,
26
123
  buildRadius,
27
124
  buildShadows,
125
+ buttonRecipe,
126
+ childrenToString,
28
127
  createRecipe,
128
+ createSlotContext,
29
129
  createTheme,
30
130
  defaultTheme,
31
131
  deriveColors,
32
132
  deriveTint,
133
+ mergeProps,
134
+ mergeRefs,
33
135
  palette,
34
136
  primitives,
137
+ resolveAnimation,
138
+ resolveSlotAnimation,
35
139
  sourceKeys,
36
140
  tokens,
141
+ useButton,
37
142
  useColorMode,
143
+ useControllableState,
144
+ useFeedback,
145
+ useIconContext,
146
+ useMergedRef,
147
+ usePressState,
148
+ usePrevious,
38
149
  useThemeColor,
39
150
  useXAUITheme
40
151
  };
@@ -1,7 +1,53 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkKFCORXWWcjs = require('../chunk-KFCORXWW.cjs');
4
- require('../chunk-M7P46XKI.cjs');
5
3
 
6
4
 
7
- exports.createRecipe = _chunkKFCORXWWcjs.createRecipe;
5
+ var _chunkLMUPNKPHcjs = require('../chunk-LMUPNKPH.cjs');
6
+
7
+
8
+
9
+
10
+
11
+
12
+
13
+
14
+
15
+
16
+
17
+
18
+
19
+
20
+
21
+
22
+
23
+
24
+
25
+
26
+
27
+ var _chunk7D262JCJcjs = require('../chunk-7D262JCJ.cjs');
28
+ require('../chunk-3QBT3Q65.cjs');
29
+
30
+
31
+
32
+
33
+
34
+
35
+
36
+
37
+
38
+
39
+
40
+
41
+
42
+
43
+
44
+
45
+
46
+
47
+
48
+
49
+
50
+
51
+
52
+
53
+ exports.HIGHLIGHT_OPACITY = _chunk7D262JCJcjs.HIGHLIGHT_OPACITY; exports.Icon = _chunk7D262JCJcjs.Icon; exports.IconContext = _chunk7D262JCJcjs.IconContext; exports.PRESS_DURATION = _chunk7D262JCJcjs.PRESS_DURATION; exports.PRESS_SCALE = _chunk7D262JCJcjs.PRESS_SCALE; exports.Portal = _chunkLMUPNKPHcjs.Portal; exports.PortalContext = _chunkLMUPNKPHcjs.PortalContext; exports.PortalHost = _chunkLMUPNKPHcjs.PortalHost; exports.PressableFeedback = _chunk7D262JCJcjs.PressableFeedback; exports.RELEASE_DURATION = _chunk7D262JCJcjs.RELEASE_DURATION; exports.RIPPLE_COVERAGE = _chunk7D262JCJcjs.RIPPLE_COVERAGE; exports.RIPPLE_DURATION = _chunk7D262JCJcjs.RIPPLE_DURATION; exports.RIPPLE_OPACITY = _chunk7D262JCJcjs.RIPPLE_OPACITY; exports.Slot = _chunk7D262JCJcjs.Slot; exports.childrenToString = _chunk7D262JCJcjs.childrenToString; exports.createRecipe = _chunk7D262JCJcjs.createRecipe; exports.createSlotContext = _chunk7D262JCJcjs.createSlotContext; exports.mergeProps = _chunk7D262JCJcjs.mergeProps; exports.mergeRefs = _chunk7D262JCJcjs.mergeRefs; exports.resolveAnimation = _chunk7D262JCJcjs.resolveAnimation; exports.resolveSlotAnimation = _chunk7D262JCJcjs.resolveSlotAnimation; exports.useFeedback = _chunk7D262JCJcjs.useFeedback; exports.useIconContext = _chunk7D262JCJcjs.useIconContext;