@carbon-labs/react-ui-shell 0.25.0 → 0.27.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.
Files changed (48) hide show
  1. package/es/components/SharkFinIcon.d.ts +24 -0
  2. package/es/components/SharkFinIcon.js +59 -0
  3. package/es/components/SideNav.js +8 -4
  4. package/es/components/SideNavFlyoutMenu.d.ts +141 -0
  5. package/es/components/SideNavFlyoutMenu.js +365 -0
  6. package/es/components/SideNavMenu.d.ts +4 -0
  7. package/es/components/SideNavMenu.js +96 -75
  8. package/es/components/SideNavMenuItem.d.ts +4 -0
  9. package/es/components/SideNavMenuItem.js +17 -4
  10. package/es/components/SideNavToggle.d.ts +4 -0
  11. package/es/components/SideNavToggle.js +9 -1
  12. package/es/index.d.ts +1 -0
  13. package/es/index.js +1 -0
  14. package/es/internal/keyboard/keys.js +13 -1
  15. package/es/internal/setupGetInstanceId.d.ts +11 -0
  16. package/es/internal/setupGetInstanceId.js +19 -0
  17. package/es/internal/useId.d.ts +21 -0
  18. package/es/internal/useId.js +100 -0
  19. package/es/internal/useIdPrefix.d.ts +12 -0
  20. package/es/internal/useIdPrefix.js +19 -0
  21. package/es/internal/usePrefix.d.ts +5 -0
  22. package/es/internal/usePrefix.js +6 -0
  23. package/lib/components/SharkFinIcon.d.ts +24 -0
  24. package/lib/components/SharkFinIcon.js +61 -0
  25. package/lib/components/SideNav.js +8 -4
  26. package/lib/components/SideNavFlyoutMenu.d.ts +141 -0
  27. package/lib/components/SideNavFlyoutMenu.js +367 -0
  28. package/lib/components/SideNavMenu.d.ts +4 -0
  29. package/lib/components/SideNavMenu.js +96 -75
  30. package/lib/components/SideNavMenuItem.d.ts +4 -0
  31. package/lib/components/SideNavMenuItem.js +17 -4
  32. package/lib/components/SideNavToggle.d.ts +4 -0
  33. package/lib/components/SideNavToggle.js +9 -1
  34. package/lib/index.d.ts +1 -0
  35. package/lib/index.js +2 -0
  36. package/lib/internal/keyboard/keys.js +14 -0
  37. package/lib/internal/setupGetInstanceId.d.ts +11 -0
  38. package/lib/internal/setupGetInstanceId.js +23 -0
  39. package/lib/internal/useId.d.ts +21 -0
  40. package/lib/internal/useId.js +103 -0
  41. package/lib/internal/useIdPrefix.d.ts +12 -0
  42. package/lib/internal/useIdPrefix.js +22 -0
  43. package/lib/internal/usePrefix.d.ts +5 -0
  44. package/lib/internal/usePrefix.js +6 -0
  45. package/package.json +2 -2
  46. package/scss/styles/_shark-fin-icon.scss +14 -0
  47. package/scss/styles/_side-nav.scss +158 -0
  48. package/scss/ui-shell.scss +1 -0
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Copyright IBM Corp. 2016, 2023
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 SharkFinIconProps {
9
+ /**
10
+ * Provide a single icon as the child to `SharkfinIcon` to render in the
11
+ * container
12
+ */
13
+ children?: React.ReactNode;
14
+ /**
15
+ * Provide an optional class to be applied to the containing node
16
+ */
17
+ className?: string;
18
+ /**
19
+ * Specify whether the icon should be placed in a smaller bounding box
20
+ * Since the 'small' prop is not provided, we make it optional and set a default value to `false`.
21
+ */
22
+ small?: boolean;
23
+ }
24
+ export declare const SharkFinIcon: React.FC<SharkFinIconProps>;
@@ -0,0 +1,59 @@
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
+ var _g, _defs;
14
+ const SharkFinIcon = _ref => {
15
+ let {
16
+ className: customClassName
17
+ } = _ref;
18
+ const prefix = usePrefix();
19
+ const className = cx({
20
+ [`${prefix}--side-nav__icon`]: true,
21
+ [`${prefix}--shark-fin__icon`]: true,
22
+ [customClassName]: !!customClassName
23
+ });
24
+ return /*#__PURE__*/React.createElement("svg", {
25
+ className: className,
26
+ width: "4",
27
+ height: "4",
28
+ viewBox: "0 0 4 4",
29
+ fill: "none",
30
+ xmlns: "http://www.w3.org/2000/svg"
31
+ }, _g || (_g = /*#__PURE__*/React.createElement("g", {
32
+ "clip-path": "url(#clip0_519_52879)"
33
+ }, /*#__PURE__*/React.createElement("path", {
34
+ d: "M2 2L4 0V4H0L2 2Z"
35
+ }))), _defs || (_defs = /*#__PURE__*/React.createElement("defs", null, /*#__PURE__*/React.createElement("clipPath", {
36
+ id: "clip0_519_52879"
37
+ }, /*#__PURE__*/React.createElement("rect", {
38
+ width: "4",
39
+ height: "4",
40
+ fill: "white"
41
+ })))));
42
+ };
43
+ SharkFinIcon.propTypes = {
44
+ /**
45
+ * Provide a single icon as the child to `SharkfinIcon` to render in the
46
+ * container
47
+ */
48
+ children: PropTypes.node,
49
+ /**
50
+ * Provide an optional class to be applied to the containing node
51
+ */
52
+ className: PropTypes.string,
53
+ /**
54
+ * Specify whether the icon should be placed in a smaller bounding box
55
+ */
56
+ small: PropTypes.bool
57
+ };
58
+
59
+ export { SharkFinIcon };
@@ -344,6 +344,11 @@ function SideNavRenderFunction(_ref, ref) {
344
344
  setInternalIsTreeview(value);
345
345
  }
