@carbon/ibm-products 2.1.2 → 2.1.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (128) hide show
  1. package/css/index-full-carbon.css +562 -189
  2. package/css/index-full-carbon.css.map +1 -1
  3. package/css/index-full-carbon.min.css +2 -2
  4. package/css/index-full-carbon.min.css.map +1 -1
  5. package/css/index-without-carbon-released-only.css +151 -0
  6. package/css/index-without-carbon-released-only.css.map +1 -1
  7. package/css/index-without-carbon-released-only.min.css +1 -1
  8. package/css/index-without-carbon-released-only.min.css.map +1 -1
  9. package/css/index-without-carbon.css +320 -18
  10. package/css/index-without-carbon.css.map +1 -1
  11. package/css/index-without-carbon.min.css +2 -2
  12. package/css/index-without-carbon.min.css.map +1 -1
  13. package/css/index.css +231 -94
  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/Cascade/Cascade.docs-page.js +22 -0
  21. package/es/components/Cascade/Cascade.js +11 -1
  22. package/es/components/CreateFullPage/CreateFullPage.docs-page.js +39 -0
  23. package/es/components/CreateFullPage/CreateFullPage.js +13 -0
  24. package/es/components/CreateModal/CreateModal.docs-page.js +24 -0
  25. package/es/components/CreateModal/CreateModal.js +7 -0
  26. package/es/components/CreateSidePanel/CreateSidePanel.docs-page.js +18 -0
  27. package/es/components/CreateSidePanel/CreateSidePanel.js +1 -1
  28. package/es/components/CreateTearsheet/CreateTearsheet.docs-page.js +29 -0
  29. package/es/components/Datagrid/Datagrid/DatagridSelectAllWithToggle.js +3 -3
  30. package/es/components/Datagrid/Datagrid/DatagridToolbar.js +3 -2
  31. package/es/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditCell/InlineEditCell.js +19 -17
  32. package/es/components/Datagrid/Datagrid/addons/InlineEdit/handleGridKeyPress.js +2 -2
  33. package/es/components/EditFullPage/EditFullPage.docs-page.js +39 -0
  34. package/es/components/EditFullPage/EditFullPage.js +2 -1
  35. package/es/components/EditSidePanel/EditSidePanel.js +1 -1
  36. package/es/components/EditTearsheet/EditTearsheet.docs-page.js +25 -0
  37. package/es/components/EditTearsheet/EditTearsheet.js +4 -0
  38. package/es/components/EditTearsheetNarrow/EditTearsheetNarrow.js +1 -1
  39. package/es/components/EditUpdateCards/EditUpdateCards.js +3 -2
  40. package/es/components/EmptyStates/EmptyState.js +4 -0
  41. package/es/components/EmptyStates/ErrorEmptyState/ErrorEmptyState.js +4 -0
  42. package/es/components/EmptyStates/NoDataEmptyState/NoDataEmptyState.js +4 -0
  43. package/es/components/EmptyStates/NoTagsEmptyState/NoTagsEmptyState.js +4 -0
  44. package/es/components/EmptyStates/NotFoundEmptyState/NotFoundEmptyState.js +4 -0
  45. package/es/components/EmptyStates/NotificationsEmptyState/NotificationsEmptyState.js +4 -0
  46. package/es/components/EmptyStates/UnauthorizedEmptyState/UnauthorizedEmptyState.js +4 -0
  47. package/es/components/ExampleComponent/ExampleComponent.docs-page.js +22 -0
  48. package/es/components/ExportModal/ExportModal.js +4 -0
  49. package/es/components/HTTPErrors/HTTPError403/HTTPError403.js +6 -0
  50. package/es/components/HTTPErrors/HTTPError404/HTTPError404.js +6 -0
  51. package/es/components/HTTPErrors/HTTPErrorOther/HTTPErrorOther.js +6 -0
  52. package/es/components/ImportModal/ImportModal.docs-page.js +18 -0
  53. package/es/components/MultiAddSelect/MultiAddSelect.docs-page.js +17 -0
  54. package/es/components/MultiAddSelect/MultiAddSelect.js +4 -0
  55. package/es/components/RemoveModal/RemoveModal.docs-page.js +18 -0
  56. package/es/components/RemoveModal/RemoveModal.js +6 -0
  57. package/es/components/SingleAddSelect/SingleAddSelect.docs-page.js +15 -0
  58. package/es/components/SingleAddSelect/SingleAddSelect.js +4 -0
  59. package/es/components/StatusIcon/StatusIcon.docs-page.js +17 -0
  60. package/es/components/StatusIcon/StatusIcon.js +10 -0
  61. package/es/components/Tearsheet/TearsheetShell.js +7 -1
  62. package/es/components/Toolbar/Toolbar.docs-page.js +14 -0
  63. package/es/components/UserProfileImage/UserProfileImage.docs-page.js +17 -0
  64. package/es/components/UserProfileImage/UserProfileImage.js +1 -1
  65. package/es/components/WebTerminal/WebTerminal.docs-page.js +52 -0
  66. package/es/components/WebTerminal/WebTerminal.js +4 -0
  67. package/es/global/js/utils/StoryDocsPage.js +218 -0
  68. package/es/global/js/utils/story-helper.js +107 -5
  69. package/lib/components/APIKeyModal/APIKeyModal.docs-page.js +37 -0
  70. package/lib/components/AboutModal/AboutModal.docs-page.js +32 -0
  71. package/lib/components/AboutModal/AboutModal.js +1 -1
  72. package/lib/components/Cascade/Cascade.docs-page.js +33 -0
  73. package/lib/components/Cascade/Cascade.js +11 -1
  74. package/lib/components/CreateFullPage/CreateFullPage.docs-page.js +50 -0
  75. package/lib/components/CreateFullPage/CreateFullPage.js +13 -0
  76. package/lib/components/CreateModal/CreateModal.docs-page.js +35 -0
  77. package/lib/components/CreateModal/CreateModal.js +7 -0
  78. package/lib/components/CreateSidePanel/CreateSidePanel.docs-page.js +29 -0
  79. package/lib/components/CreateSidePanel/CreateSidePanel.js +1 -1
  80. package/lib/components/CreateTearsheet/CreateTearsheet.docs-page.js +40 -0
  81. package/lib/components/Datagrid/Datagrid/DatagridSelectAllWithToggle.js +3 -3
  82. package/lib/components/Datagrid/Datagrid/DatagridToolbar.js +3 -2
  83. package/lib/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditCell/InlineEditCell.js +19 -17
  84. package/lib/components/Datagrid/Datagrid/addons/InlineEdit/handleGridKeyPress.js +2 -2
  85. package/lib/components/EditFullPage/EditFullPage.docs-page.js +50 -0
  86. package/lib/components/EditFullPage/EditFullPage.js +2 -1
  87. package/lib/components/EditSidePanel/EditSidePanel.js +1 -1
  88. package/lib/components/EditTearsheet/EditTearsheet.docs-page.js +36 -0
  89. package/lib/components/EditTearsheet/EditTearsheet.js +4 -0
  90. package/lib/components/EditTearsheetNarrow/EditTearsheetNarrow.js +1 -1
  91. package/lib/components/EditUpdateCards/EditUpdateCards.js +3 -2
  92. package/lib/components/EmptyStates/EmptyState.js +4 -0
  93. package/lib/components/EmptyStates/ErrorEmptyState/ErrorEmptyState.js +4 -0
  94. package/lib/components/EmptyStates/NoDataEmptyState/NoDataEmptyState.js +4 -0
  95. package/lib/components/EmptyStates/NoTagsEmptyState/NoTagsEmptyState.js +4 -0
  96. package/lib/components/EmptyStates/NotFoundEmptyState/NotFoundEmptyState.js +4 -0
  97. package/lib/components/EmptyStates/NotificationsEmptyState/NotificationsEmptyState.js +4 -0
  98. package/lib/components/EmptyStates/UnauthorizedEmptyState/UnauthorizedEmptyState.js +4 -0
  99. package/lib/components/ExampleComponent/ExampleComponent.docs-page.js +33 -0
  100. package/lib/components/ExportModal/ExportModal.js +4 -0
  101. package/lib/components/HTTPErrors/HTTPError403/HTTPError403.js +6 -0
  102. package/lib/components/HTTPErrors/HTTPError404/HTTPError404.js +6 -0
  103. package/lib/components/HTTPErrors/HTTPErrorOther/HTTPErrorOther.js +6 -0
  104. package/lib/components/ImportModal/ImportModal.docs-page.js +26 -0
  105. package/lib/components/MultiAddSelect/MultiAddSelect.docs-page.js +25 -0
  106. package/lib/components/MultiAddSelect/MultiAddSelect.js +4 -0
  107. package/lib/components/RemoveModal/RemoveModal.docs-page.js +26 -0
  108. package/lib/components/RemoveModal/RemoveModal.js +6 -0
  109. package/lib/components/SingleAddSelect/SingleAddSelect.docs-page.js +23 -0
  110. package/lib/components/SingleAddSelect/SingleAddSelect.js +4 -0
  111. package/lib/components/StatusIcon/StatusIcon.docs-page.js +28 -0
  112. package/lib/components/StatusIcon/StatusIcon.js +10 -0
  113. package/lib/components/Tearsheet/TearsheetShell.js +7 -1
  114. package/lib/components/Toolbar/Toolbar.docs-page.js +25 -0
  115. package/lib/components/UserProfileImage/UserProfileImage.docs-page.js +28 -0
  116. package/lib/components/UserProfileImage/UserProfileImage.js +1 -1
  117. package/lib/components/WebTerminal/WebTerminal.docs-page.js +63 -0
  118. package/lib/components/WebTerminal/WebTerminal.js +4 -0
  119. package/lib/global/js/utils/StoryDocsPage.js +225 -0
  120. package/lib/global/js/utils/story-helper.js +114 -6
  121. package/package.json +8 -8
  122. package/scss/components/Cascade/_storybook-styles.scss +3 -2
  123. package/scss/components/Datagrid/_storybook-styles.scss +1 -1
  124. package/scss/components/Datagrid/styles/_datagrid.scss +14 -0
  125. package/scss/components/NotificationsPanel/_storybook-styles.scss +12 -0
  126. package/scss/components/PageHeader/_storybook-styles.scss +0 -18
  127. package/scss/components/WebTerminal/_storybook-styles.scss +7 -12
  128. package/scss/components/HTTPErrors/_storybook-styles.scss +0 -20
