@carbon/ibm-products 2.28.0 → 2.29.0-alpha.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (79) hide show
  1. package/css/index-full-carbon.css +226 -17
  2. package/css/index-full-carbon.css.map +1 -1
  3. package/css/index-full-carbon.min.css +1 -1
  4. package/css/index-full-carbon.min.css.map +1 -1
  5. package/css/index-without-carbon-released-only.css +41 -9
  6. package/css/index-without-carbon-released-only.css.map +1 -1
  7. package/css/index-without-carbon-released-only.min.css +1 -1
  8. package/css/index-without-carbon-released-only.min.css.map +1 -1
  9. package/css/index-without-carbon.css +226 -17
  10. package/css/index-without-carbon.css.map +1 -1
  11. package/css/index-without-carbon.min.css +1 -1
  12. package/css/index-without-carbon.min.css.map +1 -1
  13. package/css/index.css +189 -9
  14. package/css/index.css.map +1 -1
  15. package/css/index.min.css +1 -1
  16. package/css/index.min.css.map +1 -1
  17. package/es/components/APIKeyModal/APIKeyModal.d.ts +2 -1
  18. package/es/components/APIKeyModal/APIKeyModal.js +13 -9
  19. package/es/components/APIKeyModal/APIKeyModal.types.d.ts +206 -0
  20. package/es/components/Datagrid/Datagrid/DatagridHeaderRow.js +2 -0
  21. package/es/components/Datagrid/Datagrid/addons/RowSize/RowSizeDropdown.d.ts +1 -2
  22. package/es/components/Datagrid/useInitialColumnSort.d.ts +1 -0
  23. package/es/components/Datagrid/useInitialColumnSort.js +42 -0
  24. package/es/components/Datagrid/useSortableColumns.d.ts +4 -0
  25. package/es/components/Datagrid/useSortableColumns.js +16 -16
  26. package/es/components/DescriptionList/DescriptionList.d.ts +42 -0
  27. package/es/components/DescriptionList/DescriptionList.js +88 -0
  28. package/es/components/DescriptionList/constants.d.ts +6 -0
  29. package/es/components/DescriptionList/constants.js +16 -0
  30. package/es/components/DescriptionList/index.d.ts +1 -0
  31. package/es/components/EmptyStates/EmptyStateContent.d.ts +1 -287
  32. package/es/components/HTTPErrors/HTTPErrorContent.d.ts +1 -293
  33. package/es/components/StatusIndicator/StatusIndicator.d.ts +5 -0
  34. package/es/components/StatusIndicator/StatusIndicator.js +100 -0
  35. package/es/components/StatusIndicator/StatusIndicatorStep.d.ts +5 -0
  36. package/es/components/StatusIndicator/index.d.ts +2 -0
  37. package/es/components/index.d.ts +2 -0
  38. package/es/global/js/package-settings.d.ts +3 -0
  39. package/es/global/js/package-settings.js +3 -0
  40. package/es/index.js +2 -0
  41. package/es/settings.d.ts +3 -0
  42. package/lib/components/APIKeyModal/APIKeyModal.d.ts +2 -1
  43. package/lib/components/APIKeyModal/APIKeyModal.js +13 -9
  44. package/lib/components/APIKeyModal/APIKeyModal.types.d.ts +206 -0
  45. package/lib/components/Datagrid/Datagrid/DatagridHeaderRow.js +2 -0
  46. package/lib/components/Datagrid/Datagrid/addons/RowSize/RowSizeDropdown.d.ts +1 -2
  47. package/lib/components/Datagrid/useInitialColumnSort.d.ts +1 -0
  48. package/lib/components/Datagrid/useInitialColumnSort.js +46 -0
  49. package/lib/components/Datagrid/useSortableColumns.d.ts +4 -0
  50. package/lib/components/Datagrid/useSortableColumns.js +16 -15
  51. package/lib/components/DescriptionList/DescriptionList.d.ts +42 -0
  52. package/lib/components/DescriptionList/DescriptionList.js +95 -0
  53. package/lib/components/DescriptionList/constants.d.ts +6 -0
  54. package/lib/components/DescriptionList/constants.js +20 -0
  55. package/lib/components/DescriptionList/index.d.ts +1 -0
  56. package/lib/components/EmptyStates/EmptyStateContent.d.ts +1 -287
  57. package/lib/components/HTTPErrors/HTTPErrorContent.d.ts +1 -293
  58. package/lib/components/StatusIndicator/StatusIndicator.d.ts +5 -0
  59. package/lib/components/StatusIndicator/StatusIndicator.js +107 -0
  60. package/lib/components/StatusIndicator/StatusIndicatorStep.d.ts +5 -0
  61. package/lib/components/StatusIndicator/index.d.ts +2 -0
  62. package/lib/components/index.d.ts +2 -0
  63. package/lib/global/js/package-settings.d.ts +3 -0
  64. package/lib/global/js/package-settings.js +3 -0
  65. package/lib/index.js +10 -0
  66. package/lib/settings.d.ts +3 -0
  67. package/package.json +3 -3
  68. package/scss/components/DescriptionList/_carbon-imports.scss +9 -0
  69. package/scss/components/DescriptionList/_description-list.scss +103 -0
  70. package/scss/components/DescriptionList/_index-with-carbon.scss +9 -0
  71. package/scss/components/DescriptionList/_index.scss +8 -0
  72. package/scss/components/SidePanel/_side-panel.scss +6 -1
  73. package/scss/components/StatusIndicator/_carbon-imports.scss +12 -0
  74. package/scss/components/StatusIndicator/_index-with-carbon.scss +9 -0
  75. package/scss/components/StatusIndicator/_index.scss +8 -0
  76. package/scss/components/StatusIndicator/_status-indicator.scss +93 -0
  77. package/scss/components/Tearsheet/_tearsheet.scss +42 -16
  78. package/scss/components/_index-with-carbon.scss +2 -0
  79. package/scss/components/_index.scss +2 -0
