@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.
Files changed (73) hide show
  1. package/dist/{chunk-RMLFMRWL.js → chunk-2U6JR7BF.js} +5 -5
  2. package/dist/{chunk-N7C4UNUL.js → chunk-3JATAB7S.js} +23 -1
  3. package/dist/chunk-4MHJOWM4.cjs +364 -0
  4. package/dist/{chunk-2WMVDMFV.cjs → chunk-6HXWQ5AU.cjs} +2 -2
  5. package/dist/chunk-6WW4CSPY.cjs +82 -0
  6. package/dist/chunk-AHL33YAO.js +425 -0
  7. package/dist/{chunk-XHZBXYVU.js → chunk-AKXG43S4.js} +1 -1
  8. package/dist/{chunk-A4VD4MHK.cjs → chunk-BH5DSJVX.cjs} +100 -133
  9. package/dist/chunk-BNWS26PX.cjs +449 -0
  10. package/dist/chunk-DXGQ43IV.cjs +68 -0
  11. package/dist/{chunk-4EPS7UBO.js → chunk-FNQF4KQV.js} +20 -97
  12. package/dist/chunk-FTCTTBLG.js +449 -0
  13. package/dist/chunk-FVP5FUVS.js +68 -0
  14. package/dist/{chunk-BHTFIZTQ.cjs → chunk-GBPWTFTU.cjs} +11 -11
  15. package/dist/{chunk-MWXE7D4L.js → chunk-GG2WWCBK.js} +11 -11
  16. package/dist/{chunk-EVXZGNPA.cjs → chunk-HUZ4AUM2.cjs} +98 -98
  17. package/dist/chunk-I6PE5UUH.cjs +425 -0
  18. package/dist/{chunk-33QILJJH.cjs → chunk-IBEX4XGV.cjs} +11 -11
  19. package/dist/{chunk-WXAME7KB.js → chunk-KM2TI5IC.js} +126 -159
  20. package/dist/chunk-OGC4RKE3.js +364 -0
  21. package/dist/{chunk-JXLRHKCQ.js → chunk-OYZYWWJ6.js} +1 -1
  22. package/dist/{chunk-EXX6ATAS.js → chunk-PMO62QK4.js} +101 -101
  23. package/dist/{chunk-UBA6AEY6.cjs → chunk-RAWOJ3N3.cjs} +8 -8
  24. package/dist/{chunk-6ARON3XT.cjs → chunk-VDRRD6GM.cjs} +31 -110
  25. package/dist/{chunk-UVO4GFSW.cjs → chunk-YXVKQMCK.cjs} +23 -1
  26. package/dist/chunk-ZQ3JSWRO.js +82 -0
  27. package/dist/close-button.type-BUYuoSt2.d.ts +36 -0
  28. package/dist/close-button.type-CHsgZ3wO.d.cts +36 -0
  29. package/dist/components/alert/index.cjs +17 -0
  30. package/dist/components/alert/index.d.cts +169 -0
  31. package/dist/components/alert/index.d.ts +169 -0
  32. package/dist/components/alert/index.js +17 -0
  33. package/dist/components/button/index.cjs +6 -5
  34. package/dist/components/button/index.d.cts +193 -243
  35. package/dist/components/button/index.d.ts +193 -243
  36. package/dist/components/button/index.js +5 -4
  37. package/dist/components/card/index.cjs +19 -0
  38. package/dist/components/card/index.d.cts +620 -0
  39. package/dist/components/card/index.d.ts +620 -0
  40. package/dist/components/card/index.js +19 -0
  41. package/dist/components/chip/index.cjs +17 -0
  42. package/dist/components/chip/index.d.cts +608 -0
  43. package/dist/components/chip/index.d.ts +608 -0
  44. package/dist/components/chip/index.js +17 -0
  45. package/dist/components/typography/index.cjs +4 -4
  46. package/dist/components/typography/index.d.cts +4 -4
  47. package/dist/components/typography/index.d.ts +4 -4
  48. package/dist/components/typography/index.js +3 -3
  49. package/dist/components/view/index.cjs +3 -3
  50. package/dist/components/view/index.d.cts +7 -7
  51. package/dist/components/view/index.d.ts +7 -7
  52. package/dist/components/view/index.js +2 -2
  53. package/dist/{create-recipe-CPXFo2rk.d.ts → create-recipe-CbXika57.d.ts} +7 -1
  54. package/dist/{create-recipe-C0XXjuow.d.cts → create-recipe-jHlk434p.d.cts} +7 -1
  55. package/dist/icon.type-CF4KiMKl.d.cts +73 -0
  56. package/dist/icon.type-Dq4_qePa.d.ts +73 -0
  57. package/dist/index.cjs +49 -11
  58. package/dist/index.d.cts +9 -4
  59. package/dist/index.d.ts +9 -4
  60. package/dist/index.js +71 -33
  61. package/dist/{pressable-feedback.type-BwkKLQlX.d.ts → pressable-feedback.type-BA2C9sSz.d.cts} +4 -72
  62. package/dist/{pressable-feedback.type-1K8YEOb8.d.cts → pressable-feedback.type-Bs4dQlGj.d.ts} +4 -72
  63. package/dist/{style-props.type-B1BG5TCm.d.cts → style-props.type-CfnoGEP7.d.cts} +1 -1
  64. package/dist/{style-props.type-B1BG5TCm.d.ts → style-props.type-CfnoGEP7.d.ts} +1 -1
  65. package/dist/system/index.cjs +16 -6
  66. package/dist/system/index.d.cts +174 -98
  67. package/dist/system/index.d.ts +174 -98
  68. package/dist/system/index.js +20 -10
  69. package/dist/theme/index.cjs +2 -2
  70. package/dist/theme/index.d.cts +11 -11
  71. package/dist/theme/index.d.ts +11 -11
  72. package/dist/theme/index.js +1 -1
  73. package/package.json +31 -1
