@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.
- package/dist/{chunk-XYFMSRNJ.js → chunk-27ZRTZEE.js} +14 -10
- package/dist/{chunk-ICR42HHG.js → chunk-3FV4COTM.js} +3 -3
- package/dist/chunk-423RQBOX.js +21 -0
- package/dist/{chunk-TFNB2PNI.cjs → chunk-4XPLPQLM.cjs} +13 -11
- package/dist/{chunk-APONC4DB.cjs → chunk-5GO7MAVY.cjs} +12 -10
- package/dist/{chunk-AQNWXJYV.cjs → chunk-5RQ7AZPN.cjs} +20 -16
- package/dist/{chunk-FFEUGWVA.cjs → chunk-5Z4P6WHR.cjs} +11 -9
- package/dist/{chunk-L3Q5TVYE.js → chunk-6RVCGLKZ.js} +60 -58
- package/dist/chunk-7DPL3ZDS.cjs +21 -0
- package/dist/{chunk-Y4BPKSD3.js → chunk-7SEZGVTY.js} +1 -1
- package/dist/chunk-7XKQJQF2.cjs +70 -0
- package/dist/{chunk-7BOFQN2G.js → chunk-A5OCK3C2.js} +7 -5
- package/dist/{chunk-4HELPMAK.js → chunk-BFMTUMTU.js} +81 -101
- package/dist/chunk-BVJQ3UPZ.js +62 -0
- package/dist/{chunk-NG4GFBDR.js → chunk-DFME724B.js} +8 -6
- package/dist/chunk-E2CWBQTV.js +119 -0
- package/dist/chunk-E4TS6632.cjs +314 -0
- package/dist/{chunk-VUEDYW3M.js → chunk-FMZQW35T.js} +15 -11
- package/dist/{chunk-OYZYWWJ6.js → chunk-G7K652GC.js} +4 -2
- package/dist/{chunk-YGOXQSNU.js → chunk-GI24YJPE.js} +100 -206
- package/dist/chunk-GLGU2WFL.cjs +190 -0
- package/dist/{chunk-IG4Q3WQO.cjs → chunk-GPVNCJ3Z.cjs} +74 -95
- package/dist/{chunk-D4SOU26X.js → chunk-GVQOD3VW.js} +5 -3
- package/dist/chunk-KOC3KQIT.js +124 -0
- package/dist/chunk-KPWZLUES.cjs +124 -0
- package/dist/{chunk-SVRZJEDU.cjs → chunk-KWCHSIMI.cjs} +16 -12
- package/dist/{chunk-GCU5A5MM.cjs → chunk-N527BTY4.cjs} +17 -15
- package/dist/{chunk-F3H4TXAY.cjs → chunk-NBFWWQFW.cjs} +16 -12
- package/dist/{chunk-HOIQRGSK.js → chunk-NYRXUGVL.js} +6 -4
- package/dist/{chunk-V56334S3.js → chunk-Q3WFY5N3.js} +9 -7
- package/dist/{chunk-FXHRNUCS.cjs → chunk-QGN2BBJO.cjs} +8 -6
- package/dist/{chunk-J2JJLKLG.cjs → chunk-TGZZ3RZU.cjs} +7 -5
- package/dist/{chunk-YWBTIWT5.cjs → chunk-UBQLKIZC.cjs} +22 -18
- package/dist/{chunk-PMO62QK4.js → chunk-URSKA2VR.js} +1 -114
- package/dist/{chunk-A4RGJBP2.js → chunk-V4WDMM6Z.js} +5 -3
- package/dist/{chunk-FDSQOPJH.js → chunk-VJEER76X.js} +11 -7
- package/dist/{chunk-O5KDIEDH.cjs → chunk-VZBWYWEI.cjs} +25 -24
- package/dist/{chunk-B4W2XNBP.cjs → chunk-WR7YLDVV.cjs} +3 -3
- package/dist/{chunk-5RFRASSB.js → chunk-X4HQ4H2V.js} +16 -15
- package/dist/{chunk-IBEX4XGV.cjs → chunk-XFSW3ZNI.cjs} +13 -11
- package/dist/{chunk-VZGBEGDV.cjs → chunk-XQFAUDR2.cjs} +2 -2
- package/dist/{chunk-V3KS5PPK.js → chunk-YKL6XHM6.js} +14 -10
- package/dist/{chunk-HUZ4AUM2.cjs → chunk-ZP2E2H2G.cjs} +4 -188
- package/dist/{chunk-RZC4VFB5.cjs → chunk-ZSLNGBDS.cjs} +68 -66
- package/dist/components/alert/index.cjs +8 -6
- package/dist/components/alert/index.d.cts +2 -2
- package/dist/components/alert/index.d.ts +2 -2
- package/dist/components/alert/index.js +7 -5
- package/dist/components/button/index.cjs +9 -5
- package/dist/components/button/index.d.cts +9 -4
- package/dist/components/button/index.d.ts +9 -4
- package/dist/components/button/index.js +8 -4
- package/dist/components/card/index.cjs +6 -4
- package/dist/components/card/index.d.cts +1 -1
- package/dist/components/card/index.d.ts +1 -1
- package/dist/components/card/index.js +5 -3
- package/dist/components/checkbox/index.cjs +7 -5
- package/dist/components/checkbox/index.d.cts +1 -1
- package/dist/components/checkbox/index.d.ts +1 -1
- package/dist/components/checkbox/index.js +6 -4
- package/dist/components/chip/index.cjs +8 -6
- package/dist/components/chip/index.d.cts +2 -2
- package/dist/components/chip/index.d.ts +2 -2
- package/dist/components/chip/index.js +7 -5
- package/dist/components/input/index.cjs +4 -3
- package/dist/components/input/index.d.cts +1 -1
- package/dist/components/input/index.d.ts +1 -1
- package/dist/components/input/index.js +3 -2
- package/dist/components/input-group/index.cjs +6 -5
- package/dist/components/input-group/index.d.cts +1 -1
- package/dist/components/input-group/index.d.ts +1 -1
- package/dist/components/input-group/index.js +5 -4
- package/dist/components/input-otp/index.cjs +4 -3
- package/dist/components/input-otp/index.d.cts +2 -2
- package/dist/components/input-otp/index.d.ts +2 -2
- package/dist/components/input-otp/index.js +3 -2
- package/dist/components/radio/index.cjs +7 -5
- package/dist/components/radio/index.d.cts +1 -1
- package/dist/components/radio/index.d.ts +1 -1
- package/dist/components/radio/index.js +6 -4
- package/dist/components/spinner/index.cjs +16 -0
- package/dist/components/spinner/index.d.cts +104 -0
- package/dist/components/spinner/index.d.ts +104 -0
- package/dist/components/spinner/index.js +16 -0
- package/dist/components/switch/index.cjs +6 -4
- package/dist/components/switch/index.d.cts +1 -1
- package/dist/components/switch/index.d.ts +1 -1
- package/dist/components/switch/index.js +5 -3
- package/dist/components/text-area/index.cjs +5 -4
- package/dist/components/text-area/index.js +4 -3
- package/dist/components/typography/index.cjs +4 -3
- package/dist/components/typography/index.d.cts +1 -1
- package/dist/components/typography/index.d.ts +1 -1
- package/dist/components/typography/index.js +3 -2
- package/dist/components/view/index.cjs +4 -3
- package/dist/components/view/index.js +3 -2
- package/dist/{create-recipe-DUo8doTt.d.ts → create-recipe-BdVd2ffi.d.ts} +1 -1
- package/dist/{create-recipe-CWvI5ot3.d.cts → create-recipe-dC7wMfnj.d.cts} +1 -1
- package/dist/{icon.type-Dq4_qePa.d.ts → icon.type-Kml72iSz.d.ts} +1 -1
- package/dist/{icon.type-CF4KiMKl.d.cts → icon.type-d_i9ma-i.d.cts} +1 -1
- package/dist/index.cjs +39 -37
- package/dist/index.d.cts +24 -4
- package/dist/index.d.ts +24 -4
- package/dist/index.js +73 -71
- package/dist/system/index.cjs +11 -8
- package/dist/system/index.d.cts +4 -4
- package/dist/system/index.d.ts +4 -4
- package/dist/system/index.js +11 -8
- package/package.json +11 -1
- package/dist/chunk-E25JH7W2.cjs +0 -456
|
@@ -0,0 +1,314 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 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
|
+
var _chunk7XKQJQF2cjs = require('./chunk-7XKQJQF2.cjs');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
var _chunkGPVNCJ3Zcjs = require('./chunk-GPVNCJ3Z.cjs');
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
var _chunk7DPL3ZDScjs = require('./chunk-7DPL3ZDS.cjs');
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
var _chunkWR7YLDVVcjs = require('./chunk-WR7YLDVV.cjs');
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
var _chunkEJQCQPETcjs = require('./chunk-EJQCQPET.cjs');
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
var _chunkFNEUOBCVcjs = require('./chunk-FNEUOBCV.cjs');
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
var _chunk57SJ4LJFcjs = require('./chunk-57SJ4LJF.cjs');
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
var _chunkZP2E2H2Gcjs = require('./chunk-ZP2E2H2G.cjs');
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
var _chunkGLGU2WFLcjs = require('./chunk-GLGU2WFL.cjs');
|
|
30
|
+
|
|
31
|
+
// src/components/button/button.context.ts
|
|
32
|
+
var [ButtonProvider, useButton] = _chunkZP2E2H2Gcjs.createSlotContext.call(void 0, "Button");
|
|
33
|
+
|
|
34
|
+
// src/components/button/button-icon.tsx
|
|
35
|
+
var _jsxruntime = require('react/jsx-runtime');
|
|
36
|
+
function ButtonIcon({ size, color, ...rest }) {
|
|
37
|
+
const { icon } = useButton();
|
|
38
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkWR7YLDVVcjs.Icon, { size: _nullishCoalesce(size, () => ( icon.size)), color: _nullishCoalesce(color, () => ( icon.color)), ...rest });
|
|
39
|
+
}
|
|
40
|
+
ButtonIcon.displayName = "XAUI.Button.Icon";
|
|
41
|
+
|
|
42
|
+
// src/components/button/button-label.tsx
|
|
43
|
+
var _react = require('react');
|
|
44
|
+
var _reactnative = require('react-native');
|
|
45
|
+
|
|
46
|
+
var ButtonLabel = _react.forwardRef.call(void 0, function ButtonLabel2({ children, style, numberOfLines = 1, ...props }, ref) {
|
|
47
|
+
const { labelStyle } = useButton();
|
|
48
|
+
const [styleProps, rest] = _chunkGLGU2WFLcjs.useStyleProps.call(void 0, props);
|
|
49
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
50
|
+
_reactnative.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
|
+
|
|
64
|
+
var _reactnativereanimated = require('react-native-reanimated'); var _reactnativereanimated2 = _interopRequireDefault(_reactnativereanimated);
|
|
65
|
+
|
|
66
|
+
function ButtonSpinner({
|
|
67
|
+
style,
|
|
68
|
+
animation = true,
|
|
69
|
+
...props
|
|
70
|
+
}) {
|
|
71
|
+
const { spinnerStyle } = useButton();
|
|
72
|
+
const [styleProps] = _chunkGLGU2WFLcjs.useStyleProps.call(void 0, props);
|
|
73
|
+
const ringStyle = [spinnerStyle, styleProps, style];
|
|
74
|
+
if (!animation) return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reactnative.View, { style: ringStyle });
|
|
75
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, SpinningRing, { style: ringStyle });
|
|
76
|
+
}
|
|
77
|
+
ButtonSpinner.displayName = "XAUI.Button.Spinner";
|
|
78
|
+
function SpinningRing({ style }) {
|
|
79
|
+
const rotation = _chunk7XKQJQF2cjs.useRotation.call(void 0, );
|
|
80
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reactnativereanimated2.default.View, { style: [style, rotation] });
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// src/components/button/button.tsx
|
|
84
|
+
|
|
85
|
+
|
|
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 = _chunkFNEUOBCVcjs.createRecipe.call(void 0, {
|
|
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: _chunkFNEUOBCVcjs.radiusAxis.call(void 0, "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
|
+
|
|
212
|
+
function containsElementOfType(children, type) {
|
|
213
|
+
return _react.Children.toArray(children).some(
|
|
214
|
+
(child) => _react.isValidElement.call(void 0, child) && child.type === type
|
|
215
|
+
);
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
// src/components/button/button.tsx
|
|
219
|
+
|
|
220
|
+
var ButtonRoot = _react.forwardRef.call(void 0, 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 = _chunk57SJ4LJFcjs.useXAUITheme.call(void 0, );
|
|
238
|
+
const [styleProps, rest] = _chunkGLGU2WFLcjs.useStyleProps.call(void 0, props);
|
|
239
|
+
const [isPressed, press] = _chunk7DPL3ZDScjs.usePressState.call(void 0, { 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 = _react.useMemo.call(void 0, () => {
|
|
250
|
+
const icon = _reactnative.StyleSheet.flatten([styles.icon, _optionalChain([tint, 'optionalAccess', _ => _.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
|
+
_optionalChain([tint, 'optionalAccess', _2 => _2.root]),
|
|
267
|
+
styleProps,
|
|
268
|
+
typeof style === "function" ? style({ pressed: isPressed }) : style
|
|
269
|
+
];
|
|
270
|
+
const text = _chunkZP2E2H2Gcjs.childrenToString.call(void 0, children);
|
|
271
|
+
const showSpinner = isLoading && !containsElementOfType(children, ButtonSpinner);
|
|
272
|
+
if (isIconOnly && !rest.accessibilityLabel && !rest["aria-label"]) {
|
|
273
|
+
_chunkEJQCQPETcjs.warnDev.call(void 0,
|
|
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__ */ _jsxruntime.jsx.call(void 0, ButtonProvider, { value: context, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
278
|
+
_chunkGPVNCJ3Zcjs.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__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
295
|
+
showSpinner ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ButtonSpinner, {}) : null,
|
|
296
|
+
text !== null ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, 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
|
+
|
|
311
|
+
|
|
312
|
+
|
|
313
|
+
|
|
314
|
+
exports.useButton = useButton; exports.buttonRecipe = buttonRecipe; exports.Button = Button2;
|
|
@@ -1,30 +1,34 @@
|
|
|
1
1
|
import {
|
|
2
2
|
CloseButton,
|
|
3
3
|
closeButtonBase
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-V4WDMM6Z.js";
|
|
5
|
+
import {
|
|
6
|
+
PressableFeedback
|
|
7
|
+
} from "./chunk-BFMTUMTU.js";
|
|
5
8
|
import {
|
|
6
|
-
PressableFeedback,
|
|
7
9
|
usePressState
|
|
8
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-423RQBOX.js";
|
|
11
|
+
import {
|
|
12
|
+
Icon
|
|
13
|
+
} from "./chunk-3FV4COTM.js";
|
|
9
14
|
import {
|
|
10
15
|
warnDev
|
|
11
16
|
} from "./chunk-EGLLDKN6.js";
|
|
12
|
-
import {
|
|
13
|
-
Icon
|
|
14
|
-
} from "./chunk-ICR42HHG.js";
|
|
15
17
|
import {
|
|
16
18
|
createRecipe,
|
|
17
19
|
radiusAxis
|
|
18
20
|
} from "./chunk-4GTAZM2C.js";
|
|
21
|
+
import {
|
|
22
|
+
useXAUITheme
|
|
23
|
+
} from "./chunk-A3EGFI6T.js";
|
|
19
24
|
import {
|
|
20
25
|
Slot,
|
|
21
26
|
childrenToString,
|
|
22
|
-
createSlotContext
|
|
23
|
-
|
|
24
|
-
} from "./chunk-PMO62QK4.js";
|
|
27
|
+
createSlotContext
|
|
28
|
+
} from "./chunk-E2CWBQTV.js";
|
|
25
29
|
import {
|
|
26
|
-
|
|
27
|
-
} from "./chunk-
|
|
30
|
+
useStyleProps
|
|
31
|
+
} from "./chunk-URSKA2VR.js";
|
|
28
32
|
|
|
29
33
|
// src/components/chip/chip-avatar.tsx
|
|
30
34
|
import { forwardRef } from "react";
|