@@ -1,2 +1,3 @@
1
- export let APIKeyModal: React.ForwardRefExoticComponent<React.RefAttributes<any>>;
2
1
  import React from 'react';
2
+ import { APIKeyModalProps } from './APIKeyModal.types';
3
+ export declare let APIKeyModal: React.FC<APIKeyModalProps>;
@@ -25,9 +25,10 @@ var componentName = 'APIKeyModal';
25
25
  // Default values for props
26
26
  var defaults = {
27
27
  apiKeyName: '',
28
- customSteps: Object.freeze([])
28
+ customSteps: []
29
29
  };
30
30
  var APIKeyModal = /*#__PURE__*/forwardRef(function (_ref, ref) {
31
+ var _customSteps$currentS3;
31
32
  var apiKey = _ref.apiKey,
32
33
  apiKeyLabel = _ref.apiKeyLabel,
33
34
  _ref$apiKeyName = _ref.apiKeyName,
@@ -117,8 +118,9 @@ var APIKeyModal = /*#__PURE__*/forwardRef(function (_ref, ref) {
117
118
  if (loading) {
118
119
  return true;
119
120
  }
120
- if (hasSteps && 'valid' in customSteps[currentStep]) {
121
- return !customSteps[currentStep].valid;
121
+ if (hasSteps && 'valid' in ((customSteps === null || customSteps === void 0 ? void 0 : customSteps[currentStep]) || [])) {
122
+ var _customSteps$currentS;
123
+ return !((_customSteps$currentS = customSteps[currentStep]) !== null && _customSteps$currentS !== void 0 && _customSteps$currentS.valid);
122
124
  }
123
125
  if (!hasSteps && nameRequired && !name) {
124
126
  return true;
@@ -149,7 +151,8 @@ var APIKeyModal = /*#__PURE__*/forwardRef(function (_ref, ref) {
149
151
  } else if (apiKeyLoaded) {
150
152
  setTitle(generateSuccessTitle);
151
153
  } else if (hasSteps) {
152
- setTitle(customSteps[currentStep].title);
154
+ var _customSteps$currentS2;
155
+ setTitle((_customSteps$currentS2 = customSteps[currentStep]) === null || _customSteps$currentS2 === void 0 ? void 0 : _customSteps$currentS2.title);
153
156
  } else {
154
157
  setTitle(generateTitle);
155
158
  }
@@ -160,7 +163,7 @@ var APIKeyModal = /*#__PURE__*/forwardRef(function (_ref, ref) {
160
163
  var onCloseHandler = function onCloseHandler() {
161
164
  setName('');
162
165
  setCurrentStep(0);
163
- onClose();
166
+ onClose === null || onClose === void 0 || onClose();
164
167
  };
165
168
  var submitHandler = /*#__PURE__*/function () {
166
169
  var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(e) {
@@ -204,9 +207,9 @@ var APIKeyModal = /*#__PURE__*/forwardRef(function (_ref, ref) {
204
207
  break;
205
208
  case 21:
206
209
  if (editing) {
207
- onRequestEdit(name);
210
+ onRequestEdit === null || onRequestEdit === void 0 || onRequestEdit(name);
208
211
  } else {
209
- onRequestGenerate(name);
212
+ onRequestGenerate === null || onRequestGenerate === void 0 || onRequestGenerate(name);
210
213
  }
211
214
  case 22:
212
215
  case "end":
@@ -240,7 +243,7 @@ var APIKeyModal = /*#__PURE__*/forwardRef(function (_ref, ref) {
240
243
  label: modalLabel
241
244
  }), /*#__PURE__*/React__default.createElement(ModalBody, {
242
245
  className: "".concat(blockClass, "__body-container")
243
- }, hasSteps && !apiKeyLoaded ? customSteps[currentStep].content : /*#__PURE__*/React__default.createElement(React__default.Fragment, null, body && /*#__PURE__*/React__default.createElement("p", {
246
+ }, hasSteps && !apiKeyLoaded ? (_customSteps$currentS3 = customSteps[currentStep]) === null || _customSteps$currentS3 === void 0 ? void 0 : _customSteps$currentS3.content : /*#__PURE__*/React__default.createElement(React__default.Fragment, null, body && /*#__PURE__*/React__default.createElement("p", {
244
247
  className: "".concat(blockClass, "__body")
245
248
  }, body), !editing && apiKey && hasAPIKeyVisibilityToggle && /*#__PURE__*/React__default.createElement(PasswordInput, {
246
249
  value: apiKey,
@@ -255,7 +258,7 @@ var APIKeyModal = /*#__PURE__*/forwardRef(function (_ref, ref) {
255
258
  id: apiKeyInputId.current
256
259
  }), (editing || !apiKeyLoaded && nameRequired) && /*#__PURE__*/React__default.createElement(Form, {
257
260
  onSubmit: submitHandler,
258
- "aria-label": title
261
+ "aria-label": title !== null && title !== void 0 ? title : undefined
259
262
  }, /*#__PURE__*/React__default.createElement(TextInput, {
260
263
  helperText: nameHelperText,
261
264
  placeholder: namePlaceholder,
@@ -363,6 +366,7 @@ APIKeyModal.propTypes = {
363
366
  /**
364
367
  * if you need more options for key creation beyond just the name use custom steps to obtain whatever data is required.
365
368
  */
369
+ /**@ts-ignore*/
366
370
  customSteps: PropTypes.arrayOf(PropTypes.shape({
367
371
  /**
368
372
  * designates if the step has passed whatever validation rules are in place.
@@ -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 {};
@@ -15,6 +15,7 @@ import { pkg } from '../../../settings.js';
15
15
  import { handleColumnResizeEndEvent, handleColumnResizingEvent } from './addons/stateReducer.js';
16
16
  import { getNodeTextContent } from '../../../global/js/utils/getNodeTextContent.js';
17
17
  import { DatagridSlug } from './addons/Slug/DatagridSlug.js';
18
+ import { useInitialColumnSort } from '../useInitialColumnSort.js';
18
19
 
19
20
  var _th;
20
21
  var _excluded = ["role"],
@@ -92,6 +93,7 @@ var HeaderRow = function HeaderRow(datagridState, headRef, headerGroup) {
92
93
  isTableSortable = datagridState.isTableSortable,
93
94
  rows = datagridState.rows,
94
95
  isFetching = datagridState.isFetching;
96
+ useInitialColumnSort(datagridState);
95
97
  // Used to measure the height of the table and uses that value
96
98
  // to display a vertical line to indicate the column you are resizing
97
99
  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: React.Validator<"left" | "right" | "top" | "top-left" | "top-right" | "bottom" | "bottom-left" | "bottom-right" | null | undefined> | undefined;
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,42 @@
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
+ import { slicedToArray as _slicedToArray } from '../../_virtual/_rollupPluginBabelHelpers.js';
9
+ import { useState, useEffect } from 'react';
10
+ import { getNewSortOrder } from './useSortableColumns.js';
11
+
12
+ var useInitialColumnSort = function useInitialColumnSort(instance) {
13
+ var _useState = useState(false),
14
+ _useState2 = _slicedToArray(_useState, 2),
15
+ hasInitialSort = _useState2[0],
16
+ setHasInitialSort = _useState2[1];
17
+ useEffect(function () {
18
+ var initialState = instance.initialState,
19
+ headers = instance.headers,
20
+ onSort = instance.onSort,
21
+ isTableSortable = instance.isTableSortable;
22
+ var sortableColumn = initialState.sortableColumn;
23
+ var foundSortedCol = headers.some(function (h) {
24
+ return h.isSorted;
25
+ });
26
+ if (foundSortedCol || hasInitialSort || !isTableSortable) {
27
+ return;
28
+ }
29
+ if (sortableColumn) {
30
+ var columnId = sortableColumn.id,
31
+ order = sortableColumn.order;
32
+ var _getNewSortOrder = getNewSortOrder(order),
33
+ newSortDesc = _getNewSortOrder.newSortDesc,
34
+ newOrder = _getNewSortOrder.newOrder;
35
+ onSort === null || onSort === void 0 || onSort(columnId, newOrder);
36
+ instance.toggleSortBy(columnId, newSortDesc, false);
37
+ setHasInitialSort(true);
38
+ }
39
+ }, [instance, hasInitialSort]);
40
+ };
41
+
42
+ export { useInitialColumnSort };
@@ -1,2 +1,6 @@
1
+ export function getNewSortOrder(sortOrder: any): {
2
+ newSortDesc: undefined;
3
+ newOrder: string;
4
+ };
1
5
  export default useSortableColumns;
2
6
  declare function useSortableColumns(hooks: any): void;
@@ -20,6 +20,21 @@ var ordering = {
20
20
  DESC: 'DESC',
21
21
  NONE: 'NONE'
22
22
  };
23
+ var getNewSortOrder = function getNewSortOrder(sortOrder) {
24
+ var order = {
25
+ newSortDesc: undefined,
26
+ newOrder: ordering.NONE
27
+ };
28
+ if (sortOrder === false || sortOrder === ordering.DESC) {
29
+ order.newOrder = ordering.DESC;
30
+ order.newSortDesc = true;
31
+ }
32
+ if (sortOrder === undefined || sortOrder === ordering.ASC) {
33
+ order.newOrder = ordering.ASC;
34
+ order.newSortDesc = false;
35
+ }
36
+ return order;
37
+ };
23
38
  var getAriaSortValue = function getAriaSortValue(col, _ref) {
24
39
  var ascendingSortableLabelText = _ref.ascendingSortableLabelText,
25
40
  descendingSortableLabelText = _ref.descendingSortableLabelText,
@@ -128,24 +143,9 @@ var useSortableColumns = function useSortableColumns(hooks) {
128
143
  isTableSortable: true
129
144
  });
130
145
  };
131
- var getNewSortOrder = function getNewSortOrder(sortOrder) {
132
- var order = {
133
- newSortDesc: undefined,
134
- newOrder: ordering.NONE
135
- };
136
- if (sortOrder === false) {
137
- order.newOrder = ordering.DESC;
138
- order.newSortDesc = true;
139
- }
140
- if (sortOrder === undefined) {
141
- order.newOrder = ordering.ASC;
142
- order.newSortDesc = false;
143
- }
144
- return order;
145
- };
146
146
  hooks.visibleColumns.push(sortableVisibleColumns);
147
147
  hooks.useInstance.push(sortInstanceProps);
148
148
  };
149
149
  var useSortableColumns$1 = useSortableColumns;
150
150
 
151
- export { useSortableColumns$1 as default };
151
+ export { useSortableColumns$1 as default, 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,88 @@
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
+ import { objectWithoutProperties as _objectWithoutProperties, extends as _extends, defineProperty as _defineProperty, objectSpread2 as _objectSpread2 } from '../../_virtual/_rollupPluginBabelHelpers.js';
9
+ import React__default from 'react';
10
+ import PropTypes from '../../node_modules/prop-types/index.js';
11
+ import cx from 'classnames';
12
+ import { getDevtoolsProps } from '../../global/js/utils/devtools.js';
13
+ import { pkg } from '../../settings.js';
14
+ import { DescriptionListSize } from './constants.js';
15
+ import { StructuredListWrapper } from '@carbon/react';
16
+
17
+ var _excluded = ["border", "children", "className", "size"];
18
+
19
+ // The block part of our conventional BEM class names (blockClass__E--M).
20
+ var blockClass = "".concat(pkg.prefix, "--description-list");
21
+ var componentName = 'DescriptionList';
22
+
23
+ // NOTE: the component SCSS is not imported here: it is rolled up separately.
24
+
25
+ // Default values can be included here and then assigned to the prop params,
26
+ // e.g. prop = defaults.prop,
27
+ // This gathers default values together neatly and ensures non-primitive
28
+ // values are initialized early to avoid react making unnecessary re-renders.
29
+ // Note that default values are not required for props that are 'required',
30
+ // nor for props where the component can apply undefined values reasonably.
31
+ // Default values should be provided when the component needs to make a choice
32
+ // or assumption when a prop is not supplied.
33
+
34
+ // Default values for props
35
+ var defaults = {
36
+ border: false,
37
+ size: DescriptionListSize.Medium
38
+ };
39
+
40
+ /**
41
+ * Type layouts provide an orderly layout of terms and definitions.
42
+ */
43
+ var DescriptionList = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
44
+ var _ref$border = _ref.border,
45
+ border = _ref$border === void 0 ? defaults.border : _ref$border,
46
+ children = _ref.children,
47
+ className = _ref.className,
48
+ _ref$size = _ref.size,
49
+ size = _ref$size === void 0 ? defaults.size : _ref$size,
50
+ rest = _objectWithoutProperties(_ref, _excluded);
51
+ return /*#__PURE__*/React__default.createElement("div", _extends({}, rest, {
52
+ className: cx(blockClass, // Apply the block class to the main HTML element
53
+ _defineProperty(_defineProperty({}, "".concat(blockClass, "--bordered"), border), "".concat(blockClass, "--").concat(size), size), className // Apply any supplied class names to the main HTML element.
54
+ ),
55
+ ref: ref
56
+ }, getDevtoolsProps(componentName)), /*#__PURE__*/React__default.createElement(StructuredListWrapper, {
57
+ role: "table",
58
+ selection: false
59
+ }, children));
60
+ });
61
+
62
+ // Return a placeholder if not released and not enabled by feature flag
63
+ DescriptionList = pkg.checkComponentEnabled(DescriptionList, componentName);
64
+
65
+ // The display name of the component, used by React. Note that displayName
66
+ // is used in preference to relying on function.name.
67
+ DescriptionList.displayName = componentName;
68
+ var propTypes = {
69
+ /** Provide the contents of the node */
70
+ children: PropTypes.node,
71
+ /** Provide an optional class to be applied to the containing node */
72
+ className: PropTypes.string
73
+ };
74
+
75
+ // The types and DocGen commentary for the component props,
76
+ // in alphabetical order (for consistency).
77
+ // See https://www.npmjs.com/package/prop-types#usage.
78
+ DescriptionList.propTypes = _objectSpread2(_objectSpread2({}, propTypes), {}, {
79
+ /** Specify if the type layout has a border */
80
+ border: PropTypes.bool,
81
+ /** Specify the size of the type layout, from a list of available sizes */
82
+ size: PropTypes.oneOf(Object.values(DescriptionListSize))
83
+ });
84
+ _objectSpread2({}, propTypes);
85
+ _objectSpread2({}, propTypes);
86
+ _objectSpread2({}, propTypes);
87
+
88
+ export { DescriptionList };
@@ -0,0 +1,6 @@
1
+ export namespace DescriptionListSize {
2
+ let XSmall: string;
3
+ let Small: string;
4
+ let Medium: string;
5
+ let Large: string;
6
+ }
@@ -0,0 +1,16 @@
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
+ var DescriptionListSize = {
9
+ XSmall: 'xs',
10
+ Small: 'sm',
11
+ Medium: 'md',
12
+ // default
13
+ Large: 'lg'
14
+ };
15
+
16
+ export { DescriptionListSize };
@@ -0,0 +1 @@
1
+ export { DescriptionList, DescriptionListBody, DescriptionListRow, DescriptionListCell } from "./DescriptionList";