@carbon/react 1.56.0 → 1.57.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 +902 -908
- package/es/components/ComboBox/ComboBox.js +1 -0
- package/es/components/ContainedList/ContainedList.d.ts +45 -0
- package/es/components/ContainedList/ContainedList.js +18 -3
- package/es/components/ContainedList/ContainedListItem/ContainedListItem.d.ts +35 -0
- package/es/components/ContainedList/ContainedListItem/ContainedListItem.js +3 -2
- package/es/components/ContainedList/ContainedListItem/index.d.ts +9 -0
- package/es/components/ContainedList/index.d.ts +11 -0
- package/es/components/ContainedList/index.js +13 -0
- package/es/components/DataTable/TableToolbarSearch.js +1 -1
- package/es/components/DataTable/stories/examples/TableToolbarFilter.d.ts +51 -0
- package/es/components/DatePicker/DatePicker.d.ts +5 -4
- package/es/components/DatePicker/plugins/rangePlugin.js +5 -6
- package/es/components/Dialog/index.d.ts +31 -0
- package/es/components/ListBox/next/ListBoxTrigger.js +4 -3
- package/es/components/MultiSelect/FilterableMultiSelect.d.ts +177 -0
- package/es/components/MultiSelect/FilterableMultiSelect.js +388 -313
- package/es/components/MultiSelect/MultiSelect.js +1 -2
- package/es/components/MultiSelect/MultiSelectPropTypes.d.ts +62 -0
- package/es/components/MultiSelect/index.d.ts +10 -0
- package/es/components/MultiSelect/index.js +2 -0
- package/es/components/OverflowMenu/OverflowMenu.d.ts +300 -0
- package/es/components/OverflowMenu/OverflowMenu.js +22 -14
- package/es/components/OverflowMenu/next/index.d.ts +39 -0
- package/es/components/OverflowMenu/next/index.js +4 -3
- package/es/components/Pagination/Pagination.js +9 -9
- package/es/components/RadioButton/RadioButton.d.ts +4 -0
- package/es/components/RadioButton/RadioButton.js +7 -1
- package/es/components/RadioButtonGroup/RadioButtonGroup.d.ts +4 -0
- package/es/components/RadioButtonGroup/RadioButtonGroup.js +7 -1
- package/es/components/RadioTile/RadioTile.d.ts +4 -0
- package/es/components/RadioTile/RadioTile.js +7 -1
- package/es/components/Slider/Slider.js +3 -3
- package/es/components/StructuredList/StructuredList.js +6 -2
- package/es/components/TileGroup/TileGroup.d.ts +8 -0
- package/es/components/TileGroup/TileGroup.js +7 -1
- package/es/components/TimePicker/TimePicker.js +1 -1
- package/es/index.js +2 -0
- package/es/internal/Selection.js +4 -1
- package/lib/components/ComboBox/ComboBox.js +1 -0
- package/lib/components/ContainedList/ContainedList.d.ts +45 -0
- package/lib/components/ContainedList/ContainedList.js +18 -3
- package/lib/components/ContainedList/ContainedListItem/ContainedListItem.d.ts +35 -0
- package/lib/components/ContainedList/ContainedListItem/ContainedListItem.js +3 -2
- package/lib/components/ContainedList/ContainedListItem/index.d.ts +9 -0
- package/lib/components/ContainedList/index.d.ts +11 -0
- package/lib/components/ContainedList/index.js +19 -0
- package/lib/components/DataTable/TableToolbarSearch.js +1 -1
- package/lib/components/DataTable/stories/examples/TableToolbarFilter.d.ts +51 -0
- package/lib/components/DatePicker/DatePicker.d.ts +5 -4
- package/lib/components/DatePicker/plugins/rangePlugin.js +5 -6
- package/lib/components/Dialog/index.d.ts +31 -0
- package/lib/components/ListBox/next/ListBoxTrigger.js +4 -3
- package/lib/components/MultiSelect/FilterableMultiSelect.d.ts +177 -0
- package/lib/components/MultiSelect/FilterableMultiSelect.js +387 -312
- package/lib/components/MultiSelect/MultiSelect.js +1 -2
- package/lib/components/MultiSelect/MultiSelectPropTypes.d.ts +62 -0
- package/lib/components/MultiSelect/index.d.ts +10 -0
- package/lib/components/MultiSelect/index.js +2 -0
- package/lib/components/OverflowMenu/OverflowMenu.d.ts +300 -0
- package/lib/components/OverflowMenu/OverflowMenu.js +21 -13
- package/lib/components/OverflowMenu/next/index.d.ts +39 -0
- package/lib/components/OverflowMenu/next/index.js +4 -3
- package/lib/components/Pagination/Pagination.js +9 -9
- package/lib/components/RadioButton/RadioButton.d.ts +4 -0
- package/lib/components/RadioButton/RadioButton.js +7 -1
- package/lib/components/RadioButtonGroup/RadioButtonGroup.d.ts +4 -0
- package/lib/components/RadioButtonGroup/RadioButtonGroup.js +7 -1
- package/lib/components/RadioTile/RadioTile.d.ts +4 -0
- package/lib/components/RadioTile/RadioTile.js +7 -1
- package/lib/components/Slider/Slider.js +3 -3
- package/lib/components/StructuredList/StructuredList.js +6 -2
- package/lib/components/TileGroup/TileGroup.d.ts +8 -0
- package/lib/components/TileGroup/TileGroup.js +7 -1
- package/lib/components/TimePicker/TimePicker.js +1 -1
- package/lib/index.js +2 -0
- package/lib/internal/Selection.js +4 -1
- package/package.json +8 -8
- package/telemetry.yml +1 -1
|
@@ -35,6 +35,7 @@ const RadioButtonGroup = /*#__PURE__*/React__default.forwardRef((props, ref) =>
|
|
|
35
35
|
warn = false,
|
|
36
36
|
warnText,
|
|
37
37
|
slug,
|
|
38
|
+
required,
|
|
38
39
|
...rest
|
|
39
40
|
} = props;
|
|
40
41
|
const prefix = usePrefix();
|
|
@@ -62,7 +63,8 @@ const RadioButtonGroup = /*#__PURE__*/React__default.forwardRef((props, ref) =>
|
|
|
62
63
|
key: value,
|
|
63
64
|
value: value,
|
|
64
65
|
onChange: handleOnChange,
|
|
65
|
-
checked: value === selected
|
|
66
|
+
checked: value === selected,
|
|
67
|
+
required: required
|
|
66
68
|
};
|
|
67
69
|
if (!selected && radioButton?.props.checked) {
|
|
68
70
|
newProps.checked = true;
|
|
@@ -187,6 +189,10 @@ RadioButtonGroup.propTypes = {
|
|
|
187
189
|
* Whether the RadioButtonGroup should be read-only
|
|
188
190
|
*/
|
|
189
191
|
readOnly: PropTypes.bool,
|
|
192
|
+
/**
|
|
193
|
+
* `true` to specify if radio selection in group is required.
|
|
194
|
+
*/
|
|
195
|
+
required: PropTypes.bool,
|
|
190
196
|
/**
|
|
191
197
|
* **Experimental**: Provide a `Slug` component to be rendered inside the `RadioButtonGroup` component
|
|
192
198
|
*/
|
|
@@ -50,6 +50,10 @@ export interface RadioTileProps {
|
|
|
50
50
|
* Specify the value of the underlying `<input>`.
|
|
51
51
|
*/
|
|
52
52
|
value: string | number;
|
|
53
|
+
/**
|
|
54
|
+
* `true` to specify if the input is required.
|
|
55
|
+
*/
|
|
56
|
+
required?: boolean;
|
|
53
57
|
}
|
|
54
58
|
declare const RadioTile: React.ForwardRefExoticComponent<RadioTileProps & React.RefAttributes<HTMLInputElement>>;
|
|
55
59
|
export default RadioTile;
|
|
@@ -33,6 +33,7 @@ const RadioTile = /*#__PURE__*/React__default.forwardRef(function RadioTile(_ref
|
|
|
33
33
|
id,
|
|
34
34
|
onChange = noopFn,
|
|
35
35
|
tabIndex = 0,
|
|
36
|
+
required,
|
|
36
37
|
...rest
|
|
37
38
|
} = _ref;
|
|
38
39
|
const prefix = usePrefix();
|
|
@@ -74,7 +75,8 @@ const RadioTile = /*#__PURE__*/React__default.forwardRef(function RadioTile(_ref
|
|
|
74
75
|
tabIndex: !disabled ? tabIndex : undefined,
|
|
75
76
|
type: "radio",
|
|
76
77
|
value: value,
|
|
77
|
-
ref: ref
|
|
78
|
+
ref: ref,
|
|
79
|
+
required: required
|
|
78
80
|
}), /*#__PURE__*/React__default.createElement("label", _extends({}, rest, {
|
|
79
81
|
htmlFor: inputId,
|
|
80
82
|
className: className
|
|
@@ -120,6 +122,10 @@ RadioTile.propTypes = {
|
|
|
120
122
|
* the underlying `<input>` changes.
|
|
121
123
|
*/
|
|
122
124
|
onChange: PropTypes.func,
|
|
125
|
+
/**
|
|
126
|
+
* `true` to specify if the control is required.
|
|
127
|
+
*/
|
|
128
|
+
required: PropTypes.bool,
|
|
123
129
|
/**
|
|
124
130
|
* Specify the tab index of the underlying `<input>`.
|
|
125
131
|
*/
|
|
@@ -511,7 +511,7 @@ class Slider extends PureComponent {
|
|
|
511
511
|
if (clientX) {
|
|
512
512
|
const leftOffset = this.state.isRtl ? (boundingRect?.right ?? 0) - clientX : clientX - (boundingRect?.left ?? 0);
|
|
513
513
|
return leftOffset / width;
|
|
514
|
-
} else if (value && range) {
|
|
514
|
+
} else if (value !== null && value !== undefined && range) {
|
|
515
515
|
// Prevent NaN calculation if the range is 0.
|
|
516
516
|
return range === 0 ? 0 : (value - this.props.min) / range;
|
|
517
517
|
}
|
|
@@ -1093,7 +1093,7 @@ class Slider extends PureComponent {
|
|
|
1093
1093
|
hasTooltip: hideTextInput,
|
|
1094
1094
|
className: lowerThumbWrapperClasses,
|
|
1095
1095
|
label: `${value}`,
|
|
1096
|
-
align:
|
|
1096
|
+
align: "top"
|
|
1097
1097
|
}, lowerThumbWrapperProps), /*#__PURE__*/React__default.createElement("div", {
|
|
1098
1098
|
className: lowerThumbClasses,
|
|
1099
1099
|
role: "slider",
|
|
@@ -1112,7 +1112,7 @@ class Slider extends PureComponent {
|
|
|
1112
1112
|
hasTooltip: hideTextInput,
|
|
1113
1113
|
className: upperThumbWrapperClasses,
|
|
1114
1114
|
label: `${valueUpper}`,
|
|
1115
|
-
align: "top
|
|
1115
|
+
align: "top"
|
|
1116
1116
|
}, upperThumbWrapperProps), /*#__PURE__*/React__default.createElement("div", {
|
|
1117
1117
|
className: upperThumbClasses,
|
|
1118
1118
|
role: "slider",
|
|
@@ -17,7 +17,7 @@ import { RadioButtonChecked, RadioButton } from '@carbon/icons-react';
|
|
|
17
17
|
import { useOutsideClick } from '../../internal/useOutsideClick.js';
|
|
18
18
|
import { Text } from '../Text/Text.js';
|
|
19
19
|
|
|
20
|
-
var _StructuredListCell
|
|
20
|
+
var _StructuredListCell;
|
|
21
21
|
const GridSelectedRowStateContext = /*#__PURE__*/React__default.createContext(null);
|
|
22
22
|
const GridSelectedRowDispatchContext = /*#__PURE__*/React__default.createContext(null);
|
|
23
23
|
function StructuredListWrapper(props) {
|
|
@@ -192,7 +192,11 @@ function StructuredListRow(props) {
|
|
|
192
192
|
onKeyDown: onKeyDown
|
|
193
193
|
}), /*#__PURE__*/React__default.createElement(GridRowContext.Provider, {
|
|
194
194
|
value: value
|
|
195
|
-
}, selection && /*#__PURE__*/React__default.createElement(StructuredListCell, null, selectedRow === id ?
|
|
195
|
+
}, selection && /*#__PURE__*/React__default.createElement(StructuredListCell, null, selectedRow === id ? /*#__PURE__*/React__default.createElement(RadioButtonChecked, {
|
|
196
|
+
className: `${prefix}--structured-list__icon`
|
|
197
|
+
}) : /*#__PURE__*/React__default.createElement(RadioButton, {
|
|
198
|
+
className: `${prefix}--structured-list__icon`
|
|
199
|
+
})), children));
|
|
196
200
|
}
|
|
197
201
|
StructuredListRow.propTypes = {
|
|
198
202
|
/**
|
|
@@ -40,6 +40,10 @@ export interface TileGroupProps extends Omit<ReactAttr<HTMLFieldSetElement>, Exc
|
|
|
40
40
|
* Specify the value that is currently selected in the group
|
|
41
41
|
*/
|
|
42
42
|
valueSelected?: string | number;
|
|
43
|
+
/**
|
|
44
|
+
* `true` to specify if input selection in group is required.
|
|
45
|
+
*/
|
|
46
|
+
required?: boolean;
|
|
43
47
|
}
|
|
44
48
|
declare const TileGroup: {
|
|
45
49
|
(props: any): import("react/jsx-runtime").JSX.Element;
|
|
@@ -73,6 +77,10 @@ declare const TileGroup: {
|
|
|
73
77
|
* the group changes
|
|
74
78
|
*/
|
|
75
79
|
onChange: PropTypes.Requireable<(...args: any[]) => any>;
|
|
80
|
+
/**
|
|
81
|
+
* `true` to specify if input selection in group is required.
|
|
82
|
+
*/
|
|
83
|
+
required: PropTypes.Requireable<boolean>;
|
|
76
84
|
/**
|
|
77
85
|
* Specify the value that is currently selected in the group
|
|
78
86
|
*/
|
|
@@ -21,7 +21,8 @@ const TileGroup = props => {
|
|
|
21
21
|
legend,
|
|
22
22
|
name,
|
|
23
23
|
onChange = noopFn,
|
|
24
|
-
valueSelected
|
|
24
|
+
valueSelected,
|
|
25
|
+
required
|
|
25
26
|
} = props;
|
|
26
27
|
const prefix = usePrefix();
|
|
27
28
|
const [selected, setSelected] = useState(valueSelected ?? defaultSelected);
|
|
@@ -45,6 +46,7 @@ const TileGroup = props => {
|
|
|
45
46
|
...otherProps
|
|
46
47
|
} = child.props;
|
|
47
48
|
return /*#__PURE__*/React__default.createElement(RadioTile, _extends({}, otherProps, {
|
|
49
|
+
required: required,
|
|
48
50
|
name: name,
|
|
49
51
|
key: value,
|
|
50
52
|
value: value,
|
|
@@ -113,6 +115,10 @@ TileGroup.propTypes = {
|
|
|
113
115
|
* the group changes
|
|
114
116
|
*/
|
|
115
117
|
onChange: PropTypes.func,
|
|
118
|
+
/**
|
|
119
|
+
* `true` to specify if input selection in group is required.
|
|
120
|
+
*/
|
|
121
|
+
required: PropTypes.bool,
|
|
116
122
|
/**
|
|
117
123
|
* Specify the value that is currently selected in the group
|
|
118
124
|
*/
|
|
@@ -113,7 +113,7 @@ const TimePicker = /*#__PURE__*/React__default.forwardRef(function TimePicker(_r
|
|
|
113
113
|
if (item) {
|
|
114
114
|
return /*#__PURE__*/React__default.cloneElement(item, {
|
|
115
115
|
...item.props,
|
|
116
|
-
disabled: disabled,
|
|
116
|
+
disabled: item.props.disabled ?? disabled,
|
|
117
117
|
readOnly: readOnly,
|
|
118
118
|
...readOnlyEventHandlers
|
|
119
119
|
});
|
package/es/index.js
CHANGED
|
@@ -26,6 +26,7 @@ export { ComboButton } from './components/ComboButton/index.js';
|
|
|
26
26
|
export { default as ComposedModal, ModalBody } from './components/ComposedModal/ComposedModal.js';
|
|
27
27
|
export { ModalHeader } from './components/ComposedModal/ModalHeader.js';
|
|
28
28
|
export { ModalFooter } from './components/ComposedModal/ModalFooter.js';
|
|
29
|
+
import './components/ContainedList/index.js';
|
|
29
30
|
export { default as ContentSwitcher } from './components/ContentSwitcher/index.js';
|
|
30
31
|
export { default as Copy } from './components/Copy/Copy.js';
|
|
31
32
|
export { default as CopyButton } from './components/CopyButton/CopyButton.js';
|
|
@@ -69,6 +70,7 @@ export { MenuItem, MenuItemDivider, MenuItemGroup, MenuItemRadioGroup, MenuItemS
|
|
|
69
70
|
export { MenuButton } from './components/MenuButton/index.js';
|
|
70
71
|
export { default as Modal } from './components/Modal/Modal.js';
|
|
71
72
|
export { default as ModalWrapper } from './components/ModalWrapper/ModalWrapper.js';
|
|
73
|
+
import './components/MultiSelect/index.js';
|
|
72
74
|
export { ActionableNotification, InlineNotification, NotificationActionButton, NotificationButton, StaticNotification, ToastNotification } from './components/Notification/Notification.js';
|
|
73
75
|
export { default as NumberInputSkeleton } from './components/NumberInput/NumberInput.Skeleton.js';
|
|
74
76
|
export { NumberInput } from './components/NumberInput/NumberInput.js';
|
package/es/internal/Selection.js
CHANGED
|
@@ -40,6 +40,9 @@ function useSelection(_ref2) {
|
|
|
40
40
|
const [uncontrolledItems, setUncontrolledItems] = useState(initialSelectedItems);
|
|
41
41
|
const isControlled = !!controlledItems;
|
|
42
42
|
const [selectedItems, setSelectedItems] = useState(isControlled ? controlledItems : uncontrolledItems);
|
|
43
|
+
useEffect(() => {
|
|
44
|
+
setSelectedItems(isControlled ? controlledItems : uncontrolledItems);
|
|
45
|
+
}, [isControlled, controlledItems, uncontrolledItems]);
|
|
43
46
|
useEffect(() => {
|
|
44
47
|
callOnChangeHandler({
|
|
45
48
|
isControlled,
|
|
@@ -74,7 +77,7 @@ function useSelection(_ref2) {
|
|
|
74
77
|
isMounted: isMounted.current,
|
|
75
78
|
onChangeHandlerControlled: savedOnChange.current,
|
|
76
79
|
onChangeHandlerUncontrolled: setUncontrolledItems,
|
|
77
|
-
selectedItems:
|
|
80
|
+
selectedItems: []
|
|
78
81
|
});
|
|
79
82
|
}, [disabled, isControlled]);
|
|
80
83
|
useEffect(() => {
|
|
@@ -450,6 +450,7 @@ const ComboBox = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
450
450
|
onClearSelection: handleSelectionClear,
|
|
451
451
|
selectionCount: 0
|
|
452
452
|
}), /*#__PURE__*/React__default["default"].createElement(ListBoxTrigger["default"], _rollupPluginBabelHelpers["extends"]({}, buttonProps, {
|
|
453
|
+
// @ts-expect-error
|
|
453
454
|
isOpen: isOpen,
|
|
454
455
|
translateWithId: translateWithId
|
|
455
456
|
}))), normalizedSlug, /*#__PURE__*/React__default["default"].createElement(index["default"].Menu, getMenuProps({
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2022
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
import React, { ReactNode } from 'react';
|
|
8
|
+
import ContainedListItem from './ContainedListItem';
|
|
9
|
+
declare const variants: readonly ["on-page", "disclosed"];
|
|
10
|
+
interface ContainedListType extends React.FC<ContainedListProps> {
|
|
11
|
+
ContainedListItem: typeof ContainedListItem;
|
|
12
|
+
}
|
|
13
|
+
export type Variants = (typeof variants)[number];
|
|
14
|
+
export interface ContainedListProps {
|
|
15
|
+
/**
|
|
16
|
+
* A slot for a possible interactive element to render.
|
|
17
|
+
*/
|
|
18
|
+
action?: ReactNode;
|
|
19
|
+
/**
|
|
20
|
+
* A collection of ContainedListItems to be rendered in the ContainedList
|
|
21
|
+
*/
|
|
22
|
+
children?: ReactNode;
|
|
23
|
+
/**
|
|
24
|
+
* Additional CSS class names.
|
|
25
|
+
*/
|
|
26
|
+
className?: string;
|
|
27
|
+
/**
|
|
28
|
+
* Specify whether the dividing lines in between list items should be inset.
|
|
29
|
+
*/
|
|
30
|
+
isInset?: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* The kind of ContainedList you want to display
|
|
33
|
+
*/
|
|
34
|
+
kind?: Variants;
|
|
35
|
+
/**
|
|
36
|
+
* A label describing the contained list.
|
|
37
|
+
*/
|
|
38
|
+
label: string | ReactNode;
|
|
39
|
+
/**
|
|
40
|
+
* Specify the size of the contained list.
|
|
41
|
+
*/
|
|
42
|
+
size?: 'sm' | 'md' | 'lg' | 'xl';
|
|
43
|
+
}
|
|
44
|
+
declare const ContainedList: ContainedListType;
|
|
45
|
+
export default ContainedList;
|
|
@@ -16,6 +16,7 @@ var cx = require('classnames');
|
|
|
16
16
|
var index = require('../Layout/index.js');
|
|
17
17
|
var useId = require('../../internal/useId.js');
|
|
18
18
|
var usePrefix = require('../../internal/usePrefix.js');
|
|
19
|
+
var ContainedListItem = require('./ContainedListItem/ContainedListItem.js');
|
|
19
20
|
|
|
20
21
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
21
22
|
|
|
@@ -47,7 +48,7 @@ function renderChildren(children) {
|
|
|
47
48
|
}
|
|
48
49
|
return children;
|
|
49
50
|
}
|
|
50
|
-
|
|
51
|
+
const ContainedList = _ref => {
|
|
51
52
|
let {
|
|
52
53
|
action,
|
|
53
54
|
children,
|
|
@@ -67,7 +68,20 @@ function ContainedList(_ref) {
|
|
|
67
68
|
[`${prefix}--layout--size-${size}`]: size
|
|
68
69
|
}, `${prefix}--contained-list--${kind}`, className);
|
|
69
70
|
const filteredChildren = filterChildren(children);
|
|
70
|
-
|
|
71
|
+
function isSearchAction(action) {
|
|
72
|
+
if (! /*#__PURE__*/React__default["default"].isValidElement(action)) {
|
|
73
|
+
return false;
|
|
74
|
+
}
|
|
75
|
+
const actionTypes = ['Search', 'ExpandableSearch'];
|
|
76
|
+
let actionType = '';
|
|
77
|
+
if (typeof action.type === 'string') {
|
|
78
|
+
actionType = action.type;
|
|
79
|
+
} else {
|
|
80
|
+
actionType = action.type.displayName || '';
|
|
81
|
+
}
|
|
82
|
+
return actionTypes.includes(actionType);
|
|
83
|
+
}
|
|
84
|
+
const isActionSearch = isSearchAction(action);
|
|
71
85
|
const renderedChildren = renderChildren(children);
|
|
72
86
|
return /*#__PURE__*/React__default["default"].createElement("div", _rollupPluginBabelHelpers["extends"]({
|
|
73
87
|
className: classes
|
|
@@ -96,7 +110,7 @@ function ContainedList(_ref) {
|
|
|
96
110
|
role: "list",
|
|
97
111
|
"aria-labelledby": labelId
|
|
98
112
|
}, isActionSearch ? filteredChildren : renderedChildren));
|
|
99
|
-
}
|
|
113
|
+
};
|
|
100
114
|
ContainedList.propTypes = {
|
|
101
115
|
/**
|
|
102
116
|
* A slot for a possible interactive element to render.
|
|
@@ -127,5 +141,6 @@ ContainedList.propTypes = {
|
|
|
127
141
|
*/
|
|
128
142
|
size: PropTypes__default["default"].oneOf(['sm', 'md', 'lg', 'xl'])
|
|
129
143
|
};
|
|
144
|
+
ContainedList.ContainedListItem = ContainedListItem["default"];
|
|
130
145
|
|
|
131
146
|
exports["default"] = ContainedList;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2022
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
import React, { type ComponentType, type FunctionComponent, ReactNode } from 'react';
|
|
8
|
+
interface ContainedListItemProps {
|
|
9
|
+
/**
|
|
10
|
+
* A slot for a possible interactive element to render within the item.
|
|
11
|
+
*/
|
|
12
|
+
action?: ReactNode;
|
|
13
|
+
/**
|
|
14
|
+
* The content of this item. Must not contain any interactive elements. Use props.action to include those.
|
|
15
|
+
*/
|
|
16
|
+
children?: ReactNode;
|
|
17
|
+
/**
|
|
18
|
+
* Additional CSS class names.
|
|
19
|
+
*/
|
|
20
|
+
className?: string;
|
|
21
|
+
/**
|
|
22
|
+
* Whether this item is disabled.
|
|
23
|
+
*/
|
|
24
|
+
disabled?: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Provide an optional function to be called when the item is clicked.
|
|
27
|
+
*/
|
|
28
|
+
onClick?: () => void;
|
|
29
|
+
/**
|
|
30
|
+
* Provide an optional icon to render in front of the item's content.
|
|
31
|
+
*/
|
|
32
|
+
renderIcon?: ComponentType | FunctionComponent;
|
|
33
|
+
}
|
|
34
|
+
declare const ContainedListItem: React.FC<ContainedListItemProps>;
|
|
35
|
+
export default ContainedListItem;
|
|
@@ -22,7 +22,7 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
|
22
22
|
var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
|
|
23
23
|
var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
const ContainedListItem = _ref => {
|
|
26
26
|
let {
|
|
27
27
|
action,
|
|
28
28
|
children,
|
|
@@ -58,7 +58,7 @@ function ContainedListItem(_ref) {
|
|
|
58
58
|
},
|
|
59
59
|
className: `${prefix}--contained-list-item__action`
|
|
60
60
|
}, action));
|
|
61
|
-
}
|
|
61
|
+
};
|
|
62
62
|
ContainedListItem.propTypes = {
|
|
63
63
|
/**
|
|
64
64
|
* A slot for a possible interactive element to render within the item.
|
|
@@ -83,6 +83,7 @@ ContainedListItem.propTypes = {
|
|
|
83
83
|
/**
|
|
84
84
|
* Provide an optional icon to render in front of the item's content.
|
|
85
85
|
*/
|
|
86
|
+
// @ts-expect-error: PropTypes are not expressive enough to cover this case
|
|
86
87
|
renderIcon: PropTypes__default["default"].oneOfType([PropTypes__default["default"].func, PropTypes__default["default"].object])
|
|
87
88
|
};
|
|
88
89
|
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2022
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
import ContainedListItem from './ContainedListItem';
|
|
8
|
+
export default ContainedListItem;
|
|
9
|
+
export { ContainedListItem };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2022
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
import ContainedList from './ContainedList';
|
|
8
|
+
import ContainedListItem from './ContainedListItem';
|
|
9
|
+
export { ContainedListItem };
|
|
10
|
+
export default ContainedList;
|
|
11
|
+
export { ContainedList };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2016, 2023
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
'use strict';
|
|
9
|
+
|
|
10
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
11
|
+
|
|
12
|
+
var ContainedList = require('./ContainedList.js');
|
|
13
|
+
var ContainedListItem = require('./ContainedListItem/ContainedListItem.js');
|
|
14
|
+
|
|
15
|
+
ContainedList["default"].ContainedListItem = ContainedListItem["default"];
|
|
16
|
+
|
|
17
|
+
exports.ContainedList = ContainedList["default"];
|
|
18
|
+
exports["default"] = ContainedList["default"];
|
|
19
|
+
exports.ContainedListItem = ContainedListItem["default"];
|
|
@@ -108,7 +108,7 @@ const TableToolbarSearch = _ref => {
|
|
|
108
108
|
disabled: disabled,
|
|
109
109
|
className: searchClasses,
|
|
110
110
|
value: value,
|
|
111
|
-
id: typeof id !== 'undefined' ? id : uniqueId.toString()
|
|
111
|
+
id: typeof id !== 'undefined' ? id : `table-toolbar-search-${uniqueId.toString()}`,
|
|
112
112
|
labelText: labelText || t('carbon.table.toolbar.search.label'),
|
|
113
113
|
placeholder: placeholder || t('carbon.table.toolbar.search.placeholder'),
|
|
114
114
|
onChange: onChange,
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { ChangeEvent } from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
export type PopoverAlignment = 'top' | 'bottom' | 'left' | 'right' | 'top-start' | 'top-end' | 'bottom-start' | 'bottom-end' | 'left-end' | 'left-start' | 'right-end' | 'right-start';
|
|
4
|
+
interface TableToolbarFilterProps {
|
|
5
|
+
/**
|
|
6
|
+
* Specify how the popover should align with the trigger element
|
|
7
|
+
*/
|
|
8
|
+
align?: PopoverAlignment;
|
|
9
|
+
/**
|
|
10
|
+
* Provide an optional class name for the toolbar filter
|
|
11
|
+
*/
|
|
12
|
+
className?: string;
|
|
13
|
+
/**
|
|
14
|
+
* Provide an optional hook that is called each time the input is updated
|
|
15
|
+
*/
|
|
16
|
+
onChange?: (event: '' | ChangeEvent<HTMLInputElement>, value?: string) => void;
|
|
17
|
+
/**
|
|
18
|
+
* Provide an function that is called when the apply button is clicked
|
|
19
|
+
*/
|
|
20
|
+
onApplyFilter?: (selectedCheckboxes: Array<string>) => void;
|
|
21
|
+
/**
|
|
22
|
+
* Provide an function that is called when the reset button is clicked
|
|
23
|
+
*/
|
|
24
|
+
onResetFilter?: () => void;
|
|
25
|
+
}
|
|
26
|
+
declare const TableToolbarFilter: {
|
|
27
|
+
({ align, onApplyFilter, onResetFilter, className, ...rest }: TableToolbarFilterProps): import("react/jsx-runtime").JSX.Element;
|
|
28
|
+
propTypes: {
|
|
29
|
+
/**
|
|
30
|
+
* Specify how the popover should align with the trigger element
|
|
31
|
+
*/
|
|
32
|
+
align: PropTypes.Requireable<string>;
|
|
33
|
+
/**
|
|
34
|
+
* Provide an optional class name for the search container
|
|
35
|
+
*/
|
|
36
|
+
className: PropTypes.Requireable<string>;
|
|
37
|
+
/**
|
|
38
|
+
* Provide an function that is called when the apply button is clicked
|
|
39
|
+
*/
|
|
40
|
+
onApplyFilter: PropTypes.Requireable<(...args: any[]) => any>;
|
|
41
|
+
/**
|
|
42
|
+
* Provide an optional hook that is called each time the input is updated
|
|
43
|
+
*/
|
|
44
|
+
onChange: PropTypes.Requireable<(...args: any[]) => any>;
|
|
45
|
+
/**
|
|
46
|
+
* Provide an function that is called when the reset button is clicked
|
|
47
|
+
*/
|
|
48
|
+
onResetFilter: PropTypes.Requireable<(...args: any[]) => any>;
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
export default TableToolbarFilter;
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
import { ReactNodeLike } from 'prop-types';
|
|
8
8
|
import React from 'react';
|
|
9
9
|
import flatpickr from 'flatpickr';
|
|
10
|
+
import { DateLimit, DateOption } from 'flatpickr/dist/types/options';
|
|
10
11
|
export type DatePickerTypes = 'simple' | 'single' | 'range';
|
|
11
12
|
export type CalRef = {
|
|
12
13
|
inline: boolean;
|
|
@@ -57,11 +58,11 @@ interface DatePickerProps {
|
|
|
57
58
|
/**
|
|
58
59
|
* The flatpickr `disable` option that allows a user to disable certain dates.
|
|
59
60
|
*/
|
|
60
|
-
disable?:
|
|
61
|
+
disable?: DateLimit<DateOption>[];
|
|
61
62
|
/**
|
|
62
63
|
* The flatpickr `enable` option that allows a user to enable certain dates.
|
|
63
64
|
*/
|
|
64
|
-
enable?:
|
|
65
|
+
enable?: DateLimit<DateOption>[];
|
|
65
66
|
/**
|
|
66
67
|
* The flatpickr `inline` option.
|
|
67
68
|
*/
|
|
@@ -85,11 +86,11 @@ interface DatePickerProps {
|
|
|
85
86
|
/**
|
|
86
87
|
* The maximum date that a user can pick to.
|
|
87
88
|
*/
|
|
88
|
-
maxDate?:
|
|
89
|
+
maxDate?: DateOption;
|
|
89
90
|
/**
|
|
90
91
|
* The minimum date that a user can start picking from.
|
|
91
92
|
*/
|
|
92
|
-
minDate?:
|
|
93
|
+
minDate?: DateOption;
|
|
93
94
|
/**
|
|
94
95
|
* The `change` event handler.
|
|
95
96
|
*/
|
|
@@ -35,14 +35,13 @@ var carbonFlatpickrRangePlugin = (config => {
|
|
|
35
35
|
// where Flatpickr's range plugin takes care of fixing the first `<input>`
|
|
36
36
|
if (!triggerChange) {
|
|
37
37
|
const {
|
|
38
|
-
_input:
|
|
38
|
+
_input: inputDates
|
|
39
39
|
} = fp;
|
|
40
|
-
const
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
[inputFrom, inputTo].forEach((input, i) => {
|
|
40
|
+
const inputDatesArray = inputDates.value.split(' ');
|
|
41
|
+
fp.close();
|
|
42
|
+
[inputDatesArray[0], inputDatesArray[2]].forEach((input, i) => {
|
|
44
43
|
if (input) {
|
|
45
|
-
input
|
|
44
|
+
input = !dates[i] ? '' : fp.formatDate(new Date(dates[i]), fp.config.dateFormat);
|
|
46
45
|
}
|
|
47
46
|
});
|
|
48
47
|
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2014, 2024
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
import 'wicg-inert';
|
|
8
|
+
import React from 'react';
|
|
9
|
+
import { ReactAttr } from '../../types/common';
|
|
10
|
+
export interface DialogProps extends ReactAttr<HTMLDialogElement> {
|
|
11
|
+
/**
|
|
12
|
+
* Provide the contents of the Dialog
|
|
13
|
+
*/
|
|
14
|
+
children?: React.ReactNode;
|
|
15
|
+
/**
|
|
16
|
+
* Specifies whether the dialog is modal or non-modal
|
|
17
|
+
*/
|
|
18
|
+
modal?: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Specify a handler for closing Dialog.
|
|
21
|
+
* The handler should care of closing Dialog, e.g. changing `open` prop.
|
|
22
|
+
*/
|
|
23
|
+
onRequestClose?: React.ReactEventHandler<HTMLElement>;
|
|
24
|
+
/**
|
|
25
|
+
* Specify whether the Dialog is currently open
|
|
26
|
+
*/
|
|
27
|
+
open?: boolean;
|
|
28
|
+
}
|
|
29
|
+
declare const Dialog: React.ForwardRefExoticComponent<DialogProps & React.RefAttributes<unknown>>;
|
|
30
|
+
export { Dialog };
|
|
31
|
+
export default Dialog;
|
|
@@ -37,7 +37,7 @@ const defaultTranslateWithId = id => defaultTranslations[id];
|
|
|
37
37
|
* `ListBoxTrigger` is used to orient the icon up or down depending on the
|
|
38
38
|
* state of the menu for a given `ListBox`
|
|
39
39
|
*/
|
|
40
|
-
const ListBoxTrigger = _ref
|
|
40
|
+
const ListBoxTrigger = /*#__PURE__*/React__default["default"].forwardRef(function ListBoxTrigger(_ref, ref) {
|
|
41
41
|
let {
|
|
42
42
|
isOpen,
|
|
43
43
|
translateWithId: t = defaultTranslateWithId,
|
|
@@ -54,9 +54,10 @@ const ListBoxTrigger = _ref => {
|
|
|
54
54
|
title: description,
|
|
55
55
|
className: className,
|
|
56
56
|
type: "button",
|
|
57
|
-
tabIndex: "-1"
|
|
57
|
+
tabIndex: "-1",
|
|
58
|
+
ref: ref
|
|
58
59
|
}), _ChevronDown || (_ChevronDown = /*#__PURE__*/React__default["default"].createElement(iconsReact.ChevronDown, null)));
|
|
59
|
-
};
|
|
60
|
+
});
|
|
60
61
|
ListBoxTrigger.propTypes = {
|
|
61
62
|
/**
|
|
62
63
|
* Specify whether the menu is currently open, which will influence the
|