@carbon/react 1.24.0 → 1.25.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/CodeSnippet/CodeSnippet.js +13 -115
- package/es/components/ComboBox/ComboBox.d.ts +6 -0
- package/es/components/ComboBox/ComboBox.js +19 -172
- package/es/components/ComboButton/index.js +164 -0
- package/es/components/ComposedModal/ComposedModal.js +1 -2
- package/es/components/DataTable/TableToolbar.d.ts +19 -0
- package/es/components/DataTable/TableToolbar.js +1 -1
- package/es/components/DataTable/TableToolbarAction.d.ts +21 -0
- package/es/components/DataTable/TableToolbarContent.d.ts +21 -0
- package/es/components/DataTable/TableToolbarMenu.d.ts +24 -0
- package/es/components/DataTable/TableToolbarMenu.js +3 -3
- package/es/components/DataTable/tools/sorting.js +2 -1
- package/es/components/DataTableSkeleton/DataTableSkeleton.d.ts +107 -0
- package/es/components/Dropdown/Dropdown.d.ts +6 -0
- package/es/components/Dropdown/Dropdown.js +8 -145
- package/es/components/FileUploader/FileUploader.js +1 -1
- package/es/components/FileUploader/FileUploaderDropContainer.js +30 -18
- package/es/components/FileUploader/FileUploaderItem.js +2 -1
- package/es/components/FileUploader/Filename.js +8 -2
- package/es/components/FluidTextArea/FluidTextArea.js +12 -1
- package/es/components/IconButton/index.js +1 -0
- package/es/components/ListBox/ListBoxSelection.js +4 -23
- package/es/components/ListBox/next/ListBoxSelection.js +2 -23
- package/es/components/Menu/Menu.js +50 -29
- package/es/components/Menu/MenuItem.js +1 -0
- package/es/components/MenuButton/index.js +127 -0
- package/es/components/Modal/Modal.js +4 -3
- package/es/components/MultiSelect/FilterableMultiSelect.js +31 -137
- package/es/components/MultiSelect/MultiSelect.d.ts +1 -1
- package/es/components/MultiSelect/MultiSelect.js +48 -26
- package/es/components/Notification/Notification.js +27 -264
- package/es/components/OverflowMenu/OverflowMenu.js +13 -139
- package/es/components/OverflowMenuItem/OverflowMenuItem.d.ts +58 -0
- package/es/components/OverflowMenuItem/OverflowMenuItem.js +12 -7
- package/es/components/OverflowMenuV2/index.js +15 -51
- package/es/components/Popover/index.d.ts +5 -1
- package/es/components/Popover/index.js +37 -9
- package/es/components/RadioButtonGroup/RadioButtonGroup.js +7 -4
- package/es/components/RadioTile/RadioTile.js +6 -6
- package/es/components/Select/Select.d.ts +89 -0
- package/es/components/SelectItem/SelectItem.d.ts +62 -0
- package/es/components/SelectItem/SelectItem.js +2 -4
- package/es/components/SelectItemGroup/SelectItemGroup.d.ts +52 -0
- package/es/components/SkeletonText/SkeletonText.js +1 -1
- package/es/components/StructuredList/StructuredList.js +10 -38
- package/es/components/Tabs/Tabs.js +3 -1
- package/es/components/TextArea/TextArea.Skeleton.d.ts +33 -0
- package/es/components/TextArea/TextArea.Skeleton.js +5 -5
- package/es/components/TextArea/TextArea.d.ts +9 -2
- package/es/components/TextArea/TextArea.js +31 -8
- package/es/components/TextArea/index.js +1 -0
- package/es/components/Toggle/Toggle.js +8 -19
- package/es/components/Tooltip/DefinitionTooltip.d.ts +52 -0
- package/es/components/Tooltip/DefinitionTooltip.js +2 -2
- package/es/components/Tooltip/Tooltip.d.ts +117 -0
- package/es/components/Tooltip/Tooltip.js +6 -4
- package/es/components/Tooltip/index.d.ts +9 -0
- package/es/index.d.ts +2 -0
- package/es/index.js +5 -3
- package/es/internal/ClickListener.js +1 -2
- package/es/internal/keyboard/match.js +1 -1
- package/es/internal/useAttachedMenu.js +85 -0
- package/es/internal/useDelayedState.d.ts +19 -0
- package/es/internal/useDelayedState.js +7 -3
- package/es/internal/useId.js +1 -1
- package/lib/components/CodeSnippet/CodeSnippet.js +13 -115
- package/lib/components/ComboBox/ComboBox.d.ts +6 -0
- package/lib/components/ComboBox/ComboBox.js +18 -171
- package/lib/components/ComboButton/index.js +174 -0
- package/lib/components/ComposedModal/ComposedModal.js +1 -2
- package/lib/components/DataTable/TableToolbar.d.ts +19 -0
- package/lib/components/DataTable/TableToolbar.js +1 -1
- package/lib/components/DataTable/TableToolbarAction.d.ts +21 -0
- package/lib/components/DataTable/TableToolbarContent.d.ts +21 -0
- package/lib/components/DataTable/TableToolbarMenu.d.ts +24 -0
- package/lib/components/DataTable/TableToolbarMenu.js +3 -3
- package/lib/components/DataTable/tools/sorting.js +2 -1
- package/lib/components/DataTableSkeleton/DataTableSkeleton.d.ts +107 -0
- package/lib/components/Dropdown/Dropdown.d.ts +6 -0
- package/lib/components/Dropdown/Dropdown.js +7 -144
- package/lib/components/FileUploader/FileUploader.js +1 -1
- package/lib/components/FileUploader/FileUploaderDropContainer.js +30 -18
- package/lib/components/FileUploader/FileUploaderItem.js +2 -1
- package/lib/components/FileUploader/Filename.js +8 -2
- package/lib/components/FluidTextArea/FluidTextArea.js +12 -1
- package/lib/components/IconButton/index.js +1 -0
- package/lib/components/ListBox/ListBoxSelection.js +4 -23
- package/lib/components/ListBox/next/ListBoxSelection.js +2 -23
- package/lib/components/Menu/Menu.js +50 -29
- package/lib/components/Menu/MenuItem.js +1 -0
- package/lib/components/MenuButton/index.js +137 -0
- package/lib/components/Modal/Modal.js +4 -3
- package/lib/components/MultiSelect/FilterableMultiSelect.js +29 -135
- package/lib/components/MultiSelect/MultiSelect.d.ts +1 -1
- package/lib/components/MultiSelect/MultiSelect.js +47 -25
- package/lib/components/Notification/Notification.js +27 -264
- package/lib/components/OverflowMenu/OverflowMenu.js +13 -139
- package/lib/components/OverflowMenuItem/OverflowMenuItem.d.ts +58 -0
- package/lib/components/OverflowMenuItem/OverflowMenuItem.js +12 -7
- package/lib/components/OverflowMenuV2/index.js +13 -49
- package/lib/components/Popover/index.d.ts +5 -1
- package/lib/components/Popover/index.js +37 -9
- package/lib/components/RadioButtonGroup/RadioButtonGroup.js +6 -3
- package/lib/components/RadioTile/RadioTile.js +6 -6
- package/lib/components/Select/Select.d.ts +89 -0
- package/lib/components/SelectItem/SelectItem.d.ts +62 -0
- package/lib/components/SelectItem/SelectItem.js +1 -3
- package/lib/components/SelectItemGroup/SelectItemGroup.d.ts +52 -0
- package/lib/components/SkeletonText/SkeletonText.js +1 -1
- package/lib/components/StructuredList/StructuredList.js +10 -38
- package/lib/components/Tabs/Tabs.js +3 -1
- package/lib/components/TextArea/TextArea.Skeleton.d.ts +33 -0
- package/lib/components/TextArea/TextArea.Skeleton.js +5 -5
- package/lib/components/TextArea/TextArea.d.ts +9 -2
- package/lib/components/TextArea/TextArea.js +30 -7
- package/lib/components/TextArea/index.js +2 -0
- package/lib/components/Toggle/Toggle.js +8 -19
- package/lib/components/Tooltip/DefinitionTooltip.d.ts +52 -0
- package/lib/components/Tooltip/DefinitionTooltip.js +2 -2
- package/lib/components/Tooltip/Tooltip.d.ts +117 -0
- package/lib/components/Tooltip/Tooltip.js +6 -4
- package/lib/components/Tooltip/index.d.ts +9 -0
- package/lib/index.d.ts +2 -0
- package/lib/index.js +50 -46
- package/lib/internal/ClickListener.js +1 -2
- package/lib/internal/keyboard/match.js +1 -1
- package/lib/internal/useAttachedMenu.js +89 -0
- package/lib/internal/useDelayedState.d.ts +19 -0
- package/lib/internal/useDelayedState.js +7 -3
- package/lib/internal/useId.js +1 -1
- package/package.json +3 -3
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2016, 2023
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
import React from 'react';
|
|
8
|
+
export interface TableToolbarMenuProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
9
|
+
children: React.ReactNode;
|
|
10
|
+
/**
|
|
11
|
+
* Provide an optional class name for the toolbar menu
|
|
12
|
+
*/
|
|
13
|
+
className?: string;
|
|
14
|
+
/**
|
|
15
|
+
* The description of the menu icon.
|
|
16
|
+
*/
|
|
17
|
+
iconDescription: string;
|
|
18
|
+
/**
|
|
19
|
+
* Optional prop to allow overriding the default menu icon
|
|
20
|
+
*/
|
|
21
|
+
renderIcon?: React.ReactNode;
|
|
22
|
+
}
|
|
23
|
+
declare const TableToolbarMenu: React.FC<TableToolbarMenuProps>;
|
|
24
|
+
export default TableToolbarMenu;
|
|
@@ -6,12 +6,12 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import { objectWithoutProperties as _objectWithoutProperties, extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
9
|
+
import { Settings } from '@carbon/icons-react';
|
|
9
10
|
import cx from 'classnames';
|
|
10
11
|
import PropTypes from 'prop-types';
|
|
11
12
|
import React__default from 'react';
|
|
12
|
-
import OverflowMenu from '../OverflowMenu/index.js';
|
|
13
|
-
import { Settings } from '@carbon/icons-react';
|
|
14
13
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
14
|
+
import OverflowMenu from '../OverflowMenu/index.js';
|
|
15
15
|
|
|
16
16
|
var _excluded = ["className", "renderIcon", "iconDescription", "children"];
|
|
17
17
|
|
|
@@ -25,7 +25,7 @@ var TableToolbarMenu = function TableToolbarMenu(_ref) {
|
|
|
25
25
|
var prefix = usePrefix();
|
|
26
26
|
var toolbarActionClasses = cx(className, "".concat(prefix, "--toolbar-action ").concat(prefix, "--overflow-menu"));
|
|
27
27
|
return /*#__PURE__*/React__default.createElement(OverflowMenu, _extends({
|
|
28
|
-
|
|
28
|
+
"aria-label": iconDescription,
|
|
29
29
|
renderIcon: renderIcon,
|
|
30
30
|
className: toolbarActionClasses,
|
|
31
31
|
title: iconDescription,
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2016, 2023
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
import PropTypes from 'prop-types';
|
|
8
|
+
export interface DataTableSkeletonProps {
|
|
9
|
+
/**
|
|
10
|
+
* Specify an optional className to add.
|
|
11
|
+
*/
|
|
12
|
+
className?: string;
|
|
13
|
+
/**
|
|
14
|
+
* Specify the number of columns that you want to render in the skeleton state
|
|
15
|
+
*/
|
|
16
|
+
columnCount: number;
|
|
17
|
+
/**
|
|
18
|
+
* Optionally specify whether you want the Skeleton to be rendered as a
|
|
19
|
+
* compact DataTable
|
|
20
|
+
*/
|
|
21
|
+
compact: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Optionally specify the displayed headers
|
|
24
|
+
*/
|
|
25
|
+
headers?: [{
|
|
26
|
+
header: string;
|
|
27
|
+
key: string;
|
|
28
|
+
}] | {
|
|
29
|
+
header: string;
|
|
30
|
+
key: string;
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* Specify the number of rows that you want to render in the skeleton state
|
|
34
|
+
*/
|
|
35
|
+
rowCount: number;
|
|
36
|
+
/**
|
|
37
|
+
* Specify if the table header should be rendered as part of the skeleton.
|
|
38
|
+
*/
|
|
39
|
+
showHeader: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Specify if the table toolbar should be rendered as part of the skeleton.
|
|
42
|
+
*/
|
|
43
|
+
showToolbar: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Optionally specify whether you want the DataTable to be zebra striped
|
|
46
|
+
*/
|
|
47
|
+
zebra: boolean;
|
|
48
|
+
}
|
|
49
|
+
declare const DataTableSkeleton: {
|
|
50
|
+
({ headers, rowCount, columnCount, zebra, compact, className, showHeader, showToolbar, ...rest }: {
|
|
51
|
+
[x: string]: any;
|
|
52
|
+
headers: any;
|
|
53
|
+
rowCount: any;
|
|
54
|
+
columnCount: any;
|
|
55
|
+
zebra: any;
|
|
56
|
+
compact: any;
|
|
57
|
+
className: any;
|
|
58
|
+
showHeader: any;
|
|
59
|
+
showToolbar: any;
|
|
60
|
+
}): JSX.Element;
|
|
61
|
+
propTypes: {
|
|
62
|
+
/**
|
|
63
|
+
* Specify an optional className to add.
|
|
64
|
+
*/
|
|
65
|
+
className: PropTypes.Requireable<string>;
|
|
66
|
+
/**
|
|
67
|
+
* Specify the number of columns that you want to render in the skeleton state
|
|
68
|
+
*/
|
|
69
|
+
columnCount: PropTypes.Requireable<number>;
|
|
70
|
+
/**
|
|
71
|
+
* Optionally specify whether you want the Skeleton to be rendered as a
|
|
72
|
+
* compact DataTable
|
|
73
|
+
*/
|
|
74
|
+
compact: PropTypes.Requireable<boolean>;
|
|
75
|
+
/**
|
|
76
|
+
* Optionally specify the displayed headers
|
|
77
|
+
*/
|
|
78
|
+
headers: PropTypes.Requireable<NonNullable<any[] | PropTypes.InferProps<{
|
|
79
|
+
key: PropTypes.Requireable<string>;
|
|
80
|
+
}> | null | undefined>>;
|
|
81
|
+
/**
|
|
82
|
+
* Specify the number of rows that you want to render in the skeleton state
|
|
83
|
+
*/
|
|
84
|
+
rowCount: PropTypes.Requireable<number>;
|
|
85
|
+
/**
|
|
86
|
+
* Specify if the table header should be rendered as part of the skeleton.
|
|
87
|
+
*/
|
|
88
|
+
showHeader: PropTypes.Requireable<boolean>;
|
|
89
|
+
/**
|
|
90
|
+
* Specify if the table toolbar should be rendered as part of the skeleton.
|
|
91
|
+
*/
|
|
92
|
+
showToolbar: PropTypes.Requireable<boolean>;
|
|
93
|
+
/**
|
|
94
|
+
* Optionally specify whether you want the DataTable to be zebra striped
|
|
95
|
+
*/
|
|
96
|
+
zebra: PropTypes.Requireable<boolean>;
|
|
97
|
+
};
|
|
98
|
+
defaultProps: {
|
|
99
|
+
rowCount: number;
|
|
100
|
+
columnCount: number;
|
|
101
|
+
zebra: boolean;
|
|
102
|
+
compact: boolean;
|
|
103
|
+
showHeader: boolean;
|
|
104
|
+
showToolbar: boolean;
|
|
105
|
+
};
|
|
106
|
+
};
|
|
107
|
+
export default DataTableSkeleton;
|
|
@@ -14,8 +14,14 @@ export interface OnChangeData<ItemType> {
|
|
|
14
14
|
}
|
|
15
15
|
export interface DropdownProps<ItemType> extends Omit<ReactAttr<HTMLDivElement>, ExcludedAttributes> {
|
|
16
16
|
/**
|
|
17
|
+
* Specify a label to be read by screen readers on the container node
|
|
17
18
|
* 'aria-label' of the ListBox component.
|
|
18
19
|
*/
|
|
20
|
+
['aria-label']?: string;
|
|
21
|
+
/**
|
|
22
|
+
* @deprecated please use `aria-label` instead.
|
|
23
|
+
* Specify a label to be read by screen readers on the container note.
|
|
24
|
+
*/
|
|
19
25
|
ariaLabel?: string;
|
|
20
26
|
/**
|
|
21
27
|
* Specify the direction of the dropdown. Can be either top or bottom.
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import { typeof as _typeof, objectWithoutProperties as _objectWithoutProperties, objectSpread2 as _objectSpread2, slicedToArray as _slicedToArray,
|
|
8
|
+
import { defineProperty as _defineProperty, typeof as _typeof, objectWithoutProperties as _objectWithoutProperties, objectSpread2 as _objectSpread2, slicedToArray as _slicedToArray, extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
9
9
|
import React__default, { useContext, useState, useRef } from 'react';
|
|
10
10
|
import { useSelect } from 'downshift';
|
|
11
11
|
import cx from 'classnames';
|
|
@@ -20,7 +20,9 @@ import '../FluidForm/FluidForm.js';
|
|
|
20
20
|
import { FormContext } from '../FluidForm/FormContext.js';
|
|
21
21
|
import { ListBoxSize, ListBoxType } from '../ListBox/ListBoxPropTypes.js';
|
|
22
22
|
|
|
23
|
-
var
|
|
23
|
+
var _Dropdown$propTypes;
|
|
24
|
+
|
|
25
|
+
var _excluded = ["className", "disabled", "direction", "items", "label", "aria-label", "ariaLabel", "itemToString", "itemToElement", "renderSelectedItem", "type", "size", "onChange", "id", "titleText", "hideLabel", "helperText", "translateWithId", "light", "invalid", "invalidText", "warn", "warnText", "initialSelectedItem", "selectedItem", "downshiftProps", "readOnly"];
|
|
24
26
|
|
|
25
27
|
var defaultItemToString = function defaultItemToString(item) {
|
|
26
28
|
if (typeof item === 'string') {
|
|
@@ -46,7 +48,8 @@ var Dropdown = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
|
|
|
46
48
|
direction = _ref.direction,
|
|
47
49
|
items = _ref.items,
|
|
48
50
|
label = _ref.label,
|
|
49
|
-
ariaLabel = _ref
|
|
51
|
+
ariaLabel = _ref['aria-label'],
|
|
52
|
+
deprecatedAriaLabel = _ref.ariaLabel,
|
|
50
53
|
_ref$itemToString = _ref.itemToString,
|
|
51
54
|
itemToString = _ref$itemToString === void 0 ? defaultItemToString : _ref$itemToString,
|
|
52
55
|
itemToElement = _ref.itemToElement,
|
|
@@ -161,7 +164,7 @@ var Dropdown = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
|
|
|
161
164
|
}, getLabelProps()), titleText), /*#__PURE__*/React__default.createElement(ListBox, {
|
|
162
165
|
onFocus: handleFocus,
|
|
163
166
|
onBlur: handleFocus,
|
|
164
|
-
"aria-label": ariaLabel,
|
|
167
|
+
"aria-label": deprecatedAriaLabel || ariaLabel,
|
|
165
168
|
size: size,
|
|
166
169
|
className: className,
|
|
167
170
|
invalid: invalid,
|
|
@@ -214,147 +217,7 @@ var Dropdown = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
|
|
|
214
217
|
}))), !inline && !invalid && !warn && helper);
|
|
215
218
|
});
|
|
216
219
|
Dropdown.displayName = 'Dropdown';
|
|
217
|
-
Dropdown.propTypes = {
|
|
218
|
-
/**
|
|
219
|
-
* 'aria-label' of the ListBox component.
|
|
220
|
-
*/
|
|
221
|
-
ariaLabel: PropTypes.string,
|
|
222
|
-
|
|
223
|
-
/**
|
|
224
|
-
* Provide a custom className to be applied on the bx--dropdown node
|
|
225
|
-
*/
|
|
226
|
-
className: PropTypes.string,
|
|
227
|
-
|
|
228
|
-
/**
|
|
229
|
-
* Specify the direction of the dropdown. Can be either top or bottom.
|
|
230
|
-
*/
|
|
231
|
-
direction: PropTypes.oneOf(['top', 'bottom']),
|
|
232
|
-
|
|
233
|
-
/**
|
|
234
|
-
* Disable the control
|
|
235
|
-
*/
|
|
236
|
-
disabled: PropTypes.bool,
|
|
237
|
-
|
|
238
|
-
/**
|
|
239
|
-
* Additional props passed to Downshift
|
|
240
|
-
*/
|
|
241
|
-
downshiftProps: PropTypes.object,
|
|
242
|
-
|
|
243
|
-
/**
|
|
244
|
-
* Provide helper text that is used alongside the control label for
|
|
245
|
-
* additional help
|
|
246
|
-
*/
|
|
247
|
-
helperText: PropTypes.node,
|
|
248
|
-
|
|
249
|
-
/**
|
|
250
|
-
* Specify whether the title text should be hidden or not
|
|
251
|
-
*/
|
|
252
|
-
hideLabel: PropTypes.bool,
|
|
253
|
-
|
|
254
|
-
/**
|
|
255
|
-
* Specify a custom `id`
|
|
256
|
-
*/
|
|
257
|
-
id: PropTypes.string.isRequired,
|
|
258
|
-
|
|
259
|
-
/**
|
|
260
|
-
* Allow users to pass in an arbitrary item or a string (in case their items are an array of strings)
|
|
261
|
-
* from their collection that are pre-selected
|
|
262
|
-
*/
|
|
263
|
-
initialSelectedItem: PropTypes.oneOfType([PropTypes.object, PropTypes.string, PropTypes.number]),
|
|
264
|
-
|
|
265
|
-
/**
|
|
266
|
-
* Specify if the currently selected value is invalid.
|
|
267
|
-
*/
|
|
268
|
-
invalid: PropTypes.bool,
|
|
269
|
-
|
|
270
|
-
/**
|
|
271
|
-
* Message which is displayed if the value is invalid.
|
|
272
|
-
*/
|
|
273
|
-
invalidText: PropTypes.node,
|
|
274
|
-
|
|
275
|
-
/**
|
|
276
|
-
* Function to render items as custom components instead of strings.
|
|
277
|
-
* Defaults to null and is overridden by a getter
|
|
278
|
-
*/
|
|
279
|
-
itemToElement: PropTypes.func,
|
|
280
|
-
|
|
281
|
-
/**
|
|
282
|
-
* Helper function passed to downshift that allows the library to render a
|
|
283
|
-
* given item to a string label. By default, it extracts the `label` field
|
|
284
|
-
* from a given item to serve as the item label in the list.
|
|
285
|
-
*/
|
|
286
|
-
itemToString: PropTypes.func,
|
|
287
|
-
|
|
288
|
-
/**
|
|
289
|
-
* We try to stay as generic as possible here to allow individuals to pass
|
|
290
|
-
* in a collection of whatever kind of data structure they prefer
|
|
291
|
-
*/
|
|
292
|
-
items: PropTypes.array.isRequired,
|
|
293
|
-
|
|
294
|
-
/**
|
|
295
|
-
* Generic `label` that will be used as the textual representation of what
|
|
296
|
-
* this field is for
|
|
297
|
-
*/
|
|
298
|
-
label: PropTypes.node.isRequired,
|
|
299
|
-
|
|
300
|
-
/**
|
|
301
|
-
* `true` to use the light version.
|
|
302
|
-
*/
|
|
303
|
-
light: deprecate(PropTypes.bool, 'The `light` prop for `Dropdown` has ' + 'been deprecated in favor of the new `Layer` component. It will be removed in the next major release.'),
|
|
304
|
-
|
|
305
|
-
/**
|
|
306
|
-
* `onChange` is a utility for this controlled component to communicate to a
|
|
307
|
-
* consuming component what kind of internal state changes are occurring.
|
|
308
|
-
*/
|
|
309
|
-
onChange: PropTypes.func,
|
|
310
|
-
|
|
311
|
-
/**
|
|
312
|
-
* Whether or not the Dropdown is readonly
|
|
313
|
-
*/
|
|
314
|
-
readOnly: PropTypes.bool,
|
|
315
|
-
|
|
316
|
-
/**
|
|
317
|
-
* An optional callback to render the currently selected item as a react element instead of only
|
|
318
|
-
* as a string.
|
|
319
|
-
*/
|
|
320
|
-
renderSelectedItem: PropTypes.func,
|
|
321
|
-
|
|
322
|
-
/**
|
|
323
|
-
* In the case you want to control the dropdown selection entirely.
|
|
324
|
-
*/
|
|
325
|
-
selectedItem: PropTypes.oneOfType([PropTypes.object, PropTypes.string, PropTypes.number]),
|
|
326
|
-
|
|
327
|
-
/**
|
|
328
|
-
* Specify the size of the ListBox. Currently supports either `sm`, `md` or `lg` as an option.
|
|
329
|
-
*/
|
|
330
|
-
size: ListBoxSize,
|
|
331
|
-
|
|
332
|
-
/**
|
|
333
|
-
* Provide the title text that will be read by a screen reader when
|
|
334
|
-
* visiting this control
|
|
335
|
-
*/
|
|
336
|
-
titleText: PropTypes.node.isRequired,
|
|
337
|
-
|
|
338
|
-
/**
|
|
339
|
-
* Callback function for translating ListBoxMenuIcon SVG title
|
|
340
|
-
*/
|
|
341
|
-
translateWithId: PropTypes.func,
|
|
342
|
-
|
|
343
|
-
/**
|
|
344
|
-
* The dropdown type, `default` or `inline`
|
|
345
|
-
*/
|
|
346
|
-
type: ListBoxType,
|
|
347
|
-
|
|
348
|
-
/**
|
|
349
|
-
* Specify whether the control is currently in warning state
|
|
350
|
-
*/
|
|
351
|
-
warn: PropTypes.bool,
|
|
352
|
-
|
|
353
|
-
/**
|
|
354
|
-
* Provide the text that is displayed when the control is in warning state
|
|
355
|
-
*/
|
|
356
|
-
warnText: PropTypes.node
|
|
357
|
-
};
|
|
220
|
+
Dropdown.propTypes = (_Dropdown$propTypes = {}, _defineProperty(_Dropdown$propTypes, 'aria-label', PropTypes.string), _defineProperty(_Dropdown$propTypes, "ariaLabel", deprecate(PropTypes.string, 'This prop syntax has been deprecated. Please use the new `aria-label`.')), _defineProperty(_Dropdown$propTypes, "className", PropTypes.string), _defineProperty(_Dropdown$propTypes, "direction", PropTypes.oneOf(['top', 'bottom'])), _defineProperty(_Dropdown$propTypes, "disabled", PropTypes.bool), _defineProperty(_Dropdown$propTypes, "downshiftProps", PropTypes.object), _defineProperty(_Dropdown$propTypes, "helperText", PropTypes.node), _defineProperty(_Dropdown$propTypes, "hideLabel", PropTypes.bool), _defineProperty(_Dropdown$propTypes, "id", PropTypes.string.isRequired), _defineProperty(_Dropdown$propTypes, "initialSelectedItem", PropTypes.oneOfType([PropTypes.object, PropTypes.string, PropTypes.number])), _defineProperty(_Dropdown$propTypes, "invalid", PropTypes.bool), _defineProperty(_Dropdown$propTypes, "invalidText", PropTypes.node), _defineProperty(_Dropdown$propTypes, "itemToElement", PropTypes.func), _defineProperty(_Dropdown$propTypes, "itemToString", PropTypes.func), _defineProperty(_Dropdown$propTypes, "items", PropTypes.array.isRequired), _defineProperty(_Dropdown$propTypes, "label", PropTypes.node.isRequired), _defineProperty(_Dropdown$propTypes, "light", deprecate(PropTypes.bool, 'The `light` prop for `Dropdown` has ' + 'been deprecated in favor of the new `Layer` component. It will be removed in the next major release.')), _defineProperty(_Dropdown$propTypes, "onChange", PropTypes.func), _defineProperty(_Dropdown$propTypes, "readOnly", PropTypes.bool), _defineProperty(_Dropdown$propTypes, "renderSelectedItem", PropTypes.func), _defineProperty(_Dropdown$propTypes, "selectedItem", PropTypes.oneOfType([PropTypes.object, PropTypes.string, PropTypes.number])), _defineProperty(_Dropdown$propTypes, "size", ListBoxSize), _defineProperty(_Dropdown$propTypes, "titleText", PropTypes.node.isRequired), _defineProperty(_Dropdown$propTypes, "translateWithId", PropTypes.func), _defineProperty(_Dropdown$propTypes, "type", ListBoxType), _defineProperty(_Dropdown$propTypes, "warn", PropTypes.bool), _defineProperty(_Dropdown$propTypes, "warnText", PropTypes.node), _Dropdown$propTypes);
|
|
358
221
|
Dropdown.defaultProps = {
|
|
359
222
|
disabled: false,
|
|
360
223
|
type: 'default',
|
|
@@ -158,8 +158,8 @@ var FileUploader = /*#__PURE__*/function (_React$Component) {
|
|
|
158
158
|
}, name), /*#__PURE__*/React__default.createElement("span", {
|
|
159
159
|
className: "".concat(prefix, "--file__state-container")
|
|
160
160
|
}, /*#__PURE__*/React__default.createElement(Filename, {
|
|
161
|
+
name: name,
|
|
161
162
|
iconDescription: iconDescription,
|
|
162
|
-
"aria-describedby": name,
|
|
163
163
|
status: filenameStatus,
|
|
164
164
|
onKeyDown: function onKeyDown(evt) {
|
|
165
165
|
if (matches(evt, [Enter, Space])) {
|
|
@@ -11,13 +11,15 @@ import PropTypes from 'prop-types';
|
|
|
11
11
|
import cx from 'classnames';
|
|
12
12
|
import uniqueId from '../../tools/uniqueId.js';
|
|
13
13
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
14
|
+
import { composeEventHandlers } from '../../tools/events.js';
|
|
15
|
+
import deprecate from '../../prop-types/deprecate.js';
|
|
14
16
|
import { matches } from '../../internal/keyboard/match.js';
|
|
15
17
|
import { Enter, Space } from '../../internal/keyboard/keys.js';
|
|
16
18
|
|
|
17
|
-
var _excluded = ["accept", "className", "id", "disabled", "labelText", "multiple", "name", "onAddFiles", "
|
|
19
|
+
var _excluded = ["accept", "className", "id", "disabled", "labelText", "multiple", "name", "onAddFiles", "onClick", "pattern", "innerRef"];
|
|
18
20
|
|
|
19
21
|
function FileUploaderDropContainer(_ref) {
|
|
20
|
-
var
|
|
22
|
+
var _classNames;
|
|
21
23
|
|
|
22
24
|
var accept = _ref.accept,
|
|
23
25
|
className = _ref.className,
|
|
@@ -27,9 +29,8 @@ function FileUploaderDropContainer(_ref) {
|
|
|
27
29
|
multiple = _ref.multiple,
|
|
28
30
|
name = _ref.name,
|
|
29
31
|
onAddFiles = _ref.onAddFiles,
|
|
32
|
+
onClick = _ref.onClick,
|
|
30
33
|
pattern = _ref.pattern,
|
|
31
|
-
role = _ref.role,
|
|
32
|
-
tabIndex = _ref.tabIndex,
|
|
33
34
|
innerRef = _ref.innerRef,
|
|
34
35
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
35
36
|
|
|
@@ -44,8 +45,7 @@ function FileUploaderDropContainer(_ref) {
|
|
|
44
45
|
isActive = _useState2[0],
|
|
45
46
|
setActive = _useState2[1];
|
|
46
47
|
|
|
47
|
-
var
|
|
48
|
-
var dropareaClasses = cx("".concat(prefix, "--file__drop-container"), (_classNames2 = {}, _defineProperty(_classNames2, "".concat(prefix, "--file__drop-container--drag-over"), isActive), _defineProperty(_classNames2, className, className), _classNames2));
|
|
48
|
+
var dropareaClasses = cx("".concat(prefix, "--file__drop-container"), "".concat(prefix, "--file-browse-btn"), (_classNames = {}, _defineProperty(_classNames, "".concat(prefix, "--file__drop-container--drag-over"), isActive), _defineProperty(_classNames, "".concat(prefix, "--file-browse-btn--disabled"), disabled), _defineProperty(_classNames, className, className), _classNames));
|
|
49
49
|
/**
|
|
50
50
|
* Filters the array of added files based on file type restrictions
|
|
51
51
|
* @param {Event} event - Event object, used to get the list of files added
|
|
@@ -90,6 +90,12 @@ function FileUploaderDropContainer(_ref) {
|
|
|
90
90
|
});
|
|
91
91
|
}
|
|
92
92
|
|
|
93
|
+
var handleClick = function handleClick() {
|
|
94
|
+
if (!disabled) {
|
|
95
|
+
inputRef.current.click();
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
|
|
93
99
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
94
100
|
className: "".concat(prefix, "--file"),
|
|
95
101
|
onDragOver: function onDragOver(evt) {
|
|
@@ -125,20 +131,21 @@ function FileUploaderDropContainer(_ref) {
|
|
|
125
131
|
setActive(false);
|
|
126
132
|
handleChange(evt);
|
|
127
133
|
}
|
|
128
|
-
}, /*#__PURE__*/React__default.createElement("
|
|
134
|
+
}, /*#__PURE__*/React__default.createElement("button", _extends({
|
|
135
|
+
type: "button",
|
|
136
|
+
className: dropareaClasses,
|
|
129
137
|
ref: innerRef,
|
|
130
|
-
className: labelClasses,
|
|
131
|
-
htmlFor: uid,
|
|
132
|
-
tabIndex: tabIndex || 0,
|
|
133
138
|
onKeyDown: function onKeyDown(evt) {
|
|
134
139
|
if (matches(evt, [Enter, Space])) {
|
|
140
|
+
evt.preventDefault();
|
|
135
141
|
inputRef.current.click();
|
|
136
142
|
}
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
143
|
+
},
|
|
144
|
+
onClick: composeEventHandlers([onClick, handleClick])
|
|
145
|
+
}, rest), labelText), /*#__PURE__*/React__default.createElement("label", {
|
|
146
|
+
htmlFor: uid,
|
|
147
|
+
className: "".concat(prefix, "--visually-hidden")
|
|
148
|
+
}, labelText), /*#__PURE__*/React__default.createElement("input", {
|
|
142
149
|
type: "file",
|
|
143
150
|
id: uid,
|
|
144
151
|
className: "".concat(prefix, "--file-input"),
|
|
@@ -198,6 +205,12 @@ FileUploaderDropContainer.propTypes = {
|
|
|
198
205
|
*/
|
|
199
206
|
onAddFiles: PropTypes.func,
|
|
200
207
|
|
|
208
|
+
/**
|
|
209
|
+
* Provide an optional function to be called when the button element
|
|
210
|
+
* is clicked
|
|
211
|
+
*/
|
|
212
|
+
onClick: PropTypes.func,
|
|
213
|
+
|
|
201
214
|
/**
|
|
202
215
|
* Provide a custom regex pattern for the acceptedTypes
|
|
203
216
|
*/
|
|
@@ -206,15 +219,14 @@ FileUploaderDropContainer.propTypes = {
|
|
|
206
219
|
/**
|
|
207
220
|
* Provide an accessibility role for the `<FileUploaderButton>`
|
|
208
221
|
*/
|
|
209
|
-
role: PropTypes.
|
|
222
|
+
role: deprecate(PropTypes.number, 'The `role` prop for `FileUploaderButton` has ' + 'been deprecated since it now renders a button element by default, and has an implicit role of button.'),
|
|
210
223
|
|
|
211
224
|
/**
|
|
212
225
|
* Provide a custom tabIndex value for the `<FileUploaderButton>`
|
|
213
226
|
*/
|
|
214
|
-
tabIndex: PropTypes.number
|
|
227
|
+
tabIndex: deprecate(PropTypes.number, 'The `tabIndex` prop for `FileUploaderButton` has ' + 'been deprecated since it now renders a button element by default.')
|
|
215
228
|
};
|
|
216
229
|
FileUploaderDropContainer.defaultProps = {
|
|
217
|
-
tabIndex: 0,
|
|
218
230
|
labelText: 'Add file',
|
|
219
231
|
multiple: false,
|
|
220
232
|
onAddFiles: function onAddFiles() {},
|
|
@@ -47,13 +47,14 @@ function FileUploaderItem(_ref) {
|
|
|
47
47
|
}, name), /*#__PURE__*/React__default.createElement("span", {
|
|
48
48
|
className: "".concat(prefix, "--file__state-container")
|
|
49
49
|
}, /*#__PURE__*/React__default.createElement(Filename, {
|
|
50
|
+
name: name,
|
|
50
51
|
iconDescription: iconDescription,
|
|
51
|
-
"aria-describedby": name,
|
|
52
52
|
status: status,
|
|
53
53
|
invalid: invalid,
|
|
54
54
|
onKeyDown: function onKeyDown(evt) {
|
|
55
55
|
if (matches(evt, [Enter, Space])) {
|
|
56
56
|
if (status === 'edit') {
|
|
57
|
+
evt.preventDefault();
|
|
57
58
|
onDelete(evt, {
|
|
58
59
|
uuid: id
|
|
59
60
|
});
|
|
@@ -14,12 +14,13 @@ import { usePrefix } from '../../internal/usePrefix.js';
|
|
|
14
14
|
|
|
15
15
|
var _Close;
|
|
16
16
|
|
|
17
|
-
var _excluded = ["iconDescription", "status", "invalid"];
|
|
17
|
+
var _excluded = ["iconDescription", "status", "invalid", "name"];
|
|
18
18
|
|
|
19
19
|
function Filename(_ref) {
|
|
20
20
|
var iconDescription = _ref.iconDescription,
|
|
21
21
|
status = _ref.status,
|
|
22
22
|
invalid = _ref.invalid,
|
|
23
|
+
name = _ref.name,
|
|
23
24
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
24
25
|
|
|
25
26
|
var prefix = usePrefix();
|
|
@@ -36,7 +37,7 @@ function Filename(_ref) {
|
|
|
36
37
|
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, invalid && /*#__PURE__*/React__default.createElement(WarningFilled, {
|
|
37
38
|
className: "".concat(prefix, "--file-invalid")
|
|
38
39
|
}), /*#__PURE__*/React__default.createElement("button", _extends({
|
|
39
|
-
"aria-label": iconDescription,
|
|
40
|
+
"aria-label": "".concat(iconDescription, " - ").concat(name),
|
|
40
41
|
className: "".concat(prefix, "--file-close"),
|
|
41
42
|
type: "button"
|
|
42
43
|
}, rest), _Close || (_Close = /*#__PURE__*/React__default.createElement(Close, null))));
|
|
@@ -65,6 +66,11 @@ Filename.propTypes = {
|
|
|
65
66
|
*/
|
|
66
67
|
invalid: PropTypes.bool,
|
|
67
68
|
|
|
69
|
+
/**
|
|
70
|
+
* Name of the uploaded file
|
|
71
|
+
*/
|
|
72
|
+
name: PropTypes.string,
|
|
73
|
+
|
|
68
74
|
/**
|
|
69
75
|
* Status of the file upload
|
|
70
76
|
*/
|
|
@@ -10,6 +10,7 @@ import PropTypes from 'prop-types';
|
|
|
10
10
|
import React__default from 'react';
|
|
11
11
|
import cx from 'classnames';
|
|
12
12
|
import TextArea from '../TextArea/TextArea.js';
|
|
13
|
+
import '../TextArea/TextArea.Skeleton.js';
|
|
13
14
|
import deprecate from '../../prop-types/deprecate.js';
|
|
14
15
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
15
16
|
import { FormContext } from '../FluidForm/FormContext.js';
|
|
@@ -125,7 +126,17 @@ FluidTextArea.propTypes = {
|
|
|
125
126
|
/**
|
|
126
127
|
* Provide the current value of the `<textarea>`
|
|
127
128
|
*/
|
|
128
|
-
value: PropTypes.oneOfType([PropTypes.string, PropTypes.number])
|
|
129
|
+
value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Specify whether the control is currently in warning state
|
|
133
|
+
*/
|
|
134
|
+
warn: PropTypes.bool,
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Provide the text that is displayed when the control is in warning state
|
|
138
|
+
*/
|
|
139
|
+
warnText: PropTypes.node
|
|
129
140
|
};
|
|
130
141
|
|
|
131
142
|
export { FluidTextArea as default };
|
|
@@ -9,6 +9,7 @@ import { objectWithoutProperties as _objectWithoutProperties, extends as _extend
|
|
|
9
9
|
import PropTypes from 'prop-types';
|
|
10
10
|
import React__default from 'react';
|
|
11
11
|
import Button from '../Button/Button.js';
|
|
12
|
+
import '../Tooltip/DefinitionTooltip.js';
|
|
12
13
|
import { Tooltip } from '../Tooltip/Tooltip.js';
|
|
13
14
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
14
15
|
import cx from 'classnames';
|
|
@@ -11,8 +11,6 @@ import React__default from 'react';
|
|
|
11
11
|
import PropTypes from 'prop-types';
|
|
12
12
|
import { Close } from '@carbon/icons-react';
|
|
13
13
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
14
|
-
import { match } from '../../internal/keyboard/match.js';
|
|
15
|
-
import { Enter } from '../../internal/keyboard/keys.js';
|
|
16
14
|
|
|
17
15
|
var _Close, _Close2, _defaultTranslations;
|
|
18
16
|
|
|
@@ -47,25 +45,10 @@ var ListBoxSelection = function ListBoxSelection(_ref) {
|
|
|
47
45
|
}
|
|
48
46
|
};
|
|
49
47
|
|
|
50
|
-
var handleOnKeyDown = function handleOnKeyDown(event) {
|
|
51
|
-
event.stopPropagation();
|
|
52
|
-
|
|
53
|
-
if (disabled || readOnly) {
|
|
54
|
-
return;
|
|
55
|
-
} // When a user hits ENTER, we'll clear the selection
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
if (match(event.code, Enter)) {
|
|
59
|
-
clearSelection(event);
|
|
60
|
-
|
|
61
|
-
if (onClearSelection) {
|
|
62
|
-
onClearSelection(event);
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
};
|
|
66
|
-
|
|
67
48
|
var description = selectionCount ? t('clear.all') : t('clear.selection');
|
|
68
49
|
var tagClasses = cx("".concat(prefix, "--tag"), "".concat(prefix, "--tag--filter"), "".concat(prefix, "--tag--high-contrast"), _defineProperty({}, "".concat(prefix, "--tag--disabled"), disabled));
|
|
50
|
+
/* eslint-disable jsx-a11y/click-events-have-key-events */
|
|
51
|
+
|
|
69
52
|
return selectionCount ? /*#__PURE__*/React__default.createElement("div", {
|
|
70
53
|
className: tagClasses
|
|
71
54
|
}, /*#__PURE__*/React__default.createElement("span", {
|
|
@@ -73,19 +56,17 @@ var ListBoxSelection = function ListBoxSelection(_ref) {
|
|
|
73
56
|
title: "".concat(selectionCount)
|
|
74
57
|
}, selectionCount), /*#__PURE__*/React__default.createElement("div", {
|
|
75
58
|
role: "button",
|
|
76
|
-
tabIndex:
|
|
59
|
+
tabIndex: -1,
|
|
77
60
|
className: "".concat(prefix, "--tag__close-icon"),
|
|
78
61
|
onClick: handleOnClick,
|
|
79
|
-
onKeyDown: handleOnKeyDown,
|
|
80
62
|
"aria-label": t('clear.all'),
|
|
81
63
|
title: description,
|
|
82
64
|
"aria-disabled": readOnly ? true : undefined
|
|
83
65
|
}, _Close || (_Close = /*#__PURE__*/React__default.createElement(Close, null)))) : /*#__PURE__*/React__default.createElement("div", {
|
|
84
66
|
role: "button",
|
|
85
67
|
className: className,
|
|
86
|
-
tabIndex:
|
|
68
|
+
tabIndex: -1,
|
|
87
69
|
onClick: handleOnClick,
|
|
88
|
-
onKeyDown: handleOnKeyDown,
|
|
89
70
|
"aria-label": description,
|
|
90
71
|
title: description
|
|
91
72
|
}, selectionCount, _Close2 || (_Close2 = /*#__PURE__*/React__default.createElement(Close, null)));
|