@xaui/native 0.9.1-alpha.37 → 0.9.1-alpha.38

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 (135) hide show
  1. package/dist/{chunk-OULTSBKU.js → chunk-26OGEFQI.js} +1 -1
  2. package/dist/{chunk-TJHYSSBZ.js → chunk-346QBNUD.js} +1 -1
  3. package/dist/{chunk-PPWXLZGL.js → chunk-3GFRSZYR.js} +15 -23
  4. package/dist/{chunk-DKH6BNPF.cjs → chunk-3JXI2IHV.cjs} +13 -13
  5. package/dist/{chunk-7B3UBUC6.cjs → chunk-4KFKWBN5.cjs} +23 -2
  6. package/dist/{chunk-IGLKACSR.cjs → chunk-4KSKQD37.cjs} +5 -5
  7. package/dist/{chunk-UBOXW5WO.cjs → chunk-54CWXA34.cjs} +61 -61
  8. package/dist/{chunk-ZJWEVFAO.cjs → chunk-66FOASTP.cjs} +9 -9
  9. package/dist/{chunk-5PPNDKRX.js → chunk-6CO6FM67.js} +16 -16
  10. package/dist/{chunk-54FJOKAN.cjs → chunk-7GHM4GKL.cjs} +25 -25
  11. package/dist/{chunk-AP6RVIIK.cjs → chunk-7TOG4TVU.cjs} +21 -21
  12. package/dist/{chunk-LEWW24RQ.cjs → chunk-A7YB7YWX.cjs} +3 -3
  13. package/dist/{chunk-3P6M2R4S.cjs → chunk-AAVCMCJ3.cjs} +4 -4
  14. package/dist/{chunk-VFTT3Q4B.cjs → chunk-BNFIFRQA.cjs} +3 -3
  15. package/dist/{chunk-JXNFOOKC.js → chunk-DY3SUG5P.js} +5 -5
  16. package/dist/{chunk-EOJ5MYAQ.js → chunk-EYD4H4X6.js} +4 -4
  17. package/dist/{chunk-RGKWNK4T.js → chunk-FBCWNXZC.js} +58 -58
  18. package/dist/{chunk-HXW4ANVB.js → chunk-FHUYHV6J.js} +25 -4
  19. package/dist/{chunk-6G3XWPNP.js → chunk-HA6BFY3A.js} +3 -3
  20. package/dist/{chunk-FTQHDJYL.cjs → chunk-HOI5425P.cjs} +9 -9
  21. package/dist/{chunk-YXPYOOHU.js → chunk-K72UDPVN.js} +27 -27
  22. package/dist/{chunk-NTD3NPRX.cjs → chunk-KSUV74BE.cjs} +2 -2
  23. package/dist/{chunk-UGF35NSE.js → chunk-LIUO6D3D.js} +75 -75
  24. package/dist/{chunk-E3X5ODKQ.js → chunk-LTX6TB5I.js} +1 -1
  25. package/dist/{chunk-BORJJYDW.js → chunk-MXGER5PI.js} +2 -2
  26. package/dist/{chunk-GTT4NHS2.cjs → chunk-NCCRQK3P.cjs} +11 -11
  27. package/dist/chunk-NCTOTTVW.js +13 -0
  28. package/dist/chunk-Q3MQ7S2D.cjs +476 -0
  29. package/dist/{chunk-NKPTXTTS.js → chunk-QZ24MZRX.js} +3 -3
  30. package/dist/{chunk-7LSY4WFL.js → chunk-R7BU4CPS.js} +2 -2
  31. package/dist/{chunk-DVDQSW7U.cjs → chunk-RAWGK2XK.cjs} +25 -60
  32. package/dist/{chunk-JB5LGQ54.cjs → chunk-RKCWYUGA.cjs} +3 -3
  33. package/dist/{chunk-SMW6ZWMH.js → chunk-S2WNWMNT.js} +1 -1
  34. package/dist/{chunk-WVLSQO6K.cjs → chunk-S4QUM4EE.cjs} +9 -9
  35. package/dist/{chunk-SO5UAGIU.js → chunk-SACDOFGF.js} +15 -15
  36. package/dist/{chunk-CUQTAPBU.cjs → chunk-SIP5J7HU.cjs} +17 -17
  37. package/dist/{chunk-O3A3DBSZ.js → chunk-SZLXPF3G.js} +1 -1
  38. package/dist/{chunk-437QULXO.cjs → chunk-TDTUAIFF.cjs} +5 -5
  39. package/dist/{chunk-DRMT346W.cjs → chunk-TGMVEHV7.cjs} +64 -64
  40. package/dist/{chunk-TDYPY2J7.js → chunk-TRETQZEW.js} +7 -7
  41. package/dist/{chunk-ITURCQMQ.cjs → chunk-URA25DU4.cjs} +5 -5
  42. package/dist/{chunk-4PTWZCOK.js → chunk-USF6EWYR.js} +7 -7
  43. package/dist/{chunk-P747CRAY.cjs → chunk-VZK3NLBH.cjs} +9 -9
  44. package/dist/chunk-WFEMJCXO.cjs +13 -0
  45. package/dist/{chunk-RVRVGG73.js → chunk-XNMZQSY5.js} +2 -2
  46. package/dist/{chunk-K4TWKF5U.cjs → chunk-XSQPVDFH.cjs} +15 -25
  47. package/dist/{chunk-JDSE4TQL.js → chunk-XTC2SLFT.js} +1 -1
  48. package/dist/{chunk-C5VDFRAD.cjs → chunk-XWNG2U4K.cjs} +2 -2
  49. package/dist/chunk-ZF6KIHXH.js +591 -0
  50. package/dist/{chunk-XWY4DF37.js → chunk-ZNZ7HVRW.js} +51 -88
  51. package/dist/components/accordion/index.cjs +34 -0
  52. package/dist/components/accordion/index.d.cts +299 -0
  53. package/dist/components/accordion/index.d.ts +299 -0
  54. package/dist/components/accordion/index.js +34 -0
  55. package/dist/components/alert/index.cjs +7 -7
  56. package/dist/components/alert/index.d.cts +2 -2
  57. package/dist/components/alert/index.d.ts +2 -2
  58. package/dist/components/alert/index.js +6 -6
  59. package/dist/components/avatar/index.cjs +4 -4
  60. package/dist/components/avatar/index.d.cts +3 -3
  61. package/dist/components/avatar/index.d.ts +3 -3
  62. package/dist/components/avatar/index.js +3 -3
  63. package/dist/components/badge/index.cjs +3 -3
  64. package/dist/components/badge/index.d.cts +1 -1
  65. package/dist/components/badge/index.d.ts +1 -1
  66. package/dist/components/badge/index.js +2 -2
  67. package/dist/components/button/index.cjs +8 -7
  68. package/dist/components/button/index.d.cts +204 -204
  69. package/dist/components/button/index.d.ts +204 -204
  70. package/dist/components/button/index.js +7 -6
  71. package/dist/components/card/index.cjs +5 -5
  72. package/dist/components/card/index.d.cts +206 -206
  73. package/dist/components/card/index.d.ts +206 -206
  74. package/dist/components/card/index.js +4 -4
  75. package/dist/components/checkbox/index.cjs +5 -5
  76. package/dist/components/checkbox/index.d.cts +408 -408
  77. package/dist/components/checkbox/index.d.ts +408 -408
  78. package/dist/components/checkbox/index.js +4 -4
  79. package/dist/components/chip/index.cjs +7 -7
  80. package/dist/components/chip/index.d.cts +205 -205
  81. package/dist/components/chip/index.d.ts +205 -205
  82. package/dist/components/chip/index.js +6 -6
  83. package/dist/components/divider/index.cjs +3 -3
  84. package/dist/components/divider/index.d.cts +3 -3
  85. package/dist/components/divider/index.d.ts +3 -3
  86. package/dist/components/divider/index.js +2 -2
  87. package/dist/components/field-group/index.cjs +5 -5
  88. package/dist/components/field-group/index.d.cts +8 -8
  89. package/dist/components/field-group/index.d.ts +8 -8
  90. package/dist/components/field-group/index.js +4 -4
  91. package/dist/components/input-otp/index.cjs +3 -3
  92. package/dist/components/input-otp/index.d.cts +2 -2
  93. package/dist/components/input-otp/index.d.ts +2 -2
  94. package/dist/components/input-otp/index.js +2 -2
  95. package/dist/components/radio/index.cjs +5 -5
  96. package/dist/components/radio/index.d.cts +419 -419
  97. package/dist/components/radio/index.d.ts +419 -419
  98. package/dist/components/radio/index.js +4 -4
  99. package/dist/components/select/index.cjs +8 -7
  100. package/dist/components/select/index.d.cts +12 -22
  101. package/dist/components/select/index.d.ts +12 -22
  102. package/dist/components/select/index.js +7 -6
  103. package/dist/components/skeleton/index.d.cts +1 -1
  104. package/dist/components/skeleton/index.d.ts +1 -1
  105. package/dist/components/spinner/index.cjs +5 -4
  106. package/dist/components/spinner/index.d.cts +1 -1
  107. package/dist/components/spinner/index.d.ts +1 -1
  108. package/dist/components/spinner/index.js +4 -3
  109. package/dist/components/switch/index.cjs +5 -5
  110. package/dist/components/switch/index.d.cts +409 -409
  111. package/dist/components/switch/index.d.ts +409 -409
  112. package/dist/components/switch/index.js +4 -4
  113. package/dist/components/text-area/index.cjs +4 -4
  114. package/dist/components/text-area/index.js +3 -3
  115. package/dist/components/text-field/index.cjs +3 -3
  116. package/dist/components/text-field/index.d.cts +3 -3
  117. package/dist/components/text-field/index.d.ts +3 -3
  118. package/dist/components/text-field/index.js +2 -2
  119. package/dist/components/typography/index.cjs +3 -3
  120. package/dist/components/typography/index.d.cts +5 -5
  121. package/dist/components/typography/index.d.ts +5 -5
  122. package/dist/components/typography/index.js +2 -2
  123. package/dist/components/view/index.cjs +3 -3
  124. package/dist/components/view/index.d.cts +8 -8
  125. package/dist/components/view/index.d.ts +8 -8
  126. package/dist/components/view/index.js +2 -2
  127. package/dist/index.cjs +51 -27
  128. package/dist/index.d.cts +3 -2
  129. package/dist/index.d.ts +3 -2
  130. package/dist/index.js +69 -45
  131. package/dist/system/index.cjs +9 -7
  132. package/dist/system/index.d.cts +46 -33
  133. package/dist/system/index.d.ts +46 -33
  134. package/dist/system/index.js +10 -8
  135. package/package.json +11 -1
