@xsolla/xui-input-phone 0.131.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/web/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  // src/InputPhone.tsx
2
- import React3, {
2
+ import React4, {
3
3
  useState,
4
4
  forwardRef as forwardRef2,
5
5
  useRef,
@@ -7,10 +7,117 @@ import React3, {
7
7
  } from "react";
8
8
 
9
9
  // ../primitives-web/src/Box.tsx
10
- import React from "react";
10
+ import React2 from "react";
11
11
  import styled from "styled-components";
12
+
13
+ // ../primitives-web/src/filterDOMProps.ts
14
+ import React from "react";
15
+ var NON_HTML_PROPS = /* @__PURE__ */ new Set([
16
+ // BoxProps — layout & styling
17
+ "backgroundColor",
18
+ "borderColor",
19
+ "borderWidth",
20
+ "borderBottomWidth",
21
+ "borderBottomColor",
22
+ "borderTopWidth",
23
+ "borderTopColor",
24
+ "borderLeftWidth",
25
+ "borderLeftColor",
26
+ "borderRightWidth",
27
+ "borderRightColor",
28
+ "borderRadius",
29
+ "borderStyle",
30
+ "flexDirection",
31
+ "flexWrap",
32
+ "alignItems",
33
+ "justifyContent",
34
+ "alignSelf",
35
+ "flex",
36
+ "flexShrink",
37
+ "gap",
38
+ "position",
39
+ "top",
40
+ "bottom",
41
+ "left",
42
+ "right",
43
+ "outline",
44
+ "overflow",
45
+ "overflowX",
46
+ "overflowY",
47
+ "zIndex",
48
+ "cursor",
49
+ "padding",
50
+ "paddingHorizontal",
51
+ "paddingVertical",
52
+ "paddingTop",
53
+ "paddingBottom",
54
+ "paddingLeft",
55
+ "paddingRight",
56
+ "margin",
57
+ "marginTop",
58
+ "marginBottom",
59
+ "marginLeft",
60
+ "marginRight",
61
+ "minWidth",
62
+ "minHeight",
63
+ "maxWidth",
64
+ "maxHeight",
65
+ "hoverStyle",
66
+ "pressStyle",
67
+ "focusStyle",
68
+ "outlineColor",
69
+ "outlineWidth",
70
+ "outlineOffset",
71
+ "outlineStyle",
72
+ // BoxProps — RN-only
73
+ "onPress",
74
+ "onLayout",
75
+ "onMoveShouldSetResponder",
76
+ "onResponderGrant",
77
+ "onResponderMove",
78
+ "onResponderRelease",
79
+ "onResponderTerminate",
80
+ "testID",
81
+ // Box — custom element type
82
+ "elementType",
83
+ // TextProps
84
+ "fontSize",
85
+ "fontWeight",
86
+ "fontFamily",
87
+ "lineHeight",
88
+ "whiteSpace",
89
+ "textAlign",
90
+ "textDecoration",
91
+ "numberOfLines",
92
+ "letterSpacing",
93
+ "textTransform",
94
+ // SpinnerProps
95
+ "strokeWidth",
96
+ // DividerProps
97
+ "vertical",
98
+ "dashStroke"
99
+ ]);
100
+ function createFilteredElement(defaultTag) {
101
+ const Component = React.forwardRef(
102
+ ({ children, elementType, ...props }, ref) => {
103
+ const Tag = elementType || defaultTag;
104
+ const htmlProps = {};
105
+ for (const key of Object.keys(props)) {
106
+ if (!NON_HTML_PROPS.has(key)) {
107
+ htmlProps[key] = props[key];
108
+ }
109
+ }
110
+ return React.createElement(Tag, { ref, ...htmlProps }, children);
111
+ }
112
+ );
113
+ Component.displayName = `Filtered(${defaultTag})`;
114
+ return Component;
115
+ }
116
+
117
+ // ../primitives-web/src/Box.tsx
12
118
  import { jsx } from "react/jsx-runtime";
13
- var StyledBox = styled.div`
119
+ var FilteredDiv = createFilteredElement("div");
120
+ var StyledBox = styled(FilteredDiv)`
14
121
  display: flex;
15
122
  box-sizing: border-box;
16
123
  background-color: ${(props) => props.backgroundColor || "transparent"};
@@ -97,7 +204,7 @@ var StyledBox = styled.div`
97
204
  ${(props) => props.pressStyle?.backgroundColor && `background-color: ${props.pressStyle.backgroundColor};`}
98
205
  }
99
206
  `;
100
- var Box = React.forwardRef(
207
+ var Box = React2.forwardRef(
101
208
  ({
102
209
  children,
103
210
  onPress,
@@ -149,7 +256,7 @@ var Box = React.forwardRef(
149
256
  StyledBox,
150
257
  {
151
258
  ref,
152
- as,
259
+ elementType: as,
153
260
  id,
154
261
  type: as === "button" ? type || "button" : void 0,
155
262
  disabled: as === "button" ? disabled : void 0,
@@ -180,7 +287,8 @@ Box.displayName = "Box";
180
287
  // ../primitives-web/src/Text.tsx
181
288
  import styled2 from "styled-components";
182
289
  import { jsx as jsx2 } from "react/jsx-runtime";
183
- var StyledText = styled2.span`
290
+ var FilteredSpan = createFilteredElement("span");
291
+ var StyledText = styled2(FilteredSpan)`
184
292
  color: ${(props) => props.color || "inherit"};
185
293
  font-size: ${(props) => typeof props.fontSize === "number" ? `${props.fontSize}px` : props.fontSize || "inherit"};
186
294
  font-weight: ${(props) => props.fontWeight || "normal"};
@@ -213,7 +321,8 @@ var Text = ({
213
321
  // ../primitives-web/src/Icon.tsx
214
322
  import styled3 from "styled-components";
215
323
  import { jsx as jsx3 } from "react/jsx-runtime";
216
- var StyledIcon = styled3.div`
324
+ var FilteredDiv2 = createFilteredElement("div");
325
+ var StyledIcon = styled3(FilteredDiv2)`
217
326
  display: flex;
218
327
  align-items: center;
219
328
  justify-content: center;
@@ -2304,7 +2413,7 @@ var InputPhone = forwardRef2(
2304
2413
  const inputId = providedId || `input-phone-${safeId}`;
2305
2414
  const errorId = `${inputId}-error`;
2306
2415
  const dropdownId = `${inputId}-dropdown`;
2307
- React3.useImperativeHandle(
2416
+ React4.useImperativeHandle(
2308
2417
  ref,
2309
2418
  () => inputRef.current,
2310
2419
  []
@@ -2611,7 +2720,7 @@ var InputPhone = forwardRef2(
2611
2720
  borderColor: inputColors.borderHover
2612
2721
  } : void 0,
2613
2722
  children: [
2614
- selectedCountry?.flag ? /* @__PURE__ */ jsx258(Box, { width: flagSize, height: flagSize, children: React3.isValidElement(selectedCountry.flag) ? React3.cloneElement(
2723
+ selectedCountry?.flag ? /* @__PURE__ */ jsx258(Box, { width: flagSize, height: flagSize, children: React4.isValidElement(selectedCountry.flag) ? React4.cloneElement(
2615
2724
  selectedCountry.flag,
2616
2725
  { size: flagSize }
2617
2726
  ) : selectedCountry.flag }) : /* @__PURE__ */ jsx258(Location, { size: flagSize, variant: "line", color: iconColor }),
@@ -2872,7 +2981,7 @@ var InputPhone = forwardRef2(
2872
2981
  backgroundColor: inputColors.bgHover
2873
2982
  } : void 0,
2874
2983
  children: [
2875
- country.flag ? /* @__PURE__ */ jsx258(Box, { width: flagSize, height: flagSize, children: React3.isValidElement(country.flag) ? React3.cloneElement(
2984
+ country.flag ? /* @__PURE__ */ jsx258(Box, { width: flagSize, height: flagSize, children: React4.isValidElement(country.flag) ? React4.cloneElement(
2876
2985
  country.flag,
2877
2986
  { size: flagSize }
2878
2987
  ) : country.flag }) : /* @__PURE__ */ jsx258(