@unicef/material-ui 0.11.5 → 0.11.7

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
@@ -35128,6 +35128,30 @@ exports.default = _default;
35128
35128
 
35129
35129
  var CancelIcon$1 = unwrapExports(Cancel);
35130
35130
 
35131
+ var ArrowDropDown = createCommonjsModule(function (module, exports) {
35132
+
35133
+
35134
+
35135
+
35136
+
35137
+ Object.defineProperty(exports, "__esModule", {
35138
+ value: true
35139
+ });
35140
+ exports.default = void 0;
35141
+
35142
+ var React = interopRequireWildcard(React__default);
35143
+
35144
+ var _createSvgIcon = interopRequireDefault(createSvgIcon$1);
35145
+
35146
+ var _default = (0, _createSvgIcon.default)( /*#__PURE__*/React.createElement("path", {
35147
+ d: "M7 10l5 5 5-5z"
35148
+ }), 'ArrowDropDown');
35149
+
35150
+ exports.default = _default;
35151
+ });
35152
+
35153
+ var ArrowDropDownIcon$1 = unwrapExports(ArrowDropDown);
35154
+
35131
35155
  var useStyles$5 = makeStyles$1(function (theme) {
35132
35156
  return {
35133
35157
  chip: {
@@ -37207,6 +37231,11 @@ var defaultComponents$1 = {
37207
37231
  MultiValueRemove: function MultiValueRemove(removeProps) {
37208
37232
  return React__default.createElement(CancelIcon$1, removeProps);
37209
37233
  }
37234
+ };
37235
+
37236
+ var ICON_VARIANTS = {
37237
+ dark: 'dark',
37238
+ light: 'light'
37210
37239
 
37211
37240
  /**
37212
37241
  * USelectPicker is a control for selecting a option from a list. Has the features below:
@@ -37237,7 +37266,8 @@ var defaultComponents$1 = {
37237
37266
  isDisabled = props.isDisabled,
37238
37267
  menuIsOpen = props.menuIsOpen,
37239
37268
  placeholder = props.placeholder,
37240
- others = objectWithoutProperties(props, ['label', 'variant', 'TextFieldProps', 'showNoOptionsWithEmptyTextField', 'onInputChange', 'components', 'showLabelHelp', 'InputLabelProps', 'InputLabelHelpProps', 'hideAvatar', 'readOnly', 'lineByLineOption', 'isClearable', 'isSearchable', 'isDisabled', 'menuIsOpen', 'placeholder']);
37269
+ iconVariant = props.iconVariant,
37270
+ others = objectWithoutProperties(props, ['label', 'variant', 'TextFieldProps', 'showNoOptionsWithEmptyTextField', 'onInputChange', 'components', 'showLabelHelp', 'InputLabelProps', 'InputLabelHelpProps', 'hideAvatar', 'readOnly', 'lineByLineOption', 'isClearable', 'isSearchable', 'isDisabled', 'menuIsOpen', 'placeholder', 'iconVariant']);
37241
37271
 
37242
37272
  var _useState = React.useState(true),
37243
37273
  _useState2 = slicedToArray(_useState, 2),
@@ -37283,11 +37313,17 @@ var defaultComponents$1 = {
37283
37313
  onInputChange && onInputChange(value);
37284
37314
  };
37285
37315
 
37286
- var extraComponents = readOnly ? {
37287
- DropdownIndicator: function DropdownIndicator() {
37288
- return null;
37289
- }
37290
- } : {};
37316
+ var extraComponents = {};
37317
+ if (iconVariant === ICON_VARIANTS.dark) extraComponents.DropdownIndicator = function () {
37318
+ return React__default.createElement(
37319
+ 'span',
37320
+ { style: { color: theme.palette.text.secondary } },
37321
+ React__default.createElement(ArrowDropDownIcon$1, null)
37322
+ );
37323
+ };
37324
+ if (readOnly) extraComponents.DropdownIndicator = function () {
37325
+ return null;
37326
+ };
37291
37327
 
37292
37328
  var selectPlaceholder = readOnly ? '' : placeholder;
37293
37329
 
@@ -37378,7 +37414,9 @@ USelectPicker.propTypes = {
37378
37414
  /** Whether the input is disabled */
37379
37415
  isDisabled: PropTypes__default.bool,
37380
37416
  /** Whether the menu is open */
37381
- menuIsOpen: PropTypes__default.bool
37417
+ menuIsOpen: PropTypes__default.bool,
37418
+ /** Down arrow variant */
37419
+ iconVariant: PropTypes__default.oneOf([ICON_VARIANTS.dark, ICON_VARIANTS.light])
37382
37420
  };
37383
37421
 
37384
37422
  USelectPicker.defaultProps = {
@@ -37394,7 +37432,8 @@ USelectPicker.defaultProps = {
37394
37432
  isSearchable: true,
37395
37433
  isDisabled: false,
37396
37434
  menuIsOpen: undefined,
37397
- lineByLineOption: false
37435
+ lineByLineOption: false,
37436
+ iconVariant: ICON_VARIANTS.light
37398
37437
  };
37399
37438
 
37400
37439
  /**
@@ -49363,9 +49402,14 @@ var useStyles$n = makeStyles$1(function (theme) {
49363
49402
  });
49364
49403
 
49365
49404
  var CONTROL_VARIANTS = {
49366
- popup: 'popup',
49367
49405
  menuItem: 'menuItem',
49368
- icon: 'icon'
49406
+ icon: 'icon',
49407
+ button: 'button'
49408
+ };
49409
+
49410
+ var CONFIRMATION_VARIANTS = {
49411
+ menu: 'menu',
49412
+ popup: 'popup'
49369
49413
 
49370
49414
  /**
49371
49415
  * UConfirmationButton is a component to get confirmation from the user before processing it.
@@ -49382,7 +49426,9 @@ var CONTROL_VARIANTS = {
49382
49426
  icon = props.icon,
49383
49427
  confirmText = props.confirmText,
49384
49428
  confirmActionText = props.confirmActionText,
49385
- cancelText = props.cancelText;
49429
+ cancelText = props.cancelText,
49430
+ buttonVariant = props.buttonVariant,
49431
+ confirmVariant = props.confirmVariant;
49386
49432
 
49387
49433
  var _useState = React.useState(null),
49388
49434
  _useState2 = slicedToArray(_useState, 2),
@@ -49396,7 +49442,11 @@ var CONTROL_VARIANTS = {
49396
49442
 
49397
49443
  var handleConfirm = function handleConfirm(e) {
49398
49444
  onConfirm && onConfirm(e, id);
49399
- if (variant !== CONTROL_VARIANTS.popup) handleDeleteOptionClicked();
49445
+ if (confirmVariant === CONFIRMATION_VARIANTS.popup) {
49446
+ setOpenDialog(false);
49447
+ } else {
49448
+ handleDeleteOptionClicked();
49449
+ }
49400
49450
  };
49401
49451
 
49402
49452
  var handleDeleteOptionClicked = function handleDeleteOptionClicked(e) {
@@ -49404,7 +49454,11 @@ var CONTROL_VARIANTS = {
49404
49454
  };
49405
49455
 
49406
49456
  var handleClick = function handleClick(e) {
49407
- if (variant !== CONTROL_VARIANTS.popup) setDeleteAnchorEl(e.currentTarget);else setOpenDialog(true);
49457
+ if (confirmVariant === CONFIRMATION_VARIANTS.popup) {
49458
+ setOpenDialog(true);
49459
+ } else {
49460
+ setDeleteAnchorEl(e.currentTarget);
49461
+ }
49408
49462
  };
49409
49463
 
49410
49464
  var handleCancelPopup = function handleCancelPopup(e) {
@@ -49419,10 +49473,20 @@ var CONTROL_VARIANTS = {
49419
49473
  { onClick: handleClick, className: classes.menuLabel },
49420
49474
  icon,
49421
49475
  React__default.createElement(
49422
- 'span',
49423
- { className: classes.span },
49476
+ Box,
49477
+ { component: 'span', className: icon ? classes.span : '' },
49424
49478
  buttonText
49425
49479
  )
49480
+ ) : variant === CONTROL_VARIANTS.button ? React__default.createElement(
49481
+ UButton,
49482
+ {
49483
+ startIcon: icon,
49484
+ onClick: handleClick,
49485
+ 'aria-controls': 'delete-confirmation-menu-' + id,
49486
+ 'aria-haspopup': 'true',
49487
+ variant: buttonVariant
49488
+ },
49489
+ buttonText
49426
49490
  ) : React__default.createElement(
49427
49491
  Tooltip$1,
49428
49492
  { title: buttonText, placement: 'top' },
@@ -49438,7 +49502,7 @@ var CONTROL_VARIANTS = {
49438
49502
  icon
49439
49503
  )
49440
49504
  ),
49441
- variant === CONTROL_VARIANTS.popup ? React__default.createElement(
49505
+ confirmVariant === CONFIRMATION_VARIANTS.popup ? React__default.createElement(
49442
49506
  Dialog$1,
49443
49507
  { id: 'delete-confirmation-menu-' + id, open: openDialog },
49444
49508
  React__default.createElement(
@@ -49497,8 +49561,10 @@ UConfirmationButton.propTypes = {
49497
49561
  buttonText: PropTypes__default.string,
49498
49562
  /** trigger confirmation function */
49499
49563
  onConfirm: PropTypes__default.func.isRequired,
49500
- /** variant: menu or icon */
49501
- variant: PropTypes__default.oneOf([CONTROL_VARIANTS.popup, CONTROL_VARIANTS.menuItem, CONTROL_VARIANTS.icon]),
49564
+ /** variant: menuItem or icon or button */
49565
+ variant: PropTypes__default.oneOf([CONTROL_VARIANTS.menuItem, CONTROL_VARIANTS.icon, CONTROL_VARIANTS.button]),
49566
+ /** Confirm variant: popup or menu */
49567
+ confirmVariant: PropTypes__default.oneOf([CONFIRMATION_VARIANTS.popup, CONFIRMATION_VARIANTS.menu]),
49502
49568
  /** if the variant is menuitem, this prop make sure the item enable or not */
49503
49569
  enabled: PropTypes__default.bool,
49504
49570
  /** button cancel text for popup variant */
@@ -49508,7 +49574,9 @@ UConfirmationButton.propTypes = {
49508
49574
  /** confirm action text */
49509
49575
  confirmActionText: PropTypes__default.string,
49510
49576
  /** custom icon */
49511
- icon: PropTypes__default.element
49577
+ icon: PropTypes__default.element,
49578
+ /** Button variant applied to menuItem button */
49579
+ buttonVariant: PropTypes__default.string
49512
49580
  };
49513
49581
 
49514
49582
  UConfirmationButton.defaultProps = {
@@ -49518,7 +49586,9 @@ UConfirmationButton.defaultProps = {
49518
49586
  confirmText: 'Confirm deletion?',
49519
49587
  confirmActionText: 'Yes, delete',
49520
49588
  cancelText: 'No',
49521
- icon: React__default.createElement(DeleteOutlinedIcon, null)
49589
+ icon: React__default.createElement(DeleteOutlinedIcon, null),
49590
+ buttonVariant: 'text',
49591
+ confirmVariant: 'menu'
49522
49592
  };
49523
49593
 
49524
49594
  /**
@@ -50095,7 +50165,7 @@ var Alert$1 = withStyles$1(styles$14, {
50095
50165
  * @ignore - internal component.
50096
50166
  */
50097
50167
 
50098
- var ArrowDropDownIcon$1 = createSvgIcon( /*#__PURE__*/React.createElement("path", {
50168
+ var ArrowDropDownIcon$2 = createSvgIcon( /*#__PURE__*/React.createElement("path", {
50099
50169
  d: "M7 10l5 5 5-5z"
50100
50170
  }), 'ArrowDropDown');
50101
50171
 
@@ -51421,7 +51491,7 @@ var _ref$4 = /*#__PURE__*/React.createElement(CloseIcon, {
51421
51491
  fontSize: "small"
51422
51492
  });
51423
51493
 
51424
- var _ref2$3 = /*#__PURE__*/React.createElement(ArrowDropDownIcon$1, null);
51494
+ var _ref2$3 = /*#__PURE__*/React.createElement(ArrowDropDownIcon$2, null);
51425
51495
 
51426
51496
  var Autocomplete = /*#__PURE__*/React.forwardRef(function Autocomplete(props, ref) {
51427
51497
  /* eslint-disable no-unused-vars */