@unicef/material-ui 0.9.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/lib/prod.js CHANGED
@@ -33936,7 +33936,8 @@ function PositiveNumberFormat(_ref) {
33936
33936
  isNumericString = _ref.isNumericString,
33937
33937
  allowNegative = _ref.allowNegative,
33938
33938
  decimalScale = _ref.decimalScale,
33939
- 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']);
33940
33941
 
33941
33942
  return React__default.createElement(NumberFormat, _extends$1({}, other, {
33942
33943
  getInputRef: inputRef,
@@ -33951,7 +33952,8 @@ function PositiveNumberFormat(_ref) {
33951
33952
  thousandSeparator: thousandSeparator,
33952
33953
  isNumericString: isNumericString,
33953
33954
  allowNegative: allowNegative,
33954
- decimalScale: decimalScale
33955
+ decimalScale: decimalScale,
33956
+ fixedDecimalScale: fixedDecimalScale
33955
33957
  }));
33956
33958
  }
33957
33959
 
@@ -33967,14 +33969,17 @@ PositiveNumberFormat.propTypes = {
33967
33969
  // Is allow negative numbers
33968
33970
  allowNegative: PropTypes__default.bool,
33969
33971
  // No of decimal digits
33970
- decimalScale: PropTypes__default.number
33972
+ decimalScale: PropTypes__default.number,
33973
+ //If true it add 0s to match given decimalScale.
33974
+ fixedDecimalScale: PropTypes__default.bool
33971
33975
  };
33972
33976
 
33973
33977
  PositiveNumberFormat.defaultProps = {
33974
33978
  thousandSeparator: true,
33975
33979
  isNumericString: false,
33976
33980
  allowNegative: false,
33977
- decimalScale: 0
33981
+ decimalScale: 0,
33982
+ fixedDecimalScale: false
33978
33983
  };
33979
33984
 
33980
33985
  var HelpOutline = createCommonjsModule(function (module, exports) {
@@ -46974,32 +46979,22 @@ UPositiveInteger.propTypes = {
46974
46979
  withRequiredValidator: PropTypes__default.bool
46975
46980
  };
46976
46981
 
46977
- var useStyles$n = makeStyles$1(function (theme) {
46978
- return {
46979
- startAdornmentContainer: {
46980
- marginRight: theme.spacing(0.5)
46981
- }
46982
- };
46983
- });
46984
-
46985
46982
  function UCurrencyField(_ref) {
46986
46983
  var inputPrefix = _ref.inputPrefix,
46987
46984
  decimalScale = _ref.decimalScale,
46988
- InputProps = _ref.InputProps,
46985
+ fixedDecimalScale = _ref.fixedDecimalScale,
46986
+ textAlign = _ref.textAlign,
46989
46987
  inputProps = _ref.inputProps,
46990
- props = objectWithoutProperties(_ref, ['inputPrefix', 'decimalScale', 'InputProps', 'inputProps']);
46988
+ props = objectWithoutProperties(_ref, ['inputPrefix', 'decimalScale', 'fixedDecimalScale', 'textAlign', 'inputProps']);
46991
46989
 
46992
- var classes = useStyles$n(props);
46993
46990
  return React__default.createElement(UPositiveInteger, _extends$1({
46994
46991
  variant: 'outlined',
46995
- InputProps: _extends$1({
46996
- startAdornment: React__default.createElement(
46997
- 'span',
46998
- { className: classes.startAdornmentContainer },
46999
- inputPrefix
47000
- )
47001
- }, InputProps),
47002
- 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)
47003
46998
  }, props));
47004
46999
  }
47005
47000
 
@@ -47031,12 +47026,18 @@ UCurrencyField.propTypes = {
47031
47026
  /** To make the content readOnly */
47032
47027
  readOnly: PropTypes__default.bool,
47033
47028
  /** Name of input. */
47034
- 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
47035
47034
  };
47036
47035
 
47037
47036
  UCurrencyField.defaultProps = {
47038
- inputPrefix: '$',
47039
- decimalScale: 2
47037
+ inputPrefix: '$ ',
47038
+ decimalScale: 2,
47039
+ fixedDecimalScale: true,
47040
+ textAlign: 'right'
47040
47041
  };
47041
47042
 
47042
47043
  function ActiveFormPositiveInteger(_ref) {
@@ -47087,32 +47088,22 @@ ActiveFormPositiveInteger.propTypes = {
47087
47088
  withRequiredValidator: PropTypes__default.bool
47088
47089
  };
47089
47090
 
47090
- var useStyles$o = makeStyles$1(function (theme) {
47091
- return {
47092
- startAdornmentContainer: {
47093
- marginRight: theme.spacing(0.5)
47094
- }
47095
- };
47096
- });
47097
-
47098
47091
  function ActiveCurrencyField(_ref) {
47099
47092
  var inputPrefix = _ref.inputPrefix,
47100
47093
  decimalScale = _ref.decimalScale,
47101
- InputProps = _ref.InputProps,
47094
+ fixedDecimalScale = _ref.fixedDecimalScale,
47095
+ textAlign = _ref.textAlign,
47102
47096
  inputProps = _ref.inputProps,
47103
- props = objectWithoutProperties(_ref, ['inputPrefix', 'decimalScale', 'InputProps', 'inputProps']);
47097
+ props = objectWithoutProperties(_ref, ['inputPrefix', 'decimalScale', 'fixedDecimalScale', 'textAlign', 'inputProps']);
47104
47098
 
47105
- var classes = useStyles$o(props);
47106
47099
  return React__default.createElement(ActiveFormPositiveInteger, _extends$1({
47107
47100
  variant: 'outlined',
47108
- InputProps: _extends$1({
47109
- startAdornment: React__default.createElement(
47110
- 'span',
47111
- { className: classes.startAdornmentContainer },
47112
- inputPrefix
47113
- )
47114
- }, InputProps),
47115
- 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)
47116
47107
  }, props));
47117
47108
  }
47118
47109
 
@@ -47154,12 +47145,16 @@ ActiveCurrencyField.propTypes = {
47154
47145
  /** It triggers after each validation.It will return true or false. */
47155
47146
  validatorListener: PropTypes__default.func,
47156
47147
  /** Allow to use required validator in any validation trigger, not only form submit. */
47157
- withRequiredValidator: PropTypes__default.bool
47148
+ withRequiredValidator: PropTypes__default.bool,
47149
+ /** Input text align */
47150
+ textAlign: PropTypes__default.string
47158
47151
  };
47159
47152
 
47160
47153
  ActiveCurrencyField.defaultProps = {
47161
- inputPrefix: '$',
47162
- decimalScale: 2
47154
+ inputPrefix: '$ ',
47155
+ decimalScale: 2,
47156
+ fixedDecimalScale: true,
47157
+ textAlign: 'right'
47163
47158
  };
47164
47159
 
47165
47160
  var DeleteOutlined = createCommonjsModule(function (module, exports) {
@@ -47186,7 +47181,7 @@ exports.default = _default;
47186
47181
 
47187
47182
  var DeleteOutlinedIcon = unwrapExports(DeleteOutlined);
47188
47183
 
47189
- var useStyles$p = makeStyles$1(function (theme) {
47184
+ var useStyles$n = makeStyles$1(function (theme) {
47190
47185
  return {
47191
47186
  menuDelete: {
47192
47187
  width: '500px'
@@ -47206,7 +47201,7 @@ var useStyles$p = makeStyles$1(function (theme) {
47206
47201
  * It has two varint icon/menu item
47207
47202
  */
47208
47203
  function UConfirmationButton(props) {
47209
- var classes = useStyles$p();
47204
+ var classes = useStyles$n();
47210
47205
  var onConfirm = props.onConfirm,
47211
47206
  id = props.id,
47212
47207
  buttonText = props.buttonText,
@@ -47321,7 +47316,7 @@ UConfirmationButton.defaultProps = {
47321
47316
  /**
47322
47317
  * displays radio buttons
47323
47318
  */
47324
- var useStyles$q = makeStyles$1(function (theme) {
47319
+ var useStyles$o = makeStyles$1(function (theme) {
47325
47320
  return {
47326
47321
  padding: {
47327
47322
  paddingLeft: theme.spacing(3)
@@ -47342,7 +47337,7 @@ function URadioButtons(_ref) {
47342
47337
  optionLabels = _ref.optionLabels,
47343
47338
  optionValues = _ref.optionValues;
47344
47339
 
47345
- var classes = useStyles$q();
47340
+ var classes = useStyles$o();
47346
47341
  var handleOnChange = function handleOnChange(event) {
47347
47342
  onChange && onChange(event);
47348
47343
  };
@@ -47446,7 +47441,7 @@ exports.default = _default;
47446
47441
 
47447
47442
  var DoneIcon = unwrapExports(Done);
47448
47443
 
47449
- var useStyles$r = makeStyles$1(function (theme) {
47444
+ var useStyles$p = makeStyles$1(function (theme) {
47450
47445
  return {
47451
47446
  root: {
47452
47447
  position: 'fixed',
@@ -47478,7 +47473,7 @@ function UAsyncBadge(_ref) {
47478
47473
  visible = _ref.visible,
47479
47474
  onReset = _ref.onReset;
47480
47475
 
47481
- var classes = useStyles$r();
47476
+ var classes = useStyles$p();
47482
47477
 
47483
47478
  /** If variant is success or error, after few seconds, it will set asyncResponse visible to false */
47484
47479
  React.useEffect(function () {
@@ -47517,7 +47512,7 @@ UAsyncBadge.propTypes = {
47517
47512
  onReset: PropTypes__default.func
47518
47513
  };
47519
47514
 
47520
- var useStyles$s = makeStyles$1(function () {
47515
+ var useStyles$q = makeStyles$1(function () {
47521
47516
  return {
47522
47517
  pageLoadingProgress: {
47523
47518
  height: '50vh',
@@ -47532,7 +47527,7 @@ var useStyles$s = makeStyles$1(function () {
47532
47527
  * 2. Display text message
47533
47528
  */
47534
47529
  function UPageLoadingProgress(props) {
47535
- var classes = useStyles$s();
47530
+ var classes = useStyles$q();
47536
47531
  var text = props.text;
47537
47532
 
47538
47533
  return React__default.createElement(
@@ -49385,7 +49380,7 @@ UErrorAlert.defaultProps = {
49385
49380
 
49386
49381
  var filter = createFilterOptions();
49387
49382
 
49388
- var useStyles$t = makeStyles$1(function (theme) {
49383
+ var useStyles$r = makeStyles$1(function (theme) {
49389
49384
  return {
49390
49385
  controlStyle: {
49391
49386
  marginTop: theme.spacing(2),
@@ -49411,9 +49406,12 @@ function UAutoComplete(_ref) {
49411
49406
  maxLength = _ref.maxLength,
49412
49407
  usedItemIds = _ref.usedItemIds,
49413
49408
  allowContextSpecific = _ref.allowContextSpecific,
49409
+ counter = _ref.counter,
49410
+ placeholder = _ref.placeholder,
49411
+ InputLabelProps = _ref.InputLabelProps,
49414
49412
  props = _ref.props;
49415
49413
 
49416
- var classes = useStyles$t();
49414
+ var classes = useStyles$r();
49417
49415
  //const dispatch = useDispatch()
49418
49416
 
49419
49417
  var _useState = React.useState(value || null),
@@ -49471,16 +49469,19 @@ function UAutoComplete(_ref) {
49471
49469
  var controlOptions = options && options.length > 0 ? options.filter(function (opt) {
49472
49470
  return !usedItemIds.includes(opt.id);
49473
49471
  }) : [];
49474
-
49475
49472
  return React__default.createElement(
49476
49473
  React__default.Fragment,
49477
49474
  null,
49478
49475
  readOnly ? React__default.createElement(ActiveFormTextField, {
49479
49476
  multiline: true,
49480
- label: label + '*',
49477
+ label: label,
49478
+ InputLabelProps: _extends$1({}, InputLabelProps, {
49479
+ required: isRequired
49480
+ }),
49481
49481
  variant: 'outlined',
49482
49482
  fullWidth: true,
49483
49483
  readOnly: readOnly,
49484
+ placeholder: placeholder,
49484
49485
  value: selectedValue && selectedValue.text
49485
49486
  }) : React__default.createElement(Autocomplete$1, {
49486
49487
  value: selectedValue,
@@ -49511,7 +49512,7 @@ function UAutoComplete(_ref) {
49511
49512
  renderInput: function renderInput(params) {
49512
49513
  return React__default.createElement(ActiveFormTextField, _extends$1({}, params, {
49513
49514
  multiline: true,
49514
- label: '' + label + (isRequired ? '*' : ''),
49515
+ label: label,
49515
49516
  variant: 'outlined',
49516
49517
  value: selectedValue && selectedValue.text || '',
49517
49518
  validators: isRequired ? ['required', 'trim'] : ['trim'],
@@ -49520,8 +49521,13 @@ function UAutoComplete(_ref) {
49520
49521
  minLength: minLength,
49521
49522
  maxLength: maxLength
49522
49523
  }),
49524
+ InputLabelProps: _extends$1({}, InputLabelProps, {
49525
+ required: isRequired
49526
+ }),
49523
49527
  maxLength: maxLength,
49524
- counter: true
49528
+ counter: counter,
49529
+ placeholder: placeholder,
49530
+ readOnly: readOnly
49525
49531
  }));
49526
49532
  }
49527
49533
  })
@@ -49552,17 +49558,24 @@ UAutoComplete.propTypes = {
49552
49558
  /** can create context specific item or not */
49553
49559
  allowContextSpecific: PropTypes__default.bool,
49554
49560
  /** used item id's from the options */
49555
- 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
49556
49568
  };
49557
49569
 
49558
49570
  UAutoComplete.defaultProps = {
49559
49571
  allowContextSpecific: false,
49572
+ counter: false,
49560
49573
  usedItemIds: []
49561
49574
  };
49562
49575
 
49563
49576
  /* eslint-disable no-nested-ternary */
49564
49577
 
49565
- var useStyles$u = makeStyles$1(function (theme) {
49578
+ var useStyles$s = makeStyles$1(function (theme) {
49566
49579
  var _ref;
49567
49580
 
49568
49581
  return _ref = {
@@ -49594,7 +49607,7 @@ var useStyles$u = makeStyles$1(function (theme) {
49594
49607
  * Breadcrumbs is a component to implement current user path of the application
49595
49608
  */
49596
49609
  function UBreadcrumbs(props) {
49597
- var classes = useStyles$u();
49610
+ var classes = useStyles$s();
49598
49611
  var breadcrumbLinks = props.breadcrumbLinks;
49599
49612
 
49600
49613
 
@@ -49671,7 +49684,7 @@ UInfiniteScroll.propTypes = {
49671
49684
  onEndOfScroll: PropTypes__default.func
49672
49685
  };
49673
49686
 
49674
- var useStyles$v = makeStyles$1(function (theme) {
49687
+ var useStyles$t = makeStyles$1(function (theme) {
49675
49688
  return {
49676
49689
  small: {
49677
49690
  width: theme.spacing(4),
@@ -49716,7 +49729,7 @@ function UAvatarImage(_ref) {
49716
49729
  zIndexValue = _ref.zIndexValue,
49717
49730
  loadPhoto = _ref.loadPhoto;
49718
49731
 
49719
- var classes = useStyles$v();
49732
+ var classes = useStyles$t();
49720
49733
 
49721
49734
  var _useState = React.useState(''),
49722
49735
  _useState2 = slicedToArray(_useState, 2),
@@ -50148,7 +50161,7 @@ exports.default = _default;
50148
50161
 
50149
50162
  var CloseIcon$1 = unwrapExports(Close);
50150
50163
 
50151
- var useStyles$w = makeStyles$1(function (theme) {
50164
+ var useStyles$u = makeStyles$1(function (theme) {
50152
50165
  return {
50153
50166
  root: {
50154
50167
  width: '100%',
@@ -50188,7 +50201,7 @@ function USearchBox(_ref) {
50188
50201
  searchValue = _useState2[0],
50189
50202
  setSearch = _useState2[1];
50190
50203
 
50191
- var classes = useStyles$w();
50204
+ var classes = useStyles$u();
50192
50205
 
50193
50206
  var handleChange = function handleChange(event) {
50194
50207
  setSearch(event.target.value);
@@ -50289,7 +50302,7 @@ var styles$16 = {
50289
50302
  }
50290
50303
  };
50291
50304
 
50292
- var useStyles$x = makeStyles$1(function (theme) {
50305
+ var useStyles$v = makeStyles$1(function (theme) {
50293
50306
  return {
50294
50307
  textField: {
50295
50308
  marginTop: theme.spacing(0.25),
@@ -50332,7 +50345,7 @@ var useStyles$x = makeStyles$1(function (theme) {
50332
50345
  * ActiveKeyboardDatePicker is a customized [Material Ui KeyboardDatePicker]('https://material-ui-pickers.dev/api/KeyboardDatePicker') for more details
50333
50346
  */
50334
50347
  function ActiveKeyboardDatePicker(props) {
50335
- var classes = useStyles$x(props);
50348
+ var classes = useStyles$v(props);
50336
50349
  var autoOk = props.autoOk,
50337
50350
  variant = props.variant,
50338
50351
  inputVariant = props.inputVariant,
@@ -50451,7 +50464,7 @@ var styles$17 = {
50451
50464
  }
50452
50465
  };
50453
50466
 
50454
- var useStyles$y = makeStyles$1(function (theme) {
50467
+ var useStyles$w = makeStyles$1(function (theme) {
50455
50468
  return {
50456
50469
  textField: {
50457
50470
  marginTop: theme.spacing(0.25),
@@ -50490,7 +50503,7 @@ var useStyles$y = makeStyles$1(function (theme) {
50490
50503
  * Please have look at [Material Ui Date Picker]('https://material-ui-pickers.dev/api/DatePicker') for more details
50491
50504
  */
50492
50505
  function ActiveDatePicker(props) {
50493
- var classes = useStyles$y(props);
50506
+ var classes = useStyles$w(props);
50494
50507
  var autoOk = props.autoOk,
50495
50508
  variant = props.variant,
50496
50509
  inputVariant = props.inputVariant,
@@ -50584,7 +50597,7 @@ var styles$18 = {
50584
50597
  }
50585
50598
  };
50586
50599
 
50587
- var useStyles$z = makeStyles$1(function (theme) {
50600
+ var useStyles$x = makeStyles$1(function (theme) {
50588
50601
  return {
50589
50602
  textField: {
50590
50603
  marginTop: theme.spacing(0.25),
@@ -50623,7 +50636,7 @@ var useStyles$z = makeStyles$1(function (theme) {
50623
50636
  * Please have look at [Material Ui TimePicker]('https://material-ui-pickers.dev/api/TimePicker') for more details
50624
50637
  */
50625
50638
  function ActiveTimePicker(props) {
50626
- var classes = useStyles$z(props);
50639
+ var classes = useStyles$x(props);
50627
50640
  var inputVariant = props.inputVariant,
50628
50641
  readOnly = props.readOnly,
50629
50642
  interactiveMode = props.interactiveMode,
@@ -50708,7 +50721,7 @@ var styles$19 = {
50708
50721
  }
50709
50722
  };
50710
50723
 
50711
- var useStyles$A = makeStyles$1(function (theme) {
50724
+ var useStyles$y = makeStyles$1(function (theme) {
50712
50725
  return {
50713
50726
  textField: {
50714
50727
  marginTop: theme.spacing(0.25),
@@ -50751,7 +50764,7 @@ var useStyles$A = makeStyles$1(function (theme) {
50751
50764
  * ActiveKeyboardTimePicker is customized [ Material Ui KeyboardTimePicker](https://material-ui-pickers.dev/api/KeyboardTimePicker)
50752
50765
  */
50753
50766
  function ActiveKeyboardTimePicker(props) {
50754
- var classes = useStyles$A(props);
50767
+ var classes = useStyles$y(props);
50755
50768
  var inputVariant = props.inputVariant,
50756
50769
  readOnly = props.readOnly,
50757
50770
  interactiveMode = props.interactiveMode,
@@ -50853,6 +50866,207 @@ ActiveKeyboardTimePicker.defaultProps = {
50853
50866
  variant: 'inline'
50854
50867
  };
50855
50868
 
50869
+ var filter$1 = createFilterOptions();
50870
+
50871
+ var useStyles$z = makeStyles$1(function (theme) {
50872
+ return {
50873
+ controlStyle: {
50874
+ marginTop: theme.spacing(2),
50875
+ width: '100%'
50876
+ }
50877
+ };
50878
+ });
50879
+ /**
50880
+ * ActiveAutoComplete is an editable dropdown component with interactive.
50881
+ * User can enter the text in order to find the value from the list of values
50882
+ * User can also add new value to the list as well.
50883
+ */
50884
+ function ActiveAutoComplete(_ref) {
50885
+ var value = _ref.value,
50886
+ label = _ref.label,
50887
+ onChange = _ref.onChange,
50888
+ isRequired = _ref.isRequired,
50889
+ onBlur = _ref.onBlur,
50890
+ name = _ref.name,
50891
+ options = _ref.options,
50892
+ readOnly = _ref.readOnly,
50893
+ minLength = _ref.minLength,
50894
+ maxLength = _ref.maxLength,
50895
+ usedItemIds = _ref.usedItemIds,
50896
+ allowContextSpecific = _ref.allowContextSpecific,
50897
+ interactiveMode = _ref.interactiveMode,
50898
+ counter = _ref.counter,
50899
+ placeholder = _ref.placeholder,
50900
+ InputLabelProps = _ref.InputLabelProps,
50901
+ props = _ref.props;
50902
+
50903
+ var classes = useStyles$z();
50904
+ //const dispatch = useDispatch()
50905
+
50906
+ var _useState = React.useState(value || null),
50907
+ _useState2 = slicedToArray(_useState, 2),
50908
+ selectedValue = _useState2[0],
50909
+ setSelectedValue = _useState2[1]; // for initialization: avoid the control to be a uncontrolled component with 'undefined'
50910
+
50911
+ var handleChange = function handleChange(event, newValue) {
50912
+ // Create a new value from the user input
50913
+ if (newValue && newValue.inputValue) {
50914
+ setSelectedValue({
50915
+ text: newValue.inputValue
50916
+ });
50917
+ onChange({
50918
+ text: newValue.inputValue
50919
+ });
50920
+ return;
50921
+ }
50922
+ setSelectedValue(newValue);
50923
+ onChange && onChange(newValue, name);
50924
+ };
50925
+
50926
+ var handleFilter = function handleFilter(options, params) {
50927
+ var filtered = filter$1(options, params);
50928
+ var labelForMessage = label && label.toLowerCase();
50929
+ // Suggest the creation of a new value
50930
+ if (params.inputValue !== '' && allowContextSpecific) {
50931
+ filtered.push({
50932
+ inputValue: params.inputValue,
50933
+ text: 'Use context-specific ' + (labelForMessage ? labelForMessage : '') + ' "' + params.inputValue + '"'
50934
+ });
50935
+ }
50936
+ return filtered;
50937
+ };
50938
+
50939
+ var handleGetOption = function handleGetOption(option) {
50940
+ // Value selected with enter, right from the input
50941
+ if (typeof option === 'string') {
50942
+ return option;
50943
+ }
50944
+ // Add "new" option created dynamically
50945
+ if (option.inputValue) {
50946
+ return option.inputValue;
50947
+ }
50948
+ // Regular option
50949
+ return option.text || '';
50950
+ };
50951
+
50952
+ var handleOnBlur = function handleOnBlur(e) {
50953
+ if (selectedValue && selectedValue.text && selectedValue.text.trim() !== '') {
50954
+ onBlur && onBlur(e, name);
50955
+ }
50956
+ };
50957
+
50958
+ var controlOptions = options && options.length > 0 ? options.filter(function (opt) {
50959
+ return !usedItemIds.includes(opt.id);
50960
+ }) : [];
50961
+ return React__default.createElement(
50962
+ React__default.Fragment,
50963
+ null,
50964
+ !interactiveMode && readOnly ? React__default.createElement(ActiveFormTextField, {
50965
+ multiline: true,
50966
+ label: label,
50967
+ InputLabelProps: _extends$1({}, InputLabelProps, {
50968
+ required: isRequired
50969
+ }),
50970
+ variant: 'outlined',
50971
+ fullWidth: true,
50972
+ readOnly: readOnly,
50973
+ placeholder: placeholder,
50974
+ value: selectedValue && selectedValue.text
50975
+ }) : React__default.createElement(Autocomplete$1, {
50976
+ value: selectedValue,
50977
+ getOptionSelected: function getOptionSelected(option) {
50978
+ return option.id === selectedValue.id;
50979
+ },
50980
+ onChange: function onChange(event, newValue) {
50981
+ return handleChange(event, newValue);
50982
+ },
50983
+ filterOptions: function filterOptions(options, params) {
50984
+ return handleFilter(options, params);
50985
+ },
50986
+ id: 'target-input',
50987
+ name: name,
50988
+ selectOnFocus: true,
50989
+ clearOnBlur: true,
50990
+ handleHomeEndKeys: true,
50991
+ options: controlOptions,
50992
+ getOptionLabel: function getOptionLabel(option) {
50993
+ return handleGetOption(option);
50994
+ },
50995
+ renderOption: function renderOption(option) {
50996
+ return option.text;
50997
+ },
50998
+ onBlur: handleOnBlur,
50999
+ className: classes.controlStyle,
51000
+ freeSolo: allowContextSpecific,
51001
+ renderInput: function renderInput(params) {
51002
+ return React__default.createElement(ActiveFormTextField, _extends$1({}, params, {
51003
+ multiline: true,
51004
+ label: label,
51005
+ variant: 'outlined',
51006
+ value: selectedValue && selectedValue.text || '',
51007
+ validators: isRequired ? ['required', 'trim'] : ['trim'],
51008
+ fullWidth: true,
51009
+ inputProps: _extends$1({}, params.inputProps, {
51010
+ minLength: minLength,
51011
+ maxLength: maxLength
51012
+ }),
51013
+ InputLabelProps: _extends$1({}, InputLabelProps, {
51014
+ required: isRequired
51015
+ }),
51016
+ maxLength: maxLength,
51017
+ counter: counter,
51018
+ interactiveMode: interactiveMode,
51019
+ placeholder: placeholder,
51020
+ readOnly: readOnly
51021
+ }));
51022
+ }
51023
+ })
51024
+ );
51025
+ }
51026
+
51027
+ ActiveAutoComplete.propTypes = {
51028
+ /** selected value of the dropdown */
51029
+ value: PropTypes__default.object,
51030
+ /** label */
51031
+ label: PropTypes__default.string,
51032
+ /** options to display */
51033
+ options: PropTypes__default.array,
51034
+ /** dropdown on change event */
51035
+ onChange: PropTypes__default.func,
51036
+ /** enable required validator */
51037
+ isRequired: PropTypes__default.bool,
51038
+ /** enable required error in dropdown */
51039
+ hasError: PropTypes__default.bool,
51040
+ /** onBlur event for dropdown */
51041
+ onBlur: PropTypes__default.func,
51042
+ /** name of the dropdown */
51043
+ name: PropTypes__default.string,
51044
+ /** max length text */
51045
+ maxLength: PropTypes__default.number,
51046
+ /** min length text */
51047
+ minLength: PropTypes__default.number,
51048
+ /** can create context specific item or not */
51049
+ allowContextSpecific: PropTypes__default.bool,
51050
+ /** used item id's from the options */
51051
+ usedItemIds: PropTypes__default.array,
51052
+ /** Change to write mode by hiding text field border and displays border on hover*/
51053
+ interactiveMode: PropTypes__default.bool,
51054
+ /** To enable character counter */
51055
+ counter: PropTypes__default.bool,
51056
+ /** placeholder text*/
51057
+ placeholder: PropTypes__default.string,
51058
+ /** Label props applied to input field*/
51059
+ InputLabelProps: PropTypes__default.object
51060
+ };
51061
+
51062
+ ActiveAutoComplete.defaultProps = {
51063
+ allowContextSpecific: false,
51064
+ interactiveMode: false,
51065
+ counter: false,
51066
+ usedItemIds: []
51067
+ };
51068
+
51069
+ exports.ActiveAutoComplete = ActiveAutoComplete;
50856
51070
  exports.ActiveCurrencyField = ActiveCurrencyField;
50857
51071
  exports.ActiveDatePicker = ActiveDatePicker;
50858
51072
  exports.ActiveFormCoordinateField = ActiveFormCoordinateField;