@stratakit/structures 0.5.0 → 0.5.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/CHANGELOG.md +76 -0
- package/dist/AccordionItem.js +2 -0
- package/dist/Banner.js +3 -0
- package/dist/Chip.js +3 -0
- 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 +7 -2
- package/dist/DEV/DropdownMenu.js +39 -4
- package/dist/DEV/ErrorRegion.js +2 -0
- package/dist/DEV/NavigationList.js +130 -0
- package/dist/DEV/NavigationRail.js +7 -5
- package/dist/DEV/Popover.js +93 -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 +18 -13
- package/dist/DropdownMenu.d.ts +30 -5
- package/dist/DropdownMenu.js +49 -12
- package/dist/ErrorRegion.js +2 -0
- package/dist/NavigationList.d.ts +110 -0
- package/dist/NavigationList.js +130 -0
- package/dist/NavigationRail.js +4 -2
- package/dist/Popover.d.ts +36 -0
- package/dist/Popover.js +101 -0
- package/dist/Table.js +3 -0
- package/dist/Tabs.js +3 -1
- package/dist/Toolbar.js +2 -0
- package/dist/Tree.js +2 -0
- package/dist/TreeItem.js +7 -2
- 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.useInit.d.ts +8 -0
- package/dist/~utils.useInit.js +13 -0
- package/package.json +19 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,81 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.5.2
|
|
4
|
+
|
|
5
|
+
- [#1078](https://github.com/iTwin/design-system/pull/1078): Added `DropdownMenu.Group` component used to group menu items within a dropdown menu.
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
<DropdownMenu.Provider>
|
|
9
|
+
<DropdownMenu.Button>Actions</DropdownMenu.Button>
|
|
10
|
+
|
|
11
|
+
<DropdownMenu.Content>
|
|
12
|
+
<DropdownMenu.Item label="View" />
|
|
13
|
+
<DropdownMenu.Group
|
|
14
|
+
label="Manage"
|
|
15
|
+
items={[
|
|
16
|
+
<DropdownMenu.Item key="add" label="Add" />,
|
|
17
|
+
<DropdownMenu.Item key="edit" label="Edit" />,
|
|
18
|
+
]}
|
|
19
|
+
/>
|
|
20
|
+
</DropdownMenu.Content>
|
|
21
|
+
</DropdownMenu.Provider>
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
- [#1089](https://github.com/iTwin/design-system/pull/1089): Updated the `NavigationRail.ToggleButton` component to use `aria-pressed` instead of `aria-expanded`, to better reflect how it affects the NavigationRail's appearance.
|
|
25
|
+
- [#1092](https://github.com/iTwin/design-system/pull/1092): Increased the target size of `NavigationRail.ToggleButton` component.
|
|
26
|
+
- [#1102](https://github.com/iTwin/design-system/pull/1102): "Popups" will now respect device-specific close actions (such as back gesture on Android). Affected components include: `DropdownMenu`, `Dialog` and `Popover`.
|
|
27
|
+
|
|
28
|
+
- [#1074](https://github.com/iTwin/design-system/pull/1074): Visual updates to `Table` and `Tree` active + hover states.
|
|
29
|
+
- [#1103](https://github.com/iTwin/design-system/pull/1103): `DropdownMenu.Submenu` will now remain mounted in the DOM as long as the parent DropdownMenu is open.
|
|
30
|
+
|
|
31
|
+
- Updated dependencies:
|
|
32
|
+
- @stratakit/bricks@0.5.2
|
|
33
|
+
- @stratakit/foundations@0.4.2
|
|
34
|
+
|
|
35
|
+
## 0.5.1
|
|
36
|
+
|
|
37
|
+
- [#1075](https://github.com/iTwin/design-system/pull/1075): Added a new `unstable_NavigationList` component that displays a vertical list of links for secondary navigation.
|
|
38
|
+
|
|
39
|
+
Includes the following subcomponents:
|
|
40
|
+
- `<NavigationList.Root>`
|
|
41
|
+
- `<NavigationList.Anchor>`
|
|
42
|
+
- `<NavigationList.Subgroup>`
|
|
43
|
+
|
|
44
|
+
Example:
|
|
45
|
+
|
|
46
|
+
```tsx
|
|
47
|
+
<NavigationList.Root
|
|
48
|
+
items={[
|
|
49
|
+
<NavigationList.Anchor key={1} href="/page1" label="Page 1" />,
|
|
50
|
+
<NavigationList.Anchor key={2} href="/page2" label="Page 2" />,
|
|
51
|
+
<NavigationList.Subgroup
|
|
52
|
+
key={3}
|
|
53
|
+
label="Group of pages"
|
|
54
|
+
items={[
|
|
55
|
+
<NavigationList.Anchor key={1} href="/page3-1" label="Sub-page 1" active />,
|
|
56
|
+
<NavigationList.Anchor key={2} href="/page3-2" label="Sub-page 2" />,
|
|
57
|
+
]}
|
|
58
|
+
/>,
|
|
59
|
+
]}
|
|
60
|
+
/>
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
- [#1079](https://github.com/iTwin/design-system/pull/1079): Increased the click target area of non-selectable `Tree.Item`s.
|
|
64
|
+
- If `selected` is undefined, the `Tree.Item` will expand/collapse when clicked.
|
|
65
|
+
- If `selected` is defined, the `Tree.Item` will continue to toggle selection when clicked.
|
|
66
|
+
|
|
67
|
+
- [#1064](https://github.com/iTwin/design-system/pull/1064): Added new `unstable_Popover` component that displays custom content in a non-modal window overlay that is placed relative to a trigger element.
|
|
68
|
+
|
|
69
|
+
```tsx
|
|
70
|
+
<Popover content={<>Popover content</>}>
|
|
71
|
+
<Button>Open popover</Button>
|
|
72
|
+
</Popover>
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
- Updated dependencies:
|
|
76
|
+
- @stratakit/bricks@0.5.1
|
|
77
|
+
- @stratakit/foundations@0.4.1
|
|
78
|
+
|
|
3
79
|
## 0.5.0
|
|
4
80
|
|
|
5
81
|
### Breaking changes
|
package/dist/AccordionItem.js
CHANGED
|
@@ -6,7 +6,9 @@ import { GhostAligner, IconButtonPresentation } from "@stratakit/bricks/secret-i
|
|
|
6
6
|
import { forwardRef, useControlledState } from "@stratakit/foundations/secret-internals";
|
|
7
7
|
import cx from "classnames";
|
|
8
8
|
import { ChevronDown } from "./~utils.icons.js";
|
|
9
|
+
import { useInit } from "./~utils.useInit.js";
|
|
9
10
|
const AccordionItemRoot = forwardRef((props, forwardedRef) => {
|
|
11
|
+
useInit();
|
|
10
12
|
const {
|
|
11
13
|
defaultOpen,
|
|
12
14
|
open: openProp,
|
package/dist/Banner.js
CHANGED
|
@@ -10,6 +10,7 @@ import cx from "classnames";
|
|
|
10
10
|
import { createStore, useStore } from "zustand";
|
|
11
11
|
import { combine } from "zustand/middleware";
|
|
12
12
|
import { Dismiss, StatusIcon } from "./~utils.icons.js";
|
|
13
|
+
import { useInit } from "./~utils.useInit.js";
|
|
13
14
|
function createBannerStore(initialState) {
|
|
14
15
|
return createStore(combine(initialState, (set, _, store) => ({
|
|
15
16
|
setLabelId: (labelId) => {
|
|
@@ -73,6 +74,7 @@ function useBannerState(selectorFn) {
|
|
|
73
74
|
return useStore(store, selectorFn);
|
|
74
75
|
}
|
|
75
76
|
const BannerRoot = forwardRef((props, forwardedRef) => {
|
|
77
|
+
useInit();
|
|
76
78
|
const {
|
|
77
79
|
tone = "neutral",
|
|
78
80
|
variant = "outline",
|
|
@@ -161,6 +163,7 @@ const BannerDismissButton = forwardRef((props, forwardedRef) => {
|
|
|
161
163
|
});
|
|
162
164
|
});
|
|
163
165
|
const Banner = forwardRef((props, forwardedRef) => {
|
|
166
|
+
useInit();
|
|
164
167
|
const {
|
|
165
168
|
message,
|
|
166
169
|
label,
|
package/dist/Chip.js
CHANGED
|
@@ -8,6 +8,7 @@ import cx from "classnames";
|
|
|
8
8
|
import { createStore, useStore } from "zustand";
|
|
9
9
|
import { combine } from "zustand/middleware";
|
|
10
10
|
import { Dismiss } from "./~utils.icons.js";
|
|
11
|
+
import { useInit } from "./~utils.useInit.js";
|
|
11
12
|
function createChipStore(initialState) {
|
|
12
13
|
return createStore(combine(initialState, (set, _, store) => ({
|
|
13
14
|
setLabelId: (labelId) => {
|
|
@@ -51,6 +52,7 @@ function useChipState(selectorFn) {
|
|
|
51
52
|
return useStore(store, selectorFn);
|
|
52
53
|
}
|
|
53
54
|
const ChipRoot = forwardRef((props, forwardedRef) => {
|
|
55
|
+
useInit();
|
|
54
56
|
const {
|
|
55
57
|
variant = "solid",
|
|
56
58
|
...rest
|
|
@@ -98,6 +100,7 @@ const ChipDismissButton = forwardRef((props, forwardedRef) => {
|
|
|
98
100
|
});
|
|
99
101
|
});
|
|
100
102
|
const Chip = forwardRef((props, forwardedRef) => {
|
|
103
|
+
useInit();
|
|
101
104
|
const {
|
|
102
105
|
onDismiss,
|
|
103
106
|
label,
|
|
@@ -16,8 +16,10 @@ import {
|
|
|
16
16
|
} from "@stratakit/foundations/secret-internals";
|
|
17
17
|
import cx from "classnames";
|
|
18
18
|
import { ChevronDown } from "./~utils.icons.js";
|
|
19
|
+
import { useInit } from "./~utils.useInit.js";
|
|
19
20
|
const AccordionItemRoot = forwardRef(
|
|
20
21
|
(props, forwardedRef) => {
|
|
22
|
+
useInit();
|
|
21
23
|
const {
|
|
22
24
|
defaultOpen,
|
|
23
25
|
open: openProp,
|
package/dist/DEV/Banner.js
CHANGED
|
@@ -12,6 +12,7 @@ import cx from "classnames";
|
|
|
12
12
|
import { createStore, useStore } from "zustand";
|
|
13
13
|
import { combine } from "zustand/middleware";
|
|
14
14
|
import { Dismiss, StatusIcon } from "./~utils.icons.js";
|
|
15
|
+
import { useInit } from "./~utils.useInit.js";
|
|
15
16
|
function createBannerStore(initialState) {
|
|
16
17
|
return createStore(
|
|
17
18
|
combine(initialState, (set, _, store) => ({
|
|
@@ -38,6 +39,7 @@ function useBannerState(selectorFn) {
|
|
|
38
39
|
return useStore(store, selectorFn);
|
|
39
40
|
}
|
|
40
41
|
const BannerRoot = forwardRef((props, forwardedRef) => {
|
|
42
|
+
useInit();
|
|
41
43
|
const { tone = "neutral", variant = "outline", ...rest } = props;
|
|
42
44
|
return /* @__PURE__ */ jsx(BannerProvider, { tone, children: /* @__PURE__ */ jsx(
|
|
43
45
|
Role,
|
|
@@ -143,6 +145,7 @@ const BannerDismissButton = forwardRef(
|
|
|
143
145
|
);
|
|
144
146
|
DEV: BannerDismissButton.displayName = "Banner.DismissButton";
|
|
145
147
|
const Banner = forwardRef((props, forwardedRef) => {
|
|
148
|
+
useInit();
|
|
146
149
|
const {
|
|
147
150
|
message,
|
|
148
151
|
label,
|
package/dist/DEV/Chip.js
CHANGED
|
@@ -10,6 +10,7 @@ import cx from "classnames";
|
|
|
10
10
|
import { createStore, useStore } from "zustand";
|
|
11
11
|
import { combine } from "zustand/middleware";
|
|
12
12
|
import { Dismiss } from "./~utils.icons.js";
|
|
13
|
+
import { useInit } from "./~utils.useInit.js";
|
|
13
14
|
function createChipStore(initialState) {
|
|
14
15
|
return createStore(
|
|
15
16
|
combine(initialState, (set, _, store) => ({
|
|
@@ -32,6 +33,7 @@ function useChipState(selectorFn) {
|
|
|
32
33
|
return useStore(store, selectorFn);
|
|
33
34
|
}
|
|
34
35
|
const ChipRoot = forwardRef((props, forwardedRef) => {
|
|
36
|
+
useInit();
|
|
35
37
|
const { variant = "solid", ...rest } = props;
|
|
36
38
|
return /* @__PURE__ */ jsx(ChipProvider, { children: /* @__PURE__ */ jsx(
|
|
37
39
|
Role.div,
|
|
@@ -85,6 +87,7 @@ const ChipDismissButton = forwardRef(
|
|
|
85
87
|
);
|
|
86
88
|
DEV: ChipDismissButton.displayName = "Chip.DismissButton";
|
|
87
89
|
const Chip = forwardRef((props, forwardedRef) => {
|
|
90
|
+
useInit();
|
|
88
91
|
const { onDismiss, label, ...rest } = props;
|
|
89
92
|
return /* @__PURE__ */ jsxs(ChipRoot, { ...rest, ref: forwardedRef, children: [
|
|
90
93
|
/* @__PURE__ */ jsx(ChipLabel, { children: label }),
|
package/dist/DEV/Dialog.js
CHANGED
|
@@ -8,11 +8,14 @@ import { IconButton, Text } from "@stratakit/bricks";
|
|
|
8
8
|
import { GhostAligner } from "@stratakit/bricks/secret-internals";
|
|
9
9
|
import {
|
|
10
10
|
forwardRef,
|
|
11
|
-
usePopoverApi
|
|
11
|
+
usePopoverApi,
|
|
12
|
+
useUnreactiveCallback
|
|
12
13
|
} from "@stratakit/foundations/secret-internals";
|
|
13
14
|
import cx from "classnames";
|
|
14
15
|
import { Dismiss } from "./~utils.icons.js";
|
|
16
|
+
import { useInit } from "./~utils.useInit.js";
|
|
15
17
|
const DialogRoot = forwardRef((props, forwardedRef) => {
|
|
18
|
+
useInit();
|
|
16
19
|
const { backdrop = true, unmountOnHide = true, ...rest } = props;
|
|
17
20
|
const store = AkDialog.useDialogStore();
|
|
18
21
|
const contentElement = useStoreState(store, "contentElement");
|
|
@@ -44,9 +47,11 @@ function DialogWrapper(props) {
|
|
|
44
47
|
const open = useStoreState(store, (state) => {
|
|
45
48
|
return props.open ?? state?.open;
|
|
46
49
|
});
|
|
50
|
+
const setOpen = useUnreactiveCallback(store?.setOpen);
|
|
47
51
|
const popoverProps = usePopoverApi({
|
|
48
52
|
element: wrapper,
|
|
49
|
-
open
|
|
53
|
+
open,
|
|
54
|
+
setOpen
|
|
50
55
|
});
|
|
51
56
|
const mounted = useStoreState(store, "mounted");
|
|
52
57
|
return /* @__PURE__ */ jsx(
|
package/dist/DEV/DropdownMenu.js
CHANGED
|
@@ -4,6 +4,8 @@ import { Button as ButtonAk } from "@ariakit/react/button";
|
|
|
4
4
|
import {
|
|
5
5
|
Menu,
|
|
6
6
|
MenuButton,
|
|
7
|
+
MenuGroup,
|
|
8
|
+
MenuGroupLabel,
|
|
7
9
|
MenuItem,
|
|
8
10
|
MenuItemCheckbox,
|
|
9
11
|
MenuProvider,
|
|
@@ -11,7 +13,7 @@ import {
|
|
|
11
13
|
useMenuStore
|
|
12
14
|
} from "@ariakit/react/menu";
|
|
13
15
|
import { useStoreState } from "@ariakit/react/store";
|
|
14
|
-
import { Button, Kbd } from "@stratakit/bricks";
|
|
16
|
+
import { Button, Kbd, Text } from "@stratakit/bricks";
|
|
15
17
|
import {
|
|
16
18
|
DisclosureArrow,
|
|
17
19
|
Dot,
|
|
@@ -21,12 +23,15 @@ import { Icon } from "@stratakit/foundations";
|
|
|
21
23
|
import {
|
|
22
24
|
forwardRef,
|
|
23
25
|
usePopoverApi,
|
|
24
|
-
useSafeContext
|
|
26
|
+
useSafeContext,
|
|
27
|
+
useUnreactiveCallback
|
|
25
28
|
} from "@stratakit/foundations/secret-internals";
|
|
26
29
|
import cx from "classnames";
|
|
27
30
|
import { Checkmark, ChevronRight } from "./~utils.icons.js";
|
|
28
31
|
import * as ListItem from "./~utils.ListItem.js";
|
|
32
|
+
import { useInit } from "./~utils.useInit.js";
|
|
29
33
|
function DropdownMenuProvider(props) {
|
|
34
|
+
useInit();
|
|
30
35
|
const { children, placement, open, setOpen, defaultOpen } = props;
|
|
31
36
|
return /* @__PURE__ */ jsx(
|
|
32
37
|
MenuProvider,
|
|
@@ -45,7 +50,12 @@ const DropdownMenuContent = forwardRef(
|
|
|
45
50
|
const context = useMenuContext();
|
|
46
51
|
const open = useStoreState(context, "open");
|
|
47
52
|
const popoverElement = useStoreState(context, "popoverElement");
|
|
48
|
-
const
|
|
53
|
+
const setOpen = useUnreactiveCallback(context?.setOpen);
|
|
54
|
+
const popoverProps = usePopoverApi({
|
|
55
|
+
element: popoverElement,
|
|
56
|
+
open,
|
|
57
|
+
setOpen
|
|
58
|
+
});
|
|
49
59
|
return /* @__PURE__ */ jsx(
|
|
50
60
|
Menu,
|
|
51
61
|
{
|
|
@@ -269,7 +279,6 @@ const DropdownMenuSubmenu = forwardRef(
|
|
|
269
279
|
portal: true,
|
|
270
280
|
portalElement: popoverElement,
|
|
271
281
|
preserveTabOrder: false,
|
|
272
|
-
unmountOnHide: true,
|
|
273
282
|
...props,
|
|
274
283
|
gutter: 2,
|
|
275
284
|
shift: -4,
|
|
@@ -280,10 +289,36 @@ const DropdownMenuSubmenu = forwardRef(
|
|
|
280
289
|
}
|
|
281
290
|
);
|
|
282
291
|
DEV: DropdownMenuSubmenu.displayName = "DropdownMenu.Submenu";
|
|
292
|
+
const DropdownMenuGroup = forwardRef(
|
|
293
|
+
(props, forwardedRef) => {
|
|
294
|
+
const { label, items, ...rest } = props;
|
|
295
|
+
return /* @__PURE__ */ jsxs(
|
|
296
|
+
MenuGroup,
|
|
297
|
+
{
|
|
298
|
+
...rest,
|
|
299
|
+
className: cx("\u{1F95D}DropdownMenuGroup", props.className),
|
|
300
|
+
ref: forwardedRef,
|
|
301
|
+
children: [
|
|
302
|
+
/* @__PURE__ */ jsx(
|
|
303
|
+
MenuGroupLabel,
|
|
304
|
+
{
|
|
305
|
+
className: "\u{1F95D}DropdownMenuGroupLabel",
|
|
306
|
+
render: /* @__PURE__ */ jsx(Text, { variant: "body-sm" }),
|
|
307
|
+
children: label
|
|
308
|
+
}
|
|
309
|
+
),
|
|
310
|
+
items
|
|
311
|
+
]
|
|
312
|
+
}
|
|
313
|
+
);
|
|
314
|
+
}
|
|
315
|
+
);
|
|
316
|
+
DEV: DropdownMenuGroup.displayName = "DropdownMenu.Group";
|
|
283
317
|
export {
|
|
284
318
|
DropdownMenuButton as Button,
|
|
285
319
|
DropdownMenuCheckboxItem as CheckboxItem,
|
|
286
320
|
DropdownMenuContent as Content,
|
|
321
|
+
DropdownMenuGroup as Group,
|
|
287
322
|
DropdownMenuItem as Item,
|
|
288
323
|
DropdownMenuProvider as Provider,
|
|
289
324
|
DropdownMenuSubmenu as Submenu
|
package/dist/DEV/ErrorRegion.js
CHANGED
|
@@ -20,8 +20,10 @@ import {
|
|
|
20
20
|
} from "@stratakit/foundations/secret-internals";
|
|
21
21
|
import cx from "classnames";
|
|
22
22
|
import { ChevronDown, StatusIcon } from "./~utils.icons.js";
|
|
23
|
+
import { useInit } from "./~utils.useInit.js";
|
|
23
24
|
const ErrorRegionRoot = forwardRef(
|
|
24
25
|
(props, forwardedRef) => {
|
|
26
|
+
useInit();
|
|
25
27
|
const {
|
|
26
28
|
label,
|
|
27
29
|
items = [],
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { Button as AriaButton } from "@ariakit/react/button";
|
|
4
|
+
import * as AriaDisclosure from "@ariakit/react/disclosure";
|
|
5
|
+
import { Focusable } from "@ariakit/react/focusable";
|
|
6
|
+
import { Role } from "@ariakit/react/role";
|
|
7
|
+
import { Text } from "@stratakit/bricks";
|
|
8
|
+
import { Icon } from "@stratakit/foundations";
|
|
9
|
+
import { forwardRef } from "@stratakit/foundations/secret-internals";
|
|
10
|
+
import cx from "classnames";
|
|
11
|
+
import { ChevronDown } from "./~utils.icons.js";
|
|
12
|
+
import { useInit } from "./~utils.useInit.js";
|
|
13
|
+
const NavigationListRoot = forwardRef(
|
|
14
|
+
(props, forwardedRef) => {
|
|
15
|
+
useInit();
|
|
16
|
+
const { items, role = "list", ...rest } = props;
|
|
17
|
+
const itemRole = role === "list" ? "listitem" : void 0;
|
|
18
|
+
const { indented } = React.useContext(NavigationListRootContext);
|
|
19
|
+
return /* @__PURE__ */ jsx(
|
|
20
|
+
Role,
|
|
21
|
+
{
|
|
22
|
+
...rest,
|
|
23
|
+
role,
|
|
24
|
+
className: cx("\u{1F95D}NavigationListRoot", props.className),
|
|
25
|
+
"data-_sk-indented": indented ? "true" : void 0,
|
|
26
|
+
ref: forwardedRef,
|
|
27
|
+
children: React.Children.map(items, (item) => /* @__PURE__ */ jsx(
|
|
28
|
+
Role,
|
|
29
|
+
{
|
|
30
|
+
role: itemRole,
|
|
31
|
+
className: "\u{1F95D}NavigationListItem",
|
|
32
|
+
"data-_sk-indented": indented ? "true" : void 0,
|
|
33
|
+
children: item
|
|
34
|
+
}
|
|
35
|
+
))
|
|
36
|
+
}
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
);
|
|
40
|
+
DEV: NavigationListRoot.displayName = "NavigationList.Root";
|
|
41
|
+
const NavigationListRootContext = React.createContext({
|
|
42
|
+
indented: false
|
|
43
|
+
});
|
|
44
|
+
const NavigationListItemAction = forwardRef((props, forwardedRef) => {
|
|
45
|
+
return /* @__PURE__ */ jsx(
|
|
46
|
+
Focusable,
|
|
47
|
+
{
|
|
48
|
+
accessibleWhenDisabled: true,
|
|
49
|
+
...props,
|
|
50
|
+
className: cx("\u{1F95D}NavigationListItemAction", props.className),
|
|
51
|
+
ref: forwardedRef
|
|
52
|
+
}
|
|
53
|
+
);
|
|
54
|
+
});
|
|
55
|
+
DEV: NavigationListItemAction.displayName = "NavigationListItemAction";
|
|
56
|
+
const NavigationListAnchor = forwardRef(
|
|
57
|
+
(props, forwardedRef) => {
|
|
58
|
+
const { active, label, icon, ...rest } = props;
|
|
59
|
+
return /* @__PURE__ */ jsxs(
|
|
60
|
+
NavigationListItemAction,
|
|
61
|
+
{
|
|
62
|
+
...rest,
|
|
63
|
+
render: /* @__PURE__ */ jsx(
|
|
64
|
+
Role.a,
|
|
65
|
+
{
|
|
66
|
+
"aria-current": active ? "true" : void 0,
|
|
67
|
+
render: props.render
|
|
68
|
+
}
|
|
69
|
+
),
|
|
70
|
+
ref: forwardedRef,
|
|
71
|
+
children: [
|
|
72
|
+
typeof icon === "string" ? /* @__PURE__ */ jsx(Icon, { href: icon }) : icon,
|
|
73
|
+
/* @__PURE__ */ jsx(Text, { variant: "body-sm", render: /* @__PURE__ */ jsx("span", {}), children: label })
|
|
74
|
+
]
|
|
75
|
+
}
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
);
|
|
79
|
+
DEV: NavigationListAnchor.displayName = "NavigationList.Anchor";
|
|
80
|
+
const NavigationListSubgroup = forwardRef(
|
|
81
|
+
(props, forwardedRef) => {
|
|
82
|
+
const { label, icon, items, defaultOpen, ...rest } = props;
|
|
83
|
+
return /* @__PURE__ */ jsx(
|
|
84
|
+
Role,
|
|
85
|
+
{
|
|
86
|
+
...rest,
|
|
87
|
+
className: cx("\u{1F95D}NavigationListSubgroup", props.className),
|
|
88
|
+
ref: forwardedRef,
|
|
89
|
+
children: /* @__PURE__ */ jsxs(AriaDisclosure.DisclosureProvider, { defaultOpen, children: [
|
|
90
|
+
/* @__PURE__ */ jsx(
|
|
91
|
+
AriaDisclosure.Disclosure,
|
|
92
|
+
{
|
|
93
|
+
render: /* @__PURE__ */ jsx(NavigationListSubgroupButton, { label, icon })
|
|
94
|
+
}
|
|
95
|
+
),
|
|
96
|
+
/* @__PURE__ */ jsx(NavigationListRootContext.Provider, { value: { indented: true }, children: /* @__PURE__ */ jsx(
|
|
97
|
+
AriaDisclosure.DisclosureContent,
|
|
98
|
+
{
|
|
99
|
+
render: /* @__PURE__ */ jsx(NavigationListRoot, { items })
|
|
100
|
+
}
|
|
101
|
+
) })
|
|
102
|
+
] })
|
|
103
|
+
}
|
|
104
|
+
);
|
|
105
|
+
}
|
|
106
|
+
);
|
|
107
|
+
DEV: NavigationListSubgroup.displayName = "NavigationList.Subgroup";
|
|
108
|
+
const NavigationListSubgroupButton = forwardRef((props, forwardedRef) => {
|
|
109
|
+
const { label, icon, ...rest } = props;
|
|
110
|
+
return /* @__PURE__ */ jsxs(
|
|
111
|
+
NavigationListItemAction,
|
|
112
|
+
{
|
|
113
|
+
render: /* @__PURE__ */ jsx(AriaButton, {}),
|
|
114
|
+
...rest,
|
|
115
|
+
className: cx("\u{1F95D}NavigationListSubgroupButton", props.className),
|
|
116
|
+
ref: forwardedRef,
|
|
117
|
+
children: [
|
|
118
|
+
typeof icon === "string" ? /* @__PURE__ */ jsx(Icon, { href: icon }) : icon,
|
|
119
|
+
/* @__PURE__ */ jsx(Text, { variant: "body-sm", render: /* @__PURE__ */ jsx("span", {}), children: label }),
|
|
120
|
+
/* @__PURE__ */ jsx(ChevronDown, { className: "\u{1F95D}NavigationListSubgroupChevron" })
|
|
121
|
+
]
|
|
122
|
+
}
|
|
123
|
+
);
|
|
124
|
+
});
|
|
125
|
+
DEV: NavigationListSubgroupButton.displayName = "NavigationListSubgroupButton";
|
|
126
|
+
export {
|
|
127
|
+
NavigationListAnchor as Anchor,
|
|
128
|
+
NavigationListRoot as Root,
|
|
129
|
+
NavigationListSubgroup as Subgroup
|
|
130
|
+
};
|
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
import cx from "classnames";
|
|
14
14
|
import { createStore, useStore } from "zustand";
|
|
15
15
|
import { combine } from "zustand/middleware";
|
|
16
|
+
import { useInit } from "./~utils.useInit.js";
|
|
16
17
|
function createNavigationRailStore(initialState) {
|
|
17
18
|
return createStore(
|
|
18
19
|
combine(initialState, (set) => ({
|
|
@@ -50,6 +51,7 @@ function useNavigationRailState(selectorFn) {
|
|
|
50
51
|
}
|
|
51
52
|
const NavigationRailRoot = forwardRef(
|
|
52
53
|
(props, forwardedRef) => {
|
|
54
|
+
useInit();
|
|
53
55
|
const { defaultExpanded = false, expanded, setExpanded, ...rest } = props;
|
|
54
56
|
return /* @__PURE__ */ jsx(
|
|
55
57
|
NavigationRailProvider,
|
|
@@ -77,7 +79,7 @@ const NavigationRailRootInner = forwardRef(
|
|
|
77
79
|
);
|
|
78
80
|
}
|
|
79
81
|
);
|
|
80
|
-
DEV: NavigationRailRootInner.displayName = "
|
|
82
|
+
DEV: NavigationRailRootInner.displayName = "NavigationRailRootInner";
|
|
81
83
|
const NavigationRailHeader = forwardRef(
|
|
82
84
|
(props, forwardedRef) => {
|
|
83
85
|
const expanded = useNavigationRailState((state) => state.expanded);
|
|
@@ -100,7 +102,7 @@ const NavigationRailToggleButton = forwardRef((props, forwardedRef) => {
|
|
|
100
102
|
return /* @__PURE__ */ jsxs(
|
|
101
103
|
Button,
|
|
102
104
|
{
|
|
103
|
-
"aria-
|
|
105
|
+
"aria-pressed": expanded ? "true" : "false",
|
|
104
106
|
...rest,
|
|
105
107
|
className: cx("\u{1F95D}NavigationRailToggleButton", props.className),
|
|
106
108
|
ref: forwardedRef,
|
|
@@ -159,7 +161,7 @@ const NavigationRailListItem = forwardRef(
|
|
|
159
161
|
);
|
|
160
162
|
}
|
|
161
163
|
);
|
|
162
|
-
DEV: NavigationRailListItem.displayName = "NavigationRail.
|
|
164
|
+
DEV: NavigationRailListItem.displayName = "NavigationRail.ListItem";
|
|
163
165
|
const NavigationRailItemAction = forwardRef((props, forwardedRef) => {
|
|
164
166
|
const expanded = useNavigationRailState((state) => state.expanded);
|
|
165
167
|
const { label, icon, ...rest } = props;
|
|
@@ -188,7 +190,7 @@ const NavigationRailItemAction = forwardRef((props, forwardedRef) => {
|
|
|
188
190
|
}
|
|
189
191
|
return action;
|
|
190
192
|
});
|
|
191
|
-
DEV: NavigationRailItemAction.displayName = "
|
|
193
|
+
DEV: NavigationRailItemAction.displayName = "NavigationRailItemAction";
|
|
192
194
|
const NavigationRailAnchor = forwardRef(
|
|
193
195
|
(props, forwardedRef) => {
|
|
194
196
|
const { label, icon, active, ...rest } = props;
|
|
@@ -197,7 +199,7 @@ const NavigationRailAnchor = forwardRef(
|
|
|
197
199
|
{
|
|
198
200
|
label,
|
|
199
201
|
icon,
|
|
200
|
-
"aria-current": active ? "
|
|
202
|
+
"aria-current": active ? "true" : void 0,
|
|
201
203
|
render: /* @__PURE__ */ jsx(Role.a, { ...rest, ref: forwardedRef })
|
|
202
204
|
}
|
|
203
205
|
);
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import * as AkPopover from "@ariakit/react/popover";
|
|
4
|
+
import { PortalContext } from "@ariakit/react/portal";
|
|
5
|
+
import { useStoreState } from "@ariakit/react/store";
|
|
6
|
+
import { Button } from "@stratakit/bricks";
|
|
7
|
+
import {
|
|
8
|
+
forwardRef,
|
|
9
|
+
usePopoverApi,
|
|
10
|
+
useUnreactiveCallback
|
|
11
|
+
} from "@stratakit/foundations/secret-internals";
|
|
12
|
+
import cx from "classnames";
|
|
13
|
+
import { useInit } from "./~utils.useInit.js";
|
|
14
|
+
function PopoverProvider(props) {
|
|
15
|
+
const { children, open, setOpen, placement = "bottom-start" } = props;
|
|
16
|
+
return /* @__PURE__ */ jsx(
|
|
17
|
+
AkPopover.PopoverProvider,
|
|
18
|
+
{
|
|
19
|
+
open,
|
|
20
|
+
setOpen,
|
|
21
|
+
placement,
|
|
22
|
+
children
|
|
23
|
+
}
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
DEV: PopoverProvider.displayName = "PopoverProvider";
|
|
27
|
+
const PopoverDisclosure = forwardRef(
|
|
28
|
+
(props, forwardedRef) => {
|
|
29
|
+
const store = AkPopover.usePopoverContext();
|
|
30
|
+
const open = useStoreState(store, "open");
|
|
31
|
+
const defaultId = React.useId();
|
|
32
|
+
return /* @__PURE__ */ jsx(
|
|
33
|
+
AkPopover.PopoverDisclosure,
|
|
34
|
+
{
|
|
35
|
+
id: defaultId,
|
|
36
|
+
render: /* @__PURE__ */ jsx(Button, {}),
|
|
37
|
+
...props,
|
|
38
|
+
"data-has-popover-open": open || void 0,
|
|
39
|
+
ref: forwardedRef
|
|
40
|
+
}
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
);
|
|
44
|
+
DEV: PopoverDisclosure.displayName = "PopoverDisclosure";
|
|
45
|
+
const PopoverRoot = forwardRef(
|
|
46
|
+
(props, forwardedRef) => {
|
|
47
|
+
const { children, unmountOnHide, ...rest } = props;
|
|
48
|
+
const store = AkPopover.usePopoverContext();
|
|
49
|
+
const popoverElement = useStoreState(store, "popoverElement");
|
|
50
|
+
const open = useStoreState(store, "open");
|
|
51
|
+
const setOpen = useUnreactiveCallback(store?.setOpen);
|
|
52
|
+
const popoverProps = usePopoverApi({
|
|
53
|
+
element: popoverElement,
|
|
54
|
+
open,
|
|
55
|
+
setOpen
|
|
56
|
+
});
|
|
57
|
+
const contentElement = useStoreState(store, "contentElement");
|
|
58
|
+
const triggerId = useStoreState(
|
|
59
|
+
store,
|
|
60
|
+
(state) => state?.disclosureElement?.id
|
|
61
|
+
);
|
|
62
|
+
const labelledBy = props["aria-label"] ? void 0 : triggerId;
|
|
63
|
+
return /* @__PURE__ */ jsx(
|
|
64
|
+
AkPopover.Popover,
|
|
65
|
+
{
|
|
66
|
+
"aria-labelledby": labelledBy,
|
|
67
|
+
portal: true,
|
|
68
|
+
unmountOnHide,
|
|
69
|
+
...rest,
|
|
70
|
+
gutter: 8,
|
|
71
|
+
style: { ...popoverProps.style, ...props.style },
|
|
72
|
+
wrapperProps: { popover: popoverProps.popover },
|
|
73
|
+
className: cx("\u{1F95D}Popover", props.className),
|
|
74
|
+
ref: forwardedRef,
|
|
75
|
+
children: /* @__PURE__ */ jsx(PortalContext.Provider, { value: contentElement ?? null, children })
|
|
76
|
+
}
|
|
77
|
+
);
|
|
78
|
+
}
|
|
79
|
+
);
|
|
80
|
+
DEV: PopoverRoot.displayName = "PopoverRoot";
|
|
81
|
+
const Popover = forwardRef((props, forwardedRef) => {
|
|
82
|
+
useInit();
|
|
83
|
+
const { children, content, open, setOpen, placement, ...rest } = props;
|
|
84
|
+
return /* @__PURE__ */ jsxs(PopoverProvider, { open, setOpen, placement, children: [
|
|
85
|
+
/* @__PURE__ */ jsx(PopoverDisclosure, { render: children }),
|
|
86
|
+
/* @__PURE__ */ jsx(PopoverRoot, { ...rest, ref: forwardedRef, children: content })
|
|
87
|
+
] });
|
|
88
|
+
});
|
|
89
|
+
DEV: Popover.displayName = "Popover";
|
|
90
|
+
var Popover_default = Popover;
|
|
91
|
+
export {
|
|
92
|
+
Popover_default as default
|
|
93
|
+
};
|
package/dist/DEV/Table.js
CHANGED
|
@@ -7,9 +7,11 @@ import {
|
|
|
7
7
|
useSafeContext
|
|
8
8
|
} from "@stratakit/foundations/secret-internals";
|
|
9
9
|
import cx from "classnames";
|
|
10
|
+
import { useInit } from "./~utils.useInit.js";
|
|
10
11
|
const TableContext = React.createContext(void 0);
|
|
11
12
|
const TableHeaderContext = React.createContext(false);
|
|
12
13
|
const HtmlTable = forwardRef((props, forwardedRef) => {
|
|
14
|
+
useInit();
|
|
13
15
|
const tableContextValue = React.useMemo(
|
|
14
16
|
() => ({ mode: "html" }),
|
|
15
17
|
[]
|
|
@@ -27,6 +29,7 @@ const HtmlTable = forwardRef((props, forwardedRef) => {
|
|
|
27
29
|
DEV: HtmlTable.displayName = "Table.HtmlTable";
|
|
28
30
|
const CustomTable = forwardRef(
|
|
29
31
|
(props, forwardedRef) => {
|
|
32
|
+
useInit();
|
|
30
33
|
const [captionId, setCaptionId] = React.useState();
|
|
31
34
|
const tableContextValue = React.useMemo(
|
|
32
35
|
() => ({ captionId, setCaptionId, mode: "aria" }),
|
package/dist/DEV/Tabs.js
CHANGED
|
@@ -7,9 +7,11 @@ import {
|
|
|
7
7
|
useUnreactiveCallback
|
|
8
8
|
} from "@stratakit/foundations/secret-internals";
|
|
9
9
|
import cx from "classnames";
|
|
10
|
-
|
|
10
|
+
import { useInit } from "./~utils.useInit.js";
|
|
11
|
+
const supportsAnchorPositioning = isBrowser && CSS?.supports?.("anchor-name: --foo");
|
|
11
12
|
const prefersReducedMotion = () => isBrowser && window.matchMedia("(prefers-reduced-motion)").matches;
|
|
12
13
|
function TabsProvider(props) {
|
|
14
|
+
useInit();
|
|
13
15
|
const {
|
|
14
16
|
defaultSelectedId,
|
|
15
17
|
selectedId,
|
package/dist/DEV/Toolbar.js
CHANGED
|
@@ -7,8 +7,10 @@ import {
|
|
|
7
7
|
} from "@stratakit/bricks/secret-internals";
|
|
8
8
|
import { forwardRef } from "@stratakit/foundations/secret-internals";
|
|
9
9
|
import cx from "classnames";
|
|
10
|
+
import { useInit } from "./~utils.useInit.js";
|
|
10
11
|
const ToolbarGroup = forwardRef(
|
|
11
12
|
(props, forwardedRef) => {
|
|
13
|
+
useInit();
|
|
12
14
|
return /* @__PURE__ */ jsx(
|
|
13
15
|
IconButtonContext.Provider,
|
|
14
16
|
{
|
package/dist/DEV/Tree.js
CHANGED
|
@@ -3,8 +3,10 @@ import { Composite, useCompositeStore } from "@ariakit/react/composite";
|
|
|
3
3
|
import { Role } from "@ariakit/react/role";
|
|
4
4
|
import { forwardRef } from "@stratakit/foundations/secret-internals";
|
|
5
5
|
import cx from "classnames";
|
|
6
|
+
import { useInit } from "./~utils.useInit.js";
|
|
6
7
|
import { Action as TreeItemAction, Root as TreeItemRoot } from "./TreeItem.js";
|
|
7
8
|
const Tree = forwardRef((props, forwardedRef) => {
|
|
9
|
+
useInit();
|
|
8
10
|
const composite = useCompositeStore({ orientation: "vertical" });
|
|
9
11
|
return /* @__PURE__ */ jsx(
|
|
10
12
|
Role.div,
|