@carbon/react 1.0.0-rc.0 → 1.0.2
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/README.md +2 -2
- 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/Toggletip/index.js +252 -0
- package/es/components/Tooltip/next/DefinitionTooltip.js +1 -1
- package/es/index.js +6 -10
- package/es/internal/useEvent.js +29 -0
- package/icons/package.json +2 -1
- 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/Toggletip/index.js +266 -0
- package/lib/components/Tooltip/next/DefinitionTooltip.js +1 -1
- package/lib/index.js +102 -110
- package/lib/internal/useEvent.js +33 -0
- package/package.json +9 -9
- package/es/components/ToggleSmall/ToggleSmall.js +0 -104
- package/es/components/Toolbar/Toolbar.js +0 -121
- package/es/components/ToolbarSearch/ToolbarSearch.js +0 -168
- 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/ToggleSmall/ToggleSmall.js +0 -114
- package/lib/components/Toolbar/Toolbar.js +0 -135
- package/lib/components/ToolbarSearch/ToolbarSearch.js +0 -178
- package/lib/components/TooltipDefinition/TooltipDefinition.js +0 -178
- package/lib/components/TooltipIcon/TooltipIcon.js +0 -245
- package/lib/tools/createPropAdapter.js +0 -67
|
@@ -22,8 +22,8 @@ import { Enter, Space } from '../../../internal/keyboard/keys.js';
|
|
|
22
22
|
var _CheckboxCheckedFille, _Checkbox, _ChevronDown, _ChevronDown2;
|
|
23
23
|
|
|
24
24
|
var _excluded = ["children", "className", "light"],
|
|
25
|
-
_excluded2 = ["children", "className", "clicked", "
|
|
26
|
-
_excluded3 = ["children", "className", "disabled", "
|
|
25
|
+
_excluded2 = ["children", "className", "clicked", "href", "light", "onClick", "onKeyDown"],
|
|
26
|
+
_excluded3 = ["children", "className", "disabled", "id", "light", "name", "onClick", "onChange", "onKeyDown", "selected", "tabIndex", "title", "value"],
|
|
27
27
|
_excluded4 = ["tabIndex", "className", "children", "expanded", "tileMaxHeight", "tilePadding", "onClick", "onKeyUp", "tileCollapsedIconText", "tileExpandedIconText", "tileCollapsedLabel", "tileExpandedLabel", "light"];
|
|
28
28
|
var Tile = /*#__PURE__*/React__default.forwardRef(function Tile(_ref, ref) {
|
|
29
29
|
var children = _ref.children,
|
|
@@ -64,11 +64,8 @@ var ClickableTile = /*#__PURE__*/React__default.forwardRef(function ClickableTil
|
|
|
64
64
|
className = _ref2.className,
|
|
65
65
|
_ref2$clicked = _ref2.clicked,
|
|
66
66
|
clicked = _ref2$clicked === void 0 ? false : _ref2$clicked,
|
|
67
|
-
handleClick = _ref2.handleClick,
|
|
68
|
-
handleKeyDown = _ref2.handleKeyDown,
|
|
69
67
|
href = _ref2.href,
|
|
70
|
-
|
|
71
|
-
light = _ref2$light === void 0 ? false : _ref2$light,
|
|
68
|
+
light = _ref2.light,
|
|
72
69
|
_ref2$onClick = _ref2.onClick,
|
|
73
70
|
onClick = _ref2$onClick === void 0 ? function () {} : _ref2$onClick,
|
|
74
71
|
_ref2$onKeyDown = _ref2.onKeyDown,
|
|
@@ -81,17 +78,12 @@ var ClickableTile = /*#__PURE__*/React__default.forwardRef(function ClickableTil
|
|
|
81
78
|
var _useState = useState(clicked),
|
|
82
79
|
_useState2 = _slicedToArray(_useState, 2),
|
|
83
80
|
isSelected = _useState2[0],
|
|
84
|
-
setIsSelected = _useState2[1];
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
var clickHandler = handleClick || onClick; // TODO: replace with onClick when handleClick prop is deprecated
|
|
88
|
-
|
|
89
|
-
var keyDownHandler = handleKeyDown || onKeyDown;
|
|
81
|
+
setIsSelected = _useState2[1];
|
|
90
82
|
|
|
91
83
|
function handleOnClick(evt) {
|
|
92
84
|
evt.persist();
|
|
93
85
|
setIsSelected(!isSelected);
|
|
94
|
-
|
|
86
|
+
onClick(evt);
|
|
95
87
|
}
|
|
96
88
|
|
|
97
89
|
function handleOnKeyDown(evt) {
|
|
@@ -100,10 +92,10 @@ var ClickableTile = /*#__PURE__*/React__default.forwardRef(function ClickableTil
|
|
|
100
92
|
if (matches(evt, [Enter, Space])) {
|
|
101
93
|
evt.preventDefault();
|
|
102
94
|
setIsSelected(!isSelected);
|
|
103
|
-
|
|
95
|
+
onKeyDown(evt);
|
|
104
96
|
}
|
|
105
97
|
|
|
106
|
-
|
|
98
|
+
onKeyDown(evt);
|
|
107
99
|
}
|
|
108
100
|
|
|
109
101
|
return /*#__PURE__*/React__default.createElement(Link, _extends({
|
|
@@ -131,16 +123,6 @@ ClickableTile.propTypes = {
|
|
|
131
123
|
*/
|
|
132
124
|
clicked: PropTypes.bool,
|
|
133
125
|
|
|
134
|
-
/**
|
|
135
|
-
* Deprecated in v11. Use 'onClick' instead.
|
|
136
|
-
*/
|
|
137
|
-
handleClick: deprecate(PropTypes.func, 'The handleClick prop for ClickableTile has been deprecated in favor of onClick. It will be removed in the next major release.'),
|
|
138
|
-
|
|
139
|
-
/**
|
|
140
|
-
* Specify the function to run when the ClickableTile is interacted with via a keyboard
|
|
141
|
-
*/
|
|
142
|
-
handleKeyDown: deprecate(PropTypes.func, 'The handleKeyDown prop for ClickableTile has been deprecated in favor of onKeyDown. It will be removed in the next major release.'),
|
|
143
|
-
|
|
144
126
|
/**
|
|
145
127
|
* The href for the link.
|
|
146
128
|
*/
|
|
@@ -173,12 +155,8 @@ var SelectableTile = /*#__PURE__*/React__default.forwardRef(function SelectableT
|
|
|
173
155
|
var children = _ref3.children,
|
|
174
156
|
className = _ref3.className,
|
|
175
157
|
disabled = _ref3.disabled,
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
_ref3.iconDescription;
|
|
179
|
-
var id = _ref3.id,
|
|
180
|
-
_ref3$light = _ref3.light,
|
|
181
|
-
light = _ref3$light === void 0 ? false : _ref3$light,
|
|
158
|
+
id = _ref3.id,
|
|
159
|
+
light = _ref3.light,
|
|
182
160
|
name = _ref3.name,
|
|
183
161
|
_ref3$onClick = _ref3.onClick,
|
|
184
162
|
onClick = _ref3$onClick === void 0 ? function () {} : _ref3$onClick,
|
|
@@ -196,11 +174,9 @@ var SelectableTile = /*#__PURE__*/React__default.forwardRef(function SelectableT
|
|
|
196
174
|
value = _ref3$value === void 0 ? 'value' : _ref3$value,
|
|
197
175
|
rest = _objectWithoutProperties(_ref3, _excluded3);
|
|
198
176
|
|
|
199
|
-
var prefix = usePrefix();
|
|
200
|
-
|
|
201
|
-
var
|
|
202
|
-
|
|
203
|
-
var keyDownHandler = handleKeyDown || onKeyDown;
|
|
177
|
+
var prefix = usePrefix();
|
|
178
|
+
var clickHandler = onClick;
|
|
179
|
+
var keyDownHandler = onKeyDown;
|
|
204
180
|
|
|
205
181
|
var _useState3 = useState(selected),
|
|
206
182
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
@@ -288,21 +264,6 @@ SelectableTile.propTypes = {
|
|
|
288
264
|
*/
|
|
289
265
|
disabled: PropTypes.bool,
|
|
290
266
|
|
|
291
|
-
/**
|
|
292
|
-
* Specify the function to run when the SelectableTile is clicked
|
|
293
|
-
*/
|
|
294
|
-
handleClick: deprecate(PropTypes.func, 'The `handleClick` prop for `SelectableTile` has been deprecated in favor of `onClick`. It will be removed in the next major release.'),
|
|
295
|
-
|
|
296
|
-
/**
|
|
297
|
-
* Specify the function to run when the SelectableTile is interacted with via a keyboard
|
|
298
|
-
*/
|
|
299
|
-
handleKeyDown: deprecate(PropTypes.func, 'The `handleKeyDown` prop for `SelectableTile` has been deprecated in favor of `onKeyDown`. It will be removed in the next major release.'),
|
|
300
|
-
|
|
301
|
-
/**
|
|
302
|
-
* The description of the checkmark icon.
|
|
303
|
-
*/
|
|
304
|
-
iconDescription: deprecate(PropTypes.string, 'The `iconDescription` prop for `SelectableTile` is no longer needed and has ' + 'been deprecated. It will be removed in the next major release.'),
|
|
305
|
-
|
|
306
267
|
/**
|
|
307
268
|
* The ID of the `<input>`.
|
|
308
269
|
*/
|
|
@@ -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 TileGroup from './TileGroup.js';
|
|
10
|
+
|
|
11
|
+
var index = createClassWrapper(TileGroup);
|
|
12
|
+
|
|
13
|
+
export { index as default };
|
|
@@ -11,7 +11,6 @@ import React__default from 'react';
|
|
|
11
11
|
import cx from 'classnames';
|
|
12
12
|
import { ChevronDown } from '@carbon/icons-react';
|
|
13
13
|
import { usePrefix } from '../../../internal/usePrefix.js';
|
|
14
|
-
import deprecate from '../../../prop-types/deprecate.js';
|
|
15
14
|
|
|
16
15
|
var _excluded = ["aria-label", "children", "id", "disabled", "className"];
|
|
17
16
|
var TimePickerSelect = /*#__PURE__*/React__default.forwardRef(function TimePickerSelect(_ref, ref) {
|
|
@@ -62,11 +61,6 @@ TimePickerSelect.propTypes = {
|
|
|
62
61
|
*/
|
|
63
62
|
disabled: PropTypes.bool,
|
|
64
63
|
|
|
65
|
-
/**
|
|
66
|
-
* Provide a description for the twistie icon that can be read by screen readers
|
|
67
|
-
*/
|
|
68
|
-
iconDescription: deprecate(PropTypes.string, 'The `iconDescription` prop for `TimePickerSelect` is no longer needed and has ' + 'been deprecated. It will be moved in the next major release. Use "aria-label" instead'),
|
|
69
|
-
|
|
70
64
|
/**
|
|
71
65
|
* Specify a custom `id` for the `<select>`
|
|
72
66
|
*/
|
|
@@ -0,0 +1,252 @@
|
|
|
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 { slicedToArray as _slicedToArray, defineProperty as _defineProperty, extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
9
|
+
import cx from 'classnames';
|
|
10
|
+
import PropTypes from 'prop-types';
|
|
11
|
+
import React__default, { useRef, useState, useContext } from 'react';
|
|
12
|
+
import { Popover, PopoverContent } from '../Popover/index.js';
|
|
13
|
+
import { useWindowEvent } from '../../internal/useEvent.js';
|
|
14
|
+
import { useId } from '../../internal/useId.js';
|
|
15
|
+
import { usePrefix } from '../../internal/usePrefix.js';
|
|
16
|
+
import { match } from '../../internal/keyboard/match.js';
|
|
17
|
+
import { Escape } from '../../internal/keyboard/keys.js';
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Used to render the label for a Toggletip
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
function ToggletipLabel(_ref) {
|
|
24
|
+
var _ref$as = _ref.as,
|
|
25
|
+
BaseComponent = _ref$as === void 0 ? 'span' : _ref$as,
|
|
26
|
+
children = _ref.children,
|
|
27
|
+
customClassName = _ref.className;
|
|
28
|
+
var prefix = usePrefix();
|
|
29
|
+
var className = cx("".concat(prefix, "--toggletip-label"), customClassName);
|
|
30
|
+
return /*#__PURE__*/React__default.createElement(BaseComponent, {
|
|
31
|
+
className: className
|
|
32
|
+
}, children);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
ToggletipLabel.propTypes = {
|
|
36
|
+
/**
|
|
37
|
+
* Provide a custom element or component to render the top-level node for the
|
|
38
|
+
* component.
|
|
39
|
+
*/
|
|
40
|
+
as: PropTypes.oneOfType([PropTypes.string, PropTypes.elementType]),
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Custom children to be rendered as the content of the label
|
|
44
|
+
*/
|
|
45
|
+
children: PropTypes.node,
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Provide a custom class name to be added to the outermost node in the
|
|
49
|
+
* component
|
|
50
|
+
*/
|
|
51
|
+
className: PropTypes.string
|
|
52
|
+
}; // Used to coordinate accessibility props between button and content along with
|
|
53
|
+
// the actions to open and close the toggletip
|
|
54
|
+
|
|
55
|
+
var ToggletipContext = /*#__PURE__*/React__default.createContext();
|
|
56
|
+
|
|
57
|
+
function useToggletip() {
|
|
58
|
+
return useContext(ToggletipContext);
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Used as a container for the button and content of a toggletip. This component
|
|
62
|
+
* is responsible for coordinating between interactions with the button and the
|
|
63
|
+
* visibility of the content
|
|
64
|
+
*/
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
function Toggletip(_ref2) {
|
|
68
|
+
var align = _ref2.align,
|
|
69
|
+
as = _ref2.as,
|
|
70
|
+
customClassName = _ref2.className,
|
|
71
|
+
children = _ref2.children,
|
|
72
|
+
_ref2$defaultOpen = _ref2.defaultOpen,
|
|
73
|
+
defaultOpen = _ref2$defaultOpen === void 0 ? false : _ref2$defaultOpen;
|
|
74
|
+
var ref = useRef();
|
|
75
|
+
|
|
76
|
+
var _useState = useState(defaultOpen),
|
|
77
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
78
|
+
open = _useState2[0],
|
|
79
|
+
setOpen = _useState2[1];
|
|
80
|
+
|
|
81
|
+
var prefix = usePrefix();
|
|
82
|
+
var id = useId();
|
|
83
|
+
var className = cx("".concat(prefix, "--toggletip"), customClassName, _defineProperty({}, "".concat(prefix, "--toggletip--open"), open));
|
|
84
|
+
var actions = {
|
|
85
|
+
toggle: function toggle() {
|
|
86
|
+
setOpen(!open);
|
|
87
|
+
},
|
|
88
|
+
close: function close() {
|
|
89
|
+
setOpen(false);
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
var value = {
|
|
93
|
+
buttonProps: {
|
|
94
|
+
'aria-expanded': open,
|
|
95
|
+
'aria-controls': id,
|
|
96
|
+
onClick: actions.toggle
|
|
97
|
+
},
|
|
98
|
+
contentProps: {
|
|
99
|
+
id: id
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
function onKeyDown(event) {
|
|
104
|
+
if (open && match(event, Escape)) {
|
|
105
|
+
actions.close();
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
useWindowEvent('click', function (event) {
|
|
110
|
+
if (open && !ref.current.contains(event.target)) {
|
|
111
|
+
actions.close();
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
return /*#__PURE__*/React__default.createElement(ToggletipContext.Provider, {
|
|
115
|
+
value: value
|
|
116
|
+
}, /*#__PURE__*/React__default.createElement(Popover, {
|
|
117
|
+
align: align,
|
|
118
|
+
as: as,
|
|
119
|
+
caret: true,
|
|
120
|
+
className: className,
|
|
121
|
+
dropShadow: false,
|
|
122
|
+
highContrast: true,
|
|
123
|
+
open: open,
|
|
124
|
+
onKeyDown: onKeyDown,
|
|
125
|
+
ref: ref
|
|
126
|
+
}, children));
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
Toggletip.propTypes = {
|
|
130
|
+
/**
|
|
131
|
+
* Specify how the toggletip should align with the button
|
|
132
|
+
*/
|
|
133
|
+
align: PropTypes.oneOf(['top', 'bottom', 'left', 'right']),
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* Provide a custom element or component to render the top-level node for the
|
|
137
|
+
* component.
|
|
138
|
+
*/
|
|
139
|
+
as: PropTypes.oneOfType([PropTypes.string, PropTypes.elementType]),
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* Custom children to be rendered as the content of the label
|
|
143
|
+
*/
|
|
144
|
+
children: PropTypes.node,
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* Provide a custom class name to be added to the outermost node in the
|
|
148
|
+
* component
|
|
149
|
+
*/
|
|
150
|
+
className: PropTypes.string,
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* Specify if the toggletip should be open by default
|
|
154
|
+
*/
|
|
155
|
+
defaultOpen: PropTypes.bool
|
|
156
|
+
};
|
|
157
|
+
/**
|
|
158
|
+
* `ToggletipButton` controls the visibility of the Toggletip through mouse
|
|
159
|
+
* clicks and keyboard interactions.
|
|
160
|
+
*/
|
|
161
|
+
|
|
162
|
+
function ToggletipButton(_ref3) {
|
|
163
|
+
var children = _ref3.children,
|
|
164
|
+
customClassName = _ref3.className,
|
|
165
|
+
_ref3$label = _ref3.label,
|
|
166
|
+
label = _ref3$label === void 0 ? 'Show information' : _ref3$label;
|
|
167
|
+
var toggletip = useToggletip();
|
|
168
|
+
var prefix = usePrefix();
|
|
169
|
+
var className = cx("".concat(prefix, "--toggletip-button"), customClassName);
|
|
170
|
+
return /*#__PURE__*/React__default.createElement("button", _extends({}, toggletip.buttonProps, {
|
|
171
|
+
"aria-label": label,
|
|
172
|
+
type: "button",
|
|
173
|
+
className: className
|
|
174
|
+
}), children);
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
ToggletipButton.propTypes = {
|
|
178
|
+
/**
|
|
179
|
+
* Custom children to be rendered as the content of the label
|
|
180
|
+
*/
|
|
181
|
+
children: PropTypes.node,
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* Provide a custom class name to be added to the outermost node in the
|
|
185
|
+
* component
|
|
186
|
+
*/
|
|
187
|
+
className: PropTypes.string,
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* Provide an accessible label for this button
|
|
191
|
+
*/
|
|
192
|
+
label: PropTypes.string
|
|
193
|
+
};
|
|
194
|
+
/**
|
|
195
|
+
* `ToggletipContent` is a wrapper around `PopoverContent`. It places the
|
|
196
|
+
* `children` passed in as a prop inside of `PopoverContent` so that they will
|
|
197
|
+
* be rendered inside of the popover for this component.
|
|
198
|
+
*/
|
|
199
|
+
|
|
200
|
+
function ToggletipContent(_ref4) {
|
|
201
|
+
var children = _ref4.children,
|
|
202
|
+
customClassName = _ref4.className;
|
|
203
|
+
var toggletip = useToggletip();
|
|
204
|
+
var prefix = usePrefix();
|
|
205
|
+
return /*#__PURE__*/React__default.createElement(PopoverContent, _extends({
|
|
206
|
+
className: customClassName
|
|
207
|
+
}, toggletip.contentProps), /*#__PURE__*/React__default.createElement("div", {
|
|
208
|
+
className: "".concat(prefix, "--toggletip-content")
|
|
209
|
+
}, children));
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
ToggletipContent.propTypes = {
|
|
213
|
+
/**
|
|
214
|
+
* Custom children to be rendered as the content of the label
|
|
215
|
+
*/
|
|
216
|
+
children: PropTypes.node,
|
|
217
|
+
|
|
218
|
+
/**
|
|
219
|
+
* Provide a custom class name to be added to the outermost node in the
|
|
220
|
+
* component
|
|
221
|
+
*/
|
|
222
|
+
className: PropTypes.string
|
|
223
|
+
};
|
|
224
|
+
/**
|
|
225
|
+
* `ToggletipActions` is a container for one or two actions present at the base
|
|
226
|
+
* of a toggletip. It is used for layout of these items.
|
|
227
|
+
*/
|
|
228
|
+
|
|
229
|
+
function ToggletipActions(_ref5) {
|
|
230
|
+
var children = _ref5.children,
|
|
231
|
+
customClassName = _ref5.className;
|
|
232
|
+
var prefix = usePrefix();
|
|
233
|
+
var className = cx("".concat(prefix, "--toggletip-actions"), customClassName);
|
|
234
|
+
return /*#__PURE__*/React__default.createElement("div", {
|
|
235
|
+
className: className
|
|
236
|
+
}, children);
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
ToggletipActions.propTypes = {
|
|
240
|
+
/**
|
|
241
|
+
* Custom children to be rendered as the content of the label
|
|
242
|
+
*/
|
|
243
|
+
children: PropTypes.node,
|
|
244
|
+
|
|
245
|
+
/**
|
|
246
|
+
* Provide a custom class name to be added to the outermost node in the
|
|
247
|
+
* component
|
|
248
|
+
*/
|
|
249
|
+
className: PropTypes.string
|
|
250
|
+
};
|
|
251
|
+
|
|
252
|
+
export { Toggletip, ToggletipActions, ToggletipButton, ToggletipContent, ToggletipLabel };
|
|
@@ -107,7 +107,7 @@ DefinitionTooltip.propTypes = {
|
|
|
107
107
|
id: PropTypes.string,
|
|
108
108
|
|
|
109
109
|
/**
|
|
110
|
-
* [Deprecated] Please use the `definition` prop instead.
|
|
110
|
+
* [Deprecated in v11] Please use the `definition` prop instead.
|
|
111
111
|
*
|
|
112
112
|
* Provide the text that will be displayed in the tooltip when it is rendered.
|
|
113
113
|
*/
|
package/es/index.js
CHANGED
|
@@ -18,7 +18,7 @@ export { default as CodeSnippetSkeleton } from './components/CodeSnippet/CodeSni
|
|
|
18
18
|
export { default as CodeSnippet } from './components/CodeSnippet/CodeSnippet.js';
|
|
19
19
|
export { default as ComboBox } from './components/ComboBox/ComboBox.js';
|
|
20
20
|
export { ModalFooter, ModalHeader } from './components/ComposedModal/index.js';
|
|
21
|
-
export { default as ContentSwitcher } from './components/ContentSwitcher/
|
|
21
|
+
export { default as ContentSwitcher } from './components/ContentSwitcher/index.js';
|
|
22
22
|
export { default as Copy } from './components/Copy/Copy.js';
|
|
23
23
|
export { default as CopyButton } from './components/CopyButton/CopyButton.js';
|
|
24
24
|
export { default as DangerButton } from './components/DangerButton/DangerButton.js';
|
|
@@ -74,16 +74,11 @@ export { default as TextArea } from './components/TextArea/TextArea.js';
|
|
|
74
74
|
import './components/TextInput/index.js';
|
|
75
75
|
export { ClickableTile, ExpandableTile, SelectableTile, Tile, TileAboveTheFoldContent, TileBelowTheFoldContent } from './components/Tile/index.js';
|
|
76
76
|
export { default as RadioTile } from './components/RadioTile/RadioTile.js';
|
|
77
|
-
export { default as TileGroup } from './components/TileGroup/
|
|
77
|
+
export { default as TileGroup } from './components/TileGroup/index.js';
|
|
78
78
|
export { default as TimePicker } from './components/TimePicker/index.js';
|
|
79
79
|
export { default as TimePickerSelect } from './components/TimePickerSelect/index.js';
|
|
80
80
|
export { default as Toggle } from './components/Toggle/index.js';
|
|
81
|
-
export {
|
|
82
|
-
export { default as ToggleSmall } from './components/ToggleSmall/ToggleSmall.js';
|
|
83
|
-
export { default as Toolbar, ToolbarDivider, ToolbarItem, ToolbarOption, ToolbarTitle } from './components/Toolbar/Toolbar.js';
|
|
84
|
-
export { default as ToolbarSearch } from './components/ToolbarSearch/ToolbarSearch.js';
|
|
85
|
-
export { default as TooltipDefinition } from './components/TooltipDefinition/TooltipDefinition.js';
|
|
86
|
-
export { default as TooltipIcon } from './components/TooltipIcon/TooltipIcon.js';
|
|
81
|
+
export { Toggletip, ToggletipActions, ToggletipButton, ToggletipContent, ToggletipLabel } from './components/Toggletip/index.js';
|
|
87
82
|
export { default as UnorderedList } from './components/UnorderedList/UnorderedList.js';
|
|
88
83
|
export { default as SkeletonText } from './components/SkeletonText/SkeletonText.js';
|
|
89
84
|
export { default as SkeletonPlaceholder } from './components/SkeletonPlaceholder/SkeletonPlaceholder.js';
|
|
@@ -99,6 +94,7 @@ export { default as SliderSkeleton } from './components/Slider/Slider.Skeleton.j
|
|
|
99
94
|
export { default as TabsSkeleton } from './components/Tabs/Tabs.Skeleton.js';
|
|
100
95
|
export { default as TextInputSkeleton } from './components/TextInput/TextInput.Skeleton.js';
|
|
101
96
|
export { default as ToggleSkeleton } from './components/Toggle/Toggle.Skeleton.js';
|
|
97
|
+
export { default as ToggleSmallSkeleton } from './components/ToggleSmall/ToggleSmall.Skeleton.js';
|
|
102
98
|
export { default as IconSkeleton } from './components/Icon/Icon.Skeleton.js';
|
|
103
99
|
export { default as DatePickerSkeleton } from './components/DatePicker/DatePicker.Skeleton.js';
|
|
104
100
|
export { HeaderNavigation, SideNavMenu } from './components/UIShell/index.js';
|
|
@@ -161,8 +157,8 @@ export { default as TableToolbarMenu } from './components/DataTable/TableToolbar
|
|
|
161
157
|
export { default as ErrorBoundary } from './components/ErrorBoundary/ErrorBoundary.js';
|
|
162
158
|
export { ErrorBoundaryContext } from './components/ErrorBoundary/ErrorBoundaryContext.js';
|
|
163
159
|
export { Grid } from './components/Grid/Grid.js';
|
|
164
|
-
export { ColumnHang
|
|
165
|
-
export { FlexGrid
|
|
160
|
+
export { ColumnHang } from './components/Grid/ColumnHang.js';
|
|
161
|
+
export { FlexGrid } from './components/Grid/FlexGrid.js';
|
|
166
162
|
export { default as ControlledPasswordInput } from './components/TextInput/ControlledPasswordInput.js';
|
|
167
163
|
export { default as PasswordInput } from './components/TextInput/PasswordInput.js';
|
|
168
164
|
export { ProgressStep } from './components/ProgressIndicator/ProgressIndicator.js';
|
|
@@ -0,0 +1,29 @@
|
|
|
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 { useRef, useEffect } from 'react';
|
|
9
|
+
|
|
10
|
+
function useWindowEvent(eventName, callback) {
|
|
11
|
+
var savedCallback = useRef(null);
|
|
12
|
+
useEffect(function () {
|
|
13
|
+
savedCallback.current = callback;
|
|
14
|
+
});
|
|
15
|
+
useEffect(function () {
|
|
16
|
+
function handler(event) {
|
|
17
|
+
if (savedCallback.current) {
|
|
18
|
+
savedCallback.current(event);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
window.addEventListener(eventName, handler);
|
|
23
|
+
return function () {
|
|
24
|
+
window.removeEventListener(eventName, handler);
|
|
25
|
+
};
|
|
26
|
+
}, [eventName]);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export { useWindowEvent };
|
package/icons/package.json
CHANGED
|
@@ -15,7 +15,6 @@ var React = require('react');
|
|
|
15
15
|
var cx = require('classnames');
|
|
16
16
|
var iconsReact = require('@carbon/icons-react');
|
|
17
17
|
var SkeletonText = require('../SkeletonText/SkeletonText.js');
|
|
18
|
-
var deprecate = require('../../prop-types/deprecate.js');
|
|
19
18
|
var usePrefix = require('../../internal/usePrefix.js');
|
|
20
19
|
|
|
21
20
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
@@ -84,12 +83,7 @@ AccordionSkeleton.propTypes = {
|
|
|
84
83
|
/**
|
|
85
84
|
* `false` to not display the first item opened
|
|
86
85
|
*/
|
|
87
|
-
open: PropTypes__default["default"].bool
|
|
88
|
-
|
|
89
|
-
/**
|
|
90
|
-
* Set unique identifier to generate unique item keys
|
|
91
|
-
*/
|
|
92
|
-
uid: deprecate["default"](PropTypes__default["default"].any)
|
|
86
|
+
open: PropTypes__default["default"].bool
|
|
93
87
|
};
|
|
94
88
|
AccordionSkeleton.defaultProps = {
|
|
95
89
|
open: true,
|
|
@@ -150,11 +150,6 @@ AccordionItem.propTypes = {
|
|
|
150
150
|
*/
|
|
151
151
|
disabled: PropTypes__default["default"].bool,
|
|
152
152
|
|
|
153
|
-
/**
|
|
154
|
-
* The description of the expand icon.
|
|
155
|
-
*/
|
|
156
|
-
iconDescription: deprecate["default"](PropTypes__default["default"].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`'),
|
|
157
|
-
|
|
158
153
|
/**
|
|
159
154
|
* The handler of the massaged `click` event.
|
|
160
155
|
*/
|
|
@@ -13,7 +13,6 @@ var _rollupPluginBabelHelpers = require('../../_virtual/_rollupPluginBabelHelper
|
|
|
13
13
|
var PropTypes = require('prop-types');
|
|
14
14
|
var React = require('react');
|
|
15
15
|
var cx = require('classnames');
|
|
16
|
-
var index = require('../FeatureFlags/index.js');
|
|
17
16
|
var usePrefix = require('../../internal/usePrefix.js');
|
|
18
17
|
var FeatureFlags = require('@carbon/feature-flags');
|
|
19
18
|
|
|
@@ -55,9 +54,8 @@ var ButtonSkeleton = function ButtonSkeleton(_ref) {
|
|
|
55
54
|
size = _ref$size === void 0 ? FeatureFlags__namespace.enabled('enable-v11-release') ? 'lg' : 'default' : _ref$size,
|
|
56
55
|
rest = _rollupPluginBabelHelpers.objectWithoutProperties(_ref, _excluded);
|
|
57
56
|
|
|
58
|
-
var enabled = index.useFeatureFlag('enable-v11-release');
|
|
59
57
|
var prefix = usePrefix.usePrefix();
|
|
60
|
-
var buttonClasses = cx__default["default"](className, (_cx = {}, _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--skeleton"), true), _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--btn"), true), _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--btn--sm"), small || size === 'sm'), _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--btn--md"), size === 'field' || size === 'md'), _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--btn--
|
|
58
|
+
var buttonClasses = cx__default["default"](className, (_cx = {}, _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--skeleton"), true), _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--btn"), true), _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--btn--sm"), small || size === 'sm'), _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--btn--md"), size === 'field' || size === 'md'), _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--btn--xl"), size === 'xl'), _rollupPluginBabelHelpers.defineProperty(_cx, "".concat(prefix, "--btn--2xl"), size === '2xl'), _cx));
|
|
61
59
|
|
|
62
60
|
var commonProps = _rollupPluginBabelHelpers.objectSpread2({
|
|
63
61
|
className: buttonClasses
|