@ornikar/kitt-universal 25.9.0 → 25.9.2

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 (30) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/definitions/GoogleMapsAutocompleteProvider/constants/countryCodes.d.ts +2 -0
  3. package/dist/definitions/GoogleMapsAutocompleteProvider/constants/countryCodes.d.ts.map +1 -0
  4. package/dist/definitions/GoogleMapsAutocompleteProvider/constants/languages.d.ts +2 -0
  5. package/dist/definitions/GoogleMapsAutocompleteProvider/constants/languages.d.ts.map +1 -0
  6. package/dist/definitions/GoogleMapsAutocompleteProvider/constants/types.d.ts +2 -0
  7. package/dist/definitions/GoogleMapsAutocompleteProvider/constants/types.d.ts.map +1 -0
  8. package/dist/definitions/GoogleMapsAutocompleteProvider/hooks/useGoogleMapsApi.d.ts.map +1 -1
  9. package/dist/definitions/GoogleMapsAutocompleteProvider/hooks/useGoogleMapsApi.web.d.ts.map +1 -1
  10. package/dist/definitions/GoogleMapsAutocompleteProvider/utils/makeMapsApiUrl.d.ts +10 -1
  11. package/dist/definitions/GoogleMapsAutocompleteProvider/utils/makeMapsApiUrl.d.ts.map +1 -1
  12. package/dist/definitions/forms/Autocomplete/Autocomplete.d.ts.map +1 -1
  13. package/dist/index-metro.es.android.js +53 -6
  14. package/dist/index-metro.es.android.js.map +1 -1
  15. package/dist/index-metro.es.ios.js +53 -6
  16. package/dist/index-metro.es.ios.js.map +1 -1
  17. package/dist/index-node-20.10.cjs.js +52 -5
  18. package/dist/index-node-20.10.cjs.js.map +1 -1
  19. package/dist/index-node-20.10.cjs.web.js +22 -2
  20. package/dist/index-node-20.10.cjs.web.js.map +1 -1
  21. package/dist/index-node-20.10.es.mjs +53 -6
  22. package/dist/index-node-20.10.es.mjs.map +1 -1
  23. package/dist/index-node-20.10.es.web.mjs +22 -2
  24. package/dist/index-node-20.10.es.web.mjs.map +1 -1
  25. package/dist/index.es.js +54 -6
  26. package/dist/index.es.js.map +1 -1
  27. package/dist/index.es.web.js +22 -2
  28. package/dist/index.es.web.js.map +1 -1
  29. package/dist/tsbuildinfo +1 -1
  30. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -3,6 +3,24 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [25.9.2](https://github.com/ornikar/kitt/compare/@ornikar/kitt-universal@25.9.1...@ornikar/kitt-universal@25.9.2) (2024-07-11)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * input adress ios on blur behavior OSE-10873 ([#2434](https://github.com/ornikar/kitt/issues/2434)) ([dde6231](https://github.com/ornikar/kitt/commit/dde6231c74e867214f97f28b9a28f5cd98cfb3f2))
12
+
13
+
14
+
15
+ ## [25.9.1](https://github.com/ornikar/kitt/compare/@ornikar/kitt-universal@25.9.0...@ornikar/kitt-universal@25.9.1) (2024-07-11)
16
+
17
+
18
+ ### Bug Fixes
19
+
20
+ * inputAddress only suggests addresses OSE-10872 ([#2430](https://github.com/ornikar/kitt/issues/2430)) ([123310f](https://github.com/ornikar/kitt/commit/123310f66ae3067b6cb77c557678be4dece2b236))
21
+
22
+
23
+
6
24
  ## [25.9.0](https://github.com/ornikar/kitt/compare/@ornikar/kitt-universal@25.8.0...@ornikar/kitt-universal@25.9.0) (2024-07-10)
7
25
 
8
26
 
@@ -0,0 +1,2 @@
1
+ export declare const countryCodes: string[];
2
+ //# sourceMappingURL=countryCodes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"countryCodes.d.ts","sourceRoot":"","sources":["../../../../src/GoogleMapsAutocompleteProvider/constants/countryCodes.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,YAAY,UAAiC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare const defaultLanguageSearch = "fr";
2
+ //# sourceMappingURL=languages.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"languages.d.ts","sourceRoot":"","sources":["../../../../src/GoogleMapsAutocompleteProvider/constants/languages.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,qBAAqB,OAAO,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare const autocompletePredictionTypes: string[];
2
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/GoogleMapsAutocompleteProvider/constants/types.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,2BAA2B,UAA0C,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"useGoogleMapsApi.d.ts","sourceRoot":"","sources":["../../../../src/GoogleMapsAutocompleteProvider/hooks/useGoogleMapsApi.ts"],"names":[],"mappings":";;AAGA,MAAM,WAAW,kBAAkB;IACjC,MAAM,CAAC,EAAE,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC;IACxC,MAAM,EAAE,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,mBAAmB,CAAC;CAChD;AAED,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,sBAAsB,EAAE,CAAC;IACrD,MAAM,EAAE,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,mBAAmB,CAAC;CAChD;AAED,MAAM,WAAW,uBAAuB;IACtC,YAAY,EAAE;QACZ,mBAAmB,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,mBAAmB,CAAC,CAAC;KACtE,CAAC;IACF,aAAa,EAAE;QACb,UAAU,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,kBAAkB,CAAC,CAAC;KAC9D,CAAC;CACH;AAED,wBAAgB,gBAAgB,IAAI,uBAAuB,CAwD1D"}
1
+ {"version":3,"file":"useGoogleMapsApi.d.ts","sourceRoot":"","sources":["../../../../src/GoogleMapsAutocompleteProvider/hooks/useGoogleMapsApi.ts"],"names":[],"mappings":";;AAOA,MAAM,WAAW,kBAAkB;IACjC,MAAM,CAAC,EAAE,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC;IACxC,MAAM,EAAE,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,mBAAmB,CAAC;CAChD;AAED,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,sBAAsB,EAAE,CAAC;IACrD,MAAM,EAAE,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,mBAAmB,CAAC;CAChD;AAED,MAAM,WAAW,uBAAuB;IACtC,YAAY,EAAE;QACZ,mBAAmB,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,mBAAmB,CAAC,CAAC;KACtE,CAAC;IACF,aAAa,EAAE;QACb,UAAU,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,kBAAkB,CAAC,CAAC;KAC9D,CAAC;CACH;AAED,wBAAgB,gBAAgB,IAAI,uBAAuB,CA8D1D"}
@@ -1 +1 @@
1
- {"version":3,"file":"useGoogleMapsApi.web.d.ts","sourceRoot":"","sources":["../../../../src/GoogleMapsAutocompleteProvider/hooks/useGoogleMapsApi.web.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAA2C,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAE3G,wBAAgB,gBAAgB,IAAI,uBAAuB,CAmE1D"}
1
+ {"version":3,"file":"useGoogleMapsApi.web.d.ts","sourceRoot":"","sources":["../../../../src/GoogleMapsAutocompleteProvider/hooks/useGoogleMapsApi.web.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAA2C,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAE3G,wBAAgB,gBAAgB,IAAI,uBAAuB,CA2E1D"}
@@ -1,2 +1,11 @@
1
- export declare function makeMapsApiUrl(resource: string, paramName: string, value: string, apiKey: string): string;
1
+ export type MapsApiUrlSearchParamsName = 'input' | 'language' | 'types' | 'components' | 'key' | 'place_id';
2
+ export interface MapsApiUrlSearchParams {
3
+ paramsName: MapsApiUrlSearchParamsName;
4
+ value: string;
5
+ }
6
+ export interface MapsApiUrlParams {
7
+ resource: string;
8
+ params: MapsApiUrlSearchParams[];
9
+ }
10
+ export declare function makeMapsApiUrl({ resource, params }: MapsApiUrlParams): string;
2
11
  //# sourceMappingURL=makeMapsApiUrl.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"makeMapsApiUrl.d.ts","sourceRoot":"","sources":["../../../../src/GoogleMapsAutocompleteProvider/utils/makeMapsApiUrl.ts"],"names":[],"mappings":"AAAA,wBAAgB,cAAc,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAIzG"}
1
+ {"version":3,"file":"makeMapsApiUrl.d.ts","sourceRoot":"","sources":["../../../../src/GoogleMapsAutocompleteProvider/utils/makeMapsApiUrl.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,0BAA0B,GAAG,OAAO,GAAG,UAAU,GAAG,OAAO,GAAG,YAAY,GAAG,KAAK,GAAG,UAAU,CAAC;AAE5G,MAAM,WAAW,sBAAsB;IACrC,UAAU,EAAE,0BAA0B,CAAC;IACvC,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,sBAAsB,EAAE,CAAC;CAClC;AAED,wBAAgB,cAAc,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,gBAAgB,GAAG,MAAM,CAY7E"}
@@ -1 +1 @@
1
- {"version":3,"file":"Autocomplete.d.ts","sourceRoot":"","sources":["../../../../src/forms/Autocomplete/Autocomplete.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAEhD,OAAO,KAAK,EAAE,aAAa,EAAE,YAA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B,CAAC,CAAC;IACxD,YAAY,CAAC,EAAE,cAAc,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC;IAC7C,YAAY,CAAC,EAAE,cAAc,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC;CAClD;AAMD,wBAAgB,YAAY,CAAC,CAAC,SAAS,MAAM,EAAE,EAC7C,QAAQ,EACR,IAAI,EACJ,QAAQ,EACR,WAAW,EACX,aAAa,EACb,YAAY,EACZ,cAAc,EACd,kCAAkC,EAClC,iBAAiB,EACjB,YAAY,EACZ,KAAK,EACL,QAAQ,EACR,OAAO,EACP,MAAM,EACN,aAAa,EACb,YAAY;AACZ;;GAEG;AACH,YAAY,EACZ,YAAY,EACZ,mBAAmB,EACnB,WAA2C,EAC3C,mBAAuD,EACvD,MAAa,EACb,GAAG,KAAK,EACT,EAAE,iBAAiB,CAAC,CAAC,CAAC,GAAG,SAAS,CAuLlC;yBAlNe,YAAY"}
@@ -7,7 +7,7 @@ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
7
7
  import _objectDestructuringEmpty from '@babel/runtime/helpers/objectDestructuringEmpty';
8
8
  import _extends from '@babel/runtime/helpers/extends';
9
9
  import Animated, { useSharedValue, useAnimatedStyle, interpolateColor, withSpring, withTiming, Easing as Easing$1, runOnJS, useDerivedValue, useAnimatedProps, withDelay, withRepeat, interpolate } from 'react-native-reanimated';
10
- import { Platform, Animated as Animated$1, Easing, StyleSheet, Modal, ScrollView as ScrollView$2, View as View$2, Linking, Pressable as Pressable$2, Text as Text$1, useWindowDimensions, PixelRatio } from 'react-native';
10
+ import { Platform, Animated as Animated$1, Easing, StyleSheet, Modal, ScrollView as ScrollView$2, View as View$2, Linking, Pressable as Pressable$2, Keyboard, Text as Text$1, useWindowDimensions, PixelRatio } from 'react-native';
11
11
  export { useWindowDimensions as useWindowSize } from 'react-native';
12
12
  import { SpinnerGapRegularIcon, UserRegularIcon, CaretUpFillIcon, CaretDownFillIcon, MapPinRegularIcon, EyeClosedRegularIcon, EyeRegularIcon, CheckCircleFillIcon, CaretDownRegularIcon, XRegularIcon, InfoRegularIcon, WarningRegularIcon, CheckRegularIcon, WarningCircleRegularIcon, ArrowCounterClockwiseRegularIcon, InfoFillIcon, WarningCircleFillIcon, WarningFillIcon } from '@ornikar/kitt-icons/phosphor';
13
13
  import { BottomSheetScrollView, BottomSheetView, BottomSheetModal, BottomSheetHandle, BottomSheetBackdrop, useBottomSheetModal } from '@gorhom/bottom-sheet';
@@ -5080,7 +5080,10 @@ function Autocomplete(_ref) {
5080
5080
  },
5081
5081
  onBlur: e => {
5082
5082
  /** @ts-expect-error onBlur wants web events */
5083
- if (Platform.OS !== 'android' && onSearchInputBlur) onSearchInputBlur(e);
5083
+ if (Platform.OS === 'web' && onSearchInputBlur) onSearchInputBlur(e);
5084
+
5085
+ /** @ts-expect-error onBlur wants web events */
5086
+ if (Platform.OS === 'ios' && !Keyboard.isVisible() && onSearchInputBlur) onSearchInputBlur(e);
5084
5087
  if (onBlur) onBlur(e);
5085
5088
  }
5086
5089
  /** @ts-expect-error onSearchInputChange wants web events */,
@@ -6261,14 +6264,58 @@ function useGoogleMapApiKey() {
6261
6264
  return context;
6262
6265
  }
6263
6266
 
6264
- function makeMapsApiUrl(resource, paramName, value, apiKey) {
6265
- return `https://maps.googleapis.com/maps/api/${resource}/json?${paramName}=${encodeURIComponent(value)}&key=${apiKey}`;
6267
+ // Countries where we can have instructors and students
6268
+ // Restricting the search of the InputAddress component
6269
+ // France, Guyane Française, Guadeloupe, Martinique, Réunion
6270
+ // As of today, Google restrict this array to 5 country codes
6271
+ const countryCodes = ['FR', 'GF', 'GP', 'MQ', 'RE'];
6272
+
6273
+ const defaultLanguageSearch = 'fr';
6274
+
6275
+ // types of result we want to allow as suggestions from the Autocomplete search
6276
+ // See https://developers.google.com/maps/documentation/places/web-service/supported_types#table2 for all supported types
6277
+ const autocompletePredictionTypes = ['street_address', 'point_of_interest'];
6278
+
6279
+ function makeMapsApiUrl({
6280
+ resource,
6281
+ params
6282
+ }) {
6283
+ const queryParams = params.map(({
6284
+ paramsName,
6285
+ value
6286
+ }) => {
6287
+ let encodedValue = value;
6288
+ if (paramsName === 'input') {
6289
+ encodedValue = encodeURIComponent(value);
6290
+ }
6291
+ return `${paramsName}=${encodedValue}`;
6292
+ });
6293
+ return `https://maps.googleapis.com/maps/api/${resource}/json?` + queryParams.join('&');
6266
6294
  }
6267
6295
 
6268
6296
  function useGoogleMapsApi() {
6269
6297
  const apiKey = useGoogleMapApiKey();
6270
- const makeApiUrl = (resource, paramName, value) => {
6271
- return makeMapsApiUrl(resource, paramName, value, apiKey);
6298
+ const defaultSearchParams = [{
6299
+ paramsName: 'key',
6300
+ value: apiKey
6301
+ }, {
6302
+ paramsName: 'language',
6303
+ value: defaultLanguageSearch
6304
+ }, {
6305
+ paramsName: 'types',
6306
+ value: autocompletePredictionTypes.join('|')
6307
+ }, {
6308
+ paramsName: 'components',
6309
+ value: countryCodes.map(code => `country:${code}`).join('|')
6310
+ }];
6311
+ const makeApiUrl = (resource, paramsName, param) => {
6312
+ return makeMapsApiUrl({
6313
+ resource,
6314
+ params: [...defaultSearchParams, {
6315
+ paramsName,
6316
+ value: param
6317
+ }]
6318
+ });
6272
6319
  };
6273
6320
  const sharedFetchOptions = {
6274
6321
  method: 'GET',