@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
@@ -0,0 +1,346 @@
1
+ import {
2
+ SelectionFill
3
+ } from "./chunk-BA2DBSAN.js";
4
+ import {
5
+ useControllableState
6
+ } from "./chunk-F6W3JQ7K.js";
7
+ import {
8
+ PressableFeedback
9
+ } from "./chunk-6UEZJRVI.js";
10
+ import {
11
+ usePressState
12
+ } from "./chunk-423RQBOX.js";
13
+ import {
14
+ createRecipe,
15
+ radiusAxis
16
+ } from "./chunk-4GTAZM2C.js";
17
+ import {
18
+ useXAUITheme
19
+ } from "./chunk-A3EGFI6T.js";
20
+ import {
21
+ childrenToString,
22
+ createSlotContext
23
+ } from "./chunk-K72UDPVN.js";
24
+ import {
25
+ useStyleProps
26
+ } from "./chunk-M63GFNKV.js";
27
+
28
+ // src/components/checkbox/checkbox-indicator.tsx
29
+ import { forwardRef } from "react";
30
+ import { View } from "react-native";
31
+
32
+ // src/components/checkbox/checkbox.context.ts
33
+ var [CheckboxProvider, useCheckbox] = createSlotContext("Checkbox");
34
+
35
+ // src/components/checkbox/checkbox-indicator.tsx
36
+ import { jsx } from "react/jsx-runtime";
37
+ var CheckboxIndicator = forwardRef(
38
+ function CheckboxIndicator2({ children, animation = true, style, ...props }, ref) {
39
+ const { indicatorStyle, fillStyle, isSelected, isIndeterminate } = useCheckbox();
40
+ const [styleProps, rest] = useStyleProps(props);
41
+ const isFilled = isSelected || isIndeterminate;
42
+ const mark = children ?? (isIndeterminate ? /* @__PURE__ */ jsx(Dash, {}) : /* @__PURE__ */ jsx(Check, {}));
43
+ return /* @__PURE__ */ jsx(View, { ref, ...rest, style: [indicatorStyle, styleProps, style], children: /* @__PURE__ */ jsx(SelectionFill, { isVisible: isFilled, style: fillStyle, animation, children: mark }) });
44
+ }
45
+ );
46
+ CheckboxIndicator.displayName = "XAUI.Checkbox.Indicator";
47
+ function Check() {
48
+ const { checkStyle } = useCheckbox();
49
+ return /* @__PURE__ */ jsx(View, { style: checkStyle });
50
+ }
51
+ function Dash() {
52
+ const { dashStyle } = useCheckbox();
53
+ return /* @__PURE__ */ jsx(View, { style: dashStyle });
54
+ }
55
+
56
+ // src/components/checkbox/checkbox-label.tsx
57
+ import { forwardRef as forwardRef2 } from "react";
58
+ import { Text } from "react-native";
59
+ import { jsx as jsx2 } from "react/jsx-runtime";
60
+ var CheckboxLabel = forwardRef2(
61
+ function CheckboxLabel2({ children, style, ...props }, ref) {
62
+ const { labelStyle } = useCheckbox();
63
+ const [styleProps, rest] = useStyleProps(props);
64
+ return /* @__PURE__ */ jsx2(Text, { ref, style: [labelStyle, styleProps, style], ...rest, children });
65
+ }
66
+ );
67
+ CheckboxLabel.displayName = "XAUI.Checkbox.Label";
68
+
69
+ // src/components/checkbox/checkbox.tsx
70
+ import { forwardRef as forwardRef3, useCallback, useMemo } from "react";
71
+
72
+ // src/components/checkbox/checkbox.recipe.ts
73
+ var SLOTS = ["root", "indicator", "fill", "check", "dash", "label"];
74
+ var VARIANT_TOKENS = {
75
+ primary: {
76
+ bg: "fieldBackground",
77
+ border: "fieldBorder",
78
+ bgSelected: "accent",
79
+ fgSelected: "accentForeground"
80
+ },
81
+ // `bg: 'default'` is the neutral *token*, not this variant's name — the two namespaces
82
+ // meet here as they do on the `Input`, and for the same reason: on a card,
83
+ // `fieldBackground` is the card's own colour and the box would vanish into it.
84
+ secondary: {
85
+ bg: "default",
86
+ border: "fieldBorder",
87
+ bgSelected: "accent",
88
+ fgSelected: "accentForeground"
89
+ },
90
+ tertiary: {
91
+ border: "fieldBorder",
92
+ bgSelected: "accent",
93
+ fgSelected: "accentForeground"
94
+ }
95
+ };
96
+ function sizeAxis(step) {
97
+ const { box, radius, label, gap, stroke } = step;
98
+ return (theme) => {
99
+ const side = theme.spacing(box);
100
+ return {
101
+ root: { gap: theme.spacing(gap) },
102
+ indicator: { width: side, height: side, borderRadius: theme.radius[radius] },
103
+ check: {
104
+ width: side * CHECK_WIDTH,
105
+ height: side * CHECK_HEIGHT,
106
+ borderStartWidth: stroke,
107
+ borderBottomWidth: stroke,
108
+ // An "L" has its ink in one corner, not in the middle of its box, so rotating it
109
+ // about that box's centre leaves the tick sitting low. Rotating by −45° maps a
110
+ // point to `(dy − dx)·√2/2`, and over the two strokes that spans `H` at the top
111
+ // and `H − t − W` at the bottom — an ink centre `(H − t)·√2/4` **below** the box
112
+ // centre, which flexbox then dutifully centres. Lifting by exactly that is what
113
+ // makes the mark look centred rather than measure centred.
114
+ //
115
+ // Both transforms live here, and not half here and half in a sheet, because
116
+ // `transform` is a whole value: the recipe's merge replaces it rather than
117
+ // blending, so a second step would drop the first.
118
+ transform: [
119
+ { translateY: -((side * CHECK_HEIGHT - stroke) * Math.SQRT2) / 4 },
120
+ { rotate: "-45deg" }
121
+ ]
122
+ },
123
+ // The third state's mark: the check's long stroke, on its own and level.
124
+ dash: {
125
+ width: side * CHECK_WIDTH,
126
+ height: stroke,
127
+ borderRadius: stroke / 2
128
+ },
129
+ label: {
130
+ fontSize: theme.fontSizes[label],
131
+ lineHeight: theme.lineHeights[label]
132
+ }
133
+ };
134
+ };
135
+ }
136
+ var CHECK_WIDTH = 0.5;
137
+ var CHECK_HEIGHT = 0.25;
138
+ var SIZES = {
139
+ sm: { box: 5, radius: "sm", gap: 2, label: "sm", stroke: 2 },
140
+ md: { box: 6, radius: "md", gap: 2, label: "md", stroke: 2 },
141
+ lg: { box: 7, radius: "md", gap: 2.5, label: "lg", stroke: 2.5 }
142
+ };
143
+ var checkboxRecipe = createRecipe({
144
+ slots: SLOTS,
145
+ base: (theme) => ({
146
+ root: { flexDirection: "row", alignItems: "center", alignSelf: "flex-start" },
147
+ indicator: {
148
+ alignItems: "center",
149
+ justifyContent: "center",
150
+ borderWidth: theme.borderWidth.field,
151
+ borderCurve: "continuous",
152
+ // The fill is laid inside the box and has to stop at its corners.
153
+ overflow: "hidden"
154
+ },
155
+ // Laid over the box rather than sized to it: the two corners are the indicator's, and
156
+ // an inset of zero is what keeps the fill inside the border it is clipped by.
157
+ fill: {
158
+ position: "absolute",
159
+ top: 0,
160
+ bottom: 0,
161
+ start: 0,
162
+ end: 0,
163
+ alignItems: "center",
164
+ justifyContent: "center"
165
+ },
166
+ label: {
167
+ fontFamily: theme.fontFamilies.body,
168
+ color: theme.colors.foreground
169
+ }
170
+ }),
171
+ variantTokens: VARIANT_TOKENS,
172
+ /**
173
+ * Where the variant's colours land. The border width follows the *presence* of the
174
+ * border role, exactly as on the `Input`.
175
+ *
176
+ * `bgSelected` and `fgSelected` are painted unconditionally, on two slots the indicator
177
+ * only mounts while it is ticked — which is what keeps selection out of the cache key
178
+ * and inside the tint pass at the same time. An axis would have given up the second.
179
+ */
180
+ paint: (theme, colors) => ({
181
+ indicator: {
182
+ backgroundColor: colors.bg,
183
+ borderColor: colors.border,
184
+ borderWidth: colors.border ? theme.borderWidth.field : 0
185
+ },
186
+ fill: { backgroundColor: colors.bgSelected },
187
+ check: { borderColor: colors.fgSelected },
188
+ dash: { backgroundColor: colors.fgSelected }
189
+ }),
190
+ variants: {
191
+ size: {
192
+ sm: sizeAxis(SIZES.sm),
193
+ md: sizeAxis(SIZES.md),
194
+ lg: sizeAxis(SIZES.lg)
195
+ },
196
+ radius: radiusAxis("indicator"),
197
+ /**
198
+ * Declared after `size` so its border wins. The resting fill is dropped rather than
199
+ * repainted — `undefined` over a colour is what RN reads as "no background" — because
200
+ * a box that is wrong should read as an outline, not as a filled control that happens
201
+ * to be red at the edge. HeroUI reaches the same shape with a compound.
202
+ */
203
+ isInvalid: {
204
+ true: (theme) => ({
205
+ indicator: { borderColor: theme.colors.danger, backgroundColor: void 0 },
206
+ fill: { backgroundColor: theme.colors.danger },
207
+ check: { borderColor: theme.colors.dangerForeground },
208
+ dash: { backgroundColor: theme.colors.dangerForeground },
209
+ // The label turns with it: on a long form the field that is wrong has to be
210
+ // findable without reading every message.
211
+ label: { color: theme.colors.danger }
212
+ })
213
+ }
214
+ },
215
+ /** What `primary` adds to a filled box — the `Input`'s compound, on a smaller field. */
216
+ compoundVariants: [
217
+ {
218
+ when: { variant: "primary" },
219
+ style: (theme) => ({ indicator: theme.shadows.field })
220
+ }
221
+ ],
222
+ states: {
223
+ disabled: (theme) => ({ root: { opacity: theme.opacity.disabled } })
224
+ },
225
+ defaultVariants: { variant: "secondary", size: "md" }
226
+ });
227
+
228
+ // src/components/checkbox/checkbox.tsx
229
+ import { Fragment, jsx as jsx3, jsxs } from "react/jsx-runtime";
230
+ var CheckboxRoot = forwardRef3(function Checkbox({
231
+ children,
232
+ variant,
233
+ size,
234
+ radius,
235
+ color,
236
+ isSelected,
237
+ defaultSelected = false,
238
+ onSelectedChange,
239
+ isIndeterminate = false,
240
+ isInvalid = false,
241
+ isDisabled = false,
242
+ asChild = false,
243
+ accessibilityRole,
244
+ accessibilityState,
245
+ animation,
246
+ style,
247
+ onPress,
248
+ onPressIn,
249
+ onPressOut,
250
+ ...props
251
+ }, ref) {
252
+ const theme = useXAUITheme();
253
+ const [styleProps, rest] = useStyleProps(props);
254
+ const [isPressed, press] = usePressState({ onPressIn, onPressOut });
255
+ const [selected, setSelected] = useControllableState({
256
+ value: isSelected,
257
+ defaultValue: defaultSelected,
258
+ onChange: onSelectedChange
259
+ });
260
+ const handlePress = useCallback(
261
+ (event) => {
262
+ setSelected((current) => isIndeterminate ? true : !current);
263
+ onPress?.(event);
264
+ },
265
+ [setSelected, isIndeterminate, onPress]
266
+ );
267
+ const selection = {
268
+ variant,
269
+ size,
270
+ radius,
271
+ isInvalid: isInvalid ? "true" : void 0
272
+ };
273
+ const states = { pressed: isPressed, disabled: isDisabled };
274
+ const styles = checkboxRecipe.resolve({ theme, selection, states });
275
+ const tint = color && !isInvalid ? checkboxRecipe.tint({ theme, color, selection, states }) : void 0;
276
+ const context = useMemo(
277
+ () => ({
278
+ // The tint never reaches the box **at rest**, only the two nodes that say the box
279
+ // is ticked. `paint` writes the resting fill from `bg` and the tint pass re-runs
280
+ // `paint`, so applying `tint.indicator` here would paint an unticked box in the
281
+ // caller's brand colour — which reads as ticked, which is the one thing it is not.
282
+ indicatorStyle: styles.indicator,
283
+ fillStyle: tint ? [styles.fill, tint.fill] : styles.fill,
284
+ checkStyle: tint ? [styles.check, tint.check] : styles.check,
285
+ dashStyle: tint ? [styles.dash, tint.dash] : styles.dash,
286
+ labelStyle: styles.label,
287
+ isSelected: selected,
288
+ isIndeterminate,
289
+ isDisabled,
290
+ isInvalid
291
+ }),
292
+ [styles, tint, selected, isIndeterminate, isDisabled, isInvalid]
293
+ );
294
+ const rootStyle = [
295
+ styles.root,
296
+ tint?.root,
297
+ styleProps,
298
+ typeof style === "function" ? style({ pressed: isPressed }) : style
299
+ ];
300
+ const text = childrenToString(children);
301
+ const content = text !== null ? /* @__PURE__ */ jsxs(Fragment, { children: [
302
+ /* @__PURE__ */ jsx3(CheckboxIndicator, {}),
303
+ /* @__PURE__ */ jsx3(CheckboxLabel, { children: text })
304
+ ] }) : children ?? /* @__PURE__ */ jsx3(CheckboxIndicator, {});
305
+ return /* @__PURE__ */ jsx3(CheckboxProvider, { value: context, children: /* @__PURE__ */ jsx3(
306
+ PressableFeedback,
307
+ {
308
+ ref,
309
+ isPressed,
310
+ isDisabled,
311
+ asChild,
312
+ animation,
313
+ accessibilityRole: accessibilityRole ?? "checkbox",
314
+ accessibilityState: {
315
+ // `'mixed'` is the platform's own word for the third state, and it is the only
316
+ // thing that tells a screen reader this box speaks for rows it cannot see.
317
+ checked: isIndeterminate ? "mixed" : selected,
318
+ disabled: isDisabled,
319
+ ...accessibilityState
320
+ },
321
+ "aria-invalid": isInvalid,
322
+ ...rest,
323
+ style: rootStyle,
324
+ onPress: handlePress,
325
+ onPressIn: press.onPressIn,
326
+ onPressOut: press.onPressOut,
327
+ children: asChild ? children : content
328
+ }
329
+ ) });
330
+ });
331
+ CheckboxRoot.displayName = "XAUI.Checkbox.Root";
332
+
333
+ // src/components/checkbox/index.ts
334
+ var Checkbox2 = Object.assign(CheckboxRoot, {
335
+ Indicator: CheckboxIndicator,
336
+ Label: CheckboxLabel
337
+ });
338
+
339
+ export {
340
+ useCheckbox,
341
+ CheckboxIndicator,
342
+ CheckboxLabel,
343
+ checkboxRecipe,
344
+ CheckboxRoot,
345
+ Checkbox2 as Checkbox
346
+ };
@@ -0,0 +1,9 @@
1
+ // src/utils/warn-dev.ts
2
+ function warnDev(message) {
3
+ if (typeof __DEV__ !== "undefined" && !__DEV__) return;
4
+ console.warn(`XAUI: ${message}`);
5
+ }
6
+
7
+ export {
8
+ warnDev
9
+ };
@@ -0,0 +1,9 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});// src/utils/warn-dev.ts
2
+ function warnDev(message) {
3
+ if (typeof __DEV__ !== "undefined" && !__DEV__) return;
4
+ console.warn(`XAUI: ${message}`);
5
+ }
6
+
7
+
8
+
9
+ exports.warnDev = warnDev;
@@ -0,0 +1,66 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});// src/system/anchored/anchored-motion.ts
2
+ var _reactnativereanimated = require('react-native-reanimated');
3
+ var ENTER_MS = 200;
4
+ var EXIT_MS = 150;
5
+ var TRAVEL = 8;
6
+ function anchoredEntering(placement) {
7
+ const [x, y] = travel(placement);
8
+ return new (0, _reactnativereanimated.Keyframe)({
9
+ 0: {
10
+ opacity: 0,
11
+ transform: [{ translateX: x }, { translateY: y }, { scale: 0.95 }]
12
+ },
13
+ 100: {
14
+ opacity: 1,
15
+ transform: [{ translateX: 0 }, { translateY: 0 }, { scale: 1 }],
16
+ easing: _reactnativereanimated.Easing.out(_reactnativereanimated.Easing.cubic)
17
+ }
18
+ }).duration(ENTER_MS);
19
+ }
20
+ function anchoredExiting(placement) {
21
+ const [x, y] = travel(placement);
22
+ return new (0, _reactnativereanimated.Keyframe)({
23
+ 0: {
24
+ opacity: 1,
25
+ transform: [{ translateX: 0 }, { translateY: 0 }, { scale: 1 }]
26
+ },
27
+ 100: {
28
+ opacity: 0,
29
+ transform: [{ translateX: x }, { translateY: y }, { scale: 0.95 }],
30
+ easing: _reactnativereanimated.Easing.in(_reactnativereanimated.Easing.cubic)
31
+ }
32
+ }).duration(EXIT_MS);
33
+ }
34
+ function travel(placement) {
35
+ switch (placement) {
36
+ case "bottom":
37
+ return [0, -TRAVEL];
38
+ case "top":
39
+ return [0, TRAVEL];
40
+ case "end":
41
+ return [-TRAVEL, 0];
42
+ case "start":
43
+ return [TRAVEL, 0];
44
+ }
45
+ }
46
+ var overlayEntering = new (0, _reactnativereanimated.Keyframe)({
47
+ 0: { opacity: 0 },
48
+ 100: { opacity: 1 }
49
+ }).duration(ENTER_MS);
50
+ var overlayExiting = new (0, _reactnativereanimated.Keyframe)({
51
+ 0: { opacity: 1 },
52
+ 100: { opacity: 0 }
53
+ }).duration(EXIT_MS);
54
+
55
+ // src/system/anchored/indicator-spring.ts
56
+ var INDICATOR_SPRING = { damping: 140, stiffness: 1e3, mass: 4 };
57
+ var INDICATOR_ROTATION = [0, -180];
58
+
59
+
60
+
61
+
62
+
63
+
64
+
65
+
66
+ exports.anchoredEntering = anchoredEntering; exports.anchoredExiting = anchoredExiting; exports.overlayEntering = overlayEntering; exports.overlayExiting = overlayExiting; exports.INDICATOR_SPRING = INDICATOR_SPRING; exports.INDICATOR_ROTATION = INDICATOR_ROTATION;