@@ -0,0 +1,449 @@
1
+ import {
2
+ PressableFeedback,
3
+ usePressState,
4
+ warnDev
5
+ } from "./chunk-KM2TI5IC.js";
6
+ import {
7
+ createRecipe
8
+ } from "./chunk-3JATAB7S.js";
9
+ import {
10
+ useXAUITheme
11
+ } from "./chunk-A3EGFI6T.js";
12
+ import {
13
+ Slot,
14
+ childrenToString,
15
+ createSlotContext,
16
+ useStyleProps
17
+ } from "./chunk-PMO62QK4.js";
18
+
19
+ // src/components/card/card-background.tsx
20
+ import { forwardRef } from "react";
21
+ import { Image, View } from "react-native";
22
+
23
+ // src/components/card/card.utils.ts
24
+ import { Children, isValidElement } from "react";
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 (!isValidElement(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 = 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] = createSlotContext("Card");
48
+
49
+ // src/components/card/card.style.ts
50
+ import { StyleSheet } from "react-native";
51
+ var cardSheet = StyleSheet.create({
52
+ backgroundImage: { width: "100%", height: "100%" }
53
+ });
54
+
55
+ // src/components/card/card-background.tsx
56
+ import { jsx } from "react/jsx-runtime";
57
+ var CardBackground = markBackground(
58
+ forwardRef(function CardBackground2({ children, source, style, ...props }, ref) {
59
+ const { backgroundStyle } = useCard();
60
+ const [styleProps, rest] = useStyleProps(props);
61
+ return /* @__PURE__ */ jsx(
62
+ View,
63
+ {
64
+ ref,
65
+ accessibilityElementsHidden: true,
66
+ importantForAccessibility: "no-hide-descendants",
67
+ ...rest,
68
+ style: [backgroundStyle, styleProps, style],
69
+ children: source ? /* @__PURE__ */ jsx(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
+ import { forwardRef as forwardRef2 } from "react";
78
+ import { View as View2 } from "react-native";
79
+ import { jsx as jsx2 } from "react/jsx-runtime";
80
+ var CardBody = forwardRef2(function CardBody2({ children, style, ...props }, ref) {
81
+ const { bodyStyle } = useCard();
82
+ const [styleProps, rest] = useStyleProps(props);
83
+ return /* @__PURE__ */ jsx2(View2, { ref, style: [bodyStyle, styleProps, style], ...rest, children });
84
+ });
85
+ CardBody.displayName = "XAUI.Card.Body";
86
+
87
+ // src/components/card/card-description.tsx
88
+ import { forwardRef as forwardRef3 } from "react";
89
+ import { Text } from "react-native";
90
+ import { jsx as jsx3 } from "react/jsx-runtime";
91
+ var CardDescription = forwardRef3(
92
+ function CardDescription2({ children, style, ...props }, ref) {
93
+ const { descriptionStyle } = useCard();
94
+ const [styleProps, rest] = useStyleProps(props);
95
+ return /* @__PURE__ */ jsx3(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
+ import { forwardRef as forwardRef4 } from "react";
102
+ import { View as View3 } from "react-native";
103
+ import { jsx as jsx4 } from "react/jsx-runtime";
104
+ var CardFooter = forwardRef4(function CardFooter2({ children, style, ...props }, ref) {
105
+ const { footerStyle } = useCard();
106
+ const [styleProps, rest] = useStyleProps(props);
107
+ return /* @__PURE__ */ jsx4(View3, { ref, style: [footerStyle, styleProps, style], ...rest, children });
108
+ });
109
+ CardFooter.displayName = "XAUI.Card.Footer";
110
+
111
+ // src/components/card/card-header.tsx
112
+ import { forwardRef as forwardRef5 } from "react";
113
+ import { View as View4 } from "react-native";
114
+ import { jsx as jsx5 } from "react/jsx-runtime";
115
+ var CardHeader = forwardRef5(function CardHeader2({ children, style, ...props }, ref) {
116
+ const { headerStyle } = useCard();
117
+ const [styleProps, rest] = useStyleProps(props);
118
+ return /* @__PURE__ */ jsx5(View4, { ref, style: [headerStyle, styleProps, style], ...rest, children });
119
+ });
120
+ CardHeader.displayName = "XAUI.Card.Header";
121
+
122
+ // src/components/card/card-title.tsx
123
+ import { forwardRef as forwardRef6 } from "react";
124
+ import { Text as Text2 } from "react-native";
125
+ import { jsx as jsx6 } from "react/jsx-runtime";
126
+ var CardTitle = forwardRef6(function CardTitle2({ children, style, ...props }, ref) {
127
+ const { titleStyle } = useCard();
128
+ const [styleProps, rest] = useStyleProps(props);
129
+ return /* @__PURE__ */ jsx6(Text2, { ref, style: [titleStyle, styleProps, style], ...rest, children });
130
+ });
131
+ CardTitle.displayName = "XAUI.Card.Title";
132
+
133
+ // src/components/card/card.tsx
134
+ import { forwardRef as forwardRef7, useMemo } from "react";
135
+ import { View as View5 } from "react-native";
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 = createRecipe({
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
+ import { Fragment, jsx as jsx7, jsxs } from "react/jsx-runtime";
330
+ var CardRoot = forwardRef7(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 = useXAUITheme();
348
+ const [styleProps, rest] = useStyleProps(props);
349
+ const [isPressed, press] = usePressState({ 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 = useMemo(
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
+ tint?.root,
369
+ styleProps,
370
+ typeof style === "function" ? style({ pressed: isPressed }) : style
371
+ ];
372
+ const text = childrenToString(children);
373
+ const content = text !== null ? /* @__PURE__ */ jsx7(CardDescription, { children: text }) : children;
374
+ if (!isPressable && !asChild && (onPressIn || onPressOut || rest.onPress || rest.onLongPress)) {
375
+ warnDev(
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__ */ jsxs(Fragment, { children: [
381
+ background,
382
+ body
383
+ ] });
384
+ const surface = isPressable ? /* @__PURE__ */ jsx7(
385
+ PressableFeedback,
386
+ {
387
+ ref,
388
+ isPressed,
389
+ isDisabled,
390
+ asChild,
391
+ animation,
392
+ accessibilityRole: 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__ */ jsxs(Fragment, { children: [
399
+ background,
400
+ /* @__PURE__ */ jsx7(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__ */ jsx7(
408
+ Slot,
409
+ {
410
+ ref,
411
+ accessibilityRole,
412
+ accessibilityState,
413
+ ...rest,
414
+ style: rootStyle,
415
+ children
416
+ }
417
+ )
418
+ ) : /* @__PURE__ */ jsx7(
419
+ View5,
420
+ {
421
+ ref,
422
+ accessibilityRole,
423
+ accessibilityState,
424
+ ...rest,
425
+ style: rootStyle,
426
+ children: layered
427
+ }
428
+ );
429
+ return /* @__PURE__ */ jsx7(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
+ export {
444
+ CARD_BACKGROUND,
445
+ markBackground,
446
+ useCard,
447
+ cardRecipe,
448
+ Card2 as Card
449
+ };
@@ -0,0 +1,68 @@
1
+ import {
2
+ useXAUITheme
3
+ } from "./chunk-A3EGFI6T.js";
4
+ import {
5
+ useStyleProps
6
+ } from "./chunk-PMO62QK4.js";
7
+
8
+ // src/system/icon/icon-context.ts
9
+ import { createContext, useContext } from "react";
10
+ var IconContext = createContext({});
11
+ IconContext.displayName = "XAUI.Icon.Context";
12
+ function useIconContext() {
13
+ return useContext(IconContext);
14
+ }
15
+
16
+ // src/system/icon/icon.tsx
17
+ import { cloneElement, isValidElement } from "react";
18
+ import { Image } from "react-native";
19
+ import { jsx } from "react/jsx-runtime";
20
+ function Icon(props) {
21
+ const inherited = useIconContext();
22
+ const theme = useXAUITheme();
23
+ const size = props.size ?? inherited.size ?? theme.fontSizes.md;
24
+ const color = props.color ?? inherited.color ?? theme.colors.foreground;
25
+ if (props.as) {
26
+ const Component = props.as;
27
+ return /* @__PURE__ */ jsx(Component, { size, color });
28
+ }
29
+ if (isValidElement(props.children)) {
30
+ return cloneElement(props.children, {
31
+ width: size,
32
+ height: size,
33
+ color
34
+ });
35
+ }
36
+ if (props.source) return /* @__PURE__ */ jsx(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] = useStyleProps(props);
51
+ return /* @__PURE__ */ jsx(
52
+ 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
+ export {
65
+ IconContext,
66
+ useIconContext,
67
+ Icon
68
+ };
@@ -161,7 +161,7 @@ var tokens = {
161
161
  foreground: "#18181b",
162
162
  surface: "#ffffff",
163
163
  surfaceForeground: "#18181b",
164
- surfaceSecondary: "#f4f4f5",
164
+ surfaceSecondary: "#ececee",
165
165
  surfaceSecondaryForeground: "#18181b",
166
166
  surfaceTertiary: "#e4e4e7",
167
167
  surfaceTertiaryForeground: "#18181b",
@@ -179,7 +179,7 @@ var tokens = {
179
179
  fieldBorder: "#e4e4e7",
180
180
  success: "#15803d",
181
181
  successForeground: "#fafafa",
182
- warning: "#b45309",
182
+ warning: "#c2410c",
183
183
  warningForeground: "#fafafa",
184
184
  danger: "#dc2626",
185
185
  dangerForeground: "#fafafa",
@@ -191,7 +191,7 @@ var tokens = {
191
191
  link: "#18181b",
192
192
  accentPressed: "#8533d3",
193
193
  successPressed: "#1b753a",
194
- warningPressed: "#a34d13",
194
+ warningPressed: "#af3e15",
195
195
  dangerPressed: "#c72927",
196
196
  defaultPressed: "#dbdbde",
197
197
  surfacePressed: "#eaeaea",
@@ -204,9 +204,9 @@ var tokens = {
204
204
  successSoft: "rgba(21, 128, 61, 0.15)",
205
205
  successSoftForeground: "#205f34",
206
206
  successSoftPressed: "rgba(21, 128, 61, 0.2)",
207
- warningSoft: "rgba(180, 83, 9, 0.15)",
208
- warningSoftForeground: "#793f1e",
209
- warningSoftPressed: "rgba(180, 83, 9, 0.2)",
207
+ warningSoft: "rgba(194, 65, 12, 0.15)",
208
+ warningSoftForeground: "#82361e",
209
+ warningSoftPressed: "rgba(194, 65, 12, 0.2)",
210
210
  dangerSoft: "rgba(220, 38, 38, 0.15)",
211
211
  dangerSoftForeground: "#b22b28",
212
212
  dangerSoftPressed: "rgba(220, 38, 38, 0.2)",
@@ -249,7 +249,7 @@ var tokens = {
249
249
  fieldBorder: "#3f3f46",
250
250
  success: "#4ade80",
251
251
  successForeground: "#18181b",
252
- warning: "#fbbf24",
252
+ warning: "#fb923c",
253
253
  warningForeground: "#18181b",
254
254
  danger: "#f87171",
255
255
  dangerForeground: "#18181b",
@@ -261,7 +261,7 @@ var tokens = {
261
261
  link: "#fafafa",
262
262
  accentPressed: "#c691fd",
263
263
  successPressed: "#64e18d",
264
- warningPressed: "#fbc54b",
264
+ warningPressed: "#fc9d55",
265
265
  dangerPressed: "#fa807e",
266
266
  defaultPressed: "#2e2e31",
267
267
  surfacePressed: "#27272a",
@@ -274,9 +274,9 @@ var tokens = {
274
274
  successSoft: "rgba(74, 222, 128, 0.15)",
275
275
  successSoftForeground: "#8de8a6",
276
276
  successSoftPressed: "rgba(74, 222, 128, 0.2)",
277
- warningSoft: "rgba(251, 191, 36, 0.15)",
278
- warningSoftForeground: "#fbd586",
279
- warningSoftPressed: "rgba(251, 191, 36, 0.2)",
277
+ warningSoft: "rgba(251, 146, 60, 0.15)",
278
+ warningSoftForeground: "#feb887",
279
+ warningSoftPressed: "rgba(251, 146, 60, 0.2)",
280
280
  dangerSoft: "rgba(248, 113, 113, 0.15)",
281
281
  dangerSoftForeground: "#fc8f8c",
282
282
  dangerSoftPressed: "rgba(248, 113, 113, 0.2)",
@@ -161,7 +161,7 @@ var tokens = {
161
161
  foreground: "#18181b",
162
162
  surface: "#ffffff",
163
163
  surfaceForeground: "#18181b",
164
- surfaceSecondary: "#f4f4f5",
164
+ surfaceSecondary: "#ececee",
165
165
  surfaceSecondaryForeground: "#18181b",
166
166
  surfaceTertiary: "#e4e4e7",
167
167
  surfaceTertiaryForeground: "#18181b",
@@ -179,7 +179,7 @@ var tokens = {
179
179
  fieldBorder: "#e4e4e7",
180
180
  success: "#15803d",
181
181
  successForeground: "#fafafa",
182
- warning: "#b45309",
182
+ warning: "#c2410c",
183
183
  warningForeground: "#fafafa",
184
184
  danger: "#dc2626",
185
185
  dangerForeground: "#fafafa",
@@ -191,7 +191,7 @@ var tokens = {
191
191
  link: "#18181b",
192
192
  accentPressed: "#8533d3",
193
193
  successPressed: "#1b753a",
194
- warningPressed: "#a34d13",
194
+ warningPressed: "#af3e15",
195
195
  dangerPressed: "#c72927",
196
196
  defaultPressed: "#dbdbde",
197
197
  surfacePressed: "#eaeaea",
@@ -204,9 +204,9 @@ var tokens = {
204
204
  successSoft: "rgba(21, 128, 61, 0.15)",
205
205
  successSoftForeground: "#205f34",
206
206
  successSoftPressed: "rgba(21, 128, 61, 0.2)",
207
- warningSoft: "rgba(180, 83, 9, 0.15)",
208
- warningSoftForeground: "#793f1e",
209
- warningSoftPressed: "rgba(180, 83, 9, 0.2)",
207
+ warningSoft: "rgba(194, 65, 12, 0.15)",
208
+ warningSoftForeground: "#82361e",
209
+ warningSoftPressed: "rgba(194, 65, 12, 0.2)",
210
210
  dangerSoft: "rgba(220, 38, 38, 0.15)",
211
211
  dangerSoftForeground: "#b22b28",
212
212
  dangerSoftPressed: "rgba(220, 38, 38, 0.2)",
@@ -249,7 +249,7 @@ var tokens = {
249
249
  fieldBorder: "#3f3f46",
250
250
  success: "#4ade80",
251
251
  successForeground: "#18181b",
252
- warning: "#fbbf24",
252
+ warning: "#fb923c",
253
253
  warningForeground: "#18181b",
254
254
  danger: "#f87171",
255
255
  dangerForeground: "#18181b",
@@ -261,7 +261,7 @@ var tokens = {
261
261
  link: "#fafafa",
262
262
  accentPressed: "#c691fd",
263
263
  successPressed: "#64e18d",
264
- warningPressed: "#fbc54b",
264
+ warningPressed: "#fc9d55",
265
265
  dangerPressed: "#fa807e",
266
266
  defaultPressed: "#2e2e31",
267
267
  surfacePressed: "#27272a",
@@ -274,9 +274,9 @@ var tokens = {
274
274
  successSoft: "rgba(74, 222, 128, 0.15)",
275
275
  successSoftForeground: "#8de8a6",
276
276
  successSoftPressed: "rgba(74, 222, 128, 0.2)",
277
- warningSoft: "rgba(251, 191, 36, 0.15)",
278
- warningSoftForeground: "#fbd586",
279
- warningSoftPressed: "rgba(251, 191, 36, 0.2)",
277
+ warningSoft: "rgba(251, 146, 60, 0.15)",
278
+ warningSoftForeground: "#feb887",
279
+ warningSoftPressed: "rgba(251, 146, 60, 0.2)",
280
280
  dangerSoft: "rgba(248, 113, 113, 0.15)",
281
281
  dangerSoftForeground: "#fc8f8c",
282
282
  dangerSoftPressed: "rgba(248, 113, 113, 0.2)",