@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,293 @@
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/radio/radio-indicator.tsx
29
+ import { forwardRef } from "react";
30
+ import { View } from "react-native";
31
+
32
+ // src/components/radio/radio.context.ts
33
+ var [RadioProvider, useRadio] = createSlotContext("Radio");
34
+
35
+ // src/components/radio/radio-indicator.tsx
36
+ import { jsx } from "react/jsx-runtime";
37
+ var RadioIndicator = forwardRef(
38
+ function RadioIndicator2({ children, animation = true, style, ...props }, ref) {
39
+ const { indicatorStyle, fillStyle, isSelected } = useRadio();
40
+ const [styleProps, rest] = useStyleProps(props);
41
+ return /* @__PURE__ */ jsx(View, { ref, ...rest, style: [indicatorStyle, styleProps, style], children: /* @__PURE__ */ jsx(
42
+ SelectionFill,
43
+ {
44
+ isVisible: isSelected,
45
+ style: fillStyle,
46
+ animation,
47
+ children: children ?? /* @__PURE__ */ jsx(Thumb, {})
48
+ }
49
+ ) });
50
+ }
51
+ );
52
+ RadioIndicator.displayName = "XAUI.Radio.Indicator";
53
+ function Thumb() {
54
+ const { thumbStyle } = useRadio();
55
+ return /* @__PURE__ */ jsx(View, { style: thumbStyle });
56
+ }
57
+
58
+ // src/components/radio/radio-label.tsx
59
+ import { forwardRef as forwardRef2 } from "react";
60
+ import { Text } from "react-native";
61
+ import { jsx as jsx2 } from "react/jsx-runtime";
62
+ var RadioLabel = forwardRef2(function RadioLabel2({ children, style, ...props }, ref) {
63
+ const { labelStyle } = useRadio();
64
+ const [styleProps, rest] = useStyleProps(props);
65
+ return /* @__PURE__ */ jsx2(Text, { ref, style: [labelStyle, styleProps, style], ...rest, children });
66
+ });
67
+ RadioLabel.displayName = "XAUI.Radio.Label";
68
+
69
+ // src/components/radio/radio.tsx
70
+ import { forwardRef as forwardRef3, useCallback, useMemo } from "react";
71
+
72
+ // src/components/radio/radio.recipe.ts
73
+ var SLOTS = ["root", "indicator", "fill", "thumb", "label"];
74
+ var VARIANT_TOKENS = {
75
+ primary: {
76
+ bg: "fieldBackground",
77
+ border: "fieldBorder",
78
+ bgSelected: "accent",
79
+ fgSelected: "accentForeground"
80
+ },
81
+ secondary: {
82
+ bg: "default",
83
+ border: "fieldBorder",
84
+ bgSelected: "accent",
85
+ fgSelected: "accentForeground"
86
+ },
87
+ tertiary: {
88
+ border: "fieldBorder",
89
+ bgSelected: "accent",
90
+ fgSelected: "accentForeground"
91
+ }
92
+ };
93
+ function sizeAxis(step) {
94
+ const { box, label, gap } = step;
95
+ return (theme) => {
96
+ const side = theme.spacing(box);
97
+ const dot = Math.round(side * THUMB_RATIO);
98
+ return {
99
+ root: { gap: theme.spacing(gap) },
100
+ indicator: { width: side, height: side },
101
+ thumb: { width: dot, height: dot, borderRadius: dot / 2 },
102
+ label: {
103
+ fontSize: theme.fontSizes[label],
104
+ lineHeight: theme.lineHeights[label]
105
+ }
106
+ };
107
+ };
108
+ }
109
+ var THUMB_RATIO = 10 / 24;
110
+ var SIZES = {
111
+ sm: { box: 5, gap: 2, label: "sm" },
112
+ md: { box: 6, gap: 2, label: "md" },
113
+ lg: { box: 7, gap: 2.5, label: "lg" }
114
+ };
115
+ var radioRecipe = createRecipe({
116
+ slots: SLOTS,
117
+ base: (theme) => ({
118
+ root: { flexDirection: "row", alignItems: "center", alignSelf: "flex-start" },
119
+ indicator: {
120
+ alignItems: "center",
121
+ justifyContent: "center",
122
+ borderWidth: theme.borderWidth.field,
123
+ // The one shape decision this component makes, and the whole difference between it
124
+ // and the `Checkbox`: a radio is round, at every size. `radius` still overrides it.
125
+ borderRadius: theme.radius.full,
126
+ overflow: "hidden"
127
+ },
128
+ fill: {
129
+ position: "absolute",
130
+ top: 0,
131
+ bottom: 0,
132
+ start: 0,
133
+ end: 0,
134
+ alignItems: "center",
135
+ justifyContent: "center"
136
+ },
137
+ label: {
138
+ fontFamily: theme.fontFamilies.body,
139
+ color: theme.colors.foreground
140
+ }
141
+ }),
142
+ variantTokens: VARIANT_TOKENS,
143
+ /** The `Checkbox`'s paint, with a dot where the check was. */
144
+ paint: (theme, colors) => ({
145
+ indicator: {
146
+ backgroundColor: colors.bg,
147
+ borderColor: colors.border,
148
+ borderWidth: colors.border ? theme.borderWidth.field : 0
149
+ },
150
+ fill: { backgroundColor: colors.bgSelected },
151
+ thumb: { backgroundColor: colors.fgSelected }
152
+ }),
153
+ variants: {
154
+ size: {
155
+ sm: sizeAxis(SIZES.sm),
156
+ md: sizeAxis(SIZES.md),
157
+ lg: sizeAxis(SIZES.lg)
158
+ },
159
+ radius: radiusAxis("indicator"),
160
+ /** Declared after `size` so its border wins. The `Checkbox`'s rule, to the letter. */
161
+ isInvalid: {
162
+ true: (theme) => ({
163
+ indicator: { borderColor: theme.colors.danger, backgroundColor: void 0 },
164
+ fill: { backgroundColor: theme.colors.danger },
165
+ thumb: { backgroundColor: theme.colors.dangerForeground },
166
+ label: { color: theme.colors.danger }
167
+ })
168
+ }
169
+ },
170
+ compoundVariants: [
171
+ {
172
+ when: { variant: "primary" },
173
+ style: (theme) => ({ indicator: theme.shadows.field })
174
+ }
175
+ ],
176
+ states: {
177
+ disabled: (theme) => ({ root: { opacity: theme.opacity.disabled } })
178
+ },
179
+ defaultVariants: { variant: "secondary", size: "md" }
180
+ });
181
+
182
+ // src/components/radio/radio.tsx
183
+ import { Fragment, jsx as jsx3, jsxs } from "react/jsx-runtime";
184
+ var RadioRoot = forwardRef3(function Radio({
185
+ children,
186
+ variant,
187
+ size,
188
+ radius,
189
+ color,
190
+ isSelected,
191
+ defaultSelected = false,
192
+ onSelectedChange,
193
+ isInvalid = false,
194
+ isDisabled = false,
195
+ asChild = false,
196
+ accessibilityRole,
197
+ accessibilityState,
198
+ animation,
199
+ style,
200
+ onPress,
201
+ onPressIn,
202
+ onPressOut,
203
+ ...props
204
+ }, ref) {
205
+ const theme = useXAUITheme();
206
+ const [styleProps, rest] = useStyleProps(props);
207
+ const [isPressed, press] = usePressState({ onPressIn, onPressOut });
208
+ const [selected, setSelected] = useControllableState({
209
+ value: isSelected,
210
+ defaultValue: defaultSelected,
211
+ onChange: onSelectedChange
212
+ });
213
+ const handlePress = useCallback(
214
+ (event) => {
215
+ setSelected(true);
216
+ onPress?.(event);
217
+ },
218
+ [setSelected, onPress]
219
+ );
220
+ const selection = {
221
+ variant,
222
+ size,
223
+ radius,
224
+ isInvalid: isInvalid ? "true" : void 0
225
+ };
226
+ const states = { pressed: isPressed, disabled: isDisabled };
227
+ const styles = radioRecipe.resolve({ theme, selection, states });
228
+ const tint = color && !isInvalid ? radioRecipe.tint({ theme, color, selection, states }) : void 0;
229
+ const context = useMemo(
230
+ () => ({
231
+ // The tint never reaches the circle at rest — only the fill and the dot that say it
232
+ // is the chosen one. The `Checkbox` says why, at the same line.
233
+ indicatorStyle: styles.indicator,
234
+ fillStyle: tint ? [styles.fill, tint.fill] : styles.fill,
235
+ thumbStyle: tint ? [styles.thumb, tint.thumb] : styles.thumb,
236
+ labelStyle: styles.label,
237
+ isSelected: selected,
238
+ isDisabled,
239
+ isInvalid
240
+ }),
241
+ [styles, tint, selected, isDisabled, isInvalid]
242
+ );
243
+ const rootStyle = [
244
+ styles.root,
245
+ tint?.root,
246
+ styleProps,
247
+ typeof style === "function" ? style({ pressed: isPressed }) : style
248
+ ];
249
+ const text = childrenToString(children);
250
+ const content = text !== null ? /* @__PURE__ */ jsxs(Fragment, { children: [
251
+ /* @__PURE__ */ jsx3(RadioIndicator, {}),
252
+ /* @__PURE__ */ jsx3(RadioLabel, { children: text })
253
+ ] }) : children ?? /* @__PURE__ */ jsx3(RadioIndicator, {});
254
+ return /* @__PURE__ */ jsx3(RadioProvider, { value: context, children: /* @__PURE__ */ jsx3(
255
+ PressableFeedback,
256
+ {
257
+ ref,
258
+ isPressed,
259
+ isDisabled,
260
+ asChild,
261
+ animation,
262
+ accessibilityRole: accessibilityRole ?? "radio",
263
+ accessibilityState: {
264
+ checked: selected,
265
+ disabled: isDisabled,
266
+ ...accessibilityState
267
+ },
268
+ "aria-invalid": isInvalid,
269
+ ...rest,
270
+ style: rootStyle,
271
+ onPress: handlePress,
272
+ onPressIn: press.onPressIn,
273
+ onPressOut: press.onPressOut,
274
+ children: asChild ? children : content
275
+ }
276
+ ) });
277
+ });
278
+ RadioRoot.displayName = "XAUI.Radio.Root";
279
+
280
+ // src/components/radio/index.ts
281
+ var Radio2 = Object.assign(RadioRoot, {
282
+ Indicator: RadioIndicator,
283
+ Label: RadioLabel
284
+ });
285
+
286
+ export {
287
+ useRadio,
288
+ RadioIndicator,
289
+ RadioLabel,
290
+ radioRecipe,
291
+ RadioRoot,
292
+ Radio2 as Radio
293
+ };
@@ -0,0 +1,13 @@
1
+ import {
2
+ mergeRefs
3
+ } from "./chunk-36PRYGAM.js";
4
+
5
+ // src/hooks/use-merged-ref.ts
6
+ import { useMemo } from "react";
7
+ function useMergedRef(...refs) {
8
+ return useMemo(() => mergeRefs(...refs), refs);
9
+ }
10
+
11
+ export {
12
+ useMergedRef
13
+ };
@@ -0,0 +1,410 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ function _interopRequireDefault(obj) {
7
+ return obj && obj.__esModule ? obj : {
8
+ default: obj
9
+ };
10
+ }
11
+ function _optionalChain(ops) {
12
+ let lastAccessLHS = undefined;
13
+ let value = ops[0];
14
+ let i = 1;
15
+ while (i < ops.length) {
16
+ const op = ops[i];
17
+ const fn = ops[i + 1];
18
+ i += 2;
19
+ if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) {
20
+ return undefined;
21
+ }
22
+ if (op === 'access' || op === 'optionalAccess') {
23
+ lastAccessLHS = value;
24
+ value = fn(value);
25
+ } else if (op === 'call' || op === 'optionalCall') {
26
+ value = fn((...args) => value.call(lastAccessLHS, ...args));
27
+ lastAccessLHS = undefined;
28
+ }
29
+ }
30
+ return value;
31
+ }
32
+ var _chunk4KFKWBN5cjs = require('./chunk-4KFKWBN5.cjs');
33
+ var _chunkFNEUOBCVcjs = require('./chunk-FNEUOBCV.cjs');
34
+ var _chunk57SJ4LJFcjs = require('./chunk-57SJ4LJF.cjs');
35
+ var _chunk7GHM4GKLcjs = require('./chunk-7GHM4GKL.cjs');
36
+ var _chunkTK44VBIEcjs = require('./chunk-TK44VBIE.cjs');
37
+
38
+ // src/components/avatar/avatar-fallback.tsx
39
+ var _react = require('react');
40
+ var _reactnative = require('react-native');
41
+
42
+ // src/components/avatar/avatar-initials.tsx
43
+
44
+ // src/components/avatar/avatar.context.ts
45
+ var [AvatarProvider, useAvatar] = _chunk7GHM4GKLcjs.createSlotContext.call(void 0, "Avatar");
46
+
47
+ // src/components/avatar/avatar-initials.tsx
48
+ var _jsxruntime = require('react/jsx-runtime');
49
+ var AvatarInitials = _react.forwardRef.call(void 0, function AvatarInitials2({
50
+ children,
51
+ style,
52
+ ...props
53
+ }, ref) {
54
+ const {
55
+ initialsStyle
56
+ } = useAvatar();
57
+ const [styleProps, rest] = _chunkTK44VBIEcjs.useStyleProps.call(void 0, props);
58
+ return /* @__PURE__ */_jsxruntime.jsx.call(void 0, _reactnative.Text, {
59
+ ref,
60
+ accessibilityElementsHidden: true,
61
+ importantForAccessibility: "no",
62
+ numberOfLines: 1,
63
+ ...rest,
64
+ style: [initialsStyle, styleProps, style],
65
+ children
66
+ });
67
+ });
68
+ AvatarInitials.displayName = "XAUI.Avatar.Initials";
69
+
70
+ // src/components/avatar/avatar-fallback.tsx
71
+
72
+ var AvatarFallback = _react.forwardRef.call(void 0, function AvatarFallback2({
73
+ children,
74
+ style,
75
+ ...props
76
+ }, ref) {
77
+ const {
78
+ fallbackStyle,
79
+ icon
80
+ } = useAvatar();
81
+ const [styleProps, rest] = _chunkTK44VBIEcjs.useStyleProps.call(void 0, props);
82
+ const text = _chunk7GHM4GKLcjs.childrenToString.call(void 0, children);
83
+ const content = text !== null ? /* @__PURE__ */_jsxruntime.jsx.call(void 0, AvatarInitials, {
84
+ children: text
85
+ }) : children;
86
+ return /* @__PURE__ */_jsxruntime.jsx.call(void 0, _reactnative.View, {
87
+ ref,
88
+ style: [fallbackStyle, styleProps, style],
89
+ ...rest,
90
+ children: /* @__PURE__ */_jsxruntime.jsx.call(void 0, _chunk4KFKWBN5cjs.IconContext.Provider, {
91
+ value: icon,
92
+ children: content
93
+ })
94
+ });
95
+ });
96
+ AvatarFallback.displayName = "XAUI.Avatar.Fallback";
97
+
98
+ // src/components/avatar/avatar-image.tsx
99
+
100
+ var _reactnativereanimated = require('react-native-reanimated');
101
+ var _reactnativereanimated2 = _interopRequireDefault(_reactnativereanimated);
102
+
103
+ // src/components/avatar/avatar.style.ts
104
+
105
+ var avatarSheet = _reactnative.StyleSheet.create({
106
+ image: {
107
+ position: "absolute",
108
+ top: 0,
109
+ bottom: 0,
110
+ start: 0,
111
+ end: 0
112
+ }
113
+ });
114
+
115
+ // src/components/avatar/avatar-image.tsx
116
+
117
+ var FADE_DURATION = 200;
118
+ var AvatarImage = _react.forwardRef.call(void 0, function AvatarImage2({
119
+ animation = true,
120
+ style,
121
+ ...props
122
+ }, ref) {
123
+ const [styleProps, rest] = _chunkTK44VBIEcjs.useStyleProps.call(void 0, props);
124
+ const frameStyle = [avatarSheet.image, styleProps, style];
125
+ if (!animation) return /* @__PURE__ */_jsxruntime.jsx.call(void 0, _reactnative.Image, {
126
+ ref,
127
+ ...rest,
128
+ style: frameStyle
129
+ });
130
+ return /* @__PURE__ */_jsxruntime.jsx.call(void 0, FadingImage, {
131
+ ref,
132
+ ...rest,
133
+ style: frameStyle
134
+ });
135
+ });
136
+ AvatarImage.displayName = "XAUI.Avatar.Image";
137
+ const _worklet_17449085045817_init_data = {
138
+ code: "function chunkNWGLP6JXCjs1(){const{opacity}=this.__closure;return{opacity:opacity.value};}",
139
+ location: "/home/runner/work/xaui/xaui/packages/native/dist/chunk-NWGLP6JX.cjs",
140
+ sourceMap: "{\"version\":3,\"names\":[\"chunkNWGLP6JXCjs1\",\"opacity\",\"__closure\",\"value\"],\"sources\":[\"/home/runner/work/xaui/xaui/packages/native/dist/chunk-NWGLP6JX.cjs\"],\"mappings\":\"AAoG+E,SAAAA,iBAAMA,CAAA,QAAAC,OAAA,OAAAC,SAAA,CAE/E,MAAO,CAAED,OAAO,CAAEA,OAAO,CAACE,KAAM,CAAC,CACnC\",\"ignoreList\":[]}"
141
+ };
142
+ var FadingImage = _react.forwardRef.call(void 0, function FadingImage2({
143
+ onLoad,
144
+ style,
145
+ ...props
146
+ }, ref) {
147
+ const opacity = _reactnativereanimated.useSharedValue.call(void 0, 0);
148
+ const handleLoad = _react.useCallback.call(void 0, event => {
149
+ opacity.value = _reactnativereanimated.withTiming.call(void 0, 1, {
150
+ duration: FADE_DURATION
151
+ });
152
+ _optionalChain([onLoad, 'optionalCall', _ => _(event)]);
153
+ }, [opacity, onLoad]);
154
+ const animatedStyle = _reactnativereanimated.useAnimatedStyle.call(void 0, function chunkNWGLP6JXCjs1Factory({
155
+ _worklet_17449085045817_init_data,
156
+ opacity
157
+ }) {
158
+ const _e = [new global.Error(), -2, -27];
159
+ const chunkNWGLP6JXCjs1 = function () {
160
+ return {
161
+ opacity: opacity.value
162
+ };
163
+ };
164
+ chunkNWGLP6JXCjs1.__closure = {
165
+ opacity
166
+ };
167
+ chunkNWGLP6JXCjs1.__workletHash = 17449085045817;
168
+ chunkNWGLP6JXCjs1.__pluginVersion = "0.7.4";
169
+ chunkNWGLP6JXCjs1.__initData = _worklet_17449085045817_init_data;
170
+ chunkNWGLP6JXCjs1.__stackDetails = _e;
171
+ return chunkNWGLP6JXCjs1;
172
+ }({
173
+ _worklet_17449085045817_init_data,
174
+ opacity
175
+ }), [opacity]);
176
+ return /* @__PURE__ */_jsxruntime.jsx.call(void 0, _reactnativereanimated2.default.Image, {
177
+ ref,
178
+ ...props,
179
+ onLoad: handleLoad,
180
+ style: [style, animatedStyle]
181
+ });
182
+ });
183
+
184
+ // src/components/avatar/avatar.tsx
185
+
186
+ // src/components/avatar/avatar.recipe.ts
187
+ var SLOTS = ["root", "fallback", "initials", "icon"];
188
+ var VARIANT_TOKENS = {
189
+ primary: {
190
+ bg: "accent",
191
+ fg: "accentForeground"
192
+ },
193
+ secondary: {
194
+ bg: "accentSoft",
195
+ fg: "accentSoftForeground"
196
+ },
197
+ default: {
198
+ bg: "default",
199
+ fg: "defaultForeground"
200
+ },
201
+ tertiary: {
202
+ border: "border",
203
+ fg: "foreground"
204
+ },
205
+ ghost: {
206
+ fg: "foreground"
207
+ },
208
+ success: {
209
+ bg: "success",
210
+ fg: "successForeground"
211
+ },
212
+ "success-soft": {
213
+ bg: "successSoft",
214
+ fg: "successSoftForeground"
215
+ },
216
+ warning: {
217
+ bg: "warning",
218
+ fg: "warningForeground"
219
+ },
220
+ "warning-soft": {
221
+ bg: "warningSoft",
222
+ fg: "warningSoftForeground"
223
+ },
224
+ danger: {
225
+ bg: "danger",
226
+ fg: "dangerForeground"
227
+ },
228
+ "danger-soft": {
229
+ bg: "dangerSoft",
230
+ fg: "dangerSoftForeground"
231
+ }
232
+ };
233
+ function sizeAxis(step) {
234
+ return theme => {
235
+ const diameter = theme.spacing(step.diameter);
236
+ return {
237
+ root: {
238
+ width: diameter,
239
+ height: diameter
240
+ },
241
+ initials: {
242
+ fontSize: theme.fontSizes[step.initials],
243
+ lineHeight: theme.lineHeights[step.initials]
244
+ },
245
+ icon: {
246
+ fontSize: theme.fontSizes[step.glyph]
247
+ }
248
+ };
249
+ };
250
+ }
251
+ var SIZES = {
252
+ xs: {
253
+ diameter: 8,
254
+ initials: "xs",
255
+ glyph: "xs"
256
+ },
257
+ sm: {
258
+ diameter: 10,
259
+ initials: "xs",
260
+ glyph: "sm"
261
+ },
262
+ md: {
263
+ diameter: 12,
264
+ initials: "sm",
265
+ glyph: "md"
266
+ },
267
+ lg: {
268
+ diameter: 16,
269
+ initials: "md",
270
+ glyph: "xl"
271
+ }
272
+ };
273
+ var avatarRecipe = _chunkFNEUOBCVcjs.createRecipe.call(void 0, {
274
+ slots: SLOTS,
275
+ base: theme => ({
276
+ root: {
277
+ alignItems: "center",
278
+ justifyContent: "center",
279
+ // The clip is what makes a square photo round, so unlike on the `Chip` it is not
280
+ // optional here: without it the image is a rectangle sitting over a circle.
281
+ overflow: "hidden",
282
+ // Squircle corners for when `radius` overrides the circle. Free on Android.
283
+ borderCurve: "continuous",
284
+ borderWidth: 0
285
+ },
286
+ fallback: {
287
+ width: "100%",
288
+ height: "100%",
289
+ alignItems: "center",
290
+ justifyContent: "center"
291
+ },
292
+ initials: {
293
+ fontFamily: theme.fontFamilies.body,
294
+ fontWeight: theme.fontWeights.medium,
295
+ // Two letters in a circle sit off-centre by the descender otherwise.
296
+ textAlign: "center"
297
+ }
298
+ }),
299
+ variantTokens: VARIANT_TOKENS,
300
+ /**
301
+ * Where the variant's colours land, for every variant at once. The border width follows
302
+ * the *presence* of the border role, so `ghost` needs no rule of its own to say it has
303
+ * no edge.
304
+ *
305
+ * The image takes no colour: it is a photograph, and tinting one is what `Icon`'s
306
+ * `source` form is for.
307
+ */
308
+ paint: (theme, colors) => ({
309
+ root: {
310
+ backgroundColor: colors.bg,
311
+ borderColor: colors.border,
312
+ borderWidth: colors.border ? theme.borderWidth.default : 0
313
+ },
314
+ initials: {
315
+ color: colors.fg
316
+ },
317
+ icon: {
318
+ color: colors.fg
319
+ }
320
+ }),
321
+ /** Declaration order is application order: `radius` overrides the circle `base` set. */
322
+ variants: {
323
+ size: {
324
+ xs: sizeAxis(SIZES.xs),
325
+ sm: sizeAxis(SIZES.sm),
326
+ md: sizeAxis(SIZES.md),
327
+ lg: sizeAxis(SIZES.lg)
328
+ },
329
+ radius: _chunkFNEUOBCVcjs.radiusAxis.call(void 0, "root")
330
+ },
331
+ /**
332
+ * A circle at every size, where HeroUI fixes one large radius for all three — which
333
+ * makes their small avatars round and their large ones squircles. `full` says the shape
334
+ * the name means once, and `radius` is still there for the logo that wants a square.
335
+ */
336
+ defaultVariants: {
337
+ variant: "default",
338
+ size: "md",
339
+ radius: "full"
340
+ }
341
+ });
342
+
343
+ // src/components/avatar/avatar.tsx
344
+
345
+ var AvatarRoot = _react.forwardRef.call(void 0, function Avatar({
346
+ children,
347
+ variant,
348
+ size,
349
+ radius,
350
+ color,
351
+ asChild = false,
352
+ style,
353
+ ...props
354
+ }, ref) {
355
+ const theme = _chunk57SJ4LJFcjs.useXAUITheme.call(void 0);
356
+ const [styleProps, rest] = _chunkTK44VBIEcjs.useStyleProps.call(void 0, props);
357
+ const selection = {
358
+ variant,
359
+ size,
360
+ radius
361
+ };
362
+ const styles = avatarRecipe.resolve({
363
+ theme,
364
+ selection
365
+ });
366
+ const tint = color ? avatarRecipe.tint({
367
+ theme,
368
+ color,
369
+ selection
370
+ }) : void 0;
371
+ const context = _react.useMemo.call(void 0, () => {
372
+ const icon = _reactnative.StyleSheet.flatten([styles.icon, _optionalChain([tint, 'optionalAccess', _2 => _2.icon])]);
373
+ return {
374
+ fallbackStyle: styles.fallback,
375
+ initialsStyle: tint ? [styles.initials, tint.initials] : styles.initials,
376
+ icon: {
377
+ size: icon.fontSize,
378
+ // `ColorValue` also covers the platform's opaque colours, which `Icon` cannot
379
+ // hand to a third-party component expecting a string.
380
+ color: typeof icon.color === "string" ? icon.color : void 0
381
+ }
382
+ };
383
+ }, [styles, tint]);
384
+ const rootStyle = [styles.root, _optionalChain([tint, 'optionalAccess', _3 => _3.root]), styleProps, style];
385
+ const text = _chunk7GHM4GKLcjs.childrenToString.call(void 0, children);
386
+ const content = text !== null ? /* @__PURE__ */_jsxruntime.jsx.call(void 0, AvatarFallback, {
387
+ children: text
388
+ }) : children;
389
+ const Root = asChild ? _chunk7GHM4GKLcjs.Slot : _reactnative.View;
390
+ return /* @__PURE__ */_jsxruntime.jsx.call(void 0, AvatarProvider, {
391
+ value: context,
392
+ children: /* @__PURE__ */_jsxruntime.jsx.call(void 0, Root, {
393
+ ref,
394
+ ...rest,
395
+ style: rootStyle,
396
+ children: asChild ? children : content
397
+ })
398
+ });
399
+ });
400
+ AvatarRoot.displayName = "XAUI.Avatar.Root";
401
+
402
+ // src/components/avatar/index.ts
403
+ var Avatar2 = Object.assign(AvatarRoot, {
404
+ Image: AvatarImage,
405
+ Fallback: AvatarFallback,
406
+ Initials: AvatarInitials
407
+ });
408
+ exports.useAvatar = useAvatar;
409
+ exports.avatarRecipe = avatarRecipe;
410
+ exports.Avatar = Avatar2;