@carbon-labs/react-ui-shell 0.1.0 → 0.3.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,8 @@ export interface SideNavProps extends ComponentProps<'nav'> {
20
20
  onSideNavBlur?: () => void | undefined;
21
21
  enterDelayMs?: number;
22
22
  inert?: boolean;
23
+ isCollapsible: boolean | undefined;
24
+ hideOverlay: boolean | undefined;
23
25
  }
24
26
  interface SideNavContextData {
25
27
  isRail?: boolean | undefined;
@@ -43,6 +43,8 @@ function SideNavRenderFunction(_ref, ref) {
43
43
  onOverlayClick,
44
44
  onSideNavBlur,
45
45
  enterDelayMs = 100,
46
+ isCollapsible = false,
47
+ hideOverlay = false,
46
48
  ...other
47
49
  } = _ref;
48
50
  const prefix = usePrefix();
@@ -76,7 +78,8 @@ function SideNavRenderFunction(_ref, ref) {
76
78
  [`${prefix}--side-nav--collapsed`]: !expanded && isFixedNav,
77
79
  [`${prefix}--side-nav--rail`]: isRail,
78
80
  [`${prefix}--side-nav--ux`]: isChildOfHeader,
79
- [`${prefix}--side-nav--hidden`]: !isPersistent
81
+ [`${prefix}--side-nav--hidden`]: !isPersistent,
82
+ [`${prefix}--side-nav--collapsible`]: isCollapsible
80
83
  });
81
84
  const overlayClassName = cx({
82
85
  [`${prefix}--side-nav__overlay`]: true,
@@ -153,7 +156,7 @@ function SideNavRenderFunction(_ref, ref) {
153
156
  value: {
154
157
  isRail
155
158
  }
156
- }, isFixedNav ? null :
159
+ }, isFixedNav || hideOverlay ? null :
157
160
  /*#__PURE__*/
158
161
  // eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions
159
162
  React.createElement("div", {
@@ -198,6 +201,10 @@ SideNav.propTypes = {
198
201
  * Using this prop causes SideNav to become a controled component.
199
202
  */
200
203
  expanded: PropTypes.bool,
204
+ /**
205
+ * If `true`, the overlay will be hidden. Defaults to `false`.
206
+ */
207
+ hideOverlay: PropTypes.bool,
201
208
  /**
202
209
  * Provide the `href` to the id of the element on your package that is the
203
210
  * main content.
@@ -207,6 +214,10 @@ SideNav.propTypes = {
207
214
  * Optionally provide a custom class to apply to the underlying `<li>` node
208
215
  */
209
216
  isChildOfHeader: PropTypes.bool,
217
+ /**
218
+ * Specify whether the SideNav is collapsible at desktop
219
+ */
220
+ isCollapsible: PropTypes.bool,
210
221
  /**
211
222
  * Specify if sideNav is standalone
212
223
  */
@@ -20,6 +20,8 @@ export interface SideNavProps extends ComponentProps<'nav'> {
20
20
  onSideNavBlur?: () => void | undefined;
21
21
  enterDelayMs?: number;
22
22
  inert?: boolean;
23
+ isCollapsible: boolean | undefined;
24
+ hideOverlay: boolean | undefined;
23
25
  }
24
26
  interface SideNavContextData {
25
27
  isRail?: boolean | undefined;
@@ -45,6 +45,8 @@ function SideNavRenderFunction(_ref, ref) {
45
45
  onOverlayClick,
46
46
  onSideNavBlur,
47
47
  enterDelayMs = 100,
48
+ isCollapsible = false,
49
+ hideOverlay = false,
48
50
  ...other
49
51
  } = _ref;
50
52
  const prefix = usePrefix.usePrefix();
@@ -78,7 +80,8 @@ function SideNavRenderFunction(_ref, ref) {
78
80
  [`${prefix}--side-nav--collapsed`]: !expanded && isFixedNav,
79
81
  [`${prefix}--side-nav--rail`]: isRail,
80
82
  [`${prefix}--side-nav--ux`]: isChildOfHeader,
81
- [`${prefix}--side-nav--hidden`]: !isPersistent
83
+ [`${prefix}--side-nav--hidden`]: !isPersistent,
84
+ [`${prefix}--side-nav--collapsible`]: isCollapsible
82
85
  });
83
86
  const overlayClassName = index.default({
84
87
  [`${prefix}--side-nav__overlay`]: true,
@@ -155,7 +158,7 @@ function SideNavRenderFunction(_ref, ref) {
155
158
  value: {
156
159
  isRail
157
160
  }
158
- }, isFixedNav ? null :
161
+ }, isFixedNav || hideOverlay ? null :
159
162
  /*#__PURE__*/
160
163
  // eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions
161
164
  React.createElement("div", {
@@ -200,6 +203,10 @@ SideNav.propTypes = {
200
203
  * Using this prop causes SideNav to become a controled component.
201
204
  */
202
205
  expanded: PropTypes.bool,
206
+ /**
207
+ * If `true`, the overlay will be hidden. Defaults to `false`.
208
+ */
209
+ hideOverlay: PropTypes.bool,
203
210
  /**
204
211
  * Provide the `href` to the id of the element on your package that is the
205
212
  * main content.
@@ -209,6 +216,10 @@ SideNav.propTypes = {
209
216
  * Optionally provide a custom class to apply to the underlying `<li>` node
210
217
  */
211
218
  isChildOfHeader: PropTypes.bool,
219
+ /**
220
+ * Specify whether the SideNav is collapsible at desktop
221
+ */
222
+ isCollapsible: PropTypes.bool,
212
223
  /**
213
224
  * Specify if sideNav is standalone
214
225
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@carbon-labs/react-ui-shell",
3
- "version": "0.1.0",
3
+ "version": "0.3.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": "5a095d69e2f17220f2dc611abdb3e321aba55d05"
30
+ "gitHead": "e2bf601b2e8d4301fa72fdb9a5424f2ac938df14"
31
31
  }
@@ -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
+
8
+ @use '@carbon/styles/scss/utilities/convert' as convert;
9
+
10
+ // $prefix: 'clabs' !default;
11
+ // Do we want to update to clabs?
12
+ $prefix: 'cds' !default;
13
+
14
+ //----------------------------------------------------------------------------
15
+ // Side-nav Collapsible
16
+ //----------------------------------------------------------------------------
17
+ .#{$prefix}--side-nav--collapsible.#{$prefix}--side-nav--ux {
18
+ inline-size: 0;
19
+ }
20
+
21
+ .#{$prefix}--side-nav--collapsible.#{$prefix}--side-nav--expanded {
22
+ inline-size: convert.to-rem(256px);
23
+ }
@@ -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';