@arkyn/components 3.0.1-beta.156 → 3.0.1-beta.158
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/calendar/_viewService.d.ts +1 -1
- package/dist/components/fullCalendar/_viewService.d.ts +2 -2
- package/dist/hooks/useScopedParams.d.ts +1 -1
- package/dist/index.js +4347 -4683
- package/dist/modules/components/alert/alertContainer/index.js +25 -20
- package/dist/modules/components/alert/alertContent/index.js +11 -8
- package/dist/modules/components/alert/alertDescription/index.js +11 -8
- package/dist/modules/components/alert/alertIcon/index.js +27 -19
- package/dist/modules/components/alert/alertTitle/index.js +11 -8
- package/dist/modules/components/audioPlayer/index.js +74 -75
- package/dist/modules/components/audioUpload/hasFileContent/index.js +54 -62
- package/dist/modules/components/audioUpload/index.js +71 -79
- package/dist/modules/components/audioUpload/noFileContent/index.js +35 -45
- package/dist/modules/components/badge/index.js +26 -22
- package/dist/modules/components/button/index.js +39 -32
- package/dist/modules/components/calendar/_calendarProvider.js +38 -63
- package/dist/modules/components/calendar/_viewService.js +132 -140
- package/dist/modules/components/calendar/calendarContainer/index.js +10 -7
- package/dist/modules/components/calendar/calendarHeader/index.js +51 -72
- package/dist/modules/components/calendar/calendarTableBody/index.js +12 -10
- package/dist/modules/components/calendar/calendarTableContainer/index.js +10 -7
- package/dist/modules/components/calendar/calendarTableHeader/index.js +13 -10
- package/dist/modules/components/calendar/calendarTableTd/index.js +20 -23
- package/dist/modules/components/calendar/index.js +31 -49
- package/dist/modules/components/cardTab/cardTabButton/index.js +19 -29
- package/dist/modules/components/cardTab/cardTabContainer/index.js +22 -28
- package/dist/modules/components/cardTab/cardTabContext.js +13 -11
- package/dist/modules/components/checkbox/index.js +37 -64
- package/dist/modules/components/clientOnly.js +8 -8
- package/dist/modules/components/currencyInput/index.js +110 -138
- package/dist/modules/components/divider/index.js +10 -11
- package/dist/modules/components/drawer/drawerContainer/index.js +40 -43
- package/dist/modules/components/drawer/drawerContext.js +13 -11
- package/dist/modules/components/drawer/drawerHeader/index.js +20 -27
- package/dist/modules/components/facebookPixel/facebookPixel.client.js +8 -18
- package/dist/modules/components/facebookPixel/index.js +8 -8
- package/dist/modules/components/facebookPixel/pixel.js +47 -52
- package/dist/modules/components/fieldError/index.js +12 -8
- package/dist/modules/components/fieldLabel/index.js +11 -12
- package/dist/modules/components/fieldWrapper/index.js +12 -13
- package/dist/modules/components/fileUpload/hasFileContent/index.js +59 -67
- package/dist/modules/components/fileUpload/index.js +65 -72
- package/dist/modules/components/fileUpload/noFileContent/index.js +35 -45
- package/dist/modules/components/fullCalendar/_fullCalendarProvider.js +33 -46
- package/dist/modules/components/fullCalendar/_viewService.js +100 -105
- package/dist/modules/components/fullCalendar/dayCalendar/dayCalendarContainer/index.js +10 -7
- package/dist/modules/components/fullCalendar/dayCalendar/dayCalendarEvent/index.js +70 -78
- package/dist/modules/components/fullCalendar/dayCalendar/dayCalendarRow/index.js +28 -33
- package/dist/modules/components/fullCalendar/dayCalendar/index.js +12 -9
- package/dist/modules/components/fullCalendar/fullCalendarContainer/index.js +10 -7
- package/dist/modules/components/fullCalendar/fullCalendarHeader/index.js +67 -70
- package/dist/modules/components/fullCalendar/index.js +30 -30
- package/dist/modules/components/fullCalendar/monthlyCalendar/index.js +9 -12
- package/dist/modules/components/fullCalendar/monthlyCalendar/monthlyCalendarEvent/index.js +28 -36
- package/dist/modules/components/fullCalendar/monthlyCalendar/monthlyCalendarTableBody/index.js +11 -9
- package/dist/modules/components/fullCalendar/monthlyCalendar/monthlyCalendarTableContainer/index.js +10 -9
- package/dist/modules/components/fullCalendar/monthlyCalendar/monthlyCalendarTableHeader/index.js +13 -10
- package/dist/modules/components/fullCalendar/monthlyCalendar/monthlyCalendarTableTd/index.js +35 -36
- package/dist/modules/components/fullCalendar/weekCalendar/index.js +8 -11
- package/dist/modules/components/fullCalendar/weekCalendar/weekCalendarEvent/index.js +70 -78
- package/dist/modules/components/fullCalendar/weekCalendar/weekCalendarTableBody/index.js +17 -20
- package/dist/modules/components/fullCalendar/weekCalendar/weekCalendarTableContainer/index.js +9 -8
- package/dist/modules/components/fullCalendar/weekCalendar/weekCalendarTableHeader/index.js +16 -19
- package/dist/modules/components/fullCalendar/weekCalendar/weekCalendarTableTd/index.js +34 -39
- package/dist/modules/components/googleAnalytics/googleAnalytics.client.js +7 -7
- package/dist/modules/components/googleAnalytics/googleAnalytics.js +17 -17
- package/dist/modules/components/googleAnalytics/index.js +9 -9
- package/dist/modules/components/googleAnalytics/snippets/generateGAElements.js +10 -12
- package/dist/modules/components/googleTagManager/googleTagManager.client.js +6 -6
- package/dist/modules/components/googleTagManager/googleTagManager.js +44 -48
- package/dist/modules/components/googleTagManager/index.js +16 -27
- package/dist/modules/components/googleTagManager/snippets/appendToDataLayer.js +8 -8
- package/dist/modules/components/googleTagManager/snippets/generateGTMElements.js +19 -20
- package/dist/modules/components/iconButton/index.js +31 -29
- package/dist/modules/components/imageUpload/hasFileContent/index.js +46 -63
- package/dist/modules/components/imageUpload/index.js +65 -82
- package/dist/modules/components/imageUpload/noFileContent/index.js +35 -45
- package/dist/modules/components/input/index.js +92 -120
- package/dist/modules/components/mapView/index.js +27 -31
- package/dist/modules/components/mapView/mapView.client.js +49 -51
- package/dist/modules/components/maskedInput/index.js +101 -112
- package/dist/modules/components/modal/modalContainer/index.js +49 -42
- package/dist/modules/components/modal/modalContext.js +13 -11
- package/dist/modules/components/modal/modalFooter/index.js +10 -7
- package/dist/modules/components/modal/modalHeader/index.js +20 -27
- package/dist/modules/components/multiSelect/index.js +115 -154
- package/dist/modules/components/multiSelect/multiSelectChevron/index.js +18 -21
- package/dist/modules/components/multiSelect/multiSelectContainer/index.js +13 -29
- package/dist/modules/components/multiSelect/multiSelectContent/index.js +11 -8
- package/dist/modules/components/multiSelect/multiSelectMark/index.js +19 -22
- package/dist/modules/components/multiSelect/multiSelectOption/index.js +17 -13
- package/dist/modules/components/multiSelect/multiSelectOptionsContainer/index.js +35 -45
- package/dist/modules/components/multiSelect/multiSelectOverlay/index.js +11 -8
- package/dist/modules/components/multiSelect/multiSelectSpinner/index.js +13 -16
- package/dist/modules/components/pagination/chevronButton/index.js +17 -17
- package/dist/modules/components/pagination/currentButton/index.js +11 -7
- package/dist/modules/components/pagination/index.js +51 -83
- package/dist/modules/components/pagination/pageButton/index.js +12 -8
- package/dist/modules/components/pagination/paginationService.js +33 -48
- package/dist/modules/components/pagination/spread/index.js +10 -7
- package/dist/modules/components/phoneInput/index.js +103 -151
- package/dist/modules/components/phoneInput/phoneInputContainer/index.js +12 -19
- package/dist/modules/components/phoneInput/phoneInputCountriesOverlay/index.js +11 -8
- package/dist/modules/components/phoneInput/phoneInputCountryOption/index.js +23 -15
- package/dist/modules/components/phoneInput/phoneInputCountryOptionsContainer/index.js +33 -43
- package/dist/modules/components/phoneInput/phoneInputCountrySelector/index.js +25 -21
- package/dist/modules/components/phoneInput/phoneInputMask/index.js +46 -62
- package/dist/modules/components/popover/index.js +37 -36
- package/dist/modules/components/radio/radioBox/index.js +24 -42
- package/dist/modules/components/radio/radioContext.js +20 -18
- package/dist/modules/components/radio/radioGroup/index.js +41 -64
- package/dist/modules/components/richText/blockButton/index.js +20 -23
- package/dist/modules/components/richText/element/index.js +72 -58
- package/dist/modules/components/richText/index.js +143 -135
- package/dist/modules/components/richText/insertImage/index.js +94 -105
- package/dist/modules/components/richText/insertVideo/index.js +85 -97
- package/dist/modules/components/richText/leaf/index.js +9 -6
- package/dist/modules/components/richText/markButton/index.js +19 -22
- package/dist/modules/components/richText/toolbar/index.js +10 -7
- package/dist/modules/components/searchPlaces.js +57 -66
- package/dist/modules/components/select/index.js +112 -144
- package/dist/modules/components/select/selectChevron/index.js +18 -21
- package/dist/modules/components/select/selectContainer/index.js +13 -29
- package/dist/modules/components/select/selectContent/index.js +11 -8
- package/dist/modules/components/select/selectOption/index.js +17 -13
- package/dist/modules/components/select/selectOptionsContainer/index.js +35 -45
- package/dist/modules/components/select/selectOverlay/index.js +11 -8
- package/dist/modules/components/select/selectSpinner/index.js +13 -9
- package/dist/modules/components/slider/index.js +34 -41
- package/dist/modules/components/switch/index.js +35 -62
- package/dist/modules/components/tab/tabButton/index.js +19 -29
- package/dist/modules/components/tab/tabContainer/index.js +22 -28
- package/dist/modules/components/tab/tabContext.js +12 -10
- package/dist/modules/components/table/tableBody/index.js +19 -14
- package/dist/modules/components/table/tableCaption/index.js +15 -8
- package/dist/modules/components/table/tableContainer/index.js +12 -8
- package/dist/modules/components/table/tableFooter/index.js +18 -11
- package/dist/modules/components/table/tableHeader/index.js +12 -11
- package/dist/modules/components/textarea/index.js +51 -69
- package/dist/modules/components/tooltip/index.js +34 -45
- package/dist/modules/hooks/useAutomation.js +35 -27
- package/dist/modules/hooks/useDrawer.js +17 -19
- package/dist/modules/hooks/useForm.js +6 -6
- package/dist/modules/hooks/useHydrated.js +7 -12
- package/dist/modules/hooks/useModal.js +17 -19
- package/dist/modules/hooks/useScopedParams.js +17 -17
- package/dist/modules/hooks/useScrollLock.js +19 -19
- package/dist/modules/hooks/useSearchAutomation.js +31 -14
- package/dist/modules/hooks/useSlider.js +13 -13
- package/dist/modules/hooks/useToast.js +8 -9
- package/dist/modules/index.js +72 -144
- package/dist/modules/providers/drawerProvider.js +35 -30
- package/dist/modules/providers/formProvider.js +11 -16
- package/dist/modules/providers/modalProvider.js +39 -33
- package/dist/modules/providers/placesProvider.js +16 -16
- package/dist/modules/providers/toastProvider.js +45 -51
- package/dist/modules/services/extractTextFromNode.js +6 -6
- package/dist/modules/services/fieldTemplate.js +22 -23
- package/dist/modules/services/iconRenderer.js +14 -7
- package/dist/modules/services/isBlockActive.js +12 -14
- package/dist/modules/services/isMarkActive.js +6 -6
- package/dist/modules/services/maskCurrencyValues.js +11 -12
- package/dist/modules/services/toHtml.js +6 -6
- package/dist/modules/services/toRichTextValue.js +7 -7
- package/dist/modules/services/toggleBlock.js +20 -19
- package/dist/modules/services/toggleMark.js +7 -7
- package/dist/modules/style.css +2 -1
- package/dist/modules/templates/badResponses.js +13 -13
- package/dist/modules/templates/richTextTemplates.js +17 -14
- package/dist/modules/templates/successResponses.js +9 -4
- package/dist/modules/utils/phoneInputUtilities.js +18 -28
- package/dist/modules/utils/richTextUtilities.js +88 -75
- package/dist/services/fieldTemplate.d.ts +1 -1
- package/dist/services/fieldTemplate.d.ts.map +1 -1
- package/dist/style.css +2 -1
- package/package.json +4 -4
- package/styles.d.ts +2 -0
|
@@ -1,98 +1,86 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
variant: "outline",
|
|
85
|
-
onClick: () => o(!1),
|
|
86
|
-
children: f
|
|
87
|
-
}
|
|
88
|
-
),
|
|
89
|
-
/* @__PURE__ */ e(p, { disabled: !t, type: "button", onClick: V, children: b })
|
|
90
|
-
] })
|
|
91
|
-
]
|
|
92
|
-
}
|
|
93
|
-
)
|
|
94
|
-
] });
|
|
1
|
+
import { Button as e } from "../../button/index.js";
|
|
2
|
+
import { Input as t } from "../../input/index.js";
|
|
3
|
+
import { ModalContainer as n } from "../../modal/modalContainer/index.js";
|
|
4
|
+
import { ModalFooter as r } from "../../modal/modalFooter/index.js";
|
|
5
|
+
import { ModalHeader as i } from "../../modal/modalHeader/index.js";
|
|
6
|
+
/* empty css */
|
|
7
|
+
import { useEffect as a, useState as o } from "react";
|
|
8
|
+
import { Fragment as s, jsx as c, jsxs as l } from "react/jsx-runtime";
|
|
9
|
+
import { Video as u } from "lucide-react";
|
|
10
|
+
import { useSlate as d } from "slate-react";
|
|
11
|
+
//#region src/components/richText/insertVideo/index.tsx
|
|
12
|
+
function f(f) {
|
|
13
|
+
let { modalCancelButton: p = "Cancelar", modalConfirmButton: m = "Confirmar", modalInputUrlLabel: h = "URL do vídeo:", modalTitle: g = "Inserir vídeo", invalidUrlMessage: _ = "URL inválida" } = f, v = d(), [y, b] = o(!1), [x, S] = o(""), [C, w] = o(""), [T, E] = o("");
|
|
14
|
+
function D(e) {
|
|
15
|
+
if (e.preventDefault(), !x || x === "") return;
|
|
16
|
+
let t = `https://www.youtube.com/embed/${x}`;
|
|
17
|
+
v.insertNodes([
|
|
18
|
+
{
|
|
19
|
+
type: "paragraph",
|
|
20
|
+
children: [{ text: "" }]
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
type: "video",
|
|
24
|
+
src: t,
|
|
25
|
+
children: [{ text: "" }]
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
type: "paragraph",
|
|
29
|
+
children: [{ text: "" }]
|
|
30
|
+
}
|
|
31
|
+
]), b(!1);
|
|
32
|
+
}
|
|
33
|
+
return a(() => {
|
|
34
|
+
if (!C || C === "") return;
|
|
35
|
+
S(""), E("");
|
|
36
|
+
let e = new URLSearchParams(C.split("?")[1]).get("v");
|
|
37
|
+
e ? S(e) : E(_);
|
|
38
|
+
}, [C]), a(() => {
|
|
39
|
+
y || (S(""), w(""), E(""));
|
|
40
|
+
}, [y]), /* @__PURE__ */ l(s, { children: [/* @__PURE__ */ c("button", {
|
|
41
|
+
type: "button",
|
|
42
|
+
className: "arkynRichTextInsertVideo",
|
|
43
|
+
onMouseDown: () => b(!0),
|
|
44
|
+
children: /* @__PURE__ */ c(u, {})
|
|
45
|
+
}), /* @__PURE__ */ l(n, {
|
|
46
|
+
isVisible: y,
|
|
47
|
+
makeInvisible: () => b(!1),
|
|
48
|
+
children: [
|
|
49
|
+
/* @__PURE__ */ c(i, { children: g }),
|
|
50
|
+
/* @__PURE__ */ l("div", {
|
|
51
|
+
className: "arkynRichTextInsertVideoModalContent",
|
|
52
|
+
children: [/* @__PURE__ */ c(t, {
|
|
53
|
+
type: "text",
|
|
54
|
+
name: "richTextVideoURL",
|
|
55
|
+
label: h,
|
|
56
|
+
showAsterisk: !0,
|
|
57
|
+
defaultValue: C,
|
|
58
|
+
onChange: (e) => w(e.target.value),
|
|
59
|
+
errorMessage: T
|
|
60
|
+
}), x && /* @__PURE__ */ c("iframe", {
|
|
61
|
+
width: "auto",
|
|
62
|
+
height: "315",
|
|
63
|
+
src: `https://www.youtube.com/embed/${x}`,
|
|
64
|
+
title: "YouTube video player",
|
|
65
|
+
allow: "accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share",
|
|
66
|
+
referrerPolicy: "strict-origin-when-cross-origin",
|
|
67
|
+
allowFullScreen: !0
|
|
68
|
+
})]
|
|
69
|
+
}),
|
|
70
|
+
/* @__PURE__ */ l(r, { children: [/* @__PURE__ */ c(e, {
|
|
71
|
+
type: "button",
|
|
72
|
+
scheme: "danger",
|
|
73
|
+
variant: "outline",
|
|
74
|
+
onClick: () => b(!1),
|
|
75
|
+
children: p
|
|
76
|
+
}), /* @__PURE__ */ c(e, {
|
|
77
|
+
disabled: !x,
|
|
78
|
+
type: "button",
|
|
79
|
+
onClick: D,
|
|
80
|
+
children: m
|
|
81
|
+
})] })
|
|
82
|
+
]
|
|
83
|
+
})] });
|
|
95
84
|
}
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
};
|
|
85
|
+
//#endregion
|
|
86
|
+
export { f as InsertVideo };
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { jsx as e } from "react/jsx-runtime";
|
|
2
|
+
//#region src/components/richText/leaf/index.tsx
|
|
3
|
+
function t({ attributes: t, children: n, leaf: r }) {
|
|
4
|
+
return r.bold && (n = /* @__PURE__ */ e("strong", { children: n })), r.code && (n = /* @__PURE__ */ e("code", { children: n })), r.italic && (n = /* @__PURE__ */ e("em", { children: n })), r.underline && (n = /* @__PURE__ */ e("u", { children: n })), /* @__PURE__ */ e("span", {
|
|
5
|
+
...t,
|
|
6
|
+
children: n
|
|
7
|
+
});
|
|
4
8
|
}
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
};
|
|
9
|
+
//#endregion
|
|
10
|
+
export { t as Leaf };
|
|
@@ -1,23 +1,20 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
19
|
-
);
|
|
1
|
+
import { isMarkActive as e } from "../../../services/isMarkActive.js";
|
|
2
|
+
import { toggleMark as t } from "../../../services/toggleMark.js";
|
|
3
|
+
/* empty css */
|
|
4
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
5
|
+
import { useSlate as r } from "slate-react";
|
|
6
|
+
//#region src/components/richText/markButton/index.tsx
|
|
7
|
+
function i({ format: i, icon: a }) {
|
|
8
|
+
let o = r(), s = e(o, i) ? "activeTrue" : "activeFalse";
|
|
9
|
+
function c(e) {
|
|
10
|
+
e.preventDefault(), t(o, i);
|
|
11
|
+
}
|
|
12
|
+
return /* @__PURE__ */ n("button", {
|
|
13
|
+
type: "button",
|
|
14
|
+
className: "arkynRichTextMarkButton " + s,
|
|
15
|
+
onMouseDown: c,
|
|
16
|
+
children: /* @__PURE__ */ n(a, {})
|
|
17
|
+
});
|
|
20
18
|
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
};
|
|
19
|
+
//#endregion
|
|
20
|
+
export { i as MarkButton };
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
/* empty css */
|
|
2
|
+
import { jsx as e } from "react/jsx-runtime";
|
|
3
|
+
//#region src/components/richText/toolbar/index.tsx
|
|
4
|
+
function t({ children: t }) {
|
|
5
|
+
return /* @__PURE__ */ e("div", {
|
|
6
|
+
className: "arkynRichTextToolbar",
|
|
7
|
+
children: t
|
|
8
|
+
});
|
|
5
9
|
}
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
};
|
|
10
|
+
//#endregion
|
|
11
|
+
export { t as Toolbar };
|
|
@@ -1,67 +1,58 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
type: "text",
|
|
57
|
-
autoComplete: "off",
|
|
58
|
-
onChange: (o) => i && i(o.target.value),
|
|
59
|
-
...v
|
|
60
|
-
}
|
|
61
|
-
)
|
|
62
|
-
}
|
|
63
|
-
);
|
|
1
|
+
import { Input as e } from "./input/index.js";
|
|
2
|
+
import { useState as t } from "react";
|
|
3
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
4
|
+
import { StandaloneSearchBox as r } from "@react-google-maps/api";
|
|
5
|
+
//#region src/components/searchPlaces.tsx
|
|
6
|
+
function i(i) {
|
|
7
|
+
let { onChange: a, onPlaceChanged: o, options: s, ...c } = i, [l, u] = t(null);
|
|
8
|
+
return /* @__PURE__ */ n(r, {
|
|
9
|
+
onLoad: (e) => u(e),
|
|
10
|
+
onPlacesChanged: () => {
|
|
11
|
+
let e = l?.getPlaces(), t = e ? e[0] : null, n = t?.address_components;
|
|
12
|
+
function r(e) {
|
|
13
|
+
let t = n.find((t) => t.types[0] === e);
|
|
14
|
+
return t ? t.long_name : "";
|
|
15
|
+
}
|
|
16
|
+
function i(e) {
|
|
17
|
+
let t = n.find((t) => t.types[0] === e);
|
|
18
|
+
return t ? t.short_name : "";
|
|
19
|
+
}
|
|
20
|
+
function a(e) {
|
|
21
|
+
for (let t of e) {
|
|
22
|
+
let e = n.find((e) => e.types.includes(t));
|
|
23
|
+
if (e) return e.long_name;
|
|
24
|
+
}
|
|
25
|
+
return "";
|
|
26
|
+
}
|
|
27
|
+
if (t) {
|
|
28
|
+
let e = r("route"), n = r("street_number"), s = a([
|
|
29
|
+
"sublocality_level_1",
|
|
30
|
+
"sublocality",
|
|
31
|
+
"neighborhood"
|
|
32
|
+
]), c = r("administrative_area_level_2"), l = r("administrative_area_level_1"), u = i("administrative_area_level_1"), d = {
|
|
33
|
+
street: e,
|
|
34
|
+
city: c,
|
|
35
|
+
state: l,
|
|
36
|
+
neighborhood: s,
|
|
37
|
+
postalCode: a(["postal_code", "postal_code_prefix"]),
|
|
38
|
+
streetNumber: n,
|
|
39
|
+
stateShortName: u,
|
|
40
|
+
coordinates: {
|
|
41
|
+
lat: t.geometry?.location?.lat(),
|
|
42
|
+
lng: t.geometry?.location?.lng()
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
o && o(d);
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
options: s,
|
|
49
|
+
children: /* @__PURE__ */ n(e, {
|
|
50
|
+
type: "text",
|
|
51
|
+
autoComplete: "off",
|
|
52
|
+
onChange: (e) => a && a(e.target.value),
|
|
53
|
+
...c
|
|
54
|
+
})
|
|
55
|
+
});
|
|
64
56
|
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
};
|
|
57
|
+
//#endregion
|
|
58
|
+
export { i as SearchPlaces };
|