@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
|
@@ -31,8 +31,8 @@ const AILabelContent = /*#__PURE__*/React__default.forwardRef(function AILabelCo
|
|
|
31
31
|
item.type?.displayName === 'AILabelActions';
|
|
32
32
|
});
|
|
33
33
|
const aiLabelContentClasses = cx(className, {
|
|
34
|
-
[`${prefix}--
|
|
35
|
-
[`${prefix}--
|
|
34
|
+
[`${prefix}--ai-label-content`]: true,
|
|
35
|
+
[`${prefix}--ai-label-content--with-actions`]: hasAILabelActions
|
|
36
36
|
});
|
|
37
37
|
return /*#__PURE__*/React__default.createElement(ToggletipContent, {
|
|
38
38
|
className: aiLabelContentClasses
|
|
@@ -41,11 +41,11 @@ const AILabelContent = /*#__PURE__*/React__default.forwardRef(function AILabelCo
|
|
|
41
41
|
AILabelContent.displayName = 'AILabelContent';
|
|
42
42
|
AILabelContent.propTypes = {
|
|
43
43
|
/**
|
|
44
|
-
* Specify the content you want rendered inside the
|
|
44
|
+
* Specify the content you want rendered inside the AILabel ToggleTip
|
|
45
45
|
*/
|
|
46
46
|
children: PropTypes.node,
|
|
47
47
|
/**
|
|
48
|
-
* Specify an optional className to be added to the
|
|
48
|
+
* Specify an optional className to be added to the AILabel callout
|
|
49
49
|
*/
|
|
50
50
|
className: PropTypes.string
|
|
51
51
|
};
|
|
@@ -57,7 +57,7 @@ const AILabelActions = /*#__PURE__*/React__default.forwardRef(function AILabelAc
|
|
|
57
57
|
} = _ref2;
|
|
58
58
|
const prefix = usePrefix();
|
|
59
59
|
const aiLabelActionsClasses = cx(className, {
|
|
60
|
-
[`${prefix}--
|
|
60
|
+
[`${prefix}--ai-label-actions`]: true
|
|
61
61
|
});
|
|
62
62
|
return /*#__PURE__*/React__default.createElement(ToggletipActions, {
|
|
63
63
|
className: aiLabelActionsClasses
|
|
@@ -66,11 +66,11 @@ const AILabelActions = /*#__PURE__*/React__default.forwardRef(function AILabelAc
|
|
|
66
66
|
AILabelActions.displayName = 'AILabelActions';
|
|
67
67
|
AILabelActions.propTypes = {
|
|
68
68
|
/**
|
|
69
|
-
* Specify the content you want rendered inside the
|
|
69
|
+
* Specify the content you want rendered inside the AILabel callout toolbar
|
|
70
70
|
*/
|
|
71
71
|
children: PropTypes.node,
|
|
72
72
|
/**
|
|
73
|
-
* Specify an optional className to be added to the
|
|
73
|
+
* Specify an optional className to be added to the AILabel toolbar
|
|
74
74
|
*/
|
|
75
75
|
className: PropTypes.string
|
|
76
76
|
};
|
|
@@ -104,14 +104,14 @@ const AILabel = /*#__PURE__*/React__default.forwardRef(function AILabel(_ref3, r
|
|
|
104
104
|
const prefix = usePrefix();
|
|
105
105
|
const id = useId('AILabel');
|
|
106
106
|
const aiLabelClasses = cx(className, {
|
|
107
|
-
[`${prefix}--
|
|
108
|
-
[`${prefix}--
|
|
107
|
+
[`${prefix}--ai-label`]: true,
|
|
108
|
+
[`${prefix}--ai-label--revert`]: revertActive
|
|
109
109
|
});
|
|
110
110
|
const aiLabelButtonClasses = cx({
|
|
111
|
-
[`${prefix}--
|
|
112
|
-
[`${prefix}--
|
|
113
|
-
[`${prefix}--
|
|
114
|
-
[`${prefix}--
|
|
111
|
+
[`${prefix}--ai-label__button`]: true,
|
|
112
|
+
[`${prefix}--ai-label__button--${size}`]: size,
|
|
113
|
+
[`${prefix}--ai-label__button--${kind}`]: kind,
|
|
114
|
+
[`${prefix}--ai-label__button--inline-with-content`]: kind === 'inline' && (aiTextLabel || textLabel)
|
|
115
115
|
});
|
|
116
116
|
const handleOnRevertClick = evt => {
|
|
117
117
|
if (onRevertClick) {
|
|
@@ -135,9 +135,9 @@ const AILabel = /*#__PURE__*/React__default.forwardRef(function AILabel(_ref3, r
|
|
|
135
135
|
className: aiLabelButtonClasses,
|
|
136
136
|
label: ariaLabelText
|
|
137
137
|
}, /*#__PURE__*/React__default.createElement("span", {
|
|
138
|
-
className: `${prefix}--
|
|
138
|
+
className: `${prefix}--ai-label__text`
|
|
139
139
|
}, aiText), kind === 'inline' && (aiTextLabel || textLabel) && /*#__PURE__*/React__default.createElement("span", {
|
|
140
|
-
className: `${prefix}--
|
|
140
|
+
className: `${prefix}--ai-label__additional-text`
|
|
141
141
|
}, aiTextLabel || textLabel)), children));
|
|
142
142
|
});
|
|
143
143
|
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
|
|
@@ -19,12 +19,26 @@ import uniqueId from '../../tools/uniqueId.js';
|
|
|
19
19
|
import copy from 'copy-to-clipboard';
|
|
20
20
|
import deprecate from '../../prop-types/deprecate.js';
|
|
21
21
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
22
|
+
import deprecateValuesWithin from '../../prop-types/deprecateValuesWithin.js';
|
|
22
23
|
|
|
23
24
|
const rowHeightInPixels = 16;
|
|
24
25
|
const defaultMaxCollapsedNumberOfRows = 15;
|
|
25
26
|
const defaultMaxExpandedNumberOfRows = 0;
|
|
26
27
|
const defaultMinCollapsedNumberOfRows = 3;
|
|
27
28
|
const defaultMinExpandedNumberOfRows = 16;
|
|
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 CodeSnippet(_ref) {
|
|
29
43
|
let {
|
|
30
44
|
align = 'bottom',
|
|
@@ -232,7 +246,32 @@ CodeSnippet.propTypes = {
|
|
|
232
246
|
/**
|
|
233
247
|
* Specify how the trigger should align with the tooltip
|
|
234
248
|
*/
|
|
235
|
-
align: PropTypes.oneOf(['top', 'top-left',
|
|
249
|
+
align: deprecateValuesWithin(PropTypes.oneOf(['top', 'top-left',
|
|
250
|
+
// deprecated use top-start instead
|
|
251
|
+
'top-right',
|
|
252
|
+
// deprecated use top-end instead
|
|
253
|
+
|
|
254
|
+
'bottom', 'bottom-left',
|
|
255
|
+
// deprecated use bottom-start instead
|
|
256
|
+
'bottom-right',
|
|
257
|
+
// deprecated use bottom-end instead
|
|
258
|
+
|
|
259
|
+
'left', 'left-bottom',
|
|
260
|
+
// deprecated use left-end instead
|
|
261
|
+
'left-top',
|
|
262
|
+
// deprecated use left-start instead
|
|
263
|
+
|
|
264
|
+
'right', 'right-bottom',
|
|
265
|
+
// deprecated use right-end instead
|
|
266
|
+
'right-top',
|
|
267
|
+
// deprecated use right-start instead
|
|
268
|
+
|
|
269
|
+
// new values to match floating-ui
|
|
270
|
+
'top-start', 'top-end', 'bottom-start', 'bottom-end', 'left-end', 'left-start', 'right-end', 'right-start']),
|
|
271
|
+
//allowed prop values
|
|
272
|
+
['top', 'top-start', 'top-end', 'bottom', 'bottom-start', 'bottom-end', 'left', 'left-start', 'left-end', 'right', 'right-start', 'right-end'],
|
|
273
|
+
//optional mapper function
|
|
274
|
+
propMappingFunction),
|
|
236
275
|
/**
|
|
237
276
|
* Specify a label to be read by screen readers on the containing textbox
|
|
238
277
|
* node
|
|
@@ -226,7 +226,6 @@ const ComboBox = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
226
226
|
selectedItem: selectedItemProp,
|
|
227
227
|
prevSelectedItem: prevSelectedItemProp.current
|
|
228
228
|
});
|
|
229
|
-
|
|
230
229
|
// selectedItem has been updated externally, need to update state and call onChange
|
|
231
230
|
if (inputValue !== currentInputValue) {
|
|
232
231
|
setInputValue(currentInputValue);
|
|
@@ -435,30 +434,12 @@ const ComboBox = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
435
434
|
} = _ref4;
|
|
436
435
|
const normalizedInput = inputValue || '';
|
|
437
436
|
setInputValue(normalizedInput);
|
|
438
|
-
if (selectedItemProp && !inputValue) {
|
|
439
|
-
// ensure onChange is called when selectedItem is cleared
|
|
440
|
-
onChange({
|
|
441
|
-
selectedItem,
|
|
442
|
-
inputValue: normalizedInput
|
|
443
|
-
});
|
|
444
|
-
}
|
|
445
437
|
setHighlightedIndex(indexToHighlight(normalizedInput));
|
|
446
438
|
},
|
|
447
|
-
|
|
448
|
-
let {
|
|
449
|
-
selectedItem
|
|
450
|
-
} = _ref5;
|
|
451
|
-
// only call onChange if new selection is updated from previous
|
|
452
|
-
if (!isEqual(selectedItem, selectedItemProp)) {
|
|
453
|
-
onChange({
|
|
454
|
-
selectedItem
|
|
455
|
-
});
|
|
456
|
-
}
|
|
457
|
-
},
|
|
458
|
-
onHighlightedIndexChange: _ref6 => {
|
|
439
|
+
onHighlightedIndexChange: _ref5 => {
|
|
459
440
|
let {
|
|
460
441
|
highlightedIndex
|
|
461
|
-
} =
|
|
442
|
+
} = _ref5;
|
|
462
443
|
if (highlightedIndex > -1 && typeof window !== undefined) {
|
|
463
444
|
const itemArray = document.querySelectorAll(`li.${prefix}--list-box__menu-item[role="option"]`);
|
|
464
445
|
const highlightedItem = itemArray[highlightedIndex];
|
|
@@ -470,11 +451,27 @@ const ComboBox = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
470
451
|
}
|
|
471
452
|
}
|
|
472
453
|
},
|
|
454
|
+
onStateChange: _ref6 => {
|
|
455
|
+
let {
|
|
456
|
+
type,
|
|
457
|
+
selectedItem: newSelectedItem
|
|
458
|
+
} = _ref6;
|
|
459
|
+
if (type === '__item_click__' && !isEqual(selectedItemProp, newSelectedItem)) {
|
|
460
|
+
onChange({
|
|
461
|
+
selectedItem: newSelectedItem
|
|
462
|
+
});
|
|
463
|
+
}
|
|
464
|
+
if (type === '__function_select_item__' || type === '__input_keydown_enter__') {
|
|
465
|
+
onChange({
|
|
466
|
+
selectedItem: newSelectedItem
|
|
467
|
+
});
|
|
468
|
+
}
|
|
469
|
+
},
|
|
473
470
|
initialSelectedItem: initialSelectedItem,
|
|
474
471
|
inputId: id,
|
|
475
472
|
stateReducer,
|
|
476
473
|
isItemDisabled(item, _index) {
|
|
477
|
-
return item
|
|
474
|
+
return item?.disabled;
|
|
478
475
|
},
|
|
479
476
|
...downshiftProps
|
|
480
477
|
});
|
|
@@ -22,6 +22,7 @@ import { flip, size, useFloating, autoUpdate } from '@floating-ui/react';
|
|
|
22
22
|
import { hide } from '../../node_modules/@floating-ui/dom/dist/floating-ui.dom.mjs.js';
|
|
23
23
|
import { useFeatureFlag } from '../FeatureFlags/index.js';
|
|
24
24
|
import mergeRefs from '../../tools/mergeRefs.js';
|
|
25
|
+
import deprecateValuesWithin from '../../prop-types/deprecateValuesWithin.js';
|
|
25
26
|
|
|
26
27
|
var _ChevronDown;
|
|
27
28
|
const defaultTranslations = {
|
|
@@ -32,6 +33,19 @@ const defaultTranslations = {
|
|
|
32
33
|
* Message ids that will be passed to translateWithId().
|
|
33
34
|
*/
|
|
34
35
|
|
|
36
|
+
const propMappingFunction = deprecatedValue => {
|
|
37
|
+
const mapping = {
|
|
38
|
+
'top-left': 'top-start',
|
|
39
|
+
'top-right': 'top-end',
|
|
40
|
+
'bottom-left': 'bottom-start',
|
|
41
|
+
'bottom-right': 'bottom-end',
|
|
42
|
+
'left-bottom': 'left-end',
|
|
43
|
+
'left-top': 'left-start',
|
|
44
|
+
'right-bottom': 'right-end',
|
|
45
|
+
'right-top': 'right-start'
|
|
46
|
+
};
|
|
47
|
+
return mapping[deprecatedValue];
|
|
48
|
+
};
|
|
35
49
|
function defaultTranslateWithId(messageId) {
|
|
36
50
|
return defaultTranslations[messageId];
|
|
37
51
|
}
|
|
@@ -191,7 +205,32 @@ ComboButton.propTypes = {
|
|
|
191
205
|
/**
|
|
192
206
|
* Specify how the trigger tooltip should be aligned.
|
|
193
207
|
*/
|
|
194
|
-
tooltipAlignment: PropTypes.oneOf(['top', 'top-left',
|
|
208
|
+
tooltipAlignment: deprecateValuesWithin(PropTypes.oneOf(['top', 'top-left',
|
|
209
|
+
// deprecated use top-start instead
|
|
210
|
+
'top-right',
|
|
211
|
+
// deprecated use top-end instead
|
|
212
|
+
|
|
213
|
+
'bottom', 'bottom-left',
|
|
214
|
+
// deprecated use bottom-start instead
|
|
215
|
+
'bottom-right',
|
|
216
|
+
// deprecated use bottom-end instead
|
|
217
|
+
|
|
218
|
+
'left', 'left-bottom',
|
|
219
|
+
// deprecated use left-end instead
|
|
220
|
+
'left-top',
|
|
221
|
+
// deprecated use left-start instead
|
|
222
|
+
|
|
223
|
+
'right', 'right-bottom',
|
|
224
|
+
// deprecated use right-end instead
|
|
225
|
+
'right-top',
|
|
226
|
+
// deprecated use right-start instead
|
|
227
|
+
|
|
228
|
+
// new values to match floating-ui
|
|
229
|
+
'top-start', 'top-end', 'bottom-start', 'bottom-end', 'left-end', 'left-start', 'right-end', 'right-start']),
|
|
230
|
+
//allowed prop values
|
|
231
|
+
['top', 'top-start', 'top-end', 'bottom', 'bottom-start', 'bottom-end', 'left', 'left-start', 'left-end', 'right', 'right-start', 'right-end'],
|
|
232
|
+
//optional mapper function
|
|
233
|
+
propMappingFunction),
|
|
195
234
|
/**
|
|
196
235
|
* Optional method that takes in a message id and returns an
|
|
197
236
|
* 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
|
/**
|
|
@@ -163,7 +163,7 @@ _defineProperty(ContentSwitcher, "propTypes", {
|
|
|
163
163
|
*/
|
|
164
164
|
selectedIndex: PropTypes.number,
|
|
165
165
|
/**
|
|
166
|
-
* Choose whether or not to automatically change selection on focus
|
|
166
|
+
* Choose whether or not to automatically change selection on focus when left/right arrow pressed. Defaults to 'automatic'
|
|
167
167
|
*/
|
|
168
168
|
selectionMode: PropTypes.oneOf(['automatic', 'manual']),
|
|
169
169
|
/**
|
|
@@ -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
|
*/
|
|
@@ -14,7 +14,21 @@ import { composeEventHandlers } from '../../tools/events.js';
|
|
|
14
14
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
15
15
|
import { IconButton } from '../IconButton/index.js';
|
|
16
16
|
import { noopFn } from '../../internal/noopFn.js';
|
|
17
|
+
import deprecateValuesWithin from '../../prop-types/deprecateValuesWithin.js';
|
|
17
18
|
|
|
19
|
+
const propMappingFunction = deprecatedValue => {
|
|
20
|
+
const mapping = {
|
|
21
|
+
'top-left': 'top-start',
|
|
22
|
+
'top-right': 'top-end',
|
|
23
|
+
'bottom-left': 'bottom-start',
|
|
24
|
+
'bottom-right': 'bottom-end',
|
|
25
|
+
'left-bottom': 'left-end',
|
|
26
|
+
'left-top': 'left-start',
|
|
27
|
+
'right-bottom': 'right-end',
|
|
28
|
+
'right-top': 'right-start'
|
|
29
|
+
};
|
|
30
|
+
return mapping[deprecatedValue];
|
|
31
|
+
};
|
|
18
32
|
function Copy(_ref) {
|
|
19
33
|
let {
|
|
20
34
|
align = 'bottom',
|
|
@@ -66,7 +80,32 @@ Copy.propTypes = {
|
|
|
66
80
|
/**
|
|
67
81
|
* Specify how the trigger should align with the tooltip
|
|
68
82
|
*/
|
|
69
|
-
align: PropTypes.oneOf(['top', 'top-left',
|
|
83
|
+
align: deprecateValuesWithin(PropTypes.oneOf(['top', 'top-left',
|
|
84
|
+
// deprecated use top-start instead
|
|
85
|
+
'top-right',
|
|
86
|
+
// deprecated use top-end instead
|
|
87
|
+
|
|
88
|
+
'bottom', 'bottom-left',
|
|
89
|
+
// deprecated use bottom-start instead
|
|
90
|
+
'bottom-right',
|
|
91
|
+
// deprecated use bottom-end instead
|
|
92
|
+
|
|
93
|
+
'left', 'left-bottom',
|
|
94
|
+
// deprecated use left-end instead
|
|
95
|
+
'left-top',
|
|
96
|
+
// deprecated use left-start instead
|
|
97
|
+
|
|
98
|
+
'right', 'right-bottom',
|
|
99
|
+
// deprecated use right-end instead
|
|
100
|
+
'right-top',
|
|
101
|
+
// deprecated use right-start instead
|
|
102
|
+
|
|
103
|
+
// new values to match floating-ui
|
|
104
|
+
'top-start', 'top-end', 'bottom-start', 'bottom-end', 'left-end', 'left-start', 'right-end', 'right-start']),
|
|
105
|
+
//allowed prop values
|
|
106
|
+
['top', 'top-start', 'top-end', 'bottom', 'bottom-start', 'bottom-end', 'left', 'left-start', 'left-end', 'right', 'right-start', 'right-end'],
|
|
107
|
+
//optional mapper function
|
|
108
|
+
propMappingFunction),
|
|
70
109
|
/**
|
|
71
110
|
* **Experimental**: Will attempt to automatically align the tooltip
|
|
72
111
|
*/
|
|
@@ -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
|
*/
|
|
@@ -14,7 +14,21 @@ import Copy from '../Copy/Copy.js';
|
|
|
14
14
|
import { LayoutConstraint } from '../Layout/index.js';
|
|
15
15
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
16
16
|
import { noopFn } from '../../internal/noopFn.js';
|
|
17
|
+
import deprecateValuesWithin from '../../prop-types/deprecateValuesWithin.js';
|
|
17
18
|
|
|
19
|
+
const propMappingFunction = deprecatedValue => {
|
|
20
|
+
const mapping = {
|
|
21
|
+
'top-left': 'top-start',
|
|
22
|
+
'top-right': 'top-end',
|
|
23
|
+
'bottom-left': 'bottom-start',
|
|
24
|
+
'bottom-right': 'bottom-end',
|
|
25
|
+
'left-bottom': 'left-end',
|
|
26
|
+
'left-top': 'left-start',
|
|
27
|
+
'right-bottom': 'right-end',
|
|
28
|
+
'right-top': 'right-start'
|
|
29
|
+
};
|
|
30
|
+
return mapping[deprecatedValue];
|
|
31
|
+
};
|
|
18
32
|
function CopyButton(_ref) {
|
|
19
33
|
let {
|
|
20
34
|
align = 'bottom',
|
|
@@ -48,7 +62,32 @@ CopyButton.propTypes = {
|
|
|
48
62
|
/**
|
|
49
63
|
* Specify how the trigger should align with the tooltip
|
|
50
64
|
*/
|
|
51
|
-
align: PropTypes.oneOf(['top', 'top-left',
|
|
65
|
+
align: deprecateValuesWithin(PropTypes.oneOf(['top', 'top-left',
|
|
66
|
+
// deprecated use top-start instead
|
|
67
|
+
'top-right',
|
|
68
|
+
// deprecated use top-end instead
|
|
69
|
+
|
|
70
|
+
'bottom', 'bottom-left',
|
|
71
|
+
// deprecated use bottom-start instead
|
|
72
|
+
'bottom-right',
|
|
73
|
+
// deprecated use bottom-end instead
|
|
74
|
+
|
|
75
|
+
'left', 'left-bottom',
|
|
76
|
+
// deprecated use left-end instead
|
|
77
|
+
'left-top',
|
|
78
|
+
// deprecated use left-start instead
|
|
79
|
+
|
|
80
|
+
'right', 'right-bottom',
|
|
81
|
+
// deprecated use right-end instead
|
|
82
|
+
'right-top',
|
|
83
|
+
// deprecated use right-start instead
|
|
84
|
+
|
|
85
|
+
// new values to match floating-ui
|
|
86
|
+
'top-start', 'top-end', 'bottom-start', 'bottom-end', 'left-end', 'left-start', 'right-end', 'right-start']),
|
|
87
|
+
//allowed prop values
|
|
88
|
+
['top', 'top-start', 'top-end', 'bottom', 'bottom-start', 'bottom-end', 'left', 'left-start', 'left-end', 'right', 'right-start', 'right-end'],
|
|
89
|
+
//optional mapper function
|
|
90
|
+
propMappingFunction),
|
|
52
91
|
/**
|
|
53
92
|
* **Experimental**: Will attempt to automatically align the tooltip
|
|
54
93
|
*/
|
|
@@ -30,15 +30,21 @@ const TableSelectRow = _ref => {
|
|
|
30
30
|
} = _ref;
|
|
31
31
|
const prefix = usePrefix();
|
|
32
32
|
const uniqueNameId = useId();
|
|
33
|
+
const handleRadioChange = onChange ? (value, name, event) => {
|
|
34
|
+
// Convert the radio value to boolean for consistency
|
|
35
|
+
onChange(!!value, name || '', event);
|
|
36
|
+
} : undefined;
|
|
37
|
+
const handleCheckboxChange = onChange ? (checked, name, event) => {
|
|
38
|
+
onChange(checked, name, event);
|
|
39
|
+
} : undefined;
|
|
33
40
|
const selectionInputProps = {
|
|
34
41
|
id,
|
|
35
42
|
name: name ? name : uniqueNameId,
|
|
36
43
|
onClick: onSelect,
|
|
37
|
-
onChange,
|
|
38
44
|
checked,
|
|
39
45
|
disabled
|
|
40
46
|
};
|
|
41
|
-
const
|
|
47
|
+
const labelValue = ariaLabel || deprecatedAriaLabel || '';
|
|
42
48
|
const tableSelectRowClasses = cx(`${prefix}--table-column-checkbox`, {
|
|
43
49
|
...(className && {
|
|
44
50
|
[className]: true
|
|
@@ -48,11 +54,13 @@ const TableSelectRow = _ref => {
|
|
|
48
54
|
return /*#__PURE__*/React__default.createElement("td", {
|
|
49
55
|
className: tableSelectRowClasses,
|
|
50
56
|
"aria-live": "off"
|
|
51
|
-
}, /*#__PURE__*/React__default.createElement(
|
|
52
|
-
labelText:
|
|
57
|
+
}, radio ? /*#__PURE__*/React__default.createElement(RadioButton, _extends({}, selectionInputProps, {
|
|
58
|
+
labelText: labelValue,
|
|
59
|
+
onChange: handleRadioChange,
|
|
53
60
|
hideLabel: true
|
|
54
|
-
},
|
|
55
|
-
|
|
61
|
+
})) : /*#__PURE__*/React__default.createElement(InlineCheckbox, _extends({}, selectionInputProps, {
|
|
62
|
+
"aria-label": labelValue,
|
|
63
|
+
onChange: handleCheckboxChange
|
|
56
64
|
})));
|
|
57
65
|
};
|
|
58
66
|
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
|
*/
|
|
@@ -76,7 +76,7 @@ var carbonFlatpickrFixEventsPlugin = config => fp => {
|
|
|
76
76
|
if (inputTo === target && fp.selectedDates[1]) {
|
|
77
77
|
// Using getTime() enables the ability to more readily compare the date currently
|
|
78
78
|
// selected in the calendar and the date currently in the value of the input
|
|
79
|
-
const withoutTime = date => date
|
|
79
|
+
const withoutTime = date => date?.setHours(0, 0, 0, 0);
|
|
80
80
|
const selectedToDate = withoutTime(new Date(fp.selectedDates[1]));
|
|
81
81
|
const currentValueToDate = withoutTime(parseDateWithFormat(inputTo.value));
|
|
82
82
|
|
|
@@ -88,7 +88,7 @@ var carbonFlatpickrFixEventsPlugin = config => fp => {
|
|
|
88
88
|
fp.setDate([inputFrom.value, inputTo && inputTo.value], true, fp.config.dateFormat);
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
|
-
const isValidDate = date => date
|
|
91
|
+
const isValidDate = date => date?.toString() !== 'Invalid Date';
|
|
92
92
|
// save end date in calendar inmediately after it's been written down
|
|
93
93
|
if (inputTo === target && fp.selectedDates.length === 1 && inputTo.value) {
|
|
94
94
|
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;
|