@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/prod.js CHANGED
@@ -28569,6 +28569,30 @@ exports.default = _default;
28569
28569
 
28570
28570
  var CancelIcon$1 = unwrapExports(Cancel);
28571
28571
 
28572
+ var ArrowDropDown = createCommonjsModule(function (module, exports) {
28573
+
28574
+
28575
+
28576
+
28577
+
28578
+ Object.defineProperty(exports, "__esModule", {
28579
+ value: true
28580
+ });
28581
+ exports.default = void 0;
28582
+
28583
+ var React = interopRequireWildcard(React__default);
28584
+
28585
+ var _createSvgIcon = interopRequireDefault(createSvgIcon$1);
28586
+
28587
+ var _default = (0, _createSvgIcon.default)( /*#__PURE__*/React.createElement("path", {
28588
+ d: "M7 10l5 5 5-5z"
28589
+ }), 'ArrowDropDown');
28590
+
28591
+ exports.default = _default;
28592
+ });
28593
+
28594
+ var ArrowDropDownIcon$1 = unwrapExports(ArrowDropDown);
28595
+
28572
28596
  var useStyles$5 = makeStyles$1(function (theme) {
28573
28597
  return {
28574
28598
  chip: {
@@ -30648,6 +30672,11 @@ var defaultComponents$1 = {
30648
30672
  MultiValueRemove: function MultiValueRemove(removeProps) {
30649
30673
  return React__default.createElement(CancelIcon$1, removeProps);
30650
30674
  }
30675
+ };
30676
+
30677
+ var ICON_VARIANTS = {
30678
+ dark: 'dark',
30679
+ light: 'light'
30651
30680
 
30652
30681
  /**
30653
30682
  * USelectPicker is a control for selecting a option from a list. Has the features below:
@@ -30678,7 +30707,8 @@ var defaultComponents$1 = {
30678
30707
  isDisabled = props.isDisabled,
30679
30708
  menuIsOpen = props.menuIsOpen,
30680
30709
  placeholder = props.placeholder,
30681
- others = objectWithoutProperties(props, ['label', 'variant', 'TextFieldProps', 'showNoOptionsWithEmptyTextField', 'onInputChange', 'components', 'showLabelHelp', 'InputLabelProps', 'InputLabelHelpProps', 'hideAvatar', 'readOnly', 'lineByLineOption', 'isClearable', 'isSearchable', 'isDisabled', 'menuIsOpen', 'placeholder']);
30710
+ iconVariant = props.iconVariant,
30711
+ others = objectWithoutProperties(props, ['label', 'variant', 'TextFieldProps', 'showNoOptionsWithEmptyTextField', 'onInputChange', 'components', 'showLabelHelp', 'InputLabelProps', 'InputLabelHelpProps', 'hideAvatar', 'readOnly', 'lineByLineOption', 'isClearable', 'isSearchable', 'isDisabled', 'menuIsOpen', 'placeholder', 'iconVariant']);
30682
30712
 
30683
30713
  var _useState = React.useState(true),
30684
30714
  _useState2 = slicedToArray(_useState, 2),
@@ -30724,11 +30754,17 @@ var defaultComponents$1 = {
30724
30754
  onInputChange && onInputChange(value);
30725
30755
  };
30726
30756
 
30727
- var extraComponents = readOnly ? {
30728
- DropdownIndicator: function DropdownIndicator() {
30729
- return null;
30730
- }
30731
- } : {};
30757
+ var extraComponents = {};
30758
+ if (iconVariant === ICON_VARIANTS.dark) extraComponents.DropdownIndicator = function () {
30759
+ return React__default.createElement(
30760
+ 'span',
30761
+ { style: { color: theme.palette.text.secondary } },
30762
+ React__default.createElement(ArrowDropDownIcon$1, null)
30763
+ );
30764
+ };
30765
+ if (readOnly) extraComponents.DropdownIndicator = function () {
30766
+ return null;
30767
+ };
30732
30768
 
30733
30769
  var selectPlaceholder = readOnly ? '' : placeholder;
30734
30770
 
@@ -30819,7 +30855,9 @@ USelectPicker.propTypes = {
30819
30855
  /** Whether the input is disabled */
30820
30856
  isDisabled: PropTypes__default.bool,
30821
30857
  /** Whether the menu is open */
30822
- menuIsOpen: PropTypes__default.bool
30858
+ menuIsOpen: PropTypes__default.bool,
30859
+ /** Down arrow variant */
30860
+ iconVariant: PropTypes__default.oneOf([ICON_VARIANTS.dark, ICON_VARIANTS.light])
30823
30861
  };
30824
30862
 
30825
30863
  USelectPicker.defaultProps = {
@@ -30835,7 +30873,8 @@ USelectPicker.defaultProps = {
30835
30873
  isSearchable: true,
30836
30874
  isDisabled: false,
30837
30875
  menuIsOpen: undefined,
30838
- lineByLineOption: false
30876
+ lineByLineOption: false,
30877
+ iconVariant: ICON_VARIANTS.light
30839
30878
  };
30840
30879
 
30841
30880
  /**
@@ -42732,9 +42771,14 @@ var useStyles$n = makeStyles$1(function (theme) {
42732
42771
  });
42733
42772
 
42734
42773
  var CONTROL_VARIANTS = {
42735
- popup: 'popup',
42736
42774
  menuItem: 'menuItem',
42737
- icon: 'icon'
42775
+ icon: 'icon',
42776
+ button: 'button'
42777
+ };
42778
+
42779
+ var CONFIRMATION_VARIANTS = {
42780
+ menu: 'menu',
42781
+ popup: 'popup'
42738
42782
 
42739
42783
  /**
42740
42784
  * UConfirmationButton is a component to get confirmation from the user before processing it.
@@ -42751,7 +42795,9 @@ var CONTROL_VARIANTS = {
42751
42795
  icon = props.icon,
42752
42796
  confirmText = props.confirmText,
42753
42797
  confirmActionText = props.confirmActionText,
42754
- cancelText = props.cancelText;
42798
+ cancelText = props.cancelText,
42799
+ buttonVariant = props.buttonVariant,
42800
+ confirmVariant = props.confirmVariant;
42755
42801
 
42756
42802
  var _useState = React.useState(null),
42757
42803
  _useState2 = slicedToArray(_useState, 2),
@@ -42765,7 +42811,11 @@ var CONTROL_VARIANTS = {
42765
42811
 
42766
42812
  var handleConfirm = function handleConfirm(e) {
42767
42813
  onConfirm && onConfirm(e, id);
42768
- if (variant !== CONTROL_VARIANTS.popup) handleDeleteOptionClicked();
42814
+ if (confirmVariant === CONFIRMATION_VARIANTS.popup) {
42815
+ setOpenDialog(false);
42816
+ } else {
42817
+ handleDeleteOptionClicked();
42818
+ }
42769
42819
  };
42770
42820
 
42771
42821
  var handleDeleteOptionClicked = function handleDeleteOptionClicked(e) {
@@ -42773,7 +42823,11 @@ var CONTROL_VARIANTS = {
42773
42823
  };
42774
42824
 
42775
42825
  var handleClick = function handleClick(e) {
42776
- if (variant !== CONTROL_VARIANTS.popup) setDeleteAnchorEl(e.currentTarget);else setOpenDialog(true);
42826
+ if (confirmVariant === CONFIRMATION_VARIANTS.popup) {
42827
+ setOpenDialog(true);
42828
+ } else {
42829
+ setDeleteAnchorEl(e.currentTarget);
42830
+ }
42777
42831
  };
42778
42832
 
42779
42833
  var handleCancelPopup = function handleCancelPopup(e) {
@@ -42788,10 +42842,20 @@ var CONTROL_VARIANTS = {
42788
42842
  { onClick: handleClick, className: classes.menuLabel },
42789
42843
  icon,
42790
42844
  React__default.createElement(
42791
- 'span',
42792
- { className: classes.span },
42845
+ Box,
42846
+ { component: 'span', className: icon ? classes.span : '' },
42793
42847
  buttonText
42794
42848
  )
42849
+ ) : variant === CONTROL_VARIANTS.button ? React__default.createElement(
42850
+ UButton,
42851
+ {
42852
+ startIcon: icon,
42853
+ onClick: handleClick,
42854
+ 'aria-controls': 'delete-confirmation-menu-' + id,
42855
+ 'aria-haspopup': 'true',
42856
+ variant: buttonVariant
42857
+ },
42858
+ buttonText
42795
42859
  ) : React__default.createElement(
42796
42860
  Tooltip$1,
42797
42861
  { title: buttonText, placement: 'top' },
@@ -42807,7 +42871,7 @@ var CONTROL_VARIANTS = {
42807
42871
  icon
42808
42872
  )
42809
42873
  ),
42810
- variant === CONTROL_VARIANTS.popup ? React__default.createElement(
42874
+ confirmVariant === CONFIRMATION_VARIANTS.popup ? React__default.createElement(
42811
42875
  Dialog$1,
42812
42876
  { id: 'delete-confirmation-menu-' + id, open: openDialog },
42813
42877
  React__default.createElement(
@@ -42866,8 +42930,10 @@ UConfirmationButton.propTypes = {
42866
42930
  buttonText: PropTypes__default.string,
42867
42931
  /** trigger confirmation function */
42868
42932
  onConfirm: PropTypes__default.func.isRequired,
42869
- /** variant: menu or icon */
42870
- variant: PropTypes__default.oneOf([CONTROL_VARIANTS.popup, CONTROL_VARIANTS.menuItem, CONTROL_VARIANTS.icon]),
42933
+ /** variant: menuItem or icon or button */
42934
+ variant: PropTypes__default.oneOf([CONTROL_VARIANTS.menuItem, CONTROL_VARIANTS.icon, CONTROL_VARIANTS.button]),
42935
+ /** Confirm variant: popup or menu */
42936
+ confirmVariant: PropTypes__default.oneOf([CONFIRMATION_VARIANTS.popup, CONFIRMATION_VARIANTS.menu]),
42871
42937
  /** if the variant is menuitem, this prop make sure the item enable or not */
42872
42938
  enabled: PropTypes__default.bool,
42873
42939
  /** button cancel text for popup variant */
@@ -42877,7 +42943,9 @@ UConfirmationButton.propTypes = {
42877
42943
  /** confirm action text */
42878
42944
  confirmActionText: PropTypes__default.string,
42879
42945
  /** custom icon */
42880
- icon: PropTypes__default.element
42946
+ icon: PropTypes__default.element,
42947
+ /** Button variant applied to menuItem button */
42948
+ buttonVariant: PropTypes__default.string
42881
42949
  };
42882
42950
 
42883
42951
  UConfirmationButton.defaultProps = {
@@ -42887,7 +42955,9 @@ UConfirmationButton.defaultProps = {
42887
42955
  confirmText: 'Confirm deletion?',
42888
42956
  confirmActionText: 'Yes, delete',
42889
42957
  cancelText: 'No',
42890
- icon: React__default.createElement(DeleteOutlinedIcon, null)
42958
+ icon: React__default.createElement(DeleteOutlinedIcon, null),
42959
+ buttonVariant: 'text',
42960
+ confirmVariant: 'menu'
42891
42961
  };
42892
42962
 
42893
42963
  /**
@@ -43383,7 +43453,7 @@ var Alert$1 = withStyles$1(styles$14, {
43383
43453
  * @ignore - internal component.
43384
43454
  */
43385
43455
 
43386
- var ArrowDropDownIcon$1 = createSvgIcon( /*#__PURE__*/React.createElement("path", {
43456
+ var ArrowDropDownIcon$2 = createSvgIcon( /*#__PURE__*/React.createElement("path", {
43387
43457
  d: "M7 10l5 5 5-5z"
43388
43458
  }));
43389
43459
 
@@ -44661,7 +44731,7 @@ var _ref$4 = /*#__PURE__*/React.createElement(CloseIcon, {
44661
44731
  fontSize: "small"
44662
44732
  });
44663
44733
 
44664
- var _ref2$3 = /*#__PURE__*/React.createElement(ArrowDropDownIcon$1, null);
44734
+ var _ref2$3 = /*#__PURE__*/React.createElement(ArrowDropDownIcon$2, null);
44665
44735
 
44666
44736
  var Autocomplete = /*#__PURE__*/React.forwardRef(function Autocomplete(props, ref) {
44667
44737
  /* eslint-disable no-unused-vars */