@carbon/react 1.90.0 → 1.91.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 +921 -921
- package/es/components/CodeSnippet/CodeSnippet.d.ts +1 -1
- package/es/components/CodeSnippet/CodeSnippet.js +1 -1
- package/es/components/ComboBox/ComboBox.js +1 -12
- package/es/components/ComboButton/index.js +1 -1
- package/es/components/ComposedModal/ComposedModal.js +1 -1
- package/es/components/Copy/Copy.d.ts +1 -1
- package/es/components/Copy/Copy.js +1 -1
- package/es/components/CopyButton/CopyButton.d.ts +1 -1
- package/es/components/CopyButton/CopyButton.js +1 -1
- package/es/components/DataTable/DataTable.d.ts +60 -15
- package/es/components/DataTable/DataTable.js +106 -179
- package/es/components/DataTable/Table.d.ts +2 -2
- package/es/components/DataTable/Table.js +1 -1
- package/es/components/DataTable/TableExpandHeader.d.ts +1 -1
- package/es/components/DataTable/TableExpandHeader.js +1 -1
- package/es/components/DatePicker/DatePicker.d.ts +0 -12
- package/es/components/DatePicker/DatePicker.js +3 -3
- package/es/components/DatePicker/plugins/rangePlugin.d.ts +19 -2
- package/es/components/DatePicker/plugins/rangePlugin.js +18 -14
- package/es/components/Dropdown/Dropdown.js +1 -12
- package/es/components/FeatureFlags/index.js +1 -0
- package/es/components/IconButton/index.js +1 -1
- package/es/components/Menu/MenuItem.d.ts +1 -1
- package/es/components/Menu/MenuItem.js +5 -5
- package/es/components/Modal/Modal.js +1 -1
- package/es/components/MultiSelect/FilterableMultiSelect.js +1 -1
- package/es/components/MultiSelect/MultiSelect.js +1 -12
- package/es/components/Notification/Notification.d.ts +6 -6
- package/es/components/Notification/Notification.js +6 -6
- package/es/components/OverflowMenu/OverflowMenu.js +1 -1
- package/es/components/OverflowMenu/next/index.js +1 -1
- package/es/components/Popover/index.js +1 -1
- package/es/components/Search/Search.d.ts +4 -2
- package/es/components/Search/Search.js +5 -4
- package/es/components/Slider/Slider.d.ts +144 -188
- package/es/components/Slider/Slider.js +787 -710
- package/es/components/Slider/index.d.ts +2 -2
- package/es/components/Tabs/Tabs.d.ts +4 -0
- package/es/components/TextArea/TextArea.js +13 -6
- package/es/components/TextInput/ControlledPasswordInput.js +2 -2
- package/es/components/TextInput/PasswordInput.js +2 -2
- package/es/components/TextInput/TextInput.js +2 -2
- package/es/components/TextInput/util.d.ts +17 -5
- package/es/components/TextInput/util.js +2 -7
- package/es/components/UIShell/HeaderPanel.d.ts +1 -1
- package/es/index.d.ts +12 -13
- package/es/index.js +25 -24
- package/es/internal/defaultItemToString.d.ts +7 -0
- package/es/internal/defaultItemToString.js +17 -0
- package/es/internal/index.d.ts +1 -0
- package/es/prop-types/deprecateValuesWithin.d.ts +8 -1
- package/es/prop-types/deprecateValuesWithin.js +6 -6
- package/es/prop-types/requiredIfGivenPropIsTruthy.d.ts +8 -7
- package/es/prop-types/requiredIfGivenPropIsTruthy.js +10 -10
- package/lib/components/CodeSnippet/CodeSnippet.d.ts +1 -1
- package/lib/components/CodeSnippet/CodeSnippet.js +1 -1
- package/lib/components/ComboBox/ComboBox.js +3 -14
- package/lib/components/ComboButton/index.js +1 -1
- package/lib/components/ComposedModal/ComposedModal.js +1 -1
- package/lib/components/Copy/Copy.d.ts +1 -1
- package/lib/components/Copy/Copy.js +1 -1
- package/lib/components/CopyButton/CopyButton.d.ts +1 -1
- package/lib/components/CopyButton/CopyButton.js +1 -1
- package/lib/components/DataTable/DataTable.d.ts +60 -15
- package/lib/components/DataTable/DataTable.js +106 -179
- package/lib/components/DataTable/Table.d.ts +2 -2
- package/lib/components/DataTable/Table.js +1 -1
- package/lib/components/DataTable/TableExpandHeader.d.ts +1 -1
- package/lib/components/DataTable/TableExpandHeader.js +3 -3
- package/lib/components/DatePicker/DatePicker.d.ts +0 -12
- package/lib/components/DatePicker/DatePicker.js +2 -2
- package/lib/components/DatePicker/plugins/rangePlugin.d.ts +19 -2
- package/lib/components/DatePicker/plugins/rangePlugin.js +18 -16
- package/lib/components/Dropdown/Dropdown.js +3 -14
- package/lib/components/FeatureFlags/index.js +1 -0
- package/lib/components/IconButton/index.js +1 -1
- package/lib/components/Menu/MenuItem.d.ts +1 -1
- package/lib/components/Menu/MenuItem.js +6 -6
- package/lib/components/Modal/Modal.js +1 -1
- package/lib/components/MultiSelect/FilterableMultiSelect.js +8 -8
- package/lib/components/MultiSelect/MultiSelect.js +2 -13
- package/lib/components/Notification/Notification.d.ts +6 -6
- package/lib/components/Notification/Notification.js +6 -6
- package/lib/components/OverflowMenu/OverflowMenu.js +1 -1
- package/lib/components/OverflowMenu/next/index.js +1 -1
- package/lib/components/Popover/index.js +1 -1
- package/lib/components/Search/Search.d.ts +4 -2
- package/lib/components/Search/Search.js +5 -4
- package/lib/components/Slider/Slider.d.ts +144 -188
- package/lib/components/Slider/Slider.js +784 -709
- package/lib/components/Slider/index.d.ts +2 -2
- package/lib/components/Tabs/Tabs.d.ts +4 -0
- package/lib/components/TextArea/TextArea.js +13 -6
- package/lib/components/TextInput/ControlledPasswordInput.js +1 -1
- package/lib/components/TextInput/PasswordInput.js +1 -1
- package/lib/components/TextInput/TextInput.js +1 -1
- package/lib/components/TextInput/util.d.ts +17 -5
- package/lib/components/TextInput/util.js +2 -7
- package/lib/components/UIShell/HeaderPanel.d.ts +1 -1
- package/lib/index.d.ts +12 -13
- package/lib/index.js +51 -28
- package/lib/internal/defaultItemToString.d.ts +7 -0
- package/lib/internal/defaultItemToString.js +19 -0
- package/lib/internal/index.d.ts +1 -0
- package/lib/prop-types/deprecateValuesWithin.d.ts +8 -1
- package/lib/prop-types/deprecateValuesWithin.js +6 -8
- package/lib/prop-types/requiredIfGivenPropIsTruthy.d.ts +8 -7
- package/lib/prop-types/requiredIfGivenPropIsTruthy.js +10 -12
- package/package.json +8 -7
- package/es/components/MultiSelect/tools/itemToString.d.ts +0 -1
- package/es/components/MultiSelect/tools/itemToString.js +0 -21
- package/es/components/Slider/index.js +0 -14
- package/es/internal/createClassWrapper.js +0 -23
- package/lib/components/MultiSelect/tools/itemToString.d.ts +0 -1
- package/lib/components/MultiSelect/tools/itemToString.js +0 -23
- package/lib/components/Slider/index.js +0 -20
- package/lib/internal/createClassWrapper.js +0 -25
|
@@ -5,36 +5,40 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import
|
|
8
|
+
import baseRangePlugin from 'flatpickr/dist/plugins/rangePlugin';
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
|
-
* @param
|
|
12
|
-
* @returns
|
|
11
|
+
* @param config Plugin configuration.
|
|
12
|
+
* @returns An extension of Flatpickr `rangePlugin` that does the following:
|
|
13
13
|
* * Better ensures the calendar dropdown is always aligned to the `<input>` for the starting date.
|
|
14
14
|
* Workaround for: https://github.com/flatpickr/flatpickr/issues/1944
|
|
15
15
|
* * A logic to ensure `fp.setDate()` call won't end up with "startDate to endDate" set to the first `<input>`
|
|
16
16
|
*/
|
|
17
|
-
|
|
18
|
-
const factory =
|
|
17
|
+
const rangePlugin = (config = {}) => {
|
|
18
|
+
const factory = baseRangePlugin(Object.assign({
|
|
19
19
|
position: 'left'
|
|
20
20
|
}, config));
|
|
21
21
|
return fp => {
|
|
22
|
-
const
|
|
22
|
+
const {
|
|
23
|
+
setDate: origSetDate
|
|
24
|
+
} = fp;
|
|
23
25
|
const init = () => {
|
|
24
|
-
fp.setDate =
|
|
25
|
-
origSetDate
|
|
26
|
+
fp.setDate = (dates, triggerChange, format) => {
|
|
27
|
+
origSetDate(dates, triggerChange, format);
|
|
26
28
|
// If `triggerChange` is `true`, `onValueUpdate` Flatpickr event is fired
|
|
27
29
|
// where Flatpickr's range plugin takes care of fixing the first `<input>`
|
|
28
|
-
if (!triggerChange && dates.length === 2) {
|
|
30
|
+
if (!triggerChange && Array.isArray(dates) && dates.length === 2) {
|
|
29
31
|
const {
|
|
32
|
+
formatDate,
|
|
30
33
|
_input: inputFrom
|
|
31
34
|
} = fp;
|
|
32
35
|
const {
|
|
33
36
|
input: inputTo
|
|
34
37
|
} = config;
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
+
const inputToElement = typeof inputTo === 'string' ? document.querySelector(inputTo) : inputTo;
|
|
39
|
+
[inputFrom, inputToElement].forEach((input, i) => {
|
|
40
|
+
if (input && input instanceof HTMLInputElement) {
|
|
41
|
+
input.value = !dates[i] ? '' : formatDate(new Date(dates[i]), fp.config.dateFormat);
|
|
38
42
|
}
|
|
39
43
|
});
|
|
40
44
|
}
|
|
@@ -46,9 +50,9 @@ var carbonFlatpickrRangePlugin = config => {
|
|
|
46
50
|
} = origRangePlugin;
|
|
47
51
|
return Object.assign(origRangePlugin, {
|
|
48
52
|
onReady: [init, origOnReady],
|
|
49
|
-
onPreCalendarPosition() {}
|
|
53
|
+
onPreCalendarPosition: () => {}
|
|
50
54
|
});
|
|
51
55
|
};
|
|
52
56
|
};
|
|
53
57
|
|
|
54
|
-
export {
|
|
58
|
+
export { rangePlugin };
|
|
@@ -21,6 +21,7 @@ import { useId } from '../../internal/useId.js';
|
|
|
21
21
|
import { useFloating, autoUpdate, size, flip, hide } from '@floating-ui/react';
|
|
22
22
|
import { useFeatureFlag } from '../FeatureFlags/index.js';
|
|
23
23
|
import { AILabel } from '../AILabel/index.js';
|
|
24
|
+
import { defaultItemToString } from '../../internal/defaultItemToString.js';
|
|
24
25
|
import { isComponentElement } from '../../internal/utils.js';
|
|
25
26
|
import { ListBoxTypePropType, ListBoxSizePropType } from '../ListBox/ListBoxPropTypes.js';
|
|
26
27
|
|
|
@@ -28,18 +29,6 @@ const {
|
|
|
28
29
|
ItemMouseMove,
|
|
29
30
|
MenuMouseLeave
|
|
30
31
|
} = useSelect.stateChangeTypes;
|
|
31
|
-
const defaultItemToString = item => {
|
|
32
|
-
if (typeof item === 'string') {
|
|
33
|
-
return item;
|
|
34
|
-
}
|
|
35
|
-
if (typeof item === 'number') {
|
|
36
|
-
return `${item}`;
|
|
37
|
-
}
|
|
38
|
-
if (item !== null && typeof item === 'object' && 'label' in item && typeof item['label'] === 'string') {
|
|
39
|
-
return item['label'];
|
|
40
|
-
}
|
|
41
|
-
return '';
|
|
42
|
-
};
|
|
43
32
|
/**
|
|
44
33
|
* Custom state reducer for `useSelect` in Downshift, providing control over
|
|
45
34
|
* state changes.
|
|
@@ -10,6 +10,7 @@ import PropTypes from 'prop-types';
|
|
|
10
10
|
import React, { useContext, createContext, useState, useRef, useEffect } from 'react';
|
|
11
11
|
import { deprecate } from '../../prop-types/deprecate.js';
|
|
12
12
|
|
|
13
|
+
// TODO: Can this variable be deleted now? It isn't used anywhere.
|
|
13
14
|
/**
|
|
14
15
|
* Our FeatureFlagContext is used alongside the FeatureFlags component to enable
|
|
15
16
|
* or disable feature flags in a given React tree
|
|
@@ -14,7 +14,7 @@ import { Tooltip } from '../Tooltip/Tooltip.js';
|
|
|
14
14
|
import { useId } from '../../internal/useId.js';
|
|
15
15
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
16
16
|
import ButtonBase from '../Button/ButtonBase.js';
|
|
17
|
-
import deprecateValuesWithin from '../../prop-types/deprecateValuesWithin.js';
|
|
17
|
+
import { deprecateValuesWithin } from '../../prop-types/deprecateValuesWithin.js';
|
|
18
18
|
import { BadgeIndicator } from '../BadgeIndicator/index.js';
|
|
19
19
|
import { mapPopoverAlign } from '../../tools/mapPopoverAlign.js';
|
|
20
20
|
|
|
@@ -80,7 +80,7 @@ export interface MenuItemRadioGroupProps<Item> extends Omit<ComponentProps<'ul'>
|
|
|
80
80
|
*/
|
|
81
81
|
defaultSelectedItem?: Item;
|
|
82
82
|
/**
|
|
83
|
-
*
|
|
83
|
+
* Converts an item into a string for display.
|
|
84
84
|
*/
|
|
85
85
|
itemToString?: (item: Item) => string;
|
|
86
86
|
/**
|
|
@@ -21,6 +21,7 @@ import { MenuContext } from './MenuContext.js';
|
|
|
21
21
|
import '../LayoutDirection/LayoutDirection.js';
|
|
22
22
|
import { useLayoutDirection } from '../LayoutDirection/useLayoutDirection.js';
|
|
23
23
|
import '../Text/index.js';
|
|
24
|
+
import { defaultItemToString } from '../../internal/defaultItemToString.js';
|
|
24
25
|
import { Text } from '../Text/Text.js';
|
|
25
26
|
|
|
26
27
|
var _Checkmark, _CaretLeft, _CaretRight;
|
|
@@ -178,15 +179,15 @@ const MenuItem = /*#__PURE__*/forwardRef(function MenuItem({
|
|
|
178
179
|
"aria-expanded": hasChildren ? submenuOpen : undefined,
|
|
179
180
|
onClick: handleClick,
|
|
180
181
|
onKeyDown: handleKeyDown,
|
|
181
|
-
onKeyUp: handleKeyUp
|
|
182
|
+
onKeyUp: handleKeyUp,
|
|
183
|
+
title: label
|
|
182
184
|
}, getReferenceProps()), /*#__PURE__*/React.createElement("div", {
|
|
183
185
|
className: `${prefix}--menu-item__selection-icon`
|
|
184
186
|
}, rest['aria-checked'] && (_Checkmark || (_Checkmark = /*#__PURE__*/React.createElement(Checkmark, null)))), /*#__PURE__*/React.createElement("div", {
|
|
185
187
|
className: `${prefix}--menu-item__icon`
|
|
186
188
|
}, IconElement && /*#__PURE__*/React.createElement(IconElement, null)), /*#__PURE__*/React.createElement(Text, {
|
|
187
189
|
as: "div",
|
|
188
|
-
className: `${prefix}--menu-item__label
|
|
189
|
-
title: label
|
|
190
|
+
className: `${prefix}--menu-item__label`
|
|
190
191
|
}, label), shortcut && !hasChildren && /*#__PURE__*/React.createElement("div", {
|
|
191
192
|
className: `${prefix}--menu-item__shortcut`
|
|
192
193
|
}, shortcut), hasChildren && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
@@ -324,7 +325,6 @@ MenuItemGroup.propTypes = {
|
|
|
324
325
|
*/
|
|
325
326
|
label: PropTypes.string.isRequired
|
|
326
327
|
};
|
|
327
|
-
const defaultItemToString = item => item.toString();
|
|
328
328
|
const MenuItemRadioGroup = /*#__PURE__*/forwardRef(function MenuItemRadioGroup({
|
|
329
329
|
className,
|
|
330
330
|
defaultSelectedItem,
|
|
@@ -382,7 +382,7 @@ MenuItemRadioGroup.propTypes = {
|
|
|
382
382
|
*/
|
|
383
383
|
defaultSelectedItem: PropTypes.any,
|
|
384
384
|
/**
|
|
385
|
-
*
|
|
385
|
+
* Converts an item into a string for display.
|
|
386
386
|
*/
|
|
387
387
|
itemToString: PropTypes.func,
|
|
388
388
|
/**
|
|
@@ -16,7 +16,7 @@ import '../Button/Button.Skeleton.js';
|
|
|
16
16
|
import ButtonSet from '../ButtonSet/ButtonSet.js';
|
|
17
17
|
import InlineLoading from '../InlineLoading/InlineLoading.js';
|
|
18
18
|
import { Layer } from '../Layer/index.js';
|
|
19
|
-
import requiredIfGivenPropIsTruthy from '../../prop-types/requiredIfGivenPropIsTruthy.js';
|
|
19
|
+
import { requiredIfGivenPropIsTruthy } from '../../prop-types/requiredIfGivenPropIsTruthy.js';
|
|
20
20
|
import { wrapFocus, wrapFocusWithoutSentinels, elementOrParentIsFloatingMenu } from '../../internal/wrapFocus.js';
|
|
21
21
|
import useIsomorphicEffect from '../../internal/useIsomorphicEffect.js';
|
|
22
22
|
import { useId } from '../../internal/useId.js';
|
|
@@ -21,7 +21,6 @@ import ListBoxSelection from '../ListBox/next/ListBoxSelection.js';
|
|
|
21
21
|
import ListBoxTrigger from '../ListBox/next/ListBoxTrigger.js';
|
|
22
22
|
import { Space, Enter, Delete, Escape, Tab, Home, End } from '../../internal/keyboard/keys.js';
|
|
23
23
|
import { match } from '../../internal/keyboard/match.js';
|
|
24
|
-
import { defaultItemToString } from './tools/itemToString.js';
|
|
25
24
|
import mergeRefs from '../../tools/mergeRefs.js';
|
|
26
25
|
import { deprecate } from '../../prop-types/deprecate.js';
|
|
27
26
|
import { useId } from '../../internal/useId.js';
|
|
@@ -32,6 +31,7 @@ import { FormContext } from '../FluidForm/FormContext.js';
|
|
|
32
31
|
import { useSelection } from '../../internal/Selection.js';
|
|
33
32
|
import { useFloating, autoUpdate, flip, size, hide } from '@floating-ui/react';
|
|
34
33
|
import { AILabel } from '../AILabel/index.js';
|
|
34
|
+
import { defaultItemToString } from '../../internal/defaultItemToString.js';
|
|
35
35
|
import { isComponentElement } from '../../internal/utils.js';
|
|
36
36
|
import { ListBoxTypePropType, ListBoxSizePropType } from '../ListBox/ListBoxPropTypes.js';
|
|
37
37
|
|
|
@@ -30,6 +30,7 @@ import { noopFn } from '../../internal/noopFn.js';
|
|
|
30
30
|
import { useFloating, autoUpdate, flip, size, hide } from '@floating-ui/react';
|
|
31
31
|
import { useFeatureFlag } from '../FeatureFlags/index.js';
|
|
32
32
|
import { AILabel } from '../AILabel/index.js';
|
|
33
|
+
import { defaultItemToString } from '../../internal/defaultItemToString.js';
|
|
33
34
|
import { isComponentElement } from '../../internal/utils.js';
|
|
34
35
|
import { ListBoxTypePropType, ListBoxSizePropType } from '../ListBox/ListBoxPropTypes.js';
|
|
35
36
|
|
|
@@ -48,18 +49,6 @@ const {
|
|
|
48
49
|
ToggleButtonKeyDownPageUp,
|
|
49
50
|
FunctionSetHighlightedIndex
|
|
50
51
|
} = useSelect.stateChangeTypes;
|
|
51
|
-
const defaultItemToString = item => {
|
|
52
|
-
if (typeof item === 'string') {
|
|
53
|
-
return item;
|
|
54
|
-
}
|
|
55
|
-
if (typeof item === 'number') {
|
|
56
|
-
return `${item}`;
|
|
57
|
-
}
|
|
58
|
-
if (item !== null && typeof item === 'object' && 'label' in item && typeof item['label'] === 'string') {
|
|
59
|
-
return item['label'];
|
|
60
|
-
}
|
|
61
|
-
return '';
|
|
62
|
-
};
|
|
63
52
|
const MultiSelect = /*#__PURE__*/React.forwardRef(({
|
|
64
53
|
autoAlign = false,
|
|
65
54
|
className: containerClassName,
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
|
-
import React, { type ReactNode, type MouseEvent, type ButtonHTMLAttributes, type HTMLAttributes } from 'react';
|
|
9
|
-
import { type ButtonProps } from '../Button';
|
|
8
|
+
import React, { type ReactNode, type MouseEvent, type ButtonHTMLAttributes, type HTMLAttributes, type ComponentProps } from 'react';
|
|
9
|
+
import Button, { type ButtonProps } from '../Button';
|
|
10
10
|
export interface NotificationActionButtonProps extends ButtonProps<'button'> {
|
|
11
11
|
/**
|
|
12
12
|
* Specify the content of the notification action button.
|
|
@@ -23,7 +23,7 @@ export interface NotificationActionButtonProps extends ButtonProps<'button'> {
|
|
|
23
23
|
/**
|
|
24
24
|
* Optionally specify a click handler for the notification action button.
|
|
25
25
|
*/
|
|
26
|
-
onClick
|
|
26
|
+
onClick?: ComponentProps<typeof Button>['onClick'];
|
|
27
27
|
}
|
|
28
28
|
export declare function NotificationActionButton({ children, className: customClassName, onClick, inline, ...rest }: NotificationActionButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
29
29
|
export declare namespace NotificationActionButton {
|
|
@@ -404,7 +404,7 @@ export interface ActionableNotificationProps extends HTMLAttributes<HTMLDivEleme
|
|
|
404
404
|
/**
|
|
405
405
|
* Provide a function that is called when the action is clicked
|
|
406
406
|
*/
|
|
407
|
-
onActionButtonClick
|
|
407
|
+
onActionButtonClick?: ComponentProps<typeof NotificationActionButton>['onClick'];
|
|
408
408
|
/**
|
|
409
409
|
* Provide a function that is called when menu is closed.
|
|
410
410
|
* Default behavior of hiding the notification is prevented if this function returns false.
|
|
@@ -551,7 +551,7 @@ export interface CalloutProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
551
551
|
/**
|
|
552
552
|
* Provide a function that is called when the action is clicked
|
|
553
553
|
*/
|
|
554
|
-
onActionButtonClick
|
|
554
|
+
onActionButtonClick?: ComponentProps<typeof NotificationActionButton>['onClick'];
|
|
555
555
|
/**
|
|
556
556
|
* Provide a description for "status" icon that can be read by screen readers
|
|
557
557
|
*/
|
|
@@ -587,7 +587,7 @@ export declare namespace Callout {
|
|
|
587
587
|
/**
|
|
588
588
|
* Specify what state the notification represents
|
|
589
589
|
*/
|
|
590
|
-
kind:
|
|
590
|
+
kind: PropTypes.Requireable<string> | PropTypes.Validator<string>;
|
|
591
591
|
/**
|
|
592
592
|
* Specify whether you are using the low contrast variant of the Callout.
|
|
593
593
|
*/
|
|
@@ -24,7 +24,7 @@ import { noopFn } from '../../internal/noopFn.js';
|
|
|
24
24
|
import { wrapFocusWithoutSentinels, wrapFocus } from '../../internal/wrapFocus.js';
|
|
25
25
|
import { useFeatureFlag } from '../FeatureFlags/index.js';
|
|
26
26
|
import { warning } from '../../internal/warning.js';
|
|
27
|
-
import deprecateValuesWithin from '../../prop-types/deprecateValuesWithin.js';
|
|
27
|
+
import { deprecateValuesWithin } from '../../prop-types/deprecateValuesWithin.js';
|
|
28
28
|
import { Text } from '../Text/Text.js';
|
|
29
29
|
|
|
30
30
|
/**
|
|
@@ -699,12 +699,12 @@ ActionableNotification.propTypes = {
|
|
|
699
699
|
* @deprecated Use NewKindProps instead.
|
|
700
700
|
*/
|
|
701
701
|
|
|
702
|
+
const mapping = {
|
|
703
|
+
error: 'warning',
|
|
704
|
+
// only redirect error -> warning
|
|
705
|
+
success: 'info' // only redirect success -> info
|
|
706
|
+
};
|
|
702
707
|
const propMappingFunction = deprecatedValue => {
|
|
703
|
-
const mapping = {
|
|
704
|
-
error: 'warning',
|
|
705
|
-
// only redirect error -> warning
|
|
706
|
-
success: 'info' // only redirect success -> info
|
|
707
|
-
};
|
|
708
708
|
return mapping[deprecatedValue];
|
|
709
709
|
};
|
|
710
710
|
function Callout({
|
|
@@ -21,7 +21,7 @@ import mergeRefs from '../../tools/mergeRefs.js';
|
|
|
21
21
|
import { setupGetInstanceId } from '../../tools/setupGetInstanceId.js';
|
|
22
22
|
import { IconButton } from '../IconButton/index.js';
|
|
23
23
|
import { useOutsideClick } from '../../internal/useOutsideClick.js';
|
|
24
|
-
import deprecateValuesWithin from '../../prop-types/deprecateValuesWithin.js';
|
|
24
|
+
import { deprecateValuesWithin } from '../../prop-types/deprecateValuesWithin.js';
|
|
25
25
|
import { mapPopoverAlign } from '../../tools/mapPopoverAlign.js';
|
|
26
26
|
|
|
27
27
|
const getInstanceId = setupGetInstanceId();
|
|
@@ -19,7 +19,7 @@ import mergeRefs from '../../../tools/mergeRefs.js';
|
|
|
19
19
|
import { useId } from '../../../internal/useId.js';
|
|
20
20
|
import { usePrefix } from '../../../internal/usePrefix.js';
|
|
21
21
|
import { useAttachedMenu } from '../../../internal/useAttachedMenu.js';
|
|
22
|
-
import deprecateValuesWithin from '../../../prop-types/deprecateValuesWithin.js';
|
|
22
|
+
import { deprecateValuesWithin } from '../../../prop-types/deprecateValuesWithin.js';
|
|
23
23
|
import { mapPopoverAlign } from '../../../tools/mapPopoverAlign.js';
|
|
24
24
|
|
|
25
25
|
const defaultSize = 'md';
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
9
9
|
import cx from 'classnames';
|
|
10
10
|
import PropTypes from 'prop-types';
|
|
11
|
-
import deprecateValuesWithin from '../../prop-types/deprecateValuesWithin.js';
|
|
11
|
+
import { deprecateValuesWithin } from '../../prop-types/deprecateValuesWithin.js';
|
|
12
12
|
import React, { useRef, useMemo, useEffect } from 'react';
|
|
13
13
|
import useIsomorphicEffect from '../../internal/useIsomorphicEffect.js';
|
|
14
14
|
import { useMergedRefs } from '../../internal/useMergedRefs.js';
|
|
@@ -63,7 +63,9 @@ export interface SearchProps extends InputPropsBase {
|
|
|
63
63
|
*/
|
|
64
64
|
renderIcon?: ComponentType | FunctionComponent;
|
|
65
65
|
/**
|
|
66
|
-
* Specify the role for the underlying `<input
|
|
66
|
+
* @deprecated Specify the role for the underlying `<input>`.
|
|
67
|
+
* No longer needed since `<input type="search">` already provides the correct semantics.
|
|
68
|
+
* This prop will be removed in the next major release of Carbon.
|
|
67
69
|
*/
|
|
68
70
|
role?: string;
|
|
69
71
|
/**
|
|
@@ -71,7 +73,7 @@ export interface SearchProps extends InputPropsBase {
|
|
|
71
73
|
*/
|
|
72
74
|
size?: 'sm' | 'md' | 'lg';
|
|
73
75
|
/**
|
|
74
|
-
*
|
|
76
|
+
* Specify the type of the `<input>`
|
|
75
77
|
*/
|
|
76
78
|
type?: string;
|
|
77
79
|
/**
|
|
@@ -39,9 +39,9 @@ const Search = /*#__PURE__*/React.forwardRef(({
|
|
|
39
39
|
onExpand,
|
|
40
40
|
placeholder = 'Search',
|
|
41
41
|
renderIcon,
|
|
42
|
-
role
|
|
42
|
+
role,
|
|
43
43
|
size = 'md',
|
|
44
|
-
type = '
|
|
44
|
+
type = 'search',
|
|
45
45
|
value,
|
|
46
46
|
...rest
|
|
47
47
|
}, forwardRef) => {
|
|
@@ -238,15 +238,16 @@ Search.propTypes = {
|
|
|
238
238
|
*/
|
|
239
239
|
renderIcon: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
|
|
240
240
|
/**
|
|
241
|
+
* Deprecated, since <input type="search"> already provides correct semantics.
|
|
241
242
|
* Specify the role for the underlying `<input>`, defaults to `searchbox`
|
|
242
243
|
*/
|
|
243
|
-
role: PropTypes.string,
|
|
244
|
+
role: deprecate(PropTypes.string, 'The `role` prop has been deprecated since <input type="search"> already provides correct semantics. ' + 'It will be removed in the next major release of Carbon.'),
|
|
244
245
|
/**
|
|
245
246
|
* Specify the size of the Search
|
|
246
247
|
*/
|
|
247
248
|
size: PropTypes.oneOf(['sm', 'md', 'lg']),
|
|
248
249
|
/**
|
|
249
|
-
*
|
|
250
|
+
* Specify the type of the `<input>`
|
|
250
251
|
*/
|
|
251
252
|
type: PropTypes.string,
|
|
252
253
|
/**
|