@carbon/react 1.57.0-rc.0 → 1.58.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/.playwright/INTERNAL_AVT_REPORT_DO_NOT_USE.json +1022 -1028
- package/es/components/Button/Button.js +2 -2
- package/es/components/Checkbox/Checkbox.d.ts +6 -7
- package/es/components/ComboBox/ComboBox.d.ts +4 -5
- package/es/components/ComboBox/ComboBox.js +268 -260
- package/es/components/ComposedModal/ComposedModal.d.ts +1 -2
- package/es/components/ContainedList/ContainedList.d.ts +7 -3
- package/es/components/ContainedList/ContainedList.js +3 -2
- package/es/components/ContainedList/ContainedListItem/ContainedListItem.js +1 -2
- package/es/components/ContainedList/ContainedListItem/index.d.ts +9 -0
- package/es/components/ContainedList/index.d.ts +11 -0
- package/es/components/ContainedList/index.js +13 -0
- package/es/components/DataTable/TableHeader.d.ts +4 -5
- package/es/components/DataTable/TableSlugRow.d.ts +3 -2
- package/es/components/DataTable/stories/examples/TableToolbarFilter.d.ts +51 -0
- package/es/components/DatePicker/DatePicker.d.ts +9 -9
- package/es/components/DatePicker/plugins/rangePlugin.js +5 -6
- package/es/components/Dialog/index.d.ts +31 -0
- package/es/components/Dropdown/Dropdown.d.ts +5 -6
- package/es/components/IconButton/index.d.ts +3 -4
- package/es/components/ListBox/next/ListBoxTrigger.js +5 -3
- package/es/components/Menu/Menu.js +1 -1
- package/es/components/Menu/MenuItem.js +13 -2
- package/es/components/Modal/Modal.d.ts +8 -9
- package/es/components/MultiSelect/FilterableMultiSelect.d.ts +176 -0
- package/es/components/MultiSelect/FilterableMultiSelect.js +388 -313
- package/es/components/MultiSelect/MultiSelect.d.ts +10 -9
- package/es/components/MultiSelect/MultiSelect.js +1 -2
- package/es/components/MultiSelect/MultiSelectPropTypes.d.ts +62 -0
- package/es/components/MultiSelect/index.d.ts +10 -0
- package/es/components/MultiSelect/index.js +2 -0
- package/es/components/Notification/Notification.d.ts +2 -2
- package/es/components/NumberInput/NumberInput.d.ts +1 -2
- package/es/components/Pagination/Pagination.js +9 -9
- package/es/components/PasswordInput/index.d.ts +3 -0
- package/es/components/Popover/index.d.ts +8 -2
- package/es/components/Popover/index.js +26 -1
- package/es/components/RadioButton/RadioButton.d.ts +7 -4
- package/es/components/RadioButton/RadioButton.js +7 -1
- package/es/components/RadioButtonGroup/RadioButtonGroup.d.ts +11 -8
- package/es/components/RadioButtonGroup/RadioButtonGroup.js +7 -1
- package/es/components/Select/Select.d.ts +1 -2
- package/es/components/Slider/Slider.d.ts +5 -5
- package/es/components/Slider/Slider.js +1 -1
- package/es/components/Tag/DismissibleTag.d.ts +3 -3
- package/es/components/Tag/OperationalTag.d.ts +3 -3
- package/es/components/Tag/SelectableTag.d.ts +3 -3
- package/es/components/Tag/Tag.d.ts +3 -3
- package/es/components/TextArea/TextArea.d.ts +6 -7
- package/es/components/TextInput/PasswordInput.d.ts +5 -6
- package/es/components/TextInput/PasswordInput.js +2 -2
- package/es/components/TextInput/TextInput.d.ts +1 -2
- package/es/components/Theme/index.d.ts +1 -0
- package/es/components/Theme/index.js +8 -2
- package/es/components/Tile/Tile.d.ts +3 -4
- package/es/components/TileGroup/TileGroup.d.ts +3 -2
- package/es/components/TileGroup/index.d.ts +9 -0
- package/es/components/TimePicker/TimePicker.js +1 -1
- package/es/components/Toggle/Toggle.js +1 -1
- package/es/components/Tooltip/DefinitionTooltip.js +1 -1
- package/es/index.js +7 -5
- package/es/prop-types/deprecateValuesWithin.js +35 -0
- package/lib/components/Button/Button.js +2 -2
- package/lib/components/Checkbox/Checkbox.d.ts +6 -7
- package/lib/components/ComboBox/ComboBox.d.ts +4 -5
- package/lib/components/ComboBox/ComboBox.js +267 -260
- package/lib/components/ComposedModal/ComposedModal.d.ts +1 -2
- package/lib/components/ContainedList/ContainedList.d.ts +7 -3
- package/lib/components/ContainedList/ContainedList.js +3 -2
- package/lib/components/ContainedList/ContainedListItem/ContainedListItem.js +1 -2
- package/lib/components/ContainedList/ContainedListItem/index.d.ts +9 -0
- package/lib/components/ContainedList/index.d.ts +11 -0
- package/lib/components/ContainedList/index.js +19 -0
- package/lib/components/DataTable/TableHeader.d.ts +4 -5
- package/lib/components/DataTable/TableSlugRow.d.ts +3 -2
- package/lib/components/DataTable/stories/examples/TableToolbarFilter.d.ts +51 -0
- package/lib/components/DatePicker/DatePicker.d.ts +9 -9
- package/lib/components/DatePicker/plugins/rangePlugin.js +5 -6
- package/lib/components/Dialog/index.d.ts +31 -0
- package/lib/components/Dropdown/Dropdown.d.ts +5 -6
- package/lib/components/IconButton/index.d.ts +3 -4
- package/lib/components/ListBox/next/ListBoxTrigger.js +5 -3
- package/lib/components/Menu/Menu.js +1 -1
- package/lib/components/Menu/MenuItem.js +13 -2
- package/lib/components/Modal/Modal.d.ts +8 -9
- package/lib/components/MultiSelect/FilterableMultiSelect.d.ts +176 -0
- package/lib/components/MultiSelect/FilterableMultiSelect.js +387 -312
- package/lib/components/MultiSelect/MultiSelect.d.ts +10 -9
- package/lib/components/MultiSelect/MultiSelect.js +1 -2
- package/lib/components/MultiSelect/MultiSelectPropTypes.d.ts +62 -0
- package/lib/components/MultiSelect/index.d.ts +10 -0
- package/lib/components/MultiSelect/index.js +2 -0
- package/lib/components/Notification/Notification.d.ts +2 -2
- package/lib/components/NumberInput/NumberInput.d.ts +1 -2
- package/lib/components/Pagination/Pagination.js +9 -9
- package/lib/components/PasswordInput/index.d.ts +3 -0
- package/lib/components/Popover/index.d.ts +8 -2
- package/lib/components/Popover/index.js +26 -1
- package/lib/components/RadioButton/RadioButton.d.ts +7 -4
- package/lib/components/RadioButton/RadioButton.js +7 -1
- package/lib/components/RadioButtonGroup/RadioButtonGroup.d.ts +11 -8
- package/lib/components/RadioButtonGroup/RadioButtonGroup.js +7 -1
- package/lib/components/Select/Select.d.ts +1 -2
- package/lib/components/Slider/Slider.d.ts +5 -5
- package/lib/components/Slider/Slider.js +1 -1
- package/lib/components/Tag/DismissibleTag.d.ts +3 -3
- package/lib/components/Tag/OperationalTag.d.ts +3 -3
- package/lib/components/Tag/SelectableTag.d.ts +3 -3
- package/lib/components/Tag/Tag.d.ts +3 -3
- package/lib/components/TextArea/TextArea.d.ts +6 -7
- package/lib/components/TextInput/PasswordInput.d.ts +5 -6
- package/lib/components/TextInput/PasswordInput.js +2 -2
- package/lib/components/TextInput/TextInput.d.ts +1 -2
- package/lib/components/Theme/index.d.ts +1 -0
- package/lib/components/Theme/index.js +8 -1
- package/lib/components/Tile/Tile.d.ts +3 -4
- package/lib/components/TileGroup/TileGroup.d.ts +3 -2
- package/lib/components/TileGroup/index.d.ts +9 -0
- package/lib/components/TimePicker/TimePicker.js +1 -1
- package/lib/components/Toggle/Toggle.js +1 -1
- package/lib/components/Tooltip/DefinitionTooltip.js +1 -1
- package/lib/index.js +34 -31
- package/lib/prop-types/deprecateValuesWithin.js +39 -0
- package/package.json +8 -8
- package/es/components/TileGroup/index.js +0 -13
- package/lib/components/TileGroup/index.js +0 -18
|
@@ -5,11 +5,9 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
import { UseSelectProps } from 'downshift';
|
|
8
|
-
import {
|
|
9
|
-
import React from 'react';
|
|
8
|
+
import React, { ReactNode } from 'react';
|
|
10
9
|
import { ListBoxSize, ListBoxType } from '../ListBox';
|
|
11
10
|
import { ListBoxProps } from '../ListBox/ListBox';
|
|
12
|
-
import { OnChangeData } from '../Dropdown';
|
|
13
11
|
import type { InternationalProps } from '../../types/common';
|
|
14
12
|
interface SharedOptions {
|
|
15
13
|
locale: string;
|
|
@@ -49,6 +47,9 @@ interface MultiSelectSortingProps<ItemType> {
|
|
|
49
47
|
*/
|
|
50
48
|
sortItems?(items: ReadonlyArray<ItemType>, options: SortItemsOptions<ItemType>): ItemType[];
|
|
51
49
|
}
|
|
50
|
+
interface OnChangeData<ItemType> {
|
|
51
|
+
selectedItems: ItemType[] | null;
|
|
52
|
+
}
|
|
52
53
|
export interface MultiSelectProps<ItemType> extends MultiSelectSortingProps<ItemType>, InternationalProps<'close.menu' | 'open.menu' | 'clear.all' | 'clear.selection'> {
|
|
53
54
|
className?: string;
|
|
54
55
|
/**
|
|
@@ -79,7 +80,7 @@ export interface MultiSelectProps<ItemType> extends MultiSelectSortingProps<Item
|
|
|
79
80
|
* Provide helper text that is used alongside the control label for
|
|
80
81
|
* additional help
|
|
81
82
|
*/
|
|
82
|
-
helperText?:
|
|
83
|
+
helperText?: ReactNode;
|
|
83
84
|
/**
|
|
84
85
|
* Specify whether the title text should be hidden or not
|
|
85
86
|
*/
|
|
@@ -100,7 +101,7 @@ export interface MultiSelectProps<ItemType> extends MultiSelectSortingProps<Item
|
|
|
100
101
|
/**
|
|
101
102
|
* If invalid, what is the error?
|
|
102
103
|
*/
|
|
103
|
-
invalidText?:
|
|
104
|
+
invalidText?: ReactNode;
|
|
104
105
|
/**
|
|
105
106
|
* Function to render items as custom components instead of strings.
|
|
106
107
|
* Defaults to null and is overridden by a getter
|
|
@@ -121,7 +122,7 @@ export interface MultiSelectProps<ItemType> extends MultiSelectSortingProps<Item
|
|
|
121
122
|
* Generic `label` that will be used as the textual representation of what
|
|
122
123
|
* this field is for
|
|
123
124
|
*/
|
|
124
|
-
label: NonNullable<
|
|
125
|
+
label: NonNullable<ReactNode>;
|
|
125
126
|
/**
|
|
126
127
|
* `true` to use the light version.
|
|
127
128
|
*
|
|
@@ -170,12 +171,12 @@ export interface MultiSelectProps<ItemType> extends MultiSelectSortingProps<Item
|
|
|
170
171
|
/**
|
|
171
172
|
* **Experimental**: Provide a `Slug` component to be rendered inside the `MultiSelect` component
|
|
172
173
|
*/
|
|
173
|
-
slug?:
|
|
174
|
+
slug?: ReactNode;
|
|
174
175
|
/**
|
|
175
176
|
* Provide text to be used in a `<label>` element that is tied to the
|
|
176
177
|
* multiselect via ARIA attributes.
|
|
177
178
|
*/
|
|
178
|
-
titleText?:
|
|
179
|
+
titleText?: ReactNode;
|
|
179
180
|
/**
|
|
180
181
|
* Specify 'inline' to create an inline multi-select.
|
|
181
182
|
*/
|
|
@@ -191,7 +192,7 @@ export interface MultiSelectProps<ItemType> extends MultiSelectSortingProps<Item
|
|
|
191
192
|
/**
|
|
192
193
|
* Provide the text that is displayed when the control is in warning state
|
|
193
194
|
*/
|
|
194
|
-
warnText?:
|
|
195
|
+
warnText?: ReactNode;
|
|
195
196
|
}
|
|
196
197
|
type MultiSelectComponentProps<ItemType> = React.PropsWithChildren<MultiSelectProps<ItemType>> & React.RefAttributes<HTMLButtonElement>;
|
|
197
198
|
interface MultiSelectComponent {
|
|
@@ -0,0 +1,62 @@
|
|
|
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 declare const sortingPropTypes: {
|
|
9
|
+
/**
|
|
10
|
+
* Provide a compare function that is used to determine the ordering of
|
|
11
|
+
* options. `compareItems` has the following function signature:
|
|
12
|
+
*
|
|
13
|
+
* compareFunction :
|
|
14
|
+
* (itemA: string, itemB: string, { locale: string }) => number
|
|
15
|
+
*/
|
|
16
|
+
compareItems: PropTypes.Requireable<(...args: any[]) => any>;
|
|
17
|
+
/**
|
|
18
|
+
* Provide a method that sorts all options in the control. Overriding this
|
|
19
|
+
* prop means that you also have to handle the sort logic for selected versus
|
|
20
|
+
* un-selected items. If you just want to control ordering, consider the
|
|
21
|
+
* `compareItems` prop instead.
|
|
22
|
+
*
|
|
23
|
+
* `sortItems` has the following signature:
|
|
24
|
+
*
|
|
25
|
+
* sortItems :
|
|
26
|
+
* (items: Array<Item>, {
|
|
27
|
+
* selectedItems: Array<Item>,
|
|
28
|
+
* itemToString: Item => string,
|
|
29
|
+
* compareItems: (itemA: string, itemB: string, {
|
|
30
|
+
* locale: string
|
|
31
|
+
* }) => number,
|
|
32
|
+
* locale: string,
|
|
33
|
+
* }) => Array<Item>
|
|
34
|
+
*/
|
|
35
|
+
sortItems: PropTypes.Requireable<(...args: any[]) => any>;
|
|
36
|
+
};
|
|
37
|
+
export interface ItemBase {
|
|
38
|
+
disabled?: boolean;
|
|
39
|
+
}
|
|
40
|
+
export interface SortingPropTypes<Item extends ItemBase> {
|
|
41
|
+
/**
|
|
42
|
+
* Provide a compare function that is used
|
|
43
|
+
* to determine the ordering of options.
|
|
44
|
+
*/
|
|
45
|
+
compareItems(itemA: string, itemB: string, ctx: {
|
|
46
|
+
locale: string;
|
|
47
|
+
}): number;
|
|
48
|
+
/**
|
|
49
|
+
* Provide a method that sorts all options in the control. Overriding this
|
|
50
|
+
* prop means that you also have to handle the sort logic for selected versus
|
|
51
|
+
* un-selected items. If you just want to control ordering, consider the
|
|
52
|
+
* `compareItems` prop instead.
|
|
53
|
+
*/
|
|
54
|
+
sortItems(items: Item[], state: {
|
|
55
|
+
selectedItems: Item[];
|
|
56
|
+
itemToString(item: Item): string;
|
|
57
|
+
compareItems(itemA: string, itemB: string, ctx: {
|
|
58
|
+
locale: string;
|
|
59
|
+
}): number;
|
|
60
|
+
locale: string;
|
|
61
|
+
}): Item[];
|
|
62
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
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 MultiSelect from './MultiSelect';
|
|
8
|
+
import { default as FilterableMultiSelect } from './FilterableMultiSelect';
|
|
9
|
+
export { FilterableMultiSelect, MultiSelect };
|
|
10
|
+
export default MultiSelect;
|
|
@@ -14,6 +14,8 @@ var MultiSelect = require('./MultiSelect.js');
|
|
|
14
14
|
var FilterableMultiSelect = require('./FilterableMultiSelect.js');
|
|
15
15
|
|
|
16
16
|
FilterableMultiSelect["default"].displayName = 'MultiSelect.Filterable';
|
|
17
|
+
// @ts-expect-error: The attribute indeed does not exist on the object,
|
|
18
|
+
// but since it is already deprecated, we do not have to fix it.
|
|
17
19
|
MultiSelect["default"].Filterable = FilterableMultiSelect["default"];
|
|
18
20
|
if (process.env.NODE_ENV !== "production") {
|
|
19
21
|
deprecateFieldOnObject.deprecateFieldOnObject(MultiSelect["default"], 'Filterable', FilterableMultiSelect["default"]);
|
|
@@ -388,8 +388,8 @@ export interface ActionableNotificationProps extends HTMLAttributes<HTMLDivEleme
|
|
|
388
388
|
*/
|
|
389
389
|
closeOnEscape?: boolean;
|
|
390
390
|
/**
|
|
391
|
-
* @deprecated
|
|
392
|
-
* Specify if focus should be moved to the component
|
|
391
|
+
* @deprecated This prop will be removed in the next major version, v12.
|
|
392
|
+
* Specify if focus should be moved to the component on render. To meet the spec for alertdialog, this must always be true. If you're setting this to false, explore using StaticNotification instead. https://github.com/carbon-design-system/carbon/pull/15532
|
|
393
393
|
*/
|
|
394
394
|
hasFocus?: boolean;
|
|
395
395
|
/**
|
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
|
-
import { ReactNodeLike } from 'prop-types';
|
|
8
7
|
import React, { ReactNode } from 'react';
|
|
9
8
|
export declare const translationIds: {
|
|
10
9
|
'increment.number': string;
|
|
@@ -111,7 +110,7 @@ export interface NumberInputProps extends Omit<React.InputHTMLAttributes<HTMLInp
|
|
|
111
110
|
/**
|
|
112
111
|
* **Experimental**: Provide a `Slug` component to be rendered inside the `TextInput` component
|
|
113
112
|
*/
|
|
114
|
-
slug?:
|
|
113
|
+
slug?: ReactNode;
|
|
115
114
|
/**
|
|
116
115
|
* Specify how much the values should increase/decrease upon clicking on up/down button
|
|
117
116
|
*/
|
|
@@ -78,10 +78,10 @@ const Pagination = /*#__PURE__*/React__default["default"].forwardRef(function Pa
|
|
|
78
78
|
pageSize: controlledPageSize,
|
|
79
79
|
pageSizeInputDisabled,
|
|
80
80
|
pageSizes: controlledPageSizes,
|
|
81
|
-
pageText =
|
|
81
|
+
pageText = page => `page ${page}`,
|
|
82
82
|
pagesUnknown = false,
|
|
83
83
|
size = 'md',
|
|
84
|
-
totalItems
|
|
84
|
+
totalItems,
|
|
85
85
|
...rest
|
|
86
86
|
} = _ref;
|
|
87
87
|
const prefix = usePrefix.usePrefix();
|
|
@@ -103,7 +103,7 @@ const Pagination = /*#__PURE__*/React__default["default"].forwardRef(function Pa
|
|
|
103
103
|
[`${prefix}--pagination--${size}`]: size,
|
|
104
104
|
[customClassName]: !!customClassName
|
|
105
105
|
});
|
|
106
|
-
const totalPages = Math.max(Math.ceil(totalItems / pageSize), 1);
|
|
106
|
+
const totalPages = totalItems ? Math.max(Math.ceil(totalItems / pageSize), 1) : NaN;
|
|
107
107
|
const backButtonDisabled = disabled || page === 1;
|
|
108
108
|
const backButtonClasses = cx__default["default"]({
|
|
109
109
|
[`${prefix}--pagination__button`]: true,
|
|
@@ -155,7 +155,7 @@ const Pagination = /*#__PURE__*/React__default["default"].forwardRef(function Pa
|
|
|
155
155
|
}
|
|
156
156
|
function handlePageInputChange(event) {
|
|
157
157
|
const page = Number(event.target.value);
|
|
158
|
-
if (page > 0 && page <= Math.max(Math.ceil(totalItems / pageSize), 1)) {
|
|
158
|
+
if (page > 0 && totalItems && page <= Math.max(Math.ceil(totalItems / pageSize), 1)) {
|
|
159
159
|
setPage(page);
|
|
160
160
|
if (onChange) {
|
|
161
161
|
onChange({
|
|
@@ -228,11 +228,11 @@ const Pagination = /*#__PURE__*/React__default["default"].forwardRef(function Pa
|
|
|
228
228
|
text: String(sizeObj.text)
|
|
229
229
|
}))), /*#__PURE__*/React__default["default"].createElement("span", {
|
|
230
230
|
className: `${prefix}--pagination__text ${prefix}--pagination__items-count`
|
|
231
|
-
}, pagesUnknown ? itemText(pageSize * (page - 1) + 1, page * pageSize) : itemRangeText(Math.min(pageSize * (page - 1) + 1, totalItems), Math.min(page * pageSize, totalItems), totalItems))), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
231
|
+
}, pagesUnknown || !totalItems ? itemText(pageSize * (page - 1) + 1, page * pageSize) : itemRangeText(Math.min(pageSize * (page - 1) + 1, totalItems), Math.min(page * pageSize, totalItems), totalItems))), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
232
232
|
className: `${prefix}--pagination__right`
|
|
233
233
|
}, pagesUnknown ? /*#__PURE__*/React__default["default"].createElement("span", {
|
|
234
|
-
className: `${prefix}--pagination__text ${prefix}--pagination__page-text`
|
|
235
|
-
},
|
|
234
|
+
className: `${prefix}--pagination__text ${prefix}--pagination__page-text ${prefix}--pagination__unknown-pages-text`
|
|
235
|
+
}, pageText(page)) : /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement(Select["default"], {
|
|
236
236
|
id: `${prefix}-pagination-select-${inputId}-right`,
|
|
237
237
|
className: `${prefix}--select__page-number`,
|
|
238
238
|
labelText: `Page number, of ${totalPages} pages`,
|
|
@@ -241,9 +241,9 @@ const Pagination = /*#__PURE__*/React__default["default"].forwardRef(function Pa
|
|
|
241
241
|
onChange: handlePageInputChange,
|
|
242
242
|
value: page,
|
|
243
243
|
disabled: pageInputDisabled || disabled
|
|
244
|
-
}, selectItems),
|
|
244
|
+
}, selectItems), /*#__PURE__*/React__default["default"].createElement("span", {
|
|
245
245
|
className: `${prefix}--pagination__text`
|
|
246
|
-
},
|
|
246
|
+
}, pageRangeText(page, totalPages))), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
247
247
|
className: `${prefix}--pagination__control-buttons`
|
|
248
248
|
}, /*#__PURE__*/React__default["default"].createElement(index.IconButton, {
|
|
249
249
|
align: "top",
|
|
@@ -6,10 +6,16 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import React, { type ForwardedRef, type WeakValidationMap, type ElementType } from 'react';
|
|
8
8
|
import { type PolymorphicProps } from '../../types/common';
|
|
9
|
-
|
|
9
|
+
/**
|
|
10
|
+
* Deprecated popover alignment values.
|
|
11
|
+
* @deprecated Use NewPopoverAlignment instead.
|
|
12
|
+
*/
|
|
13
|
+
export type DeprecatedPopoverAlignment = 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right' | 'left-bottom' | 'left-top' | 'right-bottom' | 'right-top';
|
|
14
|
+
export type NewPopoverAlignment = 'top' | 'bottom' | 'left' | 'right' | 'top-start' | 'top-end' | 'bottom-start' | 'bottom-end' | 'left-end' | 'left-start' | 'right-end' | 'right-start';
|
|
15
|
+
export type PopoverAlignment = DeprecatedPopoverAlignment | NewPopoverAlignment;
|
|
10
16
|
interface PopoverBaseProps {
|
|
11
17
|
/**
|
|
12
|
-
* Specify how the popover should align with the trigger element
|
|
18
|
+
* Specify how the popover should align with the trigger element.
|
|
13
19
|
*/
|
|
14
20
|
align?: PopoverAlignment;
|
|
15
21
|
/**
|
|
@@ -12,6 +12,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
12
12
|
var _rollupPluginBabelHelpers = require('../../_virtual/_rollupPluginBabelHelpers.js');
|
|
13
13
|
var cx = require('classnames');
|
|
14
14
|
var PropTypes = require('prop-types');
|
|
15
|
+
var deprecateValuesWithin = require('../../prop-types/deprecateValuesWithin.js');
|
|
15
16
|
var React = require('react');
|
|
16
17
|
var useIsomorphicEffect = require('../../internal/useIsomorphicEffect.js');
|
|
17
18
|
var useMergedRefs = require('../../internal/useMergedRefs.js');
|
|
@@ -35,6 +36,25 @@ const PopoverContext = /*#__PURE__*/React__default["default"].createContext({
|
|
|
35
36
|
},
|
|
36
37
|
autoAlign: null
|
|
37
38
|
});
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Deprecated popover alignment values.
|
|
42
|
+
* @deprecated Use NewPopoverAlignment instead.
|
|
43
|
+
*/
|
|
44
|
+
|
|
45
|
+
const propMappingFunction = deprecatedValue => {
|
|
46
|
+
const mapping = {
|
|
47
|
+
'top-left': 'top-start',
|
|
48
|
+
'top-right': 'top-end',
|
|
49
|
+
'bottom-left': 'bottom-start',
|
|
50
|
+
'bottom-right': 'bottom-end',
|
|
51
|
+
'left-bottom': 'left-end',
|
|
52
|
+
'left-top': 'left-start',
|
|
53
|
+
'right-bottom': 'right-end',
|
|
54
|
+
'right-top': 'right-start'
|
|
55
|
+
};
|
|
56
|
+
return mapping[deprecatedValue];
|
|
57
|
+
};
|
|
38
58
|
const Popover = /*#__PURE__*/React__default["default"].forwardRef(function PopoverRenderFunction(_ref, forwardRef) {
|
|
39
59
|
let {
|
|
40
60
|
isTabTip,
|
|
@@ -233,8 +253,9 @@ if (process.env.NODE_ENV !== "production") {
|
|
|
233
253
|
Popover.propTypes = {
|
|
234
254
|
/**
|
|
235
255
|
* Specify how the popover should align with the trigger element
|
|
256
|
+
|
|
236
257
|
*/
|
|
237
|
-
align: PropTypes__default["default"].oneOf(['top', 'top-left',
|
|
258
|
+
align: deprecateValuesWithin["default"](PropTypes__default["default"].oneOf(['top', 'top-left',
|
|
238
259
|
// deprecated use top-start instead
|
|
239
260
|
'top-right',
|
|
240
261
|
// deprecated use top-end instead
|
|
@@ -256,6 +277,10 @@ Popover.propTypes = {
|
|
|
256
277
|
|
|
257
278
|
// new values to match floating-ui
|
|
258
279
|
'top-start', 'top-end', 'bottom-start', 'bottom-end', 'left-end', 'left-start', 'right-end', 'right-start']),
|
|
280
|
+
//allowed prop values
|
|
281
|
+
['top', 'top-start', 'top-end', 'bottom', 'bottom-start', 'bottom-end', 'left', 'left-start', 'left-end', 'right', 'right-start', 'right-end'],
|
|
282
|
+
//optional mapper function
|
|
283
|
+
propMappingFunction),
|
|
259
284
|
/**
|
|
260
285
|
* Provide a custom element or component to render the top-level node for the
|
|
261
286
|
* component.
|
|
@@ -4,8 +4,7 @@
|
|
|
4
4
|
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
|
-
import {
|
|
8
|
-
import React from 'react';
|
|
7
|
+
import React, { ReactNode } from 'react';
|
|
9
8
|
type ExcludedAttributes = 'onChange';
|
|
10
9
|
export interface RadioButtonProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, ExcludedAttributes> {
|
|
11
10
|
/**
|
|
@@ -41,7 +40,7 @@ export interface RadioButtonProps extends Omit<React.InputHTMLAttributes<HTMLInp
|
|
|
41
40
|
* Provide label text to be read by screen readers when interacting with the
|
|
42
41
|
* control
|
|
43
42
|
*/
|
|
44
|
-
labelText:
|
|
43
|
+
labelText: ReactNode;
|
|
45
44
|
/**
|
|
46
45
|
* Provide a name for the underlying `<input>` node
|
|
47
46
|
*/
|
|
@@ -58,11 +57,15 @@ export interface RadioButtonProps extends Omit<React.InputHTMLAttributes<HTMLInp
|
|
|
58
57
|
/**
|
|
59
58
|
* **Experimental**: Provide a `Slug` component to be rendered inside the `RadioButton` component
|
|
60
59
|
*/
|
|
61
|
-
slug?:
|
|
60
|
+
slug?: ReactNode;
|
|
62
61
|
/**
|
|
63
62
|
* Specify the value of the `<RadioButton>`
|
|
64
63
|
*/
|
|
65
64
|
value?: string | number;
|
|
65
|
+
/**
|
|
66
|
+
* `true` to specify if the input is required.
|
|
67
|
+
*/
|
|
68
|
+
required?: boolean;
|
|
66
69
|
}
|
|
67
70
|
declare const RadioButton: React.ForwardRefExoticComponent<RadioButtonProps & React.RefAttributes<unknown>>;
|
|
68
71
|
export default RadioButton;
|
|
@@ -37,6 +37,7 @@ const RadioButton = /*#__PURE__*/React__default["default"].forwardRef((props, re
|
|
|
37
37
|
onChange = () => {},
|
|
38
38
|
value = '',
|
|
39
39
|
slug,
|
|
40
|
+
required,
|
|
40
41
|
...rest
|
|
41
42
|
} = props;
|
|
42
43
|
const prefix = usePrefix.usePrefix();
|
|
@@ -70,7 +71,8 @@ const RadioButton = /*#__PURE__*/React__default["default"].forwardRef((props, re
|
|
|
70
71
|
ref: mergeRefs["default"](inputRef, ref),
|
|
71
72
|
disabled: disabled,
|
|
72
73
|
value: value,
|
|
73
|
-
name: name
|
|
74
|
+
name: name,
|
|
75
|
+
required: required
|
|
74
76
|
})), /*#__PURE__*/React__default["default"].createElement("label", {
|
|
75
77
|
htmlFor: uniqueId,
|
|
76
78
|
className: `${prefix}--radio-button__label`
|
|
@@ -129,6 +131,10 @@ RadioButton.propTypes = {
|
|
|
129
131
|
* Provide a handler that is invoked when a user clicks on the control
|
|
130
132
|
*/
|
|
131
133
|
onClick: PropTypes__default["default"].func,
|
|
134
|
+
/**
|
|
135
|
+
* `true` to specify if the control is required.
|
|
136
|
+
*/
|
|
137
|
+
required: PropTypes__default["default"].bool,
|
|
132
138
|
/**
|
|
133
139
|
* **Experimental**: Provide a `Slug` component to be rendered inside the `RadioButton` component
|
|
134
140
|
*/
|
|
@@ -4,15 +4,14 @@
|
|
|
4
4
|
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
|
-
import {
|
|
8
|
-
import React from 'react';
|
|
7
|
+
import React, { ReactNode } from 'react';
|
|
9
8
|
export declare const RadioButtonGroupContext: React.Context<null>;
|
|
10
9
|
type ExcludedAttributes = 'onChange';
|
|
11
10
|
export interface RadioButtonGroupProps extends Omit<React.InputHTMLAttributes<HTMLFieldSetElement>, ExcludedAttributes> {
|
|
12
11
|
/**
|
|
13
12
|
* Provide a collection of `<RadioButton>` components to render in the group
|
|
14
13
|
*/
|
|
15
|
-
children?:
|
|
14
|
+
children?: ReactNode;
|
|
16
15
|
/**
|
|
17
16
|
* Provide an optional className to be applied to the container node
|
|
18
17
|
*/
|
|
@@ -28,7 +27,7 @@ export interface RadioButtonGroupProps extends Omit<React.InputHTMLAttributes<HT
|
|
|
28
27
|
/**
|
|
29
28
|
* Provide text that is used alongside the control label for additional help
|
|
30
29
|
*/
|
|
31
|
-
helperText?:
|
|
30
|
+
helperText?: ReactNode;
|
|
32
31
|
/**
|
|
33
32
|
* Specify whether the control is currently invalid
|
|
34
33
|
*/
|
|
@@ -36,7 +35,7 @@ export interface RadioButtonGroupProps extends Omit<React.InputHTMLAttributes<HT
|
|
|
36
35
|
/**
|
|
37
36
|
* Provide the text that is displayed when the control is in an invalid state
|
|
38
37
|
*/
|
|
39
|
-
invalidText?:
|
|
38
|
+
invalidText?: ReactNode;
|
|
40
39
|
/**
|
|
41
40
|
* Provide where label text should be placed
|
|
42
41
|
*/
|
|
@@ -45,7 +44,7 @@ export interface RadioButtonGroupProps extends Omit<React.InputHTMLAttributes<HT
|
|
|
45
44
|
* Provide a legend to the RadioButtonGroup input that you are
|
|
46
45
|
* exposing to the user
|
|
47
46
|
*/
|
|
48
|
-
legendText?:
|
|
47
|
+
legendText?: ReactNode;
|
|
49
48
|
/**
|
|
50
49
|
* Specify the name of the underlying `<input>` nodes
|
|
51
50
|
*/
|
|
@@ -66,7 +65,7 @@ export interface RadioButtonGroupProps extends Omit<React.InputHTMLAttributes<HT
|
|
|
66
65
|
/**
|
|
67
66
|
* **Experimental**: Provide a `Slug` component to be rendered inside the `RadioButtonGroup` component
|
|
68
67
|
*/
|
|
69
|
-
slug?:
|
|
68
|
+
slug?: ReactNode;
|
|
70
69
|
/**
|
|
71
70
|
* Specify whether the control is currently in warning state
|
|
72
71
|
*/
|
|
@@ -74,11 +73,15 @@ export interface RadioButtonGroupProps extends Omit<React.InputHTMLAttributes<HT
|
|
|
74
73
|
/**
|
|
75
74
|
* Provide the text that is displayed when the control is in warning state
|
|
76
75
|
*/
|
|
77
|
-
warnText?:
|
|
76
|
+
warnText?: ReactNode;
|
|
78
77
|
/**
|
|
79
78
|
* Specify the value that is currently selected in the group
|
|
80
79
|
*/
|
|
81
80
|
valueSelected?: string | number;
|
|
81
|
+
/**
|
|
82
|
+
* `true` to specify if input selection in group is required.
|
|
83
|
+
*/
|
|
84
|
+
required?: boolean;
|
|
82
85
|
}
|
|
83
86
|
declare const RadioButtonGroup: React.ForwardRefExoticComponent<RadioButtonGroupProps & React.RefAttributes<unknown>>;
|
|
84
87
|
export default RadioButtonGroup;
|
|
@@ -45,6 +45,7 @@ const RadioButtonGroup = /*#__PURE__*/React__default["default"].forwardRef((prop
|
|
|
45
45
|
warn = false,
|
|
46
46
|
warnText,
|
|
47
47
|
slug,
|
|
48
|
+
required,
|
|
48
49
|
...rest
|
|
49
50
|
} = props;
|
|
50
51
|
const prefix = usePrefix.usePrefix();
|
|
@@ -72,7 +73,8 @@ const RadioButtonGroup = /*#__PURE__*/React__default["default"].forwardRef((prop
|
|
|
72
73
|
key: value,
|
|
73
74
|
value: value,
|
|
74
75
|
onChange: handleOnChange,
|
|
75
|
-
checked: value === selected
|
|
76
|
+
checked: value === selected,
|
|
77
|
+
required: required
|
|
76
78
|
};
|
|
77
79
|
if (!selected && radioButton?.props.checked) {
|
|
78
80
|
newProps.checked = true;
|
|
@@ -197,6 +199,10 @@ RadioButtonGroup.propTypes = {
|
|
|
197
199
|
* Whether the RadioButtonGroup should be read-only
|
|
198
200
|
*/
|
|
199
201
|
readOnly: PropTypes__default["default"].bool,
|
|
202
|
+
/**
|
|
203
|
+
* `true` to specify if radio selection in group is required.
|
|
204
|
+
*/
|
|
205
|
+
required: PropTypes__default["default"].bool,
|
|
200
206
|
/**
|
|
201
207
|
* **Experimental**: Provide a `Slug` component to be rendered inside the `RadioButtonGroup` component
|
|
202
208
|
*/
|
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
|
-
import { ReactNodeLike } from 'prop-types';
|
|
8
7
|
import React, { ChangeEventHandler, ComponentPropsWithRef, ReactNode } from 'react';
|
|
9
8
|
type ExcludedAttributes = 'size';
|
|
10
9
|
interface SelectProps extends Omit<ComponentPropsWithRef<'select'>, ExcludedAttributes> {
|
|
@@ -80,7 +79,7 @@ interface SelectProps extends Omit<ComponentPropsWithRef<'select'>, ExcludedAttr
|
|
|
80
79
|
/**
|
|
81
80
|
* **Experimental**: Provide a `Slug` component to be rendered inside the `Dropdown` component
|
|
82
81
|
*/
|
|
83
|
-
slug?:
|
|
82
|
+
slug?: ReactNode;
|
|
84
83
|
/**
|
|
85
84
|
* Specify whether the control is currently in warning state
|
|
86
85
|
*/
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
|
-
import React, { type KeyboardEventHandler, PureComponent } from 'react';
|
|
8
|
-
import PropTypes
|
|
7
|
+
import React, { type KeyboardEventHandler, PureComponent, ReactNode } from 'react';
|
|
8
|
+
import PropTypes from 'prop-types';
|
|
9
9
|
/**
|
|
10
10
|
* Distinguish two handles by lower and upper positions.
|
|
11
11
|
*/
|
|
@@ -26,7 +26,7 @@ export interface SliderProps extends Omit<React.InputHTMLAttributes<HTMLInputEle
|
|
|
26
26
|
/**
|
|
27
27
|
* The child nodes.
|
|
28
28
|
*/
|
|
29
|
-
children?:
|
|
29
|
+
children?: ReactNode;
|
|
30
30
|
/**
|
|
31
31
|
* The CSS class name for the slider, set on the wrapping div.
|
|
32
32
|
*/
|
|
@@ -58,11 +58,11 @@ export interface SliderProps extends Omit<React.InputHTMLAttributes<HTMLInputEle
|
|
|
58
58
|
/**
|
|
59
59
|
* Provide the text that is displayed when the Slider is in an invalid state
|
|
60
60
|
*/
|
|
61
|
-
invalidText?:
|
|
61
|
+
invalidText?: ReactNode;
|
|
62
62
|
/**
|
|
63
63
|
* The label for the slider.
|
|
64
64
|
*/
|
|
65
|
-
labelText?:
|
|
65
|
+
labelText?: ReactNode;
|
|
66
66
|
/**
|
|
67
67
|
* @deprecated
|
|
68
68
|
* `true` to use the light version.
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
|
-
import PropTypes
|
|
8
|
-
import React from 'react';
|
|
7
|
+
import PropTypes from 'prop-types';
|
|
8
|
+
import React, { ReactNode } from 'react';
|
|
9
9
|
import { PolymorphicProps } from '../../types/common';
|
|
10
10
|
import { SIZES, TYPES } from './Tag';
|
|
11
11
|
export interface DismissibleTagBaseProps {
|
|
@@ -42,7 +42,7 @@ export interface DismissibleTagBaseProps {
|
|
|
42
42
|
/**
|
|
43
43
|
* **Experimental:** Provide a `Slug` component to be rendered inside the `DismissibleTag` component
|
|
44
44
|
*/
|
|
45
|
-
slug?:
|
|
45
|
+
slug?: ReactNode;
|
|
46
46
|
/**
|
|
47
47
|
* Text to show on clear filters
|
|
48
48
|
*/
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
|
-
import PropTypes
|
|
8
|
-
import React, { MouseEventHandler } from 'react';
|
|
7
|
+
import PropTypes from 'prop-types';
|
|
8
|
+
import React, { MouseEventHandler, ReactNode } from 'react';
|
|
9
9
|
import { PolymorphicProps } from '../../types/common';
|
|
10
10
|
import { SIZES } from './Tag';
|
|
11
11
|
declare const TYPES: {
|
|
@@ -51,7 +51,7 @@ export interface OperationalTagBaseProps {
|
|
|
51
51
|
/**
|
|
52
52
|
* **Experimental:** Provide a `Slug` component to be rendered inside the `OperationalTag` component
|
|
53
53
|
*/
|
|
54
|
-
slug?:
|
|
54
|
+
slug?: ReactNode;
|
|
55
55
|
/**
|
|
56
56
|
* Specify the type of the `Tag`
|
|
57
57
|
*/
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
|
-
import PropTypes
|
|
8
|
-
import React from 'react';
|
|
7
|
+
import PropTypes from 'prop-types';
|
|
8
|
+
import React, { ReactNode } from 'react';
|
|
9
9
|
import { PolymorphicProps } from '../../types/common';
|
|
10
10
|
import { SIZES } from './Tag';
|
|
11
11
|
export interface SelectableTagBaseProps {
|
|
@@ -42,7 +42,7 @@ export interface SelectableTagBaseProps {
|
|
|
42
42
|
/**
|
|
43
43
|
* **Experimental:** Provide a `Slug` component to be rendered inside the `SelectableTag` component
|
|
44
44
|
*/
|
|
45
|
-
slug?:
|
|
45
|
+
slug?: ReactNode;
|
|
46
46
|
}
|
|
47
47
|
export type SelectableTagProps<T extends React.ElementType> = PolymorphicProps<T, SelectableTagBaseProps>;
|
|
48
48
|
declare const SelectableTag: {
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
|
-
import PropTypes
|
|
8
|
-
import React from 'react';
|
|
7
|
+
import PropTypes from 'prop-types';
|
|
8
|
+
import React, { ReactNode } from 'react';
|
|
9
9
|
import { PolymorphicProps } from '../../types/common';
|
|
10
10
|
export declare const TYPES: {
|
|
11
11
|
red: string;
|
|
@@ -64,7 +64,7 @@ export interface TagBaseProps {
|
|
|
64
64
|
/**
|
|
65
65
|
* **Experimental:** Provide a `Slug` component to be rendered inside the `Tag` component
|
|
66
66
|
*/
|
|
67
|
-
slug?:
|
|
67
|
+
slug?: ReactNode;
|
|
68
68
|
/**
|
|
69
69
|
* @deprecated This property is deprecated and will be removed in the next major version. Use DismissibleTag instead.
|
|
70
70
|
*/
|