@carbon/react 1.90.0 → 1.91.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.
Files changed (118) hide show
  1. package/.playwright/INTERNAL_AVT_REPORT_DO_NOT_USE.json +921 -921
  2. package/es/components/CodeSnippet/CodeSnippet.d.ts +1 -1
  3. package/es/components/CodeSnippet/CodeSnippet.js +1 -1
  4. package/es/components/ComboBox/ComboBox.js +1 -12
  5. package/es/components/ComboButton/index.js +1 -1
  6. package/es/components/ComposedModal/ComposedModal.js +1 -1
  7. package/es/components/Copy/Copy.d.ts +1 -1
  8. package/es/components/Copy/Copy.js +1 -1
  9. package/es/components/CopyButton/CopyButton.d.ts +1 -1
  10. package/es/components/CopyButton/CopyButton.js +1 -1
  11. package/es/components/DataTable/DataTable.d.ts +60 -15
  12. package/es/components/DataTable/DataTable.js +106 -179
  13. package/es/components/DataTable/Table.d.ts +2 -2
  14. package/es/components/DataTable/Table.js +1 -1
  15. package/es/components/DataTable/TableExpandHeader.d.ts +1 -1
  16. package/es/components/DataTable/TableExpandHeader.js +1 -1
  17. package/es/components/DatePicker/DatePicker.d.ts +0 -12
  18. package/es/components/DatePicker/DatePicker.js +3 -3
  19. package/es/components/DatePicker/plugins/rangePlugin.d.ts +19 -2
  20. package/es/components/DatePicker/plugins/rangePlugin.js +18 -14
  21. package/es/components/Dropdown/Dropdown.js +1 -12
  22. package/es/components/FeatureFlags/index.js +1 -0
  23. package/es/components/IconButton/index.js +1 -1
  24. package/es/components/Menu/MenuItem.d.ts +1 -1
  25. package/es/components/Menu/MenuItem.js +5 -5
  26. package/es/components/Modal/Modal.js +1 -1
  27. package/es/components/MultiSelect/FilterableMultiSelect.js +1 -1
  28. package/es/components/MultiSelect/MultiSelect.js +1 -12
  29. package/es/components/Notification/Notification.d.ts +6 -6
  30. package/es/components/Notification/Notification.js +6 -6
  31. package/es/components/OverflowMenu/OverflowMenu.js +1 -1
  32. package/es/components/OverflowMenu/next/index.js +1 -1
  33. package/es/components/Popover/index.js +1 -1
  34. package/es/components/Search/Search.d.ts +4 -2
  35. package/es/components/Search/Search.js +5 -4
  36. package/es/components/Slider/Slider.d.ts +144 -188
  37. package/es/components/Slider/Slider.js +787 -710
  38. package/es/components/Slider/index.d.ts +2 -2
  39. package/es/components/Tabs/Tabs.d.ts +4 -0
  40. package/es/components/TextArea/TextArea.js +13 -6
  41. package/es/components/TextInput/ControlledPasswordInput.js +2 -2
  42. package/es/components/TextInput/PasswordInput.js +2 -2
  43. package/es/components/TextInput/TextInput.js +2 -2
  44. package/es/components/TextInput/util.d.ts +17 -5
  45. package/es/components/TextInput/util.js +2 -7
  46. package/es/components/UIShell/HeaderPanel.d.ts +1 -1
  47. package/es/index.d.ts +12 -13
  48. package/es/index.js +25 -24
  49. package/es/internal/defaultItemToString.d.ts +7 -0
  50. package/es/internal/defaultItemToString.js +17 -0
  51. package/es/internal/index.d.ts +1 -0
  52. package/es/prop-types/deprecateValuesWithin.d.ts +8 -1
  53. package/es/prop-types/deprecateValuesWithin.js +6 -6
  54. package/es/prop-types/requiredIfGivenPropIsTruthy.d.ts +8 -7
  55. package/es/prop-types/requiredIfGivenPropIsTruthy.js +10 -10
  56. package/lib/components/CodeSnippet/CodeSnippet.d.ts +1 -1
  57. package/lib/components/CodeSnippet/CodeSnippet.js +1 -1
  58. package/lib/components/ComboBox/ComboBox.js +3 -14
  59. package/lib/components/ComboButton/index.js +1 -1
  60. package/lib/components/ComposedModal/ComposedModal.js +1 -1
  61. package/lib/components/Copy/Copy.d.ts +1 -1
  62. package/lib/components/Copy/Copy.js +1 -1
  63. package/lib/components/CopyButton/CopyButton.d.ts +1 -1
  64. package/lib/components/CopyButton/CopyButton.js +1 -1
  65. package/lib/components/DataTable/DataTable.d.ts +60 -15
  66. package/lib/components/DataTable/DataTable.js +106 -179
  67. package/lib/components/DataTable/Table.d.ts +2 -2
  68. package/lib/components/DataTable/Table.js +1 -1
  69. package/lib/components/DataTable/TableExpandHeader.d.ts +1 -1
  70. package/lib/components/DataTable/TableExpandHeader.js +3 -3
  71. package/lib/components/DatePicker/DatePicker.d.ts +0 -12
  72. package/lib/components/DatePicker/DatePicker.js +2 -2
  73. package/lib/components/DatePicker/plugins/rangePlugin.d.ts +19 -2
  74. package/lib/components/DatePicker/plugins/rangePlugin.js +18 -16
  75. package/lib/components/Dropdown/Dropdown.js +3 -14
  76. package/lib/components/FeatureFlags/index.js +1 -0
  77. package/lib/components/IconButton/index.js +1 -1
  78. package/lib/components/Menu/MenuItem.d.ts +1 -1
  79. package/lib/components/Menu/MenuItem.js +6 -6
  80. package/lib/components/Modal/Modal.js +1 -1
  81. package/lib/components/MultiSelect/FilterableMultiSelect.js +8 -8
  82. package/lib/components/MultiSelect/MultiSelect.js +2 -13
  83. package/lib/components/Notification/Notification.d.ts +6 -6
  84. package/lib/components/Notification/Notification.js +6 -6
  85. package/lib/components/OverflowMenu/OverflowMenu.js +1 -1
  86. package/lib/components/OverflowMenu/next/index.js +1 -1
  87. package/lib/components/Popover/index.js +1 -1
  88. package/lib/components/Search/Search.d.ts +4 -2
  89. package/lib/components/Search/Search.js +5 -4
  90. package/lib/components/Slider/Slider.d.ts +144 -188
  91. package/lib/components/Slider/Slider.js +784 -709
  92. package/lib/components/Slider/index.d.ts +2 -2
  93. package/lib/components/Tabs/Tabs.d.ts +4 -0
  94. package/lib/components/TextArea/TextArea.js +13 -6
  95. package/lib/components/TextInput/ControlledPasswordInput.js +1 -1
  96. package/lib/components/TextInput/PasswordInput.js +1 -1
  97. package/lib/components/TextInput/TextInput.js +1 -1
  98. package/lib/components/TextInput/util.d.ts +17 -5
  99. package/lib/components/TextInput/util.js +2 -7
  100. package/lib/components/UIShell/HeaderPanel.d.ts +1 -1
  101. package/lib/index.d.ts +12 -13
  102. package/lib/index.js +51 -28
  103. package/lib/internal/defaultItemToString.d.ts +7 -0
  104. package/lib/internal/defaultItemToString.js +19 -0
  105. package/lib/internal/index.d.ts +1 -0
  106. package/lib/prop-types/deprecateValuesWithin.d.ts +8 -1
  107. package/lib/prop-types/deprecateValuesWithin.js +6 -8
  108. package/lib/prop-types/requiredIfGivenPropIsTruthy.d.ts +8 -7
  109. package/lib/prop-types/requiredIfGivenPropIsTruthy.js +10 -12
  110. package/package.json +8 -7
  111. package/es/components/MultiSelect/tools/itemToString.d.ts +0 -1
  112. package/es/components/MultiSelect/tools/itemToString.js +0 -21
  113. package/es/components/Slider/index.js +0 -14
  114. package/es/internal/createClassWrapper.js +0 -23
  115. package/lib/components/MultiSelect/tools/itemToString.d.ts +0 -1
  116. package/lib/components/MultiSelect/tools/itemToString.js +0 -23
  117. package/lib/components/Slider/index.js +0 -20
  118. package/lib/internal/createClassWrapper.js +0 -25
