@carbon/ibm-products 1.23.1 → 1.25.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (132) hide show
  1. package/css/index-full-carbon.css +274 -61
  2. package/css/index-full-carbon.css.map +1 -1
  3. package/css/index-full-carbon.min.css +1 -7
  4. package/css/index-full-carbon.min.css.map +1 -1
  5. package/css/index-without-carbon-released-only.css +41 -43
  6. package/css/index-without-carbon-released-only.css.map +1 -1
  7. package/css/index-without-carbon-released-only.min.css +1 -7
  8. package/css/index-without-carbon-released-only.min.css.map +1 -1
  9. package/css/index-without-carbon.css +274 -61
  10. package/css/index-without-carbon.css.map +1 -1
  11. package/css/index-without-carbon.min.css +1 -7
  12. package/css/index-without-carbon.min.css.map +1 -1
  13. package/css/index.css +274 -61
  14. package/css/index.css.map +1 -1
  15. package/css/index.min.css +1 -7
  16. package/css/index.min.css.map +1 -1
  17. package/es/components/AddSelect/AddSelect.js +1 -2
  18. package/es/components/AddSelect/AddSelectBody.js +5 -9
  19. package/es/components/AddSelect/AddSelectColumn.js +4 -1
  20. package/es/components/AddSelect/AddSelectList.js +1 -1
  21. package/es/components/AddSelect/AddSelectSidebar.js +4 -26
  22. package/es/components/Datagrid/Datagrid/Datagrid.js +17 -12
  23. package/es/components/Datagrid/Datagrid/DatagridRow.js +4 -2
  24. package/es/components/Datagrid/useExpandedRow.js +5 -12
  25. package/es/components/Datagrid/useOnRowClick.js +10 -3
  26. package/es/components/EditFullPage/EditFullPage.js +79 -0
  27. package/es/components/EditFullPage/index.js +7 -0
  28. package/es/components/EditTearsheet/EditTearsheet.js +205 -0
  29. package/es/components/EditTearsheet/EditTearsheetForm.js +103 -0
  30. package/es/components/EditTearsheet/index.js +8 -0
  31. package/es/components/EditTearsheet/preview-components/MultiFormEditTearsheet.js +230 -0
  32. package/es/components/EditTearsheetNarrow/EditTearsheetNarrow.js +79 -0
  33. package/es/components/EditTearsheetNarrow/index.js +7 -0
  34. package/es/components/EmptyStates/EmptyStateContent.js +2 -1
  35. package/es/components/ImportModal/ImportModal.js +10 -2
  36. package/es/components/WebTerminal/WebTerminal.js +25 -13
  37. package/es/components/WebTerminal/WebTerminalContentWrapper.js +8 -10
  38. package/es/components/WebTerminal/hooks/index.js +45 -0
  39. package/es/components/WebTerminal/index.js +2 -1
  40. package/es/components/WebTerminal/preview-components/Navigation.js +6 -10
  41. package/es/components/index.js +5 -2
  42. package/es/global/js/package-settings.js +5 -1
  43. package/lib/components/AddSelect/AddSelect.js +1 -2
  44. package/lib/components/AddSelect/AddSelectBody.js +5 -9
  45. package/lib/components/AddSelect/AddSelectColumn.js +3 -1
  46. package/lib/components/AddSelect/AddSelectList.js +1 -1
  47. package/lib/components/AddSelect/AddSelectSidebar.js +3 -26
  48. package/lib/components/Datagrid/Datagrid/Datagrid.js +17 -12
  49. package/lib/components/Datagrid/Datagrid/DatagridRow.js +3 -1
  50. package/lib/components/Datagrid/useExpandedRow.js +5 -20
  51. package/lib/components/Datagrid/useOnRowClick.js +10 -3
  52. package/lib/components/EditFullPage/EditFullPage.js +85 -0
  53. package/lib/components/EditFullPage/index.js +13 -0
  54. package/lib/components/EditTearsheet/EditTearsheet.js +229 -0
  55. package/lib/components/EditTearsheet/EditTearsheetForm.js +122 -0
  56. package/lib/components/EditTearsheet/index.js +21 -0
  57. package/lib/components/EditTearsheet/preview-components/MultiFormEditTearsheet.js +254 -0
  58. package/lib/components/EditTearsheetNarrow/EditTearsheetNarrow.js +85 -0
  59. package/lib/components/EditTearsheetNarrow/index.js +13 -0
  60. package/lib/components/EmptyStates/EmptyStateContent.js +2 -1
  61. package/lib/components/ImportModal/ImportModal.js +11 -2
  62. package/lib/components/WebTerminal/WebTerminal.js +26 -13
  63. package/lib/components/WebTerminal/WebTerminalContentWrapper.js +9 -9
  64. package/lib/components/WebTerminal/hooks/index.js +69 -0
  65. package/lib/components/WebTerminal/index.js +15 -1
  66. package/lib/components/WebTerminal/preview-components/Navigation.js +6 -10
  67. package/lib/components/index.js +37 -1
  68. package/lib/global/js/package-settings.js +5 -1
  69. package/package.json +10 -10
  70. package/scss/components/AddSelect/_add-select.scss +19 -2
  71. package/scss/components/Cascade/_cascade.scss +1 -1
  72. package/scss/components/CreateInfluencer/_create-influencer.scss +2 -0
  73. package/scss/components/Datagrid/_datagrid.scss +0 -1
  74. package/scss/components/Datagrid/_storybook-styles.scss +53 -0
  75. package/scss/components/Datagrid/styles/{datagrid.scss → _datagrid.scss} +93 -12
  76. package/scss/components/Datagrid/styles/{draggableElement.scss → _draggableElement.scss} +0 -0
  77. package/scss/components/Datagrid/styles/{index.scss → _index.scss} +0 -0
  78. package/scss/components/Datagrid/styles/{useActionsColumn.scss → _useActionsColumn.scss} +0 -0
  79. package/scss/components/Datagrid/styles/{useColumnCenterAlign.scss → _useColumnCenterAlign.scss} +0 -0
  80. package/scss/components/Datagrid/styles/{useColumnRightAlign.scss → _useColumnRightAlign.scss} +0 -0
  81. package/scss/components/Datagrid/styles/{useExpandedRow.scss → _useExpandedRow.scss} +0 -6
  82. package/scss/components/Datagrid/styles/{useNestedRows.scss → _useNestedRows.scss} +0 -0
  83. package/scss/components/Datagrid/styles/{useNestedTable.scss → _useNestedTable.scss} +0 -0
  84. package/scss/components/Datagrid/styles/{useSelectAllToggle.scss → _useSelectAllToggle.scss} +0 -0
  85. package/scss/components/Datagrid/styles/{useSortableColumns.scss → _useSortableColumns.scss} +0 -0
  86. package/scss/components/Datagrid/styles/{useStickyColumn.scss → _useStickyColumn.scss} +0 -0
  87. package/scss/components/Datagrid/styles/addons/{CustomizeColumnsModal.scss → _CustomizeColumnsModal.scss} +0 -0
  88. package/scss/components/Datagrid/styles/addons/{RowSizeDropdown.scss → _RowSizeDropdown.scss} +0 -0
  89. package/scss/components/EditFullPage/_edit-full-page.scss +34 -0
  90. package/scss/components/EditFullPage/_index.scss +8 -0
  91. package/scss/components/EditFullPage/_storybook-styles.scss +10 -0
  92. package/scss/components/EditTearsheet/_edit-tearsheet.scss +132 -0
  93. package/scss/components/EditTearsheet/_index.scss +8 -0
  94. package/scss/components/EditTearsheet/_storybook-styles.scss +55 -0
  95. package/scss/components/EditTearsheetNarrow/_edit-tearsheet-narrow.scss +34 -0
  96. package/scss/components/EditTearsheetNarrow/_index.scss +8 -0
  97. package/scss/components/EditTearsheetNarrow/_storybook-styles.scss +10 -0
  98. package/scss/components/EmptyStates/_empty-state.scss +16 -9
  99. package/scss/components/InlineEdit/_inline-edit.scss +8 -20
  100. package/scss/components/NotificationsPanel/_notifications-panel.scss +1 -0
  101. package/scss/components/PageHeader/_page-header.scss +3 -1
  102. package/scss/components/StatusIcon/_status-icon.scss +1 -1
  103. package/scss/components/Tearsheet/_tearsheet.scss +2 -2
  104. package/scss/components/_index.scss +3 -0
  105. package/css/components/Datagrid/styles/addons/CustomizeColumnsModal.css +0 -47
  106. package/css/components/Datagrid/styles/addons/CustomizeColumnsModal.css.map +0 -1
  107. package/css/components/Datagrid/styles/addons/RowSizeDropdown.css +0 -20
  108. package/css/components/Datagrid/styles/addons/RowSizeDropdown.css.map +0 -1
  109. package/css/components/Datagrid/styles/datagrid.css +0 -311
  110. package/css/components/Datagrid/styles/datagrid.css.map +0 -1
  111. package/css/components/Datagrid/styles/draggableElement.css +0 -57
  112. package/css/components/Datagrid/styles/draggableElement.css.map +0 -1
  113. package/css/components/Datagrid/styles/index.css +0 -664
  114. package/css/components/Datagrid/styles/index.css.map +0 -1
  115. package/css/components/Datagrid/styles/useActionsColumn.css +0 -23
  116. package/css/components/Datagrid/styles/useActionsColumn.css.map +0 -1
  117. package/css/components/Datagrid/styles/useColumnCenterAlign.css +0 -18
  118. package/css/components/Datagrid/styles/useColumnCenterAlign.css.map +0 -1
  119. package/css/components/Datagrid/styles/useColumnRightAlign.css +0 -28
  120. package/css/components/Datagrid/styles/useColumnRightAlign.css.map +0 -1
  121. package/css/components/Datagrid/styles/useExpandedRow.css +0 -12
  122. package/css/components/Datagrid/styles/useExpandedRow.css.map +0 -1
  123. package/css/components/Datagrid/styles/useNestedRows.css +0 -15
  124. package/css/components/Datagrid/styles/useNestedRows.css.map +0 -1
  125. package/css/components/Datagrid/styles/useNestedTable.css +0 -25
  126. package/css/components/Datagrid/styles/useNestedTable.css.map +0 -1
  127. package/css/components/Datagrid/styles/useSelectAllToggle.css +0 -28
  128. package/css/components/Datagrid/styles/useSelectAllToggle.css.map +0 -1
  129. package/css/components/Datagrid/styles/useSortableColumns.css +0 -50
  130. package/css/components/Datagrid/styles/useSortableColumns.css.map +0 -1
  131. package/css/components/Datagrid/styles/useStickyColumn.css +0 -35
  132. package/css/components/Datagrid/styles/useStickyColumn.css.map +0 -1
