@carbon/ibm-products 2.1.1 → 2.1.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (153) hide show
  1. package/css/index-full-carbon.css +586 -191
  2. package/css/index-full-carbon.css.map +1 -1
  3. package/css/index-full-carbon.min.css +3 -3
  4. package/css/index-full-carbon.min.css.map +1 -1
  5. package/css/index-without-carbon-released-only.css +157 -1
  6. package/css/index-without-carbon-released-only.css.map +1 -1
  7. package/css/index-without-carbon-released-only.min.css +2 -2
  8. package/css/index-without-carbon-released-only.min.css.map +1 -1
  9. package/css/index-without-carbon.css +344 -20
  10. package/css/index-without-carbon.css.map +1 -1
  11. package/css/index-without-carbon.min.css +3 -3
  12. package/css/index-without-carbon.min.css.map +1 -1
  13. package/css/index.css +248 -95
  14. package/css/index.css.map +1 -1
  15. package/css/index.min.css +3 -3
  16. package/css/index.min.css.map +1 -1
  17. package/es/components/APIKeyModal/APIKeyModal.docs-page.js +26 -0
  18. package/es/components/AboutModal/AboutModal.docs-page.js +21 -0
  19. package/es/components/AboutModal/AboutModal.js +1 -1
  20. package/es/components/BreadcrumbWithOverflow/BreadcrumbWithOverflow.js +3 -0
  21. package/es/components/Cascade/Cascade.docs-page.js +22 -0
  22. package/es/components/Cascade/Cascade.js +11 -1
  23. package/es/components/CreateFullPage/CreateFullPage.docs-page.js +39 -0
  24. package/es/components/CreateFullPage/CreateFullPage.js +13 -0
  25. package/es/components/CreateModal/CreateModal.docs-page.js +24 -0
  26. package/es/components/CreateModal/CreateModal.js +7 -0
  27. package/es/components/CreateSidePanel/CreateSidePanel.docs-page.js +18 -0
  28. package/es/components/CreateSidePanel/CreateSidePanel.js +1 -1
  29. package/es/components/CreateTearsheet/CreateTearsheet.docs-page.js +29 -0
  30. package/es/components/DataSpreadsheet/DataSpreadsheet.js +3 -3
  31. package/es/components/Datagrid/Datagrid/DatagridContent.js +1 -1
  32. package/es/components/Datagrid/Datagrid/DatagridSelectAllWithToggle.js +3 -3
  33. package/es/components/Datagrid/Datagrid/DatagridToolbar.js +3 -2
  34. package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/TearsheetWrapper.js +1 -1
  35. package/es/components/Datagrid/Datagrid/addons/Filtering/FilterFlyout.js +5 -11
  36. package/es/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditCell/InlineEditCell.js +12 -10
  37. package/es/components/Datagrid/Datagrid/addons/InlineEdit/handleGridKeyPress.js +2 -2
  38. package/es/components/Datagrid/utils/DatagridActions.js +6 -14
  39. package/es/components/EditFullPage/EditFullPage.docs-page.js +39 -0
  40. package/es/components/EditFullPage/EditFullPage.js +2 -1
  41. package/es/components/EditSidePanel/EditSidePanel.js +1 -1
  42. package/es/components/EditTearsheet/EditTearsheet.docs-page.js +25 -0
  43. package/es/components/EditTearsheet/EditTearsheet.js +4 -0
  44. package/es/components/EditTearsheetNarrow/EditTearsheetNarrow.js +1 -1
  45. package/es/components/EditUpdateCards/EditUpdateCards.js +3 -2
  46. package/es/components/EmptyStates/EmptyState.js +4 -0
  47. package/es/components/EmptyStates/ErrorEmptyState/ErrorEmptyState.js +4 -0
  48. package/es/components/EmptyStates/NoDataEmptyState/NoDataEmptyState.js +4 -0
  49. package/es/components/EmptyStates/NoTagsEmptyState/NoTagsEmptyState.js +4 -0
  50. package/es/components/EmptyStates/NotFoundEmptyState/NotFoundEmptyState.js +4 -0
  51. package/es/components/EmptyStates/NotificationsEmptyState/NotificationsEmptyState.js +4 -0
  52. package/es/components/EmptyStates/UnauthorizedEmptyState/UnauthorizedEmptyState.js +4 -0
  53. package/es/components/ExampleComponent/ExampleComponent.docs-page.js +22 -0
  54. package/es/components/ExportModal/ExportModal.js +4 -0
  55. package/es/components/HTTPErrors/HTTPError403/HTTPError403.js +6 -0
  56. package/es/components/HTTPErrors/HTTPError404/HTTPError404.js +6 -0
  57. package/es/components/HTTPErrors/HTTPErrorOther/HTTPErrorOther.js +6 -0
  58. package/es/components/ImportModal/ImportModal.docs-page.js +18 -0
  59. package/es/components/ImportModal/ImportModal.js +13 -6
  60. package/es/components/MultiAddSelect/MultiAddSelect.docs-page.js +17 -0
  61. package/es/components/MultiAddSelect/MultiAddSelect.js +4 -0
  62. package/es/components/NotificationsPanel/preview-components/UnreadNotificationBell.js +2 -17
  63. package/es/components/PageHeader/PageHeaderUtils.js +2 -2
  64. package/es/components/RemoveModal/RemoveModal.docs-page.js +18 -0
  65. package/es/components/RemoveModal/RemoveModal.js +6 -0
  66. package/es/components/SingleAddSelect/SingleAddSelect.docs-page.js +15 -0
  67. package/es/components/SingleAddSelect/SingleAddSelect.js +4 -0
  68. package/es/components/StatusIcon/StatusIcon.docs-page.js +17 -0
  69. package/es/components/StatusIcon/StatusIcon.js +10 -0
  70. package/es/components/Tearsheet/TearsheetShell.js +11 -6
  71. package/es/components/Toolbar/Toolbar.docs-page.js +14 -0
  72. package/es/components/UserProfileImage/UserProfileImage.docs-page.js +17 -0
  73. package/es/components/UserProfileImage/UserProfileImage.js +1 -1
  74. package/es/components/WebTerminal/WebTerminal.docs-page.js +52 -0
  75. package/es/components/WebTerminal/WebTerminal.js +4 -0
  76. package/es/global/js/hooks/useCreateComponentStepChange.js +16 -15
  77. package/es/global/js/utils/StoryDocsPage.js +218 -0
  78. package/es/global/js/utils/story-helper.js +108 -6
  79. package/lib/components/APIKeyModal/APIKeyModal.docs-page.js +37 -0
  80. package/lib/components/AboutModal/AboutModal.docs-page.js +32 -0
  81. package/lib/components/AboutModal/AboutModal.js +1 -1
  82. package/lib/components/BreadcrumbWithOverflow/BreadcrumbWithOverflow.js +3 -0
  83. package/lib/components/Cascade/Cascade.docs-page.js +33 -0
  84. package/lib/components/Cascade/Cascade.js +11 -1
  85. package/lib/components/CreateFullPage/CreateFullPage.docs-page.js +50 -0
  86. package/lib/components/CreateFullPage/CreateFullPage.js +13 -0
  87. package/lib/components/CreateModal/CreateModal.docs-page.js +35 -0
  88. package/lib/components/CreateModal/CreateModal.js +7 -0
  89. package/lib/components/CreateSidePanel/CreateSidePanel.docs-page.js +29 -0
  90. package/lib/components/CreateSidePanel/CreateSidePanel.js +1 -1
  91. package/lib/components/CreateTearsheet/CreateTearsheet.docs-page.js +40 -0
  92. package/lib/components/DataSpreadsheet/DataSpreadsheet.js +3 -3
  93. package/lib/components/Datagrid/Datagrid/DatagridContent.js +1 -1
  94. package/lib/components/Datagrid/Datagrid/DatagridSelectAllWithToggle.js +3 -3
  95. package/lib/components/Datagrid/Datagrid/DatagridToolbar.js +3 -2
  96. package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/TearsheetWrapper.js +1 -1
  97. package/lib/components/Datagrid/Datagrid/addons/Filtering/FilterFlyout.js +4 -10
  98. package/lib/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditCell/InlineEditCell.js +12 -10
  99. package/lib/components/Datagrid/Datagrid/addons/InlineEdit/handleGridKeyPress.js +2 -2
  100. package/lib/components/Datagrid/utils/DatagridActions.js +5 -13
  101. package/lib/components/EditFullPage/EditFullPage.docs-page.js +50 -0
  102. package/lib/components/EditFullPage/EditFullPage.js +2 -1
  103. package/lib/components/EditSidePanel/EditSidePanel.js +1 -1
  104. package/lib/components/EditTearsheet/EditTearsheet.docs-page.js +36 -0
  105. package/lib/components/EditTearsheet/EditTearsheet.js +4 -0
  106. package/lib/components/EditTearsheetNarrow/EditTearsheetNarrow.js +1 -1
  107. package/lib/components/EditUpdateCards/EditUpdateCards.js +3 -2
  108. package/lib/components/EmptyStates/EmptyState.js +4 -0
  109. package/lib/components/EmptyStates/ErrorEmptyState/ErrorEmptyState.js +4 -0
  110. package/lib/components/EmptyStates/NoDataEmptyState/NoDataEmptyState.js +4 -0
  111. package/lib/components/EmptyStates/NoTagsEmptyState/NoTagsEmptyState.js +4 -0
  112. package/lib/components/EmptyStates/NotFoundEmptyState/NotFoundEmptyState.js +4 -0
  113. package/lib/components/EmptyStates/NotificationsEmptyState/NotificationsEmptyState.js +4 -0
  114. package/lib/components/EmptyStates/UnauthorizedEmptyState/UnauthorizedEmptyState.js +4 -0
  115. package/lib/components/ExampleComponent/ExampleComponent.docs-page.js +33 -0
  116. package/lib/components/ExportModal/ExportModal.js +4 -0
  117. package/lib/components/HTTPErrors/HTTPError403/HTTPError403.js +6 -0
  118. package/lib/components/HTTPErrors/HTTPError404/HTTPError404.js +6 -0
  119. package/lib/components/HTTPErrors/HTTPErrorOther/HTTPErrorOther.js +6 -0
  120. package/lib/components/ImportModal/ImportModal.docs-page.js +26 -0
  121. package/lib/components/ImportModal/ImportModal.js +13 -6
  122. package/lib/components/MultiAddSelect/MultiAddSelect.docs-page.js +25 -0
  123. package/lib/components/MultiAddSelect/MultiAddSelect.js +4 -0
  124. package/lib/components/NotificationsPanel/preview-components/UnreadNotificationBell.js +2 -17
  125. package/lib/components/PageHeader/PageHeaderUtils.js +2 -2
  126. package/lib/components/RemoveModal/RemoveModal.docs-page.js +26 -0
  127. package/lib/components/RemoveModal/RemoveModal.js +6 -0
  128. package/lib/components/SingleAddSelect/SingleAddSelect.docs-page.js +23 -0
  129. package/lib/components/SingleAddSelect/SingleAddSelect.js +4 -0
  130. package/lib/components/StatusIcon/StatusIcon.docs-page.js +28 -0
  131. package/lib/components/StatusIcon/StatusIcon.js +10 -0
  132. package/lib/components/Tearsheet/TearsheetShell.js +11 -6
  133. package/lib/components/Toolbar/Toolbar.docs-page.js +25 -0
  134. package/lib/components/UserProfileImage/UserProfileImage.docs-page.js +28 -0
  135. package/lib/components/UserProfileImage/UserProfileImage.js +1 -1
  136. package/lib/components/WebTerminal/WebTerminal.docs-page.js +63 -0
  137. package/lib/components/WebTerminal/WebTerminal.js +4 -0
  138. package/lib/global/js/hooks/useCreateComponentStepChange.js +16 -15
  139. package/lib/global/js/utils/StoryDocsPage.js +225 -0
  140. package/lib/global/js/utils/story-helper.js +115 -7
  141. package/package.json +10 -10
  142. package/scss/components/Cascade/_storybook-styles.scss +3 -2
  143. package/scss/components/DataSpreadsheet/_storybook-styles.scss +6 -0
  144. package/scss/components/Datagrid/_storybook-styles.scss +8 -2
  145. package/scss/components/Datagrid/styles/_datagrid.scss +14 -0
  146. package/scss/components/Datagrid/styles/addons/_FilterFlyout.scss +7 -0
  147. package/scss/components/Datagrid/styles/addons/_FilterPanel.scss +4 -0
  148. package/scss/components/NotificationsPanel/_storybook-styles.scss +10 -2
  149. package/scss/components/PageHeader/_storybook-styles.scss +24 -14
  150. package/scss/components/Tearsheet/_tearsheet.scss +7 -1
  151. package/scss/components/WebTerminal/_storybook-styles.scss +11 -1
  152. package/scss/global/styles/_display-box.scss +1 -0
  153. package/scss/components/HTTPErrors/_storybook-styles.scss +0 -6