346
346
  };
347
+ const SideNavToggleButton = /*#__PURE__*/React.createElement(SideNavToggle, {
348
+ className: !expandedState ? `${prefix}--side-nav__toggle--collapsed` : '',
349
+ renderIcon: expandedState ? SidePanelClose : SidePanelOpen,
350
+ onClick: () => setExpandedState(!expandedState)
351
+ }, sideNavToggleText);
347
352
  return /*#__PURE__*/React.createElement(SideNavContext.Provider, {
348
353
  value: {
349
354
  expanded,
@@ -364,10 +369,9 @@ function SideNavRenderFunction(_ref, ref) {
364
369
  ref: navRef,
365
370
  className: `${prefix}--side-nav__navigation ${className}`,
366
371
  inert: !isRail && navType !== SIDE_NAV_TYPE.PANEL && !(expanded || isLg) ? -1 : undefined
367
- }, accessibilityLabel, eventHandlers, other), childrenToRender, navType === SIDE_NAV_TYPE.PANEL && /*#__PURE__*/React.createElement(SideNavToggle, {
368
- renderIcon: expandedState ? SidePanelClose : SidePanelOpen,
369
- onClick: () => setExpandedState(!expandedState)
370
- }, sideNavToggleText)));
372
+ }, accessibilityLabel, eventHandlers, other), childrenToRender, navType === SIDE_NAV_TYPE.PANEL && (expandedState ? SideNavToggleButton : /*#__PURE__*/React.createElement("div", {
373
+ className: `${prefix}--side-nav__toggle-container`
374
+ }, SideNavToggleButton))));
371
375
  }
372
376
  const SideNav = /*#__PURE__*/React.forwardRef(SideNavRenderFunction);
373
377
  SideNav.displayName = 'SideNav';