@@ -0,0 +1,230 @@
1
+ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
+
3
+ /* eslint-disable react/prop-types */
4
+
5
+ /**
6
+ * Copyright IBM Corp. 2022, 2022
7
+ *
8
+ * This source code is licensed under the Apache-2.0 license found in the
9
+ * LICENSE file in the root directory of this source tree.
10
+ */
11
+ import React, { useState } from 'react';
12
+ import { Button, Column, InlineNotification, RadioButtonGroup, RadioButton, Row, TextInput, Toggle, NumberInput } from 'carbon-components-react';
13
+ import cx from 'classnames';
14
+ import { pkg } from '../../../settings';
15
+ import { EditTearsheet } from '../EditTearsheet';
16
+ import { EditTearsheetForm } from '../EditTearsheetForm';
17
+ var blockClass = "".concat(pkg.prefix, "--tearsheet-edit-multi-form");
18
+ export var MultiFormEditTearsheet = function MultiFormEditTearsheet(_ref) {
19
+ var cancelButtonText = _ref.cancelButtonText,
20
+ className = _ref.className,
21
+ description = _ref.description,
22
+ influencerWidth = _ref.influencerWidth,
23
+ label = _ref.label,
24
+ submitButtonText = _ref.submitButtonText,
25
+ title = _ref.title;
26
+
27
+ var _useState = useState(false),
28
+ _useState2 = _slicedToArray(_useState, 2),
29
+ open = _useState2[0],
30
+ setOpen = _useState2[1];
31
+
32
+ var _useState3 = useState(false),
33
+ _useState4 = _slicedToArray(_useState3, 2),
34
+ hasSubmitError = _useState4[0],
35
+ setHasSubmitError = _useState4[1];
36
+
37
+ var _useState5 = useState('Topic name here'),
38
+ _useState6 = _slicedToArray(_useState5, 2),
39
+ formOneTextInputValue = _useState6[0],
40
+ setFormOneTextInputValue = _useState6[1];
41
+
42
+ var _useState7 = useState('Topic description here'),
43
+ _useState8 = _slicedToArray(_useState7, 2),
44
+ topicDescriptionValue = _useState8[0],
45
+ setTopicDescriptionValue = _useState8[1];
46
+
47
+ var _useState9 = useState('Topic value here'),
48
+ _useState10 = _slicedToArray(_useState9, 2),
49
+ topicVersionValue = _useState10[0],
50
+ setTopicVersionValue = _useState10[1];
51
+
52
+ var _useState11 = useState('Location here'),
53
+ _useState12 = _slicedToArray(_useState11, 2),
54
+ topicLocationValue = _useState12[0],
55
+ setTopicLocationValue = _useState12[1];
56
+
57
+ var _useState13 = useState(1),
58
+ _useState14 = _slicedToArray(_useState13, 2),
59
+ formTwoTextInputValue = _useState14[0],
60
+ setFormTwoTextInputValue = _useState14[1];
61
+
62
+ var _useState15 = useState('one-day'),
63
+ _useState16 = _slicedToArray(_useState15, 2),
64
+ formThreeTextInputValue = _useState16[0],
65
+ setFormThreeTextInputValue = _useState16[1];
66
+
67
+ var _useState17 = useState(false),
68
+ _useState18 = _slicedToArray(_useState17, 2),
69
+ isInvalid = _useState18[0],
70
+ setIsInvalid = _useState18[1];
71
+
72
+ var clearCreateData = function clearCreateData() {
73
+ setFormOneTextInputValue(formOneTextInputValue);
74
+ setTopicDescriptionValue(topicDescriptionValue);
75
+ setTopicVersionValue(topicVersionValue);
76
+ setTopicLocationValue(topicLocationValue);
77
+ setFormTwoTextInputValue(1);
78
+ setFormThreeTextInputValue('one-day');
79
+ setHasSubmitError(false);
80
+ setIsInvalid(false);
81
+ setOpen(false);
82
+ };
83
+
84
+ var handleModalClick = function handleModalClick() {
85
+ setOpen(!open);
86
+ };
87
+
88
+ return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("style", null, ".".concat(blockClass, " { opacity: 0 }"), ";"), /*#__PURE__*/React.createElement(Button, {
89
+ onClick: handleModalClick
90
+ }, open ? 'Close EditTearsheet' : 'Open EditTearsheet'), /*#__PURE__*/React.createElement(EditTearsheet, {
91
+ influencerWidth: influencerWidth,
92
+ label: label,
93
+ className: cx(blockClass, className),
94
+ submitButtonText: submitButtonText,
95
+ cancelButtonText: cancelButtonText,
96
+ description: description,
97
+ title: title,
98
+ open: open,
99
+ onHandleModalClick: handleModalClick,
100
+ onClose: clearCreateData
101
+ }, /*#__PURE__*/React.createElement(EditTearsheetForm, {
102
+ title: "Topic name",
103
+ fieldsetLegendText: "Topic information",
104
+ subtitle: "This is the unique name used to recognize your topic",
105
+ description: "It will also be used by your producers and consumers as part of the connection information, so make it something easy to recognize."
106
+ }, /*#__PURE__*/React.createElement(Row, null, /*#__PURE__*/React.createElement(Column, {
107
+ xlg: 8,
108
+ lg: 8,
109
+ md: 8,
110
+ sm: 8
111
+ }, /*#__PURE__*/React.createElement(TextInput, {
112
+ labelText: "Topic name",
113
+ placeholder: "Enter topic name",
114
+ id: "tearsheet-multi-form-story-text-input-multi-form-1",
115
+ value: formOneTextInputValue,
116
+ onChange: function onChange(event) {
117
+ if (event.target.value.length) {
118
+ setIsInvalid(false);
119
+ }
120
+
121
+ setFormOneTextInputValue(event.target.value);
122
+ },
123
+ invalid: isInvalid,
124
+ invalidText: "This is a required field",
125
+ onBlur: function onBlur() {
126
+ if (!formOneTextInputValue.length) {
127
+ setIsInvalid(true);
128
+ }
129
+ }
130
+ }), /*#__PURE__*/React.createElement(TextInput, {
131
+ labelText: "Topic description (optional)",
132
+ id: "tearsheet-multi-form-story-text-input-multi-form-1-input-2",
133
+ value: topicDescriptionValue,
134
+ placeholder: "Enter topic description",
135
+ onChange: function onChange(event) {
136
+ return setTopicDescriptionValue(event.target.value);
137
+ }
138
+ }), /*#__PURE__*/React.createElement(TextInput, {
139
+ labelText: "Topic version (optional)",
140
+ id: "tearsheet-multi-form-story-text-input-multi-form-1-input-3",
141
+ value: topicVersionValue,
142
+ placeholder: "Enter topic version",
143
+ onChange: function onChange(event) {
144
+ return setTopicVersionValue(event.target.value);
145
+ }
146
+ }), hasSubmitError && /*#__PURE__*/React.createElement(InlineNotification, {
147
+ kind: "error",
148
+ title: "Error",
149
+ subtitle: "Resolve errors to continue",
150
+ onClose: function onClose() {
151
+ return setHasSubmitError(!hasSubmitError);
152
+ }
153
+ }), /*#__PURE__*/React.createElement(Toggle, {
154
+ className: "".concat(blockClass, "__error--toggle"),
155
+ id: "simulated-error-toggle",
156
+ size: "sm",
157
+ labelText: "Simulate error",
158
+ onToggle: function onToggle() {
159
+ return setHasSubmitError(!hasSubmitError);
160
+ },
161
+ toggled: hasSubmitError
162
+ })))), /*#__PURE__*/React.createElement(EditTearsheetForm, {
163
+ title: "Location",
164
+ subtitle: "Custom form subtitle",
165
+ fieldsetLegendText: "",
166
+ description: "Custom form description (see storybook implementation for new custom form capability)"
167
+ }, /*#__PURE__*/React.createElement(Row, null, /*#__PURE__*/React.createElement(Column, {
168
+ xlg: 8,
169
+ lg: 8,
170
+ md: 8,
171
+ sm: 8
172
+ }, /*#__PURE__*/React.createElement(TextInput, {
173
+ value: topicLocationValue,
174
+ onChange: function onChange(event) {
175
+ return setTopicLocationValue(event.target.value);
176
+ },
177
+ id: "custom-form-input",
178
+ labelText: "Location",
179
+ placeholder: "Enter location"
180
+ })))), /*#__PURE__*/React.createElement(EditTearsheetForm, {
181
+ title: "Partitions",
182
+ subtitle: "One or more partitions make up a topic. A partition is an ordered list of messages.",
183
+ description: "Partitions are distributed across the brokers in order to increase the scalability of your topic. You can also use them to distribute messages across the members of a consumer group.",
184
+ fieldsetLegendText: "Partition information"
185
+ }, /*#__PURE__*/React.createElement(Row, null, /*#__PURE__*/React.createElement(Column, {
186
+ xlg: 3,
187
+ lg: 3
188
+ }, /*#__PURE__*/React.createElement(NumberInput, {
189
+ id: "carbon-number",
190
+ min: 1,
191
+ max: 100,
192
+ value: formTwoTextInputValue,
193
+ label: "Partitions",
194
+ helperText: "1 partition is sufficient for getting started but, production systems often have more.",
195
+ invalidText: "Max partitions is 100, min is 1",
196
+ onChange: function onChange(event) {
197
+ return setFormTwoTextInputValue(event.imaginaryTarget.value);
198
+ }
199
+ })))), /*#__PURE__*/React.createElement(EditTearsheetForm, {
200
+ title: "Message retention",
201
+ subtitle: "This is how long messages are retained before they are deleted.",
202
+ description: "If your messages are not read by a consumer within this time, they will be missed.",
203
+ fieldsetLegendText: "Message retention scheduling"
204
+ }, /*#__PURE__*/React.createElement(Row, null, /*#__PURE__*/React.createElement(Column, {
205
+ xlg: 8,
206
+ lg: 8,
207
+ md: 8,
208
+ sm: 8
209
+ }, /*#__PURE__*/React.createElement(RadioButtonGroup, {
210
+ legendText: "Message retention",
211
+ name: "radio-button-group",
212
+ defaultSelected: formThreeTextInputValue,
213
+ onChange: function onChange(value) {
214
+ return setFormThreeTextInputValue(value);
215
+ },
216
+ orientation: "vertical"
217
+ }, /*#__PURE__*/React.createElement(RadioButton, {
218
+ labelText: "A day",
219
+ value: "one-day",
220
+ id: "one-day"
221
+ }), /*#__PURE__*/React.createElement(RadioButton, {
222
+ labelText: "A week",
223
+ value: "one-week",
224
+ id: "one-week"
225
+ }), /*#__PURE__*/React.createElement(RadioButton, {
226
+ labelText: "A month",
227
+ value: "one-month",
228
+ id: "one-month"
229
+ })))))));
230
+ };
@@ -0,0 +1,79 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
+ var _excluded = ["children", "className"];
4
+
5
+ /**
6
+ * Copyright IBM Corp. 2022, 2022
7
+ *
8
+ * This source code is licensed under the Apache-2.0 license found in the
9
+ * LICENSE file in the root directory of this source tree.
10
+ */
11
+ // Import portions of React that are needed.
12
+ import React from 'react'; // Other standard imports.
13
+
14
+ import PropTypes from 'prop-types';
15
+ import cx from 'classnames';
16
+ import { getDevtoolsProps } from '../../global/js/utils/devtools';
17
+ import { pkg
18
+ /*, carbon */
19
+ } from '../../settings'; // Carbon and package components we use.
20
+
21
+ /* TODO: @import(s) of carbon components and other package components. */
22
+ // The block part of our conventional BEM class names (blockClass__E--M).
23
+
24
+ var blockClass = "".concat(pkg.prefix, "--edit-tearsheet-narrow");
25
+ var componentName = 'EditTearsheetNarrow'; // NOTE: the component SCSS is not imported here: it is rolled up separately.
26
+ // Default values can be included here and then assigned to the prop params,
27
+ // e.g. prop = defaults.prop,
28
+ // This gathers default values together neatly and ensures non-primitive
29
+ // values are initialized early to avoid react making unnecessary re-renders.
30
+ // Note that default values are not required for props that are 'required',
31
+ // nor for props where the component can apply undefined values reasonably.
32
+ // Default values should be provided when the component needs to make a choice
33
+ // or assumption when a prop is not supplied.
34
+ // Default values for props
35
+ // const defaults = {
36
+ // /* TODO: add defaults for relevant props if needed */
37
+ // };
38
+
39
+ /**
40
+ * TODO: A description of the component.
41
+ */
42
+
43
+ export var EditTearsheetNarrow = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
44
+ var children = _ref.children,
45
+ className = _ref.className,
46
+ rest = _objectWithoutProperties(_ref, _excluded);
47
+
48
+ return /*#__PURE__*/React.createElement("div", _extends({}, rest, {
49
+ className: cx(blockClass, // Apply the block class to the main HTML element
50
+ className, // Apply any supplied class names to the main HTML element.
51
+ // example: `${blockClass}__template-string-class-${kind}-n-${size}`,
52
+ {// switched classes dependant on props or state
53
+ // example: [`${blockClass}__here-if-small`]: size === 'sm',
54
+ }),
55
+ ref: ref,
56
+ role: "main"
57
+ }, getDevtoolsProps(componentName)), children);
58
+ }); // Return a placeholder if not released and not enabled by feature flag
59
+
60
+ EditTearsheetNarrow = pkg.checkComponentEnabled(EditTearsheetNarrow, componentName); // The display name of the component, used by React. Note that displayName
61
+ // is used in preference to relying on function.name.
62
+
63
+ EditTearsheetNarrow.displayName = componentName; // The types and DocGen commentary for the component props,
64
+ // in alphabetical order (for consistency).
65
+ // See https://www.npmjs.com/package/prop-types#usage.
66
+
67
+ EditTearsheetNarrow.propTypes = {
68
+ /**
69
+ * Provide the contents of the EditTearsheetNarrow.
70
+ */
71
+ children: PropTypes.node.isRequired,
72
+
73
+ /**
74
+ * Provide an optional class to be applied to the containing node.
75
+ */
76
+ className: PropTypes.string
77
+ /* TODO: add types and DocGen for all props. */
78
+
79
+ };
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Copyright IBM Corp. 2022, 2022
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 { EditTearsheetNarrow } from './EditTearsheetNarrow';
@@ -36,7 +36,8 @@ export var EmptyStateContent = function EmptyStateContent(_ref) {
36
36
  className: "".concat(blockClass, "__action-button"),
37
37
  kind: action.kind || 'tertiary',
38
38
  onClick: action.onClick,
39
- renderIcon: action.renderIcon || null
39
+ renderIcon: action.renderIcon || null,
40
+ size: 'sm'
40
41
  }), action.text), (link === null || link === void 0 ? void 0 : link.text) && (link === null || link === void 0 ? void 0 : link.href) && /*#__PURE__*/React.createElement(Link, _extends({}, link, {
41
42
  className: "".concat(blockClass, "__link"),
42
43
  href: link.href
@@ -4,7 +4,7 @@ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
4
4
  import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
5
5
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
6
6
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
7
- var _excluded = ["accept", "className", "defaultErrorBody", "defaultErrorHeader", "description", "fetchErrorBody", "fetchErrorHeader", "fileDropHeader", "fileDropLabel", "fileUploadLabel", "inputButtonText", "inputId", "inputLabel", "inputPlaceholder", "invalidFileTypeErrorBody", "invalidFileTypeErrorHeader", "invalidIconDescription", "maxFileSize", "maxFileSizeErrorBody", "maxFileSizeErrorHeader", "onClose", "onRequestSubmit", "open", "primaryButtonText", "secondaryButtonText", "title"];
7
+ var _excluded = ["accept", "className", "defaultErrorBody", "defaultErrorHeader", "description", "fetchErrorBody", "fetchErrorHeader", "fileDropHeader", "fileDropLabel", "fileUploadLabel", "inputButtonIcon", "inputButtonText", "inputId", "inputLabel", "inputPlaceholder", "invalidFileTypeErrorBody", "invalidFileTypeErrorHeader", "invalidIconDescription", "maxFileSize", "maxFileSizeErrorBody", "maxFileSizeErrorHeader", "onClose", "onRequestSubmit", "open", "primaryButtonText", "secondaryButtonText", "title"];
8
8
  import _regeneratorRuntime from "@babel/runtime/regenerator";
9
9
 
10
10
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
@@ -18,6 +18,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
18
18
  // LICENSE file in the root directory of this source tree.
19
19
  //
20
20
  import React, { useState, forwardRef } from 'react';
21
+ import { Add20 } from '@carbon/icons-react';
21
22
  import { ComposedModal, ModalHeader, ModalFooter, ModalBody, FileUploaderDropContainer, FileUploaderItem, TextInput, Button } from 'carbon-components-react';
22
23
  import cx from 'classnames';
23
24
  import PropTypes from 'prop-types';
@@ -41,6 +42,7 @@ export var ImportModal = /*#__PURE__*/forwardRef(function (_ref, ref) {
41
42
  fileDropHeader = _ref.fileDropHeader,
42
43
  fileDropLabel = _ref.fileDropLabel,
43
44
  fileUploadLabel = _ref.fileUploadLabel,
45
+ inputButtonIcon = _ref.inputButtonIcon,
44
46
  inputButtonText = _ref.inputButtonText,
45
47
  inputId = _ref.inputId,
46
48
  inputLabel = _ref.inputLabel,
@@ -252,7 +254,8 @@ export var ImportModal = /*#__PURE__*/forwardRef(function (_ref, ref) {
252
254
  onClick: fetchFile,
253
255
  className: "".concat(blockClass, "__import-button"),
254
256
  size: "sm",
255
- disabled: importButtonDisabled
257
+ disabled: importButtonDisabled,
258
+ renderIcon: inputButtonIcon ? Add20 : null
256
259
  }, inputButtonText)), /*#__PURE__*/React.createElement("div", {
257
260
  className: "".concat(carbon.prefix, "--file-container ").concat(blockClass, "__file-container")
258
261
  }, hasFiles && /*#__PURE__*/React.createElement("p", {
@@ -341,6 +344,11 @@ ImportModal.propTypes = {
341
344
  */
342
345
  fileUploadLabel: PropTypes.string,
343
346
 
347
+ /**
348
+ * Button icon for import by url button
349
+ */
350
+ inputButtonIcon: PropTypes.bool,
351
+
344
352
  /**
345
353
  * Button text for import by url button
346
354
  */
@@ -2,7 +2,7 @@ import _extends from "@babel/runtime/helpers/extends";
2
2
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
3
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
4
4
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
5
- var _excluded = ["actions", "children", "className", "closeIconDescription", "closeTerminal", "documentationLinks", "documentationLinksIconDescription", "open"];
5
+ var _excluded = ["actions", "children", "className", "closeIconDescription", "documentationLinks", "documentationLinksIconDescription", "isInitiallyOpen"];
6
6
 
7
7
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
8
8
 
@@ -24,6 +24,7 @@ import { pkg } from '../../settings'; // Carbon and package components we use.
24
24
  import { Close16 as Close, Help16 as Help } from '@carbon/icons-react';
25
25
  import { Button, OverflowMenu, OverflowMenuItem } from 'carbon-components-react';
26
26
  import { moderate02 } from '@carbon/motion';
27
+ import { useWebTerminal } from './hooks';
27
28
  import { getDevtoolsProps } from '../../global/js/utils/devtools'; // The block part of our conventional BEM class names (blockClass__E--M).
28
29
 
29
30
  var componentName = 'WebTerminal';
@@ -32,7 +33,8 @@ var blockClass = "".concat(pkg.prefix, "--web-terminal"); // Default values for
32
33
  var defaults = {
33
34
  actions: Object.freeze([]),
34
35
  documentationLinks: Object.freeze([]),
35
- documentationLinksIconDescription: 'Show documentation links'
36
+ documentationLinksIconDescription: 'Show documentation links',
37
+ isInitiallyOpen: false
36
38
  };
37
39
  export var WebTerminal = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
38
40
  var _ref3;
@@ -42,14 +44,19 @@ export var WebTerminal = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
42
44
  children = _ref.children,
43
45
  className = _ref.className,
44
46
  closeIconDescription = _ref.closeIconDescription,
45
- closeTerminal = _ref.closeTerminal,
46
47
  _ref$documentationLin = _ref.documentationLinks,
47
48
  documentationLinks = _ref$documentationLin === void 0 ? defaults.documentationLinks : _ref$documentationLin,
48
49
  _ref$documentationLin2 = _ref.documentationLinksIconDescription,
49
50
  documentationLinksIconDescription = _ref$documentationLin2 === void 0 ? defaults.documentationLinksIconDescription : _ref$documentationLin2,
50
- open = _ref.open,
51
+ _ref$isInitiallyOpen = _ref.isInitiallyOpen,
52
+ isInitiallyOpen = _ref$isInitiallyOpen === void 0 ? defaults.isInitiallyOpen : _ref$isInitiallyOpen,
51
53
  rest = _objectWithoutProperties(_ref, _excluded);
52
54
 
55
+ var _useWebTerminal = useWebTerminal(),
56
+ open = _useWebTerminal.open,
57
+ closeWebTerminal = _useWebTerminal.closeWebTerminal,
58
+ openWebTerminal = _useWebTerminal.openWebTerminal;
59
+
53
60
  var _useState = useState(open),
54
61
  _useState2 = _slicedToArray(_useState, 2),
55
62
  shouldRender = _useState2[0],
@@ -69,6 +76,16 @@ export var WebTerminal = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
69
76
  setRender(true);
70
77
  }
71
78
  }, [open]);
79
+ /**
80
+ On render, check if user want's the web terminal to be open by default
81
+ */
82
+
83
+ useEffect(function () {
84
+ if (isInitiallyOpen) {
85
+ openWebTerminal();
86
+ }
87
+ }, []); // eslint-disable-line
88
+
72
89
  /**
73
90
  When the web terminal slide in animation is complete, sets render to false.
74
91
  */
@@ -88,7 +105,7 @@ export var WebTerminal = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
88
105
  setRender(false);
89
106
  }
90
107
 
91
- closeTerminal();
108
+ closeWebTerminal();
92
109
  };
93
110
 
94
111
  return shouldRender ? /*#__PURE__*/React.createElement("div", _extends({}, _objectSpread(_objectSpread({}, rest), getDevtoolsProps(componentName)), {
@@ -172,23 +189,18 @@ WebTerminal.propTypes = {
172
189
  */
173
190
  closeIconDescription: PropTypes.string.isRequired,
174
191
 
175
- /**
176
- * Function that should set the open prop to false
177
- */
178
- closeTerminal: PropTypes.func.isRequired,
179
-
180
192
  /**
181
193
  * Array of objects for each documentation link. Each documentation link uses the prop types of OverflowMenuItems. See more: https://react.carbondesignsystem.com/?path=/docs/components-overflowmenu--default
182
194
  */
183
195
  documentationLinks: PropTypes.arrayOf(PropTypes.shape(_objectSpread({}, OverflowMenuItem.propTypes))),
184
196
 
185
197
  /**
186
- * Icon description for the documentation link overflow menu
198
+ * Description for the documentation link overflow menu tooltip
187
199
  */
188
200
  documentationLinksIconDescription: PropTypes.string,
189
201
 
190
202
  /**
191
- * Boolean that determines if the web terminal is opened or closed
203
+ * Optionally pass if the web terminal should be open by default
192
204
  */
193
- open: PropTypes.bool.isRequired
205
+ isInitiallyOpen: PropTypes.bool
194
206
  };
@@ -1,7 +1,7 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
3
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
4
- var _excluded = ["children", "isTerminalOpen"];
4
+ var _excluded = ["children"];
5
5
 
6
6
  /**
7
7
  * Copyright IBM Corp. 2020, 2021
@@ -14,18 +14,21 @@ import React from 'react'; // Other standard imports.
14
14
 
15
15
  import PropTypes from 'prop-types';
16
16
  import cx from 'classnames';
17
- import { pkg } from '../../settings'; // The block part of our conventional BEM class names (blockClass__E--M).
17
+ import { pkg } from '../../settings';
18
+ import { useWebTerminal } from './hooks'; // The block part of our conventional BEM class names (blockClass__E--M).
18
19
 
19
20
  var componentName = 'WebTerminalContentWrapper';
20
21
  var blockClass = "".concat(pkg.prefix, "--web-terminal-content-wrapper");
21
22
  export var WebTerminalContentWrapper = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
22
23
  var children = _ref.children,
23
- isTerminalOpen = _ref.isTerminalOpen,
24
24
  rest = _objectWithoutProperties(_ref, _excluded);
25
25
 
26
+ var _useWebTerminal = useWebTerminal(),
27
+ open = _useWebTerminal.open;
28
+
26
29
  return /*#__PURE__*/React.createElement("div", _extends({
27
30
  ref: ref,
28
- className: cx([blockClass, _defineProperty({}, "".concat(blockClass, "--open"), isTerminalOpen)])
31
+ className: cx([blockClass, _defineProperty({}, "".concat(blockClass, "--open"), open)])
29
32
  }, rest), children);
30
33
  }); // Return a placeholder if not released and not enabled by feature flag
31
34
 
@@ -40,10 +43,5 @@ WebTerminalContentWrapper.propTypes = {
40
43
  /**
41
44
  * Pass in content as children.
42
45
  */
43
- children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]).isRequired,
44
-
45
- /**
46
- * A boolean to determine if the terminal is open.
47
- */
48
- isTerminalOpen: PropTypes.bool.isRequired
46
+ children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]).isRequired
49
47
  };
