@xsolla/xui-button 0.128.0 → 0.129.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/native/index.d.mts +6 -5
- package/native/index.d.ts +6 -5
- package/native/index.js +28 -10
- package/native/index.js.map +1 -1
- package/native/index.mjs +33 -15
- package/native/index.mjs.map +1 -1
- package/package.json +4 -4
- package/web/index.d.mts +6 -5
- package/web/index.d.ts +6 -5
- package/web/index.js +21 -9
- package/web/index.js.map +1 -1
- package/web/index.mjs +26 -14
- package/web/index.mjs.map +1 -1
package/web/index.mjs
CHANGED
|
@@ -39,6 +39,8 @@ var StyledBox = styled.div`
|
|
|
39
39
|
width: ${(props) => typeof props.width === "number" ? `${props.width}px` : props.width || "auto"};
|
|
40
40
|
min-width: ${(props) => typeof props.minWidth === "number" ? `${props.minWidth}px` : props.minWidth || "auto"};
|
|
41
41
|
min-height: ${(props) => typeof props.minHeight === "number" ? `${props.minHeight}px` : props.minHeight || "auto"};
|
|
42
|
+
max-width: ${(props) => typeof props.maxWidth === "number" ? `${props.maxWidth}px` : props.maxWidth || "none"};
|
|
43
|
+
max-height: ${(props) => typeof props.maxHeight === "number" ? `${props.maxHeight}px` : props.maxHeight || "none"};
|
|
42
44
|
|
|
43
45
|
padding: ${(props) => typeof props.padding === "number" ? `${props.padding}px` : props.padding || 0};
|
|
44
46
|
${(props) => props.paddingHorizontal && `
|
|
@@ -270,7 +272,7 @@ var Icon = ({ children, ...props }) => {
|
|
|
270
272
|
};
|
|
271
273
|
|
|
272
274
|
// src/Button.tsx
|
|
273
|
-
import {
|
|
275
|
+
import { useResolvedTheme } from "@xsolla/xui-core";
|
|
274
276
|
import { jsx as jsx5, jsxs } from "react/jsx-runtime";
|
|
275
277
|
var cloneIconWithDefaults = (icon, defaultSize, defaultColor) => {
|
|
276
278
|
if (!React2.isValidElement(icon)) return icon;
|
|
@@ -306,9 +308,11 @@ var Button = ({
|
|
|
306
308
|
testID,
|
|
307
309
|
id,
|
|
308
310
|
type = "button",
|
|
309
|
-
fullWidth = false
|
|
311
|
+
fullWidth = false,
|
|
312
|
+
themeMode,
|
|
313
|
+
themeProductContext
|
|
310
314
|
}) => {
|
|
311
|
-
const { theme } =
|
|
315
|
+
const { theme } = useResolvedTheme({ themeMode, themeProductContext });
|
|
312
316
|
const [isKeyboardPressed, setIsKeyboardPressed] = useState(false);
|
|
313
317
|
const isDisabled = disabled || loading;
|
|
314
318
|
const sizeStyles = theme.sizing.button(size);
|
|
@@ -501,7 +505,7 @@ Button.displayName = "Button";
|
|
|
501
505
|
|
|
502
506
|
// src/IconButton.tsx
|
|
503
507
|
import React3, { useState as useState2 } from "react";
|
|
504
|
-
import {
|
|
508
|
+
import { useResolvedTheme as useResolvedTheme2 } from "@xsolla/xui-core";
|
|
505
509
|
import { jsx as jsx6, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
506
510
|
var cloneIconWithDefaults2 = (icon, defaultSize, defaultColor) => {
|
|
507
511
|
if (!React3.isValidElement(icon)) return icon;
|
|
@@ -530,9 +534,11 @@ var IconButton = ({
|
|
|
530
534
|
"aria-controls": ariaControls,
|
|
531
535
|
testID,
|
|
532
536
|
id,
|
|
533
|
-
type = "button"
|
|
537
|
+
type = "button",
|
|
538
|
+
themeMode,
|
|
539
|
+
themeProductContext
|
|
534
540
|
}) => {
|
|
535
|
-
const { theme } =
|
|
541
|
+
const { theme } = useResolvedTheme2({ themeMode, themeProductContext });
|
|
536
542
|
const [isKeyboardPressed, setIsKeyboardPressed] = useState2(false);
|
|
537
543
|
const isDisabled = disabled || loading;
|
|
538
544
|
const sizeStyles = theme.sizing.button(size);
|
|
@@ -672,7 +678,7 @@ import {
|
|
|
672
678
|
useRef,
|
|
673
679
|
useState as useState3
|
|
674
680
|
} from "react";
|
|
675
|
-
import {
|
|
681
|
+
import { useResolvedTheme as useResolvedTheme3 } from "@xsolla/xui-core";
|
|
676
682
|
import { Fragment, jsx as jsx7, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
677
683
|
var ICON_SIZES = {
|
|
678
684
|
xs: 12,
|
|
@@ -730,9 +736,11 @@ var FlexButton = ({
|
|
|
730
736
|
"aria-controls": ariaControls,
|
|
731
737
|
testID,
|
|
732
738
|
tabIndex = 0,
|
|
739
|
+
themeMode,
|
|
740
|
+
themeProductContext,
|
|
733
741
|
...buttonProps
|
|
734
742
|
}) => {
|
|
735
|
-
const { theme } =
|
|
743
|
+
const { theme } = useResolvedTheme3({ themeMode, themeProductContext });
|
|
736
744
|
const [state, setState] = useState3("default");
|
|
737
745
|
const [isFocused, setIsFocused] = useState3(false);
|
|
738
746
|
const isMouseOverRef = useRef(false);
|
|
@@ -1007,7 +1015,7 @@ FlexButton.displayName = "FlexButton";
|
|
|
1007
1015
|
|
|
1008
1016
|
// src/AppButton.tsx
|
|
1009
1017
|
import React5, { useState as useState4 } from "react";
|
|
1010
|
-
import {
|
|
1018
|
+
import { useResolvedTheme as useResolvedTheme4 } from "@xsolla/xui-core";
|
|
1011
1019
|
import { jsx as jsx8, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
1012
1020
|
var cloneIconWithDefaults3 = (icon, defaultSize, defaultColor) => {
|
|
1013
1021
|
if (!React5.isValidElement(icon)) return icon;
|
|
@@ -1040,9 +1048,11 @@ var AppButton = ({
|
|
|
1040
1048
|
testID,
|
|
1041
1049
|
id,
|
|
1042
1050
|
type = "button",
|
|
1043
|
-
fullWidth = false
|
|
1051
|
+
fullWidth = false,
|
|
1052
|
+
themeMode,
|
|
1053
|
+
themeProductContext
|
|
1044
1054
|
}) => {
|
|
1045
|
-
const { theme } =
|
|
1055
|
+
const { theme } = useResolvedTheme4({ themeMode, themeProductContext });
|
|
1046
1056
|
const [isKeyboardPressed, setIsKeyboardPressed] = useState4(false);
|
|
1047
1057
|
const isDisabled = disabled || loading;
|
|
1048
1058
|
const sizeStyles = theme.sizing.button(size);
|
|
@@ -1228,7 +1238,7 @@ AppButton.displayName = "AppButton";
|
|
|
1228
1238
|
|
|
1229
1239
|
// src/ButtonGroup.tsx
|
|
1230
1240
|
import React6 from "react";
|
|
1231
|
-
import {
|
|
1241
|
+
import { useResolvedTheme as useResolvedTheme5 } from "@xsolla/xui-core";
|
|
1232
1242
|
import { Fragment as Fragment2, jsx as jsx9, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1233
1243
|
var ButtonGroup = ({
|
|
1234
1244
|
orientation = "horizontal",
|
|
@@ -1241,9 +1251,11 @@ var ButtonGroup = ({
|
|
|
1241
1251
|
"aria-labelledby": ariaLabelledBy,
|
|
1242
1252
|
"aria-describedby": ariaDescribedBy,
|
|
1243
1253
|
id,
|
|
1244
|
-
testID
|
|
1254
|
+
testID,
|
|
1255
|
+
themeMode,
|
|
1256
|
+
themeProductContext
|
|
1245
1257
|
}) => {
|
|
1246
|
-
const { theme } =
|
|
1258
|
+
const { theme } = useResolvedTheme5({ themeMode, themeProductContext });
|
|
1247
1259
|
const flattenChildren = (children2) => {
|
|
1248
1260
|
const result = [];
|
|
1249
1261
|
React6.Children.forEach(children2, (child) => {
|