@xsolla/xui-input-edit 0.176.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.js ADDED
@@ -0,0 +1,973 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // src/index.tsx
31
+ var index_exports = {};
32
+ __export(index_exports, {
33
+ InputEdit: () => InputEdit
34
+ });
35
+ module.exports = __toCommonJS(index_exports);
36
+
37
+ // src/InputEdit.tsx
38
+ var import_react4 = __toESM(require("react"));
39
+
40
+ // ../../foundation/primitives-web/src/Box.tsx
41
+ var import_react2 = __toESM(require("react"));
42
+ var import_styled_components = __toESM(require("styled-components"));
43
+
44
+ // ../../foundation/primitives-web/src/filterDOMProps.ts
45
+ var import_react = __toESM(require("react"));
46
+
47
+ // ../../../node_modules/@emotion/memoize/dist/memoize.esm.js
48
+ function memoize(fn) {
49
+ var cache = {};
50
+ return function(arg) {
51
+ if (cache[arg] === void 0) cache[arg] = fn(arg);
52
+ return cache[arg];
53
+ };
54
+ }
55
+ var memoize_esm_default = memoize;
56
+
57
+ // ../../../node_modules/@emotion/is-prop-valid/dist/is-prop-valid.esm.js
58
+ 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)-.*))$/;
59
+ var index = memoize_esm_default(
60
+ function(prop) {
61
+ return reactPropsRegex.test(prop) || prop.charCodeAt(0) === 111 && prop.charCodeAt(1) === 110 && prop.charCodeAt(2) < 91;
62
+ }
63
+ /* Z+1 */
64
+ );
65
+ var is_prop_valid_esm_default = index;
66
+
67
+ // ../../foundation/primitives-web/src/filterDOMProps.ts
68
+ var ADDITIONAL_BLOCKED_PROPS = /* @__PURE__ */ new Set([
69
+ // RN-only event handlers (pass isPropValid's on* pattern)
70
+ "onPress",
71
+ "onChangeText",
72
+ "onLayout",
73
+ "onMoveShouldSetResponder",
74
+ "onResponderGrant",
75
+ "onResponderMove",
76
+ "onResponderRelease",
77
+ "onResponderTerminate",
78
+ // SVG attributes that pass isPropValid
79
+ "strokeWidth",
80
+ // CSS properties that pass isPropValid but are used as component props
81
+ "overflow",
82
+ "cursor",
83
+ "fontSize",
84
+ "fontWeight",
85
+ "fontFamily",
86
+ "textDecoration"
87
+ ]);
88
+ function shouldForwardProp(key) {
89
+ if (ADDITIONAL_BLOCKED_PROPS.has(key)) return false;
90
+ return is_prop_valid_esm_default(key);
91
+ }
92
+ function createFilteredElement(defaultTag) {
93
+ const Component = import_react.default.forwardRef(
94
+ ({ children, elementType, ...props }, ref) => {
95
+ const Tag = elementType || defaultTag;
96
+ const htmlProps = {};
97
+ for (const key of Object.keys(props)) {
98
+ if (shouldForwardProp(key)) {
99
+ htmlProps[key] = props[key];
100
+ }
101
+ }
102
+ return import_react.default.createElement(
103
+ Tag,
104
+ { ref, ...htmlProps },
105
+ children
106
+ );
107
+ }
108
+ );
109
+ Component.displayName = `Filtered(${defaultTag})`;
110
+ return Component;
111
+ }
112
+
113
+ // ../../foundation/primitives-web/src/Box.tsx
114
+ var import_jsx_runtime = require("react/jsx-runtime");
115
+ var FilteredDiv = createFilteredElement("div");
116
+ var StyledBox = (0, import_styled_components.default)(FilteredDiv)`
117
+ display: flex;
118
+ box-sizing: border-box;
119
+ background-color: ${(props) => props.backgroundColor || "transparent"};
120
+ border-color: ${(props) => props.borderColor || "transparent"};
121
+ border-width: ${(props) => typeof props.borderWidth === "number" ? `${props.borderWidth}px` : props.borderWidth || 0};
122
+
123
+ ${(props) => props.borderBottomWidth !== void 0 && `
124
+ border-bottom-width: ${typeof props.borderBottomWidth === "number" ? `${props.borderBottomWidth}px` : props.borderBottomWidth};
125
+ border-bottom-color: ${props.borderBottomColor || props.borderColor || "transparent"};
126
+ border-bottom-style: solid;
127
+ `}
128
+ ${(props) => props.borderTopWidth !== void 0 && `
129
+ border-top-width: ${typeof props.borderTopWidth === "number" ? `${props.borderTopWidth}px` : props.borderTopWidth};
130
+ border-top-color: ${props.borderTopColor || props.borderColor || "transparent"};
131
+ border-top-style: solid;
132
+ `}
133
+ ${(props) => props.borderLeftWidth !== void 0 && `
134
+ border-left-width: ${typeof props.borderLeftWidth === "number" ? `${props.borderLeftWidth}px` : props.borderLeftWidth};
135
+ border-left-color: ${props.borderLeftColor || props.borderColor || "transparent"};
136
+ border-left-style: solid;
137
+ `}
138
+ ${(props) => props.borderRightWidth !== void 0 && `
139
+ border-right-width: ${typeof props.borderRightWidth === "number" ? `${props.borderRightWidth}px` : props.borderRightWidth};
140
+ border-right-color: ${props.borderRightColor || props.borderColor || "transparent"};
141
+ border-right-style: solid;
142
+ `}
143
+
144
+ border-style: ${(props) => props.borderStyle || (props.borderWidth || props.borderBottomWidth || props.borderTopWidth || props.borderLeftWidth || props.borderRightWidth ? "solid" : "none")};
145
+ border-radius: ${(props) => typeof props.borderRadius === "number" ? `${props.borderRadius}px` : props.borderRadius || 0};
146
+ height: ${(props) => typeof props.height === "number" ? `${props.height}px` : props.height || "auto"};
147
+ width: ${(props) => typeof props.width === "number" ? `${props.width}px` : props.width || "auto"};
148
+ min-width: ${(props) => typeof props.minWidth === "number" ? `${props.minWidth}px` : props.minWidth || "auto"};
149
+ min-height: ${(props) => typeof props.minHeight === "number" ? `${props.minHeight}px` : props.minHeight || "auto"};
150
+ max-width: ${(props) => typeof props.maxWidth === "number" ? `${props.maxWidth}px` : props.maxWidth || "none"};
151
+ max-height: ${(props) => typeof props.maxHeight === "number" ? `${props.maxHeight}px` : props.maxHeight || "none"};
152
+
153
+ padding: ${(props) => typeof props.padding === "number" ? `${props.padding}px` : props.padding || 0};
154
+ ${(props) => props.paddingHorizontal && `
155
+ padding-left: ${typeof props.paddingHorizontal === "number" ? `${props.paddingHorizontal}px` : props.paddingHorizontal};
156
+ padding-right: ${typeof props.paddingHorizontal === "number" ? `${props.paddingHorizontal}px` : props.paddingHorizontal};
157
+ `}
158
+ ${(props) => props.paddingVertical && `
159
+ padding-top: ${typeof props.paddingVertical === "number" ? `${props.paddingVertical}px` : props.paddingVertical};
160
+ padding-bottom: ${typeof props.paddingVertical === "number" ? `${props.paddingVertical}px` : props.paddingVertical};
161
+ `}
162
+ ${(props) => props.paddingTop !== void 0 && `padding-top: ${typeof props.paddingTop === "number" ? `${props.paddingTop}px` : props.paddingTop};`}
163
+ ${(props) => props.paddingBottom !== void 0 && `padding-bottom: ${typeof props.paddingBottom === "number" ? `${props.paddingBottom}px` : props.paddingBottom};`}
164
+ ${(props) => props.paddingLeft !== void 0 && `padding-left: ${typeof props.paddingLeft === "number" ? `${props.paddingLeft}px` : props.paddingLeft};`}
165
+ ${(props) => props.paddingRight !== void 0 && `padding-right: ${typeof props.paddingRight === "number" ? `${props.paddingRight}px` : props.paddingRight};`}
166
+
167
+ margin: ${(props) => typeof props.margin === "number" ? `${props.margin}px` : props.margin || 0};
168
+ ${(props) => props.marginTop !== void 0 && `margin-top: ${typeof props.marginTop === "number" ? `${props.marginTop}px` : props.marginTop};`}
169
+ ${(props) => props.marginBottom !== void 0 && `margin-bottom: ${typeof props.marginBottom === "number" ? `${props.marginBottom}px` : props.marginBottom};`}
170
+ ${(props) => props.marginLeft !== void 0 && `margin-left: ${typeof props.marginLeft === "number" ? `${props.marginLeft}px` : props.marginLeft};`}
171
+ ${(props) => props.marginRight !== void 0 && `margin-right: ${typeof props.marginRight === "number" ? `${props.marginRight}px` : props.marginRight};`}
172
+
173
+ flex-direction: ${(props) => props.flexDirection || "column"};
174
+ flex-wrap: ${(props) => props.flexWrap || "nowrap"};
175
+ align-items: ${(props) => props.alignItems || "stretch"};
176
+ justify-content: ${(props) => props.justifyContent || "flex-start"};
177
+ cursor: ${(props) => props.cursor ? props.cursor : props.onClick || props.onPress ? "pointer" : "inherit"};
178
+ position: ${(props) => props.position || "static"};
179
+ top: ${(props) => typeof props.top === "number" ? `${props.top}px` : props.top};
180
+ bottom: ${(props) => typeof props.bottom === "number" ? `${props.bottom}px` : props.bottom};
181
+ left: ${(props) => typeof props.left === "number" ? `${props.left}px` : props.left};
182
+ right: ${(props) => typeof props.right === "number" ? `${props.right}px` : props.right};
183
+ flex: ${(props) => props.flex};
184
+ flex-shrink: ${(props) => props.flexShrink ?? 1};
185
+ gap: ${(props) => typeof props.gap === "number" ? `${props.gap}px` : props.gap || 0};
186
+ align-self: ${(props) => props.alignSelf || "auto"};
187
+ overflow: ${(props) => props.overflow || "visible"};
188
+ overflow-x: ${(props) => props.overflowX || "visible"};
189
+ overflow-y: ${(props) => props.overflowY || "visible"};
190
+ z-index: ${(props) => props.zIndex};
191
+ opacity: ${(props) => props.disabled ? 0.5 : 1};
192
+ pointer-events: ${(props) => props.disabled ? "none" : "auto"};
193
+
194
+ &:hover {
195
+ ${(props) => props.hoverStyle?.backgroundColor && `background-color: ${props.hoverStyle.backgroundColor};`}
196
+ ${(props) => props.hoverStyle?.borderColor && `border-color: ${props.hoverStyle.borderColor};`}
197
+ }
198
+
199
+ &:active {
200
+ ${(props) => props.pressStyle?.backgroundColor && `background-color: ${props.pressStyle.backgroundColor};`}
201
+ }
202
+ `;
203
+ var Box = import_react2.default.forwardRef(
204
+ ({
205
+ children,
206
+ onPress,
207
+ onKeyDown,
208
+ onKeyUp,
209
+ role,
210
+ "aria-label": ariaLabel,
211
+ "aria-labelledby": ariaLabelledBy,
212
+ "aria-current": ariaCurrent,
213
+ "aria-disabled": ariaDisabled,
214
+ "aria-live": ariaLive,
215
+ "aria-busy": ariaBusy,
216
+ "aria-describedby": ariaDescribedBy,
217
+ "aria-expanded": ariaExpanded,
218
+ "aria-haspopup": ariaHasPopup,
219
+ "aria-pressed": ariaPressed,
220
+ "aria-controls": ariaControls,
221
+ tabIndex,
222
+ as,
223
+ src,
224
+ alt,
225
+ onError,
226
+ onLoad,
227
+ type,
228
+ disabled,
229
+ id,
230
+ testID,
231
+ "data-testid": dataTestId,
232
+ ...props
233
+ }, ref) => {
234
+ if (as === "img" && src) {
235
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
236
+ "img",
237
+ {
238
+ src,
239
+ alt: alt || "",
240
+ onError,
241
+ onLoad,
242
+ style: {
243
+ display: "block",
244
+ objectFit: "cover",
245
+ width: typeof props.width === "number" ? `${props.width}px` : props.width,
246
+ height: typeof props.height === "number" ? `${props.height}px` : props.height,
247
+ borderRadius: typeof props.borderRadius === "number" ? `${props.borderRadius}px` : props.borderRadius,
248
+ position: props.position,
249
+ top: typeof props.top === "number" ? `${props.top}px` : props.top,
250
+ left: typeof props.left === "number" ? `${props.left}px` : props.left,
251
+ right: typeof props.right === "number" ? `${props.right}px` : props.right,
252
+ bottom: typeof props.bottom === "number" ? `${props.bottom}px` : props.bottom,
253
+ ...props.style
254
+ }
255
+ }
256
+ );
257
+ }
258
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
259
+ StyledBox,
260
+ {
261
+ ref,
262
+ elementType: as,
263
+ id,
264
+ type: as === "button" ? type || "button" : void 0,
265
+ disabled: as === "button" ? disabled : void 0,
266
+ onClick: onPress,
267
+ onKeyDown,
268
+ onKeyUp,
269
+ role,
270
+ "aria-label": ariaLabel,
271
+ "aria-labelledby": ariaLabelledBy,
272
+ "aria-current": ariaCurrent,
273
+ "aria-disabled": ariaDisabled,
274
+ "aria-busy": ariaBusy,
275
+ "aria-describedby": ariaDescribedBy,
276
+ "aria-expanded": ariaExpanded,
277
+ "aria-haspopup": ariaHasPopup,
278
+ "aria-pressed": ariaPressed,
279
+ "aria-controls": ariaControls,
280
+ "aria-live": ariaLive,
281
+ tabIndex: tabIndex !== void 0 ? tabIndex : void 0,
282
+ "data-testid": dataTestId || testID,
283
+ ...props,
284
+ children
285
+ }
286
+ );
287
+ }
288
+ );
289
+ Box.displayName = "Box";
290
+
291
+ // ../../foundation/primitives-web/src/Text.tsx
292
+ var import_styled_components2 = __toESM(require("styled-components"));
293
+ var import_jsx_runtime2 = require("react/jsx-runtime");
294
+ var FilteredSpan = createFilteredElement("span");
295
+ var StyledText = (0, import_styled_components2.default)(FilteredSpan)`
296
+ color: ${(props) => props.color || "inherit"};
297
+ font-size: ${(props) => typeof props.fontSize === "number" ? `${props.fontSize}px` : props.fontSize || "inherit"};
298
+ font-weight: ${(props) => props.fontWeight || "normal"};
299
+ font-family: ${(props) => props.fontFamily || '"Aktiv Grotesk", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif'};
300
+ line-height: ${(props) => typeof props.lineHeight === "number" ? `${props.lineHeight}px` : props.lineHeight || "inherit"};
301
+ white-space: ${(props) => props.whiteSpace || "normal"};
302
+ text-align: ${(props) => props.textAlign || "inherit"};
303
+ text-decoration: ${(props) => props.textDecoration || "none"};
304
+ `;
305
+ var Text = ({
306
+ style,
307
+ className,
308
+ id,
309
+ role,
310
+ testID,
311
+ "data-testid": dataTestId,
312
+ numberOfLines: _numberOfLines,
313
+ ...props
314
+ }) => {
315
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
316
+ StyledText,
317
+ {
318
+ ...props,
319
+ style,
320
+ className,
321
+ id,
322
+ role,
323
+ "data-testid": dataTestId || testID
324
+ }
325
+ );
326
+ };
327
+
328
+ // ../../foundation/primitives-web/src/Icon.tsx
329
+ var import_styled_components3 = __toESM(require("styled-components"));
330
+ var import_jsx_runtime3 = require("react/jsx-runtime");
331
+ var FilteredDiv2 = createFilteredElement("div");
332
+ var StyledIcon = (0, import_styled_components3.default)(FilteredDiv2)`
333
+ display: flex;
334
+ align-items: center;
335
+ justify-content: center;
336
+ width: ${(props) => typeof props.size === "number" ? `${props.size}px` : props.size || "24px"};
337
+ height: ${(props) => typeof props.size === "number" ? `${props.size}px` : props.size || "24px"};
338
+ color: ${(props) => props.color || "currentColor"};
339
+
340
+ svg {
341
+ width: 100%;
342
+ height: 100%;
343
+ fill: none;
344
+ stroke: currentColor;
345
+ }
346
+ `;
347
+ var Icon = ({
348
+ children,
349
+ testID,
350
+ "data-testid": dataTestId,
351
+ ...props
352
+ }) => {
353
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(StyledIcon, { "data-testid": dataTestId || testID, ...props, children });
354
+ };
355
+
356
+ // ../../foundation/primitives-web/src/TextArea.tsx
357
+ var import_react3 = require("react");
358
+ var import_styled_components4 = __toESM(require("styled-components"));
359
+ var import_jsx_runtime4 = require("react/jsx-runtime");
360
+ var FilteredTextArea = createFilteredElement("textarea");
361
+ var StyledTextArea = (0, import_styled_components4.default)(FilteredTextArea)`
362
+ background: transparent;
363
+ border: none;
364
+ outline: none;
365
+ width: 100%;
366
+ height: 100%;
367
+ padding: 0;
368
+ margin: 0;
369
+ color: ${(props) => props.color || "inherit"};
370
+ font-size: ${(props) => typeof props.fontSize === "number" ? `${props.fontSize}px` : props.fontSize || "inherit"};
371
+ font-family: ${(props) => props.fontFamily || '"Aktiv Grotesk", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif'};
372
+ text-align: inherit;
373
+ resize: none;
374
+
375
+ &::placeholder {
376
+ color: ${(props) => props.placeholderTextColor || "rgba(255, 255, 255, 0.5)"};
377
+ }
378
+
379
+ &:disabled {
380
+ cursor: not-allowed;
381
+ }
382
+ `;
383
+ var TextAreaPrimitive = (0, import_react3.forwardRef)(
384
+ ({
385
+ value,
386
+ placeholder,
387
+ onChangeText,
388
+ onFocus,
389
+ onBlur,
390
+ onKeyDown,
391
+ disabled,
392
+ style,
393
+ color,
394
+ fontSize,
395
+ fontFamily,
396
+ placeholderTextColor,
397
+ maxLength,
398
+ rows,
399
+ testID,
400
+ "data-testid": dataTestId
401
+ }, ref) => {
402
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
403
+ StyledTextArea,
404
+ {
405
+ ref,
406
+ value,
407
+ placeholder,
408
+ onChange: (e) => onChangeText?.(e.target.value),
409
+ onFocus,
410
+ onBlur,
411
+ onKeyDown,
412
+ disabled,
413
+ style,
414
+ color,
415
+ fontSize,
416
+ fontFamily,
417
+ placeholderTextColor,
418
+ maxLength,
419
+ rows,
420
+ "data-testid": dataTestId || testID
421
+ }
422
+ );
423
+ }
424
+ );
425
+ TextAreaPrimitive.displayName = "TextAreaPrimitive";
426
+
427
+ // ../../foundation/primitives-web/src/index.tsx
428
+ var isWeb = true;
429
+
430
+ // src/InputEdit.tsx
431
+ var import_xui_core = require("@xsolla/xui-core");
432
+ var import_xui_icons_base = require("@xsolla/xui-icons-base");
433
+ var import_jsx_runtime5 = (
434
+ // Rich-text editor (web): a contenteditable surface holding HTML.
435
+ require("react/jsx-runtime")
436
+ );
437
+ var FIELD = {
438
+ fontSize: 16,
439
+ lineHeight: 18,
440
+ framePadding: 11,
441
+ iconSize: 16
442
+ };
443
+ var stripHtml = (html) => html.replace(/<[^>]*>/g, "").replace(/&nbsp;/gi, " ");
444
+ var CONTROL_ICON_SIZE = 18;
445
+ var POPOVER_SHADOW = "0px 6px 10px 4px rgba(7, 7, 8, 0.1), 0px 2px 3px 0px rgba(7, 7, 8, 0.2)";
446
+ var POPOVER_DROP_SHADOW = "drop-shadow(0 6px 10px rgba(7, 7, 8, 0.1)) drop-shadow(0 2px 3px rgba(7, 7, 8, 0.2))";
447
+ var InputEdit = (0, import_react4.forwardRef)(
448
+ ({
449
+ value,
450
+ defaultValue,
451
+ placeholder = "Placeholder",
452
+ onChangeText,
453
+ onConfirm,
454
+ onCancel,
455
+ onKeyDown,
456
+ editControl = true,
457
+ icon = true,
458
+ editIcon,
459
+ tools,
460
+ rows,
461
+ mode = "inline",
462
+ textStyle,
463
+ richText = false,
464
+ disabled = false,
465
+ error = false,
466
+ errorMessage,
467
+ id: providedId,
468
+ "aria-label": ariaLabel,
469
+ "aria-labelledby": ariaLabelledBy,
470
+ testID,
471
+ className,
472
+ themeMode,
473
+ themeProductContext,
474
+ ...rest
475
+ }, ref) => {
476
+ const { theme } = (0, import_xui_core.useResolvedTheme)({ themeMode, themeProductContext });
477
+ const isControlled = value !== void 0;
478
+ const [internalValue, setInternalValue] = (0, import_react4.useState)(
479
+ value ?? defaultValue ?? ""
480
+ );
481
+ const currentValue = isControlled ? value : internalValue;
482
+ const isFormMode = mode === "form";
483
+ const [isEditing, setIsEditing] = (0, import_react4.useState)(false);
484
+ const editing = isFormMode || isEditing;
485
+ const [focused, setFocused] = (0, import_react4.useState)(false);
486
+ const active = isFormMode ? focused : isEditing;
487
+ const richEnabled = richText && isWeb;
488
+ const inputRef = (0, import_react4.useRef)(null);
489
+ const editableRef = (0, import_react4.useRef)(null);
490
+ const focusField = () => {
491
+ if (richEnabled) editableRef.current?.focus();
492
+ else inputRef.current?.focus();
493
+ };
494
+ const committedValue = (0, import_react4.useRef)(currentValue);
495
+ const [fieldHeight, setFieldHeight] = (0, import_react4.useState)(null);
496
+ const rawId = (0, import_xui_core.useId)();
497
+ const safeId = rawId.replace(/:/g, "");
498
+ const inputId = providedId || `input-edit-${safeId}`;
499
+ const errorId = `${inputId}-error`;
500
+ const triggerId = `${inputId}-trigger`;
501
+ const focusTrigger = () => {
502
+ if (isWeb) {
503
+ setTimeout(() => document.getElementById(triggerId)?.focus(), 0);
504
+ }
505
+ };
506
+ import_react4.default.useImperativeHandle(
507
+ ref,
508
+ () => richEnabled ? editableRef.current : inputRef.current,
509
+ [richEnabled]
510
+ );
511
+ (0, import_react4.useEffect)(() => {
512
+ if (value !== void 0) {
513
+ setInternalValue(value);
514
+ committedValue.current = value;
515
+ }
516
+ }, [value]);
517
+ const autoSize = () => {
518
+ if (!isWeb) return;
519
+ if (richEnabled) {
520
+ requestAnimationFrame(() => {
521
+ const el2 = editableRef.current;
522
+ if (el2) setFieldHeight(el2.offsetHeight + FIELD.framePadding * 2);
523
+ });
524
+ return;
525
+ }
526
+ const el = inputRef.current;
527
+ if (!el) return;
528
+ el.style.height = "auto";
529
+ el.style.height = `${el.scrollHeight}px`;
530
+ setFieldHeight(el.scrollHeight + FIELD.framePadding * 2);
531
+ };
532
+ (0, import_react4.useEffect)(() => {
533
+ if (!editing) return;
534
+ if (richEnabled) {
535
+ const el = editableRef.current;
536
+ if (el && el.innerHTML !== currentValue) el.innerHTML = currentValue;
537
+ }
538
+ autoSize();
539
+ }, [editing, currentValue, richEnabled]);
540
+ const isError = !!(error || errorMessage);
541
+ const isFilled = richText ? stripHtml(currentValue).trim().length > 0 : currentValue.length > 0;
542
+ const plainText = richText ? stripHtml(currentValue) : currentValue;
543
+ const inputColors = theme.colors.control.input;
544
+ const borderRadius = theme.shape.input.md.borderRadius;
545
+ const typo = theme.typographyTokens;
546
+ const textStyleToken = textStyle ? typo.heading[textStyle] ?? typo.basic[textStyle] : null;
547
+ const fontSize = textStyleToken ? textStyleToken.fontSize : FIELD.fontSize;
548
+ const lineHeight = textStyleToken ? parseInt(String(textStyleToken.lineHeight), 10) : FIELD.lineHeight;
549
+ const fontWeight = textStyleToken ? textStyleToken.fontWeight : 400;
550
+ const fontFamily = textStyleToken && textStyleToken.lineHeightCategory === "display" ? theme.fonts.heading : theme.fonts.body;
551
+ const controlsTop = (fieldHeight ?? lineHeight + FIELD.framePadding * 2) - FIELD.framePadding + 4;
552
+ const enterEdit = () => {
553
+ if (disabled || isEditing) return;
554
+ setIsEditing(true);
555
+ setTimeout(focusField, 0);
556
+ };
557
+ const handleRichInput = (e) => {
558
+ handleChangeText(e.currentTarget.innerHTML);
559
+ };
560
+ const handlePaste = (e) => {
561
+ e.preventDefault();
562
+ const text = e.clipboardData.getData("text/plain");
563
+ document.execCommand("insertText", false, text);
564
+ };
565
+ const handleChangeText = (next) => {
566
+ onChangeText?.(next);
567
+ if (!isControlled) {
568
+ setInternalValue(next);
569
+ }
570
+ };
571
+ const commitExplicit = () => {
572
+ onConfirm?.(currentValue);
573
+ committedValue.current = currentValue;
574
+ };
575
+ const commitOnBlur = () => {
576
+ if (currentValue !== committedValue.current) {
577
+ onConfirm?.(currentValue);
578
+ committedValue.current = currentValue;
579
+ }
580
+ };
581
+ const exitEdit = () => {
582
+ if (!isFormMode) {
583
+ setIsEditing(false);
584
+ setFocused(false);
585
+ focusTrigger();
586
+ }
587
+ };
588
+ const handleConfirm = () => {
589
+ commitExplicit();
590
+ exitEdit();
591
+ };
592
+ const handleCancel = () => {
593
+ if (!isControlled) {
594
+ setInternalValue(committedValue.current);
595
+ }
596
+ onCancel?.();
597
+ exitEdit();
598
+ };
599
+ const handleKeyDown = (e) => {
600
+ if (e.key === "Enter" && (e.metaKey || e.ctrlKey)) {
601
+ e.preventDefault();
602
+ handleConfirm();
603
+ return;
604
+ }
605
+ if (e.key === "Escape") {
606
+ e.preventDefault();
607
+ handleCancel();
608
+ return;
609
+ }
610
+ onKeyDown?.(e);
611
+ };
612
+ const handleFocus = () => setFocused(true);
613
+ const handleBlur = () => {
614
+ setFocused(false);
615
+ commitOnBlur();
616
+ if (!isFormMode) {
617
+ setIsEditing(false);
618
+ }
619
+ };
620
+ let fieldBg = "transparent";
621
+ let fieldBorder = "transparent";
622
+ if (disabled) {
623
+ fieldBg = inputColors.bgDisable;
624
+ fieldBorder = inputColors.borderDisable;
625
+ } else if (isError) {
626
+ fieldBg = inputColors.bg;
627
+ fieldBorder = theme.colors.border.alert;
628
+ } else if (active) {
629
+ fieldBg = theme.colors.control.focus.bg;
630
+ fieldBorder = theme.colors.border.brand;
631
+ } else if (isFormMode) {
632
+ fieldBg = inputColors.bg;
633
+ fieldBorder = inputColors.border;
634
+ }
635
+ const textColor = disabled ? inputColors.textDisable : inputColors.text;
636
+ const displayColor = isFilled ? textColor : inputColors.placeholder;
637
+ const preventBlur = isWeb ? { onMouseDown: (e) => e.preventDefault() } : {};
638
+ const controlBg = theme.colors.control.mono.primary.bg;
639
+ const controlBgHover = theme.colors.control.mono.primary.bgHover;
640
+ const controlIconColor = theme.colors.control.mono.text.primary;
641
+ const isTrigger = !editing && !disabled;
642
+ const triggerProps = isTrigger ? {
643
+ as: "button",
644
+ type: "button",
645
+ id: triggerId,
646
+ onPress: enterEdit,
647
+ "aria-label": ariaLabel,
648
+ "aria-labelledby": ariaLabelledBy
649
+ } : {
650
+ "aria-disabled": disabled || void 0
651
+ };
652
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
653
+ Box,
654
+ {
655
+ position: "relative",
656
+ width: "100%",
657
+ testID,
658
+ className,
659
+ children: [
660
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Box, { position: "relative", width: "100%", style: { minHeight: lineHeight }, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
661
+ Box,
662
+ {
663
+ ...triggerProps,
664
+ position: "absolute",
665
+ flexDirection: "row",
666
+ alignItems: editing || isError || disabled ? "flex-start" : "center",
667
+ gap: 8,
668
+ paddingVertical: FIELD.framePadding,
669
+ paddingHorizontal: FIELD.framePadding,
670
+ backgroundColor: fieldBg,
671
+ borderColor: fieldBorder,
672
+ borderWidth: 1,
673
+ cursor: disabled ? "not-allowed" : editing ? "text" : "pointer",
674
+ hoverStyle: !disabled && !editing && !isError ? {
675
+ backgroundColor: inputColors.bgHover,
676
+ borderColor: inputColors.borderHover
677
+ } : void 0,
678
+ style: {
679
+ // Pin top/left/right to the anchor (inflated outward); leave the bottom
680
+ // free so the field grows downward with multi-line content.
681
+ top: -FIELD.framePadding,
682
+ left: -FIELD.framePadding,
683
+ right: -FIELD.framePadding,
684
+ minHeight: lineHeight + FIELD.framePadding * 2,
685
+ borderRadius,
686
+ boxSizing: "border-box",
687
+ textAlign: "left",
688
+ width: "auto"
689
+ },
690
+ children: [
691
+ editing && richEnabled ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Box, { flex: 1, position: "relative", children: [
692
+ !isFilled && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
693
+ Text,
694
+ {
695
+ "aria-hidden": true,
696
+ color: inputColors.placeholder,
697
+ fontSize,
698
+ fontWeight: String(fontWeight),
699
+ style: {
700
+ position: "absolute",
701
+ top: 0,
702
+ left: 0,
703
+ fontFamily,
704
+ lineHeight: `${lineHeight}px`,
705
+ pointerEvents: "none"
706
+ },
707
+ children: placeholder
708
+ }
709
+ ),
710
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
711
+ "div",
712
+ {
713
+ ref: editableRef,
714
+ id: inputId,
715
+ contentEditable: !disabled,
716
+ suppressContentEditableWarning: true,
717
+ role: "textbox",
718
+ "aria-multiline": "true",
719
+ "aria-label": ariaLabel,
720
+ "aria-labelledby": ariaLabelledBy,
721
+ "aria-invalid": isError || void 0,
722
+ "aria-describedby": errorMessage ? errorId : void 0,
723
+ "data-testid": "input-edit__field",
724
+ onInput: handleRichInput,
725
+ onFocus: handleFocus,
726
+ onBlur: handleBlur,
727
+ onKeyDown: handleKeyDown,
728
+ onPaste: handlePaste,
729
+ style: {
730
+ outline: "none",
731
+ minHeight: `${lineHeight}px`,
732
+ color: textColor,
733
+ fontFamily,
734
+ fontWeight,
735
+ fontSize: `${fontSize}px`,
736
+ lineHeight: `${lineHeight}px`,
737
+ whiteSpace: "pre-wrap",
738
+ wordBreak: "break-word"
739
+ }
740
+ }
741
+ )
742
+ ] }) : editing ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Box, { flex: 1, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
743
+ TextAreaPrimitive,
744
+ {
745
+ ref: inputRef,
746
+ id: inputId,
747
+ value: plainText,
748
+ placeholder,
749
+ onChangeText: handleChangeText,
750
+ onFocus: handleFocus,
751
+ onBlur: handleBlur,
752
+ onKeyDown: handleKeyDown,
753
+ disabled,
754
+ rows: rows ?? 1,
755
+ color: textColor,
756
+ fontSize,
757
+ fontFamily,
758
+ placeholderTextColor: inputColors.placeholder,
759
+ "aria-invalid": isError || void 0,
760
+ "aria-describedby": errorMessage ? errorId : void 0,
761
+ "aria-label": ariaLabel,
762
+ "aria-labelledby": ariaLabelledBy,
763
+ "data-testid": "input-edit__field",
764
+ style: {
765
+ display: "block",
766
+ overflow: "hidden",
767
+ fontWeight,
768
+ lineHeight: `${lineHeight}px`
769
+ },
770
+ ...rest
771
+ }
772
+ ) }) : richText && isWeb && isFilled ? (
773
+ // Rich display (read-only): render the stored HTML.
774
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
775
+ "div",
776
+ {
777
+ "data-testid": "input-edit__text",
778
+ dangerouslySetInnerHTML: { __html: currentValue },
779
+ style: {
780
+ flex: 1,
781
+ color: textColor,
782
+ fontFamily,
783
+ fontWeight,
784
+ fontSize: `${fontSize}px`,
785
+ lineHeight: `${lineHeight}px`,
786
+ whiteSpace: "pre-wrap",
787
+ wordBreak: "break-word"
788
+ }
789
+ }
790
+ )
791
+ ) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
792
+ Text,
793
+ {
794
+ color: displayColor,
795
+ fontSize,
796
+ fontWeight: String(fontWeight),
797
+ "data-testid": "input-edit__text",
798
+ style: {
799
+ flex: 1,
800
+ fontFamily,
801
+ lineHeight: `${lineHeight}px`,
802
+ wordBreak: "break-word",
803
+ // Preserve author line breaks in multi-line values.
804
+ whiteSpace: "pre-wrap"
805
+ },
806
+ children: isFilled ? plainText : placeholder
807
+ }
808
+ ),
809
+ icon && !editing && !isError && !disabled && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Box, { alignItems: "center", justifyContent: "center", "aria-hidden": true, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Icon, { size: FIELD.iconSize, color: textColor, children: editIcon ?? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_xui_icons_base.Edit, {}) }) })
810
+ ]
811
+ }
812
+ ) }),
813
+ active && editControl && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
814
+ Box,
815
+ {
816
+ position: "absolute",
817
+ flexDirection: "row",
818
+ alignItems: "center",
819
+ backgroundColor: controlBg,
820
+ "data-testid": "input-edit__edit-control",
821
+ style: {
822
+ top: controlsTop,
823
+ right: -FIELD.framePadding,
824
+ borderRadius: 4,
825
+ overflow: "hidden",
826
+ ...isWeb ? {
827
+ boxShadow: POPOVER_SHADOW,
828
+ backdropFilter: "blur(12px)",
829
+ WebkitBackdropFilter: "blur(12px)"
830
+ } : {}
831
+ },
832
+ children: [
833
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
834
+ Box,
835
+ {
836
+ as: "button",
837
+ type: "button",
838
+ alignItems: "center",
839
+ justifyContent: "center",
840
+ backgroundColor: controlBg,
841
+ borderWidth: 0,
842
+ padding: 4,
843
+ cursor: "pointer",
844
+ onPress: handleConfirm,
845
+ "aria-label": "Confirm",
846
+ "data-testid": "input-edit__confirm",
847
+ hoverStyle: { backgroundColor: controlBgHover },
848
+ ...preventBlur,
849
+ children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Icon, { size: CONTROL_ICON_SIZE, color: controlIconColor, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_xui_icons_base.Check, {}) })
850
+ }
851
+ ),
852
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
853
+ Box,
854
+ {
855
+ backgroundColor: theme.colors.border.inverse,
856
+ style: { width: 1, alignSelf: "stretch" }
857
+ }
858
+ ),
859
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
860
+ Box,
861
+ {
862
+ as: "button",
863
+ type: "button",
864
+ alignItems: "center",
865
+ justifyContent: "center",
866
+ backgroundColor: controlBg,
867
+ borderWidth: 0,
868
+ padding: 4,
869
+ cursor: "pointer",
870
+ onPress: handleCancel,
871
+ "aria-label": "Cancel",
872
+ "data-testid": "input-edit__cancel",
873
+ hoverStyle: { backgroundColor: controlBgHover },
874
+ ...preventBlur,
875
+ children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Icon, { size: CONTROL_ICON_SIZE, color: controlIconColor, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_xui_icons_base.Remove, {}) })
876
+ }
877
+ )
878
+ ]
879
+ }
880
+ ),
881
+ active && tools && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
882
+ Box,
883
+ {
884
+ position: "absolute",
885
+ flexDirection: "row",
886
+ alignItems: "center",
887
+ gap: 4,
888
+ padding: 4,
889
+ backgroundColor: theme.colors.background.primary,
890
+ "data-testid": "input-edit__tools",
891
+ style: {
892
+ top: controlsTop,
893
+ left: -FIELD.framePadding,
894
+ borderRadius: 4,
895
+ ...isWeb ? {
896
+ boxShadow: POPOVER_SHADOW,
897
+ backdropFilter: "blur(12px)",
898
+ WebkitBackdropFilter: "blur(12px)"
899
+ } : {}
900
+ },
901
+ ...preventBlur,
902
+ children: tools
903
+ }
904
+ ),
905
+ isError && errorMessage && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
906
+ Box,
907
+ {
908
+ position: "relative",
909
+ style: {
910
+ marginTop: FIELD.framePadding + 4,
911
+ width: "max-content",
912
+ maxWidth: "100%",
913
+ ...isWeb ? {
914
+ filter: POPOVER_DROP_SHADOW,
915
+ WebkitFilter: POPOVER_DROP_SHADOW
916
+ } : {}
917
+ },
918
+ children: [
919
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
920
+ Box,
921
+ {
922
+ position: "absolute",
923
+ backgroundColor: theme.colors.background.primary,
924
+ style: {
925
+ width: 8,
926
+ height: 8,
927
+ top: -3,
928
+ left: 16,
929
+ transform: "rotate(45deg)"
930
+ }
931
+ }
932
+ ),
933
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
934
+ Box,
935
+ {
936
+ backgroundColor: theme.colors.background.primary,
937
+ paddingVertical: 8,
938
+ paddingHorizontal: 12,
939
+ style: {
940
+ borderRadius: 4,
941
+ ...isWeb ? {
942
+ backdropFilter: "blur(12px)",
943
+ WebkitBackdropFilter: "blur(12px)"
944
+ } : {}
945
+ },
946
+ children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
947
+ Text,
948
+ {
949
+ id: errorId,
950
+ role: "status",
951
+ "aria-live": "polite",
952
+ color: theme.colors.content.alert.primary,
953
+ fontSize: FIELD.fontSize - 2,
954
+ style: { lineHeight: `${FIELD.lineHeight}px` },
955
+ children: errorMessage
956
+ }
957
+ )
958
+ }
959
+ )
960
+ ]
961
+ }
962
+ )
963
+ ]
964
+ }
965
+ );
966
+ }
967
+ );
968
+ InputEdit.displayName = "InputEdit";
969
+ // Annotate the CommonJS export names for ESM import in node:
970
+ 0 && (module.exports = {
971
+ InputEdit
972
+ });
973
+ //# sourceMappingURL=index.js.map