@@ -0,0 +1,218 @@
1
+ import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
2
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
+ 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; }
4
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
5
+ /**
6
+ * Copyright IBM Corp. 2023, 2023
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
+
12
+ import React from 'react';
13
+ import PropTypes from 'prop-types';
14
+ import { Title, Description, Source, Controls, Canvas, Stories, AnchorMdx, useOf } from '@storybook/blocks';
15
+ import { paramCase } from 'change-case';
16
+ import { codeSandboxHref, stackblitzHref, storyDocsPageInfo } from './story-helper';
17
+ export var CustomBlocks = function CustomBlocks(_ref) {
18
+ var blocks = _ref.blocks;
19
+ return blocks.map(function (block, index) {
20
+ var source = _objectSpread({}, block === null || block === void 0 ? void 0 : block.source);
21
+ if (source.code && !source.language) {
22
+ source.language = 'jsx';
23
+ }
24
+ return /*#__PURE__*/React.createElement("div", {
25
+ key: "block-index--".concat(index)
26
+ }, block.title && /*#__PURE__*/React.createElement("h3", {
27
+ id: paramCase(block.title)
28
+ }, block.title), block.subTitle && /*#__PURE__*/React.createElement("h4", null, block.subTitle), block.description && typeof block.description === 'string' ? /*#__PURE__*/React.createElement(Description, null, block.description) : block.description, block.story && /*#__PURE__*/React.createElement(Canvas, {
29
+ of: block.story
30
+ }), block.source && /*#__PURE__*/React.createElement(Source, source));
31
+ });
32
+ };
33
+
34
+ /**
35
+ * This function checks blocks against stories and then
36
+ * - Adds title if no alternative is supplied
37
+ * - Adds blocks for unreferenced stories if omitUnreferencedStories is false
38
+ */
39
+ var processBlocks = function processBlocks(blocks, stories, omitUnreferencedStories) {
40
+ var blocksWithStoryTitles = blocks ? _toConsumableArray(blocks) : [];
41
+ var restOfStories = [];
42
+ var storyKeys = Object.keys(stories);
43
+ storyKeys.forEach(function (sk) {
44
+ var story = stories[sk].moduleExport;
45
+ var storyName = stories[sk].name;
46
+ var matchingBlock = blocksWithStoryTitles.find(function (block) {
47
+ return block.story === story;
48
+ });
49
+ if (matchingBlock) {
50
+ var _matchingBlock$title;
51
+ matchingBlock.title = (_matchingBlock$title = matchingBlock.title) !== null && _matchingBlock$title !== void 0 ? _matchingBlock$title : storyName;
52
+ } else if (!omitUnreferencedStories) {
53
+ restOfStories.push({
54
+ story: story,
55
+ title: storyName
56
+ });
57
+ }
58
+ });
59
+ if (!omitUnreferencedStories) {
60
+ return blocksWithStoryTitles.concat(restOfStories);
61
+ }
62
+ return blocksWithStoryTitles;
63
+ };
64
+
65
+ /**
66
+ * Calling with no parameters will produce the default output.
67
+ * Customize by providing alternative values and/or blocks defining sections
68
+ * @param {*} param0
69
+ * @returns
70
+ */
71
+ export var StoryDocsPage = function StoryDocsPage(_ref2) {
72
+ var _csfFile$meta, _csfFile$meta$paramet, _processedBlocks$filt;
73
+ var altTitle = _ref2.altTitle,
74
+ altDescription = _ref2.altDescription,
75
+ altGuidelinesHref = _ref2.altGuidelinesHref,
76
+ blocks = _ref2.blocks,
77
+ omitCodedExample = _ref2.omitCodedExample,
78
+ omitUnreferencedStories = _ref2.omitUnreferencedStories;
79
+ var _useOf = useOf('meta', ['meta']),
80
+ csfFile = _useOf.csfFile;
81
+ var storyInfo = storyDocsPageInfo(csfFile);
82
+ var guidelinesHref = altGuidelinesHref !== null && altGuidelinesHref !== void 0 ? altGuidelinesHref : storyInfo.guidelinesHref;
83
+ var isFullScreen = (csfFile === null || csfFile === void 0 ? void 0 : (_csfFile$meta = csfFile.meta) === null || _csfFile$meta === void 0 ? void 0 : (_csfFile$meta$paramet = _csfFile$meta.parameters) === null || _csfFile$meta$paramet === void 0 ? void 0 : _csfFile$meta$paramet.layout) === 'fullscreen' || false;
84
+ var storyHelperClass = isFullScreen ? 'c4p--story-docs-page--fullscreen' : '';
85
+ var processedBlocks = processBlocks(blocks, csfFile.stories, omitUnreferencedStories);
86
+ console.log(processBlocks);
87
+ var storyCount = (_processedBlocks$filt = processedBlocks === null || processedBlocks === void 0 ? void 0 : processedBlocks.filter(function (block) {
88
+ return !!block.story;
89
+ }).length) !== null && _processedBlocks$filt !== void 0 ? _processedBlocks$filt : 0;
90
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Title, null, altTitle !== null && altTitle !== void 0 ? altTitle : storyInfo.title), guidelinesHref ? guidelinesHref && Array.isArray(guidelinesHref) ? guidelinesHref.map(function (_ref3, index) {
91
+ var href = _ref3.href,
92
+ label = _ref3.label;
93
+ return /*#__PURE__*/React.createElement(React.Fragment, null, index > 0 && ' | ', /*#__PURE__*/React.createElement(AnchorMdx, {
94
+ key: href,
95
+ href: href
96
+ }, label));
97
+ }) : /*#__PURE__*/React.createElement(AnchorMdx, {
98
+ href: guidelinesHref
99
+ }, altTitle ? "".concat(altTitle, " usage guidelines") : storyInfo.guidelinesLinkLabel) : null, /*#__PURE__*/React.createElement("h2", {
100
+ style: {
101
+ marginTop: guidelinesHref ? '16px' : ''
102
+ }
103
+ }, "Table of contents"), /*#__PURE__*/React.createElement("ul", null, ['Overview', 'Coded examples', 'Example usage', 'Component API'].map(function (item) {
104
+ return /*#__PURE__*/React.createElement("li", {
105
+ key: item
106
+ }, /*#__PURE__*/React.createElement(AnchorMdx, {
107
+ href: "#".concat(paramCase(item))
108
+ }, item), processedBlocks && item === 'Example usage' ? /*#__PURE__*/React.createElement("ul", null, processedBlocks.map(function (block) {
109
+ return block !== null && block !== void 0 && block.title ? /*#__PURE__*/React.createElement("li", {
110
+ key: block.title
111
+ }, /*#__PURE__*/React.createElement(AnchorMdx, {
112
+ href: "#".concat(paramCase(block.title))
113
+ }, block.title)) : null;
114
+ })) : null);
115
+ })), /*#__PURE__*/React.createElement("h2", {
116
+ id: "overview"
117
+ }, "Overview"), /*#__PURE__*/React.createElement(Description, null, altDescription), !omitCodedExample && storyInfo.expectCodedExample ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("h2", {
118
+ id: "coded-examples"
119
+ }, "Coded examples"), /*#__PURE__*/React.createElement("p", null, "Coded examples can be edited and are a great way to try out a component."), /*#__PURE__*/React.createElement("ul", null, /*#__PURE__*/React.createElement("li", {
120
+ key: "codesandbox"
121
+ }, /*#__PURE__*/React.createElement(AnchorMdx, {
122
+ href: codeSandboxHref(storyInfo.title)
123
+ }, /*#__PURE__*/React.createElement("svg", {
124
+ viewBox: "0 0 24 24",
125
+ xmlns: "http://www.w3.org/2000/svg",
126
+ style: {
127
+ height: '16px',
128
+ width: '16px',
129
+ color: 'black',
130
+ boxShadow: '0 0 0 2px white',
131
+ marginRight: '8px',
132
+ verticalAlign: '-2px'
133
+ }
134
+ }, /*#__PURE__*/React.createElement("path", {
135
+ fillRule: "evenodd",
136
+ clipRule: "evenodd",
137
+ d: "M0 0h23.987v24H0V0Zm21.533 2.455v19.09H2.453V2.456h19.08Z",
138
+ fill: "currentColor"
139
+ })), "CodeSandbox")), /*#__PURE__*/React.createElement("li", {
140
+ key: "stackblitz"
141
+ }, /*#__PURE__*/React.createElement(AnchorMdx, {
142
+ href: stackblitzHref(storyInfo.title)
143
+ }, /*#__PURE__*/React.createElement("img", {
144
+ src: "https://c.staticblitz.com/assets/favicon_sb-861fe1b85c0dc928750c62de15fed96fc75e57ee366bd937bad17a3938917b3f.svg",
145
+ alt: "Stackblitz logo",
146
+ style: {
147
+ verticalAlign: '-2px',
148
+ marginRight: '8px'
149
+ }
150
+ }), "Stackblitz")))) : null, /*#__PURE__*/React.createElement("h2", {
151
+ id: "example-usage"
152
+ }, "Example usage"), /*#__PURE__*/React.createElement("div", {
153
+ className: storyHelperClass
154
+ }, processedBlocks ? /*#__PURE__*/React.createElement(CustomBlocks, {
155
+ blocks: processedBlocks
156
+ }) : /*#__PURE__*/React.createElement(Stories, null)), /*#__PURE__*/React.createElement("h2", {
157
+ id: "component-api"
158
+ }, "Component API"), storyCount > 1 && /*#__PURE__*/React.createElement("p", null, "NOTE: Changing the controls below affects the default/primary example shown on the docs page."), /*#__PURE__*/React.createElement(Controls, null));
159
+ };
160
+ StoryDocsPage.propTypes = {
161
+ /**
162
+ * Uses doc block from the component where possible.
163
+ *
164
+ * Note: use `export default { component: ExampleComponent }` in the story if the main component is wrapped by some
165
+ * additional code. This will allow the doc block to pass through.
166
+ *
167
+ * If passed as string treated as markdown.
168
+ */
169
+ altDescription: PropTypes.node,
170
+ /**
171
+ * location if any of guidelines on the PAL site, constructed by default
172
+ */
173
+ altGuidelinesHref: PropTypes.oneOfType(PropTypes.string, PropTypes.arrayOf(PropTypes.shape({
174
+ href: PropTypes.string,
175
+ label: PropTypes.string
176
+ }))),
177
+ /**
178
+ * Uses component name by default
179
+ */
180
+ altTitle: PropTypes.string,
181
+ /**
182
+ * Array with content sections
183
+ */
184
+ blocks: PropTypes.arrayOf(PropTypes.shape({
185
+ /**
186
+ * Optional title story name used by default<h3>
187
+ */
188
+ title: PropTypes.string,
189
+ /**
190
+ * Optional subTitle a <h4>
191
+ */
192
+ subTitle: PropTypes.string,
193
+ /**
194
+ * Optional description, strings treated as markdown.
195
+ */
196
+ description: PropTypes.node,
197
+ /**
198
+ * Story imported from story file
199
+ */
200
+ story: PropTypes.func,
201
+ /**
202
+ * Some source code
203
+ * default language `jsx`
204
+ */
205
+ source: PropTypes.shape({
206
+ language: PropTypes.oneOf('javascript', 'css', 'jsx'),
207
+ code: PropTypes.string
208
+ })
209
+ })),
210
+ /**
211
+ * Set to true if no published example exists (all components and patterns should have an example)
212
+ */
213
+ omitCodedExample: PropTypes.bool,
214
+ /**
215
+ * Stories unreferenced in blocks included by default
216
+ */
217
+ omitUnreferencedStories: PropTypes.bool
218
+ };
@@ -1,3 +1,5 @@
1
+ import _toArray from "@babel/runtime/helpers/toArray";
2
+ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
1
3
  //
