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

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 (209) 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-G3CCT4EY.js +518 -0
  46. package/dist/chunk-G7P3ERYF.cjs +478 -0
  47. package/dist/chunk-GA6PBWNT.js +147 -0
  48. package/dist/chunk-GFUZ3MUT.cjs +455 -0
  49. package/dist/chunk-GGW43Q37.cjs +1 -0
  50. package/dist/chunk-GTR5X65M.cjs +27 -0
  51. package/dist/chunk-H4E4HDEP.cjs +13 -0
  52. package/dist/chunk-H7DS4IO7.js +198 -0
  53. package/dist/chunk-HDVVZG4S.cjs +198 -0
  54. package/dist/chunk-IKJVLJKT.js +151 -0
  55. package/dist/chunk-J3MB4PI5.cjs +531 -0
  56. package/dist/chunk-K72UDPVN.js +119 -0
  57. package/dist/chunk-KCMYU7WF.js +86 -0
  58. package/dist/chunk-LRN3RNDO.js +940 -0
  59. package/dist/chunk-LTX6TB5I.js +124 -0
  60. package/dist/chunk-LUPCPLND.cjs +145 -0
  61. package/dist/chunk-M63GFNKV.js +194 -0
  62. package/dist/chunk-N3KTZMPG.js +293 -0
  63. package/dist/chunk-NCTOTTVW.js +13 -0
  64. package/dist/chunk-NWGLP6JX.cjs +410 -0
  65. package/dist/chunk-R73XQK7X.cjs +314 -0
  66. package/dist/chunk-RU7JCMWC.cjs +881 -0
  67. package/dist/chunk-SNIHUKDA.cjs +184 -0
  68. package/dist/chunk-T5FV5F7A.cjs +607 -0
  69. package/dist/chunk-TDTUAIFF.cjs +153 -0
  70. package/dist/chunk-TJ74XVZN.cjs +431 -0
  71. package/dist/chunk-TK44VBIE.cjs +194 -0
  72. package/dist/chunk-UAWBAD4E.cjs +346 -0
  73. package/dist/chunk-UFTCTTKK.js +381 -0
  74. package/dist/chunk-VLKBESEV.cjs +407 -0
  75. package/dist/chunk-WDDXU3OH.cjs +67 -0
  76. package/dist/chunk-WFEMJCXO.cjs +13 -0
  77. package/dist/chunk-WHJTBTYM.js +0 -0
  78. package/dist/{chunk-2KXQATVL.js → chunk-WKCQ6VGW.js} +59 -55
  79. package/dist/chunk-XFPQFCEK.js +455 -0
  80. package/dist/chunk-XSQPVDFH.cjs +60 -0
  81. package/dist/chunk-XTC2SLFT.js +153 -0
  82. package/dist/chunk-XV735BSA.cjs +366 -0
  83. package/dist/chunk-XWNG2U4K.cjs +124 -0
  84. package/dist/chunk-YGYYJ3LQ.js +314 -0
  85. package/dist/chunk-YVHT2UVW.js +74 -0
  86. package/dist/chunk-ZFOOJK37.cjs +86 -0
  87. package/dist/close-button.type-BUYuoSt2.d.ts +36 -0
  88. package/dist/close-button.type-CHsgZ3wO.d.cts +36 -0
  89. package/dist/components/accordion/index.cjs +35 -0
  90. package/dist/components/accordion/index.d.cts +299 -0
  91. package/dist/components/accordion/index.d.ts +299 -0
  92. package/dist/components/accordion/index.js +35 -0
  93. package/dist/components/alert/index.cjs +20 -0
  94. package/dist/components/alert/index.d.cts +169 -0
  95. package/dist/components/alert/index.d.ts +169 -0
  96. package/dist/components/alert/index.js +20 -0
  97. package/dist/components/avatar/index.cjs +16 -0
  98. package/dist/components/avatar/index.d.cts +131 -0
  99. package/dist/components/avatar/index.d.ts +131 -0
  100. package/dist/components/avatar/index.js +16 -0
  101. package/dist/components/badge/index.cjs +15 -0
  102. package/dist/components/badge/index.d.cts +157 -0
  103. package/dist/components/badge/index.d.ts +157 -0
  104. package/dist/components/badge/index.js +15 -0
  105. package/dist/components/button/index.cjs +22 -0
  106. package/dist/components/button/index.d.cts +613 -0
  107. package/dist/components/button/index.d.ts +613 -0
  108. package/dist/components/button/index.js +22 -0
  109. package/dist/components/card/index.cjs +22 -0
  110. package/dist/components/card/index.d.cts +620 -0
  111. package/dist/components/card/index.d.ts +620 -0
  112. package/dist/components/card/index.js +22 -0
  113. package/dist/components/checkbox/index.cjs +26 -0
  114. package/dist/components/checkbox/index.d.cts +1136 -0
  115. package/dist/components/checkbox/index.d.ts +1136 -0
  116. package/dist/components/checkbox/index.js +26 -0
  117. package/dist/components/chip/index.cjs +20 -0
  118. package/dist/components/chip/index.d.cts +608 -0
  119. package/dist/components/chip/index.d.ts +608 -0
  120. package/dist/components/chip/index.js +20 -0
  121. package/dist/components/divider/index.cjs +13 -0
  122. package/dist/components/divider/index.d.cts +117 -0
  123. package/dist/components/divider/index.d.ts +117 -0
  124. package/dist/components/divider/index.js +13 -0
  125. package/dist/components/field-group/index.cjs +27 -0
  126. package/dist/components/field-group/index.d.cts +270 -0
  127. package/dist/components/field-group/index.d.ts +270 -0
  128. package/dist/components/field-group/index.js +27 -0
  129. package/dist/components/input-otp/index.cjs +29 -0
  130. package/dist/components/input-otp/index.d.cts +325 -0
  131. package/dist/components/input-otp/index.d.ts +325 -0
  132. package/dist/components/input-otp/index.js +29 -0
  133. package/dist/components/menu/index.cjs +49 -0
  134. package/dist/components/menu/index.d.cts +351 -0
  135. package/dist/components/menu/index.d.ts +351 -0
  136. package/dist/components/menu/index.js +49 -0
  137. package/dist/components/popover/index.cjs +38 -0
  138. package/dist/components/popover/index.d.cts +254 -0
  139. package/dist/components/popover/index.d.ts +254 -0
  140. package/dist/components/popover/index.js +38 -0
  141. package/dist/components/radio/index.cjs +26 -0
  142. package/dist/components/radio/index.d.cts +1102 -0
  143. package/dist/components/radio/index.d.ts +1102 -0
  144. package/dist/components/radio/index.js +26 -0
  145. package/dist/components/select/index.cjs +50 -0
  146. package/dist/components/select/index.d.cts +498 -0
  147. package/dist/components/select/index.d.ts +498 -0
  148. package/dist/components/select/index.js +50 -0
  149. package/dist/components/skeleton/index.cjs +11 -0
  150. package/dist/components/skeleton/index.d.cts +111 -0
  151. package/dist/components/skeleton/index.d.ts +111 -0
  152. package/dist/components/skeleton/index.js +11 -0
  153. package/dist/components/spinner/index.cjs +17 -0
  154. package/dist/components/spinner/index.d.cts +104 -0
  155. package/dist/components/spinner/index.d.ts +104 -0
  156. package/dist/components/spinner/index.js +17 -0
  157. package/dist/components/switch/index.cjs +27 -0
  158. package/dist/components/switch/index.d.cts +1154 -0
  159. package/dist/components/switch/index.d.ts +1154 -0
  160. package/dist/components/switch/index.js +27 -0
  161. package/dist/components/tabs/index.cjs +33 -0
  162. package/dist/components/tabs/index.d.cts +261 -0
  163. package/dist/components/tabs/index.d.ts +261 -0
  164. package/dist/components/tabs/index.js +33 -0
  165. package/dist/components/text-area/index.cjs +14 -0
  166. package/dist/components/text-area/index.d.cts +73 -0
  167. package/dist/components/text-area/index.d.ts +73 -0
  168. package/dist/components/text-area/index.js +14 -0
  169. package/dist/components/text-field/index.cjs +25 -0
  170. package/dist/components/text-field/index.d.cts +205 -0
  171. package/dist/components/text-field/index.d.ts +205 -0
  172. package/dist/components/text-field/index.js +25 -0
  173. package/dist/components/typography/index.cjs +15 -0
  174. package/dist/components/typography/index.d.cts +116 -0
  175. package/dist/components/typography/index.d.ts +116 -0
  176. package/dist/components/typography/index.js +15 -0
  177. package/dist/components/view/index.cjs +17 -0
  178. package/dist/components/view/index.d.cts +152 -0
  179. package/dist/components/view/index.d.ts +152 -0
  180. package/dist/components/view/index.js +17 -0
  181. package/dist/create-recipe-BdVd2ffi.d.ts +114 -0
  182. package/dist/create-recipe-dC7wMfnj.d.cts +114 -0
  183. package/dist/icon.type-Kml72iSz.d.ts +73 -0
  184. package/dist/icon.type-d_i9ma-i.d.cts +73 -0
  185. package/dist/index.cjs +423 -5
  186. package/dist/index.d.cts +119 -4
  187. package/dist/index.d.ts +119 -4
  188. package/dist/index.js +445 -27
  189. package/dist/placement-DHa0Rrh1.d.cts +38 -0
  190. package/dist/placement-DHa0Rrh1.d.ts +38 -0
  191. package/dist/pressable-feedback.type-BA2C9sSz.d.cts +127 -0
  192. package/dist/pressable-feedback.type-Bs4dQlGj.d.ts +127 -0
  193. package/dist/style-props.type-CfnoGEP7.d.cts +31 -0
  194. package/dist/style-props.type-CfnoGEP7.d.ts +31 -0
  195. package/dist/system/index.cjs +73 -4
  196. package/dist/system/index.d.cts +379 -193
  197. package/dist/system/index.d.ts +379 -193
  198. package/dist/system/index.js +87 -18
  199. package/dist/text-field.type-0l73acce.d.ts +167 -0
  200. package/dist/text-field.type-DBh06DU5.d.cts +167 -0
  201. package/dist/theme/index.cjs +5 -3
  202. package/dist/theme/index.d.cts +55 -24
  203. package/dist/theme/index.d.ts +55 -24
  204. package/dist/theme/index.js +4 -2
  205. package/dist/{theme.type-C9bFJKFm.d.cts → theme.type-C2gNHpEx.d.cts} +1 -1
  206. package/dist/{theme.type-C9bFJKFm.d.ts → theme.type-C2gNHpEx.d.ts} +1 -1
  207. package/package.json +264 -18
  208. package/dist/chunk-ECDWSSHJ.js +0 -688
  209. package/dist/chunk-IYFGO523.cjs +0 -688
