@xaui/native 0.9.1-alpha.2 → 0.9.1-alpha.21
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/chunk-2WMVDMFV.cjs +62 -0
- package/dist/chunk-33QILJJH.cjs +143 -0
- package/dist/chunk-4NE3SLTM.cjs +695 -0
- package/dist/{chunk-M7P46XKI.cjs → chunk-57SJ4LJF.cjs} +33 -3
- package/dist/chunk-5LC6KVL3.cjs +68 -0
- package/dist/{chunk-RBNCR5KB.js → chunk-A3EGFI6T.js} +31 -1
- package/dist/chunk-APCBIHLR.cjs +507 -0
- package/dist/chunk-BPBY7ON7.cjs +451 -0
- package/dist/chunk-EVXZGNPA.cjs +303 -0
- package/dist/chunk-EXX6ATAS.js +303 -0
- package/dist/chunk-GGW42MY4.js +20 -0
- package/dist/chunk-IBRVMLUF.js +668 -0
- package/dist/chunk-ISVUXVFL.js +471 -0
- package/dist/chunk-JL27KVRT.js +68 -0
- package/dist/chunk-JXLRHKCQ.js +143 -0
- package/dist/chunk-MC7SY2QH.cjs +20 -0
- package/dist/{chunk-RCP3SD26.js → chunk-N7C4UNUL.js} +2 -126
- package/dist/chunk-RMLFMRWL.js +102 -0
- package/dist/chunk-RRRGLRRP.cjs +28 -0
- package/dist/chunk-SGHP76GU.js +28 -0
- package/dist/{chunk-PBVPOX7D.js → chunk-TUJBDS5M.js} +30 -63
- package/dist/chunk-UBA6AEY6.cjs +102 -0
- package/dist/{chunk-NHPQQQ7P.cjs → chunk-UL263KGM.cjs} +56 -89
- package/dist/{chunk-B755PRVJ.cjs → chunk-UVO4GFSW.cjs} +3 -127
- package/dist/chunk-XHZBXYVU.js +62 -0
- package/dist/chunk-YRCUALUQ.js +451 -0
- package/dist/components/button/index.cjs +17 -0
- package/dist/components/button/index.d.cts +659 -0
- package/dist/components/button/index.d.ts +659 -0
- package/dist/components/button/index.js +17 -0
- package/dist/components/card/index.cjs +20 -0
- package/dist/components/card/index.d.cts +620 -0
- package/dist/components/card/index.d.ts +620 -0
- package/dist/components/card/index.js +20 -0
- package/dist/components/typography/index.cjs +14 -0
- package/dist/components/typography/index.d.cts +116 -0
- package/dist/components/typography/index.d.ts +116 -0
- package/dist/components/typography/index.js +14 -0
- package/dist/components/view/index.cjs +16 -0
- package/dist/components/view/index.d.cts +152 -0
- package/dist/components/view/index.d.ts +152 -0
- package/dist/components/view/index.js +16 -0
- package/dist/create-recipe-CC3NNCqF.d.ts +94 -0
- package/dist/create-recipe-CPBFg7ym.d.cts +94 -0
- package/dist/icon.type-BkcEPJbK.d.ts +73 -0
- package/dist/icon.type-Cs1tMX0W.d.cts +73 -0
- package/dist/index.cjs +167 -5
- package/dist/index.d.cts +79 -4
- package/dist/index.d.ts +79 -4
- package/dist/index.js +171 -9
- package/dist/pressable-feedback.type-DsvWZXWC.d.ts +127 -0
- package/dist/pressable-feedback.type-wfeiJz5m.d.cts +127 -0
- package/dist/style-props.type-B1BG5TCm.d.cts +31 -0
- package/dist/style-props.type-B1BG5TCm.d.ts +31 -0
- package/dist/system/index.cjs +66 -3
- package/dist/system/index.d.cts +301 -75
- package/dist/system/index.d.ts +301 -75
- package/dist/system/index.js +68 -5
- package/dist/theme/index.cjs +4 -3
- package/dist/theme/index.d.cts +27 -15
- package/dist/theme/index.d.ts +27 -15
- package/dist/theme/index.js +7 -6
- package/dist/{theme.type-B3ODSLbB.d.cts → theme.type-C2gNHpEx.d.cts} +8 -2
- package/dist/{theme.type-B3ODSLbB.d.ts → theme.type-C2gNHpEx.d.ts} +8 -2
- package/package.json +74 -18
package/dist/index.cjs
CHANGED
|
@@ -1,37 +1,41 @@
|
|
|
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
3
|
|
|
4
4
|
|
|
5
|
+
var _chunkAPCBIHLRcjs = require('./chunk-APCBIHLR.cjs');
|
|
5
6
|
|
|
6
7
|
|
|
7
8
|
|
|
8
|
-
var _chunkB755PRVJcjs = require('./chunk-B755PRVJ.cjs');
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
12
|
+
var _chunkBPBY7ON7cjs = require('./chunk-BPBY7ON7.cjs');
|
|
12
13
|
|
|
13
14
|
|
|
14
15
|
|
|
16
|
+
var _chunkRRRGLRRPcjs = require('./chunk-RRRGLRRP.cjs');
|
|
15
17
|
|
|
16
18
|
|
|
17
19
|
|
|
18
20
|
|
|
21
|
+
var _chunkUBA6AEY6cjs = require('./chunk-UBA6AEY6.cjs');
|
|
19
22
|
|
|
20
23
|
|
|
21
24
|
|
|
22
25
|
|
|
23
26
|
|
|
24
|
-
var _chunkNHPQQQ7Pcjs = require('./chunk-NHPQQQ7P.cjs');
|
|
25
27
|
|
|
28
|
+
var _chunk33QILJJHcjs = require('./chunk-33QILJJH.cjs');
|
|
26
29
|
|
|
27
|
-
var _chunkM7P46XKIcjs = require('./chunk-M7P46XKI.cjs');
|
|
28
30
|
|
|
29
31
|
|
|
30
32
|
|
|
33
|
+
var _chunk2WMVDMFVcjs = require('./chunk-2WMVDMFV.cjs');
|
|
31
34
|
|
|
32
35
|
|
|
33
36
|
|
|
34
37
|
|
|
38
|
+
var _chunk5LC6KVL3cjs = require('./chunk-5LC6KVL3.cjs');
|
|
35
39
|
|
|
36
40
|
|
|
37
41
|
|
|
@@ -47,4 +51,162 @@ var _chunkM7P46XKIcjs = require('./chunk-M7P46XKI.cjs');
|
|
|
47
51
|
|
|
48
52
|
|
|
49
53
|
|
|
50
|
-
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
var _chunk4NE3SLTMcjs = require('./chunk-4NE3SLTM.cjs');
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
var _chunkUVO4GFSWcjs = require('./chunk-UVO4GFSW.cjs');
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
var _chunkEVXZGNPAcjs = require('./chunk-EVXZGNPA.cjs');
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
var _chunkUL263KGMcjs = require('./chunk-UL263KGM.cjs');
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
var _chunk57SJ4LJFcjs = require('./chunk-57SJ4LJF.cjs');
|
|
91
|
+
require('./chunk-MC7SY2QH.cjs');
|
|
92
|
+
|
|
93
|
+
// src/hooks/use-controllable-state.ts
|
|
94
|
+
var _react = require('react');
|
|
95
|
+
function useControllableState({
|
|
96
|
+
value,
|
|
97
|
+
defaultValue,
|
|
98
|
+
onChange
|
|
99
|
+
}) {
|
|
100
|
+
const [uncontrolled, setUncontrolled] = _react.useState.call(void 0, defaultValue);
|
|
101
|
+
const isControlled = value !== void 0;
|
|
102
|
+
const current = isControlled ? value : uncontrolled;
|
|
103
|
+
useControlWarning(isControlled);
|
|
104
|
+
const latest = _react.useRef.call(void 0, current);
|
|
105
|
+
latest.current = current;
|
|
106
|
+
const onChangeRef = _react.useRef.call(void 0, onChange);
|
|
107
|
+
onChangeRef.current = onChange;
|
|
108
|
+
const controlled = _react.useRef.call(void 0, isControlled);
|
|
109
|
+
controlled.current = isControlled;
|
|
110
|
+
const set = _react.useCallback.call(void 0, (next) => {
|
|
111
|
+
const resolved = typeof next === "function" ? next(latest.current) : next;
|
|
112
|
+
if (resolved === latest.current) return;
|
|
113
|
+
if (!controlled.current) setUncontrolled(resolved);
|
|
114
|
+
_optionalChain([onChangeRef, 'access', _ => _.current, 'optionalCall', _2 => _2(resolved)]);
|
|
115
|
+
}, []);
|
|
116
|
+
return [current, set];
|
|
117
|
+
}
|
|
118
|
+
function useControlWarning(isControlled) {
|
|
119
|
+
const wasControlled = _react.useRef.call(void 0, isControlled);
|
|
120
|
+
if (wasControlled.current !== isControlled) {
|
|
121
|
+
_chunkRRRGLRRPcjs.warnDev.call(void 0,
|
|
122
|
+
`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.`
|
|
123
|
+
);
|
|
124
|
+
wasControlled.current = isControlled;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
// src/hooks/use-merged-ref.ts
|
|
129
|
+
|
|
130
|
+
function useMergedRef(...refs) {
|
|
131
|
+
return _react.useMemo.call(void 0, () => _chunkEVXZGNPAcjs.mergeRefs.call(void 0, ...refs), refs);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
// src/hooks/use-previous.ts
|
|
135
|
+
|
|
136
|
+
function usePrevious(value) {
|
|
137
|
+
const previous = _react.useRef.call(void 0, void 0);
|
|
138
|
+
_react.useEffect.call(void 0, () => {
|
|
139
|
+
previous.current = value;
|
|
140
|
+
}, [value]);
|
|
141
|
+
return previous.current;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
|
|
207
|
+
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
|
|
211
|
+
|
|
212
|
+
exports.Button = _chunkAPCBIHLRcjs.Button; exports.CARD_BACKGROUND = _chunkBPBY7ON7cjs.CARD_BACKGROUND; exports.Card = _chunkBPBY7ON7cjs.Card; exports.Column = _chunk33QILJJHcjs.Column; exports.FEEDBACK_OVERLAY = _chunk4NE3SLTMcjs.FEEDBACK_OVERLAY; exports.Grid = _chunk33QILJJHcjs.Grid; exports.HIGHLIGHT_DURATION = _chunk4NE3SLTMcjs.HIGHLIGHT_DURATION; exports.HIGHLIGHT_OPACITY = _chunk4NE3SLTMcjs.HIGHLIGHT_OPACITY; exports.Icon = _chunk5LC6KVL3cjs.Icon; exports.IconContext = _chunk5LC6KVL3cjs.IconContext; exports.PRESS_DURATION = _chunk4NE3SLTMcjs.PRESS_DURATION; exports.PRESS_SCALE = _chunk4NE3SLTMcjs.PRESS_SCALE; exports.Portal = _chunk2WMVDMFVcjs.Portal; exports.PortalContext = _chunk2WMVDMFVcjs.PortalContext; exports.PortalHost = _chunk2WMVDMFVcjs.PortalHost; exports.PressableFeedback = _chunk4NE3SLTMcjs.PressableFeedback; exports.RIPPLE_CONFIRM_DURATION = _chunk4NE3SLTMcjs.RIPPLE_CONFIRM_DURATION; exports.RIPPLE_EXPAND_DURATION = _chunk4NE3SLTMcjs.RIPPLE_EXPAND_DURATION; exports.RIPPLE_FADE_IN = _chunk4NE3SLTMcjs.RIPPLE_FADE_IN; exports.RIPPLE_FADE_OUT = _chunk4NE3SLTMcjs.RIPPLE_FADE_OUT; exports.RIPPLE_FADE_OUT_DELAY = _chunk4NE3SLTMcjs.RIPPLE_FADE_OUT_DELAY; exports.RIPPLE_OPACITY = _chunk4NE3SLTMcjs.RIPPLE_OPACITY; exports.RIPPLE_START_SCALE = _chunk4NE3SLTMcjs.RIPPLE_START_SCALE; exports.Row = _chunk33QILJJHcjs.Row; exports.SCALE_REFERENCE_WIDTH = _chunk4NE3SLTMcjs.SCALE_REFERENCE_WIDTH; exports.Slot = _chunkEVXZGNPAcjs.Slot; exports.Stack = _chunk33QILJJHcjs.Stack; exports.TextSpan = _chunkUBA6AEY6cjs.TextSpan; exports.ThemeContext = _chunk57SJ4LJFcjs.ThemeContext; exports.Typography = _chunkUBA6AEY6cjs.Typography; exports.XAUIProvider = _chunkUL263KGMcjs.XAUIProvider; exports.buildRadius = _chunkUL263KGMcjs.buildRadius; exports.buildShadows = _chunkUL263KGMcjs.buildShadows; exports.buttonRecipe = _chunkAPCBIHLRcjs.buttonRecipe; exports.cardRecipe = _chunkBPBY7ON7cjs.cardRecipe; exports.childrenToString = _chunkEVXZGNPAcjs.childrenToString; exports.createRecipe = _chunkUVO4GFSWcjs.createRecipe; exports.createSlotContext = _chunkEVXZGNPAcjs.createSlotContext; exports.createTheme = _chunkUL263KGMcjs.createTheme; exports.defaultTheme = _chunkUL263KGMcjs.defaultTheme; exports.deriveColors = _chunkUL263KGMcjs.deriveColors; exports.deriveTint = _chunk57SJ4LJFcjs.deriveTint; exports.markBackground = _chunkBPBY7ON7cjs.markBackground; exports.markOverlay = _chunk4NE3SLTMcjs.markOverlay; exports.mergeProps = _chunkEVXZGNPAcjs.mergeProps; exports.mergeRefs = _chunkEVXZGNPAcjs.mergeRefs; exports.palette = _chunkUL263KGMcjs.palette; exports.pressScaleFor = _chunk4NE3SLTMcjs.pressScaleFor; exports.primitives = _chunkUL263KGMcjs.primitives; exports.resolveAnimation = _chunk4NE3SLTMcjs.resolveAnimation; exports.resolveSlotAnimation = _chunk4NE3SLTMcjs.resolveSlotAnimation; exports.rippleRadiusFor = _chunk4NE3SLTMcjs.rippleRadiusFor; exports.sourceKeys = _chunkUL263KGMcjs.sourceKeys; exports.tokens = _chunkUL263KGMcjs.tokens; exports.typographyRecipe = _chunkUBA6AEY6cjs.typographyRecipe; exports.useButton = _chunkAPCBIHLRcjs.useButton; exports.useCard = _chunkBPBY7ON7cjs.useCard; exports.useColorMode = _chunk57SJ4LJFcjs.useColorMode; exports.useControllableState = useControllableState; exports.useFeedback = _chunk4NE3SLTMcjs.useFeedback; exports.useGrid = _chunk33QILJJHcjs.useGrid; exports.useIconContext = _chunk5LC6KVL3cjs.useIconContext; exports.useMergedRef = useMergedRef; exports.usePressState = _chunkRRRGLRRPcjs.usePressState; exports.usePrevious = usePrevious; exports.useStyleProps = _chunkEVXZGNPAcjs.useStyleProps; exports.useThemeColor = _chunk57SJ4LJFcjs.useThemeColor; exports.useXAUITheme = _chunk57SJ4LJFcjs.useXAUITheme;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,80 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { Button, ButtonContextValue, ButtonIconProps, ButtonLabelProps, ButtonProps, ButtonSize, ButtonSlot, ButtonSpinnerProps, ButtonVariant, buttonRecipe, useButton } from './components/button/index.cjs';
|
|
2
|
+
export { CARD_BACKGROUND, Card, CardBackgroundProps, CardBodyProps, CardContextValue, CardDescriptionProps, CardFooterProps, CardHeaderProps, CardProps, CardSize, CardSlot, CardTitleProps, CardVariant, cardRecipe, markBackground, useCard } from './components/card/index.cjs';
|
|
3
|
+
export { TextSpan, TextSpanProps, Typography, TypographyProps, TypographySlot, TypographyVariant, typographyRecipe } from './components/typography/index.cjs';
|
|
4
|
+
export { AxisProps, Column, ColumnProps, Grid, GridContextValue, GridItemProps, GridProps, Row, RowProps, Stack, StackItemProps, StackProps, useGrid } from './components/view/index.cjs';
|
|
5
|
+
import { RefCallback } from 'react';
|
|
6
|
+
import { PossibleRef } from './system/index.cjs';
|
|
7
|
+
export { AsChildProps, FEEDBACK_OVERLAY, HIGHLIGHT_DURATION, HIGHLIGHT_OPACITY, Icon, IconContext, MergeableProps, PRESS_DURATION, PRESS_SCALE, Portal, PortalContext, PortalHost, PortalHostProps, PortalMethods, PortalProps, PressableFeedback, PressableFeedbackHighlightProps, PressableFeedbackRippleProps, RIPPLE_CONFIRM_DURATION, RIPPLE_EXPAND_DURATION, RIPPLE_FADE_IN, RIPPLE_FADE_OUT, RIPPLE_FADE_OUT_DELAY, RIPPLE_OPACITY, RIPPLE_START_SCALE, SCALE_REFERENCE_WIDTH, Slot, SlotProps, childrenToString, createSlotContext, markOverlay, mergeProps, mergeRefs, pressScaleFor, resolveAnimation, resolveSlotAnimation, rippleRadiusFor, useFeedback, useIconContext, useStyleProps } from './system/index.cjs';
|
|
8
|
+
import { GestureResponderEvent } from 'react-native';
|
|
9
|
+
export { I as IconComponentProps, a as IconContextValue, b as IconProps } from './icon.type-Cs1tMX0W.cjs';
|
|
10
|
+
export { A as Axes, C as CompoundVariant, R as Recipe, b as RecipeConfig, a as ResolveArgs, d as ResolvedSelection, e as ResolvedStyles, S as Selection, f as SlotStyle, g as SlotStyles, h as StateName, i as States, j as StyleFn, T as TintArgs, V as VariantColors, k as VariantRole, l as VariantTokens, c as createRecipe } from './create-recipe-CPBFg7ym.cjs';
|
|
11
|
+
export { D as DirectionalStyleKey, I as ImageStyleProps, S as StyleProps, T as TextStyleProps, V as ViewStyleProps } from './style-props.type-B1BG5TCm.cjs';
|
|
2
12
|
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,
|
|
4
|
-
|
|
5
|
-
import 'react';
|
|
13
|
+
export { C as ColorMode, F as FontSizeKey, b as FontWeightKey, R as RadiusKey, S as Size, a as XAUIColors, c as XAUIDerivedColors, d as XAUIPrimitiveColors, e as XAUIRadius, f as XAUIShadow, g as XAUISourceColors, X as XAUITheme, h as XAUIThemeConfig, i as XAUIThemeSet } from './theme.type-C2gNHpEx.cjs';
|
|
14
|
+
export { A as AnimationConfig, a as AnimationProp, F as FeedbackContext, P as PressableFeedbackProps, R as RadiusStyle, b as ResolvedAnimation, c as RippleWave, S as SlotAnimation } from './pressable-feedback.type-wfeiJz5m.cjs';
|
|
15
|
+
import 'react-native-reanimated';
|
|
16
|
+
|
|
17
|
+
type ControllableStateOptions<T> = {
|
|
18
|
+
/** Present means controlled: the caller owns the value and this never stores one. */
|
|
19
|
+
value?: T;
|
|
20
|
+
/** The starting value when uncontrolled. */
|
|
21
|
+
defaultValue: T;
|
|
22
|
+
/** Called with every new value, controlled or not. */
|
|
23
|
+
onChange?: (value: T) => void;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* One state that works both ways, so a component never has two code paths for "the
|
|
27
|
+
* caller drives this" and "we do".
|
|
28
|
+
*
|
|
29
|
+
* The setter is stable across renders and reads the current value from a ref, so a
|
|
30
|
+
* handler built on it can be passed to a memoized child without rebuilding it on every
|
|
31
|
+
* render — which is the whole reason components reach for this rather than a local
|
|
32
|
+
* `useState` plus an `if`.
|
|
33
|
+
*/
|
|
34
|
+
declare function useControllableState<T>({ value, defaultValue, onChange, }: ControllableStateOptions<T>): [T, (next: T | ((current: T) => T)) => void];
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* `mergeRefs` for a component that renders: memoized on the refs it was given, so React
|
|
38
|
+
* does not detach and reattach every one of them on each render — which it does whenever
|
|
39
|
+
* a ref callback changes identity, and which costs a node measurement every time.
|
|
40
|
+
*/
|
|
41
|
+
declare function useMergedRef<T>(...refs: Array<PossibleRef<T>>): RefCallback<T>;
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* `null` as much as `undefined`: that is how `PressableProps` types its handlers, and a
|
|
45
|
+
* root forwarding what it was given should not have to launder them first.
|
|
46
|
+
*/
|
|
47
|
+
type PressHandlers = {
|
|
48
|
+
onPressIn?: PressHandler | null;
|
|
49
|
+
onPressOut?: PressHandler | null;
|
|
50
|
+
};
|
|
51
|
+
type PressHandler = (event: GestureResponderEvent) => void;
|
|
52
|
+
/**
|
|
53
|
+
* The press state a root owns, with the handlers that maintain it.
|
|
54
|
+
*
|
|
55
|
+
* It exists because every pressable component needs the same three things and gets one
|
|
56
|
+
* of them wrong on its own: the state has to be *up here* — the recipe resolves on it
|
|
57
|
+
* (R5) — the caller's handlers must be **composed, never replaced**, and the returned
|
|
58
|
+
* handlers must keep their identity so passing them down does not defeat a memo.
|
|
59
|
+
*
|
|
60
|
+
* ```tsx
|
|
61
|
+
* const [isPressed, pressHandlers] = usePressState(props)
|
|
62
|
+
* const styles = recipe.resolve({ theme, selection, states: { pressed: isPressed } })
|
|
63
|
+
* <PressableFeedback isPressed={isPressed} {...pressHandlers} />
|
|
64
|
+
* ```
|
|
65
|
+
*/
|
|
66
|
+
declare function usePressState(handlers?: PressHandlers): [boolean, {
|
|
67
|
+
onPressIn: PressHandler;
|
|
68
|
+
onPressOut: PressHandler;
|
|
69
|
+
}];
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* The value from the render before this one, `undefined` on the first.
|
|
73
|
+
*
|
|
74
|
+
* Written in an effect rather than during render on purpose: reading it mid-render would
|
|
75
|
+
* make "previous" mean something different depending on whether React re-ran the render,
|
|
76
|
+
* which under StrictMode it does.
|
|
77
|
+
*/
|
|
78
|
+
declare function usePrevious<T>(value: T): T | undefined;
|
|
79
|
+
|
|
80
|
+
export { type ControllableStateOptions, PossibleRef, type PressHandlers, useControllableState, useMergedRef, usePressState, usePrevious };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,80 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { Button, ButtonContextValue, ButtonIconProps, ButtonLabelProps, ButtonProps, ButtonSize, ButtonSlot, ButtonSpinnerProps, ButtonVariant, buttonRecipe, useButton } from './components/button/index.js';
|
|
2
|
+
export { CARD_BACKGROUND, Card, CardBackgroundProps, CardBodyProps, CardContextValue, CardDescriptionProps, CardFooterProps, CardHeaderProps, CardProps, CardSize, CardSlot, CardTitleProps, CardVariant, cardRecipe, markBackground, useCard } from './components/card/index.js';
|
|
3
|
+
export { TextSpan, TextSpanProps, Typography, TypographyProps, TypographySlot, TypographyVariant, typographyRecipe } from './components/typography/index.js';
|
|
4
|
+
export { AxisProps, Column, ColumnProps, Grid, GridContextValue, GridItemProps, GridProps, Row, RowProps, Stack, StackItemProps, StackProps, useGrid } from './components/view/index.js';
|
|
5
|
+
import { RefCallback } from 'react';
|
|
6
|
+
import { PossibleRef } from './system/index.js';
|
|
7
|
+
export { AsChildProps, FEEDBACK_OVERLAY, HIGHLIGHT_DURATION, HIGHLIGHT_OPACITY, Icon, IconContext, MergeableProps, PRESS_DURATION, PRESS_SCALE, Portal, PortalContext, PortalHost, PortalHostProps, PortalMethods, PortalProps, PressableFeedback, PressableFeedbackHighlightProps, PressableFeedbackRippleProps, RIPPLE_CONFIRM_DURATION, RIPPLE_EXPAND_DURATION, RIPPLE_FADE_IN, RIPPLE_FADE_OUT, RIPPLE_FADE_OUT_DELAY, RIPPLE_OPACITY, RIPPLE_START_SCALE, SCALE_REFERENCE_WIDTH, Slot, SlotProps, childrenToString, createSlotContext, markOverlay, mergeProps, mergeRefs, pressScaleFor, resolveAnimation, resolveSlotAnimation, rippleRadiusFor, useFeedback, useIconContext, useStyleProps } from './system/index.js';
|
|
8
|
+
import { GestureResponderEvent } from 'react-native';
|
|
9
|
+
export { I as IconComponentProps, a as IconContextValue, b as IconProps } from './icon.type-BkcEPJbK.js';
|
|
10
|
+
export { A as Axes, C as CompoundVariant, R as Recipe, b as RecipeConfig, a as ResolveArgs, d as ResolvedSelection, e as ResolvedStyles, S as Selection, f as SlotStyle, g as SlotStyles, h as StateName, i as States, j as StyleFn, T as TintArgs, V as VariantColors, k as VariantRole, l as VariantTokens, c as createRecipe } from './create-recipe-CC3NNCqF.js';
|
|
11
|
+
export { D as DirectionalStyleKey, I as ImageStyleProps, S as StyleProps, T as TextStyleProps, V as ViewStyleProps } from './style-props.type-B1BG5TCm.js';
|
|
2
12
|
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,
|
|
4
|
-
|
|
5
|
-
import 'react';
|
|
13
|
+
export { C as ColorMode, F as FontSizeKey, b as FontWeightKey, R as RadiusKey, S as Size, a as XAUIColors, c as XAUIDerivedColors, d as XAUIPrimitiveColors, e as XAUIRadius, f as XAUIShadow, g as XAUISourceColors, X as XAUITheme, h as XAUIThemeConfig, i as XAUIThemeSet } from './theme.type-C2gNHpEx.js';
|
|
14
|
+
export { A as AnimationConfig, a as AnimationProp, F as FeedbackContext, P as PressableFeedbackProps, R as RadiusStyle, b as ResolvedAnimation, c as RippleWave, S as SlotAnimation } from './pressable-feedback.type-DsvWZXWC.js';
|
|
15
|
+
import 'react-native-reanimated';
|
|
16
|
+
|
|
17
|
+
type ControllableStateOptions<T> = {
|
|
18
|
+
/** Present means controlled: the caller owns the value and this never stores one. */
|
|
19
|
+
value?: T;
|
|
20
|
+
/** The starting value when uncontrolled. */
|
|
21
|
+
defaultValue: T;
|
|
22
|
+
/** Called with every new value, controlled or not. */
|
|
23
|
+
onChange?: (value: T) => void;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* One state that works both ways, so a component never has two code paths for "the
|
|
27
|
+
* caller drives this" and "we do".
|
|
28
|
+
*
|
|
29
|
+
* The setter is stable across renders and reads the current value from a ref, so a
|
|
30
|
+
* handler built on it can be passed to a memoized child without rebuilding it on every
|
|
31
|
+
* render — which is the whole reason components reach for this rather than a local
|
|
32
|
+
* `useState` plus an `if`.
|
|
33
|
+
*/
|
|
34
|
+
declare function useControllableState<T>({ value, defaultValue, onChange, }: ControllableStateOptions<T>): [T, (next: T | ((current: T) => T)) => void];
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* `mergeRefs` for a component that renders: memoized on the refs it was given, so React
|
|
38
|
+
* does not detach and reattach every one of them on each render — which it does whenever
|
|
39
|
+
* a ref callback changes identity, and which costs a node measurement every time.
|
|
40
|
+
*/
|
|
41
|
+
declare function useMergedRef<T>(...refs: Array<PossibleRef<T>>): RefCallback<T>;
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* `null` as much as `undefined`: that is how `PressableProps` types its handlers, and a
|
|
45
|
+
* root forwarding what it was given should not have to launder them first.
|
|
46
|
+
*/
|
|
47
|
+
type PressHandlers = {
|
|
48
|
+
onPressIn?: PressHandler | null;
|
|
49
|
+
onPressOut?: PressHandler | null;
|
|
50
|
+
};
|
|
51
|
+
type PressHandler = (event: GestureResponderEvent) => void;
|
|
52
|
+
/**
|
|
53
|
+
* The press state a root owns, with the handlers that maintain it.
|
|
54
|
+
*
|
|
55
|
+
* It exists because every pressable component needs the same three things and gets one
|
|
56
|
+
* of them wrong on its own: the state has to be *up here* — the recipe resolves on it
|
|
57
|
+
* (R5) — the caller's handlers must be **composed, never replaced**, and the returned
|
|
58
|
+
* handlers must keep their identity so passing them down does not defeat a memo.
|
|
59
|
+
*
|
|
60
|
+
* ```tsx
|
|
61
|
+
* const [isPressed, pressHandlers] = usePressState(props)
|
|
62
|
+
* const styles = recipe.resolve({ theme, selection, states: { pressed: isPressed } })
|
|
63
|
+
* <PressableFeedback isPressed={isPressed} {...pressHandlers} />
|
|
64
|
+
* ```
|
|
65
|
+
*/
|
|
66
|
+
declare function usePressState(handlers?: PressHandlers): [boolean, {
|
|
67
|
+
onPressIn: PressHandler;
|
|
68
|
+
onPressOut: PressHandler;
|
|
69
|
+
}];
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* The value from the render before this one, `undefined` on the first.
|
|
73
|
+
*
|
|
74
|
+
* Written in an effect rather than during render on purpose: reading it mid-render would
|
|
75
|
+
* make "previous" mean something different depending on whether React re-ran the render,
|
|
76
|
+
* which under StrictMode it does.
|
|
77
|
+
*/
|
|
78
|
+
declare function usePrevious<T>(value: T): T | undefined;
|
|
79
|
+
|
|
80
|
+
export { type ControllableStateOptions, PossibleRef, type PressHandlers, useControllableState, useMergedRef, usePressState, usePrevious };
|
package/dist/index.js
CHANGED
|
@@ -1,13 +1,75 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Button,
|
|
3
|
+
buttonRecipe,
|
|
4
|
+
useButton
|
|
5
|
+
} from "./chunk-ISVUXVFL.js";
|
|
6
|
+
import {
|
|
7
|
+
CARD_BACKGROUND,
|
|
8
|
+
Card,
|
|
9
|
+
cardRecipe,
|
|
10
|
+
markBackground,
|
|
11
|
+
useCard
|
|
12
|
+
} from "./chunk-YRCUALUQ.js";
|
|
13
|
+
import {
|
|
14
|
+
usePressState,
|
|
15
|
+
warnDev
|
|
16
|
+
} from "./chunk-SGHP76GU.js";
|
|
17
|
+
import {
|
|
18
|
+
TextSpan,
|
|
19
|
+
Typography,
|
|
20
|
+
typographyRecipe
|
|
21
|
+
} from "./chunk-RMLFMRWL.js";
|
|
22
|
+
import {
|
|
23
|
+
Column,
|
|
24
|
+
Grid,
|
|
25
|
+
Row,
|
|
26
|
+
Stack,
|
|
27
|
+
useGrid
|
|
28
|
+
} from "./chunk-JXLRHKCQ.js";
|
|
29
|
+
import {
|
|
30
|
+
Portal,
|
|
31
|
+
PortalContext,
|
|
32
|
+
PortalHost
|
|
33
|
+
} from "./chunk-XHZBXYVU.js";
|
|
34
|
+
import {
|
|
35
|
+
Icon,
|
|
36
|
+
IconContext,
|
|
37
|
+
useIconContext
|
|
38
|
+
} from "./chunk-JL27KVRT.js";
|
|
39
|
+
import {
|
|
40
|
+
FEEDBACK_OVERLAY,
|
|
41
|
+
HIGHLIGHT_DURATION,
|
|
42
|
+
HIGHLIGHT_OPACITY,
|
|
43
|
+
PRESS_DURATION,
|
|
44
|
+
PRESS_SCALE,
|
|
45
|
+
PressableFeedback,
|
|
46
|
+
RIPPLE_CONFIRM_DURATION,
|
|
47
|
+
RIPPLE_EXPAND_DURATION,
|
|
48
|
+
RIPPLE_FADE_IN,
|
|
49
|
+
RIPPLE_FADE_OUT,
|
|
50
|
+
RIPPLE_FADE_OUT_DELAY,
|
|
51
|
+
RIPPLE_OPACITY,
|
|
52
|
+
RIPPLE_START_SCALE,
|
|
53
|
+
SCALE_REFERENCE_WIDTH,
|
|
54
|
+
markOverlay,
|
|
55
|
+
pressScaleFor,
|
|
56
|
+
resolveAnimation,
|
|
57
|
+
resolveSlotAnimation,
|
|
58
|
+
rippleRadiusFor,
|
|
59
|
+
useFeedback
|
|
60
|
+
} from "./chunk-IBRVMLUF.js";
|
|
61
|
+
import {
|
|
62
|
+
createRecipe
|
|
63
|
+
} from "./chunk-N7C4UNUL.js";
|
|
1
64
|
import {
|
|
2
65
|
Slot,
|
|
3
66
|
childrenToString,
|
|
4
|
-
createRecipe,
|
|
5
67
|
createSlotContext,
|
|
6
68
|
mergeProps,
|
|
7
|
-
mergeRefs
|
|
8
|
-
|
|
69
|
+
mergeRefs,
|
|
70
|
+
useStyleProps
|
|
71
|
+
} from "./chunk-EXX6ATAS.js";
|
|
9
72
|
import {
|
|
10
|
-
ThemeContext,
|
|
11
73
|
XAUIProvider,
|
|
12
74
|
buildRadius,
|
|
13
75
|
buildShadows,
|
|
@@ -17,20 +79,103 @@ import {
|
|
|
17
79
|
palette,
|
|
18
80
|
primitives,
|
|
19
81
|
sourceKeys,
|
|
20
|
-
tokens
|
|
82
|
+
tokens
|
|
83
|
+
} from "./chunk-TUJBDS5M.js";
|
|
84
|
+
import {
|
|
85
|
+
ThemeContext,
|
|
86
|
+
deriveTint,
|
|
21
87
|
useColorMode,
|
|
22
88
|
useThemeColor,
|
|
23
89
|
useXAUITheme
|
|
24
|
-
} from "./chunk-
|
|
25
|
-
import
|
|
26
|
-
|
|
27
|
-
|
|
90
|
+
} from "./chunk-A3EGFI6T.js";
|
|
91
|
+
import "./chunk-GGW42MY4.js";
|
|
92
|
+
|
|
93
|
+
// src/hooks/use-controllable-state.ts
|
|
94
|
+
import { useCallback, useRef, useState } from "react";
|
|
95
|
+
function useControllableState({
|
|
96
|
+
value,
|
|
97
|
+
defaultValue,
|
|
98
|
+
onChange
|
|
99
|
+
}) {
|
|
100
|
+
const [uncontrolled, setUncontrolled] = useState(defaultValue);
|
|
101
|
+
const isControlled = value !== void 0;
|
|
102
|
+
const current = isControlled ? value : uncontrolled;
|
|
103
|
+
useControlWarning(isControlled);
|
|
104
|
+
const latest = useRef(current);
|
|
105
|
+
latest.current = current;
|
|
106
|
+
const onChangeRef = useRef(onChange);
|
|
107
|
+
onChangeRef.current = onChange;
|
|
108
|
+
const controlled = useRef(isControlled);
|
|
109
|
+
controlled.current = isControlled;
|
|
110
|
+
const set = useCallback((next) => {
|
|
111
|
+
const resolved = typeof next === "function" ? next(latest.current) : next;
|
|
112
|
+
if (resolved === latest.current) return;
|
|
113
|
+
if (!controlled.current) setUncontrolled(resolved);
|
|
114
|
+
onChangeRef.current?.(resolved);
|
|
115
|
+
}, []);
|
|
116
|
+
return [current, set];
|
|
117
|
+
}
|
|
118
|
+
function useControlWarning(isControlled) {
|
|
119
|
+
const wasControlled = useRef(isControlled);
|
|
120
|
+
if (wasControlled.current !== isControlled) {
|
|
121
|
+
warnDev(
|
|
122
|
+
`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.`
|
|
123
|
+
);
|
|
124
|
+
wasControlled.current = isControlled;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
// src/hooks/use-merged-ref.ts
|
|
129
|
+
import { useMemo } from "react";
|
|
130
|
+
function useMergedRef(...refs) {
|
|
131
|
+
return useMemo(() => mergeRefs(...refs), refs);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
// src/hooks/use-previous.ts
|
|
135
|
+
import { useEffect, useRef as useRef2 } from "react";
|
|
136
|
+
function usePrevious(value) {
|
|
137
|
+
const previous = useRef2(void 0);
|
|
138
|
+
useEffect(() => {
|
|
139
|
+
previous.current = value;
|
|
140
|
+
}, [value]);
|
|
141
|
+
return previous.current;
|
|
142
|
+
}
|
|
28
143
|
export {
|
|
144
|
+
Button,
|
|
145
|
+
CARD_BACKGROUND,
|
|
146
|
+
Card,
|
|
147
|
+
Column,
|
|
148
|
+
FEEDBACK_OVERLAY,
|
|
149
|
+
Grid,
|
|
150
|
+
HIGHLIGHT_DURATION,
|
|
151
|
+
HIGHLIGHT_OPACITY,
|
|
152
|
+
Icon,
|
|
153
|
+
IconContext,
|
|
154
|
+
PRESS_DURATION,
|
|
155
|
+
PRESS_SCALE,
|
|
156
|
+
Portal,
|
|
157
|
+
PortalContext,
|
|
158
|
+
PortalHost,
|
|
159
|
+
PressableFeedback,
|
|
160
|
+
RIPPLE_CONFIRM_DURATION,
|
|
161
|
+
RIPPLE_EXPAND_DURATION,
|
|
162
|
+
RIPPLE_FADE_IN,
|
|
163
|
+
RIPPLE_FADE_OUT,
|
|
164
|
+
RIPPLE_FADE_OUT_DELAY,
|
|
165
|
+
RIPPLE_OPACITY,
|
|
166
|
+
RIPPLE_START_SCALE,
|
|
167
|
+
Row,
|
|
168
|
+
SCALE_REFERENCE_WIDTH,
|
|
29
169
|
Slot,
|
|
170
|
+
Stack,
|
|
171
|
+
TextSpan,
|
|
30
172
|
ThemeContext,
|
|
173
|
+
Typography,
|
|
31
174
|
XAUIProvider,
|
|
32
175
|
buildRadius,
|
|
33
176
|
buildShadows,
|
|
177
|
+
buttonRecipe,
|
|
178
|
+
cardRecipe,
|
|
34
179
|
childrenToString,
|
|
35
180
|
createRecipe,
|
|
36
181
|
createSlotContext,
|
|
@@ -38,13 +183,30 @@ export {
|
|
|
38
183
|
defaultTheme,
|
|
39
184
|
deriveColors,
|
|
40
185
|
deriveTint,
|
|
186
|
+
markBackground,
|
|
187
|
+
markOverlay,
|
|
41
188
|
mergeProps,
|
|
42
189
|
mergeRefs,
|
|
43
190
|
palette,
|
|
191
|
+
pressScaleFor,
|
|
44
192
|
primitives,
|
|
193
|
+
resolveAnimation,
|
|
194
|
+
resolveSlotAnimation,
|
|
195
|
+
rippleRadiusFor,
|
|
45
196
|
sourceKeys,
|
|
46
197
|
tokens,
|
|
198
|
+
typographyRecipe,
|
|
199
|
+
useButton,
|
|
200
|
+
useCard,
|
|
47
201
|
useColorMode,
|
|
202
|
+
useControllableState,
|
|
203
|
+
useFeedback,
|
|
204
|
+
useGrid,
|
|
205
|
+
useIconContext,
|
|
206
|
+
useMergedRef,
|
|
207
|
+
usePressState,
|
|
208
|
+
usePrevious,
|
|
209
|
+
useStyleProps,
|
|
48
210
|
useThemeColor,
|
|
49
211
|
useXAUITheme
|
|
50
212
|
};
|