@useblu/ocean-react 1.135.0 → 1.136.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
@@ -5478,9 +5478,17 @@ var SkeletonBar = function (_a) {
5478
5478
  return (e.createElement("div", __assign$1({ className: "ods-skeleton-bar", style: { width: width, height: height } }, props)));
5479
5479
  };
5480
5480
 
5481
+ var CornerTag = e.forwardRef(function (_a, ref) {
5482
+ var label = _a.label, _b = _a.color, color = _b === void 0 ? 'primaryDown' : _b, className = _a.className;
5483
+ if (!label)
5484
+ return null;
5485
+ return (e.createElement("span", { ref: ref, className: classNames('ods-corner-tag', "ods-corner-tag--".concat(color), className), "aria-label": label }, label));
5486
+ });
5487
+ CornerTag.displayName = 'CornerTag';
5488
+
5481
5489
  var ListContainer = e.forwardRef(function (_a, ref) {
5482
5490
  var _b, _c;
5483
- var _d = _a.type, type = _d === void 0 ? 'card' : _d, _e = _a.showDivider, showDivider = _e === void 0 ? false : _e, _f = _a.hasError, hasError = _f === void 0 ? false : _f, highlight = _a.highlight, children = _a.children, className = _a.className, rest = __rest$1(_a, ["type", "showDivider", "hasError", "highlight", "children", "className"]);
5491
+ var _d = _a.type, type = _d === void 0 ? 'card' : _d, _e = _a.showDivider, showDivider = _e === void 0 ? false : _e, _f = _a.hasError, hasError = _f === void 0 ? false : _f, highlight = _a.highlight, cornerTag = _a.cornerTag, children = _a.children, className = _a.className, rest = __rest$1(_a, ["type", "showDivider", "hasError", "highlight", "cornerTag", "children", "className"]);
5484
5492
  return (e.createElement("div", { className: "ods-list-container" },
5485
5493
  e.createElement("div", __assign$1({ ref: ref, className: classNames('ods-list-container__content', className, {
5486
5494
  'ods-list-container__content--card': type === 'card',
@@ -5488,7 +5496,8 @@ var ListContainer = e.forwardRef(function (_a, ref) {
5488
5496
  'ods-list-container__content--text': type === 'text',
5489
5497
  }) }, rest),
5490
5498
  children,
5491
- showDivider && type === 'text' && (e.createElement("div", { className: "ods-list-container__content__divider" }))),
5499
+ showDivider && type === 'text' && (e.createElement("div", { className: "ods-list-container__content__divider" })),
5500
+ type === 'card' && (cornerTag === null || cornerTag === void 0 ? void 0 : cornerTag.label) && e.createElement(CornerTag, __assign$1({}, cornerTag))),
5492
5501
  (highlight === null || highlight === void 0 ? void 0 : highlight.caption) && (e.createElement("div", { className: "ods-list-container__highlight", "data-testid": "list-container-highlight", style: { backgroundColor: (_b = highlight.backgroundColor) !== null && _b !== void 0 ? _b : '#F3F5FE' } },
5493
5502
  e.createElement("p", { className: "ods-typography ods-typography__caption", style: { color: (_c = highlight.captionColor) !== null && _c !== void 0 ? _c : '#67697A' } }, highlight.caption)))));
5494
5503
  });
@@ -5496,7 +5505,7 @@ ListContainer.displayName = 'ListContainer';
5496
5505
 
5497
5506
  var ListReadOnly = e.forwardRef(function (_a, ref) {
5498
5507
  var _b;
5499
- var title = _a.title, description = _a.description, strikethroughDescription = _a.strikethroughDescription, caption = _a.caption, icon = _a.icon, indicator = _a.indicator, _c = _a.type, type = _c === void 0 ? 'card' : _c, _d = _a.status, status = _d === void 0 ? 'default' : _d, _e = _a.inverted, inverted = _e === void 0 ? false : _e, _f = _a.disabled, disabled = _f === void 0 ? false : _f, _g = _a.loading, loading = _g === void 0 ? false : _g, className = _a.className, _h = _a.showDivider, showDivider = _h === void 0 ? false : _h, highlight = _a.highlight, rest = __rest$1(_a, ["title", "description", "strikethroughDescription", "caption", "icon", "indicator", "type", "status", "inverted", "disabled", "loading", "className", "showDivider", "highlight"]);
5508
+ var title = _a.title, description = _a.description, strikethroughDescription = _a.strikethroughDescription, caption = _a.caption, icon = _a.icon, indicator = _a.indicator, _c = _a.type, type = _c === void 0 ? 'card' : _c, _d = _a.status, status = _d === void 0 ? 'default' : _d, _e = _a.inverted, inverted = _e === void 0 ? false : _e, _f = _a.disabled, disabled = _f === void 0 ? false : _f, _g = _a.loading, loading = _g === void 0 ? false : _g, className = _a.className, _h = _a.showDivider, showDivider = _h === void 0 ? false : _h, highlight = _a.highlight, cornerTag = _a.cornerTag, rest = __rest$1(_a, ["title", "description", "strikethroughDescription", "caption", "icon", "indicator", "type", "status", "inverted", "disabled", "loading", "className", "showDivider", "highlight", "cornerTag"]);
5500
5509
  var renderLoadingContent = function () { return (e.createElement("div", { className: "ods-list-readonly__skeleton" },
5501
5510
  e.createElement(SkeletonBar, { width: "40%", height: "16px" }),
5502
5511
  e.createElement(SkeletonBar, { width: "100%", height: "16px" }))); };
@@ -5513,14 +5522,15 @@ var ListReadOnly = e.forwardRef(function (_a, ref) {
5513
5522
  },
5514
5523
  _b["ods-list-readonly--".concat(type)] = type,
5515
5524
  _b));
5516
- return (e.createElement(ListContainer, { type: type, showDivider: showDivider, highlight: highlight },
5525
+ return (e.createElement(ListContainer, { type: type, showDivider: showDivider, highlight: highlight, cornerTag: cornerTag },
5517
5526
  e.createElement("div", __assign$1({ ref: ref, "data-testid": "card-list-readonly", className: cardClassName }, rest), loading ? renderLoadingContent() : renderContent())));
5518
5527
  });
5519
5528
  ListReadOnly.displayName = 'ListReadOnly';
5520
5529
 
5521
- var ListSelectable = e.forwardRef(function (_a, ref) {
5522
- var _b;
5523
- var title = _a.title, description = _a.description, caption = _a.caption, strikethroughDescription = _a.strikethroughDescription, inverted = _a.inverted, loading = _a.loading, disabled = _a.disabled, checkbox = _a.checkbox, radio = _a.radio, className = _a.className, showDivider = _a.showDivider, indicator = _a.indicator, isSelectableDisabled = _a.isSelectableDisabled, highlight = _a.highlight, _c = _a.status, status = _c === void 0 ? 'default' : _c, _d = _a.type, type = _d === void 0 ? 'card' : _d, _e = _a.platform, platform = _e === void 0 ? 'web' : _e, rest = __rest$1(_a, ["title", "description", "caption", "strikethroughDescription", "inverted", "loading", "disabled", "checkbox", "radio", "className", "showDivider", "indicator", "isSelectableDisabled", "highlight", "status", "type", "platform"]);
5530
+ var ListSelectable = e.forwardRef(function (props, ref) {
5531
+ var _a;
5532
+ var _b = props, title = _b.title, description = _b.description, caption = _b.caption, strikethroughDescription = _b.strikethroughDescription, inverted = _b.inverted, loading = _b.loading, disabled = _b.disabled, checkbox = _b.checkbox, radio = _b.radio, className = _b.className, showDivider = _b.showDivider, indicator = _b.indicator, isSelectableDisabled = _b.isSelectableDisabled, highlight = _b.highlight, _c = _b.status, status = _c === void 0 ? 'default' : _c, _d = _b.type, type = _d === void 0 ? 'card' : _d, _e = _b.platform, platform = _e === void 0 ? 'web' : _e, cornerTag = _b.cornerTag, rest = __rest$1(_b, ["title", "description", "caption", "strikethroughDescription", "inverted", "loading", "disabled", "checkbox", "radio", "className", "showDivider", "indicator", "isSelectableDisabled", "highlight", "status", "type", "platform", "cornerTag"]);
5533
+ var cardCornerTag = type === 'card' ? cornerTag : undefined;
5524
5534
  var hasError = e.useMemo(function () { return (radio === null || radio === void 0 ? void 0 : radio.error) || (checkbox === null || checkbox === void 0 ? void 0 : checkbox.error); }, [radio === null || radio === void 0 ? void 0 : radio.error, checkbox === null || checkbox === void 0 ? void 0 : checkbox.error]);
5525
5535
  var isInputDisabled = e.useMemo(function () { return (radio === null || radio === void 0 ? void 0 : radio.disabled) || (checkbox === null || checkbox === void 0 ? void 0 : checkbox.disabled) || disabled; }, [radio === null || radio === void 0 ? void 0 : radio.disabled, checkbox === null || checkbox === void 0 ? void 0 : checkbox.disabled, disabled]);
5526
5536
  var internalList = e.useMemo(function () {
@@ -5547,14 +5557,14 @@ var ListSelectable = e.forwardRef(function (_a, ref) {
5547
5557
  e.createElement(SkeletonBar, { width: "100%", height: "16px" })));
5548
5558
  }
5549
5559
  if (isSelectableDisabled) {
5550
- return (e.createElement(ListReadOnly, __assign$1({ title: title, description: description, status: status, type: type, inverted: inverted, disabled: disabled, loading: loading, className: className, showDivider: showDivider, indicator: indicator, caption: caption, strikethroughDescription: strikethroughDescription, highlight: highlight }, rest, { ref: ref })));
5560
+ return (e.createElement(ListReadOnly, __assign$1({ title: title, description: description, status: status, type: type, inverted: inverted, disabled: disabled, loading: loading, className: className, showDivider: showDivider, indicator: indicator, caption: caption, strikethroughDescription: strikethroughDescription, highlight: highlight, cornerTag: cardCornerTag }, rest, { ref: ref })));
5551
5561
  }
5552
- return (e.createElement(ListContainer, { type: type, showDivider: showDivider, hasError: hasError, highlight: highlight },
5553
- e.createElement("div", __assign$1({ className: classNames('ods-list-selectable', className, (_b = {
5562
+ return (e.createElement(ListContainer, { type: type, showDivider: showDivider, hasError: hasError, highlight: highlight, cornerTag: cardCornerTag },
5563
+ e.createElement("div", __assign$1({ className: classNames('ods-list-selectable', className, (_a = {
5554
5564
  'ods-list-selectable--disabled': isInputDisabled
5555
5565
  },
5556
- _b["ods-list-selectable--".concat(platform)] = platform,
5557
- _b)), ref: ref }, rest),
5566
+ _a["ods-list-selectable--".concat(platform)] = platform,
5567
+ _a)), ref: ref }, rest),
5558
5568
  checkbox && e.createElement(Checkbox, __assign$1({}, checkbox, { label: internalList })),
5559
5569
  radio && e.createElement(Radio, __assign$1({}, radio, { label: internalList })))));
5560
5570
  });