@@ -1,36 +1,25 @@
1
+ import {
2
+ PortalHost
3
+ } from "./chunk-2PMXMKS5.js";
1
4
  import {
2
5
  ThemeContext,
3
6
  alpha,
4
7
  mix
5
- } from "./chunk-X2K2FX3W.js";
8
+ } from "./chunk-A3EGFI6T.js";
9
+ import {
10
+ stableHash
11
+ } from "./chunk-M63GFNKV.js";
6
12
 
7
13
  // src/provider/xaui-provider.tsx
8
14
  import { useColorScheme } from "react-native";
9
15
 
10
- // src/utils/stable-hash.ts
11
- function canonical(value) {
12
- if (value === null || typeof value !== "object") return JSON.stringify(value) ?? "null";
13
- if (Array.isArray(value)) return `[${value.map(canonical).join(",")}]`;
14
- const entries = Object.entries(value).filter(([, v]) => typeof v !== "function").sort(([a], [b]) => a < b ? -1 : 1).map(([k, v]) => `${JSON.stringify(k)}:${canonical(v)}`);
15
- return `{${entries.join(",")}}`;
16
- }
17
- function stableHash(value) {
18
- const input = canonical(value);
19
- let hash = 2166136261;
20
- for (let i = 0; i < input.length; i++) {
21
- hash ^= input.charCodeAt(i);
22
- hash = Math.imul(hash, 16777619) >>> 0;
23
- }
24
- return hash.toString(36);
25
- }
26
-
27
16
  // src/theme/derive-colors.ts
