@carbon-labs/react-ui-shell 0.44.0 → 0.46.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 +8 -6
- package/es/components/SideNav.js +8 -3
- package/es/components/SideNavMenu.js +10 -4
- package/es/components/SideNavSlot.d.ts +23 -0
- package/es/components/SideNavSlot.js +54 -0
- package/es/index.d.ts +1 -0
- package/es/index.js +1 -0
- package/lib/components/SideNav.js +8 -3
- package/lib/components/SideNavMenu.js +9 -3
- package/lib/components/SideNavSlot.d.ts +23 -0
- package/lib/components/SideNavSlot.js +56 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +2 -0
- package/package.json +2 -2
- package/scss/styles/_content.scss +11 -0
- package/scss/styles/_side-nav.scss +42 -4
package/README.md
CHANGED
|
@@ -29,17 +29,19 @@ To use this package you will need to import components from both `@carbon/react`
|
|
|
29
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
|
+
- `HeaderDivider`
|
|
33
|
+
- `HeaderPanel`
|
|
34
|
+
- `HeaderPopover`
|
|
35
|
+
- `HeaderPopoverActions`
|
|
36
|
+
- `HeaderPopoverButton`
|
|
37
|
+
- `HeaderPopoverContent`
|
|
32
38
|
- `SideNav`
|
|
33
39
|
- `SideNavItems`
|
|
34
40
|
- `SideNavLink`
|
|
35
41
|
- `SideNavMenu`
|
|
36
42
|
- `SideNavMenuItem`
|
|
37
|
-
- `
|
|
38
|
-
- `
|
|
39
|
-
- `HeaderPopoverButton`
|
|
40
|
-
- `HeaderPopoverContent`
|
|
41
|
-
- `HeaderDivider`
|
|
42
|
-
- `SharkFinIcon`
|
|
43
|
+
- `SideNavSlot`
|
|
44
|
+
- `TrialCountdown`
|
|
43
45
|
|
|
44
46
|
```jsx
|
|
45
47
|
import { SideNav } from '@carbon-labs/react-ui-shell';
|
package/es/components/SideNav.js
CHANGED
|
@@ -155,6 +155,7 @@ function SideNavRenderFunction(_ref, ref) {
|
|
|
155
155
|
useEffect(() => {
|
|
156
156
|
if (sideNavRef.current) {
|
|
157
157
|
const backButton = sideNavRef?.current.querySelector(`.${prefix}--side-nav__back-button`);
|
|
158
|
+
const slotElement = sideNavRef?.current.querySelector(`.${prefix}--side-nav__slot`);
|
|
158
159
|
const firstElement = sideNavRef?.current?.querySelector('a, button');
|
|
159
160
|
if (navType == SIDE_NAV_TYPE.PANEL || expanded) {
|
|
160
161
|
if (isSm && backButton) {
|
|
@@ -165,6 +166,12 @@ function SideNavRenderFunction(_ref, ref) {
|
|
|
165
166
|
}
|
|
166
167
|
} else if (firstElement) {
|
|
167
168
|
firstElement.tabIndex = 0;
|
|
169
|
+
if (slotElement) {
|
|
170
|
+
const firstElementAfterSlot = slotElement.nextElementSibling?.nextElementSibling?.querySelector('a, button');
|
|
171
|
+
if (firstElementAfterSlot) {
|
|
172
|
+
firstElementAfterSlot.tabIndex = 0;
|
|
173
|
+
}
|
|
174
|
+
}
|
|
168
175
|
}
|
|
169
176
|
}
|
|
170
177
|
}
|
|
@@ -346,9 +353,7 @@ function SideNavRenderFunction(_ref, ref) {
|
|
|
346
353
|
function resetNodeTabIndices() {
|
|
347
354
|
const items = sideNavRef?.current?.querySelectorAll('[tabIndex="0"]') ?? [];
|
|
348
355
|
items.forEach(item => {
|
|
349
|
-
if (item.classList.contains(`${prefix}--side-nav__toggle`) || item.classList.contains(`${prefix}--side-nav__back-button`) ||
|
|
350
|
-
// checks if a link is in primary nav
|
|
351
|
-
item.classList.contains(`${prefix}--side-nav__link`) && item.closest(`ul`)?.getAttribute('aria-label') === ariaLabel) {
|
|
356
|
+
if (item.classList.contains(`${prefix}--side-nav__toggle`) || item.classList.contains(`${prefix}--side-nav__back-button`) || item.closest(`.${prefix}--side-nav__slot-item`) || item.classList.contains(`${prefix}--side-nav__link`) && item.closest('ul')?.getAttribute('aria-label') === ariaLabel) {
|
|
352
357
|
return;
|
|
353
358
|
}
|
|
354
359
|
item.tabIndex = -1;
|
|
@@ -5,14 +5,14 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
+
import { SideNavIcon, Layer, Button } from '@carbon/react';
|
|
8
9
|
import { breakpoints } from '../node_modules/@carbon/layout/es/index.js';
|
|
9
10
|
import cx from '../_virtual/index.js';
|
|
10
11
|
import PropTypes from 'prop-types';
|
|
11
12
|
import React, { useContext, useState, useRef, useEffect } from 'react';
|
|
12
13
|
import { CARBON_SIDENAV_ITEMS } from './_utils.js';
|
|
13
14
|
import { useId } from '../internal/useId.js';
|
|
14
|
-
import {
|
|
15
|
-
import { Escape, ArrowLeft as ArrowLeft$1, ArrowRight } from '../internal/keyboard/keys.js';
|
|
15
|
+
import { Escape, Tab, ArrowLeft as ArrowLeft$1, ArrowRight } from '../internal/keyboard/keys.js';
|
|
16
16
|
import { match } from '../internal/keyboard/match.js';
|
|
17
17
|
import { usePrefix } from '../internal/usePrefix.js';
|
|
18
18
|
import { SideNavContext, SIDE_NAV_TYPE } from './SideNav.js';
|
|
@@ -184,6 +184,12 @@ const SideNavMenu = /*#__PURE__*/React.forwardRef(function SideNavMenu(_ref, ref
|
|
|
184
184
|
const isMenu = node.hasAttribute('aria-expanded');
|
|
185
185
|
const isExpanded = node.getAttribute('aria-expanded');
|
|
186
186
|
const parent = parentSideNavMenu(node);
|
|
187
|
+
if (match(event, Tab)) {
|
|
188
|
+
const slotElement = node.closest(`.${prefix}--side-nav__slot`);
|
|
189
|
+
if (slotElement) {
|
|
190
|
+
(slotElement.nextElementSibling?.nextElementSibling?.querySelector('a, button')).tabIndex = 0;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
187
193
|
if (match(event, ArrowLeft$1)) {
|
|
188
194
|
event.stopPropagation();
|
|
189
195
|
|
|
@@ -343,7 +349,7 @@ const SideNavMenu = /*#__PURE__*/React.forwardRef(function SideNavMenu(_ref, ref
|
|
|
343
349
|
size: 20
|
|
344
350
|
})) : _ChevronDown || (_ChevronDown = /*#__PURE__*/React.createElement(ChevronDown, {
|
|
345
351
|
size: 20
|
|
346
|
-
})))), primary ? /*#__PURE__*/React.createElement("div", {
|
|
352
|
+
})))), primary ? /*#__PURE__*/React.createElement(Layer, null, /*#__PURE__*/React.createElement("div", {
|
|
347
353
|
className: primaryClassNames
|
|
348
354
|
}, /*#__PURE__*/React.createElement(SideNavItems, {
|
|
349
355
|
accessibilityLabel: {
|
|
@@ -356,7 +362,7 @@ const SideNavMenu = /*#__PURE__*/React.forwardRef(function SideNavMenu(_ref, ref
|
|
|
356
362
|
onClick: handleOnBackButtonClick,
|
|
357
363
|
className: `${prefix}--side-nav__back-button`,
|
|
358
364
|
renderIcon: backButtonRenderIcon
|
|
359
|
-
}, backButtonTitle), childrenToRender)) : /*#__PURE__*/React.createElement("ul", {
|
|
365
|
+
}, backButtonTitle), childrenToRender))) : /*#__PURE__*/React.createElement("ul", {
|
|
360
366
|
className: `${prefix}--side-nav__menu`,
|
|
361
367
|
role: "group"
|
|
362
368
|
}, childrenToRender));
|
|
@@ -0,0 +1,23 @@
|
|
|
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, { ComponentType } from 'react';
|
|
8
|
+
export interface SideNavSlotProps {
|
|
9
|
+
/**
|
|
10
|
+
* Provide children to be rendered inside the `SideNavSlot`
|
|
11
|
+
*/
|
|
12
|
+
children?: React.ReactNode;
|
|
13
|
+
/**
|
|
14
|
+
* Provide an optional class to be applied to the containing node
|
|
15
|
+
*/
|
|
16
|
+
className?: string;
|
|
17
|
+
/**
|
|
18
|
+
* Provide an icon to render when the SideNav is in rail mode and collapsed.
|
|
19
|
+
* The icon will be shown instead of child component when collapsed.
|
|
20
|
+
*/
|
|
21
|
+
renderIcon?: ComponentType;
|
|
22
|
+
}
|
|
23
|
+
export declare const SideNavSlot: React.FC<SideNavSlotProps>;
|
|
@@ -0,0 +1,54 @@
|
|
|
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 SideNavSlot = _ref => {
|
|
14
|
+
let {
|
|
15
|
+
children,
|
|
16
|
+
className: customClassName,
|
|
17
|
+
renderIcon: IconElement
|
|
18
|
+
} = _ref;
|
|
19
|
+
const prefix = usePrefix();
|
|
20
|
+
const className = cx(`${prefix}--side-nav__slot`, customClassName);
|
|
21
|
+
const handleKeyDown = e => {
|
|
22
|
+
if (e.key === 'ArrowDown') {
|
|
23
|
+
e.stopPropagation();
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
return /*#__PURE__*/React.createElement("li", {
|
|
27
|
+
className: className
|
|
28
|
+
}, IconElement && /*#__PURE__*/React.createElement("div", {
|
|
29
|
+
className: `${prefix}--side-nav__icon`
|
|
30
|
+
}, /*#__PURE__*/React.createElement(IconElement, null)), /*#__PURE__*/React.createElement("div", {
|
|
31
|
+
role: "presentation",
|
|
32
|
+
tabIndex: -1,
|
|
33
|
+
onKeyDown: handleKeyDown,
|
|
34
|
+
className: `${prefix}--side-nav__slot-item`
|
|
35
|
+
}, children));
|
|
36
|
+
};
|
|
37
|
+
SideNavSlot.propTypes = {
|
|
38
|
+
/**
|
|
39
|
+
* Provide children to be rendered inside the `SideNavSlot`
|
|
40
|
+
*/
|
|
41
|
+
children: PropTypes.node,
|
|
42
|
+
/**
|
|
43
|
+
* Provide an optional class to be applied to the containing node
|
|
44
|
+
*/
|
|
45
|
+
className: PropTypes.string,
|
|
46
|
+
/**
|
|
47
|
+
* Provide an icon to render when the SideNav is in rail mode and collapsed.
|
|
48
|
+
* The icon will be shown instead of child component when collapsed.
|
|
49
|
+
*/
|
|
50
|
+
// @ts-expect-error - PropTypes are unable to cover this case.
|
|
51
|
+
renderIcon: PropTypes.oneOfType([PropTypes.func, PropTypes.object])
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
export { SideNavSlot };
|
package/es/index.d.ts
CHANGED
|
@@ -18,3 +18,4 @@ export { HeaderPanel } from './components/HeaderPanel';
|
|
|
18
18
|
export { SharkFinIcon } from './components/SharkFinIcon';
|
|
19
19
|
export { HeaderDivider } from './components/HeaderDivider';
|
|
20
20
|
export { TrialCountdown } from './components/TrialCountdown';
|
|
21
|
+
export { SideNavSlot } from './components/SideNavSlot';
|
package/es/index.js
CHANGED
|
@@ -17,3 +17,4 @@ export { HeaderPanel } from './components/HeaderPanel.js';
|
|
|
17
17
|
export { SharkFinIcon } from './components/SharkFinIcon.js';
|
|
18
18
|
export { HeaderDivider } from './components/HeaderDivider.js';
|
|
19
19
|
export { TrialCountdown } from './components/TrialCountdown.js';
|
|
20
|
+
export { SideNavSlot } from './components/SideNavSlot.js';
|
|
@@ -157,6 +157,7 @@ function SideNavRenderFunction(_ref, ref) {
|
|
|
157
157
|
React.useEffect(() => {
|
|
158
158
|
if (sideNavRef.current) {
|
|
159
159
|
const backButton = sideNavRef?.current.querySelector(`.${prefix}--side-nav__back-button`);
|
|
160
|
+
const slotElement = sideNavRef?.current.querySelector(`.${prefix}--side-nav__slot`);
|
|
160
161
|
const firstElement = sideNavRef?.current?.querySelector('a, button');
|
|
161
162
|
if (navType == SIDE_NAV_TYPE.PANEL || expanded) {
|
|
162
163
|
if (isSm && backButton) {
|
|
@@ -167,6 +168,12 @@ function SideNavRenderFunction(_ref, ref) {
|
|
|
167
168
|
}
|
|
168
169
|
} else if (firstElement) {
|
|
169
170
|
firstElement.tabIndex = 0;
|
|
171
|
+
if (slotElement) {
|
|
172
|
+
const firstElementAfterSlot = slotElement.nextElementSibling?.nextElementSibling?.querySelector('a, button');
|
|
173
|
+
if (firstElementAfterSlot) {
|
|
174
|
+
firstElementAfterSlot.tabIndex = 0;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
170
177
|
}
|
|
171
178
|
}
|
|
172
179
|
}
|
|
@@ -348,9 +355,7 @@ function SideNavRenderFunction(_ref, ref) {
|
|
|
348
355
|
function resetNodeTabIndices() {
|
|
349
356
|
const items = sideNavRef?.current?.querySelectorAll('[tabIndex="0"]') ?? [];
|
|
350
357
|
items.forEach(item => {
|
|
351
|
-
if (item.classList.contains(`${prefix}--side-nav__toggle`) || item.classList.contains(`${prefix}--side-nav__back-button`) ||
|
|
352
|
-
// checks if a link is in primary nav
|
|
353
|
-
item.classList.contains(`${prefix}--side-nav__link`) && item.closest(`ul`)?.getAttribute('aria-label') === ariaLabel) {
|
|
358
|
+
if (item.classList.contains(`${prefix}--side-nav__toggle`) || item.classList.contains(`${prefix}--side-nav__back-button`) || item.closest(`.${prefix}--side-nav__slot-item`) || item.classList.contains(`${prefix}--side-nav__link`) && item.closest('ul')?.getAttribute('aria-label') === ariaLabel) {
|
|
354
359
|
return;
|
|
355
360
|
}
|
|
356
361
|
item.tabIndex = -1;
|
|
@@ -7,13 +7,13 @@
|
|
|
7
7
|
|
|
8
8
|
'use strict';
|
|
9
9
|
|
|
10
|
+
var react = require('@carbon/react');
|
|
10
11
|
var index$1 = require('../node_modules/@carbon/layout/es/index.js');
|
|
11
12
|
var index = require('../_virtual/index.js');
|
|
12
13
|
var PropTypes = require('prop-types');
|
|
13
14
|
var React = require('react');
|
|
14
15
|
var _utils = require('./_utils.js');
|
|
15
16
|
var useId = require('../internal/useId.js');
|
|
16
|
-
var react = require('@carbon/react');
|
|
17
17
|
var keys = require('../internal/keyboard/keys.js');
|
|
18
18
|
var match = require('../internal/keyboard/match.js');
|
|
19
19
|
var usePrefix = require('../internal/usePrefix.js');
|
|
@@ -186,6 +186,12 @@ const SideNavMenu = /*#__PURE__*/React.forwardRef(function SideNavMenu(_ref, ref
|
|
|
186
186
|
const isMenu = node.hasAttribute('aria-expanded');
|
|
187
187
|
const isExpanded = node.getAttribute('aria-expanded');
|
|
188
188
|
const parent = parentSideNavMenu(node);
|
|
189
|
+
if (match.match(event, keys.Tab)) {
|
|
190
|
+
const slotElement = node.closest(`.${prefix}--side-nav__slot`);
|
|
191
|
+
if (slotElement) {
|
|
192
|
+
(slotElement.nextElementSibling?.nextElementSibling?.querySelector('a, button')).tabIndex = 0;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
189
195
|
if (match.match(event, keys.ArrowLeft)) {
|
|
190
196
|
event.stopPropagation();
|
|
191
197
|
|
|
@@ -345,7 +351,7 @@ const SideNavMenu = /*#__PURE__*/React.forwardRef(function SideNavMenu(_ref, ref
|
|
|
345
351
|
size: 20
|
|
346
352
|
})) : _ChevronDown || (_ChevronDown = /*#__PURE__*/React.createElement(bucket3.ChevronDown, {
|
|
347
353
|
size: 20
|
|
348
|
-
})))), primary ? /*#__PURE__*/React.createElement("div", {
|
|
354
|
+
})))), primary ? /*#__PURE__*/React.createElement(react.Layer, null, /*#__PURE__*/React.createElement("div", {
|
|
349
355
|
className: primaryClassNames
|
|
350
356
|
}, /*#__PURE__*/React.createElement(SideNavItems.SideNavItems, {
|
|
351
357
|
accessibilityLabel: {
|
|
@@ -358,7 +364,7 @@ const SideNavMenu = /*#__PURE__*/React.forwardRef(function SideNavMenu(_ref, ref
|
|
|
358
364
|
onClick: handleOnBackButtonClick,
|
|
359
365
|
className: `${prefix}--side-nav__back-button`,
|
|
360
366
|
renderIcon: backButtonRenderIcon
|
|
361
|
-
}, backButtonTitle), childrenToRender)) : /*#__PURE__*/React.createElement("ul", {
|
|
367
|
+
}, backButtonTitle), childrenToRender))) : /*#__PURE__*/React.createElement("ul", {
|
|
362
368
|
className: `${prefix}--side-nav__menu`,
|
|
363
369
|
role: "group"
|
|
364
370
|
}, childrenToRender));
|
|
@@ -0,0 +1,23 @@
|
|
|
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, { ComponentType } from 'react';
|
|
8
|
+
export interface SideNavSlotProps {
|
|
9
|
+
/**
|
|
10
|
+
* Provide children to be rendered inside the `SideNavSlot`
|
|
11
|
+
*/
|
|
12
|
+
children?: React.ReactNode;
|
|
13
|
+
/**
|
|
14
|
+
* Provide an optional class to be applied to the containing node
|
|
15
|
+
*/
|
|
16
|
+
className?: string;
|
|
17
|
+
/**
|
|
18
|
+
* Provide an icon to render when the SideNav is in rail mode and collapsed.
|
|
19
|
+
* The icon will be shown instead of child component when collapsed.
|
|
20
|
+
*/
|
|
21
|
+
renderIcon?: ComponentType;
|
|
22
|
+
}
|
|
23
|
+
export declare const SideNavSlot: React.FC<SideNavSlotProps>;
|
|
@@ -0,0 +1,56 @@
|
|
|
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 SideNavSlot = _ref => {
|
|
16
|
+
let {
|
|
17
|
+
children,
|
|
18
|
+
className: customClassName,
|
|
19
|
+
renderIcon: IconElement
|
|
20
|
+
} = _ref;
|
|
21
|
+
const prefix = usePrefix.usePrefix();
|
|
22
|
+
const className = index.default(`${prefix}--side-nav__slot`, customClassName);
|
|
23
|
+
const handleKeyDown = e => {
|
|
24
|
+
if (e.key === 'ArrowDown') {
|
|
25
|
+
e.stopPropagation();
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
return /*#__PURE__*/React.createElement("li", {
|
|
29
|
+
className: className
|
|
30
|
+
}, IconElement && /*#__PURE__*/React.createElement("div", {
|
|
31
|
+
className: `${prefix}--side-nav__icon`
|
|
32
|
+
}, /*#__PURE__*/React.createElement(IconElement, null)), /*#__PURE__*/React.createElement("div", {
|
|
33
|
+
role: "presentation",
|
|
34
|
+
tabIndex: -1,
|
|
35
|
+
onKeyDown: handleKeyDown,
|
|
36
|
+
className: `${prefix}--side-nav__slot-item`
|
|
37
|
+
}, children));
|
|
38
|
+
};
|
|
39
|
+
SideNavSlot.propTypes = {
|
|
40
|
+
/**
|
|
41
|
+
* Provide children to be rendered inside the `SideNavSlot`
|
|
42
|
+
*/
|
|
43
|
+
children: PropTypes.node,
|
|
44
|
+
/**
|
|
45
|
+
* Provide an optional class to be applied to the containing node
|
|
46
|
+
*/
|
|
47
|
+
className: PropTypes.string,
|
|
48
|
+
/**
|
|
49
|
+
* Provide an icon to render when the SideNav is in rail mode and collapsed.
|
|
50
|
+
* The icon will be shown instead of child component when collapsed.
|
|
51
|
+
*/
|
|
52
|
+
// @ts-expect-error - PropTypes are unable to cover this case.
|
|
53
|
+
renderIcon: PropTypes.oneOfType([PropTypes.func, PropTypes.object])
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
exports.SideNavSlot = SideNavSlot;
|
package/lib/index.d.ts
CHANGED
|
@@ -18,3 +18,4 @@ export { HeaderPanel } from './components/HeaderPanel';
|
|
|
18
18
|
export { SharkFinIcon } from './components/SharkFinIcon';
|
|
19
19
|
export { HeaderDivider } from './components/HeaderDivider';
|
|
20
20
|
export { TrialCountdown } from './components/TrialCountdown';
|
|
21
|
+
export { SideNavSlot } from './components/SideNavSlot';
|
package/lib/index.js
CHANGED
|
@@ -19,6 +19,7 @@ var HeaderPanel = require('./components/HeaderPanel.js');
|
|
|
19
19
|
var SharkFinIcon = require('./components/SharkFinIcon.js');
|
|
20
20
|
var HeaderDivider = require('./components/HeaderDivider.js');
|
|
21
21
|
var TrialCountdown = require('./components/TrialCountdown.js');
|
|
22
|
+
var SideNavSlot = require('./components/SideNavSlot.js');
|
|
22
23
|
|
|
23
24
|
|
|
24
25
|
|
|
@@ -38,3 +39,4 @@ exports.HeaderPanel = HeaderPanel.HeaderPanel;
|
|
|
38
39
|
exports.SharkFinIcon = SharkFinIcon.SharkFinIcon;
|
|
39
40
|
exports.HeaderDivider = HeaderDivider.HeaderDivider;
|
|
40
41
|
exports.TrialCountdown = TrialCountdown.TrialCountdown;
|
|
42
|
+
exports.SideNavSlot = SideNavSlot.SideNavSlot;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@carbon-labs/react-ui-shell",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.46.0",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public",
|
|
6
6
|
"provenance": true
|
|
@@ -41,5 +41,5 @@
|
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"@ibm/telemetry-js": "^1.9.1"
|
|
43
43
|
},
|
|
44
|
-
"gitHead": "
|
|
44
|
+
"gitHead": "25a4ee32036576869be9cb12de891826699587e8"
|
|
45
45
|
}
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
@use '@carbon/styles/scss/utilities/convert' as convert;
|
|
9
9
|
@use '@carbon/styles/scss/motion' as *;
|
|
10
10
|
@use '@carbon/styles/scss/spacing' as *;
|
|
11
|
+
@use '@carbon/styles/scss/breakpoint' as *;
|
|
11
12
|
|
|
12
13
|
$prefix: 'cds' !default;
|
|
13
14
|
|
|
@@ -30,3 +31,13 @@ div:has(.#{$prefix}--side-nav--panel.#{$prefix}--side-nav--expanded)
|
|
|
30
31
|
~ .#{$prefix}--content {
|
|
31
32
|
margin-inline-start: $spacing-09;
|
|
32
33
|
}
|
|
34
|
+
|
|
35
|
+
// when rail is hidden, remove spacing that accounts for rail
|
|
36
|
+
@each $breakpoint in ('sm', 'md', 'lg', 'xlg', 'max') {
|
|
37
|
+
.#{$prefix}--side-nav--rail.#{$prefix}--side-nav--hide-rail-breakpoint-down-#{$breakpoint}
|
|
38
|
+
~ .#{$prefix}--content {
|
|
39
|
+
@include breakpoint-down($breakpoint) {
|
|
40
|
+
margin-inline-start: 0;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
@@ -32,7 +32,7 @@ div:has(.#{$prefix}--header)
|
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
//----------------------------------------------------------------------------
|
|
35
|
-
//
|
|
35
|
+
// Collapsible
|
|
36
36
|
//----------------------------------------------------------------------------
|
|
37
37
|
.#{$prefix}--side-nav--collapsible.#{$prefix}--side-nav--ux {
|
|
38
38
|
inline-size: 0;
|
|
@@ -43,7 +43,7 @@ div:has(.#{$prefix}--header)
|
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
//----------------------------------------------------------------------------
|
|
46
|
-
// Treeview
|
|
46
|
+
// Treeview
|
|
47
47
|
//----------------------------------------------------------------------------
|
|
48
48
|
|
|
49
49
|
.#{$prefix}--side-nav__icon:not(.#{$prefix}--side-nav__submenu-chevron) {
|
|
@@ -156,7 +156,7 @@ div:has(.#{$prefix}--header)
|
|
|
156
156
|
}
|
|
157
157
|
|
|
158
158
|
//----------------------------------------------------------------------------
|
|
159
|
-
//
|
|
159
|
+
// Panel
|
|
160
160
|
//----------------------------------------------------------------------------
|
|
161
161
|
.#{$prefix}--side-nav--panel {
|
|
162
162
|
z-index: 7999; /* needs to be below header */
|
|
@@ -396,6 +396,7 @@ div:has(.#{$prefix}--header)
|
|
|
396
396
|
//----------------------------------------------------------------------------
|
|
397
397
|
.#{$prefix}--side-nav--rail {
|
|
398
398
|
z-index: 7999; /* needs to be below header */
|
|
399
|
+
border-inline-end: 1px solid $border-subtle;
|
|
399
400
|
}
|
|
400
401
|
|
|
401
402
|
@each $breakpoint in ('sm', 'md', 'lg', 'xlg', 'max') {
|
|
@@ -417,7 +418,44 @@ div:has(.#{$prefix}--header)
|
|
|
417
418
|
background-color $transition-expansion $standard-easing;
|
|
418
419
|
}
|
|
419
420
|
|
|
420
|
-
|
|
421
|
+
//----------------------------------------------------------------------------
|
|
422
|
+
// Slot
|
|
423
|
+
//----------------------------------------------------------------------------
|
|
424
|
+
.#{$prefix}--side-nav__slot {
|
|
425
|
+
display: flex;
|
|
426
|
+
align-items: center;
|
|
427
|
+
margin: 0 $spacing-05;
|
|
428
|
+
block-size: 2rem;
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
.#{$prefix}--side-nav__slot-item {
|
|
432
|
+
inline-size: 100%;
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
// icon shown when rail is collapsed
|
|
436
|
+
.#{$prefix}--side-nav__slot .#{$prefix}--side-nav__icon {
|
|
437
|
+
display: none;
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
.#{$prefix}--side-nav--rail:not(.#{$prefix}--side-nav--expanded)
|
|
441
|
+
.#{$prefix}--side-nav__slot
|
|
442
|
+
.#{$prefix}--side-nav__icon {
|
|
443
|
+
display: block;
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
// hide slot item when rail collapsed
|
|
447
|
+
.#{$prefix}--side-nav--rail .#{$prefix}--side-nav__slot-item {
|
|
448
|
+
display: none;
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
.#{$prefix}--side-nav--rail.#{$prefix}--side-nav--expanded
|
|
452
|
+
.#{$prefix}--side-nav__slot-item {
|
|
453
|
+
display: block;
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
//----------------------------------------------------------------------------
|
|
457
|
+
// Mobile
|
|
458
|
+
//----------------------------------------------------------------------------
|
|
421
459
|
@include breakpoint.breakpoint-down(md) {
|
|
422
460
|
.#{$prefix}--side-nav--collapsible.#{$prefix}--side-nav--expanded {
|
|
423
461
|
inline-size: 100%;
|