@@ -0,0 +1,141 @@
1
+ /**
2
+ * Copyright IBM Corp. 2016, 2023
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 PropTypes from 'prop-types';
8
+ import React from 'react';
9
+ import { PopoverAlignment } from '@carbon/react';
10
+ import { type PolymorphicProps } from '../types/common';
11
+ interface TooltipBaseProps {
12
+ /**
13
+ * Specify how the trigger should align with the tooltip
14
+ */
15
+ align?: PopoverAlignment;
16
+ /**
17
+ * Pass in the child to which the tooltip will be applied
18
+ */
19
+ children?: React.ReactElement;
20
+ /**
21
+ * Specify an optional className to be applied to the container node
22
+ */
23
+ className?: string;
24
+ /**
25
+ * Specify whether the tooltip should be open when it first renders
26
+ */
27
+ defaultOpen?: boolean;
28
+ /**
29
+ * Provide the description to be rendered inside of the Tooltip. The
30
+ * description will use `aria-describedby` and will describe the child node
31
+ * in addition to the text rendered inside of the child. This means that if you
32
+ * have text in the child node, that it will be announced alongside the
33
+ * description to the screen reader.
34
+ *
35
+ * Note: if label and description are both provided, label will be used and
36
+ * description will not be used
37
+ */
38
+ description?: React.ReactNode;
39
+ /**
40
+ * Specify whether a drop shadow should be rendered
41
+ */
42
+ dropShadow?: boolean;
43
+ /**
44
+ * Specify the duration in milliseconds to delay before displaying the tooltip
45
+ */
46
+ enterDelayMs?: number;
47
+ /**
48
+ * Provide the label to be rendered inside of the Tooltip. The label will use
49
+ * `aria-labelledby` and will fully describe the child node that is provided.
50
+ * This means that if you have text in the child node, that it will not be
51
+ * announced to the screen reader.
52
+ *
53
+ * Note: if label and description are both provided, description will not be
54
+ * used
55
+ */
56
+ label?: React.ReactNode;
57
+ /**
58
+ * Specify the duration in milliseconds to delay before hiding the tooltip
59
+ */
60
+ leaveDelayMs?: number;
61
+ /**
62
+ * The content to be rendered inside the popover menu.
63
+ */
64
+ menuContent?: React.ReactNode;
65
+ /**
66
+ * The boolean to show the flyout menu has been selected.
67
+ */
68
+ selected?: boolean;
69
+ /**
70
+ * The title for the overall menu name.
71
+ */
72
+ title?: string;
73
+ }
74
+ export type TooltipProps<T extends React.ElementType> = PolymorphicProps<T, TooltipBaseProps>;
75
+ declare function SideNavFlyoutMenu<T extends React.ElementType>({ align, className: customClassName, children, label, description, enterDelayMs, leaveDelayMs, defaultOpen, dropShadow, highContrast, menuContent, selected, title, ...rest }: TooltipProps<T>): import("react/jsx-runtime").JSX.Element;
76
+ declare namespace SideNavFlyoutMenu {
77
+ var propTypes: {
78
+ /**
79
+ * Specify how the trigger should align with the tooltip
80
+ */
81
+ align: PropTypes.Requireable<string>;
82
+ /**
83
+ * Pass in the child to which the tooltip will be applied
84
+ */
85
+ children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
86
+ /**
87
+ * Specify an optional className to be applied to the container node
88
+ */
89
+ className: PropTypes.Requireable<string>;
90
+ /**
91
+ * Specify whether the tooltip should be open when it first renders
92
+ */
93
+ defaultOpen: PropTypes.Requireable<boolean>;
94
+ /**
95
+ * Provide the description to be rendered inside of the Tooltip. The
96
+ * description will use `aria-describedby` and will describe the child node
97
+ * in addition to the text rendered inside of the child. This means that if you
98
+ * have text in the child node, that it will be announced alongside the
99
+ * description to the screen reader.
100
+ *
101
+ * Note: if label and description are both provided, label will be used and
102
+ * description will not be used
103
+ */
104
+ description: PropTypes.Requireable<PropTypes.ReactNodeLike>;
105
+ /**
106
+ * Specify whether a drop shadow should be rendered
107
+ */
108
+ dropShadow: PropTypes.Requireable<boolean>;
109
+ /**
110
+ * Specify the duration in milliseconds to delay before displaying the tooltip
111
+ */
112
+ enterDelayMs: PropTypes.Requireable<number>;
113
+ /**
114
+ * Provide the label to be rendered inside of the Tooltip. The label will use
115
+ * `aria-labelledby` and will fully describe the child node that is provided.
116
+ * This means that if you have text in the child node, that it will not be
117
+ * announced to the screen reader.
118
+ *
119
+ * Note: if label and description are both provided, description will not be
120
+ * used
121
+ */
122
+ label: PropTypes.Requireable<PropTypes.ReactNodeLike>;
123
+ /**
124
+ * Specify the duration in milliseconds to delay before hiding the tooltip
125
+ */
126
+ leaveDelayMs: PropTypes.Requireable<number>;
127
+ /**
128
+ * The content to be rendered inside the popover menu.
129
+ */
130
+ menuContent: PropTypes.Requireable<PropTypes.ReactNodeLike>;
131
+ /**
132
+ * The boolean to show the flyout menu has been selected.
133
+ */
134
+ selected: PropTypes.Requireable<boolean>;
135
+ /**
136
+ * The title for the overall menu name.
137
+ */
138
+ title: PropTypes.Requireable<string>;
139
+ };
140
+ }
141
+ export { SideNavFlyoutMenu };
@@ -0,0 +1,365 @@
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, useCallback, useEffect } from 'react';
12
+ import { Popover, PopoverContent, FormLabel } from '@carbon/react';
13
+ import { Escape, Enter, Space } from '../internal/keyboard/keys.js';
14
+ import { match } from '../internal/keyboard/match.js';
15
+ import { useDelayedState } from '../internal/useDelayedState.js';
16
+ import { useId } from '../internal/useId.js';
17
+ import { usePrefix } from '../internal/usePrefix.js';
18
+
19
+ /**
20
+ * Event types that trigger a "drag" to stop.
21
+ */
22
+ const DRAG_STOP_EVENT_TYPES = new Set(['mouseup', 'touchend', 'touchcancel']);
23
+ function SideNavFlyoutMenu(_ref) {
24
+ let {
25
+ align = 'right-start',
26
+ className: customClassName,
27
+ children,
28
+ label,
29
+ description,
30
+ enterDelayMs = 100,
31
+ leaveDelayMs = 300,
32
+ defaultOpen = false,
33
+ dropShadow = true,
34
+ highContrast = false,
35
+ menuContent,
36
+ selected = false,
37
+ title,
38
+ ...rest
39
+ } = _ref;
40
+ const popoverRef = useRef(null);
41
+ const [open, setOpen] = useDelayedState(defaultOpen);
42
+ const [isDragging, setIsDragging] = useState(false);
43
+ const [focusByMouse, setFocusByMouse] = useState(false);
44
+ const [isPointerIntersecting, setIsPointerIntersecting] = useState(false);
45
+ const id = useId('tooltip');
46
+ const prefix = usePrefix();
47
+ const child = React.Children.only(children);
48
+ const menuButton = useRef();
49
+ const [clickMode, setClickMode] = useState(false);
50
+ const isFocusedInsideRef = useRef(false);
51
+ const popoverMenuLinks = useRef(null);
52
+ const [isButtonFocused, setIsButtonFocused] = useState(false);
53
+ const flyoutMenuItems = React.Children.map(menuContent, child => {
54
+ if (/*#__PURE__*/React.isValidElement(child)) {
55
+ return /*#__PURE__*/React.cloneElement(child, {
56
+ ...{
57
+ isFlyoutMenuItem: true
58
+ }
59
+ });
60
+ }
61
+ return child;
62
+ });
63
+ const triggerProps = {
64
+ onFocus: () => {
65
+ if (!focusByMouse) {
66
+ setOpen(true);
67
+ setIsButtonFocused(true);
68
+ setClickMode(false);
69
+ isFocusedInsideRef.current = false;
70
+ }
71
+ },
72
+ onBlur: () => {
73
+ if (!isFocusedInsideRef.current && !focusByMouse) {
74
+ closeMenu();
75
+ }
76
+ },
77
+ onClick: () => {
78
+ setIsButtonFocused(false);
79
+ setClickMode(!clickMode);
80
+ setOpen(!clickMode);
81
+ },
82
+ // This should be placed on the trigger in case the element is disabled
83
+ onMouseEnter,
84
+ onMouseLeave,
85
+ onMouseDown,
86
+ onMouseMove: onMouseMove,
87
+ onTouchStart: onDragStart
88
+ };
89
+ function getChildEventHandlers(childProps) {
90
+ const eventHandlerFunctions = Object.keys(triggerProps).filter(prop => prop.startsWith('on'));
91
+ const eventHandlers = {};
92
+ eventHandlerFunctions.forEach(functionName => {
93
+ eventHandlers[functionName] = evt => {
94
+ triggerProps[functionName](evt);
95
+ if (childProps?.[functionName]) {
96
+ childProps?.[functionName](evt);
97
+ }
98
+ };
99
+ });
100
+ return eventHandlers;
101
+ }
102
+ if (label) {
103
+ triggerProps['aria-labelledby'] = id;
104
+ } else {
105
+ triggerProps['aria-describedby'] = id;
106
+ }
107
+ function onKeyDown(event) {
108
+ if (open && match(event, Escape)) {
109
+ event.stopPropagation();
110
+ if (!isButtonFocused) {
111
+ closeMenu({
112
+ revertFocus: true
113
+ });
114
+ }
115
+ setOpen(!isButtonFocused);
116
+ setIsButtonFocused(!isButtonFocused);
117
+ }
118
+ if (match(event, Enter) || match(event, Space)) {
119
+ setIsButtonFocused(false);
120
+ setOpen(true);
121
+ setFocusByMouse(false);
122
+
123
+ // focus on the first link
124
+ if (popoverMenuLinks?.current && !isFocusedInsideRef.current) {
125
+ const firstLink = popoverMenuLinks?.current?.[0];
126
+ setContentTabIndex('0');
127
+ if (firstLink) {
128
+ isFocusedInsideRef.current = true;
129
+ // avoid race condition
130
+ setTimeout(() => firstLink.focus(), 0);
131
+ }
132
+ }
133
+ }
134
+ }
135
+ function onMouseEnter() {
136
+ if (!clickMode) {
137
+ if (!rest?.onMouseEnter) {
138
+ setIsPointerIntersecting(true);
139
+ setOpen(true, enterDelayMs);
140
+ }
141
+ }
142
+ }
143
+ function onMouseDown() {
144
+ setFocusByMouse(true);
145
+ onDragStart();
146
+ }
147
+ function onMouseLeave() {
148
+ if (!clickMode && !isFocusedInsideRef.current) {
149
+ setIsPointerIntersecting(false);
150
+ if (isDragging) {
151
+ return;
152
+ }
153
+ setIsButtonFocused(false);
154
+ setOpen(false, leaveDelayMs);
155
+ }
156
+ }
157
+ function onMouseMove(evt) {
158
+ if (evt.buttons === 1) {
159
+ setIsDragging(true);
160
+ } else {
161
+ setIsDragging(false);
162
+ }
163
+ }
164
+ function onDragStart() {
165
+ setIsDragging(true);
166
+ }
167
+ const onDragStop = useCallback(() => {
168
+ setIsDragging(false);
169
+ // Close the tooltip, unless the mouse pointer is within the bounds of the
170
+ // trigger.
171
+ if (!isPointerIntersecting) {
172
+ setIsButtonFocused(false);
173
+ setOpen(false, leaveDelayMs);
174
+ }
175
+ }, [isPointerIntersecting, leaveDelayMs, setOpen]);
176
+ useEffect(() => {
177
+ if (isDragging) {
178
+ // Register drag stop handlers.
179
+ DRAG_STOP_EVENT_TYPES.forEach(eventType => {
180
+ document.addEventListener(eventType, onDragStop);
181
+ });
182
+ }
183
+ return () => {
184
+ DRAG_STOP_EVENT_TYPES.forEach(eventType => {
185
+ document.removeEventListener(eventType, onDragStop);
186
+ });
187
+ };
188
+ }, [isDragging, onDragStop]);
189
+ const setContentTabIndex = value => {
190
+ if (popoverMenuLinks.current) {
191
+ popoverMenuLinks.current.forEach(e => e.setAttribute('tabindex', value));
192
+ }
193
+ };
194
+ function handleBlur(event) {
195
+ const isFocusOutside = !popoverRef.current?.contains(event.relatedTarget);
196
+
197
+ // tab outside the menu
198
+ if (open && isFocusedInsideRef.current && !focusByMouse && isFocusOutside) {
199
+ closeMenu();
200
+ }
201
+
202
+ // if button has been clicked, and new click is outside the menu
203
+ if (clickMode && isFocusOutside) {
204
+ closeMenu();
205
+ }
206
+ }
207
+ function closeMenu() {
208
+ let {
209
+ revertFocus = false
210
+ } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
211
+ if (revertFocus) {
212
+ menuButton.current?.focus();
213
+ setOpen(true);
214
+ setIsButtonFocused(true);
215
+ } else {
216
+ setOpen(false);
217
+ setIsButtonFocused(false);
218
+ }
219
+ isFocusedInsideRef.current = false;
220
+ setFocusByMouse(false);
221
+ setIsPointerIntersecting(!clickMode);
222
+ setClickMode(false);
223
+ setContentTabIndex('-1');
224
+ }
225
+
226
+ // initiate menu content to be untabbable
227
+ useEffect(() => {
228
+ if (popoverRef.current) {
229
+ popoverMenuLinks.current = popoverRef.current.querySelectorAll(`.${prefix}--side-nav-menu--popover-content a`);
230
+ setContentTabIndex('-1');
231
+ menuButton.current = popoverRef.current.querySelector(`.${prefix}--side-nav__submenu`);
232
+ }
233
+ }, []);
234
+
235
+ // set menu content to be untabbable
236
+ useEffect(() => {
237
+ if (popoverRef.current && !popoverMenuLinks.current) {
238
+ popoverMenuLinks.current = popoverRef.current.querySelectorAll(`.${prefix}--side-nav-menu--popover-content a`);
239
+ setContentTabIndex('-1');
240
+ }
241
+ }, [open]);
242
+ return (
243
+ /*#__PURE__*/
244
+ // @ts-ignore-error Popover throws a TS error everytime is imported
245
+ React.createElement(Popover, _extends({
246
+ ref: popoverRef
247
+ }, rest, {
248
+ align: isButtonFocused ? 'right' : align,
249
+ className: cx(customClassName, {
250
+ [`${prefix}--flyout-menu`]: true,
251
+ [`${prefix}--flyout-menu-clicked`]: clickMode,
252
+ [`${prefix}--flyout-menu-selected`]: selected,
253
+ [`${prefix}--flyout-menu-focused`]: isButtonFocused || open
254
+ }),
255
+ dropShadow: dropShadow,
256
+ highContrast: false,
257
+ onBlur: handleBlur,
258
+ onKeyDown: onKeyDown,
259
+ onMouseLeave: onMouseLeave,
260
+ open: open
261
+ }), child !== undefined ? /*#__PURE__*/React.cloneElement(child, {
262
+ ...triggerProps,
263
+ ...getChildEventHandlers(child.props)
264
+ }) : null, /*#__PURE__*/React.createElement(PopoverContent, {
265
+ "aria-hidden": open ? 'false' : 'true',
266
+ className: cx({
267
+ [`${prefix}--side-nav-menu--popover-content`]: !isButtonFocused,
268
+ [`${prefix}--flyout-tooltip-content ${prefix}--tooltip-content`]: isButtonFocused
269
+ }),
270
+ id: id,
271
+ onMouseEnter: onMouseEnter,
272
+ role: "tooltip"
273
+ }, !isButtonFocused ? /*#__PURE__*/React.createElement(FormLabel, null, title) : title, /*#__PURE__*/React.createElement("div", {
274
+ style: {
275
+ display: isButtonFocused ? 'none' : 'block'
276
+ }
277
+ }, flyoutMenuItems)))
278
+ );
279
+ }
280
+ SideNavFlyoutMenu.propTypes = {
281
+ /**
282
+ * Specify how the trigger should align with the tooltip
283
+ */
284
+ align: PropTypes.oneOf(['top', 'top-left',
285
+ // deprecated use top-start instead
286
+ 'top-right',
287
+ // deprecated use top-end instead
288
+
289
+ 'bottom', 'bottom-left',
290
+ // deprecated use bottom-start instead
291
+ 'bottom-right',
292
+ // deprecated use bottom-end instead
293
+
294
+ 'left', 'left-bottom',
295
+ // deprecated use left-end instead
296
+ 'left-top',
297
+ // deprecated use left-start instead
298
+
299
+ 'right', 'right-bottom',
300
+ // deprecated use right-end instead
301
+ 'right-top',
302
+ // deprecated use right-start instead
303
+
304
+ // new values to match floating-ui
305
+ 'top-start', 'top-end', 'bottom-start', 'bottom-end', 'left-end', 'left-start', 'right-end', 'right-start']),
306
+ /**
307
+ * Pass in the child to which the tooltip will be applied
308
+ */
309
+ children: PropTypes.node,
310
+ /**
311
+ * Specify an optional className to be applied to the container node
312
+ */
313
+ className: PropTypes.string,
314
+ /**
315
+ * Specify whether the tooltip should be open when it first renders
316
+ */
317
+ defaultOpen: PropTypes.bool,
318
+ /**
319
+ * Provide the description to be rendered inside of the Tooltip. The
320
+ * description will use `aria-describedby` and will describe the child node
321
+ * in addition to the text rendered inside of the child. This means that if you
322
+ * have text in the child node, that it will be announced alongside the
323
+ * description to the screen reader.
324
+ *
325
+ * Note: if label and description are both provided, label will be used and
326
+ * description will not be used
327
+ */
328
+ description: PropTypes.node,
329
+ /**
330
+ * Specify whether a drop shadow should be rendered
331
+ */
332
+ dropShadow: PropTypes.bool,
333
+ /**
334
+ * Specify the duration in milliseconds to delay before displaying the tooltip
335
+ */
336
+ enterDelayMs: PropTypes.number,
337
+ /**
338
+ * Provide the label to be rendered inside of the Tooltip. The label will use
339
+ * `aria-labelledby` and will fully describe the child node that is provided.
340
+ * This means that if you have text in the child node, that it will not be
341
+ * announced to the screen reader.
342
+ *
343
+ * Note: if label and description are both provided, description will not be
344
+ * used
345
+ */
346
+ label: PropTypes.node,
347
+ /**
348
+ * Specify the duration in milliseconds to delay before hiding the tooltip
349
+ */
350
+ leaveDelayMs: PropTypes.number,
351
+ /**
352
+ * The content to be rendered inside the popover menu.
353
+ */
354
+ menuContent: PropTypes.node,
355
+ /**
356
+ * The boolean to show the flyout menu has been selected.
357
+ */
358
+ selected: PropTypes.bool,
359
+ /**
360
+ * The title for the overall menu name.
361
+ */
362
+ title: PropTypes.string
363
+ };
364
+
365
+ export { SideNavFlyoutMenu };
@@ -39,6 +39,10 @@ export interface SideNavMenuProps {
39
39
  * Indicates if the side navigation container is expanded or collapsed.
40
40
  */
41
41
  isSideNavExpanded?: boolean;
42
+ /**
43
+ * The boolean to show the flyout menu has been selected.
44
+ */
45
+ selected?: boolean;
42
46
  /**
43
47
  * The tabIndex for the button element.
44
48
  * If not specified, the default validation will be applied.