@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.
Files changed (46) hide show
  1. package/CHANGELOG.md +74 -0
  2. package/dist/AccordionItem.d.ts +1 -1
  3. package/dist/AccordionItem.js +69 -124
  4. package/dist/Banner.js +149 -120
  5. package/dist/Chip.js +86 -58
  6. package/dist/DEV/AccordionItem.js +2 -0
  7. package/dist/DEV/Banner.js +3 -0
  8. package/dist/DEV/Chip.js +3 -0
  9. package/dist/DEV/Dialog.js +2 -0
  10. package/dist/DEV/DropdownMenu.js +2 -0
  11. package/dist/DEV/ErrorRegion.js +5 -11
  12. package/dist/DEV/NavigationList.js +130 -0
  13. package/dist/DEV/NavigationRail.js +6 -4
  14. package/dist/DEV/Popover.js +90 -0
  15. package/dist/DEV/Table.js +3 -0
  16. package/dist/DEV/Tabs.js +3 -1
  17. package/dist/DEV/Toolbar.js +2 -0
  18. package/dist/DEV/Tree.js +2 -0
  19. package/dist/DEV/TreeItem.js +7 -2
  20. package/dist/DEV/index.js +4 -0
  21. package/dist/DEV/styles.css.js +1 -1
  22. package/dist/DEV/~utils.ListItem.js +3 -3
  23. package/dist/DEV/~utils.useInit.js +16 -0
  24. package/dist/Dialog.js +142 -132
  25. package/dist/DropdownMenu.js +217 -234
  26. package/dist/ErrorRegion.d.ts +18 -8
  27. package/dist/ErrorRegion.js +129 -154
  28. package/dist/NavigationList.d.ts +110 -0
  29. package/dist/NavigationList.js +130 -0
  30. package/dist/NavigationRail.js +211 -188
  31. package/dist/Popover.d.ts +36 -0
  32. package/dist/Popover.js +99 -0
  33. package/dist/Table.js +119 -108
  34. package/dist/Tabs.js +100 -63
  35. package/dist/Toolbar.js +25 -43
  36. package/dist/Tree.js +15 -12
  37. package/dist/TreeItem.js +398 -314
  38. package/dist/index.d.ts +2 -0
  39. package/dist/index.js +4 -0
  40. package/dist/styles.css.js +1 -1
  41. package/dist/~utils.ListItem.d.ts +3 -3
  42. package/dist/~utils.ListItem.js +21 -34
  43. package/dist/~utils.icons.js +26 -46
  44. package/dist/~utils.useInit.d.ts +8 -0
  45. package/dist/~utils.useInit.js +13 -0
  46. package/package.json +25 -18
