@useblu/ocean-react 1.133.0 → 1.134.1

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,49 @@ 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 ListSelectable = e.forwardRef(function (_a, ref) {
5481
+ var ListContainer = e.forwardRef(function (_a, ref) {
5482
5482
  var _b, _c;
5483
- 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, _d = _a.status, status = _d === void 0 ? 'default' : _d, _e = _a.type, type = _e === void 0 ? 'card' : _e, _f = _a.platform, platform = _f === void 0 ? 'web' : _f, rest = __rest$1(_a, ["title", "description", "caption", "strikethroughDescription", "inverted", "loading", "disabled", "checkbox", "radio", "className", "showDivider", "indicator", "status", "type", "platform"]);
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"]);
5484
+ return (e.createElement("div", { className: "ods-list-container" },
5485
+ e.createElement("div", __assign$1({ ref: ref, className: classNames('ods-list-container__content', className, {
5486
+ 'ods-list-container__content--card': type === 'card',
5487
+ 'ods-list-container__content--card--error': type === 'card' && hasError,
5488
+ 'ods-list-container__content--text': type === 'text',
5489
+ }) }, rest),
5490
+ children,
5491
+ showDivider && type === 'text' && (e.createElement("div", { className: "ods-list-container__content__divider" }))),
5492
+ (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
+ e.createElement("p", { className: "ods-typography ods-typography__caption", style: { color: (_c = highlight.captionColor) !== null && _c !== void 0 ? _c : '#67697A' } }, highlight.caption)))));
5494
+ });
5495
+ ListContainer.displayName = 'ListContainer';
5496
+
5497
+ var ListReadOnly = e.forwardRef(function (_a, ref) {
5498
+ 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"]);
5500
+ var renderLoadingContent = function () { return (e.createElement("div", { className: "ods-list-readonly__skeleton" },
5501
+ e.createElement(SkeletonBar, { width: "40%", height: "16px" }),
5502
+ e.createElement(SkeletonBar, { width: "100%", height: "16px" }))); };
5503
+ var renderContent = function () { return (e.createElement(e.Fragment, null,
5504
+ icon && (e.createElement("div", { className: classNames('ods-list-readonly__icon', {
5505
+ 'ods-list-readonly__icon--inactive': status === 'inactive',
5506
+ }) }, icon)),
5507
+ e.createElement(ContentList, { title: title, description: description, strikethroughDescription: strikethroughDescription, caption: caption, inverted: inverted, type: status }),
5508
+ indicator && (e.createElement("div", { className: "ods-list-readonly__trailing" },
5509
+ e.createElement("div", { className: "ods-list-readonly__indicator" }, indicator))))); };
5510
+ var cardClassName = classNames('ods-list-readonly', className, (_b = {
5511
+ 'ods-list-readonly--loading': loading,
5512
+ 'ods-list-readonly--disabled': disabled
5513
+ },
5514
+ _b["ods-list-readonly--".concat(type)] = type,
5515
+ _b));
5516
+ return (e.createElement(ListContainer, { type: type, showDivider: showDivider, highlight: highlight },
5517
+ e.createElement("div", __assign$1({ ref: ref, "data-testid": "card-list-readonly", className: cardClassName }, rest), loading ? renderLoadingContent() : renderContent())));
5518
+ });
5519
+ ListReadOnly.displayName = 'ListReadOnly';
5520
+
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"]);
5484
5524
  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]);
5485
5525
  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]);
