@carbon/react 1.15.0-rc.0 → 1.16.0-rc.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 +2 -1
- package/es/components/ComboBox/ComboBox.js +45 -24
- package/es/components/DataTable/TableExpandHeader.js +10 -2
- package/es/components/DataTable/TableExpandRow.js +2 -4
- package/es/components/DataTable/TableHeader.js +1 -1
- package/es/components/DatePicker/DatePicker.js +10 -8
- package/es/components/Dropdown/Dropdown.js +2 -2
- package/es/components/FluidComboBox/FluidComboBox.Skeleton.js +41 -0
- package/es/components/FluidComboBox/FluidComboBox.js +140 -0
- package/es/components/FluidMultiSelect/FluidMultiSelect.Skeleton.js +41 -0
- package/es/components/FluidMultiSelect/FluidMultiSelect.js +151 -0
- package/es/components/FluidSelect/FluidSelect.Skeleton.js +41 -0
- package/es/components/FluidSelect/FluidSelect.js +93 -0
- package/es/components/FluidTextArea/FluidTextArea.js +2 -1
- package/es/components/InlineLoading/InlineLoading.js +2 -4
- package/es/components/ListBox/ListBox.js +2 -1
- package/es/components/ModalWrapper/ModalWrapper.js +8 -0
- package/es/components/MultiSelect/FilterableMultiSelect.js +41 -21
- package/es/components/MultiSelect/MultiSelect.js +28 -12
- package/es/components/OverflowMenu/OverflowMenu.js +2 -2
- package/es/components/Pagination/Pagination.js +271 -270
- package/es/components/Pagination/index.js +1 -6
- package/es/components/Select/Select.js +23 -5
- package/es/components/TextArea/TextArea.js +2 -2
- package/es/components/TextInput/ControlledPasswordInput.js +2 -3
- package/es/components/TextInput/PasswordInput.js +3 -3
- package/es/components/TextInput/TextInput.js +6 -7
- package/es/components/Tile/next/Tile.js +18 -22
- package/es/components/Tooltip/next/DefinitionTooltip.js +11 -2
- package/es/components/UIShell/HeaderMenu.js +15 -4
- package/es/components/UIShell/SideNavMenu.js +2 -1
- package/es/index.js +14 -8
- package/es/internal/useNormalizedInputProps.js +2 -1
- package/lib/components/CodeSnippet/CodeSnippet.js +2 -1
- package/lib/components/ComboBox/ComboBox.js +44 -23
- package/lib/components/DataTable/TableExpandHeader.js +10 -2
- package/lib/components/DataTable/TableExpandRow.js +2 -4
- package/lib/components/DataTable/TableHeader.js +1 -1
- package/lib/components/DatePicker/DatePicker.js +10 -8
- package/lib/components/Dropdown/Dropdown.js +2 -2
- package/lib/components/FluidComboBox/FluidComboBox.Skeleton.js +51 -0
- package/lib/components/FluidComboBox/FluidComboBox.js +150 -0
- package/lib/components/FluidMultiSelect/FluidMultiSelect.Skeleton.js +51 -0
- package/lib/components/FluidMultiSelect/FluidMultiSelect.js +161 -0
- package/lib/components/FluidSelect/FluidSelect.Skeleton.js +51 -0
- package/lib/components/FluidSelect/FluidSelect.js +103 -0
- package/lib/components/FluidTextArea/FluidTextArea.js +2 -1
- package/lib/components/InlineLoading/InlineLoading.js +2 -4
- package/lib/components/ListBox/ListBox.js +2 -1
- package/lib/components/ModalWrapper/ModalWrapper.js +8 -0
- package/lib/components/MultiSelect/FilterableMultiSelect.js +40 -20
- package/lib/components/MultiSelect/MultiSelect.js +27 -11
- package/lib/components/OverflowMenu/OverflowMenu.js +2 -2
- package/lib/components/Pagination/Pagination.js +269 -268
- package/lib/components/Pagination/index.js +2 -24
- package/lib/components/Select/Select.js +21 -3
- package/lib/components/TextArea/TextArea.js +2 -2
- package/lib/components/TextInput/ControlledPasswordInput.js +2 -3
- package/lib/components/TextInput/PasswordInput.js +3 -3
- package/lib/components/TextInput/TextInput.js +6 -7
- package/lib/components/Tile/next/Tile.js +18 -22
- package/lib/components/Tooltip/next/DefinitionTooltip.js +11 -2
- package/lib/components/UIShell/HeaderMenu.js +15 -4
- package/lib/components/UIShell/SideNavMenu.js +2 -1
- package/lib/index.js +98 -86
- package/lib/internal/useNormalizedInputProps.js +2 -1
- package/package.json +5 -5
- package/scss/components/fluid-select/_fluid-select.scss +9 -0
- package/scss/components/fluid-select/_index.scss +9 -0
- package/es/components/FileUploader/index.js +0 -15
- package/es/components/Pagination/next/Pagination.js +0 -421
- package/lib/components/FileUploader/index.js +0 -39
- package/lib/components/Pagination/next/Pagination.js +0 -431
|
@@ -16,6 +16,7 @@ import Button from '../Button/Button.js';
|
|
|
16
16
|
import CopyButton from '../CopyButton/CopyButton.js';
|
|
17
17
|
import uniqueId from '../../tools/uniqueId.js';
|
|
18
18
|
import copy from 'copy-to-clipboard';
|
|
19
|
+
import deprecate from '../../prop-types/deprecate.js';
|
|
19
20
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
20
21
|
|
|
21
22
|
var _excluded = ["className", "type", "children", "disabled", "feedback", "feedbackTimeout", "onClick", "ariaLabel", "copyText", "copyButtonDescription", "light", "showMoreText", "showLessText", "hideCopyButton", "wrapText", "maxCollapsedNumberOfRows", "maxExpandedNumberOfRows", "minCollapsedNumberOfRows", "minExpandedNumberOfRows"];
|
|
@@ -303,7 +304,7 @@ CodeSnippet.propTypes = {
|
|
|
303
304
|
* Specify whether you are using the light variant of the Code Snippet,
|
|
304
305
|
* typically used for inline snippet to display an alternate color
|
|
305
306
|
*/
|
|
306
|
-
light: PropTypes.bool,
|
|
307
|
+
light: deprecate(PropTypes.bool, 'The `light` prop for `CodeSnippet` has ' + 'been deprecated in favor of the new `Layer` component. It will be removed in the next major release.'),
|
|
307
308
|
|
|
308
309
|
/**
|
|
309
310
|
* Specify the maximum number of rows to be shown when in collapsed view
|
|
@@ -9,14 +9,16 @@ import { objectWithoutProperties as _objectWithoutProperties, slicedToArray as _
|
|
|
9
9
|
import cx from 'classnames';
|
|
10
10
|
import Downshift from 'downshift';
|
|
11
11
|
import PropTypes from 'prop-types';
|
|
12
|
-
import React__default, { useRef, useState, useEffect } from 'react';
|
|
12
|
+
import React__default, { useContext, useRef, useState, useEffect } from 'react';
|
|
13
13
|
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
17
|
import mergeRefs from '../../tools/mergeRefs.js';
|
|
18
18
|
import { useFeatureFlag } from '../FeatureFlags/index.js';
|
|
19
|
+
import deprecate from '../../prop-types/deprecate.js';
|
|
19
20
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
21
|
+
import { FormContext } from '../FluidForm/FormContext.js';
|
|
20
22
|
import { match } from '../../internal/keyboard/match.js';
|
|
21
23
|
import { Text } from '../Text/Text.js';
|
|
22
24
|
import ListBox from '../ListBox/ListBox.js';
|
|
@@ -79,7 +81,7 @@ var findHighlightedIndex = function findHighlightedIndex(_ref2, inputValue) {
|
|
|
79
81
|
|
|
80
82
|
var getInstanceId = setupGetInstanceId();
|
|
81
83
|
var ComboBox = /*#__PURE__*/React__default.forwardRef(function (props, ref) {
|
|
82
|
-
var _cx, _Text;
|
|
84
|
+
var _cx, _ref4, _Text;
|
|
83
85
|
|
|
84
86
|
var ariaLabel = props.ariaLabel,
|
|
85
87
|
containerClassName = props.className,
|
|
@@ -111,6 +113,10 @@ var ComboBox = /*#__PURE__*/React__default.forwardRef(function (props, ref) {
|
|
|
111
113
|
var rest = _objectWithoutProperties(props, _excluded);
|
|
112
114
|
|
|
113
115
|
var prefix = usePrefix();
|
|
116
|
+
|
|
117
|
+
var _useContext = useContext(FormContext),
|
|
118
|
+
isFluid = _useContext.isFluid;
|
|
119
|
+
|
|
114
120
|
var textInput = useRef();
|
|
115
121
|
var comboBoxInstanceId = getInstanceId();
|
|
116
122
|
|
|
@@ -124,15 +130,20 @@ var ComboBox = /*#__PURE__*/React__default.forwardRef(function (props, ref) {
|
|
|
124
130
|
inputValue = _useState2[0],
|
|
125
131
|
setInputValue = _useState2[1];
|
|
126
132
|
|
|
127
|
-
var _useState3 = useState(
|
|
133
|
+
var _useState3 = useState(false),
|
|
128
134
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
129
|
-
|
|
130
|
-
|
|
135
|
+
isFocused = _useState4[0],
|
|
136
|
+
setIsFocused = _useState4[1];
|
|
131
137
|
|
|
132
138
|
var _useState5 = useState(null),
|
|
133
139
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
134
|
-
|
|
135
|
-
|
|
140
|
+
prevSelectedItem = _useState6[0],
|
|
141
|
+
setPrevSelectedItem = _useState6[1];
|
|
142
|
+
|
|
143
|
+
var _useState7 = useState(null),
|
|
144
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
145
|
+
doneInitialSelectedItem = _useState8[0],
|
|
146
|
+
setDoneInitialSelectedItem = _useState8[1];
|
|
136
147
|
|
|
137
148
|
var savedOnInputChange = useRef(onInputChange);
|
|
138
149
|
|
|
@@ -215,7 +226,7 @@ var ComboBox = /*#__PURE__*/React__default.forwardRef(function (props, ref) {
|
|
|
215
226
|
var titleClasses = cx("".concat(prefix, "--label"), _defineProperty({}, "".concat(prefix, "--label--disabled"), disabled));
|
|
216
227
|
var comboBoxHelperId = !helperText ? undefined : "combobox-helper-text-".concat(comboBoxInstanceId);
|
|
217
228
|
var helperClasses = cx("".concat(prefix, "--form__helper-text"), _defineProperty({}, "".concat(prefix, "--form__helper-text--disabled"), disabled));
|
|
218
|
-
var wrapperClasses = cx("".concat(prefix, "--list-box__wrapper"), [enabled ? containerClassName : null]);
|
|
229
|
+
var wrapperClasses = cx("".concat(prefix, "--list-box__wrapper"), [enabled ? containerClassName : null, (_ref4 = {}, _defineProperty(_ref4, "".concat(prefix, "--list-box__wrapper--fluid--invalid"), isFluid && invalid), _defineProperty(_ref4, "".concat(prefix, "--list-box__wrapper--fluid--focus"), isFluid && isFocused), _ref4)]);
|
|
219
230
|
var inputClasses = cx("".concat(prefix, "--text-input"), _defineProperty({}, "".concat(prefix, "--text-input--empty"), !inputValue)); // needs to be Capitalized for react to render it correctly
|
|
220
231
|
|
|
221
232
|
var ItemToElement = itemToElement;
|
|
@@ -237,21 +248,21 @@ var ComboBox = /*#__PURE__*/React__default.forwardRef(function (props, ref) {
|
|
|
237
248
|
initialSelectedItem: initialSelectedItem,
|
|
238
249
|
inputId: id,
|
|
239
250
|
selectedItem: selectedItem
|
|
240
|
-
}), function (
|
|
251
|
+
}), function (_ref5) {
|
|
241
252
|
var _textInput$current;
|
|
242
253
|
|
|
243
|
-
var getInputProps =
|
|
244
|
-
getItemProps =
|
|
245
|
-
getLabelProps =
|
|
246
|
-
getMenuProps =
|
|
247
|
-
getRootProps =
|
|
248
|
-
getToggleButtonProps =
|
|
249
|
-
isOpen =
|
|
250
|
-
inputValue =
|
|
251
|
-
selectedItem =
|
|
252
|
-
highlightedIndex =
|
|
253
|
-
clearSelection =
|
|
254
|
-
toggleMenu =
|
|
254
|
+
var getInputProps = _ref5.getInputProps,
|
|
255
|
+
getItemProps = _ref5.getItemProps,
|
|
256
|
+
getLabelProps = _ref5.getLabelProps,
|
|
257
|
+
getMenuProps = _ref5.getMenuProps,
|
|
258
|
+
getRootProps = _ref5.getRootProps,
|
|
259
|
+
getToggleButtonProps = _ref5.getToggleButtonProps,
|
|
260
|
+
isOpen = _ref5.isOpen,
|
|
261
|
+
inputValue = _ref5.inputValue,
|
|
262
|
+
selectedItem = _ref5.selectedItem,
|
|
263
|
+
highlightedIndex = _ref5.highlightedIndex,
|
|
264
|
+
clearSelection = _ref5.clearSelection,
|
|
265
|
+
toggleMenu = _ref5.toggleMenu;
|
|
255
266
|
var rootProps = getRootProps({}, {
|
|
256
267
|
suppressRefError: true
|
|
257
268
|
});
|
|
@@ -292,12 +303,23 @@ var ComboBox = /*#__PURE__*/React__default.forwardRef(function (props, ref) {
|
|
|
292
303
|
}
|
|
293
304
|
}
|
|
294
305
|
});
|
|
306
|
+
|
|
307
|
+
var handleFocus = function handleFocus(evt) {
|
|
308
|
+
if (evt.target.type === 'button') {
|
|
309
|
+
setIsFocused(false);
|
|
310
|
+
} else {
|
|
311
|
+
setIsFocused(evt.type === 'focus' ? true : false);
|
|
312
|
+
}
|
|
313
|
+
};
|
|
314
|
+
|
|
295
315
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
296
316
|
className: wrapperClasses
|
|
297
317
|
}, titleText && /*#__PURE__*/React__default.createElement(Text, _extends({
|
|
298
318
|
as: "label",
|
|
299
319
|
className: titleClasses
|
|
300
320
|
}, labelProps), titleText), /*#__PURE__*/React__default.createElement(ListBox, {
|
|
321
|
+
onFocus: handleFocus,
|
|
322
|
+
onBlur: handleFocus,
|
|
301
323
|
className: className,
|
|
302
324
|
disabled: disabled,
|
|
303
325
|
invalid: invalid,
|
|
@@ -353,7 +375,7 @@ var ComboBox = /*#__PURE__*/React__default.forwardRef(function (props, ref) {
|
|
|
353
375
|
}, item)) : itemToString(item), selectedItem === item && /*#__PURE__*/React__default.createElement(Checkmark, {
|
|
354
376
|
className: "".concat(prefix, "--list-box__menu-item__selected-icon")
|
|
355
377
|
}));
|
|
356
|
-
}) : null)), helperText && !invalid && !warn && (_Text || (_Text = /*#__PURE__*/React__default.createElement(Text, {
|
|
378
|
+
}) : null)), helperText && !invalid && !warn && !isFluid && (_Text || (_Text = /*#__PURE__*/React__default.createElement(Text, {
|
|
357
379
|
as: "div",
|
|
358
380
|
id: comboBoxHelperId,
|
|
359
381
|
className: helperClasses
|
|
@@ -436,7 +458,7 @@ ComboBox.propTypes = {
|
|
|
436
458
|
/**
|
|
437
459
|
* should use "light theme" (white background)?
|
|
438
460
|
*/
|
|
439
|
-
light: PropTypes.bool,
|
|
461
|
+
light: deprecate(PropTypes.bool, 'The `light` prop for `Combobox` has ' + 'been deprecated in favor of the new `Layer` component. It will be removed in the next major release.'),
|
|
440
462
|
|
|
441
463
|
/**
|
|
442
464
|
* `onChange` is a utility for this controlled component to communicate to a
|
|
@@ -521,7 +543,6 @@ ComboBox.defaultProps = {
|
|
|
521
543
|
shouldFilterItem: defaultShouldFilterItem,
|
|
522
544
|
type: 'default',
|
|
523
545
|
ariaLabel: 'Choose an item',
|
|
524
|
-
light: false,
|
|
525
546
|
direction: 'bottom'
|
|
526
547
|
};
|
|
527
548
|
var ComboBox$1 = ComboBox;
|
|
@@ -14,13 +14,15 @@ import React__default from 'react';
|
|
|
14
14
|
import { ChevronRight } from '@carbon/icons-react';
|
|
15
15
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
16
16
|
|
|
17
|
-
var _excluded = ["ariaLabel", "className", "enableExpando", "enableToggle", "isExpanded", "onExpand", "expandIconDescription", "children"];
|
|
17
|
+
var _excluded = ["ariaLabel", "className", "enableExpando", "enableToggle", "id", "isExpanded", "onExpand", "expandIconDescription", "children"];
|
|
18
18
|
|
|
19
19
|
var TableExpandHeader = function TableExpandHeader(_ref) {
|
|
20
20
|
var ariaLabel = _ref.ariaLabel,
|
|
21
21
|
headerClassName = _ref.className,
|
|
22
22
|
enableExpando = _ref.enableExpando,
|
|
23
23
|
enableToggle = _ref.enableToggle,
|
|
24
|
+
_ref$id = _ref.id,
|
|
25
|
+
id = _ref$id === void 0 ? 'expand' : _ref$id,
|
|
24
26
|
isExpanded = _ref.isExpanded,
|
|
25
27
|
onExpand = _ref.onExpand,
|
|
26
28
|
expandIconDescription = _ref.expandIconDescription,
|
|
@@ -33,7 +35,8 @@ var TableExpandHeader = function TableExpandHeader(_ref) {
|
|
|
33
35
|
return /*#__PURE__*/React__default.createElement("th", _extends({
|
|
34
36
|
scope: "col",
|
|
35
37
|
className: className,
|
|
36
|
-
"data-previous-value": previousValue
|
|
38
|
+
"data-previous-value": previousValue,
|
|
39
|
+
id: id
|
|
37
40
|
}, rest), enableExpando || enableToggle ? /*#__PURE__*/React__default.createElement("button", {
|
|
38
41
|
type: "button",
|
|
39
42
|
className: "".concat(prefix, "--table-expand__button"),
|
|
@@ -70,6 +73,11 @@ TableExpandHeader.propTypes = {
|
|
|
70
73
|
*/
|
|
71
74
|
expandIconDescription: PropTypes.string,
|
|
72
75
|
|
|
76
|
+
/**
|
|
77
|
+
* Supply an id to the th element.
|
|
78
|
+
*/
|
|
79
|
+
id: PropTypes.string,
|
|
80
|
+
|
|
73
81
|
/**
|
|
74
82
|
* Specify whether this row is expanded or not. This helps coordinate data
|
|
75
83
|
* attributes so that `TableExpandRow` and `TableExpandedRow` work together
|
|
@@ -25,7 +25,8 @@ var TableExpandRow = function TableExpandRow(_ref) {
|
|
|
25
25
|
onExpand = _ref.onExpand,
|
|
26
26
|
expandIconDescription = _ref.expandIconDescription,
|
|
27
27
|
isSelected = _ref.isSelected,
|
|
28
|
-
expandHeader = _ref.expandHeader,
|
|
28
|
+
_ref$expandHeader = _ref.expandHeader,
|
|
29
|
+
expandHeader = _ref$expandHeader === void 0 ? 'expand' : _ref$expandHeader,
|
|
29
30
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
30
31
|
|
|
31
32
|
var prefix = usePrefix();
|
|
@@ -85,9 +86,6 @@ TableExpandRow.propTypes = {
|
|
|
85
86
|
*/
|
|
86
87
|
onExpand: PropTypes.func.isRequired
|
|
87
88
|
};
|
|
88
|
-
TableExpandRow.defaultProps = {
|
|
89
|
-
expandHeader: 'expand'
|
|
90
|
-
};
|
|
91
89
|
var TableExpandRow$1 = TableExpandRow;
|
|
92
90
|
|
|
93
91
|
export { TableExpandRow$1 as default };
|
|
@@ -80,7 +80,7 @@ var TableHeader = /*#__PURE__*/React__default.forwardRef(function TableHeader(_r
|
|
|
80
80
|
}, children) : null);
|
|
81
81
|
}
|
|
82
82
|
|
|
83
|
-
var className = cx(headerClassName, (_cx = {}, _defineProperty(_cx, "".concat(prefix, "--table-sort"), true), _defineProperty(_cx, "".concat(prefix, "--table-sort--active"), isSortHeader && sortDirection !== sortStates.NONE), _defineProperty(_cx, "".concat(prefix, "--table-sort--
|
|
83
|
+
var className = cx(headerClassName, (_cx = {}, _defineProperty(_cx, "".concat(prefix, "--table-sort"), true), _defineProperty(_cx, "".concat(prefix, "--table-sort--active"), isSortHeader && sortDirection !== sortStates.NONE), _defineProperty(_cx, "".concat(prefix, "--table-sort--descending"), isSortHeader && sortDirection === sortStates.DESC), _cx));
|
|
84
84
|
var ariaSort = !isSortHeader ? 'none' : sortDirections[sortDirection];
|
|
85
85
|
var sortDescription = t('carbon.table.header.icon.description', {
|
|
86
86
|
header: children,
|
|
@@ -15,6 +15,7 @@ import DatePickerInput from '../DatePickerInput/DatePickerInput.js';
|
|
|
15
15
|
import carbonFlatpickrAppendToPlugin from './plugins/appendToPlugin.js';
|
|
16
16
|
import carbonFlatpickrFixEventsPlugin from './plugins/fixEventsPlugin.js';
|
|
17
17
|
import carbonFlatpickrRangePlugin from './plugins/rangePlugin.js';
|
|
18
|
+
import deprecate from '../../prop-types/deprecate.js';
|
|
18
19
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
19
20
|
import { useSavedCallback } from '../../internal/useSavedCallback.js';
|
|
20
21
|
import { match } from '../../internal/keyboard/match.js';
|
|
@@ -145,7 +146,7 @@ function updateClassNames(calendar, prefix) {
|
|
|
145
146
|
}
|
|
146
147
|
}
|
|
147
148
|
|
|
148
|
-
function DatePicker(_ref) {
|
|
149
|
+
var DatePicker = /*#__PURE__*/React__default.forwardRef(function DatePicker(_ref, ref) {
|
|
149
150
|
var _cx;
|
|
150
151
|
|
|
151
152
|
var allowInput = _ref.allowInput,
|
|
@@ -352,12 +353,12 @@ function DatePicker(_ref) {
|
|
|
352
353
|
}
|
|
353
354
|
}, [dateFormat]);
|
|
354
355
|
useEffect(function () {
|
|
355
|
-
if (calendarRef.current
|
|
356
|
+
if (calendarRef.current) {
|
|
356
357
|
calendarRef.current.set('minDate', minDate);
|
|
357
358
|
}
|
|
358
359
|
}, [minDate]);
|
|
359
360
|
useEffect(function () {
|
|
360
|
-
if (calendarRef.current
|
|
361
|
+
if (calendarRef.current) {
|
|
361
362
|
calendarRef.current.set('maxDate', maxDate);
|
|
362
363
|
}
|
|
363
364
|
}, [maxDate]);
|
|
@@ -388,12 +389,12 @@ function DatePicker(_ref) {
|
|
|
388
389
|
}
|
|
389
390
|
}, [value, prefix]);
|
|
390
391
|
return /*#__PURE__*/React__default.createElement("div", _extends({
|
|
391
|
-
className: wrapperClasses
|
|
392
|
+
className: wrapperClasses,
|
|
393
|
+
ref: ref
|
|
392
394
|
}, rest), /*#__PURE__*/React__default.createElement("div", {
|
|
393
395
|
className: datePickerClasses
|
|
394
396
|
}, childrenWithProps));
|
|
395
|
-
}
|
|
396
|
-
|
|
397
|
+
});
|
|
397
398
|
DatePicker.propTypes = {
|
|
398
399
|
/**
|
|
399
400
|
* flatpickr prop passthrough. Allows the user to enter a date directly
|
|
@@ -453,7 +454,7 @@ DatePicker.propTypes = {
|
|
|
453
454
|
/**
|
|
454
455
|
* `true` to use the light version.
|
|
455
456
|
*/
|
|
456
|
-
light: PropTypes.bool,
|
|
457
|
+
light: deprecate(PropTypes.bool, 'The `light` prop for `DatePicker` has ' + 'been deprecated in favor of the new `Layer` component. It will be removed in the next major release.'),
|
|
457
458
|
|
|
458
459
|
/**
|
|
459
460
|
* The language locale used to format the days of the week, months, and numbers. The full list of supported locales can be found here https://github.com/flatpickr/flatpickr/tree/master/src/l10n
|
|
@@ -557,5 +558,6 @@ DatePicker.propTypes = {
|
|
|
557
558
|
*/
|
|
558
559
|
value: PropTypes.oneOfType([PropTypes.string, PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.object])), PropTypes.object, PropTypes.number])
|
|
559
560
|
};
|
|
561
|
+
var DatePicker$1 = DatePicker;
|
|
560
562
|
|
|
561
|
-
export { DatePicker as default };
|
|
563
|
+
export { DatePicker$1 as default };
|
|
@@ -13,6 +13,7 @@ import PropTypes from 'prop-types';
|
|
|
13
13
|
import { WarningFilled, WarningAltFilled, Checkmark } from '@carbon/icons-react';
|
|
14
14
|
import '../ListBox/index.js';
|
|
15
15
|
import mergeRefs from '../../tools/mergeRefs.js';
|
|
16
|
+
import deprecate from '../../prop-types/deprecate.js';
|
|
16
17
|
import { useFeatureFlag } from '../FeatureFlags/index.js';
|
|
17
18
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
18
19
|
import { FormContext } from '../FluidForm/FormContext.js';
|
|
@@ -268,7 +269,7 @@ Dropdown.propTypes = {
|
|
|
268
269
|
/**
|
|
269
270
|
* `true` to use the light version.
|
|
270
271
|
*/
|
|
271
|
-
light: PropTypes.bool,
|
|
272
|
+
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.'),
|
|
272
273
|
|
|
273
274
|
/**
|
|
274
275
|
* `onChange` is a utility for this controlled component to communicate to a
|
|
@@ -323,7 +324,6 @@ Dropdown.defaultProps = {
|
|
|
323
324
|
type: 'default',
|
|
324
325
|
itemToString: defaultItemToString,
|
|
325
326
|
itemToElement: null,
|
|
326
|
-
light: false,
|
|
327
327
|
titleText: '',
|
|
328
328
|
helperText: '',
|
|
329
329
|
direction: 'bottom'
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2016, 2022
|
|
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 { objectWithoutProperties as _objectWithoutProperties, extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
9
|
+
import PropTypes from 'prop-types';
|
|
10
|
+
import React__default from 'react';
|
|
11
|
+
import cx from 'classnames';
|
|
12
|
+
import { usePrefix } from '../../internal/usePrefix.js';
|
|
13
|
+
|
|
14
|
+
var _excluded = ["className"];
|
|
15
|
+
|
|
16
|
+
var FluidComboBoxSkeleton = function FluidComboBoxSkeleton(_ref) {
|
|
17
|
+
var className = _ref.className,
|
|
18
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
19
|
+
|
|
20
|
+
var prefix = usePrefix();
|
|
21
|
+
var wrapperClasses = cx(className, "".concat(prefix, "--skeleton"), "".concat(prefix, "--list-box"));
|
|
22
|
+
return /*#__PURE__*/React__default.createElement("div", {
|
|
23
|
+
className: "".concat(prefix, "--list-box__wrapper--fluid")
|
|
24
|
+
}, /*#__PURE__*/React__default.createElement("div", _extends({
|
|
25
|
+
className: wrapperClasses
|
|
26
|
+
}, rest), /*#__PURE__*/React__default.createElement("span", {
|
|
27
|
+
className: "".concat(prefix, "--list-box__label")
|
|
28
|
+
}), /*#__PURE__*/React__default.createElement("div", {
|
|
29
|
+
className: "".concat(prefix, "--list-box__field")
|
|
30
|
+
})));
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
FluidComboBoxSkeleton.propTypes = {
|
|
34
|
+
/**
|
|
35
|
+
* Specify an optional className to add.
|
|
36
|
+
*/
|
|
37
|
+
className: PropTypes.string
|
|
38
|
+
};
|
|
39
|
+
var FluidComboBoxSkeleton$1 = FluidComboBoxSkeleton;
|
|
40
|
+
|
|
41
|
+
export { FluidComboBoxSkeleton$1 as default };
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2016, 2022
|
|
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 { objectWithoutProperties as _objectWithoutProperties, defineProperty as _defineProperty, extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
9
|
+
import PropTypes from 'prop-types';
|
|
10
|
+
import React__default from 'react';
|
|
11
|
+
import cx from 'classnames';
|
|
12
|
+
import ComboBox from '../ComboBox/ComboBox.js';
|
|
13
|
+
import { usePrefix } from '../../internal/usePrefix.js';
|
|
14
|
+
import { FormContext } from '../FluidForm/FormContext.js';
|
|
15
|
+
|
|
16
|
+
var _excluded = ["className", "isCondensed"];
|
|
17
|
+
var FluidComboBox = /*#__PURE__*/React__default.forwardRef(function FluidComboBox(_ref, ref) {
|
|
18
|
+
var className = _ref.className,
|
|
19
|
+
isCondensed = _ref.isCondensed,
|
|
20
|
+
other = _objectWithoutProperties(_ref, _excluded);
|
|
21
|
+
|
|
22
|
+
var prefix = usePrefix();
|
|
23
|
+
var classNames = cx("".concat(prefix, "--list-box__wrapper--fluid"), className, _defineProperty({}, "".concat(prefix, "--list-box__wrapper--fluid--condensed"), isCondensed));
|
|
24
|
+
return /*#__PURE__*/React__default.createElement(FormContext.Provider, {
|
|
25
|
+
value: {
|
|
26
|
+
isFluid: true
|
|
27
|
+
}
|
|
28
|
+
}, /*#__PURE__*/React__default.createElement(ComboBox, _extends({
|
|
29
|
+
ref: ref,
|
|
30
|
+
className: classNames
|
|
31
|
+
}, other)));
|
|
32
|
+
});
|
|
33
|
+
FluidComboBox.propTypes = {
|
|
34
|
+
/**
|
|
35
|
+
* Specify an optional className to be applied to the outer FluidForm wrapper
|
|
36
|
+
*/
|
|
37
|
+
className: PropTypes.string,
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Specify the direction of the dropdown. Can be either top or bottom.
|
|
41
|
+
*/
|
|
42
|
+
direction: PropTypes.oneOf(['top', 'bottom']),
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Specify whether the `<input>` should be disabled
|
|
46
|
+
*/
|
|
47
|
+
disabled: PropTypes.bool,
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Specify a custom `id` for the `<input>`
|
|
51
|
+
*/
|
|
52
|
+
id: PropTypes.string.isRequired,
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Allow users to pass in an arbitrary item or a string (in case their items are an array of strings)
|
|
56
|
+
* from their collection that are pre-selected
|
|
57
|
+
*/
|
|
58
|
+
initialSelectedItem: PropTypes.oneOfType([PropTypes.object, PropTypes.string, PropTypes.number]),
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Specify if the currently selected value is invalid.
|
|
62
|
+
*/
|
|
63
|
+
invalid: PropTypes.bool,
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Provide the text that is displayed when the control is in an invalid state
|
|
67
|
+
*/
|
|
68
|
+
invalidText: PropTypes.node,
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Specify if the `FluidComboBox` should render its menu items in condensed mode
|
|
72
|
+
*/
|
|
73
|
+
isCondensed: PropTypes.bool,
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Function to render items as custom components instead of strings.
|
|
77
|
+
* Defaults to null and is overridden by a getter
|
|
78
|
+
*/
|
|
79
|
+
itemToElement: PropTypes.func,
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Helper function passed to downshift that allows the library to render a
|
|
83
|
+
* given item to a string label. By default, it extracts the `label` field
|
|
84
|
+
* from a given item to serve as the item label in the list.
|
|
85
|
+
*/
|
|
86
|
+
itemToString: PropTypes.func,
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* We try to stay as generic as possible here to allow individuals to pass
|
|
90
|
+
* in a collection of whatever kind of data structure they prefer
|
|
91
|
+
*/
|
|
92
|
+
items: PropTypes.array.isRequired,
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Generic `label` that will be used as the textual representation of what
|
|
96
|
+
* this field is for
|
|
97
|
+
*/
|
|
98
|
+
label: PropTypes.node.isRequired,
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* `onChange` is a utility for this controlled component to communicate to a
|
|
102
|
+
* consuming component what kind of internal state changes are occurring.
|
|
103
|
+
*/
|
|
104
|
+
onChange: PropTypes.func,
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* An optional callback to render the currently selected item as a react element instead of only
|
|
108
|
+
* as a string.
|
|
109
|
+
*/
|
|
110
|
+
renderSelectedItem: PropTypes.func,
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* In the case you want to control the dropdown selection entirely.
|
|
114
|
+
*/
|
|
115
|
+
selectedItem: PropTypes.oneOfType([PropTypes.object, PropTypes.string, PropTypes.number]),
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Provide the title text that will be read by a screen reader when
|
|
119
|
+
* visiting this control
|
|
120
|
+
*/
|
|
121
|
+
titleText: PropTypes.node,
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Callback function for translating ListBoxMenuIcon SVG title
|
|
125
|
+
*/
|
|
126
|
+
translateWithId: PropTypes.func,
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* Specify whether the control is currently in warning state
|
|
130
|
+
*/
|
|
131
|
+
warn: PropTypes.bool,
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Provide the text that is displayed when the control is in warning state
|
|
135
|
+
*/
|
|
136
|
+
warnText: PropTypes.node
|
|
137
|
+
};
|
|
138
|
+
var FluidComboBox$1 = FluidComboBox;
|
|
139
|
+
|
|
140
|
+
export { FluidComboBox$1 as default };
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2016, 2022
|
|
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 { objectWithoutProperties as _objectWithoutProperties, extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
9
|
+
import PropTypes from 'prop-types';
|
|
10
|
+
import React__default from 'react';
|
|
11
|
+
import cx from 'classnames';
|
|
12
|
+
import { usePrefix } from '../../internal/usePrefix.js';
|
|
13
|
+
|
|
14
|
+
var _excluded = ["className"];
|
|
15
|
+
|
|
16
|
+
var FluidMultiSelectSkeleton = function FluidMultiSelectSkeleton(_ref) {
|
|
17
|
+
var className = _ref.className,
|
|
18
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
19
|
+
|
|
20
|
+
var prefix = usePrefix();
|
|
21
|
+
var wrapperClasses = cx(className, "".concat(prefix, "--skeleton"), "".concat(prefix, "--list-box"));
|
|
22
|
+
return /*#__PURE__*/React__default.createElement("div", {
|
|
23
|
+
className: "".concat(prefix, "--list-box__wrapper--fluid")
|
|
24
|
+
}, /*#__PURE__*/React__default.createElement("div", _extends({
|
|
25
|
+
className: wrapperClasses
|
|
26
|
+
}, rest), /*#__PURE__*/React__default.createElement("span", {
|
|
27
|
+
className: "".concat(prefix, "--list-box__label")
|
|
28
|
+
}), /*#__PURE__*/React__default.createElement("div", {
|
|
29
|
+
className: "".concat(prefix, "--list-box__field")
|
|
30
|
+
})));
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
FluidMultiSelectSkeleton.propTypes = {
|
|
34
|
+
/**
|
|
35
|
+
* Specify an optional className to add.
|
|
36
|
+
*/
|
|
37
|
+
className: PropTypes.string
|
|
38
|
+
};
|
|
39
|
+
var FluidMultiSelectSkeleton$1 = FluidMultiSelectSkeleton;
|
|
40
|
+
|
|
41
|
+
export { FluidMultiSelectSkeleton$1 as default };
|