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