@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,124 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 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 _chunkXSQPVDFHcjs = require('./chunk-XSQPVDFH.cjs');
4
+
5
+
6
+ var _chunkFNEUOBCVcjs = require('./chunk-FNEUOBCV.cjs');
7
+
8
+
9
+
10
+ var _chunk57SJ4LJFcjs = require('./chunk-57SJ4LJF.cjs');
11
+
12
+
13
+ var _chunkTK44VBIEcjs = require('./chunk-TK44VBIE.cjs');
14
+
15
+ // src/components/spinner/spinner.tsx
16
+ var _react = require('react');
17
+ var _reactnative = require('react-native');
18
+ var _reactnativereanimated = require('react-native-reanimated'); var _reactnativereanimated2 = _interopRequireDefault(_reactnativereanimated);
19
+
20
+ // src/components/spinner/spinner.recipe.ts
21
+ var SLOTS = ["root", "arc"];
22
+ var VARIANT_TOKENS = {
23
+ primary: { fg: "accent" },
24
+ secondary: { fg: "accentSoftForeground" },
25
+ default: { fg: "foreground" },
26
+ tertiary: { fg: "muted" },
27
+ success: { fg: "success" },
28
+ warning: { fg: "warning" },
29
+ danger: { fg: "danger" }
30
+ };
31
+ var TRACK_OPACITY = 0.18;
32
+ function sizeAxis(step) {
33
+ return (theme) => {
34
+ const diameter = theme.spacing(step.diameter);
35
+ const stroke = theme.borderWidth.default * step.stroke;
36
+ return {
37
+ root: {
38
+ width: diameter,
39
+ height: diameter,
40
+ borderRadius: diameter / 2,
41
+ borderWidth: stroke
42
+ },
43
+ // The arc is the same ring, drawn one stroke outside the track's box so the two
44
+ // circles land on each other rather than nesting. R13 — `start` and `end`, so the
45
+ // inset mirrors with the layout instead of staying put.
46
+ arc: {
47
+ position: "absolute",
48
+ top: -stroke,
49
+ bottom: -stroke,
50
+ start: -stroke,
51
+ end: -stroke,
52
+ borderRadius: diameter / 2 + stroke,
53
+ borderWidth: stroke
54
+ }
55
+ };
56
+ };
57
+ }
58
+ var SIZES = {
59
+ xs: { diameter: 4, stroke: 2 },
60
+ sm: { diameter: 5, stroke: 2 },
61
+ md: { diameter: 6, stroke: 2 },
62
+ lg: { diameter: 8, stroke: 3 }
63
+ };
64
+ var spinnerRecipe = _chunkFNEUOBCVcjs.createRecipe.call(void 0, {
65
+ slots: SLOTS,
66
+ base: () => ({
67
+ // Squircle corners are meaningless on a full circle, and `overflow` would clip the
68
+ // arc that deliberately sits outside this box.
69
+ root: { alignItems: "center", justifyContent: "center" }
70
+ }),
71
+ variantTokens: VARIANT_TOKENS,
72
+ /**
73
+ * One ink, two opacities, and the gap that makes the rotation visible.
74
+ *
75
+ * `borderTopColor: 'transparent'` is structural rather than a colour the theme has an
76
+ * opinion about — it is the quarter of the circle that is missing, and without it a
77
+ * rotating ring is a ring.
78
+ */
79
+ paint: (_theme, colors) => ({
80
+ root: { borderColor: colors.fg ? _chunk57SJ4LJFcjs.alpha.call(void 0, colors.fg, TRACK_OPACITY) : void 0 },
81
+ arc: { borderColor: colors.fg, borderTopColor: "transparent" }
82
+ }),
83
+ variants: {
84
+ size: {
85
+ xs: sizeAxis(SIZES.xs),
86
+ sm: sizeAxis(SIZES.sm),
87
+ md: sizeAxis(SIZES.md),
88
+ lg: sizeAxis(SIZES.lg)
89
+ }
90
+ },
91
+ defaultVariants: { variant: "primary", size: "md" }
92
+ });
93
+
94
+ // src/components/spinner/spinner.tsx
95
+ var _jsxruntime = require('react/jsx-runtime');
96
+ var Spinner = _react.forwardRef.call(void 0, function Spinner2({ variant, size, color, animation = true, style, ...props }, ref) {
97
+ const theme = _chunk57SJ4LJFcjs.useXAUITheme.call(void 0, );
98
+ const [styleProps, rest] = _chunkTK44VBIEcjs.useStyleProps.call(void 0, props);
99
+ const selection = { variant, size };
100
+ const styles = spinnerRecipe.resolve({ theme, selection });
101
+ const tint = color ? spinnerRecipe.tint({ theme, color, selection }) : void 0;
102
+ const arcStyle = [styles.arc, _optionalChain([tint, 'optionalAccess', _ => _.arc])];
103
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
104
+ _reactnative.View,
105
+ {
106
+ ref,
107
+ accessibilityRole: "progressbar",
108
+ accessibilityState: { busy: animation },
109
+ ...rest,
110
+ style: [styles.root, _optionalChain([tint, 'optionalAccess', _2 => _2.root]), styleProps, style],
111
+ children: animation ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, SpinningArc, { style: arcStyle }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reactnative.View, { style: arcStyle })
112
+ }
113
+ );
114
+ });
115
+ Spinner.displayName = "XAUI.Spinner";
116
+ function SpinningArc({ style }) {
117
+ const rotation = _chunkXSQPVDFHcjs.useRotation.call(void 0, );
118
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reactnativereanimated2.default.View, { style: [style, rotation] });
119
+ }
120
+
121
+
122
+
123
+
124
+ exports.spinnerRecipe = spinnerRecipe; exports.Spinner = Spinner;
@@ -0,0 +1,314 @@
1
+ import {
2
+ useRotation
3
+ } from "./chunk-3GFRSZYR.js";
4
+ import {
5
+ Icon
6
+ } from "./chunk-FHUYHV6J.js";
7
+ import {
8
+ PressableFeedback
9
+ } from "./chunk-6UEZJRVI.js";
10
+ import {
11
+ usePressState
12
+ } from "./chunk-423RQBOX.js";
13
+ import {
14
+ warnDev
15
+ } from "./chunk-EGLLDKN6.js";
16
+ import {
17
+ createRecipe,
18
+ radiusAxis
19
+ } from "./chunk-4GTAZM2C.js";
20
+ import {
21
+ useXAUITheme
22
+ } from "./chunk-A3EGFI6T.js";
23
+ import {
24
+ childrenToString,
25
+ createSlotContext
26
+ } from "./chunk-K72UDPVN.js";
27
+ import {
28
+ useStyleProps
29
+ } from "./chunk-M63GFNKV.js";
30
+
31
+ // src/components/button/button.context.ts
32
+ var [ButtonProvider, useButton] = createSlotContext("Button");
33
+
34
+ // src/components/button/button-icon.tsx
35
+ import { jsx } from "react/jsx-runtime";
36
+ function ButtonIcon({ size, color, ...rest }) {
37
+ const { icon } = useButton();
38
+ return /* @__PURE__ */ jsx(Icon, { size: size ?? icon.size, color: color ?? icon.color, ...rest });
39
+ }
40
+ ButtonIcon.displayName = "XAUI.Button.Icon";
41
+
42
+ // src/components/button/button-label.tsx
43
+ import { forwardRef } from "react";
44
+ import { Text } from "react-native";
45
+ import { jsx as jsx2 } from "react/jsx-runtime";
46
+ var ButtonLabel = forwardRef(function ButtonLabel2({ children, style, numberOfLines = 1, ...props }, ref) {
47
+ const { labelStyle } = useButton();
48
+ const [styleProps, rest] = useStyleProps(props);
49
+ return /* @__PURE__ */ jsx2(
50
+ Text,
51
+ {
52
+ ref,
53
+ numberOfLines,
54
+ style: [labelStyle, styleProps, style],
55
+ ...rest,
56
+ children
57
+ }
58
+ );
59
+ });
60
+ ButtonLabel.displayName = "XAUI.Button.Label";
61
+
62
+ // src/components/button/button-spinner.tsx
63
+ import { View } from "react-native";
64
+ import Animated from "react-native-reanimated";
65
+ import { jsx as jsx3 } from "react/jsx-runtime";
66
+ function ButtonSpinner({
67
+ style,
68
+ animation = true,
69
+ ...props
70
+ }) {
71
+ const { spinnerStyle } = useButton();
72
+ const [styleProps] = useStyleProps(props);
73
+ const ringStyle = [spinnerStyle, styleProps, style];
74
+ if (!animation) return /* @__PURE__ */ jsx3(View, { style: ringStyle });
75
+ return /* @__PURE__ */ jsx3(SpinningRing, { style: ringStyle });
76
+ }
77
+ ButtonSpinner.displayName = "XAUI.Button.Spinner";
78
+ function SpinningRing({ style }) {
79
+ const rotation = useRotation();
80
+ return /* @__PURE__ */ jsx3(Animated.View, { style: [style, rotation] });
81
+ }
82
+
83
+ // src/components/button/button.tsx
84
+ import { forwardRef as forwardRef2, useMemo } from "react";
85
+ import { StyleSheet } from "react-native";
86
+
87
+ // src/components/button/button.recipe.ts
88
+ var SLOTS = ["root", "label", "icon", "spinner"];
89
+ var VARIANT_TOKENS = {
90
+ primary: { bg: "accent", bgPressed: "accentPressed", fg: "accentForeground" },
91
+ // The accent's soft slice, not a second neutral: `secondary` is to `primary` what
92
+ // `danger-soft` is to `danger`, and it reads as the same family at lower emphasis.
93
+ secondary: {
94
+ bg: "accentSoft",
95
+ bgPressed: "accentSoftPressed",
96
+ fg: "accentSoftForeground"
97
+ },
98
+ default: { bg: "default", bgPressed: "defaultPressed", fg: "defaultForeground" },
99
+ tertiary: {
100
+ border: "border",
101
+ bgPressed: "defaultSoftPressed",
102
+ fg: "foreground"
103
+ },
104
+ ghost: { bgPressed: "defaultSoftPressed", fg: "foreground" },
105
+ danger: { bg: "danger", bgPressed: "dangerPressed", fg: "dangerForeground" },
106
+ "danger-soft": {
107
+ bg: "dangerSoft",
108
+ bgPressed: "dangerSoftPressed",
109
+ fg: "dangerSoftForeground"
110
+ }
111
+ };
112
+ function ring(theme, size) {
113
+ return {
114
+ width: size,
115
+ height: size,
116
+ borderRadius: size / 2,
117
+ borderWidth: theme.borderWidth.default * 2,
118
+ borderTopColor: "transparent"
119
+ };
120
+ }
121
+ function sizeAxis(step) {
122
+ const { size, padding, gap, glyph, radius } = step;
123
+ return (theme) => ({
124
+ root: {
125
+ height: theme.controlHeights[size],
126
+ paddingHorizontal: theme.spacing(padding),
127
+ gap: theme.spacing(gap),
128
+ borderRadius: theme.radius[radius]
129
+ },
130
+ label: {
131
+ fontSize: theme.fontSizes[size],
132
+ lineHeight: theme.lineHeights[size]
133
+ },
134
+ icon: { fontSize: theme.fontSizes[glyph] },
135
+ spinner: ring(theme, theme.fontSizes[glyph])
136
+ });
137
+ }
138
+ var buttonRecipe = createRecipe({
139
+ slots: SLOTS,
140
+ base: (theme) => ({
141
+ root: {
142
+ flexDirection: "row",
143
+ alignItems: "center",
144
+ justifyContent: "center",
145
+ borderWidth: 0,
146
+ // iOS's squircle. Free on Android, and it is what makes a large radius read as a
147
+ // shape rather than as two arcs meeting a straight edge.
148
+ borderCurve: "continuous"
149
+ },
150
+ label: {
151
+ fontFamily: theme.fontFamilies.body,
152
+ fontWeight: theme.fontWeights.medium
153
+ }
154
+ }),
155
+ variantTokens: VARIANT_TOKENS,
156
+ /**
157
+ * Where the variant's colours land, for every variant at once. The border width follows
158
+ * the *presence* of the border role rather than a per-variant flag — `tertiary` is the
159
+ * only variant that names one, and that fact is already in the table above.
160
+ */
161
+ paint: (theme, colors) => ({
162
+ root: {
163
+ backgroundColor: colors.bg,
164
+ borderColor: colors.border,
165
+ borderWidth: colors.border ? theme.borderWidth.default : 0
166
+ },
167
+ label: { color: colors.fg },
168
+ icon: { color: colors.fg },
169
+ spinner: { borderColor: colors.fg }
170
+ }),
171
+ /**
172
+ * Declaration order is application order: `radius` overrides the radius `size` set, and
173
+ * `isIconOnly` overrides its padding. Both are axes rather than a static sheet merged
174
+ * at the call site, so they stay inside the cache key and a press still allocates
175
+ * nothing.
176
+ */
177
+ variants: {
178
+ size: {
179
+ xs: sizeAxis({ size: "xs", padding: 3, gap: 1, glyph: "sm", radius: "3xl" }),
180
+ sm: sizeAxis({
181
+ size: "sm",
182
+ padding: 3.5,
183
+ gap: 1.5,
184
+ glyph: "md",
185
+ radius: "3xl"
186
+ }),
187
+ md: sizeAxis({ size: "md", padding: 4, gap: 2, glyph: "lg", radius: "3xl" }),
188
+ lg: sizeAxis({ size: "lg", padding: 5, gap: 2.5, glyph: "xl", radius: "4xl" })
189
+ },
190
+ radius: radiusAxis("root"),
191
+ // A square on a fixed height. No width is computed, and none needs to be.
192
+ isIconOnly: {
193
+ true: () => ({ root: { paddingHorizontal: 0, aspectRatio: 1 } })
194
+ }
195
+ },
196
+ /**
197
+ * The pressed colour lives here rather than in a `PressableFeedback.Highlight`, because
198
+ * a control picks one treatment or the other — both, and a pressed button darkens
199
+ * twice. This one is the variant's own `…Pressed` token, so the press reads as the
200
+ * button's colour going down rather than as a neutral film over it, and a tinted button
201
+ * presses through the same OKLab formula as a token one.
202
+ */
203
+ states: {
204
+ pressed: (_theme, colors) => ({ root: { backgroundColor: colors.bgPressed } }),
205
+ disabled: (theme) => ({ root: { opacity: theme.opacity.disabled } })
206
+ },
207
+ defaultVariants: { variant: "primary", size: "md" }
208
+ });
209
+
210
+ // src/components/button/button.utils.ts
211
+ import { Children, isValidElement } from "react";
212
+ function containsElementOfType(children, type) {
213
+ return Children.toArray(children).some(
214
+ (child) => isValidElement(child) && child.type === type
215
+ );
216
+ }
217
+
218
+ // src/components/button/button.tsx
219
+ import { Fragment, jsx as jsx4, jsxs } from "react/jsx-runtime";
220
+ var ButtonRoot = forwardRef2(function Button({
221
+ children,
222
+ variant,
223
+ size,
224
+ radius,
225
+ color,
226
+ isDisabled = false,
227
+ isLoading = false,
228
+ isIconOnly = false,
229
+ asChild = false,
230
+ accessibilityRole = "button",
231
+ accessibilityState,
232
+ style,
233
+ onPressIn,
234
+ onPressOut,
235
+ ...props
236
+ }, ref) {
237
+ const theme = useXAUITheme();
238
+ const [styleProps, rest] = useStyleProps(props);
239
+ const [isPressed, press] = usePressState({ onPressIn, onPressOut });
240
+ const selection = {
241
+ variant,
242
+ size,
243
+ radius,
244
+ isIconOnly: isIconOnly ? "true" : void 0
245
+ };
246
+ const states = { pressed: isPressed, disabled: isDisabled || isLoading };
247
+ const styles = buttonRecipe.resolve({ theme, selection, states });
248
+ const tint = color ? buttonRecipe.tint({ theme, color, selection, states }) : void 0;
249
+ const context = useMemo(() => {
250
+ const icon = StyleSheet.flatten([styles.icon, tint?.icon]);
251
+ return {
252
+ labelStyle: tint ? [styles.label, tint.label] : styles.label,
253
+ spinnerStyle: tint ? [styles.spinner, tint.spinner] : styles.spinner,
254
+ icon: {
255
+ size: icon.fontSize,
256
+ // `ColorValue` also covers the platform's opaque colours, which `Icon` cannot
257
+ // hand to a third-party component expecting a string.
258
+ color: typeof icon.color === "string" ? icon.color : void 0
259
+ },
260
+ isDisabled,
261
+ isLoading
262
+ };
263
+ }, [styles, tint, isDisabled, isLoading]);
264
+ const rootStyle = [
265
+ styles.root,
266
+ tint?.root,
267
+ styleProps,
268
+ typeof style === "function" ? style({ pressed: isPressed }) : style
269
+ ];
270
+ const text = childrenToString(children);
271
+ const showSpinner = isLoading && !containsElementOfType(children, ButtonSpinner);
272
+ if (isIconOnly && !rest.accessibilityLabel && !rest["aria-label"]) {
273
+ warnDev(
274
+ "Button: an icon-only button needs an `accessibilityLabel` \u2014 there is no text for a screen reader to read, so it announces as an unlabelled button."
275
+ );
276
+ }
277
+ return /* @__PURE__ */ jsx4(ButtonProvider, { value: context, children: /* @__PURE__ */ jsx4(
278
+ PressableFeedback,
279
+ {
280
+ ref,
281
+ isPressed,
282
+ isDisabled: isDisabled || isLoading,
283
+ asChild,
284
+ accessibilityRole,
285
+ accessibilityState: {
286
+ disabled: isDisabled,
287
+ busy: isLoading,
288
+ ...accessibilityState
289
+ },
290
+ ...rest,
291
+ style: rootStyle,
292
+ onPressIn: press.onPressIn,
293
+ onPressOut: press.onPressOut,
294
+ children: asChild ? children : /* @__PURE__ */ jsxs(Fragment, { children: [
295
+ showSpinner ? /* @__PURE__ */ jsx4(ButtonSpinner, {}) : null,
296
+ text !== null ? /* @__PURE__ */ jsx4(ButtonLabel, { children: text }) : children
297
+ ] })
298
+ }
299
+ ) });
300
+ });
301
+ ButtonRoot.displayName = "XAUI.Button.Root";
302
+
303
+ // src/components/button/index.ts
304
+ var Button2 = Object.assign(ButtonRoot, {
305
+ Label: ButtonLabel,
306
+ Icon: ButtonIcon,
307
+ Spinner: ButtonSpinner
308
+ });
309
+
310
+ export {
311
+ useButton,
312
+ buttonRecipe,
313
+ Button2 as Button
314
+ };
@@ -0,0 +1,74 @@
1
+ import {
2
+ TextFieldDescription,
3
+ TextFieldError,
4
+ TextFieldField,
5
+ TextFieldLabel,
6
+ TextFieldRoot,
7
+ useTextField
8
+ } from "./chunk-2NRZKJG7.js";
9
+ import {
10
+ createSlotContext
11
+ } from "./chunk-K72UDPVN.js";
12
+ import {
13
+ useStyleProps
14
+ } from "./chunk-M63GFNKV.js";
15
+
16
+ // src/components/text-area/text-area-field.tsx
17
+ import { forwardRef, useMemo } from "react";
18
+
19
+ // src/components/text-area/text-area.context.ts
20
+ var [TextAreaProvider, useTextArea] = createSlotContext("TextArea");
21
+
22
+ // src/components/text-area/text-area-field.tsx
23
+ import { jsx } from "react/jsx-runtime";
24
+ var TextAreaField = forwardRef(
25
+ function TextAreaField2({ style, scrollEnabled, ...props }, ref) {
26
+ const { textAreaStyle, textArea } = useTextField();
27
+ const { rows, maxRows } = useTextArea();
28
+ const [styleProps, rest] = useStyleProps(props);
29
+ const height = useMemo(() => {
30
+ const chrome = textArea.paddingVertical * 2;
31
+ return {
32
+ minHeight: rows * textArea.lineHeight + chrome,
33
+ // Unset, the field grows for as long as the text does. With a ceiling it stops
34
+ // there and scrolls, which is the only case that needs `scrollEnabled` — a
35
+ // multiline field that can grow has nothing to scroll.
36
+ maxHeight: maxRows ? maxRows * textArea.lineHeight + chrome : void 0
37
+ };
38
+ }, [rows, maxRows, textArea]);
39
+ return /* @__PURE__ */ jsx(
40
+ TextFieldField,
41
+ {
42
+ ref,
43
+ multiline: true,
44
+ scrollEnabled: scrollEnabled ?? maxRows !== void 0,
45
+ ...rest,
46
+ style: [textAreaStyle, height, styleProps, style]
47
+ }
48
+ );
49
+ }
50
+ );
51
+ TextAreaField.displayName = "XAUI.TextArea.Field";
52
+
53
+ // src/components/text-area/text-area.tsx
54
+ import { forwardRef as forwardRef2, useMemo as useMemo2 } from "react";
55
+ import { jsx as jsx2 } from "react/jsx-runtime";
56
+ var DEFAULT_ROWS = 3;
57
+ var TextAreaRoot = forwardRef2(function TextArea({ rows = DEFAULT_ROWS, maxRows, children, ...props }, ref) {
58
+ const context = useMemo2(() => ({ rows, maxRows }), [rows, maxRows]);
59
+ return /* @__PURE__ */ jsx2(TextAreaProvider, { value: context, children: /* @__PURE__ */ jsx2(TextFieldRoot, { ref, ...props, children }) });
60
+ });
61
+ TextAreaRoot.displayName = "XAUI.TextArea.Root";
62
+
63
+ // src/components/text-area/index.ts
64
+ var TextArea2 = Object.assign(TextAreaRoot, {
65
+ Label: TextFieldLabel,
66
+ Field: TextAreaField,
67
+ Description: TextFieldDescription,
68
+ Error: TextFieldError
69
+ });
70
+
71
+ export {
72
+ useTextArea,
73
+ TextArea2 as TextArea
74
+ };
@@ -0,0 +1,86 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
2
+
3
+ var _chunk3E7CDKFOcjs = require('./chunk-3E7CDKFO.cjs');
4
+
5
+
6
+ var _chunk7DPL3ZDScjs = require('./chunk-7DPL3ZDS.cjs');
7
+
8
+
9
+ var _chunkEJQCQPETcjs = require('./chunk-EJQCQPET.cjs');
10
+
11
+
12
+ var _chunkTK44VBIEcjs = require('./chunk-TK44VBIE.cjs');
13
+
14
+ // src/system/close-button/close-button.tsx
15
+ var _react = require('react');
16
+ var _reactnative = require('react-native');
17
+
18
+ // src/system/close-button/close-button.style.ts
19
+
20
+ var closeButtonSheet = _reactnative.StyleSheet.create({
21
+ bar: { transform: [{ rotate: "45deg" }] },
22
+ barMirrored: { transform: [{ rotate: "-45deg" }] }
23
+ });
24
+
25
+ // src/system/close-button/close-button.tsx
26
+ var _jsxruntime = require('react/jsx-runtime');
27
+ var HIT_SLOP = 8;
28
+ var CloseButton = _react.forwardRef.call(void 0, function CloseButton2({
29
+ name,
30
+ children,
31
+ baseStyle,
32
+ glyphStyle,
33
+ accessibilityRole = "button",
34
+ hitSlop = HIT_SLOP,
35
+ style,
36
+ onPressIn,
37
+ onPressOut,
38
+ ...props
39
+ }, ref) {
40
+ const [styleProps, rest] = _chunkTK44VBIEcjs.useStyleProps.call(void 0, props);
41
+ const [isPressed, press] = _chunk7DPL3ZDScjs.usePressState.call(void 0, { onPressIn, onPressOut });
42
+ if (!rest.accessibilityLabel && !rest["aria-label"]) {
43
+ _chunkEJQCQPETcjs.warnDev.call(void 0,
44
+ `${name}: a close button needs an \`accessibilityLabel\` \u2014 the cross is not text, and the label beside it names what is being dismissed, not the action.`
45
+ );
46
+ }
47
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
48
+ _chunk3E7CDKFOcjs.PressableFeedback,
49
+ {
50
+ ref,
51
+ isPressed,
52
+ accessibilityRole,
53
+ hitSlop,
54
+ ...rest,
55
+ style: [
56
+ baseStyle,
57
+ styleProps,
58
+ typeof style === "function" ? style({ pressed: isPressed }) : style
59
+ ],
60
+ onPressIn: press.onPressIn,
61
+ onPressOut: press.onPressOut,
62
+ children: _nullishCoalesce(children, () => ( /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
63
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reactnative.View, { style: [glyphStyle, closeButtonSheet.bar] }),
64
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reactnative.View, { style: [glyphStyle, closeButtonSheet.barMirrored] })
65
+ ] })))
66
+ }
67
+ );
68
+ });
69
+ CloseButton.displayName = "XAUI.CloseButton";
70
+
71
+ // src/system/close-button/close-button.recipe.ts
72
+ function closeButtonBase(theme) {
73
+ return {
74
+ close: { alignItems: "center", justifyContent: "center" },
75
+ closeGlyph: {
76
+ position: "absolute",
77
+ height: theme.borderWidth.default * 1.5,
78
+ borderRadius: theme.borderWidth.default
79
+ }
80
+ };
81
+ }
82
+
83
+
84
+
85
+
86
+ exports.CloseButton = CloseButton; exports.closeButtonBase = closeButtonBase;
@@ -0,0 +1,36 @@
1
+ import { ReactNode } from 'react';
2
+ import { StyleProp, ViewStyle, PressableStateCallbackType } from 'react-native';
3
+ import { P as PressableFeedbackProps } from './pressable-feedback.type-Bs4dQlGj.js';
4
+
5
+ type CloseButtonOwnProps = {
6
+ /**
7
+ * Names the slot in the development warning about a missing label — `'Chip.Close'`,
8
+ * `'Alert.Close'`. Without it the warning would say "a close button" and leave the
9
+ * reader to find which one.
10
+ */
11
+ name: string;
12
+ /**
13
+ * Replaces the built-in cross — an `Icon`, or any glyph. Unset, the button draws its
14
+ * own from two rotated bars, which is what makes a dismissible component work in a
15
+ * project that has installed no icon set.
16
+ */
17
+ children?: ReactNode;
18
+ /**
19
+ * The style the surrounding component's recipe resolved for this node, applied under
20
+ * the caller's own. It is separate from `style` because `style` may be `Pressable`'s
21
+ * function form, and a function cannot be merged into an array without being resolved
22
+ * first — which only this component can do, since it owns the press state.
23
+ */
24
+ baseStyle?: StyleProp<ViewStyle>;
25
+ /** One bar of the cross: its length, its thickness and its colour, from the recipe. */
26
+ glyphStyle?: StyleProp<ViewStyle>;
27
+ /** R9 — `Pressable`'s function form as much as an object or an array. */
28
+ style?: StyleProp<ViewStyle> | ((state: PressableStateCallbackType) => StyleProp<ViewStyle>);
29
+ };
30
+ /**
31
+ * R14 — it renders a `PressableFeedback`, so it carries that node's style keys as props
32
+ * through it.
33
+ */
34
+ type CloseButtonProps = CloseButtonOwnProps & Omit<PressableFeedbackProps, 'isPressed' | 'style' | 'children'>;
35
+
36
+ export type { CloseButtonProps as C };
@@ -0,0 +1,36 @@
1
+ import { ReactNode } from 'react';
2
+ import { StyleProp, ViewStyle, PressableStateCallbackType } from 'react-native';
3
+ import { P as PressableFeedbackProps } from './pressable-feedback.type-BA2C9sSz.cjs';
4
+
5
+ type CloseButtonOwnProps = {
6
+ /**
7
+ * Names the slot in the development warning about a missing label — `'Chip.Close'`,
8
+ * `'Alert.Close'`. Without it the warning would say "a close button" and leave the
9
+ * reader to find which one.
10
+ */
11
+ name: string;
12
+ /**
13
+ * Replaces the built-in cross — an `Icon`, or any glyph. Unset, the button draws its
14
+ * own from two rotated bars, which is what makes a dismissible component work in a
15
+ * project that has installed no icon set.
16
+ */
17
+ children?: ReactNode;
18
+ /**
19
+ * The style the surrounding component's recipe resolved for this node, applied under
20
+ * the caller's own. It is separate from `style` because `style` may be `Pressable`'s
21
+ * function form, and a function cannot be merged into an array without being resolved
22
+ * first — which only this component can do, since it owns the press state.
23
+ */
24
+ baseStyle?: StyleProp<ViewStyle>;
25
+ /** One bar of the cross: its length, its thickness and its colour, from the recipe. */
26
+ glyphStyle?: StyleProp<ViewStyle>;
27
+ /** R9 — `Pressable`'s function form as much as an object or an array. */
28
+ style?: StyleProp<ViewStyle> | ((state: PressableStateCallbackType) => StyleProp<ViewStyle>);
29
+ };
30
+ /**
31
+ * R14 — it renders a `PressableFeedback`, so it carries that node's style keys as props
32
+ * through it.
33
+ */
34
+ type CloseButtonProps = CloseButtonOwnProps & Omit<PressableFeedbackProps, 'isPressed' | 'style' | 'children'>;
35
+
36
+ export type { CloseButtonProps as C };