@unicef/material-ui 0.8.1 → 0.10.0

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/README.md CHANGED
@@ -111,6 +111,25 @@ cd ..
111
111
  npm deploy
112
112
  ```
113
113
 
114
+ ## Release a new version in npm registry
115
+
116
+ There is a Github action (pipeline) that automatically releases in npm whenever a release is created.
117
+ To create a release, previously you need to ensure the version is changed in packages.json and then create a tag in the repository. These are the steps:
118
+
119
+ 1. Get the latest `master`
120
+ 2. Edit `packages.json` and increase the version number and save to origin/master.
121
+ ```bash
122
+ # After editing packages.json
123
+ git commit -m "bump version x.y.z"
124
+ git push origin master
125
+ ```
126
+ 3. Create a tag and push it to master:
127
+ ```bash
128
+ git tag releases/vX.Y.Z # where X.Y.Z is a semver number such as 1.6.9
129
+ git push origin tags
130
+ ```
131
+ 4. Then in the GitHub web interface create the release. The action will be automatically triggered.
132
+
114
133
  ## About UNICEF
115
134
 
116
135
  [UNICEF](https://www.unicef.org/) works in over 190 countries and territories to protect the rights of every child. UNICEF has spent more than 70 years working to improve the lives of children and their families. In UNICEF, **we believe all children have a right to survive, thrive and fulfill their potential – to the benefit of a better world**.
package/lib/dev.js CHANGED
@@ -11503,6 +11503,65 @@ var debounce = function debounce(func, wait, immediate) {
11503
11503
  return debounced;
11504
11504
  };
11505
11505
 
11506
+ /**
11507
+ *
11508
+ * @param {String} value Value text to be validated
11509
+ * @returns {Boolean} Whether the given value string is a phone number
11510
+ */
11511
+ function isPhoneNumberText(value) {
11512
+ var valueToTest = value || '';
11513
+ var phoneRegexp = new RegExp(/^[0-9.,+-;()\/\extEXT+# ]*$/i);
11514
+ if (!phoneRegexp.test(valueToTest)) {
11515
+ return false;
11516
+ }
11517
+ return true;
11518
+ }
11519
+
11520
+ /**
11521
+ *
11522
+ * @param {String} value Value text to be validated
11523
+ * @returns {Boolean} Whether the given value string contains safe text (no html tags)
11524
+ */
11525
+ function isSafeText(value) {
11526
+ var valueToTest = value || '';
11527
+ var htmlRegexp = new RegExp(/<\/?[a-z][\s\S]*>/i);
11528
+ if (htmlRegexp.test(valueToTest)) {
11529
+ return false;
11530
+ }
11531
+ return true;
11532
+ }
11533
+
11534
+ /**
11535
+ *
11536
+ * @param {String} value Value text to be validated
11537
+ * @returns {Boolean} Whether the given value string is an acceptable alphanumeric text in any language (also spaces are accepted)
11538
+ */
11539
+ function isAlphanumericText(value) {
11540
+ var valueToTest = value || '';
11541
+ // 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
11542
+ // 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/)
11543
+ // The following is transpiled code for all language char with space and numbers
11544
+ // ( taken from https://stackoverflow.com/a/15861883/1874080 with some modifications) :
11545
+
11546
+ 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]*$/;
11547
+
11548
+ return wordsInAllLanguages.test(valueToTest);
11549
+ }
11550
+
11551
+ /**
11552
+ *
11553
+ * @param {String} value Value text to be validated
11554
+ * @returns {Boolean} Whether the given value string is an acceptable url
11555
+ */
11556
+ function isUrlText(value) {
11557
+ var valueToTest = value || '';
11558
+ 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@\\+\\.~#\\?&/=%]*)?$');
11559
+ if (valueToTest && !urlRegexp.test(valueToTest)) {
11560
+ return false;
11561
+ }
11562
+ return true;
11563
+ }
11564
+
11506
11565
  // It should to be noted that this function isn't equivalent to `text-transform: capitalize`.
11507
11566
  //
11508
11567
  // A strict capitalization should uppercase the first letter of each word a the sentence.
@@ -40029,7 +40088,8 @@ function PositiveNumberFormat(_ref) {
40029
40088
  isNumericString = _ref.isNumericString,
40030
40089
  allowNegative = _ref.allowNegative,
40031
40090
  decimalScale = _ref.decimalScale,
40032
- other = objectWithoutProperties(_ref, ['inputRef', 'name', 'onChange', 'thousandSeparator', 'isNumericString', 'allowNegative', 'decimalScale']);
40091
+ fixedDecimalScale = _ref.fixedDecimalScale,
40092
+ other = objectWithoutProperties(_ref, ['inputRef', 'name', 'onChange', 'thousandSeparator', 'isNumericString', 'allowNegative', 'decimalScale', 'fixedDecimalScale']);
40033
40093
 
40034
40094
  return React__default.createElement(NumberFormat, _extends$1({}, other, {
40035
40095
  getInputRef: inputRef,
@@ -40044,7 +40104,8 @@ function PositiveNumberFormat(_ref) {
40044
40104
  thousandSeparator: thousandSeparator,
40045
40105
  isNumericString: isNumericString,
40046
40106
  allowNegative: allowNegative,
40047
- decimalScale: decimalScale
40107
+ decimalScale: decimalScale,
40108
+ fixedDecimalScale: fixedDecimalScale
40048
40109
  }));
40049
40110
  }
40050
40111
 
@@ -40060,14 +40121,17 @@ PositiveNumberFormat.propTypes = {
40060
40121
  // Is allow negative numbers
40061
40122
  allowNegative: PropTypes__default.bool,
40062
40123
  // No of decimal digits
40063
- decimalScale: PropTypes__default.number
40124
+ decimalScale: PropTypes__default.number,
40125
+ //If true it add 0s to match given decimalScale.
40126
+ fixedDecimalScale: PropTypes__default.bool
40064
40127
  };
40065
40128
 
40066
40129
  PositiveNumberFormat.defaultProps = {
40067
40130
  thousandSeparator: true,
40068
40131
  isNumericString: false,
40069
40132
  allowNegative: false,
40070
- decimalScale: 0
40133
+ decimalScale: 0,
40134
+ fixedDecimalScale: false
40071
40135
  };
40072
40136
 
40073
40137
  var HelpOutline = createCommonjsModule(function (module, exports) {
@@ -52907,7 +52971,10 @@ var defaultErrorMessages = {
52907
52971
  allowedExtensions: 'File type not allowed',
52908
52972
  isUrl: 'It should start with http:// or https://',
52909
52973
  isLatitude: 'It should be between -90 and 90',
52910
- isLongitude: 'It should be between -180 and 180'
52974
+ isLongitude: 'It should be between -180 and 180',
52975
+ isPhone: 'Only numbers,(,),-,.,# and (ext) are allowed',
52976
+ isSafeText: 'HTML not allowed',
52977
+ isAlphanumeric: 'Only letters and numbers are allowed'
52911
52978
  };
52912
52979
 
52913
52980
  /* eslint-disable */
@@ -52951,6 +53018,9 @@ var styles$13 = {
52951
53018
  * * isString
52952
53019
  * * maxFileSize
52953
53020
  * * allowedExtensions
53021
+ * * isPhone
53022
+ * * isAlphanumeric
53023
+ * * isSafeText
52954
53024
  *
52955
53025
  * It accepts all the props of Material-ui [TextField](https://material-ui.com/api/text-field/#textfield-api)
52956
53026
  */
@@ -53180,11 +53250,7 @@ function ForwardRefForm(props, ref) {
53180
53250
  };
53181
53251
 
53182
53252
  lib_2.addValidationRule('isUrl', function (value) {
53183
- 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@\\+\\.~#\\?&/=%]*)?$');
53184
- if (value != '' && !urlRegexp.test(value)) {
53185
- return false;
53186
- }
53187
- return true;
53253
+ return isUrlText(value);
53188
53254
  });
53189
53255
 
53190
53256
  lib_2.addValidationRule('isLatitude', function (value) {
@@ -53200,6 +53266,18 @@ function ForwardRefForm(props, ref) {
53200
53266
  return true;
53201
53267
  });
53202
53268
 
53269
+ lib_2.addValidationRule('isPhone', function (value) {
53270
+ return isPhoneNumberText(value);
53271
+ });
53272
+
53273
+ lib_2.addValidationRule('isSafeText', function (value) {
53274
+ return isSafeText(value);
53275
+ });
53276
+
53277
+ lib_2.addValidationRule('isAlphanumeric', function (value) {
53278
+ return isAlphanumericText(value);
53279
+ });
53280
+
53203
53281
  return React__default.createElement(lib_2, _extends$1({}, props, { ref: ref }));
53204
53282
  }
53205
53283
 
@@ -53512,6 +53590,67 @@ UPositiveInteger.propTypes = {
53512
53590
  withRequiredValidator: PropTypes__default.bool
53513
53591
  };
53514
53592
 
53593
+ function UCurrencyField(_ref) {
53594
+ var inputPrefix = _ref.inputPrefix,
53595
+ decimalScale = _ref.decimalScale,
53596
+ fixedDecimalScale = _ref.fixedDecimalScale,
53597
+ textAlign = _ref.textAlign,
53598
+ inputProps = _ref.inputProps,
53599
+ props = objectWithoutProperties(_ref, ['inputPrefix', 'decimalScale', 'fixedDecimalScale', 'textAlign', 'inputProps']);
53600
+
53601
+ return React__default.createElement(UPositiveInteger, _extends$1({
53602
+ variant: 'outlined',
53603
+ inputProps: _extends$1({
53604
+ decimalScale: decimalScale,
53605
+ fixedDecimalScale: fixedDecimalScale,
53606
+ prefix: inputPrefix,
53607
+ style: { textAlign: textAlign }
53608
+ }, inputProps)
53609
+ }, props));
53610
+ }
53611
+
53612
+ UCurrencyField.propTypes = {
53613
+ /** label */
53614
+ label: PropTypes__default.string,
53615
+ /** placeholder text*/
53616
+ placeholder: PropTypes__default.string,
53617
+ /**
53618
+ * Array of validators.See list of default validators above.
53619
+ *
53620
+ * Ex: `validators={['required', 'isEmail']}`
53621
+ */
53622
+ validators: PropTypes__default.array,
53623
+ /** Attributes applied to the input element. */
53624
+ inputProps: PropTypes__default.object,
53625
+ /** Props applied to the Input element. */
53626
+ InputProps: PropTypes__default.object,
53627
+ /** Prefix string for the input. */
53628
+ inputPrefix: PropTypes__default.string,
53629
+ /** Decimal digit number to be used as default. */
53630
+ decimalScale: PropTypes__default.number,
53631
+ /**
53632
+ * customErrorMessages is an object with key as validator and value as customised error message.
53633
+ *
53634
+ * Ex: `customErrorMessages={{required: 'This field is required'}`
53635
+ */
53636
+ customErrorMessages: PropTypes__default.object,
53637
+ /** To make the content readOnly */
53638
+ readOnly: PropTypes__default.bool,
53639
+ /** Name of input. */
53640
+ name: PropTypes__default.string,
53641
+ /** Input text align */
53642
+ textAlign: PropTypes__default.string,
53643
+ // If true it add 0s to match given decimalScale.
53644
+ fixedDecimalScale: PropTypes__default.bool
53645
+ };
53646
+
53647
+ UCurrencyField.defaultProps = {
53648
+ inputPrefix: '$ ',
53649
+ decimalScale: 2,
53650
+ fixedDecimalScale: true,
53651
+ textAlign: 'right'
53652
+ };
53653
+
53515
53654
  function ActiveFormPositiveInteger(_ref) {
53516
53655
  var InputProps = _ref.InputProps,
53517
53656
  props = objectWithoutProperties(_ref, ['InputProps']);
@@ -53560,6 +53699,75 @@ ActiveFormPositiveInteger.propTypes = {
53560
53699
  withRequiredValidator: PropTypes__default.bool
53561
53700
  };
53562
53701
 
53702
+ function ActiveCurrencyField(_ref) {
53703
+ var inputPrefix = _ref.inputPrefix,
53704
+ decimalScale = _ref.decimalScale,
53705
+ fixedDecimalScale = _ref.fixedDecimalScale,
53706
+ textAlign = _ref.textAlign,
53707
+ inputProps = _ref.inputProps,
53708
+ props = objectWithoutProperties(_ref, ['inputPrefix', 'decimalScale', 'fixedDecimalScale', 'textAlign', 'inputProps']);
53709
+
53710
+ return React__default.createElement(ActiveFormPositiveInteger, _extends$1({
53711
+ variant: 'outlined',
53712
+ inputProps: _extends$1({
53713
+ decimalScale: decimalScale,
53714
+ fixedDecimalScale: fixedDecimalScale,
53715
+ prefix: inputPrefix,
53716
+ style: { textAlign: textAlign }
53717
+ }, inputProps)
53718
+ }, props));
53719
+ }
53720
+
53721
+ ActiveCurrencyField.propTypes = {
53722
+ /** label */
53723
+ label: PropTypes__default.string,
53724
+ /** placeholder text*/
53725
+ placeholder: PropTypes__default.string,
53726
+ /** Typography for text inside the input (Ex: h1, div, etc.) */
53727
+ typographyVariant: PropTypes__default.string,
53728
+ /** Input has some default padding already, to make changes to it pass padding like `inputPadding='0px 2px'` */
53729
+ inputPadding: PropTypes__default.string,
53730
+ /** To hide or display the textfied border*/
53731
+ showBorder: PropTypes__default.bool,
53732
+ /**
53733
+ * Array of validators.See list of default validators above.
53734
+ *
53735
+ * Ex: `validators={['required', 'isEmail']}`
53736
+ */
53737
+ validators: PropTypes__default.array,
53738
+ /** Attributes applied to the input element. */
53739
+ inputProps: PropTypes__default.object,
53740
+ /** Props applied to the Input element. */
53741
+ InputProps: PropTypes__default.object,
53742
+ /** Prefix string for the input. */
53743
+ inputPrefix: PropTypes__default.string,
53744
+ /** Decimal digit number to be used as default. */
53745
+ decimalScale: PropTypes__default.number,
53746
+ /**
53747
+ * customErrorMessages is an object with key as validator and value as customised error message.
53748
+ *
53749
+ * Ex: `customErrorMessages={{required: 'This field is required'}`
53750
+ */
53751
+ customErrorMessages: PropTypes__default.object,
53752
+ /** To make the content readOnly */
53753
+ readOnly: PropTypes__default.bool,
53754
+ /** Name of input. */
53755
+ name: PropTypes__default.string,
53756
+ /** It triggers after each validation.It will return true or false. */
53757
+ validatorListener: PropTypes__default.func,
53758
+ /** Allow to use required validator in any validation trigger, not only form submit. */
53759
+ withRequiredValidator: PropTypes__default.bool,
53760
+ /** Input text align */
53761
+ textAlign: PropTypes__default.string
53762
+ };
53763
+
53764
+ ActiveCurrencyField.defaultProps = {
53765
+ inputPrefix: '$ ',
53766
+ decimalScale: 2,
53767
+ fixedDecimalScale: true,
53768
+ textAlign: 'right'
53769
+ };
53770
+
53563
53771
  var DeleteOutlined = createCommonjsModule(function (module, exports) {
53564
53772
 
53565
53773
 
@@ -56339,6 +56547,9 @@ function UAutoComplete(_ref) {
56339
56547
  maxLength = _ref.maxLength,
56340
56548
  usedItemIds = _ref.usedItemIds,
56341
56549
  allowContextSpecific = _ref.allowContextSpecific,
56550
+ counter = _ref.counter,
56551
+ placeholder = _ref.placeholder,
56552
+ InputLabelProps = _ref.InputLabelProps,
56342
56553
  props = _ref.props;
56343
56554
 
56344
56555
  var classes = useStyles$r();
@@ -56399,16 +56610,19 @@ function UAutoComplete(_ref) {
56399
56610
  var controlOptions = options && options.length > 0 ? options.filter(function (opt) {
56400
56611
  return !usedItemIds.includes(opt.id);
56401
56612
  }) : [];
56402
-
56403
56613
  return React__default.createElement(
56404
56614
  React__default.Fragment,
56405
56615
  null,
56406
56616
  readOnly ? React__default.createElement(ActiveFormTextField, {
56407
56617
  multiline: true,
56408
- label: label + '*',
56618
+ label: label,
56619
+ InputLabelProps: _extends$1({}, InputLabelProps, {
56620
+ required: isRequired
56621
+ }),
56409
56622
  variant: 'outlined',
56410
56623
  fullWidth: true,
56411
56624
  readOnly: readOnly,
56625
+ placeholder: placeholder,
56412
56626
  value: selectedValue && selectedValue.text
56413
56627
  }) : React__default.createElement(Autocomplete$1, {
56414
56628
  value: selectedValue,
@@ -56439,7 +56653,7 @@ function UAutoComplete(_ref) {
56439
56653
  renderInput: function renderInput(params) {
56440
56654
  return React__default.createElement(ActiveFormTextField, _extends$1({}, params, {
56441
56655
  multiline: true,
56442
- label: '' + label + (isRequired ? '*' : ''),
56656
+ label: label,
56443
56657
  variant: 'outlined',
56444
56658
  value: selectedValue && selectedValue.text || '',
56445
56659
  validators: isRequired ? ['required', 'trim'] : ['trim'],
@@ -56448,8 +56662,13 @@ function UAutoComplete(_ref) {
56448
56662
  minLength: minLength,
56449
56663
  maxLength: maxLength
56450
56664
  }),
56665
+ InputLabelProps: _extends$1({}, InputLabelProps, {
56666
+ required: isRequired
56667
+ }),
56451
56668
  maxLength: maxLength,
56452
- counter: true
56669
+ counter: counter,
56670
+ placeholder: placeholder,
56671
+ readOnly: readOnly
56453
56672
  }));
56454
56673
  }
56455
56674
  })
@@ -56480,11 +56699,18 @@ UAutoComplete.propTypes = {
56480
56699
  /** can create context specific item or not */
56481
56700
  allowContextSpecific: PropTypes__default.bool,
56482
56701
  /** used item id's from the options */
56483
- usedItemIds: PropTypes__default.array
56702
+ usedItemIds: PropTypes__default.array,
56703
+ /** To enable character counter */
56704
+ counter: PropTypes__default.bool,
56705
+ /** placeholder text*/
56706
+ placeholder: PropTypes__default.string,
56707
+ /** Label props applied to input field*/
56708
+ InputLabelProps: PropTypes__default.object
56484
56709
  };
56485
56710
 
56486
56711
  UAutoComplete.defaultProps = {
56487
56712
  allowContextSpecific: false,
56713
+ counter: false,
56488
56714
  usedItemIds: []
56489
56715
  };
56490
56716
 
@@ -57781,6 +58007,208 @@ ActiveKeyboardTimePicker.defaultProps = {
57781
58007
  variant: 'inline'
57782
58008
  };
57783
58009
 
58010
+ var filter$1 = createFilterOptions();
58011
+
58012
+ var useStyles$z = makeStyles$1(function (theme) {
58013
+ return {
58014
+ controlStyle: {
58015
+ marginTop: theme.spacing(2),
58016
+ width: '100%'
58017
+ }
58018
+ };
58019
+ });
58020
+ /**
58021
+ * ActiveAutoComplete is an editable dropdown component with interactive.
58022
+ * User can enter the text in order to find the value from the list of values
58023
+ * User can also add new value to the list as well.
58024
+ */
58025
+ function ActiveAutoComplete(_ref) {
58026
+ var value = _ref.value,
58027
+ label = _ref.label,
58028
+ onChange = _ref.onChange,
58029
+ isRequired = _ref.isRequired,
58030
+ onBlur = _ref.onBlur,
58031
+ name = _ref.name,
58032
+ options = _ref.options,
58033
+ readOnly = _ref.readOnly,
58034
+ minLength = _ref.minLength,
58035
+ maxLength = _ref.maxLength,
58036
+ usedItemIds = _ref.usedItemIds,
58037
+ allowContextSpecific = _ref.allowContextSpecific,
58038
+ interactiveMode = _ref.interactiveMode,
58039
+ counter = _ref.counter,
58040
+ placeholder = _ref.placeholder,
58041
+ InputLabelProps = _ref.InputLabelProps,
58042
+ props = _ref.props;
58043
+
58044
+ var classes = useStyles$z();
58045
+ //const dispatch = useDispatch()
58046
+
58047
+ var _useState = React.useState(value || null),
58048
+ _useState2 = slicedToArray(_useState, 2),
58049
+ selectedValue = _useState2[0],
58050
+ setSelectedValue = _useState2[1]; // for initialization: avoid the control to be a uncontrolled component with 'undefined'
58051
+
58052
+ var handleChange = function handleChange(event, newValue) {
58053
+ // Create a new value from the user input
58054
+ if (newValue && newValue.inputValue) {
58055
+ setSelectedValue({
58056
+ text: newValue.inputValue
58057
+ });
58058
+ onChange({
58059
+ text: newValue.inputValue
58060
+ });
58061
+ return;
58062
+ }
58063
+ setSelectedValue(newValue);
58064
+ onChange && onChange(newValue, name);
58065
+ };
58066
+
58067
+ var handleFilter = function handleFilter(options, params) {
58068
+ var filtered = filter$1(options, params);
58069
+ var labelForMessage = label && label.toLowerCase();
58070
+ // Suggest the creation of a new value
58071
+ if (params.inputValue !== '' && allowContextSpecific) {
58072
+ filtered.push({
58073
+ inputValue: params.inputValue,
58074
+ text: 'Use context-specific ' + (labelForMessage ? labelForMessage : '') + ' "' + params.inputValue + '"'
58075
+ });
58076
+ }
58077
+ return filtered;
58078
+ };
58079
+
58080
+ var handleGetOption = function handleGetOption(option) {
58081
+ // Value selected with enter, right from the input
58082
+ if (typeof option === 'string') {
58083
+ return option;
58084
+ }
58085
+ // Add "new" option created dynamically
58086
+ if (option.inputValue) {
58087
+ return option.inputValue;
58088
+ }
58089
+ // Regular option
58090
+ return option.text || '';
58091
+ };
58092
+
58093
+ var handleOnBlur = function handleOnBlur(e) {
58094
+ if (selectedValue && selectedValue.text && selectedValue.text.trim() !== '') {
58095
+ onBlur && onBlur(e, name);
58096
+ }
58097
+ };
58098
+
58099
+ var controlOptions = options && options.length > 0 ? options.filter(function (opt) {
58100
+ return !usedItemIds.includes(opt.id);
58101
+ }) : [];
58102
+ return React__default.createElement(
58103
+ React__default.Fragment,
58104
+ null,
58105
+ !interactiveMode && readOnly ? React__default.createElement(ActiveFormTextField, {
58106
+ multiline: true,
58107
+ label: label,
58108
+ InputLabelProps: _extends$1({}, InputLabelProps, {
58109
+ required: isRequired
58110
+ }),
58111
+ variant: 'outlined',
58112
+ fullWidth: true,
58113
+ readOnly: readOnly,
58114
+ placeholder: placeholder,
58115
+ value: selectedValue && selectedValue.text
58116
+ }) : React__default.createElement(Autocomplete$1, {
58117
+ value: selectedValue,
58118
+ getOptionSelected: function getOptionSelected(option) {
58119
+ return option.id === selectedValue.id;
58120
+ },
58121
+ onChange: function onChange(event, newValue) {
58122
+ return handleChange(event, newValue);
58123
+ },
58124
+ filterOptions: function filterOptions(options, params) {
58125
+ return handleFilter(options, params);
58126
+ },
58127
+ id: 'target-input',
58128
+ name: name,
58129
+ selectOnFocus: true,
58130
+ clearOnBlur: true,
58131
+ handleHomeEndKeys: true,
58132
+ options: controlOptions,
58133
+ getOptionLabel: function getOptionLabel(option) {
58134
+ return handleGetOption(option);
58135
+ },
58136
+ renderOption: function renderOption(option) {
58137
+ return option.text;
58138
+ },
58139
+ onBlur: handleOnBlur,
58140
+ className: classes.controlStyle,
58141
+ freeSolo: allowContextSpecific,
58142
+ renderInput: function renderInput(params) {
58143
+ return React__default.createElement(ActiveFormTextField, _extends$1({}, params, {
58144
+ multiline: true,
58145
+ label: label,
58146
+ variant: 'outlined',
58147
+ value: selectedValue && selectedValue.text || '',
58148
+ validators: isRequired ? ['required', 'trim'] : ['trim'],
58149
+ fullWidth: true,
58150
+ inputProps: _extends$1({}, params.inputProps, {
58151
+ minLength: minLength,
58152
+ maxLength: maxLength
58153
+ }),
58154
+ InputLabelProps: _extends$1({}, InputLabelProps, {
58155
+ required: isRequired
58156
+ }),
58157
+ maxLength: maxLength,
58158
+ counter: counter,
58159
+ interactiveMode: interactiveMode,
58160
+ placeholder: placeholder,
58161
+ readOnly: readOnly
58162
+ }));
58163
+ }
58164
+ })
58165
+ );
58166
+ }
58167
+
58168
+ ActiveAutoComplete.propTypes = {
58169
+ /** selected value of the dropdown */
58170
+ value: PropTypes__default.object,
58171
+ /** label */
58172
+ label: PropTypes__default.string,
58173
+ /** options to display */
58174
+ options: PropTypes__default.array,
58175
+ /** dropdown on change event */
58176
+ onChange: PropTypes__default.func,
58177
+ /** enable required validator */
58178
+ isRequired: PropTypes__default.bool,
58179
+ /** enable required error in dropdown */
58180
+ hasError: PropTypes__default.bool,
58181
+ /** onBlur event for dropdown */
58182
+ onBlur: PropTypes__default.func,
58183
+ /** name of the dropdown */
58184
+ name: PropTypes__default.string,
58185
+ /** max length text */
58186
+ maxLength: PropTypes__default.number,
58187
+ /** min length text */
58188
+ minLength: PropTypes__default.number,
58189
+ /** can create context specific item or not */
58190
+ allowContextSpecific: PropTypes__default.bool,
58191
+ /** used item id's from the options */
58192
+ usedItemIds: PropTypes__default.array,
58193
+ /** Change to write mode by hiding text field border and displays border on hover*/
58194
+ interactiveMode: PropTypes__default.bool,
58195
+ /** To enable character counter */
58196
+ counter: PropTypes__default.bool,
58197
+ /** placeholder text*/
58198
+ placeholder: PropTypes__default.string,
58199
+ /** Label props applied to input field*/
58200
+ InputLabelProps: PropTypes__default.object
58201
+ };
58202
+
58203
+ ActiveAutoComplete.defaultProps = {
58204
+ allowContextSpecific: false,
58205
+ interactiveMode: false,
58206
+ counter: false,
58207
+ usedItemIds: []
58208
+ };
58209
+
58210
+ exports.ActiveAutoComplete = ActiveAutoComplete;
58211
+ exports.ActiveCurrencyField = ActiveCurrencyField;
57784
58212
  exports.ActiveDatePicker = ActiveDatePicker;
57785
58213
  exports.ActiveFormCoordinateField = ActiveFormCoordinateField;
57786
58214
  exports.ActiveFormPositiveInteger = ActiveFormPositiveInteger;
@@ -57797,6 +58225,7 @@ exports.UButton = UButton;
57797
58225
  exports.UConfirmationButton = UConfirmationButton;
57798
58226
  exports.UContent = UContent;
57799
58227
  exports.UCoordinateField = UCoordinateField;
58228
+ exports.UCurrencyField = UCurrencyField;
57800
58229
  exports.UDatePicker = UDatePicker;
57801
58230
  exports.UDateTimePicker = UDateTimePicker;
57802
58231
  exports.UErrorAlert = UErrorAlert;