@carbon/react 1.39.0-rc.0 → 1.40.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 +2121 -857
- package/es/components/CodeSnippet/CodeSnippet.js +2 -2
- package/es/components/DataTable/TableSelectAll.js +1 -0
- package/es/components/DataTable/TableSelectRow.js +2 -1
- package/es/components/FileUploader/FileUploaderItem.d.ts +4 -0
- package/es/components/FileUploader/FileUploaderItem.js +32 -5
- package/es/components/FileUploader/Filename.js +2 -1
- package/es/components/MultiSelect/MultiSelect.d.ts +24 -0
- package/es/components/MultiSelect/MultiSelect.js +26 -0
- package/es/components/Search/Search.js +1 -1
- package/es/components/StructuredList/StructuredList.Skeleton.d.ts +32 -0
- package/es/components/StructuredList/StructuredList.Skeleton.js +16 -26
- package/es/components/StructuredList/StructuredList.d.ts +271 -0
- package/es/components/StructuredList/StructuredList.js +14 -33
- package/es/components/StructuredList/index.d.ts +8 -0
- package/es/components/UIShell/SideNavDivider.js +2 -2
- package/es/components/UIShell/SideNavLinkText.d.ts +26 -0
- package/es/components/UIShell/SideNavLinkText.js +1 -1
- package/es/components/UIShell/SideNavMenu.d.ts +46 -0
- package/es/components/UIShell/SideNavMenu.js +23 -13
- package/es/index.js +2 -2
- package/lib/components/CodeSnippet/CodeSnippet.js +2 -2
- package/lib/components/DataTable/TableSelectAll.js +1 -0
- package/lib/components/DataTable/TableSelectRow.js +2 -1
- package/lib/components/FileUploader/FileUploaderItem.d.ts +4 -0
- package/lib/components/FileUploader/FileUploaderItem.js +31 -4
- package/lib/components/FileUploader/Filename.js +2 -1
- package/lib/components/MultiSelect/MultiSelect.d.ts +24 -0
- package/lib/components/MultiSelect/MultiSelect.js +26 -0
- package/lib/components/Search/Search.js +1 -1
- package/lib/components/StructuredList/StructuredList.Skeleton.d.ts +32 -0
- package/lib/components/StructuredList/StructuredList.Skeleton.js +16 -26
- package/lib/components/StructuredList/StructuredList.d.ts +271 -0
- package/lib/components/StructuredList/StructuredList.js +14 -33
- package/lib/components/StructuredList/index.d.ts +8 -0
- package/lib/components/UIShell/SideNavDivider.js +2 -2
- package/lib/components/UIShell/SideNavLinkText.d.ts +26 -0
- package/lib/components/UIShell/SideNavLinkText.js +2 -2
- package/lib/components/UIShell/SideNavMenu.d.ts +46 -0
- package/lib/components/UIShell/SideNavMenu.js +23 -13
- package/lib/index.js +9 -9
- package/package.json +6 -5
|
@@ -20,18 +20,19 @@ function StructuredListWrapper(props) {
|
|
|
20
20
|
children,
|
|
21
21
|
selection,
|
|
22
22
|
className,
|
|
23
|
-
['aria-label']: ariaLabel,
|
|
23
|
+
['aria-label']: ariaLabel = 'Structured list section',
|
|
24
|
+
// @ts-expect-error: Deprecated prop
|
|
24
25
|
ariaLabel: deprecatedAriaLabel,
|
|
25
26
|
isCondensed,
|
|
26
27
|
isFlush,
|
|
27
28
|
...other
|
|
28
29
|
} = props;
|
|
29
30
|
const prefix = usePrefix();
|
|
30
|
-
const classes = cx(`${prefix}--structured-list`,
|
|
31
|
+
const classes = cx(`${prefix}--structured-list`, {
|
|
31
32
|
[`${prefix}--structured-list--selection`]: selection,
|
|
32
33
|
[`${prefix}--structured-list--condensed`]: isCondensed,
|
|
33
34
|
[`${prefix}--structured-list--flush`]: isFlush && !selection
|
|
34
|
-
});
|
|
35
|
+
}, className);
|
|
35
36
|
const [selectedRow, setSelectedRow] = React__default.useState(null);
|
|
36
37
|
return /*#__PURE__*/React__default.createElement(GridSelectedRowStateContext.Provider, {
|
|
37
38
|
value: selectedRow
|
|
@@ -75,12 +76,6 @@ StructuredListWrapper.propTypes = {
|
|
|
75
76
|
*/
|
|
76
77
|
selection: PropTypes.bool
|
|
77
78
|
};
|
|
78
|
-
StructuredListWrapper.defaultProps = {
|
|
79
|
-
selection: false,
|
|
80
|
-
isCondensed: false,
|
|
81
|
-
isFlush: false,
|
|
82
|
-
['aria-label']: 'Structured list section'
|
|
83
|
-
};
|
|
84
79
|
function StructuredListHead(props) {
|
|
85
80
|
const {
|
|
86
81
|
children,
|
|
@@ -132,9 +127,6 @@ StructuredListBody.propTypes = {
|
|
|
132
127
|
*/
|
|
133
128
|
onKeyDown: PropTypes.func
|
|
134
129
|
};
|
|
135
|
-
StructuredListBody.defaultProps = {
|
|
136
|
-
onKeyDown: () => {}
|
|
137
|
-
};
|
|
138
130
|
const GridRowContext = /*#__PURE__*/React__default.createContext(null);
|
|
139
131
|
function StructuredListRow(props) {
|
|
140
132
|
const {
|
|
@@ -153,11 +145,11 @@ function StructuredListRow(props) {
|
|
|
153
145
|
const value = {
|
|
154
146
|
id
|
|
155
147
|
};
|
|
156
|
-
const classes = cx(`${prefix}--structured-list-row`,
|
|
148
|
+
const classes = cx(`${prefix}--structured-list-row`, {
|
|
157
149
|
[`${prefix}--structured-list-row--header-row`]: head,
|
|
158
150
|
[`${prefix}--structured-list-row--focused-within`]: hasFocusWithin,
|
|
159
151
|
[`${prefix}--structured-list-row--selected`]: selectedRow === id
|
|
160
|
-
});
|
|
152
|
+
}, className);
|
|
161
153
|
return head ? /*#__PURE__*/React__default.createElement("div", _extends({
|
|
162
154
|
role: "row"
|
|
163
155
|
}, other, {
|
|
@@ -171,9 +163,9 @@ function StructuredListRow(props) {
|
|
|
171
163
|
}, other, {
|
|
172
164
|
role: "row",
|
|
173
165
|
className: classes,
|
|
174
|
-
onClick:
|
|
175
|
-
setSelectedRow(id);
|
|
176
|
-
onClick && onClick();
|
|
166
|
+
onClick: event => {
|
|
167
|
+
setSelectedRow?.(id);
|
|
168
|
+
onClick && onClick(event);
|
|
177
169
|
},
|
|
178
170
|
onFocus: () => {
|
|
179
171
|
setHasFocusWithin(true);
|
|
@@ -204,7 +196,7 @@ StructuredListRow.propTypes = {
|
|
|
204
196
|
*/
|
|
205
197
|
label: deprecate(PropTypes.bool, `\nThe \`label\` prop is no longer needed and will be removed in the next major version of Carbon.`),
|
|
206
198
|
/**
|
|
207
|
-
* Provide a handler that is invoked on the click
|
|
199
|
+
* Provide a handler that is invoked on the click
|
|
208
200
|
*/
|
|
209
201
|
onClick: PropTypes.func,
|
|
210
202
|
/**
|
|
@@ -212,10 +204,6 @@ StructuredListRow.propTypes = {
|
|
|
212
204
|
*/
|
|
213
205
|
onKeyDown: PropTypes.func
|
|
214
206
|
};
|
|
215
|
-
StructuredListRow.defaultProps = {
|
|
216
|
-
head: false,
|
|
217
|
-
onKeyDown: () => {}
|
|
218
|
-
};
|
|
219
207
|
function StructuredListInput(props) {
|
|
220
208
|
const defaultId = useId('structureListInput');
|
|
221
209
|
const {
|
|
@@ -234,10 +222,10 @@ function StructuredListInput(props) {
|
|
|
234
222
|
return /*#__PURE__*/React__default.createElement("input", _extends({}, other, {
|
|
235
223
|
type: "radio",
|
|
236
224
|
tabIndex: 0,
|
|
237
|
-
checked: row && row.id === selectedRow,
|
|
225
|
+
checked: !!row && row.id === selectedRow,
|
|
238
226
|
value: row?.id ?? '',
|
|
239
227
|
onChange: event => {
|
|
240
|
-
setSelectedRow(event.target.value);
|
|
228
|
+
setSelectedRow?.(event.target.value);
|
|
241
229
|
onChange && onChange(event);
|
|
242
230
|
},
|
|
243
231
|
id: id ?? defaultId,
|
|
@@ -276,9 +264,6 @@ StructuredListInput.propTypes = {
|
|
|
276
264
|
*/
|
|
277
265
|
value: deprecate(PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired, `\nThe prop \`value\` will be removed in the next major version of Carbon.`)
|
|
278
266
|
};
|
|
279
|
-
StructuredListInput.defaultProps = {
|
|
280
|
-
title: 'title'
|
|
281
|
-
};
|
|
282
267
|
function StructuredListCell(props) {
|
|
283
268
|
const {
|
|
284
269
|
children,
|
|
@@ -288,11 +273,11 @@ function StructuredListCell(props) {
|
|
|
288
273
|
...other
|
|
289
274
|
} = props;
|
|
290
275
|
const prefix = usePrefix();
|
|
291
|
-
const classes = cx(
|
|
276
|
+
const classes = cx({
|
|
292
277
|
[`${prefix}--structured-list-th`]: head,
|
|
293
278
|
[`${prefix}--structured-list-td`]: !head,
|
|
294
279
|
[`${prefix}--structured-list-content--nowrap`]: noWrap
|
|
295
|
-
});
|
|
280
|
+
}, className);
|
|
296
281
|
if (head) {
|
|
297
282
|
return /*#__PURE__*/React__default.createElement("span", _extends({
|
|
298
283
|
className: classes,
|
|
@@ -322,9 +307,5 @@ StructuredListCell.propTypes = {
|
|
|
322
307
|
*/
|
|
323
308
|
noWrap: PropTypes.bool
|
|
324
309
|
};
|
|
325
|
-
StructuredListCell.defaultProps = {
|
|
326
|
-
head: false,
|
|
327
|
-
noWrap: false
|
|
328
|
-
};
|
|
329
310
|
|
|
330
311
|
export { StructuredListBody, StructuredListCell, StructuredListHead, StructuredListInput, StructuredListRow, StructuredListWrapper };
|
|
@@ -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
|
+
export * from './StructuredList';
|
|
8
|
+
export { default as StructuredListSkeleton, type StructuredListSkeletonProps, } from './StructuredList.Skeleton';
|
|
@@ -10,6 +10,7 @@ import PropTypes from 'prop-types';
|
|
|
10
10
|
import React__default from 'react';
|
|
11
11
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
12
12
|
|
|
13
|
+
var _hr;
|
|
13
14
|
function SideNavDivider(_ref) {
|
|
14
15
|
let {
|
|
15
16
|
className
|
|
@@ -17,9 +18,8 @@ function SideNavDivider(_ref) {
|
|
|
17
18
|
const prefix = usePrefix();
|
|
18
19
|
const classNames = cx(`${prefix}--side-nav__divider`, className);
|
|
19
20
|
return /*#__PURE__*/React__default.createElement("li", {
|
|
20
|
-
role: "separator",
|
|
21
21
|
className: classNames
|
|
22
|
-
});
|
|
22
|
+
}, _hr || (_hr = /*#__PURE__*/React__default.createElement("hr", null)));
|
|
23
23
|
}
|
|
24
24
|
SideNavDivider.propTypes = {
|
|
25
25
|
/**
|
|
@@ -0,0 +1,26 @@
|
|
|
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 { ReactNode } from 'react';
|
|
8
|
+
import PropTypes from 'prop-types';
|
|
9
|
+
export interface SideNavLinkTextProps {
|
|
10
|
+
children: ReactNode;
|
|
11
|
+
className?: string;
|
|
12
|
+
}
|
|
13
|
+
declare function SideNavLinkText({ className: customClassName, children, ...rest }: SideNavLinkTextProps): JSX.Element;
|
|
14
|
+
declare namespace SideNavLinkText {
|
|
15
|
+
var propTypes: {
|
|
16
|
+
/**
|
|
17
|
+
* Provide the content for the link text
|
|
18
|
+
*/
|
|
19
|
+
children: PropTypes.Validator<NonNullable<PropTypes.ReactNodeLike>>;
|
|
20
|
+
/**
|
|
21
|
+
* Provide an optional class to be applied to the containing node
|
|
22
|
+
*/
|
|
23
|
+
className: PropTypes.Requireable<string>;
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
export default SideNavLinkText;
|
|
@@ -7,9 +7,9 @@
|
|
|
7
7
|
|
|
8
8
|
import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
9
9
|
import cx from 'classnames';
|
|
10
|
-
import PropTypes from 'prop-types';
|
|
11
10
|
import React__default from 'react';
|
|
12
11
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
12
|
+
import PropTypes from 'prop-types';
|
|
13
13
|
|
|
14
14
|
function SideNavLinkText(_ref) {
|
|
15
15
|
let {
|
|
@@ -0,0 +1,46 @@
|
|
|
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
|
+
interface SideNavMenuProps {
|
|
9
|
+
/**
|
|
10
|
+
* An optional CSS class to apply to the component.
|
|
11
|
+
*/
|
|
12
|
+
className?: string;
|
|
13
|
+
/**
|
|
14
|
+
* The content to render within the SideNavMenu component.
|
|
15
|
+
*/
|
|
16
|
+
children?: React.ReactNode;
|
|
17
|
+
/**
|
|
18
|
+
* Specifies whether the menu should be expanded by default.
|
|
19
|
+
*/
|
|
20
|
+
defaultExpanded?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Indicates whether the SideNavMenu is active.
|
|
23
|
+
*/
|
|
24
|
+
isActive?: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Specifies whether the SideNavMenu is in a large variation.
|
|
27
|
+
*/
|
|
28
|
+
large?: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* A custom icon to render next to the SideNavMenu title. This can be a function returning JSX or JSX itself.
|
|
31
|
+
*/
|
|
32
|
+
renderIcon?: React.ComponentType;
|
|
33
|
+
/**
|
|
34
|
+
* Indicates if the side navigation container is expanded or collapsed.
|
|
35
|
+
*/
|
|
36
|
+
isSideNavExpanded?: boolean;
|
|
37
|
+
/**
|
|
38
|
+
* The tabIndex for the button element.
|
|
39
|
+
* If not specified, the default validation will be applied.
|
|
40
|
+
*/
|
|
41
|
+
tabIndex?: number;
|
|
42
|
+
title: string;
|
|
43
|
+
}
|
|
44
|
+
declare const SideNavMenu: React.ForwardRefExoticComponent<SideNavMenuProps & React.RefAttributes<HTMLElement>>;
|
|
45
|
+
export default SideNavMenu;
|
|
46
|
+
export { SideNavMenu };
|
|
@@ -16,8 +16,8 @@ import { match } from '../../internal/keyboard/match.js';
|
|
|
16
16
|
import { Escape } from '../../internal/keyboard/keys.js';
|
|
17
17
|
|
|
18
18
|
var _ChevronDown;
|
|
19
|
-
const SideNavMenu = /*#__PURE__*/React__default.forwardRef(function SideNavMenu(
|
|
20
|
-
|
|
19
|
+
const SideNavMenu = /*#__PURE__*/React__default.forwardRef(function SideNavMenu(_ref, ref) {
|
|
20
|
+
let {
|
|
21
21
|
className: customClassName,
|
|
22
22
|
children,
|
|
23
23
|
defaultExpanded = false,
|
|
@@ -27,7 +27,7 @@ const SideNavMenu = /*#__PURE__*/React__default.forwardRef(function SideNavMenu(
|
|
|
27
27
|
isSideNavExpanded,
|
|
28
28
|
tabIndex,
|
|
29
29
|
title
|
|
30
|
-
} =
|
|
30
|
+
} = _ref;
|
|
31
31
|
const isRail = useContext(SideNavContext);
|
|
32
32
|
const prefix = usePrefix();
|
|
33
33
|
const [isExpanded, setIsExpanded] = useState(defaultExpanded);
|
|
@@ -111,6 +111,7 @@ SideNavMenu.propTypes = {
|
|
|
111
111
|
/**
|
|
112
112
|
* Pass in a custom icon to render next to the `SideNavMenu` title
|
|
113
113
|
*/
|
|
114
|
+
// @ts-expect-error - PropTypes are unable to cover this case.
|
|
114
115
|
renderIcon: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
|
|
115
116
|
/**
|
|
116
117
|
* Optional prop to specify the tabIndex of the button. If undefined, it will be applied default validation
|
|
@@ -121,29 +122,38 @@ SideNavMenu.propTypes = {
|
|
|
121
122
|
*/
|
|
122
123
|
title: PropTypes.string.isRequired
|
|
123
124
|
};
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
Defining the children parameter with the type ReactNode | ReactNode[]. This allows for various possibilities:
|
|
128
|
+
a single element, an array of elements, or null or undefined.
|
|
129
|
+
**/
|
|
124
130
|
function hasActiveChild(children) {
|
|
125
|
-
// if we have children, either a single or multiple, find if it is active
|
|
126
131
|
if (Array.isArray(children)) {
|
|
127
132
|
return children.some(child => {
|
|
128
|
-
if (!child
|
|
133
|
+
if (! /*#__PURE__*/React__default.isValidElement(child)) {
|
|
129
134
|
return false;
|
|
130
135
|
}
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
136
|
+
|
|
137
|
+
/** Explicitly defining the expected prop types (isActive and 'aria-current) for the children to ensure type
|
|
138
|
+
safety when accessing their props.
|
|
139
|
+
**/
|
|
140
|
+
const props = child.props;
|
|
141
|
+
if (props.isActive === true || props['aria-current']) {
|
|
135
142
|
return true;
|
|
136
143
|
}
|
|
137
144
|
return false;
|
|
138
145
|
});
|
|
139
146
|
}
|
|
140
|
-
|
|
141
|
-
|
|
147
|
+
|
|
148
|
+
// We use React.isValidElement(child) to check if the child is a valid React element before accessing its props
|
|
149
|
+
|
|
150
|
+
if ( /*#__PURE__*/React__default.isValidElement(children)) {
|
|
151
|
+
const props = children.props;
|
|
152
|
+
if (props.isActive === true || props['aria-current']) {
|
|
142
153
|
return true;
|
|
143
154
|
}
|
|
144
155
|
}
|
|
145
156
|
return false;
|
|
146
157
|
}
|
|
147
|
-
var SideNavMenu$1 = SideNavMenu;
|
|
148
158
|
|
|
149
|
-
export { SideNavMenu, SideNavMenu
|
|
159
|
+
export { SideNavMenu, SideNavMenu as default };
|
package/es/index.js
CHANGED
|
@@ -76,6 +76,8 @@ export { default as SelectItemGroup } from './components/SelectItemGroup/SelectI
|
|
|
76
76
|
export { default as SkeletonPlaceholder } from './components/SkeletonPlaceholder/SkeletonPlaceholder.js';
|
|
77
77
|
export { default as SkeletonText } from './components/SkeletonText/SkeletonText.js';
|
|
78
78
|
export { default as Slider } from './components/Slider/index.js';
|
|
79
|
+
export { StructuredListBody, StructuredListCell, StructuredListHead, StructuredListInput, StructuredListRow, StructuredListWrapper } from './components/StructuredList/StructuredList.js';
|
|
80
|
+
export { default as StructuredListSkeleton } from './components/StructuredList/StructuredList.Skeleton.js';
|
|
79
81
|
export { IconTab, Tab, TabList, TabPanel, TabPanels, Tabs } from './components/Tabs/Tabs.js';
|
|
80
82
|
export { default as TabContent } from './components/TabContent/TabContent.js';
|
|
81
83
|
export { default as TabsSkeleton } from './components/Tabs/Tabs.Skeleton.js';
|
|
@@ -215,8 +217,6 @@ export { default as RadioTile } from './components/RadioTile/RadioTile.js';
|
|
|
215
217
|
export { default as SecondaryButton } from './components/SecondaryButton/SecondaryButton.js';
|
|
216
218
|
export { default as SkeletonIcon } from './components/SkeletonIcon/SkeletonIcon.js';
|
|
217
219
|
export { default as SliderSkeleton } from './components/Slider/Slider.Skeleton.js';
|
|
218
|
-
export { default as StructuredListSkeleton } from './components/StructuredList/StructuredList.Skeleton.js';
|
|
219
|
-
export { StructuredListBody, StructuredListCell, StructuredListHead, StructuredListInput, StructuredListRow, StructuredListWrapper } from './components/StructuredList/StructuredList.js';
|
|
220
220
|
export { default as Switch } from './components/Switch/Switch.js';
|
|
221
221
|
export { default as IconSwitch } from './components/Switch/IconSwitch.js';
|
|
222
222
|
export { Stack } from './components/Stack/Stack.js';
|
|
@@ -241,13 +241,13 @@ CodeSnippet.propTypes = {
|
|
|
241
241
|
*/
|
|
242
242
|
align: PropTypes__default["default"].oneOf(['top', 'top-left', 'top-right', 'bottom', 'bottom-left', 'bottom-right', 'left', 'right']),
|
|
243
243
|
/**
|
|
244
|
-
* Specify a label to be read by screen readers on the containing
|
|
244
|
+
* Specify a label to be read by screen readers on the containing textbox
|
|
245
245
|
* node
|
|
246
246
|
*/
|
|
247
247
|
['aria-label']: PropTypes__default["default"].string,
|
|
248
248
|
/**
|
|
249
249
|
* Deprecated, please use `aria-label` instead.
|
|
250
|
-
* Specify a label to be read by screen readers on the containing
|
|
250
|
+
* Specify a label to be read by screen readers on the containing textbox
|
|
251
251
|
* node
|
|
252
252
|
*/
|
|
253
253
|
ariaLabel: deprecate["default"](PropTypes__default["default"].string, 'This prop syntax has been deprecated. Please use the new `aria-label`.'),
|
|
@@ -34,6 +34,7 @@ const TableSelectAll = _ref => {
|
|
|
34
34
|
} = _ref;
|
|
35
35
|
const prefix = usePrefix.usePrefix();
|
|
36
36
|
return /*#__PURE__*/React__default["default"].createElement("th", {
|
|
37
|
+
"aria-live": "off",
|
|
37
38
|
scope: "col",
|
|
38
39
|
className: cx__default["default"](`${prefix}--table-column-checkbox`, className)
|
|
39
40
|
}, /*#__PURE__*/React__default["default"].createElement(InlineCheckbox["default"], {
|
|
@@ -52,7 +52,8 @@ const TableSelectRow = _ref => {
|
|
|
52
52
|
[`${prefix}--table-column-radio`]: radio
|
|
53
53
|
});
|
|
54
54
|
return /*#__PURE__*/React__default["default"].createElement("td", {
|
|
55
|
-
className: tableSelectRowClasses
|
|
55
|
+
className: tableSelectRowClasses,
|
|
56
|
+
"aria-live": "off"
|
|
56
57
|
}, /*#__PURE__*/React__default["default"].createElement(InlineInputComponent, _rollupPluginBabelHelpers["extends"]({}, selectionInputProps, radio && {
|
|
57
58
|
labelText: ariaLabel,
|
|
58
59
|
hideLabel: true
|
|
@@ -28,6 +28,10 @@ export interface FileUploaderItemProps extends ReactAttr<HTMLSpanElement> {
|
|
|
28
28
|
* Name of the uploaded file
|
|
29
29
|
*/
|
|
30
30
|
name?: string;
|
|
31
|
+
/**
|
|
32
|
+
* Event handler that is called after files are added to the uploader
|
|
33
|
+
*/
|
|
34
|
+
onAddFiles?: (event: React.ChangeEvent<HTMLInputElement>) => void;
|
|
31
35
|
/**
|
|
32
36
|
* Event handler that is called after removing a file from the file uploader
|
|
33
37
|
* The event handler signature looks like `onDelete(evt, { uuid })`
|
|
@@ -16,6 +16,8 @@ var React = require('react');
|
|
|
16
16
|
var Filename = require('./Filename.js');
|
|
17
17
|
var uniqueId = require('../../tools/uniqueId.js');
|
|
18
18
|
var usePrefix = require('../../internal/usePrefix.js');
|
|
19
|
+
require('../Tooltip/DefinitionTooltip.js');
|
|
20
|
+
var Tooltip = require('../Tooltip/Tooltip.js');
|
|
19
21
|
var match = require('../../internal/keyboard/match.js');
|
|
20
22
|
var keys = require('../../internal/keyboard/keys.js');
|
|
21
23
|
|
|
@@ -38,6 +40,7 @@ function FileUploaderItem(_ref) {
|
|
|
38
40
|
size,
|
|
39
41
|
...other
|
|
40
42
|
} = _ref;
|
|
43
|
+
const [isEllipsisApplied, setIsEllipsisApplied] = React.useState(false);
|
|
41
44
|
const prefix = usePrefix.usePrefix();
|
|
42
45
|
const {
|
|
43
46
|
current: id
|
|
@@ -47,13 +50,37 @@ function FileUploaderItem(_ref) {
|
|
|
47
50
|
[`${prefix}--file__selected-file--md`]: size === 'md',
|
|
48
51
|
[`${prefix}--file__selected-file--sm`]: size === 'sm'
|
|
49
52
|
});
|
|
53
|
+
const isInvalid = invalid ? `${prefix}--file-filename-container-wrap-invalid` : `${prefix}--file-filename-container-wrap`;
|
|
54
|
+
const isEllipsisActive = element => {
|
|
55
|
+
setIsEllipsisApplied(element.offsetWidth < element.scrollWidth);
|
|
56
|
+
return element.offsetWidth < element.scrollWidth;
|
|
57
|
+
};
|
|
58
|
+
React.useLayoutEffect(() => {
|
|
59
|
+
const element = document.querySelector(`[title="${name}"]`);
|
|
60
|
+
isEllipsisActive(element);
|
|
61
|
+
}, [prefix, name]);
|
|
50
62
|
return /*#__PURE__*/React__default["default"].createElement("span", _rollupPluginBabelHelpers["extends"]({
|
|
51
63
|
className: classes
|
|
52
|
-
}, other), /*#__PURE__*/React__default["default"].createElement("
|
|
53
|
-
className:
|
|
64
|
+
}, other), isEllipsisApplied ? /*#__PURE__*/React__default["default"].createElement("div", {
|
|
65
|
+
className: isInvalid
|
|
66
|
+
}, /*#__PURE__*/React__default["default"].createElement(Tooltip.Tooltip, {
|
|
67
|
+
label: name,
|
|
68
|
+
align: "bottom",
|
|
69
|
+
className: `${prefix}--file-filename-tooltip`
|
|
70
|
+
}, /*#__PURE__*/React__default["default"].createElement("button", {
|
|
71
|
+
className: `${prefix}--file-filename-button`,
|
|
72
|
+
type: "button"
|
|
73
|
+
}, /*#__PURE__*/React__default["default"].createElement("p", {
|
|
74
|
+
title: name,
|
|
75
|
+
className: `${prefix}--file-filename-button`,
|
|
76
|
+
id: name
|
|
77
|
+
}, name)))) : /*#__PURE__*/React__default["default"].createElement("p", {
|
|
54
78
|
title: name,
|
|
79
|
+
className: `${prefix}--file-filename`,
|
|
55
80
|
id: name
|
|
56
|
-
}, name), /*#__PURE__*/React__default["default"].createElement("
|
|
81
|
+
}, name), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
82
|
+
className: `${prefix}--file-container-item`
|
|
83
|
+
}, /*#__PURE__*/React__default["default"].createElement("span", {
|
|
57
84
|
className: `${prefix}--file__state-container`
|
|
58
85
|
}, /*#__PURE__*/React__default["default"].createElement(Filename["default"], {
|
|
59
86
|
name: name,
|
|
@@ -78,7 +105,7 @@ function FileUploaderItem(_ref) {
|
|
|
78
105
|
});
|
|
79
106
|
}
|
|
80
107
|
}
|
|
81
|
-
})), invalid && errorSubject && /*#__PURE__*/React__default["default"].createElement("div", {
|
|
108
|
+
}))), invalid && errorSubject && /*#__PURE__*/React__default["default"].createElement("div", {
|
|
82
109
|
className: `${prefix}--form-requirement`,
|
|
83
110
|
role: "alert",
|
|
84
111
|
id: `${name}-id-error`
|
|
@@ -37,7 +37,8 @@ function Filename(_ref) {
|
|
|
37
37
|
return /*#__PURE__*/React__default["default"].createElement(Loading["default"], {
|
|
38
38
|
description: iconDescription,
|
|
39
39
|
small: true,
|
|
40
|
-
withOverlay: false
|
|
40
|
+
withOverlay: false,
|
|
41
|
+
className: `${prefix}--file-loading`
|
|
41
42
|
});
|
|
42
43
|
case 'edit':
|
|
43
44
|
return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, invalid && /*#__PURE__*/React__default["default"].createElement(iconsReact.WarningFilled, {
|
|
@@ -21,7 +21,31 @@ interface SortItemsOptions<ItemType> extends SharedOptions, DownshiftTypedProps<
|
|
|
21
21
|
selectedItems: ItemType[];
|
|
22
22
|
}
|
|
23
23
|
interface MultiSelectSortingProps<ItemType> {
|
|
24
|
+
/**
|
|
25
|
+
* Provide a compare function that is used to determine the ordering of
|
|
26
|
+
* options. See 'sortItems' for more control.
|
|
27
|
+
*/
|
|
24
28
|
compareItems?(item1: ItemType, item2: ItemType, options: SharedOptions): number;
|
|
29
|
+
/**
|
|
30
|
+
* Provide a method that sorts all options in the control. Overriding this
|
|
31
|
+
* prop means that you also have to handle the sort logic for selected versus
|
|
32
|
+
* un-selected items. If you just want to control ordering, consider the
|
|
33
|
+
* `compareItems` prop instead.
|
|
34
|
+
*
|
|
35
|
+
* The return value should be a number whose sign indicates the relative order
|
|
36
|
+
* of the two elements: negative if a is less than b, positive if a is greater
|
|
37
|
+
* than b, and zero if they are equal.
|
|
38
|
+
*
|
|
39
|
+
* sortItems :
|
|
40
|
+
* (items: Array<Item>, {
|
|
41
|
+
* selectedItems: Array<Item>,
|
|
42
|
+
* itemToString: Item => string,
|
|
43
|
+
* compareItems: (itemA: string, itemB: string, {
|
|
44
|
+
* locale: string
|
|
45
|
+
* }) => number,
|
|
46
|
+
* locale: string,
|
|
47
|
+
* }) => Array<Item>
|
|
48
|
+
*/
|
|
25
49
|
sortItems?(items: ReadonlyArray<ItemType>, options: SortItemsOptions<ItemType>): ItemType[];
|
|
26
50
|
}
|
|
27
51
|
export interface MultiSelectProps<ItemType> extends MultiSelectSortingProps<ItemType>, InternationalProps<'close.menu' | 'open.menu' | 'clear.all' | 'clear.selection'> {
|
|
@@ -401,6 +401,11 @@ MultiSelect.propTypes = {
|
|
|
401
401
|
* Specify the text that should be read for screen readers to clear selection.
|
|
402
402
|
*/
|
|
403
403
|
clearSelectionText: PropTypes__default["default"].string,
|
|
404
|
+
/**
|
|
405
|
+
* Provide a compare function that is used to determine the ordering of
|
|
406
|
+
* options. See 'sortItems' for more control.
|
|
407
|
+
*/
|
|
408
|
+
compareItems: PropTypes__default["default"].func.isRequired,
|
|
404
409
|
/**
|
|
405
410
|
* Specify the direction of the multiselect dropdown. Can be either top or bottom.
|
|
406
411
|
*/
|
|
@@ -502,6 +507,27 @@ MultiSelect.propTypes = {
|
|
|
502
507
|
* Specify the size of the ListBox. Currently supports either `sm`, `md` or `lg` as an option.
|
|
503
508
|
*/
|
|
504
509
|
size: ListBoxPropTypes.ListBoxSize,
|
|
510
|
+
/**
|
|
511
|
+
* Provide a method that sorts all options in the control. Overriding this
|
|
512
|
+
* prop means that you also have to handle the sort logic for selected versus
|
|
513
|
+
* un-selected items. If you just want to control ordering, consider the
|
|
514
|
+
* `compareItems` prop instead.
|
|
515
|
+
*
|
|
516
|
+
* The return value should be a number whose sign indicates the relative order
|
|
517
|
+
* of the two elements: negative if a is less than b, positive if a is greater
|
|
518
|
+
* than b, and zero if they are equal.
|
|
519
|
+
*
|
|
520
|
+
* sortItems :
|
|
521
|
+
* (items: Array<Item>, {
|
|
522
|
+
* selectedItems: Array<Item>,
|
|
523
|
+
* itemToString: Item => string,
|
|
524
|
+
* compareItems: (itemA: string, itemB: string, {
|
|
525
|
+
* locale: string
|
|
526
|
+
* }) => number,
|
|
527
|
+
* locale: string,
|
|
528
|
+
* }) => Array<Item>
|
|
529
|
+
*/
|
|
530
|
+
sortItems: PropTypes__default["default"].func.isRequired,
|
|
505
531
|
/**
|
|
506
532
|
* Provide text to be used in a `<label>` element that is tied to the
|
|
507
533
|
* multiselect via ARIA attributes.
|
|
@@ -135,7 +135,7 @@ const Search = /*#__PURE__*/React__default["default"].forwardRef(function Search
|
|
|
135
135
|
className: `${prefix}--search-magnifier`,
|
|
136
136
|
onClick: onExpand,
|
|
137
137
|
onKeyDown: handleExpandButtonKeyDown,
|
|
138
|
-
tabIndex: onExpand && !isExpanded ?
|
|
138
|
+
tabIndex: onExpand && !isExpanded ? 0 : -1,
|
|
139
139
|
ref: expandButtonRef,
|
|
140
140
|
"aria-expanded": onExpand && isExpanded ? true : undefined,
|
|
141
141
|
"aria-controls": onExpand ? uniqueId : undefined
|
|
@@ -0,0 +1,32 @@
|
|
|
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
|
+
/// <reference types="react" />
|
|
8
|
+
import PropTypes from 'prop-types';
|
|
9
|
+
export interface StructuredListSkeletonProps {
|
|
10
|
+
/**
|
|
11
|
+
* Specify an optional className to add.
|
|
12
|
+
*/
|
|
13
|
+
className?: string;
|
|
14
|
+
/**
|
|
15
|
+
* number of table rows
|
|
16
|
+
*/
|
|
17
|
+
rowCount?: number;
|
|
18
|
+
}
|
|
19
|
+
declare function StructuredListSkeleton({ rowCount, className, ...rest }: StructuredListSkeletonProps): JSX.Element;
|
|
20
|
+
declare namespace StructuredListSkeleton {
|
|
21
|
+
var propTypes: {
|
|
22
|
+
/**
|
|
23
|
+
* Specify an optional className to add.
|
|
24
|
+
*/
|
|
25
|
+
className: PropTypes.Requireable<string>;
|
|
26
|
+
/**
|
|
27
|
+
* number of table rows
|
|
28
|
+
*/
|
|
29
|
+
rowCount: PropTypes.Requireable<number>;
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
export default StructuredListSkeleton;
|
|
@@ -22,32 +22,26 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
|
22
22
|
var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
|
|
23
23
|
|
|
24
24
|
var _span, _span2, _span3;
|
|
25
|
-
|
|
25
|
+
function StructuredListSkeleton(_ref) {
|
|
26
26
|
let {
|
|
27
|
-
rowCount,
|
|
27
|
+
rowCount = 5,
|
|
28
28
|
className,
|
|
29
29
|
...rest
|
|
30
30
|
} = _ref;
|
|
31
31
|
const prefix = usePrefix.usePrefix();
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
}), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
44
|
-
className: `${prefix}--structured-list-td`
|
|
45
|
-
}), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
46
|
-
className: `${prefix}--structured-list-td`
|
|
47
|
-
})));
|
|
48
|
-
}
|
|
32
|
+
const classNames = cx__default["default"](`${prefix}--skeleton`, `${prefix}--structured-list`, className);
|
|
33
|
+
const rows = new Array(rowCount).fill(null).map((_, i) => /*#__PURE__*/React__default["default"].createElement("div", {
|
|
34
|
+
className: `${prefix}--structured-list-row`,
|
|
35
|
+
key: i
|
|
36
|
+
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
37
|
+
className: `${prefix}--structured-list-td`
|
|
38
|
+
}), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
39
|
+
className: `${prefix}--structured-list-td`
|
|
40
|
+
}), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
41
|
+
className: `${prefix}--structured-list-td`
|
|
42
|
+
})));
|
|
49
43
|
return /*#__PURE__*/React__default["default"].createElement("div", _rollupPluginBabelHelpers["extends"]({
|
|
50
|
-
className:
|
|
44
|
+
className: classNames
|
|
51
45
|
}, rest), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
52
46
|
className: `${prefix}--structured-list-thead`
|
|
53
47
|
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
@@ -61,7 +55,7 @@ const StructuredListSkeleton = _ref => {
|
|
|
61
55
|
}, _span3 || (_span3 = /*#__PURE__*/React__default["default"].createElement("span", null))))), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
62
56
|
className: `${prefix}--structured-list-tbody`
|
|
63
57
|
}, rows));
|
|
64
|
-
}
|
|
58
|
+
}
|
|
65
59
|
StructuredListSkeleton.propTypes = {
|
|
66
60
|
/**
|
|
67
61
|
* Specify an optional className to add.
|
|
@@ -72,9 +66,5 @@ StructuredListSkeleton.propTypes = {
|
|
|
72
66
|
*/
|
|
73
67
|
rowCount: PropTypes__default["default"].number
|
|
74
68
|
};
|
|
75
|
-
StructuredListSkeleton.defaultProps = {
|
|
76
|
-
rowCount: 5
|
|
77
|
-
};
|
|
78
|
-
var StructuredListSkeleton$1 = StructuredListSkeleton;
|
|
79
69
|
|
|
80
|
-
exports["default"] = StructuredListSkeleton
|
|
70
|
+
exports["default"] = StructuredListSkeleton;
|