@xsolla/xui-input-phone 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/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,82 @@ 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
+
16
+ // ../../node_modules/@emotion/memoize/dist/memoize.esm.js
17
+ function memoize(fn) {
18
+ var cache = {};
19
+ return function(arg) {
20
+ if (cache[arg] === void 0) cache[arg] = fn(arg);
21
+ return cache[arg];
22
+ };
23
+ }
24
+ var memoize_esm_default = memoize;
25
+
26
+ // ../../node_modules/@emotion/is-prop-valid/dist/is-prop-valid.esm.js
27
+ 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)-.*))$/;
28
+ var index = memoize_esm_default(
29
+ function(prop) {
30
+ return reactPropsRegex.test(prop) || prop.charCodeAt(0) === 111 && prop.charCodeAt(1) === 110 && prop.charCodeAt(2) < 91;
31
+ }
32
+ /* Z+1 */
33
+ );
34
+ var is_prop_valid_esm_default = index;
35
+
36
+ // ../primitives-web/src/filterDOMProps.ts
37
+ var ADDITIONAL_BLOCKED_PROPS = /* @__PURE__ */ new Set([
38
+ // RN-only event handlers (pass isPropValid's on* pattern)
39
+ "onPress",
40
+ "onChangeText",
41
+ "onLayout",
42
+ "onMoveShouldSetResponder",
43
+ "onResponderGrant",
44
+ "onResponderMove",
45
+ "onResponderRelease",
46
+ "onResponderTerminate",
47
+ // SVG attributes that pass isPropValid
48
+ "strokeWidth",
49
+ // CSS properties that pass isPropValid but are used as component props
50
+ "overflow",
51
+ "cursor",
52
+ "fontSize",
53
+ "fontWeight",
54
+ "fontFamily",
55
+ "textDecoration"
56
+ ]);
57
+ function shouldForwardProp(key) {
58
+ if (ADDITIONAL_BLOCKED_PROPS.has(key)) return false;
59
+ return is_prop_valid_esm_default(key);
60
+ }
61
+ function createFilteredElement(defaultTag) {
62
+ const Component = React.forwardRef(
63
+ ({ children, elementType, ...props }, ref) => {
64
+ const Tag = elementType || defaultTag;
65
+ const htmlProps = {};
66
+ for (const key of Object.keys(props)) {
67
+ if (shouldForwardProp(key)) {
68
+ htmlProps[key] = props[key];
69
+ }
70
+ }
71
+ return React.createElement(
72
+ Tag,
73
+ { ref, ...htmlProps },
74
+ children
75
+ );
76
+ }
77
+ );
78
+ Component.displayName = `Filtered(${defaultTag})`;
79
+ return Component;
80
+ }
81
+
82
+ // ../primitives-web/src/Box.tsx
12
83
  import { jsx } from "react/jsx-runtime";
13
- var StyledBox = styled.div`
84
+ var FilteredDiv = createFilteredElement("div");
85
+ var StyledBox = styled(FilteredDiv)`
14
86
  display: flex;
15
87
  box-sizing: border-box;
16
88
  background-color: ${(props) => props.backgroundColor || "transparent"};
@@ -97,7 +169,7 @@ var StyledBox = styled.div`
97
169
  ${(props) => props.pressStyle?.backgroundColor && `background-color: ${props.pressStyle.backgroundColor};`}
98
170
  }
99
171
  `;
