@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,60 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ }); // src/hooks/use-previous.ts
6
+ var _react = require('react');
7
+ function usePrevious(value) {
8
+ const previous = _react.useRef.call(void 0, void 0);
9
+ _react.useEffect.call(void 0, () => {
10
+ previous.current = value;
11
+ }, [value]);
12
+ return previous.current;
13
+ }
14
+
15
+ // src/hooks/use-rotation.ts
16
+
17
+ var _reactnativereanimated = require('react-native-reanimated');
18
+ var ROTATION_DURATION = 900;
19
+ const _worklet_15909689137170_init_data = {
20
+ code: "function chunkXSQPVDFHCjs1(){const{angle}=this.__closure;return{transform:[{rotate:angle.value+\"deg\"}]};}",
21
+ location: "/home/runner/work/xaui/xaui/packages/native/dist/chunk-XSQPVDFH.cjs",
22
+ sourceMap: "{\"version\":3,\"names\":[\"chunkXSQPVDFHCjs1\",\"angle\",\"__closure\",\"transform\",\"rotate\",\"value\"],\"sources\":[\"/home/runner/work/xaui/xaui/packages/native/dist/chunk-XSQPVDFH.cjs\"],\"mappings\":\"AA+B8D,SAAAA,iBAAMA,CAAA,QAAAC,KAAA,OAAAC,SAAA,CAEhE,MAAO,CAAEC,SAAS,CAAE,CAAC,CAAEC,MAAM,CAAKH,KAAK,CAACI,KAAK,MAAM,CAAC,CAAE,CAAC,CACzD\",\"ignoreList\":[]}"
23
+ };
24
+ function useRotation() {
25
+ const angle = _reactnativereanimated.useSharedValue.call(void 0, 0);
26
+ _react.useEffect.call(void 0, () => {
27
+ angle.value = _reactnativereanimated.withRepeat.call(void 0, _reactnativereanimated.withTiming.call(void 0, 360, {
28
+ duration: ROTATION_DURATION,
29
+ easing: _reactnativereanimated.Easing.linear
30
+ }), -1, false);
31
+ return () => _reactnativereanimated.cancelAnimation.call(void 0, angle);
32
+ }, [angle]);
33
+ return _reactnativereanimated.useAnimatedStyle.call(void 0, function chunkXSQPVDFHCjs1Factory({
34
+ _worklet_15909689137170_init_data,
35
+ angle
36
+ }) {
37
+ const _e = [new global.Error(), -2, -27];
38
+ const chunkXSQPVDFHCjs1 = function () {
39
+ return {
40
+ transform: [{
41
+ rotate: `${angle.value}deg`
42
+ }]
43
+ };
44
+ };
45
+ chunkXSQPVDFHCjs1.__closure = {
46
+ angle
47
+ };
48
+ chunkXSQPVDFHCjs1.__workletHash = 15909689137170;
49
+ chunkXSQPVDFHCjs1.__pluginVersion = "0.7.4";
50
+ chunkXSQPVDFHCjs1.__initData = _worklet_15909689137170_init_data;
51
+ chunkXSQPVDFHCjs1.__stackDetails = _e;
52
+ return chunkXSQPVDFHCjs1;
53
+ }({
54
+ _worklet_15909689137170_init_data,
55
+ angle
56
+ }), [angle]);
57
+ }
58
+ exports.usePrevious = usePrevious;
59
+ exports.ROTATION_DURATION = ROTATION_DURATION;
60
+ exports.useRotation = useRotation;
@@ -0,0 +1,153 @@
1
+ import {
2
+ Slot
3
+ } from "./chunk-K72UDPVN.js";
4
+ import {
5
+ useStyleProps
6
+ } from "./chunk-M63GFNKV.js";
7
+
8
+ // src/components/view/grid.tsx
9
+ import { Children, forwardRef, useMemo, useState } from "react";
10
+ import { View } from "react-native";
11
+
12
+ // src/components/view/grid.context.ts
13
+ import { createContext, useContext } from "react";
14
+ var GridContext = createContext(null);
15
+ var GridProvider = GridContext.Provider;
16
+ function useGrid() {
17
+ const value = useContext(GridContext);
18
+ if (value === null) {
19
+ throw new Error(
20
+ "XAUI: Grid.Item must be rendered inside a Grid \u2014 it spans that grid\u2019s columns, and outside one there is nothing to span."
21
+ );
22
+ }
23
+ return value;
24
+ }
25
+ function spanWidth({ cellWidth, columns, gap }, span) {
26
+ const clamped = Math.min(Math.max(Math.floor(span), 1), columns);
27
+ if (cellWidth === void 0) return `${100 / columns * clamped}%`;
28
+ return cellWidth * clamped + gap * (clamped - 1);
29
+ }
30
+
31
+ // src/components/view/grid.tsx
32
+ import { jsx } from "react/jsx-runtime";
33
+ var GridRoot = forwardRef(function Grid({ children, columns = 2, gap = 0, style, onLayout, ...props }, ref) {
34
+ const [width, setWidth] = useState();
35
+ const [styleProps, rest] = useStyleProps(props);
36
+ const safeColumns = Math.max(Math.floor(columns), 1);
37
+ const cellWidth = width === void 0 ? void 0 : (width - gap * (safeColumns - 1)) / safeColumns;
38
+ const context = useMemo(
39
+ () => ({ cellWidth, columns: safeColumns, gap }),
40
+ [cellWidth, safeColumns, gap]
41
+ );
42
+ const handleLayout = (event) => {
43
+ const next = event.nativeEvent.layout.width;
44
+ if (next > 0 && next !== width) setWidth(next);
45
+ onLayout?.(event);
46
+ };
47
+ return /* @__PURE__ */ jsx(GridProvider, { value: context, children: /* @__PURE__ */ jsx(
48
+ View,
49
+ {
50
+ ref,
51
+ onLayout: handleLayout,
52
+ style: [
53
+ { flexDirection: "row", flexWrap: "wrap", rowGap: gap, columnGap: gap },
54
+ styleProps,
55
+ style
56
+ ],
57
+ ...rest,
58
+ children: Children.map(
59
+ children,
60
+ (child) => isGridItem(child) ? child : /* @__PURE__ */ jsx(View, { style: { width: spanWidth(context, 1) }, children: child })
61
+ )
62
+ }
63
+ ) });
64
+ });
65
+ GridRoot.displayName = "XAUI.Grid";
66
+ function isGridItem(child) {
67
+ if (child === null || typeof child !== "object") return false;
68
+ const type = child.type;
69
+ return type?.displayName === "XAUI.Grid.Item";
70
+ }
71
+
72
+ // src/components/view/grid-item.tsx
73
+ import { forwardRef as forwardRef2 } from "react";
74
+ import { View as View2 } from "react-native";
75
+ import { jsx as jsx2 } from "react/jsx-runtime";
76
+ var GridItem = forwardRef2(function GridItem2({ children, span = 1, style, ...props }, ref) {
77
+ const grid = useGrid();
78
+ const [styleProps, rest] = useStyleProps(props);
79
+ return /* @__PURE__ */ jsx2(
80
+ View2,
81
+ {
82
+ ref,
83
+ style: [{ width: spanWidth(grid, span) }, styleProps, style],
84
+ ...rest,
85
+ children
86
+ }
87
+ );
88
+ });
89
+ GridItem.displayName = "XAUI.Grid.Item";
90
+
91
+ // src/components/view/stack.tsx
92
+ import { forwardRef as forwardRef3 } from "react";
93
+ import { View as View3 } from "react-native";
94
+ import { jsx as jsx3 } from "react/jsx-runtime";
95
+ var StackRoot = forwardRef3(function Stack({ children, asChild = false, style, ...props }, ref) {
96
+ const [styleProps, rest] = useStyleProps(props);
97
+ const Root = asChild ? Slot : View3;
98
+ return /* @__PURE__ */ jsx3(Root, { ref, style: [{ position: "relative" }, styleProps, style], ...rest, children });
99
+ });
100
+ StackRoot.displayName = "XAUI.Stack";
101
+
102
+ // src/components/view/stack-item.tsx
103
+ import { forwardRef as forwardRef4 } from "react";
104
+ import { View as View4 } from "react-native";
105
+ import { jsx as jsx4 } from "react/jsx-runtime";
106
+ var StackItem = forwardRef4(function StackItem2({ children, asChild = false, style, ...props }, ref) {
107
+ const [styleProps, rest] = useStyleProps(props);
108
+ const Root = asChild ? Slot : View4;
109
+ return /* @__PURE__ */ jsx4(Root, { ref, style: [{ position: "absolute" }, styleProps, style], ...rest, children });
110
+ });
111
+ StackItem.displayName = "XAUI.Stack.Item";
112
+
113
+ // src/components/view/row.tsx
114
+ import { forwardRef as forwardRef5 } from "react";
115
+ import { View as View5 } from "react-native";
116
+ import { jsx as jsx5 } from "react/jsx-runtime";
117
+ var Row = forwardRef5(function Row2({ children, asChild = false, style, ...props }, ref) {
118
+ const [styleProps, rest] = useStyleProps(props);
119
+ const Root = asChild ? Slot : View5;
120
+ return /* @__PURE__ */ jsx5(Root, { ref, style: [{ flexDirection: "row" }, styleProps, style], ...rest, children });
121
+ });
122
+ Row.displayName = "XAUI.Row";
123
+
124
+ // src/components/view/column.tsx
125
+ import { forwardRef as forwardRef6 } from "react";
126
+ import { View as View6 } from "react-native";
127
+ import { jsx as jsx6 } from "react/jsx-runtime";
128
+ var Column = forwardRef6(function Column2({ children, asChild = false, style, ...props }, ref) {
129
+ const [styleProps, rest] = useStyleProps(props);
130
+ const Root = asChild ? Slot : View6;
131
+ return /* @__PURE__ */ jsx6(
132
+ Root,
133
+ {
134
+ ref,
135
+ style: [{ flexDirection: "column" }, styleProps, style],
136
+ ...rest,
137
+ children
138
+ }
139
+ );
140
+ });
141
+ Column.displayName = "XAUI.Column";
142
+
143
+ // src/components/view/index.ts
144
+ var Stack2 = Object.assign(StackRoot, { Item: StackItem });
145
+ var Grid2 = Object.assign(GridRoot, { Item: GridItem });
146
+
147
+ export {
148
+ useGrid,
149
+ Row,
150
+ Column,
151
+ Stack2 as Stack,
152
+ Grid2 as Grid
153
+ };
@@ -0,0 +1,366 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
+
3
+
4
+ var _chunkZFOOJK37cjs = require('./chunk-ZFOOJK37.cjs');
5
+
6
+
7
+ var _chunk4KFKWBN5cjs = require('./chunk-4KFKWBN5.cjs');
8
+
9
+
10
+
11
+ var _chunkFNEUOBCVcjs = require('./chunk-FNEUOBCV.cjs');
12
+
13
+
14
+ var _chunk57SJ4LJFcjs = require('./chunk-57SJ4LJF.cjs');
15
+
16
+
17
+
18
+
19
+ var _chunk7GHM4GKLcjs = require('./chunk-7GHM4GKL.cjs');
20
+
21
+
22
+ var _chunkTK44VBIEcjs = require('./chunk-TK44VBIE.cjs');
23
+
24
+ // src/components/alert/alert-close.tsx
25
+ var _react = require('react');
26
+
27
+ // src/components/alert/alert.context.ts
28
+ var [AlertProvider, useAlert] = _chunk7GHM4GKLcjs.createSlotContext.call(void 0, "Alert");
29
+
30
+ // src/components/alert/alert-close.tsx
31
+ var _jsxruntime = require('react/jsx-runtime');
32
+ var AlertClose = _react.forwardRef.call(void 0, function AlertClose2({ isDisabled, ...props }, ref) {
33
+ const { closeStyle, closeGlyphStyle, isDisabled: isAlertDisabled } = useAlert();
34
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
35
+ _chunkZFOOJK37cjs.CloseButton,
36
+ {
37
+ ref,
38
+ name: "Alert.Close",
39
+ baseStyle: closeStyle,
40
+ glyphStyle: closeGlyphStyle,
41
+ isDisabled: _nullishCoalesce(isDisabled, () => ( isAlertDisabled)),
42
+ ...props
43
+ }
44
+ );
45
+ });
46
+ AlertClose.displayName = "XAUI.Alert.Close";
47
+
48
+ // src/components/alert/alert-content.tsx
49
+
50
+ var _reactnative = require('react-native');
51
+
52
+ var AlertContent = _react.forwardRef.call(void 0,
53
+ function AlertContent2({ children, style, ...props }, ref) {
54
+ const { contentStyle } = useAlert();
55
+ const [styleProps, rest] = _chunkTK44VBIEcjs.useStyleProps.call(void 0, props);
56
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reactnative.View, { ref, style: [contentStyle, styleProps, style], ...rest, children });
57
+ }
58
+ );
59
+ AlertContent.displayName = "XAUI.Alert.Content";
60
+
61
+ // src/components/alert/alert-description.tsx
62
+
63
+
64
+
65
+ var AlertDescription = _react.forwardRef.call(void 0,
66
+ function AlertDescription2({ children, style, ...props }, ref) {
67
+ const { descriptionStyle } = useAlert();
68
+ const [styleProps, rest] = _chunkTK44VBIEcjs.useStyleProps.call(void 0, props);
69
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reactnative.Text, { ref, style: [descriptionStyle, styleProps, style], ...rest, children });
70
+ }
71
+ );
72
+ AlertDescription.displayName = "XAUI.Alert.Description";
73
+
74
+ // src/components/alert/alert-icon.tsx
75
+
76
+
77
+
78
+ var AlertIcon = _react.forwardRef.call(void 0, function AlertIcon2({ as, children, source, size, color, style, ...props }, ref) {
79
+ const { iconStyle, icon } = useAlert();
80
+ const [styleProps, rest] = _chunkTK44VBIEcjs.useStyleProps.call(void 0, props);
81
+ const glyphSize = _nullishCoalesce(size, () => ( icon.size));
82
+ const glyphColor = _nullishCoalesce(color, () => ( icon.color));
83
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reactnative.View, { ref, style: [iconStyle, styleProps, style], ...rest, children: as ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk4KFKWBN5cjs.Icon, { as, size: glyphSize, color: glyphColor }) : source ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk4KFKWBN5cjs.Icon, { source, size: glyphSize, color: glyphColor }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk4KFKWBN5cjs.Icon, { size: glyphSize, color: glyphColor, children }) });
84
+ });
85
+ AlertIcon.displayName = "XAUI.Alert.Icon";
86
+
87
+ // src/components/alert/alert-title.tsx
88
+
89
+
90
+
91
+ var AlertTitle = _react.forwardRef.call(void 0, function AlertTitle2({ children, style, ...props }, ref) {
92
+ const { titleStyle } = useAlert();
93
+ const [styleProps, rest] = _chunkTK44VBIEcjs.useStyleProps.call(void 0, props);
94
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reactnative.Text, { ref, style: [titleStyle, styleProps, style], ...rest, children });
95
+ });
96
+ AlertTitle.displayName = "XAUI.Alert.Title";
97
+
98
+ // src/components/alert/alert.tsx
99
+
100
+
101
+
102
+ // src/components/alert/alert.recipe.ts
103
+ var SLOTS = [
104
+ "root",
105
+ "icon",
106
+ "iconGlyph",
107
+ "content",
108
+ "title",
109
+ "description",
110
+ "close",
111
+ "closeGlyph"
112
+ ];
113
+ var VARIANT_TOKENS = {
114
+ default: { bg: "surface", fg: "surfaceForeground" },
115
+ primary: { bg: "accent", fg: "accentForeground" },
116
+ secondary: { bg: "accentSoft", fg: "accentSoftForeground" },
117
+ success: { bg: "success", fg: "successForeground" },
118
+ "success-soft": { bg: "successSoft", fg: "successSoftForeground" },
119
+ warning: { bg: "warning", fg: "warningForeground" },
120
+ "warning-soft": { bg: "warningSoft", fg: "warningSoftForeground" },
121
+ danger: { bg: "danger", fg: "dangerForeground" },
122
+ "danger-soft": { bg: "dangerSoft", fg: "dangerSoftForeground" }
123
+ };
124
+ var DESCRIPTION_OPACITY = 0.6;
125
+ function sizeAxis(step) {
126
+ const { padding, gap, contentGap, title, description, glyph, cross, radius } = step;
127
+ return (theme) => ({
128
+ root: {
129
+ padding: theme.spacing(padding),
130
+ gap: theme.spacing(gap),
131
+ borderRadius: theme.radius[radius]
132
+ },
133
+ icon: { paddingTop: (theme.lineHeights[title] - theme.fontSizes[glyph]) / 2 },
134
+ iconGlyph: { fontSize: theme.fontSizes[glyph] },
135
+ content: { gap: theme.spacing(contentGap) },
136
+ title: {
137
+ fontSize: theme.fontSizes[title],
138
+ lineHeight: theme.lineHeights[title]
139
+ },
140
+ description: {
141
+ fontSize: theme.fontSizes[description],
142
+ lineHeight: theme.lineHeights[description]
143
+ },
144
+ // The touch target is the glyph's box; the shared `CloseButton` grows it outwards
145
+ // with `hitSlop`, because a cross big enough to hit is a cross too big to look right.
146
+ close: { width: theme.fontSizes[glyph], height: theme.fontSizes[glyph] },
147
+ closeGlyph: { width: theme.spacing(cross) }
148
+ });
149
+ }
150
+ var SIZES = {
151
+ xs: {
152
+ padding: 2,
153
+ gap: 2,
154
+ contentGap: 0.5,
155
+ title: "xs",
156
+ description: "xs",
157
+ glyph: "sm",
158
+ cross: 2,
159
+ radius: "lg"
160
+ },
161
+ sm: {
162
+ padding: 2.5,
163
+ gap: 2.5,
164
+ contentGap: 0.5,
165
+ title: "sm",
166
+ description: "xs",
167
+ glyph: "md",
168
+ cross: 2,
169
+ radius: "xl"
170
+ },
171
+ md: {
172
+ padding: 3,
173
+ gap: 3,
174
+ contentGap: 1,
175
+ title: "md",
176
+ description: "sm",
177
+ glyph: "lg",
178
+ cross: 2.5,
179
+ radius: "2xl"
180
+ },
181
+ lg: {
182
+ padding: 4,
183
+ gap: 3.5,
184
+ contentGap: 1,
185
+ title: "lg",
186
+ description: "md",
187
+ glyph: "xl",
188
+ cross: 3,
189
+ radius: "3xl"
190
+ }
191
+ };
192
+ var alertRecipe = _chunkFNEUOBCVcjs.createRecipe.call(void 0, {
193
+ slots: SLOTS,
194
+ // The cross's own geometry — thickness and centring — belongs to the shared
195
+ // `CloseButton`; what stays below is the box and bar size this component's scale sets.
196
+ base: (theme) => ({
197
+ ..._chunkZFOOJK37cjs.closeButtonBase.call(void 0, theme),
198
+ root: {
199
+ flexDirection: "row",
200
+ // Top-aligned, not centred: an alert's message can run to three lines, and an icon
201
+ // floating beside the middle of a paragraph reads as decoration rather than as the
202
+ // mark of what the paragraph is. A single-line alert centres itself with
203
+ // `alignItems="center"` on the root — one prop, and it is the caller's call.
204
+ alignItems: "flex-start",
205
+ borderWidth: 0,
206
+ // iOS's squircle. Free on Android, and it is what makes a radius this large read as
207
+ // a shape rather than as four arcs meeting straight edges.
208
+ borderCurve: "continuous"
209
+ // Deliberately no `overflow: 'hidden'`: on iOS it clips the node's own shadow, so a
210
+ // `default` alert would lose the elevation the variant just gave it.
211
+ },
212
+ // `flex: 1` and not `flexGrow`: the root is a row, so the content has to be measured
213
+ // from a zero basis to take exactly what the icon and the close leave — the opposite
214
+ // of the `Card`'s body, which grows in a column where a zero basis collapses it.
215
+ content: { flex: 1 },
216
+ // `medium`, not `semibold`. An alert's title sits in prose rather than on a control:
217
+ // one weight above the description is enough to rank them.
218
+ title: {
219
+ fontFamily: theme.fontFamilies.heading,
220
+ fontWeight: theme.fontWeights.medium
221
+ },
222
+ description: {
223
+ fontFamily: theme.fontFamilies.body,
224
+ fontWeight: theme.fontWeights.regular,
225
+ opacity: DESCRIPTION_OPACITY
226
+ }
227
+ }),
228
+ variantTokens: VARIANT_TOKENS,
229
+ /**
230
+ * Where the variant's colours land, for every variant at once.
231
+ *
232
+ * The icon takes the **title's** colour rather than a status colour of its own — on a
233
+ * `danger` alert the readable colour is the one the title already uses, and on a
234
+ * `danger-soft` one that token *is* the red. HeroUI arrives at the same place from the
235
+ * other direction, colouring the icon by status on a neutral surface; here the variant
236
+ * decides both, and an icon that has to disagree with its alert says so itself with
237
+ * `<Alert.Icon color={…} />`.
238
+ */
239
+ paint: (theme, colors) => ({
240
+ root: {
241
+ backgroundColor: colors.bg,
242
+ borderColor: colors.border,
243
+ borderWidth: colors.border ? theme.borderWidth.default : 0
244
+ },
245
+ iconGlyph: { color: colors.fg },
246
+ title: { color: colors.fg },
247
+ description: { color: colors.fg },
248
+ closeGlyph: { backgroundColor: colors.fg }
249
+ }),
250
+ /** Declaration order is application order: `radius` overrides the radius `size` set. */
251
+ variants: {
252
+ size: {
253
+ xs: sizeAxis(SIZES.xs),
254
+ sm: sizeAxis(SIZES.sm),
255
+ md: sizeAxis(SIZES.md),
256
+ lg: sizeAxis(SIZES.lg)
257
+ },
258
+ radius: _chunkFNEUOBCVcjs.radiusAxis.call(void 0, "root")
259
+ },
260
+ /**
261
+ * The elevation belongs to the one variant that is a surface standing on the background,
262
+ * exactly as on the `Card`. A tinted alert already separates itself by its fill, and a
263
+ * shadow under it would read as dirt. In dark mode the theme's `surface` shadow is
264
+ * already nothing (§4), which is why this names the role instead of a set of numbers.
265
+ */
266
+ compoundVariants: [
267
+ {
268
+ when: { variant: "default" },
269
+ style: (theme) => ({ root: theme.shadows.surface })
270
+ }
271
+ ],
272
+ states: {
273
+ disabled: (theme) => ({ root: { opacity: theme.opacity.disabled } })
274
+ },
275
+ defaultVariants: { variant: "default", size: "md" }
276
+ });
277
+
278
+ // src/components/alert/alert.tsx
279
+
280
+ var AlertRoot = _react.forwardRef.call(void 0, function Alert({
281
+ children,
282
+ variant,
283
+ size,
284
+ radius,
285
+ color,
286
+ isDisabled = false,
287
+ asChild = false,
288
+ accessibilityRole = "alert",
289
+ // Android reads a live region aloud when its content changes, which is what makes an
290
+ // alert that *appears* announce itself instead of waiting to be found. `'polite'`
291
+ // rather than `'assertive'`: it queues behind whatever is being read instead of
292
+ // cutting it off. A static alert that is part of the page sets `'none'`.
293
+ accessibilityLiveRegion = "polite",
294
+ style,
295
+ ...props
296
+ }, ref) {
297
+ const theme = _chunk57SJ4LJFcjs.useXAUITheme.call(void 0, );
298
+ const [styleProps, rest] = _chunkTK44VBIEcjs.useStyleProps.call(void 0, props);
299
+ const selection = { variant, size, radius };
300
+ const states = { disabled: isDisabled };
301
+ const styles = alertRecipe.resolve({ theme, selection, states });
302
+ const tint = color ? alertRecipe.tint({ theme, color, selection, states }) : void 0;
303
+ const context = _react.useMemo.call(void 0, () => {
304
+ const glyph = _reactnative.StyleSheet.flatten([styles.iconGlyph, _optionalChain([tint, 'optionalAccess', _ => _.iconGlyph])]);
305
+ return {
306
+ iconStyle: styles.icon,
307
+ contentStyle: styles.content,
308
+ titleStyle: tint ? [styles.title, tint.title] : styles.title,
309
+ descriptionStyle: tint ? [styles.description, tint.description] : styles.description,
310
+ closeStyle: styles.close,
311
+ closeGlyphStyle: tint ? [styles.closeGlyph, tint.closeGlyph] : styles.closeGlyph,
312
+ icon: {
313
+ size: glyph.fontSize,
314
+ // `ColorValue` also covers the platform's opaque colours, which `Icon` cannot
315
+ // hand to a third-party component expecting a string.
316
+ color: typeof glyph.color === "string" ? glyph.color : void 0
317
+ },
318
+ isDisabled
319
+ };
320
+ }, [styles, tint, isDisabled]);
321
+ const rootStyle = [styles.root, _optionalChain([tint, 'optionalAccess', _2 => _2.root]), styleProps, style];
322
+ const text = _chunk7GHM4GKLcjs.childrenToString.call(void 0, children);
323
+ const content = text !== null ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, AlertDescription, { children: text }) : children;
324
+ const surface = asChild ? (
325
+ // R12 — the caller's element *is* the alert, so it takes the children it was written
326
+ // with and the auto-wrap does not apply.
327
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
328
+ _chunk7GHM4GKLcjs.Slot,
329
+ {
330
+ ref,
331
+ accessibilityRole,
332
+ accessibilityLiveRegion,
333
+ ...rest,
334
+ style: rootStyle,
335
+ children
336
+ }
337
+ )
338
+ ) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
339
+ _reactnative.View,
340
+ {
341
+ ref,
342
+ accessibilityRole,
343
+ accessibilityLiveRegion,
344
+ ...rest,
345
+ style: rootStyle,
346
+ children: content
347
+ }
348
+ );
349
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, AlertProvider, { value: context, children: surface });
350
+ });
351
+ AlertRoot.displayName = "XAUI.Alert.Root";
352
+
353
+ // src/components/alert/index.ts
354
+ var Alert2 = Object.assign(AlertRoot, {
355
+ Icon: AlertIcon,
356
+ Content: AlertContent,
357
+ Title: AlertTitle,
358
+ Description: AlertDescription,
359
+ Close: AlertClose
360
+ });
361
+
362
+
363
+
364
+
365
+
366
+ exports.useAlert = useAlert; exports.alertRecipe = alertRecipe; exports.Alert = Alert2;