@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,153 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); 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
+ var _chunk7GHM4GKLcjs = require('./chunk-7GHM4GKL.cjs');
4
+
5
+
6
+ var _chunkTK44VBIEcjs = require('./chunk-TK44VBIE.cjs');
7
+
8
+ // src/components/view/grid.tsx
9
+ var _react = require('react');
10
+ var _reactnative = require('react-native');
11
+
12
+ // src/components/view/grid.context.ts
13
+
14
+ var GridContext = _react.createContext.call(void 0, null);
15
+ var GridProvider = GridContext.Provider;
16
+ function useGrid() {
17
+ const value = _react.useContext.call(void 0, 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
+ var _jsxruntime = require('react/jsx-runtime');
33
+ var GridRoot = _react.forwardRef.call(void 0, function Grid({ children, columns = 2, gap = 0, style, onLayout, ...props }, ref) {
34
+ const [width, setWidth] = _react.useState.call(void 0, );
35
+ const [styleProps, rest] = _chunkTK44VBIEcjs.useStyleProps.call(void 0, 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 = _react.useMemo.call(void 0,
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
+ _optionalChain([onLayout, 'optionalCall', _ => _(event)]);
46
+ };
47
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, GridProvider, { value: context, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
48
+ _reactnative.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: _react.Children.map(
59
+ children,
60
+ (child) => isGridItem(child) ? child : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reactnative.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 _optionalChain([type, 'optionalAccess', _2 => _2.displayName]) === "XAUI.Grid.Item";
70
+ }
71
+
72
+ // src/components/view/grid-item.tsx
73
+
74
+
75
+
76
+ var GridItem = _react.forwardRef.call(void 0, function GridItem2({ children, span = 1, style, ...props }, ref) {
77
+ const grid = useGrid();
78
+ const [styleProps, rest] = _chunkTK44VBIEcjs.useStyleProps.call(void 0, props);
79
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
80
+ _reactnative.View,
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
+
93
+
94
+
95
+ var StackRoot = _react.forwardRef.call(void 0, function Stack({ children, asChild = false, style, ...props }, ref) {
96
+ const [styleProps, rest] = _chunkTK44VBIEcjs.useStyleProps.call(void 0, props);
97
+ const Root = asChild ? _chunk7GHM4GKLcjs.Slot : _reactnative.View;
98
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Root, { ref, style: [{ position: "relative" }, styleProps, style], ...rest, children });
99
+ });
100
+ StackRoot.displayName = "XAUI.Stack";
101
+
102
+ // src/components/view/stack-item.tsx
103
+
104
+
105
+
106
+ var StackItem = _react.forwardRef.call(void 0, function StackItem2({ children, asChild = false, style, ...props }, ref) {
107
+ const [styleProps, rest] = _chunkTK44VBIEcjs.useStyleProps.call(void 0, props);
108
+ const Root = asChild ? _chunk7GHM4GKLcjs.Slot : _reactnative.View;
109
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Root, { ref, style: [{ position: "absolute" }, styleProps, style], ...rest, children });
110
+ });
111
+ StackItem.displayName = "XAUI.Stack.Item";
112
+
113
+ // src/components/view/row.tsx
114
+
115
+
116
+
117
+ var Row = _react.forwardRef.call(void 0, function Row2({ children, asChild = false, style, ...props }, ref) {
118
+ const [styleProps, rest] = _chunkTK44VBIEcjs.useStyleProps.call(void 0, props);
119
+ const Root = asChild ? _chunk7GHM4GKLcjs.Slot : _reactnative.View;
120
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Root, { ref, style: [{ flexDirection: "row" }, styleProps, style], ...rest, children });
121
+ });
122
+ Row.displayName = "XAUI.Row";
123
+
124
+ // src/components/view/column.tsx
125
+
126
+
127
+
128
+ var Column = _react.forwardRef.call(void 0, function Column2({ children, asChild = false, style, ...props }, ref) {
129
+ const [styleProps, rest] = _chunkTK44VBIEcjs.useStyleProps.call(void 0, props);
130
+ const Root = asChild ? _chunk7GHM4GKLcjs.Slot : _reactnative.View;
131
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
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
+
148
+
149
+
150
+
151
+
152
+
153
+ exports.useGrid = useGrid; exports.Row = Row; exports.Column = Column; exports.Stack = Stack2; exports.Grid = Grid2;
@@ -0,0 +1,431 @@
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
+ var _chunk3E7CDKFOcjs = require('./chunk-3E7CDKFO.cjs');
11
+
12
+
13
+ var _chunk7DPL3ZDScjs = require('./chunk-7DPL3ZDS.cjs');
14
+
15
+
16
+ var _chunkEJQCQPETcjs = require('./chunk-EJQCQPET.cjs');
17
+
18
+
19
+
20
+ var _chunkFNEUOBCVcjs = require('./chunk-FNEUOBCV.cjs');
21
+
22
+
23
+ var _chunk57SJ4LJFcjs = require('./chunk-57SJ4LJF.cjs');
24
+
25
+
26
+
27
+
28
+ var _chunk7GHM4GKLcjs = require('./chunk-7GHM4GKL.cjs');
29
+
30
+
31
+ var _chunkTK44VBIEcjs = require('./chunk-TK44VBIE.cjs');
32
+
33
+ // src/components/chip/chip-avatar.tsx
34
+ var _react = require('react');
35
+ var _reactnative = require('react-native');
36
+
37
+ // src/components/chip/chip.context.ts
38
+ var [ChipProvider, useChip] = _chunk7GHM4GKLcjs.createSlotContext.call(void 0, "Chip");
39
+
40
+ // src/components/chip/chip.style.ts
41
+
42
+ var chipSheet = _reactnative.StyleSheet.create({
43
+ avatarImage: { width: "100%", height: "100%" }
44
+ });
45
+
46
+ // src/components/chip/chip-avatar.tsx
47
+ var _jsxruntime = require('react/jsx-runtime');
48
+ var ChipAvatar = _react.forwardRef.call(void 0, function ChipAvatar2({ children, source, style, ...props }, ref) {
49
+ const { avatarStyle } = useChip();
50
+ const [styleProps, rest] = _chunkTK44VBIEcjs.useStyleProps.call(void 0, props);
51
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reactnative.View, { ref, style: [avatarStyle, styleProps, style], ...rest, children: source ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reactnative.Image, { source, style: chipSheet.avatarImage }) : children });
52
+ });
53
+ ChipAvatar.displayName = "XAUI.Chip.Avatar";
54
+
55
+ // src/components/chip/chip-close.tsx
56
+
57
+
58
+ var ChipClose = _react.forwardRef.call(void 0, function ChipClose2({ isDisabled, ...props }, ref) {
59
+ const { closeStyle, closeGlyphStyle, isDisabled: isChipDisabled } = useChip();
60
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
61
+ _chunkZFOOJK37cjs.CloseButton,
62
+ {
63
+ ref,
64
+ name: "Chip.Close",
65
+ baseStyle: closeStyle,
66
+ glyphStyle: closeGlyphStyle,
67
+ isDisabled: _nullishCoalesce(isDisabled, () => ( isChipDisabled)),
68
+ ...props
69
+ }
70
+ );
71
+ });
72
+ ChipClose.displayName = "XAUI.Chip.Close";
73
+
74
+ // src/components/chip/chip-dot.tsx
75
+
76
+
77
+
78
+ var ChipDot = _react.forwardRef.call(void 0, function ChipDot2({ style, ...props }, ref) {
79
+ const { dotStyle } = useChip();
80
+ const [styleProps, rest] = _chunkTK44VBIEcjs.useStyleProps.call(void 0, props);
81
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reactnative.View, { ref, style: [dotStyle, styleProps, style], ...rest });
82
+ });
83
+ ChipDot.displayName = "XAUI.Chip.Dot";
84
+
85
+ // src/components/chip/chip-icon.tsx
86
+
87
+ function ChipIcon({ size, color, ...rest }) {
88
+ const { icon } = useChip();
89
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk4KFKWBN5cjs.Icon, { size: _nullishCoalesce(size, () => ( icon.size)), color: _nullishCoalesce(color, () => ( icon.color)), ...rest });
90
+ }
91
+ ChipIcon.displayName = "XAUI.Chip.Icon";
92
+
93
+ // src/components/chip/chip-label.tsx
94
+
95
+
96
+
97
+ var ChipLabel = _react.forwardRef.call(void 0, function ChipLabel2({ children, style, numberOfLines = 1, ...props }, ref) {
98
+ const { labelStyle } = useChip();
99
+ const [styleProps, rest] = _chunkTK44VBIEcjs.useStyleProps.call(void 0, props);
100
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
101
+ _reactnative.Text,
102
+ {
103
+ ref,
104
+ numberOfLines,
105
+ style: [labelStyle, styleProps, style],
106
+ ...rest,
107
+ children
108
+ }
109
+ );
110
+ });
111
+ ChipLabel.displayName = "XAUI.Chip.Label";
112
+
113
+ // src/components/chip/chip.tsx
114
+
115
+
116
+
117
+ // src/components/chip/chip.recipe.ts
118
+ var SLOTS = [
119
+ "root",
120
+ "label",
121
+ "icon",
122
+ "dot",
123
+ "avatar",
124
+ "close",
125
+ "closeGlyph"
126
+ ];
127
+ var VARIANT_TOKENS = {
128
+ primary: { bg: "accent", bgPressed: "accentPressed", fg: "accentForeground" },
129
+ secondary: {
130
+ bg: "accentSoft",
131
+ bgPressed: "accentSoftPressed",
132
+ fg: "accentSoftForeground"
133
+ },
134
+ default: { bg: "default", bgPressed: "defaultPressed", fg: "defaultForeground" },
135
+ tertiary: { border: "border", bgPressed: "defaultSoftPressed", fg: "foreground" },
136
+ ghost: { bgPressed: "defaultSoftPressed", fg: "foreground" },
137
+ success: { bg: "success", bgPressed: "successPressed", fg: "successForeground" },
138
+ "success-soft": {
139
+ bg: "successSoft",
140
+ bgPressed: "successSoftPressed",
141
+ fg: "successSoftForeground"
142
+ },
143
+ warning: { bg: "warning", bgPressed: "warningPressed", fg: "warningForeground" },
144
+ "warning-soft": {
145
+ bg: "warningSoft",
146
+ bgPressed: "warningSoftPressed",
147
+ fg: "warningSoftForeground"
148
+ },
149
+ danger: { bg: "danger", bgPressed: "dangerPressed", fg: "dangerForeground" },
150
+ "danger-soft": {
151
+ bg: "dangerSoft",
152
+ bgPressed: "dangerSoftPressed",
153
+ fg: "dangerSoftForeground"
154
+ }
155
+ };
156
+ function sizeAxis(step) {
157
+ const { height, padding, gap, label, glyph, dot, avatar, cross } = step;
158
+ return (theme) => {
159
+ const diameter = theme.spacing(avatar);
160
+ const box = theme.fontSizes[glyph];
161
+ const inset = theme.spacing(padding);
162
+ const cap = (theme.spacing(height) - diameter) / 2;
163
+ return {
164
+ root: {
165
+ height: theme.spacing(height),
166
+ paddingHorizontal: inset,
167
+ gap: theme.spacing(gap)
168
+ },
169
+ label: {
170
+ fontSize: theme.fontSizes[label],
171
+ lineHeight: theme.lineHeights[label]
172
+ },
173
+ icon: { fontSize: box },
174
+ dot: circle(theme.spacing(dot)),
175
+ avatar: {
176
+ ...circle(diameter),
177
+ // **The one margin on a slot in this component**, and R4 is about spacing between
178
+ // slots — this is not that. The root's horizontal padding is set for text, several
179
+ // times the gap the height leaves above the avatar, so a face sits visibly pushed
180
+ // into the chip while a label beside it looks right. Cancelling the difference
181
+ // seats it in the capsule's rounded end instead. Clamped at zero, because a theme
182
+ // with tighter padding than that gap needs no pull at all.
183
+ //
184
+ // R13 — `marginStart`, so it is the leading edge in RTL too. `Chip.Avatar` is a
185
+ // leading slot by contract, which is what makes a leading-only correction sound.
186
+ marginStart: -Math.max(0, inset - cap)
187
+ },
188
+ // The touch target is the glyph's box; `hitSlop` on the slot is what makes it
189
+ // reachable, because a cross big enough to hit is a cross too big to look right.
190
+ close: { width: box, height: box },
191
+ closeGlyph: { width: theme.spacing(cross) }
192
+ };
193
+ };
194
+ }
195
+ function circle(diameter) {
196
+ return { width: diameter, height: diameter, borderRadius: diameter / 2 };
197
+ }
198
+ var SIZES = {
199
+ xs: {
200
+ height: 5,
201
+ padding: 2,
202
+ gap: 1,
203
+ label: "xs",
204
+ glyph: "sm",
205
+ dot: 1,
206
+ avatar: 3.5,
207
+ cross: 2
208
+ },
209
+ sm: {
210
+ height: 6,
211
+ padding: 2.5,
212
+ gap: 1,
213
+ label: "xs",
214
+ glyph: "sm",
215
+ dot: 1.25,
216
+ avatar: 4.5,
217
+ cross: 2
218
+ },
219
+ md: {
220
+ height: 7,
221
+ padding: 3,
222
+ gap: 1,
223
+ label: "sm",
224
+ glyph: "md",
225
+ dot: 1.5,
226
+ avatar: 5.5,
227
+ cross: 2.5
228
+ },
229
+ lg: {
230
+ height: 9,
231
+ padding: 4,
232
+ gap: 1.5,
233
+ label: "md",
234
+ glyph: "lg",
235
+ dot: 2,
236
+ avatar: 7,
237
+ cross: 3
238
+ }
239
+ };
240
+ var chipRecipe = _chunkFNEUOBCVcjs.createRecipe.call(void 0, {
241
+ slots: SLOTS,
242
+ // The cross's own geometry — thickness and centring — belongs to the shared
243
+ // `CloseButton`; what stays below is the box and bar size this component's scale sets.
244
+ base: (theme) => ({
245
+ ..._chunkZFOOJK37cjs.closeButtonBase.call(void 0, theme),
246
+ root: {
247
+ // A chip hugs its content where a `Button` fills its column. The difference is what
248
+ // the two are: a button is a control the layout sizes, a chip is a token *about*
249
+ // something, and a tag stretched across a screen has stopped being one. It is also
250
+ // the one line of HeroUI's chip that is not a measurement.
251
+ alignSelf: "flex-start",
252
+ flexDirection: "row",
253
+ alignItems: "center",
254
+ justifyContent: "center",
255
+ borderWidth: 0,
256
+ // The capsule the name means, at every size. HeroUI reaches it through a radius
257
+ // ladder that React Native would clamp to the same pill anyway; saying `full` says
258
+ // it once, and `radius` is still there for the tag that wants square corners.
259
+ borderRadius: theme.radius.full,
260
+ // Squircle corners for when `radius` overrides the pill. Free on Android.
261
+ borderCurve: "continuous"
262
+ // Deliberately no `overflow: 'hidden'`, where HeroUI clips: the press overlays
263
+ // carry their own corners (`system/pressable-feedback/`), so nothing needs the clip
264
+ // — and clipping here would cut a badge or a shadow a caller hangs off the chip.
265
+ },
266
+ label: {
267
+ fontFamily: theme.fontFamilies.body,
268
+ fontWeight: theme.fontWeights.medium
269
+ },
270
+ avatar: { overflow: "hidden", alignItems: "center", justifyContent: "center" }
271
+ }),
272
+ variantTokens: VARIANT_TOKENS,
273
+ /**
274
+ * Where the variant's colours land, for every variant at once. The border width follows
275
+ * the *presence* of the border role rather than a per-variant flag — `tertiary` is the
276
+ * only variant that names one, and that fact is already in the table above.
277
+ *
278
+ * The dot and the cross take the foreground rather than a status token of their own: on
279
+ * a filled `success` chip the readable colour is the one the label already uses, and on
280
+ * a `success-soft` one it is the green that token resolves to. One rule, eleven
281
+ * variants, and a tinted chip gets it for free.
282
+ */
283
+ paint: (theme, colors) => ({
284
+ root: {
285
+ backgroundColor: colors.bg,
286
+ borderColor: colors.border,
287
+ borderWidth: colors.border ? theme.borderWidth.default : 0
288
+ },
289
+ label: { color: colors.fg },
290
+ icon: { color: colors.fg },
291
+ dot: { backgroundColor: colors.fg },
292
+ closeGlyph: { backgroundColor: colors.fg }
293
+ }),
294
+ /** Declaration order is application order: `radius` overrides the capsule `base` set. */
295
+ variants: {
296
+ size: {
297
+ xs: sizeAxis(SIZES.xs),
298
+ sm: sizeAxis(SIZES.sm),
299
+ md: sizeAxis(SIZES.md),
300
+ lg: sizeAxis(SIZES.lg)
301
+ },
302
+ radius: _chunkFNEUOBCVcjs.radiusAxis.call(void 0, "root")
303
+ },
304
+ /**
305
+ * The pressed colour is the variant's own `…Pressed` token, as on the `Button` and not
306
+ * as on the `Card`: a chip is small enough that a wash over it reads as a smudge, while
307
+ * the fill going one step down reads as the thing itself being pushed. A tinted chip
308
+ * presses through the same OKLab formula as a token one.
309
+ */
310
+ states: {
311
+ pressed: (_theme, colors) => ({ root: { backgroundColor: colors.bgPressed } }),
312
+ disabled: (theme) => ({ root: { opacity: theme.opacity.disabled } })
313
+ },
314
+ defaultVariants: { variant: "primary", size: "md" }
315
+ });
316
+
317
+ // src/components/chip/chip.tsx
318
+
319
+ var ChipRoot = _react.forwardRef.call(void 0, function Chip({
320
+ children,
321
+ variant,
322
+ size,
323
+ radius,
324
+ color,
325
+ isDisabled = false,
326
+ isPressable = false,
327
+ asChild = false,
328
+ accessibilityRole,
329
+ accessibilityState,
330
+ animation,
331
+ style,
332
+ onPressIn,
333
+ onPressOut,
334
+ ...props
335
+ }, ref) {
336
+ const theme = _chunk57SJ4LJFcjs.useXAUITheme.call(void 0, );
337
+ const [styleProps, rest] = _chunkTK44VBIEcjs.useStyleProps.call(void 0, props);
338
+ const [isPressed, press] = _chunk7DPL3ZDScjs.usePressState.call(void 0, { onPressIn, onPressOut });
339
+ const selection = { variant, size, radius };
340
+ const states = { pressed: isPressed, disabled: isDisabled };
341
+ const styles = chipRecipe.resolve({ theme, selection, states });
342
+ const tint = color ? chipRecipe.tint({ theme, color, selection, states }) : void 0;
343
+ const context = _react.useMemo.call(void 0, () => {
344
+ const icon = _reactnative.StyleSheet.flatten([styles.icon, _optionalChain([tint, 'optionalAccess', _ => _.icon])]);
345
+ return {
346
+ labelStyle: tint ? [styles.label, tint.label] : styles.label,
347
+ dotStyle: tint ? [styles.dot, tint.dot] : styles.dot,
348
+ avatarStyle: styles.avatar,
349
+ closeStyle: styles.close,
350
+ closeGlyphStyle: tint ? [styles.closeGlyph, tint.closeGlyph] : styles.closeGlyph,
351
+ icon: {
352
+ size: icon.fontSize,
353
+ // `ColorValue` also covers the platform's opaque colours, which `Icon` cannot
354
+ // hand to a third-party component expecting a string.
355
+ color: typeof icon.color === "string" ? icon.color : void 0
356
+ },
357
+ isDisabled
358
+ };
359
+ }, [styles, tint, isDisabled]);
360
+ const rootStyle = [
361
+ styles.root,
362
+ _optionalChain([tint, 'optionalAccess', _2 => _2.root]),
363
+ styleProps,
364
+ typeof style === "function" ? style({ pressed: isPressed }) : style
365
+ ];
366
+ const text = _chunk7GHM4GKLcjs.childrenToString.call(void 0, children);
367
+ const content = text !== null ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ChipLabel, { children: text }) : children;
368
+ if (!isPressable && !asChild && (onPressIn || onPressOut || rest.onPress || rest.onLongPress)) {
369
+ _chunkEJQCQPETcjs.warnDev.call(void 0,
370
+ "Chip: a press handler needs `isPressable`. Without it the chip renders a View, which never receives the touch \u2014 add `isPressable` to make it a control. A `Chip.Close` is its own control and needs neither."
371
+ );
372
+ }
373
+ const surface = isPressable ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
374
+ _chunk3E7CDKFOcjs.PressableFeedback,
375
+ {
376
+ ref,
377
+ isPressed,
378
+ isDisabled,
379
+ asChild,
380
+ animation,
381
+ accessibilityRole: _nullishCoalesce(accessibilityRole, () => ( "button")),
382
+ accessibilityState: { disabled: isDisabled, ...accessibilityState },
383
+ ...rest,
384
+ style: rootStyle,
385
+ onPressIn: press.onPressIn,
386
+ onPressOut: press.onPressOut,
387
+ children: asChild ? children : content
388
+ }
389
+ ) : asChild ? (
390
+ // R12 — the caller's element is the chip, so it takes the children it was written
391
+ // with and the auto-wrap does not apply.
392
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
393
+ _chunk7GHM4GKLcjs.Slot,
394
+ {
395
+ ref,
396
+ accessibilityRole,
397
+ accessibilityState,
398
+ ...rest,
399
+ style: rootStyle,
400
+ children
401
+ }
402
+ )
403
+ ) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
404
+ _reactnative.View,
405
+ {
406
+ ref,
407
+ accessibilityRole,
408
+ accessibilityState,
409
+ ...rest,
410
+ style: rootStyle,
411
+ children: content
412
+ }
413
+ );
414
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ChipProvider, { value: context, children: surface });
415
+ });
416
+ ChipRoot.displayName = "XAUI.Chip.Root";
417
+
418
+ // src/components/chip/index.ts
419
+ var Chip2 = Object.assign(ChipRoot, {
420
+ Label: ChipLabel,
421
+ Icon: ChipIcon,
422
+ Dot: ChipDot,
423
+ Avatar: ChipAvatar,
424
+ Close: ChipClose
425
+ });
426
+
427
+
428
+
429
+
430
+
431
+ exports.useChip = useChip; exports.chipRecipe = chipRecipe; exports.Chip = Chip2;