@carbon/ibm-products 1.0.0-rc.2 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (39) hide show
  1. package/README.md +12 -13
  2. package/css/index-full-carbon.css +34 -69
  3. package/css/index-full-carbon.css.map +1 -1
  4. package/css/index-full-carbon.min.css +1 -1
  5. package/css/index-without-carbon-released-only.css +34 -6
  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.css +34 -69
  9. package/css/index-without-carbon.css.map +1 -1
  10. package/css/index-without-carbon.min.css +1 -1
  11. package/css/index.css +34 -69
  12. package/css/index.css.map +1 -1
  13. package/css/index.min.css +1 -1
  14. package/es/components/Card/Card.js +18 -4
  15. package/es/components/ExpressiveCard/ExpressiveCard.js +3 -2
  16. package/es/components/PageHeader/PageHeader.js +46 -36
  17. package/es/components/ProductiveCard/ProductiveCard.js +3 -2
  18. package/es/components/Toolbar/ToolbarButton.js +7 -5
  19. package/es/components/_Canary/Canary.js +1 -1
  20. package/es/components/index.js +0 -1
  21. package/es/global/js/package-settings.js +0 -1
  22. package/es/global/js/utils/story-helper.js +22 -0
  23. package/lib/components/Card/Card.js +18 -4
  24. package/lib/components/ExpressiveCard/ExpressiveCard.js +3 -2
  25. package/lib/components/PageHeader/PageHeader.js +46 -36
  26. package/lib/components/ProductiveCard/ProductiveCard.js +3 -2
  27. package/lib/components/Toolbar/ToolbarButton.js +6 -3
  28. package/lib/components/_Canary/Canary.js +1 -1
  29. package/lib/components/index.js +0 -8
  30. package/lib/global/js/package-settings.js +0 -1
  31. package/lib/global/js/utils/story-helper.js +29 -2
  32. package/package.json +5 -5
  33. package/scss/components/ButtonSetWithOverflow/_button-set-with-overflow.scss +1 -0
  34. package/scss/components/Card/_card.scss +1 -0
  35. package/scss/components/PageHeader/_page-header.scss +36 -6
  36. package/scss/components/PageHeader/_storybook-styles.scss +1 -0
  37. package/scss/components/ProductiveCard/_productive-card.scss +4 -0
  38. package/scss/components/Tearsheet/_tearsheet.scss +6 -0
  39. package/scss/components/_index.scss +0 -1
