@carbon/react 1.44.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.
- package/.playwright/INTERNAL_AVT_REPORT_DO_NOT_USE.json +805 -805
- package/es/components/Checkbox/Checkbox.d.ts +1 -1
- package/es/components/Checkbox/Checkbox.js +1 -1
- package/es/components/CheckboxGroup/CheckboxGroup.js +1 -1
- package/es/components/ComboBox/ComboBox.d.ts +1 -1
- package/es/components/ComboBox/ComboBox.js +1 -1
- package/es/components/ComboButton/index.js +1 -1
- package/es/components/ComposedModal/ModalFooter.d.ts +2 -1
- package/es/components/DataTable/DataTable.d.ts +2 -0
- package/es/components/DataTable/DataTable.js +3 -0
- package/es/components/DataTable/TableExpandRow.js +20 -3
- package/es/components/DataTable/TableHeader.d.ts +5 -0
- package/es/components/DataTable/TableHeader.js +30 -6
- package/es/components/DataTable/TableSlugRow.d.ts +31 -0
- package/es/components/DataTable/TableSlugRow.js +49 -0
- package/es/components/DataTable/index.d.ts +2 -1
- package/es/components/DataTable/index.js +3 -0
- package/es/components/DatePickerInput/DatePickerInput.d.ts +1 -1
- package/es/components/DatePickerInput/DatePickerInput.js +1 -1
- package/es/components/Dropdown/Dropdown.d.ts +1 -1
- package/es/components/Dropdown/Dropdown.js +1 -1
- package/es/components/InlineLoading/InlineLoading.d.ts +68 -0
- package/es/components/InlineLoading/InlineLoading.js +4 -4
- package/es/components/InlineLoading/index.d.ts +9 -0
- package/es/components/Layer/LayerContext.d.ts +8 -0
- package/es/components/Layer/LayerLevel.d.ts +5 -0
- package/es/components/Layer/LayerLevel.js +12 -0
- package/es/components/Layer/index.d.ts +38 -0
- package/es/components/Layer/index.js +9 -8
- package/es/components/Menu/MenuItem.js +2 -1
- package/es/components/MenuButton/index.js +1 -1
- package/es/components/Modal/Modal.d.ts +3 -2
- package/es/components/MultiSelect/FilterableMultiSelect.js +1 -1
- package/es/components/MultiSelect/MultiSelect.d.ts +1 -1
- package/es/components/MultiSelect/MultiSelect.js +1 -1
- package/es/components/Notification/Notification.js +1 -0
- package/es/components/NumberInput/NumberInput.d.ts +1 -1
- package/es/components/NumberInput/NumberInput.js +1 -1
- package/es/components/RadioButton/RadioButton.d.ts +1 -1
- package/es/components/RadioButton/RadioButton.js +1 -1
- package/es/components/RadioButtonGroup/RadioButtonGroup.d.ts +1 -1
- package/es/components/RadioButtonGroup/RadioButtonGroup.js +1 -1
- package/es/components/Select/Select.d.ts +1 -1
- package/es/components/Select/Select.js +1 -1
- package/es/components/Slider/Slider.Skeleton.js +17 -3
- package/es/components/Slider/Slider.js +132 -93
- package/es/components/Slider/SliderHandles.d.ts +4 -0
- package/es/components/Slider/SliderHandles.js +65 -0
- package/es/components/Tabs/Tabs.js +1 -1
- package/es/components/TextArea/TextArea.d.ts +7 -3
- package/es/components/TextArea/TextArea.js +84 -17
- package/es/components/TextInput/TextInput.d.ts +1 -1
- package/es/components/TextInput/TextInput.js +1 -1
- package/es/components/Tile/Tile.d.ts +8 -8
- package/es/components/Tile/Tile.js +9 -5
- package/es/components/Tooltip/Tooltip.js +48 -2
- package/es/components/UIShell/HeaderPanel.d.ts +36 -0
- package/es/components/UIShell/HeaderPanel.js +6 -6
- package/es/index.js +2 -1
- package/es/internal/useAnnouncer.js +2 -1
- package/es/internal/useNoInteractiveChildren.js +2 -6
- package/lib/components/Checkbox/Checkbox.d.ts +1 -1
- package/lib/components/Checkbox/Checkbox.js +1 -1
- package/lib/components/CheckboxGroup/CheckboxGroup.js +1 -1
- package/lib/components/ComboBox/ComboBox.d.ts +1 -1
- package/lib/components/ComboBox/ComboBox.js +1 -1
- package/lib/components/ComboButton/index.js +1 -1
- package/lib/components/ComposedModal/ModalFooter.d.ts +2 -1
- package/lib/components/DataTable/DataTable.d.ts +2 -0
- package/lib/components/DataTable/DataTable.js +3 -0
- package/lib/components/DataTable/TableExpandRow.js +20 -3
- package/lib/components/DataTable/TableHeader.d.ts +5 -0
- package/lib/components/DataTable/TableHeader.js +29 -5
- package/lib/components/DataTable/TableSlugRow.d.ts +31 -0
- package/lib/components/DataTable/TableSlugRow.js +59 -0
- package/lib/components/DataTable/index.d.ts +2 -1
- package/lib/components/DataTable/index.js +3 -0
- package/lib/components/DatePickerInput/DatePickerInput.d.ts +1 -1
- package/lib/components/DatePickerInput/DatePickerInput.js +1 -1
- package/lib/components/Dropdown/Dropdown.d.ts +1 -1
- package/lib/components/Dropdown/Dropdown.js +1 -1
- package/lib/components/InlineLoading/InlineLoading.d.ts +68 -0
- package/lib/components/InlineLoading/InlineLoading.js +4 -4
- package/lib/components/InlineLoading/index.d.ts +9 -0
- package/lib/components/Layer/LayerContext.d.ts +8 -0
- package/lib/components/Layer/LayerLevel.d.ts +5 -0
- package/lib/components/Layer/LayerLevel.js +18 -0
- package/lib/components/Layer/index.d.ts +38 -0
- package/lib/components/Layer/index.js +10 -9
- package/lib/components/Menu/MenuItem.js +2 -1
- package/lib/components/MenuButton/index.js +1 -1
- package/lib/components/Modal/Modal.d.ts +3 -2
- package/lib/components/MultiSelect/FilterableMultiSelect.js +1 -1
- package/lib/components/MultiSelect/MultiSelect.d.ts +1 -1
- package/lib/components/MultiSelect/MultiSelect.js +1 -1
- package/lib/components/Notification/Notification.js +1 -0
- package/lib/components/NumberInput/NumberInput.d.ts +1 -1
- package/lib/components/NumberInput/NumberInput.js +1 -1
- package/lib/components/RadioButton/RadioButton.d.ts +1 -1
- package/lib/components/RadioButton/RadioButton.js +1 -1
- package/lib/components/RadioButtonGroup/RadioButtonGroup.d.ts +1 -1
- package/lib/components/RadioButtonGroup/RadioButtonGroup.js +1 -1
- package/lib/components/Select/Select.d.ts +1 -1
- package/lib/components/Select/Select.js +1 -1
- package/lib/components/Slider/Slider.Skeleton.js +17 -3
- package/lib/components/Slider/Slider.js +132 -93
- package/lib/components/Slider/SliderHandles.d.ts +4 -0
- package/lib/components/Slider/SliderHandles.js +76 -0
- package/lib/components/Tabs/Tabs.js +1 -1
- package/lib/components/TextArea/TextArea.d.ts +7 -3
- package/lib/components/TextArea/TextArea.js +83 -16
- package/lib/components/TextInput/TextInput.d.ts +1 -1
- package/lib/components/TextInput/TextInput.js +1 -1
- package/lib/components/Tile/Tile.d.ts +8 -8
- package/lib/components/Tile/Tile.js +9 -5
- package/lib/components/Tooltip/Tooltip.js +47 -1
- package/lib/components/UIShell/HeaderPanel.d.ts +36 -0
- package/lib/components/UIShell/HeaderPanel.js +7 -7
- package/lib/index.js +4 -2
- package/lib/internal/useAnnouncer.js +2 -1
- package/lib/internal/useNoInteractiveChildren.js +2 -6
- package/package.json +4 -7
|
@@ -46,7 +46,7 @@ export interface CheckboxProps extends Omit<React.InputHTMLAttributes<HTMLInputE
|
|
|
46
46
|
*/
|
|
47
47
|
invalidText?: React.ReactNode;
|
|
48
48
|
/**
|
|
49
|
-
* Provide a `Slug` component to be rendered inside the `Checkbox` component
|
|
49
|
+
* **Experimental**: Provide a `Slug` component to be rendered inside the `Checkbox` component
|
|
50
50
|
*/
|
|
51
51
|
slug?: ReactNodeLike;
|
|
52
52
|
/**
|
|
@@ -175,7 +175,7 @@ Checkbox.propTypes = {
|
|
|
175
175
|
*/
|
|
176
176
|
readOnly: PropTypes.bool,
|
|
177
177
|
/**
|
|
178
|
-
* Provide a `Slug` component to be rendered inside the `Checkbox` component
|
|
178
|
+
* **Experimental**: Provide a `Slug` component to be rendered inside the `Checkbox` component
|
|
179
179
|
*/
|
|
180
180
|
slug: PropTypes.node,
|
|
181
181
|
/**
|
|
@@ -109,7 +109,7 @@ CheckboxGroup.propTypes = {
|
|
|
109
109
|
*/
|
|
110
110
|
readOnly: PropTypes.bool,
|
|
111
111
|
/**
|
|
112
|
-
* Provide a `Slug` component to be rendered inside the `CheckboxGroup` component
|
|
112
|
+
* **Experimental**: Provide a `Slug` component to be rendered inside the `CheckboxGroup` component
|
|
113
113
|
*/
|
|
114
114
|
slug: PropTypes.node,
|
|
115
115
|
/**
|
|
@@ -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
|
/**
|
|
@@ -575,7 +575,7 @@ ComboBox.propTypes = {
|
|
|
575
575
|
*/
|
|
576
576
|
size: ListBoxSize,
|
|
577
577
|
/**
|
|
578
|
-
* Provide a `Slug` component to be rendered inside the `ComboBox` component
|
|
578
|
+
* **Experimental**: Provide a `Slug` component to be rendered inside the `ComboBox` component
|
|
579
579
|
*/
|
|
580
580
|
slug: PropTypes.node,
|
|
581
581
|
/**
|
|
@@ -20,7 +20,7 @@ import { useMergedRefs } from '../../internal/useMergedRefs.js';
|
|
|
20
20
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
21
21
|
|
|
22
22
|
var _ChevronDown;
|
|
23
|
-
const spacing =
|
|
23
|
+
const spacing = 0; // top and bottom spacing between the button and the menu. in px
|
|
24
24
|
const defaultTranslations = {
|
|
25
25
|
'carbon.combo-button.additional-actions': 'Additional actions'
|
|
26
26
|
};
|
|
@@ -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?:
|
|
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;
|
|
@@ -31,6 +31,7 @@ import TableHeader from './TableHeader.js';
|
|
|
31
31
|
import TableRow from './TableRow.js';
|
|
32
32
|
import TableSelectAll from './TableSelectAll.js';
|
|
33
33
|
import TableSelectRow from './TableSelectRow.js';
|
|
34
|
+
import TableSlugRow from './TableSlugRow.js';
|
|
34
35
|
import TableToolbar from './TableToolbar.js';
|
|
35
36
|
import TableToolbarAction from './TableToolbarAction.js';
|
|
36
37
|
import TableToolbarContent from './TableToolbarContent.js';
|
|
@@ -723,6 +724,7 @@ _defineProperty(DataTable, "TableHeader", void 0);
|
|
|
723
724
|
_defineProperty(DataTable, "TableRow", void 0);
|
|
724
725
|
_defineProperty(DataTable, "TableSelectAll", void 0);
|
|
725
726
|
_defineProperty(DataTable, "TableSelectRow", void 0);
|
|
727
|
+
_defineProperty(DataTable, "TableSlugRow", void 0);
|
|
726
728
|
_defineProperty(DataTable, "TableToolbar", void 0);
|
|
727
729
|
_defineProperty(DataTable, "TableToolbarAction", void 0);
|
|
728
730
|
_defineProperty(DataTable, "TableToolbarContent", void 0);
|
|
@@ -743,6 +745,7 @@ DataTable.TableHeader = TableHeader;
|
|
|
743
745
|
DataTable.TableRow = TableRow;
|
|
744
746
|
DataTable.TableSelectAll = TableSelectAll;
|
|
745
747
|
DataTable.TableSelectRow = TableSelectRow;
|
|
748
|
+
DataTable.TableSlugRow = TableSlugRow;
|
|
746
749
|
DataTable.TableToolbar = TableToolbar;
|
|
747
750
|
DataTable.TableToolbarAction = TableToolbarAction;
|
|
748
751
|
DataTable.TableToolbarContent = TableToolbarContent;
|
|
@@ -28,17 +28,34 @@ const TableExpandRow = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
|
28
28
|
...rest
|
|
29
29
|
} = _ref;
|
|
30
30
|
const prefix = usePrefix();
|
|
31
|
+
|
|
32
|
+
// We need to put the slug before the expansion arrow and all other table cells after the arrow.
|
|
33
|
+
let rowHasSlug;
|
|
34
|
+
const slug = React__default.Children.toArray(children).map(child => {
|
|
35
|
+
if (child.type?.displayName === 'TableSlugRow') {
|
|
36
|
+
if (child.props.slug) {
|
|
37
|
+
rowHasSlug = true;
|
|
38
|
+
}
|
|
39
|
+
return child;
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
const normalizedChildren = React__default.Children.toArray(children).map(child => {
|
|
43
|
+
if (child.type?.displayName !== 'TableSlugRow') {
|
|
44
|
+
return child;
|
|
45
|
+
}
|
|
46
|
+
});
|
|
31
47
|
const className = cx({
|
|
32
48
|
[`${prefix}--parent-row`]: true,
|
|
33
49
|
[`${prefix}--expandable-row`]: isExpanded,
|
|
34
|
-
[`${prefix}--data-table--selected`]: isSelected
|
|
50
|
+
[`${prefix}--data-table--selected`]: isSelected,
|
|
51
|
+
[`${prefix}--parent-row--slug`]: rowHasSlug
|
|
35
52
|
}, rowClassName);
|
|
36
53
|
const previousValue = isExpanded ? 'collapsed' : undefined;
|
|
37
54
|
return /*#__PURE__*/React__default.createElement("tr", _extends({}, rest, {
|
|
38
55
|
ref: ref,
|
|
39
56
|
className: className,
|
|
40
57
|
"data-parent-row": true
|
|
41
|
-
}), /*#__PURE__*/React__default.createElement(TableCell, {
|
|
58
|
+
}), slug, /*#__PURE__*/React__default.createElement(TableCell, {
|
|
42
59
|
className: `${prefix}--table-expand`,
|
|
43
60
|
"data-previous-value": previousValue,
|
|
44
61
|
headers: expandHeader
|
|
@@ -53,7 +70,7 @@ const TableExpandRow = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
|
53
70
|
}, /*#__PURE__*/React__default.createElement(ChevronRight, {
|
|
54
71
|
className: `${prefix}--table-expand__svg`,
|
|
55
72
|
"aria-label": expandIconDescription
|
|
56
|
-
}))),
|
|
73
|
+
}))), normalizedChildren);
|
|
57
74
|
});
|
|
58
75
|
TableExpandRow.propTypes = {
|
|
59
76
|
/**
|
|
@@ -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.
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
9
9
|
import cx from 'classnames';
|
|
10
10
|
import PropTypes from 'prop-types';
|
|
11
|
-
import React__default from 'react';
|
|
11
|
+
import React__default, { useRef } from 'react';
|
|
12
12
|
import { ArrowUp, ArrowsVertical } from '@carbon/icons-react';
|
|
13
13
|
import './state/sorting.js';
|
|
14
14
|
import { useId } from '../../internal/useId.js';
|
|
@@ -52,11 +52,26 @@ const TableHeader = /*#__PURE__*/React__default.forwardRef(function TableHeader(
|
|
|
52
52
|
scope = defaultScope,
|
|
53
53
|
sortDirection,
|
|
54
54
|
translateWithId: t = translateWithId,
|
|
55
|
+
slug,
|
|
55
56
|
id,
|
|
56
57
|
...rest
|
|
57
58
|
} = _ref;
|
|
58
59
|
const prefix = usePrefix();
|
|
59
60
|
const uniqueId = useId('table-sort');
|
|
61
|
+
|
|
62
|
+
// Slug is always size `mini`
|
|
63
|
+
const slugRef = useRef(null);
|
|
64
|
+
let normalizedSlug;
|
|
65
|
+
if (slug) {
|
|
66
|
+
normalizedSlug = /*#__PURE__*/React__default.cloneElement(slug, {
|
|
67
|
+
size: 'mini',
|
|
68
|
+
ref: slugRef
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
const headerLabelClassNames = cx({
|
|
72
|
+
[`${prefix}--table-header-label`]: true,
|
|
73
|
+
[`${prefix}--table-header-label--slug`]: slug
|
|
74
|
+
});
|
|
60
75
|
if (!isSortable) {
|
|
61
76
|
return /*#__PURE__*/React__default.createElement("th", _extends({}, rest, {
|
|
62
77
|
id: id,
|
|
@@ -65,8 +80,8 @@ const TableHeader = /*#__PURE__*/React__default.forwardRef(function TableHeader(
|
|
|
65
80
|
colSpan: colSpan,
|
|
66
81
|
ref: ref
|
|
67
82
|
}), children ? /*#__PURE__*/React__default.createElement("div", {
|
|
68
|
-
className:
|
|
69
|
-
}, children) : null);
|
|
83
|
+
className: headerLabelClassNames
|
|
84
|
+
}, children, normalizedSlug) : null);
|
|
70
85
|
}
|
|
71
86
|
const className = cx(headerClassName, {
|
|
72
87
|
[`${prefix}--table-sort`]: true,
|
|
@@ -80,7 +95,16 @@ const TableHeader = /*#__PURE__*/React__default.forwardRef(function TableHeader(
|
|
|
80
95
|
isSortHeader,
|
|
81
96
|
sortStates
|
|
82
97
|
});
|
|
83
|
-
const headerClasses = cx(headerClassName, `${prefix}--table-sort__header
|
|
98
|
+
const headerClasses = cx(headerClassName, `${prefix}--table-sort__header`, {
|
|
99
|
+
[`${prefix}--table-sort__header--slug`]: slug
|
|
100
|
+
});
|
|
101
|
+
const handleClick = evt => {
|
|
102
|
+
if (slug && slugRef.current && slugRef.current.contains(evt.target)) {
|
|
103
|
+
return;
|
|
104
|
+
} else if (onClick) {
|
|
105
|
+
return onClick(evt);
|
|
106
|
+
}
|
|
107
|
+
};
|
|
84
108
|
return /*#__PURE__*/React__default.createElement("th", {
|
|
85
109
|
id: id,
|
|
86
110
|
"aria-sort": ariaSort,
|
|
@@ -95,12 +119,12 @@ const TableHeader = /*#__PURE__*/React__default.forwardRef(function TableHeader(
|
|
|
95
119
|
type: "button",
|
|
96
120
|
"aria-describedby": uniqueId,
|
|
97
121
|
className: className,
|
|
98
|
-
onClick:
|
|
122
|
+
onClick: handleClick
|
|
99
123
|
}, rest), /*#__PURE__*/React__default.createElement("span", {
|
|
100
124
|
className: `${prefix}--table-sort__flex`
|
|
101
125
|
}, /*#__PURE__*/React__default.createElement("div", {
|
|
102
126
|
className: `${prefix}--table-header-label`
|
|
103
|
-
}, children), /*#__PURE__*/React__default.createElement(ArrowUp, {
|
|
127
|
+
}, children), normalizedSlug, /*#__PURE__*/React__default.createElement(ArrowUp, {
|
|
104
128
|
size: 20,
|
|
105
129
|
className: `${prefix}--table-sort__icon`
|
|
106
130
|
}), /*#__PURE__*/React__default.createElement(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,49 @@
|
|
|
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
|
+
import PropTypes from 'prop-types';
|
|
9
|
+
import React__default from 'react';
|
|
10
|
+
import cx from 'classnames';
|
|
11
|
+
import { usePrefix } from '../../internal/usePrefix.js';
|
|
12
|
+
|
|
13
|
+
const TableSlugRow = _ref => {
|
|
14
|
+
let {
|
|
15
|
+
className,
|
|
16
|
+
slug
|
|
17
|
+
} = _ref;
|
|
18
|
+
const prefix = usePrefix();
|
|
19
|
+
const TableSlugRowClasses = cx({
|
|
20
|
+
...(className && {
|
|
21
|
+
[className]: true
|
|
22
|
+
}),
|
|
23
|
+
[`${prefix}--table-column-slug`]: true,
|
|
24
|
+
[`${prefix}--table-column-slug--active`]: slug
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
// Slug is always size `mini`
|
|
28
|
+
let normalizedSlug;
|
|
29
|
+
if (slug) {
|
|
30
|
+
normalizedSlug = /*#__PURE__*/React__default.cloneElement(slug, {
|
|
31
|
+
size: 'mini'
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
return /*#__PURE__*/React__default.createElement("td", {
|
|
35
|
+
className: TableSlugRowClasses
|
|
36
|
+
}, normalizedSlug);
|
|
37
|
+
};
|
|
38
|
+
TableSlugRow.propTypes = {
|
|
39
|
+
/**
|
|
40
|
+
* The CSS class names of the cell that wraps the underlying input control
|
|
41
|
+
*/
|
|
42
|
+
className: PropTypes.string,
|
|
43
|
+
/**
|
|
44
|
+
* Provide a `Slug` component to be rendered inside the `TableSlugRow` component
|
|
45
|
+
*/
|
|
46
|
+
slug: PropTypes.node
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
export { TableSlugRow as default };
|
|
@@ -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;
|
|
@@ -37,6 +37,8 @@ import TableSelectAll from './TableSelectAll.js';
|
|
|
37
37
|
export { default as TableSelectAll } from './TableSelectAll.js';
|
|
38
38
|
import TableSelectRow from './TableSelectRow.js';
|
|
39
39
|
export { default as TableSelectRow } from './TableSelectRow.js';
|
|
40
|
+
import TableSlugRow from './TableSlugRow.js';
|
|
41
|
+
export { default as TableSlugRow } from './TableSlugRow.js';
|
|
40
42
|
import TableToolbar from './TableToolbar.js';
|
|
41
43
|
export { default as TableToolbar } from './TableToolbar.js';
|
|
42
44
|
import TableToolbarAction from './TableToolbarAction.js';
|
|
@@ -63,6 +65,7 @@ DataTable.TableHeader = TableHeader;
|
|
|
63
65
|
DataTable.TableRow = TableRow;
|
|
64
66
|
DataTable.TableSelectAll = TableSelectAll;
|
|
65
67
|
DataTable.TableSelectRow = TableSelectRow;
|
|
68
|
+
DataTable.TableSlugRow = TableSlugRow;
|
|
66
69
|
DataTable.TableToolbar = TableToolbar;
|
|
67
70
|
DataTable.TableToolbarAction = TableToolbarAction;
|
|
68
71
|
DataTable.TableToolbarContent = TableToolbarContent;
|
|
@@ -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
|
/**
|
|
@@ -206,7 +206,7 @@ DatePickerInput.propTypes = {
|
|
|
206
206
|
*/
|
|
207
207
|
size: PropTypes.oneOf(['sm', 'md', 'lg']),
|
|
208
208
|
/**
|
|
209
|
-
* Provide a `Slug` component to be rendered inside the `DatePickerInput` component
|
|
209
|
+
* **Experimental**: Provide a `Slug` component to be rendered inside the `DatePickerInput` component
|
|
210
210
|
*/
|
|
211
211
|
slug: PropTypes.node,
|
|
212
212
|
/**
|
|
@@ -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
|
/**
|
|
@@ -396,7 +396,7 @@ Dropdown.propTypes = {
|
|
|
396
396
|
*/
|
|
397
397
|
size: ListBoxSize,
|
|
398
398
|
/**
|
|
399
|
-
* Provide a `Slug` component to be rendered inside the `Dropdown` component
|
|
399
|
+
* **Experimental**: Provide a `Slug` component to be rendered inside the `Dropdown` component
|
|
400
400
|
*/
|
|
401
401
|
slug: PropTypes.node,
|
|
402
402
|
/**
|
|
@@ -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;
|
|
@@ -13,7 +13,7 @@ import { ErrorFilled, CheckmarkFilled } from '@carbon/icons-react';
|
|
|
13
13
|
import Loading from '../Loading/Loading.js';
|
|
14
14
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
const InlineLoading = _ref => {
|
|
17
17
|
let {
|
|
18
18
|
className,
|
|
19
19
|
status = 'active',
|
|
@@ -21,7 +21,7 @@ function InlineLoading(_ref) {
|
|
|
21
21
|
description,
|
|
22
22
|
onSuccess,
|
|
23
23
|
successDelay = 1500,
|
|
24
|
-
...
|
|
24
|
+
...rest
|
|
25
25
|
} = _ref;
|
|
26
26
|
const prefix = usePrefix();
|
|
27
27
|
const loadingClasses = cx(`${prefix}--inline-loading`, className);
|
|
@@ -64,10 +64,10 @@ function InlineLoading(_ref) {
|
|
|
64
64
|
}, loading);
|
|
65
65
|
return /*#__PURE__*/React__default.createElement("div", _extends({
|
|
66
66
|
className: loadingClasses
|
|
67
|
-
},
|
|
67
|
+
}, rest, {
|
|
68
68
|
"aria-live": 'assertive'
|
|
69
69
|
}), loadingAnimation, description && loadingText);
|
|
70
|
-
}
|
|
70
|
+
};
|
|
71
71
|
InlineLoading.propTypes = {
|
|
72
72
|
/**
|
|
73
73
|
* 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,12 @@
|
|
|
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
|
+
const levels = ['one', 'two', 'three'];
|
|
9
|
+
const MIN_LEVEL = 0;
|
|
10
|
+
const MAX_LEVEL = levels.length - 1;
|
|
11
|
+
|
|
12
|
+
export { MAX_LEVEL, MIN_LEVEL, levels };
|
|
@@ -0,0 +1,38 @@
|
|
|
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 { LayerLevel } from './LayerLevel';
|
|
9
|
+
import { PolymorphicProps } from '../../types/common';
|
|
10
|
+
/**
|
|
11
|
+
* A custom hook that will return information about the current layer. A common
|
|
12
|
+
* field to pull from this is the `level` for the layer that the component that
|
|
13
|
+
* calls this hook is currently in
|
|
14
|
+
*/
|
|
15
|
+
export declare function useLayer(): {
|
|
16
|
+
level: 0 | 1 | 2;
|
|
17
|
+
};
|
|
18
|
+
interface LayerBaseProps {
|
|
19
|
+
/**
|
|
20
|
+
* Provide child elements to be rendered inside of `Theme`
|
|
21
|
+
*/
|
|
22
|
+
children?: React.ReactNode;
|
|
23
|
+
/**
|
|
24
|
+
* Provide a custom class name to be used on the outermost element rendered by
|
|
25
|
+
* the component
|
|
26
|
+
*/
|
|
27
|
+
className?: string;
|
|
28
|
+
/**
|
|
29
|
+
* Specify the layer level and override any existing levels based on hierarchy
|
|
30
|
+
*/
|
|
31
|
+
level?: LayerLevel;
|
|
32
|
+
}
|
|
33
|
+
export type LayerProps<T extends React.ElementType> = PolymorphicProps<T, LayerBaseProps>;
|
|
34
|
+
export interface LayerComponent {
|
|
35
|
+
<T extends React.ElementType>(props: LayerProps<T>, context?: any): React.ReactElement<any, any> | null;
|
|
36
|
+
}
|
|
37
|
+
export declare const Layer: LayerComponent;
|
|
38
|
+
export {};
|
|
@@ -11,9 +11,7 @@ import PropTypes from 'prop-types';
|
|
|
11
11
|
import cx from 'classnames';
|
|
12
12
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
13
13
|
import { LayerContext } from './LayerContext.js';
|
|
14
|
-
|
|
15
|
-
const levels = ['one', 'two', 'three'];
|
|
16
|
-
const MAX_LEVEL = levels.length - 1;
|
|
14
|
+
import { levels, MIN_LEVEL, MAX_LEVEL } from './LayerLevel.js';
|
|
17
15
|
|
|
18
16
|
/**
|
|
19
17
|
* A custom hook that will return information about the current layer. A common
|
|
@@ -26,9 +24,9 @@ function useLayer() {
|
|
|
26
24
|
level
|
|
27
25
|
};
|
|
28
26
|
}
|
|
29
|
-
const
|
|
27
|
+
const LayerRenderFunction = /*#__PURE__*/React__default.forwardRef(function Layer(_ref, ref) {
|
|
30
28
|
let {
|
|
31
|
-
as
|
|
29
|
+
as = 'div',
|
|
32
30
|
className: customClassName,
|
|
33
31
|
children,
|
|
34
32
|
level: overrideLevel,
|
|
@@ -38,8 +36,9 @@ const Layer = /*#__PURE__*/React__default.forwardRef(function Layer(_ref, ref) {
|
|
|
38
36
|
const level = overrideLevel ?? contextLevel;
|
|
39
37
|
const prefix = usePrefix();
|
|
40
38
|
const className = cx(`${prefix}--layer-${levels[level]}`, customClassName);
|
|
41
|
-
// The level should be between
|
|
42
|
-
const value = Math.max(
|
|
39
|
+
// The level should be between MIN_LEVEL and MAX_LEVEL
|
|
40
|
+
const value = Math.max(MIN_LEVEL, Math.min(level + 1, MAX_LEVEL));
|
|
41
|
+
const BaseComponent = as;
|
|
43
42
|
return /*#__PURE__*/React__default.createElement(LayerContext.Provider, {
|
|
44
43
|
value: value
|
|
45
44
|
}, /*#__PURE__*/React__default.createElement(BaseComponent, _extends({
|
|
@@ -48,7 +47,8 @@ const Layer = /*#__PURE__*/React__default.forwardRef(function Layer(_ref, ref) {
|
|
|
48
47
|
className: className
|
|
49
48
|
}), children));
|
|
50
49
|
});
|
|
51
|
-
|
|
50
|
+
LayerRenderFunction.displayName = 'Layer';
|
|
51
|
+
LayerRenderFunction.propTypes = {
|
|
52
52
|
/**
|
|
53
53
|
* Specify a custom component or element to be rendered as the top-level
|
|
54
54
|
* element in the component
|
|
@@ -68,5 +68,6 @@ Layer.propTypes = {
|
|
|
68
68
|
*/
|
|
69
69
|
level: PropTypes.oneOf([0, 1, 2])
|
|
70
70
|
};
|
|
71
|
+
const Layer = LayerRenderFunction;
|
|
71
72
|
|
|
72
73
|
export { Layer, useLayer };
|
|
@@ -169,7 +169,8 @@ const MenuItem = /*#__PURE__*/React__default.forwardRef(function MenuItem(_ref,
|
|
|
169
169
|
className: `${prefix}--menu-item__icon`
|
|
170
170
|
}, iconsAllowed && IconElement && /*#__PURE__*/React__default.createElement(IconElement, null)), /*#__PURE__*/React__default.createElement(Text, {
|
|
171
171
|
as: "div",
|
|
172
|
-
className: `${prefix}--menu-item__label
|
|
172
|
+
className: `${prefix}--menu-item__label`,
|
|
173
|
+
title: label
|
|
173
174
|
}, label), shortcut && !hasChildren && /*#__PURE__*/React__default.createElement("div", {
|
|
174
175
|
className: `${prefix}--menu-item__shortcut`
|
|
175
176
|
}, shortcut), hasChildren && /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("div", {
|