@carbon/react 1.57.0-rc.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.
Files changed (52) hide show
  1. package/.playwright/INTERNAL_AVT_REPORT_DO_NOT_USE.json +971 -936
  2. package/es/components/ComboBox/ComboBox.js +1 -0
  3. package/es/components/ContainedList/ContainedList.d.ts +7 -3
  4. package/es/components/ContainedList/ContainedList.js +3 -2
  5. package/es/components/ContainedList/ContainedListItem/ContainedListItem.js +1 -2
  6. package/es/components/ContainedList/ContainedListItem/index.d.ts +9 -0
  7. package/es/components/ContainedList/index.d.ts +11 -0
  8. package/es/components/ContainedList/index.js +13 -0
  9. package/es/components/DataTable/stories/examples/TableToolbarFilter.d.ts +51 -0
  10. package/es/components/DatePicker/DatePicker.d.ts +5 -4
  11. package/es/components/DatePicker/plugins/rangePlugin.js +5 -6
  12. package/es/components/Dialog/index.d.ts +31 -0
  13. package/es/components/ListBox/next/ListBoxTrigger.js +4 -3
  14. package/es/components/MultiSelect/FilterableMultiSelect.d.ts +177 -0
  15. package/es/components/MultiSelect/FilterableMultiSelect.js +388 -313
  16. package/es/components/MultiSelect/MultiSelect.js +1 -2
  17. package/es/components/MultiSelect/MultiSelectPropTypes.d.ts +62 -0
  18. package/es/components/MultiSelect/index.d.ts +10 -0
  19. package/es/components/MultiSelect/index.js +2 -0
  20. package/es/components/Pagination/Pagination.js +9 -9
  21. package/es/components/RadioButton/RadioButton.d.ts +4 -0
  22. package/es/components/RadioButton/RadioButton.js +7 -1
  23. package/es/components/RadioButtonGroup/RadioButtonGroup.d.ts +4 -0
  24. package/es/components/RadioButtonGroup/RadioButtonGroup.js +7 -1
  25. package/es/components/TimePicker/TimePicker.js +1 -1
  26. package/es/index.js +3 -1
  27. package/lib/components/ComboBox/ComboBox.js +1 -0
  28. package/lib/components/ContainedList/ContainedList.d.ts +7 -3
  29. package/lib/components/ContainedList/ContainedList.js +3 -2
  30. package/lib/components/ContainedList/ContainedListItem/ContainedListItem.js +1 -2
  31. package/lib/components/ContainedList/ContainedListItem/index.d.ts +9 -0
  32. package/lib/components/ContainedList/index.d.ts +11 -0
  33. package/lib/components/ContainedList/index.js +19 -0
  34. package/lib/components/DataTable/stories/examples/TableToolbarFilter.d.ts +51 -0
  35. package/lib/components/DatePicker/DatePicker.d.ts +5 -4
  36. package/lib/components/DatePicker/plugins/rangePlugin.js +5 -6
  37. package/lib/components/Dialog/index.d.ts +31 -0
  38. package/lib/components/ListBox/next/ListBoxTrigger.js +4 -3
  39. package/lib/components/MultiSelect/FilterableMultiSelect.d.ts +177 -0
  40. package/lib/components/MultiSelect/FilterableMultiSelect.js +387 -312
  41. package/lib/components/MultiSelect/MultiSelect.js +1 -2
  42. package/lib/components/MultiSelect/MultiSelectPropTypes.d.ts +62 -0
  43. package/lib/components/MultiSelect/index.d.ts +10 -0
  44. package/lib/components/MultiSelect/index.js +2 -0
  45. package/lib/components/Pagination/Pagination.js +9 -9
  46. package/lib/components/RadioButton/RadioButton.d.ts +4 -0
  47. package/lib/components/RadioButton/RadioButton.js +7 -1
  48. package/lib/components/RadioButtonGroup/RadioButtonGroup.d.ts +4 -0
  49. package/lib/components/RadioButtonGroup/RadioButtonGroup.js +7 -1
  50. package/lib/components/TimePicker/TimePicker.js +1 -1
  51. package/lib/index.js +4 -2
  52. package/package.json +7 -7
@@ -615,6 +615,5 @@ MultiSelect.propTypes = {
615
615
  */
616
616
  warnText: PropTypes.node
617
617
  };
618
- var MultiSelect$1 = MultiSelect;
619
618
 
