@stratakit/structures 0.5.0 → 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 CHANGED
@@ -1,5 +1,49 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.5.1
4
+
5
+ - [#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.
6
+
7
+ Includes the following subcomponents:
8
+ - `<NavigationList.Root>`
9
+ - `<NavigationList.Anchor>`
10
+ - `<NavigationList.Subgroup>`
11
+
12
+ Example:
13
+
14
+ ```tsx
15
+ <NavigationList.Root
16
+ items={[
17
+ <NavigationList.Anchor key={1} href="/page1" label="Page 1" />,
18
+ <NavigationList.Anchor key={2} href="/page2" label="Page 2" />,
19
+ <NavigationList.Subgroup
20
+ key={3}
21
+ label="Group of pages"
22
+ items={[
23
+ <NavigationList.Anchor key={1} href="/page3-1" label="Sub-page 1" active />,
24
+ <NavigationList.Anchor key={2} href="/page3-2" label="Sub-page 2" />,
25
+ ]}
26
+ />,
27
+ ]}
28
+ />
29
+ ```
30
+
31
+ - [#1079](https://github.com/iTwin/design-system/pull/1079): Increased the click target area of non-selectable `Tree.Item`s.
32
+ - If `selected` is undefined, the `Tree.Item` will expand/collapse when clicked.
33
+ - If `selected` is defined, the `Tree.Item` will continue to toggle selection when clicked.
34
+
35
+ - [#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.
36
+
37
+ ```tsx
38
+ <Popover content={<>Popover content</>}>
39
+ <Button>Open popover</Button>
40
+ </Popover>
41
+ ```
42
+
43
+ - Updated dependencies:
44
+ - @stratakit/bricks@0.5.1
45
+ - @stratakit/foundations@0.4.1
46
+
3
47
  ## 0.5.0
4
48
 
5
49
  ### Breaking changes
@@ -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,
@@ -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 }),
@@ -12,7 +12,9 @@ import {
12
12
  } from "@stratakit/foundations/secret-internals";
13
13
  import cx from "classnames";
14
14
  import { Dismiss } from "./~utils.icons.js";
15
+ import { useInit } from "./~utils.useInit.js";
15
16
  const DialogRoot = forwardRef((props, forwardedRef) => {
17
+ useInit();
16
18
  const { backdrop = true, unmountOnHide = true, ...rest } = props;
17
19
  const store = AkDialog.useDialogStore();
18
20
  const contentElement = useStoreState(store, "contentElement");
@@ -26,7 +26,9 @@ import {
26
26
  import cx from "classnames";
27
27
  import { Checkmark, ChevronRight } from "./~utils.icons.js";
28
28
  import * as ListItem from "./~utils.ListItem.js";
29
+ import { useInit } from "./~utils.useInit.js";
29
30
  function DropdownMenuProvider(props) {
31
+ useInit();
30
32
  const { children, placement, open, setOpen, defaultOpen } = props;
31
33
  return /* @__PURE__ */ jsx(
32
34
  MenuProvider,
@@ -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 = "NavigationRail.RootInner";
82
+ DEV: NavigationRailRootInner.displayName = "NavigationRailRootInner";
81
83
  const NavigationRailHeader = forwardRef(
82
84
  (props, forwardedRef) => {
83
85
  const expanded = useNavigationRailState((state) => state.expanded);
@@ -159,7 +161,7 @@ const NavigationRailListItem = forwardRef(
159
161
  );
160
162
  }
161
163
  );
162
- DEV: NavigationRailListItem.displayName = "NavigationRail.Item";
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 = "NavigationRail.ItemAction";
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 ? "page" : void 0,
202
+ "aria-current": active ? "true" : void 0,
201
203
  render: /* @__PURE__ */ jsx(Role.a, { ...rest, ref: forwardedRef })
202
204
  }
203
205
  );
@@ -0,0 +1,90 @@
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
+ } from "@stratakit/foundations/secret-internals";
11
+ import cx from "classnames";
12
+ import { useInit } from "./~utils.useInit.js";
13
+ function PopoverProvider(props) {
14
+ const { children, open, setOpen, placement = "bottom-start" } = props;
15
+ return /* @__PURE__ */ jsx(
16
+ AkPopover.PopoverProvider,
17
+ {
18
+ open,
19
+ setOpen,
20
+ placement,
21
+ children
22
+ }
23
+ );
24
+ }
25
+ DEV: PopoverProvider.displayName = "PopoverProvider";
26
+ const PopoverDisclosure = forwardRef(
27
+ (props, forwardedRef) => {
28
+ const store = AkPopover.usePopoverContext();
29
+ const open = useStoreState(store, "open");
30
+ const defaultId = React.useId();
31
+ return /* @__PURE__ */ jsx(
32
+ AkPopover.PopoverDisclosure,
33
+ {
34
+ id: defaultId,
35
+ render: /* @__PURE__ */ jsx(Button, {}),
36
+ ...props,
37
+ "data-has-popover-open": open || void 0,
38
+ ref: forwardedRef
39
+ }
40
+ );
41
+ }
42
+ );
43
+ DEV: PopoverDisclosure.displayName = "PopoverDisclosure";
44
+ const PopoverRoot = forwardRef(
45
+ (props, forwardedRef) => {
46
+ const { children, unmountOnHide, ...rest } = props;
47
+ const store = AkPopover.usePopoverContext();
48
+ const popoverElement = useStoreState(store, "popoverElement");
49
+ const open = useStoreState(store, "open");
50
+ const popoverProps = usePopoverApi({
51
+ element: popoverElement,
52
+ open
53
+ });
54
+ const contentElement = useStoreState(store, "contentElement");
55
+ const triggerId = useStoreState(
56
+ store,
57
+ (state) => state?.disclosureElement?.id
58
+ );
59
+ const labelledBy = props["aria-label"] ? void 0 : triggerId;
60
+ return /* @__PURE__ */ jsx(
61
+ AkPopover.Popover,
62
+ {
63
+ "aria-labelledby": labelledBy,
64
+ portal: true,
65
+ unmountOnHide,
66
+ ...rest,
67
+ gutter: 8,
68
+ style: { ...popoverProps.style, ...props.style },
69
+ wrapperProps: { popover: popoverProps.popover },
70
+ className: cx("\u{1F95D}Popover", props.className),
71
+ ref: forwardedRef,
72
+ children: /* @__PURE__ */ jsx(PortalContext.Provider, { value: contentElement ?? null, children })
73
+ }
74
+ );
75
+ }
76
+ );
77
+ DEV: PopoverRoot.displayName = "PopoverRoot";
78
+ const Popover = forwardRef((props, forwardedRef) => {
79
+ useInit();
80
+ const { children, content, open, setOpen, placement, ...rest } = props;
81
+ return /* @__PURE__ */ jsxs(PopoverProvider, { open, setOpen, placement, children: [
82
+ /* @__PURE__ */ jsx(PopoverDisclosure, { render: children }),
83
+ /* @__PURE__ */ jsx(PopoverRoot, { ...rest, ref: forwardedRef, children: content })
84
+ ] });
85
+ });
86
+ DEV: Popover.displayName = "Popover";
87
+ var Popover_default = Popover;
88
+ export {
89
+ Popover_default as default
90
+ };
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
- const supportsAnchorPositioning = isBrowser && CSS?.supports("anchor-name: --foo");
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,
@@ -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,
@@ -56,9 +56,14 @@ const TreeItem = React.memo(
56
56
  onExpandedChange?.(!expanded);
57
57
  });
58
58
  const handleClick = (event) => {
59
- if (selected === void 0) return;
59
+ if (selected !== void 0) {
60
+ event.stopPropagation();
61
+ onSelectedChange?.(!selected);
62
+ return;
63
+ }
64
+ if (expanded === void 0) return;
60
65
  event.stopPropagation();
61
- onSelectedChange?.(!selected);
66
+ onExpandedChange?.(!expanded);
62
67
  };
63
68
  const handleKeyDown = (event) => {
64
69
  if (event.altKey || event.ctrlKey || event.metaKey || event.shiftKey) {
package/dist/DEV/index.js CHANGED
@@ -5,7 +5,9 @@ import { default as default3 } from "./Chip.js";
5
5
  import * as unstable_Dialog from "./Dialog.js";
6
6
  import * as DropdownMenu from "./DropdownMenu.js";
7
7
  import * as unstable_ErrorRegion from "./ErrorRegion.js";
8
+ import * as unstable_NavigationList from "./NavigationList.js";
8
9
  import * as unstable_NavigationRail from "./NavigationRail.js";
10
+ import { default as default4 } from "./Popover.js";
9
11
  import * as Table from "./Table.js";
10
12
  import * as Tabs from "./Tabs.js";
11
13
  import * as unstable_Toolbar from "./Toolbar.js";
@@ -20,6 +22,8 @@ export {
20
22
  default2 as unstable_Banner,
21
23
  unstable_Dialog,
22
24
  unstable_ErrorRegion,
25
+ unstable_NavigationList,
23
26
  unstable_NavigationRail,
27
+ default4 as unstable_Popover,
24
28
  unstable_Toolbar
25
29
  };