@xaui/native 0.9.1-alpha.29 → 0.9.1-alpha.30

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 (110) hide show
  1. package/dist/{chunk-XYFMSRNJ.js → chunk-27ZRTZEE.js} +14 -10
  2. package/dist/{chunk-ICR42HHG.js → chunk-3FV4COTM.js} +3 -3
  3. package/dist/chunk-423RQBOX.js +21 -0
  4. package/dist/{chunk-TFNB2PNI.cjs → chunk-4XPLPQLM.cjs} +13 -11
  5. package/dist/{chunk-APONC4DB.cjs → chunk-5GO7MAVY.cjs} +12 -10
  6. package/dist/{chunk-AQNWXJYV.cjs → chunk-5RQ7AZPN.cjs} +20 -16
  7. package/dist/{chunk-FFEUGWVA.cjs → chunk-5Z4P6WHR.cjs} +11 -9
  8. package/dist/{chunk-L3Q5TVYE.js → chunk-6RVCGLKZ.js} +60 -58
  9. package/dist/chunk-7DPL3ZDS.cjs +21 -0
  10. package/dist/{chunk-Y4BPKSD3.js → chunk-7SEZGVTY.js} +1 -1
  11. package/dist/chunk-7XKQJQF2.cjs +70 -0
  12. package/dist/{chunk-7BOFQN2G.js → chunk-A5OCK3C2.js} +7 -5
  13. package/dist/{chunk-4HELPMAK.js → chunk-BFMTUMTU.js} +81 -101
  14. package/dist/chunk-BVJQ3UPZ.js +62 -0
  15. package/dist/{chunk-NG4GFBDR.js → chunk-DFME724B.js} +8 -6
  16. package/dist/chunk-E2CWBQTV.js +119 -0
  17. package/dist/chunk-E4TS6632.cjs +314 -0
  18. package/dist/{chunk-VUEDYW3M.js → chunk-FMZQW35T.js} +15 -11
  19. package/dist/{chunk-OYZYWWJ6.js → chunk-G7K652GC.js} +4 -2
  20. package/dist/{chunk-YGOXQSNU.js → chunk-GI24YJPE.js} +100 -206
  21. package/dist/chunk-GLGU2WFL.cjs +190 -0
  22. package/dist/{chunk-IG4Q3WQO.cjs → chunk-GPVNCJ3Z.cjs} +74 -95
  23. package/dist/{chunk-D4SOU26X.js → chunk-GVQOD3VW.js} +5 -3
  24. package/dist/chunk-KOC3KQIT.js +124 -0
  25. package/dist/chunk-KPWZLUES.cjs +124 -0
  26. package/dist/{chunk-SVRZJEDU.cjs → chunk-KWCHSIMI.cjs} +16 -12
  27. package/dist/{chunk-GCU5A5MM.cjs → chunk-N527BTY4.cjs} +17 -15
  28. package/dist/{chunk-F3H4TXAY.cjs → chunk-NBFWWQFW.cjs} +16 -12
  29. package/dist/{chunk-HOIQRGSK.js → chunk-NYRXUGVL.js} +6 -4
  30. package/dist/{chunk-V56334S3.js → chunk-Q3WFY5N3.js} +9 -7
  31. package/dist/{chunk-FXHRNUCS.cjs → chunk-QGN2BBJO.cjs} +8 -6
  32. package/dist/{chunk-J2JJLKLG.cjs → chunk-TGZZ3RZU.cjs} +7 -5
  33. package/dist/{chunk-YWBTIWT5.cjs → chunk-UBQLKIZC.cjs} +22 -18
  34. package/dist/{chunk-PMO62QK4.js → chunk-URSKA2VR.js} +1 -114
  35. package/dist/{chunk-A4RGJBP2.js → chunk-V4WDMM6Z.js} +5 -3
  36. package/dist/{chunk-FDSQOPJH.js → chunk-VJEER76X.js} +11 -7
  37. package/dist/{chunk-O5KDIEDH.cjs → chunk-VZBWYWEI.cjs} +25 -24
  38. package/dist/{chunk-B4W2XNBP.cjs → chunk-WR7YLDVV.cjs} +3 -3
  39. package/dist/{chunk-5RFRASSB.js → chunk-X4HQ4H2V.js} +16 -15
  40. package/dist/{chunk-IBEX4XGV.cjs → chunk-XFSW3ZNI.cjs} +13 -11
  41. package/dist/{chunk-VZGBEGDV.cjs → chunk-XQFAUDR2.cjs} +2 -2
  42. package/dist/{chunk-V3KS5PPK.js → chunk-YKL6XHM6.js} +14 -10
  43. package/dist/{chunk-HUZ4AUM2.cjs → chunk-ZP2E2H2G.cjs} +4 -188
  44. package/dist/{chunk-RZC4VFB5.cjs → chunk-ZSLNGBDS.cjs} +68 -66
  45. package/dist/components/alert/index.cjs +8 -6
  46. package/dist/components/alert/index.d.cts +2 -2
  47. package/dist/components/alert/index.d.ts +2 -2
  48. package/dist/components/alert/index.js +7 -5
  49. package/dist/components/button/index.cjs +9 -5
  50. package/dist/components/button/index.d.cts +9 -4
  51. package/dist/components/button/index.d.ts +9 -4
  52. package/dist/components/button/index.js +8 -4
  53. package/dist/components/card/index.cjs +6 -4
  54. package/dist/components/card/index.d.cts +1 -1
  55. package/dist/components/card/index.d.ts +1 -1
  56. package/dist/components/card/index.js +5 -3
  57. package/dist/components/checkbox/index.cjs +7 -5
  58. package/dist/components/checkbox/index.d.cts +1 -1
  59. package/dist/components/checkbox/index.d.ts +1 -1
  60. package/dist/components/checkbox/index.js +6 -4
  61. package/dist/components/chip/index.cjs +8 -6
  62. package/dist/components/chip/index.d.cts +2 -2
  63. package/dist/components/chip/index.d.ts +2 -2
  64. package/dist/components/chip/index.js +7 -5
  65. package/dist/components/input/index.cjs +4 -3
  66. package/dist/components/input/index.d.cts +1 -1
  67. package/dist/components/input/index.d.ts +1 -1
  68. package/dist/components/input/index.js +3 -2
  69. package/dist/components/input-group/index.cjs +6 -5
  70. package/dist/components/input-group/index.d.cts +1 -1
  71. package/dist/components/input-group/index.d.ts +1 -1
  72. package/dist/components/input-group/index.js +5 -4
  73. package/dist/components/input-otp/index.cjs +4 -3
  74. package/dist/components/input-otp/index.d.cts +2 -2
  75. package/dist/components/input-otp/index.d.ts +2 -2
  76. package/dist/components/input-otp/index.js +3 -2
  77. package/dist/components/radio/index.cjs +7 -5
  78. package/dist/components/radio/index.d.cts +1 -1
  79. package/dist/components/radio/index.d.ts +1 -1
  80. package/dist/components/radio/index.js +6 -4
  81. package/dist/components/spinner/index.cjs +16 -0
  82. package/dist/components/spinner/index.d.cts +104 -0
  83. package/dist/components/spinner/index.d.ts +104 -0
  84. package/dist/components/spinner/index.js +16 -0
  85. package/dist/components/switch/index.cjs +6 -4
  86. package/dist/components/switch/index.d.cts +1 -1
  87. package/dist/components/switch/index.d.ts +1 -1
  88. package/dist/components/switch/index.js +5 -3
  89. package/dist/components/text-area/index.cjs +5 -4
  90. package/dist/components/text-area/index.js +4 -3
  91. package/dist/components/typography/index.cjs +4 -3
  92. package/dist/components/typography/index.d.cts +1 -1
  93. package/dist/components/typography/index.d.ts +1 -1
  94. package/dist/components/typography/index.js +3 -2
  95. package/dist/components/view/index.cjs +4 -3
  96. package/dist/components/view/index.js +3 -2
  97. package/dist/{create-recipe-DUo8doTt.d.ts → create-recipe-BdVd2ffi.d.ts} +1 -1
  98. package/dist/{create-recipe-CWvI5ot3.d.cts → create-recipe-dC7wMfnj.d.cts} +1 -1
  99. package/dist/{icon.type-Dq4_qePa.d.ts → icon.type-Kml72iSz.d.ts} +1 -1
  100. package/dist/{icon.type-CF4KiMKl.d.cts → icon.type-d_i9ma-i.d.cts} +1 -1
  101. package/dist/index.cjs +39 -37
  102. package/dist/index.d.cts +24 -4
  103. package/dist/index.d.ts +24 -4
  104. package/dist/index.js +73 -71
  105. package/dist/system/index.cjs +11 -8
  106. package/dist/system/index.d.cts +4 -4
  107. package/dist/system/index.d.ts +4 -4
  108. package/dist/system/index.js +11 -8
  109. package/package.json +11 -1
  110. package/dist/chunk-E25JH7W2.cjs +0 -456