@@ -87,7 +87,8 @@ export var Card = /*#__PURE__*/forwardRef(function (_ref, ref) {
87
87
  Icon = _ref3.icon,
88
88
  onClick = _ref3.onClick,
89
89
  iconDescription = _ref3.iconDescription,
90
- onKeyDown = _ref3.onKeyDown;
90
+ onKeyDown = _ref3.onKeyDown,
91
+ href = _ref3.href;
91
92
 
92
93
  if (productive) {
93
94
  return /*#__PURE__*/React.createElement(Button, {
@@ -97,10 +98,22 @@ export var Card = /*#__PURE__*/forwardRef(function (_ref, ref) {
97
98
  onClick: onClick,
98
99
  size: actionsPlacement === 'top' ? 'sm' : 'field',
99
100
  iconDescription: iconDescription,
100
- kind: "ghost"
101
+ kind: "ghost",
102
+ href: href
101
103
  });
102
104
  }
103
105
 
106
+ if (href) {
107
+ return /*#__PURE__*/React.createElement("a", {
108
+ key: id,
109
+ className: "".concat(blockClass, "__icon"),
110
+ href: href,
111
+ onClick: onClick
112
+ }, /*#__PURE__*/React.createElement(Icon, {
113
+ "aria-label": iconDescription
114
+ }));
115
+ }
116
+
104
117
  return /*#__PURE__*/React.createElement("div", {
105
118
  key: id,
106
119
  className: "".concat(blockClass, "__icon"),
@@ -195,7 +208,8 @@ Card.propTypes = {
195
208
  icon: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
196
209
  onKeyDown: PropTypes.func,
197
210
  onClick: PropTypes.func,
198
- iconDescription: PropTypes.string
211
+ iconDescription: PropTypes.string,
212
+ href: PropTypes.string
199
213
  })),
200
214
  actionsPlacement: PropTypes.oneOf(['top', 'bottom']),
201
215
  children: PropTypes.node,
@@ -219,7 +233,7 @@ Card.propTypes = {
219
233
  primaryButtonHref: PropTypes.string,
220
234
  primaryButtonIcon: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
221
235
  primaryButtonKind: PropTypes.oneOf(['primary', 'ghost']),
222
- primaryButtonText: PropTypes.string,
236
+ primaryButtonText: PropTypes.node,
223
237
  productive: PropTypes.bool,
224
238
  secondaryButtonHref: PropTypes.string,
225
239
  secondaryButtonIcon: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
@@ -22,14 +22,15 @@ export var ExpressiveCard = /*#__PURE__*/forwardRef(function (props, ref) {
22
22
  ExpressiveCard = pkg.checkComponentEnabled(ExpressiveCard, componentName);
23
23
  ExpressiveCard.propTypes = {
24
24
  /**
25
- * Icons that are displayed on card. Refer to design documentation for implementation guidelines
25
+ * Icons that are displayed on card. Refer to design documentation for implementation guidelines. Note- href will supersede onClick
26
26
  */
27
27
  actionIcons: PropTypes.arrayOf(PropTypes.shape({
28
28
  id: PropTypes.string,
29
29
  icon: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
30
30
  onKeyDown: PropTypes.func,
31
31
  onClick: PropTypes.func,
32
- iconDescription: PropTypes.string
32
+ iconDescription: PropTypes.string,
33
+ href: PropTypes.string
33
34
  })),
34
35
 
35
36
  /**
@@ -2,7 +2,7 @@ import _extends from "@babel/runtime/helpers/extends";
2
2
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
3
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
4
4
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
5
- var _excluded = ["actionBarItems", "actionBarMenuOptionsClass", "actionBarOverflowAriaLabel", "allTagsModalSearchLabel", "allTagsModalSearchPlaceholderText", "allTagsModalTitle", "hasBackgroundAlways", "breadcrumbOverflowAriaLabel", "breadcrumbs", "children", "className", "collapseHeader", "collapseHeaderIconDescription", "collapseTitle", "disableBreadcrumbScroll", "expandHeaderIconDescription", "fullWidthGrid", "hasCollapseHeaderToggle", "narrowGrid", "navigation", "pageActions", "pageActionsOverflowLabel", "pageActionsMenuOptionsClass", "showAllTagsLabel", "subtitle", "tags", "title"];
5
+ var _excluded = ["actionBarItems", "actionBarMenuOptionsClass", "actionBarOverflowAriaLabel", "allTagsModalSearchLabel", "allTagsModalSearchPlaceholderText", "allTagsModalTitle", "hasBackgroundAlways", "breadcrumbOverflowAriaLabel", "breadcrumbs", "children", "className", "collapseHeader", "collapseHeaderIconDescription", "collapseTitle", "disableBreadcrumbScroll", "expandHeaderIconDescription", "fullWidthGrid", "hasCollapseHeaderToggle", "narrowGrid", "navigation", "pageActions", "pageActionsOverflowLabel", "pageActionsMenuOptionsClass", "showAllTagsLabel", "subtitle", "tags", "title", "withoutBackground"];
6
6
 
7
7
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
8
8
 
@@ -22,7 +22,7 @@ import { useResizeDetector } from 'react-resize-detector';
22
22
  import { Grid, Column, Row, Button, Tag } from 'carbon-components-react';
23
23
  import { useWindowResize, useNearestScroll } from '../../global/js/hooks';
24
24
  import { getDevtoolsProps } from '../../global/js/utils/devtools';
25
- import { prepareProps } from '../../global/js/utils/props-helper';
25
+ import { deprecateProp, prepareProps } from '../../global/js/utils/props-helper';
26
26
  import { pkg } from '../../settings';
27
27
  import { ActionBar } from '../ActionBar/';
28
28
  import { BreadcrumbWithOverflow } from '../BreadcrumbWithOverflow';
@@ -33,7 +33,7 @@ var componentName = 'PageHeader';
33
33
  import { blockClass, utilCheckUpdateVerticalSpace, utilGetBreadcrumbItemForTitle, utilSetCollapsed } from './PageHeaderUtils';
34
34
  import { PageHeaderTitle } from './PageHeaderTitle';
35
35
  export var PageHeader = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
36
- var _ref5, _cx2, _ref6, _cx4, _cx7;
36
+ var _withoutBackground, _ref5, _cx2, _ref6, _cx4, _cx7;
37
37
 
38
38
  var actionBarItems = _ref.actionBarItems,
39
39
  actionBarMenuOptionsClass = _ref.actionBarMenuOptionsClass,
@@ -41,7 +41,7 @@ export var PageHeader = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
41
41
  allTagsModalSearchLabel = _ref.allTagsModalSearchLabel,
42
42
  allTagsModalSearchPlaceholderText = _ref.allTagsModalSearchPlaceholderText,
43
43
  allTagsModalTitle = _ref.allTagsModalTitle,
44
- hasBackgroundAlways = _ref.hasBackgroundAlways,
44
+ deprecated_hasBackgroundAlways = _ref.hasBackgroundAlways,
45
45
  breadcrumbOverflowAriaLabel = _ref.breadcrumbOverflowAriaLabel,
46
46
  breadcrumbs = _ref.breadcrumbs,
47
47
  children = _ref.children,
@@ -62,8 +62,13 @@ export var PageHeader = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
62
62
  subtitle = _ref.subtitle,
63
63
  tags = _ref.tags,
64
64
  title = _ref.title,
65
+ withoutBackground = _ref.withoutBackground,
65
66
  rest = _objectWithoutProperties(_ref, _excluded);
66
67
 
68
+ // handle deprecated props - START
69
+ // if withoutBackground is null check deprecated_hasBackgroundAlways and default false
70
+ (_withoutBackground = withoutBackground) !== null && _withoutBackground !== void 0 ? _withoutBackground : withoutBackground = !(deprecated_hasBackgroundAlways !== null && deprecated_hasBackgroundAlways !== void 0 ? deprecated_hasBackgroundAlways : true); // handle deprecated props - END
71
+
67
72
  var _useState = useState({}),
68
73
  _useState2 = _slicedToArray(_useState, 2),
69
74
  metrics = _useState2[0],
@@ -85,7 +90,7 @@ export var PageHeader = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
85
90
  }; // state based on props only
86
91
 
87
92
 
88
- var hasActionBar = actionBarItems && actionBarItems.length;
93
+ var hasActionBar = actionBarItems && actionBarItems.length > 0;
89
94
  var hasBreadcrumbRow = breadcrumbs || actionBarItems; // NOTE: The buffer is used to add space between the bottom of the header and the last content
90
95
  // Not pre-collapsed and (subtitle or children)
91
96
 
@@ -282,8 +287,8 @@ export var PageHeader = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
282
287
  checkUpdateVerticalSpace(); // eslint-disable-next-line react-hooks/exhaustive-deps
283
288
  }, [fullWidthGrid, narrowGrid]);
284
289
  useEffect(function () {
285
- // Determines if the hasBackgroundAlways should be one based on the header height or scroll
286
- var result = hasBackgroundAlways ? 1 : 0;
290
+ // Determines the appropriate header background opacity based on the header config/height/scroll and the withoutBackground setting
291
+ var result = withoutBackground ? 0 : 1;
287
292
 
288
293
  if (!result && metrics.headerHeight > 0 && (breadcrumbs || actionBarItems || tags || navigation)) {
289
294
  var startAddingAt = parseFloat(layout05, 10) * parseInt(baseFontSize);
@@ -301,13 +306,13 @@ export var PageHeader = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
301
306
  setPageHeaderStyles(function (prev) {
302
307
  return _objectSpread(_objectSpread({}, prev), {}, _defineProperty({}, "--".concat(blockClass, "--background-opacity"), result));
303
308
  });
304
- }, [actionBarItems, hasBackgroundAlways, breadcrumbs, headerRef, metrics.breadcrumbRowHeight, metrics.headerHeight, navigation, scrollYValue, hasCollapseHeaderToggle, tags]);
309
+ }, [actionBarItems, withoutBackground, breadcrumbs, headerRef, metrics.breadcrumbRowHeight, metrics.headerHeight, navigation, scrollYValue, hasCollapseHeaderToggle, tags]);
305
310
  useEffect(function () {
306
- // only has toggle if requested and has hasBackgroundAlways
311
+ // only has toggle if requested and withoutBackground is unset/falsy
307
312
  // NOTE: prop-types isRequired.if for the expand and collapse
308
313
  // icon descriptions depends on the this.
309
- setHasCollapseButton(hasCollapseHeaderToggle && hasBackgroundAlways);
310
- }, [hasBackgroundAlways, hasCollapseHeaderToggle]);
314
+ setHasCollapseButton(hasCollapseHeaderToggle && !withoutBackground);
315
+ }, [withoutBackground, hasCollapseHeaderToggle]);
311
316
  useEffect(function () {
312
317
  // Determine if space is needed in the breadcrumb for a collapse button
313
318
  setSpaceForCollapseButton(hasCollapseButton && !(navigation || tags) && metrics.headerHeight);
@@ -446,6 +451,8 @@ export var PageHeader = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
446
451
  var handleWidthChange = isBreadcrumbRow && hasBreadcrumbRow ? handlePageActionWidthChange : function () {};
447
452
  return /*#__PURE__*/React.createElement(_Tag, {
448
453
  className: cx("".concat(blockClass, "__page-actions"), _defineProperty({}, "".concat(blockClass, "__page-actions--in-breadcrumb"), inBreadcrumbRow))
454
+ }, /*#__PURE__*/React.createElement("div", {
455
+ className: cx("".concat(blockClass, "__page-actions-content"))
449
456
  }, (_pageActions$content = pageActions.content) !== null && _pageActions$content !== void 0 ? _pageActions$content : /*#__PURE__*/React.createElement(ButtonSetWithOverflow, {
450
457
  classname: "".concat(blockClass, "__button-set-with-overflow"),
451
458
  menuOptionsClass: cx(pageActionsMenuOptionsClass, "".concat(blockClass, "__button-set-menu-options")),
@@ -453,7 +460,7 @@ export var PageHeader = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
453
460
  buttons: pageActions,
454
461
  buttonSetOverflowLabel: pageActionsOverflowLabel,
455
462
  rightAlign: true
456
- }));
463
+ })));
457
464
  }
458
465
  }
459
466
  }); // Return a placeholder if not released and not enabled by feature flag
@@ -474,7 +481,13 @@ var TYPES = {
474
481
  'high-contrast': 'High-Contrast'
475
482
  };
476
483
  var tagTypes = Object.keys(TYPES);
477
- PageHeader.propTypes = {
484
+ export var deprecatedProps = {
485
+ /**
486
+ * **Deprecated** see property `withoutBackground`
487
+ */
488
+ hasBackgroundAlways: deprecateProp(PropTypes.bool, 'Property replaced by `withoutBackground`')
489
+ };
490
+ PageHeader.propTypes = _objectSpread({
478
491
  /**
479
492
  * Specifies the action bar items which are the final items in the row top of the PageHeader.
480
493
  * Each item is specified as an object with the properties of a Carbon Button in icon only form.
@@ -498,9 +511,8 @@ PageHeader.propTypes = {
498
511
  * NOTE: This prop is required if actionBarItems are supplied
499
512
  */
500
513
  actionBarOverflowAriaLabel: PropTypes.string.isRequired.if(function (_ref8) {
501
- var actionBarItems = _ref8.actionBarItems,
502
- actionBarOverflowLabel = _ref8.actionBarOverflowLabel;
503
- return actionBarItems && actionBarItems.length > 0 && !actionBarOverflowLabel;
514
+ var actionBarItems = _ref8.actionBarItems;
515
+ return actionBarItems && actionBarItems.length > 0;
504
516
  }),
505
517
 
506
518
  /**
@@ -535,9 +547,8 @@ PageHeader.propTypes = {
535
547
  * It is used in an overflow menu when there is insufficient space to display all breadcrumbs inline.
536
548
  */
537
549
  breadcrumbOverflowAriaLabel: PropTypes.string.isRequired.if(function (_ref9) {
538
- var breadcrumbs = _ref9.breadcrumbs,
539
- breadcrumbItems = _ref9.breadcrumbItems;
540
- return breadcrumbs && breadcrumbs.length > 0 || breadcrumbItems && breadcrumbItems.length > 0;
550
+ var breadcrumbs = _ref9.breadcrumbs;
551
+ return breadcrumbs && breadcrumbs.length > 0;
541
552
  }),
542
553
 
543
554
  /**
@@ -603,13 +614,13 @@ PageHeader.propTypes = {
603
614
  collapseHeader: PropTypes.bool,
604
615
 
605
616
  /**
606
- * If `hasCollapseHeaderToggle` and `hasBackgroundAlways` are set then assistive text is required
607
- * for both the expend and collapse states of the button component used.
617
+ * If `hasCollapseHeaderToggle` is set and `withoutBackground` is unset/falsy then assistive text is
618
+ * required for both the expend and collapse states of the button component used.
608
619
  */
609
620
  collapseHeaderIconDescription: PropTypes.string.isRequired.if(function (_ref11) {
610
- var hasBackgroundAlways = _ref11.hasBackgroundAlways,
621
+ var withoutBackground = _ref11.withoutBackground,
611
622
  hasCollapseHeaderToggle = _ref11.hasCollapseHeaderToggle;
612
- return hasBackgroundAlways && hasCollapseHeaderToggle;
623
+ return !withoutBackground && hasCollapseHeaderToggle;
613
624
  }),
614
625
 
615
626
  /**
@@ -625,13 +636,13 @@ PageHeader.propTypes = {
625
636
  disableBreadcrumbScroll: PropTypes.bool,
626
637
 
627
638
  /**
628
- * If `hasCollapseHeaderToggle` and `hasBackgroundAlways` are set then assistive text is required
629
- * for both the expend and collapse states of the button component used.
639
+ * If `hasCollapseHeaderToggle` is set and `withoutBackground` is unset/falsy then assistive text is
640
+ * required for both the expend and collapse states of the button component used.
630
641
  */
631
642
  expandHeaderIconDescription: PropTypes.string.isRequired.if(function (_ref12) {
632
- var hasBackgroundAlways = _ref12.hasBackgroundAlways,
643
+ var withoutBackground = _ref12.withoutBackground,
633
644
  hasCollapseHeaderToggle = _ref12.hasCollapseHeaderToggle;
634
- return hasBackgroundAlways && hasCollapseHeaderToggle;
645
+ return !withoutBackground && hasCollapseHeaderToggle;
635
646
  }),
636
647
 
637
648
  /**
@@ -640,12 +651,6 @@ PageHeader.propTypes = {
640
651
  */
641
652
  fullWidthGrid: PropTypes.oneOfType([PropTypes.bool, PropTypes.oneOf(['xl'])]),
642
653
 
643
- /**
644
- * Specifies if the PageHeader should have a background always on and defaults to the preferred `true`.
645
- * When false some parts of the header gain a background if they stick to the top of the PageHeader on scroll.
646
- */
647
- hasBackgroundAlways: PropTypes.bool,
648
-
649
654
  /**
650
655
  * Adds a button as the last element of the bottom row which collapses and expands the header.
651
656
  *
@@ -769,11 +774,16 @@ PageHeader.propTypes = {
769
774
  content: PropTypes.node.isRequired,
770
775
  breadcrumbContent: PropTypes.node,
771
776
  asText: PropTypes.string.isRequired
772
- })])
773
- };
777
+ })]),
778
+
779
+ /**
780
+ * Specifies if the PageHeader should appear without a background color, and defaults to the preferred `false` (a background color is shown).
781
+ * Note that when `true` some parts of the header still gain a background if and when they stick to the top of the PageHeader on scroll.
782
+ */
783
+ withoutBackground: PropTypes.bool
784
+ }, deprecatedProps);
774
785
  PageHeader.defaultProps = {
775
786
  fullWidthGrid: false,
776
- hasBackgroundAlways: true,
777
787
  narrowGrid: false
778
788
  };
779
789
  PageHeader.displayName = componentName;
@@ -30,7 +30,8 @@ ProductiveCard.propTypes = {
30
30
  icon: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
31
31
  onKeyDown: PropTypes.func,
32
32
  onClick: PropTypes.func,
33
- iconDescription: PropTypes.string
33
+ iconDescription: PropTypes.string,
34
+ href: PropTypes.string
34
35
  })),