620
- export { MultiSelect$1 as default };
619
+ export { MultiSelect as default };
@@ -0,0 +1,62 @@
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
+ import PropTypes from 'prop-types';
8
+ export declare const sortingPropTypes: {
9
+ /**
10
+ * Provide a compare function that is used to determine the ordering of
11
+ * options. `compareItems` has the following function signature:
12
+ *
13
+ * compareFunction :
14
+ * (itemA: string, itemB: string, { locale: string }) => number
15
+ */
16
+ compareItems: PropTypes.Requireable<(...args: any[]) => any>;
17
+ /**
18
+ * Provide a method that sorts all options in the control. Overriding this
19
+ * prop means that you also have to handle the sort logic for selected versus
20
+ * un-selected items. If you just want to control ordering, consider the
21
+ * `compareItems` prop instead.
22
+ *
23
+ * `sortItems` has the following signature:
24
+ *
25
+ * sortItems :
26
+ * (items: Array<Item>, {
27
+ * selectedItems: Array<Item>,
28
+ * itemToString: Item => string,
29
+ * compareItems: (itemA: string, itemB: string, {
30
+ * locale: string
31
+ * }) => number,
32
+ * locale: string,
33
+ * }) => Array<Item>
34
+ */
35
+ sortItems: PropTypes.Requireable<(...args: any[]) => any>;
36
+ };
37
+ export interface ItemBase {
38
+ disabled?: boolean;
39
+ }
40
+ export interface SortingPropTypes<Item extends ItemBase> {
41
+ /**
42
+ * Provide a compare function that is used
43
+ * to determine the ordering of options.
44
+ */
45
+ compareItems(itemA: string, itemB: string, ctx: {
46
+ locale: string;
47
+ }): number;
48
+ /**
49
+ * Provide a method that sorts all options in the control. Overriding this
50
+ * prop means that you also have to handle the sort logic for selected versus
51
+ * un-selected items. If you just want to control ordering, consider the
52
+ * `compareItems` prop instead.
53
+ */
54
+ sortItems(items: Item[], state: {
55
+ selectedItems: Item[];
56
+ itemToString(item: Item): string;
57
+ compareItems(itemA: string, itemB: string, ctx: {
58
+ locale: string;
59
+ }): number;
60
+ locale: string;
61
+ }): Item[];
62
+ }
@@ -0,0 +1,10 @@
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
+ import MultiSelect from './MultiSelect';
8
+ import { default as FilterableMultiSelect } from './FilterableMultiSelect';
9
+ export { FilterableMultiSelect, MultiSelect };
10
+ export default MultiSelect;
@@ -12,6 +12,8 @@ import FilterableMultiSelect from './FilterableMultiSelect.js';
12
12
  export { default as FilterableMultiSelect } from './FilterableMultiSelect.js';
13
13
 
14
14
  FilterableMultiSelect.displayName = 'MultiSelect.Filterable';
15
+ // @ts-expect-error: The attribute indeed does not exist on the object,
16
+ // but since it is already deprecated, we do not have to fix it.
15
17
  MultiSelect.Filterable = FilterableMultiSelect;
