@carbon-labs/react-ui-shell 0.0.1-canary.421

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/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2023 IBM Corp.
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1,12 @@
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
+ function getDefaultExportFromCjs (x) {
9
+ return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
10
+ }
11
+
12
+ export { getDefaultExportFromCjs };
@@ -0,0 +1,18 @@
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
+ function _extends() {
9
+ return _extends = Object.assign ? Object.assign.bind() : function (n) {
10
+ for (var e = 1; e < arguments.length; e++) {
11
+ var t = arguments[e];
12
+ for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
13
+ }
14
+ return n;
15
+ }, _extends.apply(null, arguments);
16
+ }
17
+
18
+ export { _extends as extends };
@@ -0,0 +1,14 @@
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 { getDefaultExportFromCjs } from './_commonjsHelpers.js';
9
+ import { __require as requireClassnames } from '../node_modules/classnames/index.js';
10
+
11
+ var classnamesExports = requireClassnames();
12
+ var cx = /*@__PURE__*/getDefaultExportFromCjs(classnamesExports);
13
+
14
+ export { cx as default };
@@ -0,0 +1,10 @@
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
+ var classnames = {exports: {}};
9
+
10
+ export { classnames as __module };
@@ -0,0 +1,29 @@
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, { type ComponentProps, type FocusEvent, type KeyboardEvent, type MouseEventHandler } from 'react';
8
+ export interface SideNavProps extends ComponentProps<'nav'> {
9
+ expanded?: boolean | undefined;
10
+ defaultExpanded?: boolean | undefined;
11
+ isChildOfHeader?: boolean | undefined;
12
+ onToggle?: (event: FocusEvent<HTMLElement> | KeyboardEvent<HTMLElement> | boolean, value: boolean) => void | undefined;
13
+ href?: string | undefined;
14
+ isFixedNav?: boolean | undefined;
15
+ isRail?: boolean | undefined;
16
+ isPersistent?: boolean | undefined;
17
+ addFocusListeners?: boolean | undefined;
18
+ addMouseListeners?: boolean | undefined;
19
+ onOverlayClick?: MouseEventHandler<HTMLDivElement> | undefined;
20
+ onSideNavBlur?: () => void | undefined;
21
+ enterDelayMs?: number;
22
+ inert?: boolean;
23
+ }
24
+ interface SideNavContextData {
25
+ isRail?: boolean | undefined;
26
+ }
27
+ export declare const SideNavContext: React.Context<SideNavContextData>;
28
+ export declare const SideNav: React.ForwardRefExoticComponent<Omit<SideNavProps, "ref"> & React.RefAttributes<HTMLElement>>;
29
+ export {};
@@ -0,0 +1,251 @@
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 { extends as _extends } from '../_virtual/_rollupPluginBabelHelpers.js';
9
+ import React, { useRef, isValidElement, createContext } from 'react';
10
+ import cx from '../_virtual/index.js';
11
+ import PropTypes from 'prop-types';
12
+ import { AriaLabelPropType } from '@carbon/react/lib/prop-types/AriaPropTypes';
13
+ import { CARBON_SIDENAV_ITEMS } from './_utils.js';
14
+ import { usePrefix } from '@carbon/react/lib/internal/usePrefix';
15
+ import { keys } from '@carbon/react/lib/internal/keyboard/keys';
16
+ import { match } from '@carbon/react/lib/internal/keyboard/match';
17
+ import { useMergedRefs } from '@carbon/react/lib/internal/useMergedRefs';
18
+ import { useWindowEvent } from '@carbon/react/lib/internal/useEvent';
19
+ import { useDelayedState } from '@carbon/react/lib/internal/useDelayedState';
20
+ import { breakpoints } from '../node_modules/@carbon/layout/es/index.js';
21
+ import { useMatchMedia } from '@carbon/react/lib/internal/useMatchMedia';
22
+
23
+ // TO-DO: comment back in when footer is added for rails
24
+ // import SideNavFooter from './SideNavFooter';
25
+
26
+ const SideNavContext = /*#__PURE__*/createContext({});
27
+ function SideNavRenderFunction(_ref, ref) {
28
+ let {
29
+ expanded: expandedProp,
30
+ defaultExpanded = false,
31
+ isChildOfHeader = true,
32
+ 'aria-label': ariaLabel,
33
+ 'aria-labelledby': ariaLabelledBy,
34
+ children,
35
+ onToggle,
36
+ className: customClassName,
37
+ href,
38
+ isFixedNav = false,
39
+ isRail,
40
+ isPersistent = true,
41
+ addFocusListeners = true,
42
+ addMouseListeners = true,
43
+ onOverlayClick,
44
+ onSideNavBlur,
45
+ enterDelayMs = 100,
46
+ ...other
47
+ } = _ref;
48
+ const prefix = usePrefix();
49
+ const {
50
+ current: controlled
51
+ } = useRef(expandedProp !== undefined);
52
+ const [expandedState, setExpandedState] = useDelayedState(defaultExpanded);
53
+ const [expandedViaHoverState, setExpandedViaHoverState] = useDelayedState(defaultExpanded);
54
+ const expanded = controlled ? expandedProp : expandedState;
55
+ const sideNavRef = useRef(null);
56
+ const navRef = useMergedRefs([sideNavRef, ref]);
57
+ const handleToggle = function (event) {
58
+ let value = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !expanded;
59
+ if (!controlled) {
60
+ setExpandedState(value, enterDelayMs);
61
+ }
62
+ if (onToggle) {
63
+ onToggle(event, value);
64
+ }
65
+ if (controlled || isRail) {
66
+ setExpandedViaHoverState(value, enterDelayMs);
67
+ }
68
+ };
69
+ const accessibilityLabel = {
70
+ 'aria-label': ariaLabel,
71
+ 'aria-labelledby': ariaLabelledBy
72
+ };
73
+ const className = cx(customClassName, {
74
+ [`${prefix}--side-nav`]: true,
75
+ [`${prefix}--side-nav--expanded`]: expanded || expandedViaHoverState,
76
+ [`${prefix}--side-nav--collapsed`]: !expanded && isFixedNav,
77
+ [`${prefix}--side-nav--rail`]: isRail,
78
+ [`${prefix}--side-nav--ux`]: isChildOfHeader,
79
+ [`${prefix}--side-nav--hidden`]: !isPersistent
80
+ });
81
+ const overlayClassName = cx({
82
+ [`${prefix}--side-nav__overlay`]: true,
83
+ [`${prefix}--side-nav__overlay-active`]: expanded || expandedViaHoverState
84
+ });
85
+ let childrenToRender = children;
86
+
87
+ // Pass the expansion state as a prop, so children can update themselves to match
88
+ childrenToRender = React.Children.map(children, child => {
89
+ // if we are controlled, check for if we have hovered over or the expanded state, else just use the expanded state (uncontrolled)
90
+ const currentExpansionState = controlled ? expandedViaHoverState || expanded : expanded;
91
+ if (/*#__PURE__*/isValidElement(child)) {
92
+ const childJsxElement = child;
93
+ // avoid spreading `isSideNavExpanded` to non-Carbon UI Shell children
94
+ return /*#__PURE__*/React.cloneElement(childJsxElement, {
95
+ ...(CARBON_SIDENAV_ITEMS.includes(childJsxElement.type?.displayName ?? childJsxElement.type?.name) ? {
96
+ isSideNavExpanded: currentExpansionState
97
+ } : {})
98
+ });
99
+ }
100
+ return child;
101
+ });
102
+ const eventHandlers = {};
103
+ if (addFocusListeners) {
104
+ eventHandlers.onFocus = event => {
105
+ if (!event.currentTarget.contains(event.relatedTarget) && isRail) {
106
+ handleToggle(event, true);
107
+ }
108
+ };
109
+ eventHandlers.onBlur = event => {
110
+ if (!event.currentTarget.contains(event.relatedTarget)) {
111
+ handleToggle(event, false);
112
+ }
113
+ if (!event.currentTarget.contains(event.relatedTarget) && expanded && !isFixedNav) {
114
+ if (onSideNavBlur) {
115
+ onSideNavBlur();
116
+ }
117
+ }
118
+ };
119
+ eventHandlers.onKeyDown = event => {
120
+ if (match(event, keys.Escape)) {
121
+ handleToggle(event, false);
122
+ if (href) {
123
+ window.location.href = href;
124
+ }
125
+ }
126
+ };
127
+ }
128
+ if (addMouseListeners && isRail) {
129
+ eventHandlers.onMouseEnter = () => {
130
+ handleToggle(true, true);
131
+ };
132
+ eventHandlers.onMouseLeave = () => {
133
+ setExpandedState(false);
134
+ setExpandedViaHoverState(false);
135
+ handleToggle(false, false);
136
+ };
137
+ eventHandlers.onClick = () => {
138
+ //if delay is enabled, and user intentionally clicks it to see it expanded immediately
139
+ setExpandedState(true);
140
+ setExpandedViaHoverState(true);
141
+ handleToggle(true, true);
142
+ };
143
+ }
144
+ useWindowEvent('keydown', event => {
145
+ const focusedElement = document.activeElement;
146
+ if (match(event, keys.Tab) && expanded && !isFixedNav && sideNavRef.current && focusedElement?.classList.contains(`${prefix}--header__menu-toggle`) && !focusedElement.closest('nav')) {
147
+ sideNavRef.current.focus();
148
+ }
149
+ });
150
+ const lgMediaQuery = `(min-width: ${breakpoints.lg.width})`;
151
+ const isLg = useMatchMedia(lgMediaQuery);
152
+ return /*#__PURE__*/React.createElement(SideNavContext.Provider, {
153
+ value: {
154
+ isRail
155
+ }
156
+ }, isFixedNav ? null :
157
+ /*#__PURE__*/
158
+ // eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions
159
+ React.createElement("div", {
160
+ className: overlayClassName,
161
+ onClick: onOverlayClick
162
+ }), /*#__PURE__*/React.createElement("nav", _extends({
163
+ tabIndex: -1,
164
+ ref: navRef,
165
+ className: `${prefix}--side-nav__navigation ${className}`,
166
+ inert: !isRail ? expanded || isLg ? undefined : -1 : undefined
167
+ }, accessibilityLabel, eventHandlers, other), childrenToRender));
168
+ }
169
+ const SideNav = /*#__PURE__*/React.forwardRef(SideNavRenderFunction);
170
+ SideNav.displayName = 'SideNav';
171
+ SideNav.propTypes = {
172
+ /**
173
+ * Required props for accessibility label on the underlying menu
174
+ */
175
+ ...AriaLabelPropType,
176
+ /**
177
+ * Specify whether focus and blur listeners are added. They are by default.
178
+ */
179
+ addFocusListeners: PropTypes.bool,
180
+ /**
181
+ * Specify whether mouse entry/exit listeners are added. They are by default.
182
+ */
183
+ addMouseListeners: PropTypes.bool,
184
+ /**
185
+ * Optionally provide a custom class to apply to the underlying `<li>` node
186
+ */
187
+ className: PropTypes.string,
188
+ /**
189
+ * If `true`, the SideNav will be open on initial render.
190
+ */
191
+ defaultExpanded: PropTypes.bool,
192
+ /**
193
+ * Specify the duration in milliseconds to delay before displaying the sidenavigation
194
+ */
195
+ enterDelayMs: PropTypes.number,
196
+ /**
197
+ * If `true`, the SideNav will be expanded, otherwise it will be collapsed.
198
+ * Using this prop causes SideNav to become a controled component.
199
+ */
200
+ expanded: PropTypes.bool,
201
+ /**
202
+ * Provide the `href` to the id of the element on your package that is the
203
+ * main content.
204
+ */
205
+ href: PropTypes.string,
206
+ /**
207
+ * Optionally provide a custom class to apply to the underlying `<li>` node
208
+ */
209
+ isChildOfHeader: PropTypes.bool,
210
+ /**
211
+ * Specify if sideNav is standalone
212
+ */
213
+ isFixedNav: PropTypes.bool,
214
+ /**
215
+ * Specify if the sideNav will be persistent above the lg breakpoint
216
+ */
217
+ isPersistent: PropTypes.bool,
218
+ /**
219
+ * Optional prop to display the side nav rail.
220
+ */
221
+ isRail: PropTypes.bool,
222
+ /**
223
+ * An optional listener that is called when the SideNav overlay is clicked
224
+ *
225
+ * @param {object} event
226
+ */
227
+ onOverlayClick: PropTypes.func,
228
+ /**
229
+ * An optional listener that is called a callback to collapse the SideNav
230
+ */
231
+
232
+ onSideNavBlur: PropTypes.func,
233
+ /**
234
+ * An optional listener that is called when an event that would cause
235
+ * toggling the SideNav occurs.
236
+ *
237
+ * @param {object} event
238
+ * @param {boolean} value
239
+ */
240
+ onToggle: PropTypes.func
241
+
242
+ /**
243
+ * Provide a custom function for translating all message ids within this
244
+ * component. This function will take in two arguments: the mesasge Id and the
245
+ * state of the component. From this, you should return a string representing
246
+ * the label you want displayed or read by screen readers.
247
+ */
248
+ // translateById: PropTypes.func,
249
+ };
250
+
251
+ export { SideNav, SideNavContext };
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @license
3
+ *
4
+ * Copyright IBM Corp. 2025
5
+ *
6
+ * This source code is licensed under the Apache-2.0 license found in the
7
+ * LICENSE file in the root directory of this source tree.
8
+ */
9
+ export const CARBON_SIDENAV_ITEMS: string[];
@@ -0,0 +1,10 @@
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
+ const CARBON_SIDENAV_ITEMS = ['SideNavFooter', 'SideNavHeader', 'SideNavItems', 'SideNavMenu', 'SideNavLink'];
9
+
10
+ export { CARBON_SIDENAV_ITEMS };
package/es/index.d.ts ADDED
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @license
3
+ *
4
+ * Copyright IBM Corp. 2025
5
+ *
6
+ * This source code is licensed under the Apache-2.0 license found in the
7
+ * LICENSE file in the root directory of this source tree.
8
+ */
9
+ export { SideNav } from './components/SideNav.js';
package/es/index.js ADDED
@@ -0,0 +1,8 @@
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
+ export { SideNav } from './components/SideNav.js';
@@ -0,0 +1,58 @@
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
+ /**
9
+ * Copyright IBM Corp. 2018, 2023
10
+ *
11
+ * This source code is licensed under the Apache-2.0 license found in the
12
+ * LICENSE file in the root directory of this source tree.
13
+ */
14
+
15
+ // Convert
16
+ // Default, Use with em() and rem() functions
17
+ var baseFontSize = 16;
18
+
19
+ /**
20
+ * Convert a given px unit to a rem unit
21
+ * @param {number} px
22
+ * @returns {string}
23
+ */
24
+ function rem(px) {
25
+ return "".concat(px / baseFontSize, "rem");
26
+ }
27
+
28
+ // Breakpoint
29
+ // Initial map of our breakpoints and their values
30
+ var breakpoints = {
31
+ sm: {
32
+ width: rem(320),
33
+ columns: 4,
34
+ margin: '0'
35
+ },
36
+ md: {
37
+ width: rem(672),
38
+ columns: 8,
39
+ margin: rem(16)
40
+ },
41
+ lg: {
42
+ width: rem(1056),
43
+ columns: 16,
44
+ margin: rem(16)
45
+ },
46
+ xlg: {
47
+ width: rem(1312),
48
+ columns: 16,
49
+ margin: rem(16)
50
+ },
51
+ max: {
52
+ width: rem(1584),
53
+ columns: 16,
54
+ margin: rem(24)
55
+ }
56
+ };
57
+
58
+ export { baseFontSize, breakpoints, rem };
@@ -0,0 +1,71 @@
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 { __module as classnames } from '../../_virtual/index2.js';
9
+
10
+ var hasRequiredClassnames;
11
+ function requireClassnames() {
12
+ if (hasRequiredClassnames) return classnames.exports;
13
+ hasRequiredClassnames = 1;
14
+ (function (module) {
15
+ /* global define */
16
+
17
+ (function () {
18
+
19
+ var hasOwn = {}.hasOwnProperty;
20
+ function classNames() {
21
+ var classes = '';
22
+ for (var i = 0; i < arguments.length; i++) {
23
+ var arg = arguments[i];
24
+ if (arg) {
25
+ classes = appendClass(classes, parseValue(arg));
26
+ }
27
+ }
28
+ return classes;
29
+ }
30
+ function parseValue(arg) {
31
+ if (typeof arg === 'string' || typeof arg === 'number') {
32
+ return arg;
33
+ }
34
+ if (typeof arg !== 'object') {
35
+ return '';
36
+ }
37
+ if (Array.isArray(arg)) {
38
+ return classNames.apply(null, arg);
39
+ }
40
+ if (arg.toString !== Object.prototype.toString && !arg.toString.toString().includes('[native code]')) {
41
+ return arg.toString();
42
+ }
43
+ var classes = '';
44
+ for (var key in arg) {
45
+ if (hasOwn.call(arg, key) && arg[key]) {
46
+ classes = appendClass(classes, key);
47
+ }
48
+ }
49
+ return classes;
50
+ }
51
+ function appendClass(value, newClass) {
52
+ if (!newClass) {
53
+ return value;
54
+ }
55
+ if (value) {
56
+ return value + ' ' + newClass;
57
+ }
58
+ return value + newClass;
59
+ }
60
+ if (module.exports) {
61
+ classNames.default = classNames;
62
+ module.exports = classNames;
63
+ } else {
64
+ window.classNames = classNames;
65
+ }
66
+ })();
67
+ })(classnames);
68
+ return classnames.exports;
69
+ }
70
+
71
+ export { requireClassnames as __require };
@@ -0,0 +1,14 @@
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
+ function getDefaultExportFromCjs (x) {
11
+ return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
12
+ }
13
+
14
+ exports.getDefaultExportFromCjs = getDefaultExportFromCjs;
@@ -0,0 +1,20 @@
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
+ function _extends() {
11
+ return _extends = Object.assign ? Object.assign.bind() : function (n) {
12
+ for (var e = 1; e < arguments.length; e++) {
13
+ var t = arguments[e];
14
+ for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
15
+ }
16
+ return n;
17
+ }, _extends.apply(null, arguments);
18
+ }
19
+
20
+ exports.extends = _extends;
@@ -0,0 +1,18 @@
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
+ Object.defineProperty(exports, '__esModule', { value: true });
11
+
12
+ var _commonjsHelpers = require('./_commonjsHelpers.js');
13
+ var index = require('../node_modules/classnames/index.js');
14
+
15
+ var classnamesExports = index.__require();
16
+ var cx = /*@__PURE__*/_commonjsHelpers.getDefaultExportFromCjs(classnamesExports);
17
+
18
+ exports.default = cx;
@@ -0,0 +1,12 @@
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 classnames = {exports: {}};
11
+
12
+ exports.__module = classnames;
@@ -0,0 +1,29 @@
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, { type ComponentProps, type FocusEvent, type KeyboardEvent, type MouseEventHandler } from 'react';
8
+ export interface SideNavProps extends ComponentProps<'nav'> {
9
+ expanded?: boolean | undefined;
10
+ defaultExpanded?: boolean | undefined;
11
+ isChildOfHeader?: boolean | undefined;
12
+ onToggle?: (event: FocusEvent<HTMLElement> | KeyboardEvent<HTMLElement> | boolean, value: boolean) => void | undefined;
13
+ href?: string | undefined;
14
+ isFixedNav?: boolean | undefined;
15
+ isRail?: boolean | undefined;
16
+ isPersistent?: boolean | undefined;
17
+ addFocusListeners?: boolean | undefined;
18
+ addMouseListeners?: boolean | undefined;
19
+ onOverlayClick?: MouseEventHandler<HTMLDivElement> | undefined;
20
+ onSideNavBlur?: () => void | undefined;
21
+ enterDelayMs?: number;
22
+ inert?: boolean;
23
+ }
24
+ interface SideNavContextData {
25
+ isRail?: boolean | undefined;
26
+ }
27
+ export declare const SideNavContext: React.Context<SideNavContextData>;
28
+ export declare const SideNav: React.ForwardRefExoticComponent<Omit<SideNavProps, "ref"> & React.RefAttributes<HTMLElement>>;
29
+ export {};
@@ -0,0 +1,254 @@
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 _rollupPluginBabelHelpers = require('../_virtual/_rollupPluginBabelHelpers.js');
11
+ var React = require('react');
12
+ var index = require('../_virtual/index.js');
13
+ var PropTypes = require('prop-types');
14
+ var AriaPropTypes = require('@carbon/react/lib/prop-types/AriaPropTypes');
15
+ var _utils = require('./_utils.js');
16
+ var usePrefix = require('@carbon/react/lib/internal/usePrefix');
17
+ var keys = require('@carbon/react/lib/internal/keyboard/keys');
18
+ var match = require('@carbon/react/lib/internal/keyboard/match');
19
+ var useMergedRefs = require('@carbon/react/lib/internal/useMergedRefs');
20
+ var useEvent = require('@carbon/react/lib/internal/useEvent');
21
+ var useDelayedState = require('@carbon/react/lib/internal/useDelayedState');
22
+ var index$1 = require('../node_modules/@carbon/layout/es/index.js');
23
+ var useMatchMedia = require('@carbon/react/lib/internal/useMatchMedia');
24
+
25
+ // TO-DO: comment back in when footer is added for rails
26
+ // import SideNavFooter from './SideNavFooter';
27
+
28
+ const SideNavContext = /*#__PURE__*/React.createContext({});
29
+ function SideNavRenderFunction(_ref, ref) {
30
+ let {
31
+ expanded: expandedProp,
32
+ defaultExpanded = false,
33
+ isChildOfHeader = true,
34
+ 'aria-label': ariaLabel,
35
+ 'aria-labelledby': ariaLabelledBy,
36
+ children,
37
+ onToggle,
38
+ className: customClassName,
39
+ href,
40
+ isFixedNav = false,
41
+ isRail,
42
+ isPersistent = true,
43
+ addFocusListeners = true,
44
+ addMouseListeners = true,
45
+ onOverlayClick,
46
+ onSideNavBlur,
47
+ enterDelayMs = 100,
48
+ ...other
49
+ } = _ref;
50
+ const prefix = usePrefix.usePrefix();
51
+ const {
52
+ current: controlled
53
+ } = React.useRef(expandedProp !== undefined);
54
+ const [expandedState, setExpandedState] = useDelayedState.useDelayedState(defaultExpanded);
55
+ const [expandedViaHoverState, setExpandedViaHoverState] = useDelayedState.useDelayedState(defaultExpanded);
56
+ const expanded = controlled ? expandedProp : expandedState;
57
+ const sideNavRef = React.useRef(null);
58
+ const navRef = useMergedRefs.useMergedRefs([sideNavRef, ref]);
59
+ const handleToggle = function (event) {
60
+ let value = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !expanded;
61
+ if (!controlled) {
62
+ setExpandedState(value, enterDelayMs);
63
+ }
64
+ if (onToggle) {
65
+ onToggle(event, value);
66
+ }
67
+ if (controlled || isRail) {
68
+ setExpandedViaHoverState(value, enterDelayMs);
69
+ }
70
+ };
71
+ const accessibilityLabel = {
72
+ 'aria-label': ariaLabel,
73
+ 'aria-labelledby': ariaLabelledBy
74
+ };
75
+ const className = index.default(customClassName, {
76
+ [`${prefix}--side-nav`]: true,
77
+ [`${prefix}--side-nav--expanded`]: expanded || expandedViaHoverState,
78
+ [`${prefix}--side-nav--collapsed`]: !expanded && isFixedNav,
79
+ [`${prefix}--side-nav--rail`]: isRail,
80
+ [`${prefix}--side-nav--ux`]: isChildOfHeader,
81
+ [`${prefix}--side-nav--hidden`]: !isPersistent
82
+ });
83
+ const overlayClassName = index.default({
84
+ [`${prefix}--side-nav__overlay`]: true,
85
+ [`${prefix}--side-nav__overlay-active`]: expanded || expandedViaHoverState
86
+ });
87
+ let childrenToRender = children;
88
+
89
+ // Pass the expansion state as a prop, so children can update themselves to match
90
+ childrenToRender = React.Children.map(children, child => {
91
+ // if we are controlled, check for if we have hovered over or the expanded state, else just use the expanded state (uncontrolled)
92
+ const currentExpansionState = controlled ? expandedViaHoverState || expanded : expanded;
93
+ if (/*#__PURE__*/React.isValidElement(child)) {
94
+ const childJsxElement = child;
95
+ // avoid spreading `isSideNavExpanded` to non-Carbon UI Shell children
96
+ return /*#__PURE__*/React.cloneElement(childJsxElement, {
97
+ ...(_utils.CARBON_SIDENAV_ITEMS.includes(childJsxElement.type?.displayName ?? childJsxElement.type?.name) ? {
98
+ isSideNavExpanded: currentExpansionState
99
+ } : {})
100
+ });
101
+ }
102
+ return child;
103
+ });
104
+ const eventHandlers = {};
105
+ if (addFocusListeners) {
106
+ eventHandlers.onFocus = event => {
107
+ if (!event.currentTarget.contains(event.relatedTarget) && isRail) {
108
+ handleToggle(event, true);
109
+ }
110
+ };
111
+ eventHandlers.onBlur = event => {
112
+ if (!event.currentTarget.contains(event.relatedTarget)) {
113
+ handleToggle(event, false);
114
+ }
115
+ if (!event.currentTarget.contains(event.relatedTarget) && expanded && !isFixedNav) {
116
+ if (onSideNavBlur) {
117
+ onSideNavBlur();
118
+ }
119
+ }
120
+ };
121
+ eventHandlers.onKeyDown = event => {
122
+ if (match.match(event, keys.keys.Escape)) {
123
+ handleToggle(event, false);
124
+ if (href) {
125
+ window.location.href = href;
126
+ }
127
+ }
128
+ };
129
+ }
130
+ if (addMouseListeners && isRail) {
131
+ eventHandlers.onMouseEnter = () => {
132
+ handleToggle(true, true);
133
+ };
134
+ eventHandlers.onMouseLeave = () => {
135
+ setExpandedState(false);
136
+ setExpandedViaHoverState(false);
137
+ handleToggle(false, false);
138
+ };
139
+ eventHandlers.onClick = () => {
140
+ //if delay is enabled, and user intentionally clicks it to see it expanded immediately
141
+ setExpandedState(true);
142
+ setExpandedViaHoverState(true);
143
+ handleToggle(true, true);
144
+ };
145
+ }
146
+ useEvent.useWindowEvent('keydown', event => {
147
+ const focusedElement = document.activeElement;
148
+ if (match.match(event, keys.keys.Tab) && expanded && !isFixedNav && sideNavRef.current && focusedElement?.classList.contains(`${prefix}--header__menu-toggle`) && !focusedElement.closest('nav')) {
149
+ sideNavRef.current.focus();
150
+ }
151
+ });
152
+ const lgMediaQuery = `(min-width: ${index$1.breakpoints.lg.width})`;
153
+ const isLg = useMatchMedia.useMatchMedia(lgMediaQuery);
154
+ return /*#__PURE__*/React.createElement(SideNavContext.Provider, {
155
+ value: {
156
+ isRail
157
+ }
158
+ }, isFixedNav ? null :
159
+ /*#__PURE__*/
160
+ // eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions
161
+ React.createElement("div", {
162
+ className: overlayClassName,
163
+ onClick: onOverlayClick
164
+ }), /*#__PURE__*/React.createElement("nav", _rollupPluginBabelHelpers.extends({
165
+ tabIndex: -1,
166
+ ref: navRef,
167
+ className: `${prefix}--side-nav__navigation ${className}`,
168
+ inert: !isRail ? expanded || isLg ? undefined : -1 : undefined
169
+ }, accessibilityLabel, eventHandlers, other), childrenToRender));
170
+ }
171
+ const SideNav = /*#__PURE__*/React.forwardRef(SideNavRenderFunction);
172
+ SideNav.displayName = 'SideNav';
173
+ SideNav.propTypes = {
174
+ /**
175
+ * Required props for accessibility label on the underlying menu
176
+ */
177
+ ...AriaPropTypes.AriaLabelPropType,
178
+ /**
179
+ * Specify whether focus and blur listeners are added. They are by default.
180
+ */
181
+ addFocusListeners: PropTypes.bool,
182
+ /**
183
+ * Specify whether mouse entry/exit listeners are added. They are by default.
184
+ */
185
+ addMouseListeners: PropTypes.bool,
186
+ /**
187
+ * Optionally provide a custom class to apply to the underlying `<li>` node
188
+ */
189
+ className: PropTypes.string,
190
+ /**
191
+ * If `true`, the SideNav will be open on initial render.
192
+ */
193
+ defaultExpanded: PropTypes.bool,
194
+ /**
195
+ * Specify the duration in milliseconds to delay before displaying the sidenavigation
196
+ */
197
+ enterDelayMs: PropTypes.number,
198
+ /**
199
+ * If `true`, the SideNav will be expanded, otherwise it will be collapsed.
200
+ * Using this prop causes SideNav to become a controled component.
201
+ */
202
+ expanded: PropTypes.bool,
203
+ /**
204
+ * Provide the `href` to the id of the element on your package that is the
205
+ * main content.
206
+ */
207
+ href: PropTypes.string,
208
+ /**
209
+ * Optionally provide a custom class to apply to the underlying `<li>` node
210
+ */
211
+ isChildOfHeader: PropTypes.bool,
212
+ /**
213
+ * Specify if sideNav is standalone
214
+ */
215
+ isFixedNav: PropTypes.bool,
216
+ /**
217
+ * Specify if the sideNav will be persistent above the lg breakpoint
218
+ */
219
+ isPersistent: PropTypes.bool,
220
+ /**
221
+ * Optional prop to display the side nav rail.
222
+ */
223
+ isRail: PropTypes.bool,
224
+ /**
225
+ * An optional listener that is called when the SideNav overlay is clicked
226
+ *
227
+ * @param {object} event
228
+ */
229
+ onOverlayClick: PropTypes.func,
230
+ /**
231
+ * An optional listener that is called a callback to collapse the SideNav
232
+ */
233
+
234
+ onSideNavBlur: PropTypes.func,
235
+ /**
236
+ * An optional listener that is called when an event that would cause
237
+ * toggling the SideNav occurs.
238
+ *
239
+ * @param {object} event
240
+ * @param {boolean} value
241
+ */
242
+ onToggle: PropTypes.func
243
+
244
+ /**
245
+ * Provide a custom function for translating all message ids within this
246
+ * component. This function will take in two arguments: the mesasge Id and the
247
+ * state of the component. From this, you should return a string representing
248
+ * the label you want displayed or read by screen readers.
249
+ */
250
+ // translateById: PropTypes.func,
251
+ };
252
+
253
+ exports.SideNav = SideNav;
254
+ exports.SideNavContext = SideNavContext;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @license
3
+ *
4
+ * Copyright IBM Corp. 2025
5
+ *
6
+ * This source code is licensed under the Apache-2.0 license found in the
7
+ * LICENSE file in the root directory of this source tree.
8
+ */
9
+ export const CARBON_SIDENAV_ITEMS: string[];
@@ -0,0 +1,12 @@
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
+ const CARBON_SIDENAV_ITEMS = ['SideNavFooter', 'SideNavHeader', 'SideNavItems', 'SideNavMenu', 'SideNavLink'];
11
+
12
+ exports.CARBON_SIDENAV_ITEMS = CARBON_SIDENAV_ITEMS;
package/lib/index.d.ts ADDED
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @license
3
+ *
4
+ * Copyright IBM Corp. 2025
5
+ *
6
+ * This source code is licensed under the Apache-2.0 license found in the
7
+ * LICENSE file in the root directory of this source tree.
8
+ */
9
+ export { SideNav } from './components/SideNav.js';
package/lib/index.js ADDED
@@ -0,0 +1,14 @@
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 SideNav = require('./components/SideNav.js');
11
+
12
+
13
+
14
+ exports.SideNav = SideNav.SideNav;
@@ -0,0 +1,62 @@
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
+ /**
11
+ * Copyright IBM Corp. 2018, 2023
12
+ *
13
+ * This source code is licensed under the Apache-2.0 license found in the
14
+ * LICENSE file in the root directory of this source tree.
15
+ */
16
+
17
+ // Convert
18
+ // Default, Use with em() and rem() functions
19
+ var baseFontSize = 16;
20
+
21
+ /**
22
+ * Convert a given px unit to a rem unit
23
+ * @param {number} px
24
+ * @returns {string}
25
+ */
26
+ function rem(px) {
27
+ return "".concat(px / baseFontSize, "rem");
28
+ }
29
+
30
+ // Breakpoint
31
+ // Initial map of our breakpoints and their values
32
+ var breakpoints = {
33
+ sm: {
34
+ width: rem(320),
35
+ columns: 4,
36
+ margin: '0'
37
+ },
38
+ md: {
39
+ width: rem(672),
40
+ columns: 8,
41
+ margin: rem(16)
42
+ },
43
+ lg: {
44
+ width: rem(1056),
45
+ columns: 16,
46
+ margin: rem(16)
47
+ },
48
+ xlg: {
49
+ width: rem(1312),
50
+ columns: 16,
51
+ margin: rem(16)
52
+ },
53
+ max: {
54
+ width: rem(1584),
55
+ columns: 16,
56
+ margin: rem(24)
57
+ }
58
+ };
59
+
60
+ exports.baseFontSize = baseFontSize;
61
+ exports.breakpoints = breakpoints;
62
+ exports.rem = rem;
@@ -0,0 +1,73 @@
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/index2.js');
11
+
12
+ var hasRequiredClassnames;
13
+ function requireClassnames() {
14
+ if (hasRequiredClassnames) return index.__module.exports;
15
+ hasRequiredClassnames = 1;
16
+ (function (module) {
17
+ /* global define */
18
+
19
+ (function () {
20
+
21
+ var hasOwn = {}.hasOwnProperty;
22
+ function classNames() {
23
+ var classes = '';
24
+ for (var i = 0; i < arguments.length; i++) {
25
+ var arg = arguments[i];
26
+ if (arg) {
27
+ classes = appendClass(classes, parseValue(arg));
28
+ }
29
+ }
30
+ return classes;
31
+ }
32
+ function parseValue(arg) {
33
+ if (typeof arg === 'string' || typeof arg === 'number') {
34
+ return arg;
35
+ }
36
+ if (typeof arg !== 'object') {
37
+ return '';
38
+ }
39
+ if (Array.isArray(arg)) {
40
+ return classNames.apply(null, arg);
41
+ }
42
+ if (arg.toString !== Object.prototype.toString && !arg.toString.toString().includes('[native code]')) {
43
+ return arg.toString();
44
+ }
45
+ var classes = '';
46
+ for (var key in arg) {
47
+ if (hasOwn.call(arg, key) && arg[key]) {
48
+ classes = appendClass(classes, key);
49
+ }
50
+ }
51
+ return classes;
52
+ }
53
+ function appendClass(value, newClass) {
54
+ if (!newClass) {
55
+ return value;
56
+ }
57
+ if (value) {
58
+ return value + ' ' + newClass;
59
+ }
60
+ return value + newClass;
61
+ }
62
+ if (module.exports) {
63
+ classNames.default = classNames;
64
+ module.exports = classNames;
65
+ } else {
66
+ window.classNames = classNames;
67
+ }
68
+ })();
69
+ })(index.__module);
70
+ return index.__module.exports;
71
+ }
72
+
73
+ exports.__require = requireClassnames;
package/package.json ADDED
@@ -0,0 +1,31 @@
1
+ {
2
+ "name": "@carbon-labs/react-ui-shell",
3
+ "version": "0.0.1-canary.421+072a73f",
4
+ "publishConfig": {
5
+ "access": "public",
6
+ "provenance": true
7
+ },
8
+ "type": "module",
9
+ "description": "Carbon Labs - Ui Shell",
10
+ "license": "Apache-2.0",
11
+ "repository": {
12
+ "type": "git",
13
+ "url": "https://github.com/carbon-design-system/carbon-labs",
14
+ "directory": "src/components/UIShell"
15
+ },
16
+ "main": "./src/index.js",
17
+ "module": "./src/index.js",
18
+ "files": [
19
+ "es",
20
+ "lib",
21
+ "scss"
22
+ ],
23
+ "scripts": {
24
+ "build": "node ../../../tasks/build.js",
25
+ "clean": "rm -rf {es,lib,scss}"
26
+ },
27
+ "devDependencies": {
28
+ "@carbon-labs/utilities": "canary"
29
+ },
30
+ "gitHead": "072a73f9945838a5538271fb7aa58975fc573f43"
31
+ }
@@ -0,0 +1,20 @@
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
+ // 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
+ }