@unicef/material-ui 0.12.1 → 0.12.3

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
@@ -7394,6 +7394,20 @@ function isPhoneNumberText(value) {
7394
7394
  return true;
7395
7395
  }
7396
7396
 
7397
+ /**
7398
+ *
7399
+ * @param {String} value Value text to be validated
7400
+ * @returns {Boolean} Whether the given value string contains safe text (no html tags)
7401
+ */
7402
+ function isRegexCaseInSensitive(value, regexRule) {
7403
+ var valueToTest = value || '';
7404
+ var regexStr = regexRule;
7405
+ if (!regexStr) return true; // if no regex, then accept any text
7406
+
7407
+ var regex = new RegExp(regexStr, 'i');
7408
+ return regex.test(valueToTest);
7409
+ }
7410
+
7397
7411
  /**
7398
7412
  *
7399
7413
  * @param {String} value Value text to be validated
@@ -35424,7 +35438,12 @@ function InputComponent(_ref) {
35424
35438
  var inputRef = _ref.inputRef,
35425
35439
  props = objectWithoutProperties(_ref, ['inputRef']);
35426
35440
 
35427
- return React__default.createElement('div', _extends$1({ ref: inputRef }, props));
35441
+ return React__default.createElement('div', _extends$1({
35442
+ ref: inputRef
35443
+ }, props, {
35444
+ required: undefined // Remove required from div element
35445
+ , 'aria-invalid': undefined // Remove aria-invalid from div element
35446
+ }));
35428
35447
  }
35429
35448
 
35430
35449
  InputComponent.propTypes = {
@@ -37249,7 +37268,10 @@ function Input$3(props) {
37249
37268
  describedBy = describedBy || customDescribedBy ? '' + (describedBy ? describedBy : '') + (customDescribedBy ? ' ' + customDescribedBy : '') : undefined;
37250
37269
  }
37251
37270
 
37252
- return React__default.createElement(components.Input, _extends$1({}, props, { 'aria-describedby': describedBy }));
37271
+ return React__default.createElement(components.Input, _extends$1({}, props, {
37272
+ 'aria-describedby': describedBy,
37273
+ required: props && props.selectProps && props.selectProps.required || undefined
37274
+ }));
37253
37275
  }
37254
37276
 
37255
37277
  Input$3.propTypes = {
@@ -48938,6 +48960,10 @@ function ForwardRefForm(props, ref) {
48938
48960
  return isAlphanumericText(value);
48939
48961
  });
48940
48962
 
48963
+ lib_2.addValidationRule('matchRegexpCaseInSensitive', function (value, regexStr) {
48964
+ return isRegexCaseInSensitive(value, regexStr);
48965
+ });
48966
+
48941
48967
  return React__default.createElement(lib_2, _extends$1({}, props, { ref: ref }));
48942
48968
  }
48943
48969
 
@@ -53258,7 +53284,8 @@ function ActiveKeyboardDatePicker(props) {
53258
53284
  showLabelHelp = props.showLabelHelp,
53259
53285
  InputLabelHelpProps = props.InputLabelHelpProps,
53260
53286
  label = props.label,
53261
- others = objectWithoutProperties(props, ['autoOk', 'variant', 'inputVariant', 'readOnly', 'interactiveMode', 'InputLabelProps', 'className', 'inputProps', 'InputProps', 'placeholder', 'showLabelHelp', 'InputLabelHelpProps', 'label']);
53287
+ KeyboardButtonProps = props.KeyboardButtonProps,
53288
+ others = objectWithoutProperties(props, ['autoOk', 'variant', 'inputVariant', 'readOnly', 'interactiveMode', 'InputLabelProps', 'className', 'inputProps', 'InputProps', 'placeholder', 'showLabelHelp', 'InputLabelHelpProps', 'label', 'KeyboardButtonProps']);
53262
53289
 
53263
53290
  var _React$useState = React__default.useState(classes.icon),
53264
53291
  _React$useState2 = slicedToArray(_React$useState, 2),
@@ -53299,11 +53326,11 @@ function ActiveKeyboardDatePicker(props) {
53299
53326
  disabled: Boolean(readOnly)
53300
53327
  }, inputProps),
53301
53328
  readOnly: readOnly,
53302
- KeyboardButtonProps: {
53329
+ KeyboardButtonProps: _extends$1({}, KeyboardButtonProps, {
53303
53330
  classes: {
53304
53331
  root: '' + (!interactiveMode && !readOnly ? '' : hideIcon)
53305
53332
  }
53306
- },
53333
+ }),
53307
53334
  InputProps: _extends$1({
53308
53335
  classes: {
53309
53336
  root: classes.input + ' ' + (readOnly && classes.inputHover),
@@ -53345,14 +53372,17 @@ ActiveKeyboardDatePicker.propTypes = {
53345
53372
  /** Show label help */
53346
53373
  showLabelHelp: PropTypes__default.bool,
53347
53374
  /** 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}} */
53348
- InputLabelHelpProps: PropTypes__default.object
53375
+ InputLabelHelpProps: PropTypes__default.object,
53376
+ /** Keyboard button props */
53377
+ KeyboardButtonProps: PropTypes__default.object
53349
53378
  };
53350
53379
 
53351
53380
  ActiveKeyboardDatePicker.defaultProps = {
53352
53381
  inputVariant: 'outlined',
53353
53382
  autoOk: true,
53354
53383
  variant: 'inline',
53355
- format: 'dd/MM/yyyy'
53384
+ format: 'dd/MM/yyyy',
53385
+ KeyboardButtonProps: {}
53356
53386
  };
53357
53387
 
