@stratakit/structures 0.2.3 → 0.3.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.
- package/CHANGELOG.md +114 -0
- package/dist/AccordionItem.d.ts +64 -15
- package/dist/Banner.d.ts +156 -21
- package/dist/Banner.js +150 -49
- package/dist/DEV/Banner.js +156 -49
- package/dist/DEV/DropdownMenu.js +6 -3
- package/dist/DEV/TreeItem.js +129 -104
- package/dist/DEV/styles.css.js +1 -1
- package/dist/DEV/~utils.icons.js +2 -2
- package/dist/DropdownMenu.js +6 -3
- package/dist/Table.d.ts +12 -0
- package/dist/Tabs.d.ts +9 -2
- package/dist/TreeItem.d.ts +21 -12
- package/dist/TreeItem.js +123 -95
- package/dist/styles.css.js +1 -1
- package/dist/~utils.icons.js +2 -2
- package/package.json +7 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,119 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.3.0
|
|
4
|
+
|
|
5
|
+
### Breaking changes
|
|
6
|
+
|
|
7
|
+
- [#847](https://github.com/iTwin/design-system/pull/847): The `id` prop in `Tabs.Tab` and `tabId` prop in `Tabs.TabPanel` have been made required.
|
|
8
|
+
- [#805](https://github.com/iTwin/design-system/pull/805): Changed `actions` prop of the `Tree.Item` component to no longer automatically inline some of the actions. Instead, newly added `inlineActions` prop can be used to display up to two inline actions. All actions specified in a `actions` prop will be rendered in the action menu.
|
|
9
|
+
|
|
10
|
+
```tsx
|
|
11
|
+
<Tree.Item
|
|
12
|
+
inlineActions={[
|
|
13
|
+
<Tree.ItemAction key={…} icon={…} label={…} />,
|
|
14
|
+
<Tree.ItemAction key={…} icon={…} label={…} />,
|
|
15
|
+
]}
|
|
16
|
+
actions={[
|
|
17
|
+
<Tree.ItemAction key={…} label={…} />,
|
|
18
|
+
<Tree.ItemAction key={…} label={…} />,
|
|
19
|
+
]}
|
|
20
|
+
/>
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
A single error-related action should be specified when the tree item has an error.
|
|
24
|
+
|
|
25
|
+
```tsx
|
|
26
|
+
<Tree.Item
|
|
27
|
+
error={error}
|
|
28
|
+
inlineActions={
|
|
29
|
+
error
|
|
30
|
+
? [
|
|
31
|
+
<Tree.ItemAction key={…} icon={…} label={…} />
|
|
32
|
+
]
|
|
33
|
+
: [
|
|
34
|
+
<Tree.ItemAction key={…} icon={…} label={…} />,
|
|
35
|
+
<Tree.ItemAction key={…} icon={…} label={…} />,
|
|
36
|
+
]
|
|
37
|
+
}
|
|
38
|
+
/>
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### Non-breaking changes
|
|
42
|
+
|
|
43
|
+
- [#821](https://github.com/iTwin/design-system/pull/821): Added compositional `Banner.Root`, `Banner.Icon`, `Banner.Label`, `Banner.Message`, `Banner.Actions`, and `Banner.DismissButton` components. These new components can be used when you need fine grained configuration.
|
|
44
|
+
|
|
45
|
+
To use the compositional components, import them from the `/unstable_Banner` subpath:
|
|
46
|
+
|
|
47
|
+
```tsx
|
|
48
|
+
import * as Banner from "@stratakit/structures/unstable_Banner";
|
|
49
|
+
|
|
50
|
+
<Banner.Root>
|
|
51
|
+
<Banner.Icon href={placeholderIcon} />
|
|
52
|
+
<Banner.Label>Label</Banner.Label>
|
|
53
|
+
<Banner.Message>Message</Banner.Message>
|
|
54
|
+
<Banner.Actions>
|
|
55
|
+
<Button>Action</Button>
|
|
56
|
+
</Banner.Actions>
|
|
57
|
+
<Banner.DismissButton onClick={onDismiss} />
|
|
58
|
+
</Banner.Root>;
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
- [#716](https://github.com/iTwin/design-system/pull/716): Added support for placing `<AccordionItem.Marker>` before and `<AccordionItem.Decoration>` after the rest of the content in `<AccordionItem.Header>`.
|
|
62
|
+
|
|
63
|
+
The `<AccordionItem.Marker>` is now recommended to be placed _before_ the rest of the header content.
|
|
64
|
+
|
|
65
|
+
```tsx
|
|
66
|
+
<AccordionItem.Header>
|
|
67
|
+
<AccordionItem.Marker />
|
|
68
|
+
<AccordionItem.Button>
|
|
69
|
+
<AccordionItem.Label>Label</AccordionItem.Label>
|
|
70
|
+
</AccordionItem.Button>
|
|
71
|
+
</AccordionItem.Header>
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
- [#716](https://github.com/iTwin/design-system/pull/716): Added support for multiple decorations for `AccordionItem` when passed as children in `<AccordionItem.Decoration>`.
|
|
75
|
+
|
|
76
|
+
```tsx
|
|
77
|
+
<AccordionItem.Header>
|
|
78
|
+
<AccordionItem.Marker />
|
|
79
|
+
<AccordionItem.Decoration>
|
|
80
|
+
<Icon href={placeholder} />
|
|
81
|
+
<Icon href={placeholder} />
|
|
82
|
+
</AccordionItem.Decoration>
|
|
83
|
+
<AccordionItem.Button>
|
|
84
|
+
<AccordionItem.Label>Label</AccordionItem.Label>
|
|
85
|
+
</AccordionItem.Button>
|
|
86
|
+
</AccordionItem.Header>
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
- [#849](https://github.com/iTwin/design-system/pull/849): Add `background-color` change for the `<AccordionItem.Header>` instead of just the `<AccordionItem.Marker>` for the "hover" and "pressed" states of `<AccordionItem.Header>`.
|
|
90
|
+
|
|
91
|
+
- [#829](https://github.com/iTwin/design-system/pull/829): Improved the performance of the `Tree.Item` component by deferring the rendering of actions until the tree item becomes visible on the screen.
|
|
92
|
+
|
|
93
|
+
- [#809](https://github.com/iTwin/design-system/pull/809): Added active and active-hover states to the `Table.Row` component for styling selected rows. To enable selection, render a `Checkbox` component within the row. A row is considered selected when its checkbox is checked.
|
|
94
|
+
|
|
95
|
+
```tsx
|
|
96
|
+
<Table.Row>
|
|
97
|
+
<Table.Cell>
|
|
98
|
+
<Checkbox checked />
|
|
99
|
+
</Table.Cell>
|
|
100
|
+
<Table.Cell>Item 1</Table.Cell>
|
|
101
|
+
</Table.Row>
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
- [#854](https://github.com/iTwin/design-system/pull/854): Updated the status icons used internally by various components: `unstable_Banner`, and `unstable_ErrorRegion` and `Tree.Item`.
|
|
105
|
+
|
|
106
|
+
- Updated dependencies:
|
|
107
|
+
- @stratakit/bricks@0.3.3
|
|
108
|
+
- @stratakit/foundations@0.2.2
|
|
109
|
+
|
|
110
|
+
## 0.2.4
|
|
111
|
+
|
|
112
|
+
- [#835](https://github.com/iTwin/design-system/pull/835): Added active-hover state styles to the `Tree.Item` component.
|
|
113
|
+
- Updated dependencies:
|
|
114
|
+
- @stratakit/bricks@0.3.2
|
|
115
|
+
- @stratakit/foundations@0.2.1
|
|
116
|
+
|
|
3
117
|
## 0.2.3
|
|
4
118
|
|
|
5
119
|
- [#788](https://github.com/iTwin/design-system/pull/788): Updated `Tabs.Tab` component to support optional start and end icons.
|
package/dist/AccordionItem.d.ts
CHANGED
|
@@ -26,10 +26,10 @@ interface AccordionItemProps extends BaseProps {
|
|
|
26
26
|
* ```tsx
|
|
27
27
|
* <AccordionItem.Root>
|
|
28
28
|
* <AccordionItem.Header>
|
|
29
|
+
* <AccordionItem.Marker />
|
|
29
30
|
* <AccordionItem.Button>
|
|
30
31
|
* <AccordionItem.Label>Label</AccordionItem.Label>
|
|
31
32
|
* </AccordionItem.Button>
|
|
32
|
-
* <AccordionItem.Marker />
|
|
33
33
|
* </AccordionItem.Header>
|
|
34
34
|
* <AccordionItem.Content>Body</AccordionItem.Content>
|
|
35
35
|
* </AccordionItem.Root>
|
|
@@ -43,12 +43,12 @@ interface AccordionItemProps extends BaseProps {
|
|
|
43
43
|
* ```tsx
|
|
44
44
|
* <AccordionItem.Root>
|
|
45
45
|
* <AccordionItem.Header>
|
|
46
|
+
* <AccordionItem.Marker />
|
|
46
47
|
* <AccordionItem.Heading render={<h2 />}>
|
|
47
48
|
* <AccordionItem.Button>
|
|
48
49
|
* <AccordionItem.Label>Label</AccordionItem.Label>
|
|
49
50
|
* </AccordionItem.Button>
|
|
50
51
|
* </AccordionItem.Heading>
|
|
51
|
-
* <AccordionItem.Marker />
|
|
52
52
|
* </AccordionItem.Header>
|
|
53
53
|
* <AccordionItem.Content>Body</AccordionItem.Content>
|
|
54
54
|
* </AccordionItem.Root>
|
|
@@ -58,11 +58,11 @@ interface AccordionItemProps extends BaseProps {
|
|
|
58
58
|
* ```tsx
|
|
59
59
|
* <AccordionItem.Root>
|
|
60
60
|
* <AccordionItem.Header>
|
|
61
|
+
* <AccordionItem.Marker />
|
|
61
62
|
* <AccordionItem.Decoration render={<Icon href={placeholder} />} />
|
|
62
63
|
* <AccordionItem.Button>
|
|
63
64
|
* <AccordionItem.Label>Label</AccordionItem.Label>
|
|
64
65
|
* </AccordionItem.Button>
|
|
65
|
-
* <AccordionItem.Marker />
|
|
66
66
|
* </AccordionItem.Header>
|
|
67
67
|
* <AccordionItem.Content>Body</AccordionItem.Content>
|
|
68
68
|
* </AccordionItem.Root>
|
|
@@ -78,11 +78,11 @@ declare const AccordionItemRoot: import("react").ForwardRefExoticComponent<Accor
|
|
|
78
78
|
* Example:
|
|
79
79
|
* ```tsx
|
|
80
80
|
* <AccordionItem.Root>
|
|
81
|
-
*
|
|
81
|
+
* <AccordionItem.Header>
|
|
82
|
+
* <AccordionItem.Marker />
|
|
82
83
|
* <AccordionItem.Button>
|
|
83
84
|
* <AccordionItem.Label>Label</AccordionItem.Label>
|
|
84
85
|
* </AccordionItem.Button>
|
|
85
|
-
* <AccordionItem.Marker />
|
|
86
86
|
* </AccordionItem.Header>
|
|
87
87
|
* <AccordionItem.Content>Body</AccordionItem.Content>
|
|
88
88
|
* </AccordionItem.Root>
|
|
@@ -97,10 +97,10 @@ declare const AccordionItemHeader: import("react").ForwardRefExoticComponent<Pic
|
|
|
97
97
|
* Example:
|
|
98
98
|
* ```tsx
|
|
99
99
|
* <AccordionItem.Header>
|
|
100
|
+
* <AccordionItem.Marker />
|
|
100
101
|
* <AccordionItem.Button>
|
|
101
102
|
* <AccordionItem.Label>Label</AccordionItem.Label>
|
|
102
103
|
* </AccordionItem.Button>
|
|
103
|
-
* <AccordionItem.Marker />
|
|
104
104
|
* </AccordionItem.Header>
|
|
105
105
|
* ```
|
|
106
106
|
*/
|
|
@@ -119,45 +119,94 @@ declare const AccordionItemButton: import("react").ForwardRefExoticComponent<Pic
|
|
|
119
119
|
*/
|
|
120
120
|
declare const AccordionItemLabel: import("react").ForwardRefExoticComponent<Pick<import("@ariakit/react/role").RoleProps, "render"> & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "render"> & import("react").RefAttributes<HTMLDivElement | HTMLElement>>;
|
|
121
121
|
/**
|
|
122
|
-
* The always-visible, optional decoration of
|
|
122
|
+
* The always-visible, optional decoration of the `AccordionItem.Header` content.
|
|
123
|
+
* It can be placed before or after the rest of the content in
|
|
124
|
+
* `AccordionItem.Header`. However, the `AccordionItem.Marker` must always be
|
|
125
|
+
* placed at either edge (beginning or end) of the header.
|
|
123
126
|
*
|
|
124
|
-
* Use as a direct descendant of `AccordionItem.Header`.
|
|
125
|
-
*
|
|
127
|
+
* Use as a direct descendant of `AccordionItem.Header`. The decoration
|
|
128
|
+
* can be placed before the rest of the header content.
|
|
126
129
|
*
|
|
127
130
|
* Example:
|
|
128
131
|
* ```tsx
|
|
129
132
|
* <AccordionItem.Header>
|
|
133
|
+
* <AccordionItem.Marker />
|
|
130
134
|
* <AccordionItem.Decoration render={<Icon href={placeholder} />} />
|
|
131
135
|
* <AccordionItem.Button>
|
|
132
136
|
* <AccordionItem.Label>Label</AccordionItem.Label>
|
|
133
137
|
* </AccordionItem.Button>
|
|
138
|
+
* </AccordionItem.Header>
|
|
139
|
+
* ```
|
|
140
|
+
*
|
|
141
|
+
* Alternatively, the decoration can also be placed after the rest of the
|
|
142
|
+
* header content.
|
|
143
|
+
*
|
|
144
|
+
* Example:
|
|
145
|
+
* ```tsx
|
|
146
|
+
* <AccordionItem.Header>
|
|
147
|
+
* <AccordionItem.Marker />
|
|
148
|
+
* <AccordionItem.Button>
|
|
149
|
+
* <AccordionItem.Label>Label</AccordionItem.Label>
|
|
150
|
+
* </AccordionItem.Button>
|
|
151
|
+
* <AccordionItem.Decoration render={<Icon href={placeholder} />} />
|
|
152
|
+
* </AccordionItem.Header>
|
|
153
|
+
* ```
|
|
154
|
+
*
|
|
155
|
+
* There can also be multiple decorations if passed as children under
|
|
156
|
+
* `AccordionItem.Decoration`.
|
|
157
|
+
*
|
|
158
|
+
* Example:
|
|
159
|
+
* ```tsx
|
|
160
|
+
* <AccordionItem.Header>
|
|
134
161
|
* <AccordionItem.Marker />
|
|
162
|
+
* <AccordionItem.Decoration>
|
|
163
|
+
* <Icon href={placeholder} />
|
|
164
|
+
* <Icon href={placeholder} />
|
|
165
|
+
* </AccordionItem.Decoration>
|
|
166
|
+
* <AccordionItem.Button>
|
|
167
|
+
* <AccordionItem.Label>Label</AccordionItem.Label>
|
|
168
|
+
* </AccordionItem.Button>
|
|
135
169
|
* </AccordionItem.Header>
|
|
136
170
|
* ```
|
|
137
171
|
*/
|
|
138
172
|
declare const AccordionItemDecoration: import("react").ForwardRefExoticComponent<Pick<import("@ariakit/react/role").RoleProps, "render"> & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "render"> & import("react").RefAttributes<HTMLDivElement | HTMLElement>>;
|
|
139
173
|
/**
|
|
140
|
-
* The visual marker of
|
|
174
|
+
* The visual marker of the `AccordionItem.Header` content. While it can be
|
|
175
|
+
* placed before or after the rest of the content in `AccordionItem.Header`,
|
|
176
|
+
* it is recommended to place the marker before.
|
|
141
177
|
*
|
|
142
178
|
* Example:
|
|
143
179
|
* ```tsx
|
|
144
180
|
* <AccordionItem.Header>
|
|
181
|
+
* <AccordionItem.Marker />
|
|
145
182
|
* <AccordionItem.Button>
|
|
146
183
|
* <AccordionItem.Label>Label</AccordionItem.Label>
|
|
147
184
|
* </AccordionItem.Button>
|
|
148
|
-
* <AccordionItem.Marker />
|
|
149
185
|
* </AccordionItem.Header>
|
|
150
186
|
* ```
|
|
151
187
|
*
|
|
152
|
-
*
|
|
188
|
+
* Alternatively, the marker can also be placed after the rest of the header
|
|
189
|
+
* content.
|
|
190
|
+
*
|
|
191
|
+
* Example:
|
|
153
192
|
* ```tsx
|
|
154
193
|
* <AccordionItem.Header>
|
|
155
194
|
* <AccordionItem.Button>
|
|
156
195
|
* <AccordionItem.Label>Label</AccordionItem.Label>
|
|
157
196
|
* </AccordionItem.Button>
|
|
197
|
+
* <AccordionItem.Marker />
|
|
198
|
+
* </AccordionItem.Header>
|
|
199
|
+
* ```
|
|
200
|
+
*
|
|
201
|
+
* Pass an icon as a child to override the default chevron icon:
|
|
202
|
+
* ```tsx
|
|
203
|
+
* <AccordionItem.Header>
|
|
158
204
|
* <AccordionItem.Marker>
|
|
159
205
|
* <Icon href={placeholder} />
|
|
160
206
|
* </AccordionItem.Marker>
|
|
207
|
+
* <AccordionItem.Button>
|
|
208
|
+
* <AccordionItem.Label>Label</AccordionItem.Label>
|
|
209
|
+
* </AccordionItem.Button>
|
|
161
210
|
* </AccordionItem.Header>
|
|
162
211
|
* ```
|
|
163
212
|
*/
|
|
@@ -168,11 +217,11 @@ declare const AccordionItemMarker: import("react").ForwardRefExoticComponent<Pic
|
|
|
168
217
|
* Example:
|
|
169
218
|
* ```tsx
|
|
170
219
|
* <AccordionItem.Root>
|
|
171
|
-
*
|
|
220
|
+
* <AccordionItem.Header>
|
|
221
|
+
* <AccordionItem.Marker />
|
|
172
222
|
* <AccordionItem.Button>
|
|
173
223
|
* <AccordionItem.Label>Label</AccordionItem.Label>
|
|
174
224
|
* </AccordionItem.Button>
|
|
175
|
-
* <AccordionItem.Marker />
|
|
176
225
|
* </AccordionItem.Header>
|
|
177
226
|
* <AccordionItem.Content>Body</AccordionItem.Content>
|
|
178
227
|
* </AccordionItem.Root>
|
|
@@ -190,12 +239,12 @@ interface AccordionItemHeadingProps extends BaseProps {
|
|
|
190
239
|
* Example:
|
|
191
240
|
* ```tsx
|
|
192
241
|
* <AccordionItem.Header>
|
|
242
|
+
* <AccordionItem.Marker />
|
|
193
243
|
* <AccordionItem.Heading render={<h2 />}>
|
|
194
244
|
* <AccordionItem.Button>
|
|
195
245
|
* <AccordionItem.Label>Label</AccordionItem.Label>
|
|
196
246
|
* </AccordionItem.Button>
|
|
197
247
|
* </AccordionItem.Heading>
|
|
198
|
-
* <AccordionItem.Marker />
|
|
199
248
|
* </AccordionItem.Header>
|
|
200
249
|
*/
|
|
201
250
|
declare const AccordionItemHeading: import("react").ForwardRefExoticComponent<AccordionItemHeadingProps & import("react").RefAttributes<HTMLDivElement | HTMLElement>>;
|
package/dist/Banner.d.ts
CHANGED
|
@@ -1,33 +1,178 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
+
import { Icon } from "@stratakit/foundations";
|
|
2
3
|
import type { BaseProps } from "@stratakit/foundations/secret-internals";
|
|
4
|
+
interface BannerRootProps extends BaseProps<"div"> {
|
|
5
|
+
/**
|
|
6
|
+
* The tone of the banner.
|
|
7
|
+
*
|
|
8
|
+
* @default "neutral"
|
|
9
|
+
*/
|
|
10
|
+
tone?: "neutral" | "info" | "positive" | "attention" | "critical";
|
|
11
|
+
/**
|
|
12
|
+
* The variant of the banner.
|
|
13
|
+
*
|
|
14
|
+
* @default "outline"
|
|
15
|
+
*/
|
|
16
|
+
variant?: "outline";
|
|
17
|
+
}
|
|
3
18
|
/**
|
|
4
19
|
* A banner to highlight information and also optionally provide actions.
|
|
5
20
|
* The information could be very important (like a call to action) or reasonably import (like a status message).
|
|
6
21
|
*
|
|
7
22
|
* Example:
|
|
8
23
|
* ```tsx
|
|
9
|
-
* <Banner
|
|
24
|
+
* <Banner.Root tone="info" variant="outline">
|
|
25
|
+
* <Banner.Icon />
|
|
26
|
+
* <Banner.Label>Label</Banner.Label>
|
|
27
|
+
* <Banner.Message>Message</Banner.Message>
|
|
28
|
+
* <Banner.DismissButton onClick={onDismiss} />
|
|
29
|
+
* </Banner.Root>
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
declare const BannerRoot: React.ForwardRefExoticComponent<BannerRootProps & React.RefAttributes<HTMLDivElement | HTMLElement>>;
|
|
33
|
+
interface BannerIconProps extends React.ComponentProps<typeof Icon> {
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* A static icon decoration for the banner.
|
|
37
|
+
*
|
|
38
|
+
* - If no `href` is passed and the `tone` is `"neutral"`, no icon is shown.
|
|
39
|
+
* - If no `href` is passed and the `tone` is not` "neutral"`, the status icon is shown.
|
|
40
|
+
*
|
|
41
|
+
* Example with default status icon:
|
|
42
|
+
* ```tsx
|
|
43
|
+
* <Banner.Root tone="info">
|
|
44
|
+
* <Banner.Icon />
|
|
45
|
+
* </Banner.Root>
|
|
46
|
+
*
|
|
47
|
+
* Example with custom icon:
|
|
48
|
+
* ```tsx
|
|
49
|
+
* import placeholderIcon from "@stratakit/icons/placeholder.svg";
|
|
50
|
+
*
|
|
51
|
+
* <Banner.Root>
|
|
52
|
+
* <Banner.Icon href={placeholderIcon} />
|
|
53
|
+
* </Banner.Root>
|
|
54
|
+
* ```
|
|
55
|
+
*/
|
|
56
|
+
declare const BannerIcon: React.ForwardRefExoticComponent<Omit<BannerIconProps, "ref"> & React.RefAttributes<HTMLElement | SVGSVGElement>>;
|
|
57
|
+
interface BannerLabelProps extends BaseProps<"span"> {
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* The label of the banner.
|
|
61
|
+
*
|
|
62
|
+
* Pass `render={<VisuallyHidden />}` if you don't want the label to be visible.
|
|
63
|
+
*
|
|
64
|
+
* Example:
|
|
65
|
+
* ```tsx
|
|
66
|
+
* <Banner.Root>
|
|
67
|
+
* <Banner.Label>Label</Banner.Label>
|
|
68
|
+
* </Banner.Root>
|
|
69
|
+
* ```
|
|
70
|
+
*
|
|
71
|
+
* Example with a visually hidden label:
|
|
72
|
+
* ```tsx
|
|
73
|
+
* <Banner.Root>
|
|
74
|
+
* <Banner.Label render={<VisuallyHidden />}>Label</Banner.Label>
|
|
75
|
+
* </Banner.Root>
|
|
76
|
+
* ```
|
|
77
|
+
*/
|
|
78
|
+
declare const BannerLabel: React.ForwardRefExoticComponent<BannerLabelProps & React.RefAttributes<HTMLElement | HTMLSpanElement>>;
|
|
79
|
+
interface BannerMessageProps extends BaseProps<"div"> {
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* The message content of the banner.
|
|
83
|
+
*
|
|
84
|
+
* Example:
|
|
85
|
+
* ```tsx
|
|
86
|
+
* <Banner.Root>
|
|
87
|
+
* <Banner.Message>Message content goes here.</Banner.Message>
|
|
88
|
+
* </Banner.Root>
|
|
10
89
|
* ```
|
|
11
90
|
*/
|
|
12
|
-
declare const
|
|
91
|
+
declare const BannerMessage: React.ForwardRefExoticComponent<BannerMessageProps & React.RefAttributes<HTMLElement | HTMLSpanElement>>;
|
|
92
|
+
interface BannerActionsProps extends BaseProps<"div"> {
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* The actions available for the banner.
|
|
96
|
+
*
|
|
97
|
+
* Example with one action:
|
|
98
|
+
* ```tsx
|
|
99
|
+
* <Banner.Root>
|
|
100
|
+
* <Banner.Actions>
|
|
101
|
+
* <Button key={…} onClick={…}>Action</Button>
|
|
102
|
+
* </Banner.Actions>
|
|
103
|
+
* </Banner.Root>
|
|
104
|
+
* ```
|
|
105
|
+
*
|
|
106
|
+
* Example with two `Button`s:
|
|
107
|
+
* ```tsx
|
|
108
|
+
* <Banner.Root>
|
|
109
|
+
* <Banner.Actions>
|
|
110
|
+
* <Button key={…} onClick={…}>Action 1</Button>
|
|
111
|
+
* <Button key={…} onClick={…}>Action 2</Button>
|
|
112
|
+
* </Banner.Actions>
|
|
113
|
+
* </Banner.Root>
|
|
114
|
+
* ```
|
|
115
|
+
*
|
|
116
|
+
* Example with two `Anchor`s as `Button`:
|
|
117
|
+
* ```tsx
|
|
118
|
+
* <Banner.Root>
|
|
119
|
+
* <Banner.Actions>
|
|
120
|
+
* <Anchor key={…} render={<button />} onClick={…}>Action 1</Anchor>,
|
|
121
|
+
* <Anchor key={…} render={<button />} onClick={…}>Action 2</Anchor>,
|
|
122
|
+
* </Banner.Actions>
|
|
123
|
+
* </Banner.Root>
|
|
124
|
+
* ```
|
|
125
|
+
*/
|
|
126
|
+
declare const BannerActions: React.ForwardRefExoticComponent<BannerActionsProps & React.RefAttributes<HTMLDivElement | HTMLElement>>;
|
|
127
|
+
interface BannerDismissButtonProps extends Omit<BaseProps<"button">, "children"> {
|
|
13
128
|
/**
|
|
14
|
-
*
|
|
129
|
+
* Label for the dismiss button.
|
|
15
130
|
*
|
|
16
|
-
*
|
|
17
|
-
* or a custom JSX icon.
|
|
131
|
+
* The final accessible name of the dismiss button is a combination of this `label` and the text content of `Banner.Label`.
|
|
18
132
|
*
|
|
19
|
-
*
|
|
20
|
-
|
|
133
|
+
* @default "Dismiss"
|
|
134
|
+
*/
|
|
135
|
+
label?: string;
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Dismiss ("❌") button for the banner.
|
|
139
|
+
* Handle the `onClick` callback to dismiss the banner.
|
|
140
|
+
*
|
|
141
|
+
* Example:
|
|
142
|
+
* ```tsx
|
|
143
|
+
* <Banner.Root>
|
|
144
|
+
* <Banner.DismissButton onClick={() => {}} />
|
|
145
|
+
* </Banner.Root>
|
|
146
|
+
* ```
|
|
147
|
+
*/
|
|
148
|
+
declare const BannerDismissButton: React.ForwardRefExoticComponent<BannerDismissButtonProps & React.RefAttributes<HTMLElement | HTMLButtonElement>>;
|
|
149
|
+
/**
|
|
150
|
+
* A banner to highlight information and also optionally provide actions.
|
|
151
|
+
* The information could be very important (like a call to action) or reasonably import (like a status message).
|
|
152
|
+
*
|
|
153
|
+
* Example:
|
|
154
|
+
* ```tsx
|
|
155
|
+
* <Banner label="Label" message="Message" icon={placeholderIcon} onDismiss={() => {}} />
|
|
156
|
+
* ```
|
|
157
|
+
*/
|
|
158
|
+
declare const Banner: React.ForwardRefExoticComponent<Omit<BaseProps, "children"> & Pick<BannerRootProps, "tone" | "variant"> & {
|
|
159
|
+
/**
|
|
160
|
+
* A static icon decoration for the banner.
|
|
161
|
+
*
|
|
162
|
+
* Can be a URL of an SVG from the `@stratakit/icons` package, or a custom JSX icon.
|
|
163
|
+
*
|
|
164
|
+
* - If no `icon` is passed and the `tone` is `"neutral"`, no icon is shown.
|
|
165
|
+
* - If no `icon` is passed and the `tone` is not `"neutral"`, the status icon is shown.
|
|
21
166
|
*/
|
|
22
167
|
icon?: string | React.JSX.Element;
|
|
23
168
|
/**
|
|
24
|
-
* The label
|
|
169
|
+
* The label of the banner.
|
|
25
170
|
*
|
|
26
171
|
* Either pass a string or a `<VisuallyHidden>` component if you don't want the label to be visible.
|
|
27
172
|
*/
|
|
28
173
|
label: string | React.JSX.Element;
|
|
29
174
|
/**
|
|
30
|
-
* The content of the banner.
|
|
175
|
+
* The message content of the banner.
|
|
31
176
|
*/
|
|
32
177
|
message: React.ReactNode;
|
|
33
178
|
/**
|
|
@@ -64,19 +209,9 @@ declare const Banner: React.ForwardRefExoticComponent<Omit<BaseProps, "children"
|
|
|
64
209
|
* <Anchor key={…} render={<button />} onClick={…}>Action 2</Anchor>,
|
|
65
210
|
* </>
|
|
66
211
|
* }
|
|
212
|
+
* ```
|
|
67
213
|
*/
|
|
68
214
|
actions?: React.ReactNode;
|
|
69
|
-
/**
|
|
70
|
-
* The tone of the banner.
|
|
71
|
-
*
|
|
72
|
-
* @default "neutral"
|
|
73
|
-
*/
|
|
74
|
-
tone?: "neutral" | "info" | "positive" | "attention" | "critical";
|
|
75
|
-
/**
|
|
76
|
-
* The variant of the banner.
|
|
77
|
-
*
|
|
78
|
-
* @default "outline"
|
|
79
|
-
*/
|
|
80
|
-
variant?: "outline";
|
|
81
215
|
} & React.RefAttributes<HTMLDivElement | HTMLElement>>;
|
|
82
216
|
export default Banner;
|
|
217
|
+
export { BannerRoot as Root, BannerIcon as Icon, BannerLabel as Label, BannerMessage as Message, BannerActions as Actions, BannerDismissButton as DismissButton, };
|