@7shifts/sous-chef 3.78.0 → 3.78.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/dist/index.css +6 -0
- package/dist/index.css.map +1 -1
- package/dist/index.js +43 -5
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +42 -4
- package/dist/index.modern.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -14477,10 +14477,11 @@ var EMPTY_STATE_SIZE = {
|
|
|
14477
14477
|
LARGE: 'large'
|
|
14478
14478
|
};
|
|
14479
14479
|
|
|
14480
|
-
var styles$2 = {"empty-state-container-inline":"_mhyqH","empty-state-container-inline--inside-modal":"_Kiu3T","empty-state-container-inline__content":"_Px6C0","empty-state-container-inline__content--large":"_voA-r","empty-state-container-inline__content--medium":"_Q9cut","empty-state-container-inline__body":"_xMUQ6","empty-state-container-inline__image":"_79QnQ","empty-state-container-inline__image--large":"_HxPhH","empty-state-container-inline__image--medium":"_TeUmg"};
|
|
14480
|
+
var styles$2 = {"empty-state-container-inline":"_mhyqH","empty-state-container-inline--inside-modal":"_Kiu3T","empty-state-container-inline__content":"_Px6C0","empty-state-container-inline__content--large":"_voA-r","empty-state-container-inline__content--medium":"_Q9cut","empty-state-container-inline__body":"_xMUQ6","empty-state-container-inline__image":"_79QnQ","empty-state-container-inline__image--large":"_HxPhH","empty-state-container-inline__image--medium":"_TeUmg","empty-state-container-inline--small-container":"_VWrGi"};
|
|
14481
14481
|
|
|
14482
|
+
var smallWidthPx = 320;
|
|
14482
14483
|
var EmptyStateContainerInline = function EmptyStateContainerInline(_ref) {
|
|
14483
|
-
var _classNames, _classnames, _classnames2;
|
|
14484
|
+
var _ref$current2, _classNames, _classnames, _classnames2;
|
|
14484
14485
|
var header = _ref.header,
|
|
14485
14486
|
title = _ref.title,
|
|
14486
14487
|
children = _ref.children,
|
|
@@ -14494,9 +14495,29 @@ var EmptyStateContainerInline = function EmptyStateContainerInline(_ref) {
|
|
|
14494
14495
|
testId = _ref.testId;
|
|
14495
14496
|
var _useModalContext = useModalContext(),
|
|
14496
14497
|
isInsideModal = _useModalContext.isModalMounted;
|
|
14498
|
+
var _useState = React.useState(false),
|
|
14499
|
+
isOnSmallContainer = _useState[0],
|
|
14500
|
+
setIsOnSmallContainer = _useState[1];
|
|
14501
|
+
var ref = React.useRef(null);
|
|
14502
|
+
React.useLayoutEffect(function () {
|
|
14503
|
+
if (isSmallParent(parentWidthFromRef(ref))) {
|
|
14504
|
+
setIsOnSmallContainer(true);
|
|
14505
|
+
}
|
|
14506
|
+
}, []);
|
|
14507
|
+
React.useLayoutEffect(function () {
|
|
14508
|
+
var _ref$current;
|
|
14509
|
+
var parentElement = (_ref$current = ref.current) == null ? void 0 : _ref$current.parentElement;
|
|
14510
|
+
if (parentElement) {
|
|
14511
|
+
var parentResize = new ResizeObserver(function (event) {
|
|
14512
|
+
setIsOnSmallContainer(isSmallParent(parentWidthFromResizeEvent(event)));
|
|
14513
|
+
});
|
|
14514
|
+
parentResize.observe(parentElement);
|
|
14515
|
+
}
|
|
14516
|
+
}, [(_ref$current2 = ref.current) == null ? void 0 : _ref$current2.parentElement]);
|
|
14497
14517
|
return React__default["default"].createElement("div", {
|
|
14498
|
-
className: classnames__default["default"](styles$2['empty-state-container-inline'], (_classNames = {}, _classNames[styles$2['empty-state-container-inline--inside-modal']] = isInsideModal, _classNames)),
|
|
14499
|
-
"data-testid": testId
|
|
14518
|
+
className: classnames__default["default"](styles$2['empty-state-container-inline'], (_classNames = {}, _classNames[styles$2['empty-state-container-inline--inside-modal']] = isInsideModal, _classNames[styles$2['empty-state-container-inline--small-container']] = isOnSmallContainer, _classNames)),
|
|
14519
|
+
"data-testid": testId,
|
|
14520
|
+
ref: ref
|
|
14500
14521
|
}, React__default["default"].createElement("div", {
|
|
14501
14522
|
className: classnames__default["default"](styles$2['empty-state-container-inline__content'], (_classnames = {}, _classnames[styles$2['empty-state-container-inline__content--large']] = size === EMPTY_STATE_SIZE.LARGE, _classnames[styles$2['empty-state-container-inline__content--medium']] = size === EMPTY_STATE_SIZE.MEDIUM, _classnames))
|
|
14502
14523
|
}, React__default["default"].createElement(Stack, {
|
|
@@ -14510,7 +14531,8 @@ var EmptyStateContainerInline = function EmptyStateContainerInline(_ref) {
|
|
|
14510
14531
|
className: styles$2['empty-state-container-inline__body']
|
|
14511
14532
|
}, children), React__default["default"].createElement(Stack, {
|
|
14512
14533
|
space: 8,
|
|
14513
|
-
marginTop: 12
|
|
14534
|
+
marginTop: 12,
|
|
14535
|
+
alignItems: isOnSmallContainer ? 'center' : undefined
|
|
14514
14536
|
}, actions && React__default["default"].createElement(EmptyStateContainerCTA, {
|
|
14515
14537
|
actions: actions,
|
|
14516
14538
|
isPaywall: isPaywall,
|
|
@@ -14524,6 +14546,22 @@ var EmptyStateContainerInline = function EmptyStateContainerInline(_ref) {
|
|
|
14524
14546
|
alt: String(title)
|
|
14525
14547
|
})));
|
|
14526
14548
|
};
|
|
14549
|
+
function parentWidthFromRef(ref) {
|
|
14550
|
+
var _ref$current3;
|
|
14551
|
+
return (_ref$current3 = ref.current) == null || (_ref$current3 = _ref$current3.parentElement) == null || (_ref$current3 = _ref$current3.getBoundingClientRect()) == null ? void 0 : _ref$current3.width;
|
|
14552
|
+
}
|
|
14553
|
+
function parentWidthFromResizeEvent(event) {
|
|
14554
|
+
if (event.length > 0) {
|
|
14555
|
+
if (event[0].contentBoxSize.length > 0) {
|
|
14556
|
+
return event[0].contentBoxSize[0].inlineSize;
|
|
14557
|
+
}
|
|
14558
|
+
return event[0].contentRect.width;
|
|
14559
|
+
}
|
|
14560
|
+
return undefined;
|
|
14561
|
+
}
|
|
14562
|
+
function isSmallParent(width) {
|
|
14563
|
+
return width !== undefined && width <= smallWidthPx;
|
|
14564
|
+
}
|
|
14527
14565
|
|
|
14528
14566
|
var EmptyStateContainer = function EmptyStateContainer(_ref) {
|
|
14529
14567
|
var header = _ref.header,
|