@unicef/material-ui 0.11.4 → 0.11.6
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/lib/dev.js +44 -13
- package/lib/dev.js.map +1 -1
- package/lib/prod.js +44 -13
- package/lib/prod.js.map +1 -1
- package/package.json +1 -1
package/lib/prod.js
CHANGED
|
@@ -42732,9 +42732,14 @@ var useStyles$n = makeStyles$1(function (theme) {
|
|
|
42732
42732
|
});
|
|
42733
42733
|
|
|
42734
42734
|
var CONTROL_VARIANTS = {
|
|
42735
|
-
popup: 'popup',
|
|
42736
42735
|
menuItem: 'menuItem',
|
|
42737
|
-
icon: 'icon'
|
|
42736
|
+
icon: 'icon',
|
|
42737
|
+
button: 'button'
|
|
42738
|
+
};
|
|
42739
|
+
|
|
42740
|
+
var CONFIRMATION_VARIANTS = {
|
|
42741
|
+
menu: 'menu',
|
|
42742
|
+
popup: 'popup'
|
|
42738
42743
|
|
|
42739
42744
|
/**
|
|
42740
42745
|
* UConfirmationButton is a component to get confirmation from the user before processing it.
|
|
@@ -42751,7 +42756,9 @@ var CONTROL_VARIANTS = {
|
|
|
42751
42756
|
icon = props.icon,
|
|
42752
42757
|
confirmText = props.confirmText,
|
|
42753
42758
|
confirmActionText = props.confirmActionText,
|
|
42754
|
-
cancelText = props.cancelText
|
|
42759
|
+
cancelText = props.cancelText,
|
|
42760
|
+
buttonVariant = props.buttonVariant,
|
|
42761
|
+
confirmVariant = props.confirmVariant;
|
|
42755
42762
|
|
|
42756
42763
|
var _useState = React.useState(null),
|
|
42757
42764
|
_useState2 = slicedToArray(_useState, 2),
|
|
@@ -42765,7 +42772,11 @@ var CONTROL_VARIANTS = {
|
|
|
42765
42772
|
|
|
42766
42773
|
var handleConfirm = function handleConfirm(e) {
|
|
42767
42774
|
onConfirm && onConfirm(e, id);
|
|
42768
|
-
if (
|
|
42775
|
+
if (confirmVariant === CONFIRMATION_VARIANTS.popup) {
|
|
42776
|
+
setOpenDialog(false);
|
|
42777
|
+
} else {
|
|
42778
|
+
handleDeleteOptionClicked();
|
|
42779
|
+
}
|
|
42769
42780
|
};
|
|
42770
42781
|
|
|
42771
42782
|
var handleDeleteOptionClicked = function handleDeleteOptionClicked(e) {
|
|
@@ -42773,7 +42784,11 @@ var CONTROL_VARIANTS = {
|
|
|
42773
42784
|
};
|
|
42774
42785
|
|
|
42775
42786
|
var handleClick = function handleClick(e) {
|
|
42776
|
-
if (
|
|
42787
|
+
if (confirmVariant === CONFIRMATION_VARIANTS.popup) {
|
|
42788
|
+
setOpenDialog(true);
|
|
42789
|
+
} else {
|
|
42790
|
+
setDeleteAnchorEl(e.currentTarget);
|
|
42791
|
+
}
|
|
42777
42792
|
};
|
|
42778
42793
|
|
|
42779
42794
|
var handleCancelPopup = function handleCancelPopup(e) {
|
|
@@ -42788,10 +42803,20 @@ var CONTROL_VARIANTS = {
|
|
|
42788
42803
|
{ onClick: handleClick, className: classes.menuLabel },
|
|
42789
42804
|
icon,
|
|
42790
42805
|
React__default.createElement(
|
|
42791
|
-
|
|
42792
|
-
{ className: classes.span },
|
|
42806
|
+
Box,
|
|
42807
|
+
{ component: 'span', className: icon ? classes.span : '' },
|
|
42793
42808
|
buttonText
|
|
42794
42809
|
)
|
|
42810
|
+
) : variant === CONTROL_VARIANTS.button ? React__default.createElement(
|
|
42811
|
+
UButton,
|
|
42812
|
+
{
|
|
42813
|
+
startIcon: icon,
|
|
42814
|
+
onClick: handleClick,
|
|
42815
|
+
'aria-controls': 'delete-confirmation-menu-' + id,
|
|
42816
|
+
'aria-haspopup': 'true',
|
|
42817
|
+
variant: buttonVariant
|
|
42818
|
+
},
|
|
42819
|
+
buttonText
|
|
42795
42820
|
) : React__default.createElement(
|
|
42796
42821
|
Tooltip$1,
|
|
42797
42822
|
{ title: buttonText, placement: 'top' },
|
|
@@ -42807,7 +42832,7 @@ var CONTROL_VARIANTS = {
|
|
|
42807
42832
|
icon
|
|
42808
42833
|
)
|
|
42809
42834
|
),
|
|
42810
|
-
|
|
42835
|
+
confirmVariant === CONFIRMATION_VARIANTS.popup ? React__default.createElement(
|
|
42811
42836
|
Dialog$1,
|
|
42812
42837
|
{ id: 'delete-confirmation-menu-' + id, open: openDialog },
|
|
42813
42838
|
React__default.createElement(
|
|
@@ -42866,8 +42891,10 @@ UConfirmationButton.propTypes = {
|
|
|
42866
42891
|
buttonText: PropTypes__default.string,
|
|
42867
42892
|
/** trigger confirmation function */
|
|
42868
42893
|
onConfirm: PropTypes__default.func.isRequired,
|
|
42869
|
-
/** variant:
|
|
42870
|
-
variant: PropTypes__default.oneOf([CONTROL_VARIANTS.
|
|
42894
|
+
/** variant: menuItem or icon or button */
|
|
42895
|
+
variant: PropTypes__default.oneOf([CONTROL_VARIANTS.menuItem, CONTROL_VARIANTS.icon, CONTROL_VARIANTS.button]),
|
|
42896
|
+
/** Confirm variant: popup or menu */
|
|
42897
|
+
confirmVariant: PropTypes__default.oneOf([CONFIRMATION_VARIANTS.popup, CONFIRMATION_VARIANTS.menu]),
|
|
42871
42898
|
/** if the variant is menuitem, this prop make sure the item enable or not */
|
|
42872
42899
|
enabled: PropTypes__default.bool,
|
|
42873
42900
|
/** button cancel text for popup variant */
|
|
@@ -42877,7 +42904,9 @@ UConfirmationButton.propTypes = {
|
|
|
42877
42904
|
/** confirm action text */
|
|
42878
42905
|
confirmActionText: PropTypes__default.string,
|
|
42879
42906
|
/** custom icon */
|
|
42880
|
-
icon: PropTypes__default.element
|
|
42907
|
+
icon: PropTypes__default.element,
|
|
42908
|
+
/** Button variant applied to menuItem button */
|
|
42909
|
+
buttonVariant: PropTypes__default.string
|
|
42881
42910
|
};
|
|
42882
42911
|
|
|
42883
42912
|
UConfirmationButton.defaultProps = {
|
|
@@ -42887,7 +42916,9 @@ UConfirmationButton.defaultProps = {
|
|
|
42887
42916
|
confirmText: 'Confirm deletion?',
|
|
42888
42917
|
confirmActionText: 'Yes, delete',
|
|
42889
42918
|
cancelText: 'No',
|
|
42890
|
-
icon: React__default.createElement(DeleteOutlinedIcon, null)
|
|
42919
|
+
icon: React__default.createElement(DeleteOutlinedIcon, null),
|
|
42920
|
+
buttonVariant: 'text',
|
|
42921
|
+
confirmVariant: 'menu'
|
|
42891
42922
|
};
|
|
42892
42923
|
|
|
42893
42924
|
/**
|
|
@@ -45788,7 +45819,7 @@ function USearchBox(_ref) {
|
|
|
45788
45819
|
|
|
45789
45820
|
var classes = useStyles$u();
|
|
45790
45821
|
|
|
45791
|
-
useEffect(function () {
|
|
45822
|
+
React.useEffect(function () {
|
|
45792
45823
|
setSearch(value);
|
|
45793
45824
|
}, [value]);
|
|
45794
45825
|
|