@unicef/material-ui 0.8.2 → 0.10.1

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
@@ -11082,6 +11082,65 @@ var debounce = function debounce(func, wait, immediate) {
11082
11082
  return debounced;
11083
11083
  };
11084
11084
 
11085
+ /**
11086
+ *
11087
+ * @param {String} value Value text to be validated
11088
+ * @returns {Boolean} Whether the given value string is a phone number
11089
+ */
11090
+ function isPhoneNumberText(value) {
11091
+ var valueToTest = value || '';
11092
+ var phoneRegexp = new RegExp(/^[0-9.,+-;()\/\extEXT+# ]*$/i);
11093
+ if (!phoneRegexp.test(valueToTest)) {
11094
+ return false;
11095
+ }
11096
+ return true;
11097
+ }
11098
+
11099
+ /**
11100
+ *
11101
+ * @param {String} value Value text to be validated
11102
+ * @returns {Boolean} Whether the given value string contains safe text (no html tags)
11103
+ */
11104
+ function isSafeText(value) {
11105
+ var valueToTest = value || '';
11106
+ var htmlRegexp = new RegExp(/<\/?[a-z][\s\S]*>/i);
11107
+ if (htmlRegexp.test(valueToTest)) {
11108
+ return false;
11109
+ }
11110
+ return true;
11111
+ }
11112
+
11113
+ /**
11114
+ *
11115
+ * @param {String} value Value text to be validated
11116
+ * @returns {Boolean} Whether the given value string is an acceptable alphanumeric text in any language (also spaces are accepted)
11117
+ */
11118
+ function isAlphanumericText(value) {
11119
+ var valueToTest = value || '';
11120
+ // With Unicode Property Escapes, we can match a letter from any language with the following simple regular expression (https://javascript.info/regexp-unicode) => /\p{Letter}/u
11121
+ // Unicode Property Escapes can be transpiled down to ES5 with a tool called regexpu. OR it can be taken from the lib Steve Levithan's XRegExp package with Unicode add-on (https://xregexp.com/plugins/)
11122
+ // The following is transpiled code for all language char with space and numbers
11123
+ // ( taken from https://stackoverflow.com/a/15861883/1874080 with some modifications) :
11124
+
11125
+ var wordsInAllLanguages = /^[\u0041-\u005A\u0061-\u007A\u00AA\u00B5\u00BA\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u0527\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0\u08A2-\u08AC\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0977\u0979-\u097F\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C33\u0C35-\u0C39\u0C3D\u0C58\u0C59\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D60\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191C\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19C1-\u19C7\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA697\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA78E\uA790-\uA793\uA7A0-\uA7AA\uA7F8-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA80-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uABC0-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC\ \0|0-9\0|1-9]*$/;
11126
+
11127
+ return wordsInAllLanguages.test(valueToTest);
11128
+ }
11129
+
11130
+ /**
11131
+ *
11132
+ * @param {String} value Value text to be validated
11133
+ * @returns {Boolean} Whether the given value string is an acceptable url
11134
+ */
11135
+ function isUrlText(value) {
11136
+ var valueToTest = value || '';
11137
+ var urlRegexp = new RegExp('^http(s?)://[0-9a-zA-Z]([-.w]*[0-9a-zA-Z])*?[a-z0-9][-a-z0-9]{0,61}[a-z0-9]\\.[a-z]{2,6}(/[\\w\\s-\\w@\\+\\.~#\\?&/=%]*)?$');
11138
+ if (valueToTest && !urlRegexp.test(valueToTest)) {
11139
+ return false;
11140
+ }
11141
+ return true;
11142
+ }
11143
+
11085
11144
  // It should to be noted that this function isn't equivalent to `text-transform: capitalize`.
11086
11145
  //
11087
11146
  // A strict capitalization should uppercase the first letter of each word a the sentence.
@@ -33877,7 +33936,8 @@ function PositiveNumberFormat(_ref) {
33877
33936
  isNumericString = _ref.isNumericString,
33878
33937
  allowNegative = _ref.allowNegative,
33879
33938
  decimalScale = _ref.decimalScale,
33880
- other = objectWithoutProperties(_ref, ['inputRef', 'name', 'onChange', 'thousandSeparator', 'isNumericString', 'allowNegative', 'decimalScale']);
33939
+ fixedDecimalScale = _ref.fixedDecimalScale,
33940
+ other = objectWithoutProperties(_ref, ['inputRef', 'name', 'onChange', 'thousandSeparator', 'isNumericString', 'allowNegative', 'decimalScale', 'fixedDecimalScale']);
33881
33941
 
33882
33942
  return React__default.createElement(NumberFormat, _extends$1({}, other, {
33883
33943
  getInputRef: inputRef,
@@ -33892,7 +33952,8 @@ function PositiveNumberFormat(_ref) {
33892
33952
  thousandSeparator: thousandSeparator,
33893
33953
  isNumericString: isNumericString,
33894
33954
  allowNegative: allowNegative,
33895
- decimalScale: decimalScale
33955
+ decimalScale: decimalScale,
33956
+ fixedDecimalScale: fixedDecimalScale
33896
33957
  }));
33897
33958
  }
33898
33959
 
@@ -33908,14 +33969,17 @@ PositiveNumberFormat.propTypes = {
33908
33969
  // Is allow negative numbers
33909
33970
  allowNegative: PropTypes__default.bool,
33910
33971
  // No of decimal digits
33911
- decimalScale: PropTypes__default.number
33972
+ decimalScale: PropTypes__default.number,
33973
+ //If true it add 0s to match given decimalScale.
33974
+ fixedDecimalScale: PropTypes__default.bool
33912
33975
  };
33913
33976
 
33914
33977
  PositiveNumberFormat.defaultProps = {
33915
33978
  thousandSeparator: true,
33916
33979
  isNumericString: false,
33917
33980
  allowNegative: false,
33918
- decimalScale: 0
33981
+ decimalScale: 0,
33982
+ fixedDecimalScale: false
33919
33983
  };
33920
33984
 
33921
33985
  var HelpOutline = createCommonjsModule(function (module, exports) {
@@ -46296,7 +46360,10 @@ var defaultErrorMessages = {
46296
46360
  allowedExtensions: 'File type not allowed',
46297
46361
  isUrl: 'It should start with http:// or https://',
46298
46362
  isLatitude: 'It should be between -90 and 90',
46299
- isLongitude: 'It should be between -180 and 180'
46363
+ isLongitude: 'It should be between -180 and 180',
46364
+ isPhone: 'Only numbers,(,),-,.,# and (ext) are allowed',
46365
+ isSafeText: 'HTML not allowed',
46366
+ isAlphanumeric: 'Only letters and numbers are allowed'
46300
46367
  };
46301
46368
 
46302
46369
  /* eslint-disable */
@@ -46340,6 +46407,9 @@ var styles$13 = {
46340
46407
  * * isString
46341
46408
  * * maxFileSize
46342
46409
  * * allowedExtensions
46410
+ * * isPhone
46411
+ * * isAlphanumeric
46412
+ * * isSafeText
46343
46413
  *
46344
46414
  * It accepts all the props of Material-ui [TextField](https://material-ui.com/api/text-field/#textfield-api)
46345
46415
  */
@@ -46569,11 +46639,7 @@ function ForwardRefForm(props, ref) {
46569
46639
  };
46570
46640
 
46571
46641
  lib_2.addValidationRule('isUrl', function (value) {
46572
- var urlRegexp = new RegExp('^http(s?)://[0-9a-zA-Z]([-.w]*[0-9a-zA-Z])*?[a-z0-9][-a-z0-9]{0,61}[a-z0-9]\\.[a-z]{2,6}(/[\\w\\s-\\w@\\+\\.~#\\?&/=%]*)?$');
46573
- if (value != '' && !urlRegexp.test(value)) {
46574
- return false;
46575
- }
46576
- return true;
46642
+ return isUrlText(value);
46577
46643
  });
46578
46644
 
46579
46645
  lib_2.addValidationRule('isLatitude', function (value) {
@@ -46589,6 +46655,18 @@ function ForwardRefForm(props, ref) {
46589
46655
  return true;
46590
46656
  });
46591
46657
 
46658
+ lib_2.addValidationRule('isPhone', function (value) {
46659
+ return isPhoneNumberText(value);
46660
+ });
46661
+
46662
+ lib_2.addValidationRule('isSafeText', function (value) {
46663
+ return isSafeText(value);
46664
+ });
46665
+
46666
+ lib_2.addValidationRule('isAlphanumeric', function (value) {
46667
+ return isAlphanumericText(value);
46668
+ });
46669
+
46592
46670
  return React__default.createElement(lib_2, _extends$1({}, props, { ref: ref }));
46593
46671
  }
46594
46672
 
@@ -46901,32 +46979,22 @@ UPositiveInteger.propTypes = {
46901
46979
  withRequiredValidator: PropTypes__default.bool
46902
46980
  };
46903
46981
 
46904
- var useStyles$n = makeStyles$1(function (theme) {
46905
- return {
46906
- startAdornmentContainer: {
46907
- marginRight: theme.spacing(0.5)
46908
- }
46909
- };
46910
- });
46911
-
46912
46982
  function UCurrencyField(_ref) {
46913
46983
  var inputPrefix = _ref.inputPrefix,
46914
46984
  decimalScale = _ref.decimalScale,
46915
- InputProps = _ref.InputProps,
46985
+ fixedDecimalScale = _ref.fixedDecimalScale,
46986
+ textAlign = _ref.textAlign,
46916
46987
  inputProps = _ref.inputProps,
46917
- props = objectWithoutProperties(_ref, ['inputPrefix', 'decimalScale', 'InputProps', 'inputProps']);
46988
+ props = objectWithoutProperties(_ref, ['inputPrefix', 'decimalScale', 'fixedDecimalScale', 'textAlign', 'inputProps']);
46918
46989
 
46919
- var classes = useStyles$n(props);
46920
46990
  return React__default.createElement(UPositiveInteger, _extends$1({
46921
46991
  variant: 'outlined',
46922
- InputProps: _extends$1({
46923
- startAdornment: React__default.createElement(
46924
- 'span',
46925
- { className: classes.startAdornmentContainer },
46926
- inputPrefix
46927
- )
46928
- }, InputProps),
46929
- inputProps: _extends$1({ decimalScale: decimalScale }, inputProps)
46992
+ inputProps: _extends$1({
46993
+ decimalScale: decimalScale,
46994
+ fixedDecimalScale: fixedDecimalScale,
46995
+ prefix: inputPrefix,
46996
+ style: { textAlign: textAlign }
46997
+ }, inputProps)
46930
46998
  }, props));
46931
46999
  }
46932
47000
 
@@ -46958,12 +47026,18 @@ UCurrencyField.propTypes = {
46958
47026
  /** To make the content readOnly */
46959
47027
  readOnly: PropTypes__default.bool,
46960
47028
  /** Name of input. */
46961
- name: PropTypes__default.string
47029
+ name: PropTypes__default.string,
47030
+ /** Input text align */
47031
+ textAlign: PropTypes__default.string,
47032
+ // If true it add 0s to match given decimalScale.
47033
+ fixedDecimalScale: PropTypes__default.bool
46962
47034
  };
46963
47035
 
46964
47036
  UCurrencyField.defaultProps = {
46965
- inputPrefix: '$',
46966
- decimalScale: 2
47037
+ inputPrefix: '$ ',
47038
+ decimalScale: 2,
47039
+ fixedDecimalScale: true,
47040
+ textAlign: 'right'
46967
47041
  };
46968
47042
 
46969
47043
  function ActiveFormPositiveInteger(_ref) {
@@ -47014,32 +47088,22 @@ ActiveFormPositiveInteger.propTypes = {
47014
47088
  withRequiredValidator: PropTypes__default.bool
47015
47089
  };
47016
47090
 
47017
- var useStyles$o = makeStyles$1(function (theme) {
47018
- return {
47019
- startAdornmentContainer: {
47020
- marginRight: theme.spacing(0.5)
47021
- }
47022
- };
47023
- });
47024
-
47025
47091
  function ActiveCurrencyField(_ref) {
47026
47092
  var inputPrefix = _ref.inputPrefix,
47027
47093
  decimalScale = _ref.decimalScale,
47028
- InputProps = _ref.InputProps,
47094
+ fixedDecimalScale = _ref.fixedDecimalScale,
47095
+ textAlign = _ref.textAlign,
47029
47096
  inputProps = _ref.inputProps,
47030
- props = objectWithoutProperties(_ref, ['inputPrefix', 'decimalScale', 'InputProps', 'inputProps']);
47097
+ props = objectWithoutProperties(_ref, ['inputPrefix', 'decimalScale', 'fixedDecimalScale', 'textAlign', 'inputProps']);
47031
47098
 
47032
- var classes = useStyles$o(props);
47033
47099
  return React__default.createElement(ActiveFormPositiveInteger, _extends$1({
47034
47100
  variant: 'outlined',
47035
- InputProps: _extends$1({
47036
- startAdornment: React__default.createElement(
47037
- 'span',
47038
- { className: classes.startAdornmentContainer },
47039
- inputPrefix
47040
- )
47041
- }, InputProps),
47042
- inputProps: _extends$1({ decimalScale: decimalScale }, inputProps)
47101
+ inputProps: _extends$1({
47102
+ decimalScale: decimalScale,
47103
+ fixedDecimalScale: fixedDecimalScale,
47104
+ prefix: inputPrefix,
47105
+ style: { textAlign: textAlign }
47106
+ }, inputProps)
47043
47107
  }, props));
47044
47108
  }
47045
47109
 
@@ -47081,12 +47145,16 @@ ActiveCurrencyField.propTypes = {
47081
47145
  /** It triggers after each validation.It will return true or false. */
47082
47146
  validatorListener: PropTypes__default.func,
47083
47147
  /** Allow to use required validator in any validation trigger, not only form submit. */
47084
- withRequiredValidator: PropTypes__default.bool
47148
+ withRequiredValidator: PropTypes__default.bool,
47149
+ /** Input text align */
47150
+ textAlign: PropTypes__default.string
47085
47151
  };
47086
47152
 
47087
47153
  ActiveCurrencyField.defaultProps = {
47088
- inputPrefix: '$',
47089
- decimalScale: 2
47154
+ inputPrefix: '$ ',
47155
+ decimalScale: 2,
47156
+ fixedDecimalScale: true,
47157
+ textAlign: 'right'
47090
47158
  };
47091
47159
 
47092
47160
  var DeleteOutlined = createCommonjsModule(function (module, exports) {
@@ -47113,7 +47181,7 @@ exports.default = _default;
47113
47181
 
47114
47182
  var DeleteOutlinedIcon = unwrapExports(DeleteOutlined);
47115
47183
 
47116
- var useStyles$p = makeStyles$1(function (theme) {
47184
+ var useStyles$n = makeStyles$1(function (theme) {
47117
47185
  return {
47118
47186
  menuDelete: {
47119
47187
  width: '500px'
@@ -47133,7 +47201,7 @@ var useStyles$p = makeStyles$1(function (theme) {
47133
47201
  * It has two varint icon/menu item
47134
47202
  */
47135
47203
  function UConfirmationButton(props) {
47136
- var classes = useStyles$p();
47204
+ var classes = useStyles$n();
47137
47205
  var onConfirm = props.onConfirm,
47138
47206
  id = props.id,
47139
47207
  buttonText = props.buttonText,
@@ -47248,7 +47316,7 @@ UConfirmationButton.defaultProps = {
47248
47316
  /**
47249
47317
  * displays radio buttons
47250
47318
  */
47251
- var useStyles$q = makeStyles$1(function (theme) {
47319
+ var useStyles$o = makeStyles$1(function (theme) {
47252
47320
  return {
47253
47321
  padding: {
47254
47322
  paddingLeft: theme.spacing(3)
@@ -47269,7 +47337,7 @@ function URadioButtons(_ref) {
47269
47337
  optionLabels = _ref.optionLabels,
47270
47338
  optionValues = _ref.optionValues;
47271
47339
 
47272
- var classes = useStyles$q();
47340
+ var classes = useStyles$o();
47273
47341
  var handleOnChange = function handleOnChange(event) {
47274
47342
  onChange && onChange(event);
47275
47343
  };
@@ -47373,7 +47441,7 @@ exports.default = _default;
47373
47441
 
47374
47442
  var DoneIcon = unwrapExports(Done);
47375
47443
 
47376
- var useStyles$r = makeStyles$1(function (theme) {
47444
+ var useStyles$p = makeStyles$1(function (theme) {
47377
47445
  return {
47378
47446
  root: {
47379
47447
  position: 'fixed',
@@ -47405,7 +47473,7 @@ function UAsyncBadge(_ref) {
47405
47473
  visible = _ref.visible,
47406
47474
  onReset = _ref.onReset;
47407
47475
 
47408
- var classes = useStyles$r();
47476
+ var classes = useStyles$p();
47409
47477
 
47410
47478
  /** If variant is success or error, after few seconds, it will set asyncResponse visible to false */
47411
47479
  React.useEffect(function () {
@@ -47444,7 +47512,7 @@ UAsyncBadge.propTypes = {
47444
47512
  onReset: PropTypes__default.func
47445
47513
  };
47446
47514
 
47447
- var useStyles$s = makeStyles$1(function () {
47515
+ var useStyles$q = makeStyles$1(function () {
47448
47516
  return {
47449
47517
  pageLoadingProgress: {
47450
47518
  height: '50vh',
@@ -47459,7 +47527,7 @@ var useStyles$s = makeStyles$1(function () {
47459
47527
  * 2. Display text message
47460
47528
  */
47461
47529
  function UPageLoadingProgress(props) {
47462
- var classes = useStyles$s();
47530
+ var classes = useStyles$q();
47463
47531
  var text = props.text;
47464
47532
 
47465
47533
  return React__default.createElement(
@@ -49312,7 +49380,7 @@ UErrorAlert.defaultProps = {
49312
49380
 
49313
49381
  var filter = createFilterOptions();
49314
49382
 
49315
- var useStyles$t = makeStyles$1(function (theme) {
49383
+ var useStyles$r = makeStyles$1(function (theme) {
49316
49384
  return {
49317
49385
  controlStyle: {
49318
49386
  marginTop: theme.spacing(2),
@@ -49338,9 +49406,12 @@ function UAutoComplete(_ref) {
49338
49406
  maxLength = _ref.maxLength,
49339
49407
  usedItemIds = _ref.usedItemIds,
49340
49408
  allowContextSpecific = _ref.allowContextSpecific,
49409
+ counter = _ref.counter,
49410
+ placeholder = _ref.placeholder,
49411
+ InputLabelProps = _ref.InputLabelProps,
49341
49412
  props = _ref.props;
49342
49413
 
49343
- var classes = useStyles$t();
49414
+ var classes = useStyles$r();
49344
49415
  //const dispatch = useDispatch()
49345
49416
 
49346
49417
  var _useState = React.useState(value || null),
@@ -49398,16 +49469,19 @@ function UAutoComplete(_ref) {
49398
49469
  var controlOptions = options && options.length > 0 ? options.filter(function (opt) {
49399
49470
  return !usedItemIds.includes(opt.id);
49400
49471
  }) : [];
49401
-
49402
49472
  return React__default.createElement(
49403
49473
  React__default.Fragment,
49404
49474
  null,
49405
49475
  readOnly ? React__default.createElement(ActiveFormTextField, {
49406
49476
  multiline: true,
49407
- label: label + '*',
49477
+ label: label,
49478
+ InputLabelProps: _extends$1({}, InputLabelProps, {
49479
+ required: isRequired
49480
+ }),
49408
49481
  variant: 'outlined',
49409
49482
  fullWidth: true,
49410
49483
  readOnly: readOnly,
49484
+ placeholder: placeholder,
49411
49485
  value: selectedValue && selectedValue.text
49412
49486
  }) : React__default.createElement(Autocomplete$1, {
49413
49487
  value: selectedValue,
@@ -49438,7 +49512,7 @@ function UAutoComplete(_ref) {
49438
49512
  renderInput: function renderInput(params) {
49439
49513
  return React__default.createElement(ActiveFormTextField, _extends$1({}, params, {
49440
49514
  multiline: true,
49441
- label: '' + label + (isRequired ? '*' : ''),
49515
+ label: label,
49442
49516
  variant: 'outlined',
49443
49517
  value: selectedValue && selectedValue.text || '',
49444
49518
  validators: isRequired ? ['required', 'trim'] : ['trim'],
@@ -49447,8 +49521,13 @@ function UAutoComplete(_ref) {
49447
49521
  minLength: minLength,
49448
49522
  maxLength: maxLength
49449
49523
  }),
49524
+ InputLabelProps: _extends$1({}, InputLabelProps, {
49525
+ required: isRequired
49526
+ }),
49450
49527
  maxLength: maxLength,
49451
- counter: true
49528
+ counter: counter,
49529
+ placeholder: placeholder,
49530
+ readOnly: readOnly
49452
49531
  }));
49453
49532
  }
49454
49533
  })
@@ -49479,17 +49558,24 @@ UAutoComplete.propTypes = {
49479
49558
  /** can create context specific item or not */
49480
49559
  allowContextSpecific: PropTypes__default.bool,
49481
49560
  /** used item id's from the options */
49482
- usedItemIds: PropTypes__default.array
49561
+ usedItemIds: PropTypes__default.array,
49562
+ /** To enable character counter */
49563
+ counter: PropTypes__default.bool,
49564
+ /** placeholder text*/
49565
+ placeholder: PropTypes__default.string,
49566
+ /** Label props applied to input field*/
49567
+ InputLabelProps: PropTypes__default.object
49483
49568
  };
49484
49569
 
49485
49570
  UAutoComplete.defaultProps = {
49486
49571
  allowContextSpecific: false,
49572
+ counter: false,
49487
49573
  usedItemIds: []
49488
49574
  };
49489
49575
 
49490
49576
  /* eslint-disable no-nested-ternary */
49491
49577
 
49492
- var useStyles$u = makeStyles$1(function (theme) {
49578
+ var useStyles$s = makeStyles$1(function (theme) {
49493
49579
  var _ref;
49494
49580
 
49495
49581
  return _ref = {
@@ -49521,7 +49607,7 @@ var useStyles$u = makeStyles$1(function (theme) {
49521
49607
  * Breadcrumbs is a component to implement current user path of the application
49522
49608
  */
49523
49609
  function UBreadcrumbs(props) {
49524
- var classes = useStyles$u();
49610
+ var classes = useStyles$s();
49525
49611
  var breadcrumbLinks = props.breadcrumbLinks;
49526
49612
 
49527
49613
 
@@ -49598,7 +49684,7 @@ UInfiniteScroll.propTypes = {
49598
49684
  onEndOfScroll: PropTypes__default.func
49599
49685
  };
49600
49686
 
49601
- var useStyles$v = makeStyles$1(function (theme) {
49687
+ var useStyles$t = makeStyles$1(function (theme) {
49602
49688
  return {
49603
49689
  small: {
49604
49690
  width: theme.spacing(4),
@@ -49643,7 +49729,7 @@ function UAvatarImage(_ref) {
49643
49729
  zIndexValue = _ref.zIndexValue,
49644
49730
  loadPhoto = _ref.loadPhoto;
49645
49731
 
49646
- var classes = useStyles$v();
49732
+ var classes = useStyles$t();
49647
49733
 
49648
49734
  var _useState = React.useState(''),
49649
49735
  _useState2 = slicedToArray(_useState, 2),
@@ -50075,7 +50161,7 @@ exports.default = _default;
50075
50161
 
50076
50162
  var CloseIcon$1 = unwrapExports(Close);
50077
50163
 
50078
- var useStyles$w = makeStyles$1(function (theme) {
50164
+ var useStyles$u = makeStyles$1(function (theme) {
50079
50165
  return {
50080
50166
  root: {
50081
50167
  width: '100%',
@@ -50115,7 +50201,7 @@ function USearchBox(_ref) {
50115
50201
  searchValue = _useState2[0],
50116
50202
  setSearch = _useState2[1];
50117
50203
 
50118
- var classes = useStyles$w();
50204
+ var classes = useStyles$u();
50119
50205
 
50120
50206
  var handleChange = function handleChange(event) {
50121
50207
  setSearch(event.target.value);
@@ -50216,7 +50302,7 @@ var styles$16 = {
50216
50302
  }
50217
50303
  };
50218
50304
 
50219
- var useStyles$x = makeStyles$1(function (theme) {
50305
+ var useStyles$v = makeStyles$1(function (theme) {
50220
50306
  return {
50221
50307
  textField: {
50222
50308
  marginTop: theme.spacing(0.25),
@@ -50259,7 +50345,7 @@ var useStyles$x = makeStyles$1(function (theme) {
50259
50345
  * ActiveKeyboardDatePicker is a customized [Material Ui KeyboardDatePicker]('https://material-ui-pickers.dev/api/KeyboardDatePicker') for more details
50260
50346
  */
50261
50347
  function ActiveKeyboardDatePicker(props) {
50262
- var classes = useStyles$x(props);
50348
+ var classes = useStyles$v(props);
50263
50349
  var autoOk = props.autoOk,
50264
50350
  variant = props.variant,
50265
50351
  inputVariant = props.inputVariant,
@@ -50378,7 +50464,7 @@ var styles$17 = {
50378
50464
  }
50379
50465
  };
50380
50466
 
50381
- var useStyles$y = makeStyles$1(function (theme) {
50467
+ var useStyles$w = makeStyles$1(function (theme) {
50382
50468
  return {
50383
50469
  textField: {
50384
50470
  marginTop: theme.spacing(0.25),
@@ -50417,7 +50503,7 @@ var useStyles$y = makeStyles$1(function (theme) {
50417
50503
  * Please have look at [Material Ui Date Picker]('https://material-ui-pickers.dev/api/DatePicker') for more details
50418
50504
  */
50419
50505
  function ActiveDatePicker(props) {
50420
- var classes = useStyles$y(props);
50506
+ var classes = useStyles$w(props);
50421
50507
  var autoOk = props.autoOk,
50422
50508
  variant = props.variant,
50423
50509
  inputVariant = props.inputVariant,
@@ -50511,7 +50597,7 @@ var styles$18 = {
50511
50597
  }
50512
50598
  };
50513
50599
 
50514
- var useStyles$z = makeStyles$1(function (theme) {
50600
+ var useStyles$x = makeStyles$1(function (theme) {
50515
50601
  return {
50516
50602
  textField: {
50517
50603
  marginTop: theme.spacing(0.25),
@@ -50550,7 +50636,7 @@ var useStyles$z = makeStyles$1(function (theme) {
50550
50636
  * Please have look at [Material Ui TimePicker]('https://material-ui-pickers.dev/api/TimePicker') for more details
50551
50637
  */
50552
50638
  function ActiveTimePicker(props) {
50553
- var classes = useStyles$z(props);
50639
+ var classes = useStyles$x(props);
50554
50640
  var inputVariant = props.inputVariant,
50555
50641
  readOnly = props.readOnly,
50556
50642
  interactiveMode = props.interactiveMode,
@@ -50635,7 +50721,7 @@ var styles$19 = {
50635
50721
  }
50636
50722
  };
50637
50723
 
50638
- var useStyles$A = makeStyles$1(function (theme) {
50724
+ var useStyles$y = makeStyles$1(function (theme) {
50639
50725
  return {
50640
50726
  textField: {
50641
50727
  marginTop: theme.spacing(0.25),
@@ -50678,7 +50764,7 @@ var useStyles$A = makeStyles$1(function (theme) {
50678
50764
  * ActiveKeyboardTimePicker is customized [ Material Ui KeyboardTimePicker](https://material-ui-pickers.dev/api/KeyboardTimePicker)
50679
50765
  */
50680
50766
  function ActiveKeyboardTimePicker(props) {
50681
- var classes = useStyles$A(props);
50767
+ var classes = useStyles$y(props);
50682
50768
  var inputVariant = props.inputVariant,
50683
50769
  readOnly = props.readOnly,
50684
50770
  interactiveMode = props.interactiveMode,
@@ -50780,6 +50866,224 @@ ActiveKeyboardTimePicker.defaultProps = {
50780
50866
  variant: 'inline'
50781
50867
  };
50782
50868
 
50869
+ var filter$1 = createFilterOptions();
50870
+
50871
+ var useStyles$z = makeStyles$1(function (theme) {
50872
+ return {
50873
+ root: {
50874
+ marginTop: theme.spacing(2),
50875
+ width: '100%',
50876
+ '& .UPopupIndicator': {
50877
+ visibility: 'hidden'
50878
+ },
50879
+ '&:hover': {
50880
+ '& .UPopupIndicator': {
50881
+ visibility: 'visible'
50882
+ }
50883
+ }
50884
+ },
50885
+ focused: {
50886
+ '& .UPopupIndicator': {
50887
+ visibility: 'visible'
50888
+ }
50889
+ }
50890
+ };
50891
+ });
50892
+ /**
50893
+ * ActiveAutoComplete is an editable dropdown component with interactive.
50894
+ * User can enter the text in order to find the value from the list of values
50895
+ * User can also add new value to the list as well.
50896
+ */
50897
+ function ActiveAutoComplete(_ref) {
50898
+ var value = _ref.value,
50899
+ label = _ref.label,
50900
+ onChange = _ref.onChange,
50901
+ isRequired = _ref.isRequired,
50902
+ onBlur = _ref.onBlur,
50903
+ name = _ref.name,
50904
+ options = _ref.options,
50905
+ readOnly = _ref.readOnly,
50906
+ minLength = _ref.minLength,
50907
+ maxLength = _ref.maxLength,
50908
+ usedItemIds = _ref.usedItemIds,
50909
+ allowContextSpecific = _ref.allowContextSpecific,
50910
+ interactiveMode = _ref.interactiveMode,
50911
+ counter = _ref.counter,
50912
+ placeholder = _ref.placeholder,
50913
+ InputLabelProps = _ref.InputLabelProps,
50914
+ props = _ref.props;
50915
+
50916
+ var classes = useStyles$z();
50917
+ //const dispatch = useDispatch()
50918
+
50919
+ var _useState = React.useState(value || null),
50920
+ _useState2 = slicedToArray(_useState, 2),
50921
+ selectedValue = _useState2[0],
50922
+ setSelectedValue = _useState2[1]; // for initialization: avoid the control to be a uncontrolled component with 'undefined'
50923
+
50924
+ var handleChange = function handleChange(event, newValue) {
50925
+ // Create a new value from the user input
50926
+ if (newValue && newValue.inputValue) {
50927
+ setSelectedValue({
50928
+ text: newValue.inputValue
50929
+ });
50930
+ onChange({
50931
+ text: newValue.inputValue
50932
+ });
50933
+ return;
50934
+ }
50935
+ setSelectedValue(newValue);
50936
+ onChange && onChange(newValue, name);
50937
+ };
50938
+
50939
+ var handleFilter = function handleFilter(options, params) {
50940
+ var filtered = filter$1(options, params);
50941
+ var labelForMessage = label && label.toLowerCase();
50942
+ // Suggest the creation of a new value
50943
+ if (params.inputValue !== '' && allowContextSpecific) {
50944
+ filtered.push({
50945
+ inputValue: params.inputValue,
50946
+ text: 'Use context-specific ' + (labelForMessage ? labelForMessage : '') + ' "' + params.inputValue + '"'
50947
+ });
50948
+ }
50949
+ return filtered;
50950
+ };
50951
+
50952
+ var handleGetOption = function handleGetOption(option) {
50953
+ // Value selected with enter, right from the input
50954
+ if (typeof option === 'string') {
50955
+ return option;
50956
+ }
50957
+ // Add "new" option created dynamically
50958
+ if (option.inputValue) {
50959
+ return option.inputValue;
50960
+ }
50961
+ // Regular option
50962
+ return option.text || '';
50963
+ };
50964
+
50965
+ var handleOnBlur = function handleOnBlur(e) {
50966
+ if (selectedValue && selectedValue.text && selectedValue.text.trim() !== '') {
50967
+ onBlur && onBlur(e, name);
50968
+ }
50969
+ };
50970
+
50971
+ var controlOptions = options && options.length > 0 ? options.filter(function (opt) {
50972
+ return !usedItemIds.includes(opt.id);
50973
+ }) : [];
50974
+ return React__default.createElement(
50975
+ React__default.Fragment,
50976
+ null,
50977
+ !interactiveMode && readOnly ? React__default.createElement(ActiveFormTextField, {
50978
+ multiline: true,
50979
+ label: label,
50980
+ InputLabelProps: _extends$1({}, InputLabelProps, {
50981
+ required: isRequired
50982
+ }),
50983
+ variant: 'outlined',
50984
+ fullWidth: true,
50985
+ readOnly: readOnly,
50986
+ placeholder: placeholder,
50987
+ value: selectedValue && selectedValue.text
50988
+ }) : React__default.createElement(Autocomplete$1, {
50989
+ value: selectedValue,
50990
+ getOptionSelected: function getOptionSelected(option) {
50991
+ return option.id === selectedValue.id;
50992
+ },
50993
+ onChange: function onChange(event, newValue) {
50994
+ return handleChange(event, newValue);
50995
+ },
50996
+ filterOptions: function filterOptions(options, params) {
50997
+ return handleFilter(options, params);
50998
+ },
50999
+ id: 'target-input',
51000
+ name: name,
51001
+ selectOnFocus: true,
51002
+ clearOnBlur: true,
51003
+ handleHomeEndKeys: true,
51004
+ options: controlOptions,
51005
+ getOptionLabel: function getOptionLabel(option) {
51006
+ return handleGetOption(option);
51007
+ },
51008
+ renderOption: function renderOption(option) {
51009
+ return option.text;
51010
+ },
51011
+ onBlur: handleOnBlur,
51012
+ classes: {
51013
+ root: classes.root,
51014
+ focused: classes.focused,
51015
+ popupIndicator: 'UPopupIndicator'
51016
+ },
51017
+ freeSolo: allowContextSpecific,
51018
+ renderInput: function renderInput(params) {
51019
+ return React__default.createElement(ActiveFormTextField, _extends$1({}, params, {
51020
+ multiline: true,
51021
+ label: label,
51022
+ variant: 'outlined',
51023
+ value: selectedValue && selectedValue.text || '',
51024
+ validators: isRequired ? ['required', 'trim'] : ['trim'],
51025
+ fullWidth: true,
51026
+ inputProps: _extends$1({}, params.inputProps, {
51027
+ minLength: minLength,
51028
+ maxLength: maxLength
51029
+ }),
51030
+ InputLabelProps: _extends$1({}, InputLabelProps, {
51031
+ required: isRequired
51032
+ }),
51033
+ maxLength: maxLength,
51034
+ counter: counter,
51035
+ interactiveMode: interactiveMode,
51036
+ placeholder: placeholder,
51037
+ readOnly: readOnly
51038
+ }));
51039
+ }
51040
+ })
51041
+ );
51042
+ }
51043
+
51044
+ ActiveAutoComplete.propTypes = {
51045
+ /** selected value of the dropdown */
51046
+ value: PropTypes__default.object,
51047
+ /** label */
51048
+ label: PropTypes__default.string,
51049
+ /** options to display */
51050
+ options: PropTypes__default.array,
51051
+ /** dropdown on change event */
51052
+ onChange: PropTypes__default.func,
51053
+ /** enable required validator */
51054
+ isRequired: PropTypes__default.bool,
51055
+ /** enable required error in dropdown */
51056
+ hasError: PropTypes__default.bool,
51057
+ /** onBlur event for dropdown */
51058
+ onBlur: PropTypes__default.func,
51059
+ /** name of the dropdown */
51060
+ name: PropTypes__default.string,
51061
+ /** max length text */
51062
+ maxLength: PropTypes__default.number,
51063
+ /** min length text */
51064
+ minLength: PropTypes__default.number,
51065
+ /** can create context specific item or not */
51066
+ allowContextSpecific: PropTypes__default.bool,
51067
+ /** used item id's from the options */
51068
+ usedItemIds: PropTypes__default.array,
51069
+ /** Change to write mode by hiding text field border and displays border on hover*/
51070
+ interactiveMode: PropTypes__default.bool,
51071
+ /** To enable character counter */
51072
+ counter: PropTypes__default.bool,
51073
+ /** placeholder text*/
51074
+ placeholder: PropTypes__default.string,
51075
+ /** Label props applied to input field*/
51076
+ InputLabelProps: PropTypes__default.object
51077
+ };
51078
+
51079
+ ActiveAutoComplete.defaultProps = {
51080
+ allowContextSpecific: false,
51081
+ interactiveMode: false,
51082
+ counter: false,
51083
+ usedItemIds: []
51084
+ };
51085
+
51086
+ exports.ActiveAutoComplete = ActiveAutoComplete;
50783
51087
  exports.ActiveCurrencyField = ActiveCurrencyField;
50784
51088
  exports.ActiveDatePicker = ActiveDatePicker;
50785
51089
  exports.ActiveFormCoordinateField = ActiveFormCoordinateField;