@xaui/native 0.9.1-alpha.32 → 0.9.1-alpha.33
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-I66VMLHE.cjs +410 -0
- package/dist/chunk-ZA6RT3XQ.js +381 -0
- package/dist/components/alert/index.cjs +1 -1
- package/dist/components/alert/index.js +1 -1
- package/dist/components/avatar/index.cjs +17 -0
- package/dist/components/avatar/index.d.cts +131 -0
- package/dist/components/avatar/index.d.ts +131 -0
- package/dist/components/avatar/index.js +17 -0
- package/dist/components/button/index.cjs +3 -3
- package/dist/components/button/index.js +2 -2
- package/dist/components/chip/index.cjs +3 -3
- package/dist/components/chip/index.js +2 -2
- package/dist/index.cjs +32 -24
- package/dist/index.d.cts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +39 -31
- package/dist/system/index.cjs +4 -4
- package/dist/system/index.js +5 -5
- package/package.json +11 -1
- package/dist/{chunk-Y2B4XM3Y.js → chunk-2IWL6R3D.js} +3 -3
- package/dist/{chunk-4MPSXDAB.cjs → chunk-DBXFFJTC.cjs} +3 -3
- package/dist/{chunk-4YJLNYUS.js → chunk-M2BGCN77.js} +3 -3
- package/dist/{chunk-ETSYP3NH.cjs → chunk-QY4MN7X3.cjs} +3 -3
|
@@ -0,0 +1,381 @@
|
|
|
1
|
+
import { IconContext } from "./chunk-WJPQARJ5.js";
|
|
2
|
+
import { Slot, childrenToString, createSlotContext } from "./chunk-YXPYOOHU.js";
|
|
3
|
+
import { createRecipe, radiusAxis } from "./chunk-4GTAZM2C.js";
|
|
4
|
+
import { useStyleProps } from "./chunk-MEYCZS32.js";
|
|
5
|
+
import { useXAUITheme } from "./chunk-A3EGFI6T.js";
|
|
6
|
+
|
|
7
|
+
// src/components/avatar/avatar-fallback.tsx
|
|
8
|
+
import { forwardRef as forwardRef2 } from "react";
|
|
9
|
+
import { View } from "react-native";
|
|
10
|
+
|
|
11
|
+
// src/components/avatar/avatar-initials.tsx
|
|
12
|
+
import { forwardRef } from "react";
|
|
13
|
+
import { Text } from "react-native";
|
|
14
|
+
|
|
15
|
+
// src/components/avatar/avatar.context.ts
|
|
16
|
+
var [AvatarProvider, useAvatar] = createSlotContext("Avatar");
|
|
17
|
+
|
|
18
|
+
// src/components/avatar/avatar-initials.tsx
|
|
19
|
+
import { jsx } from "react/jsx-runtime";
|
|
20
|
+
var AvatarInitials = forwardRef(function AvatarInitials2({
|
|
21
|
+
children,
|
|
22
|
+
style,
|
|
23
|
+
...props
|
|
24
|
+
}, ref) {
|
|
25
|
+
const {
|
|
26
|
+
initialsStyle
|
|
27
|
+
} = useAvatar();
|
|
28
|
+
const [styleProps, rest] = useStyleProps(props);
|
|
29
|
+
return /* @__PURE__ */jsx(Text, {
|
|
30
|
+
ref,
|
|
31
|
+
accessibilityElementsHidden: true,
|
|
32
|
+
importantForAccessibility: "no",
|
|
33
|
+
numberOfLines: 1,
|
|
34
|
+
...rest,
|
|
35
|
+
style: [initialsStyle, styleProps, style],
|
|
36
|
+
children
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
AvatarInitials.displayName = "XAUI.Avatar.Initials";
|
|
40
|
+
|
|
41
|
+
// src/components/avatar/avatar-fallback.tsx
|
|
42
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
43
|
+
var AvatarFallback = forwardRef2(function AvatarFallback2({
|
|
44
|
+
children,
|
|
45
|
+
style,
|
|
46
|
+
...props
|
|
47
|
+
}, ref) {
|
|
48
|
+
const {
|
|
49
|
+
fallbackStyle,
|
|
50
|
+
icon
|
|
51
|
+
} = useAvatar();
|
|
52
|
+
const [styleProps, rest] = useStyleProps(props);
|
|
53
|
+
const text = childrenToString(children);
|
|
54
|
+
const content = text !== null ? /* @__PURE__ */jsx2(AvatarInitials, {
|
|
55
|
+
children: text
|
|
56
|
+
}) : children;
|
|
57
|
+
return /* @__PURE__ */jsx2(View, {
|
|
58
|
+
ref,
|
|
59
|
+
style: [fallbackStyle, styleProps, style],
|
|
60
|
+
...rest,
|
|
61
|
+
children: /* @__PURE__ */jsx2(IconContext.Provider, {
|
|
62
|
+
value: icon,
|
|
63
|
+
children: content
|
|
64
|
+
})
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
AvatarFallback.displayName = "XAUI.Avatar.Fallback";
|
|
68
|
+
|
|
69
|
+
// src/components/avatar/avatar-image.tsx
|
|
70
|
+
import { forwardRef as forwardRef3, useCallback } from "react";
|
|
71
|
+
import { Image } from "react-native";
|
|
72
|
+
import Animated, { useAnimatedStyle, useSharedValue, withTiming } from "react-native-reanimated";
|
|
73
|
+
|
|
74
|
+
// src/components/avatar/avatar.style.ts
|
|
75
|
+
import { StyleSheet } from "react-native";
|
|
76
|
+
var avatarSheet = StyleSheet.create({
|
|
77
|
+
image: {
|
|
78
|
+
position: "absolute",
|
|
79
|
+
top: 0,
|
|
80
|
+
bottom: 0,
|
|
81
|
+
start: 0,
|
|
82
|
+
end: 0
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
// src/components/avatar/avatar-image.tsx
|
|
87
|
+
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
88
|
+
var FADE_DURATION = 200;
|
|
89
|
+
var AvatarImage = forwardRef3(function AvatarImage2({
|
|
90
|
+
animation = true,
|
|
91
|
+
style,
|
|
92
|
+
...props
|
|
93
|
+
}, ref) {
|
|
94
|
+
const [styleProps, rest] = useStyleProps(props);
|
|
95
|
+
const frameStyle = [avatarSheet.image, styleProps, style];
|
|
96
|
+
if (!animation) return /* @__PURE__ */jsx3(Image, {
|
|
97
|
+
ref,
|
|
98
|
+
...rest,
|
|
99
|
+
style: frameStyle
|
|
100
|
+
});
|
|
101
|
+
return /* @__PURE__ */jsx3(FadingImage, {
|
|
102
|
+
ref,
|
|
103
|
+
...rest,
|
|
104
|
+
style: frameStyle
|
|
105
|
+
});
|
|
106
|
+
});
|
|
107
|
+
AvatarImage.displayName = "XAUI.Avatar.Image";
|
|
108
|
+
const _worklet_9106607863565_init_data = {
|
|
109
|
+
code: "function chunkZA6RT3XQJs1(){const{opacity}=this.__closure;return{opacity:opacity.value};}",
|
|
110
|
+
location: "/home/runner/work/xaui/xaui/packages/native/dist/chunk-ZA6RT3XQ.js",
|
|
111
|
+
sourceMap: "{\"version\":3,\"names\":[\"chunkZA6RT3XQJs1\",\"opacity\",\"__closure\",\"value\"],\"sources\":[\"/home/runner/work/xaui/xaui/packages/native/dist/chunk-ZA6RT3XQ.js\"],\"mappings\":\"AAoG2C,SAAAA,gBAAMA,CAAA,QAAAC,OAAA,OAAAC,SAAA,CAE3C,MAAO,CAAED,OAAO,CAAEA,OAAO,CAACE,KAAM,CAAC,CACnC\",\"ignoreList\":[]}"
|
|
112
|
+
};
|
|
113
|
+
var FadingImage = forwardRef3(function FadingImage2({
|
|
114
|
+
onLoad,
|
|
115
|
+
style,
|
|
116
|
+
...props
|
|
117
|
+
}, ref) {
|
|
118
|
+
const opacity = useSharedValue(0);
|
|
119
|
+
const handleLoad = useCallback(event => {
|
|
120
|
+
opacity.value = withTiming(1, {
|
|
121
|
+
duration: FADE_DURATION
|
|
122
|
+
});
|
|
123
|
+
onLoad?.(event);
|
|
124
|
+
}, [opacity, onLoad]);
|
|
125
|
+
const animatedStyle = useAnimatedStyle(function chunkZA6RT3XQJs1Factory({
|
|
126
|
+
_worklet_9106607863565_init_data,
|
|
127
|
+
opacity
|
|
128
|
+
}) {
|
|
129
|
+
const _e = [new global.Error(), -2, -27];
|
|
130
|
+
const chunkZA6RT3XQJs1 = function () {
|
|
131
|
+
return {
|
|
132
|
+
opacity: opacity.value
|
|
133
|
+
};
|
|
134
|
+
};
|
|
135
|
+
chunkZA6RT3XQJs1.__closure = {
|
|
136
|
+
opacity
|
|
137
|
+
};
|
|
138
|
+
chunkZA6RT3XQJs1.__workletHash = 9106607863565;
|
|
139
|
+
chunkZA6RT3XQJs1.__pluginVersion = "0.7.4";
|
|
140
|
+
chunkZA6RT3XQJs1.__initData = _worklet_9106607863565_init_data;
|
|
141
|
+
chunkZA6RT3XQJs1.__stackDetails = _e;
|
|
142
|
+
return chunkZA6RT3XQJs1;
|
|
143
|
+
}({
|
|
144
|
+
_worklet_9106607863565_init_data,
|
|
145
|
+
opacity
|
|
146
|
+
}), [opacity]);
|
|
147
|
+
return /* @__PURE__ */jsx3(Animated.Image, {
|
|
148
|
+
ref,
|
|
149
|
+
...props,
|
|
150
|
+
onLoad: handleLoad,
|
|
151
|
+
style: [style, animatedStyle]
|
|
152
|
+
});
|
|
153
|
+
});
|
|
154
|
+
|
|
155
|
+
// src/components/avatar/avatar.tsx
|
|
156
|
+
import { forwardRef as forwardRef4, useMemo } from "react";
|
|
157
|
+
import { StyleSheet as StyleSheet2, View as View2 } from "react-native";
|
|
158
|
+
|
|
159
|
+
// src/components/avatar/avatar.recipe.ts
|
|
160
|
+
var SLOTS = ["root", "fallback", "initials", "icon"];
|
|
161
|
+
var VARIANT_TOKENS = {
|
|
162
|
+
primary: {
|
|
163
|
+
bg: "accent",
|
|
164
|
+
fg: "accentForeground"
|
|
165
|
+
},
|
|
166
|
+
secondary: {
|
|
167
|
+
bg: "accentSoft",
|
|
168
|
+
fg: "accentSoftForeground"
|
|
169
|
+
},
|
|
170
|
+
default: {
|
|
171
|
+
bg: "default",
|
|
172
|
+
fg: "defaultForeground"
|
|
173
|
+
},
|
|
174
|
+
tertiary: {
|
|
175
|
+
border: "border",
|
|
176
|
+
fg: "foreground"
|
|
177
|
+
},
|
|
178
|
+
ghost: {
|
|
179
|
+
fg: "foreground"
|
|
180
|
+
},
|
|
181
|
+
success: {
|
|
182
|
+
bg: "success",
|
|
183
|
+
fg: "successForeground"
|
|
184
|
+
},
|
|
185
|
+
"success-soft": {
|
|
186
|
+
bg: "successSoft",
|
|
187
|
+
fg: "successSoftForeground"
|
|
188
|
+
},
|
|
189
|
+
warning: {
|
|
190
|
+
bg: "warning",
|
|
191
|
+
fg: "warningForeground"
|
|
192
|
+
},
|
|
193
|
+
"warning-soft": {
|
|
194
|
+
bg: "warningSoft",
|
|
195
|
+
fg: "warningSoftForeground"
|
|
196
|
+
},
|
|
197
|
+
danger: {
|
|
198
|
+
bg: "danger",
|
|
199
|
+
fg: "dangerForeground"
|
|
200
|
+
},
|
|
201
|
+
"danger-soft": {
|
|
202
|
+
bg: "dangerSoft",
|
|
203
|
+
fg: "dangerSoftForeground"
|
|
204
|
+
}
|
|
205
|
+
};
|
|
206
|
+
function sizeAxis(step) {
|
|
207
|
+
return theme => {
|
|
208
|
+
const diameter = theme.spacing(step.diameter);
|
|
209
|
+
return {
|
|
210
|
+
root: {
|
|
211
|
+
width: diameter,
|
|
212
|
+
height: diameter
|
|
213
|
+
},
|
|
214
|
+
initials: {
|
|
215
|
+
fontSize: theme.fontSizes[step.initials],
|
|
216
|
+
lineHeight: theme.lineHeights[step.initials]
|
|
217
|
+
},
|
|
218
|
+
icon: {
|
|
219
|
+
fontSize: theme.fontSizes[step.glyph]
|
|
220
|
+
}
|
|
221
|
+
};
|
|
222
|
+
};
|
|
223
|
+
}
|
|
224
|
+
var SIZES = {
|
|
225
|
+
xs: {
|
|
226
|
+
diameter: 8,
|
|
227
|
+
initials: "xs",
|
|
228
|
+
glyph: "xs"
|
|
229
|
+
},
|
|
230
|
+
sm: {
|
|
231
|
+
diameter: 10,
|
|
232
|
+
initials: "xs",
|
|
233
|
+
glyph: "sm"
|
|
234
|
+
},
|
|
235
|
+
md: {
|
|
236
|
+
diameter: 12,
|
|
237
|
+
initials: "sm",
|
|
238
|
+
glyph: "md"
|
|
239
|
+
},
|
|
240
|
+
lg: {
|
|
241
|
+
diameter: 16,
|
|
242
|
+
initials: "md",
|
|
243
|
+
glyph: "xl"
|
|
244
|
+
}
|
|
245
|
+
};
|
|
246
|
+
var avatarRecipe = createRecipe({
|
|
247
|
+
slots: SLOTS,
|
|
248
|
+
base: theme => ({
|
|
249
|
+
root: {
|
|
250
|
+
alignItems: "center",
|
|
251
|
+
justifyContent: "center",
|
|
252
|
+
// The clip is what makes a square photo round, so unlike on the `Chip` it is not
|
|
253
|
+
// optional here: without it the image is a rectangle sitting over a circle.
|
|
254
|
+
overflow: "hidden",
|
|
255
|
+
// Squircle corners for when `radius` overrides the circle. Free on Android.
|
|
256
|
+
borderCurve: "continuous",
|
|
257
|
+
borderWidth: 0
|
|
258
|
+
},
|
|
259
|
+
fallback: {
|
|
260
|
+
width: "100%",
|
|
261
|
+
height: "100%",
|
|
262
|
+
alignItems: "center",
|
|
263
|
+
justifyContent: "center"
|
|
264
|
+
},
|
|
265
|
+
initials: {
|
|
266
|
+
fontFamily: theme.fontFamilies.body,
|
|
267
|
+
fontWeight: theme.fontWeights.medium,
|
|
268
|
+
// Two letters in a circle sit off-centre by the descender otherwise.
|
|
269
|
+
textAlign: "center"
|
|
270
|
+
}
|
|
271
|
+
}),
|
|
272
|
+
variantTokens: VARIANT_TOKENS,
|
|
273
|
+
/**
|
|
274
|
+
* Where the variant's colours land, for every variant at once. The border width follows
|
|
275
|
+
* the *presence* of the border role, so `ghost` needs no rule of its own to say it has
|
|
276
|
+
* no edge.
|
|
277
|
+
*
|
|
278
|
+
* The image takes no colour: it is a photograph, and tinting one is what `Icon`'s
|
|
279
|
+
* `source` form is for.
|
|
280
|
+
*/
|
|
281
|
+
paint: (theme, colors) => ({
|
|
282
|
+
root: {
|
|
283
|
+
backgroundColor: colors.bg,
|
|
284
|
+
borderColor: colors.border,
|
|
285
|
+
borderWidth: colors.border ? theme.borderWidth.default : 0
|
|
286
|
+
},
|
|
287
|
+
initials: {
|
|
288
|
+
color: colors.fg
|
|
289
|
+
},
|
|
290
|
+
icon: {
|
|
291
|
+
color: colors.fg
|
|
292
|
+
}
|
|
293
|
+
}),
|
|
294
|
+
/** Declaration order is application order: `radius` overrides the circle `base` set. */
|
|
295
|
+
variants: {
|
|
296
|
+
size: {
|
|
297
|
+
xs: sizeAxis(SIZES.xs),
|
|
298
|
+
sm: sizeAxis(SIZES.sm),
|
|
299
|
+
md: sizeAxis(SIZES.md),
|
|
300
|
+
lg: sizeAxis(SIZES.lg)
|
|
301
|
+
},
|
|
302
|
+
radius: radiusAxis("root")
|
|
303
|
+
},
|
|
304
|
+
/**
|
|
305
|
+
* A circle at every size, where HeroUI fixes one large radius for all three — which
|
|
306
|
+
* makes their small avatars round and their large ones squircles. `full` says the shape
|
|
307
|
+
* the name means once, and `radius` is still there for the logo that wants a square.
|
|
308
|
+
*/
|
|
309
|
+
defaultVariants: {
|
|
310
|
+
variant: "default",
|
|
311
|
+
size: "md",
|
|
312
|
+
radius: "full"
|
|
313
|
+
}
|
|
314
|
+
});
|
|
315
|
+
|
|
316
|
+
// src/components/avatar/avatar.tsx
|
|
317
|
+
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
318
|
+
var AvatarRoot = forwardRef4(function Avatar({
|
|
319
|
+
children,
|
|
320
|
+
variant,
|
|
321
|
+
size,
|
|
322
|
+
radius,
|
|
323
|
+
color,
|
|
324
|
+
asChild = false,
|
|
325
|
+
style,
|
|
326
|
+
...props
|
|
327
|
+
}, ref) {
|
|
328
|
+
const theme = useXAUITheme();
|
|
329
|
+
const [styleProps, rest] = useStyleProps(props);
|
|
330
|
+
const selection = {
|
|
331
|
+
variant,
|
|
332
|
+
size,
|
|
333
|
+
radius
|
|
334
|
+
};
|
|
335
|
+
const styles = avatarRecipe.resolve({
|
|
336
|
+
theme,
|
|
337
|
+
selection
|
|
338
|
+
});
|
|
339
|
+
const tint = color ? avatarRecipe.tint({
|
|
340
|
+
theme,
|
|
341
|
+
color,
|
|
342
|
+
selection
|
|
343
|
+
}) : void 0;
|
|
344
|
+
const context = useMemo(() => {
|
|
345
|
+
const icon = StyleSheet2.flatten([styles.icon, tint?.icon]);
|
|
346
|
+
return {
|
|
347
|
+
fallbackStyle: styles.fallback,
|
|
348
|
+
initialsStyle: tint ? [styles.initials, tint.initials] : styles.initials,
|
|
349
|
+
icon: {
|
|
350
|
+
size: icon.fontSize,
|
|
351
|
+
// `ColorValue` also covers the platform's opaque colours, which `Icon` cannot
|
|
352
|
+
// hand to a third-party component expecting a string.
|
|
353
|
+
color: typeof icon.color === "string" ? icon.color : void 0
|
|
354
|
+
}
|
|
355
|
+
};
|
|
356
|
+
}, [styles, tint]);
|
|
357
|
+
const rootStyle = [styles.root, tint?.root, styleProps, style];
|
|
358
|
+
const text = childrenToString(children);
|
|
359
|
+
const content = text !== null ? /* @__PURE__ */jsx4(AvatarFallback, {
|
|
360
|
+
children: text
|
|
361
|
+
}) : children;
|
|
362
|
+
const Root = asChild ? Slot : View2;
|
|
363
|
+
return /* @__PURE__ */jsx4(AvatarProvider, {
|
|
364
|
+
value: context,
|
|
365
|
+
children: /* @__PURE__ */jsx4(Root, {
|
|
366
|
+
ref,
|
|
367
|
+
...rest,
|
|
368
|
+
style: rootStyle,
|
|
369
|
+
children: asChild ? children : content
|
|
370
|
+
})
|
|
371
|
+
});
|
|
372
|
+
});
|
|
373
|
+
AvatarRoot.displayName = "XAUI.Avatar.Root";
|
|
374
|
+
|
|
375
|
+
// src/components/avatar/index.ts
|
|
376
|
+
var Avatar2 = Object.assign(AvatarRoot, {
|
|
377
|
+
Image: AvatarImage,
|
|
378
|
+
Fallback: AvatarFallback,
|
|
379
|
+
Initials: AvatarInitials
|
|
380
|
+
});
|
|
381
|
+
export { useAvatar, avatarRecipe, Avatar2 as Avatar };
|
|
@@ -4,10 +4,10 @@
|
|
|
4
4
|
|
|
5
5
|
var _chunkK7LLERKTcjs = require('../../chunk-K7LLERKT.cjs');
|
|
6
6
|
require('../../chunk-CYS6U374.cjs');
|
|
7
|
+
require('../../chunk-PCWT2YBE.cjs');
|
|
7
8
|
require('../../chunk-6M7RUU7V.cjs');
|
|
8
9
|
require('../../chunk-7DPL3ZDS.cjs');
|
|
9
10
|
require('../../chunk-EJQCQPET.cjs');
|
|
10
|
-
require('../../chunk-PCWT2YBE.cjs');
|
|
11
11
|
require('../../chunk-54FJOKAN.cjs');
|
|
12
12
|
require('../../chunk-H4E4HDEP.cjs');
|
|
13
13
|
require('../../chunk-FNEUOBCV.cjs');
|
|
@@ -4,10 +4,10 @@ import {
|
|
|
4
4
|
useAlert
|
|
5
5
|
} from "../../chunk-AYOVBZAX.js";
|
|
6
6
|
import "../../chunk-U3RDU3HU.js";
|
|
7
|
+
import "../../chunk-WJPQARJ5.js";
|
|
7
8
|
import "../../chunk-XNNJM5DQ.js";
|
|
8
9
|
import "../../chunk-423RQBOX.js";
|
|
9
10
|
import "../../chunk-EGLLDKN6.js";
|
|
10
|
-
import "../../chunk-WJPQARJ5.js";
|
|
11
11
|
import "../../chunk-YXPYOOHU.js";
|
|
12
12
|
import "../../chunk-36PRYGAM.js";
|
|
13
13
|
import "../../chunk-4GTAZM2C.js";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
var _chunkI66VMLHEcjs = require('../../chunk-I66VMLHE.cjs');
|
|
6
|
+
require('../../chunk-PCWT2YBE.cjs');
|
|
7
|
+
require('../../chunk-54FJOKAN.cjs');
|
|
8
|
+
require('../../chunk-H4E4HDEP.cjs');
|
|
9
|
+
require('../../chunk-FNEUOBCV.cjs');
|
|
10
|
+
require('../../chunk-I6ZB3FZI.cjs');
|
|
11
|
+
require('../../chunk-57SJ4LJF.cjs');
|
|
12
|
+
require('../../chunk-MC7SY2QH.cjs');
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
exports.Avatar = _chunkI66VMLHEcjs.Avatar; exports.avatarRecipe = _chunkI66VMLHEcjs.avatarRecipe; exports.useAvatar = _chunkI66VMLHEcjs.useAvatar;
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
import * as react_native from 'react-native';
|
|
4
|
+
import { StyleProp, ViewStyle, TextStyle, ViewProps, ImageProps, ImageStyle, TextProps } from 'react-native';
|
|
5
|
+
import { V as ViewStyleProps, I as ImageStyleProps, T as TextStyleProps } from '../../style-props.type-CfnoGEP7.cjs';
|
|
6
|
+
import { S as Size, R as RadiusKey, X as XAUITheme } from '../../theme.type-C2gNHpEx.cjs';
|
|
7
|
+
import { I as IconContextValue } from '../../icon.type-d_i9ma-i.cjs';
|
|
8
|
+
import { R as Recipe, S as SlotStyles, a as StyleFn } from '../../create-recipe-dC7wMfnj.cjs';
|
|
9
|
+
|
|
10
|
+
type AvatarSlot = 'root' | 'fallback' | 'initials' | 'icon';
|
|
11
|
+
/**
|
|
12
|
+
* The full vocabulary (§1 bis), and the `Chip`'s eleven names exactly — an avatar is a
|
|
13
|
+
* token *about* a person or a thing, which is the category the `Chip` established, so a
|
|
14
|
+
* name means here what it means there.
|
|
15
|
+
*
|
|
16
|
+
* They colour the **frame**, which is all that shows when there is no image: `primary` is
|
|
17
|
+
* the accent fill with its contrasted initials, `secondary` the soft slice, `tertiary` a
|
|
18
|
+
* border and nothing else. The three status families are here because an avatar reports as
|
|
19
|
+
* often as it identifies — a red frame for the account that failed to sync, a green one for
|
|
20
|
+
* the person who is online.
|
|
21
|
+
*
|
|
22
|
+
* It is HeroUI's `variant × color` matrix said once: their `default` is this `default`, and
|
|
23
|
+
* their `soft` crossed with five colours is `secondary` plus the five `-soft` names.
|
|
24
|
+
*/
|
|
25
|
+
type AvatarVariant = 'primary' | 'secondary' | 'default' | 'tertiary' | 'ghost' | 'success' | 'success-soft' | 'warning' | 'warning-soft' | 'danger' | 'danger-soft';
|
|
26
|
+
type AvatarSize = Size;
|
|
27
|
+
/**
|
|
28
|
+
* What the `Avatar` itself understands. R14 — a name in here is the component's, so the
|
|
29
|
+
* style prop that shares it is not exposed: `size` is the avatar's diameter and never
|
|
30
|
+
* `ViewStyle`'s, and `color` is R7's tint.
|
|
31
|
+
*/
|
|
32
|
+
type AvatarOwnProps = {
|
|
33
|
+
variant?: AvatarVariant;
|
|
34
|
+
/** The diameter, and the type inside it. It sets both sides, never a width alone. */
|
|
35
|
+
size?: AvatarSize;
|
|
36
|
+
/**
|
|
37
|
+
* Overrides the circle. An avatar is round at every size — that is the shape the name
|
|
38
|
+
* means — so this is the prop for the logo or the cover that wants a square.
|
|
39
|
+
*/
|
|
40
|
+
radius?: RadiusKey;
|
|
41
|
+
/**
|
|
42
|
+
* A raw tint (`'#7c3aed'`), never a token (R7). Where it lands follows the variant: the
|
|
43
|
+
* fill of a `primary`, the border of a `tertiary`, the initials of a `ghost`. Its
|
|
44
|
+
* contrasted and soft slices are derived in OKLab, so it behaves exactly like `accent` —
|
|
45
|
+
* which is also why it must be a hex value.
|
|
46
|
+
*/
|
|
47
|
+
color?: string;
|
|
48
|
+
/** R12 — the child element becomes the frame and keeps this variant's style. */
|
|
49
|
+
asChild?: boolean;
|
|
50
|
+
style?: StyleProp<ViewStyle>;
|
|
51
|
+
children?: ReactNode;
|
|
52
|
+
};
|
|
53
|
+
type AvatarProps = Omit<ViewProps, 'style'> & AvatarOwnProps & Omit<ViewStyleProps, keyof AvatarOwnProps | keyof ViewProps>;
|
|
54
|
+
type AvatarImageOwnProps = {
|
|
55
|
+
/**
|
|
56
|
+
* `false` shows the image the moment it decodes, with no fade. The frame does not change
|
|
57
|
+
* either way, so a list switched off with this does not reflow.
|
|
58
|
+
*/
|
|
59
|
+
animation?: boolean;
|
|
60
|
+
style?: StyleProp<ImageStyle>;
|
|
61
|
+
};
|
|
62
|
+
/**
|
|
63
|
+
* `Image`'s own props win over the `ImageStyle` keys of the same name (R14). `source`
|
|
64
|
+
* stays required, as `Image` declares it: an `Avatar.Image` with nothing to show is an
|
|
65
|
+
* `Avatar.Fallback`.
|
|
66
|
+
*/
|
|
67
|
+
type AvatarImageProps = Omit<ImageProps, 'style'> & AvatarImageOwnProps & Omit<ImageStyleProps, keyof AvatarImageOwnProps | keyof ImageProps>;
|
|
68
|
+
type AvatarFallbackOwnProps = {
|
|
69
|
+
/**
|
|
70
|
+
* Initials, an `Icon`, anything. A stringifiable tree becomes `Avatar.Initials` (R3); an
|
|
71
|
+
* element is centred and left alone — and an `Icon` among them needs no props, because
|
|
72
|
+
* the fallback publishes the frame's size and colour to it.
|
|
73
|
+
*/
|
|
74
|
+
children?: ReactNode;
|
|
75
|
+
style?: StyleProp<ViewStyle>;
|
|
76
|
+
};
|
|
77
|
+
type AvatarFallbackProps = Omit<ViewProps, 'style'> & AvatarFallbackOwnProps & Omit<ViewStyleProps, keyof AvatarFallbackOwnProps | keyof ViewProps>;
|
|
78
|
+
/** `Text`'s own props win over the `TextStyle` keys of the same name (R14). */
|
|
79
|
+
type AvatarInitialsProps = TextProps & Omit<TextStyleProps, keyof TextProps> & {
|
|
80
|
+
children?: ReactNode;
|
|
81
|
+
};
|
|
82
|
+
/**
|
|
83
|
+
* R5 — resolved styles, not props for a slot to resolve a second time. Each entry is the
|
|
84
|
+
* cached `StyleSheet` reference with the uncached tint pass layered over it, so a slot
|
|
85
|
+
* merges its own `style` on top and does no work of its own.
|
|
86
|
+
*/
|
|
87
|
+
type AvatarContextValue = {
|
|
88
|
+
fallbackStyle: StyleProp<ViewStyle>;
|
|
89
|
+
initialsStyle: StyleProp<TextStyle>;
|
|
90
|
+
/**
|
|
91
|
+
* Values, not a style: `Icon` hands `size` and `color` to a third-party component, so
|
|
92
|
+
* the root flattens its icon slot once here rather than in every icon it contains.
|
|
93
|
+
*/
|
|
94
|
+
icon: IconContextValue;
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
declare const useAvatar: () => AvatarContextValue;
|
|
98
|
+
|
|
99
|
+
declare const avatarRecipe: Recipe<"root" | "icon" | "fallback" | "initials", AvatarVariant, {
|
|
100
|
+
readonly size: {
|
|
101
|
+
readonly xs: (theme: XAUITheme) => SlotStyles<AvatarSlot>;
|
|
102
|
+
readonly sm: (theme: XAUITheme) => SlotStyles<AvatarSlot>;
|
|
103
|
+
readonly md: (theme: XAUITheme) => SlotStyles<AvatarSlot>;
|
|
104
|
+
readonly lg: (theme: XAUITheme) => SlotStyles<AvatarSlot>;
|
|
105
|
+
};
|
|
106
|
+
readonly radius: Record<RadiusKey, StyleFn<AvatarSlot>>;
|
|
107
|
+
}>;
|
|
108
|
+
|
|
109
|
+
declare const Avatar: react.ForwardRefExoticComponent<Omit<react_native.ViewProps, "style"> & {
|
|
110
|
+
variant?: AvatarVariant;
|
|
111
|
+
size?: AvatarSize;
|
|
112
|
+
radius?: RadiusKey;
|
|
113
|
+
color?: string;
|
|
114
|
+
asChild?: boolean;
|
|
115
|
+
style?: react_native.StyleProp<react_native.ViewStyle>;
|
|
116
|
+
children?: react.ReactNode;
|
|
117
|
+
} & Omit<ViewStyleProps, "color" | "pointerEvents" | "style" | "children" | "hitSlop" | "id" | "needsOffscreenAlphaCompositing" | "onLayout" | "removeClippedSubviews" | "testID" | "nativeID" | "collapsable" | "collapsableChildren" | "onBlur" | "onFocus" | "renderToHardwareTextureAndroid" | "focusable" | "tabIndex" | "shouldRasterizeIOS" | "isTVSelectable" | "hasTVPreferredFocus" | "tvParallaxShiftDistanceX" | "tvParallaxShiftDistanceY" | "tvParallaxTiltAngle" | "tvParallaxMagnification" | "onStartShouldSetResponder" | "onMoveShouldSetResponder" | "onResponderEnd" | "onResponderGrant" | "onResponderReject" | "onResponderMove" | "onResponderRelease" | "onResponderStart" | "onResponderTerminationRequest" | "onResponderTerminate" | "onStartShouldSetResponderCapture" | "onMoveShouldSetResponderCapture" | "onTouchStart" | "onTouchMove" | "onTouchEnd" | "onTouchCancel" | "onTouchEndCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerUp" | "onPointerUpCapture" | "accessible" | "accessibilityActions" | "accessibilityLabel" | "aria-label" | "accessibilityRole" | "accessibilityState" | "aria-busy" | "aria-checked" | "aria-disabled" | "aria-expanded" | "aria-selected" | "accessibilityHint" | "accessibilityValue" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "onAccessibilityAction" | "importantForAccessibility" | "aria-hidden" | "aria-modal" | "role" | "accessibilityLabelledBy" | "aria-labelledby" | "accessibilityLiveRegion" | "aria-live" | "screenReaderFocusable" | "accessibilityElementsHidden" | "accessibilityViewIsModal" | "onAccessibilityEscape" | "onAccessibilityTap" | "onMagicTap" | "accessibilityIgnoresInvertColors" | "accessibilityLanguage" | "accessibilityShowsLargeContentViewer" | "accessibilityLargeContentTitle" | "accessibilityRespondsToUserInteraction" | "asChild" | "radius" | "size" | "variant"> & react.RefAttributes<react_native.View>> & {
|
|
118
|
+
Image: react.ForwardRefExoticComponent<Omit<react_native.ImageProps, "style"> & {
|
|
119
|
+
animation?: boolean;
|
|
120
|
+
style?: react_native.StyleProp<react_native.ImageStyle>;
|
|
121
|
+
} & Omit<ImageStyleProps, "height" | "width" | "borderRadius" | "resizeMode" | "tintColor" | "borderTopLeftRadius" | "borderTopRightRadius" | "borderBottomLeftRadius" | "borderBottomRightRadius" | "style" | "id" | "onLayout" | "testID" | "nativeID" | "accessible" | "accessibilityActions" | "accessibilityLabel" | "aria-label" | "accessibilityRole" | "accessibilityState" | "aria-busy" | "aria-checked" | "aria-disabled" | "aria-expanded" | "aria-selected" | "accessibilityHint" | "accessibilityValue" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "onAccessibilityAction" | "importantForAccessibility" | "aria-hidden" | "aria-modal" | "role" | "accessibilityLabelledBy" | "aria-labelledby" | "accessibilityLiveRegion" | "aria-live" | "screenReaderFocusable" | "accessibilityElementsHidden" | "accessibilityViewIsModal" | "onAccessibilityEscape" | "onAccessibilityTap" | "onMagicTap" | "accessibilityIgnoresInvertColors" | "accessibilityLanguage" | "accessibilityShowsLargeContentViewer" | "accessibilityLargeContentTitle" | "accessibilityRespondsToUserInteraction" | "source" | "animation" | "onError" | "onLoad" | "onLoadEnd" | "onLoadStart" | "progressiveRenderingEnabled" | "src" | "srcSet" | "loadingIndicatorSource" | "defaultSource" | "alt" | "crossOrigin" | "referrerPolicy" | "blurRadius" | "capInsets" | "onProgress" | "onPartialLoad" | "resizeMethod" | "fadeDuration"> & react.RefAttributes<react_native.Image>>;
|
|
122
|
+
Fallback: react.ForwardRefExoticComponent<Omit<react_native.ViewProps, "style"> & {
|
|
123
|
+
children?: react.ReactNode;
|
|
124
|
+
style?: react_native.StyleProp<react_native.ViewStyle>;
|
|
125
|
+
} & Omit<ViewStyleProps, "pointerEvents" | "style" | "children" | "hitSlop" | "id" | "needsOffscreenAlphaCompositing" | "onLayout" | "removeClippedSubviews" | "testID" | "nativeID" | "collapsable" | "collapsableChildren" | "onBlur" | "onFocus" | "renderToHardwareTextureAndroid" | "focusable" | "tabIndex" | "shouldRasterizeIOS" | "isTVSelectable" | "hasTVPreferredFocus" | "tvParallaxShiftDistanceX" | "tvParallaxShiftDistanceY" | "tvParallaxTiltAngle" | "tvParallaxMagnification" | "onStartShouldSetResponder" | "onMoveShouldSetResponder" | "onResponderEnd" | "onResponderGrant" | "onResponderReject" | "onResponderMove" | "onResponderRelease" | "onResponderStart" | "onResponderTerminationRequest" | "onResponderTerminate" | "onStartShouldSetResponderCapture" | "onMoveShouldSetResponderCapture" | "onTouchStart" | "onTouchMove" | "onTouchEnd" | "onTouchCancel" | "onTouchEndCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerUp" | "onPointerUpCapture" | "accessible" | "accessibilityActions" | "accessibilityLabel" | "aria-label" | "accessibilityRole" | "accessibilityState" | "aria-busy" | "aria-checked" | "aria-disabled" | "aria-expanded" | "aria-selected" | "accessibilityHint" | "accessibilityValue" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "onAccessibilityAction" | "importantForAccessibility" | "aria-hidden" | "aria-modal" | "role" | "accessibilityLabelledBy" | "aria-labelledby" | "accessibilityLiveRegion" | "aria-live" | "screenReaderFocusable" | "accessibilityElementsHidden" | "accessibilityViewIsModal" | "onAccessibilityEscape" | "onAccessibilityTap" | "onMagicTap" | "accessibilityIgnoresInvertColors" | "accessibilityLanguage" | "accessibilityShowsLargeContentViewer" | "accessibilityLargeContentTitle" | "accessibilityRespondsToUserInteraction"> & react.RefAttributes<react_native.View>>;
|
|
126
|
+
Initials: react.ForwardRefExoticComponent<react_native.TextProps & Omit<TextStyleProps, keyof react_native.TextProps> & {
|
|
127
|
+
children?: react.ReactNode;
|
|
128
|
+
} & react.RefAttributes<react_native.Text>>;
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
export { Avatar, type AvatarContextValue, type AvatarFallbackProps, type AvatarImageProps, type AvatarInitialsProps, type AvatarProps, type AvatarSize, type AvatarSlot, type AvatarVariant, avatarRecipe, useAvatar };
|