@@ -5,11 +5,11 @@ import { ReactNode, Provider, Ref, RefCallback } from 'react';
5
5
  import { S as SlotAnimation, F as FeedbackContext, a as AnimationProp, b as ResolvedAnimation, P as PressableFeedbackProps } from '../pressable-feedback.type-BA2C9sSz.cjs';
6
6
  export { A as AnimationConfig, R as RadiusStyle, c as RippleWave } from '../pressable-feedback.type-BA2C9sSz.cjs';
7
7
  import { R as RadiusKey, X as XAUITheme } from '../theme.type-C2gNHpEx.cjs';
8
- import { j as StyleFn, f as SlotStyle } from '../create-recipe-CWvI5ot3.cjs';
9
- export { A as Axes, C as CompoundVariant, R as Recipe, b as RecipeConfig, a as ResolveArgs, d as ResolvedSelection, e as ResolvedStyles, S as Selection, g as SlotStyles, h as StateName, i as States, T as TintArgs, V as VariantColors, k as VariantRole, l as VariantTokens, c as createRecipe } from '../create-recipe-CWvI5ot3.cjs';
8
+ import { a as StyleFn, h as SlotStyle } from '../create-recipe-dC7wMfnj.cjs';
9
+ export { A as Axes, C as CompoundVariant, R as Recipe, d as RecipeConfig, b as ResolveArgs, e as ResolvedSelection, f as ResolvedStyles, g as Selection, S as SlotStyles, i as StateName, j as States, T as TintArgs, V as VariantColors, k as VariantRole, l as VariantTokens, c as createRecipe } from '../create-recipe-dC7wMfnj.cjs';
10
10
  export { C as CloseButtonProps } from '../close-button.type-CHsgZ3wO.cjs';
