@xsolla/xui-select 0.132.0 → 0.133.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 +3 -3
- package/web/index.js +128 -19
- package/web/index.js.map +1 -1
- package/web/index.mjs +117 -8
- package/web/index.mjs.map +1 -1
package/web/index.mjs
CHANGED
|
@@ -1,11 +1,118 @@
|
|
|
1
1
|
// src/Select.tsx
|
|
2
|
-
import
|
|
2
|
+
import React3, { useState, useRef, useEffect } 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
|
+
var NON_HTML_PROPS = /* @__PURE__ */ new Set([
|
|
11
|
+
// BoxProps — layout & styling
|
|
12
|
+
"backgroundColor",
|
|
13
|
+
"borderColor",
|
|
14
|
+
"borderWidth",
|
|
15
|
+
"borderBottomWidth",
|
|
16
|
+
"borderBottomColor",
|
|
17
|
+
"borderTopWidth",
|
|
18
|
+
"borderTopColor",
|
|
19
|
+
"borderLeftWidth",
|
|
20
|
+
"borderLeftColor",
|
|
21
|
+
"borderRightWidth",
|
|
22
|
+
"borderRightColor",
|
|
23
|
+
"borderRadius",
|
|
24
|
+
"borderStyle",
|
|
25
|
+
"flexDirection",
|
|
26
|
+
"flexWrap",
|
|
27
|
+
"alignItems",
|
|
28
|
+
"justifyContent",
|
|
29
|
+
"alignSelf",
|
|
30
|
+
"flex",
|
|
31
|
+
"flexShrink",
|
|
32
|
+
"gap",
|
|
33
|
+
"position",
|
|
34
|
+
"top",
|
|
35
|
+
"bottom",
|
|
36
|
+
"left",
|
|
37
|
+
"right",
|
|
38
|
+
"outline",
|
|
39
|
+
"overflow",
|
|
40
|
+
"overflowX",
|
|
41
|
+
"overflowY",
|
|
42
|
+
"zIndex",
|
|
43
|
+
"cursor",
|
|
44
|
+
"padding",
|
|
45
|
+
"paddingHorizontal",
|
|
46
|
+
"paddingVertical",
|
|
47
|
+
"paddingTop",
|
|
48
|
+
"paddingBottom",
|
|
49
|
+
"paddingLeft",
|
|
50
|
+
"paddingRight",
|
|
51
|
+
"margin",
|
|
52
|
+
"marginTop",
|
|
53
|
+
"marginBottom",
|
|
54
|
+
"marginLeft",
|
|
55
|
+
"marginRight",
|
|
56
|
+
"minWidth",
|
|
57
|
+
"minHeight",
|
|
58
|
+
"maxWidth",
|
|
59
|
+
"maxHeight",
|
|
60
|
+
"hoverStyle",
|
|
61
|
+
"pressStyle",
|
|
62
|
+
"focusStyle",
|
|
63
|
+
"outlineColor",
|
|
64
|
+
"outlineWidth",
|
|
65
|
+
"outlineOffset",
|
|
66
|
+
"outlineStyle",
|
|
67
|
+
// BoxProps — RN-only
|
|
68
|
+
"onPress",
|
|
69
|
+
"onLayout",
|
|
70
|
+
"onMoveShouldSetResponder",
|
|
71
|
+
"onResponderGrant",
|
|
72
|
+
"onResponderMove",
|
|
73
|
+
"onResponderRelease",
|
|
74
|
+
"onResponderTerminate",
|
|
75
|
+
"testID",
|
|
76
|
+
// Box — custom element type
|
|
77
|
+
"elementType",
|
|
78
|
+
// TextProps
|
|
79
|
+
"fontSize",
|
|
80
|
+
"fontWeight",
|
|
81
|
+
"fontFamily",
|
|
82
|
+
"lineHeight",
|
|
83
|
+
"whiteSpace",
|
|
84
|
+
"textAlign",
|
|
85
|
+
"textDecoration",
|
|
86
|
+
"numberOfLines",
|
|
87
|
+
"letterSpacing",
|
|
88
|
+
"textTransform",
|
|
89
|
+
// SpinnerProps
|
|
90
|
+
"strokeWidth",
|
|
91
|
+
// DividerProps
|
|
92
|
+
"vertical",
|
|
93
|
+
"dashStroke"
|
|
94
|
+
]);
|
|
95
|
+
function createFilteredElement(defaultTag) {
|
|
96
|
+
const Component = React.forwardRef(
|
|
97
|
+
({ children, elementType, ...props }, ref) => {
|
|
98
|
+
const Tag = elementType || defaultTag;
|
|
99
|
+
const htmlProps = {};
|
|
100
|
+
for (const key of Object.keys(props)) {
|
|
101
|
+
if (!NON_HTML_PROPS.has(key)) {
|
|
102
|
+
htmlProps[key] = props[key];
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
return React.createElement(Tag, { ref, ...htmlProps }, children);
|
|
106
|
+
}
|
|
107
|
+
);
|
|
108
|
+
Component.displayName = `Filtered(${defaultTag})`;
|
|
109
|
+
return Component;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
// ../primitives-web/src/Box.tsx
|
|
7
113
|
import { jsx } from "react/jsx-runtime";
|
|
8
|
-
var
|
|
114
|
+
var FilteredDiv = createFilteredElement("div");
|
|
115
|
+
var StyledBox = styled(FilteredDiv)`
|
|
9
116
|
display: flex;
|
|
10
117
|
box-sizing: border-box;
|
|
11
118
|
background-color: ${(props) => props.backgroundColor || "transparent"};
|
|
@@ -92,7 +199,7 @@ var StyledBox = styled.div`
|
|
|
92
199
|
${(props) => props.pressStyle?.backgroundColor && `background-color: ${props.pressStyle.backgroundColor};`}
|
|
93
200
|
}
|
|
94
201
|
`;
|
|
95
|
-
var Box =
|
|
202
|
+
var Box = React2.forwardRef(
|
|
96
203
|
({
|
|
97
204
|
children,
|
|
98
205
|
onPress,
|
|
@@ -144,7 +251,7 @@ var Box = React.forwardRef(
|
|
|
144
251
|
StyledBox,
|
|
145
252
|
{
|
|
146
253
|
ref,
|
|
147
|
-
as,
|
|
254
|
+
elementType: as,
|
|
148
255
|
id,
|
|
149
256
|
type: as === "button" ? type || "button" : void 0,
|
|
150
257
|
disabled: as === "button" ? disabled : void 0,
|
|
@@ -175,7 +282,8 @@ Box.displayName = "Box";
|
|
|
175
282
|
// ../primitives-web/src/Text.tsx
|
|
176
283
|
import styled2 from "styled-components";
|
|
177
284
|
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
178
|
-
var
|
|
285
|
+
var FilteredSpan = createFilteredElement("span");
|
|
286
|
+
var StyledText = styled2(FilteredSpan)`
|
|
179
287
|
color: ${(props) => props.color || "inherit"};
|
|
180
288
|
font-size: ${(props) => typeof props.fontSize === "number" ? `${props.fontSize}px` : props.fontSize || "inherit"};
|
|
181
289
|
font-weight: ${(props) => props.fontWeight || "normal"};
|
|
@@ -208,7 +316,8 @@ var Text = ({
|
|
|
208
316
|
// ../primitives-web/src/Icon.tsx
|
|
209
317
|
import styled3 from "styled-components";
|
|
210
318
|
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
211
|
-
var
|
|
319
|
+
var FilteredDiv2 = createFilteredElement("div");
|
|
320
|
+
var StyledIcon = styled3(FilteredDiv2)`
|
|
212
321
|
display: flex;
|
|
213
322
|
align-items: center;
|
|
214
323
|
justify-content: center;
|
|
@@ -713,7 +822,7 @@ var Select = ({
|
|
|
713
822
|
const isDisable = externalState === "disable" || disabled;
|
|
714
823
|
const isError = externalState === "error" || !!errorMessage;
|
|
715
824
|
const isFocus = externalState === "focus" || isOpen;
|
|
716
|
-
|
|
825
|
+
React3.useEffect(() => {
|
|
717
826
|
if (value !== void 0) {
|
|
718
827
|
setSelectedValue(value);
|
|
719
828
|
}
|