@xaui/native 0.9.1-alpha.4 → 0.9.1-alpha.40

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 (203) hide show
  1. package/dist/chunk-2EGR4LWD.js +145 -0
  2. package/dist/chunk-2NRZKJG7.js +531 -0
  3. package/dist/chunk-2PMXMKS5.js +67 -0
  4. package/dist/chunk-2XPG2243.js +586 -0
  5. package/dist/chunk-36PRYGAM.js +13 -0
  6. package/dist/chunk-3E7CDKFO.cjs +696 -0
  7. package/dist/chunk-3GFRSZYR.js +54 -0
  8. package/dist/chunk-423RQBOX.js +21 -0
  9. package/dist/chunk-4CUZZWFW.js +92 -0
  10. package/dist/chunk-4GTAZM2C.js +174 -0
  11. package/dist/chunk-4KFKWBN5.cjs +89 -0
  12. package/dist/{chunk-3QBT3Q65.cjs → chunk-57SJ4LJF.cjs} +7 -2
  13. package/dist/chunk-5R26NM4M.cjs +402 -0
  14. package/dist/chunk-5VKYNBNA.js +607 -0
  15. package/dist/chunk-64MXEVT3.js +66 -0
  16. package/dist/chunk-6DOLGZVV.cjs +147 -0
  17. package/dist/chunk-6L2TS2R3.cjs +92 -0
  18. package/dist/chunk-6UEZJRVI.js +669 -0
  19. package/dist/chunk-734MFAX4.js +27 -0
  20. package/dist/chunk-73RKQC5X.js +104 -0
  21. package/dist/chunk-7DPL3ZDS.cjs +21 -0
  22. package/dist/chunk-7EIHHOHP.cjs +42 -0
  23. package/dist/chunk-7GHM4GKL.cjs +119 -0
  24. package/dist/chunk-7YF5NAHQ.cjs +74 -0
  25. package/dist/{chunk-X2K2FX3W.js → chunk-A3EGFI6T.js} +6 -1
  26. package/dist/chunk-ABAGZTXZ.cjs +736 -0
  27. package/dist/{chunk-AW63PTQ4.cjs → chunk-ACAPTWE3.cjs} +85 -81
  28. package/dist/chunk-AMCSSOJT.cjs +104 -0
  29. package/dist/chunk-BA2DBSAN.js +102 -0
  30. package/dist/chunk-BRRXFOBY.js +431 -0
  31. package/dist/chunk-C5YLPCFC.cjs +293 -0
  32. package/dist/chunk-DA3OKXHV.cjs +700 -0
  33. package/dist/chunk-DD4276RF.js +366 -0
  34. package/dist/chunk-DG2I4PJG.js +701 -0
  35. package/dist/chunk-DHGLGSH6.js +661 -0
  36. package/dist/chunk-DIBUQ46Y.js +346 -0
  37. package/dist/chunk-EGLLDKN6.js +9 -0
  38. package/dist/chunk-EJQCQPET.cjs +9 -0
  39. package/dist/chunk-EKS3W46M.cjs +66 -0
  40. package/dist/chunk-EZEYMLO3.js +402 -0
  41. package/dist/chunk-F6CQ6CBI.cjs +112 -0
  42. package/dist/chunk-F6W3JQ7K.js +42 -0
  43. package/dist/chunk-FHUYHV6J.js +89 -0
  44. package/dist/chunk-FNEUOBCV.cjs +174 -0
  45. package/dist/chunk-G7P3ERYF.cjs +478 -0
  46. package/dist/chunk-GA6PBWNT.js +147 -0
  47. package/dist/chunk-GFUZ3MUT.cjs +455 -0
  48. package/dist/chunk-GGW43Q37.cjs +1 -0
  49. package/dist/chunk-GTR5X65M.cjs +27 -0
  50. package/dist/chunk-H4E4HDEP.cjs +13 -0
  51. package/dist/chunk-H7DS4IO7.js +198 -0
  52. package/dist/chunk-HDVVZG4S.cjs +198 -0
  53. package/dist/chunk-IKJVLJKT.js +151 -0
  54. package/dist/chunk-J3MB4PI5.cjs +531 -0
  55. package/dist/chunk-K72UDPVN.js +119 -0
  56. package/dist/chunk-KCMYU7WF.js +86 -0
  57. package/dist/chunk-LRN3RNDO.js +940 -0
  58. package/dist/chunk-LTX6TB5I.js +124 -0
  59. package/dist/chunk-LUPCPLND.cjs +145 -0
  60. package/dist/chunk-M63GFNKV.js +194 -0
  61. package/dist/chunk-N3KTZMPG.js +293 -0
  62. package/dist/chunk-NCTOTTVW.js +13 -0
  63. package/dist/chunk-NWGLP6JX.cjs +410 -0
  64. package/dist/chunk-R73XQK7X.cjs +314 -0
  65. package/dist/chunk-RU7JCMWC.cjs +881 -0
  66. package/dist/chunk-SNIHUKDA.cjs +184 -0
  67. package/dist/chunk-T5FV5F7A.cjs +607 -0
  68. package/dist/chunk-TDTUAIFF.cjs +153 -0
  69. package/dist/chunk-TJ74XVZN.cjs +431 -0
  70. package/dist/chunk-TK44VBIE.cjs +194 -0
  71. package/dist/chunk-UAWBAD4E.cjs +346 -0
  72. package/dist/chunk-UFTCTTKK.js +381 -0
  73. package/dist/chunk-WDDXU3OH.cjs +67 -0
  74. package/dist/chunk-WFEMJCXO.cjs +13 -0
  75. package/dist/chunk-WHJTBTYM.js +0 -0
  76. package/dist/{chunk-2KXQATVL.js → chunk-WKCQ6VGW.js} +59 -55
  77. package/dist/chunk-XFPQFCEK.js +455 -0
  78. package/dist/chunk-XSQPVDFH.cjs +60 -0
  79. package/dist/chunk-XTC2SLFT.js +153 -0
  80. package/dist/chunk-XV735BSA.cjs +366 -0
  81. package/dist/chunk-XWNG2U4K.cjs +124 -0
  82. package/dist/chunk-YGYYJ3LQ.js +314 -0
  83. package/dist/chunk-YVHT2UVW.js +74 -0
  84. package/dist/chunk-ZFOOJK37.cjs +86 -0
  85. package/dist/close-button.type-BUYuoSt2.d.ts +36 -0
  86. package/dist/close-button.type-CHsgZ3wO.d.cts +36 -0
  87. package/dist/components/accordion/index.cjs +35 -0
  88. package/dist/components/accordion/index.d.cts +299 -0
  89. package/dist/components/accordion/index.d.ts +299 -0
  90. package/dist/components/accordion/index.js +35 -0
  91. package/dist/components/alert/index.cjs +20 -0
  92. package/dist/components/alert/index.d.cts +169 -0
  93. package/dist/components/alert/index.d.ts +169 -0
  94. package/dist/components/alert/index.js +20 -0
  95. package/dist/components/avatar/index.cjs +16 -0
  96. package/dist/components/avatar/index.d.cts +131 -0
  97. package/dist/components/avatar/index.d.ts +131 -0
  98. package/dist/components/avatar/index.js +16 -0
  99. package/dist/components/badge/index.cjs +15 -0
  100. package/dist/components/badge/index.d.cts +157 -0
  101. package/dist/components/badge/index.d.ts +157 -0
  102. package/dist/components/badge/index.js +15 -0
  103. package/dist/components/button/index.cjs +22 -0
  104. package/dist/components/button/index.d.cts +613 -0
  105. package/dist/components/button/index.d.ts +613 -0
  106. package/dist/components/button/index.js +22 -0
  107. package/dist/components/card/index.cjs +22 -0
  108. package/dist/components/card/index.d.cts +620 -0
  109. package/dist/components/card/index.d.ts +620 -0
  110. package/dist/components/card/index.js +22 -0
  111. package/dist/components/checkbox/index.cjs +26 -0
  112. package/dist/components/checkbox/index.d.cts +1136 -0
  113. package/dist/components/checkbox/index.d.ts +1136 -0
  114. package/dist/components/checkbox/index.js +26 -0
  115. package/dist/components/chip/index.cjs +20 -0
  116. package/dist/components/chip/index.d.cts +608 -0
  117. package/dist/components/chip/index.d.ts +608 -0
  118. package/dist/components/chip/index.js +20 -0
  119. package/dist/components/divider/index.cjs +13 -0
  120. package/dist/components/divider/index.d.cts +117 -0
  121. package/dist/components/divider/index.d.ts +117 -0
  122. package/dist/components/divider/index.js +13 -0
  123. package/dist/components/field-group/index.cjs +27 -0
  124. package/dist/components/field-group/index.d.cts +270 -0
  125. package/dist/components/field-group/index.d.ts +270 -0
  126. package/dist/components/field-group/index.js +27 -0
  127. package/dist/components/input-otp/index.cjs +29 -0
  128. package/dist/components/input-otp/index.d.cts +325 -0
  129. package/dist/components/input-otp/index.d.ts +325 -0
  130. package/dist/components/input-otp/index.js +29 -0
  131. package/dist/components/menu/index.cjs +49 -0
  132. package/dist/components/menu/index.d.cts +351 -0
  133. package/dist/components/menu/index.d.ts +351 -0
  134. package/dist/components/menu/index.js +49 -0
  135. package/dist/components/popover/index.cjs +38 -0
  136. package/dist/components/popover/index.d.cts +254 -0
  137. package/dist/components/popover/index.d.ts +254 -0
  138. package/dist/components/popover/index.js +38 -0
  139. package/dist/components/radio/index.cjs +26 -0
  140. package/dist/components/radio/index.d.cts +1102 -0
  141. package/dist/components/radio/index.d.ts +1102 -0
  142. package/dist/components/radio/index.js +26 -0
  143. package/dist/components/select/index.cjs +50 -0
  144. package/dist/components/select/index.d.cts +498 -0
  145. package/dist/components/select/index.d.ts +498 -0
  146. package/dist/components/select/index.js +50 -0
  147. package/dist/components/skeleton/index.cjs +11 -0
  148. package/dist/components/skeleton/index.d.cts +111 -0
  149. package/dist/components/skeleton/index.d.ts +111 -0
  150. package/dist/components/skeleton/index.js +11 -0
  151. package/dist/components/spinner/index.cjs +17 -0
  152. package/dist/components/spinner/index.d.cts +104 -0
  153. package/dist/components/spinner/index.d.ts +104 -0
  154. package/dist/components/spinner/index.js +17 -0
  155. package/dist/components/switch/index.cjs +27 -0
  156. package/dist/components/switch/index.d.cts +1154 -0
  157. package/dist/components/switch/index.d.ts +1154 -0
  158. package/dist/components/switch/index.js +27 -0
  159. package/dist/components/text-area/index.cjs +14 -0
  160. package/dist/components/text-area/index.d.cts +73 -0
  161. package/dist/components/text-area/index.d.ts +73 -0
  162. package/dist/components/text-area/index.js +14 -0
  163. package/dist/components/text-field/index.cjs +25 -0
  164. package/dist/components/text-field/index.d.cts +205 -0
  165. package/dist/components/text-field/index.d.ts +205 -0
  166. package/dist/components/text-field/index.js +25 -0
  167. package/dist/components/typography/index.cjs +15 -0
  168. package/dist/components/typography/index.d.cts +116 -0
  169. package/dist/components/typography/index.d.ts +116 -0
  170. package/dist/components/typography/index.js +15 -0
  171. package/dist/components/view/index.cjs +17 -0
  172. package/dist/components/view/index.d.cts +152 -0
  173. package/dist/components/view/index.d.ts +152 -0
  174. package/dist/components/view/index.js +17 -0
  175. package/dist/create-recipe-BdVd2ffi.d.ts +114 -0
  176. package/dist/create-recipe-dC7wMfnj.d.cts +114 -0
  177. package/dist/icon.type-Kml72iSz.d.ts +73 -0
  178. package/dist/icon.type-d_i9ma-i.d.cts +73 -0
  179. package/dist/index.cjs +400 -4
  180. package/dist/index.d.cts +118 -4
  181. package/dist/index.d.ts +118 -4
  182. package/dist/index.js +423 -27
  183. package/dist/placement-DHa0Rrh1.d.cts +38 -0
  184. package/dist/placement-DHa0Rrh1.d.ts +38 -0
  185. package/dist/pressable-feedback.type-BA2C9sSz.d.cts +127 -0
  186. package/dist/pressable-feedback.type-Bs4dQlGj.d.ts +127 -0
  187. package/dist/style-props.type-CfnoGEP7.d.cts +31 -0
  188. package/dist/style-props.type-CfnoGEP7.d.ts +31 -0
  189. package/dist/system/index.cjs +73 -4
  190. package/dist/system/index.d.cts +379 -193
  191. package/dist/system/index.d.ts +379 -193
  192. package/dist/system/index.js +87 -18
  193. package/dist/text-field.type-0l73acce.d.ts +167 -0
  194. package/dist/text-field.type-DBh06DU5.d.cts +167 -0
  195. package/dist/theme/index.cjs +5 -3
  196. package/dist/theme/index.d.cts +55 -24
  197. package/dist/theme/index.d.ts +55 -24
  198. package/dist/theme/index.js +4 -2
  199. package/dist/{theme.type-C9bFJKFm.d.cts → theme.type-C2gNHpEx.d.cts} +1 -1
  200. package/dist/{theme.type-C9bFJKFm.d.ts → theme.type-C2gNHpEx.d.ts} +1 -1
  201. package/package.json +254 -18
  202. package/dist/chunk-ECDWSSHJ.js +0 -688
  203. package/dist/chunk-IYFGO523.cjs +0 -688