35
36
 
36
37
  /**
@@ -96,7 +97,7 @@ ProductiveCard.propTypes = {
96
97
  /**
97
98
  * The text that's displayed in the primary button
98
99
  */
99
- primaryButtonText: PropTypes.string,
100
+ primaryButtonText: PropTypes.node,
100
101
 
101
102
  /**
102
103
  * Title that's displayed at the top of the card
@@ -14,10 +14,11 @@ import cx from 'classnames';
14
14
  import { bool, node, string } from 'prop-types';
15
15
  import React, { forwardRef, useContext } from 'react';
16
16
  import { pkg } from '../../settings';
17
- import { blockClass, ToolbarContext } from './Toolbar';
17
+ import { blockClass as toolbarClass, ToolbarContext } from './Toolbar';
18
+ var blockClass = "".concat(toolbarClass, "__button");
18
19
  /** Toolbar buttons are common functions performed as part of a products interface or an open window. */
19
20
 
20
- export var ToolbarButton = /*#__PURE__*/forwardRef(function (_ref, ref) {
21
+ var ToolbarButton = /*#__PURE__*/forwardRef(function (_ref, ref) {
21
22
  var _useContext;
22
23
 
23
24
  var caret = _ref.caret,
@@ -29,12 +30,12 @@ export var ToolbarButton = /*#__PURE__*/forwardRef(function (_ref, ref) {
29
30
  tooltipPosition: ((_useContext = useContext(ToolbarContext)) === null || _useContext === void 0 ? void 0 : _useContext.vertical) && 'right'
30
31
  }, rest, {
31
32
  ref: ref,
32
- className: cx(className, _defineProperty({}, "".concat(blockClass, "__button--caret"), caret)),
33
+ className: cx(className, _defineProperty({}, "".concat(blockClass, "--caret"), caret)),
33
34
  kind: "ghost",
34
35
  size: "md",
35
36
  hasIconOnly: true
36
37
  }), /*#__PURE__*/React.createElement(React.Fragment, null, children, caret && /*#__PURE__*/React.createElement("span", {
37
- className: "".concat(blockClass, "__button__caret")
38
+ className: "".concat(blockClass, "__caret")
38
39
  })));
39
40
  });
40
41
  var componentName = 'ToolbarButton';
@@ -52,4 +53,5 @@ ToolbarButton.propTypes = {
52
53
  ToolbarButton.defaultProps = {
53
54
  caret: false
54
55
  };
55
- ToolbarButton = pkg.checkComponentEnabled(ToolbarButton, componentName);
56
+ ToolbarButton = pkg.checkComponentEnabled(ToolbarButton, componentName);
57
+ export { blockClass, ToolbarButton };
@@ -30,7 +30,7 @@ export var Canary = function Canary(_ref
30
30
  componentName = _ref.componentName,
31
31
  rest = _objectWithoutProperties(_ref, _excluded);
32
32
 
33
- var instructions = "\nimport { pkg } from '@carbon/ibm-cloud-cognitive';\n// NOTE: must happen before component is first used\npkg.component.".concat(componentName, " = true;\n");
33
+ var instructions = "\nimport { pkg } from '@carbon/ibm-products';\n// NOTE: must happen before component is first used\npkg.component.".concat(componentName, " = true;\n");
34
34
  return /*#__PURE__*/React.createElement("div", _extends({}, rest, {
35
35
  className: cx(blockClass, className)
36
36
  }), /*#__PURE__*/React.createElement("h2", null, "This component ", /*#__PURE__*/React.createElement("strong", null, componentName), " is not ready yet."), /*#__PURE__*/React.createElement("p", null, "To enable it, initialize package flags before the component is first used."), /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement("p", null, "e.g. in main.js"), /*#__PURE__*/React.createElement(CodeSnippet, {
@@ -14,7 +14,6 @@ export { CreateSidePanel } from './CreateSidePanel';
14
14
  export { CreateTearsheet, CreateTearsheetStep, CreateTearsheetDivider } from './CreateTearsheet';
15
15
  export { CreateTearsheetNarrow } from './CreateTearsheetNarrow';
16
16
  export { EmptyState, ErrorEmptyState, NoDataEmptyState, NoTagsEmptyState, NotFoundEmptyState, NotificationsEmptyState, UnauthorizedEmptyState } from './EmptyStates';
17
- export { ExampleComponent } from './ExampleComponent';
18
17
  export { ExportModal } from './ExportModal';
19
18
  export { ExpressiveCard } from './ExpressiveCard';
20
19
  export { HTTPError403, HTTPError404, HTTPErrorOther } from './HTTPErrors';
@@ -52,7 +52,6 @@ var defaults = {
52
52
  UnauthorizedEmptyState: true,
53
53
  UserProfileImage: true,
54
54
  // other public components not yet reviewed and released:
55
- ExampleComponent: false,
56
55
  LoadingBar: false,
57
56
  ModifiedTabs: false,
58
57
  Toolbar: false,
@@ -4,6 +4,8 @@
4
4
  // This source code is licensed under the Apache-2.0 license found in the
5
5
  // LICENSE file in the root directory of this source tree.
6
6
  //
7
+ import React from 'react';
8
+ import PropTypes from 'prop-types';
7
9
  import { sanitize } from '@storybook/csf';
8
10
  import pkg from '../package-settings';
9
11
  import { getPathForComponent } from '../../../../../core/story-structure';
@@ -50,4 +52,24 @@ export var prepareStory = function prepareStory(template, options) {
50
52
  (_result$parameters2$c = (_result$parameters2 = result.parameters).ccsSettings) !== null && _result$parameters2$c !== void 0 ? _result$parameters2$c : _result$parameters2.ccsSettings = {};
51
53
  result.parameters.ccsSettings.sequence = sequence++;
52
54
  return result;
55
+ };
56
+ /**
57
+ * A helper component that returns a codesandbox link to an example codesandbox for the component.
58
+ * The link URL is based on the example directory name and the standard codesandbox URL for package examples.
59
+ */
60
+
61
+ export var CodesandboxLink = function CodesandboxLink(_ref) {
62
+ var exampleDirectory = _ref.exampleDirectory;
63
+ return /*#__PURE__*/React.createElement("a", {
64
+ href: "https://codesandbox.io/s/github/carbon-design-system/ibm-cloud-cognitive/tree/main/examples/carbon-for-ibm-products/".concat(exampleDirectory)
65
+ }, /*#__PURE__*/React.createElement("img", {
66
+ alt: "Edit on CodeSandbox",
67
+ src: "https://codesandbox.io/static/img/play-codesandbox.svg"
68
+ }));
69
+ };
70
+ CodesandboxLink.propTypes = {
71
+ /**
72
+ * directory withing examples codesandbox will be found
73
+ */
74
+ exampleDirectory: PropTypes.string
53
75
  };
@@ -104,7 +104,8 @@ var Card = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
104
104
  Icon = _ref3.icon,
105
105
  onClick = _ref3.onClick,
106
106
  iconDescription = _ref3.iconDescription,
107
- onKeyDown = _ref3.onKeyDown;
107
+ onKeyDown = _ref3.onKeyDown,
108
+ href = _ref3.href;
108
109
 
109
110
  if (productive) {
110
111
  return /*#__PURE__*/_react.default.createElement(_carbonComponentsReact.Button, {
@@ -114,10 +115,22 @@ var Card = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
114
115
  onClick: onClick,
115
116
  size: actionsPlacement === 'top' ? 'sm' : 'field',
116
117
  iconDescription: iconDescription,
117
- kind: "ghost"
118
+ kind: "ghost",
119
+ href: href
118
120
  });
119
121
  }
120
122
 
123
+ if (href) {
124
+ return /*#__PURE__*/_react.default.createElement("a", {
125
+ key: id,
126
+ className: "".concat(blockClass, "__icon"),
127
+ href: href,
128
+ onClick: onClick
129
+ }, /*#__PURE__*/_react.default.createElement(Icon, {
130
+ "aria-label": iconDescription
131
+ }));
132
+ }
133
+
121
134
  return /*#__PURE__*/_react.default.createElement("div", {
122
135
  key: id,
123
136
  className: "".concat(blockClass, "__icon"),
@@ -213,7 +226,8 @@ Card.propTypes = {
213
226
  icon: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object]),
214
227
  onKeyDown: _propTypes.default.func,
215
228
  onClick: _propTypes.default.func,
216
- iconDescription: _propTypes.default.string
229
+ iconDescription: _propTypes.default.string,
230
+ href: _propTypes.default.string
217
231
  })),
218
232
  actionsPlacement: _propTypes.default.oneOf(['top', 'bottom']),
219
233
  children: _propTypes.default.node,
@@ -237,7 +251,7 @@ Card.propTypes = {
237
251
  primaryButtonHref: _propTypes.default.string,
238
252
  primaryButtonIcon: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object]),
239
253
  primaryButtonKind: _propTypes.default.oneOf(['primary', 'ghost']),
240
- primaryButtonText: _propTypes.default.string,
254
+ primaryButtonText: _propTypes.default.node,
241
255
  productive: _propTypes.default.bool,
242
256
  secondaryButtonHref: _propTypes.default.string,
243
257
  secondaryButtonIcon: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object]),
@@ -45,14 +45,15 @@ exports.ExpressiveCard = ExpressiveCard;
45
45
  exports.ExpressiveCard = ExpressiveCard = _settings.pkg.checkComponentEnabled(ExpressiveCard, componentName);
46
46
  ExpressiveCard.propTypes = {
47
47
  /**
48
- * Icons that are displayed on card. Refer to design documentation for implementation guidelines
48
+ * Icons that are displayed on card. Refer to design documentation for implementation guidelines. Note- href will supersede onClick
49
49
  */
50
50
  actionIcons: _propTypes.default.arrayOf(_propTypes.default.shape({
51
51
  id: _propTypes.default.string,
52
52
  icon: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object]),
53
53
  onKeyDown: _propTypes.default.func,
54
54
  onClick: _propTypes.default.func,
55
- iconDescription: _propTypes.default.string
55
+ iconDescription: _propTypes.default.string,
56
+ href: _propTypes.default.string
56
57
  })),
57
58
 
58
59
  /**