@xaui/native 0.9.1-alpha.32 → 0.9.1-alpha.34
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-DUQUCOUY.cjs +198 -0
- package/dist/chunk-I66VMLHE.cjs +410 -0
- package/dist/chunk-LZK77LFX.js +198 -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/badge/index.cjs +16 -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 +16 -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 +40 -24
- package/dist/index.d.cts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +56 -40
- package/dist/system/index.cjs +4 -4
- package/dist/system/index.js +5 -5
- package/package.json +21 -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,198 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
var _chunk54FJOKANcjs = require('./chunk-54FJOKAN.cjs');
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
var _chunkFNEUOBCVcjs = require('./chunk-FNEUOBCV.cjs');
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
var _chunkI6ZB3FZIcjs = require('./chunk-I6ZB3FZI.cjs');
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
var _chunk57SJ4LJFcjs = require('./chunk-57SJ4LJF.cjs');
|
|
15
|
+
|
|
16
|
+
// src/components/badge/badge.tsx
|
|
17
|
+
var _react = require('react');
|
|
18
|
+
var _reactnative = require('react-native');
|
|
19
|
+
|
|
20
|
+
// src/components/badge/badge.recipe.ts
|
|
21
|
+
var SLOTS = ["root", "label"];
|
|
22
|
+
var VARIANT_TOKENS = {
|
|
23
|
+
primary: { bg: "accent", fg: "accentForeground" },
|
|
24
|
+
secondary: { bg: "accentSoft", fg: "accentSoftForeground" },
|
|
25
|
+
default: { bg: "default", fg: "defaultForeground" },
|
|
26
|
+
tertiary: { border: "border", fg: "foreground" },
|
|
27
|
+
ghost: { fg: "foreground" },
|
|
28
|
+
success: { bg: "success", fg: "successForeground" },
|
|
29
|
+
"success-soft": { bg: "successSoft", fg: "successSoftForeground" },
|
|
30
|
+
warning: { bg: "warning", fg: "warningForeground" },
|
|
31
|
+
"warning-soft": { bg: "warningSoft", fg: "warningSoftForeground" },
|
|
32
|
+
danger: { bg: "danger", fg: "dangerForeground" },
|
|
33
|
+
"danger-soft": { bg: "dangerSoft", fg: "dangerSoftForeground" }
|
|
34
|
+
};
|
|
35
|
+
function sizeAxis(step) {
|
|
36
|
+
return (theme) => {
|
|
37
|
+
const height = theme.spacing(step.height);
|
|
38
|
+
return {
|
|
39
|
+
root: {
|
|
40
|
+
height,
|
|
41
|
+
minWidth: height,
|
|
42
|
+
paddingHorizontal: theme.spacing(step.padding)
|
|
43
|
+
},
|
|
44
|
+
label: { fontSize: theme.fontSizes[step.label] }
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
function dotAxis(diameter) {
|
|
49
|
+
return (theme) => {
|
|
50
|
+
const size = theme.spacing(diameter);
|
|
51
|
+
return {
|
|
52
|
+
root: { height: size, width: size, minWidth: size, paddingHorizontal: 0 }
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
var BADGE_DEFAULT_SIZE = "md";
|
|
57
|
+
var SIZES = {
|
|
58
|
+
xs: { height: 4, padding: 1.25, label: "xs", dot: 1.5 },
|
|
59
|
+
sm: { height: 4.5, padding: 1.5, label: "xs", dot: 2 },
|
|
60
|
+
md: { height: 5, padding: 1.5, label: "xs", dot: 2.5 },
|
|
61
|
+
lg: { height: 6, padding: 2, label: "sm", dot: 3 }
|
|
62
|
+
};
|
|
63
|
+
function badgeOffset(theme, size, isDot) {
|
|
64
|
+
const step = SIZES[size];
|
|
65
|
+
return theme.spacing(isDot ? step.dot : step.height) / 2;
|
|
66
|
+
}
|
|
67
|
+
var badgeRecipe = _chunkFNEUOBCVcjs.createRecipe.call(void 0, {
|
|
68
|
+
slots: SLOTS,
|
|
69
|
+
base: (theme) => ({
|
|
70
|
+
root: {
|
|
71
|
+
flexDirection: "row",
|
|
72
|
+
alignItems: "center",
|
|
73
|
+
justifyContent: "center",
|
|
74
|
+
borderWidth: 0,
|
|
75
|
+
// The capsule at every size, which is what makes a two-digit count read as one
|
|
76
|
+
// object. `radius` is still there for the square marker.
|
|
77
|
+
borderRadius: theme.radius.full,
|
|
78
|
+
// Squircle corners for when `radius` overrides the pill. Free on Android.
|
|
79
|
+
borderCurve: "continuous"
|
|
80
|
+
},
|
|
81
|
+
label: {
|
|
82
|
+
fontFamily: theme.fontFamilies.body,
|
|
83
|
+
fontWeight: theme.fontWeights.semibold,
|
|
84
|
+
// Android reserves leading above and below the glyphs, which in a 16pt box is the
|
|
85
|
+
// difference between a centred digit and one sitting low.
|
|
86
|
+
includeFontPadding: false,
|
|
87
|
+
// No `lineHeight`: the scale's leading is taller than the box at every size here,
|
|
88
|
+
// and the root centres the label anyway.
|
|
89
|
+
textAlign: "center"
|
|
90
|
+
}
|
|
91
|
+
}),
|
|
92
|
+
variantTokens: VARIANT_TOKENS,
|
|
93
|
+
/**
|
|
94
|
+
* Where the variant's colours land, for every variant at once. The border width follows
|
|
95
|
+
* the *presence* of the border role, so `ghost` needs no rule of its own.
|
|
96
|
+
*/
|
|
97
|
+
paint: (theme, colors) => ({
|
|
98
|
+
root: {
|
|
99
|
+
backgroundColor: colors.bg,
|
|
100
|
+
borderColor: colors.border,
|
|
101
|
+
borderWidth: colors.border ? theme.borderWidth.default : 0
|
|
102
|
+
},
|
|
103
|
+
label: { color: colors.fg }
|
|
104
|
+
}),
|
|
105
|
+
/** Declaration order is application order: `dot` overrides the box `size` set, and
|
|
106
|
+
* `radius` overrides the capsule from `base`. */
|
|
107
|
+
variants: {
|
|
108
|
+
size: {
|
|
109
|
+
xs: sizeAxis(SIZES.xs),
|
|
110
|
+
sm: sizeAxis(SIZES.sm),
|
|
111
|
+
md: sizeAxis(SIZES.md),
|
|
112
|
+
lg: sizeAxis(SIZES.lg)
|
|
113
|
+
},
|
|
114
|
+
/**
|
|
115
|
+
* The same four keys as `size`, and the root selects it with the resolved size when
|
|
116
|
+
* `isDot` is set and with nothing when it is not — an axis left unselected contributes
|
|
117
|
+
* nothing, which is exactly "this badge has a label". A `{ true, false }` axis would
|
|
118
|
+
* have needed a `false` branch with nothing to say, and a `size × isDot` compound
|
|
119
|
+
* would have been sixteen entries for four measurements.
|
|
120
|
+
*/
|
|
121
|
+
dot: {
|
|
122
|
+
xs: dotAxis(SIZES.xs.dot),
|
|
123
|
+
sm: dotAxis(SIZES.sm.dot),
|
|
124
|
+
md: dotAxis(SIZES.md.dot),
|
|
125
|
+
lg: dotAxis(SIZES.lg.dot)
|
|
126
|
+
},
|
|
127
|
+
radius: _chunkFNEUOBCVcjs.radiusAxis.call(void 0, "root")
|
|
128
|
+
},
|
|
129
|
+
/**
|
|
130
|
+
* `danger`, where every other component in the library defaults to the first name in its
|
|
131
|
+
* ladder. A badge is overwhelmingly the count of something that wants attention — unread,
|
|
132
|
+
* failed, overdue — and a red one is what `<Badge>3</Badge>` means. The accent count is a
|
|
133
|
+
* `variant` away.
|
|
134
|
+
*/
|
|
135
|
+
defaultVariants: { variant: "danger", size: BADGE_DEFAULT_SIZE }
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
// src/components/badge/badge.utils.ts
|
|
139
|
+
function placementInsets(placement, offset) {
|
|
140
|
+
if (!placement) return void 0;
|
|
141
|
+
const vertical = placement.startsWith("top") ? { top: -offset } : { bottom: -offset };
|
|
142
|
+
const horizontal = placement.endsWith("start") ? { start: -offset } : { end: -offset };
|
|
143
|
+
return { position: "absolute", ...vertical, ...horizontal };
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
// src/components/badge/badge.tsx
|
|
147
|
+
var _jsxruntime = require('react/jsx-runtime');
|
|
148
|
+
var Badge = _react.forwardRef.call(void 0, function Badge2({
|
|
149
|
+
children,
|
|
150
|
+
variant,
|
|
151
|
+
size,
|
|
152
|
+
radius,
|
|
153
|
+
color,
|
|
154
|
+
isDot = false,
|
|
155
|
+
placement,
|
|
156
|
+
asChild = false,
|
|
157
|
+
style,
|
|
158
|
+
...props
|
|
159
|
+
}, ref) {
|
|
160
|
+
const theme = _chunk57SJ4LJFcjs.useXAUITheme.call(void 0, );
|
|
161
|
+
const [styleProps, rest] = _chunkI6ZB3FZIcjs.useStyleProps.call(void 0, props);
|
|
162
|
+
const resolvedSize = _nullishCoalesce(size, () => ( BADGE_DEFAULT_SIZE));
|
|
163
|
+
const selection = {
|
|
164
|
+
variant,
|
|
165
|
+
size,
|
|
166
|
+
radius,
|
|
167
|
+
// An axis left unselected contributes nothing, which is exactly "this badge has a
|
|
168
|
+
// label" — no `false` branch with nothing to say.
|
|
169
|
+
dot: isDot ? resolvedSize : void 0
|
|
170
|
+
};
|
|
171
|
+
const styles = badgeRecipe.resolve({ theme, selection });
|
|
172
|
+
const tint = color ? badgeRecipe.tint({ theme, color, selection }) : void 0;
|
|
173
|
+
const insets = _react.useMemo.call(void 0,
|
|
174
|
+
() => placementInsets(placement, badgeOffset(theme, resolvedSize, isDot)),
|
|
175
|
+
[placement, theme, resolvedSize, isDot]
|
|
176
|
+
);
|
|
177
|
+
const rootStyle = [styles.root, _optionalChain([tint, 'optionalAccess', _ => _.root]), insets, styleProps, style];
|
|
178
|
+
const text = _chunk54FJOKANcjs.childrenToString.call(void 0, children);
|
|
179
|
+
const label = text !== null ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reactnative.Text, { style: [styles.label, _optionalChain([tint, 'optionalAccess', _2 => _2.label])], numberOfLines: 1, children: text }) : children;
|
|
180
|
+
const content = isDot ? null : label;
|
|
181
|
+
const Root = asChild ? _chunk54FJOKANcjs.Slot : _reactnative.View;
|
|
182
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
183
|
+
Root,
|
|
184
|
+
{
|
|
185
|
+
ref,
|
|
186
|
+
...rest,
|
|
187
|
+
style: rootStyle,
|
|
188
|
+
children: asChild ? children : content
|
|
189
|
+
}
|
|
190
|
+
);
|
|
191
|
+
});
|
|
192
|
+
Badge.displayName = "XAUI.Badge";
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
exports.badgeRecipe = badgeRecipe; exports.placementInsets = placementInsets; exports.Badge = Badge;
|
|
@@ -0,0 +1,410 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
function _interopRequireDefault(obj) {
|
|
7
|
+
return obj && obj.__esModule ? obj : {
|
|
8
|
+
default: obj
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
function _optionalChain(ops) {
|
|
12
|
+
let lastAccessLHS = undefined;
|
|
13
|
+
let value = ops[0];
|
|
14
|
+
let i = 1;
|
|
15
|
+
while (i < ops.length) {
|
|
16
|
+
const op = ops[i];
|
|
17
|
+
const fn = ops[i + 1];
|
|
18
|
+
i += 2;
|
|
19
|
+
if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) {
|
|
20
|
+
return undefined;
|
|
21
|
+
}
|
|
22
|
+
if (op === 'access' || op === 'optionalAccess') {
|
|
23
|
+
lastAccessLHS = value;
|
|
24
|
+
value = fn(value);
|
|
25
|
+
} else if (op === 'call' || op === 'optionalCall') {
|
|
26
|
+
value = fn((...args) => value.call(lastAccessLHS, ...args));
|
|
27
|
+
lastAccessLHS = undefined;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
return value;
|
|
31
|
+
}
|
|
32
|
+
var _chunkPCWT2YBEcjs = require('./chunk-PCWT2YBE.cjs');
|
|
33
|
+
var _chunk54FJOKANcjs = require('./chunk-54FJOKAN.cjs');
|
|
34
|
+
var _chunkFNEUOBCVcjs = require('./chunk-FNEUOBCV.cjs');
|
|
35
|
+
var _chunkI6ZB3FZIcjs = require('./chunk-I6ZB3FZI.cjs');
|
|
36
|
+
var _chunk57SJ4LJFcjs = require('./chunk-57SJ4LJF.cjs');
|
|
37
|
+
|
|
38
|
+
// src/components/avatar/avatar-fallback.tsx
|
|
39
|
+
var _react = require('react');
|
|
40
|
+
var _reactnative = require('react-native');
|
|
41
|
+
|
|
42
|
+
// src/components/avatar/avatar-initials.tsx
|
|
43
|
+
|
|
44
|
+
// src/components/avatar/avatar.context.ts
|
|
45
|
+
var [AvatarProvider, useAvatar] = _chunk54FJOKANcjs.createSlotContext.call(void 0, "Avatar");
|
|
46
|
+
|
|
47
|
+
// src/components/avatar/avatar-initials.tsx
|
|
48
|
+
var _jsxruntime = require('react/jsx-runtime');
|
|
49
|
+
var AvatarInitials = _react.forwardRef.call(void 0, function AvatarInitials2({
|
|
50
|
+
children,
|
|
51
|
+
style,
|
|
52
|
+
...props
|
|
53
|
+
}, ref) {
|
|
54
|
+
const {
|
|
55
|
+
initialsStyle
|
|
56
|
+
} = useAvatar();
|
|
57
|
+
const [styleProps, rest] = _chunkI6ZB3FZIcjs.useStyleProps.call(void 0, props);
|
|
58
|
+
return /* @__PURE__ */_jsxruntime.jsx.call(void 0, _reactnative.Text, {
|
|
59
|
+
ref,
|
|
60
|
+
accessibilityElementsHidden: true,
|
|
61
|
+
importantForAccessibility: "no",
|
|
62
|
+
numberOfLines: 1,
|
|
63
|
+
...rest,
|
|
64
|
+
style: [initialsStyle, styleProps, style],
|
|
65
|
+
children
|
|
66
|
+
});
|
|
67
|
+
});
|
|
68
|
+
AvatarInitials.displayName = "XAUI.Avatar.Initials";
|
|
69
|
+
|
|
70
|
+
// src/components/avatar/avatar-fallback.tsx
|
|
71
|
+
|
|
72
|
+
var AvatarFallback = _react.forwardRef.call(void 0, function AvatarFallback2({
|
|
73
|
+
children,
|
|
74
|
+
style,
|
|
75
|
+
...props
|
|
76
|
+
}, ref) {
|
|
77
|
+
const {
|
|
78
|
+
fallbackStyle,
|
|
79
|
+
icon
|
|
80
|
+
} = useAvatar();
|
|
81
|
+
const [styleProps, rest] = _chunkI6ZB3FZIcjs.useStyleProps.call(void 0, props);
|
|
82
|
+
const text = _chunk54FJOKANcjs.childrenToString.call(void 0, children);
|
|
83
|
+
const content = text !== null ? /* @__PURE__ */_jsxruntime.jsx.call(void 0, AvatarInitials, {
|
|
84
|
+
children: text
|
|
85
|
+
}) : children;
|
|
86
|
+
return /* @__PURE__ */_jsxruntime.jsx.call(void 0, _reactnative.View, {
|
|
87
|
+
ref,
|
|
88
|
+
style: [fallbackStyle, styleProps, style],
|
|
89
|
+
...rest,
|
|
90
|
+
children: /* @__PURE__ */_jsxruntime.jsx.call(void 0, _chunkPCWT2YBEcjs.IconContext.Provider, {
|
|
91
|
+
value: icon,
|
|
92
|
+
children: content
|
|
93
|
+
})
|
|
94
|
+
});
|
|
95
|
+
});
|
|
96
|
+
AvatarFallback.displayName = "XAUI.Avatar.Fallback";
|
|
97
|
+
|
|
98
|
+
// src/components/avatar/avatar-image.tsx
|
|
99
|
+
|
|
100
|
+
var _reactnativereanimated = require('react-native-reanimated');
|
|
101
|
+
var _reactnativereanimated2 = _interopRequireDefault(_reactnativereanimated);
|
|
102
|
+
|
|
103
|
+
// src/components/avatar/avatar.style.ts
|
|
104
|
+
|
|
105
|
+
var avatarSheet = _reactnative.StyleSheet.create({
|
|
106
|
+
image: {
|
|
107
|
+
position: "absolute",
|
|
108
|
+
top: 0,
|
|
109
|
+
bottom: 0,
|
|
110
|
+
start: 0,
|
|
111
|
+
end: 0
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
// src/components/avatar/avatar-image.tsx
|
|
116
|
+
|
|
117
|
+
var FADE_DURATION = 200;
|
|
118
|
+
var AvatarImage = _react.forwardRef.call(void 0, function AvatarImage2({
|
|
119
|
+
animation = true,
|
|
120
|
+
style,
|
|
121
|
+
...props
|
|
122
|
+
}, ref) {
|
|
123
|
+
const [styleProps, rest] = _chunkI6ZB3FZIcjs.useStyleProps.call(void 0, props);
|
|
124
|
+
const frameStyle = [avatarSheet.image, styleProps, style];
|
|
125
|
+
if (!animation) return /* @__PURE__ */_jsxruntime.jsx.call(void 0, _reactnative.Image, {
|
|
126
|
+
ref,
|
|
127
|
+
...rest,
|
|
128
|
+
style: frameStyle
|
|
129
|
+
});
|
|
130
|
+
return /* @__PURE__ */_jsxruntime.jsx.call(void 0, FadingImage, {
|
|
131
|
+
ref,
|
|
132
|
+
...rest,
|
|
133
|
+
style: frameStyle
|
|
134
|
+
});
|
|
135
|
+
});
|
|
136
|
+
AvatarImage.displayName = "XAUI.Avatar.Image";
|
|
137
|
+
const _worklet_10076879540172_init_data = {
|
|
138
|
+
code: "function chunkI66VMLHECjs1(){const{opacity}=this.__closure;return{opacity:opacity.value};}",
|
|
139
|
+
location: "/home/runner/work/xaui/xaui/packages/native/dist/chunk-I66VMLHE.cjs",
|
|
140
|
+
sourceMap: "{\"version\":3,\"names\":[\"chunkI66VMLHECjs1\",\"opacity\",\"__closure\",\"value\"],\"sources\":[\"/home/runner/work/xaui/xaui/packages/native/dist/chunk-I66VMLHE.cjs\"],\"mappings\":\"AAoG+E,SAAAA,iBAAMA,CAAA,QAAAC,OAAA,OAAAC,SAAA,CAE/E,MAAO,CAAED,OAAO,CAAEA,OAAO,CAACE,KAAM,CAAC,CACnC\",\"ignoreList\":[]}"
|
|
141
|
+
};
|
|
142
|
+
var FadingImage = _react.forwardRef.call(void 0, function FadingImage2({
|
|
143
|
+
onLoad,
|
|
144
|
+
style,
|
|
145
|
+
...props
|
|
146
|
+
}, ref) {
|
|
147
|
+
const opacity = _reactnativereanimated.useSharedValue.call(void 0, 0);
|
|
148
|
+
const handleLoad = _react.useCallback.call(void 0, event => {
|
|
149
|
+
opacity.value = _reactnativereanimated.withTiming.call(void 0, 1, {
|
|
150
|
+
duration: FADE_DURATION
|
|
151
|
+
});
|
|
152
|
+
_optionalChain([onLoad, 'optionalCall', _ => _(event)]);
|
|
153
|
+
}, [opacity, onLoad]);
|
|
154
|
+
const animatedStyle = _reactnativereanimated.useAnimatedStyle.call(void 0, function chunkI66VMLHECjs1Factory({
|
|
155
|
+
_worklet_10076879540172_init_data,
|
|
156
|
+
opacity
|
|
157
|
+
}) {
|
|
158
|
+
const _e = [new global.Error(), -2, -27];
|
|
159
|
+
const chunkI66VMLHECjs1 = function () {
|
|
160
|
+
return {
|
|
161
|
+
opacity: opacity.value
|
|
162
|
+
};
|
|
163
|
+
};
|
|
164
|
+
chunkI66VMLHECjs1.__closure = {
|
|
165
|
+
opacity
|
|
166
|
+
};
|
|
167
|
+
chunkI66VMLHECjs1.__workletHash = 10076879540172;
|
|
168
|
+
chunkI66VMLHECjs1.__pluginVersion = "0.7.4";
|
|
169
|
+
chunkI66VMLHECjs1.__initData = _worklet_10076879540172_init_data;
|
|
170
|
+
chunkI66VMLHECjs1.__stackDetails = _e;
|
|
171
|
+
return chunkI66VMLHECjs1;
|
|
172
|
+
}({
|
|
173
|
+
_worklet_10076879540172_init_data,
|
|
174
|
+
opacity
|
|
175
|
+
}), [opacity]);
|
|
176
|
+
return /* @__PURE__ */_jsxruntime.jsx.call(void 0, _reactnativereanimated2.default.Image, {
|
|
177
|
+
ref,
|
|
178
|
+
...props,
|
|
179
|
+
onLoad: handleLoad,
|
|
180
|
+
style: [style, animatedStyle]
|
|
181
|
+
});
|
|
182
|
+
});
|
|
183
|
+
|
|
184
|
+
// src/components/avatar/avatar.tsx
|
|
185
|
+
|
|
186
|
+
// src/components/avatar/avatar.recipe.ts
|
|
187
|
+
var SLOTS = ["root", "fallback", "initials", "icon"];
|
|
188
|
+
var VARIANT_TOKENS = {
|
|
189
|
+
primary: {
|
|
190
|
+
bg: "accent",
|
|
191
|
+
fg: "accentForeground"
|
|
192
|
+
},
|
|
193
|
+
secondary: {
|
|
194
|
+
bg: "accentSoft",
|
|
195
|
+
fg: "accentSoftForeground"
|
|
196
|
+
},
|
|
197
|
+
default: {
|
|
198
|
+
bg: "default",
|
|
199
|
+
fg: "defaultForeground"
|
|
200
|
+
},
|
|
201
|
+
tertiary: {
|
|
202
|
+
border: "border",
|
|
203
|
+
fg: "foreground"
|
|
204
|
+
},
|
|
205
|
+
ghost: {
|
|
206
|
+
fg: "foreground"
|
|
207
|
+
},
|
|
208
|
+
success: {
|
|
209
|
+
bg: "success",
|
|
210
|
+
fg: "successForeground"
|
|
211
|
+
},
|
|
212
|
+
"success-soft": {
|
|
213
|
+
bg: "successSoft",
|
|
214
|
+
fg: "successSoftForeground"
|
|
215
|
+
},
|
|
216
|
+
warning: {
|
|
217
|
+
bg: "warning",
|
|
218
|
+
fg: "warningForeground"
|
|
219
|
+
},
|
|
220
|
+
"warning-soft": {
|
|
221
|
+
bg: "warningSoft",
|
|
222
|
+
fg: "warningSoftForeground"
|
|
223
|
+
},
|
|
224
|
+
danger: {
|
|
225
|
+
bg: "danger",
|
|
226
|
+
fg: "dangerForeground"
|
|
227
|
+
},
|
|
228
|
+
"danger-soft": {
|
|
229
|
+
bg: "dangerSoft",
|
|
230
|
+
fg: "dangerSoftForeground"
|
|
231
|
+
}
|
|
232
|
+
};
|
|
233
|
+
function sizeAxis(step) {
|
|
234
|
+
return theme => {
|
|
235
|
+
const diameter = theme.spacing(step.diameter);
|
|
236
|
+
return {
|
|
237
|
+
root: {
|
|
238
|
+
width: diameter,
|
|
239
|
+
height: diameter
|
|
240
|
+
},
|
|
241
|
+
initials: {
|
|
242
|
+
fontSize: theme.fontSizes[step.initials],
|
|
243
|
+
lineHeight: theme.lineHeights[step.initials]
|
|
244
|
+
},
|
|
245
|
+
icon: {
|
|
246
|
+
fontSize: theme.fontSizes[step.glyph]
|
|
247
|
+
}
|
|
248
|
+
};
|
|
249
|
+
};
|
|
250
|
+
}
|
|
251
|
+
var SIZES = {
|
|
252
|
+
xs: {
|
|
253
|
+
diameter: 8,
|
|
254
|
+
initials: "xs",
|
|
255
|
+
glyph: "xs"
|
|
256
|
+
},
|
|
257
|
+
sm: {
|
|
258
|
+
diameter: 10,
|
|
259
|
+
initials: "xs",
|
|
260
|
+
glyph: "sm"
|
|
261
|
+
},
|
|
262
|
+
md: {
|
|
263
|
+
diameter: 12,
|
|
264
|
+
initials: "sm",
|
|
265
|
+
glyph: "md"
|
|
266
|
+
},
|
|
267
|
+
lg: {
|
|
268
|
+
diameter: 16,
|
|
269
|
+
initials: "md",
|
|
270
|
+
glyph: "xl"
|
|
271
|
+
}
|
|
272
|
+
};
|
|
273
|
+
var avatarRecipe = _chunkFNEUOBCVcjs.createRecipe.call(void 0, {
|
|
274
|
+
slots: SLOTS,
|
|
275
|
+
base: theme => ({
|
|
276
|
+
root: {
|
|
277
|
+
alignItems: "center",
|
|
278
|
+
justifyContent: "center",
|
|
279
|
+
// The clip is what makes a square photo round, so unlike on the `Chip` it is not
|
|
280
|
+
// optional here: without it the image is a rectangle sitting over a circle.
|
|
281
|
+
overflow: "hidden",
|
|
282
|
+
// Squircle corners for when `radius` overrides the circle. Free on Android.
|
|
283
|
+
borderCurve: "continuous",
|
|
284
|
+
borderWidth: 0
|
|
285
|
+
},
|
|
286
|
+
fallback: {
|
|
287
|
+
width: "100%",
|
|
288
|
+
height: "100%",
|
|
289
|
+
alignItems: "center",
|
|
290
|
+
justifyContent: "center"
|
|
291
|
+
},
|
|
292
|
+
initials: {
|
|
293
|
+
fontFamily: theme.fontFamilies.body,
|
|
294
|
+
fontWeight: theme.fontWeights.medium,
|
|
295
|
+
// Two letters in a circle sit off-centre by the descender otherwise.
|
|
296
|
+
textAlign: "center"
|
|
297
|
+
}
|
|
298
|
+
}),
|
|
299
|
+
variantTokens: VARIANT_TOKENS,
|
|
300
|
+
/**
|
|
301
|
+
* Where the variant's colours land, for every variant at once. The border width follows
|
|
302
|
+
* the *presence* of the border role, so `ghost` needs no rule of its own to say it has
|
|
303
|
+
* no edge.
|
|
304
|
+
*
|
|
305
|
+
* The image takes no colour: it is a photograph, and tinting one is what `Icon`'s
|
|
306
|
+
* `source` form is for.
|
|
307
|
+
*/
|
|
308
|
+
paint: (theme, colors) => ({
|
|
309
|
+
root: {
|
|
310
|
+
backgroundColor: colors.bg,
|
|
311
|
+
borderColor: colors.border,
|
|
312
|
+
borderWidth: colors.border ? theme.borderWidth.default : 0
|
|
313
|
+
},
|
|
314
|
+
initials: {
|
|
315
|
+
color: colors.fg
|
|
316
|
+
},
|
|
317
|
+
icon: {
|
|
318
|
+
color: colors.fg
|
|
319
|
+
}
|
|
320
|
+
}),
|
|
321
|
+
/** Declaration order is application order: `radius` overrides the circle `base` set. */
|
|
322
|
+
variants: {
|
|
323
|
+
size: {
|
|
324
|
+
xs: sizeAxis(SIZES.xs),
|
|
325
|
+
sm: sizeAxis(SIZES.sm),
|
|
326
|
+
md: sizeAxis(SIZES.md),
|
|
327
|
+
lg: sizeAxis(SIZES.lg)
|
|
328
|
+
},
|
|
329
|
+
radius: _chunkFNEUOBCVcjs.radiusAxis.call(void 0, "root")
|
|
330
|
+
},
|
|
331
|
+
/**
|
|
332
|
+
* A circle at every size, where HeroUI fixes one large radius for all three — which
|
|
333
|
+
* makes their small avatars round and their large ones squircles. `full` says the shape
|
|
334
|
+
* the name means once, and `radius` is still there for the logo that wants a square.
|
|
335
|
+
*/
|
|
336
|
+
defaultVariants: {
|
|
337
|
+
variant: "default",
|
|
338
|
+
size: "md",
|
|
339
|
+
radius: "full"
|
|
340
|
+
}
|
|
341
|
+
});
|
|
342
|
+
|
|
343
|
+
// src/components/avatar/avatar.tsx
|
|
344
|
+
|
|
345
|
+
var AvatarRoot = _react.forwardRef.call(void 0, function Avatar({
|
|
346
|
+
children,
|
|
347
|
+
variant,
|
|
348
|
+
size,
|
|
349
|
+
radius,
|
|
350
|
+
color,
|
|
351
|
+
asChild = false,
|
|
352
|
+
style,
|
|
353
|
+
...props
|
|
354
|
+
}, ref) {
|
|
355
|
+
const theme = _chunk57SJ4LJFcjs.useXAUITheme.call(void 0);
|
|
356
|
+
const [styleProps, rest] = _chunkI6ZB3FZIcjs.useStyleProps.call(void 0, props);
|
|
357
|
+
const selection = {
|
|
358
|
+
variant,
|
|
359
|
+
size,
|
|
360
|
+
radius
|
|
361
|
+
};
|
|
362
|
+
const styles = avatarRecipe.resolve({
|
|
363
|
+
theme,
|
|
364
|
+
selection
|
|
365
|
+
});
|
|
366
|
+
const tint = color ? avatarRecipe.tint({
|
|
367
|
+
theme,
|
|
368
|
+
color,
|
|
369
|
+
selection
|
|
370
|
+
}) : void 0;
|
|
371
|
+
const context = _react.useMemo.call(void 0, () => {
|
|
372
|
+
const icon = _reactnative.StyleSheet.flatten([styles.icon, _optionalChain([tint, 'optionalAccess', _2 => _2.icon])]);
|
|
373
|
+
return {
|
|
374
|
+
fallbackStyle: styles.fallback,
|
|
375
|
+
initialsStyle: tint ? [styles.initials, tint.initials] : styles.initials,
|
|
376
|
+
icon: {
|
|
377
|
+
size: icon.fontSize,
|
|
378
|
+
// `ColorValue` also covers the platform's opaque colours, which `Icon` cannot
|
|
379
|
+
// hand to a third-party component expecting a string.
|
|
380
|
+
color: typeof icon.color === "string" ? icon.color : void 0
|
|
381
|
+
}
|
|
382
|
+
};
|
|
383
|
+
}, [styles, tint]);
|
|
384
|
+
const rootStyle = [styles.root, _optionalChain([tint, 'optionalAccess', _3 => _3.root]), styleProps, style];
|
|
385
|
+
const text = _chunk54FJOKANcjs.childrenToString.call(void 0, children);
|
|
386
|
+
const content = text !== null ? /* @__PURE__ */_jsxruntime.jsx.call(void 0, AvatarFallback, {
|
|
387
|
+
children: text
|
|
388
|
+
}) : children;
|
|
389
|
+
const Root = asChild ? _chunk54FJOKANcjs.Slot : _reactnative.View;
|
|
390
|
+
return /* @__PURE__ */_jsxruntime.jsx.call(void 0, AvatarProvider, {
|
|
391
|
+
value: context,
|
|
392
|
+
children: /* @__PURE__ */_jsxruntime.jsx.call(void 0, Root, {
|
|
393
|
+
ref,
|
|
394
|
+
...rest,
|
|
395
|
+
style: rootStyle,
|
|
396
|
+
children: asChild ? children : content
|
|
397
|
+
})
|
|
398
|
+
});
|
|
399
|
+
});
|
|
400
|
+
AvatarRoot.displayName = "XAUI.Avatar.Root";
|
|
401
|
+
|
|
402
|
+
// src/components/avatar/index.ts
|
|
403
|
+
var Avatar2 = Object.assign(AvatarRoot, {
|
|
404
|
+
Image: AvatarImage,
|
|
405
|
+
Fallback: AvatarFallback,
|
|
406
|
+
Initials: AvatarInitials
|
|
407
|
+
});
|
|
408
|
+
exports.useAvatar = useAvatar;
|
|
409
|
+
exports.avatarRecipe = avatarRecipe;
|
|
410
|
+
exports.Avatar = Avatar2;
|