@stratakit/structures 0.4.5 → 0.5.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.
- package/CHANGELOG.md +74 -0
- package/dist/AccordionItem.d.ts +1 -1
- package/dist/AccordionItem.js +69 -124
- package/dist/Banner.js +149 -120
- package/dist/Chip.js +86 -58
- package/dist/DEV/AccordionItem.js +2 -0
- package/dist/DEV/Banner.js +3 -0
- package/dist/DEV/Chip.js +3 -0
- package/dist/DEV/Dialog.js +2 -0
- package/dist/DEV/DropdownMenu.js +2 -0
- package/dist/DEV/ErrorRegion.js +5 -11
- package/dist/DEV/NavigationList.js +130 -0
- package/dist/DEV/NavigationRail.js +6 -4
- package/dist/DEV/Popover.js +90 -0
- package/dist/DEV/Table.js +3 -0
- package/dist/DEV/Tabs.js +3 -1
- package/dist/DEV/Toolbar.js +2 -0
- package/dist/DEV/Tree.js +2 -0
- package/dist/DEV/TreeItem.js +7 -2
- package/dist/DEV/index.js +4 -0
- package/dist/DEV/styles.css.js +1 -1
- package/dist/DEV/~utils.ListItem.js +3 -3
- package/dist/DEV/~utils.useInit.js +16 -0
- package/dist/Dialog.js +142 -132
- package/dist/DropdownMenu.js +217 -234
- package/dist/ErrorRegion.d.ts +18 -8
- package/dist/ErrorRegion.js +129 -154
- package/dist/NavigationList.d.ts +110 -0
- package/dist/NavigationList.js +130 -0
- package/dist/NavigationRail.js +211 -188
- package/dist/Popover.d.ts +36 -0
- package/dist/Popover.js +99 -0
- package/dist/Table.js +119 -108
- package/dist/Tabs.js +100 -63
- package/dist/Toolbar.js +25 -43
- package/dist/Tree.js +15 -12
- package/dist/TreeItem.js +398 -314
- package/dist/index.d.ts +2 -0
- package/dist/index.js +4 -0
- package/dist/styles.css.js +1 -1
- package/dist/~utils.ListItem.d.ts +3 -3
- package/dist/~utils.ListItem.js +21 -34
- package/dist/~utils.icons.js +26 -46
- package/dist/~utils.useInit.d.ts +8 -0
- package/dist/~utils.useInit.js +13 -0
- package/package.json +25 -18
package/dist/DropdownMenu.js
CHANGED
|
@@ -1,201 +1,193 @@
|
|
|
1
|
+
import { c as _c } from "react-compiler-runtime";
|
|
1
2
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
3
|
import * as React from "react";
|
|
3
4
|
import { Button as ButtonAk } from "@ariakit/react/button";
|
|
4
|
-
import {
|
|
5
|
-
Menu,
|
|
6
|
-
MenuButton,
|
|
7
|
-
MenuItem,
|
|
8
|
-
MenuItemCheckbox,
|
|
9
|
-
MenuProvider,
|
|
10
|
-
useMenuContext,
|
|
11
|
-
useMenuStore
|
|
12
|
-
} from "@ariakit/react/menu";
|
|
5
|
+
import { Menu, MenuButton, MenuItem, MenuItemCheckbox, MenuProvider, useMenuContext, useMenuStore } from "@ariakit/react/menu";
|
|
13
6
|
import { useStoreState } from "@ariakit/react/store";
|
|
14
7
|
import { Button, Kbd } from "@stratakit/bricks";
|
|
15
|
-
import {
|
|
16
|
-
DisclosureArrow,
|
|
17
|
-
Dot,
|
|
18
|
-
predefinedSymbols
|
|
19
|
-
} from "@stratakit/bricks/secret-internals";
|
|
8
|
+
import { DisclosureArrow, Dot, predefinedSymbols } from "@stratakit/bricks/secret-internals";
|
|
20
9
|
import { Icon } from "@stratakit/foundations";
|
|
21
|
-
import {
|
|
22
|
-
forwardRef,
|
|
23
|
-
usePopoverApi,
|
|
24
|
-
useSafeContext
|
|
25
|
-
} from "@stratakit/foundations/secret-internals";
|
|
10
|
+
import { forwardRef, usePopoverApi, useSafeContext } from "@stratakit/foundations/secret-internals";
|
|
26
11
|
import cx from "classnames";
|
|
27
12
|
import { Checkmark, ChevronRight } from "./~utils.icons.js";
|
|
28
13
|
import * as ListItem from "./~utils.ListItem.js";
|
|
14
|
+
import { useInit } from "./~utils.useInit.js";
|
|
29
15
|
function DropdownMenuProvider(props) {
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
16
|
+
const $ = _c(6);
|
|
17
|
+
useInit();
|
|
18
|
+
const {
|
|
19
|
+
children,
|
|
20
|
+
placement,
|
|
21
|
+
open,
|
|
22
|
+
setOpen,
|
|
23
|
+
defaultOpen
|
|
24
|
+
} = props;
|
|
25
|
+
let t0;
|
|
26
|
+
if ($[0] !== children || $[1] !== defaultOpen || $[2] !== open || $[3] !== placement || $[4] !== setOpen) {
|
|
27
|
+
t0 = jsx(MenuProvider, {
|
|
34
28
|
defaultOpen,
|
|
35
29
|
open,
|
|
36
30
|
placement,
|
|
37
31
|
setOpen,
|
|
38
32
|
children
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
return /* @__PURE__ */ jsx(
|
|
49
|
-
Menu,
|
|
50
|
-
{
|
|
51
|
-
portal: true,
|
|
52
|
-
unmountOnHide: true,
|
|
53
|
-
...props,
|
|
54
|
-
gutter: 4,
|
|
55
|
-
style: { ...popoverProps.style, ...props.style },
|
|
56
|
-
wrapperProps: { popover: popoverProps.popover },
|
|
57
|
-
className: cx("\u{1F95D}DropdownMenu", props.className),
|
|
58
|
-
ref: forwardedRef
|
|
59
|
-
}
|
|
60
|
-
);
|
|
61
|
-
}
|
|
62
|
-
);
|
|
63
|
-
const DropdownMenuButton = forwardRef(
|
|
64
|
-
(props, forwardedRef) => {
|
|
65
|
-
const { accessibleWhenDisabled = true, children, ...rest } = props;
|
|
66
|
-
const open = useStoreState(useMenuContext(), "open");
|
|
67
|
-
return /* @__PURE__ */ jsx(
|
|
68
|
-
MenuButton,
|
|
69
|
-
{
|
|
70
|
-
accessibleWhenDisabled: true,
|
|
71
|
-
...rest,
|
|
72
|
-
render: props.render ?? /* @__PURE__ */ jsxs(Button, { accessibleWhenDisabled, children: [
|
|
73
|
-
children,
|
|
74
|
-
/* @__PURE__ */ jsx(DisclosureArrow, {})
|
|
75
|
-
] }),
|
|
76
|
-
className: cx("\u{1F95D}DropdownMenuButton", props.className),
|
|
77
|
-
"data-has-popover-open": open || void 0,
|
|
78
|
-
ref: forwardedRef
|
|
79
|
-
}
|
|
80
|
-
);
|
|
33
|
+
});
|
|
34
|
+
$[0] = children;
|
|
35
|
+
$[1] = defaultOpen;
|
|
36
|
+
$[2] = open;
|
|
37
|
+
$[3] = placement;
|
|
38
|
+
$[4] = setOpen;
|
|
39
|
+
$[5] = t0;
|
|
40
|
+
} else {
|
|
41
|
+
t0 = $[5];
|
|
81
42
|
}
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
43
|
+
return t0;
|
|
44
|
+
}
|
|
45
|
+
const DropdownMenuContent = forwardRef((props, forwardedRef) => {
|
|
46
|
+
const context = useMenuContext();
|
|
47
|
+
const open = useStoreState(context, "open");
|
|
48
|
+
const popoverElement = useStoreState(context, "popoverElement");
|
|
49
|
+
const popoverProps = usePopoverApi({
|
|
50
|
+
element: popoverElement,
|
|
51
|
+
open
|
|
52
|
+
});
|
|
53
|
+
return /* @__PURE__ */ jsx(Menu, {
|
|
54
|
+
portal: true,
|
|
55
|
+
unmountOnHide: true,
|
|
56
|
+
...props,
|
|
57
|
+
gutter: 4,
|
|
58
|
+
style: {
|
|
59
|
+
...popoverProps.style,
|
|
60
|
+
...props.style
|
|
61
|
+
},
|
|
62
|
+
wrapperProps: {
|
|
63
|
+
popover: popoverProps.popover
|
|
64
|
+
},
|
|
65
|
+
className: cx("\u{1F95D}DropdownMenu", props.className),
|
|
66
|
+
ref: forwardedRef
|
|
67
|
+
});
|
|
68
|
+
});
|
|
69
|
+
const DropdownMenuButton = forwardRef((props, forwardedRef) => {
|
|
70
|
+
const {
|
|
71
|
+
accessibleWhenDisabled = true,
|
|
72
|
+
children,
|
|
73
|
+
...rest
|
|
74
|
+
} = props;
|
|
75
|
+
const open = useStoreState(useMenuContext(), "open");
|
|
76
|
+
return /* @__PURE__ */ jsx(MenuButton, {
|
|
77
|
+
accessibleWhenDisabled: true,
|
|
78
|
+
...rest,
|
|
79
|
+
render: props.render ?? /* @__PURE__ */ jsxs(Button, {
|
|
80
|
+
accessibleWhenDisabled,
|
|
81
|
+
children: [children, /* @__PURE__ */ jsx(DisclosureArrow, {})]
|
|
82
|
+
}),
|
|
83
|
+
className: cx("\u{1F95D}DropdownMenuButton", props.className),
|
|
84
|
+
"data-has-popover-open": open || void 0,
|
|
85
|
+
ref: forwardedRef
|
|
86
|
+
});
|
|
87
|
+
});
|
|
88
|
+
const DropdownMenuItem = forwardRef((props, forwardedRef) => {
|
|
89
|
+
const {
|
|
90
|
+
label,
|
|
91
|
+
shortcuts,
|
|
92
|
+
icon,
|
|
93
|
+
unstable_dot,
|
|
94
|
+
submenu,
|
|
95
|
+
...rest
|
|
96
|
+
} = props;
|
|
97
|
+
const dotId = React.useId();
|
|
98
|
+
const defaultSubmenuStore = useMenuStore();
|
|
99
|
+
const [submenuStore, setSubmenuStore] = React.useState();
|
|
100
|
+
const store = submenuStore ?? defaultSubmenuStore;
|
|
101
|
+
const open = useStoreState(store, "open");
|
|
102
|
+
return /* @__PURE__ */ jsxs(Fragment, {
|
|
103
|
+
children: [/* @__PURE__ */ jsxs(MenuItem, {
|
|
104
|
+
accessibleWhenDisabled: true,
|
|
105
|
+
render: /* @__PURE__ */ jsx(ListItem.Root, {
|
|
106
|
+
render: /* @__PURE__ */ jsx(ButtonAk, {
|
|
95
107
|
accessibleWhenDisabled: true,
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
className: "\u{1F95D}DropdownMenuItemChevron",
|
|
133
|
-
render: /* @__PURE__ */ jsx(ChevronRight, {})
|
|
134
|
-
}
|
|
135
|
-
) : null
|
|
136
|
-
]
|
|
137
|
-
}
|
|
138
|
-
),
|
|
139
|
-
/* @__PURE__ */ jsx(
|
|
140
|
-
DropdownMenuSubmenuContext.Provider,
|
|
141
|
-
{
|
|
142
|
-
value: React.useMemo(() => ({ setStore: setSubmenuStore }), []),
|
|
143
|
-
children: submenu
|
|
144
|
-
}
|
|
145
|
-
)
|
|
146
|
-
] });
|
|
147
|
-
}
|
|
148
|
-
);
|
|
108
|
+
"aria-describedby": dotId,
|
|
109
|
+
...rest,
|
|
110
|
+
render: submenu ? /* @__PURE__ */ jsx(MenuButton, {
|
|
111
|
+
render: props.render ?? /* @__PURE__ */ jsx("button", {}),
|
|
112
|
+
store
|
|
113
|
+
}) : props.render,
|
|
114
|
+
className: cx("\u{1F95D}DropdownMenuItem", props.className),
|
|
115
|
+
"data-has-popover-open": open || void 0,
|
|
116
|
+
ref: forwardedRef
|
|
117
|
+
})
|
|
118
|
+
}),
|
|
119
|
+
children: [icon ? /* @__PURE__ */ jsx(DropdownMenuIcon, {
|
|
120
|
+
icon
|
|
121
|
+
}) : null, /* @__PURE__ */ jsx(ListItem.Content, {
|
|
122
|
+
render: /* @__PURE__ */ jsx("span", {}),
|
|
123
|
+
children: label
|
|
124
|
+
}), shortcuts ? /* @__PURE__ */ jsx(DropdownMenuItemShortcuts, {
|
|
125
|
+
shortcuts
|
|
126
|
+
}) : null, unstable_dot ? /* @__PURE__ */ jsx(ListItem.Decoration, {
|
|
127
|
+
render: /* @__PURE__ */ jsx(Dot, {
|
|
128
|
+
id: dotId,
|
|
129
|
+
className: "\u{1F95D}DropdownMenuItemDot",
|
|
130
|
+
children: unstable_dot
|
|
131
|
+
})
|
|
132
|
+
}) : null, submenu ? /* @__PURE__ */ jsx(ListItem.Decoration, {
|
|
133
|
+
className: "\u{1F95D}DropdownMenuItemChevron",
|
|
134
|
+
render: /* @__PURE__ */ jsx(ChevronRight, {})
|
|
135
|
+
}) : null]
|
|
136
|
+
}), /* @__PURE__ */ jsx(DropdownMenuSubmenuContext.Provider, {
|
|
137
|
+
value: React.useMemo(() => ({
|
|
138
|
+
setStore: setSubmenuStore
|
|
139
|
+
}), []),
|
|
140
|
+
children: submenu
|
|
141
|
+
})]
|
|
142
|
+
});
|
|
143
|
+
});
|
|
149
144
|
const DropdownMenuItemShortcuts = forwardRef((props, forwardedRef) => {
|
|
150
|
-
const {
|
|
145
|
+
const {
|
|
146
|
+
shortcuts,
|
|
147
|
+
...rest
|
|
148
|
+
} = props;
|
|
151
149
|
const shortcutKeys = React.useMemo(() => {
|
|
152
150
|
return shortcuts.split("+").map((key) => ({
|
|
153
151
|
key: key.trim(),
|
|
154
152
|
isSymbol: key in predefinedSymbols
|
|
155
153
|
}));
|
|
156
154
|
}, [shortcuts]);
|
|
157
|
-
return /* @__PURE__ */ jsx(
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
155
|
+
return /* @__PURE__ */ jsx(ListItem.Decoration, {
|
|
156
|
+
render: /* @__PURE__ */ jsx("span", {}),
|
|
157
|
+
...rest,
|
|
158
|
+
className: cx("\u{1F95D}DropdownMenuItemShortcuts", props.className),
|
|
159
|
+
ref: forwardedRef,
|
|
160
|
+
children: shortcutKeys.map(({
|
|
161
|
+
key: key_0,
|
|
162
|
+
isSymbol
|
|
163
|
+
}, index) => {
|
|
164
|
+
if (isSymbol) {
|
|
165
|
+
return /* @__PURE__ */ jsx(Kbd, {
|
|
166
|
+
variant: "ghost",
|
|
167
|
+
symbol: key_0
|
|
168
|
+
}, `${key_0 + index}`);
|
|
169
|
+
}
|
|
170
|
+
return /* @__PURE__ */ jsx(Kbd, {
|
|
171
|
+
variant: "ghost",
|
|
172
|
+
children: key_0
|
|
173
|
+
}, `${key_0 + index}`);
|
|
174
|
+
})
|
|
175
|
+
});
|
|
176
|
+
});
|
|
177
|
+
const DropdownMenuIcon = forwardRef((props, forwardedRef) => {
|
|
178
|
+
const {
|
|
179
|
+
icon,
|
|
180
|
+
...rest
|
|
181
|
+
} = props;
|
|
182
|
+
return /* @__PURE__ */ jsx(ListItem.Decoration, {
|
|
183
|
+
render: /* @__PURE__ */ jsx(Icon, {
|
|
184
|
+
href: typeof icon === "string" ? icon : void 0,
|
|
185
|
+
render: React.isValidElement(icon) ? icon : void 0,
|
|
161
186
|
...rest,
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
if (isSymbol) {
|
|
166
|
-
return /* @__PURE__ */ jsx(
|
|
167
|
-
Kbd,
|
|
168
|
-
{
|
|
169
|
-
variant: "ghost",
|
|
170
|
-
symbol: key
|
|
171
|
-
},
|
|
172
|
-
`${key + index}`
|
|
173
|
-
);
|
|
174
|
-
}
|
|
175
|
-
return /* @__PURE__ */ jsx(Kbd, { variant: "ghost", children: key }, `${key + index}`);
|
|
176
|
-
})
|
|
177
|
-
}
|
|
178
|
-
);
|
|
187
|
+
ref: forwardedRef
|
|
188
|
+
})
|
|
189
|
+
});
|
|
179
190
|
});
|
|
180
|
-
const DropdownMenuIcon = forwardRef(
|
|
181
|
-
(props, forwardedRef) => {
|
|
182
|
-
const { icon, ...rest } = props;
|
|
183
|
-
return /* @__PURE__ */ jsx(
|
|
184
|
-
ListItem.Decoration,
|
|
185
|
-
{
|
|
186
|
-
render: /* @__PURE__ */ jsx(
|
|
187
|
-
Icon,
|
|
188
|
-
{
|
|
189
|
-
href: typeof icon === "string" ? icon : void 0,
|
|
190
|
-
render: React.isValidElement(icon) ? icon : void 0,
|
|
191
|
-
...rest,
|
|
192
|
-
ref: forwardedRef
|
|
193
|
-
}
|
|
194
|
-
)
|
|
195
|
-
}
|
|
196
|
-
);
|
|
197
|
-
}
|
|
198
|
-
);
|
|
199
191
|
const DropdownMenuCheckboxItem = forwardRef((props, forwardedRef) => {
|
|
200
192
|
const {
|
|
201
193
|
label,
|
|
@@ -208,70 +200,61 @@ const DropdownMenuCheckboxItem = forwardRef((props, forwardedRef) => {
|
|
|
208
200
|
// For defaultChecked to work
|
|
209
201
|
...rest
|
|
210
202
|
} = props;
|
|
211
|
-
return /* @__PURE__ */ jsxs(
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
{
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
/* @__PURE__ */ jsx(
|
|
238
|
-
ListItem.Decoration,
|
|
239
|
-
{
|
|
240
|
-
render: /* @__PURE__ */ jsx(Checkmark, { className: "\u{1F95D}DropdownMenuCheckmark" })
|
|
241
|
-
}
|
|
242
|
-
)
|
|
243
|
-
]
|
|
244
|
-
}
|
|
245
|
-
);
|
|
203
|
+
return /* @__PURE__ */ jsxs(MenuItemCheckbox, {
|
|
204
|
+
accessibleWhenDisabled: true,
|
|
205
|
+
defaultChecked,
|
|
206
|
+
checked,
|
|
207
|
+
name,
|
|
208
|
+
value,
|
|
209
|
+
onChange,
|
|
210
|
+
render: /* @__PURE__ */ jsx(ListItem.Root, {
|
|
211
|
+
render: /* @__PURE__ */ jsx(ButtonAk, {
|
|
212
|
+
accessibleWhenDisabled: true,
|
|
213
|
+
...rest,
|
|
214
|
+
className: cx("\u{1F95D}DropdownMenuItem", props.className),
|
|
215
|
+
ref: forwardedRef
|
|
216
|
+
})
|
|
217
|
+
}),
|
|
218
|
+
children: [icon ? /* @__PURE__ */ jsx(DropdownMenuIcon, {
|
|
219
|
+
icon
|
|
220
|
+
}) : null, /* @__PURE__ */ jsx(ListItem.Content, {
|
|
221
|
+
render: /* @__PURE__ */ jsx("span", {}),
|
|
222
|
+
children: label
|
|
223
|
+
}), /* @__PURE__ */ jsx(ListItem.Decoration, {
|
|
224
|
+
render: /* @__PURE__ */ jsx(Checkmark, {
|
|
225
|
+
className: "\u{1F95D}DropdownMenuCheckmark"
|
|
226
|
+
})
|
|
227
|
+
})]
|
|
228
|
+
});
|
|
246
229
|
});
|
|
247
230
|
const DropdownMenuSubmenuContext = React.createContext(void 0);
|
|
248
|
-
const DropdownMenuSubmenu = forwardRef(
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
}
|
|
274
|
-
);
|
|
231
|
+
const DropdownMenuSubmenu = forwardRef((props, forwardedRef) => {
|
|
232
|
+
const {
|
|
233
|
+
setStore
|
|
234
|
+
} = useSafeContext(DropdownMenuSubmenuContext);
|
|
235
|
+
const store = useMenuStore();
|
|
236
|
+
React.useEffect(() => {
|
|
237
|
+
setStore(store);
|
|
238
|
+
return () => setStore(void 0);
|
|
239
|
+
}, [store, setStore]);
|
|
240
|
+
const parent = useMenuContext();
|
|
241
|
+
const popoverElement = useStoreState(parent, "popoverElement");
|
|
242
|
+
return /* @__PURE__ */ jsx(MenuProvider, {
|
|
243
|
+
store,
|
|
244
|
+
children: /* @__PURE__ */ jsx(Menu, {
|
|
245
|
+
store,
|
|
246
|
+
portal: true,
|
|
247
|
+
portalElement: popoverElement,
|
|
248
|
+
preserveTabOrder: false,
|
|
249
|
+
unmountOnHide: true,
|
|
250
|
+
...props,
|
|
251
|
+
gutter: 2,
|
|
252
|
+
shift: -4,
|
|
253
|
+
className: cx("\u{1F95D}DropdownMenu", props.className),
|
|
254
|
+
ref: forwardedRef
|
|
255
|
+
})
|
|
256
|
+
});
|
|
257
|
+
});
|
|
275
258
|
export {
|
|
276
259
|
DropdownMenuButton as Button,
|
|
277
260
|
DropdownMenuCheckboxItem as CheckboxItem,
|
package/dist/ErrorRegion.d.ts
CHANGED
|
@@ -1,17 +1,11 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import type { BaseProps } from "@stratakit/foundations/secret-internals";
|
|
3
|
-
interface
|
|
3
|
+
interface ErrorRegionRootBaseProps extends Omit<BaseProps, "children"> {
|
|
4
4
|
/**
|
|
5
5
|
* Label for the error header, usually indicating the number of errors displayed.
|
|
6
6
|
*
|
|
7
7
|
* Changes to the `label` prop will be communicated
|
|
8
8
|
* using a [live region](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Guides/Live_regions).
|
|
9
|
-
*
|
|
10
|
-
* (deprecated behavior) By default this is used as a name of the region navigational landmark.
|
|
11
|
-
* `aria-label` or `aria-labelledby` prop should be provided to explicitly label the region instead.
|
|
12
|
-
*
|
|
13
|
-
* (deprecated behavior) Use `undefined` if you don't want to display errors rather than conditionally rendering the component.
|
|
14
|
-
* Use `items` prop instead.
|
|
15
9
|
*/
|
|
16
10
|
label?: React.ReactNode;
|
|
17
11
|
/**
|
|
@@ -19,7 +13,7 @@ interface ErrorRegionRootProps extends Omit<BaseProps, "children"> {
|
|
|
19
13
|
*
|
|
20
14
|
* Set to `undefined` or empty array if you don't want to display errors rather than conditionally rendering the component.
|
|
21
15
|
*/
|
|
22
|
-
items?: React.ReactNode;
|
|
16
|
+
items?: React.ReactNode[];
|
|
23
17
|
/**
|
|
24
18
|
* The controlled open state of the region.
|
|
25
19
|
*/
|
|
@@ -31,6 +25,22 @@ interface ErrorRegionRootProps extends Omit<BaseProps, "children"> {
|
|
|
31
25
|
*/
|
|
32
26
|
setOpen?: (open: boolean) => void;
|
|
33
27
|
}
|
|
28
|
+
type ErrorRegionRootExtraProps = {
|
|
29
|
+
/**
|
|
30
|
+
* Name of the region navigational landmark.
|
|
31
|
+
*
|
|
32
|
+
* This label should remain stable throughout the lifetime of the region.
|
|
33
|
+
*/
|
|
34
|
+
"aria-label": string | undefined;
|
|
35
|
+
} | {
|
|
36
|
+
/**
|
|
37
|
+
* Identifies the element that labels the region navigational landmark.
|
|
38
|
+
*
|
|
39
|
+
* This label should remain stable throughout the lifetime of the region.
|
|
40
|
+
*/
|
|
41
|
+
"aria-labelledby": string | undefined;
|
|
42
|
+
};
|
|
43
|
+
type ErrorRegionRootProps = ErrorRegionRootBaseProps & ErrorRegionRootExtraProps;
|
|
34
44
|
/**
|
|
35
45
|
* A collapsible region that displays a list of error messages, which might originate from another
|
|
36
46
|
* component, such as `Tree`.
|