package/CHANGELOG.md CHANGED
@@ -1,5 +1,79 @@
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
+
47
+ ## 0.5.0
48
+
49
+ ### Breaking changes
50
+
51
+ - [#1036](https://github.com/iTwin/design-system/pull/1036): Changed `items` prop type of `ErrorRegion.Root` component from `ReactNode` to `ReactNode[]`.
52
+
53
+ `items` prop is used to determine error region visibility.
54
+
55
+ - [#1038](https://github.com/iTwin/design-system/pull/1038): Removed unintentionally exposed `TreeItem` [subpath export](https://nodejs.org/api/packages.html#subpath-exports). Tree item components are available under the `Tree` subpath or the main entry point of the package.
56
+
57
+ ```diff
58
+ - import * as TreeItem from "@stratakit/structures/TreeItem";
59
+ + import * as Tree from "@stratakit/structures/Tree";
60
+
61
+ - <TreeItem.Root />
62
+ + <Tree.Item />
63
+
64
+ - <TreeItem.Action />
65
+ + <Tree.ItemAction />
66
+ ```
67
+
68
+ - [#1037](https://github.com/iTwin/design-system/pull/1037): Require `aria-label` or `aria-labelledby` prop in `ErrorRegion.Root` component.
69
+
70
+ ### Non-breaking changes
71
+
72
+ - [#1003](https://github.com/iTwin/design-system/pull/1003): Enabled React Compiler for production build. In React 18 apps, `react-compiler-runtime` dependency will be used.
73
+ - Updated dependencies:
74
+ - @stratakit/bricks@0.5.0
75
+ - @stratakit/foundations@0.4.0
76
+
3
77
  ## 0.4.5
4
78
 
5
79
  - `unstable_NavigationRail` changes:
@@ -228,7 +228,7 @@ declare const AccordionItemMarker: import("react").ForwardRefExoticComponent<Pic
228
228
  * ```
229
229
  */
230
230
  declare const AccordionItemContent: import("react").ForwardRefExoticComponent<Pick<import("@ariakit/react/role").RoleProps, "render"> & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "render"> & import("react").RefAttributes<HTMLDivElement | HTMLElement>>;
231
- interface AccordionItemHeadingProps extends BaseProps {
231
+ interface AccordionItemHeadingProps extends Omit<BaseProps, "render"> {
232
232
  render: NonNullable<BaseProps["render"]>;
233
233
  }
234
234
  /**
@@ -1,133 +1,78 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
- import {
3
- Disclosure,
4
- DisclosureContent,
5
- DisclosureProvider
6
- } from "@ariakit/react/disclosure";
2
+ import { Disclosure, DisclosureContent, DisclosureProvider } from "@ariakit/react/disclosure";
7
3
  import { Role } from "@ariakit/react/role";
8
4
  import { Text } from "@stratakit/bricks";
9
- import {
10
- GhostAligner,
11
- IconButtonPresentation
12
- } from "@stratakit/bricks/secret-internals";
13
- import {
14
- forwardRef,
15
- useControlledState
16
- } from "@stratakit/foundations/secret-internals";
5
+ import { GhostAligner, IconButtonPresentation } from "@stratakit/bricks/secret-internals";
6
+ import { forwardRef, useControlledState } from "@stratakit/foundations/secret-internals";
17
7
  import cx from "classnames";
18
8
  import { ChevronDown } from "./~utils.icons.js";
19
- const AccordionItemRoot = forwardRef(
20
- (props, forwardedRef) => {
21
- const {
22
- defaultOpen,
23
- open: openProp,
24
- setOpen: setOpenProp,
25
- ...rest
26
- } = props;
27
- const [open, setOpen] = useControlledState(
28
- defaultOpen ?? false,
29
- openProp,
30
- setOpenProp
31
- );
32
- return /* @__PURE__ */ jsx(
33
- DisclosureProvider,
34
- {
35
- defaultOpen,
36
- open,
37
- setOpen,
38
- children: /* @__PURE__ */ jsx(
39
- Role,
40
- {
41
- ...rest,
42
- className: cx("\u{1F95D}AccordionItem", props.className),
43
- "data-_sk-open": open,
44
- ref: forwardedRef
45
- }
46
- )
47
- }
48
- );
49
- }
50
- );
51
- const AccordionItemHeader = forwardRef(
52
- (props, forwardedRef) => /* @__PURE__ */ jsx(GhostAligner, { align: "block", children: /* @__PURE__ */ jsx(
53
- Role,
54
- {
55
- ...props,
56
- className: cx("\u{1F95D}AccordionItemHeader", props.className),
9
+ import { useInit } from "./~utils.useInit.js";
10
+ const AccordionItemRoot = forwardRef((props, forwardedRef) => {
11
+ useInit();
12
+ const {
13
+ defaultOpen,
14
+ open: openProp,
15
+ setOpen: setOpenProp,
16
+ ...rest
17
+ } = props;
18
+ const [open, setOpen] = useControlledState(defaultOpen ?? false, openProp, setOpenProp);
19
+ return /* @__PURE__ */ jsx(DisclosureProvider, {
20
+ defaultOpen,
21
+ open,
22
+ setOpen,
23
+ children: /* @__PURE__ */ jsx(Role, {
24
+ ...rest,
25
+ className: cx("\u{1F95D}AccordionItem", props.className),
26
+ "data-_sk-open": open,
57
27
  ref: forwardedRef
58
- }
59
- ) })
60
- );
61
- const AccordionItemButton = forwardRef(
62
- (props, forwardedRef) => /* @__PURE__ */ jsx(
63
- Disclosure,
64
- {
65
- ...props,
66
- className: cx("\u{1F95D}AccordionItemButton", props.className),
67
- ref: forwardedRef
68
- }
69
- )
70
- );
71
- const AccordionItemLabel = forwardRef(
72
- (props, forwardedRef) => /* @__PURE__ */ jsx(
73
- Text,
74
- {
75
- ...props,
76
- variant: "body-sm",
77
- className: cx("\u{1F95D}AccordionItemLabel", props.className),
78
- ref: forwardedRef
79
- }
80
- )
81
- );
82
- const AccordionItemDecoration = forwardRef(
83
- (props, forwardedRef) => /* @__PURE__ */ jsx(
84
- Role,
85
- {
86
- ...props,
87
- className: cx("\u{1F95D}AccordionItemDecoration", props.className),
88
- ref: forwardedRef
89
- }
90
- )
91
- );
92
- const AccordionItemMarker = forwardRef(
93
- (props, forwardedRef) => /* @__PURE__ */ jsx(
94
- IconButtonPresentation,
95
- {
96
- ...props,
97
- variant: "ghost",
98
- className: cx("\u{1F95D}AccordionItemMarker", props.className),
99
- ref: forwardedRef,
100
- children: props.children ?? /* @__PURE__ */ jsx(
101
- ChevronDown,
102
- {
103
- "aria-hidden": "true",
104
- className: "\u{1F95D}AccordionItemMarkerChevron"
105
- }
106
- )
107
- }
108
- )
109
- );
110
- const AccordionItemContent = forwardRef(
111
- (props, forwardedRef) => /* @__PURE__ */ jsx(
112
- DisclosureContent,
113
- {
114
- ...props,
115
- className: cx("\u{1F95D}AccordionItemContent", props.className),
116
- ref: forwardedRef
117
- }
118
- )
119
- );
120
- const AccordionItemHeading = forwardRef(
121
- (props, forwardedRef) => /* @__PURE__ */ jsx(
122
- Text,
123
- {
124
- ...props,
125
- variant: "body-sm",
126
- className: cx("\u{1F95D}AccordionItemHeading", props.className),
127
- ref: forwardedRef
128
- }
129
- )
130
- );
28
+ })
29
+ });
30
+ });
31
+ const AccordionItemHeader = forwardRef((props, forwardedRef) => /* @__PURE__ */ jsx(GhostAligner, {
32
+ align: "block",
33
+ children: /* @__PURE__ */ jsx(Role, {
34
+ ...props,
35
+ className: cx("\u{1F95D}AccordionItemHeader", props.className),
36
+ ref: forwardedRef
37
+ })
38
+ }));
39
+ const AccordionItemButton = forwardRef((props, forwardedRef) => /* @__PURE__ */ jsx(Disclosure, {
40
+ ...props,
41
+ className: cx("\u{1F95D}AccordionItemButton", props.className),
42
+ ref: forwardedRef
43
+ }));
44
+ const AccordionItemLabel = forwardRef((props, forwardedRef) => /* @__PURE__ */ jsx(Text, {
45
+ ...props,
46
+ variant: "body-sm",
47
+ className: cx("\u{1F95D}AccordionItemLabel", props.className),
48
+ ref: forwardedRef
49
+ }));
50
+ const AccordionItemDecoration = forwardRef((props, forwardedRef) => /* @__PURE__ */ jsx(Role, {
51
+ ...props,
52
+ className: cx("\u{1F95D}AccordionItemDecoration", props.className),
53
+ ref: forwardedRef
54
+ }));
55
+ const AccordionItemMarker = forwardRef((props, forwardedRef) => /* @__PURE__ */ jsx(IconButtonPresentation, {
56
+ ...props,
57
+ variant: "ghost",
58
+ className: cx("\u{1F95D}AccordionItemMarker", props.className),
59
+ ref: forwardedRef,
60
+ children: props.children ?? /* @__PURE__ */ jsx(ChevronDown, {
61
+ "aria-hidden": "true",
62
+ className: "\u{1F95D}AccordionItemMarkerChevron"
63
+ })
64
+ }));
65
+ const AccordionItemContent = forwardRef((props, forwardedRef) => /* @__PURE__ */ jsx(DisclosureContent, {
66
+ ...props,
67
+ className: cx("\u{1F95D}AccordionItemContent", props.className),
68
+ ref: forwardedRef
69
+ }));
70
+ const AccordionItemHeading = forwardRef((props, forwardedRef) => /* @__PURE__ */ jsx(Text, {
71
+ ...props,
72
+ variant: "body-sm",
73
+ className: cx("\u{1F95D}AccordionItemHeading", props.className),
74
+ ref: forwardedRef
75
+ }));
131
76
  export {
132
77
  AccordionItemButton as Button,
133
78
  AccordionItemContent as Content,
package/dist/Banner.js CHANGED
@@ -1,142 +1,169 @@
1
+ import { c as _c } from "react-compiler-runtime";
1
2
  import { jsx, jsxs } from "react/jsx-runtime";
2
3
  import * as React from "react";
3
4
  import { Role } from "@ariakit/react/role";
4
5
  import { IconButton, Text } from "@stratakit/bricks";
5
6
  import { GhostAligner } from "@stratakit/bricks/secret-internals";
6
7
  import { Icon } from "@stratakit/foundations";
7
- import {
8
- forwardRef,
9
- useSafeContext
10
- } from "@stratakit/foundations/secret-internals";
8
+ import { forwardRef, useSafeContext } from "@stratakit/foundations/secret-internals";
11
9
  import cx from "classnames";
12
10
  import { createStore, useStore } from "zustand";
13
11
  import { combine } from "zustand/middleware";
14
12
  import { Dismiss, StatusIcon } from "./~utils.icons.js";
13
+ import { useInit } from "./~utils.useInit.js";
15
14
  function createBannerStore(initialState) {
16
- return createStore(
17
- combine(initialState, (set, _, store) => ({
18
- setLabelId: (labelId) => {
19
- set({ labelId: labelId || store.getInitialState().labelId });
20
- }
21
- }))
22
- );
15
+ return createStore(combine(initialState, (set, _, store) => ({
16
+ setLabelId: (labelId) => {
17
+ set({
18
+ labelId: labelId || store.getInitialState().labelId
19
+ });
20
+ }
21
+ })));
23
22
  }
24
23
  const BannerContext = React.createContext(void 0);
25
24
  function BannerProvider(props) {
26
- const { tone } = props;
27
- const [store] = React.useState(() => createBannerStore({ tone }));
28
- React.useEffect(
29
- function synchronizeWithProps() {
30
- store.setState({ tone });
31
- },
32
- [store, tone]
33
- );
34
- return /* @__PURE__ */ jsx(BannerContext.Provider, { value: store, children: props.children });
25
+ const $ = _c(9);
26
+ const {
27
+ tone
28
+ } = props;
29
+ let t0;
30
+ if ($[0] !== tone) {
31
+ t0 = () => createBannerStore({
32
+ tone
33
+ });
34
+ $[0] = tone;
35
+ $[1] = t0;
36
+ } else {
37
+ t0 = $[1];
38
+ }
39
+ const [store] = React.useState(t0);
40
+ let t1;
41
+ let t2;
42
+ if ($[2] !== store || $[3] !== tone) {
43
+ t1 = function synchronizeWithProps() {
44
+ store.setState({
45
+ tone
46
+ });
47
+ };
48
+ t2 = [store, tone];
49
+ $[2] = store;
50
+ $[3] = tone;
51
+ $[4] = t1;
52
+ $[5] = t2;
53
+ } else {
54
+ t1 = $[4];
55
+ t2 = $[5];
56
+ }
57
+ React.useEffect(t1, t2);
58
+ let t3;
59
+ if ($[6] !== props.children || $[7] !== store) {
60
+ t3 = jsx(BannerContext.Provider, {
61
+ value: store,
62
+ children: props.children
63
+ });
64
+ $[6] = props.children;
65
+ $[7] = store;
66
+ $[8] = t3;
67
+ } else {
68
+ t3 = $[8];
69
+ }
70
+ return t3;
35
71
  }
36
72
  function useBannerState(selectorFn) {
37
73
  const store = useSafeContext(BannerContext);
38
74
  return useStore(store, selectorFn);
39
75
  }
40
76
  const BannerRoot = forwardRef((props, forwardedRef) => {
41
- const { tone = "neutral", variant = "outline", ...rest } = props;
42
- return /* @__PURE__ */ jsx(BannerProvider, { tone, children: /* @__PURE__ */ jsx(
43
- Role,
44
- {
77
+ useInit();
78
+ const {
79
+ tone = "neutral",
80
+ variant = "outline",
81
+ ...rest
82
+ } = props;
83
+ return /* @__PURE__ */ jsx(BannerProvider, {
84
+ tone,
85
+ children: /* @__PURE__ */ jsx(Role, {
45
86
  ...rest,
46
87
  "data-_sk-tone": tone,
47
88
  "data-_sk-variant": variant,
48
89
  className: cx("\u{1F95D}Banner", props.className),
49
90
  ref: forwardedRef
50
- }
51
- ) });
91
+ })
92
+ });
52
93
  });
53
94
  const BannerIcon = forwardRef((props, forwardedRef) => {
54
95
  const tone = useBannerState((state) => state.tone);
55
96
  const hasDefaultIcon = props.href === void 0 && tone !== "neutral";
56
97
  const {
57
- render = hasDefaultIcon ? /* @__PURE__ */ jsx(StatusIcon, { tone }) : void 0,
98
+ render = hasDefaultIcon ? /* @__PURE__ */ jsx(StatusIcon, {
99
+ tone
100
+ }) : void 0,
58
101
  ...rest
59
102
  } = props;
60
- return /* @__PURE__ */ jsx(
61
- Icon,
62
- {
103
+ return /* @__PURE__ */ jsx(Icon, {
104
+ ...rest,
105
+ render,
106
+ className: cx("\u{1F95D}BannerIcon", props.className),
107
+ ref: forwardedRef
108
+ });
109
+ });
110
+ const BannerLabel = forwardRef((props, forwardedRef) => {
111
+ const defaultLabelId = React.useId();
112
+ const labelId = useBannerState((state) => state.labelId);
113
+ const setLabelId = useBannerState((state_0) => state_0.setLabelId);
114
+ const id = props.id ?? defaultLabelId;
115
+ React.useEffect(() => {
116
+ setLabelId(id);
117
+ return () => setLabelId(void 0);
118
+ }, [setLabelId, id]);
119
+ return /* @__PURE__ */ jsx(Text, {
120
+ id: labelId,
121
+ render: /* @__PURE__ */ jsx("span", {}),
122
+ ...props,
123
+ className: cx("\u{1F95D}BannerLabel", props.className),
124
+ variant: "body-sm",
125
+ ref: forwardedRef
126
+ });
127
+ });
128
+ const BannerMessage = forwardRef((props, forwardedRef) => {
129
+ return /* @__PURE__ */ jsx(Text, {
130
+ ...props,
131
+ variant: "body-sm",
132
+ className: cx("\u{1F95D}BannerMessage", props.className),
133
+ ref: forwardedRef
134
+ });
135
+ });
136
+ const BannerActions = forwardRef((props, forwardedRef) => {
137
+ return /* @__PURE__ */ jsx(Role.div, {
138
+ ...props,
139
+ className: cx("\u{1F95D}BannerActions", props.className),
140
+ ref: forwardedRef
141
+ });
142
+ });
143
+ const BannerDismissButton = forwardRef((props, forwardedRef) => {
144
+ const {
145
+ label = "Dismiss",
146
+ ...rest
147
+ } = props;
148
+ const labelId = useBannerState((state) => state.labelId);
149
+ const defaultId = React.useId();
150
+ const id = props.id ?? defaultId;
151
+ return /* @__PURE__ */ jsx(GhostAligner, {
152
+ align: "block",
153
+ children: /* @__PURE__ */ jsx(IconButton, {
63
154
  ...rest,
64
- render,
65
- className: cx("\u{1F95D}BannerIcon", props.className),
155
+ id,
156
+ className: cx("\u{1F95D}BannerDismissButton", props.className),
157
+ variant: "ghost",
158
+ label,
159
+ "aria-labelledby": `${id} ${labelId || ""}`,
160
+ icon: /* @__PURE__ */ jsx(Dismiss, {}),
66
161
  ref: forwardedRef
67
- }
68
- );
162
+ })
163
+ });
69
164
  });
70
- const BannerLabel = forwardRef(
71
- (props, forwardedRef) => {
72
- const defaultLabelId = React.useId();
73
- const labelId = useBannerState((state) => state.labelId);
74
- const setLabelId = useBannerState((state) => state.setLabelId);
75
- const id = props.id ?? defaultLabelId;
76
- React.useEffect(() => {
77
- setLabelId(id);
78
- return () => setLabelId(void 0);
79
- }, [setLabelId, id]);
80
- return /* @__PURE__ */ jsx(
81
- Text,
82
- {
83
- id: labelId,
84
- render: /* @__PURE__ */ jsx("span", {}),
85
- ...props,
86
- className: cx("\u{1F95D}BannerLabel", props.className),
87
- variant: "body-sm",
88
- ref: forwardedRef
89
- }
90
- );
91
- }
92
- );
93
- const BannerMessage = forwardRef(
94
- (props, forwardedRef) => {
95
- return /* @__PURE__ */ jsx(
96
- Text,
97
- {
98
- ...props,
99
- variant: "body-sm",
100
- className: cx("\u{1F95D}BannerMessage", props.className),
101
- ref: forwardedRef
102
- }
103
- );
104
- }
105
- );
106
- const BannerActions = forwardRef(
107
- (props, forwardedRef) => {
108
- return /* @__PURE__ */ jsx(
109
- Role.div,
110
- {
111
- ...props,
112
- className: cx("\u{1F95D}BannerActions", props.className),
113
- ref: forwardedRef
114
- }
115
- );
116
- }
117
- );
118
- const BannerDismissButton = forwardRef(
119
- (props, forwardedRef) => {
120
- const { label = "Dismiss", ...rest } = props;
121
- const labelId = useBannerState((state) => state.labelId);
122
- const defaultId = React.useId();
123
- const id = props.id ?? defaultId;
124
- return /* @__PURE__ */ jsx(GhostAligner, { align: "block", children: /* @__PURE__ */ jsx(
125
- IconButton,
126
- {
127
- ...rest,
128
- id,
129
- className: cx("\u{1F95D}BannerDismissButton", props.className),
130
- variant: "ghost",
131
- label,
132
- "aria-labelledby": `${id} ${labelId || ""}`,
133
- icon: /* @__PURE__ */ jsx(Dismiss, {}),
134
- ref: forwardedRef
135
- }
136
- ) });
137
- }
138
- );
139
165
  const Banner = forwardRef((props, forwardedRef) => {
166
+ useInit();
140
167
  const {
141
168
  message,
142
169
  label,
@@ -146,23 +173,25 @@ const Banner = forwardRef((props, forwardedRef) => {
146
173
  tone = "neutral",
147
174
  ...rest
148
175
  } = props;
149
- const shouldRenderIcon = React.useMemo(
150
- () => icon !== void 0 || tone !== "neutral",
151
- [icon, tone]
152
- );
153
- return /* @__PURE__ */ jsxs(BannerRoot, { tone, ...rest, ref: forwardedRef, children: [
154
- shouldRenderIcon ? /* @__PURE__ */ jsx(
155
- BannerIcon,
156
- {
157
- href: typeof icon === "string" ? icon : void 0,
158
- render: React.isValidElement(icon) ? icon : void 0
159
- }
160
- ) : null,
161
- /* @__PURE__ */ jsx(BannerLabel, { render: React.isValidElement(label) ? label : void 0, children: label }),
162
- /* @__PURE__ */ jsx(BannerMessage, { children: message }),
163
- actions != null ? /* @__PURE__ */ jsx(BannerActions, { children: actions }) : null,
164
- onDismiss ? /* @__PURE__ */ jsx(BannerDismissButton, { onClick: onDismiss }) : null
165
- ] });
176
+ const shouldRenderIcon = React.useMemo(() => icon !== void 0 || tone !== "neutral", [icon, tone]);
177
+ return /* @__PURE__ */ jsxs(BannerRoot, {
178
+ tone,
179
+ ...rest,
180
+ ref: forwardedRef,
181
+ children: [shouldRenderIcon ? /* @__PURE__ */ jsx(BannerIcon, {
182
+ href: typeof icon === "string" ? icon : void 0,
183
+ render: React.isValidElement(icon) ? icon : void 0
184
+ }) : null, /* @__PURE__ */ jsx(BannerLabel, {
185
+ render: React.isValidElement(label) ? label : void 0,
186
+ children: label
187
+ }), /* @__PURE__ */ jsx(BannerMessage, {
188
+ children: message
189
+ }), actions != null ? /* @__PURE__ */ jsx(BannerActions, {
190
+ children: actions
191
+ }) : null, onDismiss ? /* @__PURE__ */ jsx(BannerDismissButton, {
192
+ onClick: onDismiss
193
+ }) : null]
194
+ });
166
195
  });
167
196
  var Banner_default = Banner;
168
197
  export {