16
18
  if (process.env.NODE_ENV !== "production") {
17
19
  deprecateFieldOnObject(MultiSelect, 'Filterable', FilterableMultiSelect);
@@ -68,10 +68,10 @@ const Pagination = /*#__PURE__*/React__default.forwardRef(function Pagination(_r
68
68
  pageSize: controlledPageSize,
69
69
  pageSizeInputDisabled,
70
70
  pageSizes: controlledPageSizes,
71
- pageText = (page, pagesUnknown) => `page ${pagesUnknown ? '' : page}`,
71
+ pageText = page => `page ${page}`,
72
72
  pagesUnknown = false,
73
73
  size = 'md',
74
- totalItems = 1,
74
+ totalItems,
75
75
  ...rest
76
76
  } = _ref;
77
77
  const prefix = usePrefix();
@@ -93,7 +93,7 @@ const Pagination = /*#__PURE__*/React__default.forwardRef(function Pagination(_r
93
93
  [`${prefix}--pagination--${size}`]: size,
94
94
  [customClassName]: !!customClassName
95
95
  });
96
- const totalPages = Math.max(Math.ceil(totalItems / pageSize), 1);
96
+ const totalPages = totalItems ? Math.max(Math.ceil(totalItems / pageSize), 1) : NaN;
97
97
  const backButtonDisabled = disabled || page === 1;
98
98
  const backButtonClasses = cx({
99
99
  [`${prefix}--pagination__button`]: true,
@@ -145,7 +145,7 @@ const Pagination = /*#__PURE__*/React__default.forwardRef(function Pagination(_r
145
145
  }
146
146
  function handlePageInputChange(event) {
147
147
  const page = Number(event.target.value);
148
- if (page > 0 && page <= Math.max(Math.ceil(totalItems / pageSize), 1)) {
148
+ if (page > 0 && totalItems && page <= Math.max(Math.ceil(totalItems / pageSize), 1)) {
149
149
  setPage(page);
150
150
  if (onChange) {
151
151
  onChange({
@@ -218,11 +218,11 @@ const Pagination = /*#__PURE__*/React__default.forwardRef(function Pagination(_r
218
218
  text: String(sizeObj.text)
219
219
  }))), /*#__PURE__*/React__default.createElement("span", {
220
220
  className: `${prefix}--pagination__text ${prefix}--pagination__items-count`
221
- }, pagesUnknown ? itemText(pageSize * (page - 1) + 1, page * pageSize) : itemRangeText(Math.min(pageSize * (page - 1) + 1, totalItems), Math.min(page * pageSize, totalItems), totalItems))), /*#__PURE__*/React__default.createElement("div", {
221
+ }, pagesUnknown || !totalItems ? itemText(pageSize * (page - 1) + 1, page * pageSize) : itemRangeText(Math.min(pageSize * (page - 1) + 1, totalItems), Math.min(page * pageSize, totalItems), totalItems))), /*#__PURE__*/React__default.createElement("div", {
222
222
  className: `${prefix}--pagination__right`
223
223
  }, pagesUnknown ? /*#__PURE__*/React__default.createElement("span", {
224
- className: `${prefix}--pagination__text ${prefix}--pagination__page-text`
225
- }, pagesUnknown ? pageText(page, pagesUnknown) : pageRangeText(page, totalPages)) : null, /*#__PURE__*/React__default.createElement(Select, {
224
+ className: `${prefix}--pagination__text ${prefix}--pagination__page-text ${prefix}--pagination__unknown-pages-text`
225
+ }, pageText(page)) : /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(Select, {
226
226
  id: `${prefix}-pagination-select-${inputId}-right`,
227
227
  className: `${prefix}--select__page-number`,
228
228
  labelText: `Page number, of ${totalPages} pages`,
@@ -231,9 +231,9 @@ const Pagination = /*#__PURE__*/React__default.forwardRef(function Pagination(_r
231
231
  onChange: handlePageInputChange,
232
232
  value: page,
233
233
  disabled: pageInputDisabled || disabled
234
- }, selectItems), pagesUnknown ? null : /*#__PURE__*/React__default.createElement("span", {
234
+ }, selectItems), /*#__PURE__*/React__default.createElement("span", {
235
235
  className: `${prefix}--pagination__text`
236
- }, pagesUnknown ? pageText(page, pagesUnknown) : pageRangeText(page, totalPages)), /*#__PURE__*/React__default.createElement("div", {
236
+ }, pageRangeText(page, totalPages))), /*#__PURE__*/React__default.createElement("div", {
237
237
  className: `${prefix}--pagination__control-buttons`
238
238
  }, /*#__PURE__*/React__default.createElement(IconButton, {
239
239
  align: "top",
@@ -63,6 +63,10 @@ export interface RadioButtonProps extends Omit<React.InputHTMLAttributes<HTMLInp
63
63
  * Specify the value of the `<RadioButton>`
64
64
  */
65
65
  value?: string | number;
66
+ /**
67
+ * `true` to specify if the input is required.
68
+ */
69
+ required?: boolean;
66
70
  }
67
71
  declare const RadioButton: React.ForwardRefExoticComponent<RadioButtonProps & React.RefAttributes<unknown>>;
68
72
  export default RadioButton;
@@ -27,6 +27,7 @@ const RadioButton = /*#__PURE__*/React__default.forwardRef((props, ref) => {
27
27
  onChange = () => {},
28
28
  value = '',
29
29
  slug,
30
+ required,
30
31
  ...rest
31
32
  } = props;
32
33
  const prefix = usePrefix();
@@ -60,7 +61,8 @@ const RadioButton = /*#__PURE__*/React__default.forwardRef((props, ref) => {
60
61
  ref: mergeRefs(inputRef, ref),
61
62
  disabled: disabled,
62
63
  value: value,
63
- name: name
64
+ name: name,
65
+ required: required
64
66
  })), /*#__PURE__*/React__default.createElement("label", {
65
67
  htmlFor: uniqueId,
66
68
  className: `${prefix}--radio-button__label`
@@ -119,6 +121,10 @@ RadioButton.propTypes = {
119
121
  * Provide a handler that is invoked when a user clicks on the control
120
122
  */
121
123
  onClick: PropTypes.func,
124
+ /**
125
+ * `true` to specify if the control is required.
126
+ */
127
+ required: PropTypes.bool,
122
128
  /**
123
129
  * **Experimental**: Provide a `Slug` component to be rendered inside the `RadioButton` component
124
130
  */
@@ -79,6 +79,10 @@ export interface RadioButtonGroupProps extends Omit<React.InputHTMLAttributes<HT
79
79
  * Specify the value that is currently selected in the group
80
80
  */
81
81
  valueSelected?: string | number;
82
+ /**
83
+ * `true` to specify if input selection in group is required.
84
+ */
85
+ required?: boolean;
82
86
  }
83
87
  declare const RadioButtonGroup: React.ForwardRefExoticComponent<RadioButtonGroupProps & React.RefAttributes<unknown>>;
84
88
  export default RadioButtonGroup;
@@ -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
  */
@@ -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';
@@ -179,6 +181,7 @@ export { default as unstable_PageSelector } from './components/Pagination/experi
179
181
  export { default as unstable_Pagination } from './components/Pagination/experimental/Pagination.js';
180
182
  export { default as CheckboxGroup } from './components/CheckboxGroup/CheckboxGroup.js';
181
183
  export { default as ContainedListItem } from './components/ContainedList/ContainedListItem/ContainedListItem.js';
184
+ export { default as ContainedList } from './components/ContainedList/ContainedList.js';
182
185
  export { default as useContextMenu } from './components/ContextMenu/useContextMenu.js';
183
186
  export { default as SliderSkeleton } from './components/Slider/Slider.Skeleton.js';
184
187
  export { default as TextInputSkeleton } from './components/TextInput/TextInput.Skeleton.js';
@@ -203,7 +206,6 @@ export { default as unstable__ChatButton } from './components/ChatButton/ChatBut
203
206
  export { default as unstable__ChatButtonSkeleton } from './components/ChatButton/ChatButton.Skeleton.js';
204
207
  export { Text as unstable_Text } from './components/Text/Text.js';
205
208
  export { TextDirection as unstable_TextDirection } from './components/Text/TextDirection.js';
206
- export { default as ContainedList } from './components/ContainedList/ContainedList.js';
207
209
  export { default as DataTable } from './components/DataTable/DataTable.js';
208
210
  export { Table } from './components/DataTable/Table.js';
209
211
  export { default as TableActionList } from './components/DataTable/TableActionList.js';
@@ -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({
@@ -5,9 +5,13 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
  import React, { ReactNode } from 'react';
8
+ import ContainedListItem from './ContainedListItem';
8
9
  declare const variants: readonly ["on-page", "disclosed"];
9
- type Variants = (typeof variants)[number];
10
- interface ContainedListProps {
10
+ interface ContainedListType extends React.FC<ContainedListProps> {
11
+ ContainedListItem: typeof ContainedListItem;
12
+ }
13
+ export type Variants = (typeof variants)[number];
14
+ export interface ContainedListProps {
11
15
  /**
12
16
  * A slot for a possible interactive element to render.
13
17
  */
@@ -37,5 +41,5 @@ interface ContainedListProps {
37
41
  */
38
42
  size?: 'sm' | 'md' | 'lg' | 'xl';
39
43
  }
40
- declare const ContainedList: React.FC<ContainedListProps>;
44
+ declare const ContainedList: ContainedListType;
41
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
 
@@ -140,6 +141,6 @@ ContainedList.propTypes = {
140
141
  */
141
142
  size: PropTypes__default["default"].oneOf(['sm', 'md', 'lg', 'xl'])
142
143
  };
143
- var ContainedList$1 = ContainedList;
144
+ ContainedList.ContainedListItem = ContainedListItem["default"];
144
145
 
145
- exports["default"] = ContainedList$1;
146
+ exports["default"] = ContainedList;
@@ -86,6 +86,5 @@ ContainedListItem.propTypes = {
86
86
  // @ts-expect-error: PropTypes are not expressive enough to cover this case
87
87
  renderIcon: PropTypes__default["default"].oneOfType([PropTypes__default["default"].func, PropTypes__default["default"].object])
88
88
  };
89
- var ContainedListItem$1 = ContainedListItem;
90
89
 
91
- exports["default"] = ContainedListItem$1;
90
+ exports["default"] = ContainedListItem;
@@ -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"];
@@ -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?: string[];
61
+ disable?: DateLimit<DateOption>[];
61
62
  /**
62
63
  * The flatpickr `enable` option that allows a user to enable certain dates.
63
64
  */
64
- enable?: string[];
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?: string | number;
89
+ maxDate?: DateOption;
89
90
  /**
90
91
  * The minimum date that a user can start picking from.
91
92
  */
92
- minDate?: string | number;
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: inputFrom
38
+ _input: inputDates
39
39
  } = fp;
40
- const {
41
- input: inputTo
42
- } = config;
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.value = !dates[i] ? '' : fp.formatDate(new Date(dates[i]), fp.config.dateFormat);
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