@xaui/native 0.9.1-alpha.11 → 0.9.1-alpha.13
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-7XGOXTGT.js → chunk-4O3PXFQ7.js} +15 -31
- package/dist/{chunk-3QBT3Q65.cjs → chunk-6N5JXRUZ.cjs} +26 -3
- package/dist/chunk-B3EAZ2CC.js +1010 -0
- package/dist/{chunk-2FEDC7U5.cjs → chunk-DDYMIWLW.cjs} +41 -57
- package/dist/chunk-IVVFYUDW.cjs +1044 -0
- package/dist/{chunk-6OHFG32Y.cjs → chunk-MLJ543GP.cjs} +41 -53
- package/dist/{chunk-NQ5WWF77.js → chunk-RWLODK55.js} +35 -47
- package/dist/{chunk-X2K2FX3W.js → chunk-XJARE6SC.js} +24 -1
- package/dist/components/button/index.cjs +4 -4
- package/dist/components/button/index.d.cts +162 -13
- package/dist/components/button/index.d.ts +162 -13
- package/dist/components/button/index.js +3 -3
- package/dist/{create-recipe-Dn9kj5Rs.d.ts → create-recipe-3OPwcC6P.d.ts} +81 -21
- package/dist/{create-recipe-BjSP0zL_.d.cts → create-recipe-oiLAlJ4u.d.cts} +81 -21
- package/dist/index.cjs +28 -8
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +32 -12
- package/dist/system/index.cjs +24 -4
- package/dist/system/index.d.cts +160 -35
- package/dist/system/index.d.ts +160 -35
- package/dist/system/index.js +31 -11
- package/dist/theme/index.cjs +3 -3
- package/dist/theme/index.d.cts +19 -8
- package/dist/theme/index.d.ts +19 -8
- package/dist/theme/index.js +2 -2
- package/package.json +1 -1
- package/dist/chunk-E2UGZJBT.cjs +0 -959
- package/dist/chunk-R4HJCQPI.js +0 -889
- /package/dist/{chunk-LMUPNKPH.cjs → chunk-2FOEFUPM.cjs} +0 -0
- /package/dist/{chunk-3TIDEII6.js → chunk-TO6DAGFB.js} +0 -0
|
@@ -36,11 +36,11 @@ function _optionalChain(ops) {
|
|
|
36
36
|
}
|
|
37
37
|
return value;
|
|
38
38
|
}
|
|
39
|
-
var
|
|
40
|
-
var
|
|
39
|
+
var _chunkIVVFYUDWcjs = require('./chunk-IVVFYUDW.cjs');
|
|
40
|
+
var _chunk6N5JXRUZcjs = require('./chunk-6N5JXRUZ.cjs');
|
|
41
41
|
|
|
42
42
|
// src/components/button/button.context.ts
|
|
43
|
-
var [ButtonProvider, useButton] =
|
|
43
|
+
var [ButtonProvider, useButton] = _chunkIVVFYUDWcjs.createSlotContext.call(void 0, "Button");
|
|
44
44
|
|
|
45
45
|
// src/components/button/button-icon.tsx
|
|
46
46
|
var _jsxruntime = require('react/jsx-runtime');
|
|
@@ -52,7 +52,7 @@ function ButtonIcon({
|
|
|
52
52
|
const {
|
|
53
53
|
icon
|
|
54
54
|
} = useButton();
|
|
55
|
-
return /* @__PURE__ */_jsxruntime.jsx.call(void 0,
|
|
55
|
+
return /* @__PURE__ */_jsxruntime.jsx.call(void 0, _chunkIVVFYUDWcjs.Icon, {
|
|
56
56
|
size: _nullishCoalesce(size, () => icon.size),
|
|
57
57
|
color: _nullishCoalesce(color, () => icon.color),
|
|
58
58
|
...rest
|
|
@@ -67,15 +67,16 @@ var ButtonLabel = _react.forwardRef.call(void 0, function ButtonLabel2({
|
|
|
67
67
|
children,
|
|
68
68
|
style,
|
|
69
69
|
numberOfLines = 1,
|
|
70
|
-
...
|
|
70
|
+
...props
|
|
71
71
|
}, ref) {
|
|
72
72
|
const {
|
|
73
73
|
labelStyle
|
|
74
74
|
} = useButton();
|
|
75
|
+
const [styleProps, rest] = _chunkIVVFYUDWcjs.useStyleProps.call(void 0, props);
|
|
75
76
|
return /* @__PURE__ */_jsxruntime.jsx.call(void 0, _reactnative.Text, {
|
|
76
77
|
ref,
|
|
77
78
|
numberOfLines,
|
|
78
|
-
style: [labelStyle, style],
|
|
79
|
+
style: [labelStyle, styleProps, style],
|
|
79
80
|
...rest,
|
|
80
81
|
children
|
|
81
82
|
});
|
|
@@ -89,23 +90,26 @@ var _reactnativereanimated2 = _interopRequireDefault(_reactnativereanimated);
|
|
|
89
90
|
var ROTATION_DURATION = 800;
|
|
90
91
|
function ButtonSpinner({
|
|
91
92
|
style,
|
|
92
|
-
animation = true
|
|
93
|
+
animation = true,
|
|
94
|
+
...props
|
|
93
95
|
}) {
|
|
94
96
|
const {
|
|
95
97
|
spinnerStyle
|
|
96
98
|
} = useButton();
|
|
99
|
+
const [styleProps] = _chunkIVVFYUDWcjs.useStyleProps.call(void 0, props);
|
|
100
|
+
const ringStyle = [spinnerStyle, styleProps, style];
|
|
97
101
|
if (!animation) return /* @__PURE__ */_jsxruntime.jsx.call(void 0, _reactnative.View, {
|
|
98
|
-
style:
|
|
102
|
+
style: ringStyle
|
|
99
103
|
});
|
|
100
104
|
return /* @__PURE__ */_jsxruntime.jsx.call(void 0, SpinningRing, {
|
|
101
|
-
style:
|
|
105
|
+
style: ringStyle
|
|
102
106
|
});
|
|
103
107
|
}
|
|
104
108
|
ButtonSpinner.displayName = "XAUI.Button.Spinner";
|
|
105
|
-
const
|
|
106
|
-
code: "function
|
|
107
|
-
location: "/home/runner/work/xaui/xaui/packages/native/dist/chunk-
|
|
108
|
-
sourceMap: "{\"version\":3,\"names\":[\"
|
|
109
|
+
const _worklet_13959851668106_init_data = {
|
|
110
|
+
code: "function chunkMLJ543GPCjs1(){const{angle}=this.__closure;return{transform:[{rotate:angle.value+\"deg\"}]};}",
|
|
111
|
+
location: "/home/runner/work/xaui/xaui/packages/native/dist/chunk-MLJ543GP.cjs",
|
|
112
|
+
sourceMap: "{\"version\":3,\"names\":[\"chunkMLJ543GPCjs1\",\"angle\",\"__closure\",\"transform\",\"rotate\",\"value\"],\"sources\":[\"/home/runner/work/xaui/xaui/packages/native/dist/chunk-MLJ543GP.cjs\"],\"mappings\":\"AA0E6E,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\":[]}"
|
|
109
113
|
};
|
|
110
114
|
function SpinningRing({
|
|
111
115
|
style
|
|
@@ -118,28 +122,28 @@ function SpinningRing({
|
|
|
118
122
|
}), -1, false);
|
|
119
123
|
return () => _reactnativereanimated.cancelAnimation.call(void 0, angle);
|
|
120
124
|
}, [angle]);
|
|
121
|
-
const animatedStyle = _reactnativereanimated.useAnimatedStyle.call(void 0, function
|
|
122
|
-
|
|
125
|
+
const animatedStyle = _reactnativereanimated.useAnimatedStyle.call(void 0, function chunkMLJ543GPCjs1Factory({
|
|
126
|
+
_worklet_13959851668106_init_data,
|
|
123
127
|
angle
|
|
124
128
|
}) {
|
|
125
129
|
const _e = [new global.Error(), -2, -27];
|
|
126
|
-
const
|
|
130
|
+
const chunkMLJ543GPCjs1 = function () {
|
|
127
131
|
return {
|
|
128
132
|
transform: [{
|
|
129
133
|
rotate: `${angle.value}deg`
|
|
130
134
|
}]
|
|
131
135
|
};
|
|
132
136
|
};
|
|
133
|
-
|
|
137
|
+
chunkMLJ543GPCjs1.__closure = {
|
|
134
138
|
angle
|
|
135
139
|
};
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
return
|
|
140
|
+
chunkMLJ543GPCjs1.__workletHash = 13959851668106;
|
|
141
|
+
chunkMLJ543GPCjs1.__pluginVersion = "0.7.4";
|
|
142
|
+
chunkMLJ543GPCjs1.__initData = _worklet_13959851668106_init_data;
|
|
143
|
+
chunkMLJ543GPCjs1.__stackDetails = _e;
|
|
144
|
+
return chunkMLJ543GPCjs1;
|
|
141
145
|
}({
|
|
142
|
-
|
|
146
|
+
_worklet_13959851668106_init_data,
|
|
143
147
|
angle
|
|
144
148
|
}), [angle]);
|
|
145
149
|
return /* @__PURE__ */_jsxruntime.jsx.call(void 0, _reactnativereanimated2.default.View, {
|
|
@@ -184,7 +188,14 @@ var VARIANT_TOKENS = {
|
|
|
184
188
|
bgPressed: "accentPressed",
|
|
185
189
|
fg: "accentForeground"
|
|
186
190
|
},
|
|
191
|
+
// The accent's soft slice, not a second neutral: `secondary` is to `primary` what
|
|
192
|
+
// `danger-soft` is to `danger`, and it reads as the same family at lower emphasis.
|
|
187
193
|
secondary: {
|
|
194
|
+
bg: "accentSoft",
|
|
195
|
+
bgPressed: "accentSoftPressed",
|
|
196
|
+
fg: "accentSoftForeground"
|
|
197
|
+
},
|
|
198
|
+
default: {
|
|
188
199
|
bg: "default",
|
|
189
200
|
bgPressed: "defaultPressed",
|
|
190
201
|
fg: "defaultForeground"
|
|
@@ -198,26 +209,6 @@ var VARIANT_TOKENS = {
|
|
|
198
209
|
bgPressed: "defaultSoftPressed",
|
|
199
210
|
fg: "foreground"
|
|
200
211
|
},
|
|
201
|
-
success: {
|
|
202
|
-
bg: "success",
|
|
203
|
-
bgPressed: "successPressed",
|
|
204
|
-
fg: "successForeground"
|
|
205
|
-
},
|
|
206
|
-
"success-soft": {
|
|
207
|
-
bg: "successSoft",
|
|
208
|
-
bgPressed: "successSoftPressed",
|
|
209
|
-
fg: "successSoftForeground"
|
|
210
|
-
},
|
|
211
|
-
warning: {
|
|
212
|
-
bg: "warning",
|
|
213
|
-
bgPressed: "warningPressed",
|
|
214
|
-
fg: "warningForeground"
|
|
215
|
-
},
|
|
216
|
-
"warning-soft": {
|
|
217
|
-
bg: "warningSoft",
|
|
218
|
-
bgPressed: "warningSoftPressed",
|
|
219
|
-
fg: "warningSoftForeground"
|
|
220
|
-
},
|
|
221
212
|
danger: {
|
|
222
213
|
bg: "danger",
|
|
223
214
|
bgPressed: "dangerPressed",
|
|
@@ -263,7 +254,7 @@ function sizeAxis(step) {
|
|
|
263
254
|
spinner: ring(theme, theme.fontSizes[glyph])
|
|
264
255
|
});
|
|
265
256
|
}
|
|
266
|
-
var buttonRecipe =
|
|
257
|
+
var buttonRecipe = _chunkIVVFYUDWcjs.createRecipe.call(void 0, {
|
|
267
258
|
slots: SLOTS,
|
|
268
259
|
base: theme => ({
|
|
269
260
|
root: {
|
|
@@ -444,17 +435,15 @@ var ButtonRoot = _react.forwardRef.call(void 0, function Button({
|
|
|
444
435
|
isLoading = false,
|
|
445
436
|
isIconOnly = false,
|
|
446
437
|
asChild = false,
|
|
447
|
-
// `scale` and not `scale-highlight`: the recipe's `pressed` state already paints the
|
|
448
|
-
// variant's own pressed colour, and a neutral wash on top would darken it twice.
|
|
449
|
-
feedbackVariant = "scale",
|
|
450
438
|
accessibilityRole = "button",
|
|
451
439
|
accessibilityState,
|
|
452
440
|
style,
|
|
453
441
|
onPressIn,
|
|
454
442
|
onPressOut,
|
|
455
|
-
...
|
|
443
|
+
...props
|
|
456
444
|
}, ref) {
|
|
457
|
-
const theme =
|
|
445
|
+
const theme = _chunk6N5JXRUZcjs.useXAUITheme.call(void 0);
|
|
446
|
+
const [styleProps, rest] = _chunkIVVFYUDWcjs.useStyleProps.call(void 0, props);
|
|
458
447
|
const [isPressed, press] = usePressState({
|
|
459
448
|
onPressIn,
|
|
460
449
|
onPressOut
|
|
@@ -495,22 +484,21 @@ var ButtonRoot = _react.forwardRef.call(void 0, function Button({
|
|
|
495
484
|
isLoading
|
|
496
485
|
};
|
|
497
486
|
}, [styles, tint, isDisabled, isLoading]);
|
|
498
|
-
const rootStyle = [styles.root, _optionalChain([tint, 'optionalAccess', _8 => _8.root]), typeof style === "function" ? style({
|
|
487
|
+
const rootStyle = [styles.root, _optionalChain([tint, 'optionalAccess', _8 => _8.root]), styleProps, typeof style === "function" ? style({
|
|
499
488
|
pressed: isPressed
|
|
500
489
|
}) : style];
|
|
501
|
-
const text =
|
|
490
|
+
const text = _chunkIVVFYUDWcjs.childrenToString.call(void 0, children);
|
|
502
491
|
const showSpinner = isLoading && !containsElementOfType(children, ButtonSpinner);
|
|
503
492
|
if (isIconOnly && !rest.accessibilityLabel && !rest["aria-label"]) {
|
|
504
493
|
warnDev("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.");
|
|
505
494
|
}
|
|
506
495
|
return /* @__PURE__ */_jsxruntime.jsx.call(void 0, ButtonProvider, {
|
|
507
496
|
value: context,
|
|
508
|
-
children: /* @__PURE__ */_jsxruntime.jsx.call(void 0,
|
|
497
|
+
children: /* @__PURE__ */_jsxruntime.jsx.call(void 0, _chunkIVVFYUDWcjs.PressableFeedback, {
|
|
509
498
|
ref,
|
|
510
499
|
isPressed,
|
|
511
500
|
isDisabled: isDisabled || isLoading,
|
|
512
501
|
asChild,
|
|
513
|
-
feedbackVariant,
|
|
514
502
|
accessibilityRole,
|
|
515
503
|
accessibilityState: {
|
|
516
504
|
disabled: isDisabled,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Icon, PressableFeedback, childrenToString, createRecipe, createSlotContext } from "./chunk-
|
|
2
|
-
import { useXAUITheme } from "./chunk-
|
|
1
|
+
import { Icon, PressableFeedback, childrenToString, createRecipe, createSlotContext, useStyleProps } from "./chunk-B3EAZ2CC.js";
|
|
2
|
+
import { useXAUITheme } from "./chunk-XJARE6SC.js";
|
|
3
3
|
|
|
4
4
|
// src/components/button/button.context.ts
|
|
5
5
|
var [ButtonProvider, useButton] = createSlotContext("Button");
|
|
@@ -30,15 +30,16 @@ var ButtonLabel = forwardRef(function ButtonLabel2({
|
|
|
30
30
|
children,
|
|
31
31
|
style,
|
|
32
32
|
numberOfLines = 1,
|
|
33
|
-
...
|
|
33
|
+
...props
|
|
34
34
|
}, ref) {
|
|
35
35
|
const {
|
|
36
36
|
labelStyle
|
|
37
37
|
} = useButton();
|
|
38
|
+
const [styleProps, rest] = useStyleProps(props);
|
|
38
39
|
return /* @__PURE__ */jsx2(Text, {
|
|
39
40
|
ref,
|
|
40
41
|
numberOfLines,
|
|
41
|
-
style: [labelStyle, style],
|
|
42
|
+
style: [labelStyle, styleProps, style],
|
|
42
43
|
...rest,
|
|
43
44
|
children
|
|
44
45
|
});
|
|
@@ -53,23 +54,26 @@ import { jsx as jsx3 } from "react/jsx-runtime";
|
|
|
53
54
|
var ROTATION_DURATION = 800;
|
|
54
55
|
function ButtonSpinner({
|
|
55
56
|
style,
|
|
56
|
-
animation = true
|
|
57
|
+
animation = true,
|
|
58
|
+
...props
|
|
57
59
|
}) {
|
|
58
60
|
const {
|
|
59
61
|
spinnerStyle
|
|
60
62
|
} = useButton();
|
|
63
|
+
const [styleProps] = useStyleProps(props);
|
|
64
|
+
const ringStyle = [spinnerStyle, styleProps, style];
|
|
61
65
|
if (!animation) return /* @__PURE__ */jsx3(View, {
|
|
62
|
-
style:
|
|
66
|
+
style: ringStyle
|
|
63
67
|
});
|
|
64
68
|
return /* @__PURE__ */jsx3(SpinningRing, {
|
|
65
|
-
style:
|
|
69
|
+
style: ringStyle
|
|
66
70
|
});
|
|
67
71
|
}
|
|
68
72
|
ButtonSpinner.displayName = "XAUI.Button.Spinner";
|
|
69
|
-
const
|
|
70
|
-
code: "function
|
|
71
|
-
location: "/home/runner/work/xaui/xaui/packages/native/dist/chunk-
|
|
72
|
-
sourceMap: "{\"version\":3,\"names\":[\"
|
|
73
|
+
const _worklet_6402982653390_init_data = {
|
|
74
|
+
code: "function chunkRWLODK55Js1(){const{angle}=this.__closure;return{transform:[{rotate:angle.value+\"deg\"}]};}",
|
|
75
|
+
location: "/home/runner/work/xaui/xaui/packages/native/dist/chunk-RWLODK55.js",
|
|
76
|
+
sourceMap: "{\"version\":3,\"names\":[\"chunkRWLODK55Js1\",\"angle\",\"__closure\",\"transform\",\"rotate\",\"value\"],\"sources\":[\"/home/runner/work/xaui/xaui/packages/native/dist/chunk-RWLODK55.js\"],\"mappings\":\"AA0EyC,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\":[]}"
|
|
73
77
|
};
|
|
74
78
|
function SpinningRing({
|
|
75
79
|
style
|
|
@@ -82,28 +86,28 @@ function SpinningRing({
|
|
|
82
86
|
}), -1, false);
|
|
83
87
|
return () => cancelAnimation(angle);
|
|
84
88
|
}, [angle]);
|
|
85
|
-
const animatedStyle = useAnimatedStyle(function
|
|
86
|
-
|
|
89
|
+
const animatedStyle = useAnimatedStyle(function chunkRWLODK55Js1Factory({
|
|
90
|
+
_worklet_6402982653390_init_data,
|
|
87
91
|
angle
|
|
88
92
|
}) {
|
|
89
93
|
const _e = [new global.Error(), -2, -27];
|
|
90
|
-
const
|
|
94
|
+
const chunkRWLODK55Js1 = function () {
|
|
91
95
|
return {
|
|
92
96
|
transform: [{
|
|
93
97
|
rotate: `${angle.value}deg`
|
|
94
98
|
}]
|
|
95
99
|
};
|
|
96
100
|
};
|
|
97
|
-
|
|
101
|
+
chunkRWLODK55Js1.__closure = {
|
|
98
102
|
angle
|
|
99
103
|
};
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
return
|
|
104
|
+
chunkRWLODK55Js1.__workletHash = 6402982653390;
|
|
105
|
+
chunkRWLODK55Js1.__pluginVersion = "0.7.4";
|
|
106
|
+
chunkRWLODK55Js1.__initData = _worklet_6402982653390_init_data;
|
|
107
|
+
chunkRWLODK55Js1.__stackDetails = _e;
|
|
108
|
+
return chunkRWLODK55Js1;
|
|
105
109
|
}({
|
|
106
|
-
|
|
110
|
+
_worklet_6402982653390_init_data,
|
|
107
111
|
angle
|
|
108
112
|
}), [angle]);
|
|
109
113
|
return /* @__PURE__ */jsx3(Animated.View, {
|
|
@@ -150,7 +154,14 @@ var VARIANT_TOKENS = {
|
|
|
150
154
|
bgPressed: "accentPressed",
|
|
151
155
|
fg: "accentForeground"
|
|
152
156
|
},
|
|
157
|
+
// The accent's soft slice, not a second neutral: `secondary` is to `primary` what
|
|
158
|
+
// `danger-soft` is to `danger`, and it reads as the same family at lower emphasis.
|
|
153
159
|
secondary: {
|
|
160
|
+
bg: "accentSoft",
|
|
161
|
+
bgPressed: "accentSoftPressed",
|
|
162
|
+
fg: "accentSoftForeground"
|
|
163
|
+
},
|
|
164
|
+
default: {
|
|
154
165
|
bg: "default",
|
|
155
166
|
bgPressed: "defaultPressed",
|
|
156
167
|
fg: "defaultForeground"
|
|
@@ -164,26 +175,6 @@ var VARIANT_TOKENS = {
|
|
|
164
175
|
bgPressed: "defaultSoftPressed",
|
|
165
176
|
fg: "foreground"
|
|
166
177
|
},
|
|
167
|
-
success: {
|
|
168
|
-
bg: "success",
|
|
169
|
-
bgPressed: "successPressed",
|
|
170
|
-
fg: "successForeground"
|
|
171
|
-
},
|
|
172
|
-
"success-soft": {
|
|
173
|
-
bg: "successSoft",
|
|
174
|
-
bgPressed: "successSoftPressed",
|
|
175
|
-
fg: "successSoftForeground"
|
|
176
|
-
},
|
|
177
|
-
warning: {
|
|
178
|
-
bg: "warning",
|
|
179
|
-
bgPressed: "warningPressed",
|
|
180
|
-
fg: "warningForeground"
|
|
181
|
-
},
|
|
182
|
-
"warning-soft": {
|
|
183
|
-
bg: "warningSoft",
|
|
184
|
-
bgPressed: "warningSoftPressed",
|
|
185
|
-
fg: "warningSoftForeground"
|
|
186
|
-
},
|
|
187
178
|
danger: {
|
|
188
179
|
bg: "danger",
|
|
189
180
|
bgPressed: "dangerPressed",
|
|
@@ -410,17 +401,15 @@ var ButtonRoot = forwardRef2(function Button({
|
|
|
410
401
|
isLoading = false,
|
|
411
402
|
isIconOnly = false,
|
|
412
403
|
asChild = false,
|
|
413
|
-
// `scale` and not `scale-highlight`: the recipe's `pressed` state already paints the
|
|
414
|
-
// variant's own pressed colour, and a neutral wash on top would darken it twice.
|
|
415
|
-
feedbackVariant = "scale",
|
|
416
404
|
accessibilityRole = "button",
|
|
417
405
|
accessibilityState,
|
|
418
406
|
style,
|
|
419
407
|
onPressIn,
|
|
420
408
|
onPressOut,
|
|
421
|
-
...
|
|
409
|
+
...props
|
|
422
410
|
}, ref) {
|
|
423
411
|
const theme = useXAUITheme();
|
|
412
|
+
const [styleProps, rest] = useStyleProps(props);
|
|
424
413
|
const [isPressed, press] = usePressState({
|
|
425
414
|
onPressIn,
|
|
426
415
|
onPressOut
|
|
@@ -461,7 +450,7 @@ var ButtonRoot = forwardRef2(function Button({
|
|
|
461
450
|
isLoading
|
|
462
451
|
};
|
|
463
452
|
}, [styles, tint, isDisabled, isLoading]);
|
|
464
|
-
const rootStyle = [styles.root, tint?.root, typeof style === "function" ? style({
|
|
453
|
+
const rootStyle = [styles.root, tint?.root, styleProps, typeof style === "function" ? style({
|
|
465
454
|
pressed: isPressed
|
|
466
455
|
}) : style];
|
|
467
456
|
const text = childrenToString(children);
|
|
@@ -476,7 +465,6 @@ var ButtonRoot = forwardRef2(function Button({
|
|
|
476
465
|
isPressed,
|
|
477
466
|
isDisabled: isDisabled || isLoading,
|
|
478
467
|
asChild,
|
|
479
|
-
feedbackVariant,
|
|
480
468
|
accessibilityRole,
|
|
481
469
|
accessibilityState: {
|
|
482
470
|
disabled: isDisabled,
|
|
@@ -107,19 +107,42 @@ function deriveTint(tint, theme) {
|
|
|
107
107
|
foreground,
|
|
108
108
|
soft: alpha(tint, 0.15),
|
|
109
109
|
softForeground: mix(tint, theme.colors.foreground, 0.2),
|
|
110
|
-
|
|
110
|
+
// Towards the mode's ink, not the tint's own foreground — the same single direction
|
|
111
|
+
// the token layer takes (P2-API-REVIEW §E). A raw tint has to behave like `accent`
|
|
112
|
+
// under the finger as much as it does at rest.
|
|
113
|
+
pressed: mix(tint, theme.colors.foreground, 0.1),
|
|
111
114
|
softPressed: alpha(tint, 0.2)
|
|
112
115
|
};
|
|
113
116
|
cache.set(key, derived);
|
|
114
117
|
return derived;
|
|
115
118
|
}
|
|
116
119
|
|
|
120
|
+
// src/utils/stable-hash.ts
|
|
121
|
+
function canonical(value) {
|
|
122
|
+
if (value === null || typeof value !== "object") return JSON.stringify(value) ?? "null";
|
|
123
|
+
if (Array.isArray(value)) return `[${value.map(canonical).join(",")}]`;
|
|
124
|
+
const entries = Object.entries(value).filter(([, v]) => typeof v !== "function").sort(([a], [b]) => a < b ? -1 : 1).map(([k, v]) => `${JSON.stringify(k)}:${canonical(v)}`);
|
|
125
|
+
return `{${entries.join(",")}}`;
|
|
126
|
+
}
|
|
127
|
+
function stableHash(value) {
|
|
128
|
+
const input = canonical(value);
|
|
129
|
+
let hash = 2166136261;
|
|
130
|
+
for (let i = 0; i < input.length; i++) {
|
|
131
|
+
hash ^= input.charCodeAt(i);
|
|
132
|
+
hash = Math.imul(hash, 16777619) >>> 0;
|
|
133
|
+
}
|
|
134
|
+
return hash.toString(36);
|
|
135
|
+
}
|
|
136
|
+
|
|
117
137
|
export {
|
|
118
138
|
ThemeContext,
|
|
119
139
|
useXAUITheme,
|
|
120
140
|
useColorMode,
|
|
121
141
|
useThemeColor,
|
|
142
|
+
stableHash,
|
|
143
|
+
isHex,
|
|
122
144
|
mix,
|
|
123
145
|
alpha,
|
|
146
|
+
contrastOn,
|
|
124
147
|
deriveTint
|
|
125
148
|
};
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
var
|
|
6
|
-
require('../../chunk-
|
|
7
|
-
require('../../chunk-
|
|
5
|
+
var _chunkMLJ543GPcjs = require('../../chunk-MLJ543GP.cjs');
|
|
6
|
+
require('../../chunk-IVVFYUDW.cjs');
|
|
7
|
+
require('../../chunk-6N5JXRUZ.cjs');
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
exports.Button =
|
|
12
|
+
exports.Button = _chunkMLJ543GPcjs.Button; exports.buttonRecipe = _chunkMLJ543GPcjs.buttonRecipe; exports.useButton = _chunkMLJ543GPcjs.useButton;
|