100
- var Box = React.forwardRef(
172
+ var Box = React2.forwardRef(
101
173
  ({
102
174
  children,
103
175
  onPress,
@@ -122,6 +194,8 @@ var Box = React.forwardRef(
122
194
  type,
123
195
  disabled,
124
196
  id,
197
+ testID,
198
+ "data-testid": dataTestId,
125
199
  ...props
126
200
  }, ref) => {
127
201
  if (as === "img" && src) {
@@ -149,7 +223,7 @@ var Box = React.forwardRef(
149
223
  StyledBox,
150
224
  {
151
225
  ref,
152
- as,
226
+ elementType: as,
153
227
  id,
154
228
  type: as === "button" ? type || "button" : void 0,
155
229
  disabled: as === "button" ? disabled : void 0,
@@ -169,6 +243,7 @@ var Box = React.forwardRef(
169
243
  "aria-controls": ariaControls,
170
244
  "aria-live": ariaLive,
171
245
  tabIndex: tabIndex !== void 0 ? tabIndex : void 0,
246
+ "data-testid": dataTestId || testID,
172
247
  ...props,
173
248
  children
174
249
  }
@@ -180,7 +255,8 @@ Box.displayName = "Box";
180
255
  // ../primitives-web/src/Text.tsx
181
256
  import styled2 from "styled-components";
182
257
  import { jsx as jsx2 } from "react/jsx-runtime";
183
- var StyledText = styled2.span`
258
+ var FilteredSpan = createFilteredElement("span");
259
+ var StyledText = styled2(FilteredSpan)`
184
260
  color: ${(props) => props.color || "inherit"};
185
261
  font-size: ${(props) => typeof props.fontSize === "number" ? `${props.fontSize}px` : props.fontSize || "inherit"};
186
262
  font-weight: ${(props) => props.fontWeight || "normal"};
@@ -213,7 +289,8 @@ var Text = ({
213
289
  // ../primitives-web/src/Icon.tsx
214
290
  import styled3 from "styled-components";
215
291
  import { jsx as jsx3 } from "react/jsx-runtime";
216
- var StyledIcon = styled3.div`
292
+ var FilteredDiv2 = createFilteredElement("div");
293
+ var StyledIcon = styled3(FilteredDiv2)`
217
294
  display: flex;
218
295
  align-items: center;
219
296
  justify-content: center;
@@ -236,7 +313,8 @@ var Icon = ({ children, ...props }) => {
236
313
  import { forwardRef } from "react";
237
314
  import styled4 from "styled-components";
238
315
  import { jsx as jsx4 } from "react/jsx-runtime";
239
- var StyledInput = styled4.input`
316
+ var FilteredInput = createFilteredElement("input");
317
+ var StyledInput = styled4(FilteredInput)`
240
318
  background: transparent;
241
319
  border: none;
242
320
  outline: none;
@@ -2304,7 +2382,7 @@ var InputPhone = forwardRef2(
2304
2382
  const inputId = providedId || `input-phone-${safeId}`;
2305
2383
  const errorId = `${inputId}-error`;
2306
2384
  const dropdownId = `${inputId}-dropdown`;
2307
- React3.useImperativeHandle(
2385
+ React4.useImperativeHandle(
2308
2386
  ref,
2309
2387
  () => inputRef.current,
2310
2388
  []
@@ -2611,7 +2689,7 @@ var InputPhone = forwardRef2(
2611
2689
  borderColor: inputColors.borderHover
2612
2690
  } : void 0,
2613
2691
  children: [
2614
- selectedCountry?.flag ? /* @__PURE__ */ jsx258(Box, { width: flagSize, height: flagSize, children: React3.isValidElement(selectedCountry.flag) ? React3.cloneElement(
2692
+ selectedCountry?.flag ? /* @__PURE__ */ jsx258(Box, { width: flagSize, height: flagSize, children: React4.isValidElement(selectedCountry.flag) ? React4.cloneElement(
2615
2693
  selectedCountry.flag,
2616
2694
  { size: flagSize }
2617
2695
  ) : selectedCountry.flag }) : /* @__PURE__ */ jsx258(Location, { size: flagSize, variant: "line", color: iconColor }),
@@ -2831,13 +2909,13 @@ var InputPhone = forwardRef2(
2831
2909
  }
2832
2910
  )
2833
2911
  }
2834
- ) : filteredCountries.map((country, index) => {
2912
+ ) : filteredCountries.map((country, index2) => {
2835
2913
  const isSelected = selectedCountry?.code === country.code;
2836
2914
  const brandColors = theme.colors.control.brand.primary;
2837
2915
  const contentColors = theme.colors.content;
2838
2916
  const getBgColor = () => {
2839
2917
  if (isSelected) return brandColors.bg;
2840
- if (highlightedIndex === index)
2918
+ if (highlightedIndex === index2)
2841
2919
  return inputColors.bgHover;
2842
2920
  return "transparent";
2843
2921
  };
@@ -2872,7 +2950,7 @@ var InputPhone = forwardRef2(
2872
2950
  backgroundColor: inputColors.bgHover
2873
2951
  } : void 0,
2874
2952
  children: [
2875
- country.flag ? /* @__PURE__ */ jsx258(Box, { width: flagSize, height: flagSize, children: React3.isValidElement(country.flag) ? React3.cloneElement(
2953
+ country.flag ? /* @__PURE__ */ jsx258(Box, { width: flagSize, height: flagSize, children: React4.isValidElement(country.flag) ? React4.cloneElement(
2876
2954
  country.flag,
2877
2955
  { size: flagSize }
2878
2956
  ) : country.flag }) : /* @__PURE__ */ jsx258(