@carbon/react 1.0.0-rc.0 → 1.0.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/Accordion/Accordion.Skeleton.js +1 -7
- package/es/components/Accordion/AccordionItem.js +0 -5
- package/es/components/Button/Button.Skeleton.js +1 -3
- package/es/components/Button/Button.js +51 -113
- package/es/components/Checkbox/Checkbox.js +8 -21
- package/es/components/CodeSnippet/CodeSnippet.js +3 -11
- package/es/components/ComboBox/ComboBox.js +2 -4
- package/es/components/ContentSwitcher/index.js +13 -0
- package/es/components/DataTable/DataTable.js +5 -14
- package/es/components/DataTable/Table.js +3 -11
- package/es/components/DataTable/TableBatchAction.js +2 -1
- package/es/components/DataTable/TableExpandHeader.js +1 -1
- package/es/components/DataTable/TableToolbar.js +1 -2
- package/es/components/DataTable/TableToolbarSearch.js +4 -13
- package/es/components/DatePickerInput/next/DatePickerInput.js +6 -31
- package/es/components/Dropdown/Dropdown.Skeleton.js +4 -13
- package/es/components/Dropdown/Dropdown.js +4 -9
- package/es/components/ExpandableSearch/ExpandableSearch.js +16 -22
- package/es/components/FormGroup/FormGroup.js +4 -14
- package/es/components/IconButton/index.js +0 -1
- package/es/components/InlineLoading/InlineLoading.js +2 -9
- package/es/components/ListBox/ListBox.js +10 -0
- package/es/components/Modal/next/Modal.js +5 -8
- package/es/components/MultiSelect/FilterableMultiSelect.js +1 -2
- package/es/components/MultiSelect/MultiSelect.js +2 -3
- package/es/components/MultiSelect/next/FilterableMultiSelect.js +1 -2
- package/es/components/Notification/next/Notification.js +18 -39
- package/es/components/OverflowMenuItem/OverflowMenuItem.js +1 -9
- package/es/components/RadioTile/RadioTile.js +6 -13
- package/es/components/Search/index.js +3 -3
- package/es/components/Search/next/Search.js +25 -20
- package/es/components/Select/Select.js +6 -14
- package/es/components/Slider/Slider.js +4 -14
- package/es/components/StructuredList/next/StructuredList.js +7 -11
- package/es/components/TextInput/ControlledPasswordInput.js +2 -2
- package/es/components/Tile/next/Tile.js +12 -51
- package/es/components/TileGroup/index.js +13 -0
- package/es/components/TimePickerSelect/next/TimePickerSelect.js +0 -6
- package/es/components/Tooltip/next/DefinitionTooltip.js +1 -1
- package/es/index.js +4 -6
- package/es/internal/ComponentToggle.js +1 -0
- package/lib/components/Accordion/Accordion.Skeleton.js +1 -7
- package/lib/components/Accordion/AccordionItem.js +0 -5
- package/lib/components/Button/Button.Skeleton.js +1 -3
- package/lib/components/Button/Button.js +49 -130
- package/lib/components/Checkbox/Checkbox.js +8 -21
- package/lib/components/CodeSnippet/CodeSnippet.js +3 -11
- package/lib/components/ComboBox/ComboBox.js +2 -4
- package/lib/components/ContentSwitcher/index.js +17 -0
- package/lib/components/DataTable/DataTable.js +5 -33
- package/lib/components/DataTable/Table.js +3 -30
- package/lib/components/DataTable/TableBatchAction.js +2 -1
- package/lib/components/DataTable/TableExpandHeader.js +1 -1
- package/lib/components/DataTable/TableToolbar.js +1 -21
- package/lib/components/DataTable/TableToolbarSearch.js +4 -13
- package/lib/components/DatePickerInput/next/DatePickerInput.js +5 -30
- package/lib/components/Dropdown/Dropdown.Skeleton.js +4 -13
- package/lib/components/Dropdown/Dropdown.js +4 -9
- package/lib/components/ExpandableSearch/ExpandableSearch.js +15 -21
- package/lib/components/FormGroup/FormGroup.js +3 -13
- package/lib/components/IconButton/index.js +0 -1
- package/lib/components/InlineLoading/InlineLoading.js +2 -9
- package/lib/components/ListBox/ListBox.js +10 -0
- package/lib/components/Modal/next/Modal.js +5 -8
- package/lib/components/MultiSelect/FilterableMultiSelect.js +1 -2
- package/lib/components/MultiSelect/MultiSelect.js +2 -3
- package/lib/components/MultiSelect/next/FilterableMultiSelect.js +1 -2
- package/lib/components/Notification/next/Notification.js +18 -39
- package/lib/components/OverflowMenuItem/OverflowMenuItem.js +1 -9
- package/lib/components/RadioTile/RadioTile.js +6 -13
- package/lib/components/Search/next/Search.js +25 -20
- package/lib/components/Select/Select.js +6 -33
- package/lib/components/Slider/Slider.js +4 -14
- package/lib/components/StructuredList/next/StructuredList.js +7 -11
- package/lib/components/TextInput/ControlledPasswordInput.js +2 -2
- package/lib/components/Tile/next/Tile.js +12 -51
- package/lib/components/TileGroup/index.js +17 -0
- package/lib/components/TimePickerSelect/next/TimePickerSelect.js +0 -6
- package/lib/components/Tooltip/next/DefinitionTooltip.js +1 -1
- package/lib/index.js +94 -98
- package/lib/internal/ComponentToggle.js +1 -0
- package/package.json +9 -9
- package/es/components/TooltipDefinition/TooltipDefinition.js +0 -167
- package/es/components/TooltipIcon/TooltipIcon.js +0 -235
- package/es/tools/createPropAdapter.js +0 -63
- package/lib/components/TooltipDefinition/TooltipDefinition.js +0 -178
- package/lib/components/TooltipIcon/TooltipIcon.js +0 -245
- package/lib/tools/createPropAdapter.js +0 -67
|
@@ -11,7 +11,6 @@ import React__default from 'react';
|
|
|
11
11
|
import cx from 'classnames';
|
|
12
12
|
import { ChevronRight } from '@carbon/icons-react';
|
|
13
13
|
import SkeletonText from '../SkeletonText/SkeletonText.js';
|
|
14
|
-
import deprecate from '../../prop-types/deprecate.js';
|
|
15
14
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
16
15
|
|
|
17
16
|
var _SkeletonText, _SkeletonText2, _SkeletonText3;
|
|
@@ -74,12 +73,7 @@ AccordionSkeleton.propTypes = {
|
|
|
74
73
|
/**
|
|
75
74
|
* `false` to not display the first item opened
|
|
76
75
|
*/
|
|
77
|
-
open: PropTypes.bool
|
|
78
|
-
|
|
79
|
-
/**
|
|
80
|
-
* Set unique identifier to generate unique item keys
|
|
81
|
-
*/
|
|
82
|
-
uid: deprecate(PropTypes.any)
|
|
76
|
+
open: PropTypes.bool
|
|
83
77
|
};
|
|
84
78
|
AccordionSkeleton.defaultProps = {
|
|
85
79
|
open: true,
|
|
@@ -140,11 +140,6 @@ AccordionItem.propTypes = {
|
|
|
140
140
|
*/
|
|
141
141
|
disabled: PropTypes.bool,
|
|
142
142
|
|
|
143
|
-
/**
|
|
144
|
-
* The description of the expand icon.
|
|
145
|
-
*/
|
|
146
|
-
iconDescription: deprecate(PropTypes.string, 'The `iconDescription` prop has been deprecated as it is no longer ' + 'required. Feel free to remove this prop from <AccordionItem>. This ' + 'prop will be removed in the next major release of ' + '`carbon-components-react`'),
|
|
147
|
-
|
|
148
143
|
/**
|
|
149
144
|
* The handler of the massaged `click` event.
|
|
150
145
|
*/
|
|
@@ -9,7 +9,6 @@ import { objectWithoutProperties as _objectWithoutProperties, defineProperty as
|
|
|
9
9
|
import PropTypes from 'prop-types';
|
|
10
10
|
import React__default from 'react';
|
|
11
11
|
import cx from 'classnames';
|
|
12
|
-
import { useFeatureFlag } from '../FeatureFlags/index.js';
|
|
13
12
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
14
13
|
import * as FeatureFlags from '@carbon/feature-flags';
|
|
15
14
|
|
|
@@ -26,9 +25,8 @@ var ButtonSkeleton = function ButtonSkeleton(_ref) {
|
|
|
26
25
|
size = _ref$size === void 0 ? FeatureFlags.enabled('enable-v11-release') ? 'lg' : 'default' : _ref$size,
|
|
27
26
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
28
27
|
|
|
29
|
-
var enabled = useFeatureFlag('enable-v11-release');
|
|
30
28
|
var prefix = usePrefix();
|
|
31
|
-
var buttonClasses = cx(className, (_cx = {}, _defineProperty(_cx, "".concat(prefix, "--skeleton"), true), _defineProperty(_cx, "".concat(prefix, "--btn"), true), _defineProperty(_cx, "".concat(prefix, "--btn--sm"), small || size === 'sm'), _defineProperty(_cx, "".concat(prefix, "--btn--md"), size === 'field' || size === 'md'), _defineProperty(_cx, "".concat(prefix, "--btn--
|
|
29
|
+
var buttonClasses = cx(className, (_cx = {}, _defineProperty(_cx, "".concat(prefix, "--skeleton"), true), _defineProperty(_cx, "".concat(prefix, "--btn"), true), _defineProperty(_cx, "".concat(prefix, "--btn--sm"), small || size === 'sm'), _defineProperty(_cx, "".concat(prefix, "--btn--md"), size === 'field' || size === 'md'), _defineProperty(_cx, "".concat(prefix, "--btn--xl"), size === 'xl'), _defineProperty(_cx, "".concat(prefix, "--btn--2xl"), size === '2xl'), _cx));
|
|
32
30
|
|
|
33
31
|
var commonProps = _objectSpread2({
|
|
34
32
|
className: buttonClasses
|
|
@@ -5,22 +5,17 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import { objectWithoutProperties as _objectWithoutProperties,
|
|
8
|
+
import { objectWithoutProperties as _objectWithoutProperties, defineProperty as _defineProperty, objectSpread2 as _objectSpread2, extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
9
9
|
import PropTypes from 'prop-types';
|
|
10
|
-
import React__default, {
|
|
10
|
+
import React__default, { useRef } from 'react';
|
|
11
11
|
import cx from 'classnames';
|
|
12
12
|
import { ButtonKinds } from '../../prop-types/types.js';
|
|
13
|
-
import
|
|
13
|
+
import { IconButton } from '../IconButton/index.js';
|
|
14
14
|
import { composeEventHandlers } from '../../tools/events.js';
|
|
15
15
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
16
16
|
import { useId } from '../../internal/useId.js';
|
|
17
|
-
import toggleClass from '../../tools/toggleClass.js';
|
|
18
|
-
import { useFeatureFlag } from '../FeatureFlags/index.js';
|
|
19
|
-
import * as FeatureFlags from '@carbon/feature-flags';
|
|
20
|
-
import { matches } from '../../internal/keyboard/match.js';
|
|
21
|
-
import { Escape } from '../../internal/keyboard/keys.js';
|
|
22
17
|
|
|
23
|
-
var _excluded = ["as", "children", "className", "dangerDescription", "disabled", "hasIconOnly", "href", "iconDescription", "isExpressive", "isSelected", "kind", "onBlur", "onClick", "onFocus", "onMouseEnter", "onMouseLeave", "renderIcon", "size", "
|
|
18
|
+
var _excluded = ["as", "children", "className", "dangerDescription", "disabled", "hasIconOnly", "href", "iconDescription", "isExpressive", "isSelected", "kind", "onBlur", "onClick", "onFocus", "onMouseEnter", "onMouseLeave", "renderIcon", "size", "tabIndex", "tooltipAlignment", "tooltipPosition", "type"];
|
|
24
19
|
var Button = /*#__PURE__*/React__default.forwardRef(function Button(_ref, ref) {
|
|
25
20
|
var _classNames;
|
|
26
21
|
|
|
@@ -47,8 +42,7 @@ var Button = /*#__PURE__*/React__default.forwardRef(function Button(_ref, ref) {
|
|
|
47
42
|
onMouseLeave = _ref.onMouseLeave,
|
|
48
43
|
ButtonImageElement = _ref.renderIcon,
|
|
49
44
|
_ref$size = _ref.size,
|
|
50
|
-
size = _ref$size === void 0 ?
|
|
51
|
-
small = _ref.small,
|
|
45
|
+
size = _ref$size === void 0 ? 'lg' : _ref$size,
|
|
52
46
|
_ref$tabIndex = _ref.tabIndex,
|
|
53
47
|
tabIndex = _ref$tabIndex === void 0 ? 0 : _ref$tabIndex,
|
|
54
48
|
_ref$tooltipAlignment = _ref.tooltipAlignment,
|
|
@@ -59,99 +53,18 @@ var Button = /*#__PURE__*/React__default.forwardRef(function Button(_ref, ref) {
|
|
|
59
53
|
type = _ref$type === void 0 ? 'button' : _ref$type,
|
|
60
54
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
61
55
|
|
|
62
|
-
var _useState = useState(false),
|
|
63
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
64
|
-
allowTooltipVisibility = _useState2[0],
|
|
65
|
-
setAllowTooltipVisibility = _useState2[1];
|
|
66
|
-
|
|
67
|
-
var _useState3 = useState(false),
|
|
68
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
69
|
-
isHovered = _useState4[0],
|
|
70
|
-
setIsHovered = _useState4[1];
|
|
71
|
-
|
|
72
|
-
var _useState5 = useState(false),
|
|
73
|
-
_useState6 = _slicedToArray(_useState5, 2),
|
|
74
|
-
isFocused = _useState6[0],
|
|
75
|
-
setIsFocused = _useState6[1];
|
|
76
|
-
|
|
77
56
|
var tooltipRef = useRef(null);
|
|
78
|
-
var tooltipTimeout = useRef(null);
|
|
79
57
|
var prefix = usePrefix();
|
|
80
58
|
|
|
81
|
-
var closeTooltips = function closeTooltips(evt) {
|
|
82
|
-
var _document;
|
|
83
|
-
|
|
84
|
-
var tooltipNode = (_document = document) === null || _document === void 0 ? void 0 : _document.querySelectorAll(".".concat(prefix, "--tooltip--a11y"));
|
|
85
|
-
|
|
86
|
-
_toConsumableArray(tooltipNode).map(function (node) {
|
|
87
|
-
toggleClass(node, "".concat(prefix, "--tooltip--hidden"), node !== evt.currentTarget);
|
|
88
|
-
});
|
|
89
|
-
};
|
|
90
|
-
|
|
91
|
-
var handleFocus = function handleFocus(evt) {
|
|
92
|
-
if (hasIconOnly) {
|
|
93
|
-
closeTooltips(evt);
|
|
94
|
-
setIsFocused(true);
|
|
95
|
-
setAllowTooltipVisibility(true);
|
|
96
|
-
}
|
|
97
|
-
};
|
|
98
|
-
|
|
99
|
-
var handleBlur = function handleBlur() {
|
|
100
|
-
if (hasIconOnly) {
|
|
101
|
-
setIsHovered(false);
|
|
102
|
-
setIsFocused(false);
|
|
103
|
-
setAllowTooltipVisibility(false);
|
|
104
|
-
}
|
|
105
|
-
};
|
|
106
|
-
|
|
107
|
-
var handleMouseEnter = function handleMouseEnter(evt) {
|
|
108
|
-
if (hasIconOnly) {
|
|
109
|
-
tooltipTimeout.current && clearTimeout(tooltipTimeout.current);
|
|
110
|
-
|
|
111
|
-
if (evt.target === tooltipRef.current) {
|
|
112
|
-
setAllowTooltipVisibility(true);
|
|
113
|
-
return;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
closeTooltips(evt);
|
|
117
|
-
setAllowTooltipVisibility(true);
|
|
118
|
-
}
|
|
119
|
-
};
|
|
120
|
-
|
|
121
|
-
var handleMouseLeave = function handleMouseLeave() {
|
|
122
|
-
if (!isFocused && hasIconOnly) {
|
|
123
|
-
tooltipTimeout.current = setTimeout(function () {
|
|
124
|
-
setAllowTooltipVisibility(false);
|
|
125
|
-
setIsHovered(false);
|
|
126
|
-
}, 100);
|
|
127
|
-
}
|
|
128
|
-
};
|
|
129
|
-
|
|
130
59
|
var handleClick = function handleClick(evt) {
|
|
131
60
|
// Prevent clicks on the tooltip from triggering the button click event
|
|
132
|
-
setAllowTooltipVisibility(false);
|
|
133
|
-
|
|
134
61
|
if (evt.target === tooltipRef.current) {
|
|
135
62
|
evt.preventDefault();
|
|
136
63
|
return;
|
|
137
64
|
}
|
|
138
65
|
};
|
|
139
66
|
|
|
140
|
-
|
|
141
|
-
var handleEscKeyDown = function handleEscKeyDown(event) {
|
|
142
|
-
if (matches(event, [Escape])) {
|
|
143
|
-
setAllowTooltipVisibility(false);
|
|
144
|
-
setIsHovered(false);
|
|
145
|
-
}
|
|
146
|
-
};
|
|
147
|
-
|
|
148
|
-
document.addEventListener('keydown', handleEscKeyDown);
|
|
149
|
-
return function () {
|
|
150
|
-
return document.removeEventListener('keydown', handleEscKeyDown);
|
|
151
|
-
};
|
|
152
|
-
}, []);
|
|
153
|
-
var enabled = useFeatureFlag('enable-v11-release');
|
|
154
|
-
var buttonClasses = cx(className, (_classNames = {}, _defineProperty(_classNames, "".concat(prefix, "--btn"), true), _defineProperty(_classNames, "".concat(prefix, "--btn--sm"), size === 'small' && !isExpressive || size === 'sm' && !isExpressive || small && !isExpressive), _defineProperty(_classNames, "".concat(prefix, "--btn--md"), size === 'field' && !isExpressive || size === 'md' && !isExpressive), _defineProperty(_classNames, "".concat(prefix, "--btn--lg"), enabled ? size === 'xl' : size === 'lg'), _defineProperty(_classNames, "".concat(prefix, "--btn--xl"), enabled ? size === '2xl' : size === 'xl'), _defineProperty(_classNames, "".concat(prefix, "--btn--").concat(kind), kind), _defineProperty(_classNames, "".concat(prefix, "--btn--disabled"), disabled), _defineProperty(_classNames, "".concat(prefix, "--btn--expressive"), isExpressive), _defineProperty(_classNames, "".concat(prefix, "--tooltip--visible"), isHovered), _defineProperty(_classNames, "".concat(prefix, "--tooltip--hidden"), hasIconOnly && !allowTooltipVisibility), _defineProperty(_classNames, "".concat(prefix, "--btn--icon-only"), hasIconOnly), _defineProperty(_classNames, "".concat(prefix, "--btn--selected"), hasIconOnly && isSelected && kind === 'ghost'), _defineProperty(_classNames, "".concat(prefix, "--tooltip__trigger"), hasIconOnly), _defineProperty(_classNames, "".concat(prefix, "--tooltip--a11y"), hasIconOnly), _defineProperty(_classNames, "".concat(prefix, "--btn--icon-only--").concat(tooltipPosition), hasIconOnly && tooltipPosition), _defineProperty(_classNames, "".concat(prefix, "--tooltip--align-").concat(tooltipAlignment), hasIconOnly && tooltipAlignment), _classNames));
|
|
67
|
+
var buttonClasses = cx(className, (_classNames = {}, _defineProperty(_classNames, "".concat(prefix, "--btn"), true), _defineProperty(_classNames, "".concat(prefix, "--btn--sm"), size === 'sm' && !isExpressive), _defineProperty(_classNames, "".concat(prefix, "--btn--md"), size === 'md' && !isExpressive), _defineProperty(_classNames, "".concat(prefix, "--btn--xl"), size === 'xl'), _defineProperty(_classNames, "".concat(prefix, "--btn--2xl"), size === '2xl'), _defineProperty(_classNames, "".concat(prefix, "--btn--").concat(kind), kind), _defineProperty(_classNames, "".concat(prefix, "--btn--disabled"), disabled), _defineProperty(_classNames, "".concat(prefix, "--btn--expressive"), isExpressive), _defineProperty(_classNames, "".concat(prefix, "--btn--icon-only"), hasIconOnly), _defineProperty(_classNames, "".concat(prefix, "--btn--selected"), hasIconOnly && isSelected && kind === 'ghost'), _classNames));
|
|
155
68
|
var commonProps = {
|
|
156
69
|
tabIndex: tabIndex,
|
|
157
70
|
className: buttonClasses,
|
|
@@ -162,6 +75,7 @@ var Button = /*#__PURE__*/React__default.forwardRef(function Button(_ref, ref) {
|
|
|
162
75
|
className: "".concat(prefix, "--btn__icon"),
|
|
163
76
|
"aria-hidden": "true"
|
|
164
77
|
});
|
|
78
|
+
var iconOnlyImage = !ButtonImageElement ? null : /*#__PURE__*/React__default.createElement(ButtonImageElement, null);
|
|
165
79
|
var dangerButtonVariants = ['danger', 'danger--tertiary', 'danger--ghost'];
|
|
166
80
|
var component = 'button';
|
|
167
81
|
var assistiveId = useId('danger-description');
|
|
@@ -176,13 +90,7 @@ var Button = /*#__PURE__*/React__default.forwardRef(function Button(_ref, ref) {
|
|
|
176
90
|
};
|
|
177
91
|
var assistiveText;
|
|
178
92
|
|
|
179
|
-
if (
|
|
180
|
-
assistiveText = /*#__PURE__*/React__default.createElement("div", {
|
|
181
|
-
ref: tooltipRef,
|
|
182
|
-
onMouseEnter: handleMouseEnter,
|
|
183
|
-
className: "".concat(prefix, "--assistive-text")
|
|
184
|
-
}, iconDescription);
|
|
185
|
-
} else if (dangerButtonVariants.includes(kind)) {
|
|
93
|
+
if (dangerButtonVariants.includes(kind)) {
|
|
186
94
|
assistiveText = /*#__PURE__*/React__default.createElement("span", {
|
|
187
95
|
id: assistiveId,
|
|
188
96
|
className: "".concat(prefix, "--visually-hidden")
|
|
@@ -199,13 +107,49 @@ var Button = /*#__PURE__*/React__default.forwardRef(function Button(_ref, ref) {
|
|
|
199
107
|
otherProps = anchorProps;
|
|
200
108
|
}
|
|
201
109
|
|
|
202
|
-
|
|
203
|
-
onMouseEnter:
|
|
204
|
-
onMouseLeave:
|
|
205
|
-
onFocus:
|
|
206
|
-
onBlur:
|
|
207
|
-
onClick:
|
|
110
|
+
var Button = /*#__PURE__*/React__default.createElement(component, _objectSpread2(_objectSpread2(_objectSpread2({
|
|
111
|
+
onMouseEnter: onMouseEnter,
|
|
112
|
+
onMouseLeave: onMouseLeave,
|
|
113
|
+
onFocus: onFocus,
|
|
114
|
+
onBlur: onBlur,
|
|
115
|
+
onClick: onClick
|
|
208
116
|
}, rest), commonProps), otherProps), assistiveText, children, buttonImage);
|
|
117
|
+
|
|
118
|
+
if (hasIconOnly) {
|
|
119
|
+
var align;
|
|
120
|
+
|
|
121
|
+
if (tooltipPosition === 'top' || tooltipPosition === 'bottom') {
|
|
122
|
+
if (tooltipAlignment === 'center') {
|
|
123
|
+
align = tooltipPosition;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
if (tooltipAlignment === 'end') {
|
|
127
|
+
align = "".concat(tooltipPosition, "-right");
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
if (tooltipAlignment === 'start') {
|
|
131
|
+
align = "".concat(tooltipPosition, "-left");
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
if (tooltipPosition === 'right' || tooltipPosition === 'left') {
|
|
136
|
+
align = tooltipPosition;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
return /*#__PURE__*/React__default.createElement(IconButton, _extends({
|
|
140
|
+
align: align,
|
|
141
|
+
label: iconDescription,
|
|
142
|
+
kind: kind,
|
|
143
|
+
size: size,
|
|
144
|
+
onMouseEnter: onMouseEnter,
|
|
145
|
+
onMouseLeave: onMouseLeave,
|
|
146
|
+
onFocus: onFocus,
|
|
147
|
+
onBlur: onBlur,
|
|
148
|
+
onClick: composeEventHandlers([onClick, handleClick])
|
|
149
|
+
}, rest, commonProps, otherProps), iconOnlyImage ? iconOnlyImage : children);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
return Button;
|
|
209
153
|
});
|
|
210
154
|
Button.displayName = 'Button';
|
|
211
155
|
Button.propTypes = {
|
|
@@ -316,13 +260,7 @@ Button.propTypes = {
|
|
|
316
260
|
/**
|
|
317
261
|
* Specify the size of the button, from the following list of sizes:
|
|
318
262
|
*/
|
|
319
|
-
size:
|
|
320
|
-
|
|
321
|
-
/**
|
|
322
|
-
* Deprecated in v10 in favor of `size`.
|
|
323
|
-
* Specify whether the Button should be a small variant
|
|
324
|
-
*/
|
|
325
|
-
small: deprecate(PropTypes.bool, "\nThe prop `small` for Button has been deprecated in favor of `size`. Please use `size=\"sm\"` instead."),
|
|
263
|
+
size: PropTypes.oneOf(['sm', 'md', 'lg', 'xl', '2xl']),
|
|
326
264
|
|
|
327
265
|
/**
|
|
328
266
|
* Optional prop to specify the tabIndex of the Button
|
|
@@ -10,12 +10,10 @@ import PropTypes from 'prop-types';
|
|
|
10
10
|
import React__default from 'react';
|
|
11
11
|
import cx from 'classnames';
|
|
12
12
|
import '../Text/index.js';
|
|
13
|
-
import { useFeatureFlag } from '../FeatureFlags/index.js';
|
|
14
|
-
import deprecate from '../../prop-types/deprecate.js';
|
|
15
13
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
16
14
|
import { Text } from '../Text/Text.js';
|
|
17
15
|
|
|
18
|
-
var _excluded = ["className", "id", "labelText", "onChange", "indeterminate", "hideLabel", "
|
|
16
|
+
var _excluded = ["className", "id", "labelText", "onChange", "indeterminate", "hideLabel", "title"];
|
|
19
17
|
var Checkbox = /*#__PURE__*/React__default.forwardRef(function Checkbox(_ref, _ref2) {
|
|
20
18
|
var className = _ref.className,
|
|
21
19
|
id = _ref.id,
|
|
@@ -23,29 +21,23 @@ var Checkbox = /*#__PURE__*/React__default.forwardRef(function Checkbox(_ref, _r
|
|
|
23
21
|
_onChange = _ref.onChange,
|
|
24
22
|
indeterminate = _ref.indeterminate,
|
|
25
23
|
hideLabel = _ref.hideLabel,
|
|
26
|
-
wrapperClassName = _ref.wrapperClassName,
|
|
27
24
|
_ref$title = _ref.title,
|
|
28
25
|
title = _ref$title === void 0 ? '' : _ref$title,
|
|
29
26
|
other = _objectWithoutProperties(_ref, _excluded);
|
|
30
27
|
|
|
31
|
-
var enabled = useFeatureFlag('enable-v11-release');
|
|
32
28
|
var prefix = usePrefix();
|
|
33
|
-
var labelClasses = cx("".concat(prefix, "--checkbox-label"), [
|
|
29
|
+
var labelClasses = cx("".concat(prefix, "--checkbox-label"), [className]);
|
|
34
30
|
var innerLabelClasses = cx("".concat(prefix, "--checkbox-label-text"), _defineProperty({}, "".concat(prefix, "--visually-hidden"), hideLabel));
|
|
35
|
-
var wrapperClasses = cx("".concat(prefix, "--form-item"), "".concat(prefix, "--checkbox-wrapper"), [
|
|
31
|
+
var wrapperClasses = cx("".concat(prefix, "--form-item"), "".concat(prefix, "--checkbox-wrapper"), [className]);
|
|
36
32
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
37
33
|
className: wrapperClasses
|
|
38
34
|
}, /*#__PURE__*/React__default.createElement("input", _extends({}, other, {
|
|
39
35
|
type: "checkbox",
|
|
40
36
|
onChange: function onChange(evt) {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
});
|
|
46
|
-
} else {
|
|
47
|
-
_onChange(evt.target.checked, id, evt);
|
|
48
|
-
}
|
|
37
|
+
_onChange(evt, {
|
|
38
|
+
checked: evt.target.checked,
|
|
39
|
+
id: id
|
|
40
|
+
});
|
|
49
41
|
},
|
|
50
42
|
className: "".concat(prefix, "--checkbox"),
|
|
51
43
|
id: id,
|
|
@@ -119,12 +111,7 @@ Checkbox.propTypes = {
|
|
|
119
111
|
/**
|
|
120
112
|
* Specify a title for the <label> node for the Checkbox
|
|
121
113
|
*/
|
|
122
|
-
title: PropTypes.string
|
|
123
|
-
|
|
124
|
-
/**
|
|
125
|
-
* The CSS class name to be placed on the wrapping element
|
|
126
|
-
*/
|
|
127
|
-
wrapperClassName: deprecate(PropTypes.string, "\nThe prop `wrapperClassName` for Checkbox will be deprecated in V11 in favor of `className`. `className` will then be placed on the outer wrapper.")
|
|
114
|
+
title: PropTypes.string
|
|
128
115
|
};
|
|
129
116
|
Checkbox.defaultProps = {
|
|
130
117
|
onChange: function onChange() {},
|
|
@@ -18,7 +18,7 @@ import uniqueId from '../../tools/uniqueId.js';
|
|
|
18
18
|
import copy from 'copy-to-clipboard';
|
|
19
19
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
20
20
|
|
|
21
|
-
var _excluded = ["className", "type", "children", "disabled", "feedback", "feedbackTimeout", "onClick", "ariaLabel", "copyText", "
|
|
21
|
+
var _excluded = ["className", "type", "children", "disabled", "feedback", "feedbackTimeout", "onClick", "ariaLabel", "copyText", "copyButtonDescription", "light", "showMoreText", "showLessText", "hideCopyButton", "wrapText", "maxCollapsedNumberOfRows", "maxExpandedNumberOfRows", "minCollapsedNumberOfRows", "minExpandedNumberOfRows"];
|
|
22
22
|
var rowHeightInPixels = 16;
|
|
23
23
|
var defaultMaxCollapsedNumberOfRows = 15;
|
|
24
24
|
var defaultMaxExpandedNumberOfRows = 0;
|
|
@@ -37,7 +37,6 @@ function CodeSnippet(_ref) {
|
|
|
37
37
|
onClick = _ref.onClick,
|
|
38
38
|
ariaLabel = _ref.ariaLabel,
|
|
39
39
|
copyText = _ref.copyText,
|
|
40
|
-
copyLabel = _ref.copyLabel,
|
|
41
40
|
copyButtonDescription = _ref.copyButtonDescription,
|
|
42
41
|
light = _ref.light,
|
|
43
42
|
showMoreText = _ref.showMoreText,
|
|
@@ -171,7 +170,7 @@ function CodeSnippet(_ref) {
|
|
|
171
170
|
|
|
172
171
|
return /*#__PURE__*/React__default.createElement(Copy, _extends({}, rest, {
|
|
173
172
|
onClick: handleCopyClick,
|
|
174
|
-
"aria-label":
|
|
173
|
+
"aria-label": ariaLabel,
|
|
175
174
|
"aria-describedby": uid,
|
|
176
175
|
className: codeSnippetClasses,
|
|
177
176
|
feedback: feedback,
|
|
@@ -217,7 +216,7 @@ function CodeSnippet(_ref) {
|
|
|
217
216
|
role: type === 'single' ? 'textbox' : null,
|
|
218
217
|
tabIndex: type === 'single' && !disabled ? 0 : null,
|
|
219
218
|
className: "".concat(prefix, "--snippet-container"),
|
|
220
|
-
"aria-label": ariaLabel ||
|
|
219
|
+
"aria-label": ariaLabel || 'code-snippet',
|
|
221
220
|
onScroll: type === 'single' && handleScroll || null
|
|
222
221
|
}, containerStyle), /*#__PURE__*/React__default.createElement("pre", {
|
|
223
222
|
ref: codeContentRef,
|
|
@@ -274,12 +273,6 @@ CodeSnippet.propTypes = {
|
|
|
274
273
|
*/
|
|
275
274
|
copyButtonDescription: PropTypes.string,
|
|
276
275
|
|
|
277
|
-
/**
|
|
278
|
-
* Specify a label to be read by screen readers on the containing <textbox>
|
|
279
|
-
* node
|
|
280
|
-
*/
|
|
281
|
-
copyLabel: PropTypes.string,
|
|
282
|
-
|
|
283
276
|
/**
|
|
284
277
|
* Optional text to copy. If not specified, the `children` node's `innerText`
|
|
285
278
|
* will be used as the copy value.
|
|
@@ -362,7 +355,6 @@ CodeSnippet.propTypes = {
|
|
|
362
355
|
};
|
|
363
356
|
CodeSnippet.defaultProps = {
|
|
364
357
|
ariaLabel: 'Copy to clipboard',
|
|
365
|
-
copyLabel: 'Copy to clipboard',
|
|
366
358
|
type: 'single',
|
|
367
359
|
showMoreText: 'Show more',
|
|
368
360
|
showLessText: 'Show less',
|
|
@@ -14,7 +14,6 @@ import '../Text/index.js';
|
|
|
14
14
|
import { WarningFilled, WarningAltFilled, Checkmark } from '@carbon/icons-react';
|
|
15
15
|
import '../ListBox/index.js';
|
|
16
16
|
import setupGetInstanceId from '../../tools/setupGetInstanceId.js';
|
|
17
|
-
import { mapDownshiftProps } from '../../tools/createPropAdapter.js';
|
|
18
17
|
import mergeRefs from '../../tools/mergeRefs.js';
|
|
19
18
|
import { useFeatureFlag } from '../FeatureFlags/index.js';
|
|
20
19
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
@@ -48,8 +47,7 @@ var getInputValue = function getInputValue(_ref) {
|
|
|
48
47
|
|
|
49
48
|
if (selectedItem) {
|
|
50
49
|
return itemToString(selectedItem);
|
|
51
|
-
}
|
|
52
|
-
|
|
50
|
+
}
|
|
53
51
|
|
|
54
52
|
if (initialSelectedItem) {
|
|
55
53
|
return itemToString(initialSelectedItem);
|
|
@@ -221,7 +219,7 @@ var ComboBox = /*#__PURE__*/React__default.forwardRef(function (props, ref) {
|
|
|
221
219
|
var inputClasses = cx("".concat(prefix, "--text-input"), _defineProperty({}, "".concat(prefix, "--text-input--empty"), !inputValue)); // needs to be Capitalized for react to render it correctly
|
|
222
220
|
|
|
223
221
|
var ItemToElement = itemToElement;
|
|
224
|
-
return /*#__PURE__*/React__default.createElement(Downshift, _extends({},
|
|
222
|
+
return /*#__PURE__*/React__default.createElement(Downshift, _extends({}, downshiftProps, {
|
|
225
223
|
onChange: handleOnChange,
|
|
226
224
|
onInputValueChange: handleOnInputValueChange,
|
|
227
225
|
onStateChange: function onStateChange() {
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2016, 2021
|
|
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 { createClassWrapper } from '../../internal/createClassWrapper.js';
|
|
9
|
+
import ContentSwitcher from './ContentSwitcher.js';
|
|
10
|
+
|
|
11
|
+
var index = createClassWrapper(ContentSwitcher);
|
|
12
|
+
|
|
13
|
+
export { index as default };
|
|
@@ -17,7 +17,6 @@ import { composeEventHandlers } from '../../tools/events.js';
|
|
|
17
17
|
import { defaultFilterRows } from './tools/filter.js';
|
|
18
18
|
import { defaultSortRow } from './tools/sorting.js';
|
|
19
19
|
import setupGetInstanceId from './tools/instanceId.js';
|
|
20
|
-
import * as FeatureFlags from '@carbon/feature-flags';
|
|
21
20
|
|
|
22
21
|
var _excluded = ["header", "onClick", "isSortable"],
|
|
23
22
|
_excluded2 = ["onClick"],
|
|
@@ -194,11 +193,10 @@ var DataTable = /*#__PURE__*/function (_React$Component) {
|
|
|
194
193
|
|
|
195
194
|
_defineProperty(_assertThisInitialized(_this), "getToolbarProps", function () {
|
|
196
195
|
var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
197
|
-
var size = _this.props.size;
|
|
198
|
-
|
|
199
|
-
var isSmall = size === 'compact' || size === 'short' || size === 'xs' || size === 'sm';
|
|
196
|
+
var size = _this.props.size;
|
|
197
|
+
var isSmall = size === 'xs' || size === 'sm';
|
|
200
198
|
return _objectSpread2(_objectSpread2({}, props), {}, {
|
|
201
|
-
size: isSmall ? '
|
|
199
|
+
size: isSmall ? 'sm' : undefined
|
|
202
200
|
});
|
|
203
201
|
});
|
|
204
202
|
|
|
@@ -221,7 +219,6 @@ var DataTable = /*#__PURE__*/function (_React$Component) {
|
|
|
221
219
|
size = _this$props.size,
|
|
222
220
|
isSortable = _this$props.isSortable,
|
|
223
221
|
useStaticWidth = _this$props.useStaticWidth,
|
|
224
|
-
shouldShowBorder = _this$props.shouldShowBorder,
|
|
225
222
|
stickyHeader = _this$props.stickyHeader,
|
|
226
223
|
overflowMenuOnHover = _this$props.overflowMenuOnHover;
|
|
227
224
|
return {
|
|
@@ -229,7 +226,6 @@ var DataTable = /*#__PURE__*/function (_React$Component) {
|
|
|
229
226
|
size: size,
|
|
230
227
|
isSortable: isSortable,
|
|
231
228
|
useStaticWidth: useStaticWidth,
|
|
232
|
-
shouldShowBorder: shouldShowBorder,
|
|
233
229
|
stickyHeader: stickyHeader,
|
|
234
230
|
overflowMenuOnHover: overflowMenuOnHover
|
|
235
231
|
};
|
|
@@ -585,15 +581,10 @@ _defineProperty(DataTable, "propTypes", {
|
|
|
585
581
|
isExpanded: PropTypes.bool
|
|
586
582
|
})).isRequired,
|
|
587
583
|
|
|
588
|
-
/**
|
|
589
|
-
* `false` If true, will remove the table border
|
|
590
|
-
*/
|
|
591
|
-
shouldShowBorder: PropTypes.bool,
|
|
592
|
-
|
|
593
584
|
/**
|
|
594
585
|
* Change the row height of table. Currently supports `xs`, `sm`, `md`, `lg`, and `xl`.
|
|
595
586
|
*/
|
|
596
|
-
size:
|
|
587
|
+
size: PropTypes.oneOf(['xs', 'sm', 'md', 'lg', 'xl']),
|
|
597
588
|
|
|
598
589
|
/**
|
|
599
590
|
* Optional hook to manually control sorting of the rows.
|
|
@@ -628,7 +619,7 @@ _defineProperty(DataTable, "defaultProps", {
|
|
|
628
619
|
sortRow: defaultSortRow,
|
|
629
620
|
filterRows: defaultFilterRows,
|
|
630
621
|
locale: 'en',
|
|
631
|
-
size:
|
|
622
|
+
size: 'lg',
|
|
632
623
|
overflowMenuOnHover: true,
|
|
633
624
|
translateWithId: translateWithId
|
|
634
625
|
});
|
|
@@ -6,14 +6,12 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import { objectWithoutProperties as _objectWithoutProperties, defineProperty as _defineProperty, extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
9
|
-
import * as FeatureFlags from '@carbon/feature-flags';
|
|
10
9
|
import React__default from 'react';
|
|
11
10
|
import PropTypes from 'prop-types';
|
|
12
11
|
import cx from 'classnames';
|
|
13
|
-
import deprecate from '../../prop-types/deprecate.js';
|
|
14
12
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
15
13
|
|
|
16
|
-
var _excluded = ["className", "children", "useZebraStyles", "size", "isSortable", "useStaticWidth", "
|
|
14
|
+
var _excluded = ["className", "children", "useZebraStyles", "size", "isSortable", "useStaticWidth", "stickyHeader", "overflowMenuOnHover"];
|
|
17
15
|
var Table = function Table(_ref) {
|
|
18
16
|
var _cx;
|
|
19
17
|
|
|
@@ -23,13 +21,12 @@ var Table = function Table(_ref) {
|
|
|
23
21
|
size = _ref.size,
|
|
24
22
|
isSortable = _ref.isSortable,
|
|
25
23
|
useStaticWidth = _ref.useStaticWidth,
|
|
26
|
-
shouldShowBorder = _ref.shouldShowBorder,
|
|
27
24
|
stickyHeader = _ref.stickyHeader,
|
|
28
25
|
overflowMenuOnHover = _ref.overflowMenuOnHover,
|
|
29
26
|
other = _objectWithoutProperties(_ref, _excluded);
|
|
30
27
|
|
|
31
28
|
var prefix = usePrefix();
|
|
32
|
-
var componentClass = cx("".concat(prefix, "--data-table"), className, (_cx = {}, _defineProperty(_cx, "".concat(prefix, "--data-table--").concat(size), size), _defineProperty(_cx, "".concat(prefix, "--data-table--sort"), isSortable), _defineProperty(_cx, "".concat(prefix, "--data-table--zebra"), useZebraStyles), _defineProperty(_cx, "".concat(prefix, "--data-table--static"), useStaticWidth), _defineProperty(_cx, "".concat(prefix, "--data-table--
|
|
29
|
+
var componentClass = cx("".concat(prefix, "--data-table"), className, (_cx = {}, _defineProperty(_cx, "".concat(prefix, "--data-table--").concat(size), size), _defineProperty(_cx, "".concat(prefix, "--data-table--sort"), isSortable), _defineProperty(_cx, "".concat(prefix, "--data-table--zebra"), useZebraStyles), _defineProperty(_cx, "".concat(prefix, "--data-table--static"), useStaticWidth), _defineProperty(_cx, "".concat(prefix, "--data-table--sticky-header"), stickyHeader), _defineProperty(_cx, "".concat(prefix, "--data-table--visible-overflow-menu"), !overflowMenuOnHover), _cx));
|
|
33
30
|
var table = /*#__PURE__*/React__default.createElement("div", {
|
|
34
31
|
className: "".concat(prefix, "--data-table-content")
|
|
35
32
|
}, /*#__PURE__*/React__default.createElement("table", _extends({}, other, {
|
|
@@ -56,15 +53,10 @@ Table.propTypes = {
|
|
|
56
53
|
*/
|
|
57
54
|
overflowMenuOnHover: PropTypes.bool,
|
|
58
55
|
|
|
59
|
-
/**
|
|
60
|
-
* `false` If true, will remove the table border
|
|
61
|
-
*/
|
|
62
|
-
shouldShowBorder: deprecate(PropTypes.bool, 'The `shouldShowBorder` prop has been deprecated and can be safely removed.' + 'This prop will be removed in the next major release of ' + '`carbon-components-react`'),
|
|
63
|
-
|
|
64
56
|
/**
|
|
65
57
|
* Change the row height of table. Currently supports `xs`, `sm`, `md`, `lg`, and `xl`.
|
|
66
58
|
*/
|
|
67
|
-
size:
|
|
59
|
+
size: PropTypes.oneOf(['xs', 'sm', 'md', 'lg', 'xl']),
|
|
68
60
|
|
|
69
61
|
/**
|
|
70
62
|
* `false` If true, will keep the header sticky (only data rows will scroll)
|
|
@@ -38,7 +38,8 @@ TableBatchAction.propTypes = {
|
|
|
38
38
|
renderIcon: PropTypes.oneOfType([PropTypes.func, PropTypes.object])
|
|
39
39
|
};
|
|
40
40
|
TableBatchAction.defaultProps = {
|
|
41
|
-
renderIcon: AddFilled
|
|
41
|
+
renderIcon: AddFilled,
|
|
42
|
+
iconDescription: 'Add'
|
|
42
43
|
};
|
|
43
44
|
var TableBatchAction$1 = TableBatchAction;
|
|
44
45
|
|
|
@@ -74,7 +74,7 @@ TableExpandHeader.propTypes = {
|
|
|
74
74
|
* Specify whether this row is expanded or not. This helps coordinate data
|
|
75
75
|
* attributes so that `TableExpandRow` and `TableExpandedRow` work together
|
|
76
76
|
*/
|
|
77
|
-
isExpanded:
|
|
77
|
+
isExpanded: requiredIfGivenPropIsTruthy('enableToggle', PropTypes.bool),
|
|
78
78
|
|
|
79
79
|
/**
|
|
80
80
|
* Hook for when a listener initiates a request to expand the given row
|
|
@@ -6,7 +6,6 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import { objectWithoutProperties as _objectWithoutProperties, defineProperty as _defineProperty, extends as _extends, objectSpread2 as _objectSpread2 } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
9
|
-
import * as FeatureFlags from '@carbon/feature-flags';
|
|
10
9
|
import cx from 'classnames';
|
|
11
10
|
import PropTypes from 'prop-types';
|
|
12
11
|
import React__default from 'react';
|
|
@@ -38,7 +37,7 @@ TableToolbar.propTypes = _objectSpread2(_objectSpread2({}, AriaLabelPropType), {
|
|
|
38
37
|
/**
|
|
39
38
|
* `lg` Change the row height of table
|
|
40
39
|
*/
|
|
41
|
-
size:
|
|
40
|
+
size: PropTypes.oneOf(['sm', 'lg'])
|
|
42
41
|
});
|
|
43
42
|
TableToolbar.defaultProps = {
|
|
44
43
|
'aria-label': 'data table toolbar'
|