aidos-ui 4.0.0 → 4.0.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.
- package/.claude/settings.local.json +14 -1
- package/CLAUDE.md +72 -0
- package/dist/BaseButton.js.map +1 -1
- package/dist/BaseLink.js.map +1 -1
- package/dist/BaseListItem.d.ts +1 -1
- package/dist/Calendar.d.ts +2 -2
- package/dist/Card.js +1 -1
- package/dist/Card.js.map +1 -1
- package/dist/DarkMode.js.map +1 -1
- package/dist/DatePicker.js.map +1 -1
- package/dist/Dialog.d.ts +3 -3
- package/dist/Dialog.js +7 -1
- package/dist/Dialog.js.map +1 -1
- package/dist/Dropdown.js.map +1 -1
- package/dist/Icon.d.ts +3 -3
- package/dist/Icon.js +2 -21
- package/dist/Icon.js.map +1 -1
- package/dist/Interactable.js.map +1 -1
- package/dist/NextJSRouterState.js.map +1 -1
- package/dist/OnVisible.d.ts +1 -1
- package/dist/OnVisible.js.map +1 -1
- package/dist/Popover.d.ts +3 -3
- package/dist/Popover.js +3 -1
- package/dist/Popover.js.map +1 -1
- package/dist/Providers.d.ts +2 -2
- package/dist/RangeInput.d.ts +1 -1
- package/dist/RootView.js.map +1 -1
- package/dist/Select.d.ts +0 -1
- package/dist/Storage.d.ts +2 -1
- package/dist/Storage.js.map +1 -1
- package/dist/Stream.js.map +1 -1
- package/dist/Text.js.map +1 -1
- package/dist/TextInput.d.ts +3 -2
- package/dist/TextInput.js +13 -4
- package/dist/TextInput.js.map +1 -1
- package/dist/TextPairing.js.map +1 -1
- package/dist/Tooltip.d.ts +2 -2
- package/dist/Tooltip.js +3 -2
- package/dist/Tooltip.js.map +1 -1
- package/dist/aria.js.map +1 -1
- package/dist/hash.js.map +1 -1
- package/dist/jss.d.ts +11 -6
- package/dist/jss.js +47 -2
- package/dist/jss.js.map +1 -1
- package/dist/numberToBase.js.map +1 -1
- package/dist/stateMachineContextFactory.js.map +1 -1
- package/dist/useCookie.js.map +1 -1
- package/dist/useKeyboard.js.map +1 -1
- package/dist/useNavigation.js.map +1 -1
- package/dist/useRefEffect.js.map +1 -1
- package/next-env.d.ts +2 -1
- package/next.config.js +2 -1
- package/package.json +27 -20
- package/src/BaseListItem.tsx +1 -1
- package/src/Calendar.tsx +2 -2
- package/src/Card.tsx +1 -1
- package/src/Dialog.tsx +10 -4
- package/src/Icon.tsx +4 -30
- package/src/Popover.tsx +6 -4
- package/src/Providers.tsx +1 -1
- package/src/RangeInput.tsx +1 -1
- package/src/Storage.tsx +1 -1
- package/src/TextInput.tsx +17 -5
- package/src/Tooltip.tsx +5 -4
- package/src/docs/mdx.tsx +40 -0
- package/src/docs/searchIndex.ts +1 -1
- package/src/jss.tsx +55 -3
- package/src/pages/Badge.mdx +136 -14
- package/src/pages/Button.mdx +121 -63
- package/src/pages/Calendar.mdx +196 -2
- package/src/pages/Card.mdx +123 -47
- package/src/pages/Checkbox.mdx +103 -28
- package/src/pages/Dialog.mdx +172 -7
- package/src/pages/FlexLayout.mdx +185 -51
- package/src/pages/Hashing.mdx +199 -8
- package/src/pages/Icon.mdx +150 -42
- package/src/pages/IconButton.mdx +127 -116
- package/src/pages/Link.mdx +118 -47
- package/src/pages/List.mdx +167 -283
- package/src/pages/ListHeader.mdx +157 -27
- package/src/pages/Popover.mdx +177 -55
- package/src/pages/ProgressBar.mdx +186 -6
- package/src/pages/ProgressCircle.mdx +196 -13
- package/src/pages/RangeInput.mdx +189 -61
- package/src/pages/Tabs.mdx +202 -346
- package/src/pages/Text.mdx +102 -81
- package/src/pages/TextInput.mdx +169 -44
- package/src/pages/TextPairing.mdx +164 -115
- package/src/pages/TimeInput.mdx +142 -37
- package/src/pages/Tooltip.mdx +99 -12
- package/src/pages/_app.tsx +13 -3
- package/src/pages/css-in-js.mdx +196 -83
- package/src/pages/navigation.mdx +122 -20
- package/src/pages/useCookie.mdx +168 -7
- package/src/pages/useKeyboard.mdx +242 -5
- package/src/pages/useNavigation.mdx +244 -16
- package/src/pages/usePromise.mdx +271 -6
- package/src/pages/useRefEffect.mdx +230 -28
- package/tsconfig.json +13 -4
package/src/pages/ListHeader.mdx
CHANGED
|
@@ -2,30 +2,56 @@ import { List } from "../List";
|
|
|
2
2
|
import { Icon } from "../Icon";
|
|
3
3
|
import { ListItem } from "../ListItem";
|
|
4
4
|
import { ListHeaderItem } from "../ListHeaderItem";
|
|
5
|
+
import { Column } from "../Column";
|
|
6
|
+
import { Span } from "../Text";
|
|
5
7
|
|
|
6
|
-
#
|
|
8
|
+
# ListHeaderItem
|
|
7
9
|
|
|
8
|
-
|
|
10
|
+
A specialized list item for section headers. Use to organize and visually separate groups within a list.
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## Props
|
|
15
|
+
|
|
16
|
+
| Prop | Type | Default | Description |
|
|
17
|
+
|------|------|---------|-------------|
|
|
18
|
+
| `headline` | `string` | Required | Header text |
|
|
19
|
+
| `body` | `string` | - | Optional secondary text |
|
|
20
|
+
| `highlight` | `boolean` | `false` | Use accent background color |
|
|
21
|
+
| `addOn` | `ReactNode` | - | Icon or element to display |
|
|
22
|
+
| `addOnPosition` | `Position` | - | Position of the add-on |
|
|
23
|
+
| `withDivider` | `boolean` | - | Show divider below header |
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## Basic usage
|
|
9
28
|
|
|
10
29
|
<List ariaLabel="example">
|
|
11
|
-
<ListHeaderItem headline="
|
|
12
|
-
<ListItem headline="
|
|
13
|
-
<
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
/>
|
|
17
|
-
<ListItem headline="Headline 2" body="Body 2" />
|
|
18
|
-
<ListHeaderItem highlight headline="Header" />
|
|
19
|
-
<ListItem headline="Headline 3" body="Body 3" />
|
|
20
|
-
<ListHeaderItem
|
|
21
|
-
highlight
|
|
22
|
-
headline="Header"
|
|
23
|
-
addOn={<Icon icon="fa-chain-broken" size="medium" color="light" />}
|
|
24
|
-
/>
|
|
25
|
-
<ListItem withDivider={false} headline="Headline 4" body="Body 3" />
|
|
30
|
+
<ListHeaderItem headline="Section A" />
|
|
31
|
+
<ListItem headline="Item 1" body="Description" />
|
|
32
|
+
<ListItem headline="Item 2" body="Description" />
|
|
33
|
+
<ListHeaderItem headline="Section B" />
|
|
34
|
+
<ListItem headline="Item 3" body="Description" />
|
|
35
|
+
<ListItem withDivider={false} headline="Item 4" body="Description" />
|
|
26
36
|
</List>
|
|
27
37
|
|
|
28
38
|
```js
|
|
39
|
+
<List ariaLabel="example">
|
|
40
|
+
<ListHeaderItem headline="Section A" />
|
|
41
|
+
<ListItem headline="Item 1" body="Description" />
|
|
42
|
+
<ListItem headline="Item 2" body="Description" />
|
|
43
|
+
<ListHeaderItem headline="Section B" />
|
|
44
|
+
<ListItem headline="Item 3" body="Description" />
|
|
45
|
+
<ListItem headline="Item 4" body="Description" />
|
|
46
|
+
</List>
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
## Styles
|
|
52
|
+
|
|
53
|
+
### Standard headers
|
|
54
|
+
|
|
29
55
|
<List ariaLabel="example">
|
|
30
56
|
<ListHeaderItem headline="Header" />
|
|
31
57
|
<ListItem headline="Headline 1" body="Body 1" />
|
|
@@ -43,12 +69,34 @@ import { ListHeaderItem } from "../ListHeaderItem";
|
|
|
43
69
|
/>
|
|
44
70
|
<ListItem withDivider={false} headline="Headline 4" body="Body 3" />
|
|
45
71
|
</List>
|
|
72
|
+
|
|
73
|
+
```js
|
|
74
|
+
// Plain header
|
|
75
|
+
<ListHeaderItem headline="Header" />
|
|
76
|
+
|
|
77
|
+
// With icon
|
|
78
|
+
<ListHeaderItem
|
|
79
|
+
headline="Header"
|
|
80
|
+
addOn={<Icon icon="fa-chain-broken" size="medium" color="primary" />}
|
|
81
|
+
/>
|
|
82
|
+
|
|
83
|
+
// Highlighted (accent background)
|
|
84
|
+
<ListHeaderItem highlight headline="Header" />
|
|
85
|
+
|
|
86
|
+
// Highlighted with icon
|
|
87
|
+
<ListHeaderItem
|
|
88
|
+
highlight
|
|
89
|
+
headline="Header"
|
|
90
|
+
addOn={<Icon icon="fa-chain-broken" size="medium" color="light" />}
|
|
91
|
+
/>
|
|
46
92
|
```
|
|
47
93
|
|
|
48
94
|
---
|
|
49
95
|
|
|
50
96
|
## Bare list headers
|
|
51
97
|
|
|
98
|
+
In bare lists, headers have no background:
|
|
99
|
+
|
|
52
100
|
<List bare ariaLabel="example">
|
|
53
101
|
<ListHeaderItem headline="Header" />
|
|
54
102
|
<ListItem headline="Headline 1" body="Body 1" />
|
|
@@ -70,21 +118,103 @@ import { ListHeaderItem } from "../ListHeaderItem";
|
|
|
70
118
|
```js
|
|
71
119
|
<List bare ariaLabel="example">
|
|
72
120
|
<ListHeaderItem headline="Header" />
|
|
73
|
-
<ListItem headline="
|
|
121
|
+
<ListItem headline="Item" body="Description" />
|
|
122
|
+
|
|
123
|
+
{/* Highlighted in bare mode uses highlight text color instead */}
|
|
124
|
+
<ListHeaderItem highlight headline="Header" />
|
|
125
|
+
<ListItem headline="Item" body="Description" />
|
|
126
|
+
</List>
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
---
|
|
130
|
+
|
|
131
|
+
## With icons
|
|
132
|
+
|
|
133
|
+
Add context with icons:
|
|
134
|
+
|
|
135
|
+
```js
|
|
136
|
+
// Category header
|
|
137
|
+
<ListHeaderItem
|
|
138
|
+
headline="Documents"
|
|
139
|
+
addOn={<Icon icon="fa-folder" size="medium" color="primary" />}
|
|
140
|
+
/>
|
|
141
|
+
|
|
142
|
+
// Status header
|
|
143
|
+
<ListHeaderItem
|
|
144
|
+
headline="Pending"
|
|
145
|
+
addOn={<Icon icon="fa-clock-o" size="medium" color="warning" />}
|
|
146
|
+
/>
|
|
147
|
+
|
|
148
|
+
// Alert header (highlighted)
|
|
149
|
+
<ListHeaderItem
|
|
150
|
+
highlight
|
|
151
|
+
headline="Urgent"
|
|
152
|
+
addOn={<Icon icon="fa-exclamation" size="medium" color="light" />}
|
|
153
|
+
/>
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
---
|
|
157
|
+
|
|
158
|
+
## Common patterns
|
|
159
|
+
|
|
160
|
+
### Grouped settings
|
|
161
|
+
|
|
162
|
+
```js
|
|
163
|
+
<List ariaLabel="Settings">
|
|
164
|
+
<ListHeaderItem headline="Account" />
|
|
165
|
+
<ListButtonItem headline="Profile" onClick={() => {}} />
|
|
166
|
+
<ListButtonItem headline="Password" onClick={() => {}} />
|
|
167
|
+
|
|
168
|
+
<ListHeaderItem headline="Preferences" />
|
|
169
|
+
<ListButtonItem headline="Theme" onClick={() => {}} />
|
|
170
|
+
<ListButtonItem headline="Language" onClick={() => {}} />
|
|
171
|
+
|
|
172
|
+
<ListHeaderItem headline="Danger Zone" highlight />
|
|
173
|
+
<ListButtonItem headline="Delete Account" color="negative" onClick={() => {}} />
|
|
174
|
+
</List>
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
### Alphabetical grouping
|
|
178
|
+
|
|
179
|
+
```js
|
|
180
|
+
<List ariaLabel="Contacts">
|
|
181
|
+
<ListHeaderItem headline="A" />
|
|
182
|
+
<ListItem headline="Alice Anderson" />
|
|
183
|
+
<ListItem headline="Andrew Adams" />
|
|
184
|
+
|
|
185
|
+
<ListHeaderItem headline="B" />
|
|
186
|
+
<ListItem headline="Bob Brown" />
|
|
187
|
+
<ListItem headline="Betty Baker" />
|
|
188
|
+
</List>
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
### Category browser
|
|
192
|
+
|
|
193
|
+
```js
|
|
194
|
+
<List ariaLabel="Categories">
|
|
74
195
|
<ListHeaderItem
|
|
75
|
-
headline="
|
|
76
|
-
addOn={<Icon icon="fa-
|
|
196
|
+
headline="Popular"
|
|
197
|
+
addOn={<Icon icon="fa-fire" color="warning" />}
|
|
77
198
|
/>
|
|
78
|
-
<
|
|
79
|
-
<
|
|
80
|
-
|
|
199
|
+
<ListButtonItem headline="Technology" onClick={() => {}} />
|
|
200
|
+
<ListButtonItem headline="Design" onClick={() => {}} />
|
|
201
|
+
|
|
81
202
|
<ListHeaderItem
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
addOn={<Icon icon="fa-chain-broken" size="medium" color="light" />}
|
|
203
|
+
headline="Recent"
|
|
204
|
+
addOn={<Icon icon="fa-clock-o" color="secondary" />}
|
|
85
205
|
/>
|
|
86
|
-
<
|
|
206
|
+
<ListButtonItem headline="Science" onClick={() => {}} />
|
|
207
|
+
<ListButtonItem headline="Art" onClick={() => {}} />
|
|
87
208
|
</List>
|
|
88
209
|
```
|
|
89
210
|
|
|
90
211
|
---
|
|
212
|
+
|
|
213
|
+
## Styling behavior
|
|
214
|
+
|
|
215
|
+
| Context | Standard Header | Highlighted Header |
|
|
216
|
+
|---------|----------------|-------------------|
|
|
217
|
+
| Regular list | Gray background | Accent background |
|
|
218
|
+
| Bare list | No background | Accent text color |
|
|
219
|
+
|
|
220
|
+
The component automatically adapts based on the parent list's `bare` prop.
|
package/src/pages/Popover.mdx
CHANGED
|
@@ -3,99 +3,221 @@ import { Icon } from "../Icon";
|
|
|
3
3
|
import { Button } from "../Button";
|
|
4
4
|
import { List } from "../List";
|
|
5
5
|
import { ListButtonItem } from "../ListButtonItem";
|
|
6
|
+
import { Row } from "../Row";
|
|
7
|
+
import { Column } from "../Column";
|
|
6
8
|
|
|
7
9
|
# Popover
|
|
8
10
|
|
|
9
|
-
|
|
11
|
+
A floating panel that appears next to a trigger element. Unlike tooltips, popovers can contain interactive content like menus, forms, or action lists.
|
|
10
12
|
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## Props
|
|
16
|
+
|
|
17
|
+
### PopoverTrigger
|
|
18
|
+
|
|
19
|
+
| Prop | Type | Required | Description |
|
|
20
|
+
|------|------|----------|-------------|
|
|
21
|
+
| `PopoverComponent` | `(props: { close: () => void } & Input) => JSX.Element` | Yes | Component to render in the popover |
|
|
22
|
+
| `children` | `(props: { toggle: (input: Input) => void }) => JSX.Element` | Yes | Render function for the trigger element |
|
|
23
|
+
| `jss` | `JSS` | No | Custom styles for the wrapper |
|
|
24
|
+
| `jssDialog` | `JSS` | No | Custom styles for the popover dialog |
|
|
25
|
+
| `grow` | `boolean` | No | Allow wrapper to grow |
|
|
26
|
+
| `shrink` | `boolean` | No | Allow wrapper to shrink |
|
|
27
|
+
| `tag` | `keyof HTMLElementTagNameMap` | No | HTML tag for the wrapper |
|
|
28
|
+
|
|
29
|
+
### Popover
|
|
30
|
+
|
|
31
|
+
| Prop | Type | Required | Description |
|
|
32
|
+
|------|------|----------|-------------|
|
|
33
|
+
| `children` | `ReactNode` | Yes | Popover content |
|
|
34
|
+
| `close` | `() => void` | Yes | Function to close the popover |
|
|
35
|
+
|
|
36
|
+
---
|
|
37
|
+
|
|
38
|
+
## Basic usage
|
|
39
|
+
|
|
40
|
+
Use `PopoverTrigger` to create a button that opens a popover with interactive options:
|
|
41
|
+
|
|
42
|
+
<Row padding="large">
|
|
43
|
+
<PopoverTrigger
|
|
44
|
+
PopoverComponent={({ close }) => (
|
|
45
|
+
<Popover close={close}>
|
|
46
|
+
<List bare ariaLabel="Options">
|
|
47
|
+
<ListButtonItem bare headline="Edit" onClick={() => close()} color="secondary" />
|
|
48
|
+
<ListButtonItem bare headline="Duplicate" onClick={() => close()} color="secondary" />
|
|
49
|
+
<ListButtonItem bare headline="Delete" onClick={() => close()} color="negative" withDivider={false} />
|
|
50
|
+
</List>
|
|
51
|
+
</Popover>
|
|
52
|
+
)}
|
|
53
|
+
>
|
|
54
|
+
{({ toggle }) => (
|
|
55
|
+
<Button color="positive" onClick={() => toggle(undefined)}>
|
|
56
|
+
Show Options
|
|
57
|
+
</Button>
|
|
58
|
+
)}
|
|
59
|
+
</PopoverTrigger>
|
|
60
|
+
</Row>
|
|
61
|
+
|
|
62
|
+
```js
|
|
11
63
|
<PopoverTrigger
|
|
12
64
|
PopoverComponent={({ close }) => (
|
|
13
65
|
<Popover close={close}>
|
|
14
|
-
<List bare ariaLabel="
|
|
66
|
+
<List bare ariaLabel="Options">
|
|
15
67
|
<ListButtonItem
|
|
16
68
|
bare
|
|
17
|
-
headline="
|
|
18
|
-
onClick={() =>
|
|
19
|
-
close();
|
|
20
|
-
}}
|
|
69
|
+
headline="Edit"
|
|
70
|
+
onClick={() => close()}
|
|
21
71
|
color="secondary"
|
|
22
72
|
/>
|
|
23
73
|
<ListButtonItem
|
|
24
74
|
bare
|
|
25
|
-
headline="
|
|
26
|
-
onClick={() =>
|
|
27
|
-
close();
|
|
28
|
-
}}
|
|
75
|
+
headline="Duplicate"
|
|
76
|
+
onClick={() => close()}
|
|
29
77
|
color="secondary"
|
|
30
78
|
/>
|
|
31
79
|
<ListButtonItem
|
|
32
80
|
bare
|
|
33
|
-
headline="
|
|
34
|
-
onClick={() =>
|
|
35
|
-
|
|
36
|
-
}}
|
|
37
|
-
color="secondary"
|
|
81
|
+
headline="Delete"
|
|
82
|
+
onClick={() => close()}
|
|
83
|
+
color="negative"
|
|
38
84
|
withDivider={false}
|
|
39
85
|
/>
|
|
40
86
|
</List>
|
|
41
87
|
</Popover>
|
|
42
88
|
)}
|
|
89
|
+
>
|
|
90
|
+
{({ toggle }) => (
|
|
91
|
+
<Button color="positive" onClick={() => toggle(undefined)}>
|
|
92
|
+
Show Options
|
|
93
|
+
</Button>
|
|
94
|
+
)}
|
|
95
|
+
</PopoverTrigger>
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
---
|
|
99
|
+
|
|
100
|
+
## Passing data to popover
|
|
101
|
+
|
|
102
|
+
Use TypeScript generics to pass data when opening the popover:
|
|
103
|
+
|
|
104
|
+
```js
|
|
105
|
+
interface Item {
|
|
106
|
+
id: string;
|
|
107
|
+
name: string;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
<PopoverTrigger<Item>
|
|
111
|
+
PopoverComponent={({ close, id, name }) => (
|
|
112
|
+
<Popover close={close}>
|
|
113
|
+
<Column padding="medium" gap="small">
|
|
114
|
+
<P>Edit: {name}</P>
|
|
115
|
+
<Button color="positive" onClick={() => {
|
|
116
|
+
saveItem(id);
|
|
117
|
+
close();
|
|
118
|
+
}}>
|
|
119
|
+
Save
|
|
120
|
+
</Button>
|
|
121
|
+
</Column>
|
|
122
|
+
</Popover>
|
|
123
|
+
)}
|
|
43
124
|
>
|
|
44
125
|
{({ toggle }) => (
|
|
45
126
|
<Button
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
}}
|
|
52
|
-
/>
|
|
127
|
+
color="primary"
|
|
128
|
+
onClick={() => toggle({ id: "123", name: "My Item" })}
|
|
129
|
+
>
|
|
130
|
+
Edit Item
|
|
131
|
+
</Button>
|
|
53
132
|
)}
|
|
54
133
|
</PopoverTrigger>
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
---
|
|
137
|
+
|
|
138
|
+
## Behavior
|
|
139
|
+
|
|
140
|
+
- **Toggle on click**: Clicking the trigger opens/closes the popover
|
|
141
|
+
- **Focus management**: Focus moves into the popover when opened
|
|
142
|
+
- **Focus trap**: Tab cycles through focusable elements within the popover
|
|
143
|
+
- **Escape to close**: Pressing Escape closes the popover
|
|
144
|
+
- **Outside click**: Clicking outside closes the popover
|
|
145
|
+
- **Focus restoration**: Focus returns to the trigger when closed
|
|
146
|
+
|
|
147
|
+
---
|
|
148
|
+
|
|
149
|
+
## Common patterns
|
|
150
|
+
|
|
151
|
+
### Dropdown menu
|
|
55
152
|
|
|
56
153
|
```js
|
|
57
154
|
<PopoverTrigger
|
|
58
155
|
PopoverComponent={({ close }) => (
|
|
59
156
|
<Popover close={close}>
|
|
60
|
-
<List bare ariaLabel="
|
|
61
|
-
<ListButtonItem
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
onClick={() => {
|
|
65
|
-
close();
|
|
66
|
-
}}
|
|
67
|
-
color="secondary"
|
|
68
|
-
/>
|
|
69
|
-
<ListButtonItem
|
|
70
|
-
bare
|
|
71
|
-
headline="Option 2"
|
|
72
|
-
onClick={() => {
|
|
73
|
-
close();
|
|
74
|
-
}}
|
|
75
|
-
color="secondary"
|
|
76
|
-
/>
|
|
77
|
-
<ListButtonItem
|
|
78
|
-
bare
|
|
79
|
-
headline="Option 3"
|
|
80
|
-
onClick={() => {
|
|
81
|
-
close();
|
|
82
|
-
}}
|
|
83
|
-
color="secondary"
|
|
84
|
-
withDivider={false}
|
|
85
|
-
/>
|
|
157
|
+
<List bare ariaLabel="Menu">
|
|
158
|
+
<ListButtonItem bare headline="Profile" onClick={() => close()} />
|
|
159
|
+
<ListButtonItem bare headline="Settings" onClick={() => close()} />
|
|
160
|
+
<ListButtonItem bare headline="Logout" onClick={() => close()} color="negative" />
|
|
86
161
|
</List>
|
|
87
162
|
</Popover>
|
|
88
163
|
)}
|
|
89
164
|
>
|
|
90
165
|
{({ toggle }) => (
|
|
91
|
-
<
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
}}
|
|
166
|
+
<IconButton
|
|
167
|
+
bare
|
|
168
|
+
icon="fa-ellipsis-v"
|
|
169
|
+
size="medium"
|
|
170
|
+
color="secondary"
|
|
171
|
+
onClick={() => toggle(undefined)}
|
|
98
172
|
/>
|
|
99
173
|
)}
|
|
100
174
|
</PopoverTrigger>
|
|
101
175
|
```
|
|
176
|
+
|
|
177
|
+
### Action confirmation
|
|
178
|
+
|
|
179
|
+
```js
|
|
180
|
+
<PopoverTrigger
|
|
181
|
+
PopoverComponent={({ close }) => (
|
|
182
|
+
<Popover close={close}>
|
|
183
|
+
<Column padding="medium" gap="medium">
|
|
184
|
+
<P>Are you sure you want to delete?</P>
|
|
185
|
+
<Row gap="small" justify="end">
|
|
186
|
+
<Button bare color="primary" onClick={close}>Cancel</Button>
|
|
187
|
+
<Button color="negative" onClick={() => {
|
|
188
|
+
deleteItem();
|
|
189
|
+
close();
|
|
190
|
+
}}>Delete</Button>
|
|
191
|
+
</Row>
|
|
192
|
+
</Column>
|
|
193
|
+
</Popover>
|
|
194
|
+
)}
|
|
195
|
+
>
|
|
196
|
+
{({ toggle }) => (
|
|
197
|
+
<Button color="negative" onClick={() => toggle(undefined)}>
|
|
198
|
+
Delete
|
|
199
|
+
</Button>
|
|
200
|
+
)}
|
|
201
|
+
</PopoverTrigger>
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
---
|
|
205
|
+
|
|
206
|
+
## Accessibility
|
|
207
|
+
|
|
208
|
+
- Uses `<dialog>` element with `.show()` for proper popover behavior
|
|
209
|
+
- Focus is trapped within the popover
|
|
210
|
+
- Escape key closes the popover
|
|
211
|
+
- Focus returns to the trigger when closed
|
|
212
|
+
- Tab navigation cycles through focusable elements
|
|
213
|
+
|
|
214
|
+
---
|
|
215
|
+
|
|
216
|
+
## Popover vs Dialog vs Tooltip
|
|
217
|
+
|
|
218
|
+
| Popover | Dialog | Tooltip |
|
|
219
|
+
|---------|--------|---------|
|
|
220
|
+
| Positioned near trigger | Centered on screen | Positioned near trigger |
|
|
221
|
+
| Light interactions | Complex workflows | Text only |
|
|
222
|
+
| Partial page blocking | Full page blocking | No blocking |
|
|
223
|
+
| Menus, quick actions | Forms, confirmations | Hints, labels |
|