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