@xsolla/xui-button 0.172.2 → 0.173.0
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/README.md +41 -14
- package/native/index.d.mts +8 -1
- package/native/index.d.ts +8 -1
- package/native/index.js +9 -10
- package/native/index.js.map +1 -1
- package/native/index.mjs +14 -15
- package/native/index.mjs.map +1 -1
- package/package.json +4 -4
- package/web/index.d.mts +8 -1
- package/web/index.d.ts +8 -1
- package/web/index.js +9 -10
- package/web/index.js.map +1 -1
- package/web/index.mjs +14 -15
- package/web/index.mjs.map +1 -1
package/web/index.mjs
CHANGED
|
@@ -822,7 +822,7 @@ import {
|
|
|
822
822
|
useRef,
|
|
823
823
|
useState as useState3
|
|
824
824
|
} from "react";
|
|
825
|
-
import {
|
|
825
|
+
import { useDesignSystem } from "@xsolla/xui-core";
|
|
826
826
|
import { Fragment, jsx as jsx7, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
827
827
|
var ICON_SIZES = {
|
|
828
828
|
xs: 12,
|
|
@@ -864,6 +864,7 @@ var FlexButton = ({
|
|
|
864
864
|
variant = "brand",
|
|
865
865
|
size = "md",
|
|
866
866
|
background = false,
|
|
867
|
+
hoverBackground = true,
|
|
867
868
|
disabled = false,
|
|
868
869
|
loading = false,
|
|
869
870
|
iconLeft,
|
|
@@ -880,11 +881,9 @@ var FlexButton = ({
|
|
|
880
881
|
"aria-controls": ariaControls,
|
|
881
882
|
testID,
|
|
882
883
|
tabIndex = 0,
|
|
883
|
-
themeMode,
|
|
884
|
-
themeProductContext,
|
|
885
884
|
...buttonProps
|
|
886
885
|
}) => {
|
|
887
|
-
const { theme } =
|
|
886
|
+
const { theme } = useDesignSystem();
|
|
888
887
|
const [state, setState] = useState3("default");
|
|
889
888
|
const [isFocused, setIsFocused] = useState3(false);
|
|
890
889
|
const isMouseOverRef = useRef(false);
|
|
@@ -908,8 +907,8 @@ var FlexButton = ({
|
|
|
908
907
|
};
|
|
909
908
|
}
|
|
910
909
|
return {
|
|
911
|
-
bg: currentState === "press" ? theme.colors.background.brand.primary : currentState === "hover" ? theme.colors.overlay.brand : "transparent",
|
|
912
|
-
text: currentState === "press" ? theme.colors.content.on.brand : theme.colors.content.brand.primary,
|
|
910
|
+
bg: !hoverBackground ? "transparent" : currentState === "press" ? theme.colors.background.brand.primary : currentState === "hover" ? theme.colors.overlay.brand : "transparent",
|
|
911
|
+
text: currentState === "press" && hoverBackground ? theme.colors.content.on.brand : theme.colors.content.brand.primary,
|
|
913
912
|
border: void 0
|
|
914
913
|
};
|
|
915
914
|
case "primary":
|
|
@@ -921,7 +920,7 @@ var FlexButton = ({
|
|
|
921
920
|
};
|
|
922
921
|
}
|
|
923
922
|
return {
|
|
924
|
-
bg: currentState === "press" || currentState === "hover" ? theme.colors.overlay.mono : "transparent",
|
|
923
|
+
bg: !hoverBackground ? "transparent" : currentState === "press" || currentState === "hover" ? theme.colors.overlay.mono : "transparent",
|
|
925
924
|
text: theme.colors.content.primary,
|
|
926
925
|
border: currentState === "press" ? theme.colors.border.primary : void 0
|
|
927
926
|
};
|
|
@@ -934,7 +933,7 @@ var FlexButton = ({
|
|
|
934
933
|
};
|
|
935
934
|
}
|
|
936
935
|
return {
|
|
937
|
-
bg: currentState === "press" || currentState === "hover" ? theme.colors.overlay.mono : "transparent",
|
|
936
|
+
bg: !hoverBackground ? "transparent" : currentState === "press" || currentState === "hover" ? theme.colors.overlay.mono : "transparent",
|
|
938
937
|
text: currentState === "press" ? theme.colors.content.primary : currentState === "hover" ? theme.colors.content.secondary : theme.colors.content.secondary,
|
|
939
938
|
border: void 0
|
|
940
939
|
};
|
|
@@ -947,7 +946,7 @@ var FlexButton = ({
|
|
|
947
946
|
};
|
|
948
947
|
}
|
|
949
948
|
return {
|
|
950
|
-
bg: currentState === "press" || currentState === "hover" ? theme.colors.overlay.mono : "transparent",
|
|
949
|
+
bg: !hoverBackground ? "transparent" : currentState === "press" || currentState === "hover" ? theme.colors.overlay.mono : "transparent",
|
|
951
950
|
text: currentState === "press" ? theme.colors.content.secondary : currentState === "hover" ? theme.colors.content.tertiary : theme.colors.content.tertiary,
|
|
952
951
|
border: void 0
|
|
953
952
|
};
|
|
@@ -960,7 +959,7 @@ var FlexButton = ({
|
|
|
960
959
|
};
|
|
961
960
|
}
|
|
962
961
|
return {
|
|
963
|
-
bg: currentState === "press" ? theme.colors.background.brandExtra.primary : currentState === "hover" ? theme.colors.overlay.brandExtra : "transparent",
|
|
962
|
+
bg: !hoverBackground ? "transparent" : currentState === "press" ? theme.colors.background.brandExtra.primary : currentState === "hover" ? theme.colors.overlay.brandExtra : "transparent",
|
|
964
963
|
text: currentState === "press" ? theme.colors.content.on.brandExtra : theme.colors.content.brandExtra.secondary,
|
|
965
964
|
border: void 0
|
|
966
965
|
};
|
|
@@ -973,7 +972,7 @@ var FlexButton = ({
|
|
|
973
972
|
};
|
|
974
973
|
}
|
|
975
974
|
return {
|
|
976
|
-
bg: currentState === "press" || currentState === "hover" ? theme.colors.overlay.mono : "transparent",
|
|
975
|
+
bg: !hoverBackground ? "transparent" : currentState === "press" || currentState === "hover" ? theme.colors.overlay.mono : "transparent",
|
|
977
976
|
text: theme.colors.content.inverse,
|
|
978
977
|
border: void 0
|
|
979
978
|
};
|
|
@@ -1159,7 +1158,7 @@ FlexButton.displayName = "FlexButton";
|
|
|
1159
1158
|
|
|
1160
1159
|
// src/AppButton.tsx
|
|
1161
1160
|
import React6, { useState as useState4 } from "react";
|
|
1162
|
-
import { useResolvedTheme as
|
|
1161
|
+
import { useResolvedTheme as useResolvedTheme3 } from "@xsolla/xui-core";
|
|
1163
1162
|
import { jsx as jsx8, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
1164
1163
|
var cloneIconWithDefaults3 = (icon, defaultSize, defaultColor) => {
|
|
1165
1164
|
if (!React6.isValidElement(icon)) return icon;
|
|
@@ -1196,7 +1195,7 @@ var AppButton = ({
|
|
|
1196
1195
|
themeMode,
|
|
1197
1196
|
themeProductContext
|
|
1198
1197
|
}) => {
|
|
1199
|
-
const { theme } =
|
|
1198
|
+
const { theme } = useResolvedTheme3({ themeMode, themeProductContext });
|
|
1200
1199
|
const [isKeyboardPressed, setIsKeyboardPressed] = useState4(false);
|
|
1201
1200
|
const isDisabled = disabled || loading;
|
|
1202
1201
|
const sizeStyles = theme.sizing.button(size);
|
|
@@ -1382,7 +1381,7 @@ AppButton.displayName = "AppButton";
|
|
|
1382
1381
|
|
|
1383
1382
|
// src/ButtonGroup.tsx
|
|
1384
1383
|
import React7 from "react";
|
|
1385
|
-
import { useResolvedTheme as
|
|
1384
|
+
import { useResolvedTheme as useResolvedTheme4 } from "@xsolla/xui-core";
|
|
1386
1385
|
import { Fragment as Fragment2, jsx as jsx9, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1387
1386
|
var ButtonGroup = ({
|
|
1388
1387
|
orientation = "horizontal",
|
|
@@ -1399,7 +1398,7 @@ var ButtonGroup = ({
|
|
|
1399
1398
|
themeMode,
|
|
1400
1399
|
themeProductContext
|
|
1401
1400
|
}) => {
|
|
1402
|
-
const { theme } =
|
|
1401
|
+
const { theme } = useResolvedTheme4({ themeMode, themeProductContext });
|
|
1403
1402
|
const flattenChildren = (children2) => {
|
|
1404
1403
|
const result = [];
|
|
1405
1404
|
React7.Children.forEach(children2, (child) => {
|