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