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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (203) hide show
  1. package/dist/chunk-2EGR4LWD.js +145 -0
  2. package/dist/chunk-2NRZKJG7.js +531 -0
  3. package/dist/chunk-2PMXMKS5.js +67 -0
  4. package/dist/chunk-2XPG2243.js +586 -0
  5. package/dist/chunk-36PRYGAM.js +13 -0
  6. package/dist/chunk-3E7CDKFO.cjs +696 -0
  7. package/dist/chunk-3GFRSZYR.js +54 -0
  8. package/dist/chunk-423RQBOX.js +21 -0
  9. package/dist/chunk-4CUZZWFW.js +92 -0
  10. package/dist/chunk-4GTAZM2C.js +174 -0
  11. package/dist/chunk-4KFKWBN5.cjs +89 -0
  12. package/dist/{chunk-3QBT3Q65.cjs → chunk-57SJ4LJF.cjs} +7 -2
  13. package/dist/chunk-5R26NM4M.cjs +402 -0
  14. package/dist/chunk-5VKYNBNA.js +607 -0
  15. package/dist/chunk-64MXEVT3.js +66 -0
  16. package/dist/chunk-6DOLGZVV.cjs +147 -0
  17. package/dist/chunk-6L2TS2R3.cjs +92 -0
  18. package/dist/chunk-6UEZJRVI.js +669 -0
  19. package/dist/chunk-734MFAX4.js +27 -0
  20. package/dist/chunk-73RKQC5X.js +104 -0
  21. package/dist/chunk-7DPL3ZDS.cjs +21 -0
  22. package/dist/chunk-7EIHHOHP.cjs +42 -0
  23. package/dist/chunk-7GHM4GKL.cjs +119 -0
  24. package/dist/chunk-7YF5NAHQ.cjs +74 -0
  25. package/dist/{chunk-X2K2FX3W.js → chunk-A3EGFI6T.js} +6 -1
  26. package/dist/chunk-ABAGZTXZ.cjs +736 -0
  27. package/dist/{chunk-AW63PTQ4.cjs → chunk-ACAPTWE3.cjs} +85 -81
  28. package/dist/chunk-AMCSSOJT.cjs +104 -0
  29. package/dist/chunk-BA2DBSAN.js +102 -0
  30. package/dist/chunk-BRRXFOBY.js +431 -0
  31. package/dist/chunk-C5YLPCFC.cjs +293 -0
  32. package/dist/chunk-DA3OKXHV.cjs +700 -0
  33. package/dist/chunk-DD4276RF.js +366 -0
  34. package/dist/chunk-DG2I4PJG.js +701 -0
  35. package/dist/chunk-DHGLGSH6.js +661 -0
  36. package/dist/chunk-DIBUQ46Y.js +346 -0
  37. package/dist/chunk-EGLLDKN6.js +9 -0
  38. package/dist/chunk-EJQCQPET.cjs +9 -0
  39. package/dist/chunk-EKS3W46M.cjs +66 -0
  40. package/dist/chunk-EZEYMLO3.js +402 -0
  41. package/dist/chunk-F6CQ6CBI.cjs +112 -0
  42. package/dist/chunk-F6W3JQ7K.js +42 -0
  43. package/dist/chunk-FHUYHV6J.js +89 -0
  44. package/dist/chunk-FNEUOBCV.cjs +174 -0
  45. package/dist/chunk-G7P3ERYF.cjs +478 -0
  46. package/dist/chunk-GA6PBWNT.js +147 -0
  47. package/dist/chunk-GFUZ3MUT.cjs +455 -0
  48. package/dist/chunk-GGW43Q37.cjs +1 -0
  49. package/dist/chunk-GTR5X65M.cjs +27 -0
  50. package/dist/chunk-H4E4HDEP.cjs +13 -0
  51. package/dist/chunk-H7DS4IO7.js +198 -0
  52. package/dist/chunk-HDVVZG4S.cjs +198 -0
  53. package/dist/chunk-IKJVLJKT.js +151 -0
  54. package/dist/chunk-J3MB4PI5.cjs +531 -0
  55. package/dist/chunk-K72UDPVN.js +119 -0
  56. package/dist/chunk-KCMYU7WF.js +86 -0
  57. package/dist/chunk-LRN3RNDO.js +940 -0
  58. package/dist/chunk-LTX6TB5I.js +124 -0
  59. package/dist/chunk-LUPCPLND.cjs +145 -0
  60. package/dist/chunk-M63GFNKV.js +194 -0
  61. package/dist/chunk-N3KTZMPG.js +293 -0
  62. package/dist/chunk-NCTOTTVW.js +13 -0
  63. package/dist/chunk-NWGLP6JX.cjs +410 -0
  64. package/dist/chunk-R73XQK7X.cjs +314 -0
  65. package/dist/chunk-RU7JCMWC.cjs +881 -0
  66. package/dist/chunk-SNIHUKDA.cjs +184 -0
  67. package/dist/chunk-T5FV5F7A.cjs +607 -0
  68. package/dist/chunk-TDTUAIFF.cjs +153 -0
  69. package/dist/chunk-TJ74XVZN.cjs +431 -0
  70. package/dist/chunk-TK44VBIE.cjs +194 -0
  71. package/dist/chunk-UAWBAD4E.cjs +346 -0
  72. package/dist/chunk-UFTCTTKK.js +381 -0
  73. package/dist/chunk-WDDXU3OH.cjs +67 -0
  74. package/dist/chunk-WFEMJCXO.cjs +13 -0
  75. package/dist/chunk-WHJTBTYM.js +0 -0
  76. package/dist/{chunk-2KXQATVL.js → chunk-WKCQ6VGW.js} +59 -55
  77. package/dist/chunk-XFPQFCEK.js +455 -0
  78. package/dist/chunk-XSQPVDFH.cjs +60 -0
  79. package/dist/chunk-XTC2SLFT.js +153 -0
  80. package/dist/chunk-XV735BSA.cjs +366 -0
  81. package/dist/chunk-XWNG2U4K.cjs +124 -0
  82. package/dist/chunk-YGYYJ3LQ.js +314 -0
  83. package/dist/chunk-YVHT2UVW.js +74 -0
  84. package/dist/chunk-ZFOOJK37.cjs +86 -0
  85. package/dist/close-button.type-BUYuoSt2.d.ts +36 -0
  86. package/dist/close-button.type-CHsgZ3wO.d.cts +36 -0
  87. package/dist/components/accordion/index.cjs +35 -0
  88. package/dist/components/accordion/index.d.cts +299 -0
  89. package/dist/components/accordion/index.d.ts +299 -0
  90. package/dist/components/accordion/index.js +35 -0
  91. package/dist/components/alert/index.cjs +20 -0
  92. package/dist/components/alert/index.d.cts +169 -0
  93. package/dist/components/alert/index.d.ts +169 -0
  94. package/dist/components/alert/index.js +20 -0
  95. package/dist/components/avatar/index.cjs +16 -0
  96. package/dist/components/avatar/index.d.cts +131 -0
  97. package/dist/components/avatar/index.d.ts +131 -0
  98. package/dist/components/avatar/index.js +16 -0
  99. package/dist/components/badge/index.cjs +15 -0
  100. package/dist/components/badge/index.d.cts +157 -0
  101. package/dist/components/badge/index.d.ts +157 -0
  102. package/dist/components/badge/index.js +15 -0
  103. package/dist/components/button/index.cjs +22 -0
  104. package/dist/components/button/index.d.cts +613 -0
  105. package/dist/components/button/index.d.ts +613 -0
  106. package/dist/components/button/index.js +22 -0
  107. package/dist/components/card/index.cjs +22 -0
  108. package/dist/components/card/index.d.cts +620 -0
  109. package/dist/components/card/index.d.ts +620 -0
  110. package/dist/components/card/index.js +22 -0
  111. package/dist/components/checkbox/index.cjs +26 -0
  112. package/dist/components/checkbox/index.d.cts +1136 -0
  113. package/dist/components/checkbox/index.d.ts +1136 -0
  114. package/dist/components/checkbox/index.js +26 -0
  115. package/dist/components/chip/index.cjs +20 -0
  116. package/dist/components/chip/index.d.cts +608 -0
  117. package/dist/components/chip/index.d.ts +608 -0
  118. package/dist/components/chip/index.js +20 -0
  119. package/dist/components/divider/index.cjs +13 -0
  120. package/dist/components/divider/index.d.cts +117 -0
  121. package/dist/components/divider/index.d.ts +117 -0
  122. package/dist/components/divider/index.js +13 -0
  123. package/dist/components/field-group/index.cjs +27 -0
  124. package/dist/components/field-group/index.d.cts +270 -0
  125. package/dist/components/field-group/index.d.ts +270 -0
  126. package/dist/components/field-group/index.js +27 -0
  127. package/dist/components/input-otp/index.cjs +29 -0
  128. package/dist/components/input-otp/index.d.cts +325 -0
  129. package/dist/components/input-otp/index.d.ts +325 -0
  130. package/dist/components/input-otp/index.js +29 -0
  131. package/dist/components/menu/index.cjs +49 -0
  132. package/dist/components/menu/index.d.cts +351 -0
  133. package/dist/components/menu/index.d.ts +351 -0
  134. package/dist/components/menu/index.js +49 -0
  135. package/dist/components/popover/index.cjs +38 -0
  136. package/dist/components/popover/index.d.cts +254 -0
  137. package/dist/components/popover/index.d.ts +254 -0
  138. package/dist/components/popover/index.js +38 -0
  139. package/dist/components/radio/index.cjs +26 -0
  140. package/dist/components/radio/index.d.cts +1102 -0
  141. package/dist/components/radio/index.d.ts +1102 -0
  142. package/dist/components/radio/index.js +26 -0
  143. package/dist/components/select/index.cjs +50 -0
  144. package/dist/components/select/index.d.cts +498 -0
  145. package/dist/components/select/index.d.ts +498 -0
  146. package/dist/components/select/index.js +50 -0
  147. package/dist/components/skeleton/index.cjs +11 -0
  148. package/dist/components/skeleton/index.d.cts +111 -0
  149. package/dist/components/skeleton/index.d.ts +111 -0
  150. package/dist/components/skeleton/index.js +11 -0
  151. package/dist/components/spinner/index.cjs +17 -0
  152. package/dist/components/spinner/index.d.cts +104 -0
  153. package/dist/components/spinner/index.d.ts +104 -0
  154. package/dist/components/spinner/index.js +17 -0
  155. package/dist/components/switch/index.cjs +27 -0
  156. package/dist/components/switch/index.d.cts +1154 -0
  157. package/dist/components/switch/index.d.ts +1154 -0
  158. package/dist/components/switch/index.js +27 -0
  159. package/dist/components/text-area/index.cjs +14 -0
  160. package/dist/components/text-area/index.d.cts +73 -0
  161. package/dist/components/text-area/index.d.ts +73 -0
  162. package/dist/components/text-area/index.js +14 -0
  163. package/dist/components/text-field/index.cjs +25 -0
  164. package/dist/components/text-field/index.d.cts +205 -0
  165. package/dist/components/text-field/index.d.ts +205 -0
  166. package/dist/components/text-field/index.js +25 -0
  167. package/dist/components/typography/index.cjs +15 -0
  168. package/dist/components/typography/index.d.cts +116 -0
  169. package/dist/components/typography/index.d.ts +116 -0
  170. package/dist/components/typography/index.js +15 -0
  171. package/dist/components/view/index.cjs +17 -0
  172. package/dist/components/view/index.d.cts +152 -0
  173. package/dist/components/view/index.d.ts +152 -0
  174. package/dist/components/view/index.js +17 -0
  175. package/dist/create-recipe-BdVd2ffi.d.ts +114 -0
  176. package/dist/create-recipe-dC7wMfnj.d.cts +114 -0
  177. package/dist/icon.type-Kml72iSz.d.ts +73 -0
  178. package/dist/icon.type-d_i9ma-i.d.cts +73 -0
  179. package/dist/index.cjs +400 -4
  180. package/dist/index.d.cts +118 -4
  181. package/dist/index.d.ts +118 -4
  182. package/dist/index.js +423 -27
  183. package/dist/placement-DHa0Rrh1.d.cts +38 -0
  184. package/dist/placement-DHa0Rrh1.d.ts +38 -0
  185. package/dist/pressable-feedback.type-BA2C9sSz.d.cts +127 -0
  186. package/dist/pressable-feedback.type-Bs4dQlGj.d.ts +127 -0
  187. package/dist/style-props.type-CfnoGEP7.d.cts +31 -0
  188. package/dist/style-props.type-CfnoGEP7.d.ts +31 -0
  189. package/dist/system/index.cjs +73 -4
  190. package/dist/system/index.d.cts +379 -193
  191. package/dist/system/index.d.ts +379 -193
  192. package/dist/system/index.js +87 -18
  193. package/dist/text-field.type-0l73acce.d.ts +167 -0
  194. package/dist/text-field.type-DBh06DU5.d.cts +167 -0
  195. package/dist/theme/index.cjs +5 -3
  196. package/dist/theme/index.d.cts +55 -24
  197. package/dist/theme/index.d.ts +55 -24
  198. package/dist/theme/index.js +4 -2
  199. package/dist/{theme.type-C9bFJKFm.d.cts → theme.type-C2gNHpEx.d.cts} +1 -1
  200. package/dist/{theme.type-C9bFJKFm.d.ts → theme.type-C2gNHpEx.d.ts} +1 -1
  201. package/package.json +254 -18
  202. package/dist/chunk-ECDWSSHJ.js +0 -688
  203. package/dist/chunk-IYFGO523.cjs +0 -688
