@xsolla/xui-b2b-notification-panel 0.148.0 → 0.148.2

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.
Files changed (2) hide show
  1. package/README.md +161 -0
  2. package/package.json +6 -6
package/README.md ADDED
@@ -0,0 +1,161 @@
1
+ # B2B NotificationPanel
2
+
3
+ A full-width horizontal notification bar for persistent inline feedback within B2B page layouts. Unlike toast notifications, `NotificationPanel` stays in place until explicitly dismissed and is designed to sit inline within a page or panel — not as a floating overlay.
4
+
5
+ > **See also:** [`@xsolla/xui-notification-panel`](./notification-panel.md) for the base (non-B2B) variant.
6
+
7
+ ## Installation
8
+
9
+ ```bash
10
+ npm install @xsolla/xui-b2b-notification-panel
11
+ # or
12
+ yarn add @xsolla/xui-b2b-notification-panel
13
+ ```
14
+
15
+ ## Demo
16
+
17
+ ### Basic
18
+
19
+ ```tsx
20
+ import React from 'react';
21
+ import { NotificationPanel } from '@xsolla/xui-b2b-notification-panel';
22
+
23
+ export default function BasicNotificationPanel() {
24
+ return (
25
+ <NotificationPanel
26
+ type="success"
27
+ title="Changes saved"
28
+ description="Your settings have been updated successfully."
29
+ />
30
+ );
31
+ }
32
+ ```
33
+
34
+ ### All Types
35
+
36
+ ```tsx
37
+ <NotificationPanel type="neutral" title="Info" description="Informational message." />
38
+ <NotificationPanel type="success" title="Success" description="Operation completed." />
39
+ <NotificationPanel type="warning" title="Warning" description="Please review before proceeding." />
40
+ <NotificationPanel type="alert" title="Error" description="Something went wrong." />
41
+ <NotificationPanel type="brand" title="New" description="A branded announcement." />
42
+ ```
43
+
44
+ ### With Action Button
45
+
46
+ The `actionButton` prop accepts any `Button` or `IconButton`. `tone`, `size`, and `variant` are injected automatically to match the notification type.
47
+
48
+ ```tsx
49
+ import { NotificationPanel } from '@xsolla/xui-b2b-notification-panel';
50
+ import { Button } from '@xsolla/xui-button';
51
+
52
+ <NotificationPanel
53
+ type="warning"
54
+ title="Session expiring"
55
+ description="Your session will expire in 5 minutes."
56
+ actionButton={
57
+ <Button onPress={() => extendSession()}>
58
+ Extend session
59
+ </Button>
60
+ }
61
+ onClose={() => dismiss()}
62
+ />
63
+ ```
64
+
65
+ ### With IconButton Action
66
+
67
+ ```tsx
68
+ import { NotificationPanel } from '@xsolla/xui-b2b-notification-panel';
69
+ import { IconButton } from '@xsolla/xui-button';
70
+ import { ArrowRight } from '@xsolla/xui-icons-base';
71
+
72
+ <NotificationPanel
73
+ type="neutral"
74
+ description="View all available webhooks in the documentation."
75
+ actionButton={
76
+ <IconButton icon={<ArrowRight />} onPress={() => openDocs()} />
77
+ }
78
+ showCloseButton={false}
79
+ />
80
+ ```
81
+
82
+ ### Persistent (No Close Button)
83
+
84
+ ```tsx
85
+ <NotificationPanel
86
+ type="alert"
87
+ title="Payment failed"
88
+ description="Please update your billing information to continue."
89
+ showCloseButton={false}
90
+ />
91
+ ```
92
+
93
+ ### Without Icon Frame
94
+
95
+ ```tsx
96
+ <NotificationPanel
97
+ type="neutral"
98
+ title="Notice"
99
+ description="This notification has no icon."
100
+ showIcon={false}
101
+ />
102
+ ```
103
+
104
+ ### Center-Aligned Close Button
105
+
106
+ Use `closeButtonAlign="center"` for single-line notifications where vertically centered alignment looks better.
107
+
108
+ ```tsx
109
+ <NotificationPanel
110
+ type="success"
111
+ title="Saved"
112
+ closeButtonAlign="center"
113
+ onClose={() => dismiss()}
114
+ />
115
+ ```
116
+
117
+ ## API Reference
118
+
119
+ ### NotificationPanel
120
+
121
+ | Prop | Type | Default | Description |
122
+ | :--- | :--- | :------ | :---------- |
123
+ | `type` | `"alert" \| "warning" \| "success" \| "neutral" \| "brand"` | `"neutral"` | Visual tone of the panel. Controls background color, icon, and button tone. |
124
+ | `title` | `string` | — | Bold title text (optional). |
125
+ | `description` | `string` | — | Secondary description text (optional). |
126
+ | `showIcon` | `boolean` | `true` | Show or hide the icon frame on the left. |
127
+ | `icon` | `ReactNode` | — | Custom icon to replace the default type icon. |
128
+ | `actionButton` | `ReactElement` | — | Action button (`Button` or `IconButton`). `tone`, `size="xs"`, and `variant="secondary"` are auto-applied. |
129
+ | `showCloseButton` | `boolean` | `true` | Show or hide the dismiss (×) button. |
130
+ | `onClose` | `() => void` | — | Called when the close button is pressed. |
131
+ | `closeButtonAlign` | `"top" \| "center"` | `"top"` | Vertical alignment of the close button. Use `"center"` for single-line panels. |
132
+ | `testID` | `string` | — | Test ID for testing frameworks. |
133
+ | `themeMode` | `string` | — | Override the global theme mode for this component. |
134
+ | `themeProductContext` | `string` | — | Override the global product context for this component. |
135
+
136
+ ### Auto-Applied Button Props
137
+
138
+ When an element is passed to `actionButton`, the following props are injected automatically:
139
+
140
+ | Prop | Value |
141
+ | :--- | :---- |
142
+ | `size` | `"xs"` |
143
+ | `variant` | `"secondary"` |
144
+ | `tone` | Based on `type` (see table below) |
145
+
146
+ ### Type → Button Tone Mapping
147
+
148
+ | Type | Button Tone |
149
+ | :--- | :---------- |
150
+ | `neutral` | `mono` |
151
+ | `success` | `brandExtra` |
152
+ | `warning` | `mono` |
153
+ | `alert` | `alert` |
154
+ | `brand` | `brand` |
155
+
156
+ ## Accessibility
157
+
158
+ - `role="alert"` for `type="alert"`; `role="status"` for all other types.
159
+ - `aria-label` set to `"<type> notification"` on the root element.
160
+ - Close button has `aria-label="Close notification"`.
161
+ - Icons are decorative and hidden from screen readers.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xsolla/xui-b2b-notification-panel",
3
- "version": "0.148.0",
3
+ "version": "0.148.2",
4
4
  "main": "./web/index.js",
5
5
  "module": "./web/index.mjs",
6
6
  "types": "./web/index.d.ts",
@@ -13,11 +13,11 @@
13
13
  "test:coverage": "vitest run --coverage"
14
14
  },
15
15
  "dependencies": {
16
- "@xsolla/xui-button": "0.148.0",
17
- "@xsolla/xui-core": "0.148.0",
18
- "@xsolla/xui-icons-base": "0.148.0",
19
- "@xsolla/xui-primitives-core": "0.148.0",
20
- "@xsolla/xui-typography": "0.148.0"
16
+ "@xsolla/xui-button": "0.148.2",
17
+ "@xsolla/xui-core": "0.148.2",
18
+ "@xsolla/xui-icons-base": "0.148.2",
19
+ "@xsolla/xui-primitives-core": "0.148.2",
20
+ "@xsolla/xui-typography": "0.148.2"
21
21
  },
22
22
  "peerDependencies": {
23
23
  "react": ">=16.8.0",