5486
5526
  var internalList = e.useMemo(function () {
@@ -5506,18 +5546,17 @@ var ListSelectable = e.forwardRef(function (_a, ref) {
5506
5546
  e.createElement(SkeletonBar, { width: "40%", height: "16px" }),
5507
5547
  e.createElement(SkeletonBar, { width: "100%", height: "16px" })));
5508
5548
  }
5509
- return (e.createElement("div", { className: classNames('ods-list-selectable__root', (_b = {},
5510
- _b["ods-list-selectable__root--".concat(type)] = type,
5511
- _b["ods-list-selectable__root--".concat(type, "--error")] = hasError,
5512
- _b)) },
5513
- e.createElement("div", __assign$1({ className: classNames('ods-list-selectable', className, (_c = {
5549
+ 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 })));
5551
+ }
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 = {
5514
5554
  'ods-list-selectable--disabled': isInputDisabled
5515
5555
  },
5516
- _c["ods-list-selectable--".concat(platform)] = platform,
5517
- _c)), ref: ref }, rest),
5556
+ _b["ods-list-selectable--".concat(platform)] = platform,
5557
+ _b)), ref: ref }, rest),
5518
5558
  checkbox && e.createElement(Checkbox, __assign$1({}, checkbox, { label: internalList })),
5519
- radio && e.createElement(Radio, __assign$1({}, radio, { label: internalList }))),
5520
- showDivider && type === 'text' && (e.createElement("div", { className: "ods-list-selectable__root--text--divider" }))));
5559
+ radio && e.createElement(Radio, __assign$1({}, radio, { label: internalList })))));
5521
5560
  });
5522
5561
  ListSelectable.displayName = 'ListSelectable';
5523
5562
 