28
17
  function deriveColors(s) {
29
18
  return {
30
- accentPressed: mix(s.accent, s.accentForeground, 0.1),
31
- successPressed: mix(s.success, s.successForeground, 0.1),
32
- warningPressed: mix(s.warning, s.warningForeground, 0.1),
33
- dangerPressed: mix(s.danger, s.dangerForeground, 0.1),
19
+ accentPressed: mix(s.accent, s.foreground, 0.1),
20
+ successPressed: mix(s.success, s.foreground, 0.1),
21
+ warningPressed: mix(s.warning, s.foreground, 0.1),
22
+ dangerPressed: mix(s.danger, s.foreground, 0.1),
34
23
  defaultPressed: mix(s.default, s.defaultForeground, 0.04),
35
24
  surfacePressed: mix(s.surface, s.surfaceForeground, 0.08),
36
25
  defaultSoft: alpha(s.default, 0.5),
@@ -63,6 +52,7 @@ function deriveColors(s) {
63
52
  }
64
53
 
65
54
  // src/theme/scales.ts
55
+ import { Platform } from "react-native";
66
56
  var SPACING_UNIT = 4;
67
57
  var RADIUS_BASE = 12;
68
58
  function buildRadius(base) {
@@ -75,7 +65,16 @@ function buildRadius(base) {
75
65
  "2xl": base * 2,
76
66
  "3xl": base * 3,
77
67
  "4xl": base * 4,
78
- field: base * 1.75,
68
+ /**
69
+ * HeroUI's value, reached from the other side of the scale: their `--radius-field` is
70
+ * an alias of their `--radius-xl`, and their base is 8 where ours is 12 — so their
71
+ * field corner is 12 points and, at our default base, so is this.
72
+ *
73
+ * It coincides with `lg` today and is still its own key, because that is what lets a
74
+ * theme round its fields without rounding its cards. It was `base * 1.75`, which put a
75
+ * 48-tall field at 87% of its geometric maximum — a gélule rather than a rounded box.
76
+ */
77
+ field: base,
79
78
  full: 9999
80
79
  };
81
80
  }
@@ -114,7 +113,10 @@ var fontWeights = {
114
113
  var fontFamilies = {
115
114
  body: "System",
116
115
  heading: "System",
117
- mono: "monospace"
116
+ // `'monospace'` is an Android family name, not a generic one: iOS does not resolve it and
117
+ // silently falls back to the system face, so code set with it is not monospaced there.
118
+ // Menlo is the face iOS ships, and it is what HeroUI Native selects for the same reason.
119
+ mono: Platform.OS === "ios" ? "Menlo" : "monospace"
118
120
  };
119
121
  var borderWidth = { default: 1, field: 1 };
120
122
  var opacity = { disabled: 0.5 };
@@ -131,10 +133,10 @@ function buildShadows(mode) {
131
133
  surface: noShadow,
132
134
  overlay: {
133
135
  shadowColor: "#000000",
134
- shadowOffset: { width: 0, height: 8 },
135
- shadowOpacity: 0.6,
136
- shadowRadius: 24,
137
- elevation: 16
136
+ shadowOffset: { width: 0, height: 4 },
137
+ shadowOpacity: 0.45,
138
+ shadowRadius: 16,
139
+ elevation: 8
138
140
  },
139
141
  field: noShadow
140
142
  };
@@ -149,10 +151,10 @@ function buildShadows(mode) {
149
151
  },
150
152
  overlay: {
151
153
  shadowColor: "#000000",
152
- shadowOffset: { width: 0, height: 8 },
153
- shadowOpacity: 0.14,
154
- shadowRadius: 24,
155
- elevation: 16
154
+ shadowOffset: { width: 0, height: 4 },
155
+ shadowOpacity: 0.1,
156
+ shadowRadius: 16,
157
+ elevation: 8
156
158
  },
157
159
  field: {
158
160
  shadowColor: "#000000",
@@ -171,7 +173,7 @@ var tokens = {
171
173
  foreground: "#18181b",
172
174
  surface: "#ffffff",
173
175
  surfaceForeground: "#18181b",
174
- surfaceSecondary: "#f4f4f5",
176
+ surfaceSecondary: "#ececee",
175
177
  surfaceSecondaryForeground: "#18181b",
176
178
  surfaceTertiary: "#e4e4e7",
177
179
  surfaceTertiaryForeground: "#18181b",
@@ -179,7 +181,7 @@ var tokens = {
179
181
  overlayForeground: "#18181b",
180
182
  backdrop: "rgba(0, 0, 0, 0.2)",
181
183
  muted: "#71717a",
182
- default: "#f4f4f5",
184
+ default: "#e4e4e7",
183
185
  defaultForeground: "#18181b",
184
186
  accent: "#9333ea",
185
187
  accentForeground: "#faf5ff",
@@ -189,7 +191,7 @@ var tokens = {
189
191
  fieldBorder: "#e4e4e7",
190
192
  success: "#15803d",
191
193
  successForeground: "#fafafa",
192
- warning: "#b45309",
194
+ warning: "#c2410c",
193
195
  warningForeground: "#fafafa",
194
196
  danger: "#dc2626",
195
197
  dangerForeground: "#fafafa",
@@ -199,24 +201,24 @@ var tokens = {
199
201
  separator: "#d4d4d8",
200
202
  focus: "#9333ea",
201
203
  link: "#18181b",
202
- accentPressed: "#9c4eee",
203
- successPressed: "#378c50",
204
- warningPressed: "#bd642f",
205
- dangerPressed: "#e2473f",
206
- defaultPressed: "#eaeaeb",
204
+ accentPressed: "#8533d3",
205
+ successPressed: "#1b753a",
206
+ warningPressed: "#af3e15",
207
+ dangerPressed: "#c72927",
208
+ defaultPressed: "#dbdbde",
207
209
  surfacePressed: "#eaeaea",
208
- defaultSoft: "rgba(244, 244, 245, 0.5)",
210
+ defaultSoft: "rgba(228, 228, 231, 0.5)",
209
211
  defaultSoftForeground: "#18181b",
210
- defaultSoftPressed: "rgba(244, 244, 245, 0.6)",
212
+ defaultSoftPressed: "rgba(228, 228, 231, 0.6)",
211
213
  accentSoft: "rgba(147, 51, 234, 0.15)",
212
214
  accentSoftForeground: "#7833bc",
213
215
  accentSoftPressed: "rgba(147, 51, 234, 0.2)",
214
216
  successSoft: "rgba(21, 128, 61, 0.15)",
215
217
  successSoftForeground: "#205f34",
216
218
  successSoftPressed: "rgba(21, 128, 61, 0.2)",
217
- warningSoft: "rgba(180, 83, 9, 0.15)",
218
- warningSoftForeground: "#793f1e",
219
- warningSoftPressed: "rgba(180, 83, 9, 0.2)",
219
+ warningSoft: "rgba(194, 65, 12, 0.15)",
220
+ warningSoftForeground: "#82361e",
221
+ warningSoftPressed: "rgba(194, 65, 12, 0.2)",
220
222
  dangerSoft: "rgba(220, 38, 38, 0.15)",
221
223
  dangerSoftForeground: "#b22b28",
222
224
  dangerSoftPressed: "rgba(220, 38, 38, 0.2)",
@@ -259,7 +261,7 @@ var tokens = {
259
261
  fieldBorder: "#3f3f46",
260
262
  success: "#4ade80",
261
263
  successForeground: "#18181b",
262
- warning: "#fbbf24",
264
+ warning: "#fb923c",
263
265
  warningForeground: "#18181b",
264
266
  danger: "#f87171",
265
267
  dangerForeground: "#18181b",
@@ -269,10 +271,10 @@ var tokens = {
269
271
  separator: "#52525b",
270
272
  focus: "#c084fc",
271
273
  link: "#fafafa",
272
- accentPressed: "#ad78e3",
273
- successPressed: "#47c875",
274
- warningPressed: "#e1ac2b",
275
- dangerPressed: "#df6868",
274
+ accentPressed: "#c691fd",
275
+ successPressed: "#64e18d",
276
+ warningPressed: "#fc9d55",
277
+ dangerPressed: "#fa807e",
276
278
  defaultPressed: "#2e2e31",
277
279
  surfacePressed: "#27272a",
278
280
  defaultSoft: "rgba(39, 39, 42, 0.5)",
@@ -284,9 +286,9 @@ var tokens = {
284
286
  successSoft: "rgba(74, 222, 128, 0.15)",
285
287
  successSoftForeground: "#8de8a6",
286
288
  successSoftPressed: "rgba(74, 222, 128, 0.2)",
287
- warningSoft: "rgba(251, 191, 36, 0.15)",
288
- warningSoftForeground: "#fbd586",
289
- warningSoftPressed: "rgba(251, 191, 36, 0.2)",
289
+ warningSoft: "rgba(251, 146, 60, 0.15)",
290
+ warningSoftForeground: "#feb887",
291
+ warningSoftPressed: "rgba(251, 146, 60, 0.2)",
290
292
  dangerSoft: "rgba(248, 113, 113, 0.15)",
291
293
  dangerSoftForeground: "#fc8f8c",
292
294
  dangerSoftPressed: "rgba(248, 113, 113, 0.2)",
@@ -387,14 +389,16 @@ function createTheme(config = {}) {
387
389
  var defaultTheme = createTheme();
388
390
 
389
391
  // src/provider/xaui-provider.tsx
392
+ import { jsx } from "react/jsx-runtime";
390
393
  function XAUIProvider({
391
394
  children,
392
395
  theme = defaultTheme,
393
- colorMode = "system"
396
+ colorMode = "system",
397
+ hasPortalHost = true
394
398
  }) {
395
399
  const scheme = useColorScheme();
396
400
  const resolved = colorMode === "system" ? scheme === "dark" ? "dark" : "light" : colorMode;
397
- return /* @__PURE__ */ React.createElement(ThemeContext.Provider, { value: theme[resolved] }, children);
401
+ return /* @__PURE__ */ jsx(ThemeContext.Provider, { value: theme[resolved], children: hasPortalHost ? /* @__PURE__ */ jsx(PortalHost, { children }) : children });
398
402
  }
399
403
 
400
404
  // src/theme/palette.ts
@@ -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
+ };