@useblu/ocean-react 1.116.0 → 1.118.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/CHANGELOG.md +12 -0
- package/{CardListAction/CardListAction.d.ts → ListAction/ListAction.d.ts} +10 -6
- package/ListAction/ListAction.d.ts.map +1 -0
- package/ListAction/index.d.ts +4 -0
- package/ListAction/index.d.ts.map +1 -0
- package/ListExpandable/ListExpandable.d.ts +40 -0
- package/ListExpandable/ListExpandable.d.ts.map +1 -0
- package/ListExpandable/index.d.ts +3 -0
- package/ListExpandable/index.d.ts.map +1 -0
- package/_shared/components/InternalListActions/InternalListActions.d.ts +1 -0
- package/_shared/components/InternalListActions/InternalListActions.d.ts.map +1 -1
- package/_shared/components/InternalListActions/types.d.ts +1 -0
- package/_shared/components/InternalListActions/types.d.ts.map +1 -1
- package/index.d.ts +4 -2
- package/index.d.ts.map +1 -1
- package/index.es.js +100 -23
- package/index.es.js.map +1 -1
- package/index.js +101 -23
- package/index.js.map +1 -1
- package/package.json +1 -1
- package/CardListAction/CardListAction.d.ts.map +0 -1
- package/CardListAction/index.d.ts +0 -4
- package/CardListAction/index.d.ts.map +0 -1
package/index.js
CHANGED
|
@@ -47399,13 +47399,28 @@ var TriggerButton = function (_a) {
|
|
|
47399
47399
|
};
|
|
47400
47400
|
|
|
47401
47401
|
var InternalListActions = e.forwardRef(function (_a, forwardedRef) {
|
|
47402
|
-
var actions = _a.actions, _b = _a.actionType, actionType = _b === void 0 ? 'menu' : _b, _c = _a.disabled, disabled = _c === void 0 ? false : _c, _d = _a.position, position = _d === void 0 ? 'bottom-right' : _d, className = _a.className, rest = __rest$1(_a, ["actions", "actionType", "disabled", "position", "className"]);
|
|
47402
|
+
var actions = _a.actions, _b = _a.actionType, actionType = _b === void 0 ? 'menu' : _b, _c = _a.disabled, disabled = _c === void 0 ? false : _c, _d = _a.position, position = _d === void 0 ? 'bottom-right' : _d, className = _a.className, onOpenChange = _a.onOpenChange, rest = __rest$1(_a, ["actions", "actionType", "disabled", "position", "className", "onOpenChange"]);
|
|
47403
47403
|
var _e = e.useState(false), isOpen = _e[0], setIsOpen = _e[1];
|
|
47404
47404
|
var _f = e.useState(false), isClosing = _f[0], setIsClosing = _f[1];
|
|
47405
47405
|
var wrapperRef = e.useRef(null);
|
|
47406
47406
|
var triggerRef = e.useRef(null);
|
|
47407
47407
|
var menuRef = e.useRef(null);
|
|
47408
47408
|
var isSwipeMode = actionType === 'swipe';
|
|
47409
|
+
var notifyOpenChange = function (open) {
|
|
47410
|
+
if (open && isSwipeMode && menuRef.current) {
|
|
47411
|
+
requestAnimationFrame(function () {
|
|
47412
|
+
var _a;
|
|
47413
|
+
var menuWidth = ((_a = menuRef.current) === null || _a === void 0 ? void 0 : _a.offsetWidth) || 0;
|
|
47414
|
+
onOpenChange === null || onOpenChange === void 0 ? void 0 : onOpenChange(true, menuWidth);
|
|
47415
|
+
});
|
|
47416
|
+
}
|
|
47417
|
+
else if (open) {
|
|
47418
|
+
onOpenChange === null || onOpenChange === void 0 ? void 0 : onOpenChange(true);
|
|
47419
|
+
}
|
|
47420
|
+
else {
|
|
47421
|
+
onOpenChange === null || onOpenChange === void 0 ? void 0 : onOpenChange(false);
|
|
47422
|
+
}
|
|
47423
|
+
};
|
|
47409
47424
|
var handleSwipeLeft = function () {
|
|
47410
47425
|
setIsOpen(true);
|
|
47411
47426
|
setIsClosing(false);
|
|
@@ -47413,6 +47428,7 @@ var InternalListActions = e.forwardRef(function (_a, forwardedRef) {
|
|
|
47413
47428
|
var handleClose = function () {
|
|
47414
47429
|
if (isSwipeMode) {
|
|
47415
47430
|
setIsClosing(true);
|
|
47431
|
+
notifyOpenChange(false);
|
|
47416
47432
|
setTimeout(function () {
|
|
47417
47433
|
setIsOpen(false);
|
|
47418
47434
|
setIsClosing(false);
|
|
@@ -47420,6 +47436,7 @@ var InternalListActions = e.forwardRef(function (_a, forwardedRef) {
|
|
|
47420
47436
|
}
|
|
47421
47437
|
else {
|
|
47422
47438
|
setIsOpen(false);
|
|
47439
|
+
notifyOpenChange(false);
|
|
47423
47440
|
}
|
|
47424
47441
|
};
|
|
47425
47442
|
useSwipeGesture(triggerRef, isSwipeMode, isOpen, handleSwipeLeft);
|
|
@@ -47434,6 +47451,11 @@ var InternalListActions = e.forwardRef(function (_a, forwardedRef) {
|
|
|
47434
47451
|
}
|
|
47435
47452
|
}
|
|
47436
47453
|
}, [forwardedRef]);
|
|
47454
|
+
e.useEffect(function () {
|
|
47455
|
+
if (isOpen && isSwipeMode && !isClosing) {
|
|
47456
|
+
notifyOpenChange(true);
|
|
47457
|
+
}
|
|
47458
|
+
}, [isOpen, isSwipeMode, isClosing]);
|
|
47437
47459
|
var handleToggle = function () {
|
|
47438
47460
|
if (!disabled) {
|
|
47439
47461
|
if (isOpen) {
|
|
@@ -47467,37 +47489,92 @@ var InternalListActions = e.forwardRef(function (_a, forwardedRef) {
|
|
|
47467
47489
|
});
|
|
47468
47490
|
InternalListActions.displayName = 'InternalListActions';
|
|
47469
47491
|
|
|
47470
|
-
var
|
|
47471
|
-
var
|
|
47492
|
+
var ListAction = e.forwardRef(function (_a, ref) {
|
|
47493
|
+
var _b;
|
|
47494
|
+
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, rest = __rest$1(_a, ["title", "description", "strikethroughDescription", "caption", "inverted", "type", "status", "disabled", "loading", "icon", "indicator", "actionType", "menuActions", "menuPosition", "onClick", "className", "showDivider"]);
|
|
47495
|
+
var _l = e.useState(false), isSwipeOpen = _l[0], setIsSwipeOpen = _l[1];
|
|
47496
|
+
var _m = e.useState(0), menuWidth = _m[0], setMenuWidth = _m[1];
|
|
47497
|
+
var handleSwipeOpenChange = function (isOpen, width) {
|
|
47498
|
+
setIsSwipeOpen(isOpen);
|
|
47499
|
+
if (width !== undefined) {
|
|
47500
|
+
setMenuWidth(width);
|
|
47501
|
+
}
|
|
47502
|
+
};
|
|
47472
47503
|
var renderActionIcon = function () {
|
|
47473
47504
|
if (actionType === 'chevron') {
|
|
47474
|
-
return (e.createElement("div", { className:
|
|
47505
|
+
return (e.createElement("div", { className: 'ods-list-action__action' },
|
|
47475
47506
|
e.createElement(re, { size: 20 })));
|
|
47476
47507
|
}
|
|
47477
47508
|
if (actionType === 'menu' || actionType === 'swipe') {
|
|
47478
|
-
return (e.createElement(InternalListActions, { actions: menuActions || [], disabled: disabled, position: menuPosition, actionType: actionType }));
|
|
47509
|
+
return (e.createElement(InternalListActions, { actions: menuActions || [], disabled: disabled, position: menuPosition, actionType: actionType, onOpenChange: actionType === 'swipe' ? handleSwipeOpenChange : undefined }));
|
|
47479
47510
|
}
|
|
47480
47511
|
return null;
|
|
47481
47512
|
};
|
|
47482
|
-
|
|
47483
|
-
|
|
47484
|
-
|
|
47485
|
-
|
|
47486
|
-
|
|
47487
|
-
|
|
47488
|
-
|
|
47489
|
-
|
|
47490
|
-
'ods-
|
|
47491
|
-
|
|
47492
|
-
|
|
47493
|
-
|
|
47513
|
+
var renderLoadingContent = function () { return (e.createElement("div", { className: 'ods-list-action__skeleton' },
|
|
47514
|
+
e.createElement(SkeletonBar, { width: '40%', height: '16px' }),
|
|
47515
|
+
e.createElement(SkeletonBar, { width: '100%', height: '16px' }))); };
|
|
47516
|
+
var contentStyle = isSwipeOpen && menuWidth > 0
|
|
47517
|
+
? { transform: "translateX(-".concat(menuWidth, "px)") }
|
|
47518
|
+
: {};
|
|
47519
|
+
var renderContent = function () { return (e.createElement(e.Fragment, null,
|
|
47520
|
+
e.createElement("div", { className: 'ods-list-action__content', style: contentStyle },
|
|
47521
|
+
icon && (e.createElement("div", { className: classNames('ods-list-action__icon', {
|
|
47522
|
+
'ods-list-action__icon--inactive': status === 'inactive',
|
|
47523
|
+
}) }, icon)),
|
|
47524
|
+
e.createElement(ContentList, { title: title, description: description, strikethroughDescription: strikethroughDescription, caption: caption, inverted: inverted, type: status }),
|
|
47525
|
+
indicator && (e.createElement("div", { className: 'ods-list-action__indicator' }, indicator))),
|
|
47526
|
+
renderActionIcon())); };
|
|
47527
|
+
var buttonClassName = classNames('ods-list-action', className, (_b = {
|
|
47528
|
+
'ods-list-action--loading': loading,
|
|
47529
|
+
'ods-list-action--disabled': disabled,
|
|
47530
|
+
'ods-list-action--swipe-mode': actionType === 'swipe',
|
|
47531
|
+
'ods-list-action--swipe-open': isSwipeOpen
|
|
47532
|
+
},
|
|
47533
|
+
_b["ods-list-action--".concat(type)] = type,
|
|
47534
|
+
_b));
|
|
47535
|
+
return (e.createElement("div", { className: 'ods-list-action__container' },
|
|
47536
|
+
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()),
|
|
47537
|
+
showDivider && type === 'text' && (e.createElement("div", { className: 'ods-list-action__divider' }))));
|
|
47538
|
+
});
|
|
47539
|
+
ListAction.displayName = 'ListAction';
|
|
47540
|
+
|
|
47541
|
+
var ListExpandable = e.forwardRef(function (_a, ref) {
|
|
47542
|
+
var _b;
|
|
47543
|
+
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"]);
|
|
47544
|
+
var _k = e.useState(defaultExpanded), internalExpanded = _k[0], setInternalExpanded = _k[1];
|
|
47545
|
+
var isControlled = controlledExpanded !== undefined;
|
|
47546
|
+
var isExpanded = isControlled ? controlledExpanded : internalExpanded;
|
|
47547
|
+
var handleToggle = function () {
|
|
47548
|
+
var newExpandedState = !isExpanded;
|
|
47549
|
+
if (!isControlled) {
|
|
47550
|
+
setInternalExpanded(newExpandedState);
|
|
47551
|
+
}
|
|
47552
|
+
onToggle === null || onToggle === void 0 ? void 0 : onToggle(newExpandedState);
|
|
47553
|
+
};
|
|
47554
|
+
var renderLoadingContent = function () { return (e.createElement("div", { className: "ods-list-expandable__skeleton" },
|
|
47555
|
+
e.createElement(SkeletonBar, { width: "40%", height: "16px" }),
|
|
47556
|
+
e.createElement(SkeletonBar, { width: "100%", height: "16px" }))); };
|
|
47557
|
+
var renderContent = function () { return (e.createElement(e.Fragment, null,
|
|
47558
|
+
icon && (e.createElement("div", { className: classNames('ods-list-expandable__icon', {
|
|
47559
|
+
'ods-list-expandable__icon--inactive': status === 'inactive',
|
|
47494
47560
|
}) }, icon)),
|
|
47495
|
-
e.createElement(ContentList, { title: title, description: description, strikethroughDescription: strikethroughDescription, caption: caption, inverted: inverted, type:
|
|
47496
|
-
e.createElement("div", { className: "ods-
|
|
47497
|
-
indicator && (e.createElement("div", { className: "ods-
|
|
47498
|
-
|
|
47561
|
+
e.createElement(ContentList, { title: title, description: description, strikethroughDescription: strikethroughDescription, caption: caption, inverted: inverted, type: status }),
|
|
47562
|
+
e.createElement("div", { className: "ods-list-expandable__trailing" },
|
|
47563
|
+
indicator && (e.createElement("div", { className: "ods-list-expandable__indicator" }, indicator)),
|
|
47564
|
+
e.createElement("div", { className: "ods-list-expandable__action" }, isExpanded ? e.createElement(ae, { size: 20 }) : e.createElement(ee, { size: 20 }))))); };
|
|
47565
|
+
var containerClassName = classNames('ods-list-expandable', className, (_b = {
|
|
47566
|
+
'ods-list-expandable--expanded': isExpanded,
|
|
47567
|
+
'ods-list-expandable--disabled': disabled,
|
|
47568
|
+
'ods-list-expandable--loading': loading
|
|
47569
|
+
},
|
|
47570
|
+
_b["ods-list-expandable--".concat(type)] = type,
|
|
47571
|
+
_b));
|
|
47572
|
+
return (e.createElement("div", __assign$1({ ref: ref, "data-testid": "list-expandable", className: containerClassName }, rest),
|
|
47573
|
+
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()),
|
|
47574
|
+
showDivider && e.createElement("div", { className: "ods-list-expandable__divider", "data-testid": "list-expandable-divider" }),
|
|
47575
|
+
isExpanded && children && (e.createElement("div", { className: "ods-list-expandable__content" }, children))));
|
|
47499
47576
|
});
|
|
47500
|
-
|
|
47577
|
+
ListExpandable.displayName = 'ListExpandable';
|
|
47501
47578
|
|
|
47502
47579
|
exports.Accordion = Accordion;
|
|
47503
47580
|
exports.Alert = Alert;
|
|
@@ -47505,7 +47582,7 @@ exports.Badge = Badge;
|
|
|
47505
47582
|
exports.Breadcrumb = Breadcrumb;
|
|
47506
47583
|
exports.Button = Button$1;
|
|
47507
47584
|
exports.CardGroup = CardGroup;
|
|
47508
|
-
exports.
|
|
47585
|
+
exports.CardListExpandable = ListExpandable;
|
|
47509
47586
|
exports.CardListItem = CardListItem;
|
|
47510
47587
|
exports.Carousel = Carousel;
|
|
47511
47588
|
exports.Chart = DoughnutChart;
|
|
@@ -47524,6 +47601,7 @@ exports.IconButton = IconButton;
|
|
|
47524
47601
|
exports.Input = Input;
|
|
47525
47602
|
exports.Link = Link;
|
|
47526
47603
|
exports.List = List;
|
|
47604
|
+
exports.ListAction = ListAction;
|
|
47527
47605
|
exports.ListSelectable = ListSelectable;
|
|
47528
47606
|
exports.Modal = Modal;
|
|
47529
47607
|
exports.Progress = Progress;
|