@@ -47806,7 +47845,7 @@ var AmountDetails = function (_a) {
47806
47845
 
47807
47846
  var ListAction = e.forwardRef(function (_a, ref) {
47808
47847
  var _b;
47809
- var title = _a.title, description = _a.description, strikethroughDescription = _a.strikethroughDescription, caption = _a.caption, _c = _a.inverted, inverted = _c === void 0 ? false : _c, _d = _a.type, type = _d === void 0 ? 'card' : _d, _e = _a.status, status = _e === void 0 ? 'default' : _e, _f = _a.disabled, disabled = _f === void 0 ? false : _f, _g = _a.loading, loading = _g === void 0 ? false : _g, icon = _a.icon, indicator = _a.indicator, _h = _a.actionType, actionType = _h === void 0 ? 'chevron' : _h, menuActions = _a.menuActions, _j = _a.menuPosition, menuPosition = _j === void 0 ? 'bottom-right' : _j, onClick = _a.onClick, className = _a.className, _k = _a.showDivider, showDivider = _k === void 0 ? false : _k, amountDetails = _a.amountDetails, position = _a.position, rest = __rest$1(_a, ["title", "description", "strikethroughDescription", "caption", "inverted", "type", "status", "disabled", "loading", "icon", "indicator", "actionType", "menuActions", "menuPosition", "onClick", "className", "showDivider", "amountDetails", "position"]);
47848
+ var title = _a.title, description = _a.description, strikethroughDescription = _a.strikethroughDescription, caption = _a.caption, _c = _a.inverted, inverted = _c === void 0 ? false : _c, _d = _a.type, type = _d === void 0 ? 'card' : _d, _e = _a.status, status = _e === void 0 ? 'default' : _e, _f = _a.disabled, disabled = _f === void 0 ? false : _f, _g = _a.loading, loading = _g === void 0 ? false : _g, icon = _a.icon, indicator = _a.indicator, _h = _a.actionType, actionType = _h === void 0 ? 'chevron' : _h, menuActions = _a.menuActions, _j = _a.menuPosition, menuPosition = _j === void 0 ? 'bottom-right' : _j, onClick = _a.onClick, className = _a.className, _k = _a.showDivider, showDivider = _k === void 0 ? false : _k, amountDetails = _a.amountDetails, position = _a.position, highlight = _a.highlight, rest = __rest$1(_a, ["title", "description", "strikethroughDescription", "caption", "inverted", "type", "status", "disabled", "loading", "icon", "indicator", "actionType", "menuActions", "menuPosition", "onClick", "className", "showDivider", "amountDetails", "position", "highlight"]);
47810
47849
  var _l = e.useState(false), isSwipeOpen = _l[0], setIsSwipeOpen = _l[1];
47811
47850
  var _m = e.useState(0), menuWidth = _m[0], setMenuWidth = _m[1];
47812
47851
  var handleSwipeOpenChange = function (isOpen, width) {
@@ -47860,40 +47899,14 @@ var ListAction = e.forwardRef(function (_a, ref) {
47860
47899
  },
47861
47900
  _b["ods-list-action--".concat(type)] = type,
47862
47901
  _b));
47863
- return (e.createElement("div", { className: "ods-list-action__container" },
47864
- e.createElement("button", __assign$1({ ref: ref, type: "button", "data-testid": "list-action", className: buttonClassName, onClick: loading ? undefined : onClick, disabled: disabled || loading }, rest), loading ? renderLoadingContent() : renderContent()),
47865
- showDivider && type === 'text' && (e.createElement("div", { className: "ods-list-action__divider" }))));
47902
+ return (e.createElement(ListContainer, { type: type, showDivider: showDivider, highlight: highlight },
47903
+ e.createElement("button", __assign$1({ ref: ref, type: "button", "data-testid": "list-action", className: buttonClassName, onClick: loading ? undefined : onClick, disabled: disabled || loading }, rest), loading ? renderLoadingContent() : renderContent())));
47866
47904
  });
47867
47905
  ListAction.displayName = 'ListAction';
47868
47906
 
47869
- var ListReadOnly = e.forwardRef(function (_a, ref) {
47870
- var _b;
47871
- 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, rest = __rest$1(_a, ["title", "description", "strikethroughDescription", "caption", "icon", "indicator", "type", "status", "inverted", "disabled", "loading", "className", "showDivider"]);
47872
- var renderLoadingContent = function () { return (e.createElement("div", { className: 'ods-list-readonly__skeleton' },
47873
- e.createElement(SkeletonBar, { width: '40%', height: '16px' }),
47874
- e.createElement(SkeletonBar, { width: '100%', height: '16px' }))); };
47875
- var renderContent = function () { return (e.createElement(e.Fragment, null,
47876
- icon && (e.createElement("div", { className: classNames('ods-list-readonly__icon', {
47877
- 'ods-list-readonly__icon--inactive': status === 'inactive',
47878
- }) }, icon)),
47879
- e.createElement(ContentList, { title: title, description: description, strikethroughDescription: strikethroughDescription, caption: caption, inverted: inverted, type: status }),
47880
- indicator && (e.createElement("div", { className: 'ods-list-readonly__trailing' },
47881
- e.createElement("div", { className: 'ods-list-readonly__indicator' }, indicator))))); };
47882
- var cardClassName = classNames('ods-list-readonly', className, (_b = {
47883
- 'ods-list-readonly--loading': loading,
47884
- 'ods-list-readonly--disabled': disabled
47885
- },
47886
- _b["ods-list-readonly--".concat(type)] = type,
47887
- _b));
47888
- return (e.createElement("div", { className: 'ods-list-readonly__container' },
47889
- e.createElement("div", __assign$1({ ref: ref, "data-testid": 'card-list-readonly', className: cardClassName }, rest), loading ? renderLoadingContent() : renderContent()),
47890
- showDivider && type === 'text' && (e.createElement("div", { className: 'ods-list-readonly__divider' }))));
47891
- });
47892
- ListReadOnly.displayName = 'ListReadOnly';
47893
-
47894
47907
  var ListExpandable = e.forwardRef(function (_a, ref) {
47895
47908
  var _b;
47896
- var title = _a.title, description = _a.description, strikethroughDescription = _a.strikethroughDescription, caption = _a.caption, _c = _a.inverted, inverted = _c === void 0 ? false : _c, _d = _a.type, type = _d === void 0 ? 'card' : _d, _e = _a.status, status = _e === void 0 ? 'default' : _e, _f = _a.loading, loading = _f === void 0 ? false : _f, icon = _a.icon, indicator = _a.indicator, controlledExpanded = _a.expanded, _g = _a.defaultExpanded, defaultExpanded = _g === void 0 ? false : _g, onToggle = _a.onToggle, children = _a.children, className = _a.className, _h = _a.disabled, disabled = _h === void 0 ? false : _h, _j = _a.showDivider, showDivider = _j === void 0 ? false : _j, rest = __rest$1(_a, ["title", "description", "strikethroughDescription", "caption", "inverted", "type", "status", "loading", "icon", "indicator", "expanded", "defaultExpanded", "onToggle", "children", "className", "disabled", "showDivider"]);
47909
+ var title = _a.title, description = _a.description, strikethroughDescription = _a.strikethroughDescription, caption = _a.caption, _c = _a.inverted, inverted = _c === void 0 ? false : _c, _d = _a.type, type = _d === void 0 ? 'card' : _d, _e = _a.status, status = _e === void 0 ? 'default' : _e, _f = _a.loading, loading = _f === void 0 ? false : _f, icon = _a.icon, indicator = _a.indicator, controlledExpanded = _a.expanded, _g = _a.defaultExpanded, defaultExpanded = _g === void 0 ? false : _g, onToggle = _a.onToggle, children = _a.children, className = _a.className, _h = _a.disabled, disabled = _h === void 0 ? false : _h, _j = _a.showDivider, showDivider = _j === void 0 ? false : _j, highlight = _a.highlight, rest = __rest$1(_a, ["title", "description", "strikethroughDescription", "caption", "inverted", "type", "status", "loading", "icon", "indicator", "expanded", "defaultExpanded", "onToggle", "children", "className", "disabled", "showDivider", "highlight"]);
47897
47910
  var _k = e.useState(defaultExpanded), internalExpanded = _k[0], setInternalExpanded = _k[1];
47898
47911
  var isControlled = controlledExpanded !== undefined;
47899
47912
  var isExpanded = isControlled ? controlledExpanded : internalExpanded;
@@ -47922,10 +47935,11 @@ var ListExpandable = e.forwardRef(function (_a, ref) {
47922
47935
  },
47923
47936
  _b["ods-list-expandable--".concat(type)] = type,
47924
47937
  _b));
47925
- return (e.createElement("div", __assign$1({ ref: ref, "data-testid": "list-expandable", className: containerClassName }, rest),
47926
- e.createElement("button", { type: "button", className: "ods-list-expandable__main", onClick: loading ? undefined : handleToggle, disabled: disabled || loading, "aria-expanded": isExpanded, "aria-label": "".concat(isExpanded ? 'Recolher' : 'Expandir', " ").concat(title), "data-testid": "list-expandable-button" }, loading ? renderLoadingContent() : renderContent()),
47927
- showDivider && e.createElement("div", { className: "ods-list-expandable__divider", "data-testid": "list-expandable-divider" }),
47928
- isExpanded && children && (e.createElement("div", { className: "ods-list-expandable__content" }, children))));
47938
+ return (e.createElement(ListContainer, { type: type, showDivider: false, highlight: highlight, ref: ref },
47939
+ e.createElement("div", __assign$1({ "data-testid": "list-expandable", className: containerClassName }, rest),
47940
+ e.createElement("button", { type: "button", className: "ods-list-expandable__main", onClick: loading ? undefined : handleToggle, disabled: disabled || loading, "aria-expanded": isExpanded, "aria-label": "".concat(isExpanded ? 'Recolher' : 'Expandir', " ").concat(title), "data-testid": "list-expandable-button" }, loading ? renderLoadingContent() : renderContent()),
47941
+ showDivider && (e.createElement("div", { className: "ods-list-expandable__divider", "data-testid": "list-expandable-divider" })),
47942
+ isExpanded && children && (e.createElement("div", { className: "ods-list-expandable__content" }, children)))));
47929
47943
  });
