@carbon/react 1.70.0 → 1.71.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 +895 -895
- package/es/components/AILabel/index.js +15 -15
- package/es/components/CodeSnippet/CodeSnippet.d.ts +5 -2
- package/es/components/CodeSnippet/CodeSnippet.js +40 -1
- package/es/components/ComboBox/ComboBox.js +19 -22
- package/es/components/ComboButton/index.js +40 -1
- package/es/components/ContentSwitcher/ContentSwitcher.d.ts +2 -2
- package/es/components/ContentSwitcher/ContentSwitcher.js +1 -1
- package/es/components/Copy/Copy.d.ts +5 -2
- package/es/components/Copy/Copy.js +40 -1
- package/es/components/CopyButton/CopyButton.d.ts +5 -2
- package/es/components/CopyButton/CopyButton.js +40 -1
- package/es/components/DataTable/TableSelectRow.js +14 -6
- package/es/components/DataTable/TableToolbarSearch.js +1 -1
- package/es/components/DataTable/stories/examples/TableToolbarFilter.d.ts +1 -1
- package/es/components/DatePicker/plugins/fixEventsPlugin.js +2 -2
- package/es/components/DatePickerInput/DatePickerInput.d.ts +6 -1
- package/es/components/DatePickerInput/DatePickerInput.js +16 -10
- package/es/components/Dropdown/Dropdown.d.ts +5 -0
- package/es/components/Dropdown/Dropdown.js +132 -92
- package/es/components/FeatureFlags/index.js +1 -2
- package/es/components/IconButton/index.d.ts +4 -1
- package/es/components/IconButton/index.js +40 -1
- package/es/components/InlineCheckbox/InlineCheckbox.d.ts +50 -0
- package/es/components/InlineCheckbox/InlineCheckbox.js +3 -6
- package/es/components/InlineCheckbox/index.d.ts +9 -0
- package/es/components/LayoutDirection/LayoutDirection.d.ts +44 -0
- package/es/components/LayoutDirection/LayoutDirectionContext.d.ts +10 -0
- package/es/components/LayoutDirection/useLayoutDirection.d.ts +12 -0
- package/es/components/Menu/MenuItem.js +0 -3
- package/es/components/MultiSelect/FilterableMultiSelect.d.ts +1 -1
- package/es/components/MultiSelect/FilterableMultiSelect.js +1 -2
- package/es/components/MultiSelect/MultiSelect.js +1 -1
- package/es/components/Notification/Notification.d.ts +9 -2
- package/es/components/Notification/Notification.js +16 -2
- package/es/components/NumberInput/NumberInput.d.ts +5 -0
- package/es/components/NumberInput/NumberInput.js +17 -9
- package/es/components/OverflowMenu/next/index.js +40 -1
- package/es/components/Pagination/Pagination.js +1 -1
- package/es/components/PaginationNav/PaginationNav.d.ts +1 -1
- package/es/components/PaginationNav/PaginationNav.js +10 -5
- package/es/components/Tabs/Tabs.js +46 -29
- package/es/components/TextArea/TextArea.d.ts +5 -0
- package/es/components/TextArea/TextArea.js +15 -7
- package/es/components/TextInput/TextInput.d.ts +5 -0
- package/es/components/TextInput/TextInput.js +15 -7
- package/es/components/UIShell/SideNavMenuItem.d.ts +5 -1
- package/es/components/UIShell/SideNavMenuItem.js +7 -2
- package/lib/components/AILabel/index.js +15 -15
- package/lib/components/CodeSnippet/CodeSnippet.d.ts +5 -2
- package/lib/components/CodeSnippet/CodeSnippet.js +40 -1
- package/lib/components/ComboBox/ComboBox.js +19 -22
- package/lib/components/ComboButton/index.js +40 -1
- package/lib/components/ContentSwitcher/ContentSwitcher.d.ts +2 -2
- package/lib/components/ContentSwitcher/ContentSwitcher.js +1 -1
- package/lib/components/Copy/Copy.d.ts +5 -2
- package/lib/components/Copy/Copy.js +40 -1
- package/lib/components/CopyButton/CopyButton.d.ts +5 -2
- package/lib/components/CopyButton/CopyButton.js +40 -1
- package/lib/components/DataTable/TableSelectRow.js +14 -6
- package/lib/components/DataTable/TableToolbarSearch.js +1 -1
- package/lib/components/DataTable/stories/examples/TableToolbarFilter.d.ts +1 -1
- package/lib/components/DatePicker/plugins/fixEventsPlugin.js +2 -2
- package/lib/components/DatePickerInput/DatePickerInput.d.ts +6 -1
- package/lib/components/DatePickerInput/DatePickerInput.js +16 -10
- package/lib/components/Dropdown/Dropdown.d.ts +5 -0
- package/lib/components/Dropdown/Dropdown.js +131 -91
- package/lib/components/FeatureFlags/index.js +1 -2
- package/lib/components/IconButton/index.d.ts +4 -1
- package/lib/components/IconButton/index.js +40 -1
- package/lib/components/InlineCheckbox/InlineCheckbox.d.ts +50 -0
- package/lib/components/InlineCheckbox/InlineCheckbox.js +3 -6
- package/lib/components/InlineCheckbox/index.d.ts +9 -0
- package/lib/components/LayoutDirection/LayoutDirection.d.ts +44 -0
- package/lib/components/LayoutDirection/LayoutDirectionContext.d.ts +10 -0
- package/lib/components/LayoutDirection/useLayoutDirection.d.ts +12 -0
- package/lib/components/Menu/MenuItem.js +0 -3
- package/lib/components/MultiSelect/FilterableMultiSelect.d.ts +1 -1
- package/lib/components/MultiSelect/FilterableMultiSelect.js +1 -2
- package/lib/components/MultiSelect/MultiSelect.js +1 -1
- package/lib/components/Notification/Notification.d.ts +9 -2
- package/lib/components/Notification/Notification.js +16 -2
- package/lib/components/NumberInput/NumberInput.d.ts +5 -0
- package/lib/components/NumberInput/NumberInput.js +17 -9
- package/lib/components/OverflowMenu/next/index.js +40 -1
- package/lib/components/Pagination/Pagination.js +1 -1
- package/lib/components/PaginationNav/PaginationNav.d.ts +1 -1
- package/lib/components/PaginationNav/PaginationNav.js +10 -5
- package/lib/components/Tabs/Tabs.js +46 -29
- package/lib/components/TextArea/TextArea.d.ts +5 -0
- package/lib/components/TextArea/TextArea.js +15 -7
- package/lib/components/TextInput/TextInput.d.ts +5 -0
- package/lib/components/TextInput/TextInput.js +15 -7
- package/lib/components/UIShell/SideNavMenuItem.d.ts +5 -1
- package/lib/components/UIShell/SideNavMenuItem.js +7 -2
- package/package.json +4 -4
|
@@ -41,8 +41,8 @@ const AILabelContent = /*#__PURE__*/React__default["default"].forwardRef(functio
|
|
|
41
41
|
item.type?.displayName === 'AILabelActions';
|
|
42
42
|
});
|
|
43
43
|
const aiLabelContentClasses = cx__default["default"](className, {
|
|
44
|
-
[`${prefix}--
|
|
45
|
-
[`${prefix}--
|
|
44
|
+
[`${prefix}--ai-label-content`]: true,
|
|
45
|
+
[`${prefix}--ai-label-content--with-actions`]: hasAILabelActions
|
|
46
46
|
});
|
|
47
47
|
return /*#__PURE__*/React__default["default"].createElement(index.ToggletipContent, {
|
|
48
48
|
className: aiLabelContentClasses
|
|
@@ -51,11 +51,11 @@ const AILabelContent = /*#__PURE__*/React__default["default"].forwardRef(functio
|
|
|
51
51
|
AILabelContent.displayName = 'AILabelContent';
|
|
52
52
|
AILabelContent.propTypes = {
|
|
53
53
|
/**
|
|
54
|
-
* Specify the content you want rendered inside the
|
|
54
|
+
* Specify the content you want rendered inside the AILabel ToggleTip
|
|
55
55
|
*/
|
|
56
56
|
children: PropTypes__default["default"].node,
|
|
57
57
|
/**
|
|
58
|
-
* Specify an optional className to be added to the
|
|
58
|
+
* Specify an optional className to be added to the AILabel callout
|
|
59
59
|
*/
|
|
60
60
|
className: PropTypes__default["default"].string
|
|
61
61
|
};
|
|
@@ -67,7 +67,7 @@ const AILabelActions = /*#__PURE__*/React__default["default"].forwardRef(functio
|
|
|
67
67
|
} = _ref2;
|
|
68
68
|
const prefix = usePrefix.usePrefix();
|
|
69
69
|
const aiLabelActionsClasses = cx__default["default"](className, {
|
|
70
|
-
[`${prefix}--
|
|
70
|
+
[`${prefix}--ai-label-actions`]: true
|
|
71
71
|
});
|
|
72
72
|
return /*#__PURE__*/React__default["default"].createElement(index.ToggletipActions, {
|
|
73
73
|
className: aiLabelActionsClasses
|
|
@@ -76,11 +76,11 @@ const AILabelActions = /*#__PURE__*/React__default["default"].forwardRef(functio
|
|
|
76
76
|
AILabelActions.displayName = 'AILabelActions';
|
|
77
77
|
AILabelActions.propTypes = {
|
|
78
78
|
/**
|
|
79
|
-
* Specify the content you want rendered inside the
|
|
79
|
+
* Specify the content you want rendered inside the AILabel callout toolbar
|
|
80
80
|
*/
|
|
81
81
|
children: PropTypes__default["default"].node,
|
|
82
82
|
/**
|
|
83
|
-
* Specify an optional className to be added to the
|
|
83
|
+
* Specify an optional className to be added to the AILabel toolbar
|
|
84
84
|
*/
|
|
85
85
|
className: PropTypes__default["default"].string
|
|
86
86
|
};
|
|
@@ -114,14 +114,14 @@ const AILabel = /*#__PURE__*/React__default["default"].forwardRef(function AILab
|
|
|
114
114
|
const prefix = usePrefix.usePrefix();
|
|
115
115
|
const id = useId.useId('AILabel');
|
|
116
116
|
const aiLabelClasses = cx__default["default"](className, {
|
|
117
|
-
[`${prefix}--
|
|
118
|
-
[`${prefix}--
|
|
117
|
+
[`${prefix}--ai-label`]: true,
|
|
118
|
+
[`${prefix}--ai-label--revert`]: revertActive
|
|
119
119
|
});
|
|
120
120
|
const aiLabelButtonClasses = cx__default["default"]({
|
|
121
|
-
[`${prefix}--
|
|
122
|
-
[`${prefix}--
|
|
123
|
-
[`${prefix}--
|
|
124
|
-
[`${prefix}--
|
|
121
|
+
[`${prefix}--ai-label__button`]: true,
|
|
122
|
+
[`${prefix}--ai-label__button--${size}`]: size,
|
|
123
|
+
[`${prefix}--ai-label__button--${kind}`]: kind,
|
|
124
|
+
[`${prefix}--ai-label__button--inline-with-content`]: kind === 'inline' && (aiTextLabel || textLabel)
|
|
125
125
|
});
|
|
126
126
|
const handleOnRevertClick = evt => {
|
|
127
127
|
if (onRevertClick) {
|
|
@@ -145,9 +145,9 @@ const AILabel = /*#__PURE__*/React__default["default"].forwardRef(function AILab
|
|
|
145
145
|
className: aiLabelButtonClasses,
|
|
146
146
|
label: ariaLabelText
|
|
147
147
|
}, /*#__PURE__*/React__default["default"].createElement("span", {
|
|
148
|
-
className: `${prefix}--
|
|
148
|
+
className: `${prefix}--ai-label__text`
|
|
149
149
|
}, aiText), kind === 'inline' && (aiTextLabel || textLabel) && /*#__PURE__*/React__default["default"].createElement("span", {
|
|
150
|
-
className: `${prefix}--
|
|
150
|
+
className: `${prefix}--ai-label__additional-text`
|
|
151
151
|
}, aiTextLabel || textLabel)), children));
|
|
152
152
|
});
|
|
153
153
|
AILabel.displayName = 'AILabel';
|
|
@@ -6,11 +6,14 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
8
|
import { PropsWithChildren } from 'react';
|
|
9
|
+
export type DeprecatedCodeSnippetAlignment = 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right' | 'left-bottom' | 'left-top' | 'right-bottom' | 'right-top';
|
|
10
|
+
export type NewCodeSnippetAlignmnet = 'top' | 'bottom' | 'left' | 'right' | 'top-start' | 'top-end' | 'bottom-start' | 'bottom-end' | 'left-end' | 'left-start' | 'right-end' | 'right-start';
|
|
11
|
+
export type CodeSnippetAlignment = DeprecatedCodeSnippetAlignment | NewCodeSnippetAlignmnet;
|
|
9
12
|
export interface CodeSnippetProps {
|
|
10
13
|
/**
|
|
11
14
|
* Specify how the trigger should align with the tooltip
|
|
12
15
|
*/
|
|
13
|
-
align?:
|
|
16
|
+
align?: CodeSnippetAlignment;
|
|
14
17
|
/**
|
|
15
18
|
* **Experimental**: Will attempt to automatically align the tooltip
|
|
16
19
|
*/
|
|
@@ -106,7 +109,7 @@ declare namespace CodeSnippet {
|
|
|
106
109
|
/**
|
|
107
110
|
* Specify how the trigger should align with the tooltip
|
|
108
111
|
*/
|
|
109
|
-
align:
|
|
112
|
+
align: (props: any, propName: any, componentName: any, ...rest: any[]) => any;
|
|
110
113
|
/**
|
|
111
114
|
* Specify a label to be read by screen readers on the containing textbox
|
|
112
115
|
* node
|
|
@@ -23,6 +23,7 @@ var uniqueId = require('../../tools/uniqueId.js');
|
|
|
23
23
|
var copy = require('copy-to-clipboard');
|
|
24
24
|
var deprecate = require('../../prop-types/deprecate.js');
|
|
25
25
|
var usePrefix = require('../../internal/usePrefix.js');
|
|
26
|
+
var deprecateValuesWithin = require('../../prop-types/deprecateValuesWithin.js');
|
|
26
27
|
|
|
27
28
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
28
29
|
|
|
@@ -37,6 +38,19 @@ const defaultMaxCollapsedNumberOfRows = 15;
|
|
|
37
38
|
const defaultMaxExpandedNumberOfRows = 0;
|
|
38
39
|
const defaultMinCollapsedNumberOfRows = 3;
|
|
39
40
|
const defaultMinExpandedNumberOfRows = 16;
|
|
41
|
+
const propMappingFunction = deprecatedValue => {
|
|
42
|
+
const mapping = {
|
|
43
|
+
'top-left': 'top-start',
|
|
44
|
+
'top-right': 'top-end',
|
|
45
|
+
'bottom-left': 'bottom-start',
|
|
46
|
+
'bottom-right': 'bottom-end',
|
|
47
|
+
'left-bottom': 'left-end',
|
|
48
|
+
'left-top': 'left-start',
|
|
49
|
+
'right-bottom': 'right-end',
|
|
50
|
+
'right-top': 'right-start'
|
|
51
|
+
};
|
|
52
|
+
return mapping[deprecatedValue];
|
|
53
|
+
};
|
|
40
54
|
function CodeSnippet(_ref) {
|
|
41
55
|
let {
|
|
42
56
|
align = 'bottom',
|
|
@@ -244,7 +258,32 @@ CodeSnippet.propTypes = {
|
|
|
244
258
|
/**
|
|
245
259
|
* Specify how the trigger should align with the tooltip
|
|
246
260
|
*/
|
|
247
|
-
align: PropTypes__default["default"].oneOf(['top', 'top-left',
|
|
261
|
+
align: deprecateValuesWithin["default"](PropTypes__default["default"].oneOf(['top', 'top-left',
|
|
262
|
+
// deprecated use top-start instead
|
|
263
|
+
'top-right',
|
|
264
|
+
// deprecated use top-end instead
|
|
265
|
+
|
|
266
|
+
'bottom', 'bottom-left',
|
|
267
|
+
// deprecated use bottom-start instead
|
|
268
|
+
'bottom-right',
|
|
269
|
+
// deprecated use bottom-end instead
|
|
270
|
+
|
|
271
|
+
'left', 'left-bottom',
|
|
272
|
+
// deprecated use left-end instead
|
|
273
|
+
'left-top',
|
|
274
|
+
// deprecated use left-start instead
|
|
275
|
+
|
|
276
|
+
'right', 'right-bottom',
|
|
277
|
+
// deprecated use right-end instead
|
|
278
|
+
'right-top',
|
|
279
|
+
// deprecated use right-start instead
|
|
280
|
+
|
|
281
|
+
// new values to match floating-ui
|
|
282
|
+
'top-start', 'top-end', 'bottom-start', 'bottom-end', 'left-end', 'left-start', 'right-end', 'right-start']),
|
|
283
|
+
//allowed prop values
|
|
284
|
+
['top', 'top-start', 'top-end', 'bottom', 'bottom-start', 'bottom-end', 'left', 'left-start', 'left-end', 'right', 'right-start', 'right-end'],
|
|
285
|
+
//optional mapper function
|
|
286
|
+
propMappingFunction),
|
|
248
287
|
/**
|
|
249
288
|
* Specify a label to be read by screen readers on the containing textbox
|
|
250
289
|
* node
|
|
@@ -237,7 +237,6 @@ const ComboBox = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
237
237
|
selectedItem: selectedItemProp,
|
|
238
238
|
prevSelectedItem: prevSelectedItemProp.current
|
|
239
239
|
});
|
|
240
|
-
|
|
241
240
|
// selectedItem has been updated externally, need to update state and call onChange
|
|
242
241
|
if (inputValue !== currentInputValue) {
|
|
243
242
|
setInputValue(currentInputValue);
|
|
@@ -446,30 +445,12 @@ const ComboBox = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
446
445
|
} = _ref4;
|
|
447
446
|
const normalizedInput = inputValue || '';
|
|
448
447
|
setInputValue(normalizedInput);
|
|
449
|
-
if (selectedItemProp && !inputValue) {
|
|
450
|
-
// ensure onChange is called when selectedItem is cleared
|
|
451
|
-
onChange({
|
|
452
|
-
selectedItem,
|
|
453
|
-
inputValue: normalizedInput
|
|
454
|
-
});
|
|
455
|
-
}
|
|
456
448
|
setHighlightedIndex(indexToHighlight(normalizedInput));
|
|
457
449
|
},
|
|
458
|
-
|
|
459
|
-
let {
|
|
460
|
-
selectedItem
|
|
461
|
-
} = _ref5;
|
|
462
|
-
// only call onChange if new selection is updated from previous
|
|
463
|
-
if (!isEqual__default["default"](selectedItem, selectedItemProp)) {
|
|
464
|
-
onChange({
|
|
465
|
-
selectedItem
|
|
466
|
-
});
|
|
467
|
-
}
|
|
468
|
-
},
|
|
469
|
-
onHighlightedIndexChange: _ref6 => {
|
|
450
|
+
onHighlightedIndexChange: _ref5 => {
|
|
470
451
|
let {
|
|
471
452
|
highlightedIndex
|
|
472
|
-
} =
|
|
453
|
+
} = _ref5;
|
|
473
454
|
if (highlightedIndex > -1 && typeof window !== undefined) {
|
|
474
455
|
const itemArray = document.querySelectorAll(`li.${prefix}--list-box__menu-item[role="option"]`);
|
|
475
456
|
const highlightedItem = itemArray[highlightedIndex];
|
|
@@ -481,11 +462,27 @@ const ComboBox = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
481
462
|
}
|
|
482
463
|
}
|
|
483
464
|
},
|
|
465
|
+
onStateChange: _ref6 => {
|
|
466
|
+
let {
|
|
467
|
+
type,
|
|
468
|
+
selectedItem: newSelectedItem
|
|
469
|
+
} = _ref6;
|
|
470
|
+
if (type === '__item_click__' && !isEqual__default["default"](selectedItemProp, newSelectedItem)) {
|
|
471
|
+
onChange({
|
|
472
|
+
selectedItem: newSelectedItem
|
|
473
|
+
});
|
|
474
|
+
}
|
|
475
|
+
if (type === '__function_select_item__' || type === '__input_keydown_enter__') {
|
|
476
|
+
onChange({
|
|
477
|
+
selectedItem: newSelectedItem
|
|
478
|
+
});
|
|
479
|
+
}
|
|
480
|
+
},
|
|
484
481
|
initialSelectedItem: initialSelectedItem,
|
|
485
482
|
inputId: id,
|
|
486
483
|
stateReducer,
|
|
487
484
|
isItemDisabled(item, _index) {
|
|
488
|
-
return item
|
|
485
|
+
return item?.disabled;
|
|
489
486
|
},
|
|
490
487
|
...downshiftProps
|
|
491
488
|
});
|
|
@@ -26,6 +26,7 @@ var react = require('@floating-ui/react');
|
|
|
26
26
|
var floatingUi_dom = require('../../node_modules/@floating-ui/dom/dist/floating-ui.dom.mjs.js');
|
|
27
27
|
var index = require('../FeatureFlags/index.js');
|
|
28
28
|
var mergeRefs = require('../../tools/mergeRefs.js');
|
|
29
|
+
var deprecateValuesWithin = require('../../prop-types/deprecateValuesWithin.js');
|
|
29
30
|
|
|
30
31
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
31
32
|
|
|
@@ -42,6 +43,19 @@ const defaultTranslations = {
|
|
|
42
43
|
* Message ids that will be passed to translateWithId().
|
|
43
44
|
*/
|
|
44
45
|
|
|
46
|
+
const propMappingFunction = deprecatedValue => {
|
|
47
|
+
const mapping = {
|
|
48
|
+
'top-left': 'top-start',
|
|
49
|
+
'top-right': 'top-end',
|
|
50
|
+
'bottom-left': 'bottom-start',
|
|
51
|
+
'bottom-right': 'bottom-end',
|
|
52
|
+
'left-bottom': 'left-end',
|
|
53
|
+
'left-top': 'left-start',
|
|
54
|
+
'right-bottom': 'right-end',
|
|
55
|
+
'right-top': 'right-start'
|
|
56
|
+
};
|
|
57
|
+
return mapping[deprecatedValue];
|
|
58
|
+
};
|
|
45
59
|
function defaultTranslateWithId(messageId) {
|
|
46
60
|
return defaultTranslations[messageId];
|
|
47
61
|
}
|
|
@@ -201,7 +215,32 @@ ComboButton.propTypes = {
|
|
|
201
215
|
/**
|
|
202
216
|
* Specify how the trigger tooltip should be aligned.
|
|
203
217
|
*/
|
|
204
|
-
tooltipAlignment: PropTypes__default["default"].oneOf(['top', 'top-left',
|
|
218
|
+
tooltipAlignment: deprecateValuesWithin["default"](PropTypes__default["default"].oneOf(['top', 'top-left',
|
|
219
|
+
// deprecated use top-start instead
|
|
220
|
+
'top-right',
|
|
221
|
+
// deprecated use top-end instead
|
|
222
|
+
|
|
223
|
+
'bottom', 'bottom-left',
|
|
224
|
+
// deprecated use bottom-start instead
|
|
225
|
+
'bottom-right',
|
|
226
|
+
// deprecated use bottom-end instead
|
|
227
|
+
|
|
228
|
+
'left', 'left-bottom',
|
|
229
|
+
// deprecated use left-end instead
|
|
230
|
+
'left-top',
|
|
231
|
+
// deprecated use left-start instead
|
|
232
|
+
|
|
233
|
+
'right', 'right-bottom',
|
|
234
|
+
// deprecated use right-end instead
|
|
235
|
+
'right-top',
|
|
236
|
+
// deprecated use right-start instead
|
|
237
|
+
|
|
238
|
+
// new values to match floating-ui
|
|
239
|
+
'top-start', 'top-end', 'bottom-start', 'bottom-end', 'left-end', 'left-start', 'right-end', 'right-start']),
|
|
240
|
+
//allowed prop values
|
|
241
|
+
['top', 'top-start', 'top-end', 'bottom', 'bottom-start', 'bottom-end', 'left', 'left-start', 'left-end', 'right', 'right-start', 'right-end'],
|
|
242
|
+
//optional mapper function
|
|
243
|
+
propMappingFunction),
|
|
205
244
|
/**
|
|
206
245
|
* Optional method that takes in a message id and returns an
|
|
207
246
|
* internationalized string.
|
|
@@ -38,7 +38,7 @@ export interface ContentSwitcherProps extends Omit<HTMLAttributes<HTMLElement>,
|
|
|
38
38
|
*/
|
|
39
39
|
selectedIndex: number;
|
|
40
40
|
/**
|
|
41
|
-
* Choose whether or not to automatically change selection on focus
|
|
41
|
+
* Choose whether or not to automatically change selection on focus when left/right arrow pressed. Defaults to 'automatic'
|
|
42
42
|
*/
|
|
43
43
|
selectionMode?: 'automatic' | 'manual';
|
|
44
44
|
/**
|
|
@@ -82,7 +82,7 @@ export default class ContentSwitcher extends React.Component<ContentSwitcherProp
|
|
|
82
82
|
*/
|
|
83
83
|
selectedIndex: PropTypes.Requireable<number>;
|
|
84
84
|
/**
|
|
85
|
-
* Choose whether or not to automatically change selection on focus
|
|
85
|
+
* Choose whether or not to automatically change selection on focus when left/right arrow pressed. Defaults to 'automatic'
|
|
86
86
|
*/
|
|
87
87
|
selectionMode: PropTypes.Requireable<string>;
|
|
88
88
|
/**
|
|
@@ -173,7 +173,7 @@ _rollupPluginBabelHelpers.defineProperty(ContentSwitcher, "propTypes", {
|
|
|
173
173
|
*/
|
|
174
174
|
selectedIndex: PropTypes__default["default"].number,
|
|
175
175
|
/**
|
|
176
|
-
* Choose whether or not to automatically change selection on focus
|
|
176
|
+
* Choose whether or not to automatically change selection on focus when left/right arrow pressed. Defaults to 'automatic'
|
|
177
177
|
*/
|
|
178
178
|
selectionMode: PropTypes__default["default"].oneOf(['automatic', 'manual']),
|
|
179
179
|
/**
|
|
@@ -6,11 +6,14 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
8
|
import React, { AnimationEventHandler, MouseEventHandler, PropsWithChildren } from 'react';
|
|
9
|
+
export type DeprecatedCopyAlignment = 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right' | 'left-bottom' | 'left-top' | 'right-bottom' | 'right-top';
|
|
10
|
+
export type NewCopyAlignment = 'top' | 'bottom' | 'left' | 'right' | 'top-start' | 'top-end' | 'bottom-start' | 'bottom-end' | 'left-end' | 'left-start' | 'right-end' | 'right-start';
|
|
11
|
+
export type CopyAlignment = DeprecatedCopyAlignment | NewCopyAlignment;
|
|
9
12
|
interface CopyProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
10
13
|
/**
|
|
11
14
|
* Specify how the trigger should align with the tooltip
|
|
12
15
|
*/
|
|
13
|
-
align?:
|
|
16
|
+
align?: CopyAlignment;
|
|
14
17
|
/**
|
|
15
18
|
* **Experimental**: Will attempt to automatically align the tooltip
|
|
16
19
|
*/
|
|
@@ -45,7 +48,7 @@ declare namespace Copy {
|
|
|
45
48
|
/**
|
|
46
49
|
* Specify how the trigger should align with the tooltip
|
|
47
50
|
*/
|
|
48
|
-
align:
|
|
51
|
+
align: (props: any, propName: any, componentName: any, ...rest: any[]) => any;
|
|
49
52
|
/**
|
|
50
53
|
* **Experimental**: Will attempt to automatically align the tooltip
|
|
51
54
|
*/
|
|
@@ -18,6 +18,7 @@ var events = require('../../tools/events.js');
|
|
|
18
18
|
var usePrefix = require('../../internal/usePrefix.js');
|
|
19
19
|
var index = require('../IconButton/index.js');
|
|
20
20
|
var noopFn = require('../../internal/noopFn.js');
|
|
21
|
+
var deprecateValuesWithin = require('../../prop-types/deprecateValuesWithin.js');
|
|
21
22
|
|
|
22
23
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
23
24
|
|
|
@@ -26,6 +27,19 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
|
26
27
|
var debounce__default = /*#__PURE__*/_interopDefaultLegacy(debounce);
|
|
27
28
|
var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
|
|
28
29
|
|
|
30
|
+
const propMappingFunction = deprecatedValue => {
|
|
31
|
+
const mapping = {
|
|
32
|
+
'top-left': 'top-start',
|
|
33
|
+
'top-right': 'top-end',
|
|
34
|
+
'bottom-left': 'bottom-start',
|
|
35
|
+
'bottom-right': 'bottom-end',
|
|
36
|
+
'left-bottom': 'left-end',
|
|
37
|
+
'left-top': 'left-start',
|
|
38
|
+
'right-bottom': 'right-end',
|
|
39
|
+
'right-top': 'right-start'
|
|
40
|
+
};
|
|
41
|
+
return mapping[deprecatedValue];
|
|
42
|
+
};
|
|
29
43
|
function Copy(_ref) {
|
|
30
44
|
let {
|
|
31
45
|
align = 'bottom',
|
|
@@ -77,7 +91,32 @@ Copy.propTypes = {
|
|
|
77
91
|
/**
|
|
78
92
|
* Specify how the trigger should align with the tooltip
|
|
79
93
|
*/
|
|
80
|
-
align: PropTypes__default["default"].oneOf(['top', 'top-left',
|
|
94
|
+
align: deprecateValuesWithin["default"](PropTypes__default["default"].oneOf(['top', 'top-left',
|
|
95
|
+
// deprecated use top-start instead
|
|
96
|
+
'top-right',
|
|
97
|
+
// deprecated use top-end instead
|
|
98
|
+
|
|
99
|
+
'bottom', 'bottom-left',
|
|
100
|
+
// deprecated use bottom-start instead
|
|
101
|
+
'bottom-right',
|
|
102
|
+
// deprecated use bottom-end instead
|
|
103
|
+
|
|
104
|
+
'left', 'left-bottom',
|
|
105
|
+
// deprecated use left-end instead
|
|
106
|
+
'left-top',
|
|
107
|
+
// deprecated use left-start instead
|
|
108
|
+
|
|
109
|
+
'right', 'right-bottom',
|
|
110
|
+
// deprecated use right-end instead
|
|
111
|
+
'right-top',
|
|
112
|
+
// deprecated use right-start instead
|
|
113
|
+
|
|
114
|
+
// new values to match floating-ui
|
|
115
|
+
'top-start', 'top-end', 'bottom-start', 'bottom-end', 'left-end', 'left-start', 'right-end', 'right-start']),
|
|
116
|
+
//allowed prop values
|
|
117
|
+
['top', 'top-start', 'top-end', 'bottom', 'bottom-start', 'bottom-end', 'left', 'left-start', 'left-end', 'right', 'right-start', 'right-end'],
|
|
118
|
+
//optional mapper function
|
|
119
|
+
propMappingFunction),
|
|
81
120
|
/**
|
|
82
121
|
* **Experimental**: Will attempt to automatically align the tooltip
|
|
83
122
|
*/
|
|
@@ -7,11 +7,14 @@
|
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
8
|
import { MouseEventHandler } from 'react';
|
|
9
9
|
import { ButtonProps } from '../Button';
|
|
10
|
+
export type DeprecatedCopyButtonAlignment = 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right' | 'left-bottom' | 'left-top' | 'right-bottom' | 'right-top';
|
|
11
|
+
export type NewCopyButtonAlignment = 'top' | 'bottom' | 'left' | 'right' | 'top-start' | 'top-end' | 'bottom-start' | 'bottom-end' | 'left-end' | 'left-start' | 'right-end' | 'right-start';
|
|
12
|
+
export type CopyButtonAlignment = DeprecatedCopyButtonAlignment | NewCopyButtonAlignment;
|
|
10
13
|
export interface CopyButtonProps extends ButtonProps<'button'> {
|
|
11
14
|
/**
|
|
12
15
|
* Specify how the trigger should align with the tooltip
|
|
13
16
|
*/
|
|
14
|
-
align?:
|
|
17
|
+
align?: CopyButtonAlignment;
|
|
15
18
|
/**
|
|
16
19
|
* **Experimental**: Will attempt to automatically align the tooltip
|
|
17
20
|
*/
|
|
@@ -46,7 +49,7 @@ declare namespace CopyButton {
|
|
|
46
49
|
/**
|
|
47
50
|
* Specify how the trigger should align with the tooltip
|
|
48
51
|
*/
|
|
49
|
-
align:
|
|
52
|
+
align: (props: any, propName: any, componentName: any, ...rest: any[]) => any;
|
|
50
53
|
/**
|
|
51
54
|
* **Experimental**: Will attempt to automatically align the tooltip
|
|
52
55
|
*/
|
|
@@ -18,6 +18,7 @@ var Copy = require('../Copy/Copy.js');
|
|
|
18
18
|
var index = require('../Layout/index.js');
|
|
19
19
|
var usePrefix = require('../../internal/usePrefix.js');
|
|
20
20
|
var noopFn = require('../../internal/noopFn.js');
|
|
21
|
+
var deprecateValuesWithin = require('../../prop-types/deprecateValuesWithin.js');
|
|
21
22
|
|
|
22
23
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
23
24
|
|
|
@@ -25,6 +26,19 @@ var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
|
|
|
25
26
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
26
27
|
var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
|
|
27
28
|
|
|
29
|
+
const propMappingFunction = deprecatedValue => {
|
|
30
|
+
const mapping = {
|
|
31
|
+
'top-left': 'top-start',
|
|
32
|
+
'top-right': 'top-end',
|
|
33
|
+
'bottom-left': 'bottom-start',
|
|
34
|
+
'bottom-right': 'bottom-end',
|
|
35
|
+
'left-bottom': 'left-end',
|
|
36
|
+
'left-top': 'left-start',
|
|
37
|
+
'right-bottom': 'right-end',
|
|
38
|
+
'right-top': 'right-start'
|
|
39
|
+
};
|
|
40
|
+
return mapping[deprecatedValue];
|
|
41
|
+
};
|
|
28
42
|
function CopyButton(_ref) {
|
|
29
43
|
let {
|
|
30
44
|
align = 'bottom',
|
|
@@ -58,7 +72,32 @@ CopyButton.propTypes = {
|
|
|
58
72
|
/**
|
|
59
73
|
* Specify how the trigger should align with the tooltip
|
|
60
74
|
*/
|
|
61
|
-
align: PropTypes__default["default"].oneOf(['top', 'top-left',
|
|
75
|
+
align: deprecateValuesWithin["default"](PropTypes__default["default"].oneOf(['top', 'top-left',
|
|
76
|
+
// deprecated use top-start instead
|
|
77
|
+
'top-right',
|
|
78
|
+
// deprecated use top-end instead
|
|
79
|
+
|
|
80
|
+
'bottom', 'bottom-left',
|
|
81
|
+
// deprecated use bottom-start instead
|
|
82
|
+
'bottom-right',
|
|
83
|
+
// deprecated use bottom-end instead
|
|
84
|
+
|
|
85
|
+
'left', 'left-bottom',
|
|
86
|
+
// deprecated use left-end instead
|
|
87
|
+
'left-top',
|
|
88
|
+
// deprecated use left-start instead
|
|
89
|
+
|
|
90
|
+
'right', 'right-bottom',
|
|
91
|
+
// deprecated use right-end instead
|
|
92
|
+
'right-top',
|
|
93
|
+
// deprecated use right-start instead
|
|
94
|
+
|
|
95
|
+
// new values to match floating-ui
|
|
96
|
+
'top-start', 'top-end', 'bottom-start', 'bottom-end', 'left-end', 'left-start', 'right-end', 'right-start']),
|
|
97
|
+
//allowed prop values
|
|
98
|
+
['top', 'top-start', 'top-end', 'bottom', 'bottom-start', 'bottom-end', 'left', 'left-start', 'left-end', 'right', 'right-start', 'right-end'],
|
|
99
|
+
//optional mapper function
|
|
100
|
+
propMappingFunction),
|
|
62
101
|
/**
|
|
63
102
|
* **Experimental**: Will attempt to automatically align the tooltip
|
|
64
103
|
*/
|
|
@@ -40,15 +40,21 @@ const TableSelectRow = _ref => {
|
|
|
40
40
|
} = _ref;
|
|
41
41
|
const prefix = usePrefix.usePrefix();
|
|
42
42
|
const uniqueNameId = useId.useId();
|
|
43
|
+
const handleRadioChange = onChange ? (value, name, event) => {
|
|
44
|
+
// Convert the radio value to boolean for consistency
|
|
45
|
+
onChange(!!value, name || '', event);
|
|
46
|
+
} : undefined;
|
|
47
|
+
const handleCheckboxChange = onChange ? (checked, name, event) => {
|
|
48
|
+
onChange(checked, name, event);
|
|
49
|
+
} : undefined;
|
|
43
50
|
const selectionInputProps = {
|
|
44
51
|
id,
|
|
45
52
|
name: name ? name : uniqueNameId,
|
|
46
53
|
onClick: onSelect,
|
|
47
|
-
onChange,
|
|
48
54
|
checked,
|
|
49
55
|
disabled
|
|
50
56
|
};
|
|
51
|
-
const
|
|
57
|
+
const labelValue = ariaLabel || deprecatedAriaLabel || '';
|
|
52
58
|
const tableSelectRowClasses = cx__default["default"](`${prefix}--table-column-checkbox`, {
|
|
53
59
|
...(className && {
|
|
54
60
|
[className]: true
|
|
@@ -58,11 +64,13 @@ const TableSelectRow = _ref => {
|
|
|
58
64
|
return /*#__PURE__*/React__default["default"].createElement("td", {
|
|
59
65
|
className: tableSelectRowClasses,
|
|
60
66
|
"aria-live": "off"
|
|
61
|
-
}, /*#__PURE__*/React__default["default"].createElement(
|
|
62
|
-
labelText:
|
|
67
|
+
}, radio ? /*#__PURE__*/React__default["default"].createElement(RadioButton["default"], _rollupPluginBabelHelpers["extends"]({}, selectionInputProps, {
|
|
68
|
+
labelText: labelValue,
|
|
69
|
+
onChange: handleRadioChange,
|
|
63
70
|
hideLabel: true
|
|
64
|
-
},
|
|
65
|
-
|
|
71
|
+
})) : /*#__PURE__*/React__default["default"].createElement(InlineCheckbox["default"], _rollupPluginBabelHelpers["extends"]({}, selectionInputProps, {
|
|
72
|
+
"aria-label": labelValue,
|
|
73
|
+
onChange: handleCheckboxChange
|
|
66
74
|
})));
|
|
67
75
|
};
|
|
68
76
|
TableSelectRow.propTypes = {
|
|
@@ -13,7 +13,7 @@ interface TableToolbarFilterProps {
|
|
|
13
13
|
/**
|
|
14
14
|
* Provide an optional hook that is called each time the input is updated
|
|
15
15
|
*/
|
|
16
|
-
onChange?: (event: '' | ChangeEvent<HTMLInputElement
|
|
16
|
+
onChange?: (event: '' | ChangeEvent<HTMLInputElement>) => void;
|
|
17
17
|
/**
|
|
18
18
|
* Provide an function that is called when the apply button is clicked
|
|
19
19
|
*/
|
|
@@ -80,7 +80,7 @@ var carbonFlatpickrFixEventsPlugin = config => fp => {
|
|
|
80
80
|
if (inputTo === target && fp.selectedDates[1]) {
|
|
81
81
|
// Using getTime() enables the ability to more readily compare the date currently
|
|
82
82
|
// selected in the calendar and the date currently in the value of the input
|
|
83
|
-
const withoutTime = date => date
|
|
83
|
+
const withoutTime = date => date?.setHours(0, 0, 0, 0);
|
|
84
84
|
const selectedToDate = withoutTime(new Date(fp.selectedDates[1]));
|
|
85
85
|
const currentValueToDate = withoutTime(parseDateWithFormat(inputTo.value));
|
|
86
86
|
|
|
@@ -92,7 +92,7 @@ var carbonFlatpickrFixEventsPlugin = config => fp => {
|
|
|
92
92
|
fp.setDate([inputFrom.value, inputTo && inputTo.value], true, fp.config.dateFormat);
|
|
93
93
|
}
|
|
94
94
|
}
|
|
95
|
-
const isValidDate = date => date
|
|
95
|
+
const isValidDate = date => date?.toString() !== 'Invalid Date';
|
|
96
96
|
// save end date in calendar inmediately after it's been written down
|
|
97
97
|
if (inputTo === target && fp.selectedDates.length === 1 && inputTo.value) {
|
|
98
98
|
if (isValidDate(parseDateWithFormat(inputTo.value))) {
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
import { ReactElementLike, ReactNodeArray } from 'prop-types';
|
|
8
|
-
import React from 'react';
|
|
8
|
+
import React, { ReactNode } from 'react';
|
|
9
9
|
import { ReactAttr } from '../../types/common';
|
|
10
10
|
type ExcludedAttributes = 'value' | 'onChange' | 'locale' | 'children';
|
|
11
11
|
export type ReactNodeLike = ReactElementLike | ReactNodeArray | string | number | boolean | null | undefined;
|
|
@@ -19,6 +19,10 @@ export interface DatePickerInputProps extends Omit<ReactAttr<HTMLInputElement>,
|
|
|
19
19
|
* * `range` - With calendar dropdown and a date range.
|
|
20
20
|
*/
|
|
21
21
|
datePickerType?: 'simple' | 'single' | 'range';
|
|
22
|
+
/**
|
|
23
|
+
* **Experimental**: Provide a `decorator` component to be rendered inside the `DatePickerInput` component
|
|
24
|
+
*/
|
|
25
|
+
decorator?: ReactNode;
|
|
22
26
|
/**
|
|
23
27
|
* Specify whether or not the input should be disabled
|
|
24
28
|
*/
|
|
@@ -77,6 +81,7 @@ export interface DatePickerInputProps extends Omit<ReactAttr<HTMLInputElement>,
|
|
|
77
81
|
*/
|
|
78
82
|
size?: 'sm' | 'md' | 'lg';
|
|
79
83
|
/**
|
|
84
|
+
* @deprecated please use decorator instead.
|
|
80
85
|
* **Experimental**: Provide a `Slug` component to be rendered inside the `DatePickerInput` component
|
|
81
86
|
*/
|
|
82
87
|
slug?: ReactNodeLike;
|