@carbon-labs/react-ui-shell 0.0.1-canary.421 → 0.2.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.
@@ -20,6 +20,7 @@ export interface SideNavProps extends ComponentProps<'nav'> {
20
20
  onSideNavBlur?: () => void | undefined;
21
21
  enterDelayMs?: number;
22
22
  inert?: boolean;
23
+ isCollapsible: boolean | undefined;
23
24
  }
24
25
  interface SideNavContextData {
25
26
  isRail?: boolean | undefined;
@@ -43,6 +43,7 @@ function SideNavRenderFunction(_ref, ref) {
43
43
  onOverlayClick,
44
44
  onSideNavBlur,
45
45
  enterDelayMs = 100,
46
+ isCollapsible = false,
46
47
  ...other
47
48
  } = _ref;
48
49
  const prefix = usePrefix();
@@ -76,11 +77,13 @@ function SideNavRenderFunction(_ref, ref) {
76
77
  [`${prefix}--side-nav--collapsed`]: !expanded && isFixedNav,
77
78
  [`${prefix}--side-nav--rail`]: isRail,
78
79
  [`${prefix}--side-nav--ux`]: isChildOfHeader,
79
- [`${prefix}--side-nav--hidden`]: !isPersistent
80
+ [`${prefix}--side-nav--hidden`]: !isPersistent,
81
+ [`${prefix}--side-nav--collapsible`]: isCollapsible
80
82
  });
81
83
  const overlayClassName = cx({
82
84
  [`${prefix}--side-nav__overlay`]: true,
83
- [`${prefix}--side-nav__overlay-active`]: expanded || expandedViaHoverState
85
+ [`${prefix}--side-nav__overlay-active`]: expanded || expandedViaHoverState,
86
+ [`${prefix}--side-nav__overlay-active--lg`]: isCollapsible && (expanded || expandedViaHoverState)
84
87
  });
85
88
  let childrenToRender = children;
86
89
 
@@ -207,6 +210,10 @@ SideNav.propTypes = {
207
210
  * Optionally provide a custom class to apply to the underlying `<li>` node
208
211
  */
209
212
  isChildOfHeader: PropTypes.bool,
213
+ /**
214
+ * Specify whether the SideNav is collapsible at desktop
215
+ */
216
+ isCollapsible: PropTypes.bool,
210
217
  /**
211
218
  * Specify if sideNav is standalone
212
219
  */
@@ -20,6 +20,7 @@ export interface SideNavProps extends ComponentProps<'nav'> {
20
20
  onSideNavBlur?: () => void | undefined;
21
21
  enterDelayMs?: number;
22
22
  inert?: boolean;
23
+ isCollapsible: boolean | undefined;
23
24
  }
24
25
  interface SideNavContextData {
25
26
  isRail?: boolean | undefined;
@@ -45,6 +45,7 @@ function SideNavRenderFunction(_ref, ref) {
45
45
  onOverlayClick,
46
46
  onSideNavBlur,
47
47
  enterDelayMs = 100,
48
+ isCollapsible = false,
48
49
  ...other
49
50
  } = _ref;
50
51
  const prefix = usePrefix.usePrefix();
@@ -78,11 +79,13 @@ function SideNavRenderFunction(_ref, ref) {
78
79
  [`${prefix}--side-nav--collapsed`]: !expanded && isFixedNav,
79
80
  [`${prefix}--side-nav--rail`]: isRail,
80
81
  [`${prefix}--side-nav--ux`]: isChildOfHeader,
81
- [`${prefix}--side-nav--hidden`]: !isPersistent
82
+ [`${prefix}--side-nav--hidden`]: !isPersistent,
83
+ [`${prefix}--side-nav--collapsible`]: isCollapsible
82
84
  });
83
85
  const overlayClassName = index.default({
84
86
  [`${prefix}--side-nav__overlay`]: true,
85
- [`${prefix}--side-nav__overlay-active`]: expanded || expandedViaHoverState
87
+ [`${prefix}--side-nav__overlay-active`]: expanded || expandedViaHoverState,
88
+ [`${prefix}--side-nav__overlay-active--lg`]: isCollapsible && (expanded || expandedViaHoverState)
86
89
  });
87
90
  let childrenToRender = children;
88
91
 
@@ -209,6 +212,10 @@ SideNav.propTypes = {
209
212
  * Optionally provide a custom class to apply to the underlying `<li>` node
210
213
  */
211
214
  isChildOfHeader: PropTypes.bool,
215
+ /**
216
+ * Specify whether the SideNav is collapsible at desktop
217
+ */
218
+ isCollapsible: PropTypes.bool,
212
219
  /**
213
220
  * Specify if sideNav is standalone
214
221
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@carbon-labs/react-ui-shell",
3
- "version": "0.0.1-canary.421+072a73f",
3
+ "version": "0.2.0",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "provenance": true
@@ -27,5 +27,5 @@
27
27
  "devDependencies": {
28
28
  "@carbon-labs/utilities": "canary"
29
29
  },
30
- "gitHead": "072a73f9945838a5538271fb7aa58975fc573f43"
30
+ "gitHead": "48941ca09c9d9992ac597fc3fa79b8f700daaeab"
31
31
  }
@@ -0,0 +1,35 @@
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
+
8
+ @use '@carbon/styles/scss/theme' as *;
9
+ @use '@carbon/styles/scss/motion' as *;
10
+ @use '@carbon/styles/scss/utilities/convert' as convert;
11
+
12
+ // $prefix: 'clabs' !default;
13
+ // Do we want to update to clabs?
14
+ $prefix: 'cds' !default;
15
+
16
+ //----------------------------------------------------------------------------
17
+ // Side-nav Collapsible
18
+ //----------------------------------------------------------------------------
19
+ .#{$prefix}--side-nav--collapsible.#{$prefix}--side-nav--ux {
20
+ inline-size: 0;
21
+ }
22
+
23
+ .#{$prefix}--side-nav--collapsible.#{$prefix}--side-nav--expanded {
24
+ inline-size: convert.to-rem(256px);
25
+ }
26
+
27
+ .#{$prefix}--side-nav__overlay-active--lg {
28
+ z-index: z('overlay');
29
+ background-color: $overlay;
30
+ block-size: 100vh;
31
+ inline-size: 100vw;
32
+ opacity: 1;
33
+ transition: opacity $transition-expansion $standard-easing,
34
+ background-color $transition-expansion $standard-easing;
35
+ }
@@ -5,16 +5,4 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
 
8
- // Carbon setting imports
9
- @use '@carbon/styles/scss/theme' as *;
10
- @use '@carbon/styles/scss/colors' as *;
11
- @use '@carbon/styles/scss/spacing' as *;
12
- @use '@carbon/styles/scss/components/button' as *;
13
-
14
- $prefix: 'clabs' !default;
15
-
16
- .#{$prefix}--ui-shell__container {
17
- padding: $spacing-01;
18
- border: 1px solid $border-subtle-01;
19
- inline-size: fit-content;
20
- }
8
+ @use 'styles/side-nav';