11
- import { b as IconProps, a as IconContextValue } from '../icon.type-CF4KiMKl.cjs';
12
- export { I as IconComponentProps } from '../icon.type-CF4KiMKl.cjs';
11
+ import { a as IconProps, I as IconContextValue } from '../icon.type-d_i9ma-i.cjs';
12
+ export { b as IconComponentProps } from '../icon.type-d_i9ma-i.cjs';
13
13
  import { V as ViewStyleProps } from '../style-props.type-CfnoGEP7.cjs';
14
14
  export { D as DirectionalStyleKey, I as ImageStyleProps, S as StyleProps, T as TextStyleProps } from '../style-props.type-CfnoGEP7.cjs';
15
15
  import 'react-native-reanimated';
@@ -5,11 +5,11 @@ import { ReactNode, Provider, Ref, RefCallback } from 'react';
5
5
  import { S as SlotAnimation, F as FeedbackContext, a as AnimationProp, b as ResolvedAnimation, P as PressableFeedbackProps } from '../pressable-feedback.type-Bs4dQlGj.js';
6
6
  export { A as AnimationConfig, R as RadiusStyle, c as RippleWave } from '../pressable-feedback.type-Bs4dQlGj.js';
7
7
  import { R as RadiusKey, X as XAUITheme } from '../theme.type-C2gNHpEx.js';
8
- import { j as StyleFn, f as SlotStyle } from '../create-recipe-DUo8doTt.js';
9
- export { A as Axes, C as CompoundVariant, R as Recipe, b as RecipeConfig, a as ResolveArgs, d as ResolvedSelection, e as ResolvedStyles, S as Selection, g as SlotStyles, h as StateName, i as States, T as TintArgs, V as VariantColors, k as VariantRole, l as VariantTokens, c as createRecipe } from '../create-recipe-DUo8doTt.js';
8
+ import { a as StyleFn, h as SlotStyle } from '../create-recipe-BdVd2ffi.js';
9
+ export { A as Axes, C as CompoundVariant, R as Recipe, d as RecipeConfig, b as ResolveArgs, e as ResolvedSelection, f as ResolvedStyles, g as Selection, S as SlotStyles, i as StateName, j as States, T as TintArgs, V as VariantColors, k as VariantRole, l as VariantTokens, c as createRecipe } from '../create-recipe-BdVd2ffi.js';
10
10
  export { C as CloseButtonProps } from '../close-button.type-BUYuoSt2.js';