53358
53388
  var styles$17 = {
@@ -53675,7 +53705,8 @@ function ActiveKeyboardTimePicker(props) {
53675
53705
  showLabelHelp = props.showLabelHelp,
53676
53706
  InputLabelHelpProps = props.InputLabelHelpProps,
53677
53707
  label = props.label,
53678
- others = objectWithoutProperties(props, ['inputVariant', 'readOnly', 'interactiveMode', 'InputLabelProps', 'className', 'inputProps', 'InputProps', 'placeholder', 'showLabelHelp', 'InputLabelHelpProps', 'label']);
53708
+ KeyboardButtonProps = props.KeyboardButtonProps,
53709
+ others = objectWithoutProperties(props, ['inputVariant', 'readOnly', 'interactiveMode', 'InputLabelProps', 'className', 'inputProps', 'InputProps', 'placeholder', 'showLabelHelp', 'InputLabelHelpProps', 'label', 'KeyboardButtonProps']);
53679
53710
 
53680
53711
  var _React$useState = React__default.useState(classes.icon),
53681
53712
  _React$useState2 = slicedToArray(_React$useState, 2),
@@ -53714,11 +53745,11 @@ function ActiveKeyboardTimePicker(props) {
53714
53745
  disabled: Boolean(readOnly)
53715
53746
  }, inputProps),
53716
53747
  readOnly: readOnly,
53717
- KeyboardButtonProps: {
53748
+ KeyboardButtonProps: _extends$1({}, KeyboardButtonProps, {
53718
53749
  classes: {
53719
53750
  root: '' + (!interactiveMode && !readOnly ? '' : hideIcon)
53720
53751
  }
53721
- },
53752
+ }),
53722
53753
  InputProps: _extends$1({
53723
53754
  classes: {
53724
53755
  root: classes.input + ' ' + (readOnly && classes.inputHover),
@@ -53756,13 +53787,16 @@ ActiveKeyboardTimePicker.propTypes = {
53756
53787
  /** Show label help */
53757
53788
  showLabelHelp: PropTypes__default.bool,
53758
53789
  /** 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}} */
53759
- InputLabelHelpProps: PropTypes__default.object
53790
+ InputLabelHelpProps: PropTypes__default.object,
53791
+ /** Keyboard button props */
53792
+ KeyboardButtonProps: PropTypes__default.object
53760
53793
  };
53761
53794
 
53762
53795
  ActiveKeyboardTimePicker.defaultProps = {
53763
53796
  inputVariant: 'outlined',
53764
53797
  autoOk: true,
53765
- variant: 'inline'
53798
+ variant: 'inline',
53799
+ KeyboardButtonProps: {}
53766
53800
  };
53767
53801
 
53768
53802
  var filter$1 = createFilterOptions();
@@ -54048,7 +54082,8 @@ function ActiveKeyboardDateTimePicker(props) {
54048
54082
  showLabelHelp = props.showLabelHelp,
54049
54083
  InputLabelHelpProps = props.InputLabelHelpProps,
54050
54084
  label = props.label,
54051
- others = objectWithoutProperties(props, ['autoOk', 'variant', 'inputVariant', 'readOnly', 'interactiveMode', 'InputLabelProps', 'className', 'inputProps', 'InputProps', 'placeholder', 'showLabelHelp', 'InputLabelHelpProps', 'label']);
54085
+ KeyboardButtonProps = props.KeyboardButtonProps,
54086
+ others = objectWithoutProperties(props, ['autoOk', 'variant', 'inputVariant', 'readOnly', 'interactiveMode', 'InputLabelProps', 'className', 'inputProps', 'InputProps', 'placeholder', 'showLabelHelp', 'InputLabelHelpProps', 'label', 'KeyboardButtonProps']);
54052
54087
 
54053
54088
  var _React$useState = React__default.useState(classes.icon),
54054
54089
  _React$useState2 = slicedToArray(_React$useState, 2),
@@ -54089,11 +54124,11 @@ function ActiveKeyboardDateTimePicker(props) {
54089
54124
  disabled: Boolean(readOnly)
54090
54125
  }, inputProps),
54091
54126
  readOnly: readOnly,
54092
- KeyboardButtonProps: {
54127
+ KeyboardButtonProps: _extends$1({}, KeyboardButtonProps, {
54093
54128
  classes: {
54094
54129
  root: '' + (!interactiveMode && !readOnly ? '' : hideIcon)
54095
54130
  }
54096
- },
54131
+ }),
54097
54132
  InputProps: _extends$1({
54098
54133
  classes: {
54099
54134
  root: classes.input + ' ' + (readOnly && classes.inputHover),
@@ -54135,14 +54170,17 @@ ActiveKeyboardDateTimePicker.propTypes = {
54135
54170
  /** Show label help */
54136
54171
  showLabelHelp: PropTypes__default.bool,
54137
54172
  /** 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}} */
54138
- InputLabelHelpProps: PropTypes__default.object
54173
+ InputLabelHelpProps: PropTypes__default.object,
54174
+ /** Keyboard button props */
54175
+ KeyboardButtonProps: PropTypes__default.object
54139
54176
  };
54140
54177
 
54141
54178
  ActiveKeyboardDateTimePicker.defaultProps = {
54142
54179
  inputVariant: 'outlined',
54143
54180
  autoOk: true,
54144
54181
  variant: 'inline',
54145
- format: 'dd/MM/yyyy hh:mm a'
54182
+ format: 'dd/MM/yyyy hh:mm a',
54183
+ KeyboardButtonProps: {}
54146
54184
  };
54147
54185
 
54148
54186
  exports.ActiveAutoComplete = ActiveAutoComplete;