@carbon-labs/react-ui-shell 0.28.0 → 0.30.0

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/README.md CHANGED
@@ -26,7 +26,7 @@ yarn add @carbon-labs/react-ui-shell @carbon/react
26
26
  ## ⚡ Usage
27
27
 
28
28
  To use this package you will need to import components from both `@carbon/react`
29
- and `@carbon-labs/react-ui-shell`o compose the UI Shell. The following
29
+ and `@carbon-labs/react-ui-shell` to compose the UI Shell. The following
30
30
  components are provided by `@carbon-labs/react-ui-shell`:
31
31
 
32
32
  - `SideNav`
@@ -34,7 +34,13 @@ components are provided by `@carbon-labs/react-ui-shell`:
34
34
  - `SideNavLink`
35
35
  - `SideNavMenu`
36
36
  - `SideNavMenuItem`
37
+ - `HeaderPopover`
38
+ - `HeaderPopoverActions`
39
+ - `HeaderPopoverButton`
40
+ - `HeaderPopoverContent`
37
41
  - `HeaderPanel`
42
+ - `HeaderDivider`
43
+ - `SharkFinIcon`
38
44
 
39
45
  ```jsx
40
46
  import { SideNav } from '@carbon-labs/react-ui-shell/es/index';
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Copyright IBM Corp. 2025
3
+ *
4
+ * This source code is licensed under the Apache-2.0 license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+ import React from 'react';
8
+ export interface HeaderDividerProps {
9
+ /**
10
+ * Provide an optional class to be applied to the containing node
11
+ */
12
+ className?: string;
13
+ }
14
+ export declare const HeaderDivider: React.FC<HeaderDividerProps>;
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Copyright IBM Corp. 2024
3
+ *
4
+ * This source code is licensed under the Apache-2.0 license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+
8
+ import cx from '../_virtual/index.js';
9
+ import PropTypes from 'prop-types';
10
+ import React from 'react';
11
+ import { usePrefix } from '../internal/usePrefix.js';
12
+
13
+ const HeaderDivider = _ref => {
14
+ let {
15
+ className
16
+ } = _ref;
17
+ const prefix = usePrefix();
18
+ const classNames = cx(`${prefix}--header__divider`, className);
19
+ return /*#__PURE__*/React.createElement("span", {
20
+ className: classNames
21
+ });
22
+ };
23
+ HeaderDivider.propTypes = {
24
+ /**
25
+ * Provide an optional class to be applied to the containing node
26
+ */
27
+ className: PropTypes.string
28
+ };
29
+
30
+ export { HeaderDivider };
@@ -0,0 +1,77 @@
1
+ import PropTypes from 'prop-types';
2
+ import React from 'react';
3
+ import { ToggletipActions, ToggleTipButtonProps, ToggletipContentProps, ToggletipProps } from '@carbon/react';
4
+ /**
5
+ * Used as a container for the button and content of a toggletip. This component
6
+ * is responsible for coordinating between interactions with the button and the
7
+ * visibility of the content
8
+ */
9
+ export declare function HeaderPopover({ align, as, autoAlign, className: customClassName, children, defaultOpen, ...rest }: ToggletipProps<any>): import("react/jsx-runtime").JSX.Element;
10
+ export declare namespace HeaderPopover {
11
+ var propTypes: {
12
+ /**
13
+ * Specify how the toggletip should align with the button
14
+ */
15
+ align: PropTypes.Requireable<string>;
16
+ /**
17
+ * Provide an offset value for alignment axis.
18
+ */
19
+ alignmentAxisOffset: PropTypes.Requireable<number>;
20
+ /**
21
+ * Provide a custom element or component to render the top-level node for the
22
+ * component.
23
+ */
24
+ as: PropTypes.Requireable<PropTypes.ReactComponentLike>;
25
+ /**
26
+ * Will auto-align the popover on first render if it is not visible. This prop is currently experimental and is subject to future changes.
27
+ */
28
+ autoAlign: PropTypes.Requireable<boolean>;
29
+ /**
30
+ * Custom children to be rendered as the content of the label
31
+ */
32
+ children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
33
+ /**
34
+ * Provide a custom class name to be added to the outermost node in the
35
+ * component
36
+ */
37
+ className: PropTypes.Requireable<string>;
38
+ /**
39
+ * Specify if the toggletip should be open by default
40
+ */
41
+ defaultOpen: PropTypes.Requireable<boolean>;
42
+ };
43
+ }
44
+ /**
45
+ * `ToggletipButton` controls the visibility of the Toggletip through mouse
46
+ * clicks and keyboard interactions.
47
+ */
48
+ export declare function HeaderPopoverButton<T extends React.ElementType>({ children, className: customClassName, label, as: BaseComponent, ...rest }: ToggleTipButtonProps<T>): import("react/jsx-runtime").JSX.Element;
49
+ export declare namespace HeaderPopoverButton {
50
+ var propTypes: {
51
+ /**
52
+ * Custom children to be rendered as the content of the label
53
+ */
54
+ children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
55
+ /**
56
+ * Provide a custom class name to be added to the outermost node in the
57
+ * component
58
+ */
59
+ className: PropTypes.Requireable<string>;
60
+ /**
61
+ * Provide an accessible label for this button
62
+ */
63
+ label: PropTypes.Requireable<string>;
64
+ };
65
+ }
66
+ /**
67
+ * `ToggletipContent` is a wrapper around `PopoverContent`. It places the
68
+ * `children` passed in as a prop inside of `PopoverContent` so that they will
69
+ * be rendered inside of the popover for this component.
70
+ */
71
+ export declare function HeaderPopoverContent({ children, className, ...rest }: ToggletipContentProps): import("react/jsx-runtime").JSX.Element;
72
+ /**
73
+ * `ToggletipActions` is a container for one or two actions present at the base
74
+ * of a toggletip. It is used for layout of these items.
75
+ */
76
+ declare const HeaderPopoverActions: typeof ToggletipActions;
77
+ export { HeaderPopoverActions };
@@ -0,0 +1,219 @@
1
+ /**
2
+ * Copyright IBM Corp. 2024
3
+ *
4
+ * This source code is licensed under the Apache-2.0 license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+
8
+ import { extends as _extends } from '../_virtual/_rollupPluginBabelHelpers.js';
9
+ import cx from '../_virtual/index.js';
10
+ import PropTypes from 'prop-types';
11
+ import React, { useRef, useState, useContext } from 'react';
12
+ import { Popover, ToggletipContent, ToggletipActions, IconButton } from '@carbon/react';
13
+ import { Escape } from '../internal/keyboard/keys.js';
14
+ import { match } from '../internal/keyboard/match.js';
15
+ import { useWindowEvent } from '../internal/useEvent.js';
16
+ import { useId } from '../internal/useId.js';
17
+ import { usePrefix } from '../internal/usePrefix.js';
18
+
19
+ // Used to coordinate accessibility props between button and content along with
20
+ // the actions to open and close the toggletip
21
+ const HeaderPopoverContext = /*#__PURE__*/React.createContext(undefined);
22
+ function useToggletip() {
23
+ return useContext(HeaderPopoverContext);
24
+ }
25
+
26
+ /**
27
+ * Used as a container for the button and content of a toggletip. This component
28
+ * is responsible for coordinating between interactions with the button and the
29
+ * visibility of the content
30
+ */
31
+ function HeaderPopover(_ref) {
32
+ let {
33
+ align,
34
+ as,
35
+ autoAlign,
36
+ className: customClassName,
37
+ children,
38
+ defaultOpen = false,
39
+ ...rest
40
+ } = _ref;
41
+ const ref = useRef(null);
42
+ const [open, setOpen] = useState(defaultOpen);
43
+ const prefix = usePrefix();
44
+ const id = useId();
45
+ const className = cx(customClassName, {
46
+ [`${prefix}--header-action`]: true,
47
+ [`${prefix}--autoalign`]: autoAlign
48
+ });
49
+ const actions = {
50
+ toggle: () => {
51
+ setOpen(!open);
52
+ },
53
+ close: () => {
54
+ setOpen(false);
55
+ }
56
+ };
57
+ const value = {
58
+ buttonProps: {
59
+ 'aria-expanded': open,
60
+ 'aria-controls': id,
61
+ onClick: actions.toggle
62
+ },
63
+ contentProps: {
64
+ id
65
+ },
66
+ onClick: {
67
+ onClick: actions.toggle
68
+ }
69
+ };
70
+ const onKeyDown = event => {
71
+ if (open && match(event, Escape)) {
72
+ actions.close();
73
+
74
+ // If the menu is closed while focus is still inside the menu, it should return to the trigger button (#12922)
75
+ const button = ref.current?.children[0];
76
+ if (button instanceof HTMLButtonElement) {
77
+ button.focus();
78
+ }
79
+ }
80
+ };
81
+ const handleBlur = event => {
82
+ // Do not close if the menu itself is clicked, should only close on focus out
83
+ if (open && event.relatedTarget === null) {
84
+ return;
85
+ }
86
+ if (!event.currentTarget.contains(event.relatedTarget)) {
87
+ // The menu should be closed when focus leaves the `Toggletip` (#12922)
88
+ actions.close();
89
+ }
90
+ };
91
+
92
+ // If the `Toggletip` is the last focusable item in the tab order, it should also close when the browser window loses focus (#12922)
93
+ useWindowEvent('blur', () => {
94
+ if (open) {
95
+ actions.close();
96
+ }
97
+ });
98
+ useWindowEvent('click', event => {
99
+ if (open && ref.current && !ref.current.contains(event.target)) {
100
+ actions.close();
101
+ }
102
+ });
103
+ return /*#__PURE__*/React.createElement(HeaderPopoverContext.Provider, {
104
+ value: value
105
+ }, /*#__PURE__*/React.createElement(Popover, _extends({
106
+ align: align,
107
+ autoAlign: autoAlign,
108
+ as: as,
109
+ isTabTip: true,
110
+ className: className,
111
+ dropShadow: false,
112
+ highContrast: false,
113
+ open: open,
114
+ onKeyDown: onKeyDown,
115
+ onBlur: handleBlur,
116
+ ref: ref
117
+ }, rest), children));
118
+ }
119
+ HeaderPopover.propTypes = {
120
+ /**
121
+ * Specify how the toggletip should align with the button
122
+ */
123
+ align: PropTypes.oneOf(['top', 'bottom', 'left', 'right', 'top-start', 'top-end', 'bottom-start', 'bottom-end', 'left-end', 'left-start', 'right-end', 'right-start']),
124
+ /**
125
+ * Provide an offset value for alignment axis.
126
+ */
127
+ alignmentAxisOffset: PropTypes.number,
128
+ /**
129
+ * Provide a custom element or component to render the top-level node for the
130
+ * component.
131
+ */
132
+ as: PropTypes.elementType,
133
+ /**
134
+ * Will auto-align the popover on first render if it is not visible. This prop is currently experimental and is subject to future changes.
135
+ */
136
+ autoAlign: PropTypes.bool,
137
+ /**
138
+ * Custom children to be rendered as the content of the label
139
+ */
140
+ children: PropTypes.node,
141
+ /**
142
+ * Provide a custom class name to be added to the outermost node in the
143
+ * component
144
+ */
145
+ className: PropTypes.string,
146
+ /**
147
+ * Specify if the toggletip should be open by default
148
+ */
149
+ defaultOpen: PropTypes.bool
150
+ };
151
+
152
+ /**
153
+ * `ToggletipButton` controls the visibility of the Toggletip through mouse
154
+ * clicks and keyboard interactions.
155
+ */
156
+
157
+ function HeaderPopoverButton(_ref2) {
158
+ let {
159
+ children,
160
+ className: customClassName,
161
+ label = 'Show information',
162
+ as: BaseComponent,
163
+ ...rest
164
+ } = _ref2;
165
+ const toggletip = useToggletip();
166
+ const prefix = usePrefix();
167
+ const className = cx(customClassName, {
168
+ [`${prefix}--header-action__button`]: true
169
+ });
170
+ const ComponentToggle = BaseComponent ?? IconButton;
171
+ return /*#__PURE__*/React.createElement(ComponentToggle, _extends({}, toggletip?.onClick, {
172
+ className: className,
173
+ kind: BaseComponent ? null : 'ghost',
174
+ label: label,
175
+ highContrast: false
176
+ }, rest), children);
177
+ }
178
+ HeaderPopoverButton.propTypes = {
179
+ /**
180
+ * Custom children to be rendered as the content of the label
181
+ */
182
+ children: PropTypes.node,
183
+ /**
184
+ * Provide a custom class name to be added to the outermost node in the
185
+ * component
186
+ */
187
+ className: PropTypes.string,
188
+ /**
189
+ * Provide an accessible label for this button
190
+ */
191
+ label: PropTypes.string
192
+ };
193
+
194
+ /**
195
+ * `ToggletipContent` is a wrapper around `PopoverContent`. It places the
196
+ * `children` passed in as a prop inside of `PopoverContent` so that they will
197
+ * be rendered inside of the popover for this component.
198
+ */
199
+ function HeaderPopoverContent(_ref3) {
200
+ let {
201
+ children,
202
+ className,
203
+ ...rest
204
+ } = _ref3;
205
+ const prefix = usePrefix();
206
+ return /*#__PURE__*/React.createElement(ToggletipContent, _extends({
207
+ className: cx(className, {
208
+ [`${prefix}--header-action__content`]: true
209
+ })
210
+ }, rest), children);
211
+ }
212
+
213
+ /**
214
+ * `ToggletipActions` is a container for one or two actions present at the base
215
+ * of a toggletip. It is used for layout of these items.
216
+ */
217
+ const HeaderPopoverActions = ToggletipActions;
218
+
219
+ export { HeaderPopover, HeaderPopoverActions, HeaderPopoverButton, HeaderPopoverContent };
package/es/index.d.ts CHANGED
@@ -13,5 +13,7 @@ export { SideNavLinkPopover } from './components/SideNavLinkPopover.js';
13
13
  export { SideNavMenu } from './components/SideNavMenu.js';
14
14
  export { SideNavMenuItem } from './components/SideNavMenuItem.js';
15
15
  export { HeaderContainer } from './components/HeaderContainer';
16
+ export { HeaderPopover, HeaderPopoverActions, HeaderPopoverButton, HeaderPopoverContent, } from './components/HeaderPopover';
16
17
  export { HeaderPanel } from './components/HeaderPanel';
17
18
  export { SharkFinIcon } from './components/SharkFinIcon';
19
+ export { HeaderDivider } from './components/HeaderDivider';
package/es/index.js CHANGED
@@ -12,5 +12,7 @@ export { SideNavLinkPopover } from './components/SideNavLinkPopover.js';
12
12
  export { SideNavMenu } from './components/SideNavMenu.js';
13
13
  export { SideNavMenuItem } from './components/SideNavMenuItem.js';
14
14
  export { HeaderContainer } from './components/HeaderContainer.js';
15
+ export { HeaderPopover, HeaderPopoverActions, HeaderPopoverButton, HeaderPopoverContent } from './components/HeaderPopover.js';
15
16
  export { HeaderPanel } from './components/HeaderPanel.js';
16
17
  export { SharkFinIcon } from './components/SharkFinIcon.js';
18
+ export { HeaderDivider } from './components/HeaderDivider.js';
@@ -5,7 +5,7 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
 
8
- import { getAttributes } from '../../icon-helpers/es/index.js';
8
+ import { getAttributes } from '../node_modules/@carbon/icon-helpers/es/index.js';
9
9
  import PropTypes from 'prop-types';
10
10
  import React from 'react';
11
11
 
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Copyright IBM Corp. 2025
3
+ *
4
+ * This source code is licensed under the Apache-2.0 license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+ import React from 'react';
8
+ export interface HeaderDividerProps {
9
+ /**
10
+ * Provide an optional class to be applied to the containing node
11
+ */
12
+ className?: string;
13
+ }
14
+ export declare const HeaderDivider: React.FC<HeaderDividerProps>;
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Copyright IBM Corp. 2024
3
+ *
4
+ * This source code is licensed under the Apache-2.0 license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+
8
+ 'use strict';
9
+
10
+ var index = require('../_virtual/index.js');
11
+ var PropTypes = require('prop-types');
12
+ var React = require('react');
13
+ var usePrefix = require('../internal/usePrefix.js');
14
+
15
+ const HeaderDivider = _ref => {
16
+ let {
17
+ className
18
+ } = _ref;
19
+ const prefix = usePrefix.usePrefix();
20
+ const classNames = index.default(`${prefix}--header__divider`, className);
21
+ return /*#__PURE__*/React.createElement("span", {
22
+ className: classNames
23
+ });
24
+ };
25
+ HeaderDivider.propTypes = {
26
+ /**
27
+ * Provide an optional class to be applied to the containing node
28
+ */
29
+ className: PropTypes.string
30
+ };
31
+
32
+ exports.HeaderDivider = HeaderDivider;
@@ -0,0 +1,77 @@
1
+ import PropTypes from 'prop-types';
2
+ import React from 'react';
3
+ import { ToggletipActions, ToggleTipButtonProps, ToggletipContentProps, ToggletipProps } from '@carbon/react';
4
+ /**
5
+ * Used as a container for the button and content of a toggletip. This component
6
+ * is responsible for coordinating between interactions with the button and the
7
+ * visibility of the content
8
+ */
9
+ export declare function HeaderPopover({ align, as, autoAlign, className: customClassName, children, defaultOpen, ...rest }: ToggletipProps<any>): import("react/jsx-runtime").JSX.Element;
10
+ export declare namespace HeaderPopover {
11
+ var propTypes: {
12
+ /**
13
+ * Specify how the toggletip should align with the button
14
+ */
15
+ align: PropTypes.Requireable<string>;
16
+ /**
17
+ * Provide an offset value for alignment axis.
18
+ */
19
+ alignmentAxisOffset: PropTypes.Requireable<number>;
20
+ /**
21
+ * Provide a custom element or component to render the top-level node for the
22
+ * component.
23
+ */
24
+ as: PropTypes.Requireable<PropTypes.ReactComponentLike>;
25
+ /**
26
+ * Will auto-align the popover on first render if it is not visible. This prop is currently experimental and is subject to future changes.
27
+ */
28
+ autoAlign: PropTypes.Requireable<boolean>;
29
+ /**
30
+ * Custom children to be rendered as the content of the label
31
+ */
32
+ children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
33
+ /**
34
+ * Provide a custom class name to be added to the outermost node in the
35
+ * component
36
+ */
37
+ className: PropTypes.Requireable<string>;
38
+ /**
39
+ * Specify if the toggletip should be open by default
40
+ */
41
+ defaultOpen: PropTypes.Requireable<boolean>;
42
+ };
43
+ }
44
+ /**
45
+ * `ToggletipButton` controls the visibility of the Toggletip through mouse
46
+ * clicks and keyboard interactions.
47
+ */
48
+ export declare function HeaderPopoverButton<T extends React.ElementType>({ children, className: customClassName, label, as: BaseComponent, ...rest }: ToggleTipButtonProps<T>): import("react/jsx-runtime").JSX.Element;
49
+ export declare namespace HeaderPopoverButton {
50
+ var propTypes: {
51
+ /**
52
+ * Custom children to be rendered as the content of the label
53
+ */
54
+ children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
55
+ /**
56
+ * Provide a custom class name to be added to the outermost node in the
57
+ * component
58
+ */
59
+ className: PropTypes.Requireable<string>;
60
+ /**
61
+ * Provide an accessible label for this button
62
+ */
63
+ label: PropTypes.Requireable<string>;
64
+ };
65
+ }
66
+ /**
67
+ * `ToggletipContent` is a wrapper around `PopoverContent`. It places the
68
+ * `children` passed in as a prop inside of `PopoverContent` so that they will
69
+ * be rendered inside of the popover for this component.
70
+ */
71
+ export declare function HeaderPopoverContent({ children, className, ...rest }: ToggletipContentProps): import("react/jsx-runtime").JSX.Element;
72
+ /**
73
+ * `ToggletipActions` is a container for one or two actions present at the base
74
+ * of a toggletip. It is used for layout of these items.
75
+ */
76
+ declare const HeaderPopoverActions: typeof ToggletipActions;
77
+ export { HeaderPopoverActions };
@@ -0,0 +1,224 @@
1
+ /**
2
+ * Copyright IBM Corp. 2024
3
+ *
4
+ * This source code is licensed under the Apache-2.0 license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+
8
+ 'use strict';
9
+
10
+ var _rollupPluginBabelHelpers = require('../_virtual/_rollupPluginBabelHelpers.js');
11
+ var index = require('../_virtual/index.js');
12
+ var PropTypes = require('prop-types');
13
+ var React = require('react');
14
+ var react = require('@carbon/react');
15
+ var keys = require('../internal/keyboard/keys.js');
16
+ var match = require('../internal/keyboard/match.js');
17
+ var useEvent = require('../internal/useEvent.js');
18
+ var useId = require('../internal/useId.js');
19
+ var usePrefix = require('../internal/usePrefix.js');
20
+
21
+ // Used to coordinate accessibility props between button and content along with
22
+ // the actions to open and close the toggletip
23
+ const HeaderPopoverContext = /*#__PURE__*/React.createContext(undefined);
24
+ function useToggletip() {
25
+ return React.useContext(HeaderPopoverContext);
26
+ }
27
+
28
+ /**
29
+ * Used as a container for the button and content of a toggletip. This component
30
+ * is responsible for coordinating between interactions with the button and the
31
+ * visibility of the content
32
+ */
33
+ function HeaderPopover(_ref) {
34
+ let {
35
+ align,
36
+ as,
37
+ autoAlign,
38
+ className: customClassName,
39
+ children,
40
+ defaultOpen = false,
41
+ ...rest
42
+ } = _ref;
43
+ const ref = React.useRef(null);
44
+ const [open, setOpen] = React.useState(defaultOpen);
45
+ const prefix = usePrefix.usePrefix();
46
+ const id = useId.useId();
47
+ const className = index.default(customClassName, {
48
+ [`${prefix}--header-action`]: true,
49
+ [`${prefix}--autoalign`]: autoAlign
50
+ });
51
+ const actions = {
52
+ toggle: () => {
53
+ setOpen(!open);
54
+ },
55
+ close: () => {
56
+ setOpen(false);
57
+ }
58
+ };
59
+ const value = {
60
+ buttonProps: {
61
+ 'aria-expanded': open,
62
+ 'aria-controls': id,
63
+ onClick: actions.toggle
64
+ },
65
+ contentProps: {
66
+ id
67
+ },
68
+ onClick: {
69
+ onClick: actions.toggle
70
+ }
71
+ };
72
+ const onKeyDown = event => {
73
+ if (open && match.match(event, keys.Escape)) {
74
+ actions.close();
75
+
76
+ // If the menu is closed while focus is still inside the menu, it should return to the trigger button (#12922)
77
+ const button = ref.current?.children[0];
78
+ if (button instanceof HTMLButtonElement) {
79
+ button.focus();
80
+ }
81
+ }
82
+ };
83
+ const handleBlur = event => {
84
+ // Do not close if the menu itself is clicked, should only close on focus out
85
+ if (open && event.relatedTarget === null) {
86
+ return;
87
+ }
88
+ if (!event.currentTarget.contains(event.relatedTarget)) {
89
+ // The menu should be closed when focus leaves the `Toggletip` (#12922)
90
+ actions.close();
91
+ }
92
+ };
93
+
94
+ // If the `Toggletip` is the last focusable item in the tab order, it should also close when the browser window loses focus (#12922)
95
+ useEvent.useWindowEvent('blur', () => {
96
+ if (open) {
97
+ actions.close();
98
+ }
99
+ });
100
+ useEvent.useWindowEvent('click', event => {
101
+ if (open && ref.current && !ref.current.contains(event.target)) {
102
+ actions.close();
103
+ }
104
+ });
105
+ return /*#__PURE__*/React.createElement(HeaderPopoverContext.Provider, {
106
+ value: value
107
+ }, /*#__PURE__*/React.createElement(react.Popover, _rollupPluginBabelHelpers.extends({
108
+ align: align,
109
+ autoAlign: autoAlign,
110
+ as: as,
111
+ isTabTip: true,
112
+ className: className,
113
+ dropShadow: false,
114
+ highContrast: false,
115
+ open: open,
116
+ onKeyDown: onKeyDown,
117
+ onBlur: handleBlur,
118
+ ref: ref
119
+ }, rest), children));
120
+ }
121
+ HeaderPopover.propTypes = {
122
+ /**
123
+ * Specify how the toggletip should align with the button
124
+ */
125
+ align: PropTypes.oneOf(['top', 'bottom', 'left', 'right', 'top-start', 'top-end', 'bottom-start', 'bottom-end', 'left-end', 'left-start', 'right-end', 'right-start']),
126
+ /**
127
+ * Provide an offset value for alignment axis.
128
+ */
129
+ alignmentAxisOffset: PropTypes.number,
130
+ /**
131
+ * Provide a custom element or component to render the top-level node for the
132
+ * component.
133
+ */
134
+ as: PropTypes.elementType,
135
+ /**
136
+ * Will auto-align the popover on first render if it is not visible. This prop is currently experimental and is subject to future changes.
137
+ */
138
+ autoAlign: PropTypes.bool,
139
+ /**
140
+ * Custom children to be rendered as the content of the label
141
+ */
142
+ children: PropTypes.node,
143
+ /**
144
+ * Provide a custom class name to be added to the outermost node in the
145
+ * component
146
+ */
147
+ className: PropTypes.string,
148
+ /**
149
+ * Specify if the toggletip should be open by default
150
+ */
151
+ defaultOpen: PropTypes.bool
152
+ };
153
+
154
+ /**
155
+ * `ToggletipButton` controls the visibility of the Toggletip through mouse
156
+ * clicks and keyboard interactions.
157
+ */
158
+
159
+ function HeaderPopoverButton(_ref2) {
160
+ let {
161
+ children,
162
+ className: customClassName,
163
+ label = 'Show information',
164
+ as: BaseComponent,
165
+ ...rest
166
+ } = _ref2;
167
+ const toggletip = useToggletip();
168
+ const prefix = usePrefix.usePrefix();
169
+ const className = index.default(customClassName, {
170
+ [`${prefix}--header-action__button`]: true
171
+ });
172
+ const ComponentToggle = BaseComponent ?? react.IconButton;
173
+ return /*#__PURE__*/React.createElement(ComponentToggle, _rollupPluginBabelHelpers.extends({}, toggletip?.onClick, {
174
+ className: className,
175
+ kind: BaseComponent ? null : 'ghost',
176
+ label: label,
177
+ highContrast: false
178
+ }, rest), children);
179
+ }
180
+ HeaderPopoverButton.propTypes = {
181
+ /**
182
+ * Custom children to be rendered as the content of the label
183
+ */
184
+ children: PropTypes.node,
185
+ /**
186
+ * Provide a custom class name to be added to the outermost node in the
187
+ * component
188
+ */
189
+ className: PropTypes.string,
190
+ /**
191
+ * Provide an accessible label for this button
192
+ */
193
+ label: PropTypes.string
194
+ };
195
+
196
+ /**
197
+ * `ToggletipContent` is a wrapper around `PopoverContent`. It places the
198
+ * `children` passed in as a prop inside of `PopoverContent` so that they will
199
+ * be rendered inside of the popover for this component.
200
+ */
201
+ function HeaderPopoverContent(_ref3) {
202
+ let {
203
+ children,
204
+ className,
205
+ ...rest
206
+ } = _ref3;
207
+ const prefix = usePrefix.usePrefix();
208
+ return /*#__PURE__*/React.createElement(react.ToggletipContent, _rollupPluginBabelHelpers.extends({
209
+ className: index.default(className, {
210
+ [`${prefix}--header-action__content`]: true
211
+ })
212
+ }, rest), children);
213
+ }
214
+
215
+ /**
216
+ * `ToggletipActions` is a container for one or two actions present at the base
217
+ * of a toggletip. It is used for layout of these items.
218
+ */
219
+ const HeaderPopoverActions = react.ToggletipActions;
220
+
221
+ exports.HeaderPopover = HeaderPopover;
222
+ exports.HeaderPopoverActions = HeaderPopoverActions;
223
+ exports.HeaderPopoverButton = HeaderPopoverButton;
224
+ exports.HeaderPopoverContent = HeaderPopoverContent;
package/lib/index.d.ts CHANGED
@@ -13,5 +13,7 @@ export { SideNavLinkPopover } from './components/SideNavLinkPopover.js';
13
13
  export { SideNavMenu } from './components/SideNavMenu.js';
14
14
  export { SideNavMenuItem } from './components/SideNavMenuItem.js';
15
15
  export { HeaderContainer } from './components/HeaderContainer';
16
+ export { HeaderPopover, HeaderPopoverActions, HeaderPopoverButton, HeaderPopoverContent, } from './components/HeaderPopover';
16
17
  export { HeaderPanel } from './components/HeaderPanel';
17
18
  export { SharkFinIcon } from './components/SharkFinIcon';
19
+ export { HeaderDivider } from './components/HeaderDivider';
package/lib/index.js CHANGED
@@ -14,8 +14,10 @@ var SideNavLinkPopover = require('./components/SideNavLinkPopover.js');
14
14
  var SideNavMenu = require('./components/SideNavMenu.js');
15
15
  var SideNavMenuItem = require('./components/SideNavMenuItem.js');
16
16
  var HeaderContainer = require('./components/HeaderContainer.js');
17
+ var HeaderPopover = require('./components/HeaderPopover.js');
17
18
  var HeaderPanel = require('./components/HeaderPanel.js');
18
19
  var SharkFinIcon = require('./components/SharkFinIcon.js');
20
+ var HeaderDivider = require('./components/HeaderDivider.js');
19
21
 
20
22
 
21
23
 
@@ -27,5 +29,10 @@ exports.SideNavLinkPopover = SideNavLinkPopover.SideNavLinkPopover;
27
29
  exports.SideNavMenu = SideNavMenu.SideNavMenu;
28
30
  exports.SideNavMenuItem = SideNavMenuItem.SideNavMenuItem;
29
31
  exports.HeaderContainer = HeaderContainer.HeaderContainer;
32
+ exports.HeaderPopover = HeaderPopover.HeaderPopover;
33
+ exports.HeaderPopoverActions = HeaderPopover.HeaderPopoverActions;
34
+ exports.HeaderPopoverButton = HeaderPopover.HeaderPopoverButton;
35
+ exports.HeaderPopoverContent = HeaderPopover.HeaderPopoverContent;
30
36
  exports.HeaderPanel = HeaderPanel.HeaderPanel;
31
37
  exports.SharkFinIcon = SharkFinIcon.SharkFinIcon;
38
+ exports.HeaderDivider = HeaderDivider.HeaderDivider;
@@ -9,7 +9,7 @@
9
9
 
10
10
  Object.defineProperty(exports, '__esModule', { value: true });
11
11
 
12
- var index = require('../../icon-helpers/es/index.js');
12
+ var index = require('../node_modules/@carbon/icon-helpers/es/index.js');
13
13
  var PropTypes = require('prop-types');
14
14
  var React = require('react');
15
15
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@carbon-labs/react-ui-shell",
3
- "version": "0.28.0",
3
+ "version": "0.30.0",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "provenance": true
@@ -33,5 +33,5 @@
33
33
  "dependencies": {
34
34
  "@ibm/telemetry-js": "^1.9.1"
35
35
  },
36
- "gitHead": "4a8aca9677b353f76cfcd7021a2665d95a22782c"
36
+ "gitHead": "20b37b5d599d7c73ee3fb778a096920cce966252"
37
37
  }
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Copyright IBM Corp. 2025
3
+ *
4
+ * This source code is licensed under the Apache-2.0 license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+ @use '@carbon/styles/scss/utilities/convert' as convert;
8
+ @use '@carbon/styles/scss/theme' as *;
9
+
10
+ $prefix: 'cds' !default;
11
+
12
+ .#{$prefix}--header__divider {
13
+ flex-shrink: 0;
14
+ background: $border-subtle;
15
+ block-size: convert.to-rem(24px);
16
+ inline-size: 1px;
17
+ }
@@ -4,9 +4,67 @@
4
4
  * This source code is licensed under the Apache-2.0 license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
+ @use '@carbon/styles/scss/theme' as *;
8
+
9
+ @use '@carbon/styles/scss/theme' as *;
10
+ @use '@carbon/styles/scss/motion' as *;
11
+ @use '@carbon/styles/scss/utilities/custom-property' as custom-property;
7
12
 
8
13
  $prefix: 'cds' !default;
9
14
 
15
+ .#{$prefix}--header__global {
16
+ align-items: center;
17
+ }
18
+
19
+ .#{$prefix}--header__action {
20
+ flex-shrink: 0;
21
+ }
22
+
10
23
  .#{$prefix}--header__action:focus {
11
24
  border-width: 2px;
12
25
  }
26
+
27
+ //----------------------------------------------------------------------------
28
+ // Menu button inside Header
29
+ //----------------------------------------------------------------------------
30
+
31
+ .#{$prefix}--header
32
+ .#{$prefix}--menu-button__trigger.#{$prefix}--btn--ghost:not([disabled]) {
33
+ color: $text-secondary;
34
+ }
35
+
36
+ .#{$prefix}--header-action__button.#{$prefix}--btn--ghost:not([disabled]) svg {
37
+ fill: $icon-secondary;
38
+ }
39
+
40
+ .#{$prefix}--header-action.#{$prefix}--popover--open
41
+ .#{$prefix}--header-action__button.#{$prefix}--btn--ghost:not(
42
+ [disabled]
43
+ ):hover
44
+ svg {
45
+ fill: $icon-primary;
46
+ }
47
+
48
+ // TODO: remove when https://github.com/carbon-design-system/carbon/pull/18725 is released
49
+ .#{$prefix}--header-action .#{$prefix}--tooltip-content {
50
+ color: $text-primary;
51
+ }
52
+
53
+ .#{$prefix}--header-action.#{$prefix}--popover--open
54
+ .#{$prefix}--header-action__button {
55
+ background-color: $layer;
56
+ }
57
+
58
+ .#{$prefix}--header-action .#{$prefix}--toggletip-content {
59
+ @include custom-property.declaration('button-focus-color', $focus);
60
+ @include custom-property.declaration('link-text-color', $link-primary);
61
+ @include custom-property.declaration(
62
+ 'link-hover-text-color',
63
+ $link-primary-hover
64
+ );
65
+ @include custom-property.declaration(
66
+ 'link-visited-text-color',
67
+ $link-visited
68
+ );
69
+ @include custom-property.declaration('link-focus-text-color', $focus);
70
+ }
@@ -9,3 +9,4 @@
9
9
  @use 'styles/side-nav';
10
10
  @use 'styles/content';
11
11
  @use 'styles/shark-fin-icon.scss';
12
+ @use 'styles/header-divider.scss';