@@ -0,0 +1,455 @@
1
+ import {
2
+ PressableFeedback
3
+ } from "./chunk-6UEZJRVI.js";
4
+ import {
5
+ usePressState
6
+ } from "./chunk-423RQBOX.js";
7
+ import {
8
+ warnDev
9
+ } from "./chunk-EGLLDKN6.js";
10
+ import {
11
+ createRecipe
12
+ } from "./chunk-4GTAZM2C.js";
13
+ import {
14
+ useXAUITheme
15
+ } from "./chunk-A3EGFI6T.js";
16
+ import {
17
+ Slot,
18
+ childrenToString,
19
+ createSlotContext
20
+ } from "./chunk-K72UDPVN.js";
21
+ import {
22
+ useStyleProps
23
+ } from "./chunk-M63GFNKV.js";
24
+
25
+ // src/components/card/card-background.tsx
26
+ import { forwardRef } from "react";
27
+ import { Image, View } from "react-native";
28
+
29
+ // src/components/card/card.utils.ts
30
+ import { Children, isValidElement } from "react";
31
+ var CARD_BACKGROUND = /* @__PURE__ */ Symbol.for("xaui.Card.background");
32
+ function markBackground(component) {
33
+ return Object.assign(component, { [CARD_BACKGROUND]: true });
34
+ }
35
+ function isBackground(node) {
36
+ if (!isValidElement(node)) return false;
37
+ const type = node.type;
38
+ if (typeof type !== "function" && typeof type !== "object") return false;
39
+ if (type === null) return false;
40
+ return type[CARD_BACKGROUND] === true;
41
+ }
42
+ function partitionBackground(children) {
43
+ const all = Children.toArray(children);
44
+ const index = all.findIndex(isBackground);
45
+ if (index === -1) return { background: null, content: children };
46
+ return {
47
+ background: all[index],
48
+ content: all.filter((_, at) => at !== index)
49
+ };
50
+ }
51
+
52
+ // src/components/card/card.context.ts
53
+ var [CardProvider, useCard] = createSlotContext("Card");
54
+
55
+ // src/components/card/card.style.ts
56
+ import { StyleSheet } from "react-native";
57
+ var cardSheet = StyleSheet.create({
58
+ backgroundImage: { width: "100%", height: "100%" }
59
+ });
60
+
61
+ // src/components/card/card-background.tsx
62
+ import { jsx } from "react/jsx-runtime";
63
+ var CardBackground = markBackground(
64
+ forwardRef(function CardBackground2({ children, source, style, ...props }, ref) {
65
+ const { backgroundStyle } = useCard();
66
+ const [styleProps, rest] = useStyleProps(props);
67
+ return /* @__PURE__ */ jsx(
68
+ View,
69
+ {
70
+ ref,
71
+ accessibilityElementsHidden: true,
72
+ importantForAccessibility: "no-hide-descendants",
73
+ ...rest,
74
+ style: [backgroundStyle, styleProps, style],
75
+ children: source ? /* @__PURE__ */ jsx(Image, { source, style: cardSheet.backgroundImage }) : children
76
+ }
77
+ );
78
+ })
79
+ );
80
+ CardBackground.displayName = "XAUI.Card.Background";
81
+
82
+ // src/components/card/card-body.tsx
83
+ import { forwardRef as forwardRef2 } from "react";
84
+ import { View as View2 } from "react-native";
85
+ import { jsx as jsx2 } from "react/jsx-runtime";
86
+ var CardBody = forwardRef2(function CardBody2({ children, style, ...props }, ref) {
87
+ const { bodyStyle } = useCard();
88
+ const [styleProps, rest] = useStyleProps(props);
89
+ return /* @__PURE__ */ jsx2(View2, { ref, style: [bodyStyle, styleProps, style], ...rest, children });
90
+ });
91
+ CardBody.displayName = "XAUI.Card.Body";
92
+
93
+ // src/components/card/card-description.tsx
94
+ import { forwardRef as forwardRef3 } from "react";
95
+ import { Text } from "react-native";
96
+ import { jsx as jsx3 } from "react/jsx-runtime";
97
+ var CardDescription = forwardRef3(
98
+ function CardDescription2({ children, style, ...props }, ref) {
99
+ const { descriptionStyle } = useCard();
100
+ const [styleProps, rest] = useStyleProps(props);
101
+ return /* @__PURE__ */ jsx3(Text, { ref, style: [descriptionStyle, styleProps, style], ...rest, children });
102
+ }
103
+ );
104
+ CardDescription.displayName = "XAUI.Card.Description";
105
+
106
+ // src/components/card/card-footer.tsx
107
+ import { forwardRef as forwardRef4 } from "react";
108
+ import { View as View3 } from "react-native";
109
+ import { jsx as jsx4 } from "react/jsx-runtime";
110
+ var CardFooter = forwardRef4(function CardFooter2({ children, style, ...props }, ref) {
111
+ const { footerStyle } = useCard();
112
+ const [styleProps, rest] = useStyleProps(props);
113
+ return /* @__PURE__ */ jsx4(View3, { ref, style: [footerStyle, styleProps, style], ...rest, children });
114
+ });
115
+ CardFooter.displayName = "XAUI.Card.Footer";
116
+
117
+ // src/components/card/card-header.tsx
118
+ import { forwardRef as forwardRef5 } from "react";
119
+ import { View as View4 } from "react-native";
120
+ import { jsx as jsx5 } from "react/jsx-runtime";
121
+ var CardHeader = forwardRef5(function CardHeader2({ children, style, ...props }, ref) {
122
+ const { headerStyle } = useCard();
123
+ const [styleProps, rest] = useStyleProps(props);
124
+ return /* @__PURE__ */ jsx5(View4, { ref, style: [headerStyle, styleProps, style], ...rest, children });
125
+ });
126
+ CardHeader.displayName = "XAUI.Card.Header";
127
+
128
+ // src/components/card/card-title.tsx
129
+ import { forwardRef as forwardRef6 } from "react";
130
+ import { Text as Text2 } from "react-native";
131
+ import { jsx as jsx6 } from "react/jsx-runtime";
132
+ var CardTitle = forwardRef6(function CardTitle2({ children, style, ...props }, ref) {
133
+ const { titleStyle } = useCard();
134
+ const [styleProps, rest] = useStyleProps(props);
135
+ return /* @__PURE__ */ jsx6(Text2, { ref, style: [titleStyle, styleProps, style], ...rest, children });
136
+ });
137
+ CardTitle.displayName = "XAUI.Card.Title";
138
+
139
+ // src/components/card/card.tsx
140
+ import { forwardRef as forwardRef7, useMemo } from "react";
141
+ import { View as View5 } from "react-native";
142
+
143
+ // src/components/card/card.recipe.ts
144
+ var SLOTS = [
145
+ "root",
146
+ "background",
147
+ "header",
148
+ "body",
149
+ "footer",
150
+ "title",
151
+ "description"
152
+ ];
153
+ var VARIANT_TOKENS = {
154
+ default: { bg: "surface", fg: "surfaceForeground" },
155
+ secondary: { bg: "surfaceSecondary", fg: "surfaceSecondaryForeground" },
156
+ tertiary: { border: "border", fg: "foreground" },
157
+ ghost: { fg: "foreground" }
158
+ };
159
+ var DESCRIPTION_OPACITY = 0.6;
160
+ function sizeAxis(step) {
161
+ const { padding, gap, contentGap, radius, title, description } = step;
162
+ return (theme) => ({
163
+ root: {
164
+ padding: theme.spacing(padding),
165
+ gap: theme.spacing(gap),
166
+ borderRadius: theme.radius[radius]
167
+ },
168
+ // The same corner as the root, because this layer is what clips the image — the root
169
+ // deliberately does not (see `base`), so the radius has to be repeated where the
170
+ // `overflow` is.
171
+ background: { borderRadius: theme.radius[radius] },
172
+ header: { gap: theme.spacing(contentGap) },
173
+ body: { gap: theme.spacing(contentGap) },
174
+ footer: { gap: theme.spacing(contentGap) },
175
+ title: {
176
+ fontSize: theme.fontSizes[title],
177
+ lineHeight: theme.lineHeights[title]
178
+ },
179
+ description: {
180
+ fontSize: theme.fontSizes[description],
181
+ lineHeight: theme.lineHeights[description]
182
+ }
183
+ });
184
+ }
185
+ var SIZES = {
186
+ xs: {
187
+ padding: 3,
188
+ gap: 2,
189
+ contentGap: 1,
190
+ radius: "lg",
191
+ title: "sm",
192
+ description: "xs"
193
+ },
194
+ sm: {
195
+ padding: 3.5,
196
+ gap: 3,
197
+ contentGap: 1,
198
+ radius: "xl",
199
+ title: "md",
200
+ description: "sm"
201
+ },
202
+ md: {
203
+ padding: 4,
204
+ gap: 4,
205
+ contentGap: 1,
206
+ radius: "2xl",
207
+ title: "lg",
208
+ description: "md"
209
+ },
210
+ lg: {
211
+ padding: 5,
212
+ gap: 5,
213
+ contentGap: 1.5,
214
+ radius: "3xl",
215
+ title: "xl",
216
+ description: "lg"
217
+ }
218
+ };
219
+ function corner(key) {
220
+ return (theme) => ({
221
+ root: { borderRadius: theme.radius[key] },
222
+ background: { borderRadius: theme.radius[key] }
223
+ });
224
+ }
225
+ var cardRecipe = createRecipe({
226
+ slots: SLOTS,
227
+ base: (theme) => ({
228
+ root: {
229
+ flexDirection: "column",
230
+ borderWidth: 0,
231
+ // iOS's squircle. Free on Android, and it is what makes a card's radius read as a
232
+ // shape rather than as four arcs meeting straight edges.
233
+ borderCurve: "continuous"
234
+ // Deliberately no `overflow: 'hidden'`: on iOS it clips the node's own shadow, so
235
+ // a `default` card would lose the elevation the variant just gave it. The press
236
+ // wash rounds itself off the root's corners and needs no clip; a caller bleeding an
237
+ // image to the edges writes `overflow="hidden"` and takes the trade knowingly.
238
+ },
239
+ // R13 — `start` and `end`, never `left` and `right`, even at zero. `overflow` lives
240
+ // here rather than on the root: on iOS it clips the node's own shadow, and a `default`
241
+ // card would lose the elevation its variant just gave it.
242
+ background: {
243
+ position: "absolute",
244
+ top: 0,
245
+ bottom: 0,
246
+ start: 0,
247
+ end: 0,
248
+ overflow: "hidden"
249
+ },
250
+ // Top-aligned content — a badge, an icon, a title block. A column pinned to the
251
+ // leading edge, which RTL mirrors on its own; `flexDirection="row"` is one prop away
252
+ // for a header that puts an action at the far end.
253
+ header: { alignItems: "flex-start" },
254
+ // `flexGrow` and not `flex: 1`. `flex: 1` also sets `flexBasis: 0`, and in a card
255
+ // whose height comes from its content that measures the body as empty before there
256
+ // is any free space to give back to it — the collapse is silent and total.
257
+ body: { flexGrow: 1 },
258
+ // A footer is an action row: the one section whose common case is horizontal, so it
259
+ // is the one section that is a row by default.
260
+ footer: { flexDirection: "row", alignItems: "center" },
261
+ // `medium`, not `semibold`. A card's title sits in prose rather than on a control:
262
+ // one weight above the description is enough to rank them, and the heavier step reads
263
+ // as a section heading the card did not ask for.
264
+ title: {
265
+ fontFamily: theme.fontFamilies.heading,
266
+ fontWeight: theme.fontWeights.medium
267
+ },
268
+ description: {
269
+ fontFamily: theme.fontFamilies.body,
270
+ fontWeight: theme.fontWeights.regular,
271
+ opacity: DESCRIPTION_OPACITY
272
+ }
273
+ }),
274
+ variantTokens: VARIANT_TOKENS,
275
+ /**
276
+ * Where the variant's colours land, for every variant at once. The border width follows
277
+ * the *presence* of the border role, so `ghost` needs no rule of its own to say it has
278
+ * no edge.
279
+ */
280
+ paint: (theme, colors) => ({
281
+ root: {
282
+ backgroundColor: colors.bg,
283
+ borderColor: colors.border,
284
+ borderWidth: colors.border ? theme.borderWidth.default : 0
285
+ },
286
+ title: { color: colors.fg },
287
+ description: { color: colors.fg }
288
+ }),
289
+ /** Declaration order is application order: `radius` overrides the radius `size` set. */
290
+ variants: {
291
+ size: {
292
+ xs: sizeAxis(SIZES.xs),
293
+ sm: sizeAxis(SIZES.sm),
294
+ md: sizeAxis(SIZES.md),
295
+ lg: sizeAxis(SIZES.lg)
296
+ },
297
+ /**
298
+ * Both slots move together, always: the background layer is what clips the image, so
299
+ * a `radius` that moved only the root would round the card and leave its photo square
300
+ * in the corners.
301
+ */
302
+ radius: {
303
+ xs: corner("xs"),
304
+ sm: corner("sm"),
305
+ md: corner("md"),
306
+ lg: corner("lg"),
307
+ xl: corner("xl"),
308
+ "2xl": corner("2xl"),
309
+ "3xl": corner("3xl"),
310
+ "4xl": corner("4xl"),
311
+ field: corner("field"),
312
+ full: corner("full")
313
+ }
314
+ },
315
+ /**
316
+ * The elevation belongs to the one variant that is a surface standing on the
317
+ * background. `secondary` is the level for a card *inside* a card and `tertiary` and
318
+ * `ghost` have no fill to lift, so a shadow under any of them would read as dirt rather
319
+ * than as height. In dark mode the theme's `surface` shadow is already nothing (§4),
320
+ * which is why this names the role instead of a set of numbers.
321
+ */
322
+ compoundVariants: [
323
+ {
324
+ when: { variant: "default" },
325
+ style: (theme) => ({ root: theme.shadows.surface })
326
+ }
327
+ ],
328
+ states: {
329
+ disabled: (theme) => ({ root: { opacity: theme.opacity.disabled } })
330
+ },
331
+ defaultVariants: { variant: "default", size: "md" }
332
+ });
333
+
334
+ // src/components/card/card.tsx
335
+ import { Fragment, jsx as jsx7, jsxs } from "react/jsx-runtime";
336
+ var CardRoot = forwardRef7(function Card({
337
+ children,
338
+ variant,
339
+ size,
340
+ radius,
341
+ color,
342
+ isDisabled = false,
343
+ isPressable = false,
344
+ asChild = false,
345
+ accessibilityRole,
346
+ accessibilityState,
347
+ animation,
348
+ style,
349
+ onPressIn,
350
+ onPressOut,
351
+ ...props
352
+ }, ref) {
353
+ const theme = useXAUITheme();
354
+ const [styleProps, rest] = useStyleProps(props);
355
+ const [isPressed, press] = usePressState({ onPressIn, onPressOut });
356
+ const selection = { variant, size, radius };
357
+ const states = { disabled: isDisabled };
358
+ const styles = cardRecipe.resolve({ theme, selection, states });
359
+ const tint = color ? cardRecipe.tint({ theme, color, selection, states }) : void 0;
360
+ const context = useMemo(
361
+ () => ({
362
+ backgroundStyle: styles.background,
363
+ headerStyle: styles.header,
364
+ bodyStyle: styles.body,
365
+ footerStyle: styles.footer,
366
+ titleStyle: tint ? [styles.title, tint.title] : styles.title,
367
+ descriptionStyle: tint ? [styles.description, tint.description] : styles.description,
368
+ isDisabled
369
+ }),
370
+ [styles, tint, isDisabled]
371
+ );
372
+ const rootStyle = [
373
+ styles.root,
374
+ tint?.root,
375
+ styleProps,
376
+ typeof style === "function" ? style({ pressed: isPressed }) : style
377
+ ];
378
+ const text = childrenToString(children);
379
+ const content = text !== null ? /* @__PURE__ */ jsx7(CardDescription, { children: text }) : children;
380
+ if (!isPressable && !asChild && (onPressIn || onPressOut || rest.onPress || rest.onLongPress)) {
381
+ warnDev(
382
+ "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."
383
+ );
384
+ }
385
+ const { background, content: body } = partitionBackground(content);
386
+ const layered = background === null ? body : /* @__PURE__ */ jsxs(Fragment, { children: [
387
+ background,
388
+ body
389
+ ] });
390
+ const surface = isPressable ? /* @__PURE__ */ jsx7(
391
+ PressableFeedback,
392
+ {
393
+ ref,
394
+ isPressed,
395
+ isDisabled,
396
+ asChild,
397
+ animation,
398
+ accessibilityRole: accessibilityRole ?? "button",
399
+ accessibilityState: { disabled: isDisabled, ...accessibilityState },
400
+ ...rest,
401
+ style: rootStyle,
402
+ onPressIn: press.onPressIn,
403
+ onPressOut: press.onPressOut,
404
+ children: asChild ? children : /* @__PURE__ */ jsxs(Fragment, { children: [
405
+ background,
406
+ /* @__PURE__ */ jsx7(PressableFeedback.Highlight, {}),
407
+ body
408
+ ] })
409
+ }
410
+ ) : asChild ? (
411
+ // R12 — the caller's element is the card, so it takes the children it was written
412
+ // with and the auto-wrap does not apply.
413
+ /* @__PURE__ */ jsx7(
414
+ Slot,
415
+ {
416
+ ref,
417
+ accessibilityRole,
418
+ accessibilityState,
419
+ ...rest,
420
+ style: rootStyle,
421
+ children
422
+ }
423
+ )
424
+ ) : /* @__PURE__ */ jsx7(
425
+ View5,
426
+ {
427
+ ref,
428
+ accessibilityRole,
429
+ accessibilityState,
430
+ ...rest,
431
+ style: rootStyle,
432
+ children: layered
433
+ }
434
+ );
435
+ return /* @__PURE__ */ jsx7(CardProvider, { value: context, children: surface });
436
+ });
437
+ CardRoot.displayName = "XAUI.Card.Root";
438
+
439
+ // src/components/card/index.ts
440
+ var Card2 = Object.assign(CardRoot, {
441
+ Background: CardBackground,
442
+ Header: CardHeader,
443
+ Body: CardBody,
444
+ Footer: CardFooter,
445
+ Title: CardTitle,
446
+ Description: CardDescription
447
+ });
448
+
449
+ export {
450
+ CARD_BACKGROUND,
451
+ markBackground,
452
+ useCard,
453
+ cardRecipe,
454
+ Card2 as Card
455
+ };
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ }); // src/hooks/use-previous.ts
6
+ var _react = require('react');
7
+ function usePrevious(value) {
8
+ const previous = _react.useRef.call(void 0, void 0);
9
+ _react.useEffect.call(void 0, () => {
10
+ previous.current = value;
11
+ }, [value]);
12
+ return previous.current;
13
+ }
14
+
15
+ // src/hooks/use-rotation.ts
16
+
17
+ var _reactnativereanimated = require('react-native-reanimated');
18
+ var ROTATION_DURATION = 900;
19
+ const _worklet_15909689137170_init_data = {
20
+ code: "function chunkXSQPVDFHCjs1(){const{angle}=this.__closure;return{transform:[{rotate:angle.value+\"deg\"}]};}",
21
+ location: "/home/runner/work/xaui/xaui/packages/native/dist/chunk-XSQPVDFH.cjs",
22
+ sourceMap: "{\"version\":3,\"names\":[\"chunkXSQPVDFHCjs1\",\"angle\",\"__closure\",\"transform\",\"rotate\",\"value\"],\"sources\":[\"/home/runner/work/xaui/xaui/packages/native/dist/chunk-XSQPVDFH.cjs\"],\"mappings\":\"AA+B8D,SAAAA,iBAAMA,CAAA,QAAAC,KAAA,OAAAC,SAAA,CAEhE,MAAO,CAAEC,SAAS,CAAE,CAAC,CAAEC,MAAM,CAAKH,KAAK,CAACI,KAAK,MAAM,CAAC,CAAE,CAAC,CACzD\",\"ignoreList\":[]}"
23
+ };
24
+ function useRotation() {
25
+ const angle = _reactnativereanimated.useSharedValue.call(void 0, 0);
26
+ _react.useEffect.call(void 0, () => {
27
+ angle.value = _reactnativereanimated.withRepeat.call(void 0, _reactnativereanimated.withTiming.call(void 0, 360, {
28
+ duration: ROTATION_DURATION,
29
+ easing: _reactnativereanimated.Easing.linear
30
+ }), -1, false);
31
+ return () => _reactnativereanimated.cancelAnimation.call(void 0, angle);
32
+ }, [angle]);
33
+ return _reactnativereanimated.useAnimatedStyle.call(void 0, function chunkXSQPVDFHCjs1Factory({
34
+ _worklet_15909689137170_init_data,
35
+ angle
36
+ }) {
37
+ const _e = [new global.Error(), -2, -27];
38
+ const chunkXSQPVDFHCjs1 = function () {
39
+ return {
40
+ transform: [{
41
+ rotate: `${angle.value}deg`
42
+ }]
43
+ };
44
+ };
45
+ chunkXSQPVDFHCjs1.__closure = {
46
+ angle
47
+ };
48
+ chunkXSQPVDFHCjs1.__workletHash = 15909689137170;
49
+ chunkXSQPVDFHCjs1.__pluginVersion = "0.7.4";
50
+ chunkXSQPVDFHCjs1.__initData = _worklet_15909689137170_init_data;
51
+ chunkXSQPVDFHCjs1.__stackDetails = _e;
52
+ return chunkXSQPVDFHCjs1;
53
+ }({
54
+ _worklet_15909689137170_init_data,
55
+ angle
56
+ }), [angle]);
57
+ }
58
+ exports.usePrevious = usePrevious;
59
+ exports.ROTATION_DURATION = ROTATION_DURATION;
60
+ exports.useRotation = useRotation;
@@ -0,0 +1,153 @@
1
+ import {
2
+ Slot
3
+ } from "./chunk-K72UDPVN.js";
4
+ import {
5
+ useStyleProps
6
+ } from "./chunk-M63GFNKV.js";
7
+
8
+ // src/components/view/grid.tsx
9
+ import { Children, forwardRef, useMemo, useState } from "react";
10
+ import { View } from "react-native";
11
+
12
+ // src/components/view/grid.context.ts
13
+ import { createContext, useContext } from "react";
14
+ var GridContext = createContext(null);
15
+ var GridProvider = GridContext.Provider;
16
+ function useGrid() {
17
+ const value = useContext(GridContext);
18
+ if (value === null) {
19
+ throw new Error(
20
+ "XAUI: Grid.Item must be rendered inside a Grid \u2014 it spans that grid\u2019s columns, and outside one there is nothing to span."
21
+ );
22
+ }
23
+ return value;
24
+ }
25
+ function spanWidth({ cellWidth, columns, gap }, span) {
26
+ const clamped = Math.min(Math.max(Math.floor(span), 1), columns);
27
+ if (cellWidth === void 0) return `${100 / columns * clamped}%`;
28
+ return cellWidth * clamped + gap * (clamped - 1);
29
+ }
30
+
31
+ // src/components/view/grid.tsx
32
+ import { jsx } from "react/jsx-runtime";
33
+ var GridRoot = forwardRef(function Grid({ children, columns = 2, gap = 0, style, onLayout, ...props }, ref) {
34
+ const [width, setWidth] = useState();
35
+ const [styleProps, rest] = useStyleProps(props);
36
+ const safeColumns = Math.max(Math.floor(columns), 1);
37
+ const cellWidth = width === void 0 ? void 0 : (width - gap * (safeColumns - 1)) / safeColumns;
38
+ const context = useMemo(
39
+ () => ({ cellWidth, columns: safeColumns, gap }),
40
+ [cellWidth, safeColumns, gap]
41
+ );
42
+ const handleLayout = (event) => {
43
+ const next = event.nativeEvent.layout.width;
44
+ if (next > 0 && next !== width) setWidth(next);
45
+ onLayout?.(event);
46
+ };
47
+ return /* @__PURE__ */ jsx(GridProvider, { value: context, children: /* @__PURE__ */ jsx(
48
+ View,
49
+ {
50
+ ref,
51
+ onLayout: handleLayout,
52
+ style: [
53
+ { flexDirection: "row", flexWrap: "wrap", rowGap: gap, columnGap: gap },
54
+ styleProps,
55
+ style
56
+ ],
57
+ ...rest,
58
+ children: Children.map(
59
+ children,
60
+ (child) => isGridItem(child) ? child : /* @__PURE__ */ jsx(View, { style: { width: spanWidth(context, 1) }, children: child })
61
+ )
62
+ }
63
+ ) });
64
+ });
65
+ GridRoot.displayName = "XAUI.Grid";
66
+ function isGridItem(child) {
67
+ if (child === null || typeof child !== "object") return false;
68
+ const type = child.type;
69
+ return type?.displayName === "XAUI.Grid.Item";
70
+ }
71
+
72
+ // src/components/view/grid-item.tsx
73
+ import { forwardRef as forwardRef2 } from "react";
74
+ import { View as View2 } from "react-native";
75
+ import { jsx as jsx2 } from "react/jsx-runtime";
76
+ var GridItem = forwardRef2(function GridItem2({ children, span = 1, style, ...props }, ref) {
77
+ const grid = useGrid();
78
+ const [styleProps, rest] = useStyleProps(props);
79
+ return /* @__PURE__ */ jsx2(
80
+ View2,
81
+ {
82
+ ref,
83
+ style: [{ width: spanWidth(grid, span) }, styleProps, style],
84
+ ...rest,
85
+ children
86
+ }
87
+ );
88
+ });
89
+ GridItem.displayName = "XAUI.Grid.Item";
90
+
91
+ // src/components/view/stack.tsx
92
+ import { forwardRef as forwardRef3 } from "react";
93
+ import { View as View3 } from "react-native";
94
+ import { jsx as jsx3 } from "react/jsx-runtime";
95
+ var StackRoot = forwardRef3(function Stack({ children, asChild = false, style, ...props }, ref) {
96
+ const [styleProps, rest] = useStyleProps(props);
97
+ const Root = asChild ? Slot : View3;
98
+ return /* @__PURE__ */ jsx3(Root, { ref, style: [{ position: "relative" }, styleProps, style], ...rest, children });
99
+ });
100
+ StackRoot.displayName = "XAUI.Stack";
101
+
102
+ // src/components/view/stack-item.tsx
103
+ import { forwardRef as forwardRef4 } from "react";
104
+ import { View as View4 } from "react-native";
105
+ import { jsx as jsx4 } from "react/jsx-runtime";
106
+ var StackItem = forwardRef4(function StackItem2({ children, asChild = false, style, ...props }, ref) {
107
+ const [styleProps, rest] = useStyleProps(props);
108
+ const Root = asChild ? Slot : View4;
109
+ return /* @__PURE__ */ jsx4(Root, { ref, style: [{ position: "absolute" }, styleProps, style], ...rest, children });
110
+ });
111
+ StackItem.displayName = "XAUI.Stack.Item";
112
+
113
+ // src/components/view/row.tsx
114
+ import { forwardRef as forwardRef5 } from "react";
115
+ import { View as View5 } from "react-native";
116
+ import { jsx as jsx5 } from "react/jsx-runtime";
117
+ var Row = forwardRef5(function Row2({ children, asChild = false, style, ...props }, ref) {
118
+ const [styleProps, rest] = useStyleProps(props);
119
+ const Root = asChild ? Slot : View5;
120
+ return /* @__PURE__ */ jsx5(Root, { ref, style: [{ flexDirection: "row" }, styleProps, style], ...rest, children });
121
+ });
122
+ Row.displayName = "XAUI.Row";
123
+
124
+ // src/components/view/column.tsx
125
+ import { forwardRef as forwardRef6 } from "react";
126
+ import { View as View6 } from "react-native";
127
+ import { jsx as jsx6 } from "react/jsx-runtime";
128
+ var Column = forwardRef6(function Column2({ children, asChild = false, style, ...props }, ref) {
129
+ const [styleProps, rest] = useStyleProps(props);
130
+ const Root = asChild ? Slot : View6;
131
+ return /* @__PURE__ */ jsx6(
132
+ Root,
133
+ {
134
+ ref,
135
+ style: [{ flexDirection: "column" }, styleProps, style],
136
+ ...rest,
137
+ children
138
+ }
139
+ );
140
+ });
141
+ Column.displayName = "XAUI.Column";
142
+
143
+ // src/components/view/index.ts
144
+ var Stack2 = Object.assign(StackRoot, { Item: StackItem });
145
+ var Grid2 = Object.assign(GridRoot, { Item: GridItem });
146
+
147
+ export {
148
+ useGrid,
149
+ Row,
150
+ Column,
151
+ Stack2 as Stack,
152
+ Grid2 as Grid
153
+ };