@@ -0,0 +1,67 @@
1
+ import {
2
+ useStyleProps
3
+ } from "./chunk-M63GFNKV.js";
4
+
5
+ // src/system/portal/portal-context.ts
6
+ import { createContext } from "react";
7
+ var PortalContext = createContext(null);
8
+
9
+ // src/system/portal/portal.tsx
10
+ import { useContext, useId, useLayoutEffect } from "react";
11
+ function Portal({ children }) {
12
+ const context = useContext(PortalContext);
13
+ const key = useId();
14
+ useLayoutEffect(() => {
15
+ context?.addPortal(key, children);
16
+ }, [children, context, key]);
17
+ useLayoutEffect(() => {
18
+ return () => context?.removePortal(key);
19
+ }, [context, key]);
20
+ return null;
21
+ }
22
+ Portal.displayName = "XAUI.Portal";
23
+
24
+ // src/system/portal/portal-host.tsx
25
+ import { Fragment, useCallback, useMemo, useRef, useState } from "react";
26
+ import { StyleSheet, View } from "react-native";
27
+ import { jsx, jsxs } from "react/jsx-runtime";
28
+ var styles = StyleSheet.create({
29
+ container: { flex: 1 }
30
+ });
31
+ function PortalHost({ children, ...props }) {
32
+ const [styleProps] = useStyleProps(props);
33
+ const [portals, setPortals] = useState(/* @__PURE__ */ new Map());
34
+ const [origin, setOrigin] = useState({ x: 0, y: 0 });
35
+ const node = useRef(null);
36
+ const measure = useCallback((_event) => {
37
+ node.current?.measureInWindow((x, y) => {
38
+ setOrigin((current) => current.x === x && current.y === y ? current : { x, y });
39
+ });
40
+ }, []);
41
+ const addPortal = useCallback((key, element) => {
42
+ setPortals((current) => new Map(current).set(key, element));
43
+ }, []);
44
+ const removePortal = useCallback((key) => {
45
+ setPortals((current) => {
46
+ if (!current.has(key)) return current;
47
+ const next = new Map(current);
48
+ next.delete(key);
49
+ return next;
50
+ });
51
+ }, []);
52
+ const methods = useMemo(
53
+ () => ({ addPortal, removePortal, origin }),
54
+ [addPortal, removePortal, origin]
55
+ );
56
+ return /* @__PURE__ */ jsx(PortalContext.Provider, { value: methods, children: /* @__PURE__ */ jsxs(View, { ref: node, onLayout: measure, style: [styles.container, styleProps], children: [
57
+ children,
58
+ Array.from(portals, ([key, element]) => /* @__PURE__ */ jsx(Fragment, { children: element }, key))
59
+ ] }) });
60
+ }
61
+ PortalHost.displayName = "XAUI.PortalHost";
62
+
63
+ export {
64
+ PortalContext,
65
+ Portal,
66
+ PortalHost
67
+ };
@@ -0,0 +1,586 @@
1
+ import { INDICATOR_ROTATION, INDICATOR_SPRING } from "./chunk-64MXEVT3.js";
2
+ import { ChevronDownIcon, Icon, IconContext } from "./chunk-FHUYHV6J.js";
3
+ import { useControllableState } from "./chunk-F6W3JQ7K.js";
4
+ import { PressableFeedback } from "./chunk-6UEZJRVI.js";
5
+ import { usePressState } from "./chunk-423RQBOX.js";
6
+ import { createRecipe, radiusAxis } from "./chunk-4GTAZM2C.js";
7
+ import { useXAUITheme } from "./chunk-A3EGFI6T.js";
8
+ import { Slot, createSlotContext } from "./chunk-K72UDPVN.js";
9
+ import { useStyleProps } from "./chunk-M63GFNKV.js";
10
+
11
+ // src/components/accordion/accordion-content.tsx
12
+ import { forwardRef } from "react";
13
+ import Animated from "react-native-reanimated";
14
+
15
+ // src/components/accordion/accordion.animation.ts
16
+ import { Easing, FadeIn, FadeOut, LinearTransition } from "react-native-reanimated";
17
+ var LAYOUT = LinearTransition.springify().damping(140).stiffness(1600).mass(4);
18
+ var CONTENT_MS = 200;
19
+ var contentEntering = FadeIn.duration(CONTENT_MS).easing(Easing.out(Easing.ease));
20
+ var contentExiting = FadeOut.duration(CONTENT_MS).easing(Easing.in(Easing.ease));
21
+
22
+ // src/components/accordion/accordion.context.ts
23
+ var [AccordionProvider, useAccordion] = createSlotContext("Accordion");
24
+ var [AccordionItemProvider, useAccordionItem] = createSlotContext("Accordion.Item");
25
+
26
+ // src/components/accordion/accordion-content.tsx
27
+ import { jsx } from "react/jsx-runtime";
28
+ var AccordionContent = forwardRef(function AccordionContent2({
29
+ children,
30
+ style,
31
+ ...props
32
+ }, ref) {
33
+ const {
34
+ contentStyle
35
+ } = useAccordion();
36
+ const {
37
+ isExpanded
38
+ } = useAccordionItem();
39
+ const [styleProps, rest] = useStyleProps(props);
40
+ if (!isExpanded) return null;
41
+ return /* @__PURE__ */jsx(Animated.View, {
42
+ ref,
43
+ entering: contentEntering,
44
+ exiting: contentExiting,
45
+ ...rest,
46
+ style: [contentStyle, styleProps, style],
47
+ children
48
+ });
49
+ });
50
+ AccordionContent.displayName = "XAUI.Accordion.Content";
51
+
52
+ // src/components/accordion/accordion-indicator.tsx
53
+ import { useEffect } from "react";
54
+ import Animated2, { interpolate, useAnimatedStyle, useSharedValue, withSpring } from "react-native-reanimated";
55
+ import { jsx as jsx2 } from "react/jsx-runtime";
56
+ const _worklet_11408331723562_init_data = {
57
+ code: "function chunk2XPG2243Js1(){const{interpolate,progress,INDICATOR_ROTATION}=this.__closure;return{transform:[{rotate:interpolate(progress.get(),[0,1],[INDICATOR_ROTATION[0],INDICATOR_ROTATION[1]])+\"deg\"}]};}",
58
+ location: "/home/runner/work/xaui/xaui/packages/native/dist/chunk-2XPG2243.js",
59
+ sourceMap: "{\"version\":3,\"names\":[\"chunk2XPG2243Js1\",\"interpolate\",\"progress\",\"INDICATOR_ROTATION\",\"__closure\",\"transform\",\"rotate\",\"get\"],\"sources\":[\"/home/runner/work/xaui/xaui/packages/native/dist/chunk-2XPG2243.js\"],\"mappings\":\"AA8FoC,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\":[]}"
60
+ };
61
+ function AccordionIndicator({
62
+ as = ChevronDownIcon,
63
+ ...props
64
+ }) {
65
+ const {
66
+ indicatorStyle
67
+ } = useAccordion();
68
+ const {
69
+ isExpanded
70
+ } = useAccordionItem();
71
+ const progress = useSharedValue(isExpanded ? 1 : 0);
72
+ useEffect(() => {
73
+ progress.set(withSpring(isExpanded ? 1 : 0, INDICATOR_SPRING));
74
+ }, [isExpanded, progress]);
75
+ const rotation = useAnimatedStyle(function chunk2XPG2243Js1Factory({
76
+ _worklet_11408331723562_init_data,
77
+ interpolate,
78
+ progress,
79
+ INDICATOR_ROTATION
80
+ }) {
81
+ const _e = [new global.Error(), -4, -27];
82
+ const chunk2XPG2243Js1 = () => ({
83
+ transform: [{
84
+ rotate: `${interpolate(progress.get(), [0, 1], [INDICATOR_ROTATION[0], INDICATOR_ROTATION[1]])}deg`
85
+ }]
86
+ });
87
+ chunk2XPG2243Js1.__closure = {
88
+ interpolate,
89
+ progress,
90
+ INDICATOR_ROTATION
91
+ };
92
+ chunk2XPG2243Js1.__workletHash = 11408331723562;
93
+ chunk2XPG2243Js1.__pluginVersion = "0.7.4";
94
+ chunk2XPG2243Js1.__initData = _worklet_11408331723562_init_data;
95
+ chunk2XPG2243Js1.__stackDetails = _e;
96
+ return chunk2XPG2243Js1;
97
+ }({
98
+ _worklet_11408331723562_init_data,
99
+ interpolate,
100
+ progress,
101
+ INDICATOR_ROTATION
102
+ }));
103
+ return /* @__PURE__ */jsx2(Animated2.View, {
104
+ style: [indicatorStyle, rotation],
105
+ children: /* @__PURE__ */jsx2(Icon, {
106
+ as,
107
+ ...props
108
+ })
109
+ });
110
+ }
111
+ AccordionIndicator.displayName = "XAUI.Accordion.Indicator";
112
+
113
+ // src/components/accordion/accordion-item.tsx
114
+ import { forwardRef as forwardRef2, useMemo } from "react";
115
+ import Animated3 from "react-native-reanimated";
116
+ import { jsx as jsx3 } from "react/jsx-runtime";
117
+ var AccordionItem = forwardRef2(function AccordionItem2({
118
+ value,
119
+ children,
120
+ isDisabled = false,
121
+ style,
122
+ ...props
123
+ }, ref) {
124
+ const {
125
+ itemStyle,
126
+ isDisabled: isRootDisabled,
127
+ isExpanded
128
+ } = useAccordion();
129
+ const [styleProps, rest] = useStyleProps(props);
130
+ const expanded = isExpanded(value);
131
+ const disabled = isRootDisabled || isDisabled;
132
+ const context = useMemo(() => ({
133
+ value,
134
+ isExpanded: expanded,
135
+ isDisabled: disabled
136
+ }), [value, expanded, disabled]);
137
+ return /* @__PURE__ */jsx3(AccordionItemProvider, {
138
+ value: context,
139
+ children: /* @__PURE__ */jsx3(Animated3.View, {
140
+ ref,
141
+ layout: LAYOUT,
142
+ ...rest,
143
+ style: [itemStyle, styleProps, style],
144
+ children: typeof children === "function" ? children(context) : children
145
+ })
146
+ });
147
+ });
148
+ AccordionItem.displayName = "XAUI.Accordion.Item";
149
+
150
+ // src/components/accordion/accordion-trigger.tsx
151
+ import { Children, forwardRef as forwardRef3, useCallback } from "react";
152
+ import { Text } from "react-native";
153
+ import { jsx as jsx4 } from "react/jsx-runtime";
154
+ var AccordionTrigger = forwardRef3(function AccordionTrigger2({
155
+ children,
156
+ asChild = false,
157
+ accessibilityRole = "button",
158
+ accessibilityState,
159
+ style,
160
+ onPress,
161
+ onPressIn,
162
+ onPressOut,
163
+ ...props
164
+ }, ref) {
165
+ const {
166
+ triggerStyle,
167
+ triggerPressedStyle,
168
+ labelStyle,
169
+ glyph,
170
+ toggle
171
+ } = useAccordion();
172
+ const {
173
+ value,
174
+ isExpanded,
175
+ isDisabled
176
+ } = useAccordionItem();
177
+ const [styleProps, rest] = useStyleProps(props);
178
+ const [isPressed, press] = usePressState({
179
+ onPressIn,
180
+ onPressOut
181
+ });
182
+ const handlePress = useCallback(event => {
183
+ onPress?.(event);
184
+ toggle(value);
185
+ }, [onPress, toggle, value]);
186
+ return /* @__PURE__ */jsx4(IconContext.Provider, {
187
+ value: glyph,
188
+ children: /* @__PURE__ */jsx4(PressableFeedback, {
189
+ ref,
190
+ isPressed,
191
+ isDisabled,
192
+ asChild,
193
+ accessibilityRole,
194
+ accessibilityState: {
195
+ disabled: isDisabled,
196
+ expanded: isExpanded,
197
+ ...accessibilityState
198
+ },
199
+ ...rest,
200
+ style: [triggerStyle, isPressed && triggerPressedStyle, styleProps, typeof style === "function" ? style({
201
+ pressed: isPressed
202
+ }) : style],
203
+ onPress: handlePress,
204
+ onPressIn: press.onPressIn,
205
+ onPressOut: press.onPressOut,
206
+ children: asChild ? children : wrapText(children, labelStyle)
207
+ })
208
+ });
209
+ });
210
+ AccordionTrigger.displayName = "XAUI.Accordion.Trigger";
211
+ function wrapText(children, style) {
212
+ return Children.map(children, child => typeof child === "string" || typeof child === "number" ? /* @__PURE__ */jsx4(Text, {
213
+ style,
214
+ children: child
215
+ }) : child);
216
+ }
217
+
218
+ // src/components/accordion/accordion.tsx
219
+ import { Children as Children2, forwardRef as forwardRef4, Fragment, useMemo as useMemo3 } from "react";
220
+ import { StyleSheet as StyleSheet2 } from "react-native";
221
+ import Animated4 from "react-native-reanimated";
222
+
223
+ // src/components/accordion/accordion.hook.ts
224
+ import { useCallback as useCallback2, useMemo as useMemo2 } from "react";
225
+ function useExpansion({
226
+ value,
227
+ defaultValue,
228
+ onValueChange,
229
+ selectionMode,
230
+ isCollapsible
231
+ }) {
232
+ const [current, setCurrent] = useControllableState({
233
+ value,
234
+ defaultValue: defaultValue ?? (selectionMode === "multiple" ? [] : ""),
235
+ onChange: onValueChange
236
+ });
237
+ const isExpanded = useCallback2(item => Array.isArray(current) ? current.includes(item) : current === item, [current]);
238
+ const toggle = useCallback2(item => {
239
+ setCurrent(value_ => nextValue(value_, item, selectionMode, isCollapsible));
240
+ }, [isCollapsible, selectionMode, setCurrent]);
241
+ return useMemo2(() => ({
242
+ isExpanded,
243
+ toggle
244
+ }), [isExpanded, toggle]);
245
+ }
246
+ function nextValue(current, item, selectionMode, isCollapsible) {
247
+ if (selectionMode === "multiple") {
248
+ const list = Array.isArray(current) ? current : current ? [current] : [];
249
+ if (!list.includes(item)) return [...list, item];
250
+ if (!isCollapsible && list.length === 1) return current;
251
+ return list.filter(value => value !== item);
252
+ }
253
+ if (current !== item) return item;
254
+ return isCollapsible ? "" : current;
255
+ }
256
+
257
+ // src/components/accordion/accordion.recipe.ts
258
+ import { StyleSheet } from "react-native";
259
+ var SLOTS = ["root", "container", "separator", "item", "trigger", "indicator", "content"];
260
+ var VARIANT_TOKENS = {
261
+ primary: {
262
+ bg: "surface",
263
+ fg: "surfaceForeground"
264
+ },
265
+ secondary: {
266
+ bg: "surfaceSecondary",
267
+ fg: "surfaceSecondaryForeground"
268
+ },
269
+ tertiary: {
270
+ border: "border",
271
+ fg: "foreground"
272
+ },
273
+ ghost: {
274
+ fg: "foreground"
275
+ }
276
+ };
277
+ var HAIRLINE = StyleSheet.hairlineWidth;
278
+ var SIZES = {
279
+ xs: {
280
+ padding: 2.5,
281
+ gap: 2.5,
282
+ label: "sm",
283
+ glyph: "md",
284
+ radius: "md"
285
+ },
286
+ sm: {
287
+ padding: 3,
288
+ gap: 3,
289
+ label: "md",
290
+ glyph: "lg",
291
+ radius: "lg"
292
+ },
293
+ md: {
294
+ padding: 3,
295
+ gap: 4,
296
+ label: "md",
297
+ glyph: "lg",
298
+ radius: "xl"
299
+ },
300
+ lg: {
301
+ padding: 4,
302
+ gap: 4,
303
+ label: "lg",
304
+ glyph: "xl",
305
+ radius: "2xl"
306
+ }
307
+ };
308
+ var TRIGGER_PADDING_VERTICAL = 4;
309
+ function sizeAxis(step) {
310
+ const {
311
+ padding,
312
+ gap,
313
+ label,
314
+ glyph,
315
+ radius
316
+ } = step;
317
+ return theme => ({
318
+ // Both layers, at the same value: the outer one draws the corner, the inner one is
319
+ // what a pressed row is cut against.
320
+ root: {
321
+ borderRadius: theme.radius[radius]
322
+ },
323
+ container: {
324
+ borderRadius: theme.radius[radius]
325
+ },
326
+ trigger: {
327
+ paddingVertical: theme.spacing(TRIGGER_PADDING_VERTICAL),
328
+ paddingHorizontal: theme.spacing(padding),
329
+ gap: theme.spacing(gap),
330
+ fontSize: theme.fontSizes[label],
331
+ lineHeight: theme.lineHeights[label]
332
+ },
333
+ indicator: {
334
+ fontSize: theme.fontSizes[glyph]
335
+ },
336
+ content: {
337
+ paddingHorizontal: theme.spacing(padding),
338
+ paddingBottom: theme.spacing(TRIGGER_PADDING_VERTICAL)
339
+ }
340
+ });
341
+ }
342
+ var accordionRecipe = createRecipe({
343
+ slots: SLOTS,
344
+ base: theme => ({
345
+ // The root carries the shadow and the border; it must **not** clip. On iOS
346
+ // `overflow: 'hidden'` sets `masksToBounds`, which clips the layer's own shadow along
347
+ // with everything else, and a lifted `primary` would have none at all.
348
+ root: {
349
+ flexDirection: "column",
350
+ borderCurve: "continuous"
351
+ },
352
+ // So the clipping is one layer in. This is the one extra node in the component, and
353
+ // it is here for a platform constraint rather than for layout: a single layer cannot
354
+ // both cast a shadow and clip its children on iOS. Without it a pressed row paints
355
+ // over the card's rounded corner, square, for as long as a finger is on it.
356
+ container: {
357
+ flexDirection: "column",
358
+ overflow: "hidden"
359
+ },
360
+ separator: {
361
+ height: HAIRLINE,
362
+ backgroundColor: theme.colors.separator
363
+ },
364
+ // This one is load-bearing: it is what makes the height animation read as a panel
365
+ // unrolling rather than as content sliding out from behind the row above it.
366
+ item: {
367
+ flexDirection: "column",
368
+ overflow: "hidden"
369
+ },
370
+ trigger: {
371
+ flexDirection: "row",
372
+ alignItems: "center",
373
+ justifyContent: "space-between",
374
+ fontFamily: theme.fontFamilies.body,
375
+ fontWeight: theme.fontWeights.medium
376
+ },
377
+ indicator: {
378
+ alignItems: "center",
379
+ justifyContent: "center"
380
+ }
381
+ }),
382
+ variantTokens: VARIANT_TOKENS,
383
+ /**
384
+ * The fill is the **root's**, never the row's. A row that painted its own would stack
385
+ * two fills where the separator sits, and the hairline would disappear into the seam.
386
+ */
387
+ paint: (theme, colors) => ({
388
+ root: {
389
+ backgroundColor: colors.bg,
390
+ borderColor: colors.border,
391
+ borderWidth: colors.border ? theme.borderWidth.default : 0
392
+ },
393
+ trigger: {
394
+ color: colors.fg
395
+ },
396
+ indicator: {
397
+ color: theme.colors.muted
398
+ }
399
+ }),
400
+ variants: {
401
+ size: {
402
+ xs: sizeAxis(SIZES.xs),
403
+ sm: sizeAxis(SIZES.sm),
404
+ md: sizeAxis(SIZES.md),
405
+ lg: sizeAxis(SIZES.lg)
406
+ },
407
+ radius: radiusAxis("root", "container")
408
+ },
409
+ /**
410
+ * A container inset from its own edge, and its separators inset with it. `ghost` has no
411
+ * edge to be inset from, so its rows run the full width and the hairline runs with them
412
+ * — which is the difference between a list on a page and a list in a box.
413
+ *
414
+ * `primary` is the only one lifted. It is the one that reads as a card, and HeroUI puts
415
+ * their `--shadow-surface` on exactly that variant. `secondary` and `tertiary` have too
416
+ * little fill to lift — a shadow under either would read as dirt rather than as height
417
+ * — and in dark mode the theme's surface shadow is already nothing (§4), which is why
418
+ * this names the role rather than a set of numbers.
419
+ */
420
+ compoundVariants: [...["primary", "secondary", "tertiary"].map(variant => ({
421
+ when: {
422
+ variant
423
+ },
424
+ style: theme => ({
425
+ separator: {
426
+ marginHorizontal: theme.spacing(3)
427
+ }
428
+ })
429
+ })), {
430
+ when: {
431
+ variant: "primary"
432
+ },
433
+ style: theme => ({
434
+ root: theme.shadows.surface
435
+ })
436
+ }],
437
+ states: {
438
+ // On the row, not on the root: pressing one row must not tint the whole container.
439
+ pressed: theme => ({
440
+ trigger: {
441
+ backgroundColor: theme.colors.defaultSoftPressed
442
+ }
443
+ }),
444
+ disabled: theme => ({
445
+ root: {
446
+ opacity: theme.opacity.disabled
447
+ }
448
+ })
449
+ },
450
+ defaultVariants: {
451
+ variant: "ghost",
452
+ size: "md"
453
+ }
454
+ });
455
+
456
+ // src/components/accordion/accordion.tsx
457
+ import { jsx as jsx5, jsxs } from "react/jsx-runtime";
458
+ var AccordionRoot = forwardRef4(function Accordion({
459
+ children,
460
+ variant,
461
+ size,
462
+ radius,
463
+ color,
464
+ selectionMode = "single",
465
+ value,
466
+ defaultValue,
467
+ onValueChange,
468
+ isDisabled = false,
469
+ isCollapsible = true,
470
+ hasSeparator = true,
471
+ asChild = false,
472
+ style,
473
+ ...props
474
+ }, ref) {
475
+ const theme = useXAUITheme();
476
+ const [styleProps, rest] = useStyleProps(props);
477
+ const {
478
+ isExpanded,
479
+ toggle
480
+ } = useExpansion({
481
+ value,
482
+ defaultValue,
483
+ onValueChange,
484
+ selectionMode,
485
+ isCollapsible
486
+ });
487
+ const selection = {
488
+ variant,
489
+ size,
490
+ radius
491
+ };
492
+ const styles = accordionRecipe.resolve({
493
+ theme,
494
+ selection,
495
+ states: {
496
+ disabled: isDisabled
497
+ }
498
+ });
499
+ const pressed = accordionRecipe.resolve({
500
+ theme,
501
+ selection,
502
+ states: {
503
+ pressed: true
504
+ }
505
+ });
506
+ const tint = color ? accordionRecipe.tint({
507
+ theme,
508
+ color,
509
+ selection
510
+ }) : void 0;
511
+ const context = useMemo3(() => {
512
+ const trigger = StyleSheet2.flatten([styles.trigger, tint?.trigger]);
513
+ const indicator = StyleSheet2.flatten([styles.indicator, tint?.indicator]);
514
+ return {
515
+ separatorStyle: styles.separator,
516
+ itemStyle: styles.item,
517
+ triggerStyle: tint ? [styles.trigger, tint.trigger] : styles.trigger,
518
+ triggerPressedStyle: pressed.trigger,
519
+ indicatorStyle: styles.indicator,
520
+ contentStyle: styles.content,
521
+ // The trigger is a row of views, so a stringifiable child is wrapped in a `Text` of
522
+ // its own — and that text takes the type the recipe put on the row.
523
+ labelStyle: {
524
+ color: trigger.color,
525
+ fontFamily: trigger.fontFamily,
526
+ fontWeight: trigger.fontWeight,
527
+ fontSize: trigger.fontSize,
528
+ lineHeight: trigger.lineHeight
529
+ },
530
+ glyph: {
531
+ size: indicator.fontSize,
532
+ color: typeof indicator.color === "string" ? indicator.color : void 0
533
+ },
534
+ isDisabled,
535
+ isExpanded,
536
+ toggle
537
+ };
538
+ }, [styles, pressed, tint, isDisabled, isExpanded, toggle]);
539
+ const rootStyle = [styles.root, tint?.root, styleProps, style];
540
+ const items = Children2.toArray(children);
541
+ const rows = items.map((child, index) => /* @__PURE__ */jsxs(Fragment, {
542
+ children: [child, hasSeparator && index < items.length - 1 ? /* @__PURE__ */jsx5(Animated4.View, {
543
+ layout: LAYOUT,
544
+ style: styles.separator
545
+ }) : null]
546
+ }, index));
547
+ return /* @__PURE__ */jsx5(AccordionProvider, {
548
+ value: context,
549
+ children: asChild ? /* @__PURE__ */jsx5(Slot, {
550
+ ref,
551
+ ...rest,
552
+ style: rootStyle,
553
+ children
554
+ }) :
555
+ // Two layers, and the only place in the library where a root has one inside it.
556
+ // A single layer cannot both cast a shadow and clip its children on iOS, and this
557
+ // component needs both: `primary` is lifted, and a pressed row has to be cut
558
+ // against the card's rounded corner rather than painting over it.
559
+ //
560
+ // The layout transition is on each of them as well as on every row. Without it on
561
+ // the outer one the accordion's own height jumps to its new total in one frame
562
+ // while the rows inside it are still animating.
563
+ /* @__PURE__ */
564
+ jsx5(Animated4.View, {
565
+ ref,
566
+ layout: LAYOUT,
567
+ ...rest,
568
+ style: rootStyle,
569
+ children: /* @__PURE__ */jsx5(Animated4.View, {
570
+ layout: LAYOUT,
571
+ style: styles.container,
572
+ children: rows
573
+ })
574
+ })
575
+ });
576
+ });
577
+ AccordionRoot.displayName = "XAUI.Accordion.Root";
578
+
579
+ // src/components/accordion/index.ts
580
+ var Accordion2 = Object.assign(AccordionRoot, {
581
+ Item: AccordionItem,
582
+ Trigger: AccordionTrigger,
583
+ Indicator: AccordionIndicator,
584
+ Content: AccordionContent
585
+ });
586
+ export { LAYOUT, useAccordion, useAccordionItem, AccordionContent, AccordionIndicator, AccordionItem, AccordionTrigger, accordionRecipe, AccordionRoot, Accordion2 as Accordion };
@@ -0,0 +1,13 @@
1
+ // src/system/slot/merge-refs.ts
2
+ function mergeRefs(...refs) {
3
+ return (value) => {
4
+ for (const ref of refs) {
5
+ if (typeof ref === "function") ref(value);
6
+ else if (ref) ref.current = value;
7
+ }
8
+ };
9
+ }
10
+
11
+ export {
12
+ mergeRefs
13
+ };