@redsift/products 11.2.2 → 11.3.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.d.ts +3 -1
- package/index.js +45 -33
- package/index.js.map +1 -1
- package/package.json +8 -8
package/index.d.ts
CHANGED
package/index.js
CHANGED
|
@@ -6244,10 +6244,14 @@ const StyledDialogContent$1 = styled.div`
|
|
|
6244
6244
|
|
|
6245
6245
|
${_ref2 => {
|
|
6246
6246
|
let {
|
|
6247
|
-
$width
|
|
6247
|
+
$width,
|
|
6248
|
+
$maxWidth,
|
|
6249
|
+
$minWidth
|
|
6248
6250
|
} = _ref2;
|
|
6249
6251
|
return css`
|
|
6250
|
-
width: ${$width}
|
|
6252
|
+
${$width !== undefined ? `width: ${$width};` : ''}
|
|
6253
|
+
${$maxWidth !== undefined ? `min-width: ${$maxWidth};` : ''}
|
|
6254
|
+
${$minWidth !== undefined ? `max-width: ${$minWidth};` : ''}
|
|
6251
6255
|
`;
|
|
6252
6256
|
}}
|
|
6253
6257
|
|
|
@@ -6527,30 +6531,6 @@ DialogContentHeader.displayName = COMPONENT_NAME$4;
|
|
|
6527
6531
|
const _excluded$3 = ["children", "className", "style", "theme"];
|
|
6528
6532
|
const COMPONENT_NAME$3 = 'DialogContent';
|
|
6529
6533
|
const CLASSNAME$3 = 'redsift-dialog-content';
|
|
6530
|
-
const sizeToDimension = size => {
|
|
6531
|
-
if (typeof size !== 'string') {
|
|
6532
|
-
return size;
|
|
6533
|
-
}
|
|
6534
|
-
switch (size) {
|
|
6535
|
-
case DialogSize.small:
|
|
6536
|
-
return {
|
|
6537
|
-
width: '540px'
|
|
6538
|
-
};
|
|
6539
|
-
case DialogSize.large:
|
|
6540
|
-
return {
|
|
6541
|
-
width: '800px'
|
|
6542
|
-
};
|
|
6543
|
-
case DialogSize.xlarge:
|
|
6544
|
-
return {
|
|
6545
|
-
width: '80vw'
|
|
6546
|
-
};
|
|
6547
|
-
case DialogSize.medium:
|
|
6548
|
-
default:
|
|
6549
|
-
return {
|
|
6550
|
-
width: '700px'
|
|
6551
|
-
};
|
|
6552
|
-
}
|
|
6553
|
-
};
|
|
6554
6534
|
|
|
6555
6535
|
/**
|
|
6556
6536
|
* The DialogContent component.
|
|
@@ -6573,7 +6553,9 @@ const BaseDialogContent = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
6573
6553
|
handleOpen,
|
|
6574
6554
|
hasCloseButton,
|
|
6575
6555
|
initialFocus: propsInitialFocus,
|
|
6576
|
-
|
|
6556
|
+
width,
|
|
6557
|
+
minWidth,
|
|
6558
|
+
maxWidth,
|
|
6577
6559
|
headerRef,
|
|
6578
6560
|
bodyRef,
|
|
6579
6561
|
actionsRef
|
|
@@ -6584,9 +6566,6 @@ const BaseDialogContent = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
6584
6566
|
styles
|
|
6585
6567
|
} = useTransitionStyles(floatingContext);
|
|
6586
6568
|
const dialogRef = useMergeRefs([refs.setFloating, ref]);
|
|
6587
|
-
const {
|
|
6588
|
-
width
|
|
6589
|
-
} = sizeToDimension(size);
|
|
6590
6569
|
const format = useMessageFormatter(intlMessages);
|
|
6591
6570
|
const [[header], [body], [actions]] = partitionComponents(React__default.Children.toArray(children), [isComponent('DialogContentHeader'), isComponent('DialogContentBody'), isComponent('DialogContentActions')]);
|
|
6592
6571
|
const initialFocus = propsInitialFocus === 'header' ? headerRef : propsInitialFocus === 'body' ? bodyRef : propsInitialFocus === 'actions' ? actionsRef : propsInitialFocus ? propsInitialFocus : undefined;
|
|
@@ -6607,7 +6586,9 @@ const BaseDialogContent = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
6607
6586
|
"aria-describedby": descriptionId
|
|
6608
6587
|
}, getFloatingProps(props), {
|
|
6609
6588
|
style: _objectSpread2(_objectSpread2({}, styles), style),
|
|
6610
|
-
$width: width
|
|
6589
|
+
$width: width,
|
|
6590
|
+
$minWidth: minWidth,
|
|
6591
|
+
$maxWidth: maxWidth
|
|
6611
6592
|
}), !header && !body && !actions ? /*#__PURE__*/React__default.createElement(DialogContentBody, null, children) : /*#__PURE__*/React__default.createElement(React__default.Fragment, null, header || hasCloseButton ? /*#__PURE__*/React__default.createElement("div", {
|
|
6612
6593
|
className: `${BaseDialogContent.className}__header`
|
|
6613
6594
|
}, header, hasCloseButton ? /*#__PURE__*/React__default.createElement(IconButton, {
|
|
@@ -6667,6 +6648,30 @@ const DialogTrigger = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
6667
6648
|
DialogTrigger.className = CLASSNAME$2;
|
|
6668
6649
|
DialogTrigger.displayName = COMPONENT_NAME$2;
|
|
6669
6650
|
|
|
6651
|
+
const sizeToDimension = size => {
|
|
6652
|
+
if (typeof size !== 'string') {
|
|
6653
|
+
return size;
|
|
6654
|
+
}
|
|
6655
|
+
switch (size) {
|
|
6656
|
+
case DialogSize.small:
|
|
6657
|
+
return {
|
|
6658
|
+
width: '540px'
|
|
6659
|
+
};
|
|
6660
|
+
case DialogSize.large:
|
|
6661
|
+
return {
|
|
6662
|
+
width: '800px'
|
|
6663
|
+
};
|
|
6664
|
+
case DialogSize.xlarge:
|
|
6665
|
+
return {
|
|
6666
|
+
width: '80vw'
|
|
6667
|
+
};
|
|
6668
|
+
case DialogSize.medium:
|
|
6669
|
+
default:
|
|
6670
|
+
return {
|
|
6671
|
+
width: '700px'
|
|
6672
|
+
};
|
|
6673
|
+
}
|
|
6674
|
+
};
|
|
6670
6675
|
function useDialog(_ref) {
|
|
6671
6676
|
let {
|
|
6672
6677
|
color,
|
|
@@ -6684,6 +6689,11 @@ function useDialog(_ref) {
|
|
|
6684
6689
|
const [labelId, setLabelId] = React__default.useState();
|
|
6685
6690
|
const [descriptionId, setDescriptionId] = React__default.useState();
|
|
6686
6691
|
const [isOpen, setIsOpen] = useState(propsIsOpen !== null && propsIsOpen !== void 0 ? propsIsOpen : defaultOpen);
|
|
6692
|
+
const {
|
|
6693
|
+
width,
|
|
6694
|
+
minWidth,
|
|
6695
|
+
maxWidth
|
|
6696
|
+
} = sizeToDimension(size);
|
|
6687
6697
|
useEffect(() => {
|
|
6688
6698
|
setIsOpen(propsIsOpen !== null && propsIsOpen !== void 0 ? propsIsOpen : defaultOpen);
|
|
6689
6699
|
}, [propsIsOpen, defaultOpen]);
|
|
@@ -6716,12 +6726,14 @@ function useDialog(_ref) {
|
|
|
6716
6726
|
setDescriptionId,
|
|
6717
6727
|
hasCloseButton,
|
|
6718
6728
|
initialFocus,
|
|
6719
|
-
|
|
6729
|
+
width,
|
|
6730
|
+
minWidth,
|
|
6731
|
+
maxWidth,
|
|
6720
6732
|
headerRef,
|
|
6721
6733
|
bodyRef,
|
|
6722
6734
|
actionsRef,
|
|
6723
6735
|
triggerClassName
|
|
6724
|
-
}), [color, isOpen, handleOpen, interactions, data, labelId, descriptionId, hasCloseButton, initialFocus,
|
|
6736
|
+
}), [color, isOpen, handleOpen, interactions, data, labelId, descriptionId, hasCloseButton, initialFocus, width, minWidth, maxWidth, headerRef, bodyRef, actionsRef, triggerClassName]);
|
|
6725
6737
|
}
|
|
6726
6738
|
|
|
6727
6739
|
const COMPONENT_NAME$1 = 'Dialog';
|