@useblu/ocean-react 1.128.0 → 1.130.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.js CHANGED
@@ -505,22 +505,23 @@ var Header = function (_a) {
505
505
  };
506
506
 
507
507
  var ActionButton = function (_a) {
508
- var actionLabel = _a.actionLabel, actionCount = _a.actionCount, actionClick = _a.actionClick;
508
+ var actionLabel = _a.actionLabel, actionCount = _a.actionCount, actionClick = _a.actionClick, actionBadgeColor = _a.actionBadgeColor;
509
+ var badgeColor = actionBadgeColor !== null && actionBadgeColor !== void 0 ? actionBadgeColor : (actionCount === 0 ? 'neutral' : 'alert');
509
510
  return (e.createElement(e.Fragment, null,
510
511
  e.createElement("hr", { className: "ods-divider" }),
511
512
  e.createElement("button", { onClick: actionClick, type: "button", className: "ods-card-group__action", "aria-label": actionLabel },
512
513
  e.createElement("span", { className: "ods-card-group__action--label" }, actionLabel),
513
514
  e.createElement("div", { className: "ods-card-group__action--right" },
514
- actionCount !== undefined && (e.createElement(Badge, { variation: "medium", color: actionCount === 0 ? 'neutral' : 'alert', count: actionCount })),
515
+ actionCount !== undefined && (e.createElement(Badge, { variation: "medium", color: badgeColor, count: actionCount })),
515
516
  e.createElement(re, { size: 20 })))));
516
517
  };
517
518
 
518
519
  var CardGroup = e.forwardRef(function (_a, ref) {
519
- var title = _a.title, subtitle = _a.subtitle, actionLabel = _a.actionLabel, actionCount = _a.actionCount, actionClick = _a.actionClick, count = _a.count, tag = _a.tag, children = _a.children, _b = _a.variant, variant = _b === void 0 ? 'minimal' : _b, rest = __rest$1(_a, ["title", "subtitle", "actionLabel", "actionCount", "actionClick", "count", "tag", "children", "variant"]);
520
+ var title = _a.title, subtitle = _a.subtitle, actionLabel = _a.actionLabel, actionCount = _a.actionCount, actionClick = _a.actionClick, actionBadgeColor = _a.actionBadgeColor, count = _a.count, tag = _a.tag, children = _a.children, _b = _a.variant, variant = _b === void 0 ? 'minimal' : _b, rest = __rest$1(_a, ["title", "subtitle", "actionLabel", "actionCount", "actionClick", "actionBadgeColor", "count", "tag", "children", "variant"]);
520
521
  return (e.createElement("div", __assign$1({ ref: ref }, rest, { "data-testid": "card-group", className: classNames('ods-card-group', "ods-card-group--".concat(variant)) }),
521
522
  (title || subtitle) && (e.createElement(Header, { title: title, subtitle: subtitle, count: count, tag: tag })),
522
523
  children && variant !== 'header' && e.createElement("div", null, children),
523
- actionLabel && variant !== 'header' && (e.createElement(ActionButton, { actionLabel: actionLabel, actionCount: actionCount, actionClick: actionClick }))));
524
+ actionLabel && variant !== 'header' && (e.createElement(ActionButton, { actionLabel: actionLabel, actionCount: actionCount, actionClick: actionClick, actionBadgeColor: actionBadgeColor }))));
524
525
  });
525
526
  CardGroup.displayName = 'CardGroup';
526
527
 
@@ -47810,26 +47811,40 @@ ListExpandable.displayName = 'ListExpandable';
47810
47811
  var isListItemString = function (item) {
47811
47812
  return typeof item === 'object' && item !== null && 'description' in item;
47812
47813
  };
47814
+ var primaryButtonVariants = {
47815
+ default: 'primary',
47816
+ warning: 'primaryWarning',
47817
+ negative: 'primaryCritical',
47818
+ };
47819
+ var secondaryButtonVariants = {
47820
+ default: 'tertiary',
47821
+ warning: 'tertiaryWarning',
47822
+ negative: 'tertiaryCritical',
47823
+ };
47813
47824
  var InternalContextualHero = e.forwardRef(function (_a, ref) {
47814
- var title = _a.title, description = _a.description, image = _a.image, listItems = _a.listItems, actions = _a.actions, className = _a.className;
47825
+ var _b;
47826
+ var title = _a.title, description = _a.description, image = _a.image, listItems = _a.listItems, actions = _a.actions, className = _a.className, _c = _a.imagePosition, imagePosition = _c === void 0 ? 'top' : _c, _d = _a.type, type = _d === void 0 ? 'default' : _d;
47815
47827
  var renderImage = function () {
47816
47828
  if (typeof image === 'string') {
47817
47829
  return e.createElement("img", { src: image, alt: title });
47818
47830
  }
47819
47831
  return image;
47820
47832
  };
47821
- return (e.createElement("div", { "data-testid": "internal-contextual-hero", className: classNames('ods-internal-contextual-hero', className), ref: ref },
47833
+ return (e.createElement("div", { "data-testid": "internal-contextual-hero", className: classNames('ods-internal-contextual-hero', className, (_b = {},
47834
+ _b["ods-internal-contextual-hero--".concat(type)] = type,
47835
+ _b["ods-internal-contextual-hero--".concat(imagePosition)] = imagePosition,
47836
+ _b)), ref: ref },
47822
47837
  e.createElement("div", { className: 'ods-internal-contextual-hero__body' },
47823
47838
  e.createElement("div", { className: 'ods-internal-contextual-hero__content' },
47824
47839
  e.createElement("div", { className: 'ods-internal-contextual-hero__header' },
47825
47840
  e.createElement(Typography, { variant: "heading3" }, title),
47826
47841
  e.createElement(Typography, { variant: "description" }, description)),
47827
47842
  actions && actions.length > 0 && (e.createElement("div", { className: 'ods-internal-contextual-hero__actions' },
47828
- e.createElement(Button$1, { variant: 'primary', size: 'sm', onClick: actions[0].onClick }, actions[0].label),
47829
- actions[1] && (e.createElement(Button$1, { variant: 'tertiary', size: 'sm', onClick: actions[1].onClick }, actions[1].label))))),
47843
+ e.createElement(Button$1, { variant: primaryButtonVariants[type], size: 'sm', onClick: actions[0].onClick }, actions[0].label),
47844
+ actions[1] && (e.createElement(Button$1, { variant: secondaryButtonVariants[type], size: 'sm', onClick: actions[1].onClick }, actions[1].label))))),
47830
47845
  e.createElement("div", { className: 'ods-internal-contextual-hero__list' }, listItems === null || listItems === void 0 ? void 0 : listItems.map(function (item) {
47831
47846
  return isListItemString(item) ? (e.createElement("div", { key: item.description, className: 'ods-internal-contextual-hero__list-item' },
47832
- item.icon && e.createElement("div", null, item.icon),
47847
+ item.icon && e.createElement("div", { className: "ods-internal-contextual-hero__list-item-icon" }, item.icon),
47833
47848
  e.createElement(Typography, { variant: "description" }, item.description))) : (item);
47834
47849
  }))),
47835
47850
  image && (e.createElement("div", { className: 'ods-internal-contextual-hero__image' }, renderImage()))));