@xsolla/xui-rich-icon 0.64.0-pr56.1768440195
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/native/index.d.mts +46 -0
- package/native/index.d.ts +46 -0
- package/native/index.js +633 -0
- package/native/index.js.map +1 -0
- package/native/index.mjs +597 -0
- package/native/index.mjs.map +1 -0
- package/package.json +46 -0
- package/web/index.d.mts +46 -0
- package/web/index.d.ts +46 -0
- package/web/index.js +621 -0
- package/web/index.js.map +1 -0
- package/web/index.mjs +581 -0
- package/web/index.mjs.map +1 -0
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
import { BoxProps, TextProps } from '@xsolla/xui-primitives-core';
|
|
4
|
+
|
|
5
|
+
type RichIconVariant = "circle" | "rounded" | "square";
|
|
6
|
+
type RichIconSize = "sm" | "md" | "lg" | "xl";
|
|
7
|
+
interface RichIconProps extends BoxProps {
|
|
8
|
+
children: ReactNode;
|
|
9
|
+
/**
|
|
10
|
+
* Shape variant of the icon
|
|
11
|
+
* @default "rounded"
|
|
12
|
+
*/
|
|
13
|
+
variant?: RichIconVariant;
|
|
14
|
+
/**
|
|
15
|
+
* Size variant
|
|
16
|
+
* @default "md"
|
|
17
|
+
*/
|
|
18
|
+
size?: RichIconSize;
|
|
19
|
+
}
|
|
20
|
+
interface RichIconIconProps extends BoxProps {
|
|
21
|
+
/**
|
|
22
|
+
* Source URL for an image
|
|
23
|
+
*/
|
|
24
|
+
src?: string;
|
|
25
|
+
/**
|
|
26
|
+
* Custom component (e.g., Lucide icon)
|
|
27
|
+
*/
|
|
28
|
+
component?: ReactNode;
|
|
29
|
+
/**
|
|
30
|
+
* Color for the icon (if using component)
|
|
31
|
+
*/
|
|
32
|
+
color?: string;
|
|
33
|
+
}
|
|
34
|
+
interface RichIconTextProps extends TextProps {
|
|
35
|
+
children: ReactNode;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
declare const RichIconRoot: ({ children, variant, size, ...props }: RichIconProps) => react_jsx_runtime.JSX.Element;
|
|
39
|
+
declare const RichIconIcon: ({ src, component, color, children, ...props }: RichIconIconProps) => react_jsx_runtime.JSX.Element;
|
|
40
|
+
declare const RichIconText: ({ children, ...props }: RichIconTextProps) => react_jsx_runtime.JSX.Element;
|
|
41
|
+
declare const RichIcon: (({ children, variant, size, ...props }: RichIconProps) => react_jsx_runtime.JSX.Element) & {
|
|
42
|
+
Icon: ({ src, component, color, children, ...props }: RichIconIconProps) => react_jsx_runtime.JSX.Element;
|
|
43
|
+
Text: ({ children, ...props }: RichIconTextProps) => react_jsx_runtime.JSX.Element;
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
export { RichIcon, RichIconIcon, type RichIconIconProps, type RichIconProps, RichIconRoot, type RichIconSize, RichIconText, type RichIconTextProps, type RichIconVariant };
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
import { BoxProps, TextProps } from '@xsolla/xui-primitives-core';
|
|
4
|
+
|
|
5
|
+
type RichIconVariant = "circle" | "rounded" | "square";
|
|
6
|
+
type RichIconSize = "sm" | "md" | "lg" | "xl";
|
|
7
|
+
interface RichIconProps extends BoxProps {
|
|
8
|
+
children: ReactNode;
|
|
9
|
+
/**
|
|
10
|
+
* Shape variant of the icon
|
|
11
|
+
* @default "rounded"
|
|
12
|
+
*/
|
|
13
|
+
variant?: RichIconVariant;
|
|
14
|
+
/**
|
|
15
|
+
* Size variant
|
|
16
|
+
* @default "md"
|
|
17
|
+
*/
|
|
18
|
+
size?: RichIconSize;
|
|
19
|
+
}
|
|
20
|
+
interface RichIconIconProps extends BoxProps {
|
|
21
|
+
/**
|
|
22
|
+
* Source URL for an image
|
|
23
|
+
*/
|
|
24
|
+
src?: string;
|
|
25
|
+
/**
|
|
26
|
+
* Custom component (e.g., Lucide icon)
|
|
27
|
+
*/
|
|
28
|
+
component?: ReactNode;
|
|
29
|
+
/**
|
|
30
|
+
* Color for the icon (if using component)
|
|
31
|
+
*/
|
|
32
|
+
color?: string;
|
|
33
|
+
}
|
|
34
|
+
interface RichIconTextProps extends TextProps {
|
|
35
|
+
children: ReactNode;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
declare const RichIconRoot: ({ children, variant, size, ...props }: RichIconProps) => react_jsx_runtime.JSX.Element;
|
|
39
|
+
declare const RichIconIcon: ({ src, component, color, children, ...props }: RichIconIconProps) => react_jsx_runtime.JSX.Element;
|
|
40
|
+
declare const RichIconText: ({ children, ...props }: RichIconTextProps) => react_jsx_runtime.JSX.Element;
|
|
41
|
+
declare const RichIcon: (({ children, variant, size, ...props }: RichIconProps) => react_jsx_runtime.JSX.Element) & {
|
|
42
|
+
Icon: ({ src, component, color, children, ...props }: RichIconIconProps) => react_jsx_runtime.JSX.Element;
|
|
43
|
+
Text: ({ children, ...props }: RichIconTextProps) => react_jsx_runtime.JSX.Element;
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
export { RichIcon, RichIconIcon, type RichIconIconProps, type RichIconProps, RichIconRoot, type RichIconSize, RichIconText, type RichIconTextProps, type RichIconVariant };
|
package/native/index.js
ADDED
|
@@ -0,0 +1,633 @@
|
|
|
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
|
+
RichIcon: () => RichIcon,
|
|
34
|
+
RichIconIcon: () => RichIconIcon,
|
|
35
|
+
RichIconRoot: () => RichIconRoot,
|
|
36
|
+
RichIconText: () => RichIconText
|
|
37
|
+
});
|
|
38
|
+
module.exports = __toCommonJS(index_exports);
|
|
39
|
+
|
|
40
|
+
// src/RichIcon.tsx
|
|
41
|
+
var import_react4 = require("react");
|
|
42
|
+
|
|
43
|
+
// ../primitives-native/src/Box.tsx
|
|
44
|
+
var import_react_native = require("react-native");
|
|
45
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
46
|
+
var Box = ({
|
|
47
|
+
children,
|
|
48
|
+
onPress,
|
|
49
|
+
onLayout,
|
|
50
|
+
onMoveShouldSetResponder,
|
|
51
|
+
onResponderGrant,
|
|
52
|
+
onResponderMove,
|
|
53
|
+
onResponderRelease,
|
|
54
|
+
onResponderTerminate,
|
|
55
|
+
backgroundColor,
|
|
56
|
+
borderColor,
|
|
57
|
+
borderWidth,
|
|
58
|
+
borderBottomWidth,
|
|
59
|
+
borderBottomColor,
|
|
60
|
+
borderTopWidth,
|
|
61
|
+
borderTopColor,
|
|
62
|
+
borderLeftWidth,
|
|
63
|
+
borderLeftColor,
|
|
64
|
+
borderRightWidth,
|
|
65
|
+
borderRightColor,
|
|
66
|
+
borderRadius,
|
|
67
|
+
borderStyle,
|
|
68
|
+
height,
|
|
69
|
+
padding,
|
|
70
|
+
paddingHorizontal,
|
|
71
|
+
paddingVertical,
|
|
72
|
+
margin,
|
|
73
|
+
marginTop,
|
|
74
|
+
marginBottom,
|
|
75
|
+
marginLeft,
|
|
76
|
+
marginRight,
|
|
77
|
+
flexDirection,
|
|
78
|
+
alignItems,
|
|
79
|
+
justifyContent,
|
|
80
|
+
position,
|
|
81
|
+
top,
|
|
82
|
+
bottom,
|
|
83
|
+
left,
|
|
84
|
+
right,
|
|
85
|
+
width,
|
|
86
|
+
flex,
|
|
87
|
+
overflow,
|
|
88
|
+
zIndex,
|
|
89
|
+
hoverStyle,
|
|
90
|
+
pressStyle,
|
|
91
|
+
style,
|
|
92
|
+
"data-testid": dataTestId,
|
|
93
|
+
testID,
|
|
94
|
+
as,
|
|
95
|
+
src,
|
|
96
|
+
alt,
|
|
97
|
+
...rest
|
|
98
|
+
}) => {
|
|
99
|
+
const getContainerStyle = (pressed) => ({
|
|
100
|
+
backgroundColor: pressed && pressStyle?.backgroundColor ? pressStyle.backgroundColor : backgroundColor,
|
|
101
|
+
borderColor,
|
|
102
|
+
borderWidth,
|
|
103
|
+
borderBottomWidth,
|
|
104
|
+
borderBottomColor,
|
|
105
|
+
borderTopWidth,
|
|
106
|
+
borderTopColor,
|
|
107
|
+
borderLeftWidth,
|
|
108
|
+
borderLeftColor,
|
|
109
|
+
borderRightWidth,
|
|
110
|
+
borderRightColor,
|
|
111
|
+
borderRadius,
|
|
112
|
+
borderStyle,
|
|
113
|
+
overflow,
|
|
114
|
+
zIndex,
|
|
115
|
+
height,
|
|
116
|
+
width,
|
|
117
|
+
padding,
|
|
118
|
+
paddingHorizontal,
|
|
119
|
+
paddingVertical,
|
|
120
|
+
margin,
|
|
121
|
+
marginTop,
|
|
122
|
+
marginBottom,
|
|
123
|
+
marginLeft,
|
|
124
|
+
marginRight,
|
|
125
|
+
flexDirection,
|
|
126
|
+
alignItems,
|
|
127
|
+
justifyContent,
|
|
128
|
+
position,
|
|
129
|
+
top,
|
|
130
|
+
bottom,
|
|
131
|
+
left,
|
|
132
|
+
right,
|
|
133
|
+
flex,
|
|
134
|
+
...style
|
|
135
|
+
});
|
|
136
|
+
const finalTestID = dataTestId || testID;
|
|
137
|
+
const {
|
|
138
|
+
role,
|
|
139
|
+
tabIndex,
|
|
140
|
+
onKeyDown,
|
|
141
|
+
onKeyUp,
|
|
142
|
+
"aria-label": _ariaLabel,
|
|
143
|
+
"aria-labelledby": _ariaLabelledBy,
|
|
144
|
+
"aria-current": _ariaCurrent,
|
|
145
|
+
"aria-disabled": _ariaDisabled,
|
|
146
|
+
"aria-live": _ariaLive,
|
|
147
|
+
className,
|
|
148
|
+
"data-testid": _dataTestId,
|
|
149
|
+
...nativeRest
|
|
150
|
+
} = rest;
|
|
151
|
+
if (as === "img" && src) {
|
|
152
|
+
const imageStyle = {
|
|
153
|
+
width,
|
|
154
|
+
height,
|
|
155
|
+
borderRadius,
|
|
156
|
+
position,
|
|
157
|
+
top,
|
|
158
|
+
bottom,
|
|
159
|
+
left,
|
|
160
|
+
right,
|
|
161
|
+
...style
|
|
162
|
+
};
|
|
163
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
164
|
+
import_react_native.Image,
|
|
165
|
+
{
|
|
166
|
+
source: { uri: src },
|
|
167
|
+
style: imageStyle,
|
|
168
|
+
testID: finalTestID,
|
|
169
|
+
resizeMode: "cover",
|
|
170
|
+
...nativeRest
|
|
171
|
+
}
|
|
172
|
+
);
|
|
173
|
+
}
|
|
174
|
+
if (onPress) {
|
|
175
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
176
|
+
import_react_native.Pressable,
|
|
177
|
+
{
|
|
178
|
+
onPress,
|
|
179
|
+
onLayout,
|
|
180
|
+
onMoveShouldSetResponder,
|
|
181
|
+
onResponderGrant,
|
|
182
|
+
onResponderMove,
|
|
183
|
+
onResponderRelease,
|
|
184
|
+
onResponderTerminate,
|
|
185
|
+
style: ({ pressed }) => getContainerStyle(pressed),
|
|
186
|
+
testID: finalTestID,
|
|
187
|
+
...nativeRest,
|
|
188
|
+
children
|
|
189
|
+
}
|
|
190
|
+
);
|
|
191
|
+
}
|
|
192
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
193
|
+
import_react_native.View,
|
|
194
|
+
{
|
|
195
|
+
style: getContainerStyle(),
|
|
196
|
+
testID: finalTestID,
|
|
197
|
+
onLayout,
|
|
198
|
+
onMoveShouldSetResponder,
|
|
199
|
+
onResponderGrant,
|
|
200
|
+
onResponderMove,
|
|
201
|
+
onResponderRelease,
|
|
202
|
+
onResponderTerminate,
|
|
203
|
+
...nativeRest,
|
|
204
|
+
children
|
|
205
|
+
}
|
|
206
|
+
);
|
|
207
|
+
};
|
|
208
|
+
|
|
209
|
+
// ../primitives-native/src/Text.tsx
|
|
210
|
+
var import_react_native2 = require("react-native");
|
|
211
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
212
|
+
var roleMap = {
|
|
213
|
+
alert: "alert",
|
|
214
|
+
heading: "header",
|
|
215
|
+
button: "button",
|
|
216
|
+
link: "link",
|
|
217
|
+
text: "text"
|
|
218
|
+
};
|
|
219
|
+
var Text = ({
|
|
220
|
+
children,
|
|
221
|
+
color,
|
|
222
|
+
fontSize,
|
|
223
|
+
fontWeight,
|
|
224
|
+
fontFamily,
|
|
225
|
+
id,
|
|
226
|
+
role,
|
|
227
|
+
...props
|
|
228
|
+
}) => {
|
|
229
|
+
let resolvedFontFamily = fontFamily ? fontFamily.split(",")[0].replace(/['"]/g, "").trim() : void 0;
|
|
230
|
+
if (resolvedFontFamily === "Pilat Wide Bold") {
|
|
231
|
+
resolvedFontFamily = void 0;
|
|
232
|
+
}
|
|
233
|
+
const style = {
|
|
234
|
+
color,
|
|
235
|
+
fontSize: typeof fontSize === "number" ? fontSize : void 0,
|
|
236
|
+
fontWeight,
|
|
237
|
+
fontFamily: resolvedFontFamily,
|
|
238
|
+
textDecorationLine: props.textDecoration
|
|
239
|
+
};
|
|
240
|
+
const accessibilityRole = role ? roleMap[role] : void 0;
|
|
241
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react_native2.Text, { style, testID: id, accessibilityRole, children });
|
|
242
|
+
};
|
|
243
|
+
|
|
244
|
+
// ../primitives-native/src/Spinner.tsx
|
|
245
|
+
var import_react_native3 = require("react-native");
|
|
246
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
247
|
+
var Spinner = ({
|
|
248
|
+
color,
|
|
249
|
+
size,
|
|
250
|
+
role,
|
|
251
|
+
"aria-label": ariaLabel,
|
|
252
|
+
"aria-live": ariaLive,
|
|
253
|
+
"aria-describedby": ariaDescribedBy,
|
|
254
|
+
testID
|
|
255
|
+
}) => {
|
|
256
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
257
|
+
import_react_native3.View,
|
|
258
|
+
{
|
|
259
|
+
accessible: true,
|
|
260
|
+
accessibilityRole: role === "status" ? "none" : void 0,
|
|
261
|
+
accessibilityLabel: ariaLabel,
|
|
262
|
+
accessibilityLiveRegion: ariaLive === "polite" ? "polite" : ariaLive === "assertive" ? "assertive" : "none",
|
|
263
|
+
testID,
|
|
264
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
265
|
+
import_react_native3.ActivityIndicator,
|
|
266
|
+
{
|
|
267
|
+
color,
|
|
268
|
+
size: typeof size === "number" ? size : "small"
|
|
269
|
+
}
|
|
270
|
+
)
|
|
271
|
+
}
|
|
272
|
+
);
|
|
273
|
+
};
|
|
274
|
+
Spinner.displayName = "Spinner";
|
|
275
|
+
|
|
276
|
+
// ../primitives-native/src/Icon.tsx
|
|
277
|
+
var import_react = __toESM(require("react"));
|
|
278
|
+
var import_react_native4 = require("react-native");
|
|
279
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
280
|
+
|
|
281
|
+
// ../primitives-native/src/Divider.tsx
|
|
282
|
+
var import_react_native5 = require("react-native");
|
|
283
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
284
|
+
|
|
285
|
+
// ../primitives-native/src/Input.tsx
|
|
286
|
+
var import_react2 = require("react");
|
|
287
|
+
var import_react_native6 = require("react-native");
|
|
288
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
289
|
+
var keyboardTypeMap = {
|
|
290
|
+
text: "default",
|
|
291
|
+
number: "numeric",
|
|
292
|
+
email: "email-address",
|
|
293
|
+
tel: "phone-pad",
|
|
294
|
+
url: "url",
|
|
295
|
+
decimal: "decimal-pad"
|
|
296
|
+
};
|
|
297
|
+
var inputModeToKeyboardType = {
|
|
298
|
+
none: "default",
|
|
299
|
+
text: "default",
|
|
300
|
+
decimal: "decimal-pad",
|
|
301
|
+
numeric: "number-pad",
|
|
302
|
+
tel: "phone-pad",
|
|
303
|
+
search: "default",
|
|
304
|
+
email: "email-address",
|
|
305
|
+
url: "url"
|
|
306
|
+
};
|
|
307
|
+
var autoCompleteToTextContentType = {
|
|
308
|
+
"one-time-code": "oneTimeCode",
|
|
309
|
+
email: "emailAddress",
|
|
310
|
+
username: "username",
|
|
311
|
+
password: "password",
|
|
312
|
+
"new-password": "newPassword",
|
|
313
|
+
tel: "telephoneNumber",
|
|
314
|
+
"postal-code": "postalCode",
|
|
315
|
+
name: "name"
|
|
316
|
+
};
|
|
317
|
+
var InputPrimitive = (0, import_react2.forwardRef)(
|
|
318
|
+
({
|
|
319
|
+
value,
|
|
320
|
+
placeholder,
|
|
321
|
+
onChange,
|
|
322
|
+
onChangeText,
|
|
323
|
+
onFocus,
|
|
324
|
+
onBlur,
|
|
325
|
+
onKeyDown,
|
|
326
|
+
disabled,
|
|
327
|
+
secureTextEntry,
|
|
328
|
+
style,
|
|
329
|
+
color,
|
|
330
|
+
fontSize,
|
|
331
|
+
placeholderTextColor,
|
|
332
|
+
maxLength,
|
|
333
|
+
name,
|
|
334
|
+
type,
|
|
335
|
+
inputMode,
|
|
336
|
+
autoComplete,
|
|
337
|
+
id,
|
|
338
|
+
"aria-invalid": ariaInvalid,
|
|
339
|
+
"aria-describedby": ariaDescribedBy,
|
|
340
|
+
"aria-labelledby": ariaLabelledBy,
|
|
341
|
+
"aria-label": ariaLabel,
|
|
342
|
+
"aria-disabled": ariaDisabled,
|
|
343
|
+
"data-testid": dataTestId
|
|
344
|
+
}, ref) => {
|
|
345
|
+
const handleChangeText = (text) => {
|
|
346
|
+
onChangeText?.(text);
|
|
347
|
+
if (onChange) {
|
|
348
|
+
const syntheticEvent = {
|
|
349
|
+
target: { value: text },
|
|
350
|
+
currentTarget: { value: text },
|
|
351
|
+
type: "change",
|
|
352
|
+
nativeEvent: { text },
|
|
353
|
+
preventDefault: () => {
|
|
354
|
+
},
|
|
355
|
+
stopPropagation: () => {
|
|
356
|
+
},
|
|
357
|
+
isTrusted: false
|
|
358
|
+
};
|
|
359
|
+
onChange(syntheticEvent);
|
|
360
|
+
}
|
|
361
|
+
};
|
|
362
|
+
const keyboardType = inputMode ? inputModeToKeyboardType[inputMode] || "default" : type ? keyboardTypeMap[type] || "default" : "default";
|
|
363
|
+
const textContentType = autoComplete ? autoCompleteToTextContentType[autoComplete] : void 0;
|
|
364
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
365
|
+
import_react_native6.TextInput,
|
|
366
|
+
{
|
|
367
|
+
ref,
|
|
368
|
+
value,
|
|
369
|
+
placeholder,
|
|
370
|
+
onChangeText: handleChangeText,
|
|
371
|
+
onFocus,
|
|
372
|
+
onBlur,
|
|
373
|
+
onKeyPress: (e) => {
|
|
374
|
+
if (onKeyDown) {
|
|
375
|
+
onKeyDown({
|
|
376
|
+
key: e.nativeEvent.key,
|
|
377
|
+
preventDefault: () => {
|
|
378
|
+
}
|
|
379
|
+
});
|
|
380
|
+
}
|
|
381
|
+
},
|
|
382
|
+
editable: !disabled,
|
|
383
|
+
secureTextEntry: secureTextEntry || type === "password",
|
|
384
|
+
keyboardType,
|
|
385
|
+
textContentType,
|
|
386
|
+
style: [
|
|
387
|
+
{
|
|
388
|
+
color,
|
|
389
|
+
fontSize: typeof fontSize === "number" ? fontSize : void 0,
|
|
390
|
+
flex: 1,
|
|
391
|
+
padding: 0,
|
|
392
|
+
textAlign: style?.textAlign || "left"
|
|
393
|
+
},
|
|
394
|
+
style
|
|
395
|
+
],
|
|
396
|
+
placeholderTextColor,
|
|
397
|
+
maxLength,
|
|
398
|
+
testID: dataTestId || id,
|
|
399
|
+
accessibilityLabel: ariaLabel,
|
|
400
|
+
accessibilityHint: ariaDescribedBy,
|
|
401
|
+
accessibilityState: {
|
|
402
|
+
disabled: disabled || ariaDisabled
|
|
403
|
+
},
|
|
404
|
+
accessible: true
|
|
405
|
+
}
|
|
406
|
+
);
|
|
407
|
+
}
|
|
408
|
+
);
|
|
409
|
+
InputPrimitive.displayName = "InputPrimitive";
|
|
410
|
+
|
|
411
|
+
// ../primitives-native/src/TextArea.tsx
|
|
412
|
+
var import_react3 = require("react");
|
|
413
|
+
var import_react_native7 = require("react-native");
|
|
414
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
415
|
+
var TextAreaPrimitive = (0, import_react3.forwardRef)(
|
|
416
|
+
({
|
|
417
|
+
value,
|
|
418
|
+
placeholder,
|
|
419
|
+
onChange,
|
|
420
|
+
onChangeText,
|
|
421
|
+
onFocus,
|
|
422
|
+
onBlur,
|
|
423
|
+
onKeyDown,
|
|
424
|
+
disabled,
|
|
425
|
+
style,
|
|
426
|
+
color,
|
|
427
|
+
fontSize,
|
|
428
|
+
placeholderTextColor,
|
|
429
|
+
maxLength,
|
|
430
|
+
rows,
|
|
431
|
+
id,
|
|
432
|
+
"aria-invalid": ariaInvalid,
|
|
433
|
+
"aria-describedby": ariaDescribedBy,
|
|
434
|
+
"aria-labelledby": ariaLabelledBy,
|
|
435
|
+
"aria-label": ariaLabel,
|
|
436
|
+
"aria-disabled": ariaDisabled,
|
|
437
|
+
"data-testid": dataTestId
|
|
438
|
+
}, ref) => {
|
|
439
|
+
const handleChangeText = (text) => {
|
|
440
|
+
onChangeText?.(text);
|
|
441
|
+
if (onChange) {
|
|
442
|
+
const syntheticEvent = {
|
|
443
|
+
target: { value: text },
|
|
444
|
+
currentTarget: { value: text },
|
|
445
|
+
type: "change",
|
|
446
|
+
nativeEvent: { text },
|
|
447
|
+
preventDefault: () => {
|
|
448
|
+
},
|
|
449
|
+
stopPropagation: () => {
|
|
450
|
+
},
|
|
451
|
+
isTrusted: false
|
|
452
|
+
};
|
|
453
|
+
onChange(syntheticEvent);
|
|
454
|
+
}
|
|
455
|
+
};
|
|
456
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
457
|
+
import_react_native7.TextInput,
|
|
458
|
+
{
|
|
459
|
+
ref,
|
|
460
|
+
value,
|
|
461
|
+
placeholder,
|
|
462
|
+
onChangeText: handleChangeText,
|
|
463
|
+
onFocus,
|
|
464
|
+
onBlur,
|
|
465
|
+
onKeyPress: (e) => {
|
|
466
|
+
if (onKeyDown) {
|
|
467
|
+
onKeyDown({
|
|
468
|
+
key: e.nativeEvent.key,
|
|
469
|
+
preventDefault: () => {
|
|
470
|
+
}
|
|
471
|
+
});
|
|
472
|
+
}
|
|
473
|
+
},
|
|
474
|
+
editable: !disabled,
|
|
475
|
+
multiline: true,
|
|
476
|
+
numberOfLines: rows || 4,
|
|
477
|
+
style: [
|
|
478
|
+
{
|
|
479
|
+
color,
|
|
480
|
+
fontSize: typeof fontSize === "number" ? fontSize : void 0,
|
|
481
|
+
flex: 1,
|
|
482
|
+
padding: 0,
|
|
483
|
+
textAlignVertical: "top",
|
|
484
|
+
textAlign: style?.textAlign || "left"
|
|
485
|
+
},
|
|
486
|
+
style
|
|
487
|
+
],
|
|
488
|
+
placeholderTextColor,
|
|
489
|
+
maxLength,
|
|
490
|
+
testID: dataTestId || id,
|
|
491
|
+
accessibilityLabel: ariaLabel,
|
|
492
|
+
accessibilityHint: ariaDescribedBy,
|
|
493
|
+
accessibilityState: {
|
|
494
|
+
disabled: disabled || ariaDisabled
|
|
495
|
+
},
|
|
496
|
+
accessible: true
|
|
497
|
+
}
|
|
498
|
+
);
|
|
499
|
+
}
|
|
500
|
+
);
|
|
501
|
+
TextAreaPrimitive.displayName = "TextAreaPrimitive";
|
|
502
|
+
|
|
503
|
+
// src/RichIcon.tsx
|
|
504
|
+
var import_xui_core = require("@xsolla/xui-core");
|
|
505
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
506
|
+
var RichIconContext = (0, import_react4.createContext)(null);
|
|
507
|
+
var useRichIconContext = () => {
|
|
508
|
+
const context = (0, import_react4.useContext)(RichIconContext);
|
|
509
|
+
if (!context) {
|
|
510
|
+
throw new Error(
|
|
511
|
+
"RichIcon components must be used within a RichIcon provider"
|
|
512
|
+
);
|
|
513
|
+
}
|
|
514
|
+
return context;
|
|
515
|
+
};
|
|
516
|
+
var richIconSizeMap = {
|
|
517
|
+
sm: 24,
|
|
518
|
+
md: 32,
|
|
519
|
+
lg: 40,
|
|
520
|
+
xl: 64
|
|
521
|
+
};
|
|
522
|
+
var richIconFontSizeMap = {
|
|
523
|
+
sm: 10,
|
|
524
|
+
md: 12,
|
|
525
|
+
lg: 14,
|
|
526
|
+
xl: 18
|
|
527
|
+
};
|
|
528
|
+
var getBorderRadius = (variant) => {
|
|
529
|
+
switch (variant) {
|
|
530
|
+
case "circle":
|
|
531
|
+
return 1e3;
|
|
532
|
+
case "rounded":
|
|
533
|
+
return 8;
|
|
534
|
+
case "square":
|
|
535
|
+
return 0;
|
|
536
|
+
default:
|
|
537
|
+
return 8;
|
|
538
|
+
}
|
|
539
|
+
};
|
|
540
|
+
var RichIconRoot = ({
|
|
541
|
+
children,
|
|
542
|
+
variant = "rounded",
|
|
543
|
+
size = "md",
|
|
544
|
+
...props
|
|
545
|
+
}) => {
|
|
546
|
+
const contextValue = (0, import_react4.useMemo)(() => ({ variant, size }), [variant, size]);
|
|
547
|
+
const sizeValue = richIconSizeMap[size];
|
|
548
|
+
const borderRadius = getBorderRadius(variant);
|
|
549
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(RichIconContext.Provider, { value: contextValue, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
550
|
+
Box,
|
|
551
|
+
{
|
|
552
|
+
...props,
|
|
553
|
+
width: sizeValue,
|
|
554
|
+
height: sizeValue,
|
|
555
|
+
borderRadius,
|
|
556
|
+
overflow: "hidden",
|
|
557
|
+
alignItems: "center",
|
|
558
|
+
justifyContent: "center",
|
|
559
|
+
position: "relative",
|
|
560
|
+
children
|
|
561
|
+
}
|
|
562
|
+
) });
|
|
563
|
+
};
|
|
564
|
+
var RichIconIcon = ({
|
|
565
|
+
src,
|
|
566
|
+
component,
|
|
567
|
+
color,
|
|
568
|
+
children,
|
|
569
|
+
...props
|
|
570
|
+
}) => {
|
|
571
|
+
const { theme } = (0, import_xui_core.useDesignSystem)();
|
|
572
|
+
useRichIconContext();
|
|
573
|
+
const content = (0, import_react4.useMemo)(() => {
|
|
574
|
+
if (src) {
|
|
575
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
576
|
+
Box,
|
|
577
|
+
{
|
|
578
|
+
width: "100%",
|
|
579
|
+
height: "100%",
|
|
580
|
+
style: {
|
|
581
|
+
backgroundImage: `url(${src})`,
|
|
582
|
+
backgroundSize: "cover",
|
|
583
|
+
backgroundPosition: "center"
|
|
584
|
+
}
|
|
585
|
+
}
|
|
586
|
+
);
|
|
587
|
+
}
|
|
588
|
+
if (component) {
|
|
589
|
+
return component;
|
|
590
|
+
}
|
|
591
|
+
return children;
|
|
592
|
+
}, [src, component, children]);
|
|
593
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
594
|
+
Box,
|
|
595
|
+
{
|
|
596
|
+
width: "100%",
|
|
597
|
+
height: "100%",
|
|
598
|
+
alignItems: "center",
|
|
599
|
+
justifyContent: "center",
|
|
600
|
+
backgroundColor: theme.colors.control.mono.secondary.bg,
|
|
601
|
+
...props,
|
|
602
|
+
children: content
|
|
603
|
+
}
|
|
604
|
+
);
|
|
605
|
+
};
|
|
606
|
+
var RichIconText = ({ children, ...props }) => {
|
|
607
|
+
const { size } = useRichIconContext();
|
|
608
|
+
const { theme } = (0, import_xui_core.useDesignSystem)();
|
|
609
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
610
|
+
Text,
|
|
611
|
+
{
|
|
612
|
+
color: theme.colors.content.primary,
|
|
613
|
+
fontSize: richIconFontSizeMap[size],
|
|
614
|
+
fontWeight: "600",
|
|
615
|
+
textAlign: "center",
|
|
616
|
+
style: { userSelect: "none" },
|
|
617
|
+
...props,
|
|
618
|
+
children
|
|
619
|
+
}
|
|
620
|
+
);
|
|
621
|
+
};
|
|
622
|
+
var RichIcon = Object.assign(RichIconRoot, {
|
|
623
|
+
Icon: RichIconIcon,
|
|
624
|
+
Text: RichIconText
|
|
625
|
+
});
|
|
626
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
627
|
+
0 && (module.exports = {
|
|
628
|
+
RichIcon,
|
|
629
|
+
RichIconIcon,
|
|
630
|
+
RichIconRoot,
|
|
631
|
+
RichIconText
|
|
632
|
+
});
|
|
633
|
+
//# sourceMappingURL=index.js.map
|