@ornikar/kitt-universal 16.3.1 → 16.4.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.
Files changed (74) hide show
  1. package/dist/definitions/GoogleMapsApiKeyProvider/GoogleMapsApiKeyProvider.d.ts +8 -0
  2. package/dist/definitions/GoogleMapsApiKeyProvider/GoogleMapsApiKeyProvider.d.ts.map +1 -0
  3. package/dist/definitions/GoogleMapsApiKeyProvider/hooks/useGoogleMapApiKey.d.ts +2 -0
  4. package/dist/definitions/GoogleMapsApiKeyProvider/hooks/useGoogleMapApiKey.d.ts.map +1 -0
  5. package/dist/definitions/GoogleMapsAutocompleteProvider/GoogleMapsAutocompleteProvider.d.ts +17 -0
  6. package/dist/definitions/GoogleMapsAutocompleteProvider/GoogleMapsAutocompleteProvider.d.ts.map +1 -0
  7. package/dist/definitions/GoogleMapsAutocompleteProvider/hooks/useGoogleMapsApi.d.ts +20 -0
  8. package/dist/definitions/GoogleMapsAutocompleteProvider/hooks/useGoogleMapsApi.d.ts.map +1 -0
  9. package/dist/definitions/GoogleMapsAutocompleteProvider/hooks/useGoogleMapsApi.web.d.ts +3 -0
  10. package/dist/definitions/GoogleMapsAutocompleteProvider/hooks/useGoogleMapsApi.web.d.ts.map +1 -0
  11. package/dist/definitions/GoogleMapsAutocompleteProvider/hooks/useGoogleMapsAutocomplete.d.ts +3 -0
  12. package/dist/definitions/GoogleMapsAutocompleteProvider/hooks/useGoogleMapsAutocomplete.d.ts.map +1 -0
  13. package/dist/definitions/GoogleMapsAutocompleteProvider/reducer/googleMapsAutocompleteReducer.d.ts +40 -0
  14. package/dist/definitions/GoogleMapsAutocompleteProvider/reducer/googleMapsAutocompleteReducer.d.ts.map +1 -0
  15. package/dist/definitions/GoogleMapsAutocompleteProvider/types.d.ts +5 -0
  16. package/dist/definitions/GoogleMapsAutocompleteProvider/types.d.ts.map +1 -0
  17. package/dist/definitions/GoogleMapsAutocompleteProvider/utils/formatAddressFromGoogle.d.ts +20 -0
  18. package/dist/definitions/GoogleMapsAutocompleteProvider/utils/formatAddressFromGoogle.d.ts.map +1 -0
  19. package/dist/definitions/GoogleMapsAutocompleteProvider/utils/makeMapsApiUrl.d.ts +2 -0
  20. package/dist/definitions/GoogleMapsAutocompleteProvider/utils/makeMapsApiUrl.d.ts.map +1 -0
  21. package/dist/definitions/forms/Autocomplete/Autocomplete.d.ts +40 -0
  22. package/dist/definitions/forms/Autocomplete/Autocomplete.d.ts.map +1 -0
  23. package/dist/definitions/forms/Autocomplete/AutocompleteItem.d.ts +13 -0
  24. package/dist/definitions/forms/Autocomplete/AutocompleteItem.d.ts.map +1 -0
  25. package/dist/definitions/forms/Autocomplete/AutocompleteItemsListContainer.d.ts +10 -0
  26. package/dist/definitions/forms/Autocomplete/AutocompleteItemsListContainer.d.ts.map +1 -0
  27. package/dist/definitions/forms/Autocomplete/AutocompleteOption.d.ts +8 -0
  28. package/dist/definitions/forms/Autocomplete/AutocompleteOption.d.ts.map +1 -0
  29. package/dist/definitions/forms/InputAddress/InputAddress.d.ts +15 -0
  30. package/dist/definitions/forms/InputAddress/InputAddress.d.ts.map +1 -0
  31. package/dist/definitions/forms/InputAddress/InputAddressOption.d.ts +7 -0
  32. package/dist/definitions/forms/InputAddress/InputAddressOption.d.ts.map +1 -0
  33. package/dist/definitions/forms/InputAddress/utils/defaultItemToString.d.ts +3 -0
  34. package/dist/definitions/forms/InputAddress/utils/defaultItemToString.d.ts.map +1 -0
  35. package/dist/definitions/forms/InputAddress/utils/formatInitialValueToAutocompletePrediction.d.ts +4 -0
  36. package/dist/definitions/forms/InputAddress/utils/formatInitialValueToAutocompletePrediction.d.ts.map +1 -0
  37. package/dist/definitions/index.d.ts +10 -0
  38. package/dist/definitions/index.d.ts.map +1 -1
  39. package/dist/definitions/native-base/KittNativeBaseProvider.d.ts +46 -13
  40. package/dist/definitions/native-base/KittNativeBaseProvider.d.ts.map +1 -1
  41. package/dist/definitions/story-components/StorySection.d.ts +3 -3
  42. package/dist/definitions/story-components/StorySection.d.ts.map +1 -1
  43. package/dist/definitions/themes/default.d.ts +1 -0
  44. package/dist/definitions/themes/default.d.ts.map +1 -1
  45. package/dist/definitions/themes/late-ocean/autocomplete.d.ts +37 -0
  46. package/dist/definitions/themes/late-ocean/autocomplete.d.ts.map +1 -0
  47. package/dist/definitions/themes/late-ocean/forms.d.ts +1 -0
  48. package/dist/definitions/themes/late-ocean/forms.d.ts.map +1 -1
  49. package/dist/index-browser-all.es.android.js +1073 -185
  50. package/dist/index-browser-all.es.android.js.map +1 -1
  51. package/dist/index-browser-all.es.ios.js +1073 -185
  52. package/dist/index-browser-all.es.ios.js.map +1 -1
  53. package/dist/index-browser-all.es.js +1073 -185
  54. package/dist/index-browser-all.es.js.map +1 -1
  55. package/dist/index-browser-all.es.web.js +1040 -190
  56. package/dist/index-browser-all.es.web.js.map +1 -1
  57. package/dist/index-node-14.17.cjs.js +931 -142
  58. package/dist/index-node-14.17.cjs.js.map +1 -1
  59. package/dist/index-node-14.17.cjs.web.js +892 -111
  60. package/dist/index-node-14.17.cjs.web.js.map +1 -1
  61. package/dist/linaria-themes-browser-all.es.android.js +37 -0
  62. package/dist/linaria-themes-browser-all.es.android.js.map +1 -1
  63. package/dist/linaria-themes-browser-all.es.ios.js +37 -0
  64. package/dist/linaria-themes-browser-all.es.ios.js.map +1 -1
  65. package/dist/linaria-themes-browser-all.es.js +37 -0
  66. package/dist/linaria-themes-browser-all.es.js.map +1 -1
  67. package/dist/linaria-themes-browser-all.es.web.js +37 -0
  68. package/dist/linaria-themes-browser-all.es.web.js.map +1 -1
  69. package/dist/linaria-themes-node-14.17.cjs.js +37 -0
  70. package/dist/linaria-themes-node-14.17.cjs.js.map +1 -1
  71. package/dist/linaria-themes-node-14.17.cjs.web.js +37 -0
  72. package/dist/linaria-themes-node-14.17.cjs.web.js.map +1 -1
  73. package/dist/tsbuildinfo +1 -1
  74. package/package.json +6 -3
@@ -1,4 +1,4 @@
1
- import { useContext, createContext, forwardRef, cloneElement, useState, useRef, useEffect, useMemo, Children, useReducer, Fragment as Fragment$1, createElement } from 'react';
1
+ import { useContext, createContext, forwardRef, cloneElement, useState, useRef, useEffect, useMemo, Children, useReducer, useCallback, Fragment as Fragment$1, createElement } from 'react';
2
2
  import { View as View$1, ScrollView as ScrollView$1, Pressable as Pressable$1, Image as Image$1, FlatList as FlatList$1, SectionList as SectionList$1, Stack as Stack$1, VStack as VStack$1, HStack as HStack$1, Center as Center$1, useBreakpointValue as useBreakpointValue$1, useSx, Text, Input, NativeBaseProvider, extendTheme } from 'native-base';
3
3
  export { useClipboard, useMediaQuery, useSx, useToken } from 'native-base';
4
4
  import _objectSpread from '@babel/runtime/helpers/objectSpread2';
@@ -9,17 +9,20 @@ import _extends from '@babel/runtime/helpers/extends';
9
9
  import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
10
10
  import _regeneratorRuntime from '@babel/runtime/helpers/regeneratorRuntime';
11
11
  import _asyncToGenerator from '@babel/runtime/helpers/asyncToGenerator';
12
- import { ArcIcon, UserIcon, CheckboxMark, EyeOffIcon, EyeIcon, InfoIcon, AlertTriangleIcon, CheckIcon, AlertCircleIcon, XIcon, RotateCCWIcon, TooltipArrowIcon } from '@ornikar/kitt-icons';
12
+ import { ArcIcon, UserIcon, ArrowUpIcon, ArrowDownIcon, CheckboxMark, MapPinIcon, EyeOffIcon, EyeIcon, InfoIcon, AlertTriangleIcon, CheckIcon, AlertCircleIcon, XIcon, RotateCCWIcon, TooltipArrowIcon } from '@ornikar/kitt-icons';
13
13
  export * from '@ornikar/kitt-icons';
14
14
  import { Portal } from 'react-portal';
15
15
  import { CSSTransition } from 'react-transition-group';
16
16
  import { ScrollView as ScrollView$2, View as View$2, Linking, Pressable as Pressable$2, useWindowDimensions } from 'react-native';
17
17
  export { useWindowDimensions as useWindowSize } from 'react-native';
18
18
  import { parse } from 'twemoji-parser';
19
+ import _typeof from '@babel/runtime/helpers/typeof';
20
+ import Downshift, { useSelect } from 'downshift';
21
+ import { useDebouncedCallback } from 'use-debounce';
22
+ import { Loader } from '@googlemaps/js-api-loader';
19
23
  import { parseNumber, getCountryCallingCode, isValidNumber } from 'libphonenumber-js';
20
24
  import { useSafeAreaInsets } from 'react-native-safe-area-context';
21
25
  import { useFloating, autoUpdate, offset, autoPlacement, shift, arrow } from '@floating-ui/react-dom';
22
- import { useSelect } from 'downshift';
23
26
  import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
24
27
  import { useOnClickOutside } from 'usehooks-ts';
25
28
  import { makeDecorator } from '@storybook/addons';
@@ -744,6 +747,42 @@ var feedbackMessage = {
744
747
  }
745
748
  };
746
749
 
