@carbon-labs/react-ui-shell 0.40.0 → 0.42.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.
|
@@ -21,6 +21,7 @@ export interface SideNavProps extends ComponentProps<'nav'>, TranslateWithId<Tra
|
|
|
21
21
|
defaultExpanded?: boolean;
|
|
22
22
|
isChildOfHeader?: boolean;
|
|
23
23
|
onToggle?: (event: FocusEvent<HTMLElement> | KeyboardEvent<HTMLElement> | boolean, value: boolean) => void;
|
|
24
|
+
hideRailBreakpointDown?: 'sm' | 'md' | 'lg' | 'xlg' | 'max';
|
|
24
25
|
href?: string;
|
|
25
26
|
isFixedNav?: boolean;
|
|
26
27
|
isRail?: boolean;
|
package/es/components/SideNav.js
CHANGED
|
@@ -48,6 +48,7 @@ function SideNavRenderFunction(_ref, ref) {
|
|
|
48
48
|
children,
|
|
49
49
|
onToggle,
|
|
50
50
|
className: customClassName,
|
|
51
|
+
hideRailBreakpointDown,
|
|
51
52
|
href,
|
|
52
53
|
isFixedNav = false,
|
|
53
54
|
isRail,
|
|
@@ -95,11 +96,13 @@ function SideNavRenderFunction(_ref, ref) {
|
|
|
95
96
|
[`${prefix}--side-nav`]: true,
|
|
96
97
|
[`${prefix}--side-nav--expanded`]: expanded || expandedViaHoverState,
|
|
97
98
|
[`${prefix}--side-nav--collapsed`]: !expanded && isFixedNav,
|
|
99
|
+
[`${prefix}--side-nav--hide-rail-breakpoint-down-${hideRailBreakpointDown}`]: hideRailBreakpointDown,
|
|
98
100
|
[`${prefix}--side-nav--rail`]: isRail,
|
|
99
101
|
[`${prefix}--side-nav--panel`]: navType === SIDE_NAV_TYPE.PANEL,
|
|
100
102
|
[`${prefix}--side-nav--ux`]: isChildOfHeader,
|
|
101
103
|
[`${prefix}--side-nav--hidden`]: !isPersistent,
|
|
102
|
-
[`${prefix}--side-nav--collapsible`]: isCollapsible
|
|
104
|
+
[`${prefix}--side-nav--collapsible`]: isCollapsible,
|
|
105
|
+
[`${prefix}--side-nav--with-overlay`]: !hideOverlay
|
|
103
106
|
});
|
|
104
107
|
const overlayClassName = cx({
|
|
105
108
|
[`${prefix}--side-nav__overlay`]: true,
|
|
@@ -409,6 +412,12 @@ SideNav.propTypes = {
|
|
|
409
412
|
* If `true`, the overlay will be hidden. Defaults to `false`.
|
|
410
413
|
*/
|
|
411
414
|
hideOverlay: PropTypes.bool,
|
|
415
|
+
/**
|
|
416
|
+
* Specify the breakpoint at which the SideNav will be hidden.
|
|
417
|
+
* Can be one of `sm`, `md`, `lg`, `xlg`, or `max`.
|
|
418
|
+
* Only applies when `isRail` is `true`.
|
|
419
|
+
*/
|
|
420
|
+
hideRailBreakpointDown: PropTypes.oneOf(['sm', 'md', 'lg', 'xlg', 'max']),
|
|
412
421
|
/**
|
|
413
422
|
* Provide the `href` to the id of the element on your package that is the
|
|
414
423
|
* main content.
|
|
@@ -21,6 +21,7 @@ export interface SideNavProps extends ComponentProps<'nav'>, TranslateWithId<Tra
|
|
|
21
21
|
defaultExpanded?: boolean;
|
|
22
22
|
isChildOfHeader?: boolean;
|
|
23
23
|
onToggle?: (event: FocusEvent<HTMLElement> | KeyboardEvent<HTMLElement> | boolean, value: boolean) => void;
|
|
24
|
+
hideRailBreakpointDown?: 'sm' | 'md' | 'lg' | 'xlg' | 'max';
|
|
24
25
|
href?: string;
|
|
25
26
|
isFixedNav?: boolean;
|
|
26
27
|
isRail?: boolean;
|
|
@@ -50,6 +50,7 @@ function SideNavRenderFunction(_ref, ref) {
|
|
|
50
50
|
children,
|
|
51
51
|
onToggle,
|
|
52
52
|
className: customClassName,
|
|
53
|
+
hideRailBreakpointDown,
|
|
53
54
|
href,
|
|
54
55
|
isFixedNav = false,
|
|
55
56
|
isRail,
|
|
@@ -97,11 +98,13 @@ function SideNavRenderFunction(_ref, ref) {
|
|
|
97
98
|
[`${prefix}--side-nav`]: true,
|
|
98
99
|
[`${prefix}--side-nav--expanded`]: expanded || expandedViaHoverState,
|
|
99
100
|
[`${prefix}--side-nav--collapsed`]: !expanded && isFixedNav,
|
|
101
|
+
[`${prefix}--side-nav--hide-rail-breakpoint-down-${hideRailBreakpointDown}`]: hideRailBreakpointDown,
|
|
100
102
|
[`${prefix}--side-nav--rail`]: isRail,
|
|
101
103
|
[`${prefix}--side-nav--panel`]: navType === SIDE_NAV_TYPE.PANEL,
|
|
102
104
|
[`${prefix}--side-nav--ux`]: isChildOfHeader,
|
|
103
105
|
[`${prefix}--side-nav--hidden`]: !isPersistent,
|
|
104
|
-
[`${prefix}--side-nav--collapsible`]: isCollapsible
|
|
106
|
+
[`${prefix}--side-nav--collapsible`]: isCollapsible,
|
|
107
|
+
[`${prefix}--side-nav--with-overlay`]: !hideOverlay
|
|
105
108
|
});
|
|
106
109
|
const overlayClassName = index.default({
|
|
107
110
|
[`${prefix}--side-nav__overlay`]: true,
|
|
@@ -411,6 +414,12 @@ SideNav.propTypes = {
|
|
|
411
414
|
* If `true`, the overlay will be hidden. Defaults to `false`.
|
|
412
415
|
*/
|
|
413
416
|
hideOverlay: PropTypes.bool,
|
|
417
|
+
/**
|
|
418
|
+
* Specify the breakpoint at which the SideNav will be hidden.
|
|
419
|
+
* Can be one of `sm`, `md`, `lg`, `xlg`, or `max`.
|
|
420
|
+
* Only applies when `isRail` is `true`.
|
|
421
|
+
*/
|
|
422
|
+
hideRailBreakpointDown: PropTypes.oneOf(['sm', 'md', 'lg', 'xlg', 'max']),
|
|
414
423
|
/**
|
|
415
424
|
* Provide the `href` to the id of the element on your package that is the
|
|
416
425
|
* main content.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@carbon-labs/react-ui-shell",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.42.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": "ce6519871f2327bbe4edefb8b65aeca93a4e6878"
|
|
45
45
|
}
|
|
@@ -7,12 +7,14 @@
|
|
|
7
7
|
|
|
8
8
|
@use '@carbon/styles/scss/utilities/convert' as convert;
|
|
9
9
|
@use '@carbon/styles/scss/motion' as *;
|
|
10
|
+
@use '@carbon/styles/scss/spacing' as *;
|
|
10
11
|
|
|
11
12
|
$prefix: 'cds' !default;
|
|
12
13
|
|
|
14
|
+
// Increases specificity to support shell components wrapped in a Theme component
|
|
13
15
|
.#{$prefix}--side-nav--panel ~ .#{$prefix}--content,
|
|
14
16
|
div:has(.#{$prefix}--side-nav--panel) ~ .#{$prefix}--content {
|
|
15
|
-
margin-inline-start:
|
|
17
|
+
margin-inline-start: $spacing-09;
|
|
16
18
|
transition: margin-inline-start $duration-fast-02, transform $duration-fast-02;
|
|
17
19
|
}
|
|
18
20
|
|
|
@@ -22,3 +24,9 @@ div:has(.#{$prefix}--side-nav--panel.#{$prefix}--side-nav--expanded)
|
|
|
22
24
|
~ .#{$prefix}--content {
|
|
23
25
|
margin-inline-start: convert.to-rem(256px);
|
|
24
26
|
}
|
|
27
|
+
|
|
28
|
+
// should not be a grid influencer when used with overlay
|
|
29
|
+
.#{$prefix}--side-nav--with-overlay.#{$prefix}--side-nav--expanded
|
|
30
|
+
~ .#{$prefix}--content {
|
|
31
|
+
margin-inline-start: $spacing-09;
|
|
32
|
+
}
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
@use '@carbon/styles/scss/utilities/custom-property' as custom-property;
|
|
10
10
|
@use '@carbon/styles/scss/utilities/button-reset' as button-reset;
|
|
11
11
|
@use '@carbon/styles/scss/utilities/focus-outline' as *;
|
|
12
|
+
@use '@carbon/styles/scss/breakpoint' as *;
|
|
12
13
|
@use '@carbon/styles/scss/theme' as *;
|
|
13
14
|
@use '@carbon/styles/scss/motion' as *;
|
|
14
15
|
@use '@carbon/styles/scss/type' as *;
|
|
@@ -348,8 +349,27 @@ div:has(.#{$prefix}--header)
|
|
|
348
349
|
}
|
|
349
350
|
|
|
350
351
|
//----------------------------------------------------------------------------
|
|
351
|
-
//
|
|
352
|
+
// Rail
|
|
352
353
|
//----------------------------------------------------------------------------
|
|
353
354
|
.#{$prefix}--side-nav--rail {
|
|
354
355
|
z-index: 7999; /* needs to be below header */
|
|
355
356
|
}
|
|
357
|
+
|
|
358
|
+
@each $breakpoint in ('sm', 'md', 'lg', 'xlg', 'max') {
|
|
359
|
+
.#{$prefix}--side-nav--rail.#{$prefix}--side-nav--hide-rail-breakpoint-down-#{$breakpoint} {
|
|
360
|
+
@include breakpoint-down($breakpoint) {
|
|
361
|
+
display: none;
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
// allow overlay to display at all breakpoints
|
|
367
|
+
.#{$prefix}--side-nav__overlay-active {
|
|
368
|
+
z-index: z('overlay');
|
|
369
|
+
background-color: $overlay;
|
|
370
|
+
block-size: 100vh;
|
|
371
|
+
inline-size: 100vw;
|
|
372
|
+
opacity: 1;
|
|
373
|
+
transition: opacity $transition-expansion $standard-easing,
|
|
374
|
+
background-color $transition-expansion $standard-easing;
|
|
375
|
+
}
|