@xsolla/xui-button 0.136.0 → 0.138.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/package.json +4 -4
- package/web/index.js +108 -30
- package/web/index.js.map +1 -1
- package/web/index.mjs +101 -23
- package/web/index.mjs.map +1 -1
package/web/index.mjs
CHANGED
|
@@ -1,11 +1,83 @@
|
|
|
1
1
|
// src/Button.tsx
|
|
2
|
-
import
|
|
2
|
+
import React3, { useState } from "react";
|
|
3
3
|
|
|
4
4
|
// ../primitives-web/src/Box.tsx
|
|
5
|
-
import
|
|
5
|
+
import React2 from "react";
|
|
6
6
|
import styled from "styled-components";
|
|
7
|
+
|
|
8
|
+
// ../primitives-web/src/filterDOMProps.ts
|
|
9
|
+
import React from "react";
|
|
10
|
+
|
|
11
|
+
// ../../node_modules/@emotion/memoize/dist/memoize.esm.js
|
|
12
|
+
function memoize(fn) {
|
|
13
|
+
var cache = {};
|
|
14
|
+
return function(arg) {
|
|
15
|
+
if (cache[arg] === void 0) cache[arg] = fn(arg);
|
|
16
|
+
return cache[arg];
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
var memoize_esm_default = memoize;
|
|
20
|
+
|
|
21
|
+
// ../../node_modules/@emotion/is-prop-valid/dist/is-prop-valid.esm.js
|
|
22
|
+
var reactPropsRegex = /^((children|dangerouslySetInnerHTML|key|ref|autoFocus|defaultValue|defaultChecked|innerHTML|suppressContentEditableWarning|suppressHydrationWarning|valueLink|accept|acceptCharset|accessKey|action|allow|allowUserMedia|allowPaymentRequest|allowFullScreen|allowTransparency|alt|async|autoComplete|autoPlay|capture|cellPadding|cellSpacing|challenge|charSet|checked|cite|classID|className|cols|colSpan|content|contentEditable|contextMenu|controls|controlsList|coords|crossOrigin|data|dateTime|decoding|default|defer|dir|disabled|disablePictureInPicture|download|draggable|encType|form|formAction|formEncType|formMethod|formNoValidate|formTarget|frameBorder|headers|height|hidden|high|href|hrefLang|htmlFor|httpEquiv|id|inputMode|integrity|is|keyParams|keyType|kind|label|lang|list|loading|loop|low|marginHeight|marginWidth|max|maxLength|media|mediaGroup|method|min|minLength|multiple|muted|name|nonce|noValidate|open|optimum|pattern|placeholder|playsInline|poster|preload|profile|radioGroup|readOnly|referrerPolicy|rel|required|reversed|role|rows|rowSpan|sandbox|scope|scoped|scrolling|seamless|selected|shape|size|sizes|slot|span|spellCheck|src|srcDoc|srcLang|srcSet|start|step|style|summary|tabIndex|target|title|type|useMap|value|width|wmode|wrap|about|datatype|inlist|prefix|property|resource|typeof|vocab|autoCapitalize|autoCorrect|autoSave|color|inert|itemProp|itemScope|itemType|itemID|itemRef|on|results|security|unselectable|accentHeight|accumulate|additive|alignmentBaseline|allowReorder|alphabetic|amplitude|arabicForm|ascent|attributeName|attributeType|autoReverse|azimuth|baseFrequency|baselineShift|baseProfile|bbox|begin|bias|by|calcMode|capHeight|clip|clipPathUnits|clipPath|clipRule|colorInterpolation|colorInterpolationFilters|colorProfile|colorRendering|contentScriptType|contentStyleType|cursor|cx|cy|d|decelerate|descent|diffuseConstant|direction|display|divisor|dominantBaseline|dur|dx|dy|edgeMode|elevation|enableBackground|end|exponent|externalResourcesRequired|fill|fillOpacity|fillRule|filter|filterRes|filterUnits|floodColor|floodOpacity|focusable|fontFamily|fontSize|fontSizeAdjust|fontStretch|fontStyle|fontVariant|fontWeight|format|from|fr|fx|fy|g1|g2|glyphName|glyphOrientationHorizontal|glyphOrientationVertical|glyphRef|gradientTransform|gradientUnits|hanging|horizAdvX|horizOriginX|ideographic|imageRendering|in|in2|intercept|k|k1|k2|k3|k4|kernelMatrix|kernelUnitLength|kerning|keyPoints|keySplines|keyTimes|lengthAdjust|letterSpacing|lightingColor|limitingConeAngle|local|markerEnd|markerMid|markerStart|markerHeight|markerUnits|markerWidth|mask|maskContentUnits|maskUnits|mathematical|mode|numOctaves|offset|opacity|operator|order|orient|orientation|origin|overflow|overlinePosition|overlineThickness|panose1|paintOrder|pathLength|patternContentUnits|patternTransform|patternUnits|pointerEvents|points|pointsAtX|pointsAtY|pointsAtZ|preserveAlpha|preserveAspectRatio|primitiveUnits|r|radius|refX|refY|renderingIntent|repeatCount|repeatDur|requiredExtensions|requiredFeatures|restart|result|rotate|rx|ry|scale|seed|shapeRendering|slope|spacing|specularConstant|specularExponent|speed|spreadMethod|startOffset|stdDeviation|stemh|stemv|stitchTiles|stopColor|stopOpacity|strikethroughPosition|strikethroughThickness|string|stroke|strokeDasharray|strokeDashoffset|strokeLinecap|strokeLinejoin|strokeMiterlimit|strokeOpacity|strokeWidth|surfaceScale|systemLanguage|tableValues|targetX|targetY|textAnchor|textDecoration|textRendering|textLength|to|transform|u1|u2|underlinePosition|underlineThickness|unicode|unicodeBidi|unicodeRange|unitsPerEm|vAlphabetic|vHanging|vIdeographic|vMathematical|values|vectorEffect|version|vertAdvY|vertOriginX|vertOriginY|viewBox|viewTarget|visibility|widths|wordSpacing|writingMode|x|xHeight|x1|x2|xChannelSelector|xlinkActuate|xlinkArcrole|xlinkHref|xlinkRole|xlinkShow|xlinkTitle|xlinkType|xmlBase|xmlns|xmlnsXlink|xmlLang|xmlSpace|y|y1|y2|yChannelSelector|z|zoomAndPan|for|class|autofocus)|(([Dd][Aa][Tt][Aa]|[Aa][Rr][Ii][Aa]|x)-.*))$/;
|
|
23
|
+
var index = memoize_esm_default(
|
|
24
|
+
function(prop) {
|
|
25
|
+
return reactPropsRegex.test(prop) || prop.charCodeAt(0) === 111 && prop.charCodeAt(1) === 110 && prop.charCodeAt(2) < 91;
|
|
26
|
+
}
|
|
27
|
+
/* Z+1 */
|
|
28
|
+
);
|
|
29
|
+
var is_prop_valid_esm_default = index;
|
|
30
|
+
|
|
31
|
+
// ../primitives-web/src/filterDOMProps.ts
|
|
32
|
+
var ADDITIONAL_BLOCKED_PROPS = /* @__PURE__ */ new Set([
|
|
33
|
+
// RN-only event handlers (pass isPropValid's on* pattern)
|
|
34
|
+
"onPress",
|
|
35
|
+
"onChangeText",
|
|
36
|
+
"onLayout",
|
|
37
|
+
"onMoveShouldSetResponder",
|
|
38
|
+
"onResponderGrant",
|
|
39
|
+
"onResponderMove",
|
|
40
|
+
"onResponderRelease",
|
|
41
|
+
"onResponderTerminate",
|
|
42
|
+
// SVG attributes that pass isPropValid
|
|
43
|
+
"strokeWidth",
|
|
44
|
+
// CSS properties that pass isPropValid but are used as component props
|
|
45
|
+
"overflow",
|
|
46
|
+
"cursor",
|
|
47
|
+
"fontSize",
|
|
48
|
+
"fontWeight",
|
|
49
|
+
"fontFamily",
|
|
50
|
+
"textDecoration"
|
|
51
|
+
]);
|
|
52
|
+
function shouldForwardProp(key) {
|
|
53
|
+
if (ADDITIONAL_BLOCKED_PROPS.has(key)) return false;
|
|
54
|
+
return is_prop_valid_esm_default(key);
|
|
55
|
+
}
|
|
56
|
+
function createFilteredElement(defaultTag) {
|
|
57
|
+
const Component = React.forwardRef(
|
|
58
|
+
({ children, elementType, ...props }, ref) => {
|
|
59
|
+
const Tag = elementType || defaultTag;
|
|
60
|
+
const htmlProps = {};
|
|
61
|
+
for (const key of Object.keys(props)) {
|
|
62
|
+
if (shouldForwardProp(key)) {
|
|
63
|
+
htmlProps[key] = props[key];
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
return React.createElement(
|
|
67
|
+
Tag,
|
|
68
|
+
{ ref, ...htmlProps },
|
|
69
|
+
children
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
);
|
|
73
|
+
Component.displayName = `Filtered(${defaultTag})`;
|
|
74
|
+
return Component;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
// ../primitives-web/src/Box.tsx
|
|
7
78
|
import { jsx } from "react/jsx-runtime";
|
|
8
|
-
var
|
|
79
|
+
var FilteredDiv = createFilteredElement("div");
|
|
80
|
+
var StyledBox = styled(FilteredDiv)`
|
|
9
81
|
display: flex;
|
|
10
82
|
box-sizing: border-box;
|
|
11
83
|
background-color: ${(props) => props.backgroundColor || "transparent"};
|
|
@@ -92,7 +164,7 @@ var StyledBox = styled.div`
|
|
|
92
164
|
${(props) => props.pressStyle?.backgroundColor && `background-color: ${props.pressStyle.backgroundColor};`}
|
|
93
165
|
}
|
|
94
166
|
`;
|
|
95
|
-
var Box =
|
|
167
|
+
var Box = React2.forwardRef(
|
|
96
168
|
({
|
|
97
169
|
children,
|
|
98
170
|
onPress,
|
|
@@ -117,6 +189,8 @@ var Box = React.forwardRef(
|
|
|
117
189
|
type,
|
|
118
190
|
disabled,
|
|
119
191
|
id,
|
|
192
|
+
testID,
|
|
193
|
+
"data-testid": dataTestId,
|
|
120
194
|
...props
|
|
121
195
|
}, ref) => {
|
|
122
196
|
if (as === "img" && src) {
|
|
@@ -144,7 +218,7 @@ var Box = React.forwardRef(
|
|
|
144
218
|
StyledBox,
|
|
145
219
|
{
|
|
146
220
|
ref,
|
|
147
|
-
as,
|
|
221
|
+
elementType: as,
|
|
148
222
|
id,
|
|
149
223
|
type: as === "button" ? type || "button" : void 0,
|
|
150
224
|
disabled: as === "button" ? disabled : void 0,
|
|
@@ -164,6 +238,7 @@ var Box = React.forwardRef(
|
|
|
164
238
|
"aria-controls": ariaControls,
|
|
165
239
|
"aria-live": ariaLive,
|
|
166
240
|
tabIndex: tabIndex !== void 0 ? tabIndex : void 0,
|
|
241
|
+
"data-testid": dataTestId || testID,
|
|
167
242
|
...props,
|
|
168
243
|
children
|
|
169
244
|
}
|
|
@@ -175,7 +250,8 @@ Box.displayName = "Box";
|
|
|
175
250
|
// ../primitives-web/src/Text.tsx
|
|
176
251
|
import styled2 from "styled-components";
|
|
177
252
|
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
178
|
-
var
|
|
253
|
+
var FilteredSpan = createFilteredElement("span");
|
|
254
|
+
var StyledText = styled2(FilteredSpan)`
|
|
179
255
|
color: ${(props) => props.color || "inherit"};
|
|
180
256
|
font-size: ${(props) => typeof props.fontSize === "number" ? `${props.fontSize}px` : props.fontSize || "inherit"};
|
|
181
257
|
font-weight: ${(props) => props.fontWeight || "normal"};
|
|
@@ -216,7 +292,8 @@ var rotate = keyframes`
|
|
|
216
292
|
transform: rotate(360deg);
|
|
217
293
|
}
|
|
218
294
|
`;
|
|
219
|
-
var
|
|
295
|
+
var FilteredDiv2 = createFilteredElement("div");
|
|
296
|
+
var StyledSpinner = styled3(FilteredDiv2)`
|
|
220
297
|
width: ${(props) => typeof props.size === "number" ? `${props.size}px` : props.size || "24px"};
|
|
221
298
|
height: ${(props) => typeof props.size === "number" ? `${props.size}px` : props.size || "24px"};
|
|
222
299
|
border: ${(props) => props.strokeWidth || 2}px solid
|
|
@@ -252,7 +329,8 @@ Spinner.displayName = "Spinner";
|
|
|
252
329
|
// ../primitives-web/src/Icon.tsx
|
|
253
330
|
import styled4 from "styled-components";
|
|
254
331
|
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
255
|
-
var
|
|
332
|
+
var FilteredDiv3 = createFilteredElement("div");
|
|
333
|
+
var StyledIcon = styled4(FilteredDiv3)`
|
|
256
334
|
display: flex;
|
|
257
335
|
align-items: center;
|
|
258
336
|
justify-content: center;
|
|
@@ -275,10 +353,10 @@ var Icon = ({ children, ...props }) => {
|
|
|
275
353
|
import { useResolvedTheme } from "@xsolla/xui-core";
|
|
276
354
|
import { jsx as jsx5, jsxs } from "react/jsx-runtime";
|
|
277
355
|
var cloneIconWithDefaults = (icon, defaultSize, defaultColor) => {
|
|
278
|
-
if (!
|
|
356
|
+
if (!React3.isValidElement(icon)) return icon;
|
|
279
357
|
const iconElement = icon;
|
|
280
358
|
const existingProps = iconElement.props || {};
|
|
281
|
-
return
|
|
359
|
+
return React3.cloneElement(iconElement, {
|
|
282
360
|
...existingProps,
|
|
283
361
|
// Preserve existing props (including accessibility attributes)
|
|
284
362
|
size: existingProps.size ?? defaultSize,
|
|
@@ -505,14 +583,14 @@ var Button = ({
|
|
|
505
583
|
Button.displayName = "Button";
|
|
506
584
|
|
|
507
585
|
// src/IconButton.tsx
|
|
508
|
-
import
|
|
586
|
+
import React4, { useState as useState2 } from "react";
|
|
509
587
|
import { useResolvedTheme as useResolvedTheme2 } from "@xsolla/xui-core";
|
|
510
588
|
import { jsx as jsx6, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
511
589
|
var cloneIconWithDefaults2 = (icon, defaultSize, defaultColor) => {
|
|
512
|
-
if (!
|
|
590
|
+
if (!React4.isValidElement(icon)) return icon;
|
|
513
591
|
const iconElement = icon;
|
|
514
592
|
const existingProps = iconElement.props || {};
|
|
515
|
-
return
|
|
593
|
+
return React4.cloneElement(iconElement, {
|
|
516
594
|
...existingProps,
|
|
517
595
|
// Preserve existing props (including accessibility attributes)
|
|
518
596
|
size: existingProps.size ?? defaultSize,
|
|
@@ -1016,14 +1094,14 @@ var FlexButton = ({
|
|
|
1016
1094
|
FlexButton.displayName = "FlexButton";
|
|
1017
1095
|
|
|
1018
1096
|
// src/AppButton.tsx
|
|
1019
|
-
import
|
|
1097
|
+
import React6, { useState as useState4 } from "react";
|
|
1020
1098
|
import { useResolvedTheme as useResolvedTheme4 } from "@xsolla/xui-core";
|
|
1021
1099
|
import { jsx as jsx8, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
1022
1100
|
var cloneIconWithDefaults3 = (icon, defaultSize, defaultColor) => {
|
|
1023
|
-
if (!
|
|
1101
|
+
if (!React6.isValidElement(icon)) return icon;
|
|
1024
1102
|
const iconElement = icon;
|
|
1025
1103
|
const existingProps = iconElement.props || {};
|
|
1026
|
-
return
|
|
1104
|
+
return React6.cloneElement(iconElement, {
|
|
1027
1105
|
...existingProps,
|
|
1028
1106
|
size: existingProps.size ?? defaultSize,
|
|
1029
1107
|
color: existingProps.color ?? defaultColor
|
|
@@ -1239,7 +1317,7 @@ var AppButton = ({
|
|
|
1239
1317
|
AppButton.displayName = "AppButton";
|
|
1240
1318
|
|
|
1241
1319
|
// src/ButtonGroup.tsx
|
|
1242
|
-
import
|
|
1320
|
+
import React7 from "react";
|
|
1243
1321
|
import { useResolvedTheme as useResolvedTheme5 } from "@xsolla/xui-core";
|
|
1244
1322
|
import { Fragment as Fragment2, jsx as jsx9, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1245
1323
|
var ButtonGroup = ({
|
|
@@ -1260,8 +1338,8 @@ var ButtonGroup = ({
|
|
|
1260
1338
|
const { theme } = useResolvedTheme5({ themeMode, themeProductContext });
|
|
1261
1339
|
const flattenChildren = (children2) => {
|
|
1262
1340
|
const result = [];
|
|
1263
|
-
|
|
1264
|
-
if (
|
|
1341
|
+
React7.Children.forEach(children2, (child) => {
|
|
1342
|
+
if (React7.isValidElement(child) && child.type === React7.Fragment) {
|
|
1265
1343
|
result.push(...flattenChildren(child.props.children));
|
|
1266
1344
|
} else if (child !== null && child !== void 0) {
|
|
1267
1345
|
result.push(child);
|
|
@@ -1296,12 +1374,12 @@ var ButtonGroup = ({
|
|
|
1296
1374
|
].filter(Boolean).join(" ") || void 0;
|
|
1297
1375
|
const processChildren = (childrenToProcess) => {
|
|
1298
1376
|
if (orientation === "vertical") {
|
|
1299
|
-
return childrenToProcess.map((child,
|
|
1300
|
-
if (
|
|
1301
|
-
return
|
|
1377
|
+
return childrenToProcess.map((child, index2) => {
|
|
1378
|
+
if (React7.isValidElement(child)) {
|
|
1379
|
+
return React7.cloneElement(child, {
|
|
1302
1380
|
...child.props,
|
|
1303
1381
|
fullWidth: true,
|
|
1304
|
-
key: child.key ??
|
|
1382
|
+
key: child.key ?? index2
|
|
1305
1383
|
});
|
|
1306
1384
|
}
|
|
1307
1385
|
return child;
|