@carbon/ibm-products 2.28.1 → 2.29.0-alpha.10
Sign up to get free protection for your applications and to get access to all the features.
- package/css/index-full-carbon.css +224 -15
- package/css/index-full-carbon.css.map +1 -1
- package/css/index-full-carbon.min.css +1 -1
- package/css/index-full-carbon.min.css.map +1 -1
- package/css/index-without-carbon-released-only.css +40 -8
- package/css/index-without-carbon-released-only.css.map +1 -1
- package/css/index-without-carbon-released-only.min.css +1 -1
- package/css/index-without-carbon-released-only.min.css.map +1 -1
- package/css/index-without-carbon.css +224 -15
- package/css/index-without-carbon.css.map +1 -1
- package/css/index-without-carbon.min.css +1 -1
- package/css/index-without-carbon.min.css.map +1 -1
- package/css/index.css +188 -8
- package/css/index.css.map +1 -1
- package/css/index.min.css +1 -1
- package/css/index.min.css.map +1 -1
- package/es/components/APIKeyModal/APIKeyModal.d.ts +2 -1
- package/es/components/APIKeyModal/APIKeyModal.js +13 -9
- package/es/components/APIKeyModal/APIKeyModal.types.d.ts +206 -0
- package/es/components/Datagrid/Datagrid/DatagridHeaderRow.js +2 -0
- package/es/components/Datagrid/Datagrid/addons/RowSize/RowSizeDropdown.d.ts +1 -2
- package/es/components/Datagrid/useInitialColumnSort.d.ts +1 -0
- package/es/components/Datagrid/useInitialColumnSort.js +42 -0
- package/es/components/Datagrid/useSortableColumns.d.ts +4 -0
- package/es/components/Datagrid/useSortableColumns.js +16 -16
- package/es/components/DescriptionList/DescriptionList.d.ts +42 -0
- package/es/components/DescriptionList/DescriptionList.js +88 -0
- package/es/components/DescriptionList/constants.d.ts +6 -0
- package/es/components/DescriptionList/constants.js +16 -0
- package/es/components/DescriptionList/index.d.ts +1 -0
- package/es/components/EmptyStates/EmptyStateContent.d.ts +1 -287
- package/es/components/HTTPErrors/HTTPErrorContent.d.ts +1 -293
- package/es/components/StatusIndicator/StatusIndicator.d.ts +5 -0
- package/es/components/StatusIndicator/StatusIndicator.js +100 -0
- package/es/components/StatusIndicator/StatusIndicatorStep.d.ts +5 -0
- package/es/components/StatusIndicator/index.d.ts +2 -0
- package/es/components/index.d.ts +2 -0
- package/es/global/js/package-settings.d.ts +3 -0
- package/es/global/js/package-settings.js +3 -0
- package/es/index.js +2 -0
- package/es/settings.d.ts +3 -0
- package/lib/components/APIKeyModal/APIKeyModal.d.ts +2 -1
- package/lib/components/APIKeyModal/APIKeyModal.js +13 -9
- package/lib/components/APIKeyModal/APIKeyModal.types.d.ts +206 -0
- package/lib/components/Datagrid/Datagrid/DatagridHeaderRow.js +2 -0
- package/lib/components/Datagrid/Datagrid/addons/RowSize/RowSizeDropdown.d.ts +1 -2
- package/lib/components/Datagrid/useInitialColumnSort.d.ts +1 -0
- package/lib/components/Datagrid/useInitialColumnSort.js +46 -0
- package/lib/components/Datagrid/useSortableColumns.d.ts +4 -0
- package/lib/components/Datagrid/useSortableColumns.js +16 -15
- package/lib/components/DescriptionList/DescriptionList.d.ts +42 -0
- package/lib/components/DescriptionList/DescriptionList.js +95 -0
- package/lib/components/DescriptionList/constants.d.ts +6 -0
- package/lib/components/DescriptionList/constants.js +20 -0
- package/lib/components/DescriptionList/index.d.ts +1 -0
- package/lib/components/EmptyStates/EmptyStateContent.d.ts +1 -287
- package/lib/components/HTTPErrors/HTTPErrorContent.d.ts +1 -293
- package/lib/components/StatusIndicator/StatusIndicator.d.ts +5 -0
- package/lib/components/StatusIndicator/StatusIndicator.js +107 -0
- package/lib/components/StatusIndicator/StatusIndicatorStep.d.ts +5 -0
- package/lib/components/StatusIndicator/index.d.ts +2 -0
- package/lib/components/index.d.ts +2 -0
- package/lib/global/js/package-settings.d.ts +3 -0
- package/lib/global/js/package-settings.js +3 -0
- package/lib/index.js +10 -0
- package/lib/settings.d.ts +3 -0
- package/package.json +2 -2
- package/scss/components/DescriptionList/_carbon-imports.scss +9 -0
- package/scss/components/DescriptionList/_description-list.scss +103 -0
- package/scss/components/DescriptionList/_index-with-carbon.scss +9 -0
- package/scss/components/DescriptionList/_index.scss +8 -0
- package/scss/components/SidePanel/_side-panel.scss +6 -1
- package/scss/components/StatusIndicator/_carbon-imports.scss +12 -0
- package/scss/components/StatusIndicator/_index-with-carbon.scss +9 -0
- package/scss/components/StatusIndicator/_index.scss +8 -0
- package/scss/components/StatusIndicator/_status-indicator.scss +93 -0
- package/scss/components/Tearsheet/_tearsheet.scss +41 -15
- package/scss/components/_index-with-carbon.scss +2 -0
- package/scss/components/_index.scss +2 -0
@@ -0,0 +1,206 @@
|
|
1
|
+
import { ReactNode } from 'react';
|
2
|
+
interface APIKeyModalCommonProps {
|
3
|
+
/**
|
4
|
+
* the api key that's displayed to the user when a request to create is fulfilled.
|
5
|
+
*/
|
6
|
+
apiKey?: string;
|
7
|
+
/**
|
8
|
+
* label for the text input that holds the api key.
|
9
|
+
*/
|
10
|
+
apiKeyLabel?: string;
|
11
|
+
/**
|
12
|
+
* the name of the api key. should only be supplied in edit mode.
|
13
|
+
*/
|
14
|
+
apiKeyName?: string;
|
15
|
+
/**
|
16
|
+
* body content for the modal
|
17
|
+
*/
|
18
|
+
body?: string;
|
19
|
+
/**
|
20
|
+
* optional class name
|
21
|
+
*/
|
22
|
+
className?: string;
|
23
|
+
/**
|
24
|
+
* text for the close button
|
25
|
+
*/
|
26
|
+
closeButtonText?: string;
|
27
|
+
/**
|
28
|
+
* text for the copy button
|
29
|
+
*/
|
30
|
+
copyButtonText?: string;
|
31
|
+
/**
|
32
|
+
* Error message for when the copy function fails
|
33
|
+
*/
|
34
|
+
copyErrorText?: string;
|
35
|
+
/**
|
36
|
+
* text description for the copy button icon
|
37
|
+
*/
|
38
|
+
copyIconDescription?: string;
|
39
|
+
/**
|
40
|
+
* if you need more options for key creation beyond just the name use custom steps to obtain whatever data is required.
|
41
|
+
*/
|
42
|
+
customSteps?: Array<{
|
43
|
+
valid?: boolean;
|
44
|
+
content?: ReactNode;
|
45
|
+
title?: string;
|
46
|
+
}>;
|
47
|
+
/**
|
48
|
+
* designates if the modal is in the edit mode
|
49
|
+
*/
|
50
|
+
editing?: boolean;
|
51
|
+
/**
|
52
|
+
* designates if an error has occurred in a request
|
53
|
+
*/
|
54
|
+
error?: boolean;
|
55
|
+
/**
|
56
|
+
* text to display if an error has occurred
|
57
|
+
*/
|
58
|
+
errorText?: string;
|
59
|
+
/**
|
60
|
+
* default primary button text for modal in assumed default mode create or generate.
|
61
|
+
* in create mode this is the button text prior to supplying an api key, which then
|
62
|
+
* uses copyButtonText
|
63
|
+
*/
|
64
|
+
generateButtonText?: string;
|
65
|
+
/**
|
66
|
+
* content to display if generate request was successful
|
67
|
+
*/
|
68
|
+
generateSuccessBody?: ReactNode;
|
69
|
+
/**
|
70
|
+
* title for a successful key generation
|
71
|
+
*/
|
72
|
+
generateSuccessTitle?: string;
|
73
|
+
/**
|
74
|
+
* default title for the modal in generate key mode
|
75
|
+
*/
|
76
|
+
generateTitle?: string;
|
77
|
+
/**
|
78
|
+
* designates if the api input has the visibility toggle enabled
|
79
|
+
*/
|
80
|
+
hasAPIKeyVisibilityToggle?: boolean;
|
81
|
+
/**
|
82
|
+
* designates if user is able to download the api key
|
83
|
+
*/
|
84
|
+
hasDownloadLink?: boolean;
|
85
|
+
/**
|
86
|
+
* label text that's displayed when hovering over visibility toggler to hide key
|
87
|
+
*/
|
88
|
+
hideAPIKeyLabel?: string;
|
89
|
+
/**
|
90
|
+
* designates if the modal is in a loading state via a request or some other in progress operation
|
91
|
+
*/
|
92
|
+
loading?: boolean;
|
93
|
+
/**
|
94
|
+
* text that displays while modal is in the loading state
|
95
|
+
*/
|
96
|
+
loadingText?: string;
|
97
|
+
/**
|
98
|
+
* general label text for modal
|
99
|
+
*/
|
100
|
+
modalLabel?: string;
|
101
|
+
/**
|
102
|
+
* helper text for name input
|
103
|
+
*/
|
104
|
+
nameHelperText?: string;
|
105
|
+
/**
|
106
|
+
* label for api key name input
|
107
|
+
*/
|
108
|
+
nameLabel?: string;
|
109
|
+
/**
|
110
|
+
* placeholder text for api key name input
|
111
|
+
*/
|
112
|
+
namePlaceholder?: string;
|
113
|
+
/**
|
114
|
+
* designates if a name is required or not for key generation. NOTE- if using custom steps set this to false since you will be using your own validation
|
115
|
+
*/
|
116
|
+
nameRequired?: boolean;
|
117
|
+
/**
|
118
|
+
* handler for on modal close
|
119
|
+
*/
|
120
|
+
onClose?(): void;
|
121
|
+
/**
|
122
|
+
* Optional callback if you want to use your own copy function instead of the build in one
|
123
|
+
* onCopy(apiKey)
|
124
|
+
*/
|
125
|
+
onCopy?(apiKey: string): void;
|
126
|
+
/**
|
127
|
+
* handler for api key edit
|
128
|
+
*/
|
129
|
+
onRequestEdit?(apiKeyName: string): void;
|
130
|
+
/**
|
131
|
+
* handler for api key generation
|
132
|
+
*/
|
133
|
+
onRequestGenerate?(apiKeyName: string): void;
|
134
|
+
/**
|
135
|
+
* designates if modal is open or closed
|
136
|
+
*/
|
137
|
+
open: boolean;
|
138
|
+
/**
|
139
|
+
* The DOM node the tearsheet should be rendered within. Defaults to document.body.
|
140
|
+
*/
|
141
|
+
portalTarget: ReactNode;
|
142
|
+
/**
|
143
|
+
* label text that's displayed when hovering over visibility toggler to show key
|
144
|
+
*/
|
145
|
+
showAPIKeyLabel?: string;
|
146
|
+
}
|
147
|
+
type CustomStepConditionalProps = {
|
148
|
+
/**
|
149
|
+
* if you need more options for key creation beyond just the name use custom steps to obtain whatever data is required.
|
150
|
+
*/
|
151
|
+
customSteps?: Array<{
|
152
|
+
valid?: boolean;
|
153
|
+
content?: ReactNode;
|
154
|
+
title?: string;
|
155
|
+
}>;
|
156
|
+
/**
|
157
|
+
* text that displays in the secondary button when using custom steps to indicate to the user that there is a previous step
|
158
|
+
*/
|
159
|
+
previousStepButtonText: string;
|
160
|
+
/**
|
161
|
+
* text that displays in the primary button when using custom steps to indicate to the user that there is a next step
|
162
|
+
*/
|
163
|
+
nextStepButtonText: string;
|
164
|
+
};
|
165
|
+
type EditingConditionalProps = {
|
166
|
+
/**
|
167
|
+
* designates if the modal is in the edit mode
|
168
|
+
*/
|
169
|
+
editing?: boolean;
|
170
|
+
/**
|
171
|
+
* text for the edit button
|
172
|
+
*/
|
173
|
+
editButtonText: string;
|
174
|
+
/**
|
175
|
+
* designates if the edit request was successful
|
176
|
+
*/
|
177
|
+
editSuccess: boolean;
|
178
|
+
/**
|
179
|
+
* title for a successful edit
|
180
|
+
*/
|
181
|
+
editSuccessTitle: string;
|
182
|
+
};
|
183
|
+
type HasDownloadLinkProps = {
|
184
|
+
/**
|
185
|
+
* designates if user is able to download the api key
|
186
|
+
*/
|
187
|
+
hasDownloadLink?: boolean;
|
188
|
+
/**
|
189
|
+
* the content that appears that indicates the key is downloadable
|
190
|
+
*/
|
191
|
+
downloadBodyText: string;
|
192
|
+
/**
|
193
|
+
* designates the name of downloadable json file with the key. if not specified will default to 'apikey'
|
194
|
+
*/
|
195
|
+
downloadFileName: string;
|
196
|
+
/**
|
197
|
+
* designates the file type for the downloadable key
|
198
|
+
*/
|
199
|
+
downloadFileType: 'txt' | 'json';
|
200
|
+
/**
|
201
|
+
* anchor text for the download link
|
202
|
+
*/
|
203
|
+
downloadLinkText: string;
|
204
|
+
};
|
205
|
+
export type APIKeyModalProps = APIKeyModalCommonProps & CustomStepConditionalProps & EditingConditionalProps & HasDownloadLinkProps;
|
206
|
+
export {};
|
@@ -19,6 +19,7 @@ var settings = require('../../../settings.js');
|
|
19
19
|
var stateReducer = require('./addons/stateReducer.js');
|
20
20
|
var getNodeTextContent = require('../../../global/js/utils/getNodeTextContent.js');
|
21
21
|
var DatagridSlug = require('./addons/Slug/DatagridSlug.js');
|
22
|
+
var useInitialColumnSort = require('../useInitialColumnSort.js');
|
22
23
|
|
23
24
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
24
25
|
|
@@ -101,6 +102,7 @@ var HeaderRow = function HeaderRow(datagridState, headRef, headerGroup) {
|
|
101
102
|
isTableSortable = datagridState.isTableSortable,
|
102
103
|
rows = datagridState.rows,
|
103
104
|
isFetching = datagridState.isFetching;
|
105
|
+
useInitialColumnSort.useInitialColumnSort(datagridState);
|
104
106
|
// Used to measure the height of the table and uses that value
|
105
107
|
// to display a vertical line to indicate the column you are resizing
|
106
108
|
React.useEffect(function () {
|
@@ -6,7 +6,7 @@ declare function RowSizeDropdown({ align, legendText, ...props }: {
|
|
6
6
|
}): import("react/jsx-runtime").JSX.Element;
|
7
7
|
declare namespace RowSizeDropdown {
|
8
8
|
namespace propTypes {
|
9
|
-
let align:
|
9
|
+
let align: any;
|
10
10
|
let datagridName: PropTypes.Requireable<string>;
|
11
11
|
let legendText: PropTypes.Requireable<string>;
|
12
12
|
let light: PropTypes.Requireable<boolean>;
|
@@ -14,5 +14,4 @@ declare namespace RowSizeDropdown {
|
|
14
14
|
let selectedOption: PropTypes.Requireable<string>;
|
15
15
|
}
|
16
16
|
}
|
17
|
-
import React from 'react';
|
18
17
|
import PropTypes from 'prop-types';
|
@@ -0,0 +1 @@
|
|
1
|
+
export function useInitialColumnSort(instance: any): void;
|
@@ -0,0 +1,46 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright IBM Corp. 2020, 2024
|
3
|
+
*
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
6
|
+
*/
|
7
|
+
|
8
|
+
'use strict';
|
9
|
+
|
10
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
11
|
+
|
12
|
+
var _rollupPluginBabelHelpers = require('../../_virtual/_rollupPluginBabelHelpers.js');
|
13
|
+
var React = require('react');
|
14
|
+
var useSortableColumns = require('./useSortableColumns.js');
|
15
|
+
|
16
|
+
var useInitialColumnSort = function useInitialColumnSort(instance) {
|
17
|
+
var _useState = React.useState(false),
|
18
|
+
_useState2 = _rollupPluginBabelHelpers.slicedToArray(_useState, 2),
|
19
|
+
hasInitialSort = _useState2[0],
|
20
|
+
setHasInitialSort = _useState2[1];
|
21
|
+
React.useEffect(function () {
|
22
|
+
var initialState = instance.initialState,
|
23
|
+
headers = instance.headers,
|
24
|
+
onSort = instance.onSort,
|
25
|
+
isTableSortable = instance.isTableSortable;
|
26
|
+
var sortableColumn = initialState.sortableColumn;
|
27
|
+
var foundSortedCol = headers.some(function (h) {
|
28
|
+
return h.isSorted;
|
29
|
+
});
|
30
|
+
if (foundSortedCol || hasInitialSort || !isTableSortable) {
|
31
|
+
return;
|
32
|
+
}
|
33
|
+
if (sortableColumn) {
|
34
|
+
var columnId = sortableColumn.id,
|
35
|
+
order = sortableColumn.order;
|
36
|
+
var _getNewSortOrder = useSortableColumns.getNewSortOrder(order),
|
37
|
+
newSortDesc = _getNewSortOrder.newSortDesc,
|
38
|
+
newOrder = _getNewSortOrder.newOrder;
|
39
|
+
onSort === null || onSort === void 0 || onSort(columnId, newOrder);
|
40
|
+
instance.toggleSortBy(columnId, newSortDesc, false);
|
41
|
+
setHasInitialSort(true);
|
42
|
+
}
|
43
|
+
}, [instance, hasInitialSort]);
|
44
|
+
};
|
45
|
+
|
46
|
+
exports.useInitialColumnSort = useInitialColumnSort;
|
@@ -29,6 +29,21 @@ var ordering = {
|
|
29
29
|
DESC: 'DESC',
|
30
30
|
NONE: 'NONE'
|
31
31
|
};
|
32
|
+
var getNewSortOrder = function getNewSortOrder(sortOrder) {
|
33
|
+
var order = {
|
34
|
+
newSortDesc: undefined,
|
35
|
+
newOrder: ordering.NONE
|
36
|
+
};
|
37
|
+
if (sortOrder === false || sortOrder === ordering.DESC) {
|
38
|
+
order.newOrder = ordering.DESC;
|
39
|
+
order.newSortDesc = true;
|
40
|
+
}
|
41
|
+
if (sortOrder === undefined || sortOrder === ordering.ASC) {
|
42
|
+
order.newOrder = ordering.ASC;
|
43
|
+
order.newSortDesc = false;
|
44
|
+
}
|
45
|
+
return order;
|
46
|
+
};
|
32
47
|
var getAriaSortValue = function getAriaSortValue(col, _ref) {
|
33
48
|
var ascendingSortableLabelText = _ref.ascendingSortableLabelText,
|
34
49
|
descendingSortableLabelText = _ref.descendingSortableLabelText,
|
@@ -137,24 +152,10 @@ var useSortableColumns = function useSortableColumns(hooks) {
|
|
137
152
|
isTableSortable: true
|
138
153
|
});
|
139
154
|
};
|
140
|
-
var getNewSortOrder = function getNewSortOrder(sortOrder) {
|
141
|
-
var order = {
|
142
|
-
newSortDesc: undefined,
|
143
|
-
newOrder: ordering.NONE
|
144
|
-
};
|
145
|
-
if (sortOrder === false) {
|
146
|
-
order.newOrder = ordering.DESC;
|
147
|
-
order.newSortDesc = true;
|
148
|
-
}
|
149
|
-
if (sortOrder === undefined) {
|
150
|
-
order.newOrder = ordering.ASC;
|
151
|
-
order.newSortDesc = false;
|
152
|
-
}
|
153
|
-
return order;
|
154
|
-
};
|
155
155
|
hooks.visibleColumns.push(sortableVisibleColumns);
|
156
156
|
hooks.useInstance.push(sortInstanceProps);
|
157
157
|
};
|
158
158
|
var useSortableColumns$1 = useSortableColumns;
|
159
159
|
|
160
160
|
exports["default"] = useSortableColumns$1;
|
161
|
+
exports.getNewSortOrder = getNewSortOrder;
|
@@ -0,0 +1,42 @@
|
|
1
|
+
/**
|
2
|
+
* Type layouts provide an orderly layout of terms and definitions.
|
3
|
+
*/
|
4
|
+
export let DescriptionList: React.ForwardRefExoticComponent<React.RefAttributes<any>>;
|
5
|
+
export function DescriptionListBody({ children, className, ...rest }: {
|
6
|
+
[x: string]: any;
|
7
|
+
children: any;
|
8
|
+
className: any;
|
9
|
+
}): import("react/jsx-runtime").JSX.Element;
|
10
|
+
export namespace DescriptionListBody {
|
11
|
+
export namespace propTypes {
|
12
|
+
let children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
13
|
+
let className: PropTypes.Requireable<string>;
|
14
|
+
}
|
15
|
+
export { componentNameBody as displayName };
|
16
|
+
}
|
17
|
+
export function DescriptionListRow({ children, className, ...other }: {
|
18
|
+
[x: string]: any;
|
19
|
+
children: any;
|
20
|
+
className: any;
|
21
|
+
}): import("react/jsx-runtime").JSX.Element;
|
22
|
+
export namespace DescriptionListRow {
|
23
|
+
export namespace propTypes_1 { }
|
24
|
+
export { propTypes_1 as propTypes };
|
25
|
+
export { componentNameRow as displayName };
|
26
|
+
}
|
27
|
+
export function DescriptionListCell({ children, className, ...rest }: {
|
28
|
+
[x: string]: any;
|
29
|
+
children: any;
|
30
|
+
className: any;
|
31
|
+
}): import("react/jsx-runtime").JSX.Element;
|
32
|
+
export namespace DescriptionListCell {
|
33
|
+
export namespace propTypes_2 { }
|
34
|
+
export { propTypes_2 as propTypes };
|
35
|
+
export { componentNameCell as displayName };
|
36
|
+
}
|
37
|
+
import React from 'react';
|
38
|
+
import PropTypes from 'prop-types';
|
39
|
+
declare const componentNameBody: "DescriptionListBody";
|
40
|
+
declare const componentNameRow: "DescriptionListRow";
|
41
|
+
declare const componentNameCell: "DescriptionListCell";
|
42
|
+
export {};
|
@@ -0,0 +1,95 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright IBM Corp. 2020, 2024
|
3
|
+
*
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
6
|
+
*/
|
7
|
+
|
8
|
+
'use strict';
|
9
|
+
|
10
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
11
|
+
|
12
|
+
var _rollupPluginBabelHelpers = require('../../_virtual/_rollupPluginBabelHelpers.js');
|
13
|
+
var React = require('react');
|
14
|
+
var index = require('../../node_modules/prop-types/index.js');
|
15
|
+
var cx = require('classnames');
|
16
|
+
var devtools = require('../../global/js/utils/devtools.js');
|
17
|
+
var settings = require('../../settings.js');
|
18
|
+
var constants = require('./constants.js');
|
19
|
+
var react = require('@carbon/react');
|
20
|
+
|
21
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
22
|
+
|
23
|
+
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
24
|
+
var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
|
25
|
+
|
26
|
+
var _excluded = ["border", "children", "className", "size"];
|
27
|
+
|
28
|
+
// The block part of our conventional BEM class names (blockClass__E--M).
|
29
|
+
var blockClass = "".concat(settings.pkg.prefix, "--description-list");
|
30
|
+
var componentName = 'DescriptionList';
|
31
|
+
|
32
|
+
// NOTE: the component SCSS is not imported here: it is rolled up separately.
|
33
|
+
|
34
|
+
// Default values can be included here and then assigned to the prop params,
|
35
|
+
// e.g. prop = defaults.prop,
|
36
|
+
// This gathers default values together neatly and ensures non-primitive
|
37
|
+
// values are initialized early to avoid react making unnecessary re-renders.
|
38
|
+
// Note that default values are not required for props that are 'required',
|
39
|
+
// nor for props where the component can apply undefined values reasonably.
|
40
|
+
// Default values should be provided when the component needs to make a choice
|
41
|
+
// or assumption when a prop is not supplied.
|
42
|
+
|
43
|
+
// Default values for props
|
44
|
+
var defaults = {
|
45
|
+
border: false,
|
46
|
+
size: constants.DescriptionListSize.Medium
|
47
|
+
};
|
48
|
+
|
49
|
+
/**
|
50
|
+
* Type layouts provide an orderly layout of terms and definitions.
|
51
|
+
*/
|
52
|
+
exports.DescriptionList = /*#__PURE__*/React__default["default"].forwardRef(function (_ref, ref) {
|
53
|
+
var _ref$border = _ref.border,
|
54
|
+
border = _ref$border === void 0 ? defaults.border : _ref$border,
|
55
|
+
children = _ref.children,
|
56
|
+
className = _ref.className,
|
57
|
+
_ref$size = _ref.size,
|
58
|
+
size = _ref$size === void 0 ? defaults.size : _ref$size,
|
59
|
+
rest = _rollupPluginBabelHelpers.objectWithoutProperties(_ref, _excluded);
|
60
|
+
return /*#__PURE__*/React__default["default"].createElement("div", _rollupPluginBabelHelpers["extends"]({}, rest, {
|
61
|
+
className: cx__default["default"](blockClass, // Apply the block class to the main HTML element
|
62
|
+
_rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty({}, "".concat(blockClass, "--bordered"), border), "".concat(blockClass, "--").concat(size), size), className // Apply any supplied class names to the main HTML element.
|
63
|
+
),
|
64
|
+
ref: ref
|
65
|
+
}, devtools.getDevtoolsProps(componentName)), /*#__PURE__*/React__default["default"].createElement(react.StructuredListWrapper, {
|
66
|
+
role: "table",
|
67
|
+
selection: false
|
68
|
+
}, children));
|
69
|
+
});
|
70
|
+
|
71
|
+
// Return a placeholder if not released and not enabled by feature flag
|
72
|
+
exports.DescriptionList = settings.pkg.checkComponentEnabled(exports.DescriptionList, componentName);
|
73
|
+
|
74
|
+
// The display name of the component, used by React. Note that displayName
|
75
|
+
// is used in preference to relying on function.name.
|
76
|
+
exports.DescriptionList.displayName = componentName;
|
77
|
+
var propTypes = {
|
78
|
+
/** Provide the contents of the node */
|
79
|
+
children: index["default"].node,
|
80
|
+
/** Provide an optional class to be applied to the containing node */
|
81
|
+
className: index["default"].string
|
82
|
+
};
|
83
|
+
|
84
|
+
// The types and DocGen commentary for the component props,
|
85
|
+
// in alphabetical order (for consistency).
|
86
|
+
// See https://www.npmjs.com/package/prop-types#usage.
|
87
|
+
exports.DescriptionList.propTypes = _rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, propTypes), {}, {
|
88
|
+
/** Specify if the type layout has a border */
|
89
|
+
border: index["default"].bool,
|
90
|
+
/** Specify the size of the type layout, from a list of available sizes */
|
91
|
+
size: index["default"].oneOf(Object.values(constants.DescriptionListSize))
|
92
|
+
});
|
93
|
+
_rollupPluginBabelHelpers.objectSpread2({}, propTypes);
|
94
|
+
_rollupPluginBabelHelpers.objectSpread2({}, propTypes);
|
95
|
+
_rollupPluginBabelHelpers.objectSpread2({}, propTypes);
|
@@ -0,0 +1,20 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright IBM Corp. 2020, 2024
|
3
|
+
*
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
6
|
+
*/
|
7
|
+
|
8
|
+
'use strict';
|
9
|
+
|
10
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
11
|
+
|
12
|
+
var DescriptionListSize = {
|
13
|
+
XSmall: 'xs',
|
14
|
+
Small: 'sm',
|
15
|
+
Medium: 'md',
|
16
|
+
// default
|
17
|
+
Large: 'lg'
|
18
|
+
};
|
19
|
+
|
20
|
+
exports.DescriptionListSize = DescriptionListSize;
|
@@ -0,0 +1 @@
|
|
1
|
+
export { DescriptionList, DescriptionListBody, DescriptionListRow, DescriptionListCell } from "./DescriptionList";
|