@@ -20,7 +20,7 @@ declare const translationKeys: {
20
20
  readonly unselectRow: "carbon.table.row.unselect";
21
21
  };
22
22
  /**
23
- * Message ids that will be passed to translateWithId().
23
+ * Message IDs that will be passed to translateWithId().
24
24
  */
25
25
  type TranslationKey = (typeof translationKeys)[keyof typeof translationKeys];
26
26
  export type DataTableSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
@@ -35,7 +35,6 @@ export interface DataTableCell<T> {
35
35
  header: string;
36
36
  };
37
37
  hasAILabelHeader?: boolean;
38
- hasDecoratorHeader?: boolean;
39
38
  }
40
39
  type DataTableCells<T extends any[]> = {
41
40
  [K in keyof T]: DataTableCell<T[K]>;
@@ -54,8 +53,17 @@ export interface DataTableHeader {
54
53
  decorator?: ReactElement;
55
54
  }
56
55
  export interface DataTableRenderProps<RowType, ColTypes extends any[]> {
56
+ /**
57
+ * The headers for the table.
58
+ */
57
59
  headers: DataTableHeader[];
60
+ /**
61
+ * The rows for the table.
62
+ */
58
63
  rows: (DataTableRow<ColTypes> & RowType)[];
64
+ /**
65
+ * The rows that are currently selected.
66
+ */
59
67
  selectedRows: (DataTableRow<ColTypes> & RowType)[];
60
68
  getHeaderProps: (options: {
61
69
  header: DataTableHeader;
@@ -154,14 +162,36 @@ export interface DataTableRenderProps<RowType, ColTypes extends any[]> {
154
162
  }) => {
155
163
  [key: string]: unknown;
156
164
  hasAILabelHeader?: boolean;
157
- hasDecoratorHeader?: boolean;
165
+ key: string;
158
166
  };
167
+ /**
168
+ * Handles input value changes.
169
+ */
159
170
  onInputChange: (event: ChangeEvent<HTMLInputElement>, defaultValue?: string) => void;
171
+ /**
172
+ * Sorts the table by a specific header.
173
+ */
160
174
  sortBy: (headerKey: string) => void;
175
+ /**
176
+ * Selects all rows.
177
+ */
161
178
  selectAll: () => void;
179
+ /**
180
+ * Selects or deselects a specific row.
181
+ */
162
182
  selectRow: (rowId: string) => void;
183
+ /**
184
+ * Expands or collapses a specific row.
185
+ */
163
186
  expandRow: (rowId: string) => void;
187
+ /**
188
+ * Expands or collapses all rows.
189
+ */
164
190
  expandAll: () => void;
191
+ /**
192
+ * Whether the table is using radio buttons for selection instead of
193
+ * checkboxes.
194
+ */
165
195
  radio: boolean | undefined;
166
196
  }
167
197
  export interface DataTableProps<RowType, ColTypes extends any[]> extends TranslateWithId<TranslationKey> {
@@ -179,6 +209,12 @@ export interface DataTableProps<RowType, ColTypes extends any[]> extends Transla
179
209
  locale?: string;
180
210
  overflowMenuOnHover?: boolean;
181
211
  radio?: boolean;
212
+ /**
213
+ * @deprecated Use `children` instead. This prop will be removed in
214
+ * the next major version.
215
+ *
216
+ * https://www.patterns.dev/react/render-props-pattern/#children-as-a-function
217
+ */
182
218
  render?: (renderProps: DataTableRenderProps<RowType, ColTypes>) => ReactElement;
183
219
  rows: Omit<DataTableRow<ColTypes>, 'cells'>[];
184
220
  size?: DataTableSize;
@@ -188,14 +224,12 @@ export interface DataTableProps<RowType, ColTypes extends any[]> extends Transla
188
224
  useZebraStyles?: boolean;
189
225
  }
190
226
  /**
191
- * Data Tables are used to represent a collection of resources, displaying a
192
- * subset of their fields in columns, or headers. We prioritize direct updates
193
- * to the state of what we're rendering, so internally we end up normalizing the
194
- * given data and then denormalizing it when rendering.
195
- *
196
- * As a result, each part of the DataTable is accessible through look-up by id,
197
- * and updating the state of the single entity will cascade updates to the
198
- * consumer.
227
+ * DataTable components are used to represent a collection of resources,
228
+ * displaying a subset of their fields in columns, or headers. We prioritize
229
+ * direct updates to the state of what we're rendering, so internally we
230
+ * normalize the given data and then denormalize it at render time. Each part of
231
+ * the DataTable is accessible through look-up by ID, and updating the state of
232
+ * a single entity cascades updates to the consumer.
199
233
  */
200
234
  export declare const DataTable: {
201
235
  <RowType, ColTypes extends any[]>(props: DataTableProps<RowType, ColTypes>): React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | null;
@@ -266,7 +300,7 @@ export declare const DataTable: {
266
300
  enableToggle: PropTypes.Requireable<boolean>;
267
301
  expandIconDescription: PropTypes.Requireable<string>;
268
302
  id: PropTypes.Requireable<string>;
269
- isExpanded: React.Validator;
303
+ isExpanded: PropTypes.Validator<boolean | null | undefined>;
270
304
  onExpand: PropTypes.Requireable<any>;
271
305
  };
272
306
  };
@@ -348,6 +382,10 @@ export declare const DataTable: {
348
382
  };
349
383
  TableToolbarMenu: React.FC<import("./TableToolbarMenu").TableToolbarMenuProps>;
350
384
  propTypes: {
385
+ /**
386
+ * Pass in the children that will be rendered within the Table
387
+ */
388
+ children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
351
389
  /**
352
390
  * Experimental property. Allows table to align cell contents to the top if there is text wrapping in the content. Might have performance issues, intended for smaller tables
353
391
  */
@@ -383,6 +421,13 @@ export declare const DataTable: {
383
421
  * Specify whether the control should be a radio button or inline checkbox
384
422
  */
385
423
  radio: PropTypes.Requireable<boolean>;
424
+ /**
425
+ * @deprecated Use `children` instead. This prop will be removed in
426
+ * the next major version.
427
+ *
428
+ * https://www.patterns.dev/react/render-props-pattern/#children-as-a-function
429
+ */
430
+ render: (props: Record<string, any>, propName: string, componentName: string, ...rest: any[]) => any;
386
431
  /**
387
432
  * The `rows` prop is where you provide us with a list of all the rows that
388
433
  * you want to render in the table. The only hard requirement is that this
@@ -409,13 +454,13 @@ export declare const DataTable: {
409
454
  */
410
455
  stickyHeader: PropTypes.Requireable<boolean>;
411
456
  /**
412
- * Optional method that takes in a message id and returns an
457
+ * Optional method that takes in a message ID and returns an
413
458
  * internationalized string. See `DataTable.translationKeys` for all
414
- * available message ids.
459
+ * available message IDs.
415
460
  */
416
461
  translateWithId: PropTypes.Requireable<(...args: any[]) => any>;
417
462
  /**
418
- * `false` If true, will use a width of 'auto' instead of 100%
463
+ * If `true`, sets the table width to `auto` instead of `100%`.
419
464
  */
420
465
  useStaticWidth: PropTypes.Requireable<boolean>;
421
466
  /**