@@ -0,0 +1,45 @@
1
+ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
+ import React, { useState, useCallback, createContext } from 'react';
3
+ import { useContext } from 'react';
4
+ import PropTypes from 'prop-types';
5
+ import { pkg } from '../../../settings';
6
+ export var WebTerminalContext = /*#__PURE__*/createContext();
7
+ var componentName = 'WebTerminalProvider';
8
+ export var WebTerminalProvider = function WebTerminalProvider(_ref) {
9
+ var children = _ref.children;
10
+
11
+ var _useState = useState(false),
12
+ _useState2 = _slicedToArray(_useState, 2),
13
+ open = _useState2[0],
14
+ setOpen = _useState2[1];
15
+
16
+ var openWebTerminal = useCallback(function () {
17
+ return setOpen(true);
18
+ }, []);
19
+ var closeWebTerminal = useCallback(function () {
20
+ return setOpen(false);
21
+ }, []);
22
+ var toggleWebTerminal = useCallback(function () {
23
+ return setOpen(!open);
24
+ }, [open]);
25
+ return /*#__PURE__*/React.createElement(WebTerminalContext.Provider, {
26
+ value: {
27
+ open: open,
28
+ openWebTerminal: openWebTerminal,
29
+ closeWebTerminal: closeWebTerminal,
30
+ toggleWebTerminal: toggleWebTerminal
31
+ }
32
+ }, children);
33
+ }; // Return a placeholder if not released and not enabled by feature flag
34
+
35
+ WebTerminalProvider = pkg.checkComponentEnabled(WebTerminalProvider, componentName);
36
+ WebTerminalProvider.propTypes = {
37
+ /**
38
+ * Provide your own terminal component as children to show up in the web terminal
39
+ */
40
+ children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]).isRequired
41
+ }; // Custom hook that exposes the provided value from context
42
+
43
+ export var useWebTerminal = function useWebTerminal() {
44
+ return useContext(WebTerminalContext);
45
+ };
@@ -1,2 +1,3 @@
1
1
  export { WebTerminal } from './WebTerminal';
