@carbon/react 1.70.0-rc.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 +756 -756
- package/es/components/AILabel/index.js +15 -15
- package/es/components/CheckboxGroup/CheckboxGroup.js +1 -1
- package/es/components/CodeSnippet/CodeSnippet.d.ts +5 -2
- package/es/components/CodeSnippet/CodeSnippet.js +40 -1
- package/es/components/ComboBox/ComboBox.js +28 -23
- package/es/components/ComboButton/index.js +40 -1
- package/es/components/ComposedModal/ComposedModal.js +6 -2
- 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/Table.d.ts +9 -1
- package/es/components/DataTable/Table.js +7 -2
- 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/DatePicker.js +0 -8
- package/es/components/DatePicker/plugins/appendToPlugin.js +2 -2
- package/es/components/DatePicker/plugins/fixEventsPlugin.js +4 -4
- package/es/components/DatePicker/plugins/rangePlugin.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/OverflowMenu.js +1 -1
- package/es/components/OverflowMenu/next/index.js +40 -1
- package/es/components/Pagination/Pagination.js +2 -2
- package/es/components/Pagination/experimental/PageSelector.js +1 -1
- package/es/components/PaginationNav/PaginationNav.d.ts +1 -1
- package/es/components/PaginationNav/PaginationNav.js +10 -5
- package/es/components/Popover/index.js +2 -2
- package/es/components/SkeletonText/SkeletonText.js +1 -1
- 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/TreeView/TreeNode.js +1 -1
- package/es/components/TreeView/TreeView.js +1 -1
- package/es/components/UIShell/HeaderMenu.js +1 -1
- package/es/components/UIShell/SideNav.js +1 -1
- package/es/components/UIShell/SideNavItems.js +1 -1
- package/es/components/UIShell/SideNavMenu.js +1 -1
- package/es/components/UIShell/SideNavMenuItem.d.ts +5 -1
- package/es/components/UIShell/SideNavMenuItem.js +7 -2
- package/es/components/UIShell/Switcher.js +1 -1
- package/lib/components/AILabel/index.js +15 -15
- package/lib/components/CheckboxGroup/CheckboxGroup.js +1 -1
- package/lib/components/CodeSnippet/CodeSnippet.d.ts +5 -2
- package/lib/components/CodeSnippet/CodeSnippet.js +40 -1
- package/lib/components/ComboBox/ComboBox.js +29 -23
- package/lib/components/ComboButton/index.js +40 -1
- package/lib/components/ComposedModal/ComposedModal.js +6 -2
- 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/Table.d.ts +9 -1
- package/lib/components/DataTable/Table.js +7 -2
- 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/DatePicker.js +0 -8
- package/lib/components/DatePicker/plugins/appendToPlugin.js +2 -2
- package/lib/components/DatePicker/plugins/fixEventsPlugin.js +4 -4
- package/lib/components/DatePicker/plugins/rangePlugin.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/OverflowMenu.js +1 -1
- package/lib/components/OverflowMenu/next/index.js +40 -1
- package/lib/components/Pagination/Pagination.js +2 -2
- package/lib/components/Pagination/experimental/PageSelector.js +1 -1
- package/lib/components/PaginationNav/PaginationNav.d.ts +1 -1
- package/lib/components/PaginationNav/PaginationNav.js +10 -5
- package/lib/components/Popover/index.js +2 -2
- package/lib/components/SkeletonText/SkeletonText.js +1 -1
- 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/TreeView/TreeNode.js +1 -1
- package/lib/components/TreeView/TreeView.js +1 -1
- package/lib/components/UIShell/HeaderMenu.js +1 -1
- package/lib/components/UIShell/SideNav.js +1 -1
- package/lib/components/UIShell/SideNavItems.js +1 -1
- package/lib/components/UIShell/SideNavMenu.js +1 -1
- package/lib/components/UIShell/SideNavMenuItem.d.ts +5 -1
- package/lib/components/UIShell/SideNavMenuItem.js +7 -2
- package/lib/components/UIShell/Switcher.js +1 -1
- package/package.json +5 -5
|
@@ -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
|
*/
|
|
@@ -33,9 +33,13 @@ interface TableProps {
|
|
|
33
33
|
* `true` to add useZebraStyles striping.
|
|
34
34
|
*/
|
|
35
35
|
useZebraStyles?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Specify the table tabIndex
|
|
38
|
+
*/
|
|
39
|
+
tabIndex?: number;
|
|
36
40
|
}
|
|
37
41
|
export declare const Table: {
|
|
38
|
-
({ className, children, useZebraStyles, size, isSortable, useStaticWidth, stickyHeader, overflowMenuOnHover, experimentalAutoAlign, ...other }: PropsWithChildren<TableProps>): import("react/jsx-runtime").JSX.Element;
|
|
42
|
+
({ className, children, useZebraStyles, size, isSortable, useStaticWidth, stickyHeader, overflowMenuOnHover, experimentalAutoAlign, tabIndex, ...other }: PropsWithChildren<TableProps>): import("react/jsx-runtime").JSX.Element;
|
|
39
43
|
propTypes: {
|
|
40
44
|
/**
|
|
41
45
|
* Pass in the children that will be rendered within the Table
|
|
@@ -70,6 +74,10 @@ export declare const Table: {
|
|
|
70
74
|
* `true` to add useZebraStyles striping.
|
|
71
75
|
*/
|
|
72
76
|
useZebraStyles: PropTypes.Requireable<boolean>;
|
|
77
|
+
/**
|
|
78
|
+
* Specify the table tabIndex
|
|
79
|
+
*/
|
|
80
|
+
tabIndex: PropTypes.Requireable<number>;
|
|
73
81
|
};
|
|
74
82
|
};
|
|
75
83
|
export default Table;
|
|
@@ -65,6 +65,7 @@ const Table = _ref => {
|
|
|
65
65
|
stickyHeader,
|
|
66
66
|
overflowMenuOnHover = true,
|
|
67
67
|
experimentalAutoAlign = false,
|
|
68
|
+
tabIndex,
|
|
68
69
|
...other
|
|
69
70
|
} = _ref;
|
|
70
71
|
const {
|
|
@@ -140,7 +141,7 @@ const Table = _ref => {
|
|
|
140
141
|
className: `${prefix}--data-table-content`
|
|
141
142
|
// eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex
|
|
142
143
|
,
|
|
143
|
-
tabIndex: isScrollable ? 0 : undefined
|
|
144
|
+
tabIndex: tabIndex ?? (isScrollable ? 0 : undefined)
|
|
144
145
|
}, /*#__PURE__*/React__default["default"].createElement("table", _rollupPluginBabelHelpers["extends"]({
|
|
145
146
|
"aria-labelledby": titleId,
|
|
146
147
|
"aria-describedby": descriptionId
|
|
@@ -185,7 +186,11 @@ Table.propTypes = {
|
|
|
185
186
|
/**
|
|
186
187
|
* `true` to add useZebraStyles striping.
|
|
187
188
|
*/
|
|
188
|
-
useZebraStyles: PropTypes__default["default"].bool
|
|
189
|
+
useZebraStyles: PropTypes__default["default"].bool,
|
|
190
|
+
/**
|
|
191
|
+
* Specify the table tabIndex
|
|
192
|
+
*/
|
|
193
|
+
tabIndex: PropTypes__default["default"].number
|
|
189
194
|
};
|
|
190
195
|
|
|
191
196
|
exports.Table = Table;
|
|
@@ -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
|
*/
|
|
@@ -542,9 +542,6 @@ const DatePicker = /*#__PURE__*/React__default["default"].forwardRef(function Da
|
|
|
542
542
|
const closeCalendar = event => {
|
|
543
543
|
calendarRef.current.close();
|
|
544
544
|
// Remove focus from endDate calendar input
|
|
545
|
-
if (document.activeElement instanceof HTMLElement) {
|
|
546
|
-
document.activeElement.blur();
|
|
547
|
-
}
|
|
548
545
|
onCalendarClose(calendarRef.current.selectedDates, '', calendarRef.current, {
|
|
549
546
|
type: 'clickOutside'
|
|
550
547
|
});
|
|
@@ -570,12 +567,7 @@ const DatePicker = /*#__PURE__*/React__default["default"].forwardRef(function Da
|
|
|
570
567
|
if (!calendarRef.current || !startInputField.current) return;
|
|
571
568
|
const handleKeyDown = event => {
|
|
572
569
|
if (match.match(event, keys.Tab) && !event.shiftKey && document.activeElement === endInputField.current && calendarRef.current.isOpen) {
|
|
573
|
-
event.preventDefault();
|
|
574
570
|
calendarRef.current.close();
|
|
575
|
-
// Remove focus from endDate calendar input
|
|
576
|
-
document.activeElement instanceof HTMLElement &&
|
|
577
|
-
// this is to fix the TS warning
|
|
578
|
-
document?.activeElement?.blur();
|
|
579
571
|
onCalendarClose(calendarRef.current.selectedDates, '', calendarRef.current, event);
|
|
580
572
|
}
|
|
581
573
|
};
|
|
@@ -13,7 +13,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
13
13
|
* @param {object} config Plugin configuration.
|
|
14
14
|
* @returns {Plugin} A Flatpickr plugin to put adjust the position of calendar dropdown.
|
|
15
15
|
*/
|
|
16
|
-
var carbonFlatpickrAppendToPlugin =
|
|
16
|
+
var carbonFlatpickrAppendToPlugin = config => fp => {
|
|
17
17
|
/**
|
|
18
18
|
* Adjusts the floating menu position after Flatpicker sets it.
|
|
19
19
|
*/
|
|
@@ -55,6 +55,6 @@ var carbonFlatpickrAppendToPlugin = (config => fp => {
|
|
|
55
55
|
onReady: register,
|
|
56
56
|
onPreCalendarPosition: handlePreCalendarPosition
|
|
57
57
|
};
|
|
58
|
-
}
|
|
58
|
+
};
|
|
59
59
|
|
|
60
60
|
exports["default"] = carbonFlatpickrAppendToPlugin;
|
|
@@ -16,7 +16,7 @@ var keys = require('../../../internal/keyboard/keys.js');
|
|
|
16
16
|
* @param {object} config Plugin configuration.
|
|
17
17
|
* @returns {Plugin} A Flatpickr plugin to fix Flatpickr's behavior of certain events.
|
|
18
18
|
*/
|
|
19
|
-
var carbonFlatpickrFixEventsPlugin =
|
|
19
|
+
var carbonFlatpickrFixEventsPlugin = config => fp => {
|
|
20
20
|
const {
|
|
21
21
|
inputFrom,
|
|
22
22
|
inputTo,
|
|
@@ -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))) {
|
|
@@ -154,6 +154,6 @@ var carbonFlatpickrFixEventsPlugin = (config => fp => {
|
|
|
154
154
|
onReady: [register, init],
|
|
155
155
|
onDestroy: [release]
|
|
156
156
|
};
|
|
157
|
-
}
|
|
157
|
+
};
|
|
158
158
|
|
|
159
159
|
exports["default"] = carbonFlatpickrFixEventsPlugin;
|
|
@@ -22,7 +22,7 @@ var rangePlugin__default = /*#__PURE__*/_interopDefaultLegacy(rangePlugin);
|
|
|
22
22
|
* Workaround for: https://github.com/flatpickr/flatpickr/issues/1944
|
|
23
23
|
* * A logic to ensure `fp.setDate()` call won't end up with "startDate to endDate" set to the first `<input>`
|
|
24
24
|
*/
|
|
25
|
-
var carbonFlatpickrRangePlugin =
|
|
25
|
+
var carbonFlatpickrRangePlugin = config => {
|
|
26
26
|
const factory = rangePlugin__default["default"](Object.assign({
|
|
27
27
|
position: 'left'
|
|
28
28
|
}, config));
|
|
@@ -57,6 +57,6 @@ var carbonFlatpickrRangePlugin = (config => {
|
|
|
57
57
|
onPreCalendarPosition() {}
|
|
58
58
|
});
|
|
59
59
|
};
|
|
60
|
-
}
|
|
60
|
+
};
|
|
61
61
|
|
|
62
62
|
exports["default"] = carbonFlatpickrRangePlugin;
|
|
@@ -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;
|
|
@@ -18,6 +18,7 @@ require('../FluidForm/FluidForm.js');
|
|
|
18
18
|
var FormContext = require('../FluidForm/FormContext.js');
|
|
19
19
|
var useId = require('../../internal/useId.js');
|
|
20
20
|
require('../Text/index.js');
|
|
21
|
+
var deprecate = require('../../prop-types/deprecate.js');
|
|
21
22
|
var Text = require('../Text/Text.js');
|
|
22
23
|
|
|
23
24
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
@@ -29,6 +30,7 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
|
29
30
|
const DatePickerInput = /*#__PURE__*/React__default["default"].forwardRef(function DatePickerInput(props, ref) {
|
|
30
31
|
const {
|
|
31
32
|
datePickerType,
|
|
33
|
+
decorator,
|
|
32
34
|
disabled = false,
|
|
33
35
|
helperText,
|
|
34
36
|
hideLabel,
|
|
@@ -71,7 +73,8 @@ const DatePickerInput = /*#__PURE__*/React__default["default"].forwardRef(functi
|
|
|
71
73
|
const wrapperClasses = cx__default["default"](`${prefix}--date-picker-input__wrapper`, {
|
|
72
74
|
[`${prefix}--date-picker-input__wrapper--invalid`]: invalid,
|
|
73
75
|
[`${prefix}--date-picker-input__wrapper--warn`]: warn,
|
|
74
|
-
[`${prefix}--date-picker-input__wrapper--slug`]: slug
|
|
76
|
+
[`${prefix}--date-picker-input__wrapper--slug`]: slug,
|
|
77
|
+
[`${prefix}--date-picker-input__wrapper--decorator`]: decorator
|
|
75
78
|
});
|
|
76
79
|
const labelClasses = cx__default["default"](`${prefix}--label`, {
|
|
77
80
|
[`${prefix}--visually-hidden`]: hideLabel,
|
|
@@ -105,10 +108,10 @@ const DatePickerInput = /*#__PURE__*/React__default["default"].forwardRef(functi
|
|
|
105
108
|
}
|
|
106
109
|
const input = /*#__PURE__*/React__default["default"].createElement("input", inputProps);
|
|
107
110
|
|
|
108
|
-
//
|
|
109
|
-
let
|
|
110
|
-
if (
|
|
111
|
-
|
|
111
|
+
// AILabel always size `mini`
|
|
112
|
+
let normalizedDecorator = /*#__PURE__*/React__default["default"].isValidElement(slug ?? decorator) ? slug ?? decorator : null;
|
|
113
|
+
if (normalizedDecorator && normalizedDecorator['type']?.displayName === 'AILabel') {
|
|
114
|
+
normalizedDecorator = /*#__PURE__*/React__default["default"].cloneElement(normalizedDecorator, {
|
|
112
115
|
size: 'mini'
|
|
113
116
|
});
|
|
114
117
|
}
|
|
@@ -120,7 +123,9 @@ const DatePickerInput = /*#__PURE__*/React__default["default"].forwardRef(functi
|
|
|
120
123
|
className: labelClasses
|
|
121
124
|
}, labelText), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
122
125
|
className: wrapperClasses
|
|
123
|
-
}, /*#__PURE__*/React__default["default"].createElement("span", null, input,
|
|
126
|
+
}, /*#__PURE__*/React__default["default"].createElement("span", null, input, slug ? normalizedDecorator : decorator ? /*#__PURE__*/React__default["default"].createElement("div", {
|
|
127
|
+
className: `${prefix}--date-picker-input-inner-wrapper--decorator`
|
|
128
|
+
}, normalizedDecorator) : '', isFluid && /*#__PURE__*/React__default["default"].createElement(DatePickerIcon, {
|
|
124
129
|
datePickerType: datePickerType
|
|
125
130
|
}), /*#__PURE__*/React__default["default"].createElement(DatePickerIcon, {
|
|
126
131
|
datePickerType: datePickerType,
|
|
@@ -151,6 +156,10 @@ DatePickerInput.propTypes = {
|
|
|
151
156
|
* * `range` - With calendar dropdown and a date range.
|
|
152
157
|
*/
|
|
153
158
|
datePickerType: PropTypes__default["default"].oneOf(['simple', 'single', 'range']),
|
|
159
|
+
/**
|
|
160
|
+
* **Experimental**: Provide a decorator component to be rendered inside the `RadioButton` component
|
|
161
|
+
*/
|
|
162
|
+
decorator: PropTypes__default["default"].node,
|
|
154
163
|
/**
|
|
155
164
|
* Specify whether or not the input should be disabled
|
|
156
165
|
*/
|
|
@@ -214,10 +223,7 @@ DatePickerInput.propTypes = {
|
|
|
214
223
|
* Specify the size of the Date Picker Input. Currently supports either `sm`, `md`, or `lg` as an option.
|
|
215
224
|
*/
|
|
216
225
|
size: PropTypes__default["default"].oneOf(['sm', 'md', 'lg']),
|
|
217
|
-
|
|
218
|
-
* **Experimental**: Provide a `Slug` component to be rendered inside the `DatePickerInput` component
|
|
219
|
-
*/
|
|
220
|
-
slug: PropTypes__default["default"].node,
|
|
226
|
+
slug: deprecate["default"](PropTypes__default["default"].node, 'The `slug` prop has been deprecated and will be removed in the next major version. Use the decorator prop instead.'),
|
|
221
227
|
/**
|
|
222
228
|
* Specify the type of the `<input>`
|
|
223
229
|
*/
|
|
@@ -27,6 +27,10 @@ export interface DropdownProps<ItemType> extends Omit<ReactAttr<HTMLDivElement>,
|
|
|
27
27
|
* **Experimental**: Will attempt to automatically align the floating element to avoid collisions with the viewport and being clipped by ancestor elements.
|
|
28
28
|
*/
|
|
29
29
|
autoAlign?: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* **Experimental**: Provide a `decorator` component to be rendered inside the `Dropdown` component
|
|
32
|
+
*/
|
|
33
|
+
decorator?: ReactNode;
|
|
30
34
|
/**
|
|
31
35
|
* Specify the direction of the dropdown. Can be either top or bottom.
|
|
32
36
|
*/
|
|
@@ -120,6 +124,7 @@ export interface DropdownProps<ItemType> extends Omit<ReactAttr<HTMLDivElement>,
|
|
|
120
124
|
*/
|
|
121
125
|
size?: ListBoxSize;
|
|
122
126
|
/**
|
|
127
|
+
* @deprecated please use `decorator` instead.
|
|
123
128
|
* **Experimental**: Provide a `Slug` component to be rendered inside the `Dropdown` component
|
|
124
129
|
*/
|
|
125
130
|
slug?: ReactNode;
|