2
4
  // Copyright IBM Corp. 2021, 2021
3
5
  //
@@ -10,6 +12,7 @@ import PropTypes from 'prop-types';
10
12
  import { sanitize } from '@storybook/csf';
11
13
  import pkg from '../package-settings';
12
14
  import { getPathForComponent } from '../../../../../core/story-structure';
15
+ import { paramCase } from 'change-case';
13
16
 
14
17
  /**
15
18
  * A helper function to return the structured story title for a component.
@@ -64,12 +67,14 @@ export var prepareStory = function prepareStory(template, options) {
64
67
  * The link URL is based on the example directory name and the standard codesandbox URL for package examples.
65
68
  */
66
69
  var packagePath = 'github/carbon-design-system/ibm-products/tree/main/examples/carbon-for-ibm-products';
70
+ export var codeSandboxHref = function codeSandboxHref(exampleDirectory) {
71
+ return "https://codesandbox.io/p/sandbox/".concat(packagePath, "/").concat(exampleDirectory, "?file=%2Fsrc%2FExample%2FExample.jsx");
72
+ };
67
73
  export var CodesandboxLink = function CodesandboxLink(_ref) {
68
74
  var exampleDirectory = _ref.exampleDirectory;
69
- // const stackblitz = `https://stackblitz.com/${packagePath}/${dir}?file=src%2FExample%2FExample.jsx`;
70
- var codesandbox = "https://codesandbox.io/p/sandbox/".concat(packagePath, "/").concat(exampleDirectory, "?file=%2Fsrc%2FExample%2FExample.jsx");
75
+ var href = codeSandboxHref(exampleDirectory);
71
76
  return /*#__PURE__*/React.createElement("a", {
72
- href: codesandbox
77
+ href: href
73
78
  }, /*#__PURE__*/React.createElement("img", {
74
79
  alt: "Edit on CodeSandbox",
75
80
  src: "https://codesandbox.io/static/img/play-codesandbox.svg"
@@ -81,11 +86,14 @@ CodesandboxLink.propTypes = {
81
86
  */
82
87
  exampleDirectory: PropTypes.string
83
88
  };
89
+ export var stackblitzHref = function stackblitzHref(exampleDirectory) {
90
+ return "https://stackblitz.com/".concat(packagePath, "/").concat(exampleDirectory, "?file=src%2FExample%2FExample.jsx");
91
+ };
84
92
  export var StackblitzLink = function StackblitzLink(_ref2) {
85
93
  var exampleDirectory = _ref2.exampleDirectory;
86
- var stackblitz = "https://stackblitz.com/".concat(packagePath, "/").concat(exampleDirectory, "?file=src%2FExample%2FExample.jsx");
94
+ var href = stackblitzHref(exampleDirectory);
87
95
  return /*#__PURE__*/React.createElement("a", {
88
- href: stackblitz
96
+ href: href
89
97
  }, /*#__PURE__*/React.createElement("img", {
90
98
  alt: "Edit on Stackblitz",
91
99
  src: "https://c.staticblitz.com/assets/favicon_sb-861fe1b85c0dc928750c62de15fed96fc75e57ee366bd937bad17a3938917b3f.svg"
@@ -97,12 +105,106 @@ StackblitzLink.propTypes = {
97
105
  */
98
106
  exampleDirectory: PropTypes.string
99
107
  };
108
+ export var palUsageHref = function palUsageHref(csfFile) {
109
+ var _csfFile$meta;
110
+ var title = csfFile === null || csfFile === void 0 ? void 0 : (_csfFile$meta = csfFile.meta) === null || _csfFile$meta === void 0 ? void 0 : _csfFile$meta.title;
111
+ var _title$split = title.split('/'),
112
+ _title$split2 = _slicedToArray(_title$split, 3),
113
+ _pkg = _title$split2[0],
114
+ kind = _title$split2[1],
115
+ section = _title$split2[2];
116
+ if (/components|patterns/i.test(kind) && name) {
117
+ return "https://pages.github.ibm.com/cdai-design/pal/".concat(kind, "s/").concat(paramCase(section), "/usage");
118
+ }
119
+ };
120
+ export var storyDocsPageTitle = function storyDocsPageTitle(csfFile) {
121
+ var _csfFile$meta2;
122
+ var title = csfFile === null || csfFile === void 0 ? void 0 : (_csfFile$meta2 = csfFile.meta) === null || _csfFile$meta2 === void 0 ? void 0 : _csfFile$meta2.title;
123
+ var _title$split3 = title.split('/'),
124
+ _title$split4 = _toArray(_title$split3),
125
+ _pkg = _title$split4[0],
126
+ kind = _title$split4[1],
127
+ a = _title$split4[2],
128
+ b = _title$split4[3],
129
+ rest = _title$split4.slice(4);
130
+ var component;
131
+ if (/components|patterns/i.test(kind)) {
132
+ // components and patterns have an additional level
133
+ component = b;
134
+ } else {
135
+ component = a;
136
+ }
137
+ var name = component.split('#')[0]; // canary always written as Example#canary};
138
+
139
+ if (name) {
140
+ if (rest.length > 0) {
141
+ return "".concat(name, " (").concat(rest.join(' '), ")");
142
+ } else {
143
+ return name;
144
+ }
145
+ }
146
+ console.error('Error: unable to parse title from metadata.');
147
+ return title;
148
+ };
149
+ export var storyDocsPageInfo = function storyDocsPageInfo(csfFile) {
150
+ var _csfFile$meta3;
151
+ var title = csfFile === null || csfFile === void 0 ? void 0 : (_csfFile$meta3 = csfFile.meta) === null || _csfFile$meta3 === void 0 ? void 0 : _csfFile$meta3.title;
152
+ var _title$split5 = title.split('/'),
153
+ _title$split6 = _toArray(_title$split5),
154
+ pkg = _title$split6[0],
155
+ kind = _title$split6[1],
156
+ a = _title$split6[2],
157
+ b = _title$split6[3],
158
+ rest = _title$split6.slice(4);
159
+ var result = {
160
+ package: pkg,
161
+ kind: kind,
162
+ expectCodedExample: false
163
+ };
164
+ var component;
165
+ if (/components|patterns/i.test(kind)) {
166
+ result.expectCodedExample = true;
167
+ // components and patterns have an additional level
168
+ component = b;
169
+ result.section = a;
170
+ result.guidelinesHref = "https://pages.github.ibm.com/cdai-design/pal/".concat(kind, "s/").concat(paramCase(result.section), "/usage");
171
+ } else {
172
+ component = a;
173
+ }
174
+ var nameSplit = component.split('#'); // canary always written as Example#canary};
175
+ var name = nameSplit[0];
176
+ if (nameSplit.length > 1 && nameSplit[1] === 'canary') {
177
+ result.canary = true;
178
+ }
179
+ if (name) {
180
+ if (rest.length > 0) {
181
+ result.component = result.title = "".concat(name, " (").concat(rest.join(' '), ")");
182
+ } else {
183
+ result.component = name;
184
+ result.title = name;
185
+ }
186
+ } else {
187
+ console.error('Error: unable to parse title from metadata.');
188
+ result.title = title;
189
+ }
190
+ if (result.guidelinesHref) {
191
+ result.guidelinesLinkLabel = "".concat(result.title, " usage guidelines");
192
+ }
193
+ return result;
194
+ };
195
+ export var storyDocsGuidelines = function storyDocsGuidelines(csfFile) {
196
+ var storyInfo = storyDocsPageInfo(csfFile);
197
+ return {
198
+ href: storyInfo.guidelinesHref,
199
+ label: storyInfo.guidelinesLinkLabel
200
+ };
201
+ };
100
202
 
101
203
  /**
102
204
  * A helper function that finds the designated theme on the Storybook canvas.
103
205
  * @returns "dark" or "light"
104
206
  */
105
207
  export var getSelectedCarbonTheme = function getSelectedCarbonTheme() {
106
- var themeId = document.querySelector('html').getAttribute('storybook-carbon-theme');
208
+ var themeId = document.querySelector('[storybook-carbon-theme]').getAttribute('storybook-carbon-theme');
107
209
  return themeId === 'g90' || themeId === 'g100' ? 'dark' : 'light';
108
210
  };
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ var _typeof = require("@babel/runtime/helpers/typeof");
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.default = void 0;
9
+ var _react = _interopRequireDefault(require("react"));
10
+ var _StoryDocsPage = require("../../global/js/utils/StoryDocsPage");
11
+ var _blocks = require("@storybook/blocks");
12
+ var _storyHelper = require("../../global/js/utils/story-helper");
13
+ var stories = _interopRequireWildcard(require("./APIKeyModal.stories"));
14
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
15
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
16
+ var DocsPage = function DocsPage() {
17
+ var _useOf = (0, _blocks.useOf)('meta', ['meta']),
18
+ csfFile = _useOf.csfFile;
19
+ return /*#__PURE__*/_react.default.createElement(_StoryDocsPage.StoryDocsPage, {
20
+ altGuidelinesHref: [(0, _storyHelper.storyDocsGuidelines)(csfFile), {
21
+ href: 'https://www.carbondesignsystem.com/components/modal/usage',
22
+ label: 'Carbon Modal usage guidelines'
23
+ }, {
24
+ href: 'https://react.carbondesignsystem.com/?path=/docs/modal--default',
25
+ label: 'Carbon Modal documentation'
26
+ }],
27
+ blocks: [{
28
+ story: stories.Edit,
29
+ description: "API key creation / generation is assumed to be the default mode for this modal.\nTo enable key editing you have to set the `edit` prop to true and supply any\nother edit related props with the relevant input."
30
+ }, {
31
+ description: "By default generate and edit only supply a name input for your key. If you need additional input you should use custom steps",
32
+ story: stories.CustomEdit
33
+ }]
34
+ });
35
+ };
36
+ var _default = DocsPage;
37
+ exports.default = _default;
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ var _typeof = require("@babel/runtime/helpers/typeof");
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.default = void 0;
9
+ var _react = _interopRequireDefault(require("react"));
10
+ var _StoryDocsPage = require("../../global/js/utils/StoryDocsPage");
11
+ var stories = _interopRequireWildcard(require("./AboutModal.stories"));
12
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
13
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
14
+ var DocsPage = function DocsPage() {
15
+ return /*#__PURE__*/_react.default.createElement(_StoryDocsPage.StoryDocsPage, {
16
+ guidelinesHref: "https://pages.github.ibm.com/cdai-design/pal/patterns/about-modal/usage",
17
+ blocks: [{
18
+ story: stories.aboutModal
19
+ }, {
20
+ story: stories.fullyLoaded
21
+ }, {
22
+ title: 'Overriding the Carbon theme',
23
+ description: 'The design recommendation is to use a dark theme for the AboutModal if the application is currently using a light theme, and vice versa. The theme applied to the AboutModal can easily be customized as follows:',
24
+ source: {
25
+ language: 'css',
26
+ code: ".#{$pkg-prefix}--about-modal {\n @include carbon--theme(\n $theme: $carbon--theme--g90\n );\n}"
27
+ }
28
+ }]
29
+ });
30
+ };
31
+ var _default = DocsPage;
32
+ exports.default = _default;
@@ -39,7 +39,7 @@ var componentName = 'AboutModal';
39
39
  // NOTE: the component SCSS is not imported here: it is rolled up separately.
40
40
 
41
41
  /**
42
- * The AboutModal component provides a way to communicate product information
42
+ * The `AboutModal` component provides a way to communicate product information
43
43
  * to users. It is triggered by a user’s action, appears on top of the main
44
44
  * page content, and is persistent until dismissed. The purpose of this modal
45
45
  * should be immediately apparent to the user, with a clear and obvious path
@@ -167,6 +167,9 @@ var BreadcrumbWithOverflow = function BreadcrumbWithOverflow(_ref) {
167
167
  setDisplayedBreadcrumbItems(newDisplayedBreadcrumbItems);
168
168
  }, [breadcrumbs, displayCount]);
169
169
  var checkFullyVisibleBreadcrumbItems = function checkFullyVisibleBreadcrumbItems() {
170
+ if (!breadcrumbItemWithOverflow.current) {
171
+ return;
172
+ }
170
173
  var displayItemIndex = function displayItemIndex(itemCount, index) {
171
174
  // In this data set the overflow measuring item is [0]
172
175
  // so the first displayItem in the list is [1]
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ var _typeof = require("@babel/runtime/helpers/typeof");
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.default = void 0;
9
+ var _react = _interopRequireDefault(require("react"));
10
+ var _StoryDocsPage = require("../../global/js/utils/StoryDocsPage");
11
+ var stories = _interopRequireWildcard(require("./Cascade.stories"));
12
+ var _blocks = require("@storybook/blocks");
13
+ var _storyHelper = require("../../global/js/utils/story-helper");
14
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
15
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
16
+ var DocsPage = function DocsPage() {
17
+ var _useOf = (0, _blocks.useOf)('meta', ['meta']),
18
+ csfFile = _useOf.csfFile;
19
+ return /*#__PURE__*/_react.default.createElement(_StoryDocsPage.StoryDocsPage, {
20
+ altGuidelinesHref: [(0, _storyHelper.storyDocsGuidelines)(csfFile), {
21
+ href: 'https://www.carbondesignsystem.com/guidelines/motion/overview/',
22
+ label: 'Carbon motion guidelines'
23
+ }],
24
+ blocks: [{
25
+ story: stories.WithoutGrid
26
+ }, {
27
+ description: 'When using `Cascade` with grid support its important that you follow the example code structure and provide the rows and columns. The component will assume this structure and add the appropriate CSS classes to the columns.',
28
+ story: stories.WithGrid
29
+ }]
30
+ });
31
+ };
32
+ var _default = DocsPage;
33
+ exports.default = _default;
@@ -29,6 +29,16 @@ var componentName = 'Cascade';
29
29
  var defaults = {
30
30
  grid: false
31
31
  };
32
+
33
+ /**
34
+
35
+ This pattern is intended for use with cards, tiles, or similarly styled
36
+ components. Use this patterns in areas that are the primary focus on the page to
37
+ help the user along their journey or locate the most important information on
38
+ the page. It should not be used on a page if it is the secondary focus of the
39
+ page as that will distract the user.
40
+
41
+ */
32
42
  var Cascade = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
33
43
  var children = _ref.children,
34
44
  className = _ref.className,
@@ -81,7 +91,7 @@ Cascade.propTypes = {
81
91
  */
82
92
  className: _propTypes.default.string,
83
93
  /**
84
- * Specifies whether or not to wrap the child content in a <Grid />.
94
+ * Specifies whether or not to wrap the child content in a `<Grid />`.
85
95
  * If this is set to true it's important that the children are being wrapped in rows in columns.
86
96
  * Check the documentation for additional clarification.
87
97
  */
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ var _typeof = require("@babel/runtime/helpers/typeof");
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.default = void 0;
9
+ var _react = _interopRequireDefault(require("react"));
10
+ var _StoryDocsPage = require("../../global/js/utils/StoryDocsPage");
11
+ var stories = _interopRequireWildcard(require("./CreateFullPage.stories"));
12
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
13
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
14
+ var DocsPage = function DocsPage() {
15
+ return /*#__PURE__*/_react.default.createElement(_StoryDocsPage.StoryDocsPage, {
16
+ altGuidelinesHref: "https://pages.github.ibm.com/cdai-design/pal/patterns/creation-flows/usage#full-page",
17
+ blocks: [{
18
+ description: "There are **2** components that make up a Create Full Page component, which can\nbe used in unison to create the desired look, or flow. Please note, to utilize\nthe Create Full Page component, you'll need to have a minimum of two steps. If\nyou are looking for a one step creation flow, consider Create Tearsheet, Create\nSide Panel, or Create Modal."
19
+ }, {
20
+ story: stories.createFullPage,
21
+ description: "This is used when you have one section per step. This can be created by passing\nin the overall `<CreateFullPage />` component and the `<CreateFullPageStep />`\ncomponent with form items as children:\n",
22
+ source: {
23
+ code: "<CreateFullPage {...props}>\n <CreateFullPageStep\n title=\"Required title\"\n subtitle=\"Optional subtitle\"\n description=\"Optional description\"\n onNext={() => {'Optional function'}}\n >\n <Row>\n <Column xlg={5} lg={5} md={4} sm={4}>\n <TextInput\n id=\"test-1\"\n invalidText=\"A valid value is required\"\n labelText=\"Topic name\"\n placeholder=\"Enter topic name\"\n />\n </Column>\n </Row>\n </CreateFullPageStep>\n </CreateFullPage>"
24
+ }
25
+ }, {
26
+ story: stories.createFullPageWithSections,
27
+ description: "This is used when you have several sections per step. This can be created by\npassing in the overall `<CreateFullPage />` component and the\n`<CreateFullPageStep />` component for the first `section`. All additional\n`sections` must be passed in as children, as shown below:",
28
+ source: {
29
+ code: "<CreateFullPageStep\n title=\"Required title\"\n subtitle=\"Optional subtitle\"\n description=\"Optional description\"\n onNext={() => {'Optional function'}}\n >\n <Row>\n <Column xlg={5} lg={5} md={4} sm={4}>\n <fieldset className={`#{$pkg-prefix}--create-full-page__step-fieldset`}>\n <TextInput\n id=\"test-1\"\n invalidText=\"A valid value is required\"\n labelText=\"Topic name\"\n placeholder=\"Enter topic name\"\n />\n </fieldset>\n </Column>\n </Row>\n <span className={`#{$pkg-prefix}--create-full-page__section-divider`} />\n <h5 className={`#{$pkg-prefix}--create-full-page__step-title`}>Required title</h5>\n <h6 className={`#{$pkg-prefix}--create-full-page__step-subtitle`}>\n Optional subtitle\n </h6>\n <p className={`#{$pkg-prefix}--create-full-page__step-description`}>\n Optional description\n </p>\n <Row>\n <Column xlg={5} lg={5} md={4} sm={4}>\n <fieldset className={`#{$pkg-prefix}--create-full-page__step-fieldset`}>\n <TextInput\n id=\"test-2\"\n invalidText=\"A valid value is required\"\n labelText=\"Topic name\"\n placeholder=\"Enter topic name\"\n />\n </fieldset>\n </Column>\n </Row>\n</CreateFullPageStep>"
30
+ }
31
+ }, {
32
+ title: 'Using custom components',
33
+ description: "It is possible to use custom components that return `CreateFullPageStep`s in\norder to help reduce the amount of logic in the component that contains the main\n`CreateFullPage`. _It is required that each child of the `CreateFullPage` either\nbe a custom step or a `CreateFullPageStep`_. An example of this could look like\nthe following:",
34
+ source: {
35
+ code: "const CreateStepCustom = ({ subtitle, ...rest }) => {\n return (\n <CreateFullPageStep\n {...rest}\n subtitle={subtitle}\n title=\"Step 1\"\n onNext={() => console.log('optional validation check')}\n onMount={() => console.log('optional onMount fn')}\n disableSubmit={false}\n >\n step content here\n </CreateFullPageStep>\n );\n};\n\nconst CreateComponent = () => {\n return (\n <CreateFullPage {...createFullPageProps}>\n <CreateStepCustom subtitle=\"Custom step subtitle\" />\n <CreateFullPageStep\n title=\"Topic name\"\n fieldsetLegendText=\"Topic information\"\n disableSubmit={!value}\n subtitle=\"This is the unique name used to recognize your topic\"\n description=\"It will also be used by your producers and consumers as part of the\n connection information, so make it something easy to recognize.\"\n >\n Content for second step\n </CreateFullPageStep>\n </CreateFullPage>\n );\n};"
36
+ }
37
+ }, {
38
+ title: 'Using dynamic steps',
39
+ description: "The use of dynamic steps can be utilized in a scenario when the user makes a\ncertain selection on one step that effects which steps will follow it, this is\ncontrolled via the `includeStep` prop. See abbreviated example below:",
40
+ source: {
41
+ code: "import { useState } from 'react';\n\nconst CreateFlow = () => {\n const [shouldIncludeAdditionalStep, setShouldIncludeAdditionalStep] =\n useState(false);\n return (\n <CreateFullPage {...createFullPageProps}>\n <CreateFullPageStep {...step1Props}>\n Step 1 content\n <Checkbox\n labelText={`Include additional step`}\n id=\"include-additional-step-checkbox\"\n onChange={(value) => setShouldIncludeAdditionalStep(value)}\n checked={shouldIncludeAdditionalStep}\n />\n </CreateFullPageStep>\n <CreateFullPageStep\n {...step2Props}\n includeStep={shouldIncludeAdditionalStep}\n >\n Dynamic step content\n </CreateFullPageStep>\n <CreateFullPageStep {...step3Props}>\n Final step content\n </CreateFullPageStep>\n </CreateFullPage>\n );\n};"
42
+ }
43
+ }, {
44
+ title: 'Class names',
45
+ description: "Additionally, to get the preferred styling when including your own children as\nsections, you can utilize the below included class names.\n\n| Class name | Element | Features |\n| ---------------------------------------------------- | ----------- | ---------------------------------------------------------- |\n| `#{$pkg-prefix}--create-full-page__step-title` | title | `productive-heading-04` & `margin-bottom` of `$spacing-05` |\n| `#{$pkg-prefix}--create-full-page__step-subtitle` | subtitle | `productive-heading-01` & `margin-bottom` of `$spacing-03` |\n| `#{$pkg-prefix}--create-full-page__step-description` | description | `body-long-01` & `margin-bottom` of `$spacing-06` |\n| `#{$pkg-prefix}--create-full-page__step-fieldset` | fieldset | `margin-bottom` of `$spacing-05` to all children elements |\n| `#{$pkg-prefix}--create-full-page__section-divider` | divider | Includes a `1px` divider line inside the `main` content |\n"
46
+ }]
47
+ });
48
+ };
49
+ var _default = DocsPage;
50
+ exports.default = _default;
@@ -43,6 +43,19 @@ var StepsContext = /*#__PURE__*/(0, _react.createContext)(null);
43
43
  // to let it know what number it is in the sequence of steps
44
44
  exports.StepsContext = StepsContext;
45
45
  var StepNumberContext = /*#__PURE__*/(0, _react.createContext)(-1);
46
+
47
+ /**
48
+ * Use with creations that must be completed in order for a service to be usable.
49
+ *
50
+ * ### Grid
51
+ *
52
+ * The `CreateFullPage` component utilizes Carbons' grid system in the inner
53
+ content of the main section inside of the component. You can read more guidance
54
+ on the Carbon's grid system
55
+ [here](https://www.carbondesignsystem.com/guidelines/2x-grid/overview). You can
56
+ include `<Row>` and `<Column>` components inside of each `CreateFullPageStep`
57
+ component to get the desired affect.
58
+ */
46
59
  exports.StepNumberContext = StepNumberContext;
47
60
  var CreateFullPage = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
48
61
  var backButtonText = _ref.backButtonText,
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ var _typeof = require("@babel/runtime/helpers/typeof");
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.default = void 0;
9
+ var _react = _interopRequireDefault(require("react"));
10
+ var _StoryDocsPage = require("../../global/js/utils/StoryDocsPage");
11
+ var stories = _interopRequireWildcard(require("./CreateModal.stories"));
12
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
13
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
14
+ var DocsPage = function DocsPage() {
15
+ return /*#__PURE__*/_react.default.createElement(_StoryDocsPage.StoryDocsPage, {
16
+ altGuidelinesHref: "https://pages.github.ibm.com/cdai-design/pal/patterns/creation-flows/usage#modal",
17
+ blocks: [{
18
+ story: stories.Default
19
+ }, {
20
+ title: 'Form validation',
21
+ description: "All forms, including that within the `CreateModal` should follow C&CS guidelines\nfor form validation.\n\nThis includes the following:\n\n- The `Submit` button in the modal should be disabled, until all required inputs\n are filled in and valid\n- All required inputs should _only_ throw an invalid error _after_ the element\n loses focus\n- All optional form fields should have an `(optional)` text at the end of the\n input `labelText`. Optional should always be in parentheses\n\nYou can find more information on how to validate your form fields in\n[Carbon's Form usage page](https://www.carbondesignsystem.com/components/form/usage)."
22
+ }, {
23
+ title: 'Overriding Carbon theme',
24
+ description: "The design recommendation is to use a dark theme for the CreateModal if the\napplication is currently using a light theme, and vice versa. The theme applied\nto the CreateModal can easily be customized as follows:\n\nIn SCSS:",
25
+ source: {
26
+ language: 'css',
27
+ code: " .#{$pkg-prefix}--create-modal {\n @include carbon--theme(\n $theme: $carbon--theme--g90\n );\n }"
28
+ }
29
+ }, {
30
+ description: "Alternatively, the required Carbon theme can be set as above in a custom CSS\nclass which is then applied to the CreateModal using the `className` prop."
31
+ }]
32
+ });
33
+ };
34
+ var _default = DocsPage;
35
+ exports.default = _default;