@xsolla/xui-select 0.133.0 → 0.135.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 +19 -128
- package/web/index.js.map +1 -1
- package/web/index.mjs +8 -117
- package/web/index.mjs.map +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xsolla/xui-select",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.135.0",
|
|
4
4
|
"main": "./web/index.js",
|
|
5
5
|
"module": "./web/index.mjs",
|
|
6
6
|
"types": "./web/index.d.ts",
|
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
"test:coverage": "vitest run --coverage"
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@xsolla/xui-core": "0.
|
|
17
|
-
"@xsolla/xui-primitives-core": "0.
|
|
16
|
+
"@xsolla/xui-core": "0.135.0",
|
|
17
|
+
"@xsolla/xui-primitives-core": "0.135.0"
|
|
18
18
|
},
|
|
19
19
|
"peerDependencies": {
|
|
20
20
|
"react": ">=16.8.0",
|
package/web/index.js
CHANGED
|
@@ -35,120 +35,13 @@ __export(index_exports, {
|
|
|
35
35
|
module.exports = __toCommonJS(index_exports);
|
|
36
36
|
|
|
37
37
|
// src/Select.tsx
|
|
38
|
-
var import_react3 = __toESM(require("react"));
|
|
39
|
-
|
|
40
|
-
// ../primitives-web/src/Box.tsx
|
|
41
38
|
var import_react2 = __toESM(require("react"));
|
|
42
|
-
var import_styled_components = __toESM(require("styled-components"));
|
|
43
|
-
|
|
44
|
-
// ../primitives-web/src/filterDOMProps.ts
|
|
45
|
-
var import_react = __toESM(require("react"));
|
|
46
|
-
var NON_HTML_PROPS = /* @__PURE__ */ new Set([
|
|
47
|
-
// BoxProps — layout & styling
|
|
48
|
-
"backgroundColor",
|
|
49
|
-
"borderColor",
|
|
50
|
-
"borderWidth",
|
|
51
|
-
"borderBottomWidth",
|
|
52
|
-
"borderBottomColor",
|
|
53
|
-
"borderTopWidth",
|
|
54
|
-
"borderTopColor",
|
|
55
|
-
"borderLeftWidth",
|
|
56
|
-
"borderLeftColor",
|
|
57
|
-
"borderRightWidth",
|
|
58
|
-
"borderRightColor",
|
|
59
|
-
"borderRadius",
|
|
60
|
-
"borderStyle",
|
|
61
|
-
"flexDirection",
|
|
62
|
-
"flexWrap",
|
|
63
|
-
"alignItems",
|
|
64
|
-
"justifyContent",
|
|
65
|
-
"alignSelf",
|
|
66
|
-
"flex",
|
|
67
|
-
"flexShrink",
|
|
68
|
-
"gap",
|
|
69
|
-
"position",
|
|
70
|
-
"top",
|
|
71
|
-
"bottom",
|
|
72
|
-
"left",
|
|
73
|
-
"right",
|
|
74
|
-
"outline",
|
|
75
|
-
"overflow",
|
|
76
|
-
"overflowX",
|
|
77
|
-
"overflowY",
|
|
78
|
-
"zIndex",
|
|
79
|
-
"cursor",
|
|
80
|
-
"padding",
|
|
81
|
-
"paddingHorizontal",
|
|
82
|
-
"paddingVertical",
|
|
83
|
-
"paddingTop",
|
|
84
|
-
"paddingBottom",
|
|
85
|
-
"paddingLeft",
|
|
86
|
-
"paddingRight",
|
|
87
|
-
"margin",
|
|
88
|
-
"marginTop",
|
|
89
|
-
"marginBottom",
|
|
90
|
-
"marginLeft",
|
|
91
|
-
"marginRight",
|
|
92
|
-
"minWidth",
|
|
93
|
-
"minHeight",
|
|
94
|
-
"maxWidth",
|
|
95
|
-
"maxHeight",
|
|
96
|
-
"hoverStyle",
|
|
97
|
-
"pressStyle",
|
|
98
|
-
"focusStyle",
|
|
99
|
-
"outlineColor",
|
|
100
|
-
"outlineWidth",
|
|
101
|
-
"outlineOffset",
|
|
102
|
-
"outlineStyle",
|
|
103
|
-
// BoxProps — RN-only
|
|
104
|
-
"onPress",
|
|
105
|
-
"onLayout",
|
|
106
|
-
"onMoveShouldSetResponder",
|
|
107
|
-
"onResponderGrant",
|
|
108
|
-
"onResponderMove",
|
|
109
|
-
"onResponderRelease",
|
|
110
|
-
"onResponderTerminate",
|
|
111
|
-
"testID",
|
|
112
|
-
// Box — custom element type
|
|
113
|
-
"elementType",
|
|
114
|
-
// TextProps
|
|
115
|
-
"fontSize",
|
|
116
|
-
"fontWeight",
|
|
117
|
-
"fontFamily",
|
|
118
|
-
"lineHeight",
|
|
119
|
-
"whiteSpace",
|
|
120
|
-
"textAlign",
|
|
121
|
-
"textDecoration",
|
|
122
|
-
"numberOfLines",
|
|
123
|
-
"letterSpacing",
|
|
124
|
-
"textTransform",
|
|
125
|
-
// SpinnerProps
|
|
126
|
-
"strokeWidth",
|
|
127
|
-
// DividerProps
|
|
128
|
-
"vertical",
|
|
129
|
-
"dashStroke"
|
|
130
|
-
]);
|
|
131
|
-
function createFilteredElement(defaultTag) {
|
|
132
|
-
const Component = import_react.default.forwardRef(
|
|
133
|
-
({ children, elementType, ...props }, ref) => {
|
|
134
|
-
const Tag = elementType || defaultTag;
|
|
135
|
-
const htmlProps = {};
|
|
136
|
-
for (const key of Object.keys(props)) {
|
|
137
|
-
if (!NON_HTML_PROPS.has(key)) {
|
|
138
|
-
htmlProps[key] = props[key];
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
return import_react.default.createElement(Tag, { ref, ...htmlProps }, children);
|
|
142
|
-
}
|
|
143
|
-
);
|
|
144
|
-
Component.displayName = `Filtered(${defaultTag})`;
|
|
145
|
-
return Component;
|
|
146
|
-
}
|
|
147
39
|
|
|
148
40
|
// ../primitives-web/src/Box.tsx
|
|
41
|
+
var import_react = __toESM(require("react"));
|
|
42
|
+
var import_styled_components = __toESM(require("styled-components"));
|
|
149
43
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
150
|
-
var
|
|
151
|
-
var StyledBox = (0, import_styled_components.default)(FilteredDiv)`
|
|
44
|
+
var StyledBox = import_styled_components.default.div`
|
|
152
45
|
display: flex;
|
|
153
46
|
box-sizing: border-box;
|
|
154
47
|
background-color: ${(props) => props.backgroundColor || "transparent"};
|
|
@@ -235,7 +128,7 @@ var StyledBox = (0, import_styled_components.default)(FilteredDiv)`
|
|
|
235
128
|
${(props) => props.pressStyle?.backgroundColor && `background-color: ${props.pressStyle.backgroundColor};`}
|
|
236
129
|
}
|
|
237
130
|
`;
|
|
238
|
-
var Box =
|
|
131
|
+
var Box = import_react.default.forwardRef(
|
|
239
132
|
({
|
|
240
133
|
children,
|
|
241
134
|
onPress,
|
|
@@ -287,7 +180,7 @@ var Box = import_react2.default.forwardRef(
|
|
|
287
180
|
StyledBox,
|
|
288
181
|
{
|
|
289
182
|
ref,
|
|
290
|
-
|
|
183
|
+
as,
|
|
291
184
|
id,
|
|
292
185
|
type: as === "button" ? type || "button" : void 0,
|
|
293
186
|
disabled: as === "button" ? disabled : void 0,
|
|
@@ -318,8 +211,7 @@ Box.displayName = "Box";
|
|
|
318
211
|
// ../primitives-web/src/Text.tsx
|
|
319
212
|
var import_styled_components2 = __toESM(require("styled-components"));
|
|
320
213
|
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
321
|
-
var
|
|
322
|
-
var StyledText = (0, import_styled_components2.default)(FilteredSpan)`
|
|
214
|
+
var StyledText = import_styled_components2.default.span`
|
|
323
215
|
color: ${(props) => props.color || "inherit"};
|
|
324
216
|
font-size: ${(props) => typeof props.fontSize === "number" ? `${props.fontSize}px` : props.fontSize || "inherit"};
|
|
325
217
|
font-weight: ${(props) => props.fontWeight || "normal"};
|
|
@@ -352,8 +244,7 @@ var Text = ({
|
|
|
352
244
|
// ../primitives-web/src/Icon.tsx
|
|
353
245
|
var import_styled_components3 = __toESM(require("styled-components"));
|
|
354
246
|
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
355
|
-
var
|
|
356
|
-
var StyledIcon = (0, import_styled_components3.default)(FilteredDiv2)`
|
|
247
|
+
var StyledIcon = import_styled_components3.default.div`
|
|
357
248
|
display: flex;
|
|
358
249
|
align-items: center;
|
|
359
250
|
justify-content: center;
|
|
@@ -844,22 +735,22 @@ var Select = ({
|
|
|
844
735
|
themeProductContext
|
|
845
736
|
}) => {
|
|
846
737
|
const { theme } = (0, import_xui_core.useResolvedTheme)({ themeMode, themeProductContext });
|
|
847
|
-
const [isOpen, setIsOpen] = (0,
|
|
848
|
-
const [selectedValue, setSelectedValue] = (0,
|
|
849
|
-
const [searchValue, setSearchValue] = (0,
|
|
850
|
-
const containerRef = (0,
|
|
851
|
-
const dropdownRef = (0,
|
|
852
|
-
const selectedItemRef = (0,
|
|
853
|
-
const searchInputRef = (0,
|
|
738
|
+
const [isOpen, setIsOpen] = (0, import_react2.useState)(false);
|
|
739
|
+
const [selectedValue, setSelectedValue] = (0, import_react2.useState)(value);
|
|
740
|
+
const [searchValue, setSearchValue] = (0, import_react2.useState)("");
|
|
741
|
+
const containerRef = (0, import_react2.useRef)(null);
|
|
742
|
+
const dropdownRef = (0, import_react2.useRef)(null);
|
|
743
|
+
const selectedItemRef = (0, import_react2.useRef)(null);
|
|
744
|
+
const searchInputRef = (0, import_react2.useRef)(null);
|
|
854
745
|
const isDisable = externalState === "disable" || disabled;
|
|
855
746
|
const isError = externalState === "error" || !!errorMessage;
|
|
856
747
|
const isFocus = externalState === "focus" || isOpen;
|
|
857
|
-
|
|
748
|
+
import_react2.default.useEffect(() => {
|
|
858
749
|
if (value !== void 0) {
|
|
859
750
|
setSelectedValue(value);
|
|
860
751
|
}
|
|
861
752
|
}, [value]);
|
|
862
|
-
(0,
|
|
753
|
+
(0, import_react2.useEffect)(() => {
|
|
863
754
|
if (isFocus && selectedItemRef.current && dropdownRef.current) {
|
|
864
755
|
const timeoutId = setTimeout(() => {
|
|
865
756
|
const selectedItem = selectedItemRef.current;
|
|
@@ -870,17 +761,17 @@ var Select = ({
|
|
|
870
761
|
return () => clearTimeout(timeoutId);
|
|
871
762
|
}
|
|
872
763
|
}, [isFocus]);
|
|
873
|
-
(0,
|
|
764
|
+
(0, import_react2.useEffect)(() => {
|
|
874
765
|
if (isFocus && searchable) {
|
|
875
766
|
searchInputRef.current?.focus();
|
|
876
767
|
}
|
|
877
768
|
}, [isFocus, searchable]);
|
|
878
|
-
(0,
|
|
769
|
+
(0, import_react2.useEffect)(() => {
|
|
879
770
|
if (!isFocus) {
|
|
880
771
|
setSearchValue("");
|
|
881
772
|
}
|
|
882
773
|
}, [isFocus]);
|
|
883
|
-
(0,
|
|
774
|
+
(0, import_react2.useEffect)(() => {
|
|
884
775
|
if (import_xui_core.isNative || !isOpen) return;
|
|
885
776
|
const handleClickOutside = (event) => {
|
|
886
777
|
if (containerRef.current && !containerRef.current.contains(event.target)) {
|