@carbon-labs/react-ui-shell 0.41.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;
@@ -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,6 +96,7 @@ 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,
@@ -410,6 +412,12 @@ SideNav.propTypes = {
410
412
  * If `true`, the overlay will be hidden. Defaults to `false`.
411
413
  */
412
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']),
413
421
  /**
414
422
  * Provide the `href` to the id of the element on your package that is the
415
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,6 +98,7 @@ 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,
@@ -412,6 +414,12 @@ SideNav.propTypes = {
412
414
  * If `true`, the overlay will be hidden. Defaults to `false`.
413
415
  */
414
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']),
415
423
  /**
416
424
  * Provide the `href` to the id of the element on your package that is the
417
425
  * main content.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@carbon-labs/react-ui-shell",
3
- "version": "0.41.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": "84c5f4054019f11741d1a7f4bd5b9725914bab87"
44
+ "gitHead": "ce6519871f2327bbe4edefb8b65aeca93a4e6878"
45
45
  }
@@ -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 *;
@@ -354,6 +355,14 @@ div:has(.#{$prefix}--header)
354
355
  z-index: 7999; /* needs to be below header */
355
356
  }
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
+
357
366
  // allow overlay to display at all breakpoints
358
367
  .#{$prefix}--side-nav__overlay-active {
359
368
  z-index: z('overlay');