@carbon-labs/react-ui-shell 0.29.0 → 0.31.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
@@ -34,6 +34,10 @@ 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`
38
42
  - `HeaderDivider`
39
43
  - `SharkFinIcon`
@@ -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,6 +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';
18
19
  export { HeaderDivider } from './components/HeaderDivider';
package/es/index.js CHANGED
@@ -12,6 +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';
17
18
  export { HeaderDivider } from './components/HeaderDivider.js';
@@ -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,6 +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';
18
19
  export { HeaderDivider } from './components/HeaderDivider';
package/lib/index.js CHANGED
@@ -14,6 +14,7 @@ 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');
19
20
  var HeaderDivider = require('./components/HeaderDivider.js');
@@ -28,6 +29,10 @@ exports.SideNavLinkPopover = SideNavLinkPopover.SideNavLinkPopover;
28
29
  exports.SideNavMenu = SideNavMenu.SideNavMenu;
29
30
  exports.SideNavMenuItem = SideNavMenuItem.SideNavMenuItem;
30
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;
31
36
  exports.HeaderPanel = HeaderPanel.HeaderPanel;
32
37
  exports.SharkFinIcon = SharkFinIcon.SharkFinIcon;
33
38
  exports.HeaderDivider = HeaderDivider.HeaderDivider;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@carbon-labs/react-ui-shell",
3
- "version": "0.29.0",
3
+ "version": "0.31.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": "0b543e502dcedecdc6d8b624536dc3d7f153607b"
36
+ "gitHead": "b823d1537a2e40e31f7246a6341b68d861c8fd92"
37
37
  }
@@ -6,6 +6,10 @@
6
6
  */
7
7
  @use '@carbon/styles/scss/theme' as *;
8
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;
12
+
9
13
  $prefix: 'cds' !default;
10
14
 
11
15
  .#{$prefix}--header__global {
@@ -28,3 +32,39 @@ $prefix: 'cds' !default;
28
32
  .#{$prefix}--menu-button__trigger.#{$prefix}--btn--ghost:not([disabled]) {
29
33
  color: $text-secondary;
30
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
+ }
package/telemetry.yml CHANGED
@@ -7,29 +7,104 @@ collect:
7
7
  jsx:
8
8
  elements:
9
9
  allowedAttributeNames:
10
- # SideNav
10
+ # General
11
11
  - addFocusListeners
12
- - addMouseListeners
12
+ - align
13
+ - as
14
+ - autoAlign
15
+ - children
13
16
  - className
14
17
  - defaultExpanded
18
+ - defaultOpen
19
+ - element
15
20
  - enterDelayMs
16
21
  - expanded
17
22
  - href
23
+ - isActive
24
+ - isSideNavExpanded
25
+ - label
26
+ - large
27
+ - leaveDelayMs
28
+ - renderIcon
29
+ - selected
30
+ - tabIndex
31
+ - title
32
+ # HeaderContainer
33
+ - isSwitcherExpanded
34
+ - render
35
+ # HeaderPanel
36
+ - onHeaderPanelFocus
37
+ # HeaderPopover
38
+ - alignmentAxisOffset
39
+ # SharkFinIcon
40
+ - small
41
+ # SideNav
42
+ - addMouseListeners
43
+ - hideOverlay
18
44
  - inert
19
45
  - isChildOfHeader
20
46
  - isCollapsible
21
47
  - isFixedNav
22
48
  - isPersistent
23
49
  - isRail
50
+ - isTreeview
51
+ - navType
24
52
  - onOverlayClick
25
53
  - onSideNavBlur
26
54
  - onToggle
55
+ - translateWithId
56
+ # SideNavFlyoutMenu
57
+ - description
58
+ - dropShadow
59
+ - highContrast
60
+ - menuContent
61
+ # SideNavItems
62
+ - accessibilityLabel
63
+ # SideNavLink
64
+ - aria-label
65
+ - aria-labelledby
66
+ # SideNavLinkPopover
67
+ - closeOnActivation
68
+ - disabled
69
+ - isSelected
70
+ - size
71
+ - wrapperClasses
72
+ # SideNavMenu
73
+ - depth
74
+ - onMenuToggle
75
+ # SideNavMenuItem
76
+ - isFlyoutMenuItem
77
+ # SideNavToggle
78
+ - onClick
27
79
  # React
28
80
  - key
29
81
  - ref
30
82
  allowedAttributeStringValues:
31
- - 'true'
32
- - 'false'
83
+ # General - align
84
+ - bottom
85
+ - bottom-end
86
+ - bottom-left
87
+ - bottom-right
88
+ - bottom-start
89
+ - left
90
+ - left-bottom
91
+ - left-end
92
+ - left-start
93
+ - left-top
94
+ - right
95
+ - right-bottom
96
+ - right-end
97
+ - right-start
98
+ - right-top
99
+ - top
100
+ - top-end
101
+ - top-left
102
+ - top-right
103
+ - top-start
104
+ # SideNavLinkPopover - size
105
+ - lg
106
+ - md
107
+ - sm
33
108
  npm:
34
109
  dependencies: null
35
110
  js: