@arkyn/components 3.0.1-beta.90 → 3.0.1-beta.92

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.
@@ -79,5 +79,5 @@ type InputProps = Omit<InputHTMLAttributes<HTMLInputElement>, "size" | "prefix"
79
79
  * ```
80
80
  */
81
81
  declare function Input(props: InputProps): import("react/jsx-runtime").JSX.Element;
82
- export { Input };
82
+ export { Input, type InputProps };
83
83
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/input/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAW,UAAU,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EACL,mBAAmB,EAKpB,MAAM,OAAO,CAAC;AASf,OAAO,aAAa,CAAC;AAErB,KAAK,UAAU,GAAG,IAAI,CACpB,mBAAmB,CAAC,gBAAgB,CAAC,EACrC,MAAM,GAAG,QAAQ,GAAG,MAAM,GAAG,OAAO,GAAG,cAAc,CACtD,GAAG;IACF,IAAI,EAAE,MAAM,CAAC;IAEb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,GAAG,SAAS,GAAG,WAAW,CAAC;IAE5C,MAAM,CAAC,EAAE,MAAM,GAAG,UAAU,CAAC;IAC7B,MAAM,CAAC,EAAE,MAAM,GAAG,UAAU,CAAC;IAC7B,YAAY,CAAC,EAAE,OAAO,CAAC;IAEvB,QAAQ,CAAC,EAAE,UAAU,CAAC;IACtB,SAAS,CAAC,EAAE,UAAU,CAAC;IAEvB,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC9B,CAAC;AAE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,EAAE,KAAK,UAAU,EAAE,CAAC"}
@@ -0,0 +1,13 @@
1
+ import { HtmlHTMLAttributes } from "react";
2
+ import "./styles.css";
3
+ type MapViewProps = {
4
+ zoom?: number;
5
+ draggable?: boolean;
6
+ coordinates?: {
7
+ lat: number;
8
+ lng: number;
9
+ };
10
+ } & HtmlHTMLAttributes<HTMLDivElement>;
11
+ declare function MapView(props: MapViewProps): import("react/jsx-runtime").JSX.Element;
12
+ export { MapView };
13
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/mapView/index.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,OAAO,CAAC;AAE3C,OAAO,cAAc,CAAC;AAEtB,KAAK,YAAY,GAAG;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,WAAW,CAAC,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,CAAC;CAC5C,GAAG,kBAAkB,CAAC,cAAc,CAAC,CAAC;AAEvC,iBAAS,OAAO,CAAC,KAAK,EAAE,YAAY,2CAgCnC;AAED,OAAO,EAAE,OAAO,EAAE,CAAC"}
@@ -0,0 +1,16 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { GoogleMap as Map, Marker } from "@react-google-maps/api";
3
+ import { MapPinned } from "lucide-react";
4
+ import "./styles.css";
5
+ function MapView(props) {
6
+ const { coordinates, zoom = 18, draggable = false, className, ...rest } = props;
7
+ if (!coordinates) {
8
+ return (_jsx("div", { className: "arkynMapViewPinnedEmpty " + className, ...rest, children: _jsx(MapPinned, {}) }));
9
+ }
10
+ return (_jsx("div", { className: "arkynMapViewPinned " + className, ...rest, children: _jsx(Map, { zoom: zoom, center: coordinates, mapContainerStyle: {
11
+ borderRadius: "var(--rounded-cards)",
12
+ width: "100%",
13
+ height: "100%",
14
+ }, children: _jsx(Marker, { draggable: draggable, position: coordinates }) }) }));
15
+ }
16
+ export { MapView };
@@ -0,0 +1,70 @@
1
+ import type { StandaloneSearchBoxProps } from "@react-google-maps/api";
2
+ import { InputProps } from "./input";
3
+ /**
4
+ * Props for the SearchPlaces component.
5
+ * @typedef {Object} SearchPlacesProps
6
+ * @property {StandaloneSearchBoxProps["options"]} [options] - Google Maps StandaloneSearchBox configuration options
7
+ * @property {(value: string) => void} [onChange] - Callback fired when the input value changes
8
+ * @property {(place: PlaceData) => void} [onPlaceChanged] - Callback fired when a place is selected from the autocomplete suggestions
9
+ */
10
+ type SearchPlacesProps = {
11
+ options?: StandaloneSearchBoxProps["options"];
12
+ onChange?: (e: string) => void;
13
+ onPlaceChanged?: (e: {
14
+ street: string;
15
+ city: string;
16
+ state: string;
17
+ district: string;
18
+ cep: string;
19
+ stateShortName: string;
20
+ streetNumber: string;
21
+ coordinates: {
22
+ lat: number;
23
+ lng: number;
24
+ };
25
+ }) => void;
26
+ } & Omit<InputProps, "onLoad" | "onChange" | "type">;
27
+ /**
28
+ * SearchPlaces component - A Google Places autocomplete input field.
29
+ *
30
+ * This component integrates with Google Maps API to provide address autocomplete functionality.
31
+ * When a user selects a place from the suggestions, it extracts and returns structured address data
32
+ * including street, city, state, district, postal code, and geographic coordinates.
33
+ *
34
+ * @component
35
+ * @example
36
+ * ```tsx
37
+ * <SearchPlaces
38
+ * placeholder="Digite o endereço"
39
+ * onChange={(value) => console.log('Input:', value)}
40
+ * onPlaceChanged={(place) => {
41
+ * console.log('Selected place:', place);
42
+ * // place = {
43
+ * // street: "Rua exemplo",
44
+ * // city: "São Paulo",
45
+ * // state: "São Paulo",
46
+ * // district: "Centro",
47
+ * // cep: "01310-100",
48
+ * // stateShortName: "SP",
49
+ * // streetNumber: "123",
50
+ * // coordinates: { lat: -23.5505, lng: -46.6333 }
51
+ * // }
52
+ * }}
53
+ * options={{
54
+ * componentRestrictions: { country: "br" }
55
+ * }}
56
+ * />
57
+ * ```
58
+ *
59
+ * @param {SearchPlacesProps} props - Component props
60
+ * @param {StandaloneSearchBoxProps["options"]} [props.options] - Google Maps API options for filtering/customizing search results
61
+ * @param {(value: string) => void} [props.onChange] - Handler called when the input text changes
62
+ * @param {(place: PlaceData) => void} [props.onPlaceChanged] - Handler called when a place is selected, receives structured address data
63
+ * @returns {JSX.Element} An input field with Google Places autocomplete functionality
64
+ *
65
+ * @requires Google Maps JavaScript API with Places library loaded
66
+ * @requires @react-google-maps/api package
67
+ */
68
+ declare function SearchPlaces(props: SearchPlacesProps): import("react/jsx-runtime").JSX.Element;
69
+ export { SearchPlaces };
70
+ //# sourceMappingURL=searchPlaces.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"searchPlaces.d.ts","sourceRoot":"","sources":["../../src/components/searchPlaces.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AAGvE,OAAO,EAAS,UAAU,EAAE,MAAM,SAAS,CAAC;AAY5C;;;;;;GAMG;AACH,KAAK,iBAAiB,GAAG;IACvB,OAAO,CAAC,EAAE,wBAAwB,CAAC,SAAS,CAAC,CAAC;IAC9C,QAAQ,CAAC,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/B,cAAc,CAAC,EAAE,CAAC,CAAC,EAAE;QACnB,MAAM,EAAE,MAAM,CAAC;QACf,IAAI,EAAE,MAAM,CAAC;QACb,KAAK,EAAE,MAAM,CAAC;QACd,QAAQ,EAAE,MAAM,CAAC;QACjB,GAAG,EAAE,MAAM,CAAC;QACZ,cAAc,EAAE,MAAM,CAAC;QACvB,YAAY,EAAE,MAAM,CAAC;QACrB,WAAW,EAAE;YAAE,GAAG,EAAE,MAAM,CAAC;YAAC,GAAG,EAAE,MAAM,CAAA;SAAE,CAAC;KAC3C,KAAK,IAAI,CAAC;CACZ,GAAG,IAAI,CAAC,UAAU,EAAE,QAAQ,GAAG,UAAU,GAAG,MAAM,CAAC,CAAC;AAErD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AAEH,iBAAS,YAAY,CAAC,KAAK,EAAE,iBAAiB,2CA6D7C;AAED,OAAO,EAAE,YAAY,EAAE,CAAC"}
@@ -0,0 +1,91 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { StandaloneSearchBox } from "@react-google-maps/api";
3
+ import { useState } from "react";
4
+ import { Input } from "./input";
5
+ /**
6
+ * SearchPlaces component - A Google Places autocomplete input field.
7
+ *
8
+ * This component integrates with Google Maps API to provide address autocomplete functionality.
9
+ * When a user selects a place from the suggestions, it extracts and returns structured address data
10
+ * including street, city, state, district, postal code, and geographic coordinates.
11
+ *
12
+ * @component
13
+ * @example
14
+ * ```tsx
15
+ * <SearchPlaces
16
+ * placeholder="Digite o endereço"
17
+ * onChange={(value) => console.log('Input:', value)}
18
+ * onPlaceChanged={(place) => {
19
+ * console.log('Selected place:', place);
20
+ * // place = {
21
+ * // street: "Rua exemplo",
22
+ * // city: "São Paulo",
23
+ * // state: "São Paulo",
24
+ * // district: "Centro",
25
+ * // cep: "01310-100",
26
+ * // stateShortName: "SP",
27
+ * // streetNumber: "123",
28
+ * // coordinates: { lat: -23.5505, lng: -46.6333 }
29
+ * // }
30
+ * }}
31
+ * options={{
32
+ * componentRestrictions: { country: "br" }
33
+ * }}
34
+ * />
35
+ * ```
36
+ *
37
+ * @param {SearchPlacesProps} props - Component props
38
+ * @param {StandaloneSearchBoxProps["options"]} [props.options] - Google Maps API options for filtering/customizing search results
39
+ * @param {(value: string) => void} [props.onChange] - Handler called when the input text changes
40
+ * @param {(place: PlaceData) => void} [props.onPlaceChanged] - Handler called when a place is selected, receives structured address data
41
+ * @returns {JSX.Element} An input field with Google Places autocomplete functionality
42
+ *
43
+ * @requires Google Maps JavaScript API with Places library loaded
44
+ * @requires @react-google-maps/api package
45
+ */
46
+ function SearchPlaces(props) {
47
+ const { onChange, onPlaceChanged, options, ...rest } = props;
48
+ const [searchBox, setSearchBox] = useState(null);
49
+ const handleLoad = (ref) => setSearchBox(ref);
50
+ const handlePlacesChanged = () => {
51
+ const places = searchBox.getPlaces();
52
+ const place = places[0];
53
+ const address_components = place?.address_components;
54
+ function findData(key) {
55
+ const data = address_components.find((item) => item.types[0] === key);
56
+ if (data)
57
+ return data.long_name;
58
+ return "";
59
+ }
60
+ function findDataShort(key) {
61
+ const data = address_components.find((item) => item.types[0] === key);
62
+ if (data)
63
+ return data.short_name;
64
+ return "";
65
+ }
66
+ if (place) {
67
+ const street = findData("route");
68
+ const streetNumber = findData("street_number");
69
+ const district = findData("sublocality_level_1");
70
+ const city = findData("administrative_area_level_2");
71
+ const state = findData("administrative_area_level_1");
72
+ const stateShortName = findDataShort("administrative_area_level_1");
73
+ const cep = findData("postal_code");
74
+ const lat = place.geometry?.location?.lat();
75
+ const lng = place.geometry?.location?.lng();
76
+ const sendPlace = {
77
+ street,
78
+ city,
79
+ state,
80
+ district,
81
+ cep,
82
+ streetNumber,
83
+ stateShortName,
84
+ coordinates: { lat, lng },
85
+ };
86
+ onPlaceChanged && onPlaceChanged(sendPlace);
87
+ }
88
+ };
89
+ return (_jsx(StandaloneSearchBox, { onLoad: handleLoad, onPlacesChanged: handlePlacesChanged, options: options, children: _jsx(Input, { type: "text", onChange: (e) => onChange(e.target.value), ...rest }) }));
90
+ }
91
+ export { SearchPlaces };
@@ -1,45 +1,40 @@
1
1
  /**
2
- * Hook for automating actions based on form data.
2
+ * Hook for automating actions based on form response data.
3
3
  *
4
- * This hook automates the closing of modals and the display of giveaways
5
- * based on the properties provided in the formResponseData object.
4
+ * This hook automates the closing of modals and the display of toast notifications
5
+ * based on the properties provided in the form response data object.
6
6
  *
7
- * @param {Object} formResponseData - Object containing form data for automation
7
+ * @param {Object} formResponseData - Object containing form response data for automation
8
8
  * @param {boolean} [formResponseData.closeModal] - If true, closes all open modals
9
- * @param {string} [formResponseData.message] - Message to be displayed in the giveaway
10
- * @param {"success" | "danger"} [formResponseData.type] - Type of giveaway to be displayed
9
+ * @param {string} [formResponseData.message] - Message to be displayed in the toast notification
10
+ * @param {string} [formResponseData.name] - Response name used to check against known error responses
11
+ * @param {"success" | "danger"} [formResponseData.type] - Type of toast notification to be displayed
11
12
  *
12
13
  * @example
13
14
  * ```tsx
14
- * // Basic usage example
15
- * const formResponseData = {
15
+ * // Complete usage with success notification
16
+ * const responseData = {
16
17
  * closeModal: true,
17
- * message: "Operation successfully completed!",
18
+ * message: "Operation completed successfully!",
18
19
  * type: "success"
19
20
  * };
20
21
  *
21
- * useAutomation(formResponseData);
22
+ * useAutomation(responseData);
22
23
  * ```
23
24
  *
24
25
  * @example
25
26
  * ```tsx
26
- * // Use with only modal closing
27
- * const formResponseData = {
28
- * closeModal: true
29
- * };
30
- *
31
- * useAutomation(formResponseData);
27
+ * // Close modal only
28
+ * useAutomation({ closeModal: true });
32
29
  * ```
33
30
  *
34
31
  * @example
35
32
  * ```tsx
36
- * // Use with only error message display
37
- * const formResponseData = {
33
+ * // Display error notification
34
+ * useAutomation({
38
35
  * message: "Error processing request",
39
- * type: "danger" // "success" | "danger"
40
- * };
41
- *
42
- * useAutomation(formResponseData);
36
+ * type: "danger"
37
+ * });
43
38
  * ```
44
39
  */
45
40
  declare function useAutomation(formResponseData: any): void;
@@ -1 +1 @@
1
- {"version":3,"file":"useAutomation.d.ts","sourceRoot":"","sources":["../../src/hooks/useAutomation.ts"],"names":[],"mappings":"AAKA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AAEH,iBAAS,aAAa,CAAC,gBAAgB,EAAE,GAAG,QAa3C;AAED,OAAO,EAAE,aAAa,EAAE,CAAC"}
1
+ {"version":3,"file":"useAutomation.d.ts","sourceRoot":"","sources":["../../src/hooks/useAutomation.ts"],"names":[],"mappings":"AAOA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AAEH,iBAAS,aAAa,CAAC,gBAAgB,EAAE,GAAG,QAmB3C;AAED,OAAO,EAAE,aAAa,EAAE,CAAC"}
@@ -1,48 +1,45 @@
1
1
  import { useEffect } from "react";
2
2
  import { useModal } from "./useModal";
3
3
  import { useToast } from "./useToast";
4
+ import { badResponses } from "../templates/badResponses";
5
+ import { successResponses } from "../templates/successResponses";
4
6
  /**
5
- * Hook for automating actions based on form data.
7
+ * Hook for automating actions based on form response data.
6
8
  *
7
- * This hook automates the closing of modals and the display of giveaways
8
- * based on the properties provided in the formResponseData object.
9
+ * This hook automates the closing of modals and the display of toast notifications
10
+ * based on the properties provided in the form response data object.
9
11
  *
10
- * @param {Object} formResponseData - Object containing form data for automation
12
+ * @param {Object} formResponseData - Object containing form response data for automation
11
13
  * @param {boolean} [formResponseData.closeModal] - If true, closes all open modals
12
- * @param {string} [formResponseData.message] - Message to be displayed in the giveaway
13
- * @param {"success" | "danger"} [formResponseData.type] - Type of giveaway to be displayed
14
+ * @param {string} [formResponseData.message] - Message to be displayed in the toast notification
15
+ * @param {string} [formResponseData.name] - Response name used to check against known error responses
16
+ * @param {"success" | "danger"} [formResponseData.type] - Type of toast notification to be displayed
14
17
  *
15
18
  * @example
16
19
  * ```tsx
17
- * // Basic usage example
18
- * const formResponseData = {
20
+ * // Complete usage with success notification
21
+ * const responseData = {
19
22
  * closeModal: true,
20
- * message: "Operation successfully completed!",
23
+ * message: "Operation completed successfully!",
21
24
  * type: "success"
22
25
  * };
23
26
  *
24
- * useAutomation(formResponseData);
27
+ * useAutomation(responseData);
25
28
  * ```
26
29
  *
27
30
  * @example
28
31
  * ```tsx
29
- * // Use with only modal closing
30
- * const formResponseData = {
31
- * closeModal: true
32
- * };
33
- *
34
- * useAutomation(formResponseData);
32
+ * // Close modal only
33
+ * useAutomation({ closeModal: true });
35
34
  * ```
36
35
  *
37
36
  * @example
38
37
  * ```tsx
39
- * // Use with only error message display
40
- * const formResponseData = {
38
+ * // Display error notification
39
+ * useAutomation({
41
40
  * message: "Error processing request",
42
- * type: "danger" // "success" | "danger"
43
- * };
44
- *
45
- * useAutomation(formResponseData);
41
+ * type: "danger"
42
+ * });
46
43
  * ```
47
44
  */
48
45
  function useAutomation(formResponseData) {
@@ -50,14 +47,21 @@ function useAutomation(formResponseData) {
50
47
  const { showToast } = useToast();
51
48
  const closeModal = formResponseData?.closeModal;
52
49
  const message = formResponseData?.message;
50
+ const name = formResponseData?.name;
53
51
  const type = formResponseData?.type;
54
52
  useEffect(() => {
55
53
  if (closeModal)
56
54
  closeAll();
57
- if (message && type === "success")
58
- showToast({ message, type: "success" });
59
- if (message && type === "danger")
60
- showToast({ message, type: "danger" });
55
+ if (message) {
56
+ if (type === "success")
57
+ showToast({ message, type: "success" });
58
+ if (type === "danger")
59
+ showToast({ message, type: "danger" });
60
+ if (badResponses.includes(name))
61
+ showToast({ message, type: "danger" });
62
+ if (successResponses.includes(name))
63
+ showToast({ message, type: "success" });
64
+ }
61
65
  }, [formResponseData]);
62
66
  }
63
67
  export { useAutomation };
package/dist/index.d.ts CHANGED
@@ -22,6 +22,7 @@ export { FileUpload } from "./components/fileUpload";
22
22
  export { IconButton } from "./components/iconButton";
23
23
  export { ImageUpload } from "./components/imageUpload";
24
24
  export { Input } from "./components/input";
25
+ export { MapView } from "./components/mapView";
25
26
  export { MaskedInput } from "./components/maskedInput";
26
27
  export { ModalContainer } from "./components/modal/modalContainer";
27
28
  export { ModalFooter } from "./components/modal/modalFooter";
@@ -32,6 +33,7 @@ export { Popover } from "./components/popover";
32
33
  export { RadioBox } from "./components/radio/radioBox";
33
34
  export { RadioGroup } from "./components/radio/radioGroup";
34
35
  export { RichText } from "./components/richText";
36
+ export { SearchPlaces } from "./components/searchPlaces";
35
37
  export { Select } from "./components/select";
36
38
  export { Slider } from "./components/slider";
37
39
  export { Switch } from "./components/switch";
@@ -56,6 +58,7 @@ export { useToast } from "./hooks/useToast";
56
58
  export { DrawerProvider } from "./providers/drawerProvider";
57
59
  export { FormProvider } from "./providers/formProvider";
58
60
  export { ModalProvider } from "./providers/modalProvider";
61
+ export { PlacesProvider } from "./providers/placesProvider";
59
62
  export { ToastProvider } from "./providers/toastProvider";
60
63
  export { toHtml } from "./services/toHtml";
61
64
  export { toRichTextValue } from "./services/toRichTextValue";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AACnE,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAC/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,qCAAqC,CAAC;AACvE,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAC;AACnE,OAAO,EAAE,gBAAgB,EAAE,MAAM,uCAAuC,CAAC;AACzE,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AACtE,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAChE,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,YAAY,EAA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,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAG5C,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAG1D,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC"}
package/dist/index.js CHANGED
@@ -23,6 +23,7 @@ export { FileUpload } from "./components/fileUpload";
23
23
  export { IconButton } from "./components/iconButton";
24
24
  export { ImageUpload } from "./components/imageUpload";
25
25
  export { Input } from "./components/input";
26
+ export { MapView } from "./components/mapView";
26
27
  export { MaskedInput } from "./components/maskedInput";
27
28
  export { ModalContainer } from "./components/modal/modalContainer";
28
29
  export { ModalFooter } from "./components/modal/modalFooter";
@@ -33,6 +34,7 @@ export { Popover } from "./components/popover";
33
34
  export { RadioBox } from "./components/radio/radioBox";
34
35
  export { RadioGroup } from "./components/radio/radioGroup";
35
36
  export { RichText } from "./components/richText";
37
+ export { SearchPlaces } from "./components/searchPlaces";
36
38
  export { Select } from "./components/select";
37
39
  export { Slider } from "./components/slider";
38
40
  export { Switch } from "./components/switch";
@@ -59,6 +61,7 @@ export { useToast } from "./hooks/useToast";
59
61
  export { DrawerProvider } from "./providers/drawerProvider";
60
62
  export { FormProvider } from "./providers/formProvider";
61
63
  export { ModalProvider } from "./providers/modalProvider";
64
+ export { PlacesProvider } from "./providers/placesProvider";
62
65
  export { ToastProvider } from "./providers/toastProvider";
63
66
  // services
64
67
  export { toHtml } from "./services/toHtml";
@@ -0,0 +1,27 @@
1
+ import { ReactNode } from "react";
2
+ type PlacesProviderProps = {
3
+ apiKey: string;
4
+ children: (isLoaded: boolean) => ReactNode;
5
+ preventFontsLoading?: boolean;
6
+ };
7
+ /**
8
+ * PlacesProvider component that loads Google Maps API with Places, Marker, and Maps libraries.
9
+ *
10
+ * @component
11
+ * @example
12
+ * ```tsx
13
+ * <PlacesProvider apiKey="YOUR_API_KEY">
14
+ * {(isLoaded) => isLoaded ? <MapComponent /> : <LoadingSpinner />)}
15
+ * </PlacesProvider>
16
+ * ```
17
+ *
18
+ * @param {PlacesProviderProps} props - The component props
19
+ * @param {string} props.apiKey - Maps API key for authentication
20
+ * @param {(isLoaded: boolean) => ReactNode} props.children - Render function that receives the loading state
21
+ * @param {boolean} [props.preventFontsLoading=true] - Whether to prevent Fonts from loading
22
+ *
23
+ * @returns {ReactNode} The rendered children with the loading state
24
+ */
25
+ declare function PlacesProvider(props: PlacesProviderProps): import("react/jsx-runtime").JSX.Element;
26
+ export { PlacesProvider };
27
+ //# sourceMappingURL=placesProvider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"placesProvider.d.ts","sourceRoot":"","sources":["../../src/providers/placesProvider.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElC,KAAK,mBAAmB,GAAG;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,CAAC,QAAQ,EAAE,OAAO,KAAK,SAAS,CAAC;IAC3C,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC/B,CAAC;AAEF;;;;;;;;;;;;;;;;;GAiBG;AAEH,iBAAS,cAAc,CAAC,KAAK,EAAE,mBAAmB,2CAUjD;AAED,OAAO,EAAE,cAAc,EAAE,CAAC"}
@@ -0,0 +1,30 @@
1
+ import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
2
+ import { useLoadScript } from "@react-google-maps/api";
3
+ /**
4
+ * PlacesProvider component that loads Google Maps API with Places, Marker, and Maps libraries.
5
+ *
6
+ * @component
7
+ * @example
8
+ * ```tsx
9
+ * <PlacesProvider apiKey="YOUR_API_KEY">
10
+ * {(isLoaded) => isLoaded ? <MapComponent /> : <LoadingSpinner />)}
11
+ * </PlacesProvider>
12
+ * ```
13
+ *
14
+ * @param {PlacesProviderProps} props - The component props
15
+ * @param {string} props.apiKey - Maps API key for authentication
16
+ * @param {(isLoaded: boolean) => ReactNode} props.children - Render function that receives the loading state
17
+ * @param {boolean} [props.preventFontsLoading=true] - Whether to prevent Fonts from loading
18
+ *
19
+ * @returns {ReactNode} The rendered children with the loading state
20
+ */
21
+ function PlacesProvider(props) {
22
+ const { apiKey, children, preventFontsLoading = true } = props;
23
+ const { isLoaded } = useLoadScript({
24
+ googleMapsApiKey: apiKey,
25
+ libraries: ["places", "marker", "maps"],
26
+ preventGoogleFontsLoading: preventFontsLoading,
27
+ });
28
+ return _jsx(_Fragment, { children: children(isLoaded) });
29
+ }
30
+ export { PlacesProvider };