@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/dev.js CHANGED
@@ -40088,7 +40088,8 @@ function PositiveNumberFormat(_ref) {
40088
40088
  isNumericString = _ref.isNumericString,
40089
40089
  allowNegative = _ref.allowNegative,
40090
40090
  decimalScale = _ref.decimalScale,
40091
- 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']);
40092
40093
 
40093
40094
  return React__default.createElement(NumberFormat, _extends$1({}, other, {
40094
40095
  getInputRef: inputRef,
@@ -40103,7 +40104,8 @@ function PositiveNumberFormat(_ref) {
40103
40104
  thousandSeparator: thousandSeparator,
40104
40105
  isNumericString: isNumericString,
40105
40106
  allowNegative: allowNegative,
40106
- decimalScale: decimalScale
40107
+ decimalScale: decimalScale,
40108
+ fixedDecimalScale: fixedDecimalScale
40107
40109
  }));
40108
40110
  }
40109
40111
 
@@ -40119,14 +40121,17 @@ PositiveNumberFormat.propTypes = {
40119
40121
  // Is allow negative numbers
40120
40122
  allowNegative: PropTypes__default.bool,
40121
40123
  // No of decimal digits
40122
- decimalScale: PropTypes__default.number
40124
+ decimalScale: PropTypes__default.number,
40125
+ //If true it add 0s to match given decimalScale.
40126
+ fixedDecimalScale: PropTypes__default.bool
40123
40127
  };
40124
40128
 
40125
40129
  PositiveNumberFormat.defaultProps = {
40126
40130
  thousandSeparator: true,
40127
40131
  isNumericString: false,
40128
40132
  allowNegative: false,
40129
- decimalScale: 0
40133
+ decimalScale: 0,
40134
+ fixedDecimalScale: false
40130
40135
  };
40131
40136
 
40132
40137
  var HelpOutline = createCommonjsModule(function (module, exports) {
@@ -53585,32 +53590,22 @@ UPositiveInteger.propTypes = {
53585
53590
  withRequiredValidator: PropTypes__default.bool
53586
53591
  };
53587
53592
 
53588
- var useStyles$n = makeStyles$1(function (theme) {
53589
- return {
53590
- startAdornmentContainer: {
53591
- marginRight: theme.spacing(0.5)
53592
- }
53593
- };
53594
- });
53595
-
53596
53593
  function UCurrencyField(_ref) {
53597
53594
  var inputPrefix = _ref.inputPrefix,
53598
53595
  decimalScale = _ref.decimalScale,
53599
- InputProps = _ref.InputProps,
53596
+ fixedDecimalScale = _ref.fixedDecimalScale,
53597
+ textAlign = _ref.textAlign,
53600
53598
  inputProps = _ref.inputProps,
53601
- props = objectWithoutProperties(_ref, ['inputPrefix', 'decimalScale', 'InputProps', 'inputProps']);
53599
+ props = objectWithoutProperties(_ref, ['inputPrefix', 'decimalScale', 'fixedDecimalScale', 'textAlign', 'inputProps']);
53602
53600
 
53603
- var classes = useStyles$n(props);
53604
53601
  return React__default.createElement(UPositiveInteger, _extends$1({
53605
53602
  variant: 'outlined',
53606
- InputProps: _extends$1({
53607
- startAdornment: React__default.createElement(
53608
- 'span',
53609
- { className: classes.startAdornmentContainer },
53610
- inputPrefix
53611
- )
53612
- }, InputProps),
53613
- inputProps: _extends$1({ decimalScale: decimalScale }, inputProps)
53603
+ inputProps: _extends$1({
53604
+ decimalScale: decimalScale,
53605
+ fixedDecimalScale: fixedDecimalScale,
53606
+ prefix: inputPrefix,
53607
+ style: { textAlign: textAlign }
53608
+ }, inputProps)
53614
53609
  }, props));
53615
53610
  }
53616
53611
 
@@ -53642,12 +53637,18 @@ UCurrencyField.propTypes = {
53642
53637
  /** To make the content readOnly */
53643
53638
  readOnly: PropTypes__default.bool,
53644
53639
  /** Name of input. */
53645
- name: PropTypes__default.string
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
53646
53645
  };
53647
53646
 
53648
53647
  UCurrencyField.defaultProps = {
53649
- inputPrefix: '$',
53650
- decimalScale: 2
53648
+ inputPrefix: '$ ',
53649
+ decimalScale: 2,
53650
+ fixedDecimalScale: true,
53651
+ textAlign: 'right'
53651
53652
  };
53652
53653
 
53653
53654
  function ActiveFormPositiveInteger(_ref) {
@@ -53698,32 +53699,22 @@ ActiveFormPositiveInteger.propTypes = {
53698
53699
  withRequiredValidator: PropTypes__default.bool
53699
53700
  };
53700
53701
 
53701
- var useStyles$o = makeStyles$1(function (theme) {
53702
- return {
53703
- startAdornmentContainer: {
53704
- marginRight: theme.spacing(0.5)
53705
- }
53706
- };
53707
- });
53708
-
53709
53702
  function ActiveCurrencyField(_ref) {
53710
53703
  var inputPrefix = _ref.inputPrefix,
53711
53704
  decimalScale = _ref.decimalScale,
53712
- InputProps = _ref.InputProps,
53705
+ fixedDecimalScale = _ref.fixedDecimalScale,
53706
+ textAlign = _ref.textAlign,
53713
53707
  inputProps = _ref.inputProps,
53714
- props = objectWithoutProperties(_ref, ['inputPrefix', 'decimalScale', 'InputProps', 'inputProps']);
53708
+ props = objectWithoutProperties(_ref, ['inputPrefix', 'decimalScale', 'fixedDecimalScale', 'textAlign', 'inputProps']);
53715
53709
 
53716
- var classes = useStyles$o(props);
53717
53710
  return React__default.createElement(ActiveFormPositiveInteger, _extends$1({
53718
53711
  variant: 'outlined',
53719
- InputProps: _extends$1({
53720
- startAdornment: React__default.createElement(
53721
- 'span',
53722
- { className: classes.startAdornmentContainer },
53723
- inputPrefix
53724
- )
53725
- }, InputProps),
53726
- inputProps: _extends$1({ decimalScale: decimalScale }, inputProps)
53712
+ inputProps: _extends$1({
53713
+ decimalScale: decimalScale,
53714
+ fixedDecimalScale: fixedDecimalScale,
53715
+ prefix: inputPrefix,
53716
+ style: { textAlign: textAlign }
53717
+ }, inputProps)
53727
53718
  }, props));
53728
53719
  }
53729
53720
 
@@ -53765,12 +53756,16 @@ ActiveCurrencyField.propTypes = {
53765
53756
  /** It triggers after each validation.It will return true or false. */
53766
53757
  validatorListener: PropTypes__default.func,
53767
53758
  /** Allow to use required validator in any validation trigger, not only form submit. */
53768
- withRequiredValidator: PropTypes__default.bool
53759
+ withRequiredValidator: PropTypes__default.bool,
53760
+ /** Input text align */
53761
+ textAlign: PropTypes__default.string
53769
53762
  };
53770
53763
 
53771
53764
  ActiveCurrencyField.defaultProps = {
53772
- inputPrefix: '$',
53773
- decimalScale: 2
53765
+ inputPrefix: '$ ',
53766
+ decimalScale: 2,
53767
+ fixedDecimalScale: true,
53768
+ textAlign: 'right'
53774
53769
  };
53775
53770
 
53776
53771
  var DeleteOutlined = createCommonjsModule(function (module, exports) {
@@ -53797,7 +53792,7 @@ exports.default = _default;
53797
53792
 
53798
53793
  var DeleteOutlinedIcon = unwrapExports(DeleteOutlined);
53799
53794
 
53800
- var useStyles$p = makeStyles$1(function (theme) {
53795
+ var useStyles$n = makeStyles$1(function (theme) {
53801
53796
  return {
53802
53797
  menuDelete: {
53803
53798
  width: '500px'
@@ -53817,7 +53812,7 @@ var useStyles$p = makeStyles$1(function (theme) {
53817
53812
  * It has two varint icon/menu item
53818
53813
  */
53819
53814
  function UConfirmationButton(props) {
53820
- var classes = useStyles$p();
53815
+ var classes = useStyles$n();
53821
53816
  var onConfirm = props.onConfirm,
53822
53817
  id = props.id,
53823
53818
  buttonText = props.buttonText,
@@ -53932,7 +53927,7 @@ UConfirmationButton.defaultProps = {
53932
53927
  /**
53933
53928
  * displays radio buttons
53934
53929
  */
53935
- var useStyles$q = makeStyles$1(function (theme) {
53930
+ var useStyles$o = makeStyles$1(function (theme) {
53936
53931
  return {
53937
53932
  padding: {
53938
53933
  paddingLeft: theme.spacing(3)
@@ -53953,7 +53948,7 @@ function URadioButtons(_ref) {
53953
53948
  optionLabels = _ref.optionLabels,
53954
53949
  optionValues = _ref.optionValues;
53955
53950
 
53956
- var classes = useStyles$q();
53951
+ var classes = useStyles$o();
53957
53952
  var handleOnChange = function handleOnChange(event) {
53958
53953
  onChange && onChange(event);
53959
53954
  };
@@ -54057,7 +54052,7 @@ exports.default = _default;
54057
54052
 
54058
54053
  var DoneIcon = unwrapExports(Done);
54059
54054
 
54060
- var useStyles$r = makeStyles$1(function (theme) {
54055
+ var useStyles$p = makeStyles$1(function (theme) {
54061
54056
  return {
54062
54057
  root: {
54063
54058
  position: 'fixed',
@@ -54089,7 +54084,7 @@ function UAsyncBadge(_ref) {
54089
54084
  visible = _ref.visible,
54090
54085
  onReset = _ref.onReset;
54091
54086
 
54092
- var classes = useStyles$r();
54087
+ var classes = useStyles$p();
54093
54088
 
54094
54089
  /** If variant is success or error, after few seconds, it will set asyncResponse visible to false */
54095
54090
  React.useEffect(function () {
@@ -54128,7 +54123,7 @@ UAsyncBadge.propTypes = {
54128
54123
  onReset: PropTypes__default.func
54129
54124
  };
54130
54125
 
54131
- var useStyles$s = makeStyles$1(function () {
54126
+ var useStyles$q = makeStyles$1(function () {
54132
54127
  return {
54133
54128
  pageLoadingProgress: {
54134
54129
  height: '50vh',
@@ -54143,7 +54138,7 @@ var useStyles$s = makeStyles$1(function () {
54143
54138
  * 2. Display text message
54144
54139
  */
54145
54140
  function UPageLoadingProgress(props) {
54146
- var classes = useStyles$s();
54141
+ var classes = useStyles$q();
54147
54142
  var text = props.text;
54148
54143
 
54149
54144
  return React__default.createElement(
@@ -56526,7 +56521,7 @@ UErrorAlert.defaultProps = {
56526
56521
 
56527
56522
  var filter = createFilterOptions();
56528
56523
 
56529
- var useStyles$t = makeStyles$1(function (theme) {
56524
+ var useStyles$r = makeStyles$1(function (theme) {
56530
56525
  return {
56531
56526
  controlStyle: {
56532
56527
  marginTop: theme.spacing(2),
@@ -56552,9 +56547,12 @@ function UAutoComplete(_ref) {
56552
56547
  maxLength = _ref.maxLength,
56553
56548
  usedItemIds = _ref.usedItemIds,
56554
56549
  allowContextSpecific = _ref.allowContextSpecific,
56550
+ counter = _ref.counter,
56551
+ placeholder = _ref.placeholder,
56552
+ InputLabelProps = _ref.InputLabelProps,
56555
56553
  props = _ref.props;
56556
56554
 
56557
- var classes = useStyles$t();
56555
+ var classes = useStyles$r();
56558
56556
  //const dispatch = useDispatch()
56559
56557
 
56560
56558
  var _useState = React.useState(value || null),
@@ -56612,16 +56610,19 @@ function UAutoComplete(_ref) {
56612
56610
  var controlOptions = options && options.length > 0 ? options.filter(function (opt) {
56613
56611
  return !usedItemIds.includes(opt.id);
56614
56612
  }) : [];
56615
-
56616
56613
  return React__default.createElement(
56617
56614
  React__default.Fragment,
56618
56615
  null,
56619
56616
  readOnly ? React__default.createElement(ActiveFormTextField, {
56620
56617
  multiline: true,
56621
- label: label + '*',
56618
+ label: label,
56619
+ InputLabelProps: _extends$1({}, InputLabelProps, {
56620
+ required: isRequired
56621
+ }),
56622
56622
  variant: 'outlined',
56623
56623
  fullWidth: true,
56624
56624
  readOnly: readOnly,
56625
+ placeholder: placeholder,
56625
56626
  value: selectedValue && selectedValue.text
56626
56627
  }) : React__default.createElement(Autocomplete$1, {
56627
56628
  value: selectedValue,
@@ -56652,7 +56653,7 @@ function UAutoComplete(_ref) {
56652
56653
  renderInput: function renderInput(params) {
56653
56654
  return React__default.createElement(ActiveFormTextField, _extends$1({}, params, {
56654
56655
  multiline: true,
56655
- label: '' + label + (isRequired ? '*' : ''),
56656
+ label: label,
56656
56657
  variant: 'outlined',
56657
56658
  value: selectedValue && selectedValue.text || '',
56658
56659
  validators: isRequired ? ['required', 'trim'] : ['trim'],
@@ -56661,8 +56662,13 @@ function UAutoComplete(_ref) {
56661
56662
  minLength: minLength,
56662
56663
  maxLength: maxLength
56663
56664
  }),
56665
+ InputLabelProps: _extends$1({}, InputLabelProps, {
56666
+ required: isRequired
56667
+ }),
56664
56668
  maxLength: maxLength,
56665
- counter: true
56669
+ counter: counter,
56670
+ placeholder: placeholder,
56671
+ readOnly: readOnly
56666
56672
  }));
56667
56673
  }
56668
56674
  })
@@ -56693,17 +56699,24 @@ UAutoComplete.propTypes = {
56693
56699
  /** can create context specific item or not */
56694
56700
  allowContextSpecific: PropTypes__default.bool,
56695
56701
  /** used item id's from the options */
56696
- 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
56697
56709
  };
56698
56710
 
56699
56711
  UAutoComplete.defaultProps = {
56700
56712
  allowContextSpecific: false,
56713
+ counter: false,
56701
56714
  usedItemIds: []
56702
56715
  };
56703
56716
 
56704
56717
  /* eslint-disable no-nested-ternary */
56705
56718
 
56706
- var useStyles$u = makeStyles$1(function (theme) {
56719
+ var useStyles$s = makeStyles$1(function (theme) {
56707
56720
  var _ref;
56708
56721
 
56709
56722
  return _ref = {
@@ -56735,7 +56748,7 @@ var useStyles$u = makeStyles$1(function (theme) {
56735
56748
  * Breadcrumbs is a component to implement current user path of the application
56736
56749
  */
56737
56750
  function UBreadcrumbs(props) {
56738
- var classes = useStyles$u();
56751
+ var classes = useStyles$s();
56739
56752
  var breadcrumbLinks = props.breadcrumbLinks;
56740
56753
 
56741
56754
 
@@ -56812,7 +56825,7 @@ UInfiniteScroll.propTypes = {
56812
56825
  onEndOfScroll: PropTypes__default.func
56813
56826
  };
56814
56827
 
56815
- var useStyles$v = makeStyles$1(function (theme) {
56828
+ var useStyles$t = makeStyles$1(function (theme) {
56816
56829
  return {
56817
56830
  small: {
56818
56831
  width: theme.spacing(4),
@@ -56857,7 +56870,7 @@ function UAvatarImage(_ref) {
56857
56870
  zIndexValue = _ref.zIndexValue,
56858
56871
  loadPhoto = _ref.loadPhoto;
56859
56872
 
56860
- var classes = useStyles$v();
56873
+ var classes = useStyles$t();
56861
56874
 
56862
56875
  var _useState = React.useState(''),
56863
56876
  _useState2 = slicedToArray(_useState, 2),
@@ -57289,7 +57302,7 @@ exports.default = _default;
57289
57302
 
57290
57303
  var CloseIcon$1 = unwrapExports(Close);
57291
57304
 
57292
- var useStyles$w = makeStyles$1(function (theme) {
57305
+ var useStyles$u = makeStyles$1(function (theme) {
57293
57306
  return {
57294
57307
  root: {
57295
57308
  width: '100%',
@@ -57329,7 +57342,7 @@ function USearchBox(_ref) {
57329
57342
  searchValue = _useState2[0],
57330
57343
  setSearch = _useState2[1];
57331
57344
 
57332
- var classes = useStyles$w();
57345
+ var classes = useStyles$u();
57333
57346
 
57334
57347
  var handleChange = function handleChange(event) {
57335
57348
  setSearch(event.target.value);
@@ -57430,7 +57443,7 @@ var styles$16 = {
57430
57443
  }
57431
57444
  };
57432
57445
 
57433
- var useStyles$x = makeStyles$1(function (theme) {
57446
+ var useStyles$v = makeStyles$1(function (theme) {
57434
57447
  return {
57435
57448
  textField: {
57436
57449
  marginTop: theme.spacing(0.25),
@@ -57473,7 +57486,7 @@ var useStyles$x = makeStyles$1(function (theme) {
57473
57486
  * ActiveKeyboardDatePicker is a customized [Material Ui KeyboardDatePicker]('https://material-ui-pickers.dev/api/KeyboardDatePicker') for more details
57474
57487
  */
57475
57488
  function ActiveKeyboardDatePicker(props) {
57476
- var classes = useStyles$x(props);
57489
+ var classes = useStyles$v(props);
57477
57490
  var autoOk = props.autoOk,
57478
57491
  variant = props.variant,
57479
57492
  inputVariant = props.inputVariant,
@@ -57592,7 +57605,7 @@ var styles$17 = {
57592
57605
  }
57593
57606
  };
57594
57607
 
57595
- var useStyles$y = makeStyles$1(function (theme) {
57608
+ var useStyles$w = makeStyles$1(function (theme) {
57596
57609
  return {
57597
57610
  textField: {
57598
57611
  marginTop: theme.spacing(0.25),
@@ -57631,7 +57644,7 @@ var useStyles$y = makeStyles$1(function (theme) {
57631
57644
  * Please have look at [Material Ui Date Picker]('https://material-ui-pickers.dev/api/DatePicker') for more details
57632
57645
  */
57633
57646
  function ActiveDatePicker(props) {
57634
- var classes = useStyles$y(props);
57647
+ var classes = useStyles$w(props);
57635
57648
  var autoOk = props.autoOk,
57636
57649
  variant = props.variant,
57637
57650
  inputVariant = props.inputVariant,
@@ -57725,7 +57738,7 @@ var styles$18 = {
57725
57738
  }
57726
57739
  };
57727
57740
 
57728
- var useStyles$z = makeStyles$1(function (theme) {
57741
+ var useStyles$x = makeStyles$1(function (theme) {
57729
57742
  return {
57730
57743
  textField: {
57731
57744
  marginTop: theme.spacing(0.25),
@@ -57764,7 +57777,7 @@ var useStyles$z = makeStyles$1(function (theme) {
57764
57777
  * Please have look at [Material Ui TimePicker]('https://material-ui-pickers.dev/api/TimePicker') for more details
57765
57778
  */
57766
57779
  function ActiveTimePicker(props) {
57767
- var classes = useStyles$z(props);
57780
+ var classes = useStyles$x(props);
57768
57781
  var inputVariant = props.inputVariant,
57769
57782
  readOnly = props.readOnly,
57770
57783
  interactiveMode = props.interactiveMode,
@@ -57849,7 +57862,7 @@ var styles$19 = {
57849
57862
  }
57850
57863
  };
57851
57864
 
57852
- var useStyles$A = makeStyles$1(function (theme) {
57865
+ var useStyles$y = makeStyles$1(function (theme) {
57853
57866
  return {
57854
57867
  textField: {
57855
57868
  marginTop: theme.spacing(0.25),
@@ -57892,7 +57905,7 @@ var useStyles$A = makeStyles$1(function (theme) {
57892
57905
  * ActiveKeyboardTimePicker is customized [ Material Ui KeyboardTimePicker](https://material-ui-pickers.dev/api/KeyboardTimePicker)
57893
57906
  */
57894
57907
  function ActiveKeyboardTimePicker(props) {
57895
- var classes = useStyles$A(props);
57908
+ var classes = useStyles$y(props);
57896
57909
  var inputVariant = props.inputVariant,
57897
57910
  readOnly = props.readOnly,
57898
57911
  interactiveMode = props.interactiveMode,
@@ -57994,6 +58007,207 @@ ActiveKeyboardTimePicker.defaultProps = {
57994
58007
  variant: 'inline'
57995
58008
  };
57996
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;
57997
58211
  exports.ActiveCurrencyField = ActiveCurrencyField;
57998
58212
  exports.ActiveDatePicker = ActiveDatePicker;
57999
58213
  exports.ActiveFormCoordinateField = ActiveFormCoordinateField;