@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
|
@@ -1,28 +1,41 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import {
|
|
2
|
+
useRotation
|
|
3
|
+
} from "./chunk-BVJQ3UPZ.js";
|
|
4
|
+
import {
|
|
5
|
+
PressableFeedback
|
|
6
|
+
} from "./chunk-BFMTUMTU.js";
|
|
7
|
+
import {
|
|
8
|
+
usePressState
|
|
9
|
+
} from "./chunk-423RQBOX.js";
|
|
10
|
+
import {
|
|
11
|
+
Icon
|
|
12
|
+
} from "./chunk-3FV4COTM.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-E2CWBQTV.js";
|
|
27
|
+
import {
|
|
28
|
+
useStyleProps
|
|
29
|
+
} from "./chunk-URSKA2VR.js";
|
|
7
30
|
|
|
8
31
|
// src/components/button/button.context.ts
|
|
9
32
|
var [ButtonProvider, useButton] = createSlotContext("Button");
|
|
10
33
|
|
|
11
34
|
// src/components/button/button-icon.tsx
|
|
12
35
|
import { jsx } from "react/jsx-runtime";
|
|
13
|
-
function ButtonIcon({
|
|
14
|
-
|
|
15
|
-
color,
|
|
16
|
-
...rest
|
|
17
|
-
}) {
|
|
18
|
-
const {
|
|
19
|
-
icon
|
|
20
|
-
} = useButton();
|
|
21
|
-
return /* @__PURE__ */jsx(Icon, {
|
|
22
|
-
size: size ?? icon.size,
|
|
23
|
-
color: color ?? icon.color,
|
|
24
|
-
...rest
|
|
25
|
-
});
|
|
36
|
+
function ButtonIcon({ size, color, ...rest }) {
|
|
37
|
+
const { icon } = useButton();
|
|
38
|
+
return /* @__PURE__ */ jsx(Icon, { size: size ?? icon.size, color: color ?? icon.color, ...rest });
|
|
26
39
|
}
|
|
27
40
|
ButtonIcon.displayName = "XAUI.Button.Icon";
|
|
28
41
|
|
|
@@ -30,93 +43,41 @@ ButtonIcon.displayName = "XAUI.Button.Icon";
|
|
|
30
43
|
import { forwardRef } from "react";
|
|
31
44
|
import { Text } from "react-native";
|
|
32
45
|
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
33
|
-
var ButtonLabel = forwardRef(function ButtonLabel2({
|
|
34
|
-
|
|
35
|
-
style,
|
|
36
|
-
numberOfLines = 1,
|
|
37
|
-
...props
|
|
38
|
-
}, ref) {
|
|
39
|
-
const {
|
|
40
|
-
labelStyle
|
|
41
|
-
} = useButton();
|
|
46
|
+
var ButtonLabel = forwardRef(function ButtonLabel2({ children, style, numberOfLines = 1, ...props }, ref) {
|
|
47
|
+
const { labelStyle } = useButton();
|
|
42
48
|
const [styleProps, rest] = useStyleProps(props);
|
|
43
|
-
return /* @__PURE__ */jsx2(
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
49
|
+
return /* @__PURE__ */ jsx2(
|
|
50
|
+
Text,
|
|
51
|
+
{
|
|
52
|
+
ref,
|
|
53
|
+
numberOfLines,
|
|
54
|
+
style: [labelStyle, styleProps, style],
|
|
55
|
+
...rest,
|
|
56
|
+
children
|
|
57
|
+
}
|
|
58
|
+
);
|
|
50
59
|
});
|
|
51
60
|
ButtonLabel.displayName = "XAUI.Button.Label";
|
|
52
61
|
|
|
53
62
|
// src/components/button/button-spinner.tsx
|
|
54
|
-
import { useEffect } from "react";
|
|
55
63
|
import { View } from "react-native";
|
|
56
|
-
import Animated
|
|
64
|
+
import Animated from "react-native-reanimated";
|
|
57
65
|
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
58
|
-
var ROTATION_DURATION = 800;
|
|
59
66
|
function ButtonSpinner({
|
|
60
67
|
style,
|
|
61
68
|
animation = true,
|
|
62
69
|
...props
|
|
63
70
|
}) {
|
|
64
|
-
const {
|
|
65
|
-
spinnerStyle
|
|
66
|
-
} = useButton();
|
|
71
|
+
const { spinnerStyle } = useButton();
|
|
67
72
|
const [styleProps] = useStyleProps(props);
|
|
68
73
|
const ringStyle = [spinnerStyle, styleProps, style];
|
|
69
|
-
if (!animation) return /* @__PURE__ */jsx3(View, {
|
|
70
|
-
|
|
71
|
-
});
|
|
72
|
-
return /* @__PURE__ */jsx3(SpinningRing, {
|
|
73
|
-
style: ringStyle
|
|
74
|
-
});
|
|
74
|
+
if (!animation) return /* @__PURE__ */ jsx3(View, { style: ringStyle });
|
|
75
|
+
return /* @__PURE__ */ jsx3(SpinningRing, { style: ringStyle });
|
|
75
76
|
}
|
|
76
77
|
ButtonSpinner.displayName = "XAUI.Button.Spinner";
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
sourceMap: "{\"version\":3,\"names\":[\"chunkYGOXQSNUJs1\",\"angle\",\"__closure\",\"transform\",\"rotate\",\"value\"],\"sources\":[\"/home/runner/work/xaui/xaui/packages/native/dist/chunk-YGOXQSNU.js\"],\"mappings\":\"AAqFyC,SAAAA,gBAAMA,CAAA,QAAAC,KAAA,OAAAC,SAAA,CAE3C,MAAO,CAAEC,SAAS,CAAE,CAAC,CAAEC,MAAM,CAAKH,KAAK,CAACI,KAAK,MAAM,CAAC,CAAE,CAAC,CACzD\",\"ignoreList\":[]}"
|
|
81
|
-
};
|
|
82
|
-
function SpinningRing({
|
|
83
|
-
style
|
|
84
|
-
}) {
|
|
85
|
-
const angle = useSharedValue(0);
|
|
86
|
-
useEffect(() => {
|
|
87
|
-
angle.value = withRepeat(withTiming(360, {
|
|
88
|
-
duration: ROTATION_DURATION,
|
|
89
|
-
easing: Easing.linear
|
|
90
|
-
}), -1, false);
|
|
91
|
-
return () => cancelAnimation(angle);
|
|
92
|
-
}, [angle]);
|
|
93
|
-
const animatedStyle = useAnimatedStyle(function chunkYGOXQSNUJs1Factory({
|
|
94
|
-
_worklet_7673867799543_init_data,
|
|
95
|
-
angle
|
|
96
|
-
}) {
|
|
97
|
-
const _e = [new global.Error(), -2, -27];
|
|
98
|
-
const chunkYGOXQSNUJs1 = function () {
|
|
99
|
-
return {
|
|
100
|
-
transform: [{
|
|
101
|
-
rotate: `${angle.value}deg`
|
|
102
|
-
}]
|
|
103
|
-
};
|
|
104
|
-
};
|
|
105
|
-
chunkYGOXQSNUJs1.__closure = {
|
|
106
|
-
angle
|
|
107
|
-
};
|
|
108
|
-
chunkYGOXQSNUJs1.__workletHash = 7673867799543;
|
|
109
|
-
chunkYGOXQSNUJs1.__pluginVersion = "0.7.4";
|
|
110
|
-
chunkYGOXQSNUJs1.__initData = _worklet_7673867799543_init_data;
|
|
111
|
-
chunkYGOXQSNUJs1.__stackDetails = _e;
|
|
112
|
-
return chunkYGOXQSNUJs1;
|
|
113
|
-
}({
|
|
114
|
-
_worklet_7673867799543_init_data,
|
|
115
|
-
angle
|
|
116
|
-
}), [angle]);
|
|
117
|
-
return /* @__PURE__ */jsx3(Animated.View, {
|
|
118
|
-
style: [style, animatedStyle]
|
|
119
|
-
});
|
|
78
|
+
function SpinningRing({ style }) {
|
|
79
|
+
const rotation = useRotation();
|
|
80
|
+
return /* @__PURE__ */ jsx3(Animated.View, { style: [style, rotation] });
|
|
120
81
|
}
|
|
121
82
|
|
|
122
83
|
// src/components/button/button.tsx
|
|
@@ -126,11 +87,7 @@ import { StyleSheet } from "react-native";
|
|
|
126
87
|
// src/components/button/button.recipe.ts
|
|
127
88
|
var SLOTS = ["root", "label", "icon", "spinner"];
|
|
128
89
|
var VARIANT_TOKENS = {
|
|
129
|
-
primary: {
|
|
130
|
-
bg: "accent",
|
|
131
|
-
bgPressed: "accentPressed",
|
|
132
|
-
fg: "accentForeground"
|
|
133
|
-
},
|
|
90
|
+
primary: { bg: "accent", bgPressed: "accentPressed", fg: "accentForeground" },
|
|
134
91
|
// The accent's soft slice, not a second neutral: `secondary` is to `primary` what
|
|
135
92
|
// `danger-soft` is to `danger`, and it reads as the same family at lower emphasis.
|
|
136
93
|
secondary: {
|
|
@@ -138,25 +95,14 @@ var VARIANT_TOKENS = {
|
|
|
138
95
|
bgPressed: "accentSoftPressed",
|
|
139
96
|
fg: "accentSoftForeground"
|
|
140
97
|
},
|
|
141
|
-
default: {
|
|
142
|
-
bg: "default",
|
|
143
|
-
bgPressed: "defaultPressed",
|
|
144
|
-
fg: "defaultForeground"
|
|
145
|
-
},
|
|
98
|
+
default: { bg: "default", bgPressed: "defaultPressed", fg: "defaultForeground" },
|
|
146
99
|
tertiary: {
|
|
147
100
|
border: "border",
|
|
148
101
|
bgPressed: "defaultSoftPressed",
|
|
149
102
|
fg: "foreground"
|
|
150
103
|
},
|
|
151
|
-
ghost: {
|
|
152
|
-
|
|
153
|
-
fg: "foreground"
|
|
154
|
-
},
|
|
155
|
-
danger: {
|
|
156
|
-
bg: "danger",
|
|
157
|
-
bgPressed: "dangerPressed",
|
|
158
|
-
fg: "dangerForeground"
|
|
159
|
-
},
|
|
104
|
+
ghost: { bgPressed: "defaultSoftPressed", fg: "foreground" },
|
|
105
|
+
danger: { bg: "danger", bgPressed: "dangerPressed", fg: "dangerForeground" },
|
|
160
106
|
"danger-soft": {
|
|
161
107
|
bg: "dangerSoft",
|
|
162
108
|
bgPressed: "dangerSoftPressed",
|
|
@@ -173,14 +119,8 @@ function ring(theme, size) {
|
|
|
173
119
|
};
|
|
174
120
|
}
|
|
175
121
|
function sizeAxis(step) {
|
|
176
|
-
const {
|
|
177
|
-
|
|
178
|
-
padding,
|
|
179
|
-
gap,
|
|
180
|
-
glyph,
|
|
181
|
-
radius
|
|
182
|
-
} = step;
|
|
183
|
-
return theme => ({
|
|
122
|
+
const { size, padding, gap, glyph, radius } = step;
|
|
123
|
+
return (theme) => ({
|
|
184
124
|
root: {
|
|
185
125
|
height: theme.controlHeights[size],
|
|
186
126
|
paddingHorizontal: theme.spacing(padding),
|
|
@@ -191,15 +131,13 @@ function sizeAxis(step) {
|
|
|
191
131
|
fontSize: theme.fontSizes[size],
|
|
192
132
|
lineHeight: theme.lineHeights[size]
|
|
193
133
|
},
|
|
194
|
-
icon: {
|
|
195
|
-
fontSize: theme.fontSizes[glyph]
|
|
196
|
-
},
|
|
134
|
+
icon: { fontSize: theme.fontSizes[glyph] },
|
|
197
135
|
spinner: ring(theme, theme.fontSizes[glyph])
|
|
198
136
|
});
|
|
199
137
|
}
|
|
200
138
|
var buttonRecipe = createRecipe({
|
|
201
139
|
slots: SLOTS,
|
|
202
|
-
base: theme => ({
|
|
140
|
+
base: (theme) => ({
|
|
203
141
|
root: {
|
|
204
142
|
flexDirection: "row",
|
|
205
143
|
alignItems: "center",
|
|
@@ -226,15 +164,9 @@ var buttonRecipe = createRecipe({
|
|
|
226
164
|
borderColor: colors.border,
|
|
227
165
|
borderWidth: colors.border ? theme.borderWidth.default : 0
|
|
228
166
|
},
|
|
229
|
-
label: {
|
|
230
|
-
|
|
231
|
-
}
|
|
232
|
-
icon: {
|
|
233
|
-
color: colors.fg
|
|
234
|
-
},
|
|
235
|
-
spinner: {
|
|
236
|
-
borderColor: colors.fg
|
|
237
|
-
}
|
|
167
|
+
label: { color: colors.fg },
|
|
168
|
+
icon: { color: colors.fg },
|
|
169
|
+
spinner: { borderColor: colors.fg }
|
|
238
170
|
}),
|
|
239
171
|
/**
|
|
240
172
|
* Declaration order is application order: `radius` overrides the radius `size` set, and
|
|
@@ -244,13 +176,7 @@ var buttonRecipe = createRecipe({
|
|
|
244
176
|
*/
|
|
245
177
|
variants: {
|
|
246
178
|
size: {
|
|
247
|
-
xs: sizeAxis({
|
|
248
|
-
size: "xs",
|
|
249
|
-
padding: 3,
|
|
250
|
-
gap: 1,
|
|
251
|
-
glyph: "sm",
|
|
252
|
-
radius: "3xl"
|
|
253
|
-
}),
|
|
179
|
+
xs: sizeAxis({ size: "xs", padding: 3, gap: 1, glyph: "sm", radius: "3xl" }),
|
|
254
180
|
sm: sizeAxis({
|
|
255
181
|
size: "sm",
|
|
256
182
|
padding: 3.5,
|
|
@@ -258,30 +184,13 @@ var buttonRecipe = createRecipe({
|
|
|
258
184
|
glyph: "md",
|
|
259
185
|
radius: "3xl"
|
|
260
186
|
}),
|
|
261
|
-
md: sizeAxis({
|
|
262
|
-
|
|
263
|
-
padding: 4,
|
|
264
|
-
gap: 2,
|
|
265
|
-
glyph: "lg",
|
|
266
|
-
radius: "3xl"
|
|
267
|
-
}),
|
|
268
|
-
lg: sizeAxis({
|
|
269
|
-
size: "lg",
|
|
270
|
-
padding: 5,
|
|
271
|
-
gap: 2.5,
|
|
272
|
-
glyph: "xl",
|
|
273
|
-
radius: "4xl"
|
|
274
|
-
})
|
|
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" })
|
|
275
189
|
},
|
|
276
190
|
radius: radiusAxis("root"),
|
|
277
191
|
// A square on a fixed height. No width is computed, and none needs to be.
|
|
278
192
|
isIconOnly: {
|
|
279
|
-
true: () => ({
|
|
280
|
-
root: {
|
|
281
|
-
paddingHorizontal: 0,
|
|
282
|
-
aspectRatio: 1
|
|
283
|
-
}
|
|
284
|
-
})
|
|
193
|
+
true: () => ({ root: { paddingHorizontal: 0, aspectRatio: 1 } })
|
|
285
194
|
}
|
|
286
195
|
},
|
|
287
196
|
/**
|
|
@@ -292,27 +201,18 @@ var buttonRecipe = createRecipe({
|
|
|
292
201
|
* presses through the same OKLab formula as a token one.
|
|
293
202
|
*/
|
|
294
203
|
states: {
|
|
295
|
-
pressed: (_theme, colors) => ({
|
|
296
|
-
|
|
297
|
-
backgroundColor: colors.bgPressed
|
|
298
|
-
}
|
|
299
|
-
}),
|
|
300
|
-
disabled: theme => ({
|
|
301
|
-
root: {
|
|
302
|
-
opacity: theme.opacity.disabled
|
|
303
|
-
}
|
|
304
|
-
})
|
|
204
|
+
pressed: (_theme, colors) => ({ root: { backgroundColor: colors.bgPressed } }),
|
|
205
|
+
disabled: (theme) => ({ root: { opacity: theme.opacity.disabled } })
|
|
305
206
|
},
|
|
306
|
-
defaultVariants: {
|
|
307
|
-
variant: "primary",
|
|
308
|
-
size: "md"
|
|
309
|
-
}
|
|
207
|
+
defaultVariants: { variant: "primary", size: "md" }
|
|
310
208
|
});
|
|
311
209
|
|
|
312
210
|
// src/components/button/button.utils.ts
|
|
313
211
|
import { Children, isValidElement } from "react";
|
|
314
212
|
function containsElementOfType(children, type) {
|
|
315
|
-
return Children.toArray(children).some(
|
|
213
|
+
return Children.toArray(children).some(
|
|
214
|
+
(child) => isValidElement(child) && child.type === type
|
|
215
|
+
);
|
|
316
216
|
}
|
|
317
217
|
|
|
318
218
|
// src/components/button/button.tsx
|
|
@@ -336,31 +236,16 @@ var ButtonRoot = forwardRef2(function Button({
|
|
|
336
236
|
}, ref) {
|
|
337
237
|
const theme = useXAUITheme();
|
|
338
238
|
const [styleProps, rest] = useStyleProps(props);
|
|
339
|
-
const [isPressed, press] = usePressState({
|
|
340
|
-
onPressIn,
|
|
341
|
-
onPressOut
|
|
342
|
-
});
|
|
239
|
+
const [isPressed, press] = usePressState({ onPressIn, onPressOut });
|
|
343
240
|
const selection = {
|
|
344
241
|
variant,
|
|
345
242
|
size,
|
|
346
243
|
radius,
|
|
347
244
|
isIconOnly: isIconOnly ? "true" : void 0
|
|
348
245
|
};
|
|
349
|
-
const states = {
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
};
|
|
353
|
-
const styles = buttonRecipe.resolve({
|
|
354
|
-
theme,
|
|
355
|
-
selection,
|
|
356
|
-
states
|
|
357
|
-
});
|
|
358
|
-
const tint = color ? buttonRecipe.tint({
|
|
359
|
-
theme,
|
|
360
|
-
color,
|
|
361
|
-
selection,
|
|
362
|
-
states
|
|
363
|
-
}) : void 0;
|
|
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;
|
|
364
249
|
const context = useMemo(() => {
|
|
365
250
|
const icon = StyleSheet.flatten([styles.icon, tint?.icon]);
|
|
366
251
|
return {
|
|
@@ -376,17 +261,22 @@ var ButtonRoot = forwardRef2(function Button({
|
|
|
376
261
|
isLoading
|
|
377
262
|
};
|
|
378
263
|
}, [styles, tint, isDisabled, isLoading]);
|
|
379
|
-
const rootStyle = [
|
|
380
|
-
|
|
381
|
-
|
|
264
|
+
const rootStyle = [
|
|
265
|
+
styles.root,
|
|
266
|
+
tint?.root,
|
|
267
|
+
styleProps,
|
|
268
|
+
typeof style === "function" ? style({ pressed: isPressed }) : style
|
|
269
|
+
];
|
|
382
270
|
const text = childrenToString(children);
|
|
383
271
|
const showSpinner = isLoading && !containsElementOfType(children, ButtonSpinner);
|
|
384
272
|
if (isIconOnly && !rest.accessibilityLabel && !rest["aria-label"]) {
|
|
385
|
-
warnDev(
|
|
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
|
+
);
|
|
386
276
|
}
|
|
387
|
-
return /* @__PURE__ */jsx4(ButtonProvider, {
|
|
388
|
-
|
|
389
|
-
|
|
277
|
+
return /* @__PURE__ */ jsx4(ButtonProvider, { value: context, children: /* @__PURE__ */ jsx4(
|
|
278
|
+
PressableFeedback,
|
|
279
|
+
{
|
|
390
280
|
ref,
|
|
391
281
|
isPressed,
|
|
392
282
|
isDisabled: isDisabled || isLoading,
|
|
@@ -401,13 +291,12 @@ var ButtonRoot = forwardRef2(function Button({
|
|
|
401
291
|
style: rootStyle,
|
|
402
292
|
onPressIn: press.onPressIn,
|
|
403
293
|
onPressOut: press.onPressOut,
|
|
404
|
-
children: asChild ? children : /* @__PURE__ */jsxs(Fragment, {
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
});
|
|
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
|
+
) });
|
|
411
300
|
});
|
|
412
301
|
ButtonRoot.displayName = "XAUI.Button.Root";
|
|
413
302
|
|
|
@@ -417,4 +306,9 @@ var Button2 = Object.assign(ButtonRoot, {
|
|
|
417
306
|
Icon: ButtonIcon,
|
|
418
307
|
Spinner: ButtonSpinner
|
|
419
308
|
});
|
|
420
|
-
|
|
309
|
+
|
|
310
|
+
export {
|
|
311
|
+
useButton,
|
|
312
|
+
buttonRecipe,
|
|
313
|
+
Button2 as Button
|
|
314
|
+
};
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
var _chunkMC7SY2QHcjs = require('./chunk-MC7SY2QH.cjs');
|
|
4
|
+
|
|
5
|
+
// src/system/slot/merge-refs.ts
|
|
6
|
+
function mergeRefs(...refs) {
|
|
7
|
+
return (value) => {
|
|
8
|
+
for (const ref of refs) {
|
|
9
|
+
if (typeof ref === "function") ref(value);
|
|
10
|
+
else if (ref) ref.current = value;
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
// src/system/style-props/use-style-props.ts
|
|
16
|
+
var _react = require('react');
|
|
17
|
+
|
|
18
|
+
// src/utils/style-props.ts
|
|
19
|
+
var STYLE_PROP_KEYS = [
|
|
20
|
+
// Flex and layout
|
|
21
|
+
"alignContent",
|
|
22
|
+
"alignItems",
|
|
23
|
+
"alignSelf",
|
|
24
|
+
"aspectRatio",
|
|
25
|
+
"boxSizing",
|
|
26
|
+
"columnGap",
|
|
27
|
+
"direction",
|
|
28
|
+
"display",
|
|
29
|
+
"flex",
|
|
30
|
+
"flexBasis",
|
|
31
|
+
"flexDirection",
|
|
32
|
+
"flexGrow",
|
|
33
|
+
"flexShrink",
|
|
34
|
+
"flexWrap",
|
|
35
|
+
"gap",
|
|
36
|
+
"justifyContent",
|
|
37
|
+
"overflow",
|
|
38
|
+
"rowGap",
|
|
39
|
+
// Position
|
|
40
|
+
"bottom",
|
|
41
|
+
"end",
|
|
42
|
+
"inset",
|
|
43
|
+
"insetBlock",
|
|
44
|
+
"insetBlockEnd",
|
|
45
|
+
"insetBlockStart",
|
|
46
|
+
"insetInline",
|
|
47
|
+
"insetInlineEnd",
|
|
48
|
+
"insetInlineStart",
|
|
49
|
+
"position",
|
|
50
|
+
"start",
|
|
51
|
+
"top",
|
|
52
|
+
"zIndex",
|
|
53
|
+
// Margin
|
|
54
|
+
"margin",
|
|
55
|
+
"marginBlock",
|
|
56
|
+
"marginBlockEnd",
|
|
57
|
+
"marginBlockStart",
|
|
58
|
+
"marginBottom",
|
|
59
|
+
"marginEnd",
|
|
60
|
+
"marginHorizontal",
|
|
61
|
+
"marginInline",
|
|
62
|
+
"marginInlineEnd",
|
|
63
|
+
"marginInlineStart",
|
|
64
|
+
"marginStart",
|
|
65
|
+
"marginTop",
|
|
66
|
+
"marginVertical",
|
|
67
|
+
// Padding
|
|
68
|
+
"padding",
|
|
69
|
+
"paddingBlock",
|
|
70
|
+
"paddingBlockEnd",
|
|
71
|
+
"paddingBlockStart",
|
|
72
|
+
"paddingBottom",
|
|
73
|
+
"paddingEnd",
|
|
74
|
+
"paddingHorizontal",
|
|
75
|
+
"paddingInline",
|
|
76
|
+
"paddingInlineEnd",
|
|
77
|
+
"paddingInlineStart",
|
|
78
|
+
"paddingStart",
|
|
79
|
+
"paddingTop",
|
|
80
|
+
"paddingVertical",
|
|
81
|
+
// Size
|
|
82
|
+
"height",
|
|
83
|
+
"maxHeight",
|
|
84
|
+
"maxWidth",
|
|
85
|
+
"minHeight",
|
|
86
|
+
"minWidth",
|
|
87
|
+
"width",
|
|
88
|
+
// Border
|
|
89
|
+
"borderBlockColor",
|
|
90
|
+
"borderBlockEndColor",
|
|
91
|
+
"borderBlockStartColor",
|
|
92
|
+
"borderBottomColor",
|
|
93
|
+
"borderBottomEndRadius",
|
|
94
|
+
"borderBottomStartRadius",
|
|
95
|
+
"borderBottomWidth",
|
|
96
|
+
"borderColor",
|
|
97
|
+
"borderCurve",
|
|
98
|
+
"borderEndColor",
|
|
99
|
+
"borderEndEndRadius",
|
|
100
|
+
"borderEndStartRadius",
|
|
101
|
+
"borderEndWidth",
|
|
102
|
+
"borderRadius",
|
|
103
|
+
"borderStartColor",
|
|
104
|
+
"borderStartEndRadius",
|
|
105
|
+
"borderStartStartRadius",
|
|
106
|
+
"borderStartWidth",
|
|
107
|
+
"borderStyle",
|
|
108
|
+
"borderTopColor",
|
|
109
|
+
"borderTopEndRadius",
|
|
110
|
+
"borderTopStartRadius",
|
|
111
|
+
"borderTopWidth",
|
|
112
|
+
"borderWidth",
|
|
113
|
+
// Fill, shadow, and the rest of a box's paint
|
|
114
|
+
"backfaceVisibility",
|
|
115
|
+
"backgroundColor",
|
|
116
|
+
"boxShadow",
|
|
117
|
+
"cursor",
|
|
118
|
+
"elevation",
|
|
119
|
+
"experimental_backgroundImage",
|
|
120
|
+
"filter",
|
|
121
|
+
"isolation",
|
|
122
|
+
"mixBlendMode",
|
|
123
|
+
"opacity",
|
|
124
|
+
"outlineColor",
|
|
125
|
+
"outlineOffset",
|
|
126
|
+
"outlineStyle",
|
|
127
|
+
"outlineWidth",
|
|
128
|
+
"shadowColor",
|
|
129
|
+
"shadowOffset",
|
|
130
|
+
"shadowOpacity",
|
|
131
|
+
"shadowRadius",
|
|
132
|
+
// Transform
|
|
133
|
+
"rotation",
|
|
134
|
+
"scaleX",
|
|
135
|
+
"scaleY",
|
|
136
|
+
"transform",
|
|
137
|
+
"transformMatrix",
|
|
138
|
+
"transformOrigin",
|
|
139
|
+
"translateX",
|
|
140
|
+
"translateY",
|
|
141
|
+
// Text — a text slot only
|
|
142
|
+
"color",
|
|
143
|
+
"fontFamily",
|
|
144
|
+
"fontSize",
|
|
145
|
+
"fontStyle",
|
|
146
|
+
"fontVariant",
|
|
147
|
+
"fontWeight",
|
|
148
|
+
"includeFontPadding",
|
|
149
|
+
"letterSpacing",
|
|
150
|
+
"lineHeight",
|
|
151
|
+
"textAlign",
|
|
152
|
+
"textAlignVertical",
|
|
153
|
+
"textDecorationColor",
|
|
154
|
+
"textDecorationLine",
|
|
155
|
+
"textDecorationStyle",
|
|
156
|
+
"textShadowColor",
|
|
157
|
+
"textShadowOffset",
|
|
158
|
+
"textShadowRadius",
|
|
159
|
+
"textTransform",
|
|
160
|
+
"userSelect",
|
|
161
|
+
"verticalAlign",
|
|
162
|
+
"writingDirection",
|
|
163
|
+
// Image — an image slot only
|
|
164
|
+
"objectFit",
|
|
165
|
+
"overlayColor",
|
|
166
|
+
"resizeMode",
|
|
167
|
+
"tintColor"
|
|
168
|
+
];
|
|
169
|
+
var STYLE_PROP_KEY_SET = new Set(STYLE_PROP_KEYS);
|
|
170
|
+
function splitStyleProps(props) {
|
|
171
|
+
const styleProps = {};
|
|
172
|
+
const rest = {};
|
|
173
|
+
for (const [key, value] of Object.entries(props)) {
|
|
174
|
+
if (STYLE_PROP_KEY_SET.has(key)) styleProps[key] = value;
|
|
175
|
+
else rest[key] = value;
|
|
176
|
+
}
|
|
177
|
+
return [styleProps, rest];
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
// src/system/style-props/use-style-props.ts
|
|
181
|
+
function useStyleProps(props) {
|
|
182
|
+
const [styleProps, rest] = splitStyleProps(props);
|
|
183
|
+
const key = _chunkMC7SY2QHcjs.stableHash.call(void 0, styleProps);
|
|
184
|
+
return [_react.useMemo.call(void 0, () => styleProps, [key]), rest];
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
exports.mergeRefs = mergeRefs; exports.useStyleProps = useStyleProps;
|