@carbon/ibm-products 2.30.0 → 2.31.0-alpha.5
Sign up to get free protection for your applications and to get access to all the features.
- package/css/index-full-carbon.css +242 -23
- package/css/index-full-carbon.css.map +1 -1
- package/css/index-full-carbon.min.css +1 -1
- package/css/index-full-carbon.min.css.map +1 -1
- package/css/index-without-carbon-released-only.css +4 -4
- package/css/index-without-carbon-released-only.css.map +1 -1
- package/css/index-without-carbon-released-only.min.css +1 -1
- package/css/index-without-carbon-released-only.min.css.map +1 -1
- package/css/index-without-carbon.css +242 -23
- package/css/index-without-carbon.css.map +1 -1
- package/css/index-without-carbon.min.css +1 -1
- package/css/index-without-carbon.min.css.map +1 -1
- package/css/index.css +238 -19
- package/css/index.css.map +1 -1
- package/css/index.min.css +1 -1
- package/css/index.min.css.map +1 -1
- package/es/components/ComboButton/ComboButton.d.ts +38 -18
- package/es/components/ComboButton/ComboButton.js +25 -21
- package/es/components/ComboButton/ComboButtonItem/index.d.ts +22 -13
- package/es/components/Datagrid/Datagrid/addons/stateReducer.js +7 -0
- package/es/components/EditInPlace/EditInPlace.js +4 -5
- package/es/components/Nav/Nav.d.ts +3 -0
- package/es/components/Nav/Nav.js +154 -0
- package/es/components/Nav/NavItem.d.ts +35 -0
- package/es/components/Nav/NavItem.js +149 -0
- package/es/components/Nav/NavItemLink.d.ts +3 -0
- package/es/components/Nav/NavItemLink.js +30 -0
- package/es/components/Nav/NavList.d.ts +4 -0
- package/es/components/Nav/NavList.js +168 -0
- package/es/components/Nav/index.d.ts +3 -0
- package/es/components/Tearsheet/TearsheetShell.js +22 -7
- package/es/components/index.d.ts +1 -0
- package/es/global/js/package-settings.d.ts +1 -0
- package/es/global/js/package-settings.js +1 -0
- package/es/index.js +1 -0
- package/es/node_modules/@carbon/icon-helpers/es/index.js +140 -0
- package/es/node_modules/@carbon/icons-react/es/Icon.js +73 -0
- package/es/node_modules/@carbon/icons-react/es/generated/bucket-2.js +3091 -0
- package/es/node_modules/@carbon/icons-react/es/generated/bucket-8.js +3004 -0
- package/es/node_modules/@carbon/icons-react/es/iconPropTypes-4cbeb95d.js +14 -0
- package/es/settings.d.ts +1 -0
- package/lib/components/ComboButton/ComboButton.d.ts +38 -18
- package/lib/components/ComboButton/ComboButton.js +24 -20
- package/lib/components/ComboButton/ComboButtonItem/index.d.ts +22 -13
- package/lib/components/Datagrid/Datagrid/addons/stateReducer.js +7 -0
- package/lib/components/EditInPlace/EditInPlace.js +4 -5
- package/lib/components/Nav/Nav.d.ts +3 -0
- package/lib/components/Nav/Nav.js +161 -0
- package/lib/components/Nav/NavItem.d.ts +35 -0
- package/lib/components/Nav/NavItem.js +160 -0
- package/lib/components/Nav/NavItemLink.d.ts +3 -0
- package/lib/components/Nav/NavItemLink.js +38 -0
- package/lib/components/Nav/NavList.d.ts +4 -0
- package/lib/components/Nav/NavList.js +179 -0
- package/lib/components/Nav/index.d.ts +3 -0
- package/lib/components/Tearsheet/TearsheetShell.js +22 -7
- package/lib/components/index.d.ts +1 -0
- package/lib/global/js/package-settings.d.ts +1 -0
- package/lib/global/js/package-settings.js +1 -0
- package/lib/index.js +5 -0
- package/lib/node_modules/@carbon/icon-helpers/es/index.js +145 -0
- package/lib/node_modules/@carbon/icons-react/es/Icon.js +81 -0
- package/lib/node_modules/@carbon/icons-react/es/generated/bucket-2.js +3223 -0
- package/lib/node_modules/@carbon/icons-react/es/generated/bucket-8.js +3136 -0
- package/lib/node_modules/@carbon/icons-react/es/iconPropTypes-4cbeb95d.js +18 -0
- package/lib/settings.d.ts +1 -0
- package/package.json +3 -3
- package/scss/components/ComboButton/_combo-button.scss +19 -21
- package/scss/components/Nav/_carbon-imports.scss +9 -0
- package/scss/components/Nav/_index-with-carbon.scss +9 -0
- package/scss/components/Nav/_index.scss +8 -0
- package/scss/components/Nav/_nav.scss +259 -0
- package/scss/components/Tearsheet/_tearsheet.scss +24 -6
- package/scss/components/_index-with-carbon.scss +1 -0
- package/scss/components/_index.scss +1 -0
@@ -0,0 +1,38 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright IBM Corp. 2020, 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 _rollupPluginBabelHelpers = require('../../_virtual/_rollupPluginBabelHelpers.js');
|
13
|
+
var index = require('../../node_modules/prop-types/index.js');
|
14
|
+
var React = require('react');
|
15
|
+
|
16
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
17
|
+
|
18
|
+
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
19
|
+
|
20
|
+
var _excluded = ["element"];
|
21
|
+
var NavItemLink = /*#__PURE__*/React__default["default"].forwardRef(function NavItemLink(props, ref) {
|
22
|
+
var element = props.element,
|
23
|
+
rest = _rollupPluginBabelHelpers.objectWithoutProperties(props, _excluded);
|
24
|
+
return /*#__PURE__*/React__default["default"].createElement(element, _rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, rest), {}, {
|
25
|
+
ref: ref
|
26
|
+
}));
|
27
|
+
});
|
28
|
+
NavItemLink.displayName = 'NavItemLink';
|
29
|
+
NavItemLink.propTypes = {
|
30
|
+
/** @type {elementType} The base element to use to build the link. Defaults to `a`, can also accept alternative tag names or custom components like `Link` from `react-router`. */
|
31
|
+
element: index["default"].elementType
|
32
|
+
};
|
33
|
+
NavItemLink.defaultProps = {
|
34
|
+
element: 'a'
|
35
|
+
};
|
36
|
+
var NavItemLink$1 = NavItemLink;
|
37
|
+
|
38
|
+
exports["default"] = NavItemLink$1;
|
@@ -0,0 +1,179 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright IBM Corp. 2020, 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 _rollupPluginBabelHelpers = require('../../_virtual/_rollupPluginBabelHelpers.js');
|
13
|
+
var React = require('react');
|
14
|
+
var cx = require('classnames');
|
15
|
+
var index = require('../../node_modules/prop-types/index.js');
|
16
|
+
var NavItem = require('./NavItem.js');
|
17
|
+
var settings = require('../../settings.js');
|
18
|
+
var bucket2 = require('../../node_modules/@carbon/icons-react/es/generated/bucket-2.js');
|
19
|
+
|
20
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
21
|
+
|
22
|
+
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
23
|
+
var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
|
24
|
+
|
25
|
+
var componentName = 'NavList';
|
26
|
+
var blockClass = "".concat(settings.pkg.prefix, "--nav-list");
|
27
|
+
|
28
|
+
// Default values for props
|
29
|
+
var defaults = {
|
30
|
+
activeHref: '#',
|
31
|
+
className: '',
|
32
|
+
children: null,
|
33
|
+
id: '',
|
34
|
+
isExpandedOnPageload: false,
|
35
|
+
onItemClick: function onItemClick() {},
|
36
|
+
onListClick: function onListClick() {},
|
37
|
+
tabIndex: 0,
|
38
|
+
title: '',
|
39
|
+
icon: '',
|
40
|
+
navigationItemTitle: ''
|
41
|
+
};
|
42
|
+
var NavList = /*#__PURE__*/React__default["default"].forwardRef(function (_ref, ref) {
|
43
|
+
var _ref$activeHref = _ref.activeHref,
|
44
|
+
activeHref = _ref$activeHref === void 0 ? defaults.activeHref : _ref$activeHref,
|
45
|
+
_ref$children = _ref.children,
|
46
|
+
children = _ref$children === void 0 ? defaults.children : _ref$children,
|
47
|
+
_ref$className = _ref.className,
|
48
|
+
className = _ref$className === void 0 ? defaults.className : _ref$className,
|
49
|
+
_ref$icon = _ref.icon,
|
50
|
+
icon = _ref$icon === void 0 ? defaults.icon : _ref$icon,
|
51
|
+
_ref$id = _ref.id,
|
52
|
+
id = _ref$id === void 0 ? defaults.id : _ref$id,
|
53
|
+
_ref$isExpandedOnPage = _ref.isExpandedOnPageload,
|
54
|
+
isExpandedOnPageload = _ref$isExpandedOnPage === void 0 ? defaults.isExpandedOnPageload : _ref$isExpandedOnPage,
|
55
|
+
_ref$navigationItemTi = _ref.navigationItemTitle,
|
56
|
+
navigationItemTitle = _ref$navigationItemTi === void 0 ? defaults.navigationItemTitle : _ref$navigationItemTi,
|
57
|
+
_ref$onItemClick = _ref.onItemClick,
|
58
|
+
onItemClick = _ref$onItemClick === void 0 ? defaults.onItemClick : _ref$onItemClick,
|
59
|
+
_ref$onListClick = _ref.onListClick,
|
60
|
+
onListClick = _ref$onListClick === void 0 ? defaults.onListClick : _ref$onListClick,
|
61
|
+
_ref$tabIndex = _ref.tabIndex,
|
62
|
+
tabIndex = _ref$tabIndex === void 0 ? defaults.tabIndex : _ref$tabIndex,
|
63
|
+
_ref$title = _ref.title,
|
64
|
+
title = _ref$title === void 0 ? defaults.title : _ref$title;
|
65
|
+
var _useState = React.useState(isExpandedOnPageload),
|
66
|
+
_useState2 = _rollupPluginBabelHelpers.slicedToArray(_useState, 2),
|
67
|
+
open = _useState2[0],
|
68
|
+
setOpen = _useState2[1];
|
69
|
+
React.useEffect(function () {
|
70
|
+
var hrefs = React__default["default"].Children.toArray(children).filter(function (_ref2) {
|
71
|
+
var childProps = _ref2.props;
|
72
|
+
return childProps.href && childProps.href.length > 0;
|
73
|
+
}).map(function (_ref3) {
|
74
|
+
var childProps = _ref3.props;
|
75
|
+
return childProps.href;
|
76
|
+
});
|
77
|
+
setOpen(hrefs.includes(activeHref) || isExpandedOnPageload);
|
78
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
79
|
+
}, []);
|
80
|
+
|
81
|
+
/**
|
82
|
+
* Closes the list.
|
83
|
+
*/
|
84
|
+
var close = function close() {
|
85
|
+
if (open) {
|
86
|
+
setOpen(false);
|
87
|
+
}
|
88
|
+
};
|
89
|
+
|
90
|
+
/**
|
91
|
+
* Handles toggling the list.
|
92
|
+
* @param {SyntheticEvent} event The event fired when the list is toggled.
|
93
|
+
*/
|
94
|
+
var toggle = function toggle(event) {
|
95
|
+
var which = event.which,
|
96
|
+
type = event.type;
|
97
|
+
|
98
|
+
// Enter (13) and spacebar (32).
|
99
|
+
if (which === 13 || which === 32 || type === 'click') {
|
100
|
+
if (!open) {
|
101
|
+
onListClick(id);
|
102
|
+
}
|
103
|
+
setOpen(!open);
|
104
|
+
}
|
105
|
+
};
|
106
|
+
|
107
|
+
// Expose external function calls to the parent component
|
108
|
+
React.useImperativeHandle(ref, function () {
|
109
|
+
return {
|
110
|
+
close: close,
|
111
|
+
isExpandedOnPageload: isExpandedOnPageload
|
112
|
+
};
|
113
|
+
});
|
114
|
+
var newChildren = React__default["default"].Children.map(children, function (child, index) {
|
115
|
+
return /*#__PURE__*/React__default["default"].createElement(NavItem["default"], _rollupPluginBabelHelpers["extends"]({}, child.props, {
|
116
|
+
key: "".concat(NavItem.blockClass, "--").concat(index),
|
117
|
+
onClick: function onClick(event, href) {
|
118
|
+
var _child$props$onClick, _child$props;
|
119
|
+
onItemClick(event, href);
|
120
|
+
(_child$props$onClick = (_child$props = child.props).onClick) === null || _child$props$onClick === void 0 || _child$props$onClick.call(_child$props, event);
|
121
|
+
},
|
122
|
+
activeHref: activeHref,
|
123
|
+
tabIndex: open ? 0 : -1
|
124
|
+
}));
|
125
|
+
});
|
126
|
+
return /*#__PURE__*/React__default["default"].createElement("li", {
|
127
|
+
ref: ref,
|
128
|
+
className: cx__default["default"](blockClass, className, _rollupPluginBabelHelpers.defineProperty({}, "".concat(NavItem.blockClass, "--expanded"), open)),
|
129
|
+
tabIndex: tabIndex,
|
130
|
+
onClick: toggle,
|
131
|
+
onKeyDown: toggle,
|
132
|
+
role: "menuitem"
|
133
|
+
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
134
|
+
className: "".concat(NavItem.blockClass, "__link")
|
135
|
+
}, icon && /*#__PURE__*/React__default["default"].createElement("img", {
|
136
|
+
alt: navigationItemTitle,
|
137
|
+
className: "".concat(NavItem.blockClass, "__img"),
|
138
|
+
src: icon
|
139
|
+
}), /*#__PURE__*/React__default["default"].createElement("div", {
|
140
|
+
className: "".concat(NavItem.blockClass, "__content")
|
141
|
+
}, title), /*#__PURE__*/React__default["default"].createElement(bucket2.ChevronDown, {
|
142
|
+
className: "".concat(blockClass, "__icon")
|
143
|
+
})), /*#__PURE__*/React__default["default"].createElement("ul", {
|
144
|
+
"aria-label": title,
|
145
|
+
"aria-hidden": !open,
|
146
|
+
className: "".concat(blockClass, " ").concat(blockClass, "--nested"),
|
147
|
+
role: "menu"
|
148
|
+
}, newChildren));
|
149
|
+
});
|
150
|
+
NavList.propTypes = {
|
151
|
+
/** @type {string} Hypertext reference for active page. */
|
152
|
+
activeHref: index.propTypesExports.string,
|
153
|
+
/** @type {Node} Child elements. */
|
154
|
+
children: index.propTypesExports.node,
|
155
|
+
/** @type {string} Extra classes to add. */
|
156
|
+
className: index.propTypesExports.string,
|
157
|
+
/** @type {string} Icon of a list. */
|
158
|
+
icon: index.propTypesExports.string,
|
159
|
+
/** @type {string} ID of a list. */
|
160
|
+
id: index.propTypesExports.string,
|
161
|
+
/** @type {boolean} State of a list. */
|
162
|
+
isExpandedOnPageload: index.propTypesExports.bool,
|
163
|
+
/** @type {boolean} Title of nav. */
|
164
|
+
navigationItemTitle: index.propTypesExports.string,
|
165
|
+
/** @type {Function} Click handler for an item. */
|
166
|
+
onItemClick: index.propTypesExports.func,
|
167
|
+
/** @type {Function} Click handler for a list. */
|
168
|
+
onListClick: index.propTypesExports.func,
|
169
|
+
/** @type {number} `tabindex` of an item. */
|
170
|
+
tabIndex: index.propTypesExports.number,
|
171
|
+
/** @type {string} Label of the list. */
|
172
|
+
title: index.propTypesExports.string
|
173
|
+
};
|
174
|
+
NavList.displayName = componentName;
|
175
|
+
var NavList$1 = NavList;
|
176
|
+
|
177
|
+
exports.NavList = NavList;
|
178
|
+
exports.blockClass = blockClass;
|
179
|
+
exports["default"] = NavList$1;
|
@@ -43,9 +43,13 @@ var maxDepth = 3;
|
|
43
43
|
// happens when a tearsheet opens or closes. The 'open' array contains one
|
44
44
|
// handler per OPEN tearsheet ordered from lowest to highest in visual z-order.
|
45
45
|
// The 'all' array contains all the handlers for open and closed tearsheets.
|
46
|
+
// The 'sizes' array contains an array of the sizes for every stacked tearsheet.
|
47
|
+
// This is so we can opt-out of including the stacking scale effect when there
|
48
|
+
// are stacked tearsheets with mixed sizes (ie, using wide and narrow together)
|
46
49
|
var stack = {
|
47
50
|
open: [],
|
48
|
-
all: []
|
51
|
+
all: [],
|
52
|
+
sizes: []
|
49
53
|
};
|
50
54
|
|
51
55
|
// these props are only applicable when size='wide'
|
@@ -156,6 +160,7 @@ var TearsheetShell = /*#__PURE__*/React__default["default"].forwardRef(function
|
|
156
160
|
|
157
161
|
// Register this tearsheet's stack change callback/listener.
|
158
162
|
stack.all.push(handleStackChange);
|
163
|
+
stack.sizes.push(size);
|
159
164
|
|
160
165
|
// If the tearsheet is mounting with open=true or open is changing from
|
161
166
|
// false to true to open it then append its notification callback to
|
@@ -172,6 +177,7 @@ var TearsheetShell = /*#__PURE__*/React__default["default"].forwardRef(function
|
|
172
177
|
return function cleanup() {
|
173
178
|
// Remove the notification callback from the all handlers array.
|
174
179
|
stack.all.splice(stack.all.indexOf(handleStackChange), 1);
|
180
|
+
stack.sizes.splice(stack.sizes.indexOf(size), 1);
|
175
181
|
|
176
182
|
// Remove the notification callback from the open handlers array, if
|
177
183
|
// it's there, and notify all open tearsheets that the stacking has
|
@@ -182,7 +188,7 @@ var TearsheetShell = /*#__PURE__*/React__default["default"].forwardRef(function
|
|
182
188
|
notify();
|
183
189
|
}
|
184
190
|
};
|
185
|
-
}, [open]);
|
191
|
+
}, [open, size]);
|
186
192
|
function handleFocus() {
|
187
193
|
// If something within us is receiving focus but we are not the topmost
|
188
194
|
// stacked tearsheet, transfer focus to the topmost tearsheet instead
|
@@ -198,14 +204,23 @@ var TearsheetShell = /*#__PURE__*/React__default["default"].forwardRef(function
|
|
198
204
|
|
199
205
|
// Include an ActionSet if and only if one or more actions is given.
|
200
206
|
var includeActions = actions && (actions === null || actions === void 0 ? void 0 : actions.length) > 0;
|
207
|
+
var areAllSameSizeVariant = function areAllSameSizeVariant() {
|
208
|
+
return new Set(stack.sizes).size === 1;
|
209
|
+
};
|
210
|
+
var setScaleValues = function setScaleValues() {
|
211
|
+
if (!areAllSameSizeVariant()) {
|
212
|
+
return _rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty({}, "--".concat(bc, "--stacking-scale-factor-single"), 1), "--".concat(bc, "--stacking-scale-factor-double"), 1);
|
213
|
+
}
|
214
|
+
return _rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty({}, "--".concat(bc, "--stacking-scale-factor-single"), (width - 32) / width), "--".concat(bc, "--stacking-scale-factor-double"), (width - 64) / width);
|
215
|
+
};
|
201
216
|
return renderPortalUse( /*#__PURE__*/React__default["default"].createElement(react.ComposedModal, _rollupPluginBabelHelpers["extends"]({}, rest, {
|
202
217
|
"aria-label": ariaLabel || getNodeTextContent.getNodeTextContent(title),
|
203
218
|
className: cx__default["default"](bc, className, _rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty({}, "".concat(bc, "--stacked-").concat(position, "-of-").concat(depth),
|
204
219
|
// Don't apply this on the initial open of a single tearsheet.
|
205
220
|
depth > 1 || depth === 1 && prevDepth.current > 1), "".concat(bc, "--wide"), wide), "".concat(bc, "--narrow"), !wide), "".concat(bc, "--has-slug"), slug), "".concat(bc, "--has-close"), effectiveHasCloseIcon)),
|
206
221
|
slug: slug,
|
207
|
-
style:
|
208
|
-
containerClassName: cx__default["default"]("".concat(bc, "__container"), _rollupPluginBabelHelpers.defineProperty({}, "".concat(bc, "__container--lower"), verticalPosition === 'lower')),
|
222
|
+
style: setScaleValues(),
|
223
|
+
containerClassName: cx__default["default"]("".concat(bc, "__container"), _rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty({}, "".concat(bc, "__container--lower"), verticalPosition === 'lower'), "".concat(bc, "__container--mixed-size-stacking"), !areAllSameSizeVariant())),
|
209
224
|
onClose: onClose,
|
210
225
|
open: open,
|
211
226
|
selectorPrimaryFocus: selectorPrimaryFocus,
|
@@ -333,9 +348,9 @@ TearsheetShell.propTypes = _rollupPluginBabelHelpers.objectSpread2({
|
|
333
348
|
* **Note:** This prop is only required if a close icon is shown, i.e. if
|
334
349
|
* there are a no navigation actions and/or hasCloseIcon is true.
|
335
350
|
*/
|
336
|
-
closeIconDescription: index["default"].string.isRequired.if(function (
|
337
|
-
var actions =
|
338
|
-
hasCloseIcon =
|
351
|
+
closeIconDescription: index["default"].string.isRequired.if(function (_ref4) {
|
352
|
+
var actions = _ref4.actions,
|
353
|
+
hasCloseIcon = _ref4.hasCloseIcon;
|
339
354
|
return tearsheetHasCloseIcon(actions, hasCloseIcon);
|
340
355
|
}),
|
341
356
|
/**
|
@@ -44,6 +44,7 @@ export { Decorator } from "./Decorator";
|
|
44
44
|
export { DescriptionList } from "./DescriptionList";
|
45
45
|
export { FullPageError } from "./FullPageError";
|
46
46
|
export { SearchBar } from "./SearchBar";
|
47
|
+
export { Nav } from "./Nav";
|
47
48
|
export { StringFormatter } from "./StringFormatter";
|
48
49
|
export { UserAvatar } from "./UserAvatar";
|
49
50
|
export { StatusIndicator } from "./StatusIndicator";
|
package/lib/index.js
CHANGED
@@ -113,6 +113,7 @@ var Decorator = require('./components/Decorator/Decorator.js');
|
|
113
113
|
var DescriptionList = require('./components/DescriptionList/DescriptionList.js');
|
114
114
|
var FullPageError = require('./components/FullPageError/FullPageError.js');
|
115
115
|
var SearchBar = require('./components/SearchBar/SearchBar.js');
|
116
|
+
var Nav = require('./components/Nav/Nav.js');
|
116
117
|
var StringFormatter = require('./components/StringFormatter/StringFormatter.js');
|
117
118
|
var UserAvatar = require('./components/UserAvatar/UserAvatar.js');
|
118
119
|
var StatusIndicator = require('./components/StatusIndicator/StatusIndicator.js');
|
@@ -467,6 +468,10 @@ Object.defineProperty(exports, 'SearchBar', {
|
|
467
468
|
enumerable: true,
|
468
469
|
get: function () { return SearchBar.SearchBar; }
|
469
470
|
});
|
471
|
+
Object.defineProperty(exports, 'Nav', {
|
472
|
+
enumerable: true,
|
473
|
+
get: function () { return Nav.Nav; }
|
474
|
+
});
|
470
475
|
Object.defineProperty(exports, 'StringFormatter', {
|
471
476
|
enumerable: true,
|
472
477
|
get: function () { return StringFormatter.StringFormatter; }
|
@@ -0,0 +1,145 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright IBM Corp. 2020, 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 _rollupPluginBabelHelpers = require('../../../../_virtual/_rollupPluginBabelHelpers.js');
|
13
|
+
|
14
|
+
function ownKeys(object, enumerableOnly) {
|
15
|
+
var keys = Object.keys(object);
|
16
|
+
if (Object.getOwnPropertySymbols) {
|
17
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
18
|
+
enumerableOnly && (symbols = symbols.filter(function (sym) {
|
19
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
20
|
+
})), keys.push.apply(keys, symbols);
|
21
|
+
}
|
22
|
+
return keys;
|
23
|
+
}
|
24
|
+
function _objectSpread2(target) {
|
25
|
+
for (var i = 1; i < arguments.length; i++) {
|
26
|
+
var source = null != arguments[i] ? arguments[i] : {};
|
27
|
+
i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
|
28
|
+
_defineProperty(target, key, source[key]);
|
29
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
|
30
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
31
|
+
});
|
32
|
+
}
|
33
|
+
return target;
|
34
|
+
}
|
35
|
+
function _defineProperty(obj, key, value) {
|
36
|
+
key = _toPropertyKey(key);
|
37
|
+
if (key in obj) {
|
38
|
+
Object.defineProperty(obj, key, {
|
39
|
+
value: value,
|
40
|
+
enumerable: true,
|
41
|
+
configurable: true,
|
42
|
+
writable: true
|
43
|
+
});
|
44
|
+
} else {
|
45
|
+
obj[key] = value;
|
46
|
+
}
|
47
|
+
return obj;
|
48
|
+
}
|
49
|
+
function _objectWithoutPropertiesLoose(source, excluded) {
|
50
|
+
if (source == null) return {};
|
51
|
+
var target = {};
|
52
|
+
var sourceKeys = Object.keys(source);
|
53
|
+
var key, i;
|
54
|
+
for (i = 0; i < sourceKeys.length; i++) {
|
55
|
+
key = sourceKeys[i];
|
56
|
+
if (excluded.indexOf(key) >= 0) continue;
|
57
|
+
target[key] = source[key];
|
58
|
+
}
|
59
|
+
return target;
|
60
|
+
}
|
61
|
+
function _objectWithoutProperties(source, excluded) {
|
62
|
+
if (source == null) return {};
|
63
|
+
var target = _objectWithoutPropertiesLoose(source, excluded);
|
64
|
+
var key, i;
|
65
|
+
if (Object.getOwnPropertySymbols) {
|
66
|
+
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
67
|
+
for (i = 0; i < sourceSymbolKeys.length; i++) {
|
68
|
+
key = sourceSymbolKeys[i];
|
69
|
+
if (excluded.indexOf(key) >= 0) continue;
|
70
|
+
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
71
|
+
target[key] = source[key];
|
72
|
+
}
|
73
|
+
}
|
74
|
+
return target;
|
75
|
+
}
|
76
|
+
function _toPrimitive(input, hint) {
|
77
|
+
if (_rollupPluginBabelHelpers["typeof"](input) !== "object" || input === null) return input;
|
78
|
+
var prim = input[Symbol.toPrimitive];
|
79
|
+
if (prim !== undefined) {
|
80
|
+
var res = prim.call(input, hint || "default");
|
81
|
+
if (_rollupPluginBabelHelpers["typeof"](res) !== "object") return res;
|
82
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
83
|
+
}
|
84
|
+
return (hint === "string" ? String : Number)(input);
|
85
|
+
}
|
86
|
+
function _toPropertyKey(arg) {
|
87
|
+
var key = _toPrimitive(arg, "string");
|
88
|
+
return _rollupPluginBabelHelpers["typeof"](key) === "symbol" ? key : String(key);
|
89
|
+
}
|
90
|
+
var _excluded = ["width", "height", "viewBox"],
|
91
|
+
_excluded2 = ["tabindex"];
|
92
|
+
/**
|
93
|
+
* Copyright IBM Corp. 2018, 2024
|
94
|
+
*
|
95
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
96
|
+
* LICENSE file in the root directory of this source tree.
|
97
|
+
*/
|
98
|
+
|
99
|
+
var defaultAttributes = {
|
100
|
+
// Reference:
|
101
|
+
// https://github.com/IBM/carbon-components-react/issues/1392
|
102
|
+
// https://github.com/PolymerElements/iron-iconset-svg/pull/47
|
103
|
+
// `focusable` is a string attribute which is why we do not use a boolean here
|
104
|
+
focusable: 'false',
|
105
|
+
preserveAspectRatio: 'xMidYMid meet'
|
106
|
+
};
|
107
|
+
|
108
|
+
/**
|
109
|
+
* Get supplementary HTML attributes for a given <svg> element based on existing
|
110
|
+
* attributes.
|
111
|
+
*/
|
112
|
+
function getAttributes() {
|
113
|
+
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
114
|
+
width = _ref.width,
|
115
|
+
height = _ref.height,
|
116
|
+
_ref$viewBox = _ref.viewBox,
|
117
|
+
viewBox = _ref$viewBox === void 0 ? "0 0 ".concat(width, " ").concat(height) : _ref$viewBox,
|
118
|
+
attributes = _objectWithoutProperties(_ref, _excluded);
|
119
|
+
var tabindex = attributes.tabindex,
|
120
|
+
rest = _objectWithoutProperties(attributes, _excluded2);
|
121
|
+
var iconAttributes = _objectSpread2(_objectSpread2(_objectSpread2({}, defaultAttributes), rest), {}, {
|
122
|
+
width: width,
|
123
|
+
height: height,
|
124
|
+
viewBox: viewBox
|
125
|
+
});
|
126
|
+
|
127
|
+
// TODO: attributes.title assumes that the consumer will implement <title> and
|
128
|
+
// correctly set `aria-labelledby`.
|
129
|
+
if (iconAttributes['aria-label'] || iconAttributes['aria-labelledby'] || iconAttributes.title) {
|
130
|
+
iconAttributes.role = 'img';
|
131
|
+
|
132
|
+
// Reference:
|
133
|
+
// https://allyjs.io/tutorials/focusing-in-svg.html
|
134
|
+
if (tabindex !== undefined && tabindex !== null) {
|
135
|
+
iconAttributes.focusable = 'true';
|
136
|
+
iconAttributes.tabindex = tabindex;
|
137
|
+
}
|
138
|
+
} else {
|
139
|
+
iconAttributes['aria-hidden'] = true;
|
140
|
+
}
|
141
|
+
return iconAttributes;
|
142
|
+
}
|
143
|
+
|
144
|
+
exports.defaultAttributes = defaultAttributes;
|
145
|
+
exports.getAttributes = getAttributes;
|
@@ -0,0 +1,81 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright IBM Corp. 2020, 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 _rollupPluginBabelHelpers = require('../../../../_virtual/_rollupPluginBabelHelpers.js');
|
13
|
+
var index = require('../../icon-helpers/es/index.js');
|
14
|
+
var index$1 = require('../../../prop-types/index.js');
|
15
|
+
var React = require('react');
|
16
|
+
|
17
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
18
|
+
|
19
|
+
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
20
|
+
|
21
|
+
var _excluded = ["className", "children", "tabIndex", "xmlns", "preserveAspectRatio"],
|
22
|
+
_excluded2 = ["tabindex"];
|
23
|
+
|
24
|
+
/**
|
25
|
+
* Copyright IBM Corp. 2019, 2023
|
26
|
+
*
|
27
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
28
|
+
* LICENSE file in the root directory of this source tree.
|
29
|
+
*/
|
30
|
+
var Icon = /*#__PURE__*/React__default["default"].forwardRef(function Icon(_ref, ref) {
|
31
|
+
var className = _ref.className,
|
32
|
+
children = _ref.children,
|
33
|
+
tabIndex = _ref.tabIndex,
|
34
|
+
_ref$xmlns = _ref.xmlns,
|
35
|
+
xmlns = _ref$xmlns === void 0 ? 'http://www.w3.org/2000/svg' : _ref$xmlns,
|
36
|
+
_ref$preserveAspectRa = _ref.preserveAspectRatio,
|
37
|
+
preserveAspectRatio = _ref$preserveAspectRa === void 0 ? 'xMidYMid meet' : _ref$preserveAspectRa,
|
38
|
+
rest = _rollupPluginBabelHelpers.objectWithoutProperties(_ref, _excluded);
|
39
|
+
var _getAttributes = index.getAttributes(_rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, rest), {}, {
|
40
|
+
tabindex: tabIndex
|
41
|
+
})),
|
42
|
+
tabindex = _getAttributes.tabindex,
|
43
|
+
attrs = _rollupPluginBabelHelpers.objectWithoutProperties(_getAttributes, _excluded2);
|
44
|
+
var props = attrs;
|
45
|
+
if (className) {
|
46
|
+
props.className = className;
|
47
|
+
}
|
48
|
+
if (tabindex !== undefined && tabindex !== null) {
|
49
|
+
if (typeof tabindex === 'number') {
|
50
|
+
props.tabIndex = tabindex;
|
51
|
+
} else {
|
52
|
+
props.tabIndex = Number(tabIndex);
|
53
|
+
}
|
54
|
+
}
|
55
|
+
if (ref) {
|
56
|
+
props.ref = ref;
|
57
|
+
}
|
58
|
+
if (xmlns) {
|
59
|
+
props.xmlns = xmlns;
|
60
|
+
}
|
61
|
+
if (preserveAspectRatio) {
|
62
|
+
props.preserveAspectRatio = preserveAspectRatio;
|
63
|
+
}
|
64
|
+
return /*#__PURE__*/React__default["default"].createElement('svg', props, children);
|
65
|
+
});
|
66
|
+
Icon.displayName = 'Icon';
|
67
|
+
Icon.propTypes = {
|
68
|
+
'aria-hidden': index$1["default"].oneOfType([index$1["default"].bool, index$1["default"].oneOf(['true', 'false'])]),
|
69
|
+
'aria-label': index$1["default"].string,
|
70
|
+
'aria-labelledby': index$1["default"].string,
|
71
|
+
children: index$1["default"].node,
|
72
|
+
className: index$1["default"].string,
|
73
|
+
height: index$1["default"].oneOfType([index$1["default"].number, index$1["default"].string]),
|
74
|
+
preserveAspectRatio: index$1["default"].string,
|
75
|
+
tabIndex: index$1["default"].oneOfType([index$1["default"].number, index$1["default"].string]),
|
76
|
+
viewBox: index$1["default"].string,
|
77
|
+
width: index$1["default"].oneOfType([index$1["default"].number, index$1["default"].string]),
|
78
|
+
xmlns: index$1["default"].string
|
79
|
+
};
|
80
|
+
|
81
|
+
exports["default"] = Icon;
|