750
+ var autocomplete = {
751
+ option: {
752
+ verticalPadding: 2,
753
+ minHeight: 40,
754
+ "default": {
755
+ backgroundColor: colors.white
756
+ },
757
+ hovered: {
758
+ backgroundColor: lateOceanColorPalette.black50
759
+ },
760
+ focused: {
761
+ backgroundColor: lateOceanColorPalette.black50
762
+ },
763
+ selected: {
764
+ backgroundColor: lateOceanColorPalette.black50
765
+ },
766
+ highlighted: {
767
+ backgroundColor: lateOceanColorPalette.black50
768
+ },
769
+ pressed: {
770
+ backgroundColor: lateOceanColorPalette.black100
771
+ }
772
+ },
773
+ optionsContainer: {
774
+ borderRadius: 10,
775
+ backgroundColor: colors.white,
776
+ shadow: {
777
+ color: colors.black,
778
+ offsetX: 0,
779
+ offsetY: 10,
780
+ opacity: 0.15,
781
+ radius: 20
782
+ }
783
+ }
784
+ };
785
+
747
786
  var checkbox = {
748
787
  borderWidth: 2,
749
788
  borderRadius: 5,
@@ -1047,6 +1086,7 @@ var timePicker = {
1047
1086
  };
1048
1087
 
1049
1088
  var forms = {
1089
+ autocomplete: autocomplete,
1050
1090
  datePicker: datePicker,
1051
1091
  input: input,
1052
1092
  radio: radio,
@@ -1838,7 +1878,7 @@ var isTypographyHeader = function (type, isHeaderTypographyInContext) {
1838
1878
  throw new Error('You must set a "base" prop or wrap this Typography in one that does.');
1839
1879
  };
1840
1880
 
1841
- var _excluded$I = ["accessibilityRole", "base", "small", "medium", "large", "wide", "type", "variant", "color"];
1881
+ var _excluded$L = ["accessibilityRole", "base", "small", "medium", "large", "wide", "type", "variant", "color"];
1842
1882
  var IsHeaderTypographyContext = /*#__PURE__*/createContext(undefined);
1843
1883
  var TypographyColorContext = /*#__PURE__*/createContext('black');
1844
1884
  function useTypographyColor() {
@@ -1888,7 +1928,7 @@ function Typography(_ref) {
1888
1928
  } : _ref$type,
1889
1929
  variant = _ref.variant,
1890
1930
  color = _ref.color,
1891
- otherProps = _objectWithoutProperties(_ref, _excluded$I);
1931
+ otherProps = _objectWithoutProperties(_ref, _excluded$L);
1892
1932
  var sx = useSx();
1893
1933
  var isHeaderTypographyInContext = useContext(IsHeaderTypographyContext);
1894
1934
  var defaultColor = useTypographyDefaultColor();
@@ -1993,11 +2033,11 @@ function Icon(_ref) {
1993
2033
  });
1994
2034
  }
1995
2035
 
1996
- var _excluded$H = ["color"],
1997
- _excluded2$6 = ["color"];
2036
+ var _excluded$K = ["color"],
2037
+ _excluded2$7 = ["color"];
1998
2038
  function TypographyIconSpecifiedColor(_ref) {
1999
2039
  var color = _ref.color,
2000
- props = _objectWithoutProperties(_ref, _excluded$H);
2040
+ props = _objectWithoutProperties(_ref, _excluded$K);
2001
2041
  var sx = useSx();
2002
2042
  var colorStyle = sx({
2003
2043
  color: getTypographyColorValue(color)
@@ -2012,7 +2052,7 @@ function TypographyIconInheritColor(props) {
2012
2052
  }
2013
2053
  function TypographyIcon(_ref2) {
2014
2054
  var color = _ref2.color,
2015
- props = _objectWithoutProperties(_ref2, _excluded2$6);
2055
+ props = _objectWithoutProperties(_ref2, _excluded2$7);
2016
2056
  if (color) {
2017
2057
  return /*#__PURE__*/jsx(TypographyIconSpecifiedColor, _objectSpread({
2018
2058
  color: color
@@ -2041,7 +2081,7 @@ var getTextColorByType = function (type, variant, isHovered, isPressed) {
2041
2081
  }
2042
2082
  };
2043
2083
 
2044
- var _excluded$G = ["type", "variant", "isDisabled", "icon", "children", "isHovered", "isPressed", "isFocused"];
2084
+ var _excluded$J = ["type", "variant", "isDisabled", "icon", "children", "isHovered", "isPressed", "isFocused"];
2045
2085
  function ButtonIcon(_ref) {
2046
2086
  var icon = _ref.icon,
2047
2087
  color = _ref.color,
@@ -2116,7 +2156,7 @@ function ButtonContent(_ref3) {
2116
2156
  isHovered = _ref3.isHovered,
2117
2157
  isPressed = _ref3.isPressed;
2118
2158
  _ref3.isFocused;
2119
- var props = _objectWithoutProperties(_ref3, _excluded$G);
2159
+ var props = _objectWithoutProperties(_ref3, _excluded$J);
2120
2160
  var color = isDisabled ? 'black-light' : getTextColorByType(type, variant, isHovered, isPressed);
2121
2161
  return /*#__PURE__*/jsx(View, {
2122
2162
  _web: {
@@ -2337,7 +2377,7 @@ function LoaderIcon(_ref) {
2337
2377
  });
2338
2378
  }
2339
2379
 
2340
- var _excluded$F = ["as", "onPress", "disabled", "icon", "stretch"];
2380
+ var _excluded$I = ["as", "onPress", "disabled", "icon", "stretch"];
2341
2381
  function ActionsItem(_ref) {
2342
2382
  var as = _ref.as,
2343
2383
  onPress = _ref.onPress,
@@ -2348,7 +2388,7 @@ function ActionsItem(_ref) {
2348
2388
  base: true,
2349
2389
  medium: false
2350
2390
  } : _ref$stretch,
2351
- props = _objectWithoutProperties(_ref, _excluded$F);
2391
+ props = _objectWithoutProperties(_ref, _excluded$I);
2352
2392
  var _useState = useState(false),
2353
2393
  _useState2 = _slicedToArray(_useState, 2),
2354
2394
  isLoading = _useState2[0],
@@ -2419,7 +2459,7 @@ function ActionsButton(_ref) {
2419
2459
  }, props));
2420
2460
  }
2421
2461
 
2422
- var _excluded$E = ["children", "layout", "reversed"];
2462
+ var _excluded$H = ["children", "layout", "reversed"];
2423
2463
  function getCurrentLayout(layout) {
2424
2464
  if (!layout) return {
2425
2465
  base: 'stretch',
@@ -2448,7 +2488,7 @@ function Actions(_ref) {
2448
2488
  var children = _ref.children,
2449
2489
  layout = _ref.layout,
2450
2490
  reversed = _ref.reversed,
2451
- props = _objectWithoutProperties(_ref, _excluded$E);
2491
+ props = _objectWithoutProperties(_ref, _excluded$H);
2452
2492
  var currentAlignItems = getCurrentLayout(layout);
2453
2493
  var currentDirection = getCurrentDirection(layout);
2454
2494
  var currentAlignSelf = getCurrentAlignSelf(layout);
@@ -2497,7 +2537,7 @@ function getInitials(firstname, lastname) {
2497
2537
  return "".concat(firstname[0]).concat(lastname[0]).toUpperCase();
2498
2538
  }
2499
2539
 
2500
- var _excluded$D = ["size", "round", "light", "sizeVariant"];
2540
+ var _excluded$G = ["size", "round", "light", "sizeVariant"];
2501
2541
  function AvatarContent(_ref) {
2502
2542
  var size = _ref.size,
2503
2543
  src = _ref.src,
@@ -2536,7 +2576,7 @@ function Avatar(_ref2) {
2536
2576
  round = _ref2.round,
2537
2577
  light = _ref2.light,
2538
2578
  sizeVariant = _ref2.sizeVariant,
2539
- props = _objectWithoutProperties(_ref2, _excluded$D);
2579
+ props = _objectWithoutProperties(_ref2, _excluded$G);
2540
2580
  var currentSize = getCurrentSize({
2541
2581
  size: size,
2542
2582
  sizeVariant: sizeVariant
@@ -2687,7 +2727,7 @@ function CardModalRotationContainer(props) {
2687
2727
  }, props));
2688
2728
  }
2689
2729
 
2690
- var _excluded$C = ["children", "appear", "visible", "unmountOnExit", "isAnimationEnabled", "onEnter", "onEntered", "onExit", "onExited", "onClose"];
2730
+ var _excluded$F = ["children", "appear", "visible", "unmountOnExit", "isAnimationEnabled", "onEnter", "onEntered", "onExit", "onExited", "onClose"];
2691
2731
  var contentAnimationEnter$1 = "kitt-u_contentAnimationEnter_c11xxy4r";
2692
2732
  var contentAnimatioEnterActive$1 = "kitt-u_contentAnimatioEnterActive_cl52117";
2693
2733
  var contentAnimatioExit$1 = "kitt-u_contentAnimatioExit_cyjczep";
@@ -2726,7 +2766,7 @@ function CardModalAnimation(_ref) {
2726
2766
  onExit = _ref.onExit,
2727
2767
  onExited = _ref.onExited,
2728
2768
  onClose = _ref.onClose,
2729
- props = _objectWithoutProperties(_ref, _excluded$C);
2769
+ props = _objectWithoutProperties(_ref, _excluded$F);
2730
2770
  var theme = useTheme();
2731
2771
  var animation = theme.kitt.cardModal.animation;
2732
2772
  var sharedProps = {
@@ -2759,11 +2799,11 @@ function CardModalAnimation(_ref) {
2759
2799
  }));
2760
2800
  }
2761
2801
 
2762
- var _excluded$B = ["children"],
2763
- _excluded2$5 = ["children", "visible", "onClose", "onExited"];
2802
+ var _excluded$E = ["children"],
2803
+ _excluded2$6 = ["children", "visible", "onClose", "onExited"];
2764
2804
  function CardModalScrollContainer(_ref) {
2765
2805
  var children = _ref.children,
2766
- props = _objectWithoutProperties(_ref, _excluded$B);
2806
+ props = _objectWithoutProperties(_ref, _excluded$E);
2767
2807
  return /*#__PURE__*/jsx(ScrollView, _objectSpread(_objectSpread({}, props), {}, {
2768
2808
  children: children
2769
2809
  }));
@@ -2773,7 +2813,7 @@ function CardModalBehaviour(_ref2) {
2773
2813
  visible = _ref2.visible,
2774
2814
  onClose = _ref2.onClose,
2775
2815
  onExited = _ref2.onExited,
2776
- props = _objectWithoutProperties(_ref2, _excluded2$5);
2816
+ props = _objectWithoutProperties(_ref2, _excluded2$6);
2777
2817
  var _useState = useState(visible),
2778
2818
  _useState2 = _slicedToArray(_useState, 2),
2779
2819
  isModalBehaviourVisible = _useState2[0],
@@ -2804,7 +2844,7 @@ function CardModalBehaviour(_ref2) {
2804
2844
  });
2805
2845
  }
2806
2846
 
2807
- var _excluded$A = ["children", "paddingX", "paddingY"];
2847
+ var _excluded$D = ["children", "paddingX", "paddingY"];
2808
2848
  function CardModalBody(_ref) {
2809
2849
  var children = _ref.children,
2810
2850
  _ref$paddingX = _ref.paddingX,
@@ -2814,7 +2854,7 @@ function CardModalBody(_ref) {
2814
2854
  } : _ref$paddingX,
2815
2855
  _ref$paddingY = _ref.paddingY,
2816
2856
  paddingY = _ref$paddingY === void 0 ? 'kitt.4' : _ref$paddingY,
2817
- props = _objectWithoutProperties(_ref, _excluded$A);
2857
+ props = _objectWithoutProperties(_ref, _excluded$D);
2818
2858
  return /*#__PURE__*/jsx(View, _objectSpread(_objectSpread({
2819
2859
  paddingX: paddingX,
2820
2860
  paddingY: paddingY
@@ -2823,7 +2863,7 @@ function CardModalBody(_ref) {
2823
2863
  }));
2824
2864
  }
2825
2865
 
2826
- var _excluded$z = ["children", "padding", "hasSeparator"];
2866
+ var _excluded$C = ["children", "padding", "hasSeparator"];
2827
2867
  function CardModalFooter(_ref) {
2828
2868
  var children = _ref.children,
2829
2869
  _ref$padding = _ref.padding,
@@ -2833,7 +2873,7 @@ function CardModalFooter(_ref) {
2833
2873
  } : _ref$padding,
2834
2874
  _ref$hasSeparator = _ref.hasSeparator,
2835
2875
  hasSeparator = _ref$hasSeparator === void 0 ? true : _ref$hasSeparator,
2836
- props = _objectWithoutProperties(_ref, _excluded$z);
2876
+ props = _objectWithoutProperties(_ref, _excluded$C);
2837
2877
  return /*#__PURE__*/jsx(View, _objectSpread(_objectSpread({}, props), {}, {
2838
2878
  marginTop: "kitt.2",
2839
2879
  padding: padding,
@@ -2847,7 +2887,7 @@ function CardModalFooter(_ref) {
2847
2887
  }));
2848
2888
  }
2849
2889
 
2850
- var _excluded$y = ["children", "title", "paddingBottom", "hasSeparator", "right", "left"];
2890
+ var _excluded$B = ["children", "title", "paddingBottom", "hasSeparator", "right", "left"];
2851
2891
  function CardModalHeader(_ref) {
2852
2892
  var children = _ref.children,
2853
2893
  title = _ref.title,
@@ -2860,7 +2900,7 @@ function CardModalHeader(_ref) {
2860
2900
  hasSeparator = _ref$hasSeparator === void 0 ? true : _ref$hasSeparator,
2861
2901
  right = _ref.right,
2862
2902
  left = _ref.left,
2863
- props = _objectWithoutProperties(_ref, _excluded$y);
2903
+ props = _objectWithoutProperties(_ref, _excluded$B);
2864
2904
  var defaultContainerPadding = {
2865
2905
  base: 'kitt.4',
2866
2906
  medium: 'kitt.6'
@@ -2898,7 +2938,7 @@ function CardModalHeader(_ref) {
2898
2938
  }));
2899
2939
  }
2900
2940
 
2901
- var _excluded$x = ["backgroundColor", "maxWidth", "withoutShadow", "children", "header", "body", "footer"];
2941
+ var _excluded$A = ["backgroundColor", "maxWidth", "withoutShadow", "children", "header", "body", "footer"];
2902
2942
  function CardModal(_ref) {
2903
2943
  var _ref$backgroundColor = _ref.backgroundColor,
2904
2944
  backgroundColor = _ref$backgroundColor === void 0 ? 'kitt.uiBackgroundLight' : _ref$backgroundColor,
@@ -2909,7 +2949,7 @@ function CardModal(_ref) {
2909
2949
  header = _ref.header,
2910
2950
  body = _ref.body,
2911
2951
  footer = _ref.footer,
2912
- props = _objectWithoutProperties(_ref, _excluded$x);
2952
+ props = _objectWithoutProperties(_ref, _excluded$A);
2913
2953
  return /*#__PURE__*/jsx(View, _objectSpread(_objectSpread({}, props), {}, {
2914
2954
  overflow: "hidden",
2915
2955
  backgroundColor: backgroundColor,
@@ -2928,7 +2968,7 @@ CardModal.Header = CardModalHeader;
2928
2968
  CardModal.Footer = CardModalFooter;
2929
2969
  CardModal.ModalBehaviour = CardModalBehaviour;
2930
2970
 
2931
- function getBackgroundColor$4(_ref) {
2971
+ function getBackgroundColor$5(_ref) {
2932
2972
  var isDisabled = _ref.isDisabled,
2933
2973
  isSelected = _ref.isSelected,
2934
2974
  isHovered = _ref.isHovered,
@@ -2959,7 +2999,7 @@ function AnimatedChoiceItemView(_ref) {
2959
2999
  return /*#__PURE__*/jsx(View, {
2960
3000
  position: "relative",
2961
3001
  borderRadius: getBorderRadius(variant),
2962
- backgroundColor: getBackgroundColor$4({
3002
+ backgroundColor: getBackgroundColor$5({
2963
3003
  isDisabled: isDisabled,
2964
3004
  isSelected: isSelected,
2965
3005
  isHovered: isHovered,
@@ -3094,10 +3134,10 @@ function ChoiceItemContainer(_ref) {
3094
3134
  });
3095
3135
  }
3096
3136
 
3097
- var _excluded$w = ["direction"];
3137
+ var _excluded$z = ["direction"];
3098
3138
  function ChoicesContainer(_ref) {
3099
3139
  var direction = _ref.direction,
3100
- props = _objectWithoutProperties(_ref, _excluded$w);
3140
+ props = _objectWithoutProperties(_ref, _excluded$z);
3101
3141
  if (direction === 'row') {
3102
3142
  return /*#__PURE__*/jsx(ScrollView$2, _objectSpread({
3103
3143
  horizontal: true
@@ -3169,7 +3209,7 @@ var ChoicesElements = {
3169
3209
  ButtonChoices: ButtonChoices
3170
3210
  };
3171
3211
 
3172
- var _excluded$v = ["children", "appear", "visible", "unmountOnExit", "isAnimationEnabled", "onEnter", "onEntered", "onExit", "onExited", "onClose"];
3212
+ var _excluded$y = ["children", "appear", "visible", "unmountOnExit", "isAnimationEnabled", "onEnter", "onEntered", "onExit", "onExited", "onClose"];
3173
3213
  var contentAnimationEnter = "kitt-u_contentAnimationEnter_c1i0gle8";
3174
3214
  var contentAnimatioEnterActive = "kitt-u_contentAnimatioEnterActive_c1jmfkjw";
3175
3215
  var contentAnimatioExit = "kitt-u_contentAnimatioExit_cwjstxl";
@@ -3208,7 +3248,7 @@ function DialogModalAnimation(_ref) {
3208
3248
  onExit = _ref.onExit,
3209
3249
  onExited = _ref.onExited,
3210
3250
  onClose = _ref.onClose,
3211
- props = _objectWithoutProperties(_ref, _excluded$v);
3251
+ props = _objectWithoutProperties(_ref, _excluded$y);
3212
3252
  var theme = useTheme();
3213
3253
  var animation = theme.kitt.dialogModal.animation;
3214
3254
  var sharedProps = {
@@ -3243,13 +3283,13 @@ function DialogModalAnimation(_ref) {
3243
3283
  }));
3244
3284
  }
3245
3285
 
3246
- var _excluded$u = ["children", "visible", "onClose", "onExited"];
3286
+ var _excluded$x = ["children", "visible", "onClose", "onExited"];
3247
3287
  function DialogModalBehaviour(_ref) {
3248
3288
  var children = _ref.children,
3249
3289
  visible = _ref.visible,
3250
3290
  onClose = _ref.onClose,
3251
3291
  onExited = _ref.onExited,
3252
- props = _objectWithoutProperties(_ref, _excluded$u);
3292
+ props = _objectWithoutProperties(_ref, _excluded$x);
3253
3293
  var _useState = useState(visible),
3254
3294
  _useState2 = _slicedToArray(_useState, 2),
3255
3295
  isModalBehaviourVisible = _useState2[0],
@@ -3280,7 +3320,7 @@ function DialogModalBehaviour(_ref) {
3280
3320
  });
3281
3321
  }
3282
3322
 
3283
- var _excluded$t = ["stretch"];
3323
+ var _excluded$w = ["stretch"];
3284
3324
  function DialogModal(_ref) {
3285
3325
  var illustration = _ref.illustration,
3286
3326
  title = _ref.title,
@@ -3321,7 +3361,7 @@ DialogModal.ModalBehaviour = DialogModalBehaviour;
3321
3361
  function DialogModalButton(_ref2) {
3322
3362
  var _ref2$stretch = _ref2.stretch,
3323
3363
  stretch = _ref2$stretch === void 0 ? true : _ref2$stretch,
3324
- props = _objectWithoutProperties(_ref2, _excluded$t);
3364
+ props = _objectWithoutProperties(_ref2, _excluded$w);
3325
3365
  return /*#__PURE__*/jsx(Actions.Button, _objectSpread({
3326
3366
  stretch: stretch
3327
3367
  }, props));
@@ -3358,17 +3398,17 @@ function Emoji(_ref) {
3358
3398
  });
3359
3399
  }
3360
3400
 
3361
- var _excluded$s = ["as", "appScheme", "appValue", "onPress", "onOpenAppError"],
3362
- _excluded2$4 = ["phoneNumber", "children"],
3363
- _excluded3$3 = ["phoneNumber", "children"],
3364
- _excluded4$1 = ["emailAddress", "children"];
3401
+ var _excluded$v = ["as", "appScheme", "appValue", "onPress", "onOpenAppError"],
3402
+ _excluded2$5 = ["phoneNumber", "children"],
3403
+ _excluded3$4 = ["phoneNumber", "children"],
3404
+ _excluded4$3 = ["emailAddress", "children"];
3365
3405
  function ExternalAppLink(_ref) {
3366
3406
  var Component = _ref.as,
3367
3407
  appScheme = _ref.appScheme,
3368
3408
  appValue = _ref.appValue,
3369
3409
  onPress = _ref.onPress,
3370
3410
  onOpenAppError = _ref.onOpenAppError,
3371
- rest = _objectWithoutProperties(_ref, _excluded$s);
3411
+ rest = _objectWithoutProperties(_ref, _excluded$v);
3372
3412
  var href = "".concat(appScheme, ":").concat(appValue);
3373
3413
  var handleOnPress = /*#__PURE__*/function () {
3374
3414
  var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(e) {
@@ -3430,7 +3470,7 @@ function ExternalAppLink(_ref) {
3430
3470
  ExternalAppLink.Sms = function (_ref3) {
3431
3471
  var phoneNumber = _ref3.phoneNumber,
3432
3472
  children = _ref3.children,
3433
- rest = _objectWithoutProperties(_ref3, _excluded2$4);
3473
+ rest = _objectWithoutProperties(_ref3, _excluded2$5);
3434
3474
  return /*#__PURE__*/jsx(ExternalAppLink, _objectSpread(_objectSpread({}, rest), {}, {
3435
3475
  appScheme: "sms",
3436
3476
  appValue: phoneNumber,
@@ -3440,7 +3480,7 @@ ExternalAppLink.Sms = function (_ref3) {
3440
3480
  ExternalAppLink.Tel = function (_ref4) {
3441
3481
  var phoneNumber = _ref4.phoneNumber,
3442
3482
  children = _ref4.children,
3443
- rest = _objectWithoutProperties(_ref4, _excluded3$3);
3483
+ rest = _objectWithoutProperties(_ref4, _excluded3$4);
3444
3484
  return /*#__PURE__*/jsx(ExternalAppLink, _objectSpread(_objectSpread({}, rest), {}, {
3445
3485
  appScheme: "tel",
3446
3486
  appValue: phoneNumber,
@@ -3450,7 +3490,7 @@ ExternalAppLink.Tel = function (_ref4) {
3450
3490
  ExternalAppLink.Mail = function (_ref5) {
3451
3491
  var emailAddress = _ref5.emailAddress,
3452
3492
  children = _ref5.children,
3453
- rest = _objectWithoutProperties(_ref5, _excluded4$1);
3493
+ rest = _objectWithoutProperties(_ref5, _excluded4$3);
3454
3494
  return /*#__PURE__*/jsx(ExternalAppLink, _objectSpread(_objectSpread({}, rest), {}, {
3455
3495
  appScheme: "mailto",
3456
3496
  appValue: emailAddress,
@@ -3463,14 +3503,14 @@ var defaultOpenLinkBehavior = {
3463
3503
  web: 'targetBlank'
3464
3504
  };
3465
3505
 
3466
- var _excluded$r = ["as", "href", "openLinkBehavior", "onPress"];
3506
+ var _excluded$u = ["as", "href", "openLinkBehavior", "onPress"];
3467
3507
  function ExternalLink(_ref) {
3468
3508
  var Component = _ref.as,
3469
3509
  href = _ref.href,
3470
3510
  _ref$openLinkBehavior = _ref.openLinkBehavior,
3471
3511
  openLinkBehavior = _ref$openLinkBehavior === void 0 ? defaultOpenLinkBehavior : _ref$openLinkBehavior,
3472
3512
  onPress = _ref.onPress,
3473
- rest = _objectWithoutProperties(_ref, _excluded$r);
3513
+ rest = _objectWithoutProperties(_ref, _excluded$u);
3474
3514
  return /*#__PURE__*/jsx(Component, _objectSpread(_objectSpread({}, rest), {}, {
3475
3515
  href: href,
3476
3516
  hrefAttrs: (openLinkBehavior === null || openLinkBehavior === void 0 ? void 0 : openLinkBehavior.web) === 'targetSelf' ? undefined : {
@@ -3481,6 +3521,388 @@ function ExternalLink(_ref) {
3481
3521
  }));
3482
3522
  }
3483
3523
 
3524
+ function getIconColor(state, disabled) {
3525
+ if (disabled) return 'black-light';
3526
+ switch (state) {
3527
+ case 'invalid':
3528
+ return 'danger';
3529
+ case 'valid':
3530
+ return 'success';
3531
+ default:
3532
+ return undefined;
3533
+ }
3534
+ }
3535
+ function InputIcon(_ref) {
3536
+ var icon = _ref.icon,
3537
+ state = _ref.state,
3538
+ disabled = _ref.disabled;
3539
+ var theme = useTheme();
3540
+ var color = getIconColor(state, disabled);
3541
+ return /*#__PURE__*/jsx(TypographyIcon, {
3542
+ color: color,
3543
+ icon: icon,
3544
+ size: theme.kitt.forms.input.icon.size
3545
+ });
3546
+ }
3547
+
3548
+ function InputPressable(_ref) {
3549
+ var props = _extends({}, (_objectDestructuringEmpty(_ref), _ref));
3550
+ return /*#__PURE__*/jsx(Pressable$2, _objectSpread({}, props));
3551
+ }
3552
+
3553
+ var inputTextContainer = "kitt-u_inputTextContainer_i1encr9g";
3554
+ function InputTextContainer(props) {
3555
+ return /*#__PURE__*/jsx("div", _objectSpread({
3556
+ className: inputTextContainer
3557
+ }, props));
3558
+ }
3559
+
3560
+ var _excluded$t = ["id", "right", "state", "variant", "internalForceState", "disabled", "autoCorrect", "textContentType", "autoComplete", "keyboardType", "multiline", "onSubmitEditing"];
3561
+ var InputText = /*#__PURE__*/forwardRef(function (_ref, ref) {
3562
+ var id = _ref.id,
3563
+ right = _ref.right;
3564
+ _ref.state;
3565
+ var _ref$variant = _ref.variant,
3566
+ variant = _ref$variant === void 0 ? 'outline' : _ref$variant,
3567
+ internalForceState = _ref.internalForceState,
3568
+ _ref$disabled = _ref.disabled,
3569
+ disabled = _ref$disabled === void 0 ? false : _ref$disabled,
3570
+ _ref$autoCorrect = _ref.autoCorrect,
3571
+ autoCorrect = _ref$autoCorrect === void 0 ? true : _ref$autoCorrect,
3572
+ _ref$textContentType = _ref.textContentType,
3573
+ textContentType = _ref$textContentType === void 0 ? 'none' : _ref$textContentType,
3574
+ _ref$autoComplete = _ref.autoComplete,
3575
+ autoComplete = _ref$autoComplete === void 0 ? 'off' : _ref$autoComplete,
3576
+ _ref$keyboardType = _ref.keyboardType,
3577
+ keyboardType = _ref$keyboardType === void 0 ? 'default' : _ref$keyboardType,
3578
+ multiline = _ref.multiline,
3579
+ onSubmitEditing = _ref.onSubmitEditing,
3580
+ props = _objectWithoutProperties(_ref, _excluded$t);
3581
+ var theme = useTheme();
3582
+ var fontSizeForNativeBase = createNativeBaseFontSize({
3583
+ base: 'body'
3584
+ });
3585
+ return /*#__PURE__*/jsxs(InputTextContainer, {
3586
+ children: [/*#__PURE__*/jsx(Input, _objectSpread(_objectSpread({
3587
+ ref: ref,
3588
+ multiline: multiline,
3589
+ nativeID: id,
3590
+ isDisabled: internalForceState ? internalForceState === 'disabled' : disabled,
3591
+ isHovered: internalForceState ? internalForceState === 'hover' : undefined,
3592
+ isFocused: internalForceState ? internalForceState === 'focus' : undefined,
3593
+ keyboardType: keyboardType,
3594
+ autoComplete: autoComplete,
3595
+ autoCorrect: autoCorrect,
3596
+ textContentType: textContentType,
3597
+ fontSize: fontSizeForNativeBase,
3598
+ lineHeight:
3599
+ // On basic text input, we set the line-height to zero for iOS to fix vertical text alignment
3600
+ // This is a iOS only fix since having 0 as a line-height value breaks text inputs on Android
3601
+ fontSizeForNativeBase,
3602
+ fontWeight: "bodies.regular",
3603
+ fontFamily: "bodies.regular",
3604
+ py: !multiline && "web" !== 'web' ? 0 : undefined,
3605
+ variant: variant
3606
+ }, props), {}, {
3607
+ onSubmitEditing: multiline ? function () {
3608
+ return null;
3609
+ } : onSubmitEditing
3610
+ })), right ? /*#__PURE__*/jsx(View, {
3611
+ position: "absolute",
3612
+ right: 0,
3613
+ top: 0,
3614
+ bottom: 0,
3615
+ justifyContent: "center",
3616
+ padding: theme.kitt.forms.input.rightContainer.padding,
3617
+ children: right
3618
+ }) : null]
3619
+ });
3620
+ });
3621
+
3622
+ function getBackgroundColor$4(_ref) {
3623
+ var isSelected = _ref.isSelected,
3624
+ isHighlighted = _ref.isHighlighted,
3625
+ isPressed = _ref.isPressed,
3626
+ isHovered = _ref.isHovered,
3627
+ isFocused = _ref.isFocused;
3628
+ var baseKey = 'kitt.forms.autocomplete.option';
3629
+ if (isHighlighted) {
3630
+ return "".concat(baseKey, ".highlighted.backgroundColor");
3631
+ }
3632
+ if (isPressed) {
3633
+ return "".concat(baseKey, ".pressed.backgroundColor");
3634
+ }
3635
+ if (isHovered) {
3636
+ return "".concat(baseKey, ".hovered.backgroundColor");
3637
+ }
3638
+ if (isFocused) {
3639
+ return "".concat(baseKey, ".focused.backgroundColor");
3640
+ }
3641
+ if (isSelected) {
3642
+ return "".concat(baseKey, ".selected.backgroundColor");
3643
+ }
3644
+ return "".concat(baseKey, ".default.backgroundColor");
3645
+ }
3646
+ function AutocompleteItem(_ref2) {
3647
+ var children = _ref2.children,
3648
+ isSelected = _ref2.isSelected,
3649
+ isHighlighted = _ref2.isHighlighted,
3650
+ isHovered = _ref2.isHovered,
3651
+ isFocused = _ref2.isFocused,
3652
+ isPressed = _ref2.isPressed;
3653
+ return /*#__PURE__*/jsx(View, {
3654
+ justifyContent: "center",
3655
+ width: "100%",
3656
+ minHeight: "kitt.forms.autocomplete.option.minHeight",
3657
+ borderRadius: "kitt.1",
3658
+ padding: "kitt.1",
3659
+ backgroundColor: getBackgroundColor$4({
3660
+ isSelected: isSelected,
3661
+ isHighlighted: isHighlighted,
3662
+ isPressed: isPressed,
3663
+ isHovered: isHovered,
3664
+ isFocused: isFocused
3665
+ }),
3666
+ children: children
3667
+ });
3668
+ }
3669
+
3670
+ function AutocompleteItemsListContainer(_ref) {
3671
+ var testID = _ref.testID,
3672
+ children = _ref.children,
3673
+ _ref$zIndex = _ref.zIndex,
3674
+ zIndex = _ref$zIndex === void 0 ? 1000 : _ref$zIndex;
3675
+ return /*#__PURE__*/jsx(View, {
3676
+ testID: testID,
3677
+ zIndex: zIndex,
3678
+ top: "kitt.2",
3679
+ left: 0,
3680
+ position: "absolute",
3681
+ flexGrow: 1,
3682
+ width: "100%",
3683
+ paddingY: "kitt.2",
3684
+ borderRadius: "kitt.forms.autocomplete.optionsContainer.borderRadius",
3685
+ backgroundColor: "kitt.forms.autocomplete.optionsContainer.backgroundColor",
3686
+ shadow: "kitt.forms.autocomplete.optionsContainer.shadow",
3687
+ _android: {
3688
+ style: {
3689
+ elevation: 2
3690
+ }
3691
+ },
3692
+ children: children
3693
+ });
3694
+ }
3695
+
3696
+ var _excluded$s = ["children"];
3697
+ function AutocompleteOption(_ref) {
3698
+ var children = _ref.children,
3699
+ props = _objectWithoutProperties(_ref, _excluded$s);
3700
+ return /*#__PURE__*/jsx(View, _objectSpread(_objectSpread({
3701
+ paddingX: {
3702
+ base: 'kitt.2',
3703
+ small: 'kitt.4'
3704
+ },
3705
+ paddingY: "kitt.forms.autocomplete.option.verticalPadding"
3706
+ }, props), {}, {
3707
+ children: children
3708
+ }));
3709
+ }
3710
+
3711
+ var _excluded$r = ["children", "name", "disabled", "placeholder", "isInitialOpen", "initialValue", "containerProps", "filterItemBasedOnCurrentInputValue", "checkSelectedItem", "itemToString", "right", "onChange", "onFocus", "onBlur", "onInputChange", "onSelectItem", "onOuterPress", "errorElement", "emptyResultsElement", "inputTestID", "listContainerTestID", "zIndex"],
3712
+ _excluded2$4 = ["onClick", "onPress"],
3713
+ _excluded3$3 = ["onKeyDown", "onFocus", "onBlur", "onChange"],
3714
+ _excluded4$2 = ["onClick", "onPress", "role", "aria-selected"];
3715
+ function isReactElement(element) {
3716
+ return _typeof(element) === 'object' && element !== null && 'type' in element && 'props' in element;
3717
+ }
3718
+ function Autocomplete(_ref) {
3719
+ var _children = _ref.children,
3720
+ name = _ref.name,
3721
+ disabled = _ref.disabled,
3722
+ placeholder = _ref.placeholder,
3723
+ isInitialOpen = _ref.isInitialOpen,
3724
+ initialValue = _ref.initialValue,
3725
+ containerProps = _ref.containerProps,
3726
+ filterItemBasedOnCurrentInputValue = _ref.filterItemBasedOnCurrentInputValue,
3727
+ checkSelectedItem = _ref.checkSelectedItem,
3728
+ itemToString = _ref.itemToString,
3729
+ right = _ref.right,
3730
+ _onChange = _ref.onChange,
3731
+ _onFocus = _ref.onFocus,
3732
+ _onBlur = _ref.onBlur,
3733
+ onInputChange = _ref.onInputChange,
3734
+ onSelectItem = _ref.onSelectItem,
3735
+ onOuterPress = _ref.onOuterPress,
3736
+ errorElement = _ref.errorElement,
3737
+ emptyResultsElement = _ref.emptyResultsElement,
3738
+ _ref$inputTestID = _ref.inputTestID,
3739
+ inputTestID = _ref$inputTestID === void 0 ? 'kitt.Autocomplete.inputText' : _ref$inputTestID,
3740
+ _ref$listContainerTes = _ref.listContainerTestID,
3741
+ listContainerTestID = _ref$listContainerTes === void 0 ? 'kitt.Autocomplete.listContainer' : _ref$listContainerTes,
3742
+ _ref$zIndex = _ref.zIndex,
3743
+ zIndex = _ref$zIndex === void 0 ? 1000 : _ref$zIndex,
3744
+ props = _objectWithoutProperties(_ref, _excluded$r);
3745
+ var childrenArray = Children.toArray(_children);
3746
+ var items = childrenArray.filter(isReactElement).map(function (child) {
3747
+ return {
3748
+ child: child,
3749
+ item: child.props.item
3750
+ };
3751
+ });
3752
+ return /*#__PURE__*/jsx(Downshift, {
3753
+ defaultIsOpen: isInitialOpen,
3754
+ initialSelectedItem: initialValue,
3755
+ initialInputValue: initialValue ? itemToString(initialValue) : undefined,
3756
+ itemToString: function handleItemToString(item) {
3757
+ // Prevents returning null values
3758
+ if (!itemToString) return '';
3759
+ return itemToString(item || undefined);
3760
+ },
3761
+ stateReducer: function stateReducer(state, changes) {
3762
+ switch (changes.type) {
3763
+ case Downshift.stateChangeTypes.changeInput:
3764
+ return _objectSpread(_objectSpread({}, changes), {}, {
3765
+ selectedItem: null
3766
+ });
3767
+ default:
3768
+ return changes;
3769
+ }
3770
+ },
3771
+ onChange: function onChange(selectedItem, stateAndHelpers) {
3772
+ if (_onChange) {
3773
+ _onChange(selectedItem, stateAndHelpers);
3774
+ }
3775
+ },
3776
+ onSelect: onSelectItem,
3777
+ onOuterClick: onOuterPress,
3778
+ onInputValueChange: onInputChange,
3779
+ children: function children(_ref2) {
3780
+ var getRootProps = _ref2.getRootProps,
3781
+ getInputProps = _ref2.getInputProps,
3782
+ getMenuProps = _ref2.getMenuProps,
3783
+ getItemProps = _ref2.getItemProps,
3784
+ getToggleButtonProps = _ref2.getToggleButtonProps,
3785
+ isOpen = _ref2.isOpen,
3786
+ inputValue = _ref2.inputValue,
3787
+ highlightedIndex = _ref2.highlightedIndex,
3788
+ selectedItem = _ref2.selectedItem,
3789
+ openMenu = _ref2.openMenu;
3790
+ var shouldSuppressRefError = "web" !== 'web';
3791
+ var rootProps = getRootProps(undefined, {
3792
+ suppressRefError: shouldSuppressRefError
3793
+ });
3794
+ var menuProps = getMenuProps(undefined, {
3795
+ suppressRefError: shouldSuppressRefError
3796
+ });
3797
+ var _getToggleButtonProps = getToggleButtonProps({
3798
+ disabled: disabled
3799
+ }),
3800
+ onClickToggle = _getToggleButtonProps.onClick;
3801
+ _getToggleButtonProps.onPress;
3802
+ var toggleProps = _objectWithoutProperties(_getToggleButtonProps, _excluded2$4);
3803
+ var _getInputProps = getInputProps({
3804
+ placeholder: placeholder,
3805
+ disabled: disabled
3806
+ }),
3807
+ onKeyDown = _getInputProps.onKeyDown,
3808
+ onSearchInputFocus = _getInputProps.onFocus,
3809
+ onSearchInputBlur = _getInputProps.onBlur,
3810
+ onSearchInputChange = _getInputProps.onChange,
3811
+ inputProps = _objectWithoutProperties(_getInputProps, _excluded3$3);
3812
+ var hasCurrentSearch = inputValue && inputValue.length > 0;
3813
+ var currentItems = hasCurrentSearch && filterItemBasedOnCurrentInputValue ? items.filter(function (_ref3) {
3814
+ var item = _ref3.item;
3815
+ if (!filterItemBasedOnCurrentInputValue) return true;
3816
+ return filterItemBasedOnCurrentInputValue(item, inputValue || '');
3817
+ }) : items;
3818
+
3819
+ // We need to check if the menu is open and if there is at least one item or an error element to prevent displaying an empty container
3820
+ var isCurrentlyOpen = isOpen ? currentItems.length > 0 || !!errorElement || !!emptyResultsElement : false;
3821
+ var canDisplayCollapseButton = currentItems.length > 0 || !!errorElement || !!emptyResultsElement;
3822
+ return /*#__PURE__*/jsxs(View, _objectSpread(_objectSpread(_objectSpread({}, rootProps), containerProps), {}, {
3823
+ zIndex: zIndex,
3824
+ position: "relative",
3825
+ children: [/*#__PURE__*/jsx(InputText, _objectSpread(_objectSpread(_objectSpread({}, inputProps), props), {}, {
3826
+ name: name,
3827
+ testID: inputTestID,
3828
+ right: right || (canDisplayCollapseButton ? /*#__PURE__*/jsx(InputPressable, _objectSpread(_objectSpread({}, toggleProps), {}, {
3829
+ testID: "kitt.Autocomplete.listToggle",
3830
+ hitSlop: 40,
3831
+ onPress: function handleTogglePress(e) {
3832
+ onClickToggle(e);
3833
+ },
3834
+ children: /*#__PURE__*/jsx(InputIcon, {
3835
+ icon: isCurrentlyOpen ? /*#__PURE__*/jsx(ArrowUpIcon, {}) : /*#__PURE__*/jsx(ArrowDownIcon, {})
3836
+ })
3837
+ })) : null),
3838
+ onFocus: function onFocus(e) {
3839
+ openMenu();
3840
+ /** @ts-expect-error onFocus wants web events */
3841
+ if (onSearchInputFocus) onSearchInputFocus(e);
3842
+ if (_onFocus) _onFocus(e);
3843
+ },
3844
+ onBlur: function onBlur(e) {
3845
+ /** @ts-expect-error onBlur wants web events */
3846
+ if (onSearchInputBlur) onSearchInputBlur(e);
3847
+ if (_onBlur) _onBlur(e);
3848
+ }
3849
+ /** @ts-expect-error onSearchInputChange wants web events */,
3850
+ onChange: onSearchInputChange
3851
+ /** @ts-expect-error onKeyDown wants web events */,
3852
+ onKeyPress: onKeyDown
3853
+ })), /*#__PURE__*/jsx(View, _objectSpread(_objectSpread({}, menuProps), {}, {
3854
+ position: "relative",
3855
+ children: isCurrentlyOpen ? /*#__PURE__*/jsxs(AutocompleteItemsListContainer, {
3856
+ testID: listContainerTestID,
3857
+ children: [currentItems.map(function (_ref4, index) {
3858
+ var child = _ref4.child,
3859
+ item = _ref4.item;
3860
+ var _getItemProps = getItemProps({
3861
+ item: item,
3862
+ index: index
3863
+ }),
3864
+ onClick = _getItemProps.onClick;
3865
+ _getItemProps.onPress;
3866
+ var role = _getItemProps.role,
3867
+ ariaSelected = _getItemProps['aria-selected'],
3868
+ itemProps = _objectWithoutProperties(_getItemProps, _excluded4$2);
3869
+ return /*#__PURE__*/jsx(Pressable, _objectSpread(_objectSpread({}, itemProps), {}, {
3870
+ accessibilityRole: role,
3871
+ accessibilityState: {
3872
+ selected: ariaSelected
3873
+ },
3874
+ disabled: disabled,
3875
+ onPress: function onPress(e) {
3876
+ if (onClick) onClick(e);
3877
+ },
3878
+ children: function children(_ref5) {
3879
+ var isHovered = _ref5.isHovered,
3880
+ isFocused = _ref5.isFocused,
3881
+ isPressed = _ref5.isPressed;
3882
+ return /*#__PURE__*/jsx(AutocompleteItem, {
3883
+ item: item,
3884
+ isHighlighted: highlightedIndex === index,
3885
+ isHovered: isHovered,
3886
+ isFocused: isFocused,
3887
+ isPressed: isPressed,
3888
+ isSelected: checkSelectedItem(selectedItem || undefined, item),
3889
+ children: child
3890
+ });
3891
+ }
3892
+ }), itemProps.id);
3893
+ }), errorElement, emptyResultsElement]
3894
+ }) : null
3895
+ }))]
3896
+ }));
3897
+ }
3898
+ });
3899
+ }
3900
+ Autocomplete.Option = AutocompleteOption;
3901
+ /**
3902
+ * @description: This is exported for testing purposes only
3903
+ */
3904
+ Autocomplete.UnsafeInternalItem = AutocompleteItem;
3905
+
3484
3906
  function getBackgroundColor$3(_ref) {
3485
3907
  var isDisabled = _ref.isDisabled,
3486
3908
  isPressed = _ref.isPressed,
@@ -3757,94 +4179,25 @@ function onDatePartChange(_ref) {
3757
4179
  if (maxDate) {
3758
4180
  maxDate.setMinutes(0);
3759
4181
  maxDate.setHours(0);
3760
- maxDate.setSeconds(0);
3761
- maxDate.setMilliseconds(0);
3762
- var isMaxDateBeforeNextValue = nextValue.getTime() > maxDate.getTime();
3763
- if (isMaxDateBeforeNextValue) {
3764
- if (onFocus) onFocus();
3765
- onChange(undefined);
3766
- if (onBlur) onBlur();
3767
- return;
3768
- }
3769
- }
3770
- if (onFocus) onFocus();
3771
- onChange(nextValue);
3772
- if (onBlur) onBlur();
3773
- }
3774
-
3775
- function stringToNumber(text) {
3776
- if (text.length === 0) return undefined;
3777
- return parseInt(text, 10);
3778
- }
3779
-
3780
- var inputTextContainer = "kitt-u_inputTextContainer_i1encr9g";
3781
- function InputTextContainer(props) {
3782
- return /*#__PURE__*/jsx("div", _objectSpread({
3783
- className: inputTextContainer
3784
- }, props));
3785
- }
3786
-
3787
- var _excluded$q = ["id", "right", "state", "variant", "internalForceState", "disabled", "autoCorrect", "textContentType", "autoComplete", "keyboardType", "multiline", "onSubmitEditing"];
3788
- var InputText = /*#__PURE__*/forwardRef(function (_ref, ref) {
3789
- var id = _ref.id,
3790
- right = _ref.right;
3791
- _ref.state;
3792
- var _ref$variant = _ref.variant,
3793
- variant = _ref$variant === void 0 ? 'outline' : _ref$variant,
3794
- internalForceState = _ref.internalForceState,
3795
- _ref$disabled = _ref.disabled,
3796
- disabled = _ref$disabled === void 0 ? false : _ref$disabled,
3797
- _ref$autoCorrect = _ref.autoCorrect,
3798
- autoCorrect = _ref$autoCorrect === void 0 ? true : _ref$autoCorrect,
3799
- _ref$textContentType = _ref.textContentType,
3800
- textContentType = _ref$textContentType === void 0 ? 'none' : _ref$textContentType,
3801
- _ref$autoComplete = _ref.autoComplete,
3802
- autoComplete = _ref$autoComplete === void 0 ? 'off' : _ref$autoComplete,
3803
- _ref$keyboardType = _ref.keyboardType,
3804
- keyboardType = _ref$keyboardType === void 0 ? 'default' : _ref$keyboardType,
3805
- multiline = _ref.multiline,
3806
- onSubmitEditing = _ref.onSubmitEditing,
3807
- props = _objectWithoutProperties(_ref, _excluded$q);
3808
- var theme = useTheme();
3809
- var fontSizeForNativeBase = createNativeBaseFontSize({
3810
- base: 'body'
3811
- });
3812
- return /*#__PURE__*/jsxs(InputTextContainer, {
3813
- children: [/*#__PURE__*/jsx(Input, _objectSpread(_objectSpread({
3814
- ref: ref,
3815
- multiline: multiline,
3816
- nativeID: id,
3817
- isDisabled: internalForceState ? internalForceState === 'disabled' : disabled,
3818
- isHovered: internalForceState ? internalForceState === 'hover' : undefined,
3819
- isFocused: internalForceState ? internalForceState === 'focus' : undefined,
3820
- keyboardType: keyboardType,
3821
- autoComplete: autoComplete,
3822
- autoCorrect: autoCorrect,
3823
- textContentType: textContentType,
3824
- fontSize: fontSizeForNativeBase,
3825
- lineHeight:
3826
- // On basic text input, we set the line-height to zero for iOS to fix vertical text alignment
3827
- // This is a iOS only fix since having 0 as a line-height value breaks text inputs on Android
3828
- fontSizeForNativeBase,
3829
- fontWeight: "bodies.regular",
3830
- fontFamily: "bodies.regular",
3831
- py: !multiline && "web" !== 'web' ? 0 : undefined,
3832
- variant: variant
3833
- }, props), {}, {
3834
- onSubmitEditing: multiline ? function () {
3835
- return null;
3836
- } : onSubmitEditing
3837
- })), right ? /*#__PURE__*/jsx(View, {
3838
- position: "absolute",
3839
- right: 0,
3840
- top: 0,
3841
- bottom: 0,
3842
- justifyContent: "center",
3843
- padding: theme.kitt.forms.input.rightContainer.padding,
3844
- children: right
3845
- }) : null]
3846
- });
3847
- });
4182
+ maxDate.setSeconds(0);
4183
+ maxDate.setMilliseconds(0);
4184
+ var isMaxDateBeforeNextValue = nextValue.getTime() > maxDate.getTime();
4185
+ if (isMaxDateBeforeNextValue) {
4186
+ if (onFocus) onFocus();
4187
+ onChange(undefined);
4188
+ if (onBlur) onBlur();
4189
+ return;
4190
+ }
4191
+ }
4192
+ if (onFocus) onFocus();
4193
+ onChange(nextValue);
4194
+ if (onBlur) onBlur();
4195
+ }
4196
+
4197
+ function stringToNumber(text) {
4198
+ if (text.length === 0) return undefined;
4199
+ return parseInt(text, 10);
4200
+ }
3848
4201
 
3849
4202
  function getCurrentInternalForcedState$1(_ref) {
3850
4203
  var isDisabled = _ref.isDisabled,
@@ -3902,7 +4255,7 @@ function PartContainer(_ref) {
3902
4255
  });
3903
4256
  }
3904
4257
 
3905
- var _excluded$p = ["id", "value", "testID", "stretch", "placeholder", "minDate", "maxDate", "disabled", "isFocusedInternal", "isHoveredInternal", "isPressedInternal", "returnKeyType", "onChange", "onBlur", "onFocus", "onSubmitEditing"];
4258
+ var _excluded$q = ["id", "value", "testID", "stretch", "placeholder", "minDate", "maxDate", "disabled", "isFocusedInternal", "isHoveredInternal", "isPressedInternal", "returnKeyType", "onChange", "onBlur", "onFocus", "onSubmitEditing"];
3906
4259
  var KeyboardDatePicker = /*#__PURE__*/forwardRef(function (_ref, ref) {
3907
4260
  var id = _ref.id,
3908
4261
  value = _ref.value,
@@ -3920,7 +4273,7 @@ var KeyboardDatePicker = /*#__PURE__*/forwardRef(function (_ref, ref) {
3920
4273
  onBlur = _ref.onBlur,
3921
4274
  onFocus = _ref.onFocus,
3922
4275
  onSubmitEditing = _ref.onSubmitEditing;
3923
- _objectWithoutProperties(_ref, _excluded$p);
4276
+ _objectWithoutProperties(_ref, _excluded$q);
3924
4277
  var monthRef = useRef(null);
3925
4278
  var yearRef = useRef(null);
3926
4279
  var defaultValue = value;
@@ -4063,10 +4416,10 @@ var KeyboardDatePicker = /*#__PURE__*/forwardRef(function (_ref, ref) {
4063
4416
  });
4064
4417
  });
4065
4418
 
4066
- var _excluded$o = ["value"];
4419
+ var _excluded$p = ["value"];
4067
4420
  var DatePicker = /*#__PURE__*/forwardRef(function (_ref, ref) {
4068
4421
  var value = _ref.value,
4069
- props = _objectWithoutProperties(_ref, _excluded$o);
4422
+ props = _objectWithoutProperties(_ref, _excluded$p);
4070
4423
  // in apps, final-form can give a string value that will break the component
4071
4424
  var currentValue = value || undefined;
4072
4425
  return /*#__PURE__*/jsx(KeyboardDatePicker, _objectSpread(_objectSpread({
@@ -4076,6 +4429,487 @@ var DatePicker = /*#__PURE__*/forwardRef(function (_ref, ref) {
4076
4429
  }));
4077
4430
  });
4078
4431
 
4432
+ var GoogleMapsApiKeyContext = /*#__PURE__*/createContext(undefined);
4433
+ function GoogleMapsApiKeyProvider(_ref) {
4434
+ var children = _ref.children,
4435
+ apiKey = _ref.apiKey;
4436
+ return /*#__PURE__*/jsx(GoogleMapsApiKeyContext.Provider, {
4437
+ value: apiKey,
4438
+ children: children
4439
+ });
4440
+ }
4441
+
4442
+ function useGoogleMapApiKey() {
4443
+ var context = useContext(GoogleMapsApiKeyContext);
4444
+ if (!context) {
4445
+ throw new Error('<GoogleMapsApiKeyContext> missing in the react tree');
4446
+ }
4447
+ return context;
4448
+ }
4449
+
4450
+ function useGoogleMapsApi() {
4451
+ var apiKey = useGoogleMapApiKey();
4452
+ var autoCompleteServiceInstanceRef = useRef(null);
4453
+ var placesServiceInstanceRef = useRef(null);
4454
+ useEffect(function () {
4455
+ if (autoCompleteServiceInstanceRef.current && placesServiceInstanceRef.current) return;
4456
+ var loader = new Loader({
4457
+ apiKey: apiKey,
4458
+ libraries: ['places']
4459
+ });
4460
+ function loadMapsApi() {
4461
+ return _loadMapsApi.apply(this, arguments);
4462
+ }
4463
+ function _loadMapsApi() {
4464
+ _loadMapsApi = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
4465
+ var placeApi;
4466
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
4467
+ while (1) switch (_context.prev = _context.next) {
4468
+ case 0:
4469
+ _context.prev = 0;
4470
+ _context.next = 3;
4471
+ return loader.importLibrary('places');
4472
+ case 3:
4473
+ placeApi = _context.sent;
4474
+ autoCompleteServiceInstanceRef.current = new placeApi.AutocompleteService();
4475
+ placesServiceInstanceRef.current = new placeApi.PlacesService(document.createElement('div'));
4476
+ _context.next = 11;
4477
+ break;
4478
+ case 8:
4479
+ _context.prev = 8;
4480
+ _context.t0 = _context["catch"](0);
4481
+ console.error(_context.t0);
4482
+ case 11:
4483
+ case "end":
4484
+ return _context.stop();
4485
+ }
4486
+ }, _callee, null, [[0, 8]]);
4487
+ }));
4488
+ return _loadMapsApi.apply(this, arguments);
4489
+ }
4490
+ loadMapsApi();
4491
+ }, [apiKey]);
4492
+ return {
4493
+ autoComplete: {
4494
+ getPlacePredictions: function getPlacePredictions(input) {
4495
+ var promise = new Promise(function (resolve) {
4496
+ var _autoCompleteServiceI;
4497
+ (_autoCompleteServiceI = autoCompleteServiceInstanceRef.current) === null || _autoCompleteServiceI === void 0 ? void 0 : _autoCompleteServiceI.getPlacePredictions({
4498
+ input: input
4499
+ }, function (predictions, status) {
4500
+ if (status !== google.maps.places.PlacesServiceStatus.OK) {
4501
+ resolve({
4502
+ status: status,
4503
+ results: []
4504
+ });
4505
+ return;
4506
+ }
4507
+ resolve({
4508
+ results: predictions,
4509
+ status: status
4510
+ });
4511
+ });
4512
+ });
4513
+ return promise;
4514
+ }
4515
+ },
4516
+ placesService: {
4517
+ getDetails: function getDetails(placeId) {
4518
+ var promise = new Promise(function (resolve) {
4519
+ var _placesServiceInstanc;
4520
+ (_placesServiceInstanc = placesServiceInstanceRef.current) === null || _placesServiceInstanc === void 0 ? void 0 : _placesServiceInstanc.getDetails({
4521
+ placeId: placeId
4522
+ }, function (place, status) {
4523
+ if (status !== google.maps.places.PlacesServiceStatus.OK) {
4524
+ resolve({
4525
+ status: status,
4526
+ result: undefined
4527
+ });
4528
+ return;
4529
+ }
4530
+ resolve({
4531
+ result: place,
4532
+ status: status
4533
+ });
4534
+ });
4535
+ });
4536
+ return promise;
4537
+ }
4538
+ }
4539
+ };
4540
+ }
4541
+
4542
+ var googleMapsAutocompleteReducer = function (state, action) {
4543
+ switch (action.type) {
4544
+ case 'search-change':
4545
+ {
4546
+ return _objectSpread(_objectSpread({}, state), {}, {
4547
+ hasSearchError: false,
4548
+ isLoadingSearch: true
4549
+ });
4550
+ }
4551
+ case 'search-success':
4552
+ {
4553
+ return _objectSpread(_objectSpread({}, state), {}, {
4554
+ hasSearchError: false,
4555
+ isLoadingSearch: false,
4556
+ items: action.payload.results
4557
+ });
4558
+ }
4559
+ case 'search-error':
4560
+ {
4561
+ return _objectSpread(_objectSpread({}, state), {}, {
4562
+ hasSearchError: true,
4563
+ isLoadingSearch: false,
4564
+ items: []
4565
+ });
4566
+ }
4567
+ case 'select-result':
4568
+ {
4569
+ return _objectSpread(_objectSpread({}, state), {}, {
4570
+ hasSelectResultError: false,
4571
+ isLoadingResultDetails: true
4572
+ });
4573
+ }
4574
+ case 'select-result-success':
4575
+ {
4576
+ return _objectSpread(_objectSpread({}, state), {}, {
4577
+ hasSelectResultError: false,
4578
+ isLoadingResultDetails: false,
4579
+ currentSelectedValue: action.payload.result
4580
+ });
4581
+ }
4582
+ case 'select-result-error':
4583
+ {
4584
+ return _objectSpread(_objectSpread({}, state), {}, {
4585
+ hasSelectResultError: true,
4586
+ isLoadingResultDetails: false,
4587
+ currentSelectedValue: undefined
4588
+ });
4589
+ }
4590
+ default:
4591
+ return state;
4592
+ }
4593
+ };
4594
+
4595
+ function findComponentByType(typeName, components) {
4596
+ return components.find(function (component) {
4597
+ return component.types.includes(typeName);
4598
+ });
4599
+ }
4600
+ var matchStreetNumberWithOriginalAddress = function () {
4601
+ var streetNumber = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
4602
+ var address = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
4603
+ var _ref = / *(\d*[-/_]{0,1}\d*) *(bis|ter|quater|quinquies|sexies|septies|octies|novies|decies|[a-z])? /i.exec(address) || [],
4604
+ _ref2 = _slicedToArray(_ref, 3),
4605
+ _ref2$ = _ref2[1],
4606
+ number = _ref2$ === void 0 ? '' : _ref2$,
4607
+ _ref2$2 = _ref2[2],
4608
+ extension = _ref2$2 === void 0 ? '' : _ref2$2;
4609
+ if (number) return "".concat(number).concat(extension);
4610
+ return streetNumber;
4611
+ };
4612
+ var formatAddressFromGoogle = function (placeResult, originalAddress) {
4613
+ var _placeResult$geometry, _placeResult$geometry2, _findComponentByType, _findComponentByType2, _findComponentByType3, _findComponentByType4, _findComponentByType5, _findComponentByType6, _findComponentByType7, _findComponentByType8;
4614
+ var _placeResult$address_ = placeResult.address_components,
4615
+ addressComponents = _placeResult$address_ === void 0 ? [] : _placeResult$address_;
4616
+ return {
4617
+ source: 'google',
4618
+ lat: (_placeResult$geometry = placeResult.geometry) === null || _placeResult$geometry === void 0 ? void 0 : _placeResult$geometry.location.lat(),
4619
+ lng: (_placeResult$geometry2 = placeResult.geometry) === null || _placeResult$geometry2 === void 0 ? void 0 : _placeResult$geometry2.location.lng(),
4620
+ locality: (_findComponentByType = findComponentByType('locality', addressComponents)) === null || _findComponentByType === void 0 ? void 0 : _findComponentByType.long_name,
4621
+ subLocality: (_findComponentByType2 = findComponentByType('sublocality', addressComponents)) === null || _findComponentByType2 === void 0 ? void 0 : _findComponentByType2.long_name,
4622
+ zipcode: (_findComponentByType3 = findComponentByType('postal_code', addressComponents)) === null || _findComponentByType3 === void 0 ? void 0 : _findComponentByType3.long_name,
4623
+ streetName: (_findComponentByType4 = findComponentByType('route', addressComponents)) === null || _findComponentByType4 === void 0 ? void 0 : _findComponentByType4.long_name,
4624
+ streetNumber: matchStreetNumberWithOriginalAddress((_findComponentByType5 = findComponentByType('street_number', addressComponents)) === null || _findComponentByType5 === void 0 ? void 0 : _findComponentByType5.long_name, originalAddress),
4625
+ country: (_findComponentByType6 = findComponentByType('country', addressComponents)) === null || _findComponentByType6 === void 0 ? void 0 : _findComponentByType6.long_name,
4626
+ administrativeAreaLevel1: (_findComponentByType7 = findComponentByType('administrative_area_level_1', addressComponents)) === null || _findComponentByType7 === void 0 ? void 0 : _findComponentByType7.long_name,
4627
+ administrativeAreaLevel2: (_findComponentByType8 = findComponentByType('administrative_area_level_1', addressComponents)) === null || _findComponentByType8 === void 0 ? void 0 : _findComponentByType8.long_name
4628
+ };
4629
+ };
4630
+
4631
+ var GoogleMapsAutocompleteContext = /*#__PURE__*/createContext({
4632
+ state: {
4633
+ items: [],
4634
+ currentSelectedValue: undefined,
4635
+ isLoadingSearch: false,
4636
+ hasSearchError: false,
4637
+ hasSelectResultError: false,
4638
+ isLoadingResultDetails: false,
4639
+ shouldDisplayEmptyStateWhenNoResults: false
4640
+ },
4641
+ onInputChange: function onInputChange() {
4642
+ return Promise.resolve();
4643
+ },
4644
+ onSelectItem: function onSelectItem() {}
4645
+ });
4646
+ function GoogleMapsAutocompleteProvider(_ref) {
4647
+ var children = _ref.children,
4648
+ _ref$minCharsToSearch = _ref.minCharsToSearch,
4649
+ minCharsToSearch = _ref$minCharsToSearch === void 0 ? 3 : _ref$minCharsToSearch,
4650
+ _ref$debounceTimeout = _ref.debounceTimeout,
4651
+ debounceTimeout = _ref$debounceTimeout === void 0 ? 950 : _ref$debounceTimeout;
4652
+ var mapsApi = useGoogleMapsApi();
4653
+ var searchResultsCache = useRef({});
4654
+ var resultDetailsCache = useRef({});
4655
+ var _useReducer = useReducer(googleMapsAutocompleteReducer, {
4656
+ items: [],
4657
+ shouldDisplayEmptyStateWhenNoResults: false
4658
+ }),
4659
+ _useReducer2 = _slicedToArray(_useReducer, 2),
4660
+ state = _useReducer2[0],
4661
+ dispatch = _useReducer2[1];
4662
+ var handleInputChange = useDebouncedCallback(useCallback( /*#__PURE__*/function () {
4663
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(value) {
4664
+ var predictionsPromise, _yield$predictionsPro, results, status;
4665
+ return _regeneratorRuntime().wrap(function (_context) {
4666
+ while (1) switch (_context.prev = _context.next) {
4667
+ case 0:
4668
+ if (!(value.length < minCharsToSearch)) {
4669
+ _context.next = 2;
4670
+ break;
4671
+ }
4672
+ return _context.abrupt("return");
4673
+ case 2:
4674
+ dispatch({
4675
+ type: 'search-change'
4676
+ });
4677
+
4678
+ // If the user types the same value as the previous search, we don't need to call the API again
4679
+ predictionsPromise = searchResultsCache.current[value] ? Promise.resolve({
4680
+ results: searchResultsCache.current[value],
4681
+ status: 'OK'
4682
+ }) : mapsApi.autoComplete.getPlacePredictions(value);
4683
+ _context.prev = 4;
4684
+ _context.next = 7;
4685
+ return predictionsPromise;
4686
+ case 7:
4687
+ _yield$predictionsPro = _context.sent;
4688
+ results = _yield$predictionsPro.results;
4689
+ status = _yield$predictionsPro.status;
4690
+ if (!(status !== 'OK')) {
4691
+ _context.next = 13;
4692
+ break;
4693
+ }
4694
+ dispatch({
4695
+ type: 'search-error'
4696
+ });
4697
+ return _context.abrupt("return");
4698
+ case 13:
4699
+ // We cache the results to avoid calling the API again if the user types the same value
4700
+ searchResultsCache.current[value] = results;
4701
+ dispatch({
4702
+ type: 'search-success',
4703
+ payload: {
4704
+ results: results
4705
+ }
4706
+ });
4707
+ _context.next = 20;
4708
+ break;
4709
+ case 17:
4710
+ _context.prev = 17;
4711
+ _context.t0 = _context["catch"](4);
4712
+ dispatch({
4713
+ type: 'search-error'
4714
+ });
4715
+ case 20:
4716
+ case "end":
4717
+ return _context.stop();
4718
+ }
4719
+ }, _callee, null, [[4, 17]]);
4720
+ }));
4721
+ return function () {
4722
+ return _ref2.apply(this, arguments);
4723
+ };
4724
+ }(), [mapsApi.autoComplete, minCharsToSearch]), debounceTimeout);
4725
+ var handleSelectItem = useCallback( /*#__PURE__*/function () {
4726
+ var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(item, onChange) {
4727
+ var placePromise, place, formattedAddress;
4728
+ return _regeneratorRuntime().wrap(function (_context2) {
4729
+ while (1) switch (_context2.prev = _context2.next) {
4730
+ case 0:
4731
+ if (item !== null && item !== void 0 && item.place_id) {
4732
+ _context2.next = 3;
4733
+ break;
4734
+ }
4735
+ if (onChange) onChange(undefined);
4736
+ return _context2.abrupt("return");
4737
+ case 3:
4738
+ dispatch({
4739
+ type: 'select-result'
4740
+ });
4741
+ _context2.prev = 4;
4742
+ // If we already have the details in cache, we don't need to fetch them again
4743
+ placePromise = resultDetailsCache.current[item.place_id] ? Promise.resolve(resultDetailsCache.current[item.place_id]) : mapsApi.placesService.getDetails(item.place_id).then(function (_ref4) {
4744
+ var result = _ref4.result;
4745
+ return result;
4746
+ });
4747
+ _context2.next = 8;
4748
+ return placePromise;
4749
+ case 8:
4750
+ place = _context2.sent;
4751
+ if (place) {
4752
+ _context2.next = 13;
4753
+ break;
4754
+ }
4755
+ dispatch({
4756
+ type: 'select-result-error'
4757
+ });
4758
+ if (onChange) onChange(undefined);
4759
+ return _context2.abrupt("return");
4760
+ case 13:
4761
+ dispatch({
4762
+ type: 'select-result-success',
4763
+ payload: {
4764
+ result: place
4765
+ }
4766
+ });
4767
+ formattedAddress = formatAddressFromGoogle(place, item.description); // We cache the result details to avoid fetching them again if the user selects the same item
4768
+ resultDetailsCache.current[item.place_id] = place;
4769
+ if (onChange) onChange(formattedAddress);
4770
+ _context2.next = 23;
4771
+ break;
4772
+ case 19:
4773
+ _context2.prev = 19;
4774
+ _context2.t0 = _context2["catch"](4);
4775
+ dispatch({
4776
+ type: 'select-result-error'
4777
+ });
4778
+ if (onChange) onChange(undefined);
4779
+ case 23:
4780
+ case "end":
4781
+ return _context2.stop();
4782
+ }
4783
+ }, _callee2, null, [[4, 19]]);
4784
+ }));
4785
+ return function () {
4786
+ return _ref3.apply(this, arguments);
4787
+ };
4788
+ }(), [mapsApi.placesService]);
4789
+ var api = useMemo(function () {
4790
+ return {
4791
+ state: state,
4792
+ onSelectItem: handleSelectItem,
4793
+ onInputChange: handleInputChange
4794
+ };
4795
+ }, [handleInputChange, handleSelectItem, state]);
4796
+ return /*#__PURE__*/jsx(GoogleMapsAutocompleteContext.Provider, {
4797
+ value: api,
4798
+ children: children
4799
+ });
4800
+ }
4801
+
4802
+ function useGoogleMapsAutocomplete() {
4803
+ var context = useContext(GoogleMapsAutocompleteContext);
4804
+ if (!context) {
4805
+ throw new Error('<GoogleMapsAutocompleteProvider> missing in the react tree');
4806
+ }
4807
+ return context;
4808
+ }
4809
+
4810
+ function InputAddressOption(_ref) {
4811
+ var item = _ref.item;
4812
+ var sharedTransform = {
4813
+ style: {
4814
+ transform: [{
4815
+ translateY: 4
4816
+ }]
4817
+ }
4818
+ };
4819
+ return /*#__PURE__*/jsx(Autocomplete.Option, {
4820
+ item: item,
4821
+ children: /*#__PURE__*/jsxs(HStack, {
4822
+ space: "kitt.2",
4823
+ children: [/*#__PURE__*/jsx(View, {
4824
+ _web: sharedTransform,
4825
+ _ios: sharedTransform,
4826
+ _android: sharedTransform,
4827
+ children: /*#__PURE__*/jsx(TypographyIcon, {
4828
+ icon: /*#__PURE__*/jsx(MapPinIcon, {}),
4829
+ color: "black"
4830
+ })
4831
+ }), /*#__PURE__*/jsx(View, {
4832
+ flexShrink: 1,
4833
+ children: /*#__PURE__*/jsxs(Typography.Text, {
4834
+ children: [/*#__PURE__*/jsx(Typography.Text, {
4835
+ variant: "bold",
4836
+ children: item.structured_formatting.main_text
4837
+ }), item.structured_formatting.secondary_text ? /*#__PURE__*/jsxs(Typography.Text, {
4838
+ color: "black-light",
4839
+ variant: "bold",
4840
+ children: [' ', item.structured_formatting.secondary_text]
4841
+ }) : null]
4842
+ })
4843
+ })]
4844
+ })
4845
+ });
4846
+ }
4847
+
4848
+ function defaultItemToString(item) {
4849
+ if (!item) return '';
4850
+ return item.structured_formatting.main_text;
4851
+ }
4852
+
4853
+ // This function takes AutocompleteAddress and return a valid google AutocompletePrediction
4854
+ function formatInitialValueToAutocompletePrediction(address, placeId) {
4855
+ return {
4856
+ place_id: placeId,
4857
+ description: '',
4858
+ reference: '',
4859
+ types: [],
4860
+ terms: [],
4861
+ matched_substrings: [],
4862
+ structured_formatting: {
4863
+ main_text: [address.streetName, address.streetNumber].filter(Boolean).join(' '),
4864
+ main_text_matched_substrings: [],
4865
+ secondary_text: [address.zipcode, address.locality, address.subLocality].filter(Boolean).join(' ')
4866
+ }
4867
+ };
4868
+ }
4869
+
4870
+ var _excluded$o = ["initialValue", "itemToString", "errorElement", "emptyResultsElement", "onChange"];
4871
+ function InputAddress(_ref) {
4872
+ var initialValue = _ref.initialValue,
4873
+ _ref$itemToString = _ref.itemToString,
4874
+ itemToString = _ref$itemToString === void 0 ? defaultItemToString : _ref$itemToString,
4875
+ errorElement = _ref.errorElement,
4876
+ emptyResultsElement = _ref.emptyResultsElement,
4877
+ _onChange = _ref.onChange;
4878
+ _objectWithoutProperties(_ref, _excluded$o);
4879
+ var _useGoogleMapsAutocom = useGoogleMapsAutocomplete(),
4880
+ state = _useGoogleMapsAutocom.state,
4881
+ _onInputChange = _useGoogleMapsAutocom.onInputChange,
4882
+ onSelectItem = _useGoogleMapsAutocom.onSelectItem;
4883
+
4884
+ // place_id is a google field that is not available within an AutoCompleteAddress, so we need to add a fake one when handling initial values
4885
+ var formattedInitialValue = initialValue ? formatInitialValueToAutocompletePrediction(initialValue, 'initial-value-placeId') : undefined;
4886
+ return /*#__PURE__*/jsx(Autocomplete, {
4887
+ itemToString: itemToString,
4888
+ initialValue: formattedInitialValue,
4889
+ checkSelectedItem: function checkSelectedItem(selectedItem, item) {
4890
+ return (selectedItem === null || selectedItem === void 0 ? void 0 : selectedItem.place_id) === item.place_id;
4891
+ },
4892
+ right: state.isLoadingSearch || state.isLoadingResultDetails ? /*#__PURE__*/jsx(Icon, {
4893
+ icon: /*#__PURE__*/jsx(LoaderIcon, {}),
4894
+ color: "kitt.black"
4895
+ }) : undefined,
4896
+ errorElement: state.hasSearchError || state.hasSelectResultError ? errorElement : null,
4897
+ emptyResultsElement: state.items.length === 0 ? emptyResultsElement : null,
4898
+ onInputChange: function onInputChange(v) {
4899
+ _onInputChange(v);
4900
+ },
4901
+ onChange: function onChange(v) {
4902
+ onSelectItem(v, _onChange);
4903
+ },
4904
+ children: state.items.map(function (item) {
4905
+ return /*#__PURE__*/jsx(InputAddressOption, {
4906
+ item: item
4907
+ }, item.place_id);
4908
+ })
4909
+ });
4910
+ }
4911
+ InputAddress.Option = InputAddressOption;
4912
+
4079
4913
  var InputEmail = /*#__PURE__*/forwardRef(function (props, ref) {
4080
4914
  return /*#__PURE__*/jsx(InputText, _objectSpread({
4081
4915
  ref: ref,
@@ -4131,35 +4965,6 @@ function InputField(_ref) {
4131
4965
  });
4132
4966
  }
4133
4967
 
4134
- function getIconColor(state, disabled) {
4135
- if (disabled) return 'black-light';
4136
- switch (state) {
4137
- case 'invalid':
4138
- return 'danger';
4139
- case 'valid':
4140
- return 'success';
4141
- default:
4142
- return undefined;
4143
- }
4144
- }
4145
- function InputIcon(_ref) {
4146
- var icon = _ref.icon,
4147
- state = _ref.state,
4148
- disabled = _ref.disabled;
4149
- var theme = useTheme();
4150
- var color = getIconColor(state, disabled);
4151
- return /*#__PURE__*/jsx(TypographyIcon, {
4152
- color: color,
4153
- icon: icon,
4154
- size: theme.kitt.forms.input.icon.size
4155
- });
4156
- }
4157
-
4158
- function InputPressable(_ref) {
4159
- var props = _extends({}, (_objectDestructuringEmpty(_ref), _ref));
4160
- return /*#__PURE__*/jsx(Pressable$2, _objectSpread({}, props));
4161
- }
4162
-
4163
4968
  var _excluded$n = ["isPasswordDefaultVisible", "right"];
4164
4969
  var InputPassword = /*#__PURE__*/forwardRef(function (_ref, ref) {
4165
4970
  var isPasswordDefaultVisible = _ref.isPasswordDefaultVisible,
@@ -5850,6 +6655,31 @@ function createKittNativeBaseCustomTheme(theme, appTheme) {
5850
6655
  }
5851
6656
  },
5852
6657
  forms: {
6658
+ autocomplete: {
6659
+ option: {
6660
+ "default": {
6661
+ backgroundColor: theme.forms.autocomplete.option["default"].backgroundColor
6662
+ },
6663
+ hovered: {
6664
+ backgroundColor: theme.forms.autocomplete.option.hovered.backgroundColor
6665
+ },
6666
+ focused: {
6667
+ backgroundColor: theme.forms.autocomplete.option.focused.backgroundColor
6668
+ },
6669
+ selected: {
6670
+ backgroundColor: theme.forms.autocomplete.option.selected.backgroundColor
6671
+ },
6672
+ highlighted: {
6673
+ backgroundColor: theme.forms.autocomplete.option.highlighted.backgroundColor
6674
+ },
6675
+ pressed: {
6676
+ backgroundColor: theme.forms.autocomplete.option.pressed.backgroundColor
6677
+ }
6678
+ },
6679
+ optionsContainer: {
6680
+ backgroundColor: theme.forms.autocomplete.optionsContainer.backgroundColor
6681
+ }
6682
+ },
5853
6683
  input: {
5854
6684
  states: theme.forms.input.states
5855
6685
  },
@@ -6073,6 +6903,11 @@ function createKittNativeBaseCustomTheme(theme, appTheme) {
6073
6903
  borderRadius: theme.dialogModal.borderRadius
6074
6904
  },
6075
6905
  forms: {
6906
+ autocomplete: {
6907
+ optionsContainer: {
6908
+ borderRadius: theme.forms.autocomplete.optionsContainer.borderRadius
6909
+ }
6910
+ },
6076
6911
  input: {
6077
6912
  borderRadius: theme.forms.input.borderRadius
6078
6913
  },
@@ -6328,6 +7163,11 @@ function createKittNativeBaseCustomTheme(theme, appTheme) {
6328
7163
  minHeight: theme.feedbackMessage.minHeight
6329
7164
  },
6330
7165
  forms: {
7166
+ autocomplete: {
7167
+ option: {
7168
+ minHeight: theme.forms.autocomplete.option.minHeight
7169
+ }
7170
+ },
6331
7171
  datePicker: {
6332
7172
  minHeight: theme.forms.input.minHeight,
6333
7173
  day: {
@@ -6430,6 +7270,11 @@ function createKittNativeBaseCustomTheme(theme, appTheme) {
6430
7270
  overlayPadding: theme.dialogModal.overlayPadding
6431
7271
  },
6432
7272
  forms: {
7273
+ autocomplete: {
7274
+ option: {
7275
+ verticalPadding: theme.forms.autocomplete.option.verticalPadding
7276
+ }
7277
+ },
6433
7278
  datePicker: {
6434
7279
  padding: theme.forms.input.padding
6435
7280
  },
@@ -6899,16 +7744,18 @@ function createKittNativeBaseCustomTheme(theme, appTheme) {
6899
7744
  shadowRadius: theme.dialogModal.shadow.radius
6900
7745
  }
6901
7746
  },
6902
- pciker: {
6903
- optionsContainer: {
6904
- shadow: {
6905
- shadowColor: theme.picker.web.optionsContainer.shadow.color,
6906
- shadowOffset: {
6907
- width: theme.picker.web.optionsContainer.shadow.offsetX,
6908
- height: theme.picker.web.optionsContainer.shadow.offsetY
6909
- },
6910
- shadowOpacity: theme.picker.web.optionsContainer.shadow.opacity,
6911
- shadowRadius: theme.picker.web.optionsContainer.shadow.radius
7747
+ forms: {
7748
+ autocomplete: {
7749
+ optionsContainer: {
7750
+ shadow: {
7751
+ shadowColor: theme.forms.autocomplete.optionsContainer.shadow.color,
7752
+ shadowOffset: {
7753
+ width: theme.forms.autocomplete.optionsContainer.shadow.offsetX,
7754
+ height: theme.forms.autocomplete.optionsContainer.shadow.offsetY
7755
+ },
7756
+ shadowOpacity: theme.forms.autocomplete.optionsContainer.shadow.opacity,
7757
+ shadowRadius: theme.forms.autocomplete.optionsContainer.shadow.radius
7758
+ }
6912
7759
  }
6913
7760
  }
6914
7761
  }
@@ -7525,7 +8372,7 @@ function SkeletonContent(_ref) {
7525
8372
  var _excluded$8 = ["isLoading", "style"],
7526
8373
  _excluded2$1 = ["size"],
7527
8374
  _excluded3$1 = ["size"],
7528
- _excluded4 = ["size"];
8375
+ _excluded4$1 = ["size"];
7529
8376
  function Skeleton(_ref) {
7530
8377
  var _ref$isLoading = _ref.isLoading,
7531
8378
  isLoading = _ref$isLoading === void 0 ? false : _ref$isLoading,
@@ -7571,7 +8418,7 @@ function Circle(_ref4) {
7571
8418
  }
7572
8419
  function Square(_ref5) {
7573
8420
  var size = _ref5.size,
7574
- props = _objectWithoutProperties(_ref5, _excluded4);
8421
+ props = _objectWithoutProperties(_ref5, _excluded4$1);
7575
8422
  var currentSize = size || 'kitt.skeleton.shape.square.size';
7576
8423
  var currentBorderRadius = size ? size * 0.5 : 'kitt.skeleton.shape.square.borderRadius';
7577
8424
  return /*#__PURE__*/jsx(Skeleton, _objectSpread(_objectSpread({}, props), {}, {
@@ -7984,7 +8831,8 @@ function Story(_ref) {
7984
8831
 
7985
8832
  var _excluded$5 = ["title", "children", "internalIsDemoSection"],
7986
8833
  _excluded2 = ["title", "children"],
7987
- _excluded3 = ["title", "children"];
8834
+ _excluded3 = ["title", "children"],
8835
+ _excluded4 = ["children"];
7988
8836
  function StorySection(_ref) {
7989
8837
  var title = _ref.title,
7990
8838
  children = _ref.children,
@@ -8024,15 +8872,17 @@ function BlockSection(_ref3) {
8024
8872
  }));
8025
8873
  }
8026
8874
  function DemoSection(_ref4) {
8027
- var children = _ref4.children;
8028
- return /*#__PURE__*/jsx(View, {
8029
- marginBottom: "kitt.16",
8875
+ var children = _ref4.children,
8876
+ props = _objectWithoutProperties(_ref4, _excluded4);
8877
+ return /*#__PURE__*/jsx(View, _objectSpread(_objectSpread({
8878
+ marginBottom: "kitt.16"
8879
+ }, props), {}, {
8030
8880
  children: /*#__PURE__*/jsx(StorySection, {
8031
8881
  internalIsDemoSection: true,
8032
8882
  title: "Demo",
8033
8883
  children: children
8034
8884
  })
8035
- });
8885
+ }));
8036
8886
  }
8037
8887
  StorySection.SubSection = SubSection;
8038
8888
  StorySection.BlockSection = BlockSection;
@@ -8918,5 +9768,5 @@ function VerticalSteps(_ref) {
8918
9768
  }
8919
9769
  VerticalSteps.Step = ExternalStep;
8920
9770
 
8921
- export { ActionCard, Actions, Avatar, BottomSheet, Button, CardModal, Center, Checkbox, ChoicesElements, DatePicker, DialogModal, Emoji, ExternalAppLink, ExternalLink, FlatList, Flex, FullscreenModal, HStack, Highlight, Icon, IconButton, Image, InputEmail, InputFeedback, InputField, InputIcon, InputPassword, InputPhone, InputPressable, InputTag, InputText, KittBreakpointNameEnum, KittBreakpoints, KittBreakpointsMax, KittMapConfigProvider, KittNativeBaseProvider, KittThemeDecorator, KittThemeProvider, Label, ListItem, LoaderIcon, MapMarkerLarge, MapMarkerPosition, MapMarkerSimple, MatchWindowSize, Message, ModalBehaviour, NavigationModal, Notification, Overlay, PageLoader, Picker, Pressable, Radio, RadioButtonGroup, ScrollView, DeprecatedSection as Section, SectionList, SegmentedProgressBar, Skeleton, SpinningIcon, Stack, StaticMap, Story, StoryBlock, StoryContainer, StoryDecorator, StoryGrid, StorySection, StoryTitle, StyleWebWrapper, SwitchBreakpoints, Tag, TextArea, TimePicker, Tooltip, Typography, TypographyEmoji, TypographyIcon, TypographyLink, VStack, VerticalSteps, View, createChoicesComponent, createResponsiveStyleFromProp, getStaticMapImageUrl, hex2rgba, matchWindowSize, theme, useBottomSheet, useBreakpointValue, useCurrentBreakpointName, useGetStaticMapImageUrl, useKittMapConfig, useKittTheme, useMatchWindowSize, useStaticBottomSheet, useStoryBlockColor, useTheme };
9771
+ export { ActionCard, Actions, Autocomplete, Avatar, BottomSheet, Button, CardModal, Center, Checkbox, ChoicesElements, DatePicker, DialogModal, Emoji, ExternalAppLink, ExternalLink, FlatList, Flex, FullscreenModal, GoogleMapsApiKeyProvider, GoogleMapsAutocompleteProvider, HStack, Highlight, Icon, IconButton, Image, InputAddress, InputEmail, InputFeedback, InputField, InputIcon, InputPassword, InputPhone, InputPressable, InputTag, InputText, KittBreakpointNameEnum, KittBreakpoints, KittBreakpointsMax, KittMapConfigProvider, KittNativeBaseProvider, KittThemeDecorator, KittThemeProvider, Label, ListItem, LoaderIcon, MapMarkerLarge, MapMarkerPosition, MapMarkerSimple, MatchWindowSize, Message, ModalBehaviour, NavigationModal, Notification, Overlay, PageLoader, Picker, Pressable, Radio, RadioButtonGroup, ScrollView, DeprecatedSection as Section, SectionList, SegmentedProgressBar, Skeleton, SpinningIcon, Stack, StaticMap, Story, StoryBlock, StoryContainer, StoryDecorator, StoryGrid, StorySection, StoryTitle, StyleWebWrapper, SwitchBreakpoints, Tag, TextArea, TimePicker, Tooltip, Typography, TypographyEmoji, TypographyIcon, TypographyLink, VStack, VerticalSteps, View, createChoicesComponent, createResponsiveStyleFromProp, getStaticMapImageUrl, hex2rgba, matchWindowSize, theme, useBottomSheet, useBreakpointValue, useCurrentBreakpointName, useGetStaticMapImageUrl, useKittMapConfig, useKittTheme, useMatchWindowSize, useStaticBottomSheet, useStoryBlockColor, useTheme };
8922
9772
  //# sourceMappingURL=index-browser-all.es.web.js.map