@carbon/react 1.22.0-rc.0 → 1.23.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/{es/components → components}/Checkbox/Checkbox.Skeleton.d.ts +0 -0
- package/es/{es/components → components}/Checkbox/Checkbox.d.ts +0 -0
- package/es/{es/components → components}/Checkbox/index.d.ts +0 -0
- package/es/components/CodeSnippet/CodeSnippet.js +2 -2
- package/es/components/ComboBox/ComboBox.d.ts +151 -0
- package/es/components/ComboBox/ComboBox.js +28 -21
- package/es/components/ComposedModal/ComposedModal.js +2 -2
- package/es/{es/components → components}/DataTable/TableSelectAll.d.ts +0 -0
- package/es/components/DataTable/TableSelectRow.d.ts +88 -0
- package/es/components/DataTable/TableSelectRow.js +3 -5
- package/es/components/DatePicker/DatePicker.js +1 -1
- package/es/components/DatePicker/plugins/fixEventsPlugin.js +10 -1
- package/es/components/DatePicker/plugins/rangePlugin.js +1 -1
- package/es/{es/components → components}/Dropdown/Dropdown.d.ts +0 -0
- package/es/{es/components → components}/Dropdown/index.d.ts +0 -0
- package/es/components/FileUploader/FileUploaderButton.js +14 -16
- package/es/{es/components → components}/FluidForm/FluidForm.d.ts +0 -0
- package/es/{es/components → components}/FluidForm/FormContext.d.ts +0 -0
- package/es/{es/components → components}/FluidForm/index.d.ts +0 -0
- package/es/components/FluidSelect/FluidSelect.js +1 -0
- package/es/components/IconButton/index.js +1 -0
- package/es/{es/components → components}/ListBox/ListBox.d.ts +0 -0
- package/es/{es/components → components}/ListBox/ListBoxField.d.ts +0 -0
- package/es/{es/components → components}/ListBox/ListBoxMenu.d.ts +0 -0
- package/es/{es/components → components}/ListBox/ListBoxMenuIcon.d.ts +0 -0
- package/es/{es/components → components}/ListBox/ListBoxMenuItem.d.ts +0 -0
- package/es/{es/components → components}/ListBox/ListBoxPropTypes.d.ts +0 -0
- package/es/{es/components → components}/ListBox/ListBoxSelection.d.ts +0 -0
- package/es/{es/components → components}/ListBox/index.d.ts +0 -0
- package/es/{es/components → components}/NumberInput/NumberInput.Skeleton.d.ts +0 -0
- package/es/components/NumberInput/NumberInput.d.ts +132 -0
- package/es/components/NumberInput/NumberInput.js +9 -7
- package/es/components/OverflowMenu/OverflowMenu.js +28 -34
- package/es/components/Pagination/Pagination.js +1 -0
- package/es/components/Pagination/experimental/PageSelector.js +1 -0
- package/es/components/Pagination/experimental/Pagination.js +1 -0
- package/es/components/Select/Select.Skeleton.d.ts +33 -0
- package/es/components/Select/index.js +1 -0
- package/es/{es/components → components}/Slider/Slider.Skeleton.d.ts +0 -0
- package/es/{es/components → components}/Text/Text.d.ts +0 -0
- package/es/{es/components → components}/Text/TextDirection.d.ts +0 -0
- package/es/{es/components → components}/Text/createTextComponent.d.ts +0 -0
- package/es/{es/components → components}/Text/index.d.ts +0 -0
- package/es/components/TextArea/TextArea.js +1 -0
- package/es/components/Toggle/Toggle.js +54 -33
- package/es/components/Toggletip/index.js +26 -1
- package/es/components/Tooltip/Tooltip.js +33 -4
- package/es/{es/index.d.ts → index.d.ts} +0 -0
- package/es/internal/FloatingMenu.js +1 -4
- package/es/internal/useNormalizedInputProps.js +3 -3
- package/es/{es/internal → internal}/usePrefix.d.ts +0 -0
- package/lib/{lib/components → components}/Checkbox/Checkbox.Skeleton.d.ts +0 -0
- package/lib/{lib/components → components}/Checkbox/Checkbox.d.ts +0 -0
- package/lib/{lib/components → components}/Checkbox/index.d.ts +0 -0
- package/lib/components/CodeSnippet/CodeSnippet.js +4 -3
- package/lib/components/ComboBox/ComboBox.d.ts +151 -0
- package/lib/components/ComboBox/ComboBox.js +28 -21
- package/lib/components/ComposedModal/ComposedModal.js +2 -2
- package/lib/{lib/components → components}/DataTable/TableSelectAll.d.ts +0 -0
- package/lib/components/DataTable/TableSelectRow.d.ts +88 -0
- package/lib/components/DataTable/TableSelectRow.js +2 -4
- package/lib/components/DatePicker/DatePicker.js +9 -8
- package/lib/components/DatePicker/plugins/fixEventsPlugin.js +10 -1
- package/lib/components/DatePicker/plugins/rangePlugin.js +6 -2
- package/lib/{lib/components → components}/Dropdown/Dropdown.d.ts +0 -0
- package/lib/{lib/components → components}/Dropdown/index.d.ts +0 -0
- package/lib/components/FileUploader/FileUploaderButton.js +14 -16
- package/lib/{lib/components → components}/FluidForm/FluidForm.d.ts +0 -0
- package/lib/{lib/components → components}/FluidForm/FormContext.d.ts +0 -0
- package/lib/{lib/components → components}/FluidForm/index.d.ts +0 -0
- package/lib/components/FluidSelect/FluidSelect.js +1 -0
- package/lib/components/IconButton/index.js +1 -0
- package/lib/{lib/components → components}/ListBox/ListBox.d.ts +0 -0
- package/lib/{lib/components → components}/ListBox/ListBoxField.d.ts +0 -0
- package/lib/{lib/components → components}/ListBox/ListBoxMenu.d.ts +0 -0
- package/lib/{lib/components → components}/ListBox/ListBoxMenuIcon.d.ts +0 -0
- package/lib/{lib/components → components}/ListBox/ListBoxMenuItem.d.ts +0 -0
- package/lib/{lib/components → components}/ListBox/ListBoxPropTypes.d.ts +0 -0
- package/lib/{lib/components → components}/ListBox/ListBoxSelection.d.ts +0 -0
- package/lib/{lib/components → components}/ListBox/index.d.ts +0 -0
- package/lib/{lib/components → components}/NumberInput/NumberInput.Skeleton.d.ts +0 -0
- package/lib/components/NumberInput/NumberInput.d.ts +132 -0
- package/lib/components/NumberInput/NumberInput.js +9 -7
- package/lib/components/OverflowMenu/OverflowMenu.js +27 -52
- package/lib/components/Pagination/Pagination.js +1 -0
- package/lib/components/Pagination/experimental/PageSelector.js +1 -0
- package/lib/components/Pagination/experimental/Pagination.js +1 -0
- package/lib/components/Select/Select.Skeleton.d.ts +33 -0
- package/lib/components/Select/index.js +2 -0
- package/lib/{lib/components → components}/Slider/Slider.Skeleton.d.ts +0 -0
- package/lib/{lib/components → components}/Text/Text.d.ts +0 -0
- package/lib/{lib/components → components}/Text/TextDirection.d.ts +0 -0
- package/lib/{lib/components → components}/Text/createTextComponent.d.ts +0 -0
- package/lib/{lib/components → components}/Text/index.d.ts +0 -0
- package/lib/components/TextArea/TextArea.js +1 -0
- package/lib/components/Toggle/Toggle.js +53 -32
- package/lib/components/Toggletip/index.js +26 -1
- package/lib/components/Tooltip/Tooltip.js +31 -2
- package/lib/{lib/index.d.ts → index.d.ts} +0 -0
- package/lib/internal/FloatingMenu.js +1 -4
- package/lib/internal/useNormalizedInputProps.js +3 -3
- package/lib/{lib/internal → internal}/usePrefix.d.ts +0 -0
- package/package.json +4 -6
- package/es/_virtual/ResizeObserver.es.js +0 -13
- package/es/_virtual/_commonjsHelpers.js +0 -42
- package/es/_virtual/index.js +0 -14
- package/es/_virtual/rangePlugin.js +0 -14
- package/es/node_modules/flatpickr/dist/l10n/index.js +0 -1423
- package/es/node_modules/flatpickr/dist/plugins/rangePlugin.js +0 -196
- package/es/node_modules/resize-observer-polyfill/dist/ResizeObserver.es.js +0 -1112
- package/es/node_modules/use-resize-observer/polyfilled.js +0 -111
- package/lib/_virtual/ResizeObserver.es.js +0 -17
- package/lib/_virtual/_commonjsHelpers.js +0 -48
- package/lib/_virtual/index.js +0 -18
- package/lib/_virtual/rangePlugin.js +0 -18
- package/lib/node_modules/flatpickr/dist/l10n/index.js +0 -1427
- package/lib/node_modules/flatpickr/dist/plugins/rangePlugin.js +0 -200
- package/lib/node_modules/resize-observer-polyfill/dist/ResizeObserver.es.js +0 -1116
- package/lib/node_modules/use-resize-observer/polyfilled.js +0 -119
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -9,7 +9,7 @@ import { objectWithoutProperties as _objectWithoutProperties, slicedToArray as _
|
|
|
9
9
|
import PropTypes from 'prop-types';
|
|
10
10
|
import React__default, { useState, useRef, useCallback, useEffect } from 'react';
|
|
11
11
|
import cx from 'classnames';
|
|
12
|
-
import useResizeObserver from '
|
|
12
|
+
import useResizeObserver from 'use-resize-observer/polyfilled';
|
|
13
13
|
import { ChevronDown } from '@carbon/icons-react';
|
|
14
14
|
import Copy from '../Copy/Copy.js';
|
|
15
15
|
import Button from '../Button/Button.js';
|
|
@@ -139,7 +139,7 @@ function CodeSnippet(_ref) {
|
|
|
139
139
|
handleScroll();
|
|
140
140
|
}
|
|
141
141
|
}
|
|
142
|
-
});
|
|
142
|
+
}, [type, maxCollapsedNumberOfRows, maxExpandedNumberOfRows, minExpandedNumberOfRows, rowHeightInPixels]);
|
|
143
143
|
useEffect(function () {
|
|
144
144
|
handleScroll();
|
|
145
145
|
}, [handleScroll]);
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2016, 2018
|
|
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 Downshift from 'downshift';
|
|
8
|
+
import { ReactNodeLike } from 'prop-types';
|
|
9
|
+
import React from 'react';
|
|
10
|
+
import { ListBoxType, ListBoxSize } from '../ListBox';
|
|
11
|
+
type ExcludedAttributes = 'id' | 'onChange' | 'onClick' | 'type' | 'size';
|
|
12
|
+
export interface ComboBoxProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, ExcludedAttributes> {
|
|
13
|
+
/**
|
|
14
|
+
* 'aria-label' of the ListBox component.
|
|
15
|
+
*/
|
|
16
|
+
ariaLabel?: string;
|
|
17
|
+
/**
|
|
18
|
+
* An optional className to add to the container node
|
|
19
|
+
*/
|
|
20
|
+
className?: string;
|
|
21
|
+
/**
|
|
22
|
+
* Specify the direction of the combobox dropdown. Can be either top or bottom.
|
|
23
|
+
*/
|
|
24
|
+
direction?: 'top' | 'bottom';
|
|
25
|
+
/**
|
|
26
|
+
* Specify if the control should be disabled, or not
|
|
27
|
+
*/
|
|
28
|
+
disabled?: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Additional props passed to Downshift
|
|
31
|
+
*/
|
|
32
|
+
downshiftProps?: React.ComponentProps<typeof Downshift>;
|
|
33
|
+
/**
|
|
34
|
+
* Provide helper text that is used alongside the control label for
|
|
35
|
+
* additional help
|
|
36
|
+
*/
|
|
37
|
+
helperText?: string;
|
|
38
|
+
/**
|
|
39
|
+
* Specify a custom `id` for the input
|
|
40
|
+
*/
|
|
41
|
+
id: string;
|
|
42
|
+
/**
|
|
43
|
+
* Allow users to pass in an arbitrary item or a string (in case their items are an array of strings)
|
|
44
|
+
* from their collection that are pre-selected
|
|
45
|
+
*/
|
|
46
|
+
initialSelectedItem?: object | string | number;
|
|
47
|
+
/**
|
|
48
|
+
* Specify if the currently selected value is invalid.
|
|
49
|
+
*/
|
|
50
|
+
invalid?: boolean;
|
|
51
|
+
/**
|
|
52
|
+
* Message which is displayed if the value is invalid.
|
|
53
|
+
*/
|
|
54
|
+
invalidText?: ReactNodeLike;
|
|
55
|
+
/**
|
|
56
|
+
* Optional function to render items as custom components instead of strings.
|
|
57
|
+
* Defaults to null and is overridden by a getter
|
|
58
|
+
*/
|
|
59
|
+
itemToElement?: React.ComponentType | null;
|
|
60
|
+
/**
|
|
61
|
+
* Helper function passed to downshift that allows the library to render a
|
|
62
|
+
* given item to a string label. By default, it extracts the `label` field
|
|
63
|
+
* from a given item to serve as the item label in the list
|
|
64
|
+
*/
|
|
65
|
+
itemToString?: (item: unknown) => string;
|
|
66
|
+
/**
|
|
67
|
+
* We try to stay as generic as possible here to allow individuals to pass
|
|
68
|
+
* in a collection of whatever kind of data structure they prefer
|
|
69
|
+
*/
|
|
70
|
+
items: (object | string | number)[];
|
|
71
|
+
/**
|
|
72
|
+
* @deprecated
|
|
73
|
+
* should use "light theme" (white background)?
|
|
74
|
+
*/
|
|
75
|
+
light?: boolean;
|
|
76
|
+
/**
|
|
77
|
+
* `onChange` is a utility for this controlled component to communicate to a
|
|
78
|
+
* consuming component when a specific dropdown item is selected.
|
|
79
|
+
* `({ selectedItem }) => void`
|
|
80
|
+
// * @param {{ selectedItem }}
|
|
81
|
+
*/
|
|
82
|
+
onChange: (data: {
|
|
83
|
+
selectedItem: any;
|
|
84
|
+
}) => void;
|
|
85
|
+
/**
|
|
86
|
+
* Callback function to notify consumer when the text input changes.
|
|
87
|
+
* This provides support to change available items based on the text.
|
|
88
|
+
* `(inputText) => void`
|
|
89
|
+
* @param {string} inputText
|
|
90
|
+
*/
|
|
91
|
+
onInputChange?: (inputText: string) => void;
|
|
92
|
+
/**
|
|
93
|
+
* Helper function passed to Downshift that allows the user to observe internal
|
|
94
|
+
* state changes
|
|
95
|
+
* `(changes, stateAndHelpers) => void`
|
|
96
|
+
*/
|
|
97
|
+
onStateChange?: (changes: object, stateAndHelpers: object) => void;
|
|
98
|
+
/**
|
|
99
|
+
* Callback function that fires when the combobox menu toggle is clicked
|
|
100
|
+
* `(evt) => void`
|
|
101
|
+
* @param {MouseEvent} event
|
|
102
|
+
*/
|
|
103
|
+
onToggleClick?: (evt: MouseEvent) => void;
|
|
104
|
+
/**
|
|
105
|
+
* Used to provide a placeholder text node before a user enters any input.
|
|
106
|
+
* This is only present if the control has no items selected
|
|
107
|
+
*/
|
|
108
|
+
placeholder?: string;
|
|
109
|
+
/**
|
|
110
|
+
* Is the ComboBox readonly?
|
|
111
|
+
*/
|
|
112
|
+
readOnly?: boolean;
|
|
113
|
+
/**
|
|
114
|
+
* For full control of the selection
|
|
115
|
+
*/
|
|
116
|
+
selectedItem?: object | string | number;
|
|
117
|
+
/**
|
|
118
|
+
* Specify your own filtering logic by passing in a `shouldFilterItem`
|
|
119
|
+
* function that takes in the current input and an item and passes back
|
|
120
|
+
* whether or not the item should be filtered.
|
|
121
|
+
*/
|
|
122
|
+
shouldFilterItem?: (input: any) => boolean;
|
|
123
|
+
/**
|
|
124
|
+
* Specify the size of the ListBox. Currently supports either `sm`, `md` or `lg` as an option.
|
|
125
|
+
*/
|
|
126
|
+
size?: ListBoxSize;
|
|
127
|
+
/**
|
|
128
|
+
* Provide text to be used in a `<label>` element that is tied to the
|
|
129
|
+
* combobox via ARIA attributes.
|
|
130
|
+
*/
|
|
131
|
+
titleText?: ReactNodeLike;
|
|
132
|
+
/**
|
|
133
|
+
* Specify a custom translation function that takes in a message identifier
|
|
134
|
+
* and returns the localized string for the message
|
|
135
|
+
*/
|
|
136
|
+
translateWithId?: (id: any) => string;
|
|
137
|
+
/**
|
|
138
|
+
* Currently supports either the default type, or an inline variant
|
|
139
|
+
*/
|
|
140
|
+
type?: ListBoxType;
|
|
141
|
+
/**
|
|
142
|
+
* Specify whether the control is currently in warning state
|
|
143
|
+
*/
|
|
144
|
+
warn?: boolean;
|
|
145
|
+
/**
|
|
146
|
+
* Provide the text that is displayed when the control is in warning state
|
|
147
|
+
*/
|
|
148
|
+
warnText?: ReactNodeLike;
|
|
149
|
+
}
|
|
150
|
+
declare const ComboBox: React.ForwardRefExoticComponent<ComboBoxProps & React.RefAttributes<unknown>>;
|
|
151
|
+
export default ComboBox;
|
|
@@ -60,7 +60,8 @@ var getInputValue = function getInputValue(_ref) {
|
|
|
60
60
|
|
|
61
61
|
var findHighlightedIndex = function findHighlightedIndex(_ref2, inputValue) {
|
|
62
62
|
var items = _ref2.items,
|
|
63
|
-
itemToString = _ref2.itemToString
|
|
63
|
+
_ref2$itemToString = _ref2.itemToString,
|
|
64
|
+
itemToString = _ref2$itemToString === void 0 ? defaultItemToString : _ref2$itemToString;
|
|
64
65
|
|
|
65
66
|
if (!inputValue) {
|
|
66
67
|
return -1;
|
|
@@ -69,9 +70,9 @@ var findHighlightedIndex = function findHighlightedIndex(_ref2, inputValue) {
|
|
|
69
70
|
var searchValue = inputValue.toLowerCase();
|
|
70
71
|
|
|
71
72
|
for (var i = 0; i < items.length; i++) {
|
|
72
|
-
var
|
|
73
|
+
var _item = itemToString(items[i]).toLowerCase();
|
|
73
74
|
|
|
74
|
-
if (
|
|
75
|
+
if (_item.indexOf(searchValue) !== -1) {
|
|
75
76
|
return i;
|
|
76
77
|
}
|
|
77
78
|
}
|
|
@@ -81,7 +82,7 @@ var findHighlightedIndex = function findHighlightedIndex(_ref2, inputValue) {
|
|
|
81
82
|
|
|
82
83
|
var getInstanceId = setupGetInstanceId();
|
|
83
84
|
var ComboBox = /*#__PURE__*/React__default.forwardRef(function (props, ref) {
|
|
84
|
-
var _cx, _ref4, _Text;
|
|
85
|
+
var _cx, _ref4, _cx4, _Text;
|
|
85
86
|
|
|
86
87
|
var ariaLabel = props.ariaLabel,
|
|
87
88
|
containerClassName = props.className,
|
|
@@ -118,7 +119,7 @@ var ComboBox = /*#__PURE__*/React__default.forwardRef(function (props, ref) {
|
|
|
118
119
|
var _useContext = useContext(FormContext),
|
|
119
120
|
isFluid = _useContext.isFluid;
|
|
120
121
|
|
|
121
|
-
var textInput = useRef();
|
|
122
|
+
var textInput = useRef(null);
|
|
122
123
|
var comboBoxInstanceId = getInstanceId();
|
|
123
124
|
|
|
124
125
|
var _useState = useState(getInputValue({
|
|
@@ -136,12 +137,12 @@ var ComboBox = /*#__PURE__*/React__default.forwardRef(function (props, ref) {
|
|
|
136
137
|
isFocused = _useState4[0],
|
|
137
138
|
setIsFocused = _useState4[1];
|
|
138
139
|
|
|
139
|
-
var _useState5 = useState(
|
|
140
|
+
var _useState5 = useState(),
|
|
140
141
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
141
142
|
prevSelectedItem = _useState6[0],
|
|
142
143
|
setPrevSelectedItem = _useState6[1];
|
|
143
144
|
|
|
144
|
-
var _useState7 = useState(
|
|
145
|
+
var _useState7 = useState(false),
|
|
145
146
|
_useState8 = _slicedToArray(_useState7, 2),
|
|
146
147
|
doneInitialSelectedItem = _useState8[0],
|
|
147
148
|
setDoneInitialSelectedItem = _useState8[1];
|
|
@@ -161,11 +162,11 @@ var ComboBox = /*#__PURE__*/React__default.forwardRef(function (props, ref) {
|
|
|
161
162
|
|
|
162
163
|
var filterItems = function filterItems(items, itemToString, inputValue) {
|
|
163
164
|
return items.filter(function (item) {
|
|
164
|
-
return shouldFilterItem({
|
|
165
|
+
return shouldFilterItem ? shouldFilterItem({
|
|
165
166
|
item: item,
|
|
166
167
|
itemToString: itemToString,
|
|
167
168
|
inputValue: inputValue
|
|
168
|
-
});
|
|
169
|
+
}) : defaultShouldFilterItem();
|
|
169
170
|
});
|
|
170
171
|
};
|
|
171
172
|
|
|
@@ -228,7 +229,7 @@ var ComboBox = /*#__PURE__*/React__default.forwardRef(function (props, ref) {
|
|
|
228
229
|
var comboBoxHelperId = !helperText ? undefined : "combobox-helper-text-".concat(comboBoxInstanceId);
|
|
229
230
|
var helperClasses = cx("".concat(prefix, "--form__helper-text"), _defineProperty({}, "".concat(prefix, "--form__helper-text--disabled"), disabled));
|
|
230
231
|
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)]);
|
|
231
|
-
var inputClasses = cx("".concat(prefix, "--text-input"),
|
|
232
|
+
var inputClasses = cx("".concat(prefix, "--text-input"), (_cx4 = {}, _defineProperty(_cx4, "".concat(prefix, "--text-input--empty"), !inputValue), _defineProperty(_cx4, "".concat(prefix, "--combo-box--input--focus"), isFocused && !isFluid), _cx4)); // needs to be Capitalized for react to render it correctly
|
|
232
233
|
|
|
233
234
|
var ItemToElement = itemToElement;
|
|
234
235
|
return /*#__PURE__*/React__default.createElement(Downshift, _extends({}, downshiftProps, {
|
|
@@ -264,7 +265,8 @@ var ComboBox = /*#__PURE__*/React__default.forwardRef(function (props, ref) {
|
|
|
264
265
|
highlightedIndex = _ref5.highlightedIndex,
|
|
265
266
|
clearSelection = _ref5.clearSelection,
|
|
266
267
|
toggleMenu = _ref5.toggleMenu;
|
|
267
|
-
var rootProps = getRootProps(
|
|
268
|
+
var rootProps = getRootProps( // @ts-ignore this is not supposed to be a required property
|
|
269
|
+
{}, {
|
|
268
270
|
suppressRefError: true
|
|
269
271
|
});
|
|
270
272
|
var labelProps = getLabelProps();
|
|
@@ -306,11 +308,7 @@ var ComboBox = /*#__PURE__*/React__default.forwardRef(function (props, ref) {
|
|
|
306
308
|
});
|
|
307
309
|
|
|
308
310
|
var handleFocus = function handleFocus(evt) {
|
|
309
|
-
|
|
310
|
-
setIsFocused(false);
|
|
311
|
-
} else {
|
|
312
|
-
setIsFocused(evt.type === 'focus' ? true : false);
|
|
313
|
-
}
|
|
311
|
+
setIsFocused(evt.type === 'focus');
|
|
314
312
|
};
|
|
315
313
|
|
|
316
314
|
var readOnlyEventHandlers = readOnly ? {
|
|
@@ -362,7 +360,8 @@ var ComboBox = /*#__PURE__*/React__default.forwardRef(function (props, ref) {
|
|
|
362
360
|
clearSelection: clearSelection,
|
|
363
361
|
translateWithId: translateWithId,
|
|
364
362
|
disabled: disabled || readOnly,
|
|
365
|
-
onClearSelection: handleSelectionClear
|
|
363
|
+
onClearSelection: handleSelectionClear,
|
|
364
|
+
selectionCount: 0
|
|
366
365
|
}), /*#__PURE__*/React__default.createElement(ListBoxTrigger, _extends({}, buttonProps, {
|
|
367
366
|
isOpen: isOpen,
|
|
368
367
|
translateWithId: translateWithId
|
|
@@ -374,15 +373,18 @@ var ComboBox = /*#__PURE__*/React__default.forwardRef(function (props, ref) {
|
|
|
374
373
|
var itemProps = getItemProps((_getItemProps = {
|
|
375
374
|
item: item,
|
|
376
375
|
index: index
|
|
377
|
-
}, _defineProperty(_getItemProps, 'aria-current', selectedItem === item ? true :
|
|
376
|
+
}, _defineProperty(_getItemProps, 'aria-current', selectedItem === item ? 'true' : 'false'), _defineProperty(_getItemProps, 'aria-selected', highlightedIndex === index ? 'true' : 'false'), _defineProperty(_getItemProps, "disabled", item.disabled), _getItemProps));
|
|
378
377
|
return /*#__PURE__*/React__default.createElement(ListBox.MenuItem, _extends({
|
|
379
378
|
key: itemProps.id,
|
|
380
379
|
isActive: selectedItem === item,
|
|
381
380
|
isHighlighted: highlightedIndex === index || (selectedItem === null || selectedItem === void 0 ? void 0 : selectedItem.id) && (selectedItem === null || selectedItem === void 0 ? void 0 : selectedItem.id) === item.id || false,
|
|
382
|
-
title: itemToElement ? item.text : itemToString(item)
|
|
383
|
-
}, itemProps), itemToElement ?
|
|
381
|
+
title: itemToElement ? item.text : itemToString ? itemToString(item) : undefined
|
|
382
|
+
}, itemProps), itemToElement ?
|
|
383
|
+
/*#__PURE__*/
|
|
384
|
+
// @ts-ignore
|
|
385
|
+
React__default.createElement(ItemToElement, _extends({
|
|
384
386
|
key: itemProps.id
|
|
385
|
-
}, item)) : itemToString(item), selectedItem === item && /*#__PURE__*/React__default.createElement(Checkmark, {
|
|
387
|
+
}, item)) : itemToString ? itemToString(item) : defaultItemToString(item), selectedItem === item && /*#__PURE__*/React__default.createElement(Checkmark, {
|
|
386
388
|
className: "".concat(prefix, "--list-box__menu-item__selected-icon")
|
|
387
389
|
}));
|
|
388
390
|
}) : null)), helperText && !invalid && !warn && !isFluid && (_Text || (_Text = /*#__PURE__*/React__default.createElement(Text, {
|
|
@@ -417,6 +419,7 @@ ComboBox.propTypes = {
|
|
|
417
419
|
/**
|
|
418
420
|
* Additional props passed to Downshift
|
|
419
421
|
*/
|
|
422
|
+
// @ts-ignore
|
|
420
423
|
downshiftProps: PropTypes.shape(Downshift.propTypes),
|
|
421
424
|
|
|
422
425
|
/**
|
|
@@ -473,6 +476,7 @@ ComboBox.propTypes = {
|
|
|
473
476
|
/**
|
|
474
477
|
* `onChange` is a utility for this controlled component to communicate to a
|
|
475
478
|
* consuming component when a specific dropdown item is selected.
|
|
479
|
+
* `({ selectedItem }) => void`
|
|
476
480
|
* @param {{ selectedItem }}
|
|
477
481
|
*/
|
|
478
482
|
onChange: PropTypes.func.isRequired,
|
|
@@ -480,6 +484,7 @@ ComboBox.propTypes = {
|
|
|
480
484
|
/**
|
|
481
485
|
* Callback function to notify consumer when the text input changes.
|
|
482
486
|
* This provides support to change available items based on the text.
|
|
487
|
+
* `(inputText) => void`
|
|
483
488
|
* @param {string} inputText
|
|
484
489
|
*/
|
|
485
490
|
onInputChange: PropTypes.func,
|
|
@@ -487,11 +492,13 @@ ComboBox.propTypes = {
|
|
|
487
492
|
/**
|
|
488
493
|
* Helper function passed to Downshift that allows the user to observe internal
|
|
489
494
|
* state changes
|
|
495
|
+
* `(changes, stateAndHelpers) => void`
|
|
490
496
|
*/
|
|
491
497
|
onStateChange: PropTypes.func,
|
|
492
498
|
|
|
493
499
|
/**
|
|
494
500
|
* Callback function that fires when the combobox menu toggle is clicked
|
|
501
|
+
* `(evt) => void`
|
|
495
502
|
* @param {MouseEvent} event
|
|
496
503
|
*/
|
|
497
504
|
onToggleClick: PropTypes.func,
|
|
@@ -94,7 +94,7 @@ var ComposedModal = /*#__PURE__*/React__default.forwardRef(function ComposedModa
|
|
|
94
94
|
onKeyDown(evt);
|
|
95
95
|
}
|
|
96
96
|
|
|
97
|
-
function
|
|
97
|
+
function handleMousedown(evt) {
|
|
98
98
|
if (!innerModal.current.contains(evt.target) && preventCloseOnClickOutside) {
|
|
99
99
|
return;
|
|
100
100
|
}
|
|
@@ -194,7 +194,7 @@ var ComposedModal = /*#__PURE__*/React__default.forwardRef(function ComposedModa
|
|
|
194
194
|
ref: ref,
|
|
195
195
|
"aria-hidden": !open,
|
|
196
196
|
onBlur: handleBlur,
|
|
197
|
-
|
|
197
|
+
onMouseDown: handleMousedown,
|
|
198
198
|
onKeyDown: handleKeyDown,
|
|
199
199
|
className: modalClass,
|
|
200
200
|
tabIndex: "-1"
|
|
File without changes
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2016, 2018
|
|
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
|
+
import React from 'react';
|
|
9
|
+
export interface TableSelectRowProps {
|
|
10
|
+
/**
|
|
11
|
+
* Specify the aria label for the underlying input control
|
|
12
|
+
*/
|
|
13
|
+
ariaLabel: string;
|
|
14
|
+
/**
|
|
15
|
+
* Specify whether this row is selected, or not
|
|
16
|
+
*/
|
|
17
|
+
checked: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* The CSS class names of the cell that wraps the underlying input control
|
|
20
|
+
*/
|
|
21
|
+
className?: string;
|
|
22
|
+
/**
|
|
23
|
+
* Specify whether the control is disabled
|
|
24
|
+
*/
|
|
25
|
+
disabled?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Provide an `id` for the underlying input control
|
|
28
|
+
*/
|
|
29
|
+
id: string;
|
|
30
|
+
/**
|
|
31
|
+
* Provide a `name` for the underlying input control
|
|
32
|
+
*/
|
|
33
|
+
name: string;
|
|
34
|
+
/**
|
|
35
|
+
* Provide an optional hook that is called each time the input is updated
|
|
36
|
+
*/
|
|
37
|
+
onChange?: (value: boolean, name: string, event: React.ChangeEvent<HTMLInputElement>) => void;
|
|
38
|
+
/**
|
|
39
|
+
* Provide a handler to listen to when a user initiates a selection request
|
|
40
|
+
*/
|
|
41
|
+
onSelect: React.MouseEventHandler<HTMLInputElement>;
|
|
42
|
+
/**
|
|
43
|
+
* Specify whether the control should be a radio button or inline checkbox
|
|
44
|
+
*/
|
|
45
|
+
radio?: boolean;
|
|
46
|
+
}
|
|
47
|
+
declare const TableSelectRow: {
|
|
48
|
+
({ ariaLabel, checked, id, name, onSelect, onChange, disabled, radio, className, }: TableSelectRowProps): JSX.Element;
|
|
49
|
+
propTypes: {
|
|
50
|
+
/**
|
|
51
|
+
* Specify the aria label for the underlying input control
|
|
52
|
+
*/
|
|
53
|
+
ariaLabel: PropTypes.Validator<string>;
|
|
54
|
+
/**
|
|
55
|
+
* Specify whether this row is selected, or not
|
|
56
|
+
*/
|
|
57
|
+
checked: PropTypes.Validator<boolean>;
|
|
58
|
+
/**
|
|
59
|
+
* The CSS class names of the cell that wraps the underlying input control
|
|
60
|
+
*/
|
|
61
|
+
className: PropTypes.Requireable<string>;
|
|
62
|
+
/**
|
|
63
|
+
* Specify whether the control is disabled
|
|
64
|
+
*/
|
|
65
|
+
disabled: PropTypes.Requireable<boolean>;
|
|
66
|
+
/**
|
|
67
|
+
* Provide an `id` for the underlying input control
|
|
68
|
+
*/
|
|
69
|
+
id: PropTypes.Validator<string>;
|
|
70
|
+
/**
|
|
71
|
+
* Provide a `name` for the underlying input control
|
|
72
|
+
*/
|
|
73
|
+
name: PropTypes.Validator<string>;
|
|
74
|
+
/**
|
|
75
|
+
* Provide an optional hook that is called each time the input is updated
|
|
76
|
+
*/
|
|
77
|
+
onChange: PropTypes.Requireable<(...args: any[]) => any>;
|
|
78
|
+
/**
|
|
79
|
+
* Provide a handler to listen to when a user initiates a selection request
|
|
80
|
+
*/
|
|
81
|
+
onSelect: PropTypes.Validator<(...args: any[]) => any>;
|
|
82
|
+
/**
|
|
83
|
+
* Specify whether the control should be a radio button or inline checkbox
|
|
84
|
+
*/
|
|
85
|
+
radio: PropTypes.Requireable<boolean>;
|
|
86
|
+
};
|
|
87
|
+
};
|
|
88
|
+
export default TableSelectRow;
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import { defineProperty as _defineProperty, extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
8
|
+
import { objectSpread2 as _objectSpread2, defineProperty as _defineProperty, extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
9
9
|
import PropTypes from 'prop-types';
|
|
10
10
|
import React__default from 'react';
|
|
11
11
|
import cx from 'classnames';
|
|
@@ -14,8 +14,6 @@ import RadioButton from '../RadioButton/RadioButton.js';
|
|
|
14
14
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
15
15
|
|
|
16
16
|
var TableSelectRow = function TableSelectRow(_ref) {
|
|
17
|
-
var _classNames;
|
|
18
|
-
|
|
19
17
|
var ariaLabel = _ref.ariaLabel,
|
|
20
18
|
checked = _ref.checked,
|
|
21
19
|
id = _ref.id,
|
|
@@ -35,7 +33,7 @@ var TableSelectRow = function TableSelectRow(_ref) {
|
|
|
35
33
|
disabled: disabled
|
|
36
34
|
};
|
|
37
35
|
var InlineInputComponent = radio ? RadioButton : InlineCheckbox;
|
|
38
|
-
var tableSelectRowClasses = cx("".concat(prefix, "--table-column-checkbox"), (
|
|
36
|
+
var tableSelectRowClasses = cx("".concat(prefix, "--table-column-checkbox"), _objectSpread2(_objectSpread2({}, className && _defineProperty({}, className, true)), {}, _defineProperty({}, "".concat(prefix, "--table-column-radio"), radio)));
|
|
39
37
|
return /*#__PURE__*/React__default.createElement("td", {
|
|
40
38
|
className: tableSelectRowClasses
|
|
41
39
|
}, /*#__PURE__*/React__default.createElement(InlineInputComponent, _extends({}, selectionInputProps, radio && {
|
|
@@ -53,7 +51,7 @@ TableSelectRow.propTypes = {
|
|
|
53
51
|
ariaLabel: PropTypes.string.isRequired,
|
|
54
52
|
|
|
55
53
|
/**
|
|
56
|
-
* Specify whether
|
|
54
|
+
* Specify whether this row is selected, or not
|
|
57
55
|
*/
|
|
58
56
|
checked: PropTypes.bool.isRequired,
|
|
59
57
|
|
|
@@ -10,7 +10,7 @@ import PropTypes from 'prop-types';
|
|
|
10
10
|
import React__default, { useContext, useState, useCallback, useRef, useEffect, useImperativeHandle } from 'react';
|
|
11
11
|
import cx from 'classnames';
|
|
12
12
|
import flatpickr from 'flatpickr';
|
|
13
|
-
import l10n from '
|
|
13
|
+
import l10n from 'flatpickr/dist/l10n/index';
|
|
14
14
|
import DatePickerInput from '../DatePickerInput/DatePickerInput.js';
|
|
15
15
|
import carbonFlatpickrAppendToPlugin from './plugins/appendToPlugin.js';
|
|
16
16
|
import carbonFlatpickrFixEventsPlugin from './plugins/fixEventsPlugin.js';
|
|
@@ -65,7 +65,16 @@ var carbonFlatpickrFixEventsPlugin = (function (config) {
|
|
|
65
65
|
|
|
66
66
|
if (selectedToDate && currentValueToDate && selectedToDate !== currentValueToDate) {
|
|
67
67
|
// Update the calendar with the value of the `to` date input
|
|
68
|
-
fp.setDate([inputFrom.value, inputTo && inputTo.value],
|
|
68
|
+
fp.setDate([inputFrom.value, inputTo && inputTo.value], true, fp.config.dateFormat);
|
|
69
|
+
}
|
|
70
|
+
} // save end date in calendar inmediately after it's been written down
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
if (inputTo === target && fp.selectedDates.length === 1 && inputTo.value) {
|
|
74
|
+
var currentEndDate = new Date(inputTo.value);
|
|
75
|
+
|
|
76
|
+
if (currentEndDate.toString() !== 'Invalid Date') {
|
|
77
|
+
fp.setDate([inputFrom.value, inputTo.value], true, fp.config.dateFormat);
|
|
69
78
|
}
|
|
70
79
|
}
|
|
71
80
|
};
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import rangePlugin from '
|
|
8
|
+
import rangePlugin from 'flatpickr/dist/plugins/rangePlugin';
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* @param {object} config Plugin configuration.
|
|
File without changes
|
|
File without changes
|
|
@@ -13,10 +13,11 @@ import { ButtonKinds } from '../../prop-types/types.js';
|
|
|
13
13
|
import uniqueId from '../../tools/uniqueId.js';
|
|
14
14
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
15
15
|
import * as FeatureFlags from '@carbon/feature-flags';
|
|
16
|
+
import deprecate from '../../prop-types/deprecate.js';
|
|
16
17
|
import { matches } from '../../internal/keyboard/match.js';
|
|
17
18
|
import { Enter, Space } from '../../internal/keyboard/keys.js';
|
|
18
19
|
|
|
19
|
-
var _excluded = ["accept", "buttonKind", "className", "disabled", "disableLabelChanges", "id", "labelText", "multiple", "onChange", "
|
|
20
|
+
var _excluded = ["accept", "buttonKind", "className", "disabled", "disableLabelChanges", "id", "labelText", "multiple", "onChange", "name", "size", "innerRef"];
|
|
20
21
|
|
|
21
22
|
function noop() {}
|
|
22
23
|
|
|
@@ -38,13 +39,9 @@ function FileUploaderButton(_ref) {
|
|
|
38
39
|
multiple = _ref$multiple === void 0 ? false : _ref$multiple,
|
|
39
40
|
_ref$onChange = _ref.onChange,
|
|
40
41
|
onChange = _ref$onChange === void 0 ? noop : _ref$onChange,
|
|
41
|
-
_ref$role = _ref.role,
|
|
42
|
-
role = _ref$role === void 0 ? 'button' : _ref$role,
|
|
43
42
|
name = _ref.name,
|
|
44
43
|
_ref$size = _ref.size,
|
|
45
44
|
size = _ref$size === void 0 ? 'md' : _ref$size,
|
|
46
|
-
_ref$tabIndex = _ref.tabIndex,
|
|
47
|
-
tabIndex = _ref$tabIndex === void 0 ? 0 : _ref$tabIndex,
|
|
48
45
|
innerRef = _ref.innerRef,
|
|
49
46
|
other = _objectWithoutProperties(_ref, _excluded);
|
|
50
47
|
|
|
@@ -73,6 +70,7 @@ function FileUploaderButton(_ref) {
|
|
|
73
70
|
|
|
74
71
|
function onClick(event) {
|
|
75
72
|
event.target.value = null;
|
|
73
|
+
inputNode.current.click();
|
|
76
74
|
}
|
|
77
75
|
|
|
78
76
|
function onKeyDown(event) {
|
|
@@ -96,16 +94,17 @@ function FileUploaderButton(_ref) {
|
|
|
96
94
|
onChange(event);
|
|
97
95
|
}
|
|
98
96
|
|
|
99
|
-
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("
|
|
100
|
-
|
|
101
|
-
|
|
97
|
+
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("button", _extends({
|
|
98
|
+
type: "button",
|
|
99
|
+
disabled: disabled,
|
|
102
100
|
className: classes,
|
|
103
|
-
|
|
101
|
+
onClick: onClick,
|
|
102
|
+
onKeyDown: onKeyDown
|
|
103
|
+
}, other), labelText), /*#__PURE__*/React__default.createElement("label", {
|
|
104
|
+
className: "".concat(prefix, "--visually-hidden"),
|
|
105
|
+
ref: innerRef,
|
|
104
106
|
htmlFor: inputId
|
|
105
|
-
},
|
|
106
|
-
role: role,
|
|
107
|
-
"aria-disabled": disabled
|
|
108
|
-
}, labelText)), /*#__PURE__*/React__default.createElement("input", {
|
|
107
|
+
}, /*#__PURE__*/React__default.createElement("span", null, labelText)), /*#__PURE__*/React__default.createElement("input", {
|
|
109
108
|
className: "".concat(prefix, "--visually-hidden"),
|
|
110
109
|
ref: inputNode,
|
|
111
110
|
id: inputId,
|
|
@@ -115,8 +114,7 @@ function FileUploaderButton(_ref) {
|
|
|
115
114
|
multiple: multiple,
|
|
116
115
|
accept: accept,
|
|
117
116
|
name: name,
|
|
118
|
-
onChange: handleOnChange
|
|
119
|
-
onClick: onClick
|
|
117
|
+
onChange: handleOnChange
|
|
120
118
|
}));
|
|
121
119
|
}
|
|
122
120
|
|
|
@@ -194,7 +192,7 @@ FileUploaderButton.propTypes = {
|
|
|
194
192
|
/**
|
|
195
193
|
* Provide a custom tabIndex value for the `<FileUploaderButton>`
|
|
196
194
|
*/
|
|
197
|
-
tabIndex: PropTypes.number
|
|
195
|
+
tabIndex: deprecate(PropTypes.number, 'The `tabIndex` prop for `FileUploaderButton` has ' + 'been deprecated since it now renders a button element by default.')
|
|
198
196
|
};
|
|
199
197
|
|
|
200
198
|
export { FileUploaderButton as default };
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -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 Select from '../Select/Select.js';
|
|
13
|
+
import '../Select/Select.Skeleton.js';
|
|
13
14
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
14
15
|
import { FormContext } from '../FluidForm/FormContext.js';
|
|
15
16
|
|
|
@@ -32,6 +32,7 @@ var IconButton = /*#__PURE__*/React__default.forwardRef(function IconButton(prop
|
|
|
32
32
|
return /*#__PURE__*/React__default.createElement(Tooltip, {
|
|
33
33
|
align: align,
|
|
34
34
|
className: "".concat(prefix, "--icon-tooltip"),
|
|
35
|
+
closeOnActivation: true,
|
|
35
36
|
defaultOpen: defaultOpen,
|
|
36
37
|
enterDelayMs: enterDelayMs,
|
|
37
38
|
label: label,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|