@xaui/native 0.9.1-alpha.3 → 0.9.1-alpha.30
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-27ZRTZEE.js +293 -0
- package/dist/chunk-3FV4COTM.js +68 -0
- package/dist/chunk-423RQBOX.js +21 -0
- package/dist/chunk-4GTAZM2C.js +174 -0
- package/dist/chunk-4XPLPQLM.cjs +147 -0
- package/dist/{chunk-3QBT3Q65.cjs → chunk-57SJ4LJF.cjs} +7 -2
- package/dist/chunk-5GO7MAVY.cjs +74 -0
- package/dist/chunk-5RQ7AZPN.cjs +455 -0
- package/dist/chunk-5Z4P6WHR.cjs +525 -0
- package/dist/chunk-6RVCGLKZ.js +661 -0
- package/dist/chunk-7DPL3ZDS.cjs +21 -0
- package/dist/chunk-7EIHHOHP.cjs +42 -0
- package/dist/chunk-7SEZGVTY.js +62 -0
- package/dist/chunk-7XKQJQF2.cjs +70 -0
- package/dist/{chunk-X2K2FX3W.js → chunk-A3EGFI6T.js} +6 -1
- package/dist/chunk-A5OCK3C2.js +525 -0
- package/dist/chunk-BA2DBSAN.js +102 -0
- package/dist/chunk-BFMTUMTU.js +669 -0
- package/dist/chunk-BVJQ3UPZ.js +62 -0
- package/dist/chunk-DFME724B.js +147 -0
- package/dist/chunk-E2CWBQTV.js +119 -0
- package/dist/chunk-E4TS6632.cjs +314 -0
- package/dist/chunk-EGLLDKN6.js +9 -0
- package/dist/chunk-EJQCQPET.cjs +9 -0
- package/dist/chunk-F6CQ6CBI.cjs +112 -0
- package/dist/chunk-F6W3JQ7K.js +42 -0
- package/dist/chunk-FMZQW35T.js +431 -0
- package/dist/chunk-FNEUOBCV.cjs +174 -0
- package/dist/chunk-G7K652GC.js +145 -0
- package/dist/chunk-GGW42MY4.js +20 -0
- package/dist/chunk-GI24YJPE.js +314 -0
- package/dist/chunk-GLGU2WFL.cjs +190 -0
- package/dist/chunk-GPVNCJ3Z.cjs +696 -0
- package/dist/chunk-GVQOD3VW.js +74 -0
- package/dist/chunk-KOC3KQIT.js +124 -0
- package/dist/chunk-KPWZLUES.cjs +124 -0
- package/dist/chunk-KWCHSIMI.cjs +293 -0
- package/dist/chunk-MC7SY2QH.cjs +20 -0
- package/dist/chunk-N527BTY4.cjs +366 -0
- package/dist/chunk-NBFWWQFW.cjs +346 -0
- package/dist/chunk-NYRXUGVL.js +104 -0
- package/dist/{chunk-AW63PTQ4.cjs → chunk-OHEHPQLC.cjs} +72 -72
- package/dist/chunk-Q3WFY5N3.js +366 -0
- package/dist/chunk-QGN2BBJO.cjs +104 -0
- package/dist/chunk-TGZZ3RZU.cjs +86 -0
- package/dist/{chunk-2KXQATVL.js → chunk-TZG3DERP.js} +46 -46
- package/dist/chunk-UBQLKIZC.cjs +431 -0
- package/dist/chunk-URSKA2VR.js +190 -0
- package/dist/chunk-V4WDMM6Z.js +86 -0
- package/dist/chunk-VJEER76X.js +455 -0
- package/dist/chunk-VZBWYWEI.cjs +736 -0
- package/dist/chunk-WR7YLDVV.cjs +68 -0
- package/dist/chunk-X4HQ4H2V.js +701 -0
- package/dist/chunk-XFSW3ZNI.cjs +145 -0
- package/dist/chunk-XQFAUDR2.cjs +62 -0
- package/dist/chunk-YKL6XHM6.js +346 -0
- package/dist/chunk-ZP2E2H2G.cjs +119 -0
- package/dist/chunk-ZSLNGBDS.cjs +700 -0
- package/dist/close-button.type-BUYuoSt2.d.ts +36 -0
- package/dist/close-button.type-CHsgZ3wO.d.cts +36 -0
- package/dist/components/alert/index.cjs +20 -0
- package/dist/components/alert/index.d.cts +169 -0
- package/dist/components/alert/index.d.ts +169 -0
- package/dist/components/alert/index.js +20 -0
- package/dist/components/button/index.cjs +21 -0
- package/dist/components/button/index.d.cts +613 -0
- package/dist/components/button/index.d.ts +613 -0
- package/dist/components/button/index.js +21 -0
- package/dist/components/card/index.cjs +22 -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 +22 -0
- package/dist/components/checkbox/index.cjs +26 -0
- package/dist/components/checkbox/index.d.cts +1136 -0
- package/dist/components/checkbox/index.d.ts +1136 -0
- package/dist/components/checkbox/index.js +26 -0
- package/dist/components/chip/index.cjs +20 -0
- package/dist/components/chip/index.d.cts +608 -0
- package/dist/components/chip/index.d.ts +608 -0
- package/dist/components/chip/index.js +20 -0
- package/dist/components/input/index.cjs +25 -0
- package/dist/components/input/index.d.cts +205 -0
- package/dist/components/input/index.d.ts +205 -0
- package/dist/components/input/index.js +25 -0
- package/dist/components/input-group/index.cjs +27 -0
- package/dist/components/input-group/index.d.cts +270 -0
- package/dist/components/input-group/index.d.ts +270 -0
- package/dist/components/input-group/index.js +27 -0
- package/dist/components/input-otp/index.cjs +29 -0
- package/dist/components/input-otp/index.d.cts +325 -0
- package/dist/components/input-otp/index.d.ts +325 -0
- package/dist/components/input-otp/index.js +29 -0
- package/dist/components/radio/index.cjs +26 -0
- package/dist/components/radio/index.d.cts +1102 -0
- package/dist/components/radio/index.d.ts +1102 -0
- package/dist/components/radio/index.js +26 -0
- package/dist/components/spinner/index.cjs +16 -0
- package/dist/components/spinner/index.d.cts +104 -0
- package/dist/components/spinner/index.d.ts +104 -0
- package/dist/components/spinner/index.js +16 -0
- package/dist/components/switch/index.cjs +27 -0
- package/dist/components/switch/index.d.cts +1154 -0
- package/dist/components/switch/index.d.ts +1154 -0
- package/dist/components/switch/index.js +27 -0
- package/dist/components/text-area/index.cjs +14 -0
- package/dist/components/text-area/index.d.cts +73 -0
- package/dist/components/text-area/index.d.ts +73 -0
- package/dist/components/text-area/index.js +14 -0
- package/dist/components/typography/index.cjs +15 -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 +15 -0
- package/dist/components/view/index.cjs +17 -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 +17 -0
- package/dist/create-recipe-BdVd2ffi.d.ts +114 -0
- package/dist/create-recipe-dC7wMfnj.d.cts +114 -0
- package/dist/icon.type-Kml72iSz.d.ts +73 -0
- package/dist/icon.type-d_i9ma-i.d.cts +73 -0
- package/dist/index.cjs +246 -4
- package/dist/index.d.cts +109 -4
- package/dist/index.d.ts +109 -4
- package/dist/index.js +266 -24
- package/dist/input.type-BUMDlzL9.d.cts +167 -0
- package/dist/input.type-D2qgi03E.d.ts +167 -0
- package/dist/pressable-feedback.type-BA2C9sSz.d.cts +127 -0
- package/dist/pressable-feedback.type-Bs4dQlGj.d.ts +127 -0
- package/dist/style-props.type-CfnoGEP7.d.cts +31 -0
- package/dist/style-props.type-CfnoGEP7.d.ts +31 -0
- package/dist/system/index.cjs +60 -3
- package/dist/system/index.d.cts +347 -181
- package/dist/system/index.d.ts +347 -181
- package/dist/system/index.js +71 -14
- package/dist/theme/index.cjs +4 -3
- package/dist/theme/index.d.cts +34 -23
- package/dist/theme/index.d.ts +34 -23
- package/dist/theme/index.js +3 -2
- package/dist/{theme.type-C9bFJKFm.d.cts → theme.type-C2gNHpEx.d.cts} +1 -1
- package/dist/{theme.type-C9bFJKFm.d.ts → theme.type-C2gNHpEx.d.ts} +1 -1
- package/package.json +174 -18
- package/dist/chunk-QAMNNTGM.js +0 -637
- package/dist/chunk-V63JO65F.cjs +0 -637
package/dist/system/index.d.cts
CHANGED
|
@@ -1,98 +1,134 @@
|
|
|
1
|
+
import * as react_native from 'react-native';
|
|
2
|
+
import { StyleProp, ViewStyle, View } from 'react-native';
|
|
1
3
|
import * as react from 'react';
|
|
2
4
|
import { ReactNode, Provider, Ref, RefCallback } from 'react';
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { S as SlotAnimation, F as FeedbackContext, a as AnimationProp, b as ResolvedAnimation, P as PressableFeedbackProps } from '../pressable-feedback.type-BA2C9sSz.cjs';
|
|
6
|
+
export { A as AnimationConfig, R as RadiusStyle, c as RippleWave } from '../pressable-feedback.type-BA2C9sSz.cjs';
|
|
7
|
+
import { R as RadiusKey, X as XAUITheme } from '../theme.type-C2gNHpEx.cjs';
|
|
8
|
+
import { a as StyleFn, h as SlotStyle } from '../create-recipe-dC7wMfnj.cjs';
|
|
9
|
+
export { A as Axes, C as CompoundVariant, R as Recipe, d as RecipeConfig, b as ResolveArgs, e as ResolvedSelection, f as ResolvedStyles, g as Selection, S as SlotStyles, i as StateName, j as States, T as TintArgs, V as VariantColors, k as VariantRole, l as VariantTokens, c as createRecipe } from '../create-recipe-dC7wMfnj.cjs';
|
|
10
|
+
export { C as CloseButtonProps } from '../close-button.type-CHsgZ3wO.cjs';
|
|
11
|
+
import { a as IconProps, I as IconContextValue } from '../icon.type-d_i9ma-i.cjs';
|
|
12
|
+
export { b as IconComponentProps } from '../icon.type-d_i9ma-i.cjs';
|
|
13
|
+
import { V as ViewStyleProps } from '../style-props.type-CfnoGEP7.cjs';
|
|
14
|
+
export { D as DirectionalStyleKey, I as ImageStyleProps, S as StyleProps, T as TextStyleProps } from '../style-props.type-CfnoGEP7.cjs';
|
|
15
|
+
import 'react-native-reanimated';
|
|
7
16
|
|
|
8
17
|
/**
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
18
|
+
* The runtime half of R14. The type half lives in `system/style-props/`, and the two are
|
|
19
|
+
* pinned to each other by a compile-time check there: a React Native upgrade that adds or
|
|
20
|
+
* removes a style key fails `type-check` with the key's name rather than drifting.
|
|
21
|
+
*
|
|
22
|
+
* One set for the three style types rather than one per node. A caller cannot write
|
|
23
|
+
* `fontSize` on a view slot — that slot's props are typed `ViewStyleProps` — so the split
|
|
24
|
+
* never has to know which node it runs for, and every component shares one table.
|
|
13
25
|
*/
|
|
14
|
-
|
|
15
|
-
type
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
26
|
+
declare const STYLE_PROP_KEYS: readonly ["alignContent", "alignItems", "alignSelf", "aspectRatio", "boxSizing", "columnGap", "direction", "display", "flex", "flexBasis", "flexDirection", "flexGrow", "flexShrink", "flexWrap", "gap", "justifyContent", "overflow", "rowGap", "bottom", "end", "inset", "insetBlock", "insetBlockEnd", "insetBlockStart", "insetInline", "insetInlineEnd", "insetInlineStart", "position", "start", "top", "zIndex", "margin", "marginBlock", "marginBlockEnd", "marginBlockStart", "marginBottom", "marginEnd", "marginHorizontal", "marginInline", "marginInlineEnd", "marginInlineStart", "marginStart", "marginTop", "marginVertical", "padding", "paddingBlock", "paddingBlockEnd", "paddingBlockStart", "paddingBottom", "paddingEnd", "paddingHorizontal", "paddingInline", "paddingInlineEnd", "paddingInlineStart", "paddingStart", "paddingTop", "paddingVertical", "height", "maxHeight", "maxWidth", "minHeight", "minWidth", "width", "borderBlockColor", "borderBlockEndColor", "borderBlockStartColor", "borderBottomColor", "borderBottomEndRadius", "borderBottomStartRadius", "borderBottomWidth", "borderColor", "borderCurve", "borderEndColor", "borderEndEndRadius", "borderEndStartRadius", "borderEndWidth", "borderRadius", "borderStartColor", "borderStartEndRadius", "borderStartStartRadius", "borderStartWidth", "borderStyle", "borderTopColor", "borderTopEndRadius", "borderTopStartRadius", "borderTopWidth", "borderWidth", "backfaceVisibility", "backgroundColor", "boxShadow", "cursor", "elevation", "experimental_backgroundImage", "filter", "isolation", "mixBlendMode", "opacity", "outlineColor", "outlineOffset", "outlineStyle", "outlineWidth", "shadowColor", "shadowOffset", "shadowOpacity", "shadowRadius", "rotation", "scaleX", "scaleY", "transform", "transformMatrix", "transformOrigin", "translateX", "translateY", "color", "fontFamily", "fontSize", "fontStyle", "fontVariant", "fontWeight", "includeFontPadding", "letterSpacing", "lineHeight", "textAlign", "textAlignVertical", "textDecorationColor", "textDecorationLine", "textDecorationStyle", "textShadowColor", "textShadowOffset", "textShadowRadius", "textTransform", "userSelect", "verticalAlign", "writingDirection", "objectFit", "overlayColor", "resizeMode", "tintColor"];
|
|
27
|
+
type StylePropKey = (typeof STYLE_PROP_KEYS)[number];
|
|
28
|
+
/** What `splitStyleProps` takes out of a props object. */
|
|
29
|
+
type StylePropsOf<P> = Pick<P, Extract<keyof P, StylePropKey>>;
|
|
30
|
+
/** What it leaves in it. */
|
|
31
|
+
type RestPropsOf<P> = Omit<P, StylePropKey>;
|
|
32
|
+
|
|
20
33
|
/**
|
|
21
|
-
* `
|
|
22
|
-
*
|
|
23
|
-
*
|
|
34
|
+
* `splitStyleProps`, memoized on the values (R14). A component calls it on what is left
|
|
35
|
+
* after destructuring its own props, applies the style half between the tint and its
|
|
36
|
+
* `style`, and forwards the rest:
|
|
37
|
+
*
|
|
38
|
+
* ```tsx
|
|
39
|
+
* const [styleProps, rest] = useStyleProps(props)
|
|
40
|
+
* <Pressable style={[styles.root, tint, styleProps, style]} {...rest} />
|
|
41
|
+
* ```
|
|
42
|
+
*
|
|
43
|
+
* The identity is stable while the values are, which is what a memoized child or an
|
|
44
|
+
* animated style depends on. It is keyed on a hash rather than on the object, because the
|
|
45
|
+
* object is a fresh rest-spread on every render and would never hit.
|
|
24
46
|
*/
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
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
|
-
|
|
54
|
-
|
|
55
|
-
|
|
47
|
+
declare function useStyleProps<P extends object>(props: P): [StylePropsOf<P>, RestPropsOf<P>];
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* The gap nobody else closes: an icon is a third-party component, so a slot context does
|
|
51
|
+
* not reach it and every call site ends up computing the colour by hand.
|
|
52
|
+
*
|
|
53
|
+
* ```tsx
|
|
54
|
+
* <Button variant="danger">
|
|
55
|
+
* <Button.Icon as={TrashIcon} /> {/* colour and size inherited, nothing to pass *\/}
|
|
56
|
+
* <Button.Label>Supprimer</Button.Label>
|
|
57
|
+
* </Button>
|
|
58
|
+
* ```
|
|
59
|
+
*
|
|
60
|
+
* Three accepted forms — a component through `as`, a raw SVG as children, or an image
|
|
61
|
+
* through `source` — and the resolution is the same for all three: an explicit prop, else
|
|
62
|
+
* what the surrounding slot published, else the theme.
|
|
63
|
+
*
|
|
64
|
+
* The props are taken whole rather than destructured, because they are a union: which
|
|
65
|
+
* keys exist depends on the form, and narrowing is what lets `style` be reachable in the
|
|
66
|
+
* one branch that renders a node and unwritable in the two that do not.
|
|
67
|
+
*/
|
|
68
|
+
declare function Icon(props: IconProps): react.JSX.Element;
|
|
69
|
+
declare namespace Icon {
|
|
70
|
+
var displayName: string;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Not a `createSlotContext`: that one throws outside its parent, and an `Icon` has to
|
|
75
|
+
* work on its own as much as inside a `Button`. An empty context is the honest default —
|
|
76
|
+
* nothing inherited, so the theme decides.
|
|
77
|
+
*/
|
|
78
|
+
declare const IconContext: react.Context<IconContextValue>;
|
|
79
|
+
declare function useIconContext(): IconContextValue;
|
|
80
|
+
|
|
81
|
+
type PortalProps = {
|
|
82
|
+
children: ReactNode;
|
|
56
83
|
};
|
|
57
84
|
/**
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
*
|
|
85
|
+
* Renders its children into the nearest `PortalHost` instead of where it sits. What
|
|
86
|
+
* `Dialog`, `Sheet`, `Drawer` and `Snackbar` are built on: an overlay has to escape the
|
|
87
|
+
* clipping and stacking of whatever container happened to hold the trigger.
|
|
88
|
+
*
|
|
89
|
+
* Both halves run in layout effects rather than effects, which is deliberate: the content
|
|
90
|
+
* lands in the same commit as the trigger's, so an overlay neither shows one frame late
|
|
91
|
+
* nor survives one frame past the unmount that closed it. The unpublish sits in its own
|
|
92
|
+
* effect so that it does not depend on `children` — a re-publish then keeps the portal's
|
|
93
|
+
* place in the host's order instead of dropping it and re-adding it at the end.
|
|
62
94
|
*/
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
95
|
+
declare function Portal({ children }: PortalProps): null;
|
|
96
|
+
declare namespace Portal {
|
|
97
|
+
var displayName: string;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
type PortalMethods = {
|
|
101
|
+
addPortal: (key: string, element: ReactNode) => void;
|
|
102
|
+
removePortal: (key: string) => void;
|
|
68
103
|
};
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
*/
|
|
80
|
-
pressCount?: SharedValue<number>;
|
|
81
|
-
/** Where the finger landed, and how big the root is — the ripple needs both. */
|
|
82
|
-
origin?: SharedValue<{
|
|
83
|
-
x: number;
|
|
84
|
-
y: number;
|
|
85
|
-
}>;
|
|
86
|
-
size?: SharedValue<{
|
|
87
|
-
width: number;
|
|
88
|
-
height: number;
|
|
89
|
-
}>;
|
|
104
|
+
/**
|
|
105
|
+
* `null` outside a host, and `Portal` treats that as "render nothing" rather than
|
|
106
|
+
* throwing: an app that forgot `PortalHost` should lose its overlays, not crash on the
|
|
107
|
+
* first `Dialog`.
|
|
108
|
+
*/
|
|
109
|
+
declare const PortalContext: react.Context<PortalMethods | null>;
|
|
110
|
+
|
|
111
|
+
/** R14 — it renders a view of its own, so it takes that view's style keys as props. */
|
|
112
|
+
type PortalHostProps = ViewStyleProps & {
|
|
113
|
+
children: ReactNode;
|
|
90
114
|
};
|
|
115
|
+
/**
|
|
116
|
+
* Where every `Portal` in the tree below renders. Mounted once, at the root of the app,
|
|
117
|
+
* above navigation — an overlay that renders inside a screen is clipped by it.
|
|
118
|
+
*/
|
|
119
|
+
declare function PortalHost({ children, ...props }: PortalHostProps): react.JSX.Element;
|
|
120
|
+
declare namespace PortalHost {
|
|
121
|
+
var displayName: string;
|
|
122
|
+
}
|
|
91
123
|
|
|
92
|
-
type PressableFeedbackHighlightProps = {
|
|
124
|
+
type PressableFeedbackHighlightProps = ViewStyleProps & {
|
|
93
125
|
style?: StyleProp<ViewStyle>;
|
|
94
|
-
/** Overrides the blanket `animation` on the root, for this overlay only. */
|
|
95
126
|
animation?: SlotAnimation;
|
|
127
|
+
/**
|
|
128
|
+
* The content the wash sits under. Optional: `<Highlight />` on its own is an overlay
|
|
129
|
+
* among the root's other children, and the root hoists it so order does not matter.
|
|
130
|
+
*/
|
|
131
|
+
children?: ReactNode;
|
|
96
132
|
};
|
|
97
133
|
/**
|
|
98
134
|
* The press wash: one flat overlay fading in under the finger.
|
|
@@ -100,30 +136,75 @@ type PressableFeedbackHighlightProps = {
|
|
|
100
136
|
* It is a **neutral** wash, not the variant's pressed colour. A component picks one or
|
|
101
137
|
* the other — this overlay, or a `pressed` state in its recipe swapping `bg` for
|
|
102
138
|
* `bgPressed` — never both, or a pressed button darkens twice.
|
|
139
|
+
*
|
|
140
|
+
* **Wrapping is the readable form**, and it costs nothing:
|
|
141
|
+
*
|
|
142
|
+
* ```tsx
|
|
143
|
+
* <PressableFeedback style={{ flexDirection: 'row', gap: 8 }}>
|
|
144
|
+
* <PressableFeedback.Highlight>
|
|
145
|
+
* <Icon />
|
|
146
|
+
* <Label />
|
|
147
|
+
* </PressableFeedback.Highlight>
|
|
148
|
+
* </PressableFeedback>
|
|
149
|
+
* ```
|
|
150
|
+
*
|
|
151
|
+
* The children are **not** put inside a box. They are returned as siblings of the wash in
|
|
152
|
+
* a fragment, which has no presence in the host tree — so the root's `flexDirection`,
|
|
153
|
+
* `gap` and `alignItems` still reach the icon and the label directly, and the rendered
|
|
154
|
+
* tree is identical to writing the wash as a bare sibling. A real wrapping `View` would
|
|
155
|
+
* have made the root's layout apply to the wrapper instead, and would have added the depth
|
|
156
|
+
* §8 removed.
|
|
103
157
|
*/
|
|
104
|
-
declare function PressableFeedbackHighlight({ style, animation: override, }: PressableFeedbackHighlightProps): react.JSX.Element;
|
|
158
|
+
declare function PressableFeedbackHighlight({ style, animation: override, children, ...props }: PressableFeedbackHighlightProps): react.JSX.Element;
|
|
105
159
|
declare namespace PressableFeedbackHighlight {
|
|
106
160
|
var displayName: string;
|
|
107
161
|
}
|
|
108
162
|
|
|
109
|
-
type PressableFeedbackRippleProps = {
|
|
163
|
+
type PressableFeedbackRippleProps = ViewStyleProps & {
|
|
164
|
+
/** Applies to the wave itself, not to the container that clips it. */
|
|
110
165
|
style?: StyleProp<ViewStyle>;
|
|
111
|
-
/** Overrides the blanket `animation` on the root, for this overlay only. */
|
|
112
166
|
animation?: SlotAnimation;
|
|
167
|
+
/**
|
|
168
|
+
* The content the wave washes under. Optional: `<Ripple />` on its own is an overlay
|
|
169
|
+
* among the root's other children, and the root hoists it so order does not matter.
|
|
170
|
+
*/
|
|
171
|
+
children?: ReactNode;
|
|
113
172
|
};
|
|
114
173
|
/**
|
|
115
174
|
* A circle washing outwards from where the finger landed.
|
|
116
175
|
*
|
|
117
|
-
*
|
|
118
|
-
*
|
|
119
|
-
*
|
|
176
|
+
* **The root drives it, this only draws it.** The root is the touch surface: touches on a
|
|
177
|
+
* component's own children — a button's label — bubble up to the `Pressable`, and never to
|
|
178
|
+
* this overlay, which is their sibling rather than their parent. An overlay owning the
|
|
179
|
+
* handlers works on the padding and does nothing on the text, which is the kind of bug that
|
|
180
|
+
* looks like a rendering problem.
|
|
181
|
+
*
|
|
182
|
+
* Its ink and its corners come from the root, which reads both off its own style — only
|
|
183
|
+
* the root knows what the wave sits on, or what shape it has to stay inside.
|
|
184
|
+
*
|
|
185
|
+
* **Wrapping is the readable form**, and it costs nothing:
|
|
120
186
|
*
|
|
121
|
-
*
|
|
122
|
-
*
|
|
123
|
-
*
|
|
124
|
-
*
|
|
187
|
+
* ```tsx
|
|
188
|
+
* <PressableFeedback style={{ flexDirection: 'row', gap: 8 }}>
|
|
189
|
+
* <PressableFeedback.Ripple>
|
|
190
|
+
* <Icon />
|
|
191
|
+
* <Label />
|
|
192
|
+
* </PressableFeedback.Ripple>
|
|
193
|
+
* </PressableFeedback>
|
|
194
|
+
* ```
|
|
195
|
+
*
|
|
196
|
+
* The children are **not** put inside a box. They come back as siblings of the wave's
|
|
197
|
+
* container in a fragment, which has no presence in the host tree — so the root's
|
|
198
|
+
* `flexDirection`, `gap` and `alignItems` still reach the icon and the label directly, and
|
|
199
|
+
* the rendered tree is identical to writing the wave as a bare sibling. Written on its own,
|
|
200
|
+
* `<Ripple />` is that bare sibling, and the root hoists it so order does not matter.
|
|
201
|
+
*
|
|
202
|
+
* The motion is Material's `InkRipple`, and the parts that matter are the ones that are not
|
|
203
|
+
* obvious: the ink is **independent of the expansion**, the circle **starts at 30%** of its
|
|
204
|
+
* target rather than at a point, the target is **half the diagonal**, and the centre
|
|
205
|
+
* **travels** from the finger to the middle of the control. The constants carry the why.
|
|
125
206
|
*/
|
|
126
|
-
declare function PressableFeedbackRipple({ style, animation: override, }: PressableFeedbackRippleProps): react.JSX.Element
|
|
207
|
+
declare function PressableFeedbackRipple({ style, animation: override, children, ...props }: PressableFeedbackRippleProps): react.JSX.Element;
|
|
127
208
|
declare namespace PressableFeedbackRipple {
|
|
128
209
|
var displayName: string;
|
|
129
210
|
}
|
|
@@ -131,24 +212,66 @@ declare namespace PressableFeedbackRipple {
|
|
|
131
212
|
declare const useFeedback: () => FeedbackContext;
|
|
132
213
|
|
|
133
214
|
/**
|
|
134
|
-
*
|
|
135
|
-
*
|
|
136
|
-
*
|
|
137
|
-
*
|
|
138
|
-
*
|
|
215
|
+
* What marks a component as a press overlay.
|
|
216
|
+
*
|
|
217
|
+
* `Symbol.for` rather than a boolean field or an identity check against our own two
|
|
218
|
+
* components: the registry is global, so two copies of `@xaui/native` in one tree still
|
|
219
|
+
* agree on what an overlay is, and a third party writing their own overlay — anything that
|
|
220
|
+
* reads `useFeedback()` and paints under the content — opts into the same treatment
|
|
221
|
+
* instead of being a second-class citizen.
|
|
139
222
|
*/
|
|
140
|
-
declare const
|
|
141
|
-
|
|
142
|
-
declare
|
|
143
|
-
|
|
144
|
-
declare const HIGHLIGHT_OPACITY = 0.08;
|
|
145
|
-
declare const RIPPLE_OPACITY = 0.12;
|
|
146
|
-
declare const RIPPLE_DURATION = 350;
|
|
223
|
+
declare const FEEDBACK_OVERLAY: unique symbol;
|
|
224
|
+
/** Tags a component so `PressableFeedback` paints it under its content. */
|
|
225
|
+
declare function markOverlay<T extends object>(component: T): T;
|
|
226
|
+
|
|
147
227
|
/**
|
|
148
|
-
*
|
|
149
|
-
*
|
|
228
|
+
* How far a control shrinks under the finger — **before** the width coefficient below.
|
|
229
|
+
*
|
|
230
|
+
* The v0 tree shrank everything to a flat `0.975`, which is why a wide button read as
|
|
231
|
+
* lurching: a ratio applied to a 360pt row moves nine points, and the same ratio on a
|
|
232
|
+
* 96pt chip moves two. What the eye reads is the displacement, not the ratio.
|
|
150
233
|
*/
|
|
151
|
-
declare const
|
|
234
|
+
declare const PRESS_SCALE = 0.985;
|
|
235
|
+
declare const PRESS_DURATION = 300;
|
|
236
|
+
/**
|
|
237
|
+
* The width at which `PRESS_SCALE` is applied as written. Wider controls shrink
|
|
238
|
+
* proportionally less, narrower ones more, so the movement stays roughly constant in
|
|
239
|
+
* points across a 96pt chip and a full-width button.
|
|
240
|
+
*/
|
|
241
|
+
declare const SCALE_REFERENCE_WIDTH = 300;
|
|
242
|
+
/** The scale a control of `width` should reach when pressed. */
|
|
243
|
+
declare function pressScaleFor(width: number): number;
|
|
244
|
+
/** How far the wash goes at full press, and how long it takes to get there. */
|
|
245
|
+
declare const HIGHLIGHT_OPACITY = 0.1;
|
|
246
|
+
declare const HIGHLIGHT_DURATION = 200;
|
|
247
|
+
/**
|
|
248
|
+
* The ripple, taken from Material's reference implementation (`InkRipple`) rather than
|
|
249
|
+
* approximated. Four of its numbers are load-bearing and none of them is obvious:
|
|
250
|
+
*
|
|
251
|
+
* - **The opacity is not tied to the expansion.** It reaches full ink in 75ms and stays
|
|
252
|
+
* there while the circle keeps growing. Tying the two — the obvious thing to write —
|
|
253
|
+
* means the ink is faintest exactly when the circle is small enough to be read as a
|
|
254
|
+
* circle, which is why such a ripple looks like nothing at all.
|
|
255
|
+
* - **The circle starts at 30% of its target**, not at a point. A wave from a dot spends
|
|
256
|
+
* its visible life too small to see.
|
|
257
|
+
* - **The target radius is half the diagonal**, which is what covers the box. Larger and
|
|
258
|
+
* the edge leaves the control before the eye catches it, so the effect reads as the
|
|
259
|
+
* surface tinting rather than as something spreading.
|
|
260
|
+
* - **The centre travels** from the finger to the middle of the control as it opens, which
|
|
261
|
+
* is what makes it settle into the control instead of flooding out of a corner.
|
|
262
|
+
*
|
|
263
|
+
* The expansion runs a full second while the finger is down, and finishes in 225ms once it
|
|
264
|
+
* lifts — the wave catches up rather than being cut.
|
|
265
|
+
*/
|
|
266
|
+
declare const RIPPLE_OPACITY = 0.1;
|
|
267
|
+
declare const RIPPLE_START_SCALE = 0.3;
|
|
268
|
+
declare const RIPPLE_EXPAND_DURATION = 1000;
|
|
269
|
+
declare const RIPPLE_CONFIRM_DURATION = 225;
|
|
270
|
+
declare const RIPPLE_FADE_IN = 75;
|
|
271
|
+
declare const RIPPLE_FADE_OUT_DELAY = 225;
|
|
272
|
+
declare const RIPPLE_FADE_OUT = 150;
|
|
273
|
+
/** Half the diagonal covers the box from its centre; the 5 is Material's own overshoot. */
|
|
274
|
+
declare function rippleRadiusFor(width: number, height: number): number;
|
|
152
275
|
/**
|
|
153
276
|
* One shape out of four accepted ones, so the components read a record instead of
|
|
154
277
|
* re-deciding what `'disable-all'` meant.
|
|
@@ -169,11 +292,16 @@ type ResolvedSlotAnimation = {
|
|
|
169
292
|
*/
|
|
170
293
|
declare function resolveSlotAnimation(override: SlotAnimation | undefined, enabledByRoot: boolean, defaultOpacity: number, defaultDuration?: number): ResolvedSlotAnimation;
|
|
171
294
|
|
|
172
|
-
|
|
295
|
+
/**
|
|
296
|
+
* The root scales; what else happens under the finger is **composed**, not named by a
|
|
297
|
+
* prop. An overlay a caller can reach is an overlay a caller can place, style and switch
|
|
298
|
+
* off — and it is the only shape that survives `asChild`, where the caller's own element
|
|
299
|
+
* is the pressable and there is no sibling for the primitive to inject.
|
|
300
|
+
*/
|
|
301
|
+
declare const PressableFeedback: react.ForwardRefExoticComponent<Omit<react_native.PressableProps, "disabled" | "style" | "children"> & ViewStyleProps & {
|
|
173
302
|
isPressed?: boolean;
|
|
174
303
|
isDisabled?: boolean;
|
|
175
304
|
asChild?: boolean;
|
|
176
|
-
feedbackVariant?: FeedbackVariant;
|
|
177
305
|
animation?: AnimationProp;
|
|
178
306
|
style?: react_native.StyleProp<react_native.ViewStyle>;
|
|
179
307
|
children?: react.ReactNode;
|
|
@@ -183,83 +311,67 @@ declare const PressableFeedback: react.ForwardRefExoticComponent<Omit<react_nati
|
|
|
183
311
|
};
|
|
184
312
|
|
|
185
313
|
/**
|
|
186
|
-
*
|
|
187
|
-
*
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
*
|
|
199
|
-
*
|
|
314
|
+
* The `radius` axis, which is the same ten lines in every component that has one — a key
|
|
315
|
+
* of the radius scale, applied to one slot, overriding whatever `size` chose.
|
|
316
|
+
*
|
|
317
|
+
* It is written here rather than a third time in a recipe because that is the rule §2 bis
|
|
318
|
+
* states: extract at the second use, and by the end of P3 this axis exists in a dozen
|
|
319
|
+
* components. Nothing about it is component-specific except which slot carries the corner.
|
|
320
|
+
*
|
|
321
|
+
* ```ts
|
|
322
|
+
* variants: { size: { … }, radius: radiusAxis('root') }
|
|
323
|
+
* ```
|
|
324
|
+
*
|
|
325
|
+
* **More than one slot when a second node has to square off with the first.** A `Switch`
|
|
326
|
+
* whose track lost its capsule and kept a circular knob is half-rounded, so the axis moves
|
|
327
|
+
* both: `radiusAxis('track', 'thumb')`.
|
|
328
|
+
*
|
|
329
|
+
* The same named corner on each, not an inset-corrected one. Nesting rules would say the
|
|
330
|
+
* inner radius is the outer less the gap, but here that reaches zero before the outer does
|
|
331
|
+
* — at `xs` a 3pt track would hold a sharp-cornered knob — and two matched corners read
|
|
332
|
+
* better than one correct one.
|
|
333
|
+
*
|
|
334
|
+
* Variadic rather than an array because every call but that one passes a single slot, and
|
|
335
|
+
* `radiusAxis('root')` reads better than `radiusAxis(['root'])`.
|
|
336
|
+
*
|
|
337
|
+
* The return type is a full `Record<RadiusKey, …>` rather than a partial one, so
|
|
338
|
+
* `createRecipe` still infers `radius="3xl"` as the axis's value union and a typo in a
|
|
339
|
+
* caller's `radius` is a type error rather than a silently ignored key.
|
|
200
340
|
*/
|
|
201
|
-
|
|
202
|
-
type States = Partial<Record<StateName, boolean>>;
|
|
203
|
-
/** Reads the theme and the variant's resolved colours; returns one style per slot. */
|
|
204
|
-
type StyleFn<Slot extends string> = (theme: XAUITheme, colors: VariantColors) => SlotStyles<Slot>;
|
|
205
|
-
/** Named axes of finite token values — `{ size: { sm: fn, md: fn } }`. */
|
|
206
|
-
type Axes<Slot extends string> = Record<string, Record<string, StyleFn<Slot>>>;
|
|
207
|
-
/** One value per axis, plus the variant. Missing keys fall back to `defaultVariants`. */
|
|
208
|
-
type Selection<Variant extends string, A extends Axes<string>> = {
|
|
209
|
-
variant?: Variant;
|
|
210
|
-
} & {
|
|
211
|
-
[Axis in keyof A]?: Extract<keyof A[Axis], string>;
|
|
212
|
-
};
|
|
213
|
-
type CompoundVariant<Slot extends string, Variant extends string, A extends Axes<Slot>> = {
|
|
214
|
-
when: Selection<Variant, A>;
|
|
215
|
-
style: StyleFn<Slot>;
|
|
216
|
-
};
|
|
217
|
-
type RecipeConfig<Slot extends string, Variant extends string, A extends Axes<Slot>> = {
|
|
218
|
-
/** Every slot the component publishes. Slots a recipe never styles resolve to `{}`. */
|
|
219
|
-
slots: readonly Slot[];
|
|
220
|
-
base?: StyleFn<Slot>;
|
|
221
|
-
variantTokens?: Record<Variant, VariantTokens>;
|
|
222
|
-
/** Where the variant's colours land — written once, and it holds for every variant. */
|
|
223
|
-
paint?: StyleFn<Slot>;
|
|
224
|
-
variants?: A;
|
|
225
|
-
compoundVariants?: ReadonlyArray<CompoundVariant<Slot, Variant, A>>;
|
|
226
|
-
states?: Partial<Record<StateName, StyleFn<Slot>>>;
|
|
227
|
-
defaultVariants?: Selection<Variant, A>;
|
|
228
|
-
};
|
|
229
|
-
/** Stable references: the same object for the same tokens, for the app's lifetime. */
|
|
230
|
-
type ResolvedStyles<Slot extends string> = Readonly<Record<Slot, SlotStyle>>;
|
|
231
|
-
/** A selection with `defaultVariants` already folded in, keyed by axis name. */
|
|
232
|
-
type ResolvedSelection = Readonly<Record<string, string | undefined>>;
|
|
341
|
+
declare function radiusAxis<Slot extends string>(...slots: Slot[]): Record<RadiusKey, StyleFn<Slot>>;
|
|
233
342
|
|
|
234
|
-
type
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
readonly slots: readonly Slot[];
|
|
244
|
-
/** The cached pass: stable `StyleSheet` references, keyed by tokens alone. */
|
|
245
|
-
resolve(args: ResolveArgs<Variant, A>): ResolvedStyles<Slot>;
|
|
246
|
-
/**
|
|
247
|
-
* The tint pass: the same functions run again with `color`'s slices in place of the
|
|
248
|
-
* theme's tokens. Uncached and allocating, and only ever called when `color` is set.
|
|
249
|
-
*/
|
|
250
|
-
tint(args: TintArgs<Variant, A>): SlotStyles<Slot>;
|
|
343
|
+
type SelectionFillProps = {
|
|
344
|
+
/** Whether the control is on. The fill is the answer, and the mark rides on it. */
|
|
345
|
+
isVisible: boolean;
|
|
346
|
+
/** The resolved style of the host component's `fill` slot (R5). */
|
|
347
|
+
style: StyleProp<ViewStyle>;
|
|
348
|
+
/** `false` shows the fill without the fade and the scale, and mounts no worklet. */
|
|
349
|
+
animation?: boolean;
|
|
350
|
+
/** The mark — a check, a dash, a dot. It appears with the fill, never before it. */
|
|
351
|
+
children?: ReactNode;
|
|
251
352
|
};
|
|
353
|
+
|
|
252
354
|
/**
|
|
253
|
-
*
|
|
254
|
-
*
|
|
255
|
-
*
|
|
256
|
-
*
|
|
257
|
-
*
|
|
258
|
-
*
|
|
259
|
-
*
|
|
260
|
-
*
|
|
355
|
+
* The colour a control takes when it is on, and the mark that arrives with it — the
|
|
356
|
+
* `Checkbox`'s check on its accent square, the `Radio`'s dot in its accent circle.
|
|
357
|
+
*
|
|
358
|
+
* It is a node of its own rather than a background on the box, because it has to fade and
|
|
359
|
+
* grow in **without taking the border with it**, and the mark has to ride along: a check
|
|
360
|
+
* arriving before its background reads as a glitch rather than as an animation.
|
|
361
|
+
*
|
|
362
|
+
* ```tsx
|
|
363
|
+
* <SelectionFill isVisible={isSelected} style={fillStyle} animation={animation}>
|
|
364
|
+
* <Check />
|
|
365
|
+
* </SelectionFill>
|
|
366
|
+
* ```
|
|
367
|
+
*
|
|
368
|
+
* The style is the host component's own resolved `fill` slot (R5) — this owns the motion
|
|
369
|
+
* and nothing else, which is what lets two components share it without sharing a recipe.
|
|
261
370
|
*/
|
|
262
|
-
declare function
|
|
371
|
+
declare function SelectionFill({ isVisible, style, animation, children, }: SelectionFillProps): react.JSX.Element | null;
|
|
372
|
+
declare namespace SelectionFill {
|
|
373
|
+
var displayName: string;
|
|
374
|
+
}
|
|
263
375
|
|
|
264
376
|
/**
|
|
265
377
|
* R3: the string a root should wrap in its default text slot, or `null` when it should
|
|
@@ -350,4 +462,58 @@ type SlotProps = MergeableProps & {
|
|
|
350
462
|
*/
|
|
351
463
|
declare const Slot: react.ForwardRefExoticComponent<Omit<SlotProps, "ref"> & react.RefAttributes<unknown>>;
|
|
352
464
|
|
|
353
|
-
|
|
465
|
+
/**
|
|
466
|
+
* The dismiss affordance shared by everything that can be dismissed — `Chip.Close`,
|
|
467
|
+
* `Alert.Close`, and the `Dialog`, `Snackbar` and `Sheet` of P5. Each of those is a
|
|
468
|
+
* five-line call site handing it the styles its own recipe resolved:
|
|
469
|
+
*
|
|
470
|
+
* ```tsx
|
|
471
|
+
* const { closeStyle, closeGlyphStyle, isDisabled } = useChip()
|
|
472
|
+
*
|
|
473
|
+
* <CloseButton
|
|
474
|
+
* name="Chip.Close"
|
|
475
|
+
* baseStyle={closeStyle}
|
|
476
|
+
* glyphStyle={closeGlyphStyle}
|
|
477
|
+
* isDisabled={isDisabled}
|
|
478
|
+
* />
|
|
479
|
+
* ```
|
|
480
|
+
*
|
|
481
|
+
* **It owns its press state**, unlike every other pressable in the library, where the
|
|
482
|
+
* component root owns it because its recipe resolves on it. Here the surrounding
|
|
483
|
+
* component is usually not a control at all, and where it is, the two are different
|
|
484
|
+
* targets: pressing the cross must not read as pressing the chip around it.
|
|
485
|
+
*
|
|
486
|
+
* With no children it draws its own cross from two bars a quarter turn apart, so a
|
|
487
|
+
* dismissible component works in a project that has installed no icon set.
|
|
488
|
+
*/
|
|
489
|
+
declare const CloseButton: react.ForwardRefExoticComponent<{
|
|
490
|
+
name: string;
|
|
491
|
+
children?: react.ReactNode;
|
|
492
|
+
baseStyle?: react_native.StyleProp<react_native.ViewStyle>;
|
|
493
|
+
glyphStyle?: react_native.StyleProp<react_native.ViewStyle>;
|
|
494
|
+
style?: react_native.StyleProp<react_native.ViewStyle> | ((state: react_native.PressableStateCallbackType) => react_native.StyleProp<react_native.ViewStyle>);
|
|
495
|
+
} & Omit<PressableFeedbackProps, "isPressed" | "style" | "children"> & react.RefAttributes<View>>;
|
|
496
|
+
|
|
497
|
+
/** The two slots a component publishes for a `CloseButton`: its box and one cross bar. */
|
|
498
|
+
type CloseButtonSlots = {
|
|
499
|
+
close: SlotStyle;
|
|
500
|
+
closeGlyph: SlotStyle;
|
|
501
|
+
};
|
|
502
|
+
/**
|
|
503
|
+
* The cross's own geometry, for the `base` of any recipe that hosts a `CloseButton`:
|
|
504
|
+
*
|
|
505
|
+
* ```ts
|
|
506
|
+
* base: theme => ({ ...closeButtonBase(theme), root: { … } })
|
|
507
|
+
* ```
|
|
508
|
+
*
|
|
509
|
+
* The bar's thickness and the box's centring belong to the button rather than to the
|
|
510
|
+
* component around it, so they are written once here. What stays in the recipe is what is
|
|
511
|
+
* genuinely the component's: the size of the box and the length of the bar, both of which
|
|
512
|
+
* follow that component's own scale.
|
|
513
|
+
*
|
|
514
|
+
* Two bars are rendered, rotated a quarter turn apart, which is why only one is described
|
|
515
|
+
* and why it is positioned absolutely — they overlap at the centre of the box.
|
|
516
|
+
*/
|
|
517
|
+
declare function closeButtonBase(theme: XAUITheme): CloseButtonSlots;
|
|
518
|
+
|
|
519
|
+
export { AnimationProp, type AsChildProps, CloseButton, type CloseButtonSlots, FEEDBACK_OVERLAY, FeedbackContext, HIGHLIGHT_DURATION, HIGHLIGHT_OPACITY, Icon, IconContext, IconContextValue, IconProps, type MergeableProps, PRESS_DURATION, PRESS_SCALE, Portal, PortalContext, PortalHost, type PortalHostProps, type PortalMethods, type PortalProps, type PossibleRef, PressableFeedback, type PressableFeedbackHighlightProps, PressableFeedbackProps, type PressableFeedbackRippleProps, RIPPLE_CONFIRM_DURATION, RIPPLE_EXPAND_DURATION, RIPPLE_FADE_IN, RIPPLE_FADE_OUT, RIPPLE_FADE_OUT_DELAY, RIPPLE_OPACITY, RIPPLE_START_SCALE, ResolvedAnimation, SCALE_REFERENCE_WIDTH, SelectionFill, type SelectionFillProps, Slot, SlotAnimation, type SlotProps, SlotStyle, StyleFn, ViewStyleProps, childrenToString, closeButtonBase, createSlotContext, markOverlay, mergeProps, mergeRefs, pressScaleFor, radiusAxis, resolveAnimation, resolveSlotAnimation, rippleRadiusFor, useFeedback, useIconContext, useStyleProps };
|