@carbon/react 1.39.0-rc.0 → 1.39.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 +809 -666
- package/es/components/CodeSnippet/CodeSnippet.js +2 -2
- package/es/components/MultiSelect/MultiSelect.d.ts +24 -0
- package/es/components/MultiSelect/MultiSelect.js +26 -0
- 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/index.js +2 -2
- package/lib/components/CodeSnippet/CodeSnippet.js +2 -2
- package/lib/components/MultiSelect/MultiSelect.d.ts +24 -0
- package/lib/components/MultiSelect/MultiSelect.js +26 -0
- 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/index.js +9 -9
- package/package.json +5 -5
|
@@ -229,13 +229,13 @@ CodeSnippet.propTypes = {
|
|
|
229
229
|
*/
|
|
230
230
|
align: PropTypes.oneOf(['top', 'top-left', 'top-right', 'bottom', 'bottom-left', 'bottom-right', 'left', 'right']),
|
|
231
231
|
/**
|
|
232
|
-
* Specify a label to be read by screen readers on the containing
|
|
232
|
+
* Specify a label to be read by screen readers on the containing textbox
|
|
233
233
|
* node
|
|
234
234
|
*/
|
|
235
235
|
['aria-label']: PropTypes.string,
|
|
236
236
|
/**
|
|
237
237
|
* Deprecated, please use `aria-label` instead.
|
|
238
|
-
* Specify a label to be read by screen readers on the containing
|
|
238
|
+
* Specify a label to be read by screen readers on the containing textbox
|
|
239
239
|
* node
|
|
240
240
|
*/
|
|
241
241
|
ariaLabel: deprecate(PropTypes.string, 'This prop syntax has been deprecated. Please use the new `aria-label`.'),
|
|
@@ -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'> {
|
|
@@ -390,6 +390,11 @@ MultiSelect.propTypes = {
|
|
|
390
390
|
* Specify the text that should be read for screen readers to clear selection.
|
|
391
391
|
*/
|
|
392
392
|
clearSelectionText: PropTypes.string,
|
|
393
|
+
/**
|
|
394
|
+
* Provide a compare function that is used to determine the ordering of
|
|
395
|
+
* options. See 'sortItems' for more control.
|
|
396
|
+
*/
|
|
397
|
+
compareItems: PropTypes.func.isRequired,
|
|
393
398
|
/**
|
|
394
399
|
* Specify the direction of the multiselect dropdown. Can be either top or bottom.
|
|
395
400
|
*/
|
|
@@ -491,6 +496,27 @@ MultiSelect.propTypes = {
|
|
|
491
496
|
* Specify the size of the ListBox. Currently supports either `sm`, `md` or `lg` as an option.
|
|
492
497
|
*/
|
|
493
498
|
size: ListBoxSize,
|
|
499
|
+
/**
|
|
500
|
+
* Provide a method that sorts all options in the control. Overriding this
|
|
501
|
+
* prop means that you also have to handle the sort logic for selected versus
|
|
502
|
+
* un-selected items. If you just want to control ordering, consider the
|
|
503
|
+
* `compareItems` prop instead.
|
|
504
|
+
*
|
|
505
|
+
* The return value should be a number whose sign indicates the relative order
|
|
506
|
+
* of the two elements: negative if a is less than b, positive if a is greater
|
|
507
|
+
* than b, and zero if they are equal.
|
|
508
|
+
*
|
|
509
|
+
* sortItems :
|
|
510
|
+
* (items: Array<Item>, {
|
|
511
|
+
* selectedItems: Array<Item>,
|
|
512
|
+
* itemToString: Item => string,
|
|
513
|
+
* compareItems: (itemA: string, itemB: string, {
|
|
514
|
+
* locale: string
|
|
515
|
+
* }) => number,
|
|
516
|
+
* locale: string,
|
|
517
|
+
* }) => Array<Item>
|
|
518
|
+
*/
|
|
519
|
+
sortItems: PropTypes.func.isRequired,
|
|
494
520
|
/**
|
|
495
521
|
* Provide text to be used in a `<label>` element that is tied to the
|
|
496
522
|
* multiselect via ARIA attributes.
|
|
@@ -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;
|
|
@@ -12,32 +12,26 @@ import cx from 'classnames';
|
|
|
12
12
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
13
13
|
|
|
14
14
|
var _span, _span2, _span3;
|
|
15
|
-
|
|
15
|
+
function StructuredListSkeleton(_ref) {
|
|
16
16
|
let {
|
|
17
|
-
rowCount,
|
|
17
|
+
rowCount = 5,
|
|
18
18
|
className,
|
|
19
19
|
...rest
|
|
20
20
|
} = _ref;
|
|
21
21
|
const prefix = usePrefix();
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}), /*#__PURE__*/React__default.createElement("div", {
|
|
34
|
-
className: `${prefix}--structured-list-td`
|
|
35
|
-
}), /*#__PURE__*/React__default.createElement("div", {
|
|
36
|
-
className: `${prefix}--structured-list-td`
|
|
37
|
-
})));
|
|
38
|
-
}
|
|
22
|
+
const classNames = cx(`${prefix}--skeleton`, `${prefix}--structured-list`, className);
|
|
23
|
+
const rows = new Array(rowCount).fill(null).map((_, i) => /*#__PURE__*/React__default.createElement("div", {
|
|
24
|
+
className: `${prefix}--structured-list-row`,
|
|
25
|
+
key: i
|
|
26
|
+
}, /*#__PURE__*/React__default.createElement("div", {
|
|
27
|
+
className: `${prefix}--structured-list-td`
|
|
28
|
+
}), /*#__PURE__*/React__default.createElement("div", {
|
|
29
|
+
className: `${prefix}--structured-list-td`
|
|
30
|
+
}), /*#__PURE__*/React__default.createElement("div", {
|
|
31
|
+
className: `${prefix}--structured-list-td`
|
|
32
|
+
})));
|
|
39
33
|
return /*#__PURE__*/React__default.createElement("div", _extends({
|
|
40
|
-
className:
|
|
34
|
+
className: classNames
|
|
41
35
|
}, rest), /*#__PURE__*/React__default.createElement("div", {
|
|
42
36
|
className: `${prefix}--structured-list-thead`
|
|
43
37
|
}, /*#__PURE__*/React__default.createElement("div", {
|
|
@@ -51,7 +45,7 @@ const StructuredListSkeleton = _ref => {
|
|
|
51
45
|
}, _span3 || (_span3 = /*#__PURE__*/React__default.createElement("span", null))))), /*#__PURE__*/React__default.createElement("div", {
|
|
52
46
|
className: `${prefix}--structured-list-tbody`
|
|
53
47
|
}, rows));
|
|
54
|
-
}
|
|
48
|
+
}
|
|
55
49
|
StructuredListSkeleton.propTypes = {
|
|
56
50
|
/**
|
|
57
51
|
* Specify an optional className to add.
|
|
@@ -62,9 +56,5 @@ StructuredListSkeleton.propTypes = {
|
|
|
62
56
|
*/
|
|
63
57
|
rowCount: PropTypes.number
|
|
64
58
|
};
|
|
65
|
-
StructuredListSkeleton.defaultProps = {
|
|
66
|
-
rowCount: 5
|
|
67
|
-
};
|
|
68
|
-
var StructuredListSkeleton$1 = StructuredListSkeleton;
|
|
69
59
|
|
|
70
|
-
export { StructuredListSkeleton
|
|
60
|
+
export { StructuredListSkeleton as default };
|
|
@@ -0,0 +1,271 @@
|
|
|
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 { type HTMLAttributes, type ReactNode, type KeyboardEvent, type ChangeEvent, type MouseEvent } from 'react';
|
|
8
|
+
import PropTypes from 'prop-types';
|
|
9
|
+
type DivAttrs = HTMLAttributes<HTMLDivElement>;
|
|
10
|
+
export interface StructuredListWrapperProps extends DivAttrs {
|
|
11
|
+
/**
|
|
12
|
+
* Specify a label to be read by screen readers on the container node
|
|
13
|
+
*/
|
|
14
|
+
'aria-label'?: string;
|
|
15
|
+
/**
|
|
16
|
+
* Provide the contents of your StructuredListWrapper
|
|
17
|
+
*/
|
|
18
|
+
children?: ReactNode;
|
|
19
|
+
/**
|
|
20
|
+
* Specify an optional className to be applied to the container node
|
|
21
|
+
*/
|
|
22
|
+
className?: string;
|
|
23
|
+
/**
|
|
24
|
+
* Specify if structured list is condensed, default is false
|
|
25
|
+
*/
|
|
26
|
+
isCondensed?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Specify if structured list is flush, default is false
|
|
29
|
+
*/
|
|
30
|
+
isFlush?: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Specify whether your StructuredListWrapper should have selections
|
|
33
|
+
*/
|
|
34
|
+
selection?: boolean;
|
|
35
|
+
}
|
|
36
|
+
export declare function StructuredListWrapper(props: StructuredListWrapperProps): JSX.Element;
|
|
37
|
+
export declare namespace StructuredListWrapper {
|
|
38
|
+
var propTypes: {
|
|
39
|
+
/**
|
|
40
|
+
* Specify a label to be read by screen readers on the container node
|
|
41
|
+
*/
|
|
42
|
+
"aria-label": PropTypes.Requireable<string>;
|
|
43
|
+
/**
|
|
44
|
+
* Deprecated, please use `aria-label` instead.
|
|
45
|
+
* Specify a label to be read by screen readers on the container note.
|
|
46
|
+
*/
|
|
47
|
+
ariaLabel: (props: any, propName: any, componentName: any, ...rest: any[]) => any;
|
|
48
|
+
/**
|
|
49
|
+
* Provide the contents of your StructuredListWrapper
|
|
50
|
+
*/
|
|
51
|
+
children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
52
|
+
/**
|
|
53
|
+
* Specify an optional className to be applied to the container node
|
|
54
|
+
*/
|
|
55
|
+
className: PropTypes.Requireable<string>;
|
|
56
|
+
/**
|
|
57
|
+
* Specify if structured list is condensed, default is false
|
|
58
|
+
*/
|
|
59
|
+
isCondensed: PropTypes.Requireable<boolean>;
|
|
60
|
+
/**
|
|
61
|
+
* Specify if structured list is flush, not valid for selection variant, default is false
|
|
62
|
+
*/
|
|
63
|
+
isFlush: PropTypes.Requireable<boolean>;
|
|
64
|
+
/**
|
|
65
|
+
* Specify whether your StructuredListWrapper should have selections
|
|
66
|
+
*/
|
|
67
|
+
selection: PropTypes.Requireable<boolean>;
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
export interface StructuredListHeadProps extends DivAttrs {
|
|
71
|
+
/**
|
|
72
|
+
* Provide the contents of your StructuredListHead
|
|
73
|
+
*/
|
|
74
|
+
children?: ReactNode;
|
|
75
|
+
/**
|
|
76
|
+
* Specify an optional className to be applied to the node
|
|
77
|
+
*/
|
|
78
|
+
className?: string;
|
|
79
|
+
}
|
|
80
|
+
export declare function StructuredListHead(props: any): JSX.Element;
|
|
81
|
+
export declare namespace StructuredListHead {
|
|
82
|
+
var propTypes: {
|
|
83
|
+
/**
|
|
84
|
+
* Provide the contents of your StructuredListHead
|
|
85
|
+
*/
|
|
86
|
+
children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
87
|
+
/**
|
|
88
|
+
* Specify an optional className to be applied to the node
|
|
89
|
+
*/
|
|
90
|
+
className: PropTypes.Requireable<string>;
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
export interface StructuredListBodyProps extends DivAttrs {
|
|
94
|
+
/**
|
|
95
|
+
* Provide the contents of your StructuredListBody
|
|
96
|
+
*/
|
|
97
|
+
children?: ReactNode;
|
|
98
|
+
/**
|
|
99
|
+
* Specify an optional className to be applied to the container node
|
|
100
|
+
*/
|
|
101
|
+
className?: string;
|
|
102
|
+
head?: boolean;
|
|
103
|
+
/**
|
|
104
|
+
* Provide a handler that is invoked on the key down event for the control
|
|
105
|
+
*/
|
|
106
|
+
onKeyDown?(event: KeyboardEvent): void;
|
|
107
|
+
}
|
|
108
|
+
export declare function StructuredListBody(props: StructuredListBodyProps): JSX.Element;
|
|
109
|
+
export declare namespace StructuredListBody {
|
|
110
|
+
var propTypes: {
|
|
111
|
+
/**
|
|
112
|
+
* Provide the contents of your StructuredListBody
|
|
113
|
+
*/
|
|
114
|
+
children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
115
|
+
/**
|
|
116
|
+
* Specify an optional className to be applied to the container node
|
|
117
|
+
*/
|
|
118
|
+
className: PropTypes.Requireable<string>;
|
|
119
|
+
head: PropTypes.Requireable<boolean>;
|
|
120
|
+
/**
|
|
121
|
+
* Provide a handler that is invoked on the key down event for the control
|
|
122
|
+
*/
|
|
123
|
+
onKeyDown: PropTypes.Requireable<(...args: any[]) => any>;
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
export interface StructuredListRowProps extends DivAttrs {
|
|
127
|
+
/**
|
|
128
|
+
* Provide the contents of your StructuredListRow
|
|
129
|
+
*/
|
|
130
|
+
children?: ReactNode;
|
|
131
|
+
/**
|
|
132
|
+
* Specify an optional className to be applied to the container node
|
|
133
|
+
*/
|
|
134
|
+
className?: string;
|
|
135
|
+
/**
|
|
136
|
+
* Specify whether your StructuredListRow should be used as a header row
|
|
137
|
+
*/
|
|
138
|
+
head?: boolean;
|
|
139
|
+
/**
|
|
140
|
+
* Provide a handler that is invoked on the click
|
|
141
|
+
*/
|
|
142
|
+
onClick?(event: MouseEvent): void;
|
|
143
|
+
/**
|
|
144
|
+
* Provide a handler that is invoked on the key down event for the control
|
|
145
|
+
*/
|
|
146
|
+
onKeyDown?(event: KeyboardEvent): void;
|
|
147
|
+
}
|
|
148
|
+
export declare function StructuredListRow(props: StructuredListRowProps): JSX.Element;
|
|
149
|
+
export declare namespace StructuredListRow {
|
|
150
|
+
var propTypes: {
|
|
151
|
+
/**
|
|
152
|
+
* Provide the contents of your StructuredListRow
|
|
153
|
+
*/
|
|
154
|
+
children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
155
|
+
/**
|
|
156
|
+
* Specify an optional className to be applied to the container node
|
|
157
|
+
*/
|
|
158
|
+
className: PropTypes.Requireable<string>;
|
|
159
|
+
/**
|
|
160
|
+
* Specify whether your StructuredListRow should be used as a header row
|
|
161
|
+
*/
|
|
162
|
+
head: PropTypes.Requireable<boolean>;
|
|
163
|
+
/**
|
|
164
|
+
* Specify whether a `<label>` should be used
|
|
165
|
+
*/
|
|
166
|
+
label: (props: any, propName: any, componentName: any, ...rest: any[]) => any;
|
|
167
|
+
/**
|
|
168
|
+
* Provide a handler that is invoked on the click
|
|
169
|
+
*/
|
|
170
|
+
onClick: PropTypes.Requireable<(...args: any[]) => any>;
|
|
171
|
+
/**
|
|
172
|
+
* Provide a handler that is invoked on the key down event for the control,
|
|
173
|
+
*/
|
|
174
|
+
onKeyDown: PropTypes.Requireable<(...args: any[]) => any>;
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
export interface StructuredListInputProps extends DivAttrs {
|
|
178
|
+
/**
|
|
179
|
+
* Specify an optional className to be applied to the input
|
|
180
|
+
*/
|
|
181
|
+
className?: string;
|
|
182
|
+
/**
|
|
183
|
+
* Specify a custom `id` for the input
|
|
184
|
+
*/
|
|
185
|
+
id?: string;
|
|
186
|
+
/**
|
|
187
|
+
* Provide a `name` for the input
|
|
188
|
+
*/
|
|
189
|
+
name?: string;
|
|
190
|
+
/**
|
|
191
|
+
* Provide an optional hook that is called each time the input is updated
|
|
192
|
+
*/
|
|
193
|
+
onChange?(event: ChangeEvent<HTMLInputElement>): void;
|
|
194
|
+
/**
|
|
195
|
+
* Provide a `title` for the input
|
|
196
|
+
*/
|
|
197
|
+
title?: string;
|
|
198
|
+
}
|
|
199
|
+
export declare function StructuredListInput(props: StructuredListInputProps): JSX.Element;
|
|
200
|
+
export declare namespace StructuredListInput {
|
|
201
|
+
var propTypes: {
|
|
202
|
+
/**
|
|
203
|
+
* Specify an optional className to be applied to the input
|
|
204
|
+
*/
|
|
205
|
+
className: PropTypes.Requireable<string>;
|
|
206
|
+
/**
|
|
207
|
+
* Specify whether the underlying input should be checked by default
|
|
208
|
+
*/
|
|
209
|
+
defaultChecked: (props: any, propName: any, componentName: any, ...rest: any[]) => any;
|
|
210
|
+
/**
|
|
211
|
+
* Specify a custom `id` for the input
|
|
212
|
+
*/
|
|
213
|
+
id: PropTypes.Requireable<string>;
|
|
214
|
+
/**
|
|
215
|
+
* Provide a `name` for the input
|
|
216
|
+
*/
|
|
217
|
+
name: PropTypes.Requireable<string>;
|
|
218
|
+
/**
|
|
219
|
+
* Provide an optional hook that is called each time the input is updated
|
|
220
|
+
*/
|
|
221
|
+
onChange: PropTypes.Requireable<(...args: any[]) => any>;
|
|
222
|
+
/**
|
|
223
|
+
* Provide a `title` for the input
|
|
224
|
+
*/
|
|
225
|
+
title: PropTypes.Requireable<string>;
|
|
226
|
+
/**
|
|
227
|
+
* Specify the value of the input
|
|
228
|
+
*/
|
|
229
|
+
value: (props: any, propName: any, componentName: any, ...rest: any[]) => any;
|
|
230
|
+
};
|
|
231
|
+
}
|
|
232
|
+
export interface StructuredListCellProps extends DivAttrs {
|
|
233
|
+
/**
|
|
234
|
+
* Provide the contents of your StructuredListCell
|
|
235
|
+
*/
|
|
236
|
+
children?: ReactNode;
|
|
237
|
+
/**
|
|
238
|
+
* Specify an optional className to be applied to the container node
|
|
239
|
+
*/
|
|
240
|
+
className?: string;
|
|
241
|
+
/**
|
|
242
|
+
* Specify whether your StructuredListCell should be used as a header cell
|
|
243
|
+
*/
|
|
244
|
+
head?: boolean;
|
|
245
|
+
/**
|
|
246
|
+
* Specify whether your StructuredListCell should have text wrapping
|
|
247
|
+
*/
|
|
248
|
+
noWrap?: boolean;
|
|
249
|
+
}
|
|
250
|
+
export declare function StructuredListCell(props: StructuredListCellProps): JSX.Element;
|
|
251
|
+
export declare namespace StructuredListCell {
|
|
252
|
+
var propTypes: {
|
|
253
|
+
/**
|
|
254
|
+
* Provide the contents of your StructuredListCell
|
|
255
|
+
*/
|
|
256
|
+
children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
257
|
+
/**
|
|
258
|
+
* Specify an optional className to be applied to the container node
|
|
259
|
+
*/
|
|
260
|
+
className: PropTypes.Requireable<string>;
|
|
261
|
+
/**
|
|
262
|
+
* Specify whether your StructuredListCell should be used as a header cell
|
|
263
|
+
*/
|
|
264
|
+
head: PropTypes.Requireable<boolean>;
|
|
265
|
+
/**
|
|
266
|
+
* Specify whether your StructuredListCell should have text wrapping
|
|
267
|
+
*/
|
|
268
|
+
noWrap: PropTypes.Requireable<boolean>;
|
|
269
|
+
};
|
|
270
|
+
}
|
|
271
|
+
export {};
|
|
@@ -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
|
/**
|
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`.'),
|