@@ -0,0 +1,591 @@
1
+ import { ChevronDownIcon, Icon, IconContext } from "./chunk-FHUYHV6J.js";
2
+ import { useControllableState } from "./chunk-F6W3JQ7K.js";
3
+ import { PressableFeedback } from "./chunk-LIUO6D3D.js";
4
+ import { usePressState } from "./chunk-423RQBOX.js";
5
+ import { Slot, createSlotContext } from "./chunk-K72UDPVN.js";
6
+ import { createRecipe, radiusAxis } from "./chunk-4GTAZM2C.js";
7
+ import { useXAUITheme } from "./chunk-A3EGFI6T.js";
8
+ import { useStyleProps } from "./chunk-M63GFNKV.js";
9
+
10
+ // src/components/accordion/accordion-content.tsx
11
+ import { forwardRef } from "react";
12
+ import Animated from "react-native-reanimated";
13
+
14
+ // src/components/accordion/accordion.animation.ts
15
+ import { Easing, FadeIn, FadeOut, LinearTransition } from "react-native-reanimated";
16
+ var LAYOUT = LinearTransition.springify().damping(140).stiffness(1600).mass(4);
17
+ var CONTENT_MS = 200;
18
+ var contentEntering = FadeIn.duration(CONTENT_MS).easing(Easing.out(Easing.ease));
19
+ var contentExiting = FadeOut.duration(CONTENT_MS).easing(Easing.in(Easing.ease));
20
+ var INDICATOR_SPRING = {
21
+ damping: 140,
22
+ stiffness: 1e3,
23
+ mass: 4
24
+ };
25
+ var INDICATOR_ROTATION = [0, -180];
26
+
27
+ // src/components/accordion/accordion.context.ts
28
+ var [AccordionProvider, useAccordion] = createSlotContext("Accordion");
29
+ var [AccordionItemProvider, useAccordionItem] = createSlotContext("Accordion.Item");
30
+
31
+ // src/components/accordion/accordion-content.tsx
32
+ import { jsx } from "react/jsx-runtime";
33
+ var AccordionContent = forwardRef(function AccordionContent2({
34
+ children,
35
+ style,
36
+ ...props
37
+ }, ref) {
38
+ const {
39
+ contentStyle
40
+ } = useAccordion();
41
+ const {
42
+ isExpanded
43
+ } = useAccordionItem();
44
+ const [styleProps, rest] = useStyleProps(props);
45
+ if (!isExpanded) return null;
46
+ return /* @__PURE__ */jsx(Animated.View, {
47
+ ref,
48
+ entering: contentEntering,
49
+ exiting: contentExiting,
50
+ ...rest,
51
+ style: [contentStyle, styleProps, style],
52
+ children
53
+ });
54
+ });
55
+ AccordionContent.displayName = "XAUI.Accordion.Content";
56
+
57
+ // src/components/accordion/accordion-indicator.tsx
58
+ import { useEffect } from "react";
59
+ import Animated2, { interpolate, useAnimatedStyle, useSharedValue, withSpring } from "react-native-reanimated";
60
+ import { jsx as jsx2 } from "react/jsx-runtime";
61
+ const _worklet_14153867294208_init_data = {
62
+ code: "function chunkZF6KIHXHJs1(){const{interpolate,progress,INDICATOR_ROTATION}=this.__closure;return{transform:[{rotate:interpolate(progress.get(),[0,1],[INDICATOR_ROTATION[0],INDICATOR_ROTATION[1]])+\"deg\"}]};}",
63
+ location: "/home/runner/work/xaui/xaui/packages/native/dist/chunk-ZF6KIHXH.js",
64
+ sourceMap: "{\"version\":3,\"names\":[\"chunkZF6KIHXHJs1\",\"interpolate\",\"progress\",\"INDICATOR_ROTATION\",\"__closure\",\"transform\",\"rotate\",\"get\"],\"sources\":[\"/home/runner/work/xaui/xaui/packages/native/dist/chunk-ZF6KIHXH.js\"],\"mappings\":\"AA4FoC,SAAAA,iBAAA,QAAAC,WAAA,CAAAC,QAAA,CAAAC,kBAAA,OAAAC,SAAA,OAAO,CACvCC,SAAS,CAAE,CACT,CACEC,MAAM,CAAKL,WAAW,CAACC,QAAQ,CAACK,GAAG,CAAC,CAAC,CAAE,CAAC,CAAC,CAAE,CAAC,CAAC,CAAE,CAACJ,kBAAkB,CAAC,CAAC,CAAC,CAAEA,kBAAkB,CAAC,CAAC,CAAC,CAAC,CAAC,MAChG,CAAC,CAEL,CAAC\",\"ignoreList\":[]}"
65
+ };
66
+ function AccordionIndicator({
67
+ as = ChevronDownIcon,
68
+ ...props
69
+ }) {
70
+ const {
71
+ indicatorStyle
72
+ } = useAccordion();
73
+ const {
74
+ isExpanded
75
+ } = useAccordionItem();
76
+ const progress = useSharedValue(isExpanded ? 1 : 0);
77
+ useEffect(() => {
78
+ progress.set(withSpring(isExpanded ? 1 : 0, INDICATOR_SPRING));
79
+ }, [isExpanded, progress]);
80
+ const rotation = useAnimatedStyle(function chunkZF6KIHXHJs1Factory({
81
+ _worklet_14153867294208_init_data,
82
+ interpolate,
83
+ progress,
84
+ INDICATOR_ROTATION
85
+ }) {
86
+ const _e = [new global.Error(), -4, -27];
87
+ const chunkZF6KIHXHJs1 = () => ({
88
+ transform: [{
89
+ rotate: `${interpolate(progress.get(), [0, 1], [INDICATOR_ROTATION[0], INDICATOR_ROTATION[1]])}deg`
90
+ }]
91
+ });
92
+ chunkZF6KIHXHJs1.__closure = {
93
+ interpolate,
94
+ progress,
95
+ INDICATOR_ROTATION
96
+ };
97
+ chunkZF6KIHXHJs1.__workletHash = 14153867294208;
98
+ chunkZF6KIHXHJs1.__pluginVersion = "0.7.4";
99
+ chunkZF6KIHXHJs1.__initData = _worklet_14153867294208_init_data;
100
+ chunkZF6KIHXHJs1.__stackDetails = _e;
101
+ return chunkZF6KIHXHJs1;
102
+ }({
103
+ _worklet_14153867294208_init_data,
104
+ interpolate,
105
+ progress,
106
+ INDICATOR_ROTATION
107
+ }));
108
+ return /* @__PURE__ */jsx2(Animated2.View, {
109
+ style: [indicatorStyle, rotation],
110
+ children: /* @__PURE__ */jsx2(Icon, {
111
+ as,
112
+ ...props
113
+ })
114
+ });
115
+ }
116
+ AccordionIndicator.displayName = "XAUI.Accordion.Indicator";
117
+
118
+ // src/components/accordion/accordion-item.tsx
119
+ import { forwardRef as forwardRef2, useMemo } from "react";
120
+ import Animated3 from "react-native-reanimated";
121
+ import { jsx as jsx3 } from "react/jsx-runtime";
122
+ var AccordionItem = forwardRef2(function AccordionItem2({
123
+ value,
124
+ children,
125
+ isDisabled = false,
126
+ style,
127
+ ...props
128
+ }, ref) {
129
+ const {
130
+ itemStyle,
131
+ isDisabled: isRootDisabled,
132
+ isExpanded
133
+ } = useAccordion();
134
+ const [styleProps, rest] = useStyleProps(props);
135
+ const expanded = isExpanded(value);
136
+ const disabled = isRootDisabled || isDisabled;
137
+ const context = useMemo(() => ({
138
+ value,
139
+ isExpanded: expanded,
140
+ isDisabled: disabled
141
+ }), [value, expanded, disabled]);
142
+ return /* @__PURE__ */jsx3(AccordionItemProvider, {
143
+ value: context,
144
+ children: /* @__PURE__ */jsx3(Animated3.View, {
145
+ ref,
146
+ layout: LAYOUT,
147
+ ...rest,
148
+ style: [itemStyle, styleProps, style],
149
+ children: typeof children === "function" ? children(context) : children
150
+ })
151
+ });
152
+ });
153
+ AccordionItem.displayName = "XAUI.Accordion.Item";
154
+
155
+ // src/components/accordion/accordion-trigger.tsx
156
+ import { Children, forwardRef as forwardRef3, useCallback } from "react";
157
+ import { Text } from "react-native";
158
+ import { jsx as jsx4 } from "react/jsx-runtime";
159
+ var AccordionTrigger = forwardRef3(function AccordionTrigger2({
160
+ children,
161
+ asChild = false,
162
+ accessibilityRole = "button",
163
+ accessibilityState,
164
+ style,
165
+ onPress,
166
+ onPressIn,
167
+ onPressOut,
168
+ ...props
169
+ }, ref) {
170
+ const {
171
+ triggerStyle,
172
+ triggerPressedStyle,
173
+ labelStyle,
174
+ glyph,
175
+ toggle
176
+ } = useAccordion();
177
+ const {
178
+ value,
179
+ isExpanded,
180
+ isDisabled
181
+ } = useAccordionItem();
182
+ const [styleProps, rest] = useStyleProps(props);
183
+ const [isPressed, press] = usePressState({
184
+ onPressIn,
185
+ onPressOut
186
+ });
187
+ const handlePress = useCallback(event => {
188
+ onPress?.(event);
189
+ toggle(value);
190
+ }, [onPress, toggle, value]);
191
+ return /* @__PURE__ */jsx4(IconContext.Provider, {
192
+ value: glyph,
193
+ children: /* @__PURE__ */jsx4(PressableFeedback, {
194
+ ref,
195
+ isPressed,
196
+ isDisabled,
197
+ asChild,
198
+ accessibilityRole,
199
+ accessibilityState: {
200
+ disabled: isDisabled,
201
+ expanded: isExpanded,
202
+ ...accessibilityState
203
+ },
204
+ ...rest,
205
+ style: [triggerStyle, isPressed && triggerPressedStyle, styleProps, typeof style === "function" ? style({
206
+ pressed: isPressed
207
+ }) : style],
208
+ onPress: handlePress,
209
+ onPressIn: press.onPressIn,
210
+ onPressOut: press.onPressOut,
211
+ children: asChild ? children : wrapText(children, labelStyle)
212
+ })
213
+ });
214
+ });
215
+ AccordionTrigger.displayName = "XAUI.Accordion.Trigger";
216
+ function wrapText(children, style) {
217
+ return Children.map(children, child => typeof child === "string" || typeof child === "number" ? /* @__PURE__ */jsx4(Text, {
218
+ style,
219
+ children: child
220
+ }) : child);
221
+ }
222
+
223
+ // src/components/accordion/accordion.tsx
224
+ import { Children as Children2, forwardRef as forwardRef4, Fragment, useMemo as useMemo3 } from "react";
225
+ import { StyleSheet as StyleSheet2 } from "react-native";
226
+ import Animated4 from "react-native-reanimated";
227
+
228
+ // src/components/accordion/accordion.hook.ts
229
+ import { useCallback as useCallback2, useMemo as useMemo2 } from "react";
230
+ function useExpansion({
231
+ value,
232
+ defaultValue,
233
+ onValueChange,
234
+ selectionMode,
235
+ isCollapsible
236
+ }) {
237
+ const [current, setCurrent] = useControllableState({
238
+ value,
239
+ defaultValue: defaultValue ?? (selectionMode === "multiple" ? [] : ""),
240
+ onChange: onValueChange
241
+ });
242
+ const isExpanded = useCallback2(item => Array.isArray(current) ? current.includes(item) : current === item, [current]);
243
+ const toggle = useCallback2(item => {
244
+ setCurrent(value_ => nextValue(value_, item, selectionMode, isCollapsible));
245
+ }, [isCollapsible, selectionMode, setCurrent]);
246
+ return useMemo2(() => ({
247
+ isExpanded,
248
+ toggle
249
+ }), [isExpanded, toggle]);
250
+ }
251
+ function nextValue(current, item, selectionMode, isCollapsible) {
252
+ if (selectionMode === "multiple") {
253
+ const list = Array.isArray(current) ? current : current ? [current] : [];
254
+ if (!list.includes(item)) return [...list, item];
255
+ if (!isCollapsible && list.length === 1) return current;
256
+ return list.filter(value => value !== item);
257
+ }
258
+ if (current !== item) return item;
259
+ return isCollapsible ? "" : current;
260
+ }
261
+
262
+ // src/components/accordion/accordion.recipe.ts
263
+ import { StyleSheet } from "react-native";
264
+ var SLOTS = ["root", "container", "separator", "item", "trigger", "indicator", "content"];
265
+ var VARIANT_TOKENS = {
266
+ primary: {
267
+ bg: "surface",
268
+ fg: "surfaceForeground"
269
+ },
270
+ secondary: {
271
+ bg: "surfaceSecondary",
272
+ fg: "surfaceSecondaryForeground"
273
+ },
274
+ tertiary: {
275
+ border: "border",
276
+ fg: "foreground"
277
+ },
278
+ ghost: {
279
+ fg: "foreground"
280
+ }
281
+ };
282
+ var HAIRLINE = StyleSheet.hairlineWidth;
283
+ var SIZES = {
284
+ xs: {
285
+ padding: 2.5,
286
+ gap: 2.5,
287
+ label: "sm",
288
+ glyph: "md",
289
+ radius: "md"
290
+ },
291
+ sm: {
292
+ padding: 3,
293
+ gap: 3,
294
+ label: "md",
295
+ glyph: "lg",
296
+ radius: "lg"
297
+ },
298
+ md: {
299
+ padding: 3,
300
+ gap: 4,
301
+ label: "md",
302
+ glyph: "lg",
303
+ radius: "xl"
304
+ },
305
+ lg: {
306
+ padding: 4,
307
+ gap: 4,
308
+ label: "lg",
309
+ glyph: "xl",
310
+ radius: "2xl"
311
+ }
312
+ };
313
+ var TRIGGER_PADDING_VERTICAL = 4;
314
+ function sizeAxis(step) {
315
+ const {
316
+ padding,
317
+ gap,
318
+ label,
319
+ glyph,
320
+ radius
321
+ } = step;
322
+ return theme => ({
323
+ // Both layers, at the same value: the outer one draws the corner, the inner one is
324
+ // what a pressed row is cut against.
325
+ root: {
326
+ borderRadius: theme.radius[radius]
327
+ },
328
+ container: {
329
+ borderRadius: theme.radius[radius]
330
+ },
331
+ trigger: {
332
+ paddingVertical: theme.spacing(TRIGGER_PADDING_VERTICAL),
333
+ paddingHorizontal: theme.spacing(padding),
334
+ gap: theme.spacing(gap),
335
+ fontSize: theme.fontSizes[label],
336
+ lineHeight: theme.lineHeights[label]
337
+ },
338
+ indicator: {
339
+ fontSize: theme.fontSizes[glyph]
340
+ },
341
+ content: {
342
+ paddingHorizontal: theme.spacing(padding),
343
+ paddingBottom: theme.spacing(TRIGGER_PADDING_VERTICAL)
344
+ }
345
+ });
346
+ }
347
+ var accordionRecipe = createRecipe({
348
+ slots: SLOTS,
349
+ base: theme => ({
350
+ // The root carries the shadow and the border; it must **not** clip. On iOS
351
+ // `overflow: 'hidden'` sets `masksToBounds`, which clips the layer's own shadow along
352
+ // with everything else, and a lifted `primary` would have none at all.
353
+ root: {
354
+ flexDirection: "column",
355
+ borderCurve: "continuous"
356
+ },
357
+ // So the clipping is one layer in. This is the one extra node in the component, and
358
+ // it is here for a platform constraint rather than for layout: a single layer cannot
359
+ // both cast a shadow and clip its children on iOS. Without it a pressed row paints
360
+ // over the card's rounded corner, square, for as long as a finger is on it.
361
+ container: {
362
+ flexDirection: "column",
363
+ overflow: "hidden"
364
+ },
365
+ separator: {
366
+ height: HAIRLINE,
367
+ backgroundColor: theme.colors.separator
368
+ },
369
+ // This one is load-bearing: it is what makes the height animation read as a panel
370
+ // unrolling rather than as content sliding out from behind the row above it.
371
+ item: {
372
+ flexDirection: "column",
373
+ overflow: "hidden"
374
+ },
375
+ trigger: {
376
+ flexDirection: "row",
377
+ alignItems: "center",
378
+ justifyContent: "space-between",
379
+ fontFamily: theme.fontFamilies.body,
380
+ fontWeight: theme.fontWeights.medium
381
+ },
382
+ indicator: {
383
+ alignItems: "center",
384
+ justifyContent: "center"
385
+ }
386
+ }),
387
+ variantTokens: VARIANT_TOKENS,
388
+ /**
389
+ * The fill is the **root's**, never the row's. A row that painted its own would stack
390
+ * two fills where the separator sits, and the hairline would disappear into the seam.
391
+ */
392
+ paint: (theme, colors) => ({
393
+ root: {
394
+ backgroundColor: colors.bg,
395
+ borderColor: colors.border,
396
+ borderWidth: colors.border ? theme.borderWidth.default : 0
397
+ },
398
+ trigger: {
399
+ color: colors.fg
400
+ },
401
+ indicator: {
402
+ color: theme.colors.muted
403
+ }
404
+ }),
405
+ variants: {
406
+ size: {
407
+ xs: sizeAxis(SIZES.xs),
408
+ sm: sizeAxis(SIZES.sm),
409
+ md: sizeAxis(SIZES.md),
410
+ lg: sizeAxis(SIZES.lg)
411
+ },
412
+ radius: radiusAxis("root", "container")
413
+ },
414
+ /**
415
+ * A container inset from its own edge, and its separators inset with it. `ghost` has no
416
+ * edge to be inset from, so its rows run the full width and the hairline runs with them
417
+ * — which is the difference between a list on a page and a list in a box.
418
+ *
419
+ * `primary` is the only one lifted. It is the one that reads as a card, and HeroUI puts
420
+ * their `--shadow-surface` on exactly that variant. `secondary` and `tertiary` have too
421
+ * little fill to lift — a shadow under either would read as dirt rather than as height
422
+ * — and in dark mode the theme's surface shadow is already nothing (§4), which is why
423
+ * this names the role rather than a set of numbers.
424
+ */
425
+ compoundVariants: [...["primary", "secondary", "tertiary"].map(variant => ({
426
+ when: {
427
+ variant
428
+ },
429
+ style: theme => ({
430
+ separator: {
431
+ marginHorizontal: theme.spacing(3)
432
+ }
433
+ })
434
+ })), {
435
+ when: {
436
+ variant: "primary"
437
+ },
438
+ style: theme => ({
439
+ root: theme.shadows.surface
440
+ })
441
+ }],
442
+ states: {
443
+ // On the row, not on the root: pressing one row must not tint the whole container.
444
+ pressed: theme => ({
445
+ trigger: {
446
+ backgroundColor: theme.colors.defaultSoftPressed
447
+ }
448
+ }),
449
+ disabled: theme => ({
450
+ root: {
451
+ opacity: theme.opacity.disabled
452
+ }
453
+ })
454
+ },
455
+ defaultVariants: {
456
+ variant: "ghost",
457
+ size: "md"
458
+ }
459
+ });
460
+
461
+ // src/components/accordion/accordion.tsx
462
+ import { jsx as jsx5, jsxs } from "react/jsx-runtime";
463
+ var AccordionRoot = forwardRef4(function Accordion({
464
+ children,
465
+ variant,
466
+ size,
467
+ radius,
468
+ color,
469
+ selectionMode = "single",
470
+ value,
471
+ defaultValue,
472
+ onValueChange,
473
+ isDisabled = false,
474
+ isCollapsible = true,
475
+ hasSeparator = true,
476
+ asChild = false,
477
+ style,
478
+ ...props
479
+ }, ref) {
480
+ const theme = useXAUITheme();
481
+ const [styleProps, rest] = useStyleProps(props);
482
+ const {
483
+ isExpanded,
484
+ toggle
485
+ } = useExpansion({
486
+ value,
487
+ defaultValue,
488
+ onValueChange,
489
+ selectionMode,
490
+ isCollapsible
491
+ });
492
+ const selection = {
493
+ variant,
494
+ size,
495
+ radius
496
+ };
497
+ const styles = accordionRecipe.resolve({
498
+ theme,
499
+ selection,
500
+ states: {
501
+ disabled: isDisabled
502
+ }
503
+ });
504
+ const pressed = accordionRecipe.resolve({
505
+ theme,
506
+ selection,
507
+ states: {
508
+ pressed: true
509
+ }
510
+ });
511
+ const tint = color ? accordionRecipe.tint({
512
+ theme,
513
+ color,
514
+ selection
515
+ }) : void 0;
516
+ const context = useMemo3(() => {
517
+ const trigger = StyleSheet2.flatten([styles.trigger, tint?.trigger]);
518
+ const indicator = StyleSheet2.flatten([styles.indicator, tint?.indicator]);
519
+ return {
520
+ separatorStyle: styles.separator,
521
+ itemStyle: styles.item,
522
+ triggerStyle: tint ? [styles.trigger, tint.trigger] : styles.trigger,
523
+ triggerPressedStyle: pressed.trigger,
524
+ indicatorStyle: styles.indicator,
525
+ contentStyle: styles.content,
526
+ // The trigger is a row of views, so a stringifiable child is wrapped in a `Text` of
527
+ // its own — and that text takes the type the recipe put on the row.
528
+ labelStyle: {
529
+ color: trigger.color,
530
+ fontFamily: trigger.fontFamily,
531
+ fontWeight: trigger.fontWeight,
532
+ fontSize: trigger.fontSize,
533
+ lineHeight: trigger.lineHeight
534
+ },
535
+ glyph: {
536
+ size: indicator.fontSize,
537
+ color: typeof indicator.color === "string" ? indicator.color : void 0
538
+ },
539
+ isDisabled,
540
+ isExpanded,
541
+ toggle
542
+ };
543
+ }, [styles, pressed, tint, isDisabled, isExpanded, toggle]);
544
+ const rootStyle = [styles.root, tint?.root, styleProps, style];
545
+ const items = Children2.toArray(children);
546
+ const rows = items.map((child, index) => /* @__PURE__ */jsxs(Fragment, {
547
+ children: [child, hasSeparator && index < items.length - 1 ? /* @__PURE__ */jsx5(Animated4.View, {
548
+ layout: LAYOUT,
549
+ style: styles.separator
550
+ }) : null]
551
+ }, index));
552
+ return /* @__PURE__ */jsx5(AccordionProvider, {
553
+ value: context,
554
+ children: asChild ? /* @__PURE__ */jsx5(Slot, {
555
+ ref,
556
+ ...rest,
557
+ style: rootStyle,
558
+ children
559
+ }) :
560
+ // Two layers, and the only place in the library where a root has one inside it.
561
+ // A single layer cannot both cast a shadow and clip its children on iOS, and this
562
+ // component needs both: `primary` is lifted, and a pressed row has to be cut
563
+ // against the card's rounded corner rather than painting over it.
564
+ //
565
+ // The layout transition is on each of them as well as on every row. Without it on
566
+ // the outer one the accordion's own height jumps to its new total in one frame
567
+ // while the rows inside it are still animating.
568
+ /* @__PURE__ */
569
+ jsx5(Animated4.View, {
570
+ ref,
571
+ layout: LAYOUT,
572
+ ...rest,
573
+ style: rootStyle,
574
+ children: /* @__PURE__ */jsx5(Animated4.View, {
575
+ layout: LAYOUT,
576
+ style: styles.container,
577
+ children: rows
578
+ })
579
+ })
580
+ });
581
+ });
582
+ AccordionRoot.displayName = "XAUI.Accordion.Root";
583
+
584
+ // src/components/accordion/index.ts
585
+ var Accordion2 = Object.assign(AccordionRoot, {
586
+ Item: AccordionItem,
587
+ Trigger: AccordionTrigger,
588
+ Indicator: AccordionIndicator,
589
+ Content: AccordionContent
590
+ });
591
+ export { LAYOUT, useAccordion, useAccordionItem, AccordionContent, AccordionIndicator, AccordionItem, AccordionTrigger, accordionRecipe, AccordionRoot, Accordion2 as Accordion };