@xaui/native 0.9.1-alpha.20 → 0.9.1-alpha.22
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-RMLFMRWL.js → chunk-2U6JR7BF.js} +5 -5
- package/dist/{chunk-N7C4UNUL.js → chunk-3JATAB7S.js} +23 -1
- package/dist/chunk-4MHJOWM4.cjs +364 -0
- package/dist/{chunk-2WMVDMFV.cjs → chunk-6HXWQ5AU.cjs} +2 -2
- package/dist/chunk-6WW4CSPY.cjs +82 -0
- package/dist/chunk-AHL33YAO.js +425 -0
- package/dist/{chunk-XHZBXYVU.js → chunk-AKXG43S4.js} +1 -1
- package/dist/{chunk-A4VD4MHK.cjs → chunk-BH5DSJVX.cjs} +100 -133
- package/dist/chunk-BNWS26PX.cjs +449 -0
- package/dist/chunk-DXGQ43IV.cjs +68 -0
- package/dist/{chunk-4EPS7UBO.js → chunk-FNQF4KQV.js} +20 -97
- package/dist/chunk-FTCTTBLG.js +449 -0
- package/dist/chunk-FVP5FUVS.js +68 -0
- package/dist/{chunk-BHTFIZTQ.cjs → chunk-GBPWTFTU.cjs} +11 -11
- package/dist/{chunk-MWXE7D4L.js → chunk-GG2WWCBK.js} +11 -11
- package/dist/{chunk-EVXZGNPA.cjs → chunk-HUZ4AUM2.cjs} +98 -98
- package/dist/chunk-I6PE5UUH.cjs +425 -0
- package/dist/{chunk-33QILJJH.cjs → chunk-IBEX4XGV.cjs} +11 -11
- package/dist/{chunk-WXAME7KB.js → chunk-KM2TI5IC.js} +126 -159
- package/dist/chunk-OGC4RKE3.js +364 -0
- package/dist/{chunk-JXLRHKCQ.js → chunk-OYZYWWJ6.js} +1 -1
- package/dist/{chunk-EXX6ATAS.js → chunk-PMO62QK4.js} +101 -101
- package/dist/{chunk-UBA6AEY6.cjs → chunk-RAWOJ3N3.cjs} +8 -8
- package/dist/{chunk-6ARON3XT.cjs → chunk-VDRRD6GM.cjs} +31 -110
- package/dist/{chunk-UVO4GFSW.cjs → chunk-YXVKQMCK.cjs} +23 -1
- package/dist/chunk-ZQ3JSWRO.js +82 -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 +17 -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 +17 -0
- package/dist/components/button/index.cjs +6 -5
- package/dist/components/button/index.d.cts +193 -243
- package/dist/components/button/index.d.ts +193 -243
- package/dist/components/button/index.js +5 -4
- package/dist/components/card/index.cjs +19 -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 +19 -0
- package/dist/components/chip/index.cjs +17 -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 +17 -0
- package/dist/components/typography/index.cjs +4 -4
- package/dist/components/typography/index.d.cts +4 -4
- package/dist/components/typography/index.d.ts +4 -4
- package/dist/components/typography/index.js +3 -3
- package/dist/components/view/index.cjs +3 -3
- package/dist/components/view/index.d.cts +7 -7
- package/dist/components/view/index.d.ts +7 -7
- package/dist/components/view/index.js +2 -2
- package/dist/{create-recipe-CPXFo2rk.d.ts → create-recipe-CbXika57.d.ts} +7 -1
- package/dist/{create-recipe-C0XXjuow.d.cts → create-recipe-jHlk434p.d.cts} +7 -1
- package/dist/icon.type-CF4KiMKl.d.cts +73 -0
- package/dist/icon.type-Dq4_qePa.d.ts +73 -0
- package/dist/index.cjs +49 -11
- package/dist/index.d.cts +9 -4
- package/dist/index.d.ts +9 -4
- package/dist/index.js +71 -33
- package/dist/{pressable-feedback.type-BwkKLQlX.d.ts → pressable-feedback.type-BA2C9sSz.d.cts} +4 -72
- package/dist/{pressable-feedback.type-1K8YEOb8.d.cts → pressable-feedback.type-Bs4dQlGj.d.ts} +4 -72
- package/dist/{style-props.type-B1BG5TCm.d.cts → style-props.type-CfnoGEP7.d.cts} +1 -1
- package/dist/{style-props.type-B1BG5TCm.d.ts → style-props.type-CfnoGEP7.d.ts} +1 -1
- package/dist/system/index.cjs +16 -6
- package/dist/system/index.d.cts +174 -98
- package/dist/system/index.d.ts +174 -98
- package/dist/system/index.js +20 -10
- package/dist/theme/index.cjs +2 -2
- package/dist/theme/index.d.cts +11 -11
- package/dist/theme/index.d.ts +11 -11
- package/dist/theme/index.js +1 -1
- package/package.json +31 -1
|
@@ -0,0 +1,449 @@
|
|
|
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
|
+
|
|
5
|
+
var _chunkBH5DSJVXcjs = require('./chunk-BH5DSJVX.cjs');
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
var _chunkYXVKQMCKcjs = require('./chunk-YXVKQMCK.cjs');
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
var _chunk57SJ4LJFcjs = require('./chunk-57SJ4LJF.cjs');
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
var _chunkHUZ4AUM2cjs = require('./chunk-HUZ4AUM2.cjs');
|
|
18
|
+
|
|
19
|
+
// src/components/card/card-background.tsx
|
|
20
|
+
var _react = require('react');
|
|
21
|
+
var _reactnative = require('react-native');
|
|
22
|
+
|
|
23
|
+
// src/components/card/card.utils.ts
|
|
24
|
+
|
|
25
|
+
var CARD_BACKGROUND = /* @__PURE__ */ Symbol.for("xaui.Card.background");
|
|
26
|
+
function markBackground(component) {
|
|
27
|
+
return Object.assign(component, { [CARD_BACKGROUND]: true });
|
|
28
|
+
}
|
|
29
|
+
function isBackground(node) {
|
|
30
|
+
if (!_react.isValidElement.call(void 0, node)) return false;
|
|
31
|
+
const type = node.type;
|
|
32
|
+
if (typeof type !== "function" && typeof type !== "object") return false;
|
|
33
|
+
if (type === null) return false;
|
|
34
|
+
return type[CARD_BACKGROUND] === true;
|
|
35
|
+
}
|
|
36
|
+
function partitionBackground(children) {
|
|
37
|
+
const all = _react.Children.toArray(children);
|
|
38
|
+
const index = all.findIndex(isBackground);
|
|
39
|
+
if (index === -1) return { background: null, content: children };
|
|
40
|
+
return {
|
|
41
|
+
background: all[index],
|
|
42
|
+
content: all.filter((_, at) => at !== index)
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// src/components/card/card.context.ts
|
|
47
|
+
var [CardProvider, useCard] = _chunkHUZ4AUM2cjs.createSlotContext.call(void 0, "Card");
|
|
48
|
+
|
|
49
|
+
// src/components/card/card.style.ts
|
|
50
|
+
|
|
51
|
+
var cardSheet = _reactnative.StyleSheet.create({
|
|
52
|
+
backgroundImage: { width: "100%", height: "100%" }
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
// src/components/card/card-background.tsx
|
|
56
|
+
var _jsxruntime = require('react/jsx-runtime');
|
|
57
|
+
var CardBackground = markBackground(
|
|
58
|
+
_react.forwardRef.call(void 0, function CardBackground2({ children, source, style, ...props }, ref) {
|
|
59
|
+
const { backgroundStyle } = useCard();
|
|
60
|
+
const [styleProps, rest] = _chunkHUZ4AUM2cjs.useStyleProps.call(void 0, props);
|
|
61
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
62
|
+
_reactnative.View,
|
|
63
|
+
{
|
|
64
|
+
ref,
|
|
65
|
+
accessibilityElementsHidden: true,
|
|
66
|
+
importantForAccessibility: "no-hide-descendants",
|
|
67
|
+
...rest,
|
|
68
|
+
style: [backgroundStyle, styleProps, style],
|
|
69
|
+
children: source ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reactnative.Image, { source, style: cardSheet.backgroundImage }) : children
|
|
70
|
+
}
|
|
71
|
+
);
|
|
72
|
+
})
|
|
73
|
+
);
|
|
74
|
+
CardBackground.displayName = "XAUI.Card.Background";
|
|
75
|
+
|
|
76
|
+
// src/components/card/card-body.tsx
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
var CardBody = _react.forwardRef.call(void 0, function CardBody2({ children, style, ...props }, ref) {
|
|
81
|
+
const { bodyStyle } = useCard();
|
|
82
|
+
const [styleProps, rest] = _chunkHUZ4AUM2cjs.useStyleProps.call(void 0, props);
|
|
83
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reactnative.View, { ref, style: [bodyStyle, styleProps, style], ...rest, children });
|
|
84
|
+
});
|
|
85
|
+
CardBody.displayName = "XAUI.Card.Body";
|
|
86
|
+
|
|
87
|
+
// src/components/card/card-description.tsx
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
var CardDescription = _react.forwardRef.call(void 0,
|
|
92
|
+
function CardDescription2({ children, style, ...props }, ref) {
|
|
93
|
+
const { descriptionStyle } = useCard();
|
|
94
|
+
const [styleProps, rest] = _chunkHUZ4AUM2cjs.useStyleProps.call(void 0, props);
|
|
95
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reactnative.Text, { ref, style: [descriptionStyle, styleProps, style], ...rest, children });
|
|
96
|
+
}
|
|
97
|
+
);
|
|
98
|
+
CardDescription.displayName = "XAUI.Card.Description";
|
|
99
|
+
|
|
100
|
+
// src/components/card/card-footer.tsx
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
var CardFooter = _react.forwardRef.call(void 0, function CardFooter2({ children, style, ...props }, ref) {
|
|
105
|
+
const { footerStyle } = useCard();
|
|
106
|
+
const [styleProps, rest] = _chunkHUZ4AUM2cjs.useStyleProps.call(void 0, props);
|
|
107
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reactnative.View, { ref, style: [footerStyle, styleProps, style], ...rest, children });
|
|
108
|
+
});
|
|
109
|
+
CardFooter.displayName = "XAUI.Card.Footer";
|
|
110
|
+
|
|
111
|
+
// src/components/card/card-header.tsx
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
var CardHeader = _react.forwardRef.call(void 0, function CardHeader2({ children, style, ...props }, ref) {
|
|
116
|
+
const { headerStyle } = useCard();
|
|
117
|
+
const [styleProps, rest] = _chunkHUZ4AUM2cjs.useStyleProps.call(void 0, props);
|
|
118
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reactnative.View, { ref, style: [headerStyle, styleProps, style], ...rest, children });
|
|
119
|
+
});
|
|
120
|
+
CardHeader.displayName = "XAUI.Card.Header";
|
|
121
|
+
|
|
122
|
+
// src/components/card/card-title.tsx
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
var CardTitle = _react.forwardRef.call(void 0, function CardTitle2({ children, style, ...props }, ref) {
|
|
127
|
+
const { titleStyle } = useCard();
|
|
128
|
+
const [styleProps, rest] = _chunkHUZ4AUM2cjs.useStyleProps.call(void 0, props);
|
|
129
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reactnative.Text, { ref, style: [titleStyle, styleProps, style], ...rest, children });
|
|
130
|
+
});
|
|
131
|
+
CardTitle.displayName = "XAUI.Card.Title";
|
|
132
|
+
|
|
133
|
+
// src/components/card/card.tsx
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
// src/components/card/card.recipe.ts
|
|
138
|
+
var SLOTS = [
|
|
139
|
+
"root",
|
|
140
|
+
"background",
|
|
141
|
+
"header",
|
|
142
|
+
"body",
|
|
143
|
+
"footer",
|
|
144
|
+
"title",
|
|
145
|
+
"description"
|
|
146
|
+
];
|
|
147
|
+
var VARIANT_TOKENS = {
|
|
148
|
+
default: { bg: "surface", fg: "surfaceForeground" },
|
|
149
|
+
secondary: { bg: "surfaceSecondary", fg: "surfaceSecondaryForeground" },
|
|
150
|
+
tertiary: { border: "border", fg: "foreground" },
|
|
151
|
+
ghost: { fg: "foreground" }
|
|
152
|
+
};
|
|
153
|
+
var DESCRIPTION_OPACITY = 0.6;
|
|
154
|
+
function sizeAxis(step) {
|
|
155
|
+
const { padding, gap, contentGap, radius, title, description } = step;
|
|
156
|
+
return (theme) => ({
|
|
157
|
+
root: {
|
|
158
|
+
padding: theme.spacing(padding),
|
|
159
|
+
gap: theme.spacing(gap),
|
|
160
|
+
borderRadius: theme.radius[radius]
|
|
161
|
+
},
|
|
162
|
+
// The same corner as the root, because this layer is what clips the image — the root
|
|
163
|
+
// deliberately does not (see `base`), so the radius has to be repeated where the
|
|
164
|
+
// `overflow` is.
|
|
165
|
+
background: { borderRadius: theme.radius[radius] },
|
|
166
|
+
header: { gap: theme.spacing(contentGap) },
|
|
167
|
+
body: { gap: theme.spacing(contentGap) },
|
|
168
|
+
footer: { gap: theme.spacing(contentGap) },
|
|
169
|
+
title: {
|
|
170
|
+
fontSize: theme.fontSizes[title],
|
|
171
|
+
lineHeight: theme.lineHeights[title]
|
|
172
|
+
},
|
|
173
|
+
description: {
|
|
174
|
+
fontSize: theme.fontSizes[description],
|
|
175
|
+
lineHeight: theme.lineHeights[description]
|
|
176
|
+
}
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
var SIZES = {
|
|
180
|
+
xs: {
|
|
181
|
+
padding: 3,
|
|
182
|
+
gap: 2,
|
|
183
|
+
contentGap: 1,
|
|
184
|
+
radius: "lg",
|
|
185
|
+
title: "sm",
|
|
186
|
+
description: "xs"
|
|
187
|
+
},
|
|
188
|
+
sm: {
|
|
189
|
+
padding: 3.5,
|
|
190
|
+
gap: 3,
|
|
191
|
+
contentGap: 1,
|
|
192
|
+
radius: "xl",
|
|
193
|
+
title: "md",
|
|
194
|
+
description: "sm"
|
|
195
|
+
},
|
|
196
|
+
md: {
|
|
197
|
+
padding: 4,
|
|
198
|
+
gap: 4,
|
|
199
|
+
contentGap: 1,
|
|
200
|
+
radius: "2xl",
|
|
201
|
+
title: "lg",
|
|
202
|
+
description: "md"
|
|
203
|
+
},
|
|
204
|
+
lg: {
|
|
205
|
+
padding: 5,
|
|
206
|
+
gap: 5,
|
|
207
|
+
contentGap: 1.5,
|
|
208
|
+
radius: "3xl",
|
|
209
|
+
title: "xl",
|
|
210
|
+
description: "lg"
|
|
211
|
+
}
|
|
212
|
+
};
|
|
213
|
+
function corner(key) {
|
|
214
|
+
return (theme) => ({
|
|
215
|
+
root: { borderRadius: theme.radius[key] },
|
|
216
|
+
background: { borderRadius: theme.radius[key] }
|
|
217
|
+
});
|
|
218
|
+
}
|
|
219
|
+
var cardRecipe = _chunkYXVKQMCKcjs.createRecipe.call(void 0, {
|
|
220
|
+
slots: SLOTS,
|
|
221
|
+
base: (theme) => ({
|
|
222
|
+
root: {
|
|
223
|
+
flexDirection: "column",
|
|
224
|
+
borderWidth: 0,
|
|
225
|
+
// iOS's squircle. Free on Android, and it is what makes a card's radius read as a
|
|
226
|
+
// shape rather than as four arcs meeting straight edges.
|
|
227
|
+
borderCurve: "continuous"
|
|
228
|
+
// Deliberately no `overflow: 'hidden'`: on iOS it clips the node's own shadow, so
|
|
229
|
+
// a `default` card would lose the elevation the variant just gave it. The press
|
|
230
|
+
// wash rounds itself off the root's corners and needs no clip; a caller bleeding an
|
|
231
|
+
// image to the edges writes `overflow="hidden"` and takes the trade knowingly.
|
|
232
|
+
},
|
|
233
|
+
// R13 — `start` and `end`, never `left` and `right`, even at zero. `overflow` lives
|
|
234
|
+
// here rather than on the root: on iOS it clips the node's own shadow, and a `default`
|
|
235
|
+
// card would lose the elevation its variant just gave it.
|
|
236
|
+
background: {
|
|
237
|
+
position: "absolute",
|
|
238
|
+
top: 0,
|
|
239
|
+
bottom: 0,
|
|
240
|
+
start: 0,
|
|
241
|
+
end: 0,
|
|
242
|
+
overflow: "hidden"
|
|
243
|
+
},
|
|
244
|
+
// Top-aligned content — a badge, an icon, a title block. A column pinned to the
|
|
245
|
+
// leading edge, which RTL mirrors on its own; `flexDirection="row"` is one prop away
|
|
246
|
+
// for a header that puts an action at the far end.
|
|
247
|
+
header: { alignItems: "flex-start" },
|
|
248
|
+
// `flexGrow` and not `flex: 1`. `flex: 1` also sets `flexBasis: 0`, and in a card
|
|
249
|
+
// whose height comes from its content that measures the body as empty before there
|
|
250
|
+
// is any free space to give back to it — the collapse is silent and total.
|
|
251
|
+
body: { flexGrow: 1 },
|
|
252
|
+
// A footer is an action row: the one section whose common case is horizontal, so it
|
|
253
|
+
// is the one section that is a row by default.
|
|
254
|
+
footer: { flexDirection: "row", alignItems: "center" },
|
|
255
|
+
// `medium`, not `semibold`. A card's title sits in prose rather than on a control:
|
|
256
|
+
// one weight above the description is enough to rank them, and the heavier step reads
|
|
257
|
+
// as a section heading the card did not ask for.
|
|
258
|
+
title: {
|
|
259
|
+
fontFamily: theme.fontFamilies.heading,
|
|
260
|
+
fontWeight: theme.fontWeights.medium
|
|
261
|
+
},
|
|
262
|
+
description: {
|
|
263
|
+
fontFamily: theme.fontFamilies.body,
|
|
264
|
+
fontWeight: theme.fontWeights.regular,
|
|
265
|
+
opacity: DESCRIPTION_OPACITY
|
|
266
|
+
}
|
|
267
|
+
}),
|
|
268
|
+
variantTokens: VARIANT_TOKENS,
|
|
269
|
+
/**
|
|
270
|
+
* Where the variant's colours land, for every variant at once. The border width follows
|
|
271
|
+
* the *presence* of the border role, so `ghost` needs no rule of its own to say it has
|
|
272
|
+
* no edge.
|
|
273
|
+
*/
|
|
274
|
+
paint: (theme, colors) => ({
|
|
275
|
+
root: {
|
|
276
|
+
backgroundColor: colors.bg,
|
|
277
|
+
borderColor: colors.border,
|
|
278
|
+
borderWidth: colors.border ? theme.borderWidth.default : 0
|
|
279
|
+
},
|
|
280
|
+
title: { color: colors.fg },
|
|
281
|
+
description: { color: colors.fg }
|
|
282
|
+
}),
|
|
283
|
+
/** Declaration order is application order: `radius` overrides the radius `size` set. */
|
|
284
|
+
variants: {
|
|
285
|
+
size: {
|
|
286
|
+
xs: sizeAxis(SIZES.xs),
|
|
287
|
+
sm: sizeAxis(SIZES.sm),
|
|
288
|
+
md: sizeAxis(SIZES.md),
|
|
289
|
+
lg: sizeAxis(SIZES.lg)
|
|
290
|
+
},
|
|
291
|
+
/**
|
|
292
|
+
* Both slots move together, always: the background layer is what clips the image, so
|
|
293
|
+
* a `radius` that moved only the root would round the card and leave its photo square
|
|
294
|
+
* in the corners.
|
|
295
|
+
*/
|
|
296
|
+
radius: {
|
|
297
|
+
xs: corner("xs"),
|
|
298
|
+
sm: corner("sm"),
|
|
299
|
+
md: corner("md"),
|
|
300
|
+
lg: corner("lg"),
|
|
301
|
+
xl: corner("xl"),
|
|
302
|
+
"2xl": corner("2xl"),
|
|
303
|
+
"3xl": corner("3xl"),
|
|
304
|
+
"4xl": corner("4xl"),
|
|
305
|
+
field: corner("field"),
|
|
306
|
+
full: corner("full")
|
|
307
|
+
}
|
|
308
|
+
},
|
|
309
|
+
/**
|
|
310
|
+
* The elevation belongs to the one variant that is a surface standing on the
|
|
311
|
+
* background. `secondary` is the level for a card *inside* a card and `tertiary` and
|
|
312
|
+
* `ghost` have no fill to lift, so a shadow under any of them would read as dirt rather
|
|
313
|
+
* than as height. In dark mode the theme's `surface` shadow is already nothing (§4),
|
|
314
|
+
* which is why this names the role instead of a set of numbers.
|
|
315
|
+
*/
|
|
316
|
+
compoundVariants: [
|
|
317
|
+
{
|
|
318
|
+
when: { variant: "default" },
|
|
319
|
+
style: (theme) => ({ root: theme.shadows.surface })
|
|
320
|
+
}
|
|
321
|
+
],
|
|
322
|
+
states: {
|
|
323
|
+
disabled: (theme) => ({ root: { opacity: theme.opacity.disabled } })
|
|
324
|
+
},
|
|
325
|
+
defaultVariants: { variant: "default", size: "md" }
|
|
326
|
+
});
|
|
327
|
+
|
|
328
|
+
// src/components/card/card.tsx
|
|
329
|
+
|
|
330
|
+
var CardRoot = _react.forwardRef.call(void 0, function Card({
|
|
331
|
+
children,
|
|
332
|
+
variant,
|
|
333
|
+
size,
|
|
334
|
+
radius,
|
|
335
|
+
color,
|
|
336
|
+
isDisabled = false,
|
|
337
|
+
isPressable = false,
|
|
338
|
+
asChild = false,
|
|
339
|
+
accessibilityRole,
|
|
340
|
+
accessibilityState,
|
|
341
|
+
animation,
|
|
342
|
+
style,
|
|
343
|
+
onPressIn,
|
|
344
|
+
onPressOut,
|
|
345
|
+
...props
|
|
346
|
+
}, ref) {
|
|
347
|
+
const theme = _chunk57SJ4LJFcjs.useXAUITheme.call(void 0, );
|
|
348
|
+
const [styleProps, rest] = _chunkHUZ4AUM2cjs.useStyleProps.call(void 0, props);
|
|
349
|
+
const [isPressed, press] = _chunkBH5DSJVXcjs.usePressState.call(void 0, { onPressIn, onPressOut });
|
|
350
|
+
const selection = { variant, size, radius };
|
|
351
|
+
const states = { disabled: isDisabled };
|
|
352
|
+
const styles = cardRecipe.resolve({ theme, selection, states });
|
|
353
|
+
const tint = color ? cardRecipe.tint({ theme, color, selection, states }) : void 0;
|
|
354
|
+
const context = _react.useMemo.call(void 0,
|
|
355
|
+
() => ({
|
|
356
|
+
backgroundStyle: styles.background,
|
|
357
|
+
headerStyle: styles.header,
|
|
358
|
+
bodyStyle: styles.body,
|
|
359
|
+
footerStyle: styles.footer,
|
|
360
|
+
titleStyle: tint ? [styles.title, tint.title] : styles.title,
|
|
361
|
+
descriptionStyle: tint ? [styles.description, tint.description] : styles.description,
|
|
362
|
+
isDisabled
|
|
363
|
+
}),
|
|
364
|
+
[styles, tint, isDisabled]
|
|
365
|
+
);
|
|
366
|
+
const rootStyle = [
|
|
367
|
+
styles.root,
|
|
368
|
+
_optionalChain([tint, 'optionalAccess', _2 => _2.root]),
|
|
369
|
+
styleProps,
|
|
370
|
+
typeof style === "function" ? style({ pressed: isPressed }) : style
|
|
371
|
+
];
|
|
372
|
+
const text = _chunkHUZ4AUM2cjs.childrenToString.call(void 0, children);
|
|
373
|
+
const content = text !== null ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, CardDescription, { children: text }) : children;
|
|
374
|
+
if (!isPressable && !asChild && (onPressIn || onPressOut || rest.onPress || rest.onLongPress)) {
|
|
375
|
+
_chunkBH5DSJVXcjs.warnDev.call(void 0,
|
|
376
|
+
"Card: a press handler needs `isPressable`. Without it the card renders a View, which never receives the touch \u2014 add `isPressable` to make it a control."
|
|
377
|
+
);
|
|
378
|
+
}
|
|
379
|
+
const { background, content: body } = partitionBackground(content);
|
|
380
|
+
const layered = background === null ? body : /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
381
|
+
background,
|
|
382
|
+
body
|
|
383
|
+
] });
|
|
384
|
+
const surface = isPressable ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
385
|
+
_chunkBH5DSJVXcjs.PressableFeedback,
|
|
386
|
+
{
|
|
387
|
+
ref,
|
|
388
|
+
isPressed,
|
|
389
|
+
isDisabled,
|
|
390
|
+
asChild,
|
|
391
|
+
animation,
|
|
392
|
+
accessibilityRole: _nullishCoalesce(accessibilityRole, () => ( "button")),
|
|
393
|
+
accessibilityState: { disabled: isDisabled, ...accessibilityState },
|
|
394
|
+
...rest,
|
|
395
|
+
style: rootStyle,
|
|
396
|
+
onPressIn: press.onPressIn,
|
|
397
|
+
onPressOut: press.onPressOut,
|
|
398
|
+
children: asChild ? children : /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
399
|
+
background,
|
|
400
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBH5DSJVXcjs.PressableFeedback.Highlight, {}),
|
|
401
|
+
body
|
|
402
|
+
] })
|
|
403
|
+
}
|
|
404
|
+
) : asChild ? (
|
|
405
|
+
// R12 — the caller's element is the card, so it takes the children it was written
|
|
406
|
+
// with and the auto-wrap does not apply.
|
|
407
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
408
|
+
_chunkHUZ4AUM2cjs.Slot,
|
|
409
|
+
{
|
|
410
|
+
ref,
|
|
411
|
+
accessibilityRole,
|
|
412
|
+
accessibilityState,
|
|
413
|
+
...rest,
|
|
414
|
+
style: rootStyle,
|
|
415
|
+
children
|
|
416
|
+
}
|
|
417
|
+
)
|
|
418
|
+
) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
419
|
+
_reactnative.View,
|
|
420
|
+
{
|
|
421
|
+
ref,
|
|
422
|
+
accessibilityRole,
|
|
423
|
+
accessibilityState,
|
|
424
|
+
...rest,
|
|
425
|
+
style: rootStyle,
|
|
426
|
+
children: layered
|
|
427
|
+
}
|
|
428
|
+
);
|
|
429
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, CardProvider, { value: context, children: surface });
|
|
430
|
+
});
|
|
431
|
+
CardRoot.displayName = "XAUI.Card.Root";
|
|
432
|
+
|
|
433
|
+
// src/components/card/index.ts
|
|
434
|
+
var Card2 = Object.assign(CardRoot, {
|
|
435
|
+
Background: CardBackground,
|
|
436
|
+
Header: CardHeader,
|
|
437
|
+
Body: CardBody,
|
|
438
|
+
Footer: CardFooter,
|
|
439
|
+
Title: CardTitle,
|
|
440
|
+
Description: CardDescription
|
|
441
|
+
});
|
|
442
|
+
|
|
443
|
+
|
|
444
|
+
|
|
445
|
+
|
|
446
|
+
|
|
447
|
+
|
|
448
|
+
|
|
449
|
+
exports.CARD_BACKGROUND = CARD_BACKGROUND; exports.markBackground = markBackground; exports.useCard = useCard; exports.cardRecipe = cardRecipe; exports.Card = Card2;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
|
|
2
|
+
|
|
3
|
+
var _chunk57SJ4LJFcjs = require('./chunk-57SJ4LJF.cjs');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
var _chunkHUZ4AUM2cjs = require('./chunk-HUZ4AUM2.cjs');
|
|
7
|
+
|
|
8
|
+
// src/system/icon/icon-context.ts
|
|
9
|
+
var _react = require('react');
|
|
10
|
+
var IconContext = _react.createContext.call(void 0, {});
|
|
11
|
+
IconContext.displayName = "XAUI.Icon.Context";
|
|
12
|
+
function useIconContext() {
|
|
13
|
+
return _react.useContext.call(void 0, IconContext);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
// src/system/icon/icon.tsx
|
|
17
|
+
|
|
18
|
+
var _reactnative = require('react-native');
|
|
19
|
+
var _jsxruntime = require('react/jsx-runtime');
|
|
20
|
+
function Icon(props) {
|
|
21
|
+
const inherited = useIconContext();
|
|
22
|
+
const theme = _chunk57SJ4LJFcjs.useXAUITheme.call(void 0, );
|
|
23
|
+
const size = _nullishCoalesce(_nullishCoalesce(props.size, () => ( inherited.size)), () => ( theme.fontSizes.md));
|
|
24
|
+
const color = _nullishCoalesce(_nullishCoalesce(props.color, () => ( inherited.color)), () => ( theme.colors.foreground));
|
|
25
|
+
if (props.as) {
|
|
26
|
+
const Component = props.as;
|
|
27
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Component, { size, color });
|
|
28
|
+
}
|
|
29
|
+
if (_react.isValidElement.call(void 0, props.children)) {
|
|
30
|
+
return _react.cloneElement.call(void 0, props.children, {
|
|
31
|
+
width: size,
|
|
32
|
+
height: size,
|
|
33
|
+
color
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
if (props.source) return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, IconImage, { ...props, resolved: { size, color } });
|
|
37
|
+
throw new Error(
|
|
38
|
+
"XAUI: Icon needs one of `as` (an icon component), a raw SVG element as its child, or `source` (an image). It renders nothing on its own."
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
Icon.displayName = "XAUI.Icon";
|
|
42
|
+
function IconImage({
|
|
43
|
+
source,
|
|
44
|
+
style,
|
|
45
|
+
resolved,
|
|
46
|
+
size: _size,
|
|
47
|
+
color: _color,
|
|
48
|
+
...props
|
|
49
|
+
}) {
|
|
50
|
+
const [styleProps] = _chunkHUZ4AUM2cjs.useStyleProps.call(void 0, props);
|
|
51
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
52
|
+
_reactnative.Image,
|
|
53
|
+
{
|
|
54
|
+
source,
|
|
55
|
+
style: [
|
|
56
|
+
{ width: resolved.size, height: resolved.size, tintColor: resolved.color },
|
|
57
|
+
styleProps,
|
|
58
|
+
style
|
|
59
|
+
]
|
|
60
|
+
}
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
exports.IconContext = IconContext; exports.useIconContext = useIconContext; exports.Icon = Icon;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { Icon
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { Icon } from "./chunk-FVP5FUVS.js";
|
|
2
|
+
import { PressableFeedback, usePressState, warnDev } from "./chunk-KM2TI5IC.js";
|
|
3
|
+
import { createRecipe, radiusAxis } from "./chunk-3JATAB7S.js";
|
|
4
4
|
import { useXAUITheme } from "./chunk-A3EGFI6T.js";
|
|
5
|
+
import { childrenToString, createSlotContext, useStyleProps } from "./chunk-PMO62QK4.js";
|
|
5
6
|
|
|
6
7
|
// src/components/button/button.context.ts
|
|
7
8
|
var [ButtonProvider, useButton] = createSlotContext("Button");
|
|
@@ -72,10 +73,10 @@ function ButtonSpinner({
|
|
|
72
73
|
});
|
|
73
74
|
}
|
|
74
75
|
ButtonSpinner.displayName = "XAUI.Button.Spinner";
|
|
75
|
-
const
|
|
76
|
-
code: "function
|
|
77
|
-
location: "/home/runner/work/xaui/xaui/packages/native/dist/chunk-
|
|
78
|
-
sourceMap: "{\"version\":3,\"names\":[\"
|
|
76
|
+
const _worklet_763735822272_init_data = {
|
|
77
|
+
code: "function chunkFNQF4KQVJs1(){const{angle}=this.__closure;return{transform:[{rotate:angle.value+\"deg\"}]};}",
|
|
78
|
+
location: "/home/runner/work/xaui/xaui/packages/native/dist/chunk-FNQF4KQV.js",
|
|
79
|
+
sourceMap: "{\"version\":3,\"names\":[\"chunkFNQF4KQVJs1\",\"angle\",\"__closure\",\"transform\",\"rotate\",\"value\"],\"sources\":[\"/home/runner/work/xaui/xaui/packages/native/dist/chunk-FNQF4KQV.js\"],\"mappings\":\"AAmFyC,SAAAA,gBAAMA,CAAA,QAAAC,KAAA,OAAAC,SAAA,CAE3C,MAAO,CAAEC,SAAS,CAAE,CAAC,CAAEC,MAAM,CAAKH,KAAK,CAACI,KAAK,MAAM,CAAC,CAAE,CAAC,CACzD\",\"ignoreList\":[]}"
|
|
79
80
|
};
|
|
80
81
|
function SpinningRing({
|
|
81
82
|
style
|
|
@@ -88,28 +89,28 @@ function SpinningRing({
|
|
|
88
89
|
}), -1, false);
|
|
89
90
|
return () => cancelAnimation(angle);
|
|
90
91
|
}, [angle]);
|
|
91
|
-
const animatedStyle = useAnimatedStyle(function
|
|
92
|
-
|
|
92
|
+
const animatedStyle = useAnimatedStyle(function chunkFNQF4KQVJs1Factory({
|
|
93
|
+
_worklet_763735822272_init_data,
|
|
93
94
|
angle
|
|
94
95
|
}) {
|
|
95
96
|
const _e = [new global.Error(), -2, -27];
|
|
96
|
-
const
|
|
97
|
+
const chunkFNQF4KQVJs1 = function () {
|
|
97
98
|
return {
|
|
98
99
|
transform: [{
|
|
99
100
|
rotate: `${angle.value}deg`
|
|
100
101
|
}]
|
|
101
102
|
};
|
|
102
103
|
};
|
|
103
|
-
|
|
104
|
+
chunkFNQF4KQVJs1.__closure = {
|
|
104
105
|
angle
|
|
105
106
|
};
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
return
|
|
107
|
+
chunkFNQF4KQVJs1.__workletHash = 763735822272;
|
|
108
|
+
chunkFNQF4KQVJs1.__pluginVersion = "0.7.4";
|
|
109
|
+
chunkFNQF4KQVJs1.__initData = _worklet_763735822272_init_data;
|
|
110
|
+
chunkFNQF4KQVJs1.__stackDetails = _e;
|
|
111
|
+
return chunkFNQF4KQVJs1;
|
|
111
112
|
}({
|
|
112
|
-
|
|
113
|
+
_worklet_763735822272_init_data,
|
|
113
114
|
angle
|
|
114
115
|
}), [angle]);
|
|
115
116
|
return /* @__PURE__ */jsx3(Animated.View, {
|
|
@@ -121,33 +122,6 @@ function SpinningRing({
|
|
|
121
122
|
import { forwardRef as forwardRef2, useMemo } from "react";
|
|
122
123
|
import { StyleSheet } from "react-native";
|
|
123
124
|
|
|
124
|
-
// src/hooks/use-press-state.ts
|
|
125
|
-
import { useCallback, useRef, useState } from "react";
|
|
126
|
-
function usePressState(handlers = {}) {
|
|
127
|
-
const [isPressed, setIsPressed] = useState(false);
|
|
128
|
-
const latest = useRef(handlers);
|
|
129
|
-
latest.current = handlers;
|
|
130
|
-
const onPressIn = useCallback(event => {
|
|
131
|
-
setIsPressed(true);
|
|
132
|
-
latest.current.onPressIn?.(event);
|
|
133
|
-
}, []);
|
|
134
|
-
const onPressOut = useCallback(event => {
|
|
135
|
-
setIsPressed(false);
|
|
136
|
-
latest.current.onPressOut?.(event);
|
|
137
|
-
}, []);
|
|
138
|
-
const press = useRef({
|
|
139
|
-
onPressIn,
|
|
140
|
-
onPressOut
|
|
141
|
-
}).current;
|
|
142
|
-
return [isPressed, press];
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
// src/utils/warn-dev.ts
|
|
146
|
-
function warnDev(message) {
|
|
147
|
-
if (typeof __DEV__ !== "undefined" && !__DEV__) return;
|
|
148
|
-
console.warn(`XAUI: ${message}`);
|
|
149
|
-
}
|
|
150
|
-
|
|
151
125
|
// src/components/button/button.recipe.ts
|
|
152
126
|
var SLOTS = ["root", "label", "icon", "spinner"];
|
|
153
127
|
var VARIANT_TOKENS = {
|
|
@@ -298,58 +272,7 @@ var buttonRecipe = createRecipe({
|
|
|
298
272
|
radius: "4xl"
|
|
299
273
|
})
|
|
300
274
|
},
|
|
301
|
-
radius:
|
|
302
|
-
xs: t => ({
|
|
303
|
-
root: {
|
|
304
|
-
borderRadius: t.radius.xs
|
|
305
|
-
}
|
|
306
|
-
}),
|
|
307
|
-
sm: t => ({
|
|
308
|
-
root: {
|
|
309
|
-
borderRadius: t.radius.sm
|
|
310
|
-
}
|
|
311
|
-
}),
|
|
312
|
-
md: t => ({
|
|
313
|
-
root: {
|
|
314
|
-
borderRadius: t.radius.md
|
|
315
|
-
}
|
|
316
|
-
}),
|
|
317
|
-
lg: t => ({
|
|
318
|
-
root: {
|
|
319
|
-
borderRadius: t.radius.lg
|
|
320
|
-
}
|
|
321
|
-
}),
|
|
322
|
-
xl: t => ({
|
|
323
|
-
root: {
|
|
324
|
-
borderRadius: t.radius.xl
|
|
325
|
-
}
|
|
326
|
-
}),
|
|
327
|
-
"2xl": t => ({
|
|
328
|
-
root: {
|
|
329
|
-
borderRadius: t.radius["2xl"]
|
|
330
|
-
}
|
|
331
|
-
}),
|
|
332
|
-
"3xl": t => ({
|
|
333
|
-
root: {
|
|
334
|
-
borderRadius: t.radius["3xl"]
|
|
335
|
-
}
|
|
336
|
-
}),
|
|
337
|
-
"4xl": t => ({
|
|
338
|
-
root: {
|
|
339
|
-
borderRadius: t.radius["4xl"]
|
|
340
|
-
}
|
|
341
|
-
}),
|
|
342
|
-
field: t => ({
|
|
343
|
-
root: {
|
|
344
|
-
borderRadius: t.radius.field
|
|
345
|
-
}
|
|
346
|
-
}),
|
|
347
|
-
full: t => ({
|
|
348
|
-
root: {
|
|
349
|
-
borderRadius: t.radius.full
|
|
350
|
-
}
|
|
351
|
-
})
|
|
352
|
-
},
|
|
275
|
+
radius: radiusAxis("root"),
|
|
353
276
|
// A square on a fixed height. No width is computed, and none needs to be.
|
|
354
277
|
isIconOnly: {
|
|
355
278
|
true: () => ({
|
|
@@ -493,4 +416,4 @@ var Button2 = Object.assign(ButtonRoot, {
|
|
|
493
416
|
Icon: ButtonIcon,
|
|
494
417
|
Spinner: ButtonSpinner
|
|
495
418
|
});
|
|
496
|
-
export { useButton,
|
|
419
|
+
export { useButton, buttonRecipe, Button2 as Button };
|