@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 CHANGED
@@ -49363,9 +49363,14 @@ var useStyles$n = makeStyles$1(function (theme) {
49363
49363
  });
49364
49364
 
49365
49365
  var CONTROL_VARIANTS = {
49366
- popup: 'popup',
49367
49366
  menuItem: 'menuItem',
49368
- icon: 'icon'
49367
+ icon: 'icon',
49368
+ button: 'button'
49369
+ };
49370
+
49371
+ var CONFIRMATION_VARIANTS = {
49372
+ menu: 'menu',
49373
+ popup: 'popup'
49369
49374
 
49370
49375
  /**
49371
49376
  * UConfirmationButton is a component to get confirmation from the user before processing it.
@@ -49382,7 +49387,9 @@ var CONTROL_VARIANTS = {
49382
49387
  icon = props.icon,
49383
49388
  confirmText = props.confirmText,
49384
49389
  confirmActionText = props.confirmActionText,
49385
- cancelText = props.cancelText;
49390
+ cancelText = props.cancelText,
49391
+ buttonVariant = props.buttonVariant,
49392
+ confirmVariant = props.confirmVariant;
49386
49393
 
49387
49394
  var _useState = React.useState(null),
49388
49395
  _useState2 = slicedToArray(_useState, 2),
@@ -49396,7 +49403,11 @@ var CONTROL_VARIANTS = {
49396
49403
 
49397
49404
  var handleConfirm = function handleConfirm(e) {
49398
49405
  onConfirm && onConfirm(e, id);
49399
- if (variant !== CONTROL_VARIANTS.popup) handleDeleteOptionClicked();
49406
+ if (confirmVariant === CONFIRMATION_VARIANTS.popup) {
49407
+ setOpenDialog(false);
49408
+ } else {
49409
+ handleDeleteOptionClicked();
49410
+ }
49400
49411
  };
49401
49412
 
49402
49413
  var handleDeleteOptionClicked = function handleDeleteOptionClicked(e) {
@@ -49404,7 +49415,11 @@ var CONTROL_VARIANTS = {
49404
49415
  };
49405
49416
 
49406
49417
  var handleClick = function handleClick(e) {
49407
- if (variant !== CONTROL_VARIANTS.popup) setDeleteAnchorEl(e.currentTarget);else setOpenDialog(true);
49418
+ if (confirmVariant === CONFIRMATION_VARIANTS.popup) {
49419
+ setOpenDialog(true);
49420
+ } else {
49421
+ setDeleteAnchorEl(e.currentTarget);
49422
+ }
49408
49423
  };
49409
49424
 
49410
49425
  var handleCancelPopup = function handleCancelPopup(e) {
@@ -49419,10 +49434,20 @@ var CONTROL_VARIANTS = {
49419
49434
  { onClick: handleClick, className: classes.menuLabel },
49420
49435
  icon,
49421
49436
  React__default.createElement(
49422
- 'span',
49423
- { className: classes.span },
49437
+ Box,
49438
+ { component: 'span', className: icon ? classes.span : '' },
49424
49439
  buttonText
49425
49440
  )
49441
+ ) : variant === CONTROL_VARIANTS.button ? React__default.createElement(
49442
+ UButton,
49443
+ {
49444
+ startIcon: icon,
49445
+ onClick: handleClick,
49446
+ 'aria-controls': 'delete-confirmation-menu-' + id,
49447
+ 'aria-haspopup': 'true',
49448
+ variant: buttonVariant
49449
+ },
49450
+ buttonText
49426
49451
  ) : React__default.createElement(
49427
49452
  Tooltip$1,
49428
49453
  { title: buttonText, placement: 'top' },
@@ -49438,7 +49463,7 @@ var CONTROL_VARIANTS = {
49438
49463
  icon
49439
49464
  )
49440
49465
  ),
49441
- variant === CONTROL_VARIANTS.popup ? React__default.createElement(
49466
+ confirmVariant === CONFIRMATION_VARIANTS.popup ? React__default.createElement(
49442
49467
  Dialog$1,
49443
49468
  { id: 'delete-confirmation-menu-' + id, open: openDialog },
49444
49469
  React__default.createElement(
@@ -49497,8 +49522,10 @@ UConfirmationButton.propTypes = {
49497
49522
  buttonText: PropTypes__default.string,
49498
49523
  /** trigger confirmation function */
49499
49524
  onConfirm: PropTypes__default.func.isRequired,
49500
- /** variant: menu or icon */
49501
- variant: PropTypes__default.oneOf([CONTROL_VARIANTS.popup, CONTROL_VARIANTS.menuItem, CONTROL_VARIANTS.icon]),
49525
+ /** variant: menuItem or icon or button */
49526
+ variant: PropTypes__default.oneOf([CONTROL_VARIANTS.menuItem, CONTROL_VARIANTS.icon, CONTROL_VARIANTS.button]),
49527
+ /** Confirm variant: popup or menu */
49528
+ confirmVariant: PropTypes__default.oneOf([CONFIRMATION_VARIANTS.popup, CONFIRMATION_VARIANTS.menu]),
49502
49529
  /** if the variant is menuitem, this prop make sure the item enable or not */
49503
49530
  enabled: PropTypes__default.bool,
49504
49531
  /** button cancel text for popup variant */
@@ -49508,7 +49535,9 @@ UConfirmationButton.propTypes = {
49508
49535
  /** confirm action text */
49509
49536
  confirmActionText: PropTypes__default.string,
49510
49537
  /** custom icon */
49511
- icon: PropTypes__default.element
49538
+ icon: PropTypes__default.element,
49539
+ /** Button variant applied to menuItem button */
49540
+ buttonVariant: PropTypes__default.string
49512
49541
  };
49513
49542
 
49514
49543
  UConfirmationButton.defaultProps = {
@@ -49518,7 +49547,9 @@ UConfirmationButton.defaultProps = {
49518
49547
  confirmText: 'Confirm deletion?',
49519
49548
  confirmActionText: 'Yes, delete',
49520
49549
  cancelText: 'No',
49521
- icon: React__default.createElement(DeleteOutlinedIcon, null)
49550
+ icon: React__default.createElement(DeleteOutlinedIcon, null),
49551
+ buttonVariant: 'text',
49552
+ confirmVariant: 'menu'
49522
49553
  };
49523
49554
 
49524
49555
  /**
@@ -52949,7 +52980,7 @@ function USearchBox(_ref) {
52949
52980
 
52950
52981
  var classes = useStyles$u();
52951
52982
 
52952
- useEffect(function () {
52983
+ React.useEffect(function () {
52953
52984
  setSearch(value);
52954
52985
  }, [value]);
52955
52986