2
- export { WebTerminalContentWrapper } from './WebTerminalContentWrapper';
2
+ export { WebTerminalContentWrapper } from './WebTerminalContentWrapper';
3
+ export { useWebTerminal, WebTerminalProvider } from './hooks';
@@ -1,10 +1,12 @@
1
1
  import React from 'react';
2
2
  import { Header, HeaderName, HeaderGlobalAction, HeaderGlobalBar } from 'carbon-components-react';
3
3
  import { Terminal20 as Terminal, Search20 as Search, User20 as User } from '@carbon/icons-react';
4
- import PropTypes from 'prop-types';
4
+ import { useWebTerminal } from '../hooks';
5
+
6
+ var Navigation = function Navigation() {
7
+ var _useWebTerminal = useWebTerminal(),
8
+ openWebTerminal = _useWebTerminal.openWebTerminal;
5
9
 
6
- var Navigation = function Navigation(_ref) {
7
- var openTerminal = _ref.openTerminal;
8
10
  return /*#__PURE__*/React.createElement(Header, {
9
11
  "aria-label": "IBM Platform Name"
10
12
  }, /*#__PURE__*/React.createElement(HeaderName, {
@@ -12,7 +14,7 @@ var Navigation = function Navigation(_ref) {
12
14
  prefix: "IBM"
13
15
  }, "[Platform]"), /*#__PURE__*/React.createElement(HeaderGlobalBar, null, /*#__PURE__*/React.createElement(HeaderGlobalAction, {
14
16
  "aria-label": "Web terminal",
15
- onClick: openTerminal
17
+ onClick: openWebTerminal
16
18
  }, /*#__PURE__*/React.createElement(Terminal, null)), /*#__PURE__*/React.createElement(HeaderGlobalAction, {
17
19
  "aria-label": "Search",
18
20
  onClick: function onClick() {}
@@ -22,10 +24,4 @@ var Navigation = function Navigation(_ref) {
22
24
  }, /*#__PURE__*/React.createElement(User, null))));
23
25
  };
24
26
 
25
- Navigation.propTypes = {
26
- /**
27
- * Opens the terminal
28
- */
29
- openTerminal: PropTypes.func.isRequired
30
- };
31
27
  export default Navigation;
@@ -32,9 +32,12 @@ export { TagSet } from './TagSet';
32
32
  export { Tearsheet, TearsheetNarrow } from './Tearsheet';
33
33
  export { Toolbar, ToolbarButton, ToolbarGroup } from './Toolbar';
34
34
  export { UserProfileImage } from './UserProfileImage';
35
- export { WebTerminal, WebTerminalContentWrapper } from './WebTerminal';
35
+ export { WebTerminal, WebTerminalContentWrapper, useWebTerminal, WebTerminalProvider } from './WebTerminal';
36
36
  export { EditSidePanel } from './EditSidePanel';
37
37
  export { OptionsTile } from './OptionsTile';
38
38
  export { InlineEdit } from './InlineEdit';
39
39
  export { DataSpreadsheet } from './DataSpreadsheet';
40
- export { Datagrid, useDatagrid, useInfiniteScroll, useNestedRows, useSelectRows, useExpandedRow, useOnRowClick, useSortableColumns, useRowIsMouseOver, useColumnRightAlign, useDisableSelectRows, useStickyColumn, useActionsColumn, useCustomizeColumns, useSelectAllWithToggle } from './Datagrid';
40
+ export { Datagrid, useDatagrid, useInfiniteScroll, useNestedRows, useSelectRows, useExpandedRow, useOnRowClick, useSortableColumns, useRowIsMouseOver, useColumnRightAlign, useDisableSelectRows, useStickyColumn, useActionsColumn, useCustomizeColumns, useSelectAllWithToggle } from './Datagrid';
41
+ export { EditTearsheet } from './EditTearsheet';
42
+ export { EditTearsheetNarrow } from './EditTearsheetNarrow';
43
+ export { EditFullPage } from './EditFullPage';
@@ -62,10 +62,14 @@ var defaults = {
62
62
  ToolbarGroup: false,
63
63
  WebTerminal: false,
64
64
  WebTerminalContentWrapper: false,
65
+ WebTerminalProvider: false,
65
66
  EditSidePanel: false,
66
67
  CancelableTextEdit: false,
67
68
  DataSpreadsheet: false,
68
- Datagrid: false
69
+ Datagrid: false,
70
+ EditTearsheet: false,
71
+ EditTearsheetNarrow: false,
72
+ EditFullPage: false
69
73
  /* new component flags here - comment used by generate CLI */
70
74
 
71
75
  },
@@ -47,7 +47,7 @@ var AddSelect = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
47
47
  return (0, _defineProperty2.default)({
48
48
  id: item.id
49
49
  }, modifierAttribute, item[modifierAttribute]);
50
- }) : null;
50
+ }) : [];
51
51
  return /*#__PURE__*/_react.default.createElement(_AddSelectBody.AddSelectBody, (0, _extends2.default)({}, props, {
52
52
  className: blockClass,
53
53
  ref: ref,
@@ -123,7 +123,6 @@ AddSelect.propTypes = {
123
123
  * portal target for the all tags modal
124
124
  */
125
125
  portalTarget: _propTypes.default.node,
126
- removeIconDescription: _propTypes.default.string,
127
126
  searchResultsLabel: _propTypes.default.string,
128
127
  title: _propTypes.default.string.isRequired
129
128
  };