47930
47944
  ListExpandable.displayName = 'ListExpandable';
47931
47945
 
@@ -48016,7 +48030,7 @@ InternalContextualHero.displayName = 'InternalContextualHero';
48016
48030
 
48017
48031
  var ListSettings = e.forwardRef(function (_a, ref) {
48018
48032
  var _b;
48019
- var title = _a.title, description = _a.description, strikethroughDescription = _a.strikethroughDescription, caption = _a.caption, _c = _a.inverted, inverted = _c === void 0 ? false : _c, _d = _a.type, type = _d === void 0 ? 'card' : _d, _e = _a.status, status = _e === void 0 ? 'default' : _e, _f = _a.disabled, disabled = _f === void 0 ? false : _f, _g = _a.loading, loading = _g === void 0 ? false : _g, icon = _a.icon, _h = _a.actionType, actionType = _h === void 0 ? 'button' : _h, _j = _a.buttonLabel, buttonLabel = _j === void 0 ? 'Label' : _j, _k = _a.buttonSize, buttonSize = _k === void 0 ? 'sm' : _k, _l = _a.buttonVariant, buttonVariant = _l === void 0 ? 'primary' : _l, _m = _a.toggleChecked, toggleChecked = _m === void 0 ? false : _m, onButtonClick = _a.onButtonClick, onToggleChange = _a.onToggleChange, _o = _a.showDivider, showDivider = _o === void 0 ? false : _o, className = _a.className, rest = __rest$1(_a, ["title", "description", "strikethroughDescription", "caption", "inverted", "type", "status", "disabled", "loading", "icon", "actionType", "buttonLabel", "buttonSize", "buttonVariant", "toggleChecked", "onButtonClick", "onToggleChange", "showDivider", "className"]);
48033
+ var title = _a.title, description = _a.description, strikethroughDescription = _a.strikethroughDescription, caption = _a.caption, _c = _a.inverted, inverted = _c === void 0 ? false : _c, _d = _a.type, type = _d === void 0 ? 'card' : _d, _e = _a.status, status = _e === void 0 ? 'default' : _e, _f = _a.disabled, disabled = _f === void 0 ? false : _f, _g = _a.loading, loading = _g === void 0 ? false : _g, icon = _a.icon, _h = _a.actionType, actionType = _h === void 0 ? 'button' : _h, _j = _a.buttonLabel, buttonLabel = _j === void 0 ? 'Label' : _j, _k = _a.buttonSize, buttonSize = _k === void 0 ? 'sm' : _k, _l = _a.buttonVariant, buttonVariant = _l === void 0 ? 'primary' : _l, _m = _a.toggleChecked, toggleChecked = _m === void 0 ? false : _m, onButtonClick = _a.onButtonClick, onToggleChange = _a.onToggleChange, _o = _a.showDivider, showDivider = _o === void 0 ? false : _o, highlight = _a.highlight, className = _a.className, rest = __rest$1(_a, ["title", "description", "strikethroughDescription", "caption", "inverted", "type", "status", "disabled", "loading", "icon", "actionType", "buttonLabel", "buttonSize", "buttonVariant", "toggleChecked", "onButtonClick", "onToggleChange", "showDivider", "highlight", "className"]);
48020
48034
  var renderActionElement = function () {
48021
48035
  if (actionType === 'button') {
48022
48036
  return (e.createElement(Button$1, { variant: buttonVariant, size: buttonSize, onClick: onButtonClick, disabled: disabled }, buttonLabel));
@@ -48041,9 +48055,8 @@ var ListSettings = e.forwardRef(function (_a, ref) {
48041
48055
  },
48042
48056
  _b["ods-list-settings--".concat(type)] = type,
48043
48057
  _b));
48044
- return (e.createElement("div", { className: "ods-list-settings__container" },
48045
- e.createElement("div", __assign$1({ ref: ref, "data-testid": "list-settings", className: containerClassName }, rest), loading ? renderLoadingContent() : renderContent()),
48046
- showDivider && type === 'text' && (e.createElement("div", { className: "ods-list-settings__divider" }))));
48058
+ return (e.createElement(ListContainer, { type: type, showDivider: showDivider, highlight: highlight },
48059
+ e.createElement("div", __assign$1({ ref: ref, "data-testid": "list-settings", className: containerClassName }, rest), loading ? renderLoadingContent() : renderContent())));
48047
48060
  });
48048
48061
  ListSettings.displayName = 'ListSettings';
48049
48062