@unicef/material-ui 0.11.3 → 0.11.5

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
@@ -48532,6 +48532,18 @@ var UTextField = function (_ValidatorComponent) {
48532
48532
  }
48533
48533
  };
48534
48534
 
48535
+ _this.handleSelectOpen = function () {
48536
+ _this.setState({
48537
+ isSelectOpen: true
48538
+ });
48539
+ };
48540
+
48541
+ _this.handleSelectClose = function () {
48542
+ _this.setState({
48543
+ isSelectOpen: false
48544
+ });
48545
+ };
48546
+
48535
48547
  return _this;
48536
48548
  }
48537
48549
 
@@ -48560,8 +48572,13 @@ var UTextField = function (_ValidatorComponent) {
48560
48572
  InputLabelProps = _props.InputLabelProps,
48561
48573
  showLabelHelp = _props.showLabelHelp,
48562
48574
  InputLabelHelpProps = _props.InputLabelHelpProps,
48563
- rest = objectWithoutProperties(_props, ['variant', 'error', 'customErrorMessages', 'validators', 'requiredError', 'helperText', 'validatorListener', 'withRequiredValidator', 'onBlur', 'maxLength', 'counter', 'counterClassName', 'readOnly', 'label', 'InputProps', 'InputLabelProps', 'showLabelHelp', 'InputLabelHelpProps']);
48564
- var isValid = this.state.isValid;
48575
+ select = _props.select,
48576
+ id = _props.id,
48577
+ SelectProps = _props.SelectProps,
48578
+ rest = objectWithoutProperties(_props, ['variant', 'error', 'customErrorMessages', 'validators', 'requiredError', 'helperText', 'validatorListener', 'withRequiredValidator', 'onBlur', 'maxLength', 'counter', 'counterClassName', 'readOnly', 'label', 'InputProps', 'InputLabelProps', 'showLabelHelp', 'InputLabelHelpProps', 'select', 'id', 'SelectProps']);
48579
+ var _state = this.state,
48580
+ isValid = _state.isValid,
48581
+ isSelectOpen = _state.isSelectOpen;
48565
48582
 
48566
48583
  var length = this.props.value ? this.props.value.length : 0;
48567
48584
  var counterError = maxLength && maxLength < length;
@@ -48583,8 +48600,32 @@ var UTextField = function (_ValidatorComponent) {
48583
48600
  InputLabelProps: _extends$1({}, InputLabelProps, {
48584
48601
  style: _extends$1({}, styles$13.labelRoot)
48585
48602
  }),
48586
- label: showLabelHelp ? React__default.createElement(InputLabelHelp, _extends$1({ inputLabel: label }, InputLabelHelpProps)) : label
48587
- })),
48603
+ label: showLabelHelp ? React__default.createElement(InputLabelHelp, _extends$1({ inputLabel: label }, InputLabelHelpProps)) : label,
48604
+ select: select,
48605
+ id: id
48606
+ /** Accessibility fixes for select field */
48607
+ }, select ? {
48608
+ inputProps: _extends$1({}, this.props.inputProps ? this.props.inputProps : {}, {
48609
+ 'aria-describedby': null
48610
+ }),
48611
+ SelectProps: _extends$1({}, SelectProps ? SelectProps : {}, {
48612
+ open: isSelectOpen ? true : false,
48613
+ onClose: this.handleSelectClose,
48614
+ onOpen: this.handleSelectOpen,
48615
+ MenuProps: {
48616
+ MenuListProps: {
48617
+ id: id + '-select-menu',
48618
+ 'aria-labelledby': null
48619
+ }
48620
+ },
48621
+ SelectDisplayProps: {
48622
+ role: 'combobox',
48623
+ 'aria-controls': id + '-select-menu',
48624
+ 'aria-expanded': isSelectOpen ? true : false,
48625
+ 'aria-describedby': id + '-helper-text'
48626
+ }
48627
+ })
48628
+ } : {})),
48588
48629
  counter && React__default.createElement(
48589
48630
  Box,
48590
48631
  { display: 'block' },
@@ -48637,7 +48678,11 @@ UTextField.propTypes = {
48637
48678
  /** Show label help */
48638
48679
  showLabelHelp: PropTypes__default.bool,
48639
48680
  /** 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}} */
48640
- InputLabelHelpProps: PropTypes__default.object
48681
+ InputLabelHelpProps: PropTypes__default.object,
48682
+ /** Id of the field */
48683
+ id: PropTypes__default.string,
48684
+ /** Props applied to the Select element. */
48685
+ SelectProps: PropTypes__default.object
48641
48686
  };
48642
48687
 
48643
48688
  UTextField.defaultProps = {
@@ -48645,7 +48690,9 @@ UTextField.defaultProps = {
48645
48690
  readOnly: false,
48646
48691
  validatorListener: function validatorListener() {},
48647
48692
  showLabelHelp: false,
48648
- InputLabelHelpProps: {}
48693
+ InputLabelHelpProps: {},
48694
+ select: false,
48695
+ SelectProps: {}
48649
48696
  };
48650
48697
 
48651
48698
  //Extending the ValidatorComponent using class component, so taking an exclusion from our rule: functional components only.
@@ -49607,7 +49654,8 @@ var useStyles$p = makeStyles$1(function (theme) {
49607
49654
  root: {
49608
49655
  position: 'fixed',
49609
49656
  top: 16,
49610
- left: '40%',
49657
+ left: '50%',
49658
+ transform: 'translate(-50%, 0)',
49611
49659
  zIndex: 5000
49612
49660
  },
49613
49661
  chip: {
@@ -52901,6 +52949,10 @@ function USearchBox(_ref) {
52901
52949
 
52902
52950
  var classes = useStyles$u();
52903
52951
 
52952
+ React.useEffect(function () {
52953
+ setSearch(value);
52954
+ }, [value]);
52955
+
52904
52956
  var handleChange = function handleChange(event) {
52905
52957
  setSearch(event.target.value);
52906
52958
  };