@xsolla/xui-b2b-notification-panel 0.147.1

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.
@@ -0,0 +1,344 @@
1
+ // src/NotificationPanel.tsx
2
+ import { cloneElement, isValidElement } from "react";
3
+
4
+ // ../../foundation/primitives-native/src/Box.tsx
5
+ import {
6
+ View,
7
+ Pressable,
8
+ Image
9
+ } from "react-native";
10
+ import { jsx } from "react/jsx-runtime";
11
+ var Box = ({
12
+ children,
13
+ onPress,
14
+ onLayout,
15
+ onMoveShouldSetResponder,
16
+ onResponderGrant,
17
+ onResponderMove,
18
+ onResponderRelease,
19
+ onResponderTerminate,
20
+ backgroundColor,
21
+ borderColor,
22
+ borderWidth,
23
+ borderBottomWidth,
24
+ borderBottomColor,
25
+ borderTopWidth,
26
+ borderTopColor,
27
+ borderLeftWidth,
28
+ borderLeftColor,
29
+ borderRightWidth,
30
+ borderRightColor,
31
+ borderRadius,
32
+ borderStyle,
33
+ height,
34
+ padding,
35
+ paddingHorizontal,
36
+ paddingVertical,
37
+ margin,
38
+ marginTop,
39
+ marginBottom,
40
+ marginLeft,
41
+ marginRight,
42
+ flexDirection,
43
+ alignItems,
44
+ justifyContent,
45
+ position,
46
+ top,
47
+ bottom,
48
+ left,
49
+ right,
50
+ width,
51
+ minWidth,
52
+ minHeight,
53
+ maxWidth,
54
+ maxHeight,
55
+ flex,
56
+ overflow,
57
+ zIndex,
58
+ hoverStyle,
59
+ pressStyle,
60
+ style,
61
+ "data-testid": dataTestId,
62
+ testID,
63
+ as,
64
+ src,
65
+ alt,
66
+ ...rest
67
+ }) => {
68
+ const getContainerStyle = (pressed) => ({
69
+ backgroundColor: pressed && pressStyle?.backgroundColor ? pressStyle.backgroundColor : backgroundColor,
70
+ borderColor,
71
+ borderWidth,
72
+ borderBottomWidth,
73
+ borderBottomColor,
74
+ borderTopWidth,
75
+ borderTopColor,
76
+ borderLeftWidth,
77
+ borderLeftColor,
78
+ borderRightWidth,
79
+ borderRightColor,
80
+ borderRadius,
81
+ borderStyle,
82
+ overflow,
83
+ zIndex,
84
+ height,
85
+ width,
86
+ minWidth,
87
+ minHeight,
88
+ maxWidth,
89
+ maxHeight,
90
+ padding,
91
+ paddingHorizontal,
92
+ paddingVertical,
93
+ margin,
94
+ marginTop,
95
+ marginBottom,
96
+ marginLeft,
97
+ marginRight,
98
+ flexDirection,
99
+ alignItems,
100
+ justifyContent,
101
+ position,
102
+ top,
103
+ bottom,
104
+ left,
105
+ right,
106
+ flex,
107
+ ...style
108
+ });
109
+ const finalTestID = dataTestId || testID;
110
+ const {
111
+ role,
112
+ tabIndex,
113
+ onKeyDown,
114
+ onKeyUp,
115
+ "aria-label": _ariaLabel,
116
+ "aria-labelledby": _ariaLabelledBy,
117
+ "aria-current": _ariaCurrent,
118
+ "aria-disabled": _ariaDisabled,
119
+ "aria-live": _ariaLive,
120
+ className,
121
+ "data-testid": _dataTestId,
122
+ ...nativeRest
123
+ } = rest;
124
+ if (as === "img" && src) {
125
+ const imageStyle = {
126
+ width,
127
+ height,
128
+ borderRadius,
129
+ position,
130
+ top,
131
+ bottom,
132
+ left,
133
+ right,
134
+ ...style
135
+ };
136
+ return /* @__PURE__ */ jsx(
137
+ Image,
138
+ {
139
+ source: { uri: src },
140
+ style: imageStyle,
141
+ testID: finalTestID,
142
+ resizeMode: "cover",
143
+ ...nativeRest
144
+ }
145
+ );
146
+ }
147
+ if (onPress) {
148
+ return /* @__PURE__ */ jsx(
149
+ Pressable,
150
+ {
151
+ onPress,
152
+ onLayout,
153
+ onMoveShouldSetResponder,
154
+ onResponderGrant,
155
+ onResponderMove,
156
+ onResponderRelease,
157
+ onResponderTerminate,
158
+ style: ({ pressed }) => getContainerStyle(pressed),
159
+ testID: finalTestID,
160
+ ...nativeRest,
161
+ children
162
+ }
163
+ );
164
+ }
165
+ return /* @__PURE__ */ jsx(
166
+ View,
167
+ {
168
+ style: getContainerStyle(),
169
+ testID: finalTestID,
170
+ onLayout,
171
+ onMoveShouldSetResponder,
172
+ onResponderGrant,
173
+ onResponderMove,
174
+ onResponderRelease,
175
+ onResponderTerminate,
176
+ ...nativeRest,
177
+ children
178
+ }
179
+ );
180
+ };
181
+
182
+ // src/NotificationPanel.tsx
183
+ import { useResolvedTheme } from "@xsolla/xui-core";
184
+ import {
185
+ IconButton
186
+ } from "@xsolla/xui-button";
187
+ import { Typography } from "@xsolla/xui-typography";
188
+ import {
189
+ ExclamationMarkSq,
190
+ InfoSq,
191
+ CheckCr,
192
+ Remove
193
+ } from "@xsolla/xui-icons-base";
194
+ import { jsx as jsx2, jsxs } from "react/jsx-runtime";
195
+ var NotificationPanel = ({
196
+ type = "neutral",
197
+ title,
198
+ description,
199
+ showIcon = true,
200
+ icon,
201
+ actionButton,
202
+ showCloseButton = true,
203
+ onClose,
204
+ closeButtonAlign = "top",
205
+ testID,
206
+ themeMode,
207
+ themeProductContext
208
+ }) => {
209
+ const { theme } = useResolvedTheme({ themeMode, themeProductContext });
210
+ const config = theme.sizing.notificationPanel();
211
+ const typeConfig = {
212
+ alert: {
213
+ panelBg: theme.colors.overlay.alert,
214
+ iconFrameBg: theme.colors.overlay.alert,
215
+ iconColor: theme.colors.content.primary,
216
+ buttonTone: "alert",
217
+ IconComponent: ExclamationMarkSq
218
+ },
219
+ warning: {
220
+ panelBg: theme.colors.overlay.warning,
221
+ iconFrameBg: theme.colors.background.warning.primary,
222
+ iconColor: theme.colors.content.primary,
223
+ buttonTone: "mono",
224
+ IconComponent: ExclamationMarkSq
225
+ },
226
+ success: {
227
+ panelBg: theme.colors.overlay.success,
228
+ iconFrameBg: theme.colors.background.success.primary,
229
+ iconColor: theme.colors.content.primary,
230
+ buttonTone: "brandExtra",
231
+ IconComponent: CheckCr
232
+ },
233
+ neutral: {
234
+ panelBg: theme.colors.overlay.mono,
235
+ iconFrameBg: theme.colors.overlay.mono,
236
+ iconColor: theme.colors.content.primary,
237
+ buttonTone: "mono",
238
+ IconComponent: InfoSq
239
+ },
240
+ brand: {
241
+ panelBg: theme.colors.overlay.brand,
242
+ iconFrameBg: theme.colors.overlay.brand,
243
+ iconColor: theme.colors.content.primary,
244
+ buttonTone: "brand",
245
+ IconComponent: InfoSq
246
+ }
247
+ };
248
+ const currentConfig = typeConfig[type];
249
+ const IconComponent = currentConfig.IconComponent;
250
+ return /* @__PURE__ */ jsxs(
251
+ Box,
252
+ {
253
+ backgroundColor: currentConfig.panelBg,
254
+ borderRadius: config.borderRadius,
255
+ flexDirection: "row",
256
+ alignItems: "stretch",
257
+ overflow: "hidden",
258
+ testID,
259
+ role: type === "alert" ? "alert" : "status",
260
+ "aria-label": `${type} notification`,
261
+ children: [
262
+ showIcon && /* @__PURE__ */ jsx2(
263
+ Box,
264
+ {
265
+ backgroundColor: currentConfig.iconFrameBg,
266
+ width: config.iconFrameWidth,
267
+ alignItems: "center",
268
+ justifyContent: "center",
269
+ style: {
270
+ borderTopLeftRadius: config.borderRadius,
271
+ borderBottomLeftRadius: config.borderRadius
272
+ },
273
+ children: icon || /* @__PURE__ */ jsx2(
274
+ IconComponent,
275
+ {
276
+ size: config.iconSize,
277
+ color: currentConfig.iconColor,
278
+ variant: "solid"
279
+ }
280
+ )
281
+ }
282
+ ),
283
+ /* @__PURE__ */ jsxs(
284
+ Box,
285
+ {
286
+ flex: 1,
287
+ flexDirection: "row",
288
+ alignItems: "center",
289
+ paddingHorizontal: config.bodyPaddingHorizontal,
290
+ paddingVertical: config.bodyPaddingVertical,
291
+ gap: config.contentGap,
292
+ children: [
293
+ /* @__PURE__ */ jsxs(Box, { flex: 1, gap: config.textGap, children: [
294
+ title && /* @__PURE__ */ jsx2(
295
+ Typography,
296
+ {
297
+ variant: "bodyMdAccent",
298
+ color: theme.colors.content.primary,
299
+ children: title
300
+ }
301
+ ),
302
+ description && /* @__PURE__ */ jsx2(Typography, { variant: "bodySm", color: theme.colors.content.tertiary, children: description })
303
+ ] }),
304
+ (actionButton || showCloseButton) && /* @__PURE__ */ jsxs(
305
+ Box,
306
+ {
307
+ flexDirection: "row",
308
+ alignSelf: closeButtonAlign === "top" ? "stretch" : "center",
309
+ alignItems: closeButtonAlign === "top" ? "flex-start" : "center",
310
+ justifyContent: "flex-start",
311
+ paddingVertical: closeButtonAlign === "top" ? 4 : 0,
312
+ gap: config.buttonsGap,
313
+ children: [
314
+ isValidElement(actionButton) && cloneElement(actionButton, {
315
+ size: "xs",
316
+ variant: "secondary"
317
+ }),
318
+ showCloseButton && /* @__PURE__ */ jsx2(
319
+ IconButton,
320
+ {
321
+ variant: "tertiary",
322
+ tone: "mono",
323
+ size: "xs",
324
+ onPress: onClose,
325
+ "aria-label": "Close notification",
326
+ icon: /* @__PURE__ */ jsx2(Remove, { size: 18 }),
327
+ hoverBackground: "none"
328
+ }
329
+ )
330
+ ]
331
+ }
332
+ )
333
+ ]
334
+ }
335
+ )
336
+ ]
337
+ }
338
+ );
339
+ };
340
+ NotificationPanel.displayName = "NotificationPanel";
341
+ export {
342
+ NotificationPanel
343
+ };
344
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/NotificationPanel.tsx","../../../../foundation/primitives-native/src/Box.tsx"],"sourcesContent":["import React, { cloneElement, isValidElement } from \"react\";\n// @ts-expect-error - this will be resolved at build time\nimport { Box } from \"@xsolla/xui-primitives\";\nimport { useResolvedTheme, type ThemeOverrideProps } from \"@xsolla/xui-core\";\nimport {\n IconButton,\n type ButtonProps,\n type IconButtonProps,\n} from \"@xsolla/xui-button\";\nimport { Typography } from \"@xsolla/xui-typography\";\nimport {\n ExclamationMarkSq,\n InfoSq,\n CheckCr,\n Remove,\n type BaseIconComponent,\n} from \"@xsolla/xui-icons-base\";\n\nexport type ActionButtonElement = React.ReactElement<\n ButtonProps | IconButtonProps\n>;\n\nexport interface NotificationPanelProps extends ThemeOverrideProps {\n /** Visual variant/tone of the notification */\n type?: \"alert\" | \"warning\" | \"success\" | \"neutral\" | \"brand\";\n /** Title text (optional) */\n title?: string;\n /** Description text (optional) */\n description?: string;\n /** Show/hide the icon frame */\n showIcon?: boolean;\n /** Custom icon override (optional) */\n icon?: React.ReactNode;\n /**\n * Action button (optional - pass any Button/IconButton component).\n * The `tone`, `size`, and `variant` props will be automatically set.\n */\n actionButton?: React.ReactElement;\n /** Show/hide close button */\n showCloseButton?: boolean;\n /** Close button click handler */\n onClose?: () => void;\n /** Vertical alignment of the close button — \"top\" (default) or \"center\" */\n closeButtonAlign?: \"center\" | \"top\";\n /** Test ID for testing frameworks */\n testID?: string;\n}\n\nexport const NotificationPanel: React.FC<NotificationPanelProps> = ({\n type = \"neutral\",\n title,\n description,\n showIcon = true,\n icon,\n actionButton,\n showCloseButton = true,\n onClose,\n closeButtonAlign = \"top\",\n testID,\n themeMode,\n themeProductContext,\n}) => {\n const { theme } = useResolvedTheme({ themeMode, themeProductContext });\n const config = theme.sizing.notificationPanel();\n\n const typeConfig: Record<\n NonNullable<NotificationPanelProps[\"type\"]>,\n {\n panelBg: string;\n iconFrameBg: string;\n iconColor: string;\n buttonTone: \"brand\" | \"brandExtra\" | \"alert\" | \"mono\";\n IconComponent: BaseIconComponent;\n }\n > = {\n alert: {\n panelBg: theme.colors.overlay.alert,\n iconFrameBg: theme.colors.overlay.alert,\n iconColor: theme.colors.content.primary,\n buttonTone: \"alert\",\n IconComponent: ExclamationMarkSq,\n },\n warning: {\n panelBg: theme.colors.overlay.warning,\n iconFrameBg: theme.colors.background.warning.primary,\n iconColor: theme.colors.content.primary,\n buttonTone: \"mono\",\n IconComponent: ExclamationMarkSq,\n },\n success: {\n panelBg: theme.colors.overlay.success,\n iconFrameBg: theme.colors.background.success.primary,\n iconColor: theme.colors.content.primary,\n buttonTone: \"brandExtra\",\n IconComponent: CheckCr,\n },\n neutral: {\n panelBg: theme.colors.overlay.mono,\n iconFrameBg: theme.colors.overlay.mono,\n iconColor: theme.colors.content.primary,\n buttonTone: \"mono\",\n IconComponent: InfoSq,\n },\n brand: {\n panelBg: theme.colors.overlay.brand,\n iconFrameBg: theme.colors.overlay.brand,\n iconColor: theme.colors.content.primary,\n buttonTone: \"brand\",\n IconComponent: InfoSq,\n },\n };\n\n const currentConfig = typeConfig[type];\n const IconComponent = currentConfig.IconComponent;\n\n return (\n <Box\n backgroundColor={currentConfig.panelBg}\n borderRadius={config.borderRadius}\n flexDirection=\"row\"\n alignItems=\"stretch\"\n overflow=\"hidden\"\n testID={testID}\n role={type === \"alert\" ? \"alert\" : \"status\"}\n aria-label={`${type} notification`}\n >\n {/* Icon Frame */}\n {showIcon && (\n <Box\n backgroundColor={currentConfig.iconFrameBg}\n width={config.iconFrameWidth}\n alignItems=\"center\"\n justifyContent=\"center\"\n style={{\n borderTopLeftRadius: config.borderRadius,\n borderBottomLeftRadius: config.borderRadius,\n }}\n >\n {icon || (\n <IconComponent\n size={config.iconSize}\n color={currentConfig.iconColor}\n variant=\"solid\"\n />\n )}\n </Box>\n )}\n\n {/* Body */}\n <Box\n flex={1}\n flexDirection=\"row\"\n alignItems=\"center\"\n paddingHorizontal={config.bodyPaddingHorizontal}\n paddingVertical={config.bodyPaddingVertical}\n gap={config.contentGap}\n >\n {/* Text Content */}\n <Box flex={1} gap={config.textGap}>\n {title && (\n <Typography\n variant=\"bodyMdAccent\"\n color={theme.colors.content.primary}\n >\n {title}\n </Typography>\n )}\n {description && (\n <Typography variant=\"bodySm\" color={theme.colors.content.tertiary}>\n {description}\n </Typography>\n )}\n </Box>\n\n {/* Buttons */}\n {(actionButton || showCloseButton) && (\n <Box\n flexDirection=\"row\"\n alignSelf={closeButtonAlign === \"top\" ? \"stretch\" : \"center\"}\n alignItems={closeButtonAlign === \"top\" ? \"flex-start\" : \"center\"}\n justifyContent=\"flex-start\"\n paddingVertical={closeButtonAlign === \"top\" ? 4 : 0}\n gap={config.buttonsGap}\n >\n {isValidElement(actionButton) &&\n cloneElement(actionButton as ActionButtonElement, {\n size: \"xs\",\n variant: \"secondary\",\n })}\n\n {showCloseButton && (\n <IconButton\n variant=\"tertiary\"\n tone=\"mono\"\n size=\"xs\"\n onPress={onClose}\n aria-label=\"Close notification\"\n icon={<Remove size={18} />}\n hoverBackground=\"none\"\n />\n )}\n </Box>\n )}\n </Box>\n </Box>\n );\n};\n\nNotificationPanel.displayName = \"NotificationPanel\";\n","import React from \"react\";\nimport {\n View,\n Pressable,\n Image,\n ViewStyle,\n ImageStyle,\n DimensionValue,\n AnimatableNumericValue,\n} from \"react-native\";\nimport { BoxProps } from \"@xsolla/xui-primitives-core\";\n\nexport const Box: React.FC<BoxProps> = ({\n children,\n onPress,\n onLayout,\n onMoveShouldSetResponder,\n onResponderGrant,\n onResponderMove,\n onResponderRelease,\n onResponderTerminate,\n backgroundColor,\n borderColor,\n borderWidth,\n borderBottomWidth,\n borderBottomColor,\n borderTopWidth,\n borderTopColor,\n borderLeftWidth,\n borderLeftColor,\n borderRightWidth,\n borderRightColor,\n borderRadius,\n borderStyle,\n height,\n padding,\n paddingHorizontal,\n paddingVertical,\n margin,\n marginTop,\n marginBottom,\n marginLeft,\n marginRight,\n flexDirection,\n alignItems,\n justifyContent,\n position,\n top,\n bottom,\n left,\n right,\n width,\n minWidth,\n minHeight,\n maxWidth,\n maxHeight,\n flex,\n overflow,\n zIndex,\n hoverStyle,\n pressStyle,\n style,\n \"data-testid\": dataTestId,\n testID,\n as,\n src,\n alt,\n ...rest\n}) => {\n const getContainerStyle = (pressed?: boolean): ViewStyle => ({\n backgroundColor:\n pressed && pressStyle?.backgroundColor\n ? pressStyle.backgroundColor\n : backgroundColor,\n borderColor,\n borderWidth,\n borderBottomWidth,\n borderBottomColor,\n borderTopWidth,\n borderTopColor,\n borderLeftWidth,\n borderLeftColor,\n borderRightWidth,\n borderRightColor,\n borderRadius: borderRadius as AnimatableNumericValue,\n borderStyle: borderStyle as ViewStyle[\"borderStyle\"],\n overflow,\n zIndex,\n height: height as DimensionValue,\n width: width as DimensionValue,\n minWidth: minWidth as DimensionValue,\n minHeight: minHeight as DimensionValue,\n maxWidth: maxWidth as DimensionValue,\n maxHeight: maxHeight as DimensionValue,\n padding: padding as DimensionValue,\n paddingHorizontal: paddingHorizontal as DimensionValue,\n paddingVertical: paddingVertical as DimensionValue,\n margin: margin as DimensionValue,\n marginTop: marginTop as DimensionValue,\n marginBottom: marginBottom as DimensionValue,\n marginLeft: marginLeft as DimensionValue,\n marginRight: marginRight as DimensionValue,\n flexDirection,\n alignItems,\n justifyContent,\n position: position as ViewStyle[\"position\"],\n top: top as DimensionValue,\n bottom: bottom as DimensionValue,\n left: left as DimensionValue,\n right: right as DimensionValue,\n flex,\n ...(style as ViewStyle),\n });\n\n const finalTestID = dataTestId || testID;\n\n // Destructure and drop web-only props from rest before passing to RN components\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const {\n role,\n tabIndex,\n onKeyDown,\n onKeyUp,\n \"aria-label\": _ariaLabel,\n \"aria-labelledby\": _ariaLabelledBy,\n \"aria-current\": _ariaCurrent,\n \"aria-disabled\": _ariaDisabled,\n \"aria-live\": _ariaLive,\n className,\n \"data-testid\": _dataTestId,\n ...nativeRest\n } = rest as Record<string, unknown>;\n\n // Handle as=\"img\" for React Native\n if (as === \"img\" && src) {\n const imageStyle: ImageStyle = {\n width: width as DimensionValue,\n height: height as DimensionValue,\n borderRadius: borderRadius as number,\n position: position as ImageStyle[\"position\"],\n top: top as DimensionValue,\n bottom: bottom as DimensionValue,\n left: left as DimensionValue,\n right: right as DimensionValue,\n ...(style as ImageStyle),\n };\n\n return (\n <Image\n source={{ uri: src }}\n style={imageStyle}\n testID={finalTestID}\n resizeMode=\"cover\"\n {...nativeRest}\n />\n );\n }\n\n if (onPress) {\n return (\n <Pressable\n onPress={onPress}\n onLayout={onLayout}\n onMoveShouldSetResponder={onMoveShouldSetResponder}\n onResponderGrant={onResponderGrant}\n onResponderMove={onResponderMove}\n onResponderRelease={onResponderRelease}\n onResponderTerminate={onResponderTerminate}\n style={({ pressed }) => getContainerStyle(pressed)}\n testID={finalTestID}\n {...nativeRest}\n >\n {children}\n </Pressable>\n );\n }\n\n return (\n <View\n style={getContainerStyle()}\n testID={finalTestID}\n onLayout={onLayout}\n onMoveShouldSetResponder={onMoveShouldSetResponder}\n onResponderGrant={onResponderGrant}\n onResponderMove={onResponderMove}\n onResponderRelease={onResponderRelease}\n onResponderTerminate={onResponderTerminate}\n {...nativeRest}\n >\n {children}\n </View>\n );\n};\n"],"mappings":";AAAA,SAAgB,cAAc,sBAAsB;;;ACCpD;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OAKK;AA2ID;AAxIC,IAAM,MAA0B,CAAC;AAAA,EACtC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,eAAe;AAAA,EACf;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAAM;AACJ,QAAM,oBAAoB,CAAC,aAAkC;AAAA,IAC3D,iBACE,WAAW,YAAY,kBACnB,WAAW,kBACX;AAAA,IACN;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,I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AS,OAAO,MAAM,OAAO,QAAQ,UACtD,uBACH;AAAA,iBAEJ;AAAA,eAGE,gBAAgB,oBAChB;AAAA,gBAAC;AAAA;AAAA,kBACC,eAAc;AAAA,kBACd,WAAW,qBAAqB,QAAQ,YAAY;AAAA,kBACpD,YAAY,qBAAqB,QAAQ,eAAe;AAAA,kBACxD,gBAAe;AAAA,kBACf,iBAAiB,qBAAqB,QAAQ,IAAI;AAAA,kBAClD,KAAK,OAAO;AAAA,kBAEX;AAAA,mCAAe,YAAY,KAC1B,aAAa,cAAqC;AAAA,sBAChD,MAAM;AAAA,sBACN,SAAS;AAAA,oBACX,CAAC;AAAA,oBAEF,mBACC,gBAAAA;AAAA,sBAAC;AAAA;AAAA,wBACC,SAAQ;AAAA,wBACR,MAAK;AAAA,wBACL,MAAK;AAAA,wBACL,SAAS;AAAA,wBACT,cAAW;AAAA,wBACX,MAAM,gBAAAA,KAAC,UAAO,MAAM,IAAI;AAAA,wBACxB,iBAAgB;AAAA;AAAA,oBAClB;AAAA;AAAA;AAAA,cAEJ;AAAA;AAAA;AAAA,QAEJ;AAAA;AAAA;AAAA,EACF;AAEJ;AAEA,kBAAkB,cAAc;","names":["jsx"]}
package/package.json ADDED
@@ -0,0 +1,61 @@
1
+ {
2
+ "name": "@xsolla/xui-b2b-notification-panel",
3
+ "version": "0.147.1",
4
+ "main": "./web/index.js",
5
+ "module": "./web/index.mjs",
6
+ "types": "./web/index.d.ts",
7
+ "scripts": {
8
+ "build": "yarn build:web && yarn build:native",
9
+ "build:web": "PLATFORM=web tsup",
10
+ "build:native": "PLATFORM=native tsup",
11
+ "test": "vitest",
12
+ "test:run": "vitest run",
13
+ "test:coverage": "vitest run --coverage"
14
+ },
15
+ "dependencies": {
16
+ "@xsolla/xui-button": "0.147.1",
17
+ "@xsolla/xui-core": "0.147.1",
18
+ "@xsolla/xui-icons-base": "0.147.1",
19
+ "@xsolla/xui-primitives-core": "0.147.1",
20
+ "@xsolla/xui-typography": "0.147.1"
21
+ },
22
+ "peerDependencies": {
23
+ "react": ">=16.8.0",
24
+ "react-dom": ">=16",
25
+ "styled-components": ">=4"
26
+ },
27
+ "devDependencies": {
28
+ "@testing-library/jest-dom": "^6.9.1",
29
+ "@testing-library/react": "^14.1.2",
30
+ "@vitest/coverage-v8": "^4.0.18",
31
+ "jsdom": "^24.0.0",
32
+ "react": "^18.0.0",
33
+ "react-dom": "^18.0.0",
34
+ "tsup": "^8.0.0",
35
+ "vitest": "^4.0.18"
36
+ },
37
+ "license": "MIT",
38
+ "sideEffects": false,
39
+ "react-native": "./native/index.js",
40
+ "exports": {
41
+ ".": {
42
+ "react-native": {
43
+ "types": "./native/index.d.ts",
44
+ "import": "./native/index.mjs",
45
+ "require": "./native/index.js"
46
+ },
47
+ "import": {
48
+ "types": "./web/index.d.ts",
49
+ "default": "./web/index.mjs"
50
+ },
51
+ "require": {
52
+ "types": "./web/index.d.ts",
53
+ "default": "./web/index.js"
54
+ },
55
+ "default": {
56
+ "types": "./web/index.d.ts",
57
+ "default": "./web/index.js"
58
+ }
59
+ }
60
+ }
61
+ }
@@ -0,0 +1,33 @@
1
+ import React from 'react';
2
+ import { ThemeOverrideProps } from '@xsolla/xui-core';
3
+ import { ButtonProps, IconButtonProps } from '@xsolla/xui-button';
4
+
5
+ type ActionButtonElement = React.ReactElement<ButtonProps | IconButtonProps>;
6
+ interface NotificationPanelProps extends ThemeOverrideProps {
7
+ /** Visual variant/tone of the notification */
8
+ type?: "alert" | "warning" | "success" | "neutral" | "brand";
9
+ /** Title text (optional) */
10
+ title?: string;
11
+ /** Description text (optional) */
12
+ description?: string;
13
+ /** Show/hide the icon frame */
14
+ showIcon?: boolean;
15
+ /** Custom icon override (optional) */
16
+ icon?: React.ReactNode;
17
+ /**
18
+ * Action button (optional - pass any Button/IconButton component).
19
+ * The `tone`, `size`, and `variant` props will be automatically set.
20
+ */
21
+ actionButton?: React.ReactElement;
22
+ /** Show/hide close button */
23
+ showCloseButton?: boolean;
24
+ /** Close button click handler */
25
+ onClose?: () => void;
26
+ /** Vertical alignment of the close button — "top" (default) or "center" */
27
+ closeButtonAlign?: "center" | "top";
28
+ /** Test ID for testing frameworks */
29
+ testID?: string;
30
+ }
31
+ declare const NotificationPanel: React.FC<NotificationPanelProps>;
32
+
33
+ export { type ActionButtonElement, NotificationPanel, type NotificationPanelProps };
package/web/index.d.ts ADDED
@@ -0,0 +1,33 @@
1
+ import React from 'react';
2
+ import { ThemeOverrideProps } from '@xsolla/xui-core';
3
+ import { ButtonProps, IconButtonProps } from '@xsolla/xui-button';
4
+
5
+ type ActionButtonElement = React.ReactElement<ButtonProps | IconButtonProps>;
6
+ interface NotificationPanelProps extends ThemeOverrideProps {
7
+ /** Visual variant/tone of the notification */
8
+ type?: "alert" | "warning" | "success" | "neutral" | "brand";
9
+ /** Title text (optional) */
10
+ title?: string;
11
+ /** Description text (optional) */
12
+ description?: string;
13
+ /** Show/hide the icon frame */
14
+ showIcon?: boolean;
15
+ /** Custom icon override (optional) */
16
+ icon?: React.ReactNode;
17
+ /**
18
+ * Action button (optional - pass any Button/IconButton component).
19
+ * The `tone`, `size`, and `variant` props will be automatically set.
20
+ */
21
+ actionButton?: React.ReactElement;
22
+ /** Show/hide close button */
23
+ showCloseButton?: boolean;
24
+ /** Close button click handler */
25
+ onClose?: () => void;
26
+ /** Vertical alignment of the close button — "top" (default) or "center" */
27
+ closeButtonAlign?: "center" | "top";
28
+ /** Test ID for testing frameworks */
29
+ testID?: string;
30
+ }
31
+ declare const NotificationPanel: React.FC<NotificationPanelProps>;
32
+
33
+ export { type ActionButtonElement, NotificationPanel, type NotificationPanelProps };