@xaui/native 0.9.1-alpha.4 → 0.9.1-alpha.41
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-2EGR4LWD.js +145 -0
- package/dist/chunk-2NRZKJG7.js +531 -0
- package/dist/chunk-2PMXMKS5.js +67 -0
- package/dist/chunk-2XPG2243.js +586 -0
- package/dist/chunk-36PRYGAM.js +13 -0
- package/dist/chunk-3E7CDKFO.cjs +696 -0
- package/dist/chunk-3GFRSZYR.js +54 -0
- package/dist/chunk-423RQBOX.js +21 -0
- package/dist/chunk-4CUZZWFW.js +92 -0
- package/dist/chunk-4GTAZM2C.js +174 -0
- package/dist/chunk-4KFKWBN5.cjs +89 -0
- package/dist/{chunk-3QBT3Q65.cjs → chunk-57SJ4LJF.cjs} +7 -2
- package/dist/chunk-5R26NM4M.cjs +402 -0
- package/dist/chunk-5VKYNBNA.js +607 -0
- package/dist/chunk-64MXEVT3.js +66 -0
- package/dist/chunk-6DOLGZVV.cjs +147 -0
- package/dist/chunk-6L2TS2R3.cjs +92 -0
- package/dist/chunk-6UEZJRVI.js +669 -0
- package/dist/chunk-734MFAX4.js +27 -0
- package/dist/chunk-73RKQC5X.js +104 -0
- package/dist/chunk-7DPL3ZDS.cjs +21 -0
- package/dist/chunk-7EIHHOHP.cjs +42 -0
- package/dist/chunk-7GHM4GKL.cjs +119 -0
- package/dist/chunk-7YF5NAHQ.cjs +74 -0
- package/dist/{chunk-X2K2FX3W.js → chunk-A3EGFI6T.js} +6 -1
- package/dist/chunk-ABAGZTXZ.cjs +736 -0
- package/dist/{chunk-AW63PTQ4.cjs → chunk-ACAPTWE3.cjs} +85 -81
- package/dist/chunk-AMCSSOJT.cjs +104 -0
- package/dist/chunk-BA2DBSAN.js +102 -0
- package/dist/chunk-BRRXFOBY.js +431 -0
- package/dist/chunk-C5YLPCFC.cjs +293 -0
- package/dist/chunk-DA3OKXHV.cjs +700 -0
- package/dist/chunk-DD4276RF.js +366 -0
- package/dist/chunk-DG2I4PJG.js +701 -0
- package/dist/chunk-DHGLGSH6.js +661 -0
- package/dist/chunk-DIBUQ46Y.js +346 -0
- package/dist/chunk-EGLLDKN6.js +9 -0
- package/dist/chunk-EJQCQPET.cjs +9 -0
- package/dist/chunk-EKS3W46M.cjs +66 -0
- package/dist/chunk-EZEYMLO3.js +402 -0
- package/dist/chunk-F6CQ6CBI.cjs +112 -0
- package/dist/chunk-F6W3JQ7K.js +42 -0
- package/dist/chunk-FHUYHV6J.js +89 -0
- package/dist/chunk-FNEUOBCV.cjs +174 -0
- package/dist/chunk-G3CCT4EY.js +518 -0
- package/dist/chunk-G7P3ERYF.cjs +478 -0
- package/dist/chunk-GA6PBWNT.js +147 -0
- package/dist/chunk-GFUZ3MUT.cjs +455 -0
- package/dist/chunk-GGW43Q37.cjs +1 -0
- package/dist/chunk-GTR5X65M.cjs +27 -0
- package/dist/chunk-H4E4HDEP.cjs +13 -0
- package/dist/chunk-H7DS4IO7.js +198 -0
- package/dist/chunk-HDVVZG4S.cjs +198 -0
- package/dist/chunk-IKJVLJKT.js +151 -0
- package/dist/chunk-J3MB4PI5.cjs +531 -0
- package/dist/chunk-K72UDPVN.js +119 -0
- package/dist/chunk-KCMYU7WF.js +86 -0
- package/dist/chunk-LRN3RNDO.js +940 -0
- package/dist/chunk-LTX6TB5I.js +124 -0
- package/dist/chunk-LUPCPLND.cjs +145 -0
- package/dist/chunk-M63GFNKV.js +194 -0
- package/dist/chunk-N3KTZMPG.js +293 -0
- package/dist/chunk-NCTOTTVW.js +13 -0
- package/dist/chunk-NWGLP6JX.cjs +410 -0
- package/dist/chunk-R73XQK7X.cjs +314 -0
- package/dist/chunk-RU7JCMWC.cjs +881 -0
- package/dist/chunk-SNIHUKDA.cjs +184 -0
- package/dist/chunk-T5FV5F7A.cjs +607 -0
- package/dist/chunk-TDTUAIFF.cjs +153 -0
- package/dist/chunk-TJ74XVZN.cjs +431 -0
- package/dist/chunk-TK44VBIE.cjs +194 -0
- package/dist/chunk-UAWBAD4E.cjs +346 -0
- package/dist/chunk-UFTCTTKK.js +381 -0
- package/dist/chunk-VLKBESEV.cjs +407 -0
- package/dist/chunk-WDDXU3OH.cjs +67 -0
- package/dist/chunk-WFEMJCXO.cjs +13 -0
- package/dist/chunk-WHJTBTYM.js +0 -0
- package/dist/{chunk-2KXQATVL.js → chunk-WKCQ6VGW.js} +59 -55
- package/dist/chunk-XFPQFCEK.js +455 -0
- package/dist/chunk-XSQPVDFH.cjs +60 -0
- package/dist/chunk-XTC2SLFT.js +153 -0
- package/dist/chunk-XV735BSA.cjs +366 -0
- package/dist/chunk-XWNG2U4K.cjs +124 -0
- package/dist/chunk-YGYYJ3LQ.js +314 -0
- package/dist/chunk-YVHT2UVW.js +74 -0
- package/dist/chunk-ZFOOJK37.cjs +86 -0
- package/dist/close-button.type-BUYuoSt2.d.ts +36 -0
- package/dist/close-button.type-CHsgZ3wO.d.cts +36 -0
- package/dist/components/accordion/index.cjs +35 -0
- package/dist/components/accordion/index.d.cts +299 -0
- package/dist/components/accordion/index.d.ts +299 -0
- package/dist/components/accordion/index.js +35 -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/avatar/index.cjs +16 -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 +16 -0
- package/dist/components/badge/index.cjs +15 -0
- package/dist/components/badge/index.d.cts +157 -0
- package/dist/components/badge/index.d.ts +157 -0
- package/dist/components/badge/index.js +15 -0
- package/dist/components/button/index.cjs +22 -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 +22 -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/divider/index.cjs +13 -0
- package/dist/components/divider/index.d.cts +117 -0
- package/dist/components/divider/index.d.ts +117 -0
- package/dist/components/divider/index.js +13 -0
- package/dist/components/field-group/index.cjs +27 -0
- package/dist/components/field-group/index.d.cts +270 -0
- package/dist/components/field-group/index.d.ts +270 -0
- package/dist/components/field-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/menu/index.cjs +49 -0
- package/dist/components/menu/index.d.cts +351 -0
- package/dist/components/menu/index.d.ts +351 -0
- package/dist/components/menu/index.js +49 -0
- package/dist/components/popover/index.cjs +38 -0
- package/dist/components/popover/index.d.cts +254 -0
- package/dist/components/popover/index.d.ts +254 -0
- package/dist/components/popover/index.js +38 -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/select/index.cjs +50 -0
- package/dist/components/select/index.d.cts +498 -0
- package/dist/components/select/index.d.ts +498 -0
- package/dist/components/select/index.js +50 -0
- package/dist/components/skeleton/index.cjs +11 -0
- package/dist/components/skeleton/index.d.cts +111 -0
- package/dist/components/skeleton/index.d.ts +111 -0
- package/dist/components/skeleton/index.js +11 -0
- package/dist/components/spinner/index.cjs +17 -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 +17 -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/tabs/index.cjs +33 -0
- package/dist/components/tabs/index.d.cts +261 -0
- package/dist/components/tabs/index.d.ts +261 -0
- package/dist/components/tabs/index.js +33 -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/text-field/index.cjs +25 -0
- package/dist/components/text-field/index.d.cts +205 -0
- package/dist/components/text-field/index.d.ts +205 -0
- package/dist/components/text-field/index.js +25 -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 +423 -5
- package/dist/index.d.cts +119 -4
- package/dist/index.d.ts +119 -4
- package/dist/index.js +445 -27
- package/dist/placement-DHa0Rrh1.d.cts +38 -0
- package/dist/placement-DHa0Rrh1.d.ts +38 -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 +73 -4
- package/dist/system/index.d.cts +379 -193
- package/dist/system/index.d.ts +379 -193
- package/dist/system/index.js +87 -18
- package/dist/text-field.type-0l73acce.d.ts +167 -0
- package/dist/text-field.type-DBh06DU5.d.cts +167 -0
- package/dist/theme/index.cjs +5 -3
- package/dist/theme/index.d.cts +55 -24
- package/dist/theme/index.d.ts +55 -24
- package/dist/theme/index.js +4 -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 +264 -18
- package/dist/chunk-ECDWSSHJ.js +0 -688
- package/dist/chunk-IYFGO523.cjs +0 -688
|
@@ -0,0 +1,381 @@
|
|
|
1
|
+
import { IconContext } from "./chunk-FHUYHV6J.js";
|
|
2
|
+
import { createRecipe, radiusAxis } from "./chunk-4GTAZM2C.js";
|
|
3
|
+
import { useXAUITheme } from "./chunk-A3EGFI6T.js";
|
|
4
|
+
import { Slot, childrenToString, createSlotContext } from "./chunk-K72UDPVN.js";
|
|
5
|
+
import { useStyleProps } from "./chunk-M63GFNKV.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_11788124035832_init_data = {
|
|
109
|
+
code: "function chunkUFTCTTKKJs1(){const{opacity}=this.__closure;return{opacity:opacity.value};}",
|
|
110
|
+
location: "/home/runner/work/xaui/xaui/packages/native/dist/chunk-UFTCTTKK.js",
|
|
111
|
+
sourceMap: "{\"version\":3,\"names\":[\"chunkUFTCTTKKJs1\",\"opacity\",\"__closure\",\"value\"],\"sources\":[\"/home/runner/work/xaui/xaui/packages/native/dist/chunk-UFTCTTKK.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 chunkUFTCTTKKJs1Factory({
|
|
126
|
+
_worklet_11788124035832_init_data,
|
|
127
|
+
opacity
|
|
128
|
+
}) {
|
|
129
|
+
const _e = [new global.Error(), -2, -27];
|
|
130
|
+
const chunkUFTCTTKKJs1 = function () {
|
|
131
|
+
return {
|
|
132
|
+
opacity: opacity.value
|
|
133
|
+
};
|
|
134
|
+
};
|
|
135
|
+
chunkUFTCTTKKJs1.__closure = {
|
|
136
|
+
opacity
|
|
137
|
+
};
|
|
138
|
+
chunkUFTCTTKKJs1.__workletHash = 11788124035832;
|
|
139
|
+
chunkUFTCTTKKJs1.__pluginVersion = "0.7.4";
|
|
140
|
+
chunkUFTCTTKKJs1.__initData = _worklet_11788124035832_init_data;
|
|
141
|
+
chunkUFTCTTKKJs1.__stackDetails = _e;
|
|
142
|
+
return chunkUFTCTTKKJs1;
|
|
143
|
+
}({
|
|
144
|
+
_worklet_11788124035832_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 };
|