@carbon/react 1.44.0-rc.0 → 1.45.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 (140) hide show
  1. package/.playwright/INTERNAL_AVT_REPORT_DO_NOT_USE.json +1009 -1050
  2. package/es/components/Accordion/AccordionItem.d.ts +1 -1
  3. package/es/components/Accordion/AccordionItem.js +19 -15
  4. package/es/components/Checkbox/Checkbox.d.ts +4 -0
  5. package/es/components/Checkbox/Checkbox.js +15 -2
  6. package/es/components/CheckboxGroup/CheckboxGroup.js +17 -2
  7. package/es/components/ComboBox/ComboBox.d.ts +1 -1
  8. package/es/components/ComboBox/ComboBox.js +1 -1
  9. package/es/components/ComboButton/index.js +1 -1
  10. package/es/components/ComposedModal/ModalFooter.d.ts +2 -1
  11. package/es/components/DataTable/DataTable.d.ts +2 -0
  12. package/es/components/DataTable/DataTable.js +3 -0
  13. package/es/components/DataTable/TableExpandRow.js +20 -3
  14. package/es/components/DataTable/TableHeader.d.ts +5 -0
  15. package/es/components/DataTable/TableHeader.js +30 -6
  16. package/es/components/DataTable/TableSlugRow.d.ts +31 -0
  17. package/es/components/DataTable/TableSlugRow.js +49 -0
  18. package/es/components/DataTable/index.d.ts +2 -1
  19. package/es/components/DataTable/index.js +3 -0
  20. package/es/components/DataTable/tools/sorting.js +1 -1
  21. package/es/components/DatePickerInput/DatePickerInput.d.ts +1 -1
  22. package/es/components/DatePickerInput/DatePickerInput.js +1 -1
  23. package/es/components/Dropdown/Dropdown.d.ts +1 -1
  24. package/es/components/Dropdown/Dropdown.js +1 -1
  25. package/es/components/FileUploader/FileUploader.js +5 -3
  26. package/es/components/Grid/Column.js +11 -1
  27. package/es/components/InlineLoading/InlineLoading.d.ts +68 -0
  28. package/es/components/InlineLoading/InlineLoading.js +4 -4
  29. package/es/components/InlineLoading/index.d.ts +9 -0
  30. package/es/components/Layer/LayerContext.d.ts +8 -0
  31. package/es/components/Layer/LayerLevel.d.ts +5 -0
  32. package/es/components/Layer/LayerLevel.js +12 -0
  33. package/es/components/Layer/index.d.ts +38 -0
  34. package/es/components/Layer/index.js +9 -8
  35. package/es/components/Menu/MenuItem.js +2 -1
  36. package/es/components/MenuButton/index.js +8 -2
  37. package/es/components/Modal/Modal.d.ts +3 -2
  38. package/es/components/MultiSelect/FilterableMultiSelect.js +1 -1
  39. package/es/components/MultiSelect/MultiSelect.d.ts +1 -1
  40. package/es/components/MultiSelect/MultiSelect.js +1 -1
  41. package/es/components/Notification/Notification.js +1 -0
  42. package/es/components/NumberInput/NumberInput.d.ts +1 -1
  43. package/es/components/NumberInput/NumberInput.js +1 -1
  44. package/es/components/RadioButton/RadioButton.d.ts +4 -0
  45. package/es/components/RadioButton/RadioButton.js +15 -2
  46. package/es/components/RadioButtonGroup/RadioButtonGroup.d.ts +4 -0
  47. package/es/components/RadioButtonGroup/RadioButtonGroup.js +17 -2
  48. package/es/components/Select/Select.d.ts +2 -2
  49. package/es/components/Select/Select.js +1 -1
  50. package/es/components/Slider/Slider.Skeleton.js +17 -3
  51. package/es/components/Slider/Slider.js +132 -93
  52. package/es/components/Slider/SliderHandles.d.ts +4 -0
  53. package/es/components/Slider/SliderHandles.js +65 -0
  54. package/es/components/Slug/index.js +1 -1
  55. package/es/components/Tabs/Tabs.js +1 -1
  56. package/es/components/TextArea/TextArea.d.ts +7 -3
  57. package/es/components/TextArea/TextArea.js +84 -17
  58. package/es/components/TextInput/TextInput.d.ts +1 -1
  59. package/es/components/TextInput/TextInput.js +1 -1
  60. package/es/components/Tile/Tile.d.ts +37 -0
  61. package/es/components/Tile/Tile.js +114 -13
  62. package/es/components/Tooltip/Tooltip.js +48 -2
  63. package/es/components/UIShell/Content.d.ts +296 -0
  64. package/es/components/UIShell/Content.js +1 -2
  65. package/es/components/UIShell/HeaderPanel.d.ts +36 -0
  66. package/es/components/UIShell/HeaderPanel.js +6 -6
  67. package/es/components/UIShell/SideNav.d.ts +1 -1
  68. package/es/index.js +2 -1
  69. package/es/internal/useAnnouncer.js +2 -1
  70. package/es/internal/useNoInteractiveChildren.js +2 -6
  71. package/lib/components/Accordion/AccordionItem.d.ts +1 -1
  72. package/lib/components/Accordion/AccordionItem.js +18 -14
  73. package/lib/components/Checkbox/Checkbox.d.ts +4 -0
  74. package/lib/components/Checkbox/Checkbox.js +15 -2
  75. package/lib/components/CheckboxGroup/CheckboxGroup.js +17 -2
  76. package/lib/components/ComboBox/ComboBox.d.ts +1 -1
  77. package/lib/components/ComboBox/ComboBox.js +1 -1
  78. package/lib/components/ComboButton/index.js +1 -1
  79. package/lib/components/ComposedModal/ModalFooter.d.ts +2 -1
  80. package/lib/components/DataTable/DataTable.d.ts +2 -0
  81. package/lib/components/DataTable/DataTable.js +3 -0
  82. package/lib/components/DataTable/TableExpandRow.js +20 -3
  83. package/lib/components/DataTable/TableHeader.d.ts +5 -0
  84. package/lib/components/DataTable/TableHeader.js +29 -5
  85. package/lib/components/DataTable/TableSlugRow.d.ts +31 -0
  86. package/lib/components/DataTable/TableSlugRow.js +59 -0
  87. package/lib/components/DataTable/index.d.ts +2 -1
  88. package/lib/components/DataTable/index.js +3 -0
  89. package/lib/components/DataTable/tools/sorting.js +1 -1
  90. package/lib/components/DatePickerInput/DatePickerInput.d.ts +1 -1
  91. package/lib/components/DatePickerInput/DatePickerInput.js +1 -1
  92. package/lib/components/Dropdown/Dropdown.d.ts +1 -1
  93. package/lib/components/Dropdown/Dropdown.js +1 -1
  94. package/lib/components/FileUploader/FileUploader.js +5 -3
  95. package/lib/components/Grid/Column.js +11 -1
  96. package/lib/components/InlineLoading/InlineLoading.d.ts +68 -0
  97. package/lib/components/InlineLoading/InlineLoading.js +4 -4
  98. package/lib/components/InlineLoading/index.d.ts +9 -0
  99. package/lib/components/Layer/LayerContext.d.ts +8 -0
  100. package/lib/components/Layer/LayerLevel.d.ts +5 -0
  101. package/lib/components/Layer/LayerLevel.js +18 -0
  102. package/lib/components/Layer/index.d.ts +38 -0
  103. package/lib/components/Layer/index.js +10 -9
  104. package/lib/components/Menu/MenuItem.js +2 -1
  105. package/lib/components/MenuButton/index.js +8 -2
  106. package/lib/components/Modal/Modal.d.ts +3 -2
  107. package/lib/components/MultiSelect/FilterableMultiSelect.js +1 -1
  108. package/lib/components/MultiSelect/MultiSelect.d.ts +1 -1
  109. package/lib/components/MultiSelect/MultiSelect.js +1 -1
  110. package/lib/components/Notification/Notification.js +1 -0
  111. package/lib/components/NumberInput/NumberInput.d.ts +1 -1
  112. package/lib/components/NumberInput/NumberInput.js +1 -1
  113. package/lib/components/RadioButton/RadioButton.d.ts +4 -0
  114. package/lib/components/RadioButton/RadioButton.js +15 -2
  115. package/lib/components/RadioButtonGroup/RadioButtonGroup.d.ts +4 -0
  116. package/lib/components/RadioButtonGroup/RadioButtonGroup.js +17 -2
  117. package/lib/components/Select/Select.d.ts +2 -2
  118. package/lib/components/Select/Select.js +1 -1
  119. package/lib/components/Slider/Slider.Skeleton.js +17 -3
  120. package/lib/components/Slider/Slider.js +132 -93
  121. package/lib/components/Slider/SliderHandles.d.ts +4 -0
  122. package/lib/components/Slider/SliderHandles.js +76 -0
  123. package/lib/components/Slug/index.js +1 -1
  124. package/lib/components/Tabs/Tabs.js +1 -1
  125. package/lib/components/TextArea/TextArea.d.ts +7 -3
  126. package/lib/components/TextArea/TextArea.js +83 -16
  127. package/lib/components/TextInput/TextInput.d.ts +1 -1
  128. package/lib/components/TextInput/TextInput.js +1 -1
  129. package/lib/components/Tile/Tile.d.ts +37 -0
  130. package/lib/components/Tile/Tile.js +114 -13
  131. package/lib/components/Tooltip/Tooltip.js +47 -1
  132. package/lib/components/UIShell/Content.d.ts +296 -0
  133. package/lib/components/UIShell/Content.js +1 -2
  134. package/lib/components/UIShell/HeaderPanel.d.ts +36 -0
  135. package/lib/components/UIShell/HeaderPanel.js +7 -7
  136. package/lib/components/UIShell/SideNav.d.ts +1 -1
  137. package/lib/index.js +4 -2
  138. package/lib/internal/useAnnouncer.js +2 -1
  139. package/lib/internal/useNoInteractiveChildren.js +2 -6
  140. package/package.json +5 -8