11
- import { b as IconProps, a as IconContextValue } from '../icon.type-Dq4_qePa.js';
12
- export { I as IconComponentProps } from '../icon.type-Dq4_qePa.js';
11
+ import { a as IconProps, I as IconContextValue } from '../icon.type-Kml72iSz.js';
12
+ export { b as IconComponentProps } from '../icon.type-Kml72iSz.js';
13
13
  import { V as ViewStyleProps } from '../style-props.type-CfnoGEP7.js';
14
14
  export { D as DirectionalStyleKey, I as ImageStyleProps, S as StyleProps, T as TextStyleProps } from '../style-props.type-CfnoGEP7.js';
15
15
  import 'react-native-reanimated';
@@ -2,14 +2,14 @@ import {
2
2
  Portal,
3
3
  PortalContext,
4
4
  PortalHost
5
- } from "../chunk-Y4BPKSD3.js";
5
+ } from "../chunk-7SEZGVTY.js";
6
6
  import {
7
7
  SelectionFill
8
8
  } from "../chunk-BA2DBSAN.js";
9
9
  import {
10
10
  CloseButton,
11
11
  closeButtonBase
12
- } from "../chunk-A4RGJBP2.js";
12
+ } from "../chunk-V4WDMM6Z.js";
13
13
  import {
14
14
  FEEDBACK_OVERLAY,
15
15
  HIGHLIGHT_DURATION,
@@ -31,26 +31,29 @@ import {
31
31
  resolveSlotAnimation,
32
32
  rippleRadiusFor,
33
33
  useFeedback
34
- } from "../chunk-4HELPMAK.js";
35
- import "../chunk-EGLLDKN6.js";
34
+ } from "../chunk-BFMTUMTU.js";
35
+ import "../chunk-423RQBOX.js";
36
36
  import {
37
37
  Icon,
38
38
  IconContext,
39
39
  useIconContext
40
- } from "../chunk-ICR42HHG.js";
40
+ } from "../chunk-3FV4COTM.js";
41
+ import "../chunk-EGLLDKN6.js";
41
42
  import {
42
43
  createRecipe,
43
44
  radiusAxis
44
45
  } from "../chunk-4GTAZM2C.js";
46
+ import "../chunk-A3EGFI6T.js";
45
47
  import {
46
48
  Slot,
47
49
  childrenToString,
48
50
  createSlotContext,
49
- mergeProps,
51
+ mergeProps
52
+ } from "../chunk-E2CWBQTV.js";
53
+ import {
50
54
  mergeRefs,
51
55
  useStyleProps
52
- } from "../chunk-PMO62QK4.js";
53
- import "../chunk-A3EGFI6T.js";
56
+ } from "../chunk-URSKA2VR.js";
54
57
  import "../chunk-GGW42MY4.js";
55
58
  export {
56
59
  CloseButton,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xaui/native",
3
- "version": "0.9.1-alpha.29",
3
+ "version": "0.9.1-alpha.30",
4
4
  "description": "Composition-first React Native UI components with native animations powered by Reanimated",
5
5
  "keywords": [
6
6
  "react-native",
@@ -117,6 +117,16 @@
117
117
  "default": "./dist/components/radio/index.cjs"
118
118
  }
119
119
  },