@@ -13,6 +13,10 @@ import { getDevtoolsProps } from '../../global/js/utils/devtools';
13
13
  import { pkg } from '../../settings';
14
14
  import { prepareProps } from '../../global/js/utils/props-helper';
15
15
  var componentName = 'SingleAddSelect';
16
+
17
+ /**
18
+ * Used to add or select one or more items from larger lists or hierarchies.
19
+ */
16
20
  export var SingleAddSelect = /*#__PURE__*/forwardRef(function (props, ref) {
17
21
  // remove multi add select specific props
18
22
  var validProps = prepareProps(props, ['columnInputPlaceholder', 'globalFilters', 'globalFiltersIconDescription', 'globalFiltersPlaceholderText', 'globalFiltersPrimaryButtonText', 'globalFiltersSecondaryButtonText', 'influencerTitle', 'multi', 'noSelectionDescription', 'noSelectionTitle', 'removeIconDescription']);
@@ -0,0 +1,17 @@
1
+ import React from 'react';
2
+ import { StoryDocsPage } from '../../global/js/utils/StoryDocsPage';
3
+ import * as stories from './StatusIcon.stories';
4
+ var DocsPage = function DocsPage() {
5
+ return /*#__PURE__*/React.createElement(StoryDocsPage, {
6
+ blocks: [{
7
+ story: stories.Default
8
+ }, {
9
+ title: 'Accessibility',
10
+ description: "The `StatusIcon` component follows the Carbon guidelines for status icons with\nsome added specifications around illustration usage. For additional usage\nguidelines and documentation please refer to the links above.\n\n_Status icons_ are an important method of communicating severity level\ninformation to users. The shapes and colors, communicate severity that enable\nusers to quickly assess and identify status and respond accordingly."
11
+ }, {
12
+ title: 'Sizing',
13
+ description: "\n| Size | Pixels |\n| ------- | ------- |\n| small | 16 x 16 |\n| medium | 20 x 20 |\n| large | 24 x 24 |\n| x-large | 32 x 32 |\n "
14
+ }]
15
+ });
16
+ };
17
+ export default DocsPage;
@@ -16,6 +16,16 @@ import { getDevtoolsProps } from '../../global/js/utils/devtools';
16
16
  import { pkg } from '../../settings';
17
17
  var blockClass = "".concat(pkg.prefix, "--status-icon");
18
18
  var componentName = 'StatusIcon';
19
+
20
+ /**
21
+ The `StatusIcon` component follows the Carbon guidelines for status icons with
22
+ some added specifications around illustration usage. For additional usage
23
+ guidelines and documentation please refer to the links above.
24
+
25
+ _Status icons_ are an important method of communicating severity level
26
+ information to users. The shapes and colors, communicate severity that enable
27
+ users to quickly assess and identify status and respond accordingly.
28
+ */
19
29
  export var StatusIcon = /*#__PURE__*/forwardRef(function (_ref, ref) {
20
30
  var _icons$kind;
21
31
  var kind = _ref.kind,
@@ -55,7 +55,13 @@ export var tearsheetHasCloseIcon = function tearsheetHasCloseIcon(actions, hasCl
55
55
  return hasCloseIcon !== null && hasCloseIcon !== void 0 ? hasCloseIcon : tearsheetIsPassive(actions);
56
56
  };
57
57
 
58
- // TearSheetShell is used internally by TearSheet and TearSheetNarrow
58
+ /**
59
+ * TearSheetShell is used internally by TearSheet and TearSheetNarrow
60
+ *
61
+ * The component is not public.
62
+ *
63
+ * See the canvas tab for the component API details.
64
+ * */
59
65
  export var TearsheetShell = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
60
66
  var actions = _ref.actions,
61
67
  children = _ref.children,
@@ -0,0 +1,14 @@
1
+ import React from 'react';
2
+ import { StoryDocsPage } from '../../global/js/utils/StoryDocsPage';
3
+ import * as stories from './Toolbar.stories';
4
+ var DocsPage = function DocsPage() {
5
+ return /*#__PURE__*/React.createElement(StoryDocsPage, {
6
+ blocks: [{
7
+ story: stories._Toolbar
8
+ }, {
9
+ story: stories.vertical,
10
+ description: "A toolbar orientation for floating the toolbar on the canvas."
11
+ }]
12
+ });
13
+ };
14
+ export default DocsPage;
@@ -0,0 +1,17 @@
1
+ import React from 'react';
2
+ import { StoryDocsPage } from '../../global/js/utils/StoryDocsPage';
3
+ import * as stories from './UserProfileImage.stories';
4
+ var DocsPage = function DocsPage() {
5
+ return /*#__PURE__*/React.createElement(StoryDocsPage, {
6
+ blocks: [{
7
+ story: stories.Default
8
+ }, {
9
+ story: stories.WithGroupIcon,
10
+ description: "By passing in icon prop with a value of `group`, the avatar will display the group icon"
11
+ }, {
12
+ story: stories.WithInitials,
13
+ description: "When passing a display name to the component, the display name will be distilled down to the first and last initials of the display name. `Thomas Watson` and `Thomas J. Watson` will both display `TW` as the initials."
14
+ }]
15
+ });
16
+ };
17
+ export default DocsPage;
@@ -33,7 +33,7 @@ var defaults = {
33
33
  tooltipAlignment: 'bottom'
34
34
  };
35
35
  /**
36
- * This is a user profile image component which displays an image, or initials or icon for a user.
36
+ * The user profile avatar allows for an image of the user to be displayed by passing in the image prop. By default the component will display a user icon on a blue background.
37
37
  */
38
38
  export var UserProfileImage = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
39
39
  var backgroundColor = _ref.backgroundColor,
@@ -0,0 +1,52 @@
1
+ import React from 'react';
2
+ import { StoryDocsPage } from '../../global/js/utils/StoryDocsPage';
3
+ import * as stories from './WebTerminal.stories';
4
+ var DocsPage = function DocsPage() {
5
+ return /*#__PURE__*/React.createElement(StoryDocsPage, {
6
+ blocks: [{
7
+ description: "To get started using the WebTerminal, you have to first wrap your\n application with the `<WebTerminalProvider>`\n component. This will allow all the WebTerminal components to be\n used with the `useWebTerminal()` custom hook.\n ",
8
+ title: 'Getting Started',
9
+ source: {
10
+ code: "import { WebTerminalProvider } from '@carbon/ibm-products';\n\nconst App = () => {\n return (\n <WebTerminalProvider>\n ...\n <WebTerminalProvider>\n )\n};"
11
+ }
12
+ }, {
13
+ title: 'useWebTerminal()',
14
+ source: {
15
+ code: "const { open, openWebTerminal, closeWebTerminal, toggleWebTerminal } =\n useWebTerminal();"
16
+ }
17
+ }, {
18
+ description: "The `useWebTerminal()` hook returns an object with 4 properties:\n1. Read the `open` state (true or false)\n2. `openWebTerminal` sets the `open` state to true\n3. `closeWebTerminal` sets the `open` state to false\n4. `toggleWebTerminal` toggles between true and false\n\nExample:\n",
19
+ source: {
20
+ code: "const MyComponent = () => {\n const { open, openWebTerminal, closeWebTerminal, toggleWebTerminal } =\n useWebTerminal();\n\n return (\n <div>\n <button onClick={() => openWebTerminal()}>Open web terminal</button>\n <button onClick={() => closeWebTerminal()}>Close web terminal</button>\n <button onClick={() => toggleWebTerminal()}>Toggle web terminal</button>\n <p>The web terminal is now {open}</p>\n\n <WebTerminal>...</WebTerminal>\n </div>\n );\n};"
21
+ }
22
+ }, {
23
+ subTitle: 'Passing in your own terminal.',
24
+ description: "The `WebTerminal` is wrapper component for your own\nterminal component that you may have been using for your product.\nSimply pass your own terminal component as children.\n "
25
+ }, {
26
+ subTitle: 'Optional wrapper component.',
27
+ description: "Optionally you can import `WebTerminalContentWrapper` to have\n content adjust their width based off the `WebTerminal` width when\n it is opened.",
28
+ source: {
29
+ code: "<WebTerminalContentWrapper>\n content\n</WebTerminalContentWrapper>\n\n<WebTerminal>\n ...\n</WebTerminal>"
30
+ }
31
+ }, {
32
+ description: 'The default web terminal is one which opens and the terminal loads. Then if the user desires to dismiss it they can click the close icon on the top right corner of the component.',
33
+ story: stories.Default
34
+ }, {
35
+ story: stories.WithDocumentationLinks
36
+ }, {
37
+ subTitle: 'Help users with helpful documentation links',
38
+ description: "Optionally you can pass documentation links to help point your users to useful\ndocumentation for your terminal, or kubernetes commands etc.\n\nThe documentation links should reflect the same props as `OverflowMenuItem` from\ncarbon.\n\nLearn more:\nhttps://react.carbondesignsystem.com/?path=/docs/components-overflowmenu--default\n",
39
+ source: {
40
+ code: "const documentationLinks = [\n {\n itemText: 'BX/ICP docs',\n href: '#',\n onClick: () => console.log('clicked'),\n },\n {\n itemText: 'Kubernetes docs',\n href: '#',\n onClick: () => console.log('clicked'),\n },\n {\n itemText: 'Docker docs',\n href: '#',\n onClick: () => console.log('clicked'),\n },\n {\n itemText: 'Helm docs',\n href: '#',\n onClick: () => console.log('clicked'),\n },\n];"
41
+ }
42
+ }, {
43
+ story: stories.WithActions
44
+ }, {
45
+ description: "Optionally you can add actions to the web terminal header bar. To add actions\nyou need to pass in an array of actions with objects for each object.",
46
+ source: {
47
+ code: "<WebTerminal\n actions={[\n {\n renderIcon: Code32,\n onClick: () => {},\n iconDescription: 'Create new deployment',\n },\n ]}\n>\n ...\n</WebTerminal>"
48
+ }
49
+ }]
50
+ });
51
+ };
52
+ export default DocsPage;
@@ -39,6 +39,10 @@ var defaults = {
39
39
  documentationLinksIconDescription: 'Show documentation links',
40
40
  isInitiallyOpen: false
41
41
  };
42
+
43
+ /**
44
+ * The `WebTerminal` is prompted by the user and is persistent until dismissed. The purpose of a web terminal is to provide users with the ability to type commands manually instead of using the GUI.
45
+ */
42
46
  export var WebTerminal = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
43
47
  var _ref3;
44
48
  var _ref$actions = _ref.actions,
@@ -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,6 +105,100 @@ 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.
@@ -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