@@ -36,6 +36,7 @@ function CheckboxGroup(_ref) {
36
36
  readOnly,
37
37
  warn,
38
38
  warnText,
39
+ slug,
39
40
  ...rest
40
41
  } = _ref;
41
42
  const prefix = usePrefix.usePrefix();
@@ -50,8 +51,18 @@ function CheckboxGroup(_ref) {
50
51
  const fieldsetClasses = cx__default["default"](`${prefix}--checkbox-group`, className, {
51
52
  [`${prefix}--checkbox-group--readonly`]: readOnly,
52
53
  [`${prefix}--checkbox-group--invalid`]: !readOnly && invalid,
53
- [`${prefix}--checkbox-group--warning`]: showWarning
54
+ [`${prefix}--checkbox-group--warning`]: showWarning,
55
+ [`${prefix}--checkbox-group--slug`]: slug
54
56
  });
57
+
58
+ // Slug is always size `mini`
59
+ let normalizedSlug;
60
+ if (slug) {
61
+ normalizedSlug = /*#__PURE__*/React__default["default"].cloneElement(slug, {
62
+ size: 'mini',
63
+ kind: 'default'
64
+ });
65
+ }
55
66
  return /*#__PURE__*/React__default["default"].createElement("fieldset", _rollupPluginBabelHelpers["extends"]({
56
67
  className: fieldsetClasses,
57
68
  "data-invalid": invalid ? true : undefined,
@@ -61,7 +72,7 @@ function CheckboxGroup(_ref) {
61
72
  }, rest), /*#__PURE__*/React__default["default"].createElement("legend", {
62
73
  className: `${prefix}--label`,
63
74
  id: legendId || rest['aria-labelledby']
64
- }, legendText), children, /*#__PURE__*/React__default["default"].createElement("div", {
75
+ }, legendText, normalizedSlug), children, /*#__PURE__*/React__default["default"].createElement("div", {
65
76
  className: `${prefix}--checkbox-group__validation-msg`
66
77
  }, !readOnly && invalid && /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement(iconsReact.WarningFilled, {
67
78
  className: `${prefix}--checkbox__invalid-icon`
@@ -107,6 +118,10 @@ CheckboxGroup.propTypes = {
107
118
  * Whether the CheckboxGroup should be read-only
108
119
  */
109
120
  readOnly: PropTypes__default["default"].bool,
121
+ /**
122
+ * **Experimental**: Provide a `Slug` component to be rendered inside the `CheckboxGroup` component
123
+ */
124
+ slug: PropTypes__default["default"].node,
110
125
  /**
111
126
  * Specify whether the form group is currently in warning state
112
127
  */
@@ -137,7 +137,7 @@ export interface ComboBoxProps<ItemType> extends Omit<InputHTMLAttributes<HTMLIn
137
137
  */
138
138
  size?: ListBoxSize;
139
139
  /**
140
- * Provide a `Slug` component to be rendered inside the `ComboBox` component
140
+ * **Experimental**: Provide a `Slug` component to be rendered inside the `ComboBox` component
141
141
  */
142
142
  slug?: ReactNodeLike;
143
143
  /**
@@ -586,7 +586,7 @@ ComboBox.propTypes = {
586
586
  */
587
587
  size: ListBoxPropTypes.ListBoxSize,
588
588
  /**
589
- * Provide a `Slug` component to be rendered inside the `ComboBox` component
589
+ * **Experimental**: Provide a `Slug` component to be rendered inside the `ComboBox` component
590
590
  */
591
591
  slug: PropTypes__default["default"].node,
592
592
  /**
@@ -30,7 +30,7 @@ var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
30
30
  var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
31
31
 
32
32
  var _ChevronDown;
33
- const spacing = 4; // top and bottom spacing between the button and the menu. in px
33
+ const spacing = 0; // top and bottom spacing between the button and the menu. in px
34
34
  const defaultTranslations = {
35
35
  'carbon.combo-button.additional-actions': 'Additional actions'
36
36
  };
@@ -1,4 +1,5 @@
1
1
  import React, { type ReactNode, type MouseEvent, type Ref } from 'react';
2
+ import { InlineLoadingStatus } from '../InlineLoading/InlineLoading';
2
3
  interface SecondaryButtonProps {
3
4
  buttonText: ReactNode;
4
5
  onClick(evt: MouseEvent): void;
@@ -70,7 +71,7 @@ export interface ModalFooterProps {
70
71
  /**
71
72
  * loading status
72
73
  */
73
- loadingStatus?: string;
74
+ loadingStatus?: InlineLoadingStatus;
74
75
  /**
75
76
  * Specify the description for the loading text
76
77
  */
@@ -22,6 +22,7 @@ import TableHeader from './TableHeader';
22
22
  import TableRow from './TableRow';
23
23
  import TableSelectAll from './TableSelectAll';
24
24
  import TableSelectRow from './TableSelectRow';
25
+ import TableSlugRow from './TableSlugRow';
25
26
  import TableToolbar from './TableToolbar';
26
27
  import TableToolbarAction from './TableToolbarAction';
27
28
  import TableToolbarContent from './TableToolbarContent';
@@ -302,6 +303,7 @@ declare class DataTable<RowType, ColTypes extends any[]> extends React.Component
302
303
  static TableRow: typeof TableRow;
303
304
  static TableSelectAll: typeof TableSelectAll;
304
305
  static TableSelectRow: typeof TableSelectRow;
306
+ static TableSlugRow: typeof TableSlugRow;
305
307
  static TableToolbar: typeof TableToolbar;
306
308
  static TableToolbarAction: typeof TableToolbarAction;
307
309
  static TableToolbarContent: typeof TableToolbarContent;
@@ -35,6 +35,7 @@ var TableHeader = require('./TableHeader.js');
35
35
  var TableRow = require('./TableRow.js');
36
36
  var TableSelectAll = require('./TableSelectAll.js');
37
37
  var TableSelectRow = require('./TableSelectRow.js');
38
+ var TableSlugRow = require('./TableSlugRow.js');
38
39
  var TableToolbar = require('./TableToolbar.js');
39
40
  var TableToolbarAction = require('./TableToolbarAction.js');
40
41
  var TableToolbarContent = require('./TableToolbarContent.js');
@@ -733,6 +734,7 @@ _rollupPluginBabelHelpers.defineProperty(DataTable, "TableHeader", void 0);
733
734
  _rollupPluginBabelHelpers.defineProperty(DataTable, "TableRow", void 0);
734
735
  _rollupPluginBabelHelpers.defineProperty(DataTable, "TableSelectAll", void 0);
735
736
  _rollupPluginBabelHelpers.defineProperty(DataTable, "TableSelectRow", void 0);
737
+ _rollupPluginBabelHelpers.defineProperty(DataTable, "TableSlugRow", void 0);
736
738
  _rollupPluginBabelHelpers.defineProperty(DataTable, "TableToolbar", void 0);
737
739
  _rollupPluginBabelHelpers.defineProperty(DataTable, "TableToolbarAction", void 0);
738
740
  _rollupPluginBabelHelpers.defineProperty(DataTable, "TableToolbarContent", void 0);
@@ -753,6 +755,7 @@ DataTable.TableHeader = TableHeader["default"];
753
755
  DataTable.TableRow = TableRow["default"];
754
756
  DataTable.TableSelectAll = TableSelectAll["default"];
755
757
  DataTable.TableSelectRow = TableSelectRow["default"];
758
+ DataTable.TableSlugRow = TableSlugRow["default"];
756
759
  DataTable.TableToolbar = TableToolbar["default"];
757
760
  DataTable.TableToolbarAction = TableToolbarAction["default"];
758
761
  DataTable.TableToolbarContent = TableToolbarContent["default"];
@@ -38,17 +38,34 @@ const TableExpandRow = /*#__PURE__*/React__default["default"].forwardRef((_ref,
38
38
  ...rest
39
39
  } = _ref;
40
40
  const prefix = usePrefix.usePrefix();
41
+
42
+ // We need to put the slug before the expansion arrow and all other table cells after the arrow.
43
+ let rowHasSlug;
44
+ const slug = React__default["default"].Children.toArray(children).map(child => {
45
+ if (child.type?.displayName === 'TableSlugRow') {
46
+ if (child.props.slug) {
47
+ rowHasSlug = true;
48
+ }
49
+ return child;
50
+ }
51
+ });
52
+ const normalizedChildren = React__default["default"].Children.toArray(children).map(child => {
53
+ if (child.type?.displayName !== 'TableSlugRow') {
54
+ return child;
55
+ }
56
+ });
41
57
  const className = cx__default["default"]({
42
58
  [`${prefix}--parent-row`]: true,
43
59
  [`${prefix}--expandable-row`]: isExpanded,
44
- [`${prefix}--data-table--selected`]: isSelected
60
+ [`${prefix}--data-table--selected`]: isSelected,
61
+ [`${prefix}--parent-row--slug`]: rowHasSlug
45
62
  }, rowClassName);
46
63
  const previousValue = isExpanded ? 'collapsed' : undefined;
47
64
  return /*#__PURE__*/React__default["default"].createElement("tr", _rollupPluginBabelHelpers["extends"]({}, rest, {
48
65
  ref: ref,
49
66
  className: className,
50
67
  "data-parent-row": true
51
- }), /*#__PURE__*/React__default["default"].createElement(TableCell["default"], {
68
+ }), slug, /*#__PURE__*/React__default["default"].createElement(TableCell["default"], {
52
69
  className: `${prefix}--table-expand`,
53
70
  "data-previous-value": previousValue,
54
71
  headers: expandHeader
@@ -63,7 +80,7 @@ const TableExpandRow = /*#__PURE__*/React__default["default"].forwardRef((_ref,
63
80
  }, /*#__PURE__*/React__default["default"].createElement(iconsReact.ChevronRight, {
64
81
  className: `${prefix}--table-expand__svg`,
65
82
  "aria-label": expandIconDescription
66
- }))), children);
83
+ }))), normalizedChildren);
67
84
  });
68
85
  TableExpandRow.propTypes = {
69
86
  /**
@@ -4,6 +4,7 @@
4
4
  * This source code is licensed under the Apache-2.0 license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
+ import { ReactNodeLike } from 'prop-types';
7
8
  import React, { MouseEventHandler } from 'react';
8
9
  import { ReactAttr } from '../../types/common';
9
10
  interface TableHeaderProps extends ReactAttr<HTMLTableCellElement & HTMLButtonElement> {
@@ -43,6 +44,10 @@ interface TableHeaderProps extends ReactAttr<HTMLTableCellElement & HTMLButtonEl
43
44
  * https://developer.mozilla.org/en-US/docs/Web/HTML/Element/th#attr-scope
44
45
  */
45
46
  scope?: string;
47
+ /**
48
+ * **Experimental**: Provide a `Slug` component to be rendered inside the `TableSlugRow` component
49
+ */
50
+ slug?: ReactNodeLike;
46
51
  /**
47
52
  * Specify which direction we are currently sorting by, should be one of DESC,
48
53
  * NONE, or ASC.
@@ -62,11 +62,26 @@ const TableHeader = /*#__PURE__*/React__default["default"].forwardRef(function T
62
62
  scope = defaultScope,
63
63
  sortDirection,
64
64
  translateWithId: t = translateWithId,
65
+ slug,
65
66
  id,
66
67
  ...rest
67
68
  } = _ref;
68
69
  const prefix = usePrefix.usePrefix();
69
70
  const uniqueId = useId.useId('table-sort');
71
+
72
+ // Slug is always size `mini`
73
+ const slugRef = React.useRef(null);
74
+ let normalizedSlug;
75
+ if (slug) {
76
+ normalizedSlug = /*#__PURE__*/React__default["default"].cloneElement(slug, {
77
+ size: 'mini',
78
+ ref: slugRef
79
+ });
80
+ }
81
+ const headerLabelClassNames = cx__default["default"]({
82
+ [`${prefix}--table-header-label`]: true,
83
+ [`${prefix}--table-header-label--slug`]: slug
84
+ });
70
85
  if (!isSortable) {
71
86
  return /*#__PURE__*/React__default["default"].createElement("th", _rollupPluginBabelHelpers["extends"]({}, rest, {
72
87
  id: id,
@@ -75,8 +90,8 @@ const TableHeader = /*#__PURE__*/React__default["default"].forwardRef(function T
75
90
  colSpan: colSpan,
76
91
  ref: ref
77
92
  }), children ? /*#__PURE__*/React__default["default"].createElement("div", {
78
- className: `${prefix}--table-header-label`
79
- }, children) : null);
93
+ className: headerLabelClassNames
94
+ }, children, normalizedSlug) : null);
80
95
  }
81
96
  const className = cx__default["default"](headerClassName, {
82
97
  [`${prefix}--table-sort`]: true,
@@ -90,7 +105,16 @@ const TableHeader = /*#__PURE__*/React__default["default"].forwardRef(function T
90
105
  isSortHeader,
91
106
  sortStates: sortStates.sortStates
92
107
  });
93
- const headerClasses = cx__default["default"](headerClassName, `${prefix}--table-sort__header`);
108
+ const headerClasses = cx__default["default"](headerClassName, `${prefix}--table-sort__header`, {
109
+ [`${prefix}--table-sort__header--slug`]: slug
110
+ });
111
+ const handleClick = evt => {
112
+ if (slug && slugRef.current && slugRef.current.contains(evt.target)) {
113
+ return;
114
+ } else if (onClick) {
115
+ return onClick(evt);
116
+ }
117
+ };
94
118
  return /*#__PURE__*/React__default["default"].createElement("th", {
95
119
  id: id,
96
120
  "aria-sort": ariaSort,
@@ -105,12 +129,12 @@ const TableHeader = /*#__PURE__*/React__default["default"].forwardRef(function T
105
129
  type: "button",
106
130
  "aria-describedby": uniqueId,
107
131
  className: className,
108
- onClick: onClick
132
+ onClick: handleClick
109
133
  }, rest), /*#__PURE__*/React__default["default"].createElement("span", {
110
134
  className: `${prefix}--table-sort__flex`
111
135
  }, /*#__PURE__*/React__default["default"].createElement("div", {
112
136
  className: `${prefix}--table-header-label`
113
- }, children), /*#__PURE__*/React__default["default"].createElement(iconsReact.ArrowUp, {
137
+ }, children), normalizedSlug, /*#__PURE__*/React__default["default"].createElement(iconsReact.ArrowUp, {
114
138
  size: 20,
115
139
  className: `${prefix}--table-sort__icon`
116
140
  }), /*#__PURE__*/React__default["default"].createElement(iconsReact.ArrowsVertical, {
@@ -0,0 +1,31 @@
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, { ReactNodeLike } from 'prop-types';
8
+ export interface TableSlugRowProps {
9
+ /**
10
+ * The CSS class names of the cell that wraps the underlying input control
11
+ */
12
+ className?: string;
13
+ /**
14
+ * Provide a `Slug` component to be rendered inside the `TableSlugRow` component
15
+ */
16
+ slug?: ReactNodeLike;
17
+ }
18
+ declare const TableSlugRow: {
19
+ ({ className, slug }: TableSlugRowProps): JSX.Element;
20
+ propTypes: {
21
+ /**
22
+ * The CSS class names of the cell that wraps the underlying input control
23
+ */
24
+ className: PropTypes.Requireable<string>;
25
+ /**
26
+ * Provide a `Slug` component to be rendered inside the `TableSlugRow` component
27
+ */
28
+ slug: PropTypes.Requireable<PropTypes.ReactNodeLike>;
29
+ };
30
+ };
31
+ export default TableSlugRow;
@@ -0,0 +1,59 @@
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 PropTypes = require('prop-types');
13
+ var React = require('react');
14
+ var cx = require('classnames');
15
+ var usePrefix = require('../../internal/usePrefix.js');
16
+
17
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
18
+
19
+ var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
20
+ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
21
+ var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
22
+
23
+ const TableSlugRow = _ref => {
24
+ let {
25
+ className,
26
+ slug
27
+ } = _ref;
28
+ const prefix = usePrefix.usePrefix();
29
+ const TableSlugRowClasses = cx__default["default"]({
30
+ ...(className && {
31
+ [className]: true
32
+ }),
33
+ [`${prefix}--table-column-slug`]: true,
34
+ [`${prefix}--table-column-slug--active`]: slug
35
+ });
36
+
37
+ // Slug is always size `mini`
38
+ let normalizedSlug;
39
+ if (slug) {
40
+ normalizedSlug = /*#__PURE__*/React__default["default"].cloneElement(slug, {
41
+ size: 'mini'
42
+ });
43
+ }
44
+ return /*#__PURE__*/React__default["default"].createElement("td", {
45
+ className: TableSlugRowClasses
46
+ }, normalizedSlug);
47
+ };
48
+ TableSlugRow.propTypes = {
49
+ /**
50
+ * The CSS class names of the cell that wraps the underlying input control
51
+ */
52
+ className: PropTypes__default["default"].string,
53
+ /**
54
+ * Provide a `Slug` component to be rendered inside the `TableSlugRow` component
55
+ */
56
+ slug: PropTypes__default["default"].node
57
+ };
58
+
59
+ exports["default"] = TableSlugRow;
@@ -20,10 +20,11 @@ import TableHeader from './TableHeader';
20
20
  import TableRow from './TableRow';
21
21
  import TableSelectAll from './TableSelectAll';
22
22
  import TableSelectRow from './TableSelectRow';
23
+ import TableSlugRow from './TableSlugRow';
23
24
  import TableToolbar from './TableToolbar';
24
25
  import TableToolbarAction from './TableToolbarAction';
25
26
  import TableToolbarContent from './TableToolbarContent';
26
27
  import TableToolbarSearch from './TableToolbarSearch';
27
28
  import TableToolbarMenu from './TableToolbarMenu';
28
- export { DataTable, type DataTableCell, type DataTableHeader, type DataTableProps, type DataTableRenderProps, type DataTableRow, type DataTableSize, Table, TableActionList, TableBatchAction, TableBatchActions, TableBody, TableCell, TableContainer, TableExpandHeader, TableExpandRow, TableExpandedRow, TableHead, TableHeader, TableRow, TableSelectAll, TableSelectRow, TableToolbar, TableToolbarAction, TableToolbarContent, TableToolbarSearch, TableToolbarMenu, };
29
+ export { DataTable, type DataTableCell, type DataTableHeader, type DataTableProps, type DataTableRenderProps, type DataTableRow, type DataTableSize, Table, TableActionList, TableBatchAction, TableBatchActions, TableBody, TableCell, TableContainer, TableExpandHeader, TableExpandRow, TableExpandedRow, TableHead, TableHeader, TableRow, TableSelectAll, TableSelectRow, TableSlugRow, TableToolbar, TableToolbarAction, TableToolbarContent, TableToolbarSearch, TableToolbarMenu, };
29
30
  export default DataTable;
@@ -25,6 +25,7 @@ var TableHeader = require('./TableHeader.js');
25
25
  var TableRow = require('./TableRow.js');
26
26
  var TableSelectAll = require('./TableSelectAll.js');
27
27
  var TableSelectRow = require('./TableSelectRow.js');
28
+ var TableSlugRow = require('./TableSlugRow.js');
28
29
  var TableToolbar = require('./TableToolbar.js');
29
30
  var TableToolbarAction = require('./TableToolbarAction.js');
30
31
  var TableToolbarContent = require('./TableToolbarContent.js');
@@ -46,6 +47,7 @@ DataTable["default"].TableHeader = TableHeader["default"];
46
47
  DataTable["default"].TableRow = TableRow["default"];
47
48
  DataTable["default"].TableSelectAll = TableSelectAll["default"];
48
49
  DataTable["default"].TableSelectRow = TableSelectRow["default"];
50
+ DataTable["default"].TableSlugRow = TableSlugRow["default"];
49
51
  DataTable["default"].TableToolbar = TableToolbar["default"];
50
52
  DataTable["default"].TableToolbarAction = TableToolbarAction["default"];
51
53
  DataTable["default"].TableToolbarContent = TableToolbarContent["default"];
@@ -69,6 +71,7 @@ exports.TableHeader = TableHeader["default"];
69
71
  exports.TableRow = TableRow["default"];
70
72
  exports.TableSelectAll = TableSelectAll["default"];
71
73
  exports.TableSelectRow = TableSelectRow["default"];
74
+ exports.TableSlugRow = TableSlugRow["default"];
72
75
  exports.TableToolbar = TableToolbar["default"];
73
76
  exports.TableToolbarAction = TableToolbarAction["default"];
74
77
  exports.TableToolbarContent = TableToolbarContent["default"];
@@ -37,7 +37,7 @@ const compare = function (a, b) {
37
37
 
38
38
  // if column has React elements, this should sort by the child string if there is one
39
39
  if (typeof a === 'object' && typeof b === 'object') {
40
- if (typeof a.props.children === 'string' && typeof b.props.children === 'string') {
40
+ if (typeof a.props?.children === 'string' && typeof b.props?.children === 'string') {
41
41
  return compareStrings(a.props.children, b.props.children, locale);
42
42
  }
43
43
  }
@@ -77,7 +77,7 @@ interface DatePickerInputProps extends Omit<ReactAttr<HTMLInputElement>, Exclude
77
77
  */
78
78
  size?: 'sm' | 'md' | 'lg';
79
79
  /**
80
- * Provide a `Slug` component to be rendered inside the `DatePickerInput` component
80
+ * **Experimental**: Provide a `Slug` component to be rendered inside the `DatePickerInput` component
81
81
  */
82
82
  slug?: ReactNodeLike;
83
83
  /**
@@ -216,7 +216,7 @@ DatePickerInput.propTypes = {
216
216
  */
217
217
  size: PropTypes__default["default"].oneOf(['sm', 'md', 'lg']),
218
218
  /**
219
- * Provide a `Slug` component to be rendered inside the `DatePickerInput` component
219
+ * **Experimental**: Provide a `Slug` component to be rendered inside the `DatePickerInput` component
220
220
  */
221
221
  slug: PropTypes__default["default"].node,
222
222
  /**
@@ -112,7 +112,7 @@ export interface DropdownProps<ItemType> extends Omit<ReactAttr<HTMLDivElement>,
112
112
  */
113
113
  size?: ListBoxSize;
114
114
  /**
115
- * Provide a `Slug` component to be rendered inside the `Dropdown` component
115
+ * **Experimental**: Provide a `Slug` component to be rendered inside the `Dropdown` component
116
116
  */
117
117
  slug?: ReactNodeLike;
118
118
  /**
@@ -406,7 +406,7 @@ Dropdown.propTypes = {
406
406
  */
407
407
  size: ListBoxPropTypes.ListBoxSize,
408
408
  /**
409
- * Provide a `Slug` component to be rendered inside the `Dropdown` component
409
+ * **Experimental**: Provide a `Slug` component to be rendered inside the `Dropdown` component
410
410
  */
411
411
  slug: PropTypes__default["default"].node,
412
412
  /**
@@ -116,11 +116,12 @@ class FileUploader extends React__default["default"].Component {
116
116
  return /*#__PURE__*/React__default["default"].createElement("div", _rollupPluginBabelHelpers["extends"]({
117
117
  className: classes
118
118
  }, other), !labelTitle ? null : /*#__PURE__*/React__default["default"].createElement(Text.Text, {
119
- as: "p",
119
+ as: "h3",
120
120
  className: getHelperLabelClasses(`${prefix}--file--label`)
121
121
  }, labelTitle), /*#__PURE__*/React__default["default"].createElement(Text.Text, {
122
122
  as: "p",
123
- className: getHelperLabelClasses(`${prefix}--label-description`)
123
+ className: getHelperLabelClasses(`${prefix}--label-description`),
124
+ id: "description"
124
125
  }, labelDescription), /*#__PURE__*/React__default["default"].createElement(FileUploaderButton["default"], {
125
126
  innerRef: this.uploaderButton,
126
127
  disabled: disabled,
@@ -131,7 +132,8 @@ class FileUploader extends React__default["default"].Component {
131
132
  disableLabelChanges: true,
132
133
  accept: accept,
133
134
  name: name,
134
- size: size
135
+ size: size,
136
+ "aria-describedby": "description"
135
137
  }), /*#__PURE__*/React__default["default"].createElement("div", {
136
138
  className: `${prefix}--file-container`
137
139
  }, this.state.filenames.length === 0 ? null : this.state.filenames.map((name, index) => /*#__PURE__*/React__default["default"].createElement("span", _rollupPluginBabelHelpers["extends"]({
@@ -131,6 +131,11 @@ Column.propTypes = {
131
131
  * @see https://www.carbondesignsystem.com/guidelines/layout#breakpoints
132
132
  */
133
133
  sm: spanPropType,
134
+ /**
135
+ * Specify constant column span, start, or end values that will not change
136
+ * based on breakpoint
137
+ */
138
+ span: PropTypes__default["default"].oneOfType([PropTypes__default["default"].number, percentSpanType]),
134
139
  /**
135
140
  * Specify column span for the `xlg` breakpoint (Default breakpoint up to
136
141
  * 1584px) This breakpoint supports 16 columns by default.
@@ -340,8 +345,13 @@ function getClassNameForFlexGridBreakpoints(breakpoints, prefix) {
340
345
  */
341
346
  function getClassNameForSpan(value, prefix) {
342
347
  const classNames = [];
343
- if (typeof value === 'number' || typeof value === 'string') {
348
+ if (typeof value === 'number') {
344
349
  classNames.push(`${prefix}--col-span-${value}`);
350
+ }
351
+ // If value is a string, the user has specified a percent
352
+ // they'd like this column to span.
353
+ else if (typeof value === 'string') {
354
+ classNames.push(`${prefix}--col-span-${value.slice(0, -1)}`);
345
355
  } else if (typeof value === 'object') {
346
356
  const {
347
357
  span,
@@ -0,0 +1,68 @@
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 React from 'react';
8
+ import PropTypes from 'prop-types';
9
+ export declare const InlineLoadingStatuses: readonly ["inactive", "active", "finished", "error"];
10
+ export type InlineLoadingStatus = (typeof InlineLoadingStatuses)[number];
11
+ export interface InlineLoadingProps extends Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, 'children'> {
12
+ /**
13
+ * Specify a custom className to be applied to the container node
14
+ */
15
+ className?: string;
16
+ /**
17
+ * Specify the description for the inline loading text
18
+ */
19
+ description?: React.ReactNode;
20
+ /**
21
+ * Specify the description for the inline loading text
22
+ */
23
+ iconDescription?: string;
24
+ /**
25
+ * Provide an optional handler to be invoked when <InlineLoading> is
26
+ * successful
27
+ */
28
+ onSuccess?: () => void;
29
+ /**
30
+ * Specify the loading status
31
+ */
32
+ status?: InlineLoadingStatus;
33
+ /**
34
+ * Provide a delay for the `setTimeout` for success
35
+ */
36
+ successDelay?: number;
37
+ }
38
+ declare const InlineLoading: {
39
+ ({ className, status, iconDescription, description, onSuccess, successDelay, ...rest }: InlineLoadingProps): JSX.Element;
40
+ propTypes: {
41
+ /**
42
+ * Specify a custom className to be applied to the container node
43
+ */
44
+ className: PropTypes.Requireable<string>;
45
+ /**
46
+ * Specify the description for the inline loading text
47
+ */
48
+ description: PropTypes.Requireable<PropTypes.ReactNodeLike>;
49
+ /**
50
+ * Specify the description for the inline loading text
51
+ */
52
+ iconDescription: PropTypes.Requireable<string>;
53
+ /**
54
+ * Provide an optional handler to be invoked when <InlineLoading> is
55
+ * successful
56
+ */
57
+ onSuccess: PropTypes.Requireable<(...args: any[]) => any>;
58
+ /**
59
+ * Specify the loading status
60
+ */
61
+ status: PropTypes.Requireable<string>;
62
+ /**
63
+ * Provide a delay for the `setTimeout` for success
64
+ */
65
+ successDelay: PropTypes.Requireable<number>;
66
+ };
67
+ };
68
+ export default InlineLoading;
@@ -23,7 +23,7 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
23
23
  var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
24
24
  var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
25
25
 
26
- function InlineLoading(_ref) {
26
+ const InlineLoading = _ref => {
27
27
  let {
28
28
  className,
29
29
  status = 'active',
@@ -31,7 +31,7 @@ function InlineLoading(_ref) {
31
31
  description,
32
32
  onSuccess,
33
33
  successDelay = 1500,
34
- ...other
34
+ ...rest
35
35
  } = _ref;
36
36
  const prefix = usePrefix.usePrefix();
37
37
  const loadingClasses = cx__default["default"](`${prefix}--inline-loading`, className);
@@ -74,10 +74,10 @@ function InlineLoading(_ref) {
74
74
  }, loading);
75
75
  return /*#__PURE__*/React__default["default"].createElement("div", _rollupPluginBabelHelpers["extends"]({
76
76
  className: loadingClasses
77
- }, other, {
77
+ }, rest, {
78
78
  "aria-live": 'assertive'
79
79
  }), loadingAnimation, description && loadingText);
80
- }
80
+ };
81
81
  InlineLoading.propTypes = {
82
82
  /**
83
83
  * Specify a custom className to be applied to the container node
@@ -0,0 +1,9 @@
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 InlineLoading from './InlineLoading';
8
+ export default InlineLoading;
9
+ export { InlineLoading };
@@ -0,0 +1,8 @@
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 React from 'react';
8
+ export declare const LayerContext: React.Context<0 | 1 | 2>;
@@ -0,0 +1,5 @@
1
+ export declare const levels: readonly ["one", "two", "three"];
2
+ export declare const MIN_LEVEL = 0;
3
+ export declare const MAX_LEVEL: number;
4
+ export declare const LayerLevels: readonly [0, 1, 2];
5
+ export type LayerLevel = (typeof LayerLevels)[number];
@@ -0,0 +1,18 @@
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
+ const levels = ['one', 'two', 'three'];
13
+ const MIN_LEVEL = 0;
14
+ const MAX_LEVEL = levels.length - 1;
15
+
16
+ exports.MAX_LEVEL = MAX_LEVEL;
17
+ exports.MIN_LEVEL = MIN_LEVEL;
18
+ exports.levels = levels;