@carbon-labs/react-ui-shell 0.86.0 → 0.88.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.
- package/es/components/HeaderContainer.js +2 -2
- package/es/components/HeaderDivider.js +2 -2
- package/es/components/HeaderOverflowPanel.js +5 -5
- package/es/components/HeaderPopover.js +6 -6
- package/es/components/Link.js +2 -2
- package/es/components/Profile.js +17 -17
- package/es/components/SharkFinIcon.js +6 -6
- package/es/components/SideNav.js +10 -10
- package/es/components/SideNavFlyoutMenu.js +9 -9
- package/es/components/SideNavItems.js +5 -5
- package/es/components/SideNavLink.js +7 -7
- package/es/components/SideNavLinkPopover.js +2 -2
- package/es/components/SideNavMenu.js +24 -24
- package/es/components/SideNavMenuItem.js +7 -7
- package/es/components/SideNavSlot.js +4 -4
- package/es/components/SideNavTitle.js +3 -3
- package/es/components/SideNavToggle.js +7 -7
- package/es/components/TrialCountdown.js +3 -3
- package/es/internal/useId.js +2 -2
- package/es/internal/useIdPrefix.js +3 -3
- package/es/internal/usePrefix.js +3 -3
- package/lib/components/HeaderContainer.js +10 -10
- package/lib/components/HeaderDivider.js +2 -2
- package/lib/components/HeaderOverflowPanel.js +5 -5
- package/lib/components/HeaderPopover.js +9 -9
- package/lib/components/Link.js +3 -3
- package/lib/components/Profile.js +17 -17
- package/lib/components/SharkFinIcon.js +6 -6
- package/lib/components/SideNav.js +23 -23
- package/lib/components/SideNavFlyoutMenu.js +22 -22
- package/lib/components/SideNavItems.js +8 -8
- package/lib/components/SideNavLink.js +9 -9
- package/lib/components/SideNavLinkPopover.js +2 -2
- package/lib/components/SideNavMenu.js +42 -42
- package/lib/components/SideNavMenuItem.js +8 -8
- package/lib/components/SideNavSlot.js +4 -4
- package/lib/components/SideNavTitle.js +3 -3
- package/lib/components/SideNavToggle.js +9 -9
- package/lib/components/TrialCountdown.js +3 -3
- package/lib/es/components/HeaderContainer.d.ts +2 -2
- package/lib/es/components/HeaderDivider.d.ts +2 -2
- package/lib/es/components/HeaderOverflowPanel.d.ts +2 -2
- package/lib/es/components/HeaderPopover.d.ts +4 -4
- package/lib/es/components/Link.d.ts +3 -3
- package/lib/es/components/Profile.d.ts +7 -7
- package/lib/es/components/SharkFinIcon.d.ts +2 -2
- package/lib/es/components/SideNav.d.ts +4 -4
- package/lib/es/components/SideNavFlyoutMenu.d.ts +2 -2
- package/lib/es/components/SideNavItems.d.ts +2 -2
- package/lib/es/components/SideNavLink.d.ts +2 -2
- package/lib/es/components/SideNavLinkPopover.d.ts +2 -2
- package/lib/es/components/SideNavMenu.d.ts +2 -2
- package/lib/es/components/SideNavMenuItem.d.ts +2 -2
- package/lib/es/components/SideNavSlot.d.ts +2 -2
- package/lib/es/components/SideNavTitle.d.ts +3 -3
- package/lib/es/components/SideNavToggle.d.ts +2 -2
- package/lib/es/components/TrialCountdown.d.ts +2 -2
- package/lib/es/internal/useIdPrefix.d.ts +2 -2
- package/lib/es/internal/usePrefix.d.ts +2 -2
- package/lib/internal/useDelayedState.js +5 -5
- package/lib/internal/useEvent.js +4 -4
- package/lib/internal/useId.js +5 -5
- package/lib/internal/useIdPrefix.js +3 -3
- package/lib/internal/useMatchMedia.js +3 -3
- package/lib/internal/useMergedRefs.js +2 -2
- package/lib/internal/usePrefix.js +3 -3
- package/package.json +4 -6
- package/scss/styles/_header-divider.scss +1 -0
- package/scss/styles/_header.scss +13 -1
- package/scss/styles/_profile.scss +4 -1
- package/LICENSE +0 -201
- package/es/node_modules/@carbon/ibm-products/es/_virtual/_commonjsHelpers.js +0 -12
- package/es/node_modules/@carbon/ibm-products/es/_virtual/_rollupPluginBabelHelpers.js +0 -18
- package/es/node_modules/@carbon/ibm-products/es/_virtual/index.js +0 -14
- package/es/node_modules/@carbon/ibm-products/es/_virtual/index2.js +0 -12
- package/es/node_modules/@carbon/ibm-products/es/components/TooltipTrigger/TooltipTrigger.js +0 -62
- package/es/node_modules/@carbon/ibm-products/es/components/UserAvatar/UserAvatar.js +0 -161
- package/es/node_modules/@carbon/ibm-products/es/components/_Canary/Canary.js +0 -49
- package/es/node_modules/@carbon/ibm-products/es/global/js/package-settings.js +0 -246
- package/es/node_modules/@carbon/ibm-products/es/global/js/utils/devtools.js +0 -16
- package/es/node_modules/@carbon/ibm-products/es/global/js/utils/pconsole.js +0 -35
- package/es/node_modules/@carbon/ibm-products/es/node_modules/object-assign/index.js +0 -89
- package/es/node_modules/@carbon/ibm-products/es/node_modules/prop-types/checkPropTypes.js +0 -95
- package/es/node_modules/@carbon/ibm-products/es/node_modules/prop-types/factoryWithThrowingShims.js +0 -64
- package/es/node_modules/@carbon/ibm-products/es/node_modules/prop-types/factoryWithTypeCheckers.js +0 -561
- package/es/node_modules/@carbon/ibm-products/es/node_modules/prop-types/index.js +0 -32
- package/es/node_modules/@carbon/ibm-products/es/node_modules/prop-types/lib/ReactPropTypesSecret.js +0 -18
- package/es/node_modules/@carbon/ibm-products/es/node_modules/prop-types/lib/has.js +0 -17
- package/es/node_modules/@carbon/ibm-products/es/settings.js +0 -84
- package/lib/node_modules/@carbon/ibm-products/es/_virtual/_commonjsHelpers.js +0 -14
- package/lib/node_modules/@carbon/ibm-products/es/_virtual/_rollupPluginBabelHelpers.js +0 -20
- package/lib/node_modules/@carbon/ibm-products/es/_virtual/index.js +0 -19
- package/lib/node_modules/@carbon/ibm-products/es/_virtual/index2.js +0 -14
- package/lib/node_modules/@carbon/ibm-products/es/components/TooltipTrigger/TooltipTrigger.js +0 -64
- package/lib/node_modules/@carbon/ibm-products/es/components/UserAvatar/UserAvatar.js +0 -163
- package/lib/node_modules/@carbon/ibm-products/es/components/_Canary/Canary.js +0 -51
- package/lib/node_modules/@carbon/ibm-products/es/global/js/package-settings.js +0 -252
- package/lib/node_modules/@carbon/ibm-products/es/global/js/utils/devtools.js +0 -20
- package/lib/node_modules/@carbon/ibm-products/es/global/js/utils/pconsole.js +0 -45
- package/lib/node_modules/@carbon/ibm-products/es/node_modules/object-assign/index.js +0 -91
- package/lib/node_modules/@carbon/ibm-products/es/node_modules/prop-types/checkPropTypes.js +0 -97
- package/lib/node_modules/@carbon/ibm-products/es/node_modules/prop-types/factoryWithThrowingShims.js +0 -66
- package/lib/node_modules/@carbon/ibm-products/es/node_modules/prop-types/factoryWithTypeCheckers.js +0 -563
- package/lib/node_modules/@carbon/ibm-products/es/node_modules/prop-types/index.js +0 -34
- package/lib/node_modules/@carbon/ibm-products/es/node_modules/prop-types/lib/ReactPropTypesSecret.js +0 -20
- package/lib/node_modules/@carbon/ibm-products/es/node_modules/prop-types/lib/has.js +0 -19
- package/lib/node_modules/@carbon/ibm-products/es/settings.js +0 -86
|
@@ -1,84 +0,0 @@
|
|
|
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 pkg$1 from './global/js/package-settings.js';
|
|
9
|
-
import React__default from 'react';
|
|
10
|
-
import pconsole from './global/js/utils/pconsole.js';
|
|
11
|
-
import { Canary } from './components/_Canary/Canary.js';
|
|
12
|
-
|
|
13
|
-
const componentDeprecatedWarning = (name, details) => `Carbon for IBM Products (WARNING): Component "${name}" is deprecated. ${details}`;
|
|
14
|
-
pkg$1.logDeprecated = (component, name) => {
|
|
15
|
-
if (component?.deprecated) {
|
|
16
|
-
const {
|
|
17
|
-
level,
|
|
18
|
-
details
|
|
19
|
-
} = component.deprecated;
|
|
20
|
-
const logUsing = pconsole?.[level] ?? pconsole.error;
|
|
21
|
-
logUsing(componentDeprecatedWarning(name || component.displayName, details));
|
|
22
|
-
}
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
// Check that a component is enabled. This function returns a stub which checks
|
|
26
|
-
// the component status on first use and then renders as the component or as
|
|
27
|
-
// a Canary placeholder initialized with the name of the replaced component.
|
|
28
|
-
// Note that the returned stub carries any other properties which had already
|
|
29
|
-
// been assigned (eg propTypes, displayName, etc).
|
|
30
|
-
pkg$1.checkComponentEnabled = (component, name) => {
|
|
31
|
-
if (component.render) {
|
|
32
|
-
// The component is a forward-ref, so make a stub forward-ref.
|
|
33
|
-
const forward = /*#__PURE__*/React__default.forwardRef((props, ref) => {
|
|
34
|
-
pkg$1.logDeprecated(component, name); // may log don't care about result
|
|
35
|
-
// Replace the stub's render fn so this test only happens once.
|
|
36
|
-
return (forward.render = pkg$1.isComponentEnabled(name) || !pkg$1.isComponentPublic(name) ?
|
|
37
|
-
// If the component is enabled, or if it's not a public component,
|
|
38
|
-
// replace the stub's render fn with the component's render fn.
|
|
39
|
-
component.render :
|
|
40
|
-
// Note that Canary is a direct render fn (not a forward-ref) and
|
|
41
|
-
// will ignore the passed props and ref (if any)
|
|
42
|
-
Canary.bind(undefined, {
|
|
43
|
-
componentName: name
|
|
44
|
-
}))(
|
|
45
|
-
// Call it now (after this it will be directly called).
|
|
46
|
-
props, ref);
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
// Transfer object properties already assigned (eg propTypes, displayName)
|
|
50
|
-
// then merge in the stub forward-ref which checks the component status
|
|
51
|
-
// when first used.
|
|
52
|
-
// NOTE: React 18 = displayName not iterable on render function
|
|
53
|
-
return Object.assign({}, component, {
|
|
54
|
-
displayName: component.displayName
|
|
55
|
-
}, forward);
|
|
56
|
-
} else {
|
|
57
|
-
// The component is a direct render fn, so make a stub render fn.
|
|
58
|
-
let render = props => {
|
|
59
|
-
pkg$1.logDeprecated(component, name); // may log don't care about result
|
|
60
|
-
// Replace the stub render fn so this test only happens once.
|
|
61
|
-
return (render = pkg$1.isComponentEnabled(name) || !pkg$1.isComponentPublic(name) ?
|
|
62
|
-
// If the component is enabled, or if it's not a public component,
|
|
63
|
-
// replace the stub render fn with the component render fn.
|
|
64
|
-
component :
|
|
65
|
-
// Replace the stub render fn with the Canary render fn, which will
|
|
66
|
-
// ignore the passed props.
|
|
67
|
-
Canary.bind(undefined, {
|
|
68
|
-
componentName: name
|
|
69
|
-
}))(
|
|
70
|
-
// Call it now (after this it will be directly called).
|
|
71
|
-
props);
|
|
72
|
-
};
|
|
73
|
-
|
|
74
|
-
// Transfer object properties already assigned (eg propTypes, displayName)
|
|
75
|
-
// to a function which calls the stub render fn which checks the component
|
|
76
|
-
// status when first used.
|
|
77
|
-
return Object.assign(props => render(props), component, {
|
|
78
|
-
displayName: component.displayName
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
};
|
|
82
|
-
const pkg = pkg$1;
|
|
83
|
-
|
|
84
|
-
export { pkg };
|
|
@@ -1,14 +0,0 @@
|
|
|
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;
|
|
@@ -1,20 +0,0 @@
|
|
|
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;
|
|
@@ -1,19 +0,0 @@
|
|
|
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/prop-types/index.js');
|
|
14
|
-
|
|
15
|
-
var propTypesExports = /*@__PURE__*/index.__require();
|
|
16
|
-
var PropTypes = /*@__PURE__*/_commonjsHelpers.getDefaultExportFromCjs(propTypesExports);
|
|
17
|
-
|
|
18
|
-
exports.default = PropTypes;
|
|
19
|
-
exports.p = propTypesExports;
|
|
@@ -1,14 +0,0 @@
|
|
|
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 propTypes = {
|
|
11
|
-
exports: {}
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
exports.__module = propTypes;
|
package/lib/node_modules/@carbon/ibm-products/es/components/TooltipTrigger/TooltipTrigger.js
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
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__default = require('react');
|
|
12
|
-
var index = require('../../_virtual/index.js');
|
|
13
|
-
var cx = require('classnames');
|
|
14
|
-
var settings = require('../../settings.js');
|
|
15
|
-
|
|
16
|
-
// The block part of our conventional BEM class names (blockClass__E--M).
|
|
17
|
-
const blockClass = `${settings.pkg.prefix}--tooltip-trigger`;
|
|
18
|
-
const componentName = 'TooltipTrigger';
|
|
19
|
-
|
|
20
|
-
// NOTE: the component SCSS is not imported here: it is rolled up separately.
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* This is an tooltip trigger as Carbon Tooltip requires an active element to work but provides
|
|
24
|
-
* no blanked button.
|
|
25
|
-
*/
|
|
26
|
-
const TooltipTrigger = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
27
|
-
let {
|
|
28
|
-
children,
|
|
29
|
-
className,
|
|
30
|
-
// Collect any other property values passed in.
|
|
31
|
-
...rest
|
|
32
|
-
} = _ref;
|
|
33
|
-
return /*#__PURE__*/React__default.createElement("button", _rollupPluginBabelHelpers.extends({
|
|
34
|
-
type: "button",
|
|
35
|
-
ref: ref
|
|
36
|
-
}, rest, {
|
|
37
|
-
className: cx(blockClass,
|
|
38
|
-
// Apply the block class to the main HTML element
|
|
39
|
-
className // Apply any supplied class names to the main HTML element.
|
|
40
|
-
)
|
|
41
|
-
}), children);
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
// Return a placeholder if not released and not enabled by feature flag.
|
|
45
|
-
|
|
46
|
-
// The display name of the component, used by React. Note that displayName
|
|
47
|
-
// is used in preference to relying on function.name.
|
|
48
|
-
TooltipTrigger.displayName = componentName;
|
|
49
|
-
|
|
50
|
-
// The types and DocGen commentary for the component props,
|
|
51
|
-
// in alphabetical order (for consistency).
|
|
52
|
-
// See https://www.npmjs.com/package/prop-types#usage.
|
|
53
|
-
TooltipTrigger.propTypes = {
|
|
54
|
-
/**
|
|
55
|
-
* Child content of tooltip trigger
|
|
56
|
-
*/
|
|
57
|
-
children: index.default.node,
|
|
58
|
-
/**
|
|
59
|
-
* Provide an optional class to be applied to the containing node.
|
|
60
|
-
*/
|
|
61
|
-
className: index.default.string
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
exports.TooltipTrigger = TooltipTrigger;
|
|
@@ -1,163 +0,0 @@
|
|
|
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__default = require('react');
|
|
12
|
-
var index = require('../../_virtual/index.js');
|
|
13
|
-
var cx = require('classnames');
|
|
14
|
-
var devtools = require('../../global/js/utils/devtools.js');
|
|
15
|
-
var settings = require('../../settings.js');
|
|
16
|
-
var react = require('@carbon/react');
|
|
17
|
-
var icons = require('@carbon/react/icons');
|
|
18
|
-
var TooltipTrigger = require('../TooltipTrigger/TooltipTrigger.js');
|
|
19
|
-
|
|
20
|
-
// Carbon and package components we use.
|
|
21
|
-
/* TODO: @import(s) of carbon components and other package components. */
|
|
22
|
-
|
|
23
|
-
// The block part of our conventional BEM class names (blockClass__E--M).
|
|
24
|
-
const blockClass = `${settings.pkg.prefix}--user-avatar`;
|
|
25
|
-
const componentName = 'UserAvatar';
|
|
26
|
-
|
|
27
|
-
// NOTE: the component SCSS is not imported here: it is rolled up separately.
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* TODO: A description of the component.
|
|
31
|
-
*/
|
|
32
|
-
|
|
33
|
-
const UserAvatar = /*#__PURE__*/React__default.forwardRef((props, ref) => {
|
|
34
|
-
const {
|
|
35
|
-
backgroundColor = 'order-1-cyan',
|
|
36
|
-
className,
|
|
37
|
-
image,
|
|
38
|
-
imageDescription,
|
|
39
|
-
name,
|
|
40
|
-
/* TODO: add other props for UserAvatar, with default values if needed */
|
|
41
|
-
renderIcon: RenderIcon,
|
|
42
|
-
size = 'md',
|
|
43
|
-
tooltipText,
|
|
44
|
-
tooltipAlignment = 'bottom',
|
|
45
|
-
...rest
|
|
46
|
-
} = props;
|
|
47
|
-
const carbonPrefix = react.usePrefix();
|
|
48
|
-
const iconSize = {
|
|
49
|
-
sm: 16,
|
|
50
|
-
md: 20,
|
|
51
|
-
lg: 24,
|
|
52
|
-
xl: 32
|
|
53
|
-
};
|
|
54
|
-
const formatInitials = () => {
|
|
55
|
-
const parts = name?.split(' ') || [];
|
|
56
|
-
const firstChar = parts[0].charAt(0).toUpperCase();
|
|
57
|
-
const secondChar = parts[0].charAt(1).toUpperCase();
|
|
58
|
-
if (parts.length === 1) {
|
|
59
|
-
return firstChar + secondChar;
|
|
60
|
-
}
|
|
61
|
-
const lastChar = parts[parts.length - 1].charAt(0).toUpperCase();
|
|
62
|
-
const initials = [firstChar];
|
|
63
|
-
if (lastChar) {
|
|
64
|
-
initials.push(lastChar);
|
|
65
|
-
}
|
|
66
|
-
return ''.concat(...initials);
|
|
67
|
-
};
|
|
68
|
-
const getItem = () => {
|
|
69
|
-
const iconProps = {
|
|
70
|
-
size: iconSize[size]
|
|
71
|
-
};
|
|
72
|
-
if (image) {
|
|
73
|
-
return /*#__PURE__*/React__default.createElement("img", {
|
|
74
|
-
alt: imageDescription,
|
|
75
|
-
src: image,
|
|
76
|
-
className: `${blockClass}__photo ${blockClass}__photo--${size}`
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
|
-
if (RenderIcon) {
|
|
80
|
-
return /*#__PURE__*/React__default.createElement(RenderIcon, iconProps);
|
|
81
|
-
}
|
|
82
|
-
if (name) {
|
|
83
|
-
return formatInitials();
|
|
84
|
-
}
|
|
85
|
-
return /*#__PURE__*/React__default.createElement(icons.User, iconProps);
|
|
86
|
-
};
|
|
87
|
-
const Avatar = () => /*#__PURE__*/React__default.createElement("div", _rollupPluginBabelHelpers.extends({}, rest, {
|
|
88
|
-
className: cx(blockClass,
|
|
89
|
-
// Apply the block class to the main HTML element
|
|
90
|
-
className,
|
|
91
|
-
// Apply any supplied class names to the main HTML element.
|
|
92
|
-
`${blockClass}--${backgroundColor}`, `${blockClass}--${size}`,
|
|
93
|
-
// example: `${blockClass}__template-string-class-${kind}-n-${size}`,
|
|
94
|
-
{
|
|
95
|
-
// switched classes dependant on props or state
|
|
96
|
-
// example: [`${blockClass}__here-if-small`]: size === 'sm',
|
|
97
|
-
}),
|
|
98
|
-
ref: ref
|
|
99
|
-
}, devtools.getDevtoolsProps(componentName)), getItem());
|
|
100
|
-
if (tooltipText) {
|
|
101
|
-
return /*#__PURE__*/React__default.createElement(react.Tooltip, {
|
|
102
|
-
align: tooltipAlignment,
|
|
103
|
-
label: tooltipText,
|
|
104
|
-
className: `${blockClass}__tooltip ${carbonPrefix}--icon-tooltip`
|
|
105
|
-
}, /*#__PURE__*/React__default.createElement(TooltipTrigger.TooltipTrigger, null, /*#__PURE__*/React__default.createElement(Avatar, null)));
|
|
106
|
-
}
|
|
107
|
-
return /*#__PURE__*/React__default.createElement(Avatar, null);
|
|
108
|
-
});
|
|
109
|
-
|
|
110
|
-
// Return a placeholder if not released and not enabled by feature flag
|
|
111
|
-
|
|
112
|
-
// The display name of the component, used by React. Note that displayName
|
|
113
|
-
// is used in preference to relying on function.name.
|
|
114
|
-
UserAvatar.displayName = componentName;
|
|
115
|
-
|
|
116
|
-
// The types and DocGen commentary for the component props,
|
|
117
|
-
// in alphabetical order (for consistency).
|
|
118
|
-
// See https://www.npmjs.com/package/prop-types#usage.
|
|
119
|
-
UserAvatar.propTypes = {
|
|
120
|
-
/**
|
|
121
|
-
* Provide the background color need to be set for UserAvatar. Background color will be set based on lighter or darker theme.
|
|
122
|
-
* For example: if you select order-5-purple, it will take $purple-60 for lighter theme and $purple-50 for darker theme.
|
|
123
|
-
*/
|
|
124
|
-
backgroundColor: index.default.oneOf(['order-1-cyan', 'order-2-gray', 'order-3-green', 'order-4-magenta', 'order-5-purple', 'order-6-teal', 'order-7-cyan', 'order-8-gray', 'order-9-green', 'order-10-magenta', 'order-11-purple', 'order-12-teal']),
|
|
125
|
-
/**
|
|
126
|
-
* Provide an optional class to be applied to the containing node.
|
|
127
|
-
*/
|
|
128
|
-
className: index.default.string,
|
|
129
|
-
/**
|
|
130
|
-
* When passing the image prop, supply a full path to the image to be displayed.
|
|
131
|
-
*/
|
|
132
|
-
/**@ts-ignore */
|
|
133
|
-
image: index.default.string,
|
|
134
|
-
/**
|
|
135
|
-
* When passing the image prop use the imageDescription prop to describe the image for screen reader.
|
|
136
|
-
*/
|
|
137
|
-
/**@ts-ignore */
|
|
138
|
-
imageDescription: index.default.string,
|
|
139
|
-
/**
|
|
140
|
-
* When passing the name prop, either send the initials to be used or the user's full name. The first two capital letters of the user's name will be used as the name.
|
|
141
|
-
*/
|
|
142
|
-
name: index.default.string,
|
|
143
|
-
/**
|
|
144
|
-
* Provide a custom icon to use if you need to use an icon other than the default one
|
|
145
|
-
*/
|
|
146
|
-
/**@ts-ignore */
|
|
147
|
-
renderIcon: index.default.oneOfType([index.default.func, index.default.object, index.default.string]),
|
|
148
|
-
/**
|
|
149
|
-
* Set the size of the avatar circle
|
|
150
|
-
*/
|
|
151
|
-
size: index.default.oneOf(['xl', 'lg', 'md', 'sm']),
|
|
152
|
-
/**
|
|
153
|
-
* Specify how the trigger should align with the tooltip
|
|
154
|
-
*/
|
|
155
|
-
tooltipAlignment: index.default.oneOf(['top', 'top-left', 'top-right', 'bottom', 'bottom-left', 'bottom-right', 'left', 'right']),
|
|
156
|
-
/**
|
|
157
|
-
* Pass in the display name to have it shown on hover
|
|
158
|
-
*/
|
|
159
|
-
tooltipText: index.default.string
|
|
160
|
-
/* TODO: add types and DocGen for all props. */
|
|
161
|
-
};
|
|
162
|
-
|
|
163
|
-
exports.UserAvatar = UserAvatar;
|
|
@@ -1,51 +0,0 @@
|
|
|
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__default = require('react');
|
|
12
|
-
var index = require('../../_virtual/index.js');
|
|
13
|
-
var cx = require('classnames');
|
|
14
|
-
var packageSettings = require('../../global/js/package-settings.js');
|
|
15
|
-
var react = require('@carbon/react');
|
|
16
|
-
|
|
17
|
-
var _p, _br, _p2, _br2, _p3;
|
|
18
|
-
|
|
19
|
-
// The block part of our conventional BEM class names (blockClass__E--M).
|
|
20
|
-
const blockClass = `${packageSettings.default.prefix}--canary`;
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Canary component used when the component requested is not yet production
|
|
24
|
-
*/
|
|
25
|
-
const Canary = (_ref /*, originalArgs*/) => {
|
|
26
|
-
let {
|
|
27
|
-
className,
|
|
28
|
-
componentName,
|
|
29
|
-
...rest
|
|
30
|
-
} = _ref;
|
|
31
|
-
const instructions = `
|
|
32
|
-
import { pkg } from '@carbon/ibm-products';
|
|
33
|
-
// NOTE: must happen before component is first used
|
|
34
|
-
pkg.component.${componentName} = true;
|
|
35
|
-
`;
|
|
36
|
-
return /*#__PURE__*/React__default.createElement("div", _rollupPluginBabelHelpers.extends({}, rest, {
|
|
37
|
-
className: cx(blockClass, className)
|
|
38
|
-
}), /*#__PURE__*/React__default.createElement("h2", null, "This component ", /*#__PURE__*/React__default.createElement("strong", null, componentName), " is not ready yet."), _p || (_p = /*#__PURE__*/React__default.createElement("p", null, "To enable it, initialize package flags before the component is first used.")), _br || (_br = /*#__PURE__*/React__default.createElement("br", null)), _p2 || (_p2 = /*#__PURE__*/React__default.createElement("p", null, "e.g. in main.js")), /*#__PURE__*/React__default.createElement(react.CodeSnippet, {
|
|
39
|
-
type: "multi"
|
|
40
|
-
}, instructions), _br2 || (_br2 = /*#__PURE__*/React__default.createElement("br", null)), _p3 || (_p3 = /*#__PURE__*/React__default.createElement("p", null, "View a live example on", ' ', /*#__PURE__*/React__default.createElement("a", {
|
|
41
|
-
href: "https://codesandbox.io/s/example-component-olif5?file=/src/config.js"
|
|
42
|
-
}, "codesandbox"), ".")));
|
|
43
|
-
};
|
|
44
|
-
Canary.propTypes = {
|
|
45
|
-
/** Provide an optional class to be applied to the containing node */
|
|
46
|
-
className: index.default.string,
|
|
47
|
-
/** Name of the component that is not ready yet */
|
|
48
|
-
componentName: index.default.string.isRequired
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
exports.Canary = Canary;
|
|
@@ -1,252 +0,0 @@
|
|
|
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
|
-
// Copyright IBM Corp. 2020, 2025
|
|
13
|
-
//
|
|
14
|
-
// This source code is licensed under the Apache-2.0 license found in the
|
|
15
|
-
// LICENSE file in the root directory of this source tree.
|
|
16
|
-
//
|
|
17
|
-
|
|
18
|
-
const defaults = {
|
|
19
|
-
prefix: 'c4p',
|
|
20
|
-
// by default only released components are set to true
|
|
21
|
-
component: {
|
|
22
|
-
// reviewed and released components:
|
|
23
|
-
AboutModal: true,
|
|
24
|
-
APIKeyModal: true,
|
|
25
|
-
Cascade: true,
|
|
26
|
-
Checklist: true,
|
|
27
|
-
CreateModal: true,
|
|
28
|
-
CreateFullPage: true,
|
|
29
|
-
CreateFullPageStep: true,
|
|
30
|
-
CreateSidePanel: true,
|
|
31
|
-
CreateTearsheetNarrow: true,
|
|
32
|
-
CreateTearsheet: true,
|
|
33
|
-
CreateTearsheetStep: true,
|
|
34
|
-
CreateTearsheetDivider: true,
|
|
35
|
-
Datagrid: true,
|
|
36
|
-
EditInPlace: true,
|
|
37
|
-
EmptyState: true,
|
|
38
|
-
ErrorEmptyState: true,
|
|
39
|
-
ExportModal: true,
|
|
40
|
-
ExpressiveCard: true,
|
|
41
|
-
FullPageError: true,
|
|
42
|
-
HTTPError403: true,
|
|
43
|
-
HTTPError404: true,
|
|
44
|
-
HTTPErrorOther: true,
|
|
45
|
-
ImportModal: true,
|
|
46
|
-
MultiAddSelect: true,
|
|
47
|
-
NotificationsPanel: true,
|
|
48
|
-
NoDataEmptyState: true,
|
|
49
|
-
NoTagsEmptyState: true,
|
|
50
|
-
NotFoundEmptyState: true,
|
|
51
|
-
NotificationsEmptyState: true,
|
|
52
|
-
OptionsTile: true,
|
|
53
|
-
PageHeader: true,
|
|
54
|
-
ProductiveCard: true,
|
|
55
|
-
RemoveModal: true,
|
|
56
|
-
Saving: true,
|
|
57
|
-
SidePanel: true,
|
|
58
|
-
SingleAddSelect: true,
|
|
59
|
-
StatusIcon: true,
|
|
60
|
-
TagSet: true,
|
|
61
|
-
Tearsheet: true,
|
|
62
|
-
TearsheetNarrow: true,
|
|
63
|
-
UnauthorizedEmptyState: true,
|
|
64
|
-
UserProfileImage: true,
|
|
65
|
-
WebTerminal: true,
|
|
66
|
-
WebTerminalContentWrapper: true,
|
|
67
|
-
WebTerminalProvider: true,
|
|
68
|
-
UserAvatar: true,
|
|
69
|
-
// other public components not yet reviewed and released:
|
|
70
|
-
Toolbar: false,
|
|
71
|
-
ToolbarButton: false,
|
|
72
|
-
ToolbarGroup: false,
|
|
73
|
-
EditSidePanel: false,
|
|
74
|
-
CancelableTextEdit: false,
|
|
75
|
-
DataSpreadsheet: false,
|
|
76
|
-
EditTearsheet: false,
|
|
77
|
-
EditTearsheetForm: false,
|
|
78
|
-
EditTearsheetNarrow: false,
|
|
79
|
-
EditFullPage: false,
|
|
80
|
-
EditUpdateCards: false,
|
|
81
|
-
Nav: false,
|
|
82
|
-
NavItem: false,
|
|
83
|
-
NavList: false,
|
|
84
|
-
BigNumber: false,
|
|
85
|
-
TruncatedList: false,
|
|
86
|
-
TruncatedText: false,
|
|
87
|
-
DelimitedList: false,
|
|
88
|
-
ScrollGradient: false,
|
|
89
|
-
StringFormatter: false,
|
|
90
|
-
StatusIndicator: false,
|
|
91
|
-
StatusIndicatorStep: false,
|
|
92
|
-
TagOverflow: false,
|
|
93
|
-
ActionBar: false,
|
|
94
|
-
FilterPanel: false,
|
|
95
|
-
FilterPanelAccordion: false,
|
|
96
|
-
FilterPanelAccordionItem: false,
|
|
97
|
-
FilterPanelCheckbox: false,
|
|
98
|
-
FilterPanelCheckboxWithOverflow: false,
|
|
99
|
-
FilterPanelGroup: false,
|
|
100
|
-
FilterPanelLabel: false,
|
|
101
|
-
FilterPanelSearch: false,
|
|
102
|
-
ConditionBuilder: false,
|
|
103
|
-
GetStartedCard: false,
|
|
104
|
-
/* new component flags here - comment used by generate CLI */
|
|
105
|
-
|
|
106
|
-
// Onboarding components not yet reviewed and released:
|
|
107
|
-
Coachmark: false,
|
|
108
|
-
CoachmarkBeacon: false,
|
|
109
|
-
CoachmarkButton: false,
|
|
110
|
-
CoachmarkFixed: false,
|
|
111
|
-
CoachmarkOverlayElement: false,
|
|
112
|
-
CoachmarkOverlayElements: false,
|
|
113
|
-
CoachmarkStack: false,
|
|
114
|
-
Decorator: false,
|
|
115
|
-
DecoratorLink: false,
|
|
116
|
-
DecoratorSingleButton: false,
|
|
117
|
-
DecoratorDualButton: false,
|
|
118
|
-
DescriptionList: false,
|
|
119
|
-
DescriptionListBody: false,
|
|
120
|
-
DescriptionListCell: false,
|
|
121
|
-
DescriptionListRow: false,
|
|
122
|
-
SearchBar: false,
|
|
123
|
-
/* new component flags here - comment used by generate CLI */
|
|
124
|
-
|
|
125
|
-
// Onboarding components not yet reviewed and released:
|
|
126
|
-
EmptyStateV2: false,
|
|
127
|
-
Guidebanner: false,
|
|
128
|
-
GuidebannerElement: false,
|
|
129
|
-
GuidebannerElementButton: false,
|
|
130
|
-
GuidebannerElementLink: false,
|
|
131
|
-
InlineTip: false,
|
|
132
|
-
InlineTipButton: false,
|
|
133
|
-
InlineTipLink: false,
|
|
134
|
-
InterstitialScreen: true,
|
|
135
|
-
NonLinearReading: false
|
|
136
|
-
},
|
|
137
|
-
// feature level flags
|
|
138
|
-
feature: {
|
|
139
|
-
'default-portal-target-body': true,
|
|
140
|
-
'Datagrid.useInlineEdit': false,
|
|
141
|
-
'Datagrid.useEditableCell': false,
|
|
142
|
-
'Datagrid.useCustomizeColumns': false,
|
|
143
|
-
'ExampleComponent.secondaryIcon': false,
|
|
144
|
-
'ExampleComponent.useExample': false
|
|
145
|
-
}
|
|
146
|
-
};
|
|
147
|
-
const warningMessageComponent = property => `Carbon for IBM Products (WARNING): Component "${property}" enabled via feature flags. This component has not yet completed its review process.`;
|
|
148
|
-
const warningMessageFeature = property => `Carbon for IBM Products (WARNING): Feature "${property}" enabled via feature flags.`;
|
|
149
|
-
const errorMessageFeature = property => `Carbon for IBM Products (Error): Feature "${property}" not enabled. To enable see the notes on feature flags in the README.`;
|
|
150
|
-
const warningMessageAllComponents = 'Carbon for IBM Products (WARNING): All components enabled through use of setAllComponents. This includes components that have not yet completed their review process.';
|
|
151
|
-
const warningMessageAllFeatures = 'Carbon for IBM Products (WARNING): All features enabled through use of setAllFeatures';
|
|
152
|
-
|
|
153
|
-
// Values to represent overrides for component or feature settings.
|
|
154
|
-
// Each value maps the initial value to the value that should be returned.
|
|
155
|
-
const all = {
|
|
156
|
-
INITIAL: v => v,
|
|
157
|
-
ON: () => true,
|
|
158
|
-
OFF: () => false
|
|
159
|
-
};
|
|
160
|
-
let allComponents = all.INITIAL;
|
|
161
|
-
let allFeatures = all.INITIAL;
|
|
162
|
-
let silent = false;
|
|
163
|
-
const component = new Proxy({
|
|
164
|
-
...defaults.component
|
|
165
|
-
}, {
|
|
166
|
-
set(target, property, value) {
|
|
167
|
-
if (target[property] !== true && !silent && value) {
|
|
168
|
-
// not already true, not silent, and now true
|
|
169
|
-
console.warn(warningMessageComponent(property));
|
|
170
|
-
}
|
|
171
|
-
target[property] = value;
|
|
172
|
-
return true; // value set
|
|
173
|
-
},
|
|
174
|
-
get(target, property) {
|
|
175
|
-
return allComponents(target[property] ?? false);
|
|
176
|
-
}
|
|
177
|
-
});
|
|
178
|
-
const feature = new Proxy({
|
|
179
|
-
...defaults.feature
|
|
180
|
-
}, {
|
|
181
|
-
set(target, property, value) {
|
|
182
|
-
// If we receive a feature flag that doesn't exist in our defaults we should not log
|
|
183
|
-
// a warning message and instead just return
|
|
184
|
-
if (!Object.getOwnPropertyDescriptor(defaults.feature, property)) {
|
|
185
|
-
return true;
|
|
186
|
-
}
|
|
187
|
-
if (target[property] !== true && !silent && value) {
|
|
188
|
-
// not already true, not silent, and now true
|
|
189
|
-
console.warn(warningMessageFeature(property));
|
|
190
|
-
}
|
|
191
|
-
target[property] = value;
|
|
192
|
-
return true; // value set
|
|
193
|
-
},
|
|
194
|
-
get(target, property) {
|
|
195
|
-
return allFeatures(target[property] ?? false);
|
|
196
|
-
}
|
|
197
|
-
});
|
|
198
|
-
const devtoolsAttribute = 'data-carbon-devtools-id';
|
|
199
|
-
function getDevtoolsId(componentName) {
|
|
200
|
-
return `${defaults.prefix}--${componentName}`;
|
|
201
|
-
}
|
|
202
|
-
var pkg = {
|
|
203
|
-
devtoolsAttribute,
|
|
204
|
-
getDevtoolsId,
|
|
205
|
-
prefix: defaults.prefix,
|
|
206
|
-
component: component,
|
|
207
|
-
feature: feature,
|
|
208
|
-
isComponentEnabled: function (componentOrName) {
|
|
209
|
-
let byDefault = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
210
|
-
const componentName = componentOrName?.displayName || componentOrName?.name || componentOrName;
|
|
211
|
-
return byDefault ? defaults.component[componentName] : component[componentName];
|
|
212
|
-
},
|
|
213
|
-
isComponentPublic: function (componentOrName) {
|
|
214
|
-
let byDefault = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
215
|
-
const componentName = componentOrName?.displayName || componentOrName?.name || componentOrName;
|
|
216
|
-
return Object.prototype.hasOwnProperty.call(byDefault ? defaults.component : component, componentName);
|
|
217
|
-
},
|
|
218
|
-
isFeatureEnabled: function (featureName) {
|
|
219
|
-
let byDefault = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
220
|
-
return byDefault ? defaults.feature[featureName] : feature[featureName];
|
|
221
|
-
},
|
|
222
|
-
checkReportFeatureEnabled(featureName) {
|
|
223
|
-
if (feature[featureName]) {
|
|
224
|
-
// NOTE: Warning emitted if feature flag is enabled (see Proxy above)
|
|
225
|
-
return true;
|
|
226
|
-
} else {
|
|
227
|
-
console.error(errorMessageFeature(featureName));
|
|
228
|
-
}
|
|
229
|
-
},
|
|
230
|
-
isFeaturePublic: function (featureName) {
|
|
231
|
-
let byDefault = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
232
|
-
return Object.prototype.hasOwnProperty.call(byDefault ? defaults.feature : feature, featureName);
|
|
233
|
-
},
|
|
234
|
-
setAllComponents: enabled => {
|
|
235
|
-
enabled === true && !silent && console.warn(warningMessageAllComponents);
|
|
236
|
-
allComponents = enabled === true ? all.ON : enabled === false ? all.OFF : all.INITIAL;
|
|
237
|
-
},
|
|
238
|
-
setAllFeatures: enabled => {
|
|
239
|
-
enabled === true && !silent && console.warn(warningMessageAllFeatures);
|
|
240
|
-
allFeatures = enabled === true ? all.ON : enabled === false ? all.OFF : all.INITIAL;
|
|
241
|
-
},
|
|
242
|
-
_silenceWarnings: value => {
|
|
243
|
-
// This will suppress console warnings when components or feature flags
|
|
244
|
-
// are enabled, and should only be used when this is not an issue, such
|
|
245
|
-
// as in internal test suites and storybook builds.
|
|
246
|
-
silent = value;
|
|
247
|
-
}
|
|
248
|
-
};
|
|
249
|
-
|
|
250
|
-
exports.default = pkg;
|
|
251
|
-
exports.devtoolsAttribute = devtoolsAttribute;
|
|
252
|
-
exports.getDevtoolsId = getDevtoolsId;
|