@unicef/material-ui 0.11.2 → 0.11.4
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 +124 -38
- package/lib/dev.js.map +1 -1
- package/lib/prod.js +124 -38
- package/lib/prod.js.map +1 -1
- package/package.json +1 -1
package/lib/prod.js
CHANGED
|
@@ -41901,6 +41901,18 @@ var UTextField = function (_ValidatorComponent) {
|
|
|
41901
41901
|
}
|
|
41902
41902
|
};
|
|
41903
41903
|
|
|
41904
|
+
_this.handleSelectOpen = function () {
|
|
41905
|
+
_this.setState({
|
|
41906
|
+
isSelectOpen: true
|
|
41907
|
+
});
|
|
41908
|
+
};
|
|
41909
|
+
|
|
41910
|
+
_this.handleSelectClose = function () {
|
|
41911
|
+
_this.setState({
|
|
41912
|
+
isSelectOpen: false
|
|
41913
|
+
});
|
|
41914
|
+
};
|
|
41915
|
+
|
|
41904
41916
|
return _this;
|
|
41905
41917
|
}
|
|
41906
41918
|
|
|
@@ -41929,8 +41941,13 @@ var UTextField = function (_ValidatorComponent) {
|
|
|
41929
41941
|
InputLabelProps = _props.InputLabelProps,
|
|
41930
41942
|
showLabelHelp = _props.showLabelHelp,
|
|
41931
41943
|
InputLabelHelpProps = _props.InputLabelHelpProps,
|
|
41932
|
-
|
|
41933
|
-
|
|
41944
|
+
select = _props.select,
|
|
41945
|
+
id = _props.id,
|
|
41946
|
+
SelectProps = _props.SelectProps,
|
|
41947
|
+
rest = objectWithoutProperties(_props, ['variant', 'error', 'customErrorMessages', 'validators', 'requiredError', 'helperText', 'validatorListener', 'withRequiredValidator', 'onBlur', 'maxLength', 'counter', 'counterClassName', 'readOnly', 'label', 'InputProps', 'InputLabelProps', 'showLabelHelp', 'InputLabelHelpProps', 'select', 'id', 'SelectProps']);
|
|
41948
|
+
var _state = this.state,
|
|
41949
|
+
isValid = _state.isValid,
|
|
41950
|
+
isSelectOpen = _state.isSelectOpen;
|
|
41934
41951
|
|
|
41935
41952
|
var length = this.props.value ? this.props.value.length : 0;
|
|
41936
41953
|
var counterError = maxLength && maxLength < length;
|
|
@@ -41952,8 +41969,32 @@ var UTextField = function (_ValidatorComponent) {
|
|
|
41952
41969
|
InputLabelProps: _extends$1({}, InputLabelProps, {
|
|
41953
41970
|
style: _extends$1({}, styles$13.labelRoot)
|
|
41954
41971
|
}),
|
|
41955
|
-
label: showLabelHelp ? React__default.createElement(InputLabelHelp, _extends$1({ inputLabel: label }, InputLabelHelpProps)) : label
|
|
41956
|
-
|
|
41972
|
+
label: showLabelHelp ? React__default.createElement(InputLabelHelp, _extends$1({ inputLabel: label }, InputLabelHelpProps)) : label,
|
|
41973
|
+
select: select,
|
|
41974
|
+
id: id
|
|
41975
|
+
/** Accessibility fixes for select field */
|
|
41976
|
+
}, select ? {
|
|
41977
|
+
inputProps: _extends$1({}, this.props.inputProps ? this.props.inputProps : {}, {
|
|
41978
|
+
'aria-describedby': null
|
|
41979
|
+
}),
|
|
41980
|
+
SelectProps: _extends$1({}, SelectProps ? SelectProps : {}, {
|
|
41981
|
+
open: isSelectOpen ? true : false,
|
|
41982
|
+
onClose: this.handleSelectClose,
|
|
41983
|
+
onOpen: this.handleSelectOpen,
|
|
41984
|
+
MenuProps: {
|
|
41985
|
+
MenuListProps: {
|
|
41986
|
+
id: id + '-select-menu',
|
|
41987
|
+
'aria-labelledby': null
|
|
41988
|
+
}
|
|
41989
|
+
},
|
|
41990
|
+
SelectDisplayProps: {
|
|
41991
|
+
role: 'combobox',
|
|
41992
|
+
'aria-controls': id + '-select-menu',
|
|
41993
|
+
'aria-expanded': isSelectOpen ? true : false,
|
|
41994
|
+
'aria-describedby': id + '-helper-text'
|
|
41995
|
+
}
|
|
41996
|
+
})
|
|
41997
|
+
} : {})),
|
|
41957
41998
|
counter && React__default.createElement(
|
|
41958
41999
|
Box,
|
|
41959
42000
|
{ display: 'block' },
|
|
@@ -42006,7 +42047,11 @@ UTextField.propTypes = {
|
|
|
42006
42047
|
/** Show label help */
|
|
42007
42048
|
showLabelHelp: PropTypes__default.bool,
|
|
42008
42049
|
/** Props applied to the input label help element. E.g InputLabelHelpProps={{type:'link', label:'Help', link:'unicef.github.io', icon, tooltipTitle: 'Tooltip title', tooltipPlacement: 'bottom}} */
|
|
42009
|
-
InputLabelHelpProps: PropTypes__default.object
|
|
42050
|
+
InputLabelHelpProps: PropTypes__default.object,
|
|
42051
|
+
/** Id of the field */
|
|
42052
|
+
id: PropTypes__default.string,
|
|
42053
|
+
/** Props applied to the Select element. */
|
|
42054
|
+
SelectProps: PropTypes__default.object
|
|
42010
42055
|
};
|
|
42011
42056
|
|
|
42012
42057
|
UTextField.defaultProps = {
|
|
@@ -42014,7 +42059,9 @@ UTextField.defaultProps = {
|
|
|
42014
42059
|
readOnly: false,
|
|
42015
42060
|
validatorListener: function validatorListener() {},
|
|
42016
42061
|
showLabelHelp: false,
|
|
42017
|
-
InputLabelHelpProps: {}
|
|
42062
|
+
InputLabelHelpProps: {},
|
|
42063
|
+
select: false,
|
|
42064
|
+
SelectProps: {}
|
|
42018
42065
|
};
|
|
42019
42066
|
|
|
42020
42067
|
//Extending the ValidatorComponent using class component, so taking an exclusion from our rule: functional components only.
|
|
@@ -42684,12 +42731,17 @@ var useStyles$n = makeStyles$1(function (theme) {
|
|
|
42684
42731
|
};
|
|
42685
42732
|
});
|
|
42686
42733
|
|
|
42687
|
-
|
|
42688
|
-
|
|
42689
|
-
|
|
42690
|
-
|
|
42691
|
-
|
|
42692
|
-
|
|
42734
|
+
var CONTROL_VARIANTS = {
|
|
42735
|
+
popup: 'popup',
|
|
42736
|
+
menuItem: 'menuItem',
|
|
42737
|
+
icon: 'icon'
|
|
42738
|
+
|
|
42739
|
+
/**
|
|
42740
|
+
* UConfirmationButton is a component to get confirmation from the user before processing it.
|
|
42741
|
+
* This button displays the confirmation where user has clicked the button
|
|
42742
|
+
* It has two varint icon/menu item
|
|
42743
|
+
*/
|
|
42744
|
+
};function UConfirmationButton(props) {
|
|
42693
42745
|
var classes = useStyles$n();
|
|
42694
42746
|
var onConfirm = props.onConfirm,
|
|
42695
42747
|
id = props.id,
|
|
@@ -42699,32 +42751,41 @@ function UConfirmationButton(props) {
|
|
|
42699
42751
|
icon = props.icon,
|
|
42700
42752
|
confirmText = props.confirmText,
|
|
42701
42753
|
confirmActionText = props.confirmActionText,
|
|
42702
|
-
|
|
42754
|
+
cancelText = props.cancelText;
|
|
42703
42755
|
|
|
42704
42756
|
var _useState = React.useState(null),
|
|
42705
42757
|
_useState2 = slicedToArray(_useState, 2),
|
|
42706
42758
|
deleteAnchorEl = _useState2[0],
|
|
42707
42759
|
setDeleteAnchorEl = _useState2[1];
|
|
42708
42760
|
|
|
42761
|
+
var _useState3 = React.useState(false),
|
|
42762
|
+
_useState4 = slicedToArray(_useState3, 2),
|
|
42763
|
+
openDialog = _useState4[0],
|
|
42764
|
+
setOpenDialog = _useState4[1];
|
|
42765
|
+
|
|
42709
42766
|
var handleConfirm = function handleConfirm(e) {
|
|
42710
|
-
onConfirm(e, id);
|
|
42711
|
-
handleDeleteOptionClicked();
|
|
42767
|
+
onConfirm && onConfirm(e, id);
|
|
42768
|
+
if (variant !== CONTROL_VARIANTS.popup) handleDeleteOptionClicked();
|
|
42712
42769
|
};
|
|
42713
42770
|
|
|
42714
42771
|
var handleDeleteOptionClicked = function handleDeleteOptionClicked(e) {
|
|
42715
42772
|
setDeleteAnchorEl(null);
|
|
42716
42773
|
};
|
|
42774
|
+
|
|
42775
|
+
var handleClick = function handleClick(e) {
|
|
42776
|
+
if (variant !== CONTROL_VARIANTS.popup) setDeleteAnchorEl(e.currentTarget);else setOpenDialog(true);
|
|
42777
|
+
};
|
|
42778
|
+
|
|
42779
|
+
var handleCancelPopup = function handleCancelPopup(e) {
|
|
42780
|
+
setOpenDialog(false);
|
|
42781
|
+
};
|
|
42782
|
+
|
|
42717
42783
|
return React__default.createElement(
|
|
42718
42784
|
React__default.Fragment,
|
|
42719
42785
|
null,
|
|
42720
|
-
variant ===
|
|
42786
|
+
variant === CONTROL_VARIANTS.menuItem ? React__default.createElement(
|
|
42721
42787
|
MenuItem$1,
|
|
42722
|
-
{
|
|
42723
|
-
onClick: function onClick(e) {
|
|
42724
|
-
return setDeleteAnchorEl(e.currentTarget);
|
|
42725
|
-
},
|
|
42726
|
-
className: classes.menuLabel
|
|
42727
|
-
},
|
|
42788
|
+
{ onClick: handleClick, className: classes.menuLabel },
|
|
42728
42789
|
icon,
|
|
42729
42790
|
React__default.createElement(
|
|
42730
42791
|
'span',
|
|
@@ -42739,16 +42800,40 @@ function UConfirmationButton(props) {
|
|
|
42739
42800
|
{
|
|
42740
42801
|
'aria-controls': 'delete-confirmation-menu-' + id,
|
|
42741
42802
|
'aria-haspopup': 'true',
|
|
42742
|
-
onClick:
|
|
42743
|
-
return setDeleteAnchorEl(e.currentTarget);
|
|
42744
|
-
},
|
|
42803
|
+
onClick: handleClick,
|
|
42745
42804
|
disabled: !enabled,
|
|
42746
42805
|
className: classes.menuLabel
|
|
42747
42806
|
},
|
|
42748
42807
|
icon
|
|
42749
42808
|
)
|
|
42750
42809
|
),
|
|
42751
|
-
React__default.createElement(
|
|
42810
|
+
variant === CONTROL_VARIANTS.popup ? React__default.createElement(
|
|
42811
|
+
Dialog$1,
|
|
42812
|
+
{ id: 'delete-confirmation-menu-' + id, open: openDialog },
|
|
42813
|
+
React__default.createElement(
|
|
42814
|
+
DialogContent$1,
|
|
42815
|
+
null,
|
|
42816
|
+
React__default.createElement(
|
|
42817
|
+
Typography$1,
|
|
42818
|
+
{ variant: 'body1' },
|
|
42819
|
+
confirmText || ''
|
|
42820
|
+
)
|
|
42821
|
+
),
|
|
42822
|
+
React__default.createElement(
|
|
42823
|
+
DialogActions$1,
|
|
42824
|
+
null,
|
|
42825
|
+
React__default.createElement(
|
|
42826
|
+
UButton,
|
|
42827
|
+
{ onClick: handleCancelPopup, variant: 'uDefault' },
|
|
42828
|
+
cancelText || ''
|
|
42829
|
+
),
|
|
42830
|
+
React__default.createElement(
|
|
42831
|
+
UButton,
|
|
42832
|
+
{ onClick: handleConfirm, variant: 'uPrimary', color: 'primary' },
|
|
42833
|
+
confirmActionText || ''
|
|
42834
|
+
)
|
|
42835
|
+
)
|
|
42836
|
+
) : React__default.createElement(
|
|
42752
42837
|
Menu$1,
|
|
42753
42838
|
{
|
|
42754
42839
|
id: 'delete-confirmation-menu-' + id,
|
|
@@ -42782,9 +42867,11 @@ UConfirmationButton.propTypes = {
|
|
|
42782
42867
|
/** trigger confirmation function */
|
|
42783
42868
|
onConfirm: PropTypes__default.func.isRequired,
|
|
42784
42869
|
/** variant: menu or icon */
|
|
42785
|
-
variant: PropTypes__default.oneOf([
|
|
42870
|
+
variant: PropTypes__default.oneOf([CONTROL_VARIANTS.popup, CONTROL_VARIANTS.menuItem, CONTROL_VARIANTS.icon]),
|
|
42786
42871
|
/** if the variant is menuitem, this prop make sure the item enable or not */
|
|
42787
42872
|
enabled: PropTypes__default.bool,
|
|
42873
|
+
/** button cancel text for popup variant */
|
|
42874
|
+
cancelText: PropTypes__default.string,
|
|
42788
42875
|
/** button confirm text */
|
|
42789
42876
|
confirmText: PropTypes__default.string,
|
|
42790
42877
|
/** confirm action text */
|
|
@@ -42799,6 +42886,7 @@ UConfirmationButton.defaultProps = {
|
|
|
42799
42886
|
enabled: true,
|
|
42800
42887
|
confirmText: 'Confirm deletion?',
|
|
42801
42888
|
confirmActionText: 'Yes, delete',
|
|
42889
|
+
cancelText: 'No',
|
|
42802
42890
|
icon: React__default.createElement(DeleteOutlinedIcon, null)
|
|
42803
42891
|
};
|
|
42804
42892
|
|
|
@@ -42935,7 +43023,8 @@ var useStyles$p = makeStyles$1(function (theme) {
|
|
|
42935
43023
|
root: {
|
|
42936
43024
|
position: 'fixed',
|
|
42937
43025
|
top: 16,
|
|
42938
|
-
left: '
|
|
43026
|
+
left: '50%',
|
|
43027
|
+
transform: 'translate(-50%, 0)',
|
|
42939
43028
|
zIndex: 5000
|
|
42940
43029
|
},
|
|
42941
43030
|
chip: {
|
|
@@ -42978,21 +43067,14 @@ function UAsyncBadge(_ref) {
|
|
|
42978
43067
|
}
|
|
42979
43068
|
}, [variant]);
|
|
42980
43069
|
|
|
42981
|
-
React.useEffect(function () {
|
|
42982
|
-
// When the badge becomes visible, set focus to it.
|
|
42983
|
-
if (visible && variant) {
|
|
42984
|
-
chipRef.current.focus();
|
|
42985
|
-
}
|
|
42986
|
-
}, [visible, variant]);
|
|
42987
|
-
|
|
42988
43070
|
return React__default.createElement(
|
|
42989
43071
|
'span',
|
|
42990
43072
|
{ className: classes.root },
|
|
42991
43073
|
visible && React__default.createElement(Chip$1, {
|
|
42992
43074
|
ref: chipRef,
|
|
42993
|
-
|
|
42994
|
-
'aria-live': '
|
|
42995
|
-
|
|
43075
|
+
role: 'status',
|
|
43076
|
+
'aria-live': 'polite',
|
|
43077
|
+
className: classes.chip + ' ' + classes[variant],
|
|
42996
43078
|
avatar: variant === 'loading' ? React__default.createElement(CircularProgress$1, { size: 16 }) : variant === 'error' ? React__default.createElement(HighlightOffIcon, { size: 16 }) : variant === 'success' && React__default.createElement(DoneIcon, { size: 16 }),
|
|
42997
43079
|
classes: { avatar: classes[variant] },
|
|
42998
43080
|
size: 'medium',
|
|
@@ -45706,6 +45788,10 @@ function USearchBox(_ref) {
|
|
|
45706
45788
|
|
|
45707
45789
|
var classes = useStyles$u();
|
|
45708
45790
|
|
|
45791
|
+
useEffect(function () {
|
|
45792
|
+
setSearch(value);
|
|
45793
|
+
}, [value]);
|
|
45794
|
+
|
|
45709
45795
|
var handleChange = function handleChange(event) {
|
|
45710
45796
|
setSearch(event.target.value);
|
|
45711
45797
|
};
|