120
+ "./spinner": {
121
+ "import": {
122
+ "types": "./dist/components/spinner/index.d.ts",
123
+ "default": "./dist/components/spinner/index.js"
124
+ },
125
+ "require": {
126
+ "types": "./dist/components/spinner/index.d.cts",
127
+ "default": "./dist/components/spinner/index.cjs"
128
+ }
129
+ },
120
130
  "./switch": {
121
131
  "import": {
122
132
  "types": "./dist/components/switch/index.d.ts",
@@ -1,456 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- function _interopRequireDefault(obj) {
7
- return obj && obj.__esModule ? obj : {
8
- default: obj
9
- };
10
- }
11
- function _nullishCoalesce(lhs, rhsFn) {
12
- if (lhs != null) {
13
- return lhs;
14
- } else {
15
- return rhsFn();
16
- }
17
- }
18
- function _optionalChain(ops) {
19
- let lastAccessLHS = undefined;
20
- let value = ops[0];
21
- let i = 1;
22
- while (i < ops.length) {
23
- const op = ops[i];
24
- const fn = ops[i + 1];
25
- i += 2;
26
- if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) {
27
- return undefined;
28
- }
29
- if (op === 'access' || op === 'optionalAccess') {
30
- lastAccessLHS = value;
31
- value = fn(value);
32
- } else if (op === 'call' || op === 'optionalCall') {
33
- value = fn((...args) => value.call(lastAccessLHS, ...args));
34
- lastAccessLHS = undefined;
35
- }
36
- }
37
- return value;
38
- }
39
- var _chunkIG4Q3WQOcjs = require('./chunk-IG4Q3WQO.cjs');
40
- var _chunkEJQCQPETcjs = require('./chunk-EJQCQPET.cjs');
41
- var _chunkB4W2XNBPcjs = require('./chunk-B4W2XNBP.cjs');
42
- var _chunkFNEUOBCVcjs = require('./chunk-FNEUOBCV.cjs');
43
- var _chunkHUZ4AUM2cjs = require('./chunk-HUZ4AUM2.cjs');
44
- var _chunk57SJ4LJFcjs = require('./chunk-57SJ4LJF.cjs');
45
-
46
- // src/components/button/button.context.ts
47
- var [ButtonProvider, useButton] = _chunkHUZ4AUM2cjs.createSlotContext.call(void 0, "Button");
48
-
49
- // src/components/button/button-icon.tsx
50
- var _jsxruntime = require('react/jsx-runtime');
51
- function ButtonIcon({
52
- size,
53
- color,
54
- ...rest
55
- }) {
56
- const {
57
- icon
58
- } = useButton();
59
- return /* @__PURE__ */_jsxruntime.jsx.call(void 0, _chunkB4W2XNBPcjs.Icon, {
60
- size: _nullishCoalesce(size, () => icon.size),
61
- color: _nullishCoalesce(color, () => icon.color),
62
- ...rest
63
- });
64
- }
65
- ButtonIcon.displayName = "XAUI.Button.Icon";
66
-
67
- // src/components/button/button-label.tsx
68
- var _react = require('react');
69
- var _reactnative = require('react-native');
70
- var ButtonLabel = _react.forwardRef.call(void 0, function ButtonLabel2({
71
- children,
72
- style,
73
- numberOfLines = 1,
74
- ...props
75
- }, ref) {
76
- const {
77
- labelStyle
78
- } = useButton();
79
- const [styleProps, rest] = _chunkHUZ4AUM2cjs.useStyleProps.call(void 0, props);
80
- return /* @__PURE__ */_jsxruntime.jsx.call(void 0, _reactnative.Text, {
81
- ref,
82
- numberOfLines,
83
- style: [labelStyle, styleProps, style],
84
- ...rest,
85
- children
86
- });
87
- });
88
- ButtonLabel.displayName = "XAUI.Button.Label";
89
-
90
- // src/components/button/button-spinner.tsx
91
-
92
- var _reactnativereanimated = require('react-native-reanimated');
93
- var _reactnativereanimated2 = _interopRequireDefault(_reactnativereanimated);
94
- var ROTATION_DURATION = 800;
95
- function ButtonSpinner({
96
- style,
97
- animation = true,
98
- ...props
99
- }) {
100
- const {
101
- spinnerStyle
102
- } = useButton();
103
- const [styleProps] = _chunkHUZ4AUM2cjs.useStyleProps.call(void 0, props);
104
- const ringStyle = [spinnerStyle, styleProps, style];
105
- if (!animation) return /* @__PURE__ */_jsxruntime.jsx.call(void 0, _reactnative.View, {
106
- style: ringStyle
107
- });
108
- return /* @__PURE__ */_jsxruntime.jsx.call(void 0, SpinningRing, {
109
- style: ringStyle
110
- });
111
- }
112
- ButtonSpinner.displayName = "XAUI.Button.Spinner";
113
- const _worklet_13197846893142_init_data = {
114
- code: "function chunkE25JH7W2Cjs1(){const{angle}=this.__closure;return{transform:[{rotate:angle.value+\"deg\"}]};}",
115
- location: "/home/runner/work/xaui/xaui/packages/native/dist/chunk-E25JH7W2.cjs",
116
- sourceMap: "{\"version\":3,\"names\":[\"chunkE25JH7W2Cjs1\",\"angle\",\"__closure\",\"transform\",\"rotate\",\"value\"],\"sources\":[\"/home/runner/work/xaui/xaui/packages/native/dist/chunk-E25JH7W2.cjs\"],\"mappings\":\"AAqF6E,SAAAA,iBAAMA,CAAA,QAAAC,KAAA,OAAAC,SAAA,CAE/E,MAAO,CAAEC,SAAS,CAAE,CAAC,CAAEC,MAAM,CAAKH,KAAK,CAACI,KAAK,MAAM,CAAC,CAAE,CAAC,CACzD\",\"ignoreList\":[]}"
117
- };
118
- function SpinningRing({
119
- style
120
- }) {
121
- const angle = _reactnativereanimated.useSharedValue.call(void 0, 0);
122
- _react.useEffect.call(void 0, () => {
123
- angle.value = _reactnativereanimated.withRepeat.call(void 0, _reactnativereanimated.withTiming.call(void 0, 360, {
124
- duration: ROTATION_DURATION,
125
- easing: _reactnativereanimated.Easing.linear
126
- }), -1, false);
127
- return () => _reactnativereanimated.cancelAnimation.call(void 0, angle);
128
- }, [angle]);
129
- const animatedStyle = _reactnativereanimated.useAnimatedStyle.call(void 0, function chunkE25JH7W2Cjs1Factory({
130
- _worklet_13197846893142_init_data,
131
- angle
132
- }) {
133
- const _e = [new global.Error(), -2, -27];
134
- const chunkE25JH7W2Cjs1 = function () {
135
- return {
136
- transform: [{
137
- rotate: `${angle.value}deg`
138
- }]
139
- };
140
- };
141
- chunkE25JH7W2Cjs1.__closure = {
142
- angle
143
- };
144
- chunkE25JH7W2Cjs1.__workletHash = 13197846893142;
145
- chunkE25JH7W2Cjs1.__pluginVersion = "0.7.4";
146
- chunkE25JH7W2Cjs1.__initData = _worklet_13197846893142_init_data;
147
- chunkE25JH7W2Cjs1.__stackDetails = _e;
148
- return chunkE25JH7W2Cjs1;
149
- }({
150
- _worklet_13197846893142_init_data,
151
- angle
152
- }), [angle]);
153
- return /* @__PURE__ */_jsxruntime.jsx.call(void 0, _reactnativereanimated2.default.View, {
154
- style: [style, animatedStyle]
155
- });
156
- }
157
-
158
- // src/components/button/button.tsx
159
-
160
- // src/components/button/button.recipe.ts
161
- var SLOTS = ["root", "label", "icon", "spinner"];
162
- var VARIANT_TOKENS = {
163
- primary: {
164
- bg: "accent",
165
- bgPressed: "accentPressed",
166
- fg: "accentForeground"
167
- },
168
- // The accent's soft slice, not a second neutral: `secondary` is to `primary` what
169
- // `danger-soft` is to `danger`, and it reads as the same family at lower emphasis.
170
- secondary: {
171
- bg: "accentSoft",
172
- bgPressed: "accentSoftPressed",
173
- fg: "accentSoftForeground"
174
- },
175
- default: {
176
- bg: "default",
177
- bgPressed: "defaultPressed",
178
- fg: "defaultForeground"
179
- },
180
- tertiary: {
181
- border: "border",
182
- bgPressed: "defaultSoftPressed",
183
- fg: "foreground"
184
- },
185
- ghost: {
186
- bgPressed: "defaultSoftPressed",
187
- fg: "foreground"
188
- },
189
- danger: {
190
- bg: "danger",
191
- bgPressed: "dangerPressed",
192
- fg: "dangerForeground"
193
- },
194
- "danger-soft": {
195
- bg: "dangerSoft",
196
- bgPressed: "dangerSoftPressed",
197
- fg: "dangerSoftForeground"
198
- }
199
- };
200
- function ring(theme, size) {
201
- return {
202
- width: size,
203
- height: size,
204
- borderRadius: size / 2,
205
- borderWidth: theme.borderWidth.default * 2,
206
- borderTopColor: "transparent"
207
- };
208
- }
209
- function sizeAxis(step) {
210
- const {
211
- size,
212
- padding,
213
- gap,
214
- glyph,
215
- radius
216
- } = step;
217
- return theme => ({
218
- root: {
219
- height: theme.controlHeights[size],
220
- paddingHorizontal: theme.spacing(padding),
221
- gap: theme.spacing(gap),
222
- borderRadius: theme.radius[radius]
223
- },
224
- label: {
225
- fontSize: theme.fontSizes[size],
226
- lineHeight: theme.lineHeights[size]
227
- },
228
- icon: {
229
- fontSize: theme.fontSizes[glyph]
230
- },
231
- spinner: ring(theme, theme.fontSizes[glyph])
232
- });
233
- }
234
- var buttonRecipe = _chunkFNEUOBCVcjs.createRecipe.call(void 0, {
235
- slots: SLOTS,
236
- base: theme => ({
237
- root: {
238
- flexDirection: "row",
239
- alignItems: "center",
240
- justifyContent: "center",
241
- borderWidth: 0,
242
- // iOS's squircle. Free on Android, and it is what makes a large radius read as a
243
- // shape rather than as two arcs meeting a straight edge.
244
- borderCurve: "continuous"
245
- },
246
- label: {
247
- fontFamily: theme.fontFamilies.body,
248
- fontWeight: theme.fontWeights.medium
249
- }
250
- }),
251
- variantTokens: VARIANT_TOKENS,
252
- /**
253
- * Where the variant's colours land, for every variant at once. The border width follows
254
- * the *presence* of the border role rather than a per-variant flag — `tertiary` is the
255
- * only variant that names one, and that fact is already in the table above.
256
- */
257
- paint: (theme, colors) => ({
258
- root: {
259
- backgroundColor: colors.bg,
260
- borderColor: colors.border,
261
- borderWidth: colors.border ? theme.borderWidth.default : 0
262
- },
263
- label: {
264
- color: colors.fg
265
- },
266
- icon: {
267
- color: colors.fg
268
- },
269
- spinner: {
270
- borderColor: colors.fg
271
- }
272
- }),
273
- /**
274
- * Declaration order is application order: `radius` overrides the radius `size` set, and
275
- * `isIconOnly` overrides its padding. Both are axes rather than a static sheet merged
276
- * at the call site, so they stay inside the cache key and a press still allocates
277
- * nothing.
278
- */
279
- variants: {
280
- size: {
281
- xs: sizeAxis({
282
- size: "xs",
283
- padding: 3,
284
- gap: 1,
285
- glyph: "sm",
286
- radius: "3xl"
287
- }),
288
- sm: sizeAxis({
289
- size: "sm",
290
- padding: 3.5,
291
- gap: 1.5,
292
- glyph: "md",
293
- radius: "3xl"
294
- }),
295
- md: sizeAxis({
296
- size: "md",
297
- padding: 4,
298
- gap: 2,
299
- glyph: "lg",
300
- radius: "3xl"
301
- }),
302
- lg: sizeAxis({
303
- size: "lg",
304
- padding: 5,
305
- gap: 2.5,
306
- glyph: "xl",
307
- radius: "4xl"
308
- })
309
- },
310
- radius: _chunkFNEUOBCVcjs.radiusAxis.call(void 0, "root"),
311
- // A square on a fixed height. No width is computed, and none needs to be.
312
- isIconOnly: {
313
- true: () => ({
314
- root: {
315
- paddingHorizontal: 0,
316
- aspectRatio: 1
317
- }
318
- })
319
- }
320
- },
321
- /**
322
- * The pressed colour lives here rather than in a `PressableFeedback.Highlight`, because
323
- * a control picks one treatment or the other — both, and a pressed button darkens
324
- * twice. This one is the variant's own `…Pressed` token, so the press reads as the
325
- * button's colour going down rather than as a neutral film over it, and a tinted button
326
- * presses through the same OKLab formula as a token one.
327
- */
328
- states: {
329
- pressed: (_theme, colors) => ({
330
- root: {
331
- backgroundColor: colors.bgPressed
332
- }
333
- }),
334
- disabled: theme => ({
335
- root: {
336
- opacity: theme.opacity.disabled
337
- }
338
- })
339
- },
340
- defaultVariants: {
341
- variant: "primary",
342
- size: "md"
343
- }
344
- });
345
-
346
- // src/components/button/button.utils.ts
347
-
348
- function containsElementOfType(children, type) {
349
- return _react.Children.toArray(children).some(child => _react.isValidElement.call(void 0, child) && child.type === type);
350
- }
351
-
352
- // src/components/button/button.tsx
353
-
354
- var ButtonRoot = _react.forwardRef.call(void 0, function Button({
355
- children,
356
- variant,
357
- size,
358
- radius,
359
- color,
360
- isDisabled = false,
361
- isLoading = false,
362
- isIconOnly = false,
363
- asChild = false,
364
- accessibilityRole = "button",
365
- accessibilityState,
366
- style,
367
- onPressIn,
368
- onPressOut,
369
- ...props
370
- }, ref) {
371
- const theme = _chunk57SJ4LJFcjs.useXAUITheme.call(void 0);
372
- const [styleProps, rest] = _chunkHUZ4AUM2cjs.useStyleProps.call(void 0, props);
373
- const [isPressed, press] = _chunkIG4Q3WQOcjs.usePressState.call(void 0, {
374
- onPressIn,
375
- onPressOut
376
- });
377
- const selection = {
378
- variant,
379
- size,
380
- radius,
381
- isIconOnly: isIconOnly ? "true" : void 0
382
- };
383
- const states = {
384
- pressed: isPressed,
385
- disabled: isDisabled || isLoading
386
- };
387
- const styles = buttonRecipe.resolve({
388
- theme,
389
- selection,
390
- states
391
- });
392
- const tint = color ? buttonRecipe.tint({
393
- theme,
394
- color,
395
- selection,
396
- states
397
- }) : void 0;
398
- const context = _react.useMemo.call(void 0, () => {
399
- const icon = _reactnative.StyleSheet.flatten([styles.icon, _optionalChain([tint, 'optionalAccess', _ => _.icon])]);
400
- return {
401
- labelStyle: tint ? [styles.label, tint.label] : styles.label,
402
- spinnerStyle: tint ? [styles.spinner, tint.spinner] : styles.spinner,
403
- icon: {
404
- size: icon.fontSize,
405
- // `ColorValue` also covers the platform's opaque colours, which `Icon` cannot
406
- // hand to a third-party component expecting a string.
407
- color: typeof icon.color === "string" ? icon.color : void 0
408
- },
409
- isDisabled,
410
- isLoading
411
- };
412
- }, [styles, tint, isDisabled, isLoading]);
413
- const rootStyle = [styles.root, _optionalChain([tint, 'optionalAccess', _2 => _2.root]), styleProps, typeof style === "function" ? style({
414
- pressed: isPressed
415
- }) : style];
416
- const text = _chunkHUZ4AUM2cjs.childrenToString.call(void 0, children);
417
- const showSpinner = isLoading && !containsElementOfType(children, ButtonSpinner);
418
- if (isIconOnly && !rest.accessibilityLabel && !rest["aria-label"]) {
419
- _chunkEJQCQPETcjs.warnDev.call(void 0, "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.");
420
- }
421
- return /* @__PURE__ */_jsxruntime.jsx.call(void 0, ButtonProvider, {
422
- value: context,
423
- children: /* @__PURE__ */_jsxruntime.jsx.call(void 0, _chunkIG4Q3WQOcjs.PressableFeedback, {
424
- ref,
425
- isPressed,
426
- isDisabled: isDisabled || isLoading,
427
- asChild,
428
- accessibilityRole,
429
- accessibilityState: {
430
- disabled: isDisabled,
431
- busy: isLoading,
432
- ...accessibilityState
433
- },
434
- ...rest,
435
- style: rootStyle,
436
- onPressIn: press.onPressIn,
437
- onPressOut: press.onPressOut,
438
- children: asChild ? children : /* @__PURE__ */_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, {
439
- children: [showSpinner ? /* @__PURE__ */_jsxruntime.jsx.call(void 0, ButtonSpinner, {}) : null, text !== null ? /* @__PURE__ */_jsxruntime.jsx.call(void 0, ButtonLabel, {
440
- children: text
441
- }) : children]
442
- })
443
- })
444
- });
445
- });
446
- ButtonRoot.displayName = "XAUI.Button.Root";
447
-
448
- // src/components/button/index.ts
449
- var Button2 = Object.assign(ButtonRoot, {
450
- Label: ButtonLabel,
451
- Icon: ButtonIcon,
452
- Spinner: ButtonSpinner
453
- });
454
- exports.useButton = useButton;
455
- exports.buttonRecipe = buttonRecipe;
456
- exports.Button = Button2;