treege 3.0.0-beta.7 → 3.0.0-beta.70
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/LICENSE +18 -12
- package/README.md +476 -81
- package/dist/DefaultSubmitButton-PXs4TMgX.js +1766 -0
- package/dist/ThemeContext-CdHMLHiw.js +942 -0
- package/dist/editor/components/input/ComboboxWithCreate.d.ts +2 -1
- package/dist/editor/components/styles/EditorStyles.d.ts +2 -0
- package/dist/editor/constants/defaultNode.d.ts +1 -1
- package/dist/editor/constants/edgeTypes.d.ts +3 -2
- package/dist/editor/constants/inputTypeIcons.d.ts +3 -0
- package/dist/editor/constants/nodeSpacing.d.ts +25 -0
- package/dist/editor/constants/nodeTypes.d.ts +4 -5
- package/dist/editor/context/OpenApiContext.d.ts +79 -0
- package/dist/editor/context/TreegeEditorRuntimeProvider.d.ts +78 -0
- package/dist/editor/features/TreegeEditor/TreegeEditor.d.ts +1 -1
- package/dist/editor/features/TreegeEditor/controls/MiniMapControl.d.ts +6 -0
- package/dist/editor/features/TreegeEditor/dialogs/AuthorizeDialog.d.ts +20 -0
- package/dist/editor/features/TreegeEditor/dialogs/ChangeNodeTypeDialog.d.ts +2 -0
- package/dist/editor/features/TreegeEditor/dialogs/DeleteNodeDialog.d.ts +2 -0
- package/dist/editor/features/TreegeEditor/dialogs/HeadersDialog.d.ts +19 -0
- package/dist/editor/features/TreegeEditor/dialogs/OpenApiDialog.d.ts +6 -0
- package/dist/editor/features/TreegeEditor/edges/ConditionalEdge.d.ts +2 -2
- package/dist/editor/features/TreegeEditor/edges/DefaultEdge.d.ts +3 -0
- package/dist/editor/features/TreegeEditor/forms/JsonTemplateEditor.d.ts +13 -0
- package/dist/editor/features/TreegeEditor/forms/OptionsMappingFields.d.ts +34 -0
- package/dist/editor/features/TreegeEditor/forms/OptionsSourceForm.d.ts +7 -0
- package/dist/editor/features/TreegeEditor/forms/SensitiveHeaderWarning.d.ts +13 -0
- package/dist/editor/features/TreegeEditor/forms/SubmitConfigForm.d.ts +7 -0
- package/dist/editor/features/TreegeEditor/inputs/ApiUrlCombobox.d.ts +20 -0
- package/dist/editor/features/TreegeEditor/inputs/ComboboxPattern.d.ts +2 -1
- package/dist/editor/features/TreegeEditor/inputs/OptionImageField.d.ts +6 -0
- package/dist/editor/features/TreegeEditor/inputs/SelectNodeGroup.d.ts +22 -1
- package/dist/editor/features/TreegeEditor/layout/AutoLayout.d.ts +15 -0
- package/dist/editor/features/TreegeEditor/nodes/TreegeNode.d.ts +5 -0
- package/dist/editor/features/TreegeEditor/nodes/components/BottomHandleDropdown.d.ts +25 -0
- package/dist/editor/features/TreegeEditor/nodes/components/NodeGroupBadge.d.ts +6 -0
- package/dist/editor/features/TreegeEditor/nodes/components/NodeImage.d.ts +5 -0
- package/dist/editor/features/TreegeEditor/nodes/components/NodeImageButton.d.ts +6 -0
- package/dist/editor/features/TreegeEditor/nodes/components/NodeInputPreview.d.ts +12 -0
- package/dist/editor/features/TreegeEditor/nodes/components/NodeLabelInput.d.ts +10 -0
- package/dist/editor/features/TreegeEditor/nodes/components/NodeMoreMenu.d.ts +6 -0
- package/dist/editor/features/TreegeEditor/nodes/components/NodeRequiredButton.d.ts +6 -0
- package/dist/editor/features/TreegeEditor/nodes/components/NodeStackOrderButtons.d.ts +6 -0
- package/dist/editor/features/TreegeEditor/nodes/components/NodeTypeBadge.d.ts +7 -0
- package/dist/editor/features/TreegeEditor/nodes/components/NodeTypePickerMenuContent.d.ts +12 -0
- package/dist/editor/features/TreegeEditor/nodes/layout/NodeWrapper.d.ts +4 -2
- package/dist/editor/features/TreegeEditor/panel/AIGeneratorDialog.d.ts +16 -0
- package/dist/editor/features/TreegeEditor/panel/ActionsPanel.d.ts +7 -2
- package/dist/editor/features/TreegeEditor/panel/MultiSelectionPanel.d.ts +7 -0
- package/dist/editor/hooks/useAvailableParentFields.d.ts +13 -0
- package/dist/editor/hooks/useFlowActions.d.ts +6 -2
- package/dist/editor/hooks/useFlowConnections.d.ts +14 -0
- package/dist/editor/hooks/useHistoryStore.d.ts +26 -0
- package/dist/editor/hooks/useIsStackedEdge.d.ts +8 -0
- package/dist/editor/hooks/useKeyValueRows.d.ts +15 -0
- package/dist/editor/hooks/useNodesSelection.d.ts +5 -5
- package/dist/editor/hooks/useStackPosition.d.ts +14 -0
- package/dist/editor/hooks/useTranslate.d.ts +1 -1
- package/dist/editor/hooks/useUndoRedo.d.ts +31 -0
- package/dist/editor/types/ai.d.ts +65 -0
- package/dist/editor/types/editor.d.ts +97 -10
- package/dist/editor/types/openapi.d.ts +106 -0
- package/dist/editor/utils/aiFlowGenerator.d.ts +5 -0
- package/dist/editor/utils/cleanNodeConfig.d.ts +5 -0
- package/dist/editor/utils/dagreLayout.d.ts +8 -0
- package/dist/editor/utils/edge.d.ts +50 -0
- package/dist/editor/utils/groupColor.d.ts +14 -0
- package/dist/editor/utils/image.d.ts +7 -0
- package/dist/editor/utils/inputTypeIcon.d.ts +6 -0
- package/dist/editor/utils/jsonBindTarget.d.ts +15 -0
- package/dist/editor/utils/openApiPayload.d.ts +12 -0
- package/dist/editor/utils/openapi.d.ts +35 -0
- package/dist/editor/utils/sensitiveHeaders.d.ts +20 -0
- package/dist/editor/utils/stackPositionIndex.d.ts +9 -0
- package/dist/editor-Bh4AR91O.js +6407 -0
- package/dist/editor.js +3 -7
- package/dist/main.js +6 -52
- package/dist/renderer/context/TreegeRenderRuntimeProvider.d.ts +135 -0
- package/dist/renderer/context/TreegeRendererProvider.d.ts +15 -0
- package/dist/renderer/features/TreegeRenderer/native/TreegeRenderer.d.ts +19 -11
- package/dist/renderer/features/TreegeRenderer/native/components/DefaultFormWrapper.d.ts +7 -7
- package/dist/renderer/features/TreegeRenderer/native/components/DefaultInputWrapper.d.ts +9 -0
- package/dist/renderer/features/TreegeRenderer/native/components/DefaultInputs.d.ts +20 -15
- package/dist/renderer/features/TreegeRenderer/native/components/DefaultLoadingSkeleton.d.ts +8 -0
- package/dist/renderer/features/TreegeRenderer/native/components/DefaultStep.d.ts +3 -0
- package/dist/renderer/features/TreegeRenderer/native/components/DefaultSubmitButton.d.ts +9 -7
- package/dist/renderer/features/TreegeRenderer/native/components/DefaultSubmitButtonWrapper.d.ts +11 -0
- package/dist/renderer/features/TreegeRenderer/native/components/DefaultUI.d.ts +8 -7
- package/dist/renderer/features/TreegeRenderer/native/components/DependencyHint.d.ts +15 -0
- package/dist/renderer/features/TreegeRenderer/native/components/OptionItemContent.d.ts +17 -0
- package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultAddressInput.d.ts +3 -0
- package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultAutocompleteInput.d.ts +3 -0
- package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultCheckboxInput.d.ts +3 -0
- package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultDateInput.d.ts +3 -0
- package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultDateRangeInput.d.ts +3 -0
- package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultFileInput.d.ts +3 -0
- package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultHiddenInput.d.ts +3 -0
- package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultHttpInput.d.ts +3 -0
- package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultNumberInput.d.ts +3 -0
- package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultPasswordInput.d.ts +3 -0
- package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultRadioInput.d.ts +3 -0
- package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultSelectInput.d.ts +3 -0
- package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultSubmitInput.d.ts +11 -0
- package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultSwitchInput.d.ts +3 -0
- package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultTextInput.d.ts +3 -0
- package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultTextareaInput.d.ts +3 -0
- package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultTimeInput.d.ts +3 -0
- package/dist/renderer/features/TreegeRenderer/native/components/inputs/DefaultTimeRangeInput.d.ts +3 -0
- package/dist/renderer/features/TreegeRenderer/useTreegeRenderer.d.ts +97 -24
- package/dist/renderer/features/TreegeRenderer/web/TreegeRenderer.d.ts +1 -1
- package/dist/renderer/features/TreegeRenderer/web/components/DefaultFormWrapper.d.ts +3 -2
- package/dist/renderer/features/TreegeRenderer/web/components/DefaultInputWrapper.d.ts +9 -0
- package/dist/renderer/features/TreegeRenderer/web/components/DefaultLoadingSkeleton.d.ts +7 -0
- package/dist/renderer/features/TreegeRenderer/web/components/DefaultStep.d.ts +3 -0
- package/dist/renderer/features/TreegeRenderer/web/components/DefaultSubmitButton.d.ts +5 -1
- package/dist/renderer/features/TreegeRenderer/web/components/DependencyHint.d.ts +22 -0
- package/dist/renderer/features/TreegeRenderer/web/components/OptionItemContent.d.ts +17 -0
- package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultAddressInput.d.ts +1 -1
- package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultAutocompleteInput.d.ts +1 -1
- package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultCheckboxInput.d.ts +1 -1
- package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultDateInput.d.ts +1 -1
- package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultDateRangeInput.d.ts +1 -1
- package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultFileInput.d.ts +1 -1
- package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultHiddenInput.d.ts +1 -1
- package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultHttpInput.d.ts +1 -1
- package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultNumberInput.d.ts +1 -1
- package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultPasswordInput.d.ts +1 -1
- package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultRadioInput.d.ts +1 -1
- package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultSelectInput.d.ts +1 -1
- package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultSubmitInput.d.ts +11 -0
- package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultSwitchInput.d.ts +1 -1
- package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultTextAreaInput.d.ts +1 -1
- package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultTextInput.d.ts +1 -1
- package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultTimeInput.d.ts +1 -1
- package/dist/renderer/features/TreegeRenderer/web/components/inputs/DefaultTimeRangeInput.d.ts +1 -1
- package/dist/renderer/features/TreegeRenderer/web/components/styles/RendererStyles.d.ts +2 -0
- package/dist/renderer/hooks/useInputOptions.d.ts +28 -0
- package/dist/renderer/hooks/useRenderNode.d.ts +61 -0
- package/dist/renderer/hooks/useSubmitHandler.d.ts +36 -0
- package/dist/renderer/hooks/useTranslate.d.ts +7 -5
- package/dist/renderer/index.d.ts +4 -2
- package/dist/renderer/index.native.d.ts +19 -0
- package/dist/renderer/types/renderer.d.ts +279 -42
- package/dist/renderer/utils/flow.d.ts +1 -18
- package/dist/renderer/utils/form.d.ts +38 -2
- package/dist/renderer/utils/http.d.ts +161 -0
- package/dist/renderer/utils/jsonTemplate.d.ts +30 -0
- package/dist/renderer/utils/node.d.ts +29 -1
- package/dist/renderer/utils/sanitize.d.ts +85 -0
- package/dist/renderer/utils/sanitize.native.d.ts +69 -0
- package/dist/renderer/utils/step.d.ts +27 -0
- package/dist/renderer/utils/submit.d.ts +49 -0
- package/dist/renderer/utils/templateDependencies.d.ts +17 -0
- package/dist/renderer-DFzpylQb.js +255 -0
- package/dist/renderer-native.d.ts +2 -0
- package/dist/renderer-native.js +3746 -0
- package/dist/renderer.js +5 -45
- package/dist/shared/components/ui/badge.d.ts +2 -2
- package/dist/shared/components/ui/button.d.ts +3 -3
- package/dist/shared/components/ui/collapsible.d.ts +1 -1
- package/dist/shared/components/ui/command.d.ts +1 -1
- package/dist/shared/components/ui/dropdown-menu.d.ts +1 -1
- package/dist/shared/components/ui/field.d.ts +24 -0
- package/dist/shared/components/ui/form.d.ts +1 -1
- package/dist/shared/components/ui/item.d.ts +23 -0
- package/dist/shared/components/ui/popover.d.ts +10 -2
- package/dist/shared/components/ui/select.d.ts +3 -1
- package/dist/shared/components/ui/sheet.d.ts +1 -1
- package/dist/shared/components/ui/skeleton.d.ts +3 -0
- package/dist/shared/components/ui/toggle-group.d.ts +7 -0
- package/dist/shared/components/ui/toggle.d.ts +9 -0
- package/dist/shared/components/ui/tooltip.d.ts +1 -1
- package/dist/shared/constants/colors.d.ts +45 -0
- package/dist/shared/constants/inputType.d.ts +6 -0
- package/dist/shared/constants/node.d.ts +0 -1
- package/dist/shared/context/PortalContainerContext.d.ts +5 -0
- package/dist/shared/context/ThemeContext.d.ts +2 -0
- package/dist/shared/context/ThemeContext.native.d.ts +22 -0
- package/dist/shared/hooks/useMediaQuery.d.ts +12 -0
- package/dist/shared/hooks/useThemeColors.d.ts +37 -0
- package/dist/shared/locales/ar.json.d.ts +253 -19
- package/dist/shared/locales/de.json.d.ts +254 -20
- package/dist/shared/locales/en.json.d.ts +255 -21
- package/dist/shared/locales/es.json.d.ts +254 -20
- package/dist/shared/locales/fr.json.d.ts +254 -20
- package/dist/shared/locales/it.json.d.ts +254 -20
- package/dist/shared/locales/pt.json.d.ts +254 -20
- package/dist/shared/types/edge.d.ts +6 -0
- package/dist/shared/types/node.d.ts +146 -18
- package/dist/shared/utils/httpRecord.d.ts +20 -0
- package/dist/shared/utils/inputTypeGuards.d.ts +7 -0
- package/dist/shared/utils/nodeTypeGuards.d.ts +1 -6
- package/dist/useRenderNode-DJGmt663.js +514 -0
- package/package.json +54 -22
- package/dist/ThemeContext-BIvs8Kw-.js +0 -758
- package/dist/TreegeEditor-Lv5Tn9_F.js +0 -2152
- package/dist/TreegeRenderer-D3EvsEfJ.js +0 -1413
- package/dist/editor/context/TreegeEditorContext.d.ts +0 -12
- package/dist/editor/features/TreegeEditor/forms/FlowNodeForm.d.ts +0 -2
- package/dist/editor/features/TreegeEditor/inputs/SelectInputType.d.ts +0 -7
- package/dist/editor/features/TreegeEditor/nodes/FlowNode.d.ts +0 -6
- package/dist/editor/features/TreegeEditor/nodes/GroupNode.d.ts +0 -6
- package/dist/editor/features/TreegeEditor/nodes/InputNode.d.ts +0 -6
- package/dist/editor/features/TreegeEditor/nodes/UINode.d.ts +0 -6
- package/dist/editor/hooks/useEdgesSelection.d.ts +0 -11
- package/dist/renderer/context/TreegeConfigContext.d.ts +0 -39
- package/dist/renderer/context/TreegeRendererContext.d.ts +0 -25
- package/dist/renderer/features/TreegeRenderer/native/components/DefaultGroup.d.ts +0 -7
- package/dist/renderer/features/TreegeRenderer/web/components/DefaultGroup.d.ts +0 -6
- /package/dist/editor/components/{data-display/logo.d.ts → branding/Logo.d.ts} +0 -0
|
@@ -0,0 +1,3746 @@
|
|
|
1
|
+
import { A as e, D as t, E as n, I as r, R as i, S as a, T as o, _ as s, a as c, b as l, c as u, h as d, i as f, j as p, m, n as h, o as g, p as _, r as v, s as y, t as b, v as x } from "./ThemeContext-CdHMLHiw.js";
|
|
2
|
+
import { a as S, c as C, i as w, l as T, n as E, o as D, r as ee, s as O, t as k } from "./useRenderNode-DJGmt663.js";
|
|
3
|
+
import { useCallback as te, useEffect as A, useMemo as j, useRef as M, useState as N } from "react";
|
|
4
|
+
import { Fragment as ne, jsx as P, jsxs as F } from "react/jsx-runtime";
|
|
5
|
+
import { ActivityIndicator as re, Alert as ie, Animated as I, FlatList as ae, Image as L, Modal as oe, ScrollView as R, StyleSheet as z, Switch as se, Text as B, TextInput as ce, TouchableOpacity as V, View as H } from "react-native";
|
|
6
|
+
//#region src/renderer/features/TreegeRenderer/native/components/DefaultFormWrapper.tsx
|
|
7
|
+
var le = ({ children: e }) => /* @__PURE__ */ P(H, {
|
|
8
|
+
style: ue.container,
|
|
9
|
+
children: e
|
|
10
|
+
}), ue = z.create({ container: { padding: 16 } }), de = async (e, t) => {
|
|
11
|
+
if (!e || e.trim().length < 3) return [];
|
|
12
|
+
try {
|
|
13
|
+
let n = await fetch(`https://nominatim.openstreetmap.org/search?q=${encodeURIComponent(e)}&format=jsonv2&addressdetails=1&limit=5`, { headers: {
|
|
14
|
+
Accept: "application/json",
|
|
15
|
+
"User-Agent": "Treege Renderer",
|
|
16
|
+
...t && { "Accept-Language": t }
|
|
17
|
+
} });
|
|
18
|
+
return n.ok ? (await n.json()).map((e) => ({
|
|
19
|
+
label: e.display_name,
|
|
20
|
+
value: e.display_name
|
|
21
|
+
})) : [];
|
|
22
|
+
} catch (e) {
|
|
23
|
+
return console.error("Nominatim fetch error:", e), [];
|
|
24
|
+
}
|
|
25
|
+
}, fe = async (e, t) => {
|
|
26
|
+
if (!e || e.trim().length < 3) return [];
|
|
27
|
+
try {
|
|
28
|
+
let n = await fetch(`https://maps.googleapis.com/maps/api/place/autocomplete/json?input=${encodeURIComponent(e)}&key=${t}`);
|
|
29
|
+
if (!n.ok) return console.warn("Google Places API request failed:", n.status), [];
|
|
30
|
+
let r = await n.json();
|
|
31
|
+
return r.status !== "OK" && r.status !== "ZERO_RESULTS" ? (console.warn("Google Places API status:", r.status), []) : (r.predictions || []).map((e) => ({
|
|
32
|
+
label: e.description,
|
|
33
|
+
value: e.description
|
|
34
|
+
}));
|
|
35
|
+
} catch (e) {
|
|
36
|
+
return console.error("Google Places fetch error:", e), [];
|
|
37
|
+
}
|
|
38
|
+
}, pe = ({ field: e, extra: n }) => {
|
|
39
|
+
let [r, i] = N(""), [a, o] = N([]), [s, c] = N(!1), [l, u] = N(!1), { value: d, placeholder: f, id: m, name: g } = e, { node: _, setValue: v, error: y, label: b, helperText: x } = n, { language: S, googleApiKey: C } = p(), w = t(), { colors: T } = h(), E = te((e) => {
|
|
40
|
+
v(e.value), i(""), c(!1), o([]);
|
|
41
|
+
}, [v]), D = () => {
|
|
42
|
+
c(!1);
|
|
43
|
+
};
|
|
44
|
+
return A(() => {
|
|
45
|
+
if (!r || r.trim().length < 3) {
|
|
46
|
+
o([]), u(!1);
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
u(!0);
|
|
50
|
+
let e = setTimeout(async () => {
|
|
51
|
+
o(C ? await fe(r, C) : await de(r, S)), u(!1);
|
|
52
|
+
}, 300);
|
|
53
|
+
return () => {
|
|
54
|
+
clearTimeout(e), u(!1);
|
|
55
|
+
};
|
|
56
|
+
}, [
|
|
57
|
+
r,
|
|
58
|
+
S,
|
|
59
|
+
C
|
|
60
|
+
]), /* @__PURE__ */ F(H, {
|
|
61
|
+
style: U.container,
|
|
62
|
+
children: [
|
|
63
|
+
/* @__PURE__ */ F(B, {
|
|
64
|
+
style: [U.label, { color: T.textSecondary }],
|
|
65
|
+
children: [b || _.data.name, _.data.required && /* @__PURE__ */ P(B, {
|
|
66
|
+
style: { color: T.error },
|
|
67
|
+
children: "*"
|
|
68
|
+
})]
|
|
69
|
+
}),
|
|
70
|
+
/* @__PURE__ */ F(V, {
|
|
71
|
+
style: [
|
|
72
|
+
U.trigger,
|
|
73
|
+
{
|
|
74
|
+
backgroundColor: T.input,
|
|
75
|
+
borderColor: T.border
|
|
76
|
+
},
|
|
77
|
+
y && { borderColor: T.error }
|
|
78
|
+
],
|
|
79
|
+
onPress: () => c(!0),
|
|
80
|
+
activeOpacity: .7,
|
|
81
|
+
children: [/* @__PURE__ */ P(B, {
|
|
82
|
+
style: [
|
|
83
|
+
U.triggerText,
|
|
84
|
+
{ color: T.text },
|
|
85
|
+
!d && { color: T.textMuted }
|
|
86
|
+
],
|
|
87
|
+
numberOfLines: 1,
|
|
88
|
+
children: d || f || w("renderer.defaultAddressInput.enterAddress")
|
|
89
|
+
}), /* @__PURE__ */ P(B, {
|
|
90
|
+
style: U.icon,
|
|
91
|
+
children: "📍"
|
|
92
|
+
})]
|
|
93
|
+
}),
|
|
94
|
+
/* @__PURE__ */ P(oe, {
|
|
95
|
+
visible: s,
|
|
96
|
+
transparent: !0,
|
|
97
|
+
animationType: "fade",
|
|
98
|
+
onRequestClose: D,
|
|
99
|
+
children: /* @__PURE__ */ P(V, {
|
|
100
|
+
style: U.modalOverlay,
|
|
101
|
+
activeOpacity: 1,
|
|
102
|
+
onPress: D,
|
|
103
|
+
children: /* @__PURE__ */ F(V, {
|
|
104
|
+
style: [U.modalContent, { backgroundColor: T.card }],
|
|
105
|
+
activeOpacity: 1,
|
|
106
|
+
onPress: () => {},
|
|
107
|
+
children: [
|
|
108
|
+
/* @__PURE__ */ F(H, {
|
|
109
|
+
style: [U.modalHeader, { borderBottomColor: T.separator }],
|
|
110
|
+
children: [/* @__PURE__ */ P(B, {
|
|
111
|
+
style: [U.modalTitle, { color: T.text }],
|
|
112
|
+
children: b || _.data.name
|
|
113
|
+
}), /* @__PURE__ */ P(V, {
|
|
114
|
+
onPress: D,
|
|
115
|
+
children: /* @__PURE__ */ P(B, {
|
|
116
|
+
style: [U.closeButton, { color: T.textMuted }],
|
|
117
|
+
children: "✕"
|
|
118
|
+
})
|
|
119
|
+
})]
|
|
120
|
+
}),
|
|
121
|
+
/* @__PURE__ */ F(H, {
|
|
122
|
+
style: U.searchContainer,
|
|
123
|
+
children: [/* @__PURE__ */ P(ce, {
|
|
124
|
+
style: [U.searchInput, {
|
|
125
|
+
backgroundColor: T.muted,
|
|
126
|
+
borderColor: T.border,
|
|
127
|
+
color: T.text
|
|
128
|
+
}],
|
|
129
|
+
placeholder: f || w("renderer.defaultAddressInput.enterAddress"),
|
|
130
|
+
placeholderTextColor: T.textMuted,
|
|
131
|
+
value: r,
|
|
132
|
+
onChangeText: i,
|
|
133
|
+
autoFocus: !0,
|
|
134
|
+
autoCapitalize: "none",
|
|
135
|
+
autoCorrect: !1
|
|
136
|
+
}), l && /* @__PURE__ */ P(re, {
|
|
137
|
+
size: "small",
|
|
138
|
+
color: T.primary,
|
|
139
|
+
style: U.searchLoader
|
|
140
|
+
})]
|
|
141
|
+
}),
|
|
142
|
+
l ? /* @__PURE__ */ F(H, {
|
|
143
|
+
style: U.loadingContainer,
|
|
144
|
+
children: [/* @__PURE__ */ P(re, {
|
|
145
|
+
size: "small",
|
|
146
|
+
color: T.primary
|
|
147
|
+
}), /* @__PURE__ */ P(B, {
|
|
148
|
+
style: [U.loadingText, { color: T.textMuted }],
|
|
149
|
+
children: w("renderer.defaultAddressInput.searching")
|
|
150
|
+
})]
|
|
151
|
+
}) : /* @__PURE__ */ P(ae, {
|
|
152
|
+
data: a,
|
|
153
|
+
keyExtractor: (e, t) => t.toString(),
|
|
154
|
+
style: U.suggestionsList,
|
|
155
|
+
contentContainerStyle: U.suggestionsListContent,
|
|
156
|
+
keyboardShouldPersistTaps: "handled",
|
|
157
|
+
ListEmptyComponent: r.length >= 3 ? /* @__PURE__ */ P(H, {
|
|
158
|
+
style: U.emptyContainer,
|
|
159
|
+
children: /* @__PURE__ */ P(B, {
|
|
160
|
+
style: [U.emptyText, { color: T.textMuted }],
|
|
161
|
+
children: w("renderer.defaultAddressInput.noAddressesFound")
|
|
162
|
+
})
|
|
163
|
+
}) : /* @__PURE__ */ P(H, {
|
|
164
|
+
style: U.emptyContainer,
|
|
165
|
+
children: /* @__PURE__ */ P(B, {
|
|
166
|
+
style: [U.emptyText, { color: T.textMuted }],
|
|
167
|
+
children: w("renderer.defaultAddressInput.typeMinChars")
|
|
168
|
+
})
|
|
169
|
+
}),
|
|
170
|
+
renderItem: ({ item: e }) => /* @__PURE__ */ F(V, {
|
|
171
|
+
style: U.suggestionItem,
|
|
172
|
+
onPress: () => E(e),
|
|
173
|
+
activeOpacity: .7,
|
|
174
|
+
children: [/* @__PURE__ */ P(B, {
|
|
175
|
+
style: U.suggestionIcon,
|
|
176
|
+
children: "📍"
|
|
177
|
+
}), /* @__PURE__ */ P(B, {
|
|
178
|
+
style: [U.suggestionText, { color: T.text }],
|
|
179
|
+
numberOfLines: 2,
|
|
180
|
+
children: e.label
|
|
181
|
+
})]
|
|
182
|
+
})
|
|
183
|
+
})
|
|
184
|
+
]
|
|
185
|
+
})
|
|
186
|
+
})
|
|
187
|
+
}),
|
|
188
|
+
y && /* @__PURE__ */ P(B, {
|
|
189
|
+
style: [U.error, { color: T.error }],
|
|
190
|
+
children: y
|
|
191
|
+
}),
|
|
192
|
+
x && !y && /* @__PURE__ */ P(B, {
|
|
193
|
+
style: [U.helperText, { color: T.textMuted }],
|
|
194
|
+
children: x
|
|
195
|
+
})
|
|
196
|
+
]
|
|
197
|
+
});
|
|
198
|
+
}, U = z.create({
|
|
199
|
+
closeButton: {
|
|
200
|
+
fontSize: 24,
|
|
201
|
+
fontWeight: "300"
|
|
202
|
+
},
|
|
203
|
+
container: { marginBottom: 16 },
|
|
204
|
+
emptyContainer: {
|
|
205
|
+
alignItems: "center",
|
|
206
|
+
paddingVertical: 24
|
|
207
|
+
},
|
|
208
|
+
emptyText: { fontSize: 14 },
|
|
209
|
+
error: {
|
|
210
|
+
fontSize: 12,
|
|
211
|
+
marginTop: 4
|
|
212
|
+
},
|
|
213
|
+
helperText: {
|
|
214
|
+
fontSize: 12,
|
|
215
|
+
marginTop: 4
|
|
216
|
+
},
|
|
217
|
+
icon: { fontSize: 16 },
|
|
218
|
+
label: {
|
|
219
|
+
fontSize: 14,
|
|
220
|
+
fontWeight: "500",
|
|
221
|
+
marginBottom: 8
|
|
222
|
+
},
|
|
223
|
+
loadingContainer: {
|
|
224
|
+
alignItems: "center",
|
|
225
|
+
flexDirection: "row",
|
|
226
|
+
justifyContent: "center",
|
|
227
|
+
paddingVertical: 24
|
|
228
|
+
},
|
|
229
|
+
loadingText: {
|
|
230
|
+
fontSize: 14,
|
|
231
|
+
marginLeft: 8
|
|
232
|
+
},
|
|
233
|
+
modalContent: {
|
|
234
|
+
borderRadius: 12,
|
|
235
|
+
maxHeight: "80%",
|
|
236
|
+
padding: 16,
|
|
237
|
+
width: "90%"
|
|
238
|
+
},
|
|
239
|
+
modalHeader: {
|
|
240
|
+
alignItems: "center",
|
|
241
|
+
borderBottomWidth: 1,
|
|
242
|
+
flexDirection: "row",
|
|
243
|
+
justifyContent: "space-between",
|
|
244
|
+
marginBottom: 12,
|
|
245
|
+
paddingBottom: 12
|
|
246
|
+
},
|
|
247
|
+
modalOverlay: {
|
|
248
|
+
alignItems: "center",
|
|
249
|
+
backgroundColor: "rgba(0, 0, 0, 0.5)",
|
|
250
|
+
flex: 1,
|
|
251
|
+
justifyContent: "center"
|
|
252
|
+
},
|
|
253
|
+
modalTitle: {
|
|
254
|
+
fontSize: 18,
|
|
255
|
+
fontWeight: "600"
|
|
256
|
+
},
|
|
257
|
+
searchContainer: {
|
|
258
|
+
marginBottom: 12,
|
|
259
|
+
position: "relative"
|
|
260
|
+
},
|
|
261
|
+
searchInput: {
|
|
262
|
+
borderRadius: 6,
|
|
263
|
+
borderWidth: 1,
|
|
264
|
+
fontSize: 14,
|
|
265
|
+
paddingHorizontal: 12,
|
|
266
|
+
paddingRight: 40,
|
|
267
|
+
paddingVertical: 10
|
|
268
|
+
},
|
|
269
|
+
searchLoader: {
|
|
270
|
+
position: "absolute",
|
|
271
|
+
right: 12,
|
|
272
|
+
top: "50%",
|
|
273
|
+
transform: [{ translateY: -10 }]
|
|
274
|
+
},
|
|
275
|
+
suggestionIcon: {
|
|
276
|
+
fontSize: 16,
|
|
277
|
+
marginRight: 8
|
|
278
|
+
},
|
|
279
|
+
suggestionItem: {
|
|
280
|
+
alignItems: "center",
|
|
281
|
+
borderRadius: 6,
|
|
282
|
+
flexDirection: "row",
|
|
283
|
+
paddingHorizontal: 12,
|
|
284
|
+
paddingVertical: 12
|
|
285
|
+
},
|
|
286
|
+
suggestionsList: {
|
|
287
|
+
flexGrow: 0,
|
|
288
|
+
flexShrink: 1
|
|
289
|
+
},
|
|
290
|
+
suggestionsListContent: { flexGrow: 0 },
|
|
291
|
+
suggestionText: {
|
|
292
|
+
flex: 1,
|
|
293
|
+
fontSize: 14
|
|
294
|
+
},
|
|
295
|
+
trigger: {
|
|
296
|
+
alignItems: "center",
|
|
297
|
+
borderRadius: 6,
|
|
298
|
+
borderWidth: 1,
|
|
299
|
+
flexDirection: "row",
|
|
300
|
+
justifyContent: "space-between",
|
|
301
|
+
paddingHorizontal: 12,
|
|
302
|
+
paddingVertical: 10
|
|
303
|
+
},
|
|
304
|
+
triggerText: {
|
|
305
|
+
flex: 1,
|
|
306
|
+
fontSize: 14
|
|
307
|
+
}
|
|
308
|
+
}), me = ({ label: e, description: t, image: n, disabled: r }) => {
|
|
309
|
+
let { colors: i } = h();
|
|
310
|
+
return /* @__PURE__ */ F(H, {
|
|
311
|
+
style: he.content,
|
|
312
|
+
children: [n ? /* @__PURE__ */ P(L, {
|
|
313
|
+
source: { uri: n },
|
|
314
|
+
style: he.image
|
|
315
|
+
}) : null, /* @__PURE__ */ F(H, {
|
|
316
|
+
style: he.textWrapper,
|
|
317
|
+
children: [/* @__PURE__ */ P(B, {
|
|
318
|
+
style: [he.label, { color: r ? i.textMuted : i.text }],
|
|
319
|
+
children: e
|
|
320
|
+
}), t ? /* @__PURE__ */ P(B, {
|
|
321
|
+
style: [he.description, { color: i.textMuted }],
|
|
322
|
+
children: t
|
|
323
|
+
}) : null]
|
|
324
|
+
})]
|
|
325
|
+
});
|
|
326
|
+
}, he = z.create({
|
|
327
|
+
content: {
|
|
328
|
+
alignItems: "center",
|
|
329
|
+
flex: 1,
|
|
330
|
+
flexDirection: "row",
|
|
331
|
+
gap: 12
|
|
332
|
+
},
|
|
333
|
+
description: {
|
|
334
|
+
fontSize: 12,
|
|
335
|
+
marginTop: 2
|
|
336
|
+
},
|
|
337
|
+
image: {
|
|
338
|
+
borderRadius: 6,
|
|
339
|
+
height: 40,
|
|
340
|
+
width: 40
|
|
341
|
+
},
|
|
342
|
+
label: { fontSize: 14 },
|
|
343
|
+
textWrapper: { flex: 1 }
|
|
344
|
+
}), ge = ({ field: e, extra: n }) => {
|
|
345
|
+
let [r, i] = N(!1), [a, o] = N(""), { value: s, placeholder: c } = e, { node: l, setValue: u, error: d, label: f, helperText: p } = n, m = t(), { colors: g } = h(), _ = l.data.options || [], v = _.find((e) => e.value === s), y = j(() => {
|
|
346
|
+
if (!a.trim()) return _;
|
|
347
|
+
let e = a.toLowerCase();
|
|
348
|
+
return _.filter((t) => m(t.label).toLowerCase().includes(e) || t.value.toLowerCase().includes(e));
|
|
349
|
+
}, [
|
|
350
|
+
_,
|
|
351
|
+
a,
|
|
352
|
+
m
|
|
353
|
+
]), b = (e) => {
|
|
354
|
+
u(e === s ? "" : e), i(!1), o("");
|
|
355
|
+
}, x = () => {
|
|
356
|
+
i(!1), o("");
|
|
357
|
+
};
|
|
358
|
+
return /* @__PURE__ */ F(H, {
|
|
359
|
+
style: W.container,
|
|
360
|
+
children: [
|
|
361
|
+
/* @__PURE__ */ F(B, {
|
|
362
|
+
style: [W.label, { color: g.textSecondary }],
|
|
363
|
+
children: [f || l.data.name, l.data.required && /* @__PURE__ */ P(B, {
|
|
364
|
+
style: { color: g.error },
|
|
365
|
+
children: "*"
|
|
366
|
+
})]
|
|
367
|
+
}),
|
|
368
|
+
/* @__PURE__ */ F(V, {
|
|
369
|
+
style: [
|
|
370
|
+
W.trigger,
|
|
371
|
+
{
|
|
372
|
+
backgroundColor: g.input,
|
|
373
|
+
borderColor: g.border
|
|
374
|
+
},
|
|
375
|
+
d && { borderColor: g.error }
|
|
376
|
+
],
|
|
377
|
+
onPress: () => i(!0),
|
|
378
|
+
activeOpacity: .7,
|
|
379
|
+
children: [/* @__PURE__ */ P(B, {
|
|
380
|
+
style: [
|
|
381
|
+
W.triggerText,
|
|
382
|
+
{ color: g.text },
|
|
383
|
+
!s && { color: g.textMuted }
|
|
384
|
+
],
|
|
385
|
+
numberOfLines: 1,
|
|
386
|
+
children: s && v ? m(v.label) : c || m("renderer.defaultAutocompleteInput.selectOption")
|
|
387
|
+
}), /* @__PURE__ */ P(B, {
|
|
388
|
+
style: [W.arrow, { color: g.textMuted }],
|
|
389
|
+
children: "▼"
|
|
390
|
+
})]
|
|
391
|
+
}),
|
|
392
|
+
/* @__PURE__ */ P(oe, {
|
|
393
|
+
visible: r,
|
|
394
|
+
transparent: !0,
|
|
395
|
+
animationType: "fade",
|
|
396
|
+
onRequestClose: x,
|
|
397
|
+
children: /* @__PURE__ */ P(V, {
|
|
398
|
+
style: W.modalOverlay,
|
|
399
|
+
activeOpacity: 1,
|
|
400
|
+
onPress: x,
|
|
401
|
+
children: /* @__PURE__ */ F(V, {
|
|
402
|
+
style: [W.modalContent, { backgroundColor: g.card }],
|
|
403
|
+
activeOpacity: 1,
|
|
404
|
+
onPress: () => {},
|
|
405
|
+
children: [
|
|
406
|
+
/* @__PURE__ */ F(H, {
|
|
407
|
+
style: [W.modalHeader, { borderBottomColor: g.separator }],
|
|
408
|
+
children: [/* @__PURE__ */ P(B, {
|
|
409
|
+
style: [W.modalTitle, { color: g.text }],
|
|
410
|
+
children: f || l.data.name
|
|
411
|
+
}), /* @__PURE__ */ P(V, {
|
|
412
|
+
onPress: x,
|
|
413
|
+
children: /* @__PURE__ */ P(B, {
|
|
414
|
+
style: [W.closeButton, { color: g.textMuted }],
|
|
415
|
+
children: "✕"
|
|
416
|
+
})
|
|
417
|
+
})]
|
|
418
|
+
}),
|
|
419
|
+
/* @__PURE__ */ P(H, {
|
|
420
|
+
style: W.searchContainer,
|
|
421
|
+
children: /* @__PURE__ */ P(ce, {
|
|
422
|
+
style: [W.searchInput, {
|
|
423
|
+
backgroundColor: g.muted,
|
|
424
|
+
borderColor: g.border,
|
|
425
|
+
color: g.text
|
|
426
|
+
}],
|
|
427
|
+
placeholder: c || m("renderer.defaultAutocompleteInput.search"),
|
|
428
|
+
placeholderTextColor: g.textMuted,
|
|
429
|
+
value: a,
|
|
430
|
+
onChangeText: o,
|
|
431
|
+
autoFocus: !0,
|
|
432
|
+
autoCapitalize: "none",
|
|
433
|
+
autoCorrect: !1
|
|
434
|
+
})
|
|
435
|
+
}),
|
|
436
|
+
/* @__PURE__ */ P(ae, {
|
|
437
|
+
data: y,
|
|
438
|
+
keyExtractor: (e) => e.value,
|
|
439
|
+
style: W.optionsList,
|
|
440
|
+
contentContainerStyle: W.optionsListContent,
|
|
441
|
+
ListEmptyComponent: /* @__PURE__ */ P(H, {
|
|
442
|
+
style: W.emptyContainer,
|
|
443
|
+
children: /* @__PURE__ */ P(B, {
|
|
444
|
+
style: [W.emptyText, { color: g.textMuted }],
|
|
445
|
+
children: m("renderer.defaultAutocompleteInput.noResults")
|
|
446
|
+
})
|
|
447
|
+
}),
|
|
448
|
+
renderItem: ({ item: e }) => {
|
|
449
|
+
let t = e.value === s;
|
|
450
|
+
return /* @__PURE__ */ F(V, {
|
|
451
|
+
style: [W.option, t && { backgroundColor: g.primaryLight }],
|
|
452
|
+
onPress: () => b(e.value),
|
|
453
|
+
disabled: e.disabled,
|
|
454
|
+
activeOpacity: .7,
|
|
455
|
+
children: [/* @__PURE__ */ P(me, {
|
|
456
|
+
label: m(e.label) || e.value,
|
|
457
|
+
description: m(e.description),
|
|
458
|
+
image: e.image,
|
|
459
|
+
disabled: e.disabled
|
|
460
|
+
}), t && /* @__PURE__ */ P(B, {
|
|
461
|
+
style: [W.checkmark, { color: g.primary }],
|
|
462
|
+
children: "✓"
|
|
463
|
+
})]
|
|
464
|
+
});
|
|
465
|
+
}
|
|
466
|
+
})
|
|
467
|
+
]
|
|
468
|
+
})
|
|
469
|
+
})
|
|
470
|
+
}),
|
|
471
|
+
d && /* @__PURE__ */ P(B, {
|
|
472
|
+
style: [W.error, { color: g.error }],
|
|
473
|
+
children: d
|
|
474
|
+
}),
|
|
475
|
+
p && !d && /* @__PURE__ */ P(B, {
|
|
476
|
+
style: [W.helperText, { color: g.textMuted }],
|
|
477
|
+
children: p
|
|
478
|
+
})
|
|
479
|
+
]
|
|
480
|
+
});
|
|
481
|
+
}, W = z.create({
|
|
482
|
+
arrow: { fontSize: 12 },
|
|
483
|
+
checkmark: {
|
|
484
|
+
fontSize: 18,
|
|
485
|
+
fontWeight: "700"
|
|
486
|
+
},
|
|
487
|
+
closeButton: {
|
|
488
|
+
fontSize: 24,
|
|
489
|
+
fontWeight: "300"
|
|
490
|
+
},
|
|
491
|
+
container: { marginBottom: 16 },
|
|
492
|
+
emptyContainer: {
|
|
493
|
+
alignItems: "center",
|
|
494
|
+
paddingVertical: 24
|
|
495
|
+
},
|
|
496
|
+
emptyText: { fontSize: 14 },
|
|
497
|
+
error: {
|
|
498
|
+
fontSize: 12,
|
|
499
|
+
marginTop: 4
|
|
500
|
+
},
|
|
501
|
+
helperText: {
|
|
502
|
+
fontSize: 12,
|
|
503
|
+
marginTop: 4
|
|
504
|
+
},
|
|
505
|
+
label: {
|
|
506
|
+
fontSize: 14,
|
|
507
|
+
fontWeight: "500",
|
|
508
|
+
marginBottom: 8
|
|
509
|
+
},
|
|
510
|
+
modalContent: {
|
|
511
|
+
borderRadius: 12,
|
|
512
|
+
maxHeight: "80%",
|
|
513
|
+
padding: 16,
|
|
514
|
+
width: "90%"
|
|
515
|
+
},
|
|
516
|
+
modalHeader: {
|
|
517
|
+
alignItems: "center",
|
|
518
|
+
borderBottomWidth: 1,
|
|
519
|
+
flexDirection: "row",
|
|
520
|
+
justifyContent: "space-between",
|
|
521
|
+
marginBottom: 12,
|
|
522
|
+
paddingBottom: 12
|
|
523
|
+
},
|
|
524
|
+
modalOverlay: {
|
|
525
|
+
alignItems: "center",
|
|
526
|
+
backgroundColor: "rgba(0, 0, 0, 0.5)",
|
|
527
|
+
flex: 1,
|
|
528
|
+
justifyContent: "center"
|
|
529
|
+
},
|
|
530
|
+
modalTitle: {
|
|
531
|
+
fontSize: 18,
|
|
532
|
+
fontWeight: "600"
|
|
533
|
+
},
|
|
534
|
+
option: {
|
|
535
|
+
alignItems: "center",
|
|
536
|
+
borderRadius: 6,
|
|
537
|
+
flexDirection: "row",
|
|
538
|
+
justifyContent: "space-between",
|
|
539
|
+
paddingHorizontal: 12,
|
|
540
|
+
paddingVertical: 12
|
|
541
|
+
},
|
|
542
|
+
optionsList: {
|
|
543
|
+
flexGrow: 0,
|
|
544
|
+
flexShrink: 1
|
|
545
|
+
},
|
|
546
|
+
optionsListContent: { flexGrow: 0 },
|
|
547
|
+
searchContainer: { marginBottom: 12 },
|
|
548
|
+
searchInput: {
|
|
549
|
+
borderRadius: 6,
|
|
550
|
+
borderWidth: 1,
|
|
551
|
+
fontSize: 14,
|
|
552
|
+
paddingHorizontal: 12,
|
|
553
|
+
paddingVertical: 10
|
|
554
|
+
},
|
|
555
|
+
trigger: {
|
|
556
|
+
alignItems: "center",
|
|
557
|
+
borderRadius: 6,
|
|
558
|
+
borderWidth: 1,
|
|
559
|
+
flexDirection: "row",
|
|
560
|
+
justifyContent: "space-between",
|
|
561
|
+
paddingHorizontal: 12,
|
|
562
|
+
paddingVertical: 10
|
|
563
|
+
},
|
|
564
|
+
triggerText: {
|
|
565
|
+
flex: 1,
|
|
566
|
+
fontSize: 14
|
|
567
|
+
}
|
|
568
|
+
}), _e = ({ field: e, extra: n }) => {
|
|
569
|
+
let r = t(), { value: i } = e, { node: a, setValue: o, error: s, label: c, helperText: l } = n, { colors: u } = h(), d = a.data.options || [], f = d.length > 0, p = Array.isArray(i) ? i : [], m = typeof i == "boolean" ? i : !1, g = (e) => {
|
|
570
|
+
o(f ? p.includes(e) ? p.filter((t) => t !== e) : [...p, e] : !m);
|
|
571
|
+
}, _ = (e) => f ? p.includes(e) : m;
|
|
572
|
+
return /* @__PURE__ */ F(H, {
|
|
573
|
+
style: G.container,
|
|
574
|
+
children: [
|
|
575
|
+
/* @__PURE__ */ F(B, {
|
|
576
|
+
style: [G.label, { color: u.textSecondary }],
|
|
577
|
+
children: [c || a.data.name, a.data.required && /* @__PURE__ */ P(B, {
|
|
578
|
+
style: { color: u.error },
|
|
579
|
+
children: "*"
|
|
580
|
+
})]
|
|
581
|
+
}),
|
|
582
|
+
d.length > 0 ? d.map((e) => {
|
|
583
|
+
let t = r(e.description);
|
|
584
|
+
return /* @__PURE__ */ F(V, {
|
|
585
|
+
style: G.option,
|
|
586
|
+
onPress: () => g(e.value),
|
|
587
|
+
disabled: e.disabled,
|
|
588
|
+
activeOpacity: .7,
|
|
589
|
+
accessible: !0,
|
|
590
|
+
accessibilityRole: "checkbox",
|
|
591
|
+
accessibilityState: {
|
|
592
|
+
checked: _(e.value),
|
|
593
|
+
disabled: e.disabled
|
|
594
|
+
},
|
|
595
|
+
accessibilityLabel: r(e.label) || e.value,
|
|
596
|
+
children: [
|
|
597
|
+
/* @__PURE__ */ P(H, {
|
|
598
|
+
style: [
|
|
599
|
+
G.checkbox,
|
|
600
|
+
{
|
|
601
|
+
backgroundColor: u.input,
|
|
602
|
+
borderColor: u.border
|
|
603
|
+
},
|
|
604
|
+
_(e.value) && {
|
|
605
|
+
backgroundColor: u.primary,
|
|
606
|
+
borderColor: u.primary
|
|
607
|
+
}
|
|
608
|
+
],
|
|
609
|
+
children: _(e.value) && /* @__PURE__ */ P(B, {
|
|
610
|
+
style: G.checkmark,
|
|
611
|
+
children: "✓"
|
|
612
|
+
})
|
|
613
|
+
}),
|
|
614
|
+
e.image ? /* @__PURE__ */ P(L, {
|
|
615
|
+
source: { uri: e.image },
|
|
616
|
+
style: G.image
|
|
617
|
+
}) : null,
|
|
618
|
+
/* @__PURE__ */ F(H, {
|
|
619
|
+
style: G.optionTextContainer,
|
|
620
|
+
children: [/* @__PURE__ */ P(B, {
|
|
621
|
+
style: [
|
|
622
|
+
G.optionLabel,
|
|
623
|
+
{ color: u.textSecondary },
|
|
624
|
+
e.disabled && { color: u.textMuted }
|
|
625
|
+
],
|
|
626
|
+
children: r(e.label) || e.value
|
|
627
|
+
}), t && /* @__PURE__ */ P(B, {
|
|
628
|
+
style: [G.optionDescription, { color: u.textMuted }],
|
|
629
|
+
children: t
|
|
630
|
+
})]
|
|
631
|
+
})
|
|
632
|
+
]
|
|
633
|
+
}, e.value);
|
|
634
|
+
}) : /* @__PURE__ */ F(V, {
|
|
635
|
+
style: G.option,
|
|
636
|
+
onPress: () => g(""),
|
|
637
|
+
activeOpacity: .7,
|
|
638
|
+
accessible: !0,
|
|
639
|
+
accessibilityRole: "checkbox",
|
|
640
|
+
accessibilityState: { checked: m },
|
|
641
|
+
accessibilityLabel: c || a.data.name,
|
|
642
|
+
children: [/* @__PURE__ */ P(H, {
|
|
643
|
+
style: [
|
|
644
|
+
G.checkbox,
|
|
645
|
+
{
|
|
646
|
+
backgroundColor: u.input,
|
|
647
|
+
borderColor: u.border
|
|
648
|
+
},
|
|
649
|
+
m && {
|
|
650
|
+
backgroundColor: u.primary,
|
|
651
|
+
borderColor: u.primary
|
|
652
|
+
}
|
|
653
|
+
],
|
|
654
|
+
children: m && /* @__PURE__ */ P(B, {
|
|
655
|
+
style: G.checkmark,
|
|
656
|
+
children: "✓"
|
|
657
|
+
})
|
|
658
|
+
}), /* @__PURE__ */ P(B, {
|
|
659
|
+
style: [G.optionLabel, { color: u.textSecondary }],
|
|
660
|
+
children: c || a.data.name
|
|
661
|
+
})]
|
|
662
|
+
}),
|
|
663
|
+
s && /* @__PURE__ */ P(B, {
|
|
664
|
+
style: [G.error, { color: u.error }],
|
|
665
|
+
children: s
|
|
666
|
+
}),
|
|
667
|
+
l && !s && /* @__PURE__ */ P(B, {
|
|
668
|
+
style: [G.helperText, { color: u.textMuted }],
|
|
669
|
+
children: l
|
|
670
|
+
})
|
|
671
|
+
]
|
|
672
|
+
});
|
|
673
|
+
}, G = z.create({
|
|
674
|
+
checkbox: {
|
|
675
|
+
alignItems: "center",
|
|
676
|
+
borderRadius: 4,
|
|
677
|
+
borderWidth: 2,
|
|
678
|
+
height: 20,
|
|
679
|
+
justifyContent: "center",
|
|
680
|
+
marginRight: 12,
|
|
681
|
+
width: 20
|
|
682
|
+
},
|
|
683
|
+
checkmark: {
|
|
684
|
+
color: "#FFFFFF",
|
|
685
|
+
fontSize: 14,
|
|
686
|
+
fontWeight: "700"
|
|
687
|
+
},
|
|
688
|
+
container: { marginBottom: 16 },
|
|
689
|
+
error: {
|
|
690
|
+
fontSize: 12,
|
|
691
|
+
marginTop: 4
|
|
692
|
+
},
|
|
693
|
+
helperText: {
|
|
694
|
+
fontSize: 12,
|
|
695
|
+
marginTop: 4
|
|
696
|
+
},
|
|
697
|
+
image: {
|
|
698
|
+
borderRadius: 4,
|
|
699
|
+
height: 32,
|
|
700
|
+
marginRight: 8,
|
|
701
|
+
width: 32
|
|
702
|
+
},
|
|
703
|
+
label: {
|
|
704
|
+
fontSize: 14,
|
|
705
|
+
fontWeight: "500",
|
|
706
|
+
marginBottom: 8
|
|
707
|
+
},
|
|
708
|
+
option: {
|
|
709
|
+
alignItems: "flex-start",
|
|
710
|
+
flexDirection: "row",
|
|
711
|
+
marginBottom: 8
|
|
712
|
+
},
|
|
713
|
+
optionDescription: {
|
|
714
|
+
fontSize: 12,
|
|
715
|
+
marginTop: 2
|
|
716
|
+
},
|
|
717
|
+
optionLabel: { fontSize: 14 },
|
|
718
|
+
optionTextContainer: { flex: 1 }
|
|
719
|
+
}), ve = ({ field: e, extra: n }) => {
|
|
720
|
+
let [r, i] = N(!1), { value: a, placeholder: o } = e, { node: s, setValue: c, error: l, label: u, helperText: d } = n, { colors: f } = h(), p = t(), m = a ? new Date(a) : void 0, { year: g, month: _, today: v } = j(() => {
|
|
721
|
+
let e = m || /* @__PURE__ */ new Date(), t = e.getFullYear(), n = e.getMonth(), r = /* @__PURE__ */ new Date();
|
|
722
|
+
return r.setHours(0, 0, 0, 0), {
|
|
723
|
+
month: n,
|
|
724
|
+
today: r,
|
|
725
|
+
year: t
|
|
726
|
+
};
|
|
727
|
+
}, [m]), [y, b] = N(g), [x, S] = N(_), C = [
|
|
728
|
+
"January",
|
|
729
|
+
"February",
|
|
730
|
+
"March",
|
|
731
|
+
"April",
|
|
732
|
+
"May",
|
|
733
|
+
"June",
|
|
734
|
+
"July",
|
|
735
|
+
"August",
|
|
736
|
+
"September",
|
|
737
|
+
"October",
|
|
738
|
+
"November",
|
|
739
|
+
"December"
|
|
740
|
+
], w = j(() => {
|
|
741
|
+
let e = new Date(y, x, 1).getDay(), t = new Date(y, x + 1, 0).getDate(), n = new Date(y, x, 0).getDate(), r = [];
|
|
742
|
+
for (let t = e - 1; t >= 0; t--) r.push({
|
|
743
|
+
date: new Date(y, x - 1, n - t),
|
|
744
|
+
day: n - t,
|
|
745
|
+
isCurrentMonth: !1
|
|
746
|
+
});
|
|
747
|
+
for (let e = 1; e <= t; e++) r.push({
|
|
748
|
+
date: new Date(y, x, e),
|
|
749
|
+
day: e,
|
|
750
|
+
isCurrentMonth: !0
|
|
751
|
+
});
|
|
752
|
+
let i = 42 - r.length;
|
|
753
|
+
for (let e = 1; e <= i; e++) r.push({
|
|
754
|
+
date: new Date(y, x + 1, e),
|
|
755
|
+
day: e,
|
|
756
|
+
isCurrentMonth: !1
|
|
757
|
+
});
|
|
758
|
+
return r;
|
|
759
|
+
}, [y, x]), T = te((e) => {
|
|
760
|
+
s.data.disablePast && e < v || (c(e.toISOString()), i(!1));
|
|
761
|
+
}, [
|
|
762
|
+
s.data.disablePast,
|
|
763
|
+
v,
|
|
764
|
+
c
|
|
765
|
+
]), E = () => {
|
|
766
|
+
x === 0 ? (S(11), b(y - 1)) : S(x - 1);
|
|
767
|
+
}, D = () => {
|
|
768
|
+
x === 11 ? (S(0), b(y + 1)) : S(x + 1);
|
|
769
|
+
}, ee = () => m ? m.toLocaleDateString() : o || p("renderer.defaultInputs.selectDate"), O = (e) => s.data.disablePast ? e < v : !1, k = (e) => m ? e.getDate() === m.getDate() && e.getMonth() === m.getMonth() && e.getFullYear() === m.getFullYear() : !1;
|
|
770
|
+
return /* @__PURE__ */ F(H, {
|
|
771
|
+
style: K.container,
|
|
772
|
+
children: [
|
|
773
|
+
/* @__PURE__ */ F(B, {
|
|
774
|
+
style: [K.label, { color: f.textSecondary }],
|
|
775
|
+
children: [u || s.data.name, s.data.required && /* @__PURE__ */ P(B, {
|
|
776
|
+
style: { color: f.error },
|
|
777
|
+
children: "*"
|
|
778
|
+
})]
|
|
779
|
+
}),
|
|
780
|
+
/* @__PURE__ */ F(V, {
|
|
781
|
+
style: [
|
|
782
|
+
K.trigger,
|
|
783
|
+
{
|
|
784
|
+
backgroundColor: f.input,
|
|
785
|
+
borderColor: f.border
|
|
786
|
+
},
|
|
787
|
+
l && { borderColor: f.error }
|
|
788
|
+
],
|
|
789
|
+
onPress: () => i(!0),
|
|
790
|
+
activeOpacity: .7,
|
|
791
|
+
children: [/* @__PURE__ */ P(B, {
|
|
792
|
+
style: [
|
|
793
|
+
K.triggerText,
|
|
794
|
+
{ color: f.text },
|
|
795
|
+
!a && { color: f.textMuted }
|
|
796
|
+
],
|
|
797
|
+
numberOfLines: 1,
|
|
798
|
+
children: ee()
|
|
799
|
+
}), /* @__PURE__ */ P(B, {
|
|
800
|
+
style: K.icon,
|
|
801
|
+
children: "📅"
|
|
802
|
+
})]
|
|
803
|
+
}),
|
|
804
|
+
/* @__PURE__ */ P(oe, {
|
|
805
|
+
visible: r,
|
|
806
|
+
transparent: !0,
|
|
807
|
+
animationType: "fade",
|
|
808
|
+
onRequestClose: () => i(!1),
|
|
809
|
+
children: /* @__PURE__ */ P(V, {
|
|
810
|
+
style: K.modalOverlay,
|
|
811
|
+
activeOpacity: 1,
|
|
812
|
+
onPress: () => i(!1),
|
|
813
|
+
children: /* @__PURE__ */ F(V, {
|
|
814
|
+
style: [K.modalContent, { backgroundColor: f.card }],
|
|
815
|
+
activeOpacity: 1,
|
|
816
|
+
onPress: () => {},
|
|
817
|
+
children: [
|
|
818
|
+
/* @__PURE__ */ F(H, {
|
|
819
|
+
style: [K.modalHeader, { borderBottomColor: f.separator }],
|
|
820
|
+
children: [/* @__PURE__ */ P(B, {
|
|
821
|
+
style: [K.modalTitle, { color: f.text }],
|
|
822
|
+
children: u || s.data.name
|
|
823
|
+
}), /* @__PURE__ */ P(V, {
|
|
824
|
+
onPress: () => i(!1),
|
|
825
|
+
children: /* @__PURE__ */ P(B, {
|
|
826
|
+
style: [K.closeButton, { color: f.textMuted }],
|
|
827
|
+
children: "✕"
|
|
828
|
+
})
|
|
829
|
+
})]
|
|
830
|
+
}),
|
|
831
|
+
/* @__PURE__ */ F(H, {
|
|
832
|
+
style: K.calendarHeader,
|
|
833
|
+
children: [
|
|
834
|
+
/* @__PURE__ */ P(V, {
|
|
835
|
+
onPress: E,
|
|
836
|
+
style: K.navButton,
|
|
837
|
+
children: /* @__PURE__ */ P(B, {
|
|
838
|
+
style: [K.navButtonText, { color: f.primary }],
|
|
839
|
+
children: "‹"
|
|
840
|
+
})
|
|
841
|
+
}),
|
|
842
|
+
/* @__PURE__ */ F(B, {
|
|
843
|
+
style: [K.monthYear, { color: f.text }],
|
|
844
|
+
children: [
|
|
845
|
+
C[x],
|
|
846
|
+
" ",
|
|
847
|
+
y
|
|
848
|
+
]
|
|
849
|
+
}),
|
|
850
|
+
/* @__PURE__ */ P(V, {
|
|
851
|
+
onPress: D,
|
|
852
|
+
style: K.navButton,
|
|
853
|
+
children: /* @__PURE__ */ P(B, {
|
|
854
|
+
style: [K.navButtonText, { color: f.primary }],
|
|
855
|
+
children: "›"
|
|
856
|
+
})
|
|
857
|
+
})
|
|
858
|
+
]
|
|
859
|
+
}),
|
|
860
|
+
/* @__PURE__ */ P(H, {
|
|
861
|
+
style: K.weekDays,
|
|
862
|
+
children: [
|
|
863
|
+
"Sun",
|
|
864
|
+
"Mon",
|
|
865
|
+
"Tue",
|
|
866
|
+
"Wed",
|
|
867
|
+
"Thu",
|
|
868
|
+
"Fri",
|
|
869
|
+
"Sat"
|
|
870
|
+
].map((e) => /* @__PURE__ */ P(B, {
|
|
871
|
+
style: [K.weekDay, { color: f.textMuted }],
|
|
872
|
+
children: e
|
|
873
|
+
}, e))
|
|
874
|
+
}),
|
|
875
|
+
/* @__PURE__ */ P(ae, {
|
|
876
|
+
data: w,
|
|
877
|
+
keyExtractor: (e, t) => `${e.date.getTime()}-${t}`,
|
|
878
|
+
numColumns: 7,
|
|
879
|
+
scrollEnabled: !1,
|
|
880
|
+
style: K.calendar,
|
|
881
|
+
contentContainerStyle: K.calendarContent,
|
|
882
|
+
renderItem: ({ item: e }) => {
|
|
883
|
+
let t = O(e.date), n = k(e.date);
|
|
884
|
+
return /* @__PURE__ */ P(V, {
|
|
885
|
+
style: [
|
|
886
|
+
K.dayCell,
|
|
887
|
+
!e.isCurrentMonth && K.dayCellOtherMonth,
|
|
888
|
+
n && {
|
|
889
|
+
backgroundColor: f.primary,
|
|
890
|
+
borderRadius: 20
|
|
891
|
+
},
|
|
892
|
+
t && K.dayCellDisabled
|
|
893
|
+
],
|
|
894
|
+
onPress: () => T(e.date),
|
|
895
|
+
disabled: t,
|
|
896
|
+
activeOpacity: .7,
|
|
897
|
+
children: /* @__PURE__ */ P(B, {
|
|
898
|
+
style: [
|
|
899
|
+
K.dayText,
|
|
900
|
+
{ color: f.text },
|
|
901
|
+
!e.isCurrentMonth && { color: f.textMuted },
|
|
902
|
+
n && {
|
|
903
|
+
color: f.background,
|
|
904
|
+
fontWeight: "600"
|
|
905
|
+
},
|
|
906
|
+
t && { color: f.textMuted }
|
|
907
|
+
],
|
|
908
|
+
children: e.day
|
|
909
|
+
})
|
|
910
|
+
});
|
|
911
|
+
}
|
|
912
|
+
})
|
|
913
|
+
]
|
|
914
|
+
})
|
|
915
|
+
})
|
|
916
|
+
}),
|
|
917
|
+
l && /* @__PURE__ */ P(B, {
|
|
918
|
+
style: [K.error, { color: f.error }],
|
|
919
|
+
children: l
|
|
920
|
+
}),
|
|
921
|
+
d && !l && /* @__PURE__ */ P(B, {
|
|
922
|
+
style: [K.helperText, { color: f.textMuted }],
|
|
923
|
+
children: d
|
|
924
|
+
})
|
|
925
|
+
]
|
|
926
|
+
});
|
|
927
|
+
}, K = z.create({
|
|
928
|
+
calendar: {
|
|
929
|
+
flexGrow: 0,
|
|
930
|
+
flexShrink: 1
|
|
931
|
+
},
|
|
932
|
+
calendarContent: { flexGrow: 0 },
|
|
933
|
+
calendarHeader: {
|
|
934
|
+
alignItems: "center",
|
|
935
|
+
flexDirection: "row",
|
|
936
|
+
justifyContent: "space-between",
|
|
937
|
+
marginBottom: 16,
|
|
938
|
+
paddingHorizontal: 8
|
|
939
|
+
},
|
|
940
|
+
closeButton: {
|
|
941
|
+
fontSize: 24,
|
|
942
|
+
fontWeight: "300"
|
|
943
|
+
},
|
|
944
|
+
container: { marginBottom: 16 },
|
|
945
|
+
dayCell: {
|
|
946
|
+
alignItems: "center",
|
|
947
|
+
aspectRatio: 1,
|
|
948
|
+
flex: 1,
|
|
949
|
+
justifyContent: "center",
|
|
950
|
+
margin: 2,
|
|
951
|
+
maxWidth: "14.28%"
|
|
952
|
+
},
|
|
953
|
+
dayCellDisabled: { opacity: .3 },
|
|
954
|
+
dayCellOtherMonth: { opacity: .3 },
|
|
955
|
+
dayText: { fontSize: 14 },
|
|
956
|
+
error: {
|
|
957
|
+
fontSize: 12,
|
|
958
|
+
marginTop: 4
|
|
959
|
+
},
|
|
960
|
+
helperText: {
|
|
961
|
+
fontSize: 12,
|
|
962
|
+
marginTop: 4
|
|
963
|
+
},
|
|
964
|
+
icon: { fontSize: 16 },
|
|
965
|
+
label: {
|
|
966
|
+
fontSize: 14,
|
|
967
|
+
fontWeight: "500",
|
|
968
|
+
marginBottom: 8
|
|
969
|
+
},
|
|
970
|
+
modalContent: {
|
|
971
|
+
borderRadius: 12,
|
|
972
|
+
maxHeight: "80%",
|
|
973
|
+
padding: 16,
|
|
974
|
+
width: "90%"
|
|
975
|
+
},
|
|
976
|
+
modalHeader: {
|
|
977
|
+
alignItems: "center",
|
|
978
|
+
borderBottomWidth: 1,
|
|
979
|
+
flexDirection: "row",
|
|
980
|
+
justifyContent: "space-between",
|
|
981
|
+
marginBottom: 16,
|
|
982
|
+
paddingBottom: 12
|
|
983
|
+
},
|
|
984
|
+
modalOverlay: {
|
|
985
|
+
alignItems: "center",
|
|
986
|
+
backgroundColor: "rgba(0, 0, 0, 0.5)",
|
|
987
|
+
flex: 1,
|
|
988
|
+
justifyContent: "center"
|
|
989
|
+
},
|
|
990
|
+
modalTitle: {
|
|
991
|
+
fontSize: 18,
|
|
992
|
+
fontWeight: "600"
|
|
993
|
+
},
|
|
994
|
+
monthYear: {
|
|
995
|
+
fontSize: 16,
|
|
996
|
+
fontWeight: "600"
|
|
997
|
+
},
|
|
998
|
+
navButton: { padding: 8 },
|
|
999
|
+
navButtonText: {
|
|
1000
|
+
fontSize: 24,
|
|
1001
|
+
fontWeight: "600"
|
|
1002
|
+
},
|
|
1003
|
+
trigger: {
|
|
1004
|
+
alignItems: "center",
|
|
1005
|
+
borderRadius: 6,
|
|
1006
|
+
borderWidth: 1,
|
|
1007
|
+
flexDirection: "row",
|
|
1008
|
+
justifyContent: "space-between",
|
|
1009
|
+
paddingHorizontal: 12,
|
|
1010
|
+
paddingVertical: 10
|
|
1011
|
+
},
|
|
1012
|
+
triggerText: {
|
|
1013
|
+
flex: 1,
|
|
1014
|
+
fontSize: 14
|
|
1015
|
+
},
|
|
1016
|
+
weekDay: {
|
|
1017
|
+
flex: 1,
|
|
1018
|
+
fontSize: 12,
|
|
1019
|
+
fontWeight: "600",
|
|
1020
|
+
maxWidth: "14.28%",
|
|
1021
|
+
textAlign: "center"
|
|
1022
|
+
},
|
|
1023
|
+
weekDays: {
|
|
1024
|
+
flexDirection: "row",
|
|
1025
|
+
marginBottom: 8
|
|
1026
|
+
}
|
|
1027
|
+
}), ye = ({ field: e, extra: n }) => {
|
|
1028
|
+
let [r, i] = N(!1), [a, o] = N(!0), { value: s } = e, { node: c, setValue: l, error: u, label: d, helperText: f } = n, p = t(), { colors: m } = h(), g = Array.isArray(s) ? s : [], _ = g[0] ? new Date(g[0]) : void 0, v = g[1] ? new Date(g[1]) : void 0, { year: y, month: b, today: x } = j(() => {
|
|
1029
|
+
let e = _ || /* @__PURE__ */ new Date(), t = e.getFullYear(), n = e.getMonth(), r = /* @__PURE__ */ new Date();
|
|
1030
|
+
return r.setHours(0, 0, 0, 0), {
|
|
1031
|
+
month: n,
|
|
1032
|
+
today: r,
|
|
1033
|
+
year: t
|
|
1034
|
+
};
|
|
1035
|
+
}, [_]), [S, C] = N(y), [w, T] = N(b), E = [
|
|
1036
|
+
"January",
|
|
1037
|
+
"February",
|
|
1038
|
+
"March",
|
|
1039
|
+
"April",
|
|
1040
|
+
"May",
|
|
1041
|
+
"June",
|
|
1042
|
+
"July",
|
|
1043
|
+
"August",
|
|
1044
|
+
"September",
|
|
1045
|
+
"October",
|
|
1046
|
+
"November",
|
|
1047
|
+
"December"
|
|
1048
|
+
], D = j(() => {
|
|
1049
|
+
let e = new Date(S, w, 1).getDay(), t = new Date(S, w + 1, 0).getDate(), n = new Date(S, w, 0).getDate(), r = [];
|
|
1050
|
+
for (let t = e - 1; t >= 0; t--) r.push({
|
|
1051
|
+
date: new Date(S, w - 1, n - t),
|
|
1052
|
+
day: n - t,
|
|
1053
|
+
isCurrentMonth: !1
|
|
1054
|
+
});
|
|
1055
|
+
for (let e = 1; e <= t; e++) r.push({
|
|
1056
|
+
date: new Date(S, w, e),
|
|
1057
|
+
day: e,
|
|
1058
|
+
isCurrentMonth: !0
|
|
1059
|
+
});
|
|
1060
|
+
let i = 42 - r.length;
|
|
1061
|
+
for (let e = 1; e <= i; e++) r.push({
|
|
1062
|
+
date: new Date(S, w + 1, e),
|
|
1063
|
+
day: e,
|
|
1064
|
+
isCurrentMonth: !1
|
|
1065
|
+
});
|
|
1066
|
+
return r;
|
|
1067
|
+
}, [S, w]), ee = te((e) => {
|
|
1068
|
+
c.data.disablePast && e < x || (a ? (l([e.toISOString(), v?.toISOString()]), o(!1)) : (l(_ && e < _ ? [e.toISOString(), _.toISOString()] : [_?.toISOString(), e.toISOString()]), i(!1), o(!0)));
|
|
1069
|
+
}, [
|
|
1070
|
+
c.data.disablePast,
|
|
1071
|
+
x,
|
|
1072
|
+
a,
|
|
1073
|
+
_,
|
|
1074
|
+
v,
|
|
1075
|
+
l
|
|
1076
|
+
]), O = () => {
|
|
1077
|
+
w === 0 ? (T(11), C(S - 1)) : T(w - 1);
|
|
1078
|
+
}, k = () => {
|
|
1079
|
+
w === 11 ? (T(0), C(S + 1)) : T(w + 1);
|
|
1080
|
+
}, A = () => _ && v ? `${_.toLocaleDateString()} - ${v.toLocaleDateString()}` : _ ? _.toLocaleDateString() : p("renderer.defaultInputs.selectDateRange"), M = (e) => c.data.disablePast ? e < x : !1, ne = (e) => _ && v ? e >= _ && e <= v : !1, re = (e) => {
|
|
1081
|
+
if (!(_ || v)) return !1;
|
|
1082
|
+
let t = _ && e.getDate() === _.getDate() && e.getMonth() === _.getMonth() && e.getFullYear() === _.getFullYear(), n = v && e.getDate() === v.getDate() && e.getMonth() === v.getMonth() && e.getFullYear() === v.getFullYear();
|
|
1083
|
+
return t || n;
|
|
1084
|
+
};
|
|
1085
|
+
return /* @__PURE__ */ F(H, {
|
|
1086
|
+
style: q.container,
|
|
1087
|
+
children: [
|
|
1088
|
+
/* @__PURE__ */ F(B, {
|
|
1089
|
+
style: [q.label, { color: m.textSecondary }],
|
|
1090
|
+
children: [d || c.data.name, c.data.required && /* @__PURE__ */ P(B, {
|
|
1091
|
+
style: { color: m.error },
|
|
1092
|
+
children: "*"
|
|
1093
|
+
})]
|
|
1094
|
+
}),
|
|
1095
|
+
/* @__PURE__ */ F(V, {
|
|
1096
|
+
style: [
|
|
1097
|
+
q.trigger,
|
|
1098
|
+
{
|
|
1099
|
+
backgroundColor: m.input,
|
|
1100
|
+
borderColor: m.border
|
|
1101
|
+
},
|
|
1102
|
+
u && { borderColor: m.error }
|
|
1103
|
+
],
|
|
1104
|
+
onPress: () => i(!0),
|
|
1105
|
+
activeOpacity: .7,
|
|
1106
|
+
children: [/* @__PURE__ */ P(B, {
|
|
1107
|
+
style: [
|
|
1108
|
+
q.triggerText,
|
|
1109
|
+
{ color: m.text },
|
|
1110
|
+
!_ && { color: m.textMuted }
|
|
1111
|
+
],
|
|
1112
|
+
numberOfLines: 1,
|
|
1113
|
+
children: A()
|
|
1114
|
+
}), /* @__PURE__ */ P(B, {
|
|
1115
|
+
style: q.icon,
|
|
1116
|
+
children: "📅"
|
|
1117
|
+
})]
|
|
1118
|
+
}),
|
|
1119
|
+
/* @__PURE__ */ P(oe, {
|
|
1120
|
+
visible: r,
|
|
1121
|
+
transparent: !0,
|
|
1122
|
+
animationType: "fade",
|
|
1123
|
+
onRequestClose: () => i(!1),
|
|
1124
|
+
children: /* @__PURE__ */ P(V, {
|
|
1125
|
+
style: q.modalOverlay,
|
|
1126
|
+
activeOpacity: 1,
|
|
1127
|
+
onPress: () => i(!1),
|
|
1128
|
+
children: /* @__PURE__ */ F(V, {
|
|
1129
|
+
style: [q.modalContent, { backgroundColor: m.card }],
|
|
1130
|
+
activeOpacity: 1,
|
|
1131
|
+
onPress: () => {},
|
|
1132
|
+
children: [
|
|
1133
|
+
/* @__PURE__ */ F(H, {
|
|
1134
|
+
style: [q.modalHeader, { borderBottomColor: m.separator }],
|
|
1135
|
+
children: [/* @__PURE__ */ P(B, {
|
|
1136
|
+
style: [q.modalTitle, { color: m.text }],
|
|
1137
|
+
children: d || c.data.name
|
|
1138
|
+
}), /* @__PURE__ */ P(V, {
|
|
1139
|
+
onPress: () => i(!1),
|
|
1140
|
+
children: /* @__PURE__ */ P(B, {
|
|
1141
|
+
style: [q.closeButton, { color: m.textMuted }],
|
|
1142
|
+
children: "✕"
|
|
1143
|
+
})
|
|
1144
|
+
})]
|
|
1145
|
+
}),
|
|
1146
|
+
/* @__PURE__ */ P(H, {
|
|
1147
|
+
style: [q.rangeIndicator, { backgroundColor: m.primaryLight }],
|
|
1148
|
+
children: /* @__PURE__ */ P(B, {
|
|
1149
|
+
style: [q.rangeIndicatorText, { color: m.primary }],
|
|
1150
|
+
children: p(a ? "renderer.defaultInputs.startDate" : "renderer.defaultInputs.endDate")
|
|
1151
|
+
})
|
|
1152
|
+
}),
|
|
1153
|
+
/* @__PURE__ */ F(H, {
|
|
1154
|
+
style: q.calendarHeader,
|
|
1155
|
+
children: [
|
|
1156
|
+
/* @__PURE__ */ P(V, {
|
|
1157
|
+
onPress: O,
|
|
1158
|
+
style: q.navButton,
|
|
1159
|
+
children: /* @__PURE__ */ P(B, {
|
|
1160
|
+
style: [q.navButtonText, { color: m.primary }],
|
|
1161
|
+
children: "‹"
|
|
1162
|
+
})
|
|
1163
|
+
}),
|
|
1164
|
+
/* @__PURE__ */ F(B, {
|
|
1165
|
+
style: [q.monthYear, { color: m.text }],
|
|
1166
|
+
children: [
|
|
1167
|
+
E[w],
|
|
1168
|
+
" ",
|
|
1169
|
+
S
|
|
1170
|
+
]
|
|
1171
|
+
}),
|
|
1172
|
+
/* @__PURE__ */ P(V, {
|
|
1173
|
+
onPress: k,
|
|
1174
|
+
style: q.navButton,
|
|
1175
|
+
children: /* @__PURE__ */ P(B, {
|
|
1176
|
+
style: [q.navButtonText, { color: m.primary }],
|
|
1177
|
+
children: "›"
|
|
1178
|
+
})
|
|
1179
|
+
})
|
|
1180
|
+
]
|
|
1181
|
+
}),
|
|
1182
|
+
/* @__PURE__ */ P(H, {
|
|
1183
|
+
style: q.weekDays,
|
|
1184
|
+
children: [
|
|
1185
|
+
"Sun",
|
|
1186
|
+
"Mon",
|
|
1187
|
+
"Tue",
|
|
1188
|
+
"Wed",
|
|
1189
|
+
"Thu",
|
|
1190
|
+
"Fri",
|
|
1191
|
+
"Sat"
|
|
1192
|
+
].map((e) => /* @__PURE__ */ P(B, {
|
|
1193
|
+
style: [q.weekDay, { color: m.textMuted }],
|
|
1194
|
+
children: e
|
|
1195
|
+
}, e))
|
|
1196
|
+
}),
|
|
1197
|
+
/* @__PURE__ */ P(ae, {
|
|
1198
|
+
data: D,
|
|
1199
|
+
keyExtractor: (e, t) => `${e.date.getTime()}-${t}`,
|
|
1200
|
+
numColumns: 7,
|
|
1201
|
+
scrollEnabled: !1,
|
|
1202
|
+
style: q.calendar,
|
|
1203
|
+
contentContainerStyle: q.calendarContent,
|
|
1204
|
+
renderItem: ({ item: e }) => {
|
|
1205
|
+
let t = M(e.date), n = ne(e.date), r = re(e.date);
|
|
1206
|
+
return /* @__PURE__ */ P(V, {
|
|
1207
|
+
style: [
|
|
1208
|
+
q.dayCell,
|
|
1209
|
+
!e.isCurrentMonth && q.dayCellOtherMonth,
|
|
1210
|
+
n && { backgroundColor: m.primaryLight },
|
|
1211
|
+
r && {
|
|
1212
|
+
backgroundColor: m.primary,
|
|
1213
|
+
borderRadius: 20
|
|
1214
|
+
},
|
|
1215
|
+
t && q.dayCellDisabled
|
|
1216
|
+
],
|
|
1217
|
+
onPress: () => ee(e.date),
|
|
1218
|
+
disabled: t,
|
|
1219
|
+
activeOpacity: .7,
|
|
1220
|
+
children: /* @__PURE__ */ P(B, {
|
|
1221
|
+
style: [
|
|
1222
|
+
q.dayText,
|
|
1223
|
+
{ color: m.text },
|
|
1224
|
+
!e.isCurrentMonth && { color: m.textMuted },
|
|
1225
|
+
n && { color: m.primary },
|
|
1226
|
+
r && {
|
|
1227
|
+
color: m.background,
|
|
1228
|
+
fontWeight: "600"
|
|
1229
|
+
},
|
|
1230
|
+
t && { color: m.textMuted }
|
|
1231
|
+
],
|
|
1232
|
+
children: e.day
|
|
1233
|
+
})
|
|
1234
|
+
});
|
|
1235
|
+
}
|
|
1236
|
+
})
|
|
1237
|
+
]
|
|
1238
|
+
})
|
|
1239
|
+
})
|
|
1240
|
+
}),
|
|
1241
|
+
u && /* @__PURE__ */ P(B, {
|
|
1242
|
+
style: [q.error, { color: m.error }],
|
|
1243
|
+
children: u
|
|
1244
|
+
}),
|
|
1245
|
+
f && !u && /* @__PURE__ */ P(B, {
|
|
1246
|
+
style: [q.helperText, { color: m.textMuted }],
|
|
1247
|
+
children: f
|
|
1248
|
+
})
|
|
1249
|
+
]
|
|
1250
|
+
});
|
|
1251
|
+
}, q = z.create({
|
|
1252
|
+
calendar: {
|
|
1253
|
+
flexGrow: 0,
|
|
1254
|
+
flexShrink: 1
|
|
1255
|
+
},
|
|
1256
|
+
calendarContent: { flexGrow: 0 },
|
|
1257
|
+
calendarHeader: {
|
|
1258
|
+
alignItems: "center",
|
|
1259
|
+
flexDirection: "row",
|
|
1260
|
+
justifyContent: "space-between",
|
|
1261
|
+
marginBottom: 16,
|
|
1262
|
+
paddingHorizontal: 8
|
|
1263
|
+
},
|
|
1264
|
+
closeButton: {
|
|
1265
|
+
fontSize: 24,
|
|
1266
|
+
fontWeight: "300"
|
|
1267
|
+
},
|
|
1268
|
+
container: { marginBottom: 16 },
|
|
1269
|
+
dayCell: {
|
|
1270
|
+
alignItems: "center",
|
|
1271
|
+
aspectRatio: 1,
|
|
1272
|
+
flex: 1,
|
|
1273
|
+
justifyContent: "center",
|
|
1274
|
+
margin: 2,
|
|
1275
|
+
maxWidth: "14.28%"
|
|
1276
|
+
},
|
|
1277
|
+
dayCellDisabled: { opacity: .3 },
|
|
1278
|
+
dayCellOtherMonth: { opacity: .3 },
|
|
1279
|
+
dayText: { fontSize: 14 },
|
|
1280
|
+
error: {
|
|
1281
|
+
fontSize: 12,
|
|
1282
|
+
marginTop: 4
|
|
1283
|
+
},
|
|
1284
|
+
helperText: {
|
|
1285
|
+
fontSize: 12,
|
|
1286
|
+
marginTop: 4
|
|
1287
|
+
},
|
|
1288
|
+
icon: { fontSize: 16 },
|
|
1289
|
+
label: {
|
|
1290
|
+
fontSize: 14,
|
|
1291
|
+
fontWeight: "500",
|
|
1292
|
+
marginBottom: 8
|
|
1293
|
+
},
|
|
1294
|
+
modalContent: {
|
|
1295
|
+
borderRadius: 12,
|
|
1296
|
+
maxHeight: "80%",
|
|
1297
|
+
padding: 16,
|
|
1298
|
+
width: "90%"
|
|
1299
|
+
},
|
|
1300
|
+
modalHeader: {
|
|
1301
|
+
alignItems: "center",
|
|
1302
|
+
borderBottomWidth: 1,
|
|
1303
|
+
flexDirection: "row",
|
|
1304
|
+
justifyContent: "space-between",
|
|
1305
|
+
marginBottom: 12,
|
|
1306
|
+
paddingBottom: 12
|
|
1307
|
+
},
|
|
1308
|
+
modalOverlay: {
|
|
1309
|
+
alignItems: "center",
|
|
1310
|
+
backgroundColor: "rgba(0, 0, 0, 0.5)",
|
|
1311
|
+
flex: 1,
|
|
1312
|
+
justifyContent: "center"
|
|
1313
|
+
},
|
|
1314
|
+
modalTitle: {
|
|
1315
|
+
fontSize: 18,
|
|
1316
|
+
fontWeight: "600"
|
|
1317
|
+
},
|
|
1318
|
+
monthYear: {
|
|
1319
|
+
fontSize: 16,
|
|
1320
|
+
fontWeight: "600"
|
|
1321
|
+
},
|
|
1322
|
+
navButton: { padding: 8 },
|
|
1323
|
+
navButtonText: {
|
|
1324
|
+
fontSize: 24,
|
|
1325
|
+
fontWeight: "600"
|
|
1326
|
+
},
|
|
1327
|
+
rangeIndicator: {
|
|
1328
|
+
alignItems: "center",
|
|
1329
|
+
borderRadius: 6,
|
|
1330
|
+
marginBottom: 12,
|
|
1331
|
+
paddingVertical: 8
|
|
1332
|
+
},
|
|
1333
|
+
rangeIndicatorText: {
|
|
1334
|
+
fontSize: 14,
|
|
1335
|
+
fontWeight: "600"
|
|
1336
|
+
},
|
|
1337
|
+
trigger: {
|
|
1338
|
+
alignItems: "center",
|
|
1339
|
+
borderRadius: 6,
|
|
1340
|
+
borderWidth: 1,
|
|
1341
|
+
flexDirection: "row",
|
|
1342
|
+
justifyContent: "space-between",
|
|
1343
|
+
paddingHorizontal: 12,
|
|
1344
|
+
paddingVertical: 10
|
|
1345
|
+
},
|
|
1346
|
+
triggerText: {
|
|
1347
|
+
flex: 1,
|
|
1348
|
+
fontSize: 14
|
|
1349
|
+
},
|
|
1350
|
+
weekDay: {
|
|
1351
|
+
flex: 1,
|
|
1352
|
+
fontSize: 12,
|
|
1353
|
+
fontWeight: "600",
|
|
1354
|
+
maxWidth: "14.28%",
|
|
1355
|
+
textAlign: "center"
|
|
1356
|
+
},
|
|
1357
|
+
weekDays: {
|
|
1358
|
+
flexDirection: "row",
|
|
1359
|
+
marginBottom: 8
|
|
1360
|
+
}
|
|
1361
|
+
}), be = ({ field: e, extra: n }) => {
|
|
1362
|
+
let [r, i] = N(null), [a, o] = N(!0), { value: s } = e, { node: c, setValue: l, error: u, label: d, helperText: f } = n, { colors: p } = h(), m = t(), g = Array.isArray(s) ? s : s ? [s] : [], _ = c.data.multiple, v = te(async () => {
|
|
1363
|
+
if (r) try {
|
|
1364
|
+
let e = (await r({ allowMultiSelection: _ })).map((e) => ({
|
|
1365
|
+
data: e.uri,
|
|
1366
|
+
lastModified: Date.now(),
|
|
1367
|
+
name: e.name,
|
|
1368
|
+
size: e.size,
|
|
1369
|
+
type: e.type || "application/octet-stream"
|
|
1370
|
+
}));
|
|
1371
|
+
l(_ ? [...g, ...e] : e[0] || null);
|
|
1372
|
+
} catch (e) {
|
|
1373
|
+
e.code !== "DOCUMENT_PICKER_CANCELED" && ie.alert("Error", m("renderer.defaultInputs.filePickerError"));
|
|
1374
|
+
}
|
|
1375
|
+
}, [
|
|
1376
|
+
r,
|
|
1377
|
+
g,
|
|
1378
|
+
_,
|
|
1379
|
+
l,
|
|
1380
|
+
m
|
|
1381
|
+
]), y = te((e) => {
|
|
1382
|
+
let t = g.filter((t, n) => n !== e);
|
|
1383
|
+
l(t.length > 0 ? t : null);
|
|
1384
|
+
}, [g, l]), b = (e) => e < 1024 ? `${e} B` : e < 1024 * 1024 ? `${(e / 1024).toFixed(1)} KB` : `${(e / (1024 * 1024)).toFixed(1)} MB`;
|
|
1385
|
+
return A(() => {
|
|
1386
|
+
(async () => {
|
|
1387
|
+
try {
|
|
1388
|
+
let { pick: e } = await import("react-native-document-picker");
|
|
1389
|
+
i(() => e);
|
|
1390
|
+
} catch {
|
|
1391
|
+
i(null);
|
|
1392
|
+
} finally {
|
|
1393
|
+
o(!1);
|
|
1394
|
+
}
|
|
1395
|
+
})();
|
|
1396
|
+
}, []), a ? null : r ? /* @__PURE__ */ F(H, {
|
|
1397
|
+
style: J.container,
|
|
1398
|
+
children: [
|
|
1399
|
+
/* @__PURE__ */ F(B, {
|
|
1400
|
+
style: [J.label, { color: p.textSecondary }],
|
|
1401
|
+
children: [d || c.data.name, c.data.required && /* @__PURE__ */ P(B, {
|
|
1402
|
+
style: { color: p.error },
|
|
1403
|
+
children: "*"
|
|
1404
|
+
})]
|
|
1405
|
+
}),
|
|
1406
|
+
g.length > 0 && /* @__PURE__ */ P(H, {
|
|
1407
|
+
style: J.filesList,
|
|
1408
|
+
children: g.map((e, t) => /* @__PURE__ */ F(H, {
|
|
1409
|
+
style: [J.fileItem, {
|
|
1410
|
+
backgroundColor: p.card,
|
|
1411
|
+
borderColor: p.separator
|
|
1412
|
+
}],
|
|
1413
|
+
children: [
|
|
1414
|
+
/* @__PURE__ */ P(H, {
|
|
1415
|
+
style: [J.fileIcon, { backgroundColor: p.muted }],
|
|
1416
|
+
children: /* @__PURE__ */ P(B, {
|
|
1417
|
+
style: J.fileIconText,
|
|
1418
|
+
children: "📄"
|
|
1419
|
+
})
|
|
1420
|
+
}),
|
|
1421
|
+
/* @__PURE__ */ F(H, {
|
|
1422
|
+
style: J.fileInfo,
|
|
1423
|
+
children: [/* @__PURE__ */ P(B, {
|
|
1424
|
+
style: [J.fileName, { color: p.text }],
|
|
1425
|
+
numberOfLines: 1,
|
|
1426
|
+
children: e.name
|
|
1427
|
+
}), e.size > 0 && /* @__PURE__ */ P(B, {
|
|
1428
|
+
style: [J.fileSize, { color: p.textMuted }],
|
|
1429
|
+
children: b(e.size)
|
|
1430
|
+
})]
|
|
1431
|
+
}),
|
|
1432
|
+
/* @__PURE__ */ P(V, {
|
|
1433
|
+
style: J.removeButton,
|
|
1434
|
+
onPress: () => y(t),
|
|
1435
|
+
activeOpacity: .7,
|
|
1436
|
+
children: /* @__PURE__ */ P(B, {
|
|
1437
|
+
style: [J.removeButtonText, { color: p.textMuted }],
|
|
1438
|
+
children: "✕"
|
|
1439
|
+
})
|
|
1440
|
+
})
|
|
1441
|
+
]
|
|
1442
|
+
}, `${e.name}-${t}`))
|
|
1443
|
+
}),
|
|
1444
|
+
/* @__PURE__ */ P(V, {
|
|
1445
|
+
style: [J.pickButton, {
|
|
1446
|
+
backgroundColor: p.input,
|
|
1447
|
+
borderColor: p.border
|
|
1448
|
+
}],
|
|
1449
|
+
onPress: v,
|
|
1450
|
+
activeOpacity: .7,
|
|
1451
|
+
children: /* @__PURE__ */ P(B, {
|
|
1452
|
+
style: [J.pickButtonText, { color: p.textMuted }],
|
|
1453
|
+
children: g.length === 0 ? m(_ ? "renderer.defaultInputs.selectFiles" : "renderer.defaultInputs.selectFile") : m(_ ? "renderer.defaultInputs.addMoreFiles" : "renderer.defaultInputs.replaceFile")
|
|
1454
|
+
})
|
|
1455
|
+
}),
|
|
1456
|
+
u && /* @__PURE__ */ P(B, {
|
|
1457
|
+
style: [J.error, { color: p.error }],
|
|
1458
|
+
children: u
|
|
1459
|
+
}),
|
|
1460
|
+
f && !u && /* @__PURE__ */ P(B, {
|
|
1461
|
+
style: [J.helperText, { color: p.textMuted }],
|
|
1462
|
+
children: f
|
|
1463
|
+
})
|
|
1464
|
+
]
|
|
1465
|
+
}) : /* @__PURE__ */ F(H, {
|
|
1466
|
+
style: J.container,
|
|
1467
|
+
children: [
|
|
1468
|
+
/* @__PURE__ */ F(B, {
|
|
1469
|
+
style: [J.label, { color: p.textSecondary }],
|
|
1470
|
+
children: [d || c.data.name, c.data.required && /* @__PURE__ */ P(B, {
|
|
1471
|
+
style: { color: p.error },
|
|
1472
|
+
children: "*"
|
|
1473
|
+
})]
|
|
1474
|
+
}),
|
|
1475
|
+
/* @__PURE__ */ P(H, {
|
|
1476
|
+
style: [J.unavailableContainer, {
|
|
1477
|
+
backgroundColor: p.errorLight,
|
|
1478
|
+
borderColor: p.error
|
|
1479
|
+
}],
|
|
1480
|
+
children: /* @__PURE__ */ P(B, {
|
|
1481
|
+
style: [J.unavailableText, { color: p.error }],
|
|
1482
|
+
children: m("renderer.defaultInputs.filePickerUnavailable")
|
|
1483
|
+
})
|
|
1484
|
+
}),
|
|
1485
|
+
f && /* @__PURE__ */ P(B, {
|
|
1486
|
+
style: [J.helperText, { color: p.textMuted }],
|
|
1487
|
+
children: f
|
|
1488
|
+
})
|
|
1489
|
+
]
|
|
1490
|
+
});
|
|
1491
|
+
}, J = z.create({
|
|
1492
|
+
container: { marginBottom: 16 },
|
|
1493
|
+
error: {
|
|
1494
|
+
fontSize: 12,
|
|
1495
|
+
marginTop: 4
|
|
1496
|
+
},
|
|
1497
|
+
fileIcon: {
|
|
1498
|
+
alignItems: "center",
|
|
1499
|
+
borderRadius: 6,
|
|
1500
|
+
height: 40,
|
|
1501
|
+
justifyContent: "center",
|
|
1502
|
+
width: 40
|
|
1503
|
+
},
|
|
1504
|
+
fileIconText: { fontSize: 20 },
|
|
1505
|
+
fileInfo: {
|
|
1506
|
+
flex: 1,
|
|
1507
|
+
marginLeft: 12
|
|
1508
|
+
},
|
|
1509
|
+
fileItem: {
|
|
1510
|
+
alignItems: "center",
|
|
1511
|
+
borderRadius: 6,
|
|
1512
|
+
borderWidth: 1,
|
|
1513
|
+
flexDirection: "row",
|
|
1514
|
+
marginBottom: 8,
|
|
1515
|
+
padding: 12
|
|
1516
|
+
},
|
|
1517
|
+
fileName: {
|
|
1518
|
+
fontSize: 14,
|
|
1519
|
+
fontWeight: "500"
|
|
1520
|
+
},
|
|
1521
|
+
fileSize: {
|
|
1522
|
+
fontSize: 12,
|
|
1523
|
+
marginTop: 2
|
|
1524
|
+
},
|
|
1525
|
+
filesList: { marginBottom: 12 },
|
|
1526
|
+
helperText: {
|
|
1527
|
+
fontSize: 12,
|
|
1528
|
+
marginTop: 4
|
|
1529
|
+
},
|
|
1530
|
+
label: {
|
|
1531
|
+
fontSize: 14,
|
|
1532
|
+
fontWeight: "500",
|
|
1533
|
+
marginBottom: 8
|
|
1534
|
+
},
|
|
1535
|
+
pickButton: {
|
|
1536
|
+
alignItems: "center",
|
|
1537
|
+
borderRadius: 6,
|
|
1538
|
+
borderStyle: "dashed",
|
|
1539
|
+
borderWidth: 2,
|
|
1540
|
+
justifyContent: "center",
|
|
1541
|
+
paddingVertical: 16
|
|
1542
|
+
},
|
|
1543
|
+
pickButtonText: {
|
|
1544
|
+
fontSize: 14,
|
|
1545
|
+
fontWeight: "500"
|
|
1546
|
+
},
|
|
1547
|
+
removeButton: { padding: 4 },
|
|
1548
|
+
removeButtonText: { fontSize: 18 },
|
|
1549
|
+
unavailableContainer: {
|
|
1550
|
+
alignItems: "center",
|
|
1551
|
+
borderRadius: 6,
|
|
1552
|
+
borderWidth: 1,
|
|
1553
|
+
justifyContent: "center",
|
|
1554
|
+
paddingVertical: 16
|
|
1555
|
+
},
|
|
1556
|
+
unavailableText: {
|
|
1557
|
+
fontSize: 12,
|
|
1558
|
+
textAlign: "center"
|
|
1559
|
+
}
|
|
1560
|
+
}), xe = (e) => null, Se = ({ missing: e, children: n }) => {
|
|
1561
|
+
let r = t(), { colors: i } = h();
|
|
1562
|
+
return /* @__PURE__ */ F(ne, { children: [n, e.length > 0 && /* @__PURE__ */ F(H, {
|
|
1563
|
+
style: Ce.container,
|
|
1564
|
+
children: [/* @__PURE__ */ P(B, {
|
|
1565
|
+
style: [Ce.title, { color: i.textMuted }],
|
|
1566
|
+
children: r("renderer.dependencyHint.title")
|
|
1567
|
+
}), e.map((e) => /* @__PURE__ */ F(B, {
|
|
1568
|
+
style: [Ce.item, { color: i.textMuted }],
|
|
1569
|
+
children: [
|
|
1570
|
+
"•",
|
|
1571
|
+
" ",
|
|
1572
|
+
e.label
|
|
1573
|
+
]
|
|
1574
|
+
}, e.id))]
|
|
1575
|
+
})] });
|
|
1576
|
+
}, Ce = z.create({
|
|
1577
|
+
container: {
|
|
1578
|
+
gap: 2,
|
|
1579
|
+
marginTop: 4
|
|
1580
|
+
},
|
|
1581
|
+
item: { fontSize: 12 },
|
|
1582
|
+
title: {
|
|
1583
|
+
fontSize: 12,
|
|
1584
|
+
fontWeight: "500"
|
|
1585
|
+
}
|
|
1586
|
+
}), we = (e) => e.replace(/<[^>]*>/g, ""), Te = (e) => e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, "\"").replace(/'/g, "'").replace(///g, "/"), Ee = (e, t = {}) => e == null || e === "" ? "" : Te(we(String(e))), De = 100, Oe = (e, t = {}, n = 0, r = /* @__PURE__ */ new WeakSet()) => {
|
|
1587
|
+
if (n > De) return console.warn(`sanitizeHttpResponse: Maximum depth (${De}) exceeded.`), typeof e == "string" ? Ee(e, t) : "[Max Depth Exceeded]";
|
|
1588
|
+
if (e == null) return e;
|
|
1589
|
+
if (typeof e == "string") return Ee(e, t);
|
|
1590
|
+
if (Array.isArray(e)) return e.map((e) => Oe(e, t, n + 1, r));
|
|
1591
|
+
if (typeof e == "object") {
|
|
1592
|
+
if (r.has(e)) return console.warn("sanitizeHttpResponse: Circular reference detected. Breaking cycle to prevent infinite recursion."), "[Circular Reference]";
|
|
1593
|
+
r.add(e);
|
|
1594
|
+
let i = {};
|
|
1595
|
+
for (let [a, o] of Object.entries(e)) i[a] = Oe(o, t, n + 1, r);
|
|
1596
|
+
return r.delete(e), i;
|
|
1597
|
+
}
|
|
1598
|
+
return e;
|
|
1599
|
+
}, ke = (e) => {
|
|
1600
|
+
let t = e.matchAll(/{{([\w-]+)}}/g);
|
|
1601
|
+
return Array.from(t, (e) => e[1]);
|
|
1602
|
+
}, Ae = (e, t) => ke(e).every((e) => {
|
|
1603
|
+
let n = t[e];
|
|
1604
|
+
return n != null && n !== "";
|
|
1605
|
+
}), je = (e, t, n = !1) => e.replace(/{{([\w-]+)}}/g, (e, r) => {
|
|
1606
|
+
let i = t[r], a = i == null ? "" : String(i);
|
|
1607
|
+
return n ? encodeURIComponent(a) : a;
|
|
1608
|
+
}), Me = ({ field: e, extra: r }) => {
|
|
1609
|
+
let [i, c] = N(!1), [u, d] = N(null), [f, m] = N([]), [g, _] = N(""), [v, b] = N(!1), { value: S, placeholder: C } = e, { node: w, setValue: T, error: E, label: D, helperText: ee, missingDependencies: O } = r, { formValues: k, inputNodes: ne, headers: ie, baseUrl: I } = p(), { colors: L } = h(), { httpConfig: R } = w.data, z = t(), se = M(!1), le = M(!1), ue = M(""), de = M(R), fe = M(k), pe = M(ne), U = M(ie), he = M(I), ge = M(T), W = M(null), _e = M(null), G = j(() => R?.url ? ke(R.url) : [], [R?.url]), ve = G.length > 0, K = j(() => G.map((e) => `${e}:${String(k[e] ?? "")}`).join("|"), [G, k]), ye = j(() => R?.url ? ve ? Ae(R.url, k) : !0 : !1, [
|
|
1610
|
+
R?.url,
|
|
1611
|
+
ve,
|
|
1612
|
+
k
|
|
1613
|
+
]), q = te(async (e) => {
|
|
1614
|
+
_e.current && _e.current.abort();
|
|
1615
|
+
let t = new AbortController();
|
|
1616
|
+
_e.current = t;
|
|
1617
|
+
let r = de.current, i = fe.current, u = ge.current;
|
|
1618
|
+
if (!r?.url) {
|
|
1619
|
+
d(z("renderer.defaultHttpInput.noUrlConfigured")), _e.current = null;
|
|
1620
|
+
return;
|
|
1621
|
+
}
|
|
1622
|
+
if (r.url && !Ae(r.url, i)) {
|
|
1623
|
+
_e.current = null;
|
|
1624
|
+
return;
|
|
1625
|
+
}
|
|
1626
|
+
c(!0), d(null);
|
|
1627
|
+
try {
|
|
1628
|
+
let f = n(je(r.url, i, !0), he.current), p = x(r.searchParam && e ? `${f}${f.includes("?") ? "&" : "?"}${r.searchParam}=${encodeURIComponent(e)}` : f, o(r.queryParams, i)), h = a({ "Content-Type": "application/json" }, o(U.current, i), o(r.headers, i)), g = [
|
|
1629
|
+
"POST",
|
|
1630
|
+
"PUT",
|
|
1631
|
+
"PATCH"
|
|
1632
|
+
].includes(r.method || "") ? r.sendAllFormValues ? JSON.stringify(y(i, pe.current)) : s(r.body, i, pe.current) : void 0, _ = setTimeout(() => t.abort(), 3e4), v = await fetch(p, {
|
|
1633
|
+
body: g || void 0,
|
|
1634
|
+
headers: Object.fromEntries(Object.entries(h).filter(([, e]) => e)),
|
|
1635
|
+
method: r.method || "GET",
|
|
1636
|
+
signal: t.signal
|
|
1637
|
+
});
|
|
1638
|
+
if (clearTimeout(_), !v.ok) {
|
|
1639
|
+
d(`HTTP Error ${v.status}: ${v.statusText}`), c(!1);
|
|
1640
|
+
return;
|
|
1641
|
+
}
|
|
1642
|
+
let b = Oe(await v.json()), S = r.responsePath ? l(b, r.responsePath) : b;
|
|
1643
|
+
if (r.responseMapping && Array.isArray(S)) {
|
|
1644
|
+
let { valueField: e = "value", labelField: t = "label", descriptionField: n, imageField: i } = r.responseMapping;
|
|
1645
|
+
m(S.map((r) => {
|
|
1646
|
+
let a = n ? l(r, n) : void 0, o = i ? l(r, i) : void 0;
|
|
1647
|
+
return {
|
|
1648
|
+
description: a != null && a !== "" ? String(a) : void 0,
|
|
1649
|
+
image: typeof o == "string" && o !== "" ? o : void 0,
|
|
1650
|
+
label: String(l(r, t) || ""),
|
|
1651
|
+
value: String(l(r, e) || "")
|
|
1652
|
+
};
|
|
1653
|
+
}));
|
|
1654
|
+
} else u(typeof S == "string" ? S : JSON.stringify(S));
|
|
1655
|
+
} catch (e) {
|
|
1656
|
+
if (e instanceof Error && e.name === "AbortError") return;
|
|
1657
|
+
d(e instanceof Error ? e.message : z("renderer.defaultHttpInput.fetchFailed")), console.error("HTTP Input fetch error:", e);
|
|
1658
|
+
} finally {
|
|
1659
|
+
c(!1), _e.current = null;
|
|
1660
|
+
}
|
|
1661
|
+
}, [z]);
|
|
1662
|
+
if (A(() => {
|
|
1663
|
+
de.current = R, fe.current = k, pe.current = ne, U.current = ie, he.current = I, ge.current = T, W.current = q;
|
|
1664
|
+
}, [
|
|
1665
|
+
R,
|
|
1666
|
+
k,
|
|
1667
|
+
ne,
|
|
1668
|
+
ie,
|
|
1669
|
+
I,
|
|
1670
|
+
T,
|
|
1671
|
+
q
|
|
1672
|
+
]), A(() => () => {
|
|
1673
|
+
_e.current && _e.current.abort(), se.current = !1, le.current = !1;
|
|
1674
|
+
}, []), A(() => {
|
|
1675
|
+
if (se.current) return;
|
|
1676
|
+
se.current = !0;
|
|
1677
|
+
let e = de.current, t = fe.current, n = W.current, r = e?.url && Ae(e.url, t);
|
|
1678
|
+
e?.fetchOnMount && r && n && (n(), e.url && (ue.current = ke(e.url).map((e) => `${e}:${String(t[e] ?? "")}`).join("|")));
|
|
1679
|
+
}, []), A(() => {
|
|
1680
|
+
if (!se.current || !ve || ue.current === K || !ye) return;
|
|
1681
|
+
let e = setTimeout(() => {
|
|
1682
|
+
q(), ue.current = K;
|
|
1683
|
+
}, 500);
|
|
1684
|
+
return () => clearTimeout(e);
|
|
1685
|
+
}, [
|
|
1686
|
+
K,
|
|
1687
|
+
ve,
|
|
1688
|
+
ye,
|
|
1689
|
+
q
|
|
1690
|
+
]), A(() => {
|
|
1691
|
+
if (!le.current) {
|
|
1692
|
+
le.current = !0;
|
|
1693
|
+
return;
|
|
1694
|
+
}
|
|
1695
|
+
let e = de.current, t = fe.current, n = W.current, r = e?.url && Ae(e.url, t);
|
|
1696
|
+
e?.fetchOnMount && r && n && (n(), e.url && (ue.current = ke(e.url).map((e) => `${e}:${String(t[e] ?? "")}`).join("|")));
|
|
1697
|
+
}, [j(() => JSON.stringify({
|
|
1698
|
+
body: R?.body,
|
|
1699
|
+
fetchOnMount: R?.fetchOnMount,
|
|
1700
|
+
headers: R?.headers,
|
|
1701
|
+
method: R?.method,
|
|
1702
|
+
queryParams: R?.queryParams,
|
|
1703
|
+
responseMapping: R?.responseMapping,
|
|
1704
|
+
responsePath: R?.responsePath,
|
|
1705
|
+
searchParam: R?.searchParam,
|
|
1706
|
+
sendAllFormValues: R?.sendAllFormValues,
|
|
1707
|
+
url: R?.url
|
|
1708
|
+
}), [R])]), A(() => {
|
|
1709
|
+
if (!(R?.searchParam && g)) return;
|
|
1710
|
+
let e = setTimeout(() => {
|
|
1711
|
+
q(g);
|
|
1712
|
+
}, 300);
|
|
1713
|
+
return () => clearTimeout(e);
|
|
1714
|
+
}, [
|
|
1715
|
+
g,
|
|
1716
|
+
R?.searchParam,
|
|
1717
|
+
q
|
|
1718
|
+
]), R?.responseMapping) {
|
|
1719
|
+
let e = Array.isArray(S) ? S[0] : S, t = f.find((t) => t.value === e);
|
|
1720
|
+
if (R.searchParam) {
|
|
1721
|
+
let n = i && R?.showLoading;
|
|
1722
|
+
return /* @__PURE__ */ F(H, {
|
|
1723
|
+
style: Y.container,
|
|
1724
|
+
children: [
|
|
1725
|
+
/* @__PURE__ */ F(B, {
|
|
1726
|
+
style: [Y.label, { color: L.textSecondary }],
|
|
1727
|
+
children: [D || w.data.name, w.data.required && /* @__PURE__ */ P(B, {
|
|
1728
|
+
style: { color: L.error },
|
|
1729
|
+
children: "*"
|
|
1730
|
+
})]
|
|
1731
|
+
}),
|
|
1732
|
+
/* @__PURE__ */ P(Se, {
|
|
1733
|
+
missing: O,
|
|
1734
|
+
children: /* @__PURE__ */ F(V, {
|
|
1735
|
+
style: [
|
|
1736
|
+
Y.trigger,
|
|
1737
|
+
{
|
|
1738
|
+
backgroundColor: L.input,
|
|
1739
|
+
borderColor: L.border
|
|
1740
|
+
},
|
|
1741
|
+
E && { borderColor: L.error },
|
|
1742
|
+
O.length > 0 && { backgroundColor: L.muted }
|
|
1743
|
+
],
|
|
1744
|
+
onPress: () => b(!0),
|
|
1745
|
+
disabled: O.length > 0,
|
|
1746
|
+
activeOpacity: .7,
|
|
1747
|
+
children: [n ? /* @__PURE__ */ F(H, {
|
|
1748
|
+
style: Y.loadingTrigger,
|
|
1749
|
+
children: [/* @__PURE__ */ P(re, {
|
|
1750
|
+
size: "small",
|
|
1751
|
+
color: L.primary
|
|
1752
|
+
}), /* @__PURE__ */ P(B, {
|
|
1753
|
+
style: [Y.triggerText, { color: L.textMuted }],
|
|
1754
|
+
numberOfLines: 1,
|
|
1755
|
+
children: t?.label || C || z("renderer.defaultHttpInput.search")
|
|
1756
|
+
})]
|
|
1757
|
+
}) : /* @__PURE__ */ P(B, {
|
|
1758
|
+
style: [
|
|
1759
|
+
Y.triggerText,
|
|
1760
|
+
{ color: L.text },
|
|
1761
|
+
!t && { color: L.textMuted }
|
|
1762
|
+
],
|
|
1763
|
+
numberOfLines: 1,
|
|
1764
|
+
children: t?.label || C || z("renderer.defaultHttpInput.search")
|
|
1765
|
+
}), /* @__PURE__ */ P(B, {
|
|
1766
|
+
style: [Y.arrow, { color: L.textMuted }],
|
|
1767
|
+
children: "▼"
|
|
1768
|
+
})]
|
|
1769
|
+
})
|
|
1770
|
+
}),
|
|
1771
|
+
/* @__PURE__ */ P(oe, {
|
|
1772
|
+
visible: v,
|
|
1773
|
+
transparent: !0,
|
|
1774
|
+
animationType: "fade",
|
|
1775
|
+
onRequestClose: () => b(!1),
|
|
1776
|
+
children: /* @__PURE__ */ P(V, {
|
|
1777
|
+
style: Y.modalOverlay,
|
|
1778
|
+
activeOpacity: 1,
|
|
1779
|
+
onPress: () => b(!1),
|
|
1780
|
+
children: /* @__PURE__ */ F(V, {
|
|
1781
|
+
style: [Y.modalContent, { backgroundColor: L.card }],
|
|
1782
|
+
activeOpacity: 1,
|
|
1783
|
+
onPress: () => {},
|
|
1784
|
+
children: [
|
|
1785
|
+
/* @__PURE__ */ F(H, {
|
|
1786
|
+
style: [Y.modalHeader, { borderBottomColor: L.separator }],
|
|
1787
|
+
children: [/* @__PURE__ */ P(B, {
|
|
1788
|
+
style: [Y.modalTitle, { color: L.text }],
|
|
1789
|
+
children: D || w.data.name
|
|
1790
|
+
}), /* @__PURE__ */ P(V, {
|
|
1791
|
+
onPress: () => b(!1),
|
|
1792
|
+
children: /* @__PURE__ */ P(B, {
|
|
1793
|
+
style: [Y.closeButton, { color: L.textMuted }],
|
|
1794
|
+
children: "✕"
|
|
1795
|
+
})
|
|
1796
|
+
})]
|
|
1797
|
+
}),
|
|
1798
|
+
/* @__PURE__ */ P(H, {
|
|
1799
|
+
style: Y.searchContainer,
|
|
1800
|
+
children: /* @__PURE__ */ P(ce, {
|
|
1801
|
+
style: [Y.searchInput, {
|
|
1802
|
+
backgroundColor: L.muted,
|
|
1803
|
+
borderColor: L.border,
|
|
1804
|
+
color: L.text
|
|
1805
|
+
}],
|
|
1806
|
+
placeholder: z("renderer.defaultHttpInput.search"),
|
|
1807
|
+
placeholderTextColor: L.textMuted,
|
|
1808
|
+
value: g,
|
|
1809
|
+
onChangeText: (e) => {
|
|
1810
|
+
_(e), d(null);
|
|
1811
|
+
},
|
|
1812
|
+
autoFocus: !0,
|
|
1813
|
+
autoCapitalize: "none",
|
|
1814
|
+
autoCorrect: !1
|
|
1815
|
+
})
|
|
1816
|
+
}),
|
|
1817
|
+
i ? /* @__PURE__ */ P(H, {
|
|
1818
|
+
style: Y.loadingContainer,
|
|
1819
|
+
children: /* @__PURE__ */ P(re, {
|
|
1820
|
+
size: "small",
|
|
1821
|
+
color: L.primary
|
|
1822
|
+
})
|
|
1823
|
+
}) : u ? /* @__PURE__ */ F(H, {
|
|
1824
|
+
style: Y.errorContainer,
|
|
1825
|
+
children: [/* @__PURE__ */ P(B, {
|
|
1826
|
+
style: [Y.errorText, { color: L.error }],
|
|
1827
|
+
children: u
|
|
1828
|
+
}), /* @__PURE__ */ P(V, {
|
|
1829
|
+
onPress: () => q(g),
|
|
1830
|
+
style: Y.retryButton,
|
|
1831
|
+
children: /* @__PURE__ */ P(B, {
|
|
1832
|
+
style: [Y.retryButtonText, { color: L.primary }],
|
|
1833
|
+
children: z("renderer.defaultHttpInput.retry")
|
|
1834
|
+
})
|
|
1835
|
+
})]
|
|
1836
|
+
}) : /* @__PURE__ */ P(ae, {
|
|
1837
|
+
data: f,
|
|
1838
|
+
keyExtractor: (e) => e.value,
|
|
1839
|
+
style: Y.optionsList,
|
|
1840
|
+
contentContainerStyle: Y.optionsListContent,
|
|
1841
|
+
ListEmptyComponent: /* @__PURE__ */ P(H, {
|
|
1842
|
+
style: Y.emptyContainer,
|
|
1843
|
+
children: /* @__PURE__ */ P(B, {
|
|
1844
|
+
style: [Y.emptyText, { color: L.textMuted }],
|
|
1845
|
+
children: z("renderer.defaultHttpInput.noResults")
|
|
1846
|
+
})
|
|
1847
|
+
}),
|
|
1848
|
+
renderItem: ({ item: t }) => {
|
|
1849
|
+
let n = t.value === e;
|
|
1850
|
+
return /* @__PURE__ */ F(V, {
|
|
1851
|
+
style: [Y.option, n && { backgroundColor: L.primaryLight }],
|
|
1852
|
+
onPress: () => {
|
|
1853
|
+
T(t.value), b(!1);
|
|
1854
|
+
},
|
|
1855
|
+
activeOpacity: .7,
|
|
1856
|
+
children: [/* @__PURE__ */ P(me, {
|
|
1857
|
+
label: t.label,
|
|
1858
|
+
description: t.description,
|
|
1859
|
+
image: t.image
|
|
1860
|
+
}), n && /* @__PURE__ */ P(B, {
|
|
1861
|
+
style: [Y.checkmark, { color: L.primary }],
|
|
1862
|
+
children: "✓"
|
|
1863
|
+
})]
|
|
1864
|
+
});
|
|
1865
|
+
}
|
|
1866
|
+
})
|
|
1867
|
+
]
|
|
1868
|
+
})
|
|
1869
|
+
})
|
|
1870
|
+
}),
|
|
1871
|
+
E && /* @__PURE__ */ P(B, {
|
|
1872
|
+
style: [Y.error, { color: L.error }],
|
|
1873
|
+
children: E
|
|
1874
|
+
}),
|
|
1875
|
+
ee && !E && /* @__PURE__ */ P(B, {
|
|
1876
|
+
style: [Y.helperText, { color: L.textMuted }],
|
|
1877
|
+
children: ee
|
|
1878
|
+
})
|
|
1879
|
+
]
|
|
1880
|
+
});
|
|
1881
|
+
}
|
|
1882
|
+
let n = i && R?.showLoading, r = O.length === 0 && f.length === 0 && !n ? u ?? z("renderer.defaultHttpInput.noDataAvailable") : void 0;
|
|
1883
|
+
return /* @__PURE__ */ F(H, {
|
|
1884
|
+
style: Y.container,
|
|
1885
|
+
children: [
|
|
1886
|
+
/* @__PURE__ */ F(B, {
|
|
1887
|
+
style: [Y.label, { color: L.textSecondary }],
|
|
1888
|
+
children: [D || w.data.name, w.data.required && /* @__PURE__ */ P(B, {
|
|
1889
|
+
style: { color: L.error },
|
|
1890
|
+
children: "*"
|
|
1891
|
+
})]
|
|
1892
|
+
}),
|
|
1893
|
+
/* @__PURE__ */ P(Se, {
|
|
1894
|
+
missing: O,
|
|
1895
|
+
children: /* @__PURE__ */ F(V, {
|
|
1896
|
+
style: [
|
|
1897
|
+
Y.trigger,
|
|
1898
|
+
{
|
|
1899
|
+
backgroundColor: L.input,
|
|
1900
|
+
borderColor: L.border
|
|
1901
|
+
},
|
|
1902
|
+
E && { borderColor: L.error },
|
|
1903
|
+
(n || f.length === 0) && { backgroundColor: L.muted }
|
|
1904
|
+
],
|
|
1905
|
+
onPress: () => b(!0),
|
|
1906
|
+
disabled: n || f.length === 0,
|
|
1907
|
+
activeOpacity: .7,
|
|
1908
|
+
children: [
|
|
1909
|
+
n && /* @__PURE__ */ P(re, {
|
|
1910
|
+
size: "small",
|
|
1911
|
+
color: L.primary,
|
|
1912
|
+
style: Y.triggerLoader
|
|
1913
|
+
}),
|
|
1914
|
+
/* @__PURE__ */ P(B, {
|
|
1915
|
+
style: [
|
|
1916
|
+
Y.triggerText,
|
|
1917
|
+
{ color: L.text },
|
|
1918
|
+
!t && { color: L.textMuted }
|
|
1919
|
+
],
|
|
1920
|
+
numberOfLines: 1,
|
|
1921
|
+
children: t?.label || C || z("renderer.defaultHttpInput.selectOption")
|
|
1922
|
+
}),
|
|
1923
|
+
/* @__PURE__ */ P(B, {
|
|
1924
|
+
style: [Y.arrow, { color: L.textMuted }],
|
|
1925
|
+
children: "▼"
|
|
1926
|
+
})
|
|
1927
|
+
]
|
|
1928
|
+
})
|
|
1929
|
+
}),
|
|
1930
|
+
r && /* @__PURE__ */ P(B, {
|
|
1931
|
+
style: [Y.disabledMessage, { color: L.error }],
|
|
1932
|
+
children: r
|
|
1933
|
+
}),
|
|
1934
|
+
/* @__PURE__ */ P(oe, {
|
|
1935
|
+
visible: v,
|
|
1936
|
+
transparent: !0,
|
|
1937
|
+
animationType: "fade",
|
|
1938
|
+
onRequestClose: () => b(!1),
|
|
1939
|
+
children: /* @__PURE__ */ P(V, {
|
|
1940
|
+
style: Y.modalOverlay,
|
|
1941
|
+
activeOpacity: 1,
|
|
1942
|
+
onPress: () => b(!1),
|
|
1943
|
+
children: /* @__PURE__ */ F(V, {
|
|
1944
|
+
style: [Y.modalContent, { backgroundColor: L.card }],
|
|
1945
|
+
activeOpacity: 1,
|
|
1946
|
+
onPress: () => {},
|
|
1947
|
+
children: [/* @__PURE__ */ F(H, {
|
|
1948
|
+
style: [Y.modalHeader, { borderBottomColor: L.separator }],
|
|
1949
|
+
children: [/* @__PURE__ */ P(B, {
|
|
1950
|
+
style: [Y.modalTitle, { color: L.text }],
|
|
1951
|
+
children: D || w.data.name
|
|
1952
|
+
}), /* @__PURE__ */ P(V, {
|
|
1953
|
+
onPress: () => b(!1),
|
|
1954
|
+
children: /* @__PURE__ */ P(B, {
|
|
1955
|
+
style: [Y.closeButton, { color: L.textMuted }],
|
|
1956
|
+
children: "✕"
|
|
1957
|
+
})
|
|
1958
|
+
})]
|
|
1959
|
+
}), /* @__PURE__ */ P(ae, {
|
|
1960
|
+
data: f,
|
|
1961
|
+
keyExtractor: (e) => e.value,
|
|
1962
|
+
style: Y.optionsList,
|
|
1963
|
+
contentContainerStyle: Y.optionsListContent,
|
|
1964
|
+
renderItem: ({ item: t }) => {
|
|
1965
|
+
let n = t.value === e;
|
|
1966
|
+
return /* @__PURE__ */ F(V, {
|
|
1967
|
+
style: [Y.option, n && { backgroundColor: L.primaryLight }],
|
|
1968
|
+
onPress: () => {
|
|
1969
|
+
T(t.value), b(!1);
|
|
1970
|
+
},
|
|
1971
|
+
activeOpacity: .7,
|
|
1972
|
+
children: [/* @__PURE__ */ P(me, {
|
|
1973
|
+
label: t.label,
|
|
1974
|
+
description: t.description,
|
|
1975
|
+
image: t.image
|
|
1976
|
+
}), n && /* @__PURE__ */ P(B, {
|
|
1977
|
+
style: [Y.checkmark, { color: L.primary }],
|
|
1978
|
+
children: "✓"
|
|
1979
|
+
})]
|
|
1980
|
+
});
|
|
1981
|
+
}
|
|
1982
|
+
})]
|
|
1983
|
+
})
|
|
1984
|
+
})
|
|
1985
|
+
}),
|
|
1986
|
+
E && /* @__PURE__ */ P(B, {
|
|
1987
|
+
style: [Y.error, { color: L.error }],
|
|
1988
|
+
children: E
|
|
1989
|
+
}),
|
|
1990
|
+
ee && !E && /* @__PURE__ */ P(B, {
|
|
1991
|
+
style: [Y.helperText, { color: L.textMuted }],
|
|
1992
|
+
children: ee
|
|
1993
|
+
})
|
|
1994
|
+
]
|
|
1995
|
+
});
|
|
1996
|
+
}
|
|
1997
|
+
return /* @__PURE__ */ F(H, {
|
|
1998
|
+
style: Y.container,
|
|
1999
|
+
children: [
|
|
2000
|
+
/* @__PURE__ */ F(B, {
|
|
2001
|
+
style: [Y.label, { color: L.textSecondary }],
|
|
2002
|
+
children: [D || w.data.name, w.data.required && /* @__PURE__ */ P(B, {
|
|
2003
|
+
style: { color: L.error },
|
|
2004
|
+
children: "*"
|
|
2005
|
+
})]
|
|
2006
|
+
}),
|
|
2007
|
+
/* @__PURE__ */ P(ce, {
|
|
2008
|
+
style: [Y.input, {
|
|
2009
|
+
backgroundColor: L.muted,
|
|
2010
|
+
borderColor: L.border,
|
|
2011
|
+
color: L.textMuted
|
|
2012
|
+
}],
|
|
2013
|
+
value: typeof S == "string" ? S : JSON.stringify(S),
|
|
2014
|
+
editable: !1
|
|
2015
|
+
}),
|
|
2016
|
+
E && /* @__PURE__ */ P(B, {
|
|
2017
|
+
style: [Y.error, { color: L.error }],
|
|
2018
|
+
children: E
|
|
2019
|
+
}),
|
|
2020
|
+
ee && !E && /* @__PURE__ */ P(B, {
|
|
2021
|
+
style: [Y.helperText, { color: L.textMuted }],
|
|
2022
|
+
children: ee
|
|
2023
|
+
})
|
|
2024
|
+
]
|
|
2025
|
+
});
|
|
2026
|
+
}, Y = z.create({
|
|
2027
|
+
arrow: { fontSize: 12 },
|
|
2028
|
+
checkmark: {
|
|
2029
|
+
fontSize: 18,
|
|
2030
|
+
fontWeight: "700"
|
|
2031
|
+
},
|
|
2032
|
+
closeButton: {
|
|
2033
|
+
fontSize: 24,
|
|
2034
|
+
fontWeight: "300"
|
|
2035
|
+
},
|
|
2036
|
+
container: { marginBottom: 16 },
|
|
2037
|
+
disabledMessage: {
|
|
2038
|
+
fontSize: 12,
|
|
2039
|
+
marginTop: 4
|
|
2040
|
+
},
|
|
2041
|
+
emptyContainer: {
|
|
2042
|
+
alignItems: "center",
|
|
2043
|
+
paddingVertical: 24
|
|
2044
|
+
},
|
|
2045
|
+
emptyText: { fontSize: 14 },
|
|
2046
|
+
error: {
|
|
2047
|
+
fontSize: 12,
|
|
2048
|
+
marginTop: 4
|
|
2049
|
+
},
|
|
2050
|
+
errorContainer: {
|
|
2051
|
+
alignItems: "center",
|
|
2052
|
+
paddingVertical: 16
|
|
2053
|
+
},
|
|
2054
|
+
errorText: {
|
|
2055
|
+
fontSize: 14,
|
|
2056
|
+
textAlign: "center"
|
|
2057
|
+
},
|
|
2058
|
+
helperText: {
|
|
2059
|
+
fontSize: 12,
|
|
2060
|
+
marginTop: 4
|
|
2061
|
+
},
|
|
2062
|
+
input: {
|
|
2063
|
+
borderRadius: 6,
|
|
2064
|
+
borderWidth: 1,
|
|
2065
|
+
fontSize: 14,
|
|
2066
|
+
paddingHorizontal: 12,
|
|
2067
|
+
paddingVertical: 10
|
|
2068
|
+
},
|
|
2069
|
+
label: {
|
|
2070
|
+
fontSize: 14,
|
|
2071
|
+
fontWeight: "500",
|
|
2072
|
+
marginBottom: 8
|
|
2073
|
+
},
|
|
2074
|
+
loadingContainer: {
|
|
2075
|
+
alignItems: "center",
|
|
2076
|
+
paddingVertical: 24
|
|
2077
|
+
},
|
|
2078
|
+
loadingTrigger: {
|
|
2079
|
+
alignItems: "center",
|
|
2080
|
+
flex: 1,
|
|
2081
|
+
flexDirection: "row",
|
|
2082
|
+
gap: 8
|
|
2083
|
+
},
|
|
2084
|
+
modalContent: {
|
|
2085
|
+
borderRadius: 12,
|
|
2086
|
+
maxHeight: "80%",
|
|
2087
|
+
padding: 16,
|
|
2088
|
+
width: "90%"
|
|
2089
|
+
},
|
|
2090
|
+
modalHeader: {
|
|
2091
|
+
alignItems: "center",
|
|
2092
|
+
borderBottomWidth: 1,
|
|
2093
|
+
flexDirection: "row",
|
|
2094
|
+
justifyContent: "space-between",
|
|
2095
|
+
marginBottom: 12,
|
|
2096
|
+
paddingBottom: 12
|
|
2097
|
+
},
|
|
2098
|
+
modalOverlay: {
|
|
2099
|
+
alignItems: "center",
|
|
2100
|
+
backgroundColor: "rgba(0, 0, 0, 0.5)",
|
|
2101
|
+
flex: 1,
|
|
2102
|
+
justifyContent: "center"
|
|
2103
|
+
},
|
|
2104
|
+
modalTitle: {
|
|
2105
|
+
fontSize: 18,
|
|
2106
|
+
fontWeight: "600"
|
|
2107
|
+
},
|
|
2108
|
+
option: {
|
|
2109
|
+
alignItems: "center",
|
|
2110
|
+
borderRadius: 6,
|
|
2111
|
+
flexDirection: "row",
|
|
2112
|
+
justifyContent: "space-between",
|
|
2113
|
+
paddingHorizontal: 12,
|
|
2114
|
+
paddingVertical: 12
|
|
2115
|
+
},
|
|
2116
|
+
optionsList: {
|
|
2117
|
+
flexGrow: 0,
|
|
2118
|
+
flexShrink: 1
|
|
2119
|
+
},
|
|
2120
|
+
optionsListContent: { flexGrow: 0 },
|
|
2121
|
+
retryButton: { marginTop: 12 },
|
|
2122
|
+
retryButtonText: {
|
|
2123
|
+
fontSize: 14,
|
|
2124
|
+
textDecorationLine: "underline"
|
|
2125
|
+
},
|
|
2126
|
+
searchContainer: { marginBottom: 12 },
|
|
2127
|
+
searchInput: {
|
|
2128
|
+
borderRadius: 6,
|
|
2129
|
+
borderWidth: 1,
|
|
2130
|
+
fontSize: 14,
|
|
2131
|
+
paddingHorizontal: 12,
|
|
2132
|
+
paddingVertical: 10
|
|
2133
|
+
},
|
|
2134
|
+
trigger: {
|
|
2135
|
+
alignItems: "center",
|
|
2136
|
+
borderRadius: 6,
|
|
2137
|
+
borderWidth: 1,
|
|
2138
|
+
flexDirection: "row",
|
|
2139
|
+
justifyContent: "space-between",
|
|
2140
|
+
paddingHorizontal: 12,
|
|
2141
|
+
paddingVertical: 10
|
|
2142
|
+
},
|
|
2143
|
+
triggerLoader: { marginRight: 8 },
|
|
2144
|
+
triggerText: {
|
|
2145
|
+
flex: 1,
|
|
2146
|
+
fontSize: 14
|
|
2147
|
+
}
|
|
2148
|
+
}), Ne = ({ field: e, extra: t }) => {
|
|
2149
|
+
let { value: n, placeholder: r, name: i } = e, [a, o] = N(n?.toString() ?? ""), { node: s, setValue: c, error: l, label: u, helperText: d } = t, { colors: f } = h();
|
|
2150
|
+
return A(() => {
|
|
2151
|
+
o(n?.toString() ?? "");
|
|
2152
|
+
}, [n]), /* @__PURE__ */ F(H, {
|
|
2153
|
+
style: Pe.container,
|
|
2154
|
+
children: [
|
|
2155
|
+
/* @__PURE__ */ F(B, {
|
|
2156
|
+
style: [Pe.label, { color: f.textSecondary }],
|
|
2157
|
+
children: [u || s.data.name, s.data.required && /* @__PURE__ */ P(B, {
|
|
2158
|
+
style: { color: f.error },
|
|
2159
|
+
children: "*"
|
|
2160
|
+
})]
|
|
2161
|
+
}),
|
|
2162
|
+
/* @__PURE__ */ P(ce, {
|
|
2163
|
+
style: [
|
|
2164
|
+
Pe.input,
|
|
2165
|
+
{
|
|
2166
|
+
backgroundColor: f.input,
|
|
2167
|
+
borderColor: f.border,
|
|
2168
|
+
color: f.text
|
|
2169
|
+
},
|
|
2170
|
+
l && { borderColor: f.error }
|
|
2171
|
+
],
|
|
2172
|
+
value: a,
|
|
2173
|
+
onChangeText: (e) => {
|
|
2174
|
+
if (o(e), e.trim() === "") {
|
|
2175
|
+
c(null);
|
|
2176
|
+
return;
|
|
2177
|
+
}
|
|
2178
|
+
let t = Number(e);
|
|
2179
|
+
Number.isNaN(t) || c(t);
|
|
2180
|
+
},
|
|
2181
|
+
placeholder: r,
|
|
2182
|
+
placeholderTextColor: f.textMuted,
|
|
2183
|
+
keyboardType: "numeric",
|
|
2184
|
+
accessibilityLabel: i
|
|
2185
|
+
}),
|
|
2186
|
+
l && /* @__PURE__ */ P(B, {
|
|
2187
|
+
style: [Pe.error, { color: f.error }],
|
|
2188
|
+
children: l
|
|
2189
|
+
}),
|
|
2190
|
+
d && !l && /* @__PURE__ */ P(B, {
|
|
2191
|
+
style: [Pe.helperText, { color: f.textMuted }],
|
|
2192
|
+
children: d
|
|
2193
|
+
})
|
|
2194
|
+
]
|
|
2195
|
+
});
|
|
2196
|
+
}, Pe = z.create({
|
|
2197
|
+
container: { marginBottom: 16 },
|
|
2198
|
+
error: {
|
|
2199
|
+
fontSize: 12,
|
|
2200
|
+
marginTop: 4
|
|
2201
|
+
},
|
|
2202
|
+
helperText: {
|
|
2203
|
+
fontSize: 12,
|
|
2204
|
+
marginTop: 4
|
|
2205
|
+
},
|
|
2206
|
+
input: {
|
|
2207
|
+
borderRadius: 6,
|
|
2208
|
+
borderWidth: 1,
|
|
2209
|
+
fontSize: 14,
|
|
2210
|
+
paddingHorizontal: 12,
|
|
2211
|
+
paddingVertical: 8
|
|
2212
|
+
},
|
|
2213
|
+
label: {
|
|
2214
|
+
fontSize: 14,
|
|
2215
|
+
fontWeight: "500",
|
|
2216
|
+
marginBottom: 8
|
|
2217
|
+
}
|
|
2218
|
+
}), Fe = ({ field: e, extra: t }) => {
|
|
2219
|
+
let [n, r] = N(!1), { value: i, placeholder: a, name: o } = e, { node: s, setValue: c, error: l, label: u, helperText: d } = t, { colors: f } = h();
|
|
2220
|
+
return /* @__PURE__ */ F(H, {
|
|
2221
|
+
style: Ie.container,
|
|
2222
|
+
children: [
|
|
2223
|
+
/* @__PURE__ */ F(B, {
|
|
2224
|
+
style: [Ie.label, { color: f.textSecondary }],
|
|
2225
|
+
children: [u || s.data.name, s.data.required && /* @__PURE__ */ P(B, {
|
|
2226
|
+
style: { color: f.error },
|
|
2227
|
+
children: "*"
|
|
2228
|
+
})]
|
|
2229
|
+
}),
|
|
2230
|
+
/* @__PURE__ */ F(H, {
|
|
2231
|
+
style: Ie.inputWrapper,
|
|
2232
|
+
children: [/* @__PURE__ */ P(ce, {
|
|
2233
|
+
style: [
|
|
2234
|
+
Ie.input,
|
|
2235
|
+
{
|
|
2236
|
+
backgroundColor: f.input,
|
|
2237
|
+
borderColor: f.border,
|
|
2238
|
+
color: f.text
|
|
2239
|
+
},
|
|
2240
|
+
l && { borderColor: f.error }
|
|
2241
|
+
],
|
|
2242
|
+
value: i ?? "",
|
|
2243
|
+
onChangeText: c,
|
|
2244
|
+
placeholder: a,
|
|
2245
|
+
placeholderTextColor: f.textMuted,
|
|
2246
|
+
secureTextEntry: !n,
|
|
2247
|
+
accessibilityLabel: o
|
|
2248
|
+
}), /* @__PURE__ */ P(V, {
|
|
2249
|
+
style: Ie.toggleButton,
|
|
2250
|
+
onPress: () => r(!n),
|
|
2251
|
+
activeOpacity: .7,
|
|
2252
|
+
children: /* @__PURE__ */ P(B, {
|
|
2253
|
+
style: [Ie.toggleText, { color: f.primary }],
|
|
2254
|
+
children: n ? "Hide" : "Show"
|
|
2255
|
+
})
|
|
2256
|
+
})]
|
|
2257
|
+
}),
|
|
2258
|
+
l && /* @__PURE__ */ P(B, {
|
|
2259
|
+
style: [Ie.error, { color: f.error }],
|
|
2260
|
+
children: l
|
|
2261
|
+
}),
|
|
2262
|
+
d && !l && /* @__PURE__ */ P(B, {
|
|
2263
|
+
style: [Ie.helperText, { color: f.textMuted }],
|
|
2264
|
+
children: d
|
|
2265
|
+
})
|
|
2266
|
+
]
|
|
2267
|
+
});
|
|
2268
|
+
}, Ie = z.create({
|
|
2269
|
+
container: { marginBottom: 16 },
|
|
2270
|
+
error: {
|
|
2271
|
+
fontSize: 12,
|
|
2272
|
+
marginTop: 4
|
|
2273
|
+
},
|
|
2274
|
+
helperText: {
|
|
2275
|
+
fontSize: 12,
|
|
2276
|
+
marginTop: 4
|
|
2277
|
+
},
|
|
2278
|
+
input: {
|
|
2279
|
+
borderRadius: 6,
|
|
2280
|
+
borderWidth: 1,
|
|
2281
|
+
flex: 1,
|
|
2282
|
+
fontSize: 14,
|
|
2283
|
+
paddingHorizontal: 12,
|
|
2284
|
+
paddingVertical: 8
|
|
2285
|
+
},
|
|
2286
|
+
inputWrapper: {
|
|
2287
|
+
alignItems: "center",
|
|
2288
|
+
flexDirection: "row",
|
|
2289
|
+
position: "relative"
|
|
2290
|
+
},
|
|
2291
|
+
label: {
|
|
2292
|
+
fontSize: 14,
|
|
2293
|
+
fontWeight: "500",
|
|
2294
|
+
marginBottom: 8
|
|
2295
|
+
},
|
|
2296
|
+
toggleButton: {
|
|
2297
|
+
paddingHorizontal: 12,
|
|
2298
|
+
paddingVertical: 8,
|
|
2299
|
+
position: "absolute",
|
|
2300
|
+
right: 0
|
|
2301
|
+
},
|
|
2302
|
+
toggleText: {
|
|
2303
|
+
fontSize: 12,
|
|
2304
|
+
fontWeight: "600"
|
|
2305
|
+
}
|
|
2306
|
+
}), Le = ({ field: e, extra: n }) => {
|
|
2307
|
+
let { value: r } = e, { node: i, setValue: a, error: o, label: s, helperText: c } = n, { colors: l } = h(), u = t(), d = i.data.options || [], f = r || "", p = i.data.variant !== "default", m = (e) => {
|
|
2308
|
+
a(e);
|
|
2309
|
+
};
|
|
2310
|
+
return /* @__PURE__ */ F(H, {
|
|
2311
|
+
style: X.container,
|
|
2312
|
+
children: [
|
|
2313
|
+
/* @__PURE__ */ F(B, {
|
|
2314
|
+
style: [X.label, { color: l.textSecondary }],
|
|
2315
|
+
children: [s || i.data.name, i.data.required && /* @__PURE__ */ P(B, {
|
|
2316
|
+
style: { color: l.error },
|
|
2317
|
+
children: "*"
|
|
2318
|
+
})]
|
|
2319
|
+
}),
|
|
2320
|
+
d.map((e) => {
|
|
2321
|
+
let t = f === e.value, n = u(e.label) || e.value, r = u(e.description);
|
|
2322
|
+
return p ? /* @__PURE__ */ F(V, {
|
|
2323
|
+
style: [
|
|
2324
|
+
X.card,
|
|
2325
|
+
{
|
|
2326
|
+
backgroundColor: l.input,
|
|
2327
|
+
borderColor: l.border
|
|
2328
|
+
},
|
|
2329
|
+
t && {
|
|
2330
|
+
backgroundColor: `${l.primary}10`,
|
|
2331
|
+
borderColor: l.primary
|
|
2332
|
+
},
|
|
2333
|
+
e.disabled && { opacity: .5 }
|
|
2334
|
+
],
|
|
2335
|
+
onPress: () => m(e.value),
|
|
2336
|
+
disabled: e.disabled,
|
|
2337
|
+
activeOpacity: .7,
|
|
2338
|
+
children: [
|
|
2339
|
+
e.image && /* @__PURE__ */ P(L, {
|
|
2340
|
+
source: { uri: e.image },
|
|
2341
|
+
style: X.cardImage
|
|
2342
|
+
}),
|
|
2343
|
+
/* @__PURE__ */ F(H, {
|
|
2344
|
+
style: X.cardTextContainer,
|
|
2345
|
+
children: [/* @__PURE__ */ P(B, {
|
|
2346
|
+
style: [X.cardLabel, { color: l.textSecondary }],
|
|
2347
|
+
children: n
|
|
2348
|
+
}), r && /* @__PURE__ */ P(B, {
|
|
2349
|
+
style: [X.cardDescription, { color: l.textMuted }],
|
|
2350
|
+
children: r
|
|
2351
|
+
})]
|
|
2352
|
+
}),
|
|
2353
|
+
/* @__PURE__ */ P(H, {
|
|
2354
|
+
style: [
|
|
2355
|
+
X.radio,
|
|
2356
|
+
X.cardRadio,
|
|
2357
|
+
{
|
|
2358
|
+
backgroundColor: l.input,
|
|
2359
|
+
borderColor: l.border
|
|
2360
|
+
},
|
|
2361
|
+
t && { borderColor: l.primary }
|
|
2362
|
+
],
|
|
2363
|
+
children: t && /* @__PURE__ */ P(H, { style: [X.radioInner, { backgroundColor: l.primary }] })
|
|
2364
|
+
})
|
|
2365
|
+
]
|
|
2366
|
+
}, e.value) : /* @__PURE__ */ F(V, {
|
|
2367
|
+
style: X.option,
|
|
2368
|
+
onPress: () => m(e.value),
|
|
2369
|
+
disabled: e.disabled,
|
|
2370
|
+
activeOpacity: .7,
|
|
2371
|
+
children: [
|
|
2372
|
+
/* @__PURE__ */ P(H, {
|
|
2373
|
+
style: [
|
|
2374
|
+
X.radio,
|
|
2375
|
+
{
|
|
2376
|
+
backgroundColor: l.input,
|
|
2377
|
+
borderColor: l.border
|
|
2378
|
+
},
|
|
2379
|
+
t && { borderColor: l.primary }
|
|
2380
|
+
],
|
|
2381
|
+
children: t && /* @__PURE__ */ P(H, { style: [X.radioInner, { backgroundColor: l.primary }] })
|
|
2382
|
+
}),
|
|
2383
|
+
e.image && /* @__PURE__ */ P(L, {
|
|
2384
|
+
source: { uri: e.image },
|
|
2385
|
+
style: X.image
|
|
2386
|
+
}),
|
|
2387
|
+
/* @__PURE__ */ F(H, {
|
|
2388
|
+
style: X.optionTextContainer,
|
|
2389
|
+
children: [/* @__PURE__ */ P(B, {
|
|
2390
|
+
style: [
|
|
2391
|
+
X.optionLabel,
|
|
2392
|
+
{ color: l.textSecondary },
|
|
2393
|
+
e.disabled && { color: l.textMuted }
|
|
2394
|
+
],
|
|
2395
|
+
children: n
|
|
2396
|
+
}), r && /* @__PURE__ */ P(B, {
|
|
2397
|
+
style: [X.optionDescription, { color: l.textMuted }],
|
|
2398
|
+
children: r
|
|
2399
|
+
})]
|
|
2400
|
+
})
|
|
2401
|
+
]
|
|
2402
|
+
}, e.value);
|
|
2403
|
+
}),
|
|
2404
|
+
o && /* @__PURE__ */ P(B, {
|
|
2405
|
+
style: [X.error, { color: l.error }],
|
|
2406
|
+
children: o
|
|
2407
|
+
}),
|
|
2408
|
+
c && !o && /* @__PURE__ */ P(B, {
|
|
2409
|
+
style: [X.helperText, { color: l.textMuted }],
|
|
2410
|
+
children: c
|
|
2411
|
+
})
|
|
2412
|
+
]
|
|
2413
|
+
});
|
|
2414
|
+
}, X = z.create({
|
|
2415
|
+
card: {
|
|
2416
|
+
alignItems: "center",
|
|
2417
|
+
borderRadius: 8,
|
|
2418
|
+
borderWidth: 1,
|
|
2419
|
+
flexDirection: "row",
|
|
2420
|
+
marginBottom: 8,
|
|
2421
|
+
padding: 16
|
|
2422
|
+
},
|
|
2423
|
+
cardDescription: {
|
|
2424
|
+
fontSize: 12,
|
|
2425
|
+
marginTop: 4
|
|
2426
|
+
},
|
|
2427
|
+
cardImage: {
|
|
2428
|
+
borderRadius: 4,
|
|
2429
|
+
height: 40,
|
|
2430
|
+
marginRight: 12,
|
|
2431
|
+
width: 40
|
|
2432
|
+
},
|
|
2433
|
+
cardLabel: {
|
|
2434
|
+
fontSize: 14,
|
|
2435
|
+
fontWeight: "500"
|
|
2436
|
+
},
|
|
2437
|
+
cardRadio: {
|
|
2438
|
+
marginLeft: 12,
|
|
2439
|
+
marginRight: 0
|
|
2440
|
+
},
|
|
2441
|
+
cardTextContainer: { flex: 1 },
|
|
2442
|
+
container: { marginBottom: 16 },
|
|
2443
|
+
error: {
|
|
2444
|
+
fontSize: 12,
|
|
2445
|
+
marginTop: 4
|
|
2446
|
+
},
|
|
2447
|
+
helperText: {
|
|
2448
|
+
fontSize: 12,
|
|
2449
|
+
marginTop: 4
|
|
2450
|
+
},
|
|
2451
|
+
image: {
|
|
2452
|
+
borderRadius: 4,
|
|
2453
|
+
height: 32,
|
|
2454
|
+
marginRight: 8,
|
|
2455
|
+
width: 32
|
|
2456
|
+
},
|
|
2457
|
+
label: {
|
|
2458
|
+
fontSize: 14,
|
|
2459
|
+
fontWeight: "500",
|
|
2460
|
+
marginBottom: 8
|
|
2461
|
+
},
|
|
2462
|
+
option: {
|
|
2463
|
+
alignItems: "center",
|
|
2464
|
+
flexDirection: "row",
|
|
2465
|
+
marginBottom: 8
|
|
2466
|
+
},
|
|
2467
|
+
optionDescription: {
|
|
2468
|
+
fontSize: 12,
|
|
2469
|
+
marginTop: 2
|
|
2470
|
+
},
|
|
2471
|
+
optionLabel: { fontSize: 14 },
|
|
2472
|
+
optionTextContainer: { flex: 1 },
|
|
2473
|
+
radio: {
|
|
2474
|
+
alignItems: "center",
|
|
2475
|
+
borderRadius: 10,
|
|
2476
|
+
borderWidth: 2,
|
|
2477
|
+
height: 20,
|
|
2478
|
+
justifyContent: "center",
|
|
2479
|
+
marginRight: 12,
|
|
2480
|
+
width: 20
|
|
2481
|
+
},
|
|
2482
|
+
radioInner: {
|
|
2483
|
+
borderRadius: 5,
|
|
2484
|
+
height: 10,
|
|
2485
|
+
width: 10
|
|
2486
|
+
}
|
|
2487
|
+
}), Re = ({ field: e, extra: n }) => {
|
|
2488
|
+
let [r, i] = N(!1), { value: a, placeholder: o } = e, { node: s, setValue: c, error: l, label: u, helperText: d } = n, { colors: f } = h(), p = t(), m = s.data.options || [], g = s.data.multiple, _ = Array.isArray(a) ? a : a ? [a] : [], v = (e) => {
|
|
2489
|
+
g ? c(_.includes(e) ? _.filter((t) => t !== e) : [..._, e]) : (c(e), i(!1));
|
|
2490
|
+
};
|
|
2491
|
+
return /* @__PURE__ */ F(H, {
|
|
2492
|
+
style: Z.container,
|
|
2493
|
+
children: [
|
|
2494
|
+
/* @__PURE__ */ F(B, {
|
|
2495
|
+
style: [Z.label, { color: f.textSecondary }],
|
|
2496
|
+
children: [u || s.data.name, s.data.required && /* @__PURE__ */ P(B, {
|
|
2497
|
+
style: { color: f.error },
|
|
2498
|
+
children: "*"
|
|
2499
|
+
})]
|
|
2500
|
+
}),
|
|
2501
|
+
/* @__PURE__ */ F(V, {
|
|
2502
|
+
style: [
|
|
2503
|
+
Z.trigger,
|
|
2504
|
+
{
|
|
2505
|
+
backgroundColor: f.input,
|
|
2506
|
+
borderColor: f.border
|
|
2507
|
+
},
|
|
2508
|
+
l && { borderColor: f.error }
|
|
2509
|
+
],
|
|
2510
|
+
onPress: () => i(!0),
|
|
2511
|
+
activeOpacity: .7,
|
|
2512
|
+
children: [/* @__PURE__ */ P(B, {
|
|
2513
|
+
style: [
|
|
2514
|
+
Z.triggerText,
|
|
2515
|
+
{ color: f.text },
|
|
2516
|
+
_.length === 0 && { color: f.textMuted }
|
|
2517
|
+
],
|
|
2518
|
+
children: (() => {
|
|
2519
|
+
if (_.length === 0) return o || "Select...";
|
|
2520
|
+
if (g) return m.filter((e) => _.includes(e.value)).map((e) => p(e.label) || e.value).join(", ");
|
|
2521
|
+
let e = m.find((e) => e.value === _[0]);
|
|
2522
|
+
return e ? p(e.label) || e.value : o || "Select...";
|
|
2523
|
+
})()
|
|
2524
|
+
}), /* @__PURE__ */ P(B, {
|
|
2525
|
+
style: [Z.arrow, { color: f.textMuted }],
|
|
2526
|
+
children: "▼"
|
|
2527
|
+
})]
|
|
2528
|
+
}),
|
|
2529
|
+
/* @__PURE__ */ P(oe, {
|
|
2530
|
+
visible: r,
|
|
2531
|
+
transparent: !0,
|
|
2532
|
+
animationType: "fade",
|
|
2533
|
+
onRequestClose: () => i(!1),
|
|
2534
|
+
children: /* @__PURE__ */ P(V, {
|
|
2535
|
+
style: Z.modalOverlay,
|
|
2536
|
+
activeOpacity: 1,
|
|
2537
|
+
onPress: () => i(!1),
|
|
2538
|
+
children: /* @__PURE__ */ F(H, {
|
|
2539
|
+
style: [Z.modalContent, { backgroundColor: f.card }],
|
|
2540
|
+
onStartShouldSetResponder: () => !0,
|
|
2541
|
+
children: [
|
|
2542
|
+
/* @__PURE__ */ F(H, {
|
|
2543
|
+
style: [Z.modalHeader, { borderBottomColor: f.border }],
|
|
2544
|
+
children: [/* @__PURE__ */ P(B, {
|
|
2545
|
+
style: [Z.modalTitle, { color: f.text }],
|
|
2546
|
+
children: u || s.data.name
|
|
2547
|
+
}), /* @__PURE__ */ P(V, {
|
|
2548
|
+
onPress: () => i(!1),
|
|
2549
|
+
children: /* @__PURE__ */ P(B, {
|
|
2550
|
+
style: [Z.closeButton, { color: f.textMuted }],
|
|
2551
|
+
children: "✕"
|
|
2552
|
+
})
|
|
2553
|
+
})]
|
|
2554
|
+
}),
|
|
2555
|
+
/* @__PURE__ */ P(R, {
|
|
2556
|
+
style: Z.optionsList,
|
|
2557
|
+
children: m.map((e) => {
|
|
2558
|
+
let t = _.includes(e.value);
|
|
2559
|
+
return /* @__PURE__ */ F(V, {
|
|
2560
|
+
style: [Z.option, t && { backgroundColor: `${f.primary}20` }],
|
|
2561
|
+
onPress: () => v(e.value),
|
|
2562
|
+
disabled: e.disabled,
|
|
2563
|
+
activeOpacity: .7,
|
|
2564
|
+
children: [/* @__PURE__ */ P(me, {
|
|
2565
|
+
label: p(e.label) || e.value,
|
|
2566
|
+
description: p(e.description),
|
|
2567
|
+
image: e.image,
|
|
2568
|
+
disabled: e.disabled
|
|
2569
|
+
}), t && /* @__PURE__ */ P(B, {
|
|
2570
|
+
style: [Z.checkmark, { color: f.primary }],
|
|
2571
|
+
children: "✓"
|
|
2572
|
+
})]
|
|
2573
|
+
}, e.value);
|
|
2574
|
+
})
|
|
2575
|
+
}),
|
|
2576
|
+
g && /* @__PURE__ */ P(V, {
|
|
2577
|
+
style: [Z.doneButton, { backgroundColor: f.primary }],
|
|
2578
|
+
onPress: () => i(!1),
|
|
2579
|
+
children: /* @__PURE__ */ P(B, {
|
|
2580
|
+
style: Z.doneButtonText,
|
|
2581
|
+
children: "Done"
|
|
2582
|
+
})
|
|
2583
|
+
})
|
|
2584
|
+
]
|
|
2585
|
+
})
|
|
2586
|
+
})
|
|
2587
|
+
}),
|
|
2588
|
+
l && /* @__PURE__ */ P(B, {
|
|
2589
|
+
style: [Z.error, { color: f.error }],
|
|
2590
|
+
children: l
|
|
2591
|
+
}),
|
|
2592
|
+
d && !l && /* @__PURE__ */ P(B, {
|
|
2593
|
+
style: [Z.helperText, { color: f.textMuted }],
|
|
2594
|
+
children: d
|
|
2595
|
+
})
|
|
2596
|
+
]
|
|
2597
|
+
});
|
|
2598
|
+
}, Z = z.create({
|
|
2599
|
+
arrow: { fontSize: 12 },
|
|
2600
|
+
checkmark: {
|
|
2601
|
+
fontSize: 18,
|
|
2602
|
+
fontWeight: "700"
|
|
2603
|
+
},
|
|
2604
|
+
closeButton: {
|
|
2605
|
+
fontSize: 24,
|
|
2606
|
+
fontWeight: "300"
|
|
2607
|
+
},
|
|
2608
|
+
container: { marginBottom: 16 },
|
|
2609
|
+
doneButton: {
|
|
2610
|
+
alignItems: "center",
|
|
2611
|
+
borderRadius: 6,
|
|
2612
|
+
marginTop: 12,
|
|
2613
|
+
paddingVertical: 12
|
|
2614
|
+
},
|
|
2615
|
+
doneButtonText: {
|
|
2616
|
+
color: "#FFFFFF",
|
|
2617
|
+
fontSize: 16,
|
|
2618
|
+
fontWeight: "600"
|
|
2619
|
+
},
|
|
2620
|
+
error: {
|
|
2621
|
+
fontSize: 12,
|
|
2622
|
+
marginTop: 4
|
|
2623
|
+
},
|
|
2624
|
+
helperText: {
|
|
2625
|
+
fontSize: 12,
|
|
2626
|
+
marginTop: 4
|
|
2627
|
+
},
|
|
2628
|
+
label: {
|
|
2629
|
+
fontSize: 14,
|
|
2630
|
+
fontWeight: "500",
|
|
2631
|
+
marginBottom: 8
|
|
2632
|
+
},
|
|
2633
|
+
modalContent: {
|
|
2634
|
+
borderRadius: 12,
|
|
2635
|
+
maxHeight: "80%",
|
|
2636
|
+
padding: 16,
|
|
2637
|
+
width: "90%"
|
|
2638
|
+
},
|
|
2639
|
+
modalHeader: {
|
|
2640
|
+
alignItems: "center",
|
|
2641
|
+
borderBottomWidth: 1,
|
|
2642
|
+
flexDirection: "row",
|
|
2643
|
+
justifyContent: "space-between",
|
|
2644
|
+
marginBottom: 12,
|
|
2645
|
+
paddingBottom: 12
|
|
2646
|
+
},
|
|
2647
|
+
modalOverlay: {
|
|
2648
|
+
alignItems: "center",
|
|
2649
|
+
backgroundColor: "rgba(0, 0, 0, 0.5)",
|
|
2650
|
+
flex: 1,
|
|
2651
|
+
justifyContent: "center"
|
|
2652
|
+
},
|
|
2653
|
+
modalTitle: {
|
|
2654
|
+
fontSize: 18,
|
|
2655
|
+
fontWeight: "600"
|
|
2656
|
+
},
|
|
2657
|
+
option: {
|
|
2658
|
+
alignItems: "center",
|
|
2659
|
+
borderRadius: 6,
|
|
2660
|
+
flexDirection: "row",
|
|
2661
|
+
justifyContent: "space-between",
|
|
2662
|
+
paddingHorizontal: 12,
|
|
2663
|
+
paddingVertical: 12
|
|
2664
|
+
},
|
|
2665
|
+
optionsList: { maxHeight: 300 },
|
|
2666
|
+
trigger: {
|
|
2667
|
+
alignItems: "center",
|
|
2668
|
+
borderRadius: 6,
|
|
2669
|
+
borderWidth: 1,
|
|
2670
|
+
flexDirection: "row",
|
|
2671
|
+
justifyContent: "space-between",
|
|
2672
|
+
paddingHorizontal: 12,
|
|
2673
|
+
paddingVertical: 10
|
|
2674
|
+
},
|
|
2675
|
+
triggerText: {
|
|
2676
|
+
flex: 1,
|
|
2677
|
+
fontSize: 14
|
|
2678
|
+
}
|
|
2679
|
+
}), ze = (e) => null, Be = ({ field: e, extra: t }) => {
|
|
2680
|
+
let { value: n } = e, { node: r, setValue: i, error: a, label: o, helperText: s } = t, { colors: c } = h(), l = !!n;
|
|
2681
|
+
return /* @__PURE__ */ F(H, {
|
|
2682
|
+
style: Ve.container,
|
|
2683
|
+
children: [
|
|
2684
|
+
/* @__PURE__ */ F(H, {
|
|
2685
|
+
style: Ve.row,
|
|
2686
|
+
children: [/* @__PURE__ */ P(H, {
|
|
2687
|
+
style: Ve.labelContainer,
|
|
2688
|
+
children: /* @__PURE__ */ F(B, {
|
|
2689
|
+
style: [Ve.label, { color: c.textSecondary }],
|
|
2690
|
+
children: [o || r.data.name, r.data.required && /* @__PURE__ */ P(B, {
|
|
2691
|
+
style: { color: c.error },
|
|
2692
|
+
children: "*"
|
|
2693
|
+
})]
|
|
2694
|
+
})
|
|
2695
|
+
}), /* @__PURE__ */ P(se, {
|
|
2696
|
+
trackColor: {
|
|
2697
|
+
false: c.border,
|
|
2698
|
+
true: `${c.primary}80`
|
|
2699
|
+
},
|
|
2700
|
+
thumbColor: l ? c.primary : c.card,
|
|
2701
|
+
ios_backgroundColor: c.border,
|
|
2702
|
+
onValueChange: i,
|
|
2703
|
+
value: l
|
|
2704
|
+
})]
|
|
2705
|
+
}),
|
|
2706
|
+
a && /* @__PURE__ */ P(B, {
|
|
2707
|
+
style: [Ve.error, { color: c.error }],
|
|
2708
|
+
children: a
|
|
2709
|
+
}),
|
|
2710
|
+
s && !a && /* @__PURE__ */ P(B, {
|
|
2711
|
+
style: [Ve.helperText, { color: c.textMuted }],
|
|
2712
|
+
children: s
|
|
2713
|
+
})
|
|
2714
|
+
]
|
|
2715
|
+
});
|
|
2716
|
+
}, Ve = z.create({
|
|
2717
|
+
container: { marginBottom: 16 },
|
|
2718
|
+
error: {
|
|
2719
|
+
fontSize: 12,
|
|
2720
|
+
marginTop: 4
|
|
2721
|
+
},
|
|
2722
|
+
helperText: {
|
|
2723
|
+
fontSize: 12,
|
|
2724
|
+
marginTop: 4
|
|
2725
|
+
},
|
|
2726
|
+
label: {
|
|
2727
|
+
fontSize: 14,
|
|
2728
|
+
fontWeight: "500"
|
|
2729
|
+
},
|
|
2730
|
+
labelContainer: { flex: 1 },
|
|
2731
|
+
row: {
|
|
2732
|
+
alignItems: "center",
|
|
2733
|
+
flexDirection: "row",
|
|
2734
|
+
justifyContent: "space-between"
|
|
2735
|
+
}
|
|
2736
|
+
}), He = ({ field: e, extra: t }) => {
|
|
2737
|
+
let { value: n, placeholder: r, name: i } = e, { node: a, setValue: o, error: s, label: c, helperText: l } = t, { colors: u } = h();
|
|
2738
|
+
return /* @__PURE__ */ F(H, {
|
|
2739
|
+
style: Ue.container,
|
|
2740
|
+
children: [
|
|
2741
|
+
/* @__PURE__ */ F(B, {
|
|
2742
|
+
style: [Ue.label, { color: u.textSecondary }],
|
|
2743
|
+
children: [c || a.data.name, a.data.required && /* @__PURE__ */ P(B, {
|
|
2744
|
+
style: { color: u.error },
|
|
2745
|
+
children: "*"
|
|
2746
|
+
})]
|
|
2747
|
+
}),
|
|
2748
|
+
/* @__PURE__ */ P(ce, {
|
|
2749
|
+
style: [
|
|
2750
|
+
Ue.textarea,
|
|
2751
|
+
{
|
|
2752
|
+
backgroundColor: u.input,
|
|
2753
|
+
borderColor: u.border,
|
|
2754
|
+
color: u.text
|
|
2755
|
+
},
|
|
2756
|
+
s && { borderColor: u.error }
|
|
2757
|
+
],
|
|
2758
|
+
value: n ?? "",
|
|
2759
|
+
onChangeText: o,
|
|
2760
|
+
placeholder: r,
|
|
2761
|
+
placeholderTextColor: u.textMuted,
|
|
2762
|
+
multiline: !0,
|
|
2763
|
+
numberOfLines: 4,
|
|
2764
|
+
textAlignVertical: "top",
|
|
2765
|
+
accessibilityLabel: i
|
|
2766
|
+
}),
|
|
2767
|
+
s && /* @__PURE__ */ P(B, {
|
|
2768
|
+
style: [Ue.error, { color: u.error }],
|
|
2769
|
+
children: s
|
|
2770
|
+
}),
|
|
2771
|
+
l && !s && /* @__PURE__ */ P(B, {
|
|
2772
|
+
style: [Ue.helperText, { color: u.textMuted }],
|
|
2773
|
+
children: l
|
|
2774
|
+
})
|
|
2775
|
+
]
|
|
2776
|
+
});
|
|
2777
|
+
}, Ue = z.create({
|
|
2778
|
+
container: { marginBottom: 16 },
|
|
2779
|
+
error: {
|
|
2780
|
+
fontSize: 12,
|
|
2781
|
+
marginTop: 4
|
|
2782
|
+
},
|
|
2783
|
+
helperText: {
|
|
2784
|
+
fontSize: 12,
|
|
2785
|
+
marginTop: 4
|
|
2786
|
+
},
|
|
2787
|
+
label: {
|
|
2788
|
+
fontSize: 14,
|
|
2789
|
+
fontWeight: "500",
|
|
2790
|
+
marginBottom: 8
|
|
2791
|
+
},
|
|
2792
|
+
textarea: {
|
|
2793
|
+
borderRadius: 6,
|
|
2794
|
+
borderWidth: 1,
|
|
2795
|
+
fontSize: 14,
|
|
2796
|
+
minHeight: 100,
|
|
2797
|
+
paddingHorizontal: 12,
|
|
2798
|
+
paddingVertical: 8
|
|
2799
|
+
}
|
|
2800
|
+
}), We = ({ field: e, extra: t }) => {
|
|
2801
|
+
let { value: n, placeholder: r, name: i } = e, { node: a, setValue: o, error: s, label: c, helperText: l } = t, { colors: u } = h();
|
|
2802
|
+
return /* @__PURE__ */ F(H, {
|
|
2803
|
+
style: Ge.container,
|
|
2804
|
+
children: [
|
|
2805
|
+
/* @__PURE__ */ F(B, {
|
|
2806
|
+
style: [Ge.label, { color: u.textSecondary }],
|
|
2807
|
+
children: [c || a.data.name, a.data.required && /* @__PURE__ */ P(B, {
|
|
2808
|
+
style: { color: u.error },
|
|
2809
|
+
children: "*"
|
|
2810
|
+
})]
|
|
2811
|
+
}),
|
|
2812
|
+
/* @__PURE__ */ P(ce, {
|
|
2813
|
+
style: [
|
|
2814
|
+
Ge.input,
|
|
2815
|
+
{
|
|
2816
|
+
backgroundColor: u.input,
|
|
2817
|
+
borderColor: u.border,
|
|
2818
|
+
color: u.text
|
|
2819
|
+
},
|
|
2820
|
+
s && { borderColor: u.error }
|
|
2821
|
+
],
|
|
2822
|
+
value: n ?? "",
|
|
2823
|
+
onChangeText: o,
|
|
2824
|
+
placeholder: r,
|
|
2825
|
+
placeholderTextColor: u.textMuted,
|
|
2826
|
+
accessibilityLabel: i
|
|
2827
|
+
}),
|
|
2828
|
+
s && /* @__PURE__ */ P(B, {
|
|
2829
|
+
style: [Ge.error, { color: u.error }],
|
|
2830
|
+
children: s
|
|
2831
|
+
}),
|
|
2832
|
+
l && !s && /* @__PURE__ */ P(B, {
|
|
2833
|
+
style: [Ge.helperText, { color: u.textMuted }],
|
|
2834
|
+
children: l
|
|
2835
|
+
})
|
|
2836
|
+
]
|
|
2837
|
+
});
|
|
2838
|
+
}, Ge = z.create({
|
|
2839
|
+
container: { marginBottom: 16 },
|
|
2840
|
+
error: {
|
|
2841
|
+
fontSize: 12,
|
|
2842
|
+
marginTop: 4
|
|
2843
|
+
},
|
|
2844
|
+
helperText: {
|
|
2845
|
+
fontSize: 12,
|
|
2846
|
+
marginTop: 4
|
|
2847
|
+
},
|
|
2848
|
+
input: {
|
|
2849
|
+
borderRadius: 6,
|
|
2850
|
+
borderWidth: 1,
|
|
2851
|
+
fontSize: 14,
|
|
2852
|
+
paddingHorizontal: 12,
|
|
2853
|
+
paddingVertical: 8
|
|
2854
|
+
},
|
|
2855
|
+
label: {
|
|
2856
|
+
fontSize: 14,
|
|
2857
|
+
fontWeight: "500",
|
|
2858
|
+
marginBottom: 8
|
|
2859
|
+
}
|
|
2860
|
+
}), Ke = ({ field: e, extra: t }) => {
|
|
2861
|
+
let { value: n, placeholder: r } = e, i = (n || "").split(":"), a = Number.parseInt(i[0], 10), o = Number.parseInt(i[1], 10), s = Number.isNaN(a) ? 0 : a, c = Number.isNaN(o) ? 0 : o, [l, u] = N(s || 0), [d, f] = N(c || 0), [p, m] = N(!1), { node: g, setValue: _, error: v, label: y, helperText: b } = t, { colors: x } = h(), S = M(null), C = M(null), w = Array.from({ length: 24 }, (e, t) => t), T = Array.from({ length: 60 }, (e, t) => t), E = () => n || r || "Select time", D = te(() => {
|
|
2862
|
+
_(`${String(l).padStart(2, "0")}:${String(d).padStart(2, "0")}`), m(!1);
|
|
2863
|
+
}, [
|
|
2864
|
+
l,
|
|
2865
|
+
d,
|
|
2866
|
+
_
|
|
2867
|
+
]);
|
|
2868
|
+
return /* @__PURE__ */ F(H, {
|
|
2869
|
+
style: Q.container,
|
|
2870
|
+
children: [
|
|
2871
|
+
/* @__PURE__ */ F(B, {
|
|
2872
|
+
style: [Q.label, { color: x.textSecondary }],
|
|
2873
|
+
children: [y || g.data.name, g.data.required && /* @__PURE__ */ P(B, {
|
|
2874
|
+
style: { color: x.error },
|
|
2875
|
+
children: "*"
|
|
2876
|
+
})]
|
|
2877
|
+
}),
|
|
2878
|
+
/* @__PURE__ */ F(V, {
|
|
2879
|
+
style: [
|
|
2880
|
+
Q.trigger,
|
|
2881
|
+
{
|
|
2882
|
+
backgroundColor: x.input,
|
|
2883
|
+
borderColor: x.border
|
|
2884
|
+
},
|
|
2885
|
+
v && { borderColor: x.error }
|
|
2886
|
+
],
|
|
2887
|
+
onPress: () => {
|
|
2888
|
+
u(s || 0), f(c || 0), m(!0);
|
|
2889
|
+
},
|
|
2890
|
+
activeOpacity: .7,
|
|
2891
|
+
children: [/* @__PURE__ */ P(B, {
|
|
2892
|
+
style: [
|
|
2893
|
+
Q.triggerText,
|
|
2894
|
+
{ color: x.text },
|
|
2895
|
+
!n && { color: x.textMuted }
|
|
2896
|
+
],
|
|
2897
|
+
numberOfLines: 1,
|
|
2898
|
+
children: E()
|
|
2899
|
+
}), /* @__PURE__ */ P(B, {
|
|
2900
|
+
style: Q.icon,
|
|
2901
|
+
children: "🕐"
|
|
2902
|
+
})]
|
|
2903
|
+
}),
|
|
2904
|
+
/* @__PURE__ */ P(oe, {
|
|
2905
|
+
visible: p,
|
|
2906
|
+
transparent: !0,
|
|
2907
|
+
animationType: "fade",
|
|
2908
|
+
onRequestClose: () => m(!1),
|
|
2909
|
+
children: /* @__PURE__ */ P(V, {
|
|
2910
|
+
style: Q.modalOverlay,
|
|
2911
|
+
activeOpacity: 1,
|
|
2912
|
+
onPress: () => m(!1),
|
|
2913
|
+
children: /* @__PURE__ */ F(V, {
|
|
2914
|
+
style: [Q.modalContent, { backgroundColor: x.card }],
|
|
2915
|
+
activeOpacity: 1,
|
|
2916
|
+
onPress: () => {},
|
|
2917
|
+
children: [
|
|
2918
|
+
/* @__PURE__ */ F(H, {
|
|
2919
|
+
style: [Q.modalHeader, { borderBottomColor: x.separator }],
|
|
2920
|
+
children: [/* @__PURE__ */ P(B, {
|
|
2921
|
+
style: [Q.modalTitle, { color: x.text }],
|
|
2922
|
+
children: y || g.data.name
|
|
2923
|
+
}), /* @__PURE__ */ P(V, {
|
|
2924
|
+
onPress: () => m(!1),
|
|
2925
|
+
children: /* @__PURE__ */ P(B, {
|
|
2926
|
+
style: [Q.closeButton, { color: x.textMuted }],
|
|
2927
|
+
children: "✕"
|
|
2928
|
+
})
|
|
2929
|
+
})]
|
|
2930
|
+
}),
|
|
2931
|
+
/* @__PURE__ */ F(H, {
|
|
2932
|
+
style: Q.pickerContainer,
|
|
2933
|
+
children: [
|
|
2934
|
+
/* @__PURE__ */ F(H, {
|
|
2935
|
+
style: Q.pickerColumn,
|
|
2936
|
+
children: [/* @__PURE__ */ P(B, {
|
|
2937
|
+
style: [Q.pickerLabel, { color: x.textMuted }],
|
|
2938
|
+
children: "Hour"
|
|
2939
|
+
}), /* @__PURE__ */ P(R, {
|
|
2940
|
+
ref: S,
|
|
2941
|
+
style: Q.picker,
|
|
2942
|
+
contentContainerStyle: Q.pickerContent,
|
|
2943
|
+
showsVerticalScrollIndicator: !1,
|
|
2944
|
+
children: w.map((e) => /* @__PURE__ */ P(V, {
|
|
2945
|
+
style: [Q.pickerItem, l === e && { backgroundColor: x.primary }],
|
|
2946
|
+
onPress: () => u(e),
|
|
2947
|
+
activeOpacity: .7,
|
|
2948
|
+
children: /* @__PURE__ */ P(B, {
|
|
2949
|
+
style: [
|
|
2950
|
+
Q.pickerItemText,
|
|
2951
|
+
{ color: x.text },
|
|
2952
|
+
l === e && {
|
|
2953
|
+
color: x.background,
|
|
2954
|
+
fontWeight: "600"
|
|
2955
|
+
}
|
|
2956
|
+
],
|
|
2957
|
+
children: String(e).padStart(2, "0")
|
|
2958
|
+
})
|
|
2959
|
+
}, e))
|
|
2960
|
+
})]
|
|
2961
|
+
}),
|
|
2962
|
+
/* @__PURE__ */ P(B, {
|
|
2963
|
+
style: [Q.pickerSeparator, { color: x.text }],
|
|
2964
|
+
children: ":"
|
|
2965
|
+
}),
|
|
2966
|
+
/* @__PURE__ */ F(H, {
|
|
2967
|
+
style: Q.pickerColumn,
|
|
2968
|
+
children: [/* @__PURE__ */ P(B, {
|
|
2969
|
+
style: [Q.pickerLabel, { color: x.textMuted }],
|
|
2970
|
+
children: "Minute"
|
|
2971
|
+
}), /* @__PURE__ */ P(R, {
|
|
2972
|
+
ref: C,
|
|
2973
|
+
style: Q.picker,
|
|
2974
|
+
contentContainerStyle: Q.pickerContent,
|
|
2975
|
+
showsVerticalScrollIndicator: !1,
|
|
2976
|
+
children: T.map((e) => /* @__PURE__ */ P(V, {
|
|
2977
|
+
style: [Q.pickerItem, d === e && { backgroundColor: x.primary }],
|
|
2978
|
+
onPress: () => f(e),
|
|
2979
|
+
activeOpacity: .7,
|
|
2980
|
+
children: /* @__PURE__ */ P(B, {
|
|
2981
|
+
style: [
|
|
2982
|
+
Q.pickerItemText,
|
|
2983
|
+
{ color: x.text },
|
|
2984
|
+
d === e && {
|
|
2985
|
+
color: x.background,
|
|
2986
|
+
fontWeight: "600"
|
|
2987
|
+
}
|
|
2988
|
+
],
|
|
2989
|
+
children: String(e).padStart(2, "0")
|
|
2990
|
+
})
|
|
2991
|
+
}, e))
|
|
2992
|
+
})]
|
|
2993
|
+
})
|
|
2994
|
+
]
|
|
2995
|
+
}),
|
|
2996
|
+
/* @__PURE__ */ P(V, {
|
|
2997
|
+
style: [Q.confirmButton, { backgroundColor: x.primary }],
|
|
2998
|
+
onPress: D,
|
|
2999
|
+
activeOpacity: .7,
|
|
3000
|
+
children: /* @__PURE__ */ P(B, {
|
|
3001
|
+
style: [Q.confirmButtonText, { color: x.background }],
|
|
3002
|
+
children: "Confirm"
|
|
3003
|
+
})
|
|
3004
|
+
})
|
|
3005
|
+
]
|
|
3006
|
+
})
|
|
3007
|
+
})
|
|
3008
|
+
}),
|
|
3009
|
+
v && /* @__PURE__ */ P(B, {
|
|
3010
|
+
style: [Q.error, { color: x.error }],
|
|
3011
|
+
children: v
|
|
3012
|
+
}),
|
|
3013
|
+
b && !v && /* @__PURE__ */ P(B, {
|
|
3014
|
+
style: [Q.helperText, { color: x.textMuted }],
|
|
3015
|
+
children: b
|
|
3016
|
+
})
|
|
3017
|
+
]
|
|
3018
|
+
});
|
|
3019
|
+
}, Q = z.create({
|
|
3020
|
+
closeButton: {
|
|
3021
|
+
fontSize: 24,
|
|
3022
|
+
fontWeight: "300"
|
|
3023
|
+
},
|
|
3024
|
+
confirmButton: {
|
|
3025
|
+
alignItems: "center",
|
|
3026
|
+
borderRadius: 6,
|
|
3027
|
+
marginTop: 16,
|
|
3028
|
+
paddingVertical: 12
|
|
3029
|
+
},
|
|
3030
|
+
confirmButtonText: {
|
|
3031
|
+
fontSize: 16,
|
|
3032
|
+
fontWeight: "600"
|
|
3033
|
+
},
|
|
3034
|
+
container: { marginBottom: 16 },
|
|
3035
|
+
error: {
|
|
3036
|
+
fontSize: 12,
|
|
3037
|
+
marginTop: 4
|
|
3038
|
+
},
|
|
3039
|
+
helperText: {
|
|
3040
|
+
fontSize: 12,
|
|
3041
|
+
marginTop: 4
|
|
3042
|
+
},
|
|
3043
|
+
icon: { fontSize: 16 },
|
|
3044
|
+
label: {
|
|
3045
|
+
fontSize: 14,
|
|
3046
|
+
fontWeight: "500",
|
|
3047
|
+
marginBottom: 8
|
|
3048
|
+
},
|
|
3049
|
+
modalContent: {
|
|
3050
|
+
borderRadius: 12,
|
|
3051
|
+
padding: 16,
|
|
3052
|
+
width: "80%"
|
|
3053
|
+
},
|
|
3054
|
+
modalHeader: {
|
|
3055
|
+
alignItems: "center",
|
|
3056
|
+
borderBottomWidth: 1,
|
|
3057
|
+
flexDirection: "row",
|
|
3058
|
+
justifyContent: "space-between",
|
|
3059
|
+
marginBottom: 16,
|
|
3060
|
+
paddingBottom: 12
|
|
3061
|
+
},
|
|
3062
|
+
modalOverlay: {
|
|
3063
|
+
alignItems: "center",
|
|
3064
|
+
backgroundColor: "rgba(0, 0, 0, 0.5)",
|
|
3065
|
+
flex: 1,
|
|
3066
|
+
justifyContent: "center"
|
|
3067
|
+
},
|
|
3068
|
+
modalTitle: {
|
|
3069
|
+
fontSize: 18,
|
|
3070
|
+
fontWeight: "600"
|
|
3071
|
+
},
|
|
3072
|
+
picker: { maxHeight: 200 },
|
|
3073
|
+
pickerColumn: { flex: 1 },
|
|
3074
|
+
pickerContainer: {
|
|
3075
|
+
alignItems: "center",
|
|
3076
|
+
flexDirection: "row",
|
|
3077
|
+
gap: 8
|
|
3078
|
+
},
|
|
3079
|
+
pickerContent: { paddingVertical: 8 },
|
|
3080
|
+
pickerItem: {
|
|
3081
|
+
alignItems: "center",
|
|
3082
|
+
borderRadius: 6,
|
|
3083
|
+
marginVertical: 2,
|
|
3084
|
+
paddingVertical: 10
|
|
3085
|
+
},
|
|
3086
|
+
pickerItemText: { fontSize: 18 },
|
|
3087
|
+
pickerLabel: {
|
|
3088
|
+
fontSize: 12,
|
|
3089
|
+
fontWeight: "600",
|
|
3090
|
+
marginBottom: 8,
|
|
3091
|
+
textAlign: "center"
|
|
3092
|
+
},
|
|
3093
|
+
pickerSeparator: {
|
|
3094
|
+
fontSize: 24,
|
|
3095
|
+
fontWeight: "600"
|
|
3096
|
+
},
|
|
3097
|
+
trigger: {
|
|
3098
|
+
alignItems: "center",
|
|
3099
|
+
borderRadius: 6,
|
|
3100
|
+
borderWidth: 1,
|
|
3101
|
+
flexDirection: "row",
|
|
3102
|
+
justifyContent: "space-between",
|
|
3103
|
+
paddingHorizontal: 12,
|
|
3104
|
+
paddingVertical: 10
|
|
3105
|
+
},
|
|
3106
|
+
triggerText: {
|
|
3107
|
+
flex: 1,
|
|
3108
|
+
fontSize: 14
|
|
3109
|
+
}
|
|
3110
|
+
}), qe = ({ field: e, extra: n }) => {
|
|
3111
|
+
let [r, i] = N(!1), [a, o] = N(!0), { value: s } = e, { node: c, setValue: l, error: u, label: d, helperText: f } = n, { colors: p } = h(), m = t(), g = Array.isArray(s) ? s : [], _ = g[0] || "", v = g[1] || "", y = _.split(":"), b = Number.parseInt(y[0], 10), x = Number.parseInt(y[1], 10), S = Number.isNaN(b) ? 0 : b, C = Number.isNaN(x) ? 0 : x, w = v.split(":"), T = Number.parseInt(w[0], 10), E = Number.parseInt(w[1], 10), D = Number.isNaN(T) ? 0 : T, ee = Number.isNaN(E) ? 0 : E, [O, k] = N(0), [A, j] = N(0), M = Array.from({ length: 24 }, (e, t) => t), ne = Array.from({ length: 60 }, (e, t) => t), re = () => _ && v ? `${_} - ${v}` : _ || m("renderer.defaultInputs.selectDateRange"), ie = te(() => {
|
|
3112
|
+
let e = `${String(O).padStart(2, "0")}:${String(A).padStart(2, "0")}`;
|
|
3113
|
+
a ? (l([e, v]), o(!1), k(D || 0), j(ee || 0)) : (l([_, e]), i(!1), o(!0));
|
|
3114
|
+
}, [
|
|
3115
|
+
a,
|
|
3116
|
+
O,
|
|
3117
|
+
A,
|
|
3118
|
+
_,
|
|
3119
|
+
v,
|
|
3120
|
+
D,
|
|
3121
|
+
ee,
|
|
3122
|
+
l
|
|
3123
|
+
]);
|
|
3124
|
+
return /* @__PURE__ */ F(H, {
|
|
3125
|
+
style: $.container,
|
|
3126
|
+
children: [
|
|
3127
|
+
/* @__PURE__ */ F(B, {
|
|
3128
|
+
style: [$.label, { color: p.textSecondary }],
|
|
3129
|
+
children: [d || c.data.name, c.data.required && /* @__PURE__ */ P(B, {
|
|
3130
|
+
style: { color: p.error },
|
|
3131
|
+
children: "*"
|
|
3132
|
+
})]
|
|
3133
|
+
}),
|
|
3134
|
+
/* @__PURE__ */ F(V, {
|
|
3135
|
+
style: [
|
|
3136
|
+
$.trigger,
|
|
3137
|
+
{
|
|
3138
|
+
backgroundColor: p.input,
|
|
3139
|
+
borderColor: p.border
|
|
3140
|
+
},
|
|
3141
|
+
u && { borderColor: p.error }
|
|
3142
|
+
],
|
|
3143
|
+
onPress: () => {
|
|
3144
|
+
k(S || 0), j(C || 0), o(!0), i(!0);
|
|
3145
|
+
},
|
|
3146
|
+
activeOpacity: .7,
|
|
3147
|
+
children: [/* @__PURE__ */ P(B, {
|
|
3148
|
+
style: [
|
|
3149
|
+
$.triggerText,
|
|
3150
|
+
{ color: p.text },
|
|
3151
|
+
!_ && { color: p.textMuted }
|
|
3152
|
+
],
|
|
3153
|
+
numberOfLines: 1,
|
|
3154
|
+
children: re()
|
|
3155
|
+
}), /* @__PURE__ */ P(B, {
|
|
3156
|
+
style: $.icon,
|
|
3157
|
+
children: "🕐"
|
|
3158
|
+
})]
|
|
3159
|
+
}),
|
|
3160
|
+
/* @__PURE__ */ P(oe, {
|
|
3161
|
+
visible: r,
|
|
3162
|
+
transparent: !0,
|
|
3163
|
+
animationType: "fade",
|
|
3164
|
+
onRequestClose: () => i(!1),
|
|
3165
|
+
children: /* @__PURE__ */ P(V, {
|
|
3166
|
+
style: $.modalOverlay,
|
|
3167
|
+
activeOpacity: 1,
|
|
3168
|
+
onPress: () => i(!1),
|
|
3169
|
+
children: /* @__PURE__ */ F(V, {
|
|
3170
|
+
style: [$.modalContent, { backgroundColor: p.card }],
|
|
3171
|
+
activeOpacity: 1,
|
|
3172
|
+
onPress: () => {},
|
|
3173
|
+
children: [
|
|
3174
|
+
/* @__PURE__ */ F(H, {
|
|
3175
|
+
style: [$.modalHeader, { borderBottomColor: p.separator }],
|
|
3176
|
+
children: [/* @__PURE__ */ P(B, {
|
|
3177
|
+
style: [$.modalTitle, { color: p.text }],
|
|
3178
|
+
children: d || c.data.name
|
|
3179
|
+
}), /* @__PURE__ */ P(V, {
|
|
3180
|
+
onPress: () => i(!1),
|
|
3181
|
+
children: /* @__PURE__ */ P(B, {
|
|
3182
|
+
style: [$.closeButton, { color: p.textMuted }],
|
|
3183
|
+
children: "✕"
|
|
3184
|
+
})
|
|
3185
|
+
})]
|
|
3186
|
+
}),
|
|
3187
|
+
/* @__PURE__ */ P(H, {
|
|
3188
|
+
style: [$.rangeIndicator, { backgroundColor: p.primaryLight }],
|
|
3189
|
+
children: /* @__PURE__ */ P(B, {
|
|
3190
|
+
style: [$.rangeIndicatorText, { color: p.primary }],
|
|
3191
|
+
children: m(a ? "renderer.defaultInputs.startTime" : "renderer.defaultInputs.endTime")
|
|
3192
|
+
})
|
|
3193
|
+
}),
|
|
3194
|
+
/* @__PURE__ */ F(H, {
|
|
3195
|
+
style: $.pickerContainer,
|
|
3196
|
+
children: [
|
|
3197
|
+
/* @__PURE__ */ F(H, {
|
|
3198
|
+
style: $.pickerColumn,
|
|
3199
|
+
children: [/* @__PURE__ */ P(B, {
|
|
3200
|
+
style: [$.pickerLabel, { color: p.textMuted }],
|
|
3201
|
+
children: "Hour"
|
|
3202
|
+
}), /* @__PURE__ */ P(R, {
|
|
3203
|
+
style: $.picker,
|
|
3204
|
+
contentContainerStyle: $.pickerContent,
|
|
3205
|
+
showsVerticalScrollIndicator: !1,
|
|
3206
|
+
children: M.map((e) => /* @__PURE__ */ P(V, {
|
|
3207
|
+
style: [$.pickerItem, O === e && { backgroundColor: p.primary }],
|
|
3208
|
+
onPress: () => k(e),
|
|
3209
|
+
activeOpacity: .7,
|
|
3210
|
+
children: /* @__PURE__ */ P(B, {
|
|
3211
|
+
style: [
|
|
3212
|
+
$.pickerItemText,
|
|
3213
|
+
{ color: p.text },
|
|
3214
|
+
O === e && {
|
|
3215
|
+
color: p.background,
|
|
3216
|
+
fontWeight: "600"
|
|
3217
|
+
}
|
|
3218
|
+
],
|
|
3219
|
+
children: String(e).padStart(2, "0")
|
|
3220
|
+
})
|
|
3221
|
+
}, e))
|
|
3222
|
+
})]
|
|
3223
|
+
}),
|
|
3224
|
+
/* @__PURE__ */ P(B, {
|
|
3225
|
+
style: [$.pickerSeparator, { color: p.text }],
|
|
3226
|
+
children: ":"
|
|
3227
|
+
}),
|
|
3228
|
+
/* @__PURE__ */ F(H, {
|
|
3229
|
+
style: $.pickerColumn,
|
|
3230
|
+
children: [/* @__PURE__ */ P(B, {
|
|
3231
|
+
style: [$.pickerLabel, { color: p.textMuted }],
|
|
3232
|
+
children: "Minute"
|
|
3233
|
+
}), /* @__PURE__ */ P(R, {
|
|
3234
|
+
style: $.picker,
|
|
3235
|
+
contentContainerStyle: $.pickerContent,
|
|
3236
|
+
showsVerticalScrollIndicator: !1,
|
|
3237
|
+
children: ne.map((e) => /* @__PURE__ */ P(V, {
|
|
3238
|
+
style: [$.pickerItem, A === e && { backgroundColor: p.primary }],
|
|
3239
|
+
onPress: () => j(e),
|
|
3240
|
+
activeOpacity: .7,
|
|
3241
|
+
children: /* @__PURE__ */ P(B, {
|
|
3242
|
+
style: [
|
|
3243
|
+
$.pickerItemText,
|
|
3244
|
+
{ color: p.text },
|
|
3245
|
+
A === e && {
|
|
3246
|
+
color: p.background,
|
|
3247
|
+
fontWeight: "600"
|
|
3248
|
+
}
|
|
3249
|
+
],
|
|
3250
|
+
children: String(e).padStart(2, "0")
|
|
3251
|
+
})
|
|
3252
|
+
}, e))
|
|
3253
|
+
})]
|
|
3254
|
+
})
|
|
3255
|
+
]
|
|
3256
|
+
}),
|
|
3257
|
+
/* @__PURE__ */ P(V, {
|
|
3258
|
+
style: [$.confirmButton, { backgroundColor: p.primary }],
|
|
3259
|
+
onPress: ie,
|
|
3260
|
+
activeOpacity: .7,
|
|
3261
|
+
children: /* @__PURE__ */ P(B, {
|
|
3262
|
+
style: [$.confirmButtonText, { color: p.background }],
|
|
3263
|
+
children: a ? "Next" : "Confirm"
|
|
3264
|
+
})
|
|
3265
|
+
})
|
|
3266
|
+
]
|
|
3267
|
+
})
|
|
3268
|
+
})
|
|
3269
|
+
}),
|
|
3270
|
+
u && /* @__PURE__ */ P(B, {
|
|
3271
|
+
style: [$.error, { color: p.error }],
|
|
3272
|
+
children: u
|
|
3273
|
+
}),
|
|
3274
|
+
f && !u && /* @__PURE__ */ P(B, {
|
|
3275
|
+
style: [$.helperText, { color: p.textMuted }],
|
|
3276
|
+
children: f
|
|
3277
|
+
})
|
|
3278
|
+
]
|
|
3279
|
+
});
|
|
3280
|
+
}, $ = z.create({
|
|
3281
|
+
closeButton: {
|
|
3282
|
+
fontSize: 24,
|
|
3283
|
+
fontWeight: "300"
|
|
3284
|
+
},
|
|
3285
|
+
confirmButton: {
|
|
3286
|
+
alignItems: "center",
|
|
3287
|
+
borderRadius: 6,
|
|
3288
|
+
marginTop: 16,
|
|
3289
|
+
paddingVertical: 12
|
|
3290
|
+
},
|
|
3291
|
+
confirmButtonText: {
|
|
3292
|
+
fontSize: 16,
|
|
3293
|
+
fontWeight: "600"
|
|
3294
|
+
},
|
|
3295
|
+
container: { marginBottom: 16 },
|
|
3296
|
+
error: {
|
|
3297
|
+
fontSize: 12,
|
|
3298
|
+
marginTop: 4
|
|
3299
|
+
},
|
|
3300
|
+
helperText: {
|
|
3301
|
+
fontSize: 12,
|
|
3302
|
+
marginTop: 4
|
|
3303
|
+
},
|
|
3304
|
+
icon: { fontSize: 16 },
|
|
3305
|
+
label: {
|
|
3306
|
+
fontSize: 14,
|
|
3307
|
+
fontWeight: "500",
|
|
3308
|
+
marginBottom: 8
|
|
3309
|
+
},
|
|
3310
|
+
modalContent: {
|
|
3311
|
+
borderRadius: 12,
|
|
3312
|
+
padding: 16,
|
|
3313
|
+
width: "80%"
|
|
3314
|
+
},
|
|
3315
|
+
modalHeader: {
|
|
3316
|
+
alignItems: "center",
|
|
3317
|
+
borderBottomWidth: 1,
|
|
3318
|
+
flexDirection: "row",
|
|
3319
|
+
justifyContent: "space-between",
|
|
3320
|
+
marginBottom: 12,
|
|
3321
|
+
paddingBottom: 12
|
|
3322
|
+
},
|
|
3323
|
+
modalOverlay: {
|
|
3324
|
+
alignItems: "center",
|
|
3325
|
+
backgroundColor: "rgba(0, 0, 0, 0.5)",
|
|
3326
|
+
flex: 1,
|
|
3327
|
+
justifyContent: "center"
|
|
3328
|
+
},
|
|
3329
|
+
modalTitle: {
|
|
3330
|
+
fontSize: 18,
|
|
3331
|
+
fontWeight: "600"
|
|
3332
|
+
},
|
|
3333
|
+
picker: { maxHeight: 200 },
|
|
3334
|
+
pickerColumn: { flex: 1 },
|
|
3335
|
+
pickerContainer: {
|
|
3336
|
+
alignItems: "center",
|
|
3337
|
+
flexDirection: "row",
|
|
3338
|
+
gap: 8
|
|
3339
|
+
},
|
|
3340
|
+
pickerContent: { paddingVertical: 8 },
|
|
3341
|
+
pickerItem: {
|
|
3342
|
+
alignItems: "center",
|
|
3343
|
+
borderRadius: 6,
|
|
3344
|
+
marginVertical: 2,
|
|
3345
|
+
paddingVertical: 10
|
|
3346
|
+
},
|
|
3347
|
+
pickerItemText: { fontSize: 18 },
|
|
3348
|
+
pickerLabel: {
|
|
3349
|
+
fontSize: 12,
|
|
3350
|
+
fontWeight: "600",
|
|
3351
|
+
marginBottom: 8,
|
|
3352
|
+
textAlign: "center"
|
|
3353
|
+
},
|
|
3354
|
+
pickerSeparator: {
|
|
3355
|
+
fontSize: 24,
|
|
3356
|
+
fontWeight: "600"
|
|
3357
|
+
},
|
|
3358
|
+
rangeIndicator: {
|
|
3359
|
+
alignItems: "center",
|
|
3360
|
+
borderRadius: 6,
|
|
3361
|
+
marginBottom: 12,
|
|
3362
|
+
paddingVertical: 8
|
|
3363
|
+
},
|
|
3364
|
+
rangeIndicatorText: {
|
|
3365
|
+
fontSize: 14,
|
|
3366
|
+
fontWeight: "600"
|
|
3367
|
+
},
|
|
3368
|
+
trigger: {
|
|
3369
|
+
alignItems: "center",
|
|
3370
|
+
borderRadius: 6,
|
|
3371
|
+
borderWidth: 1,
|
|
3372
|
+
flexDirection: "row",
|
|
3373
|
+
justifyContent: "space-between",
|
|
3374
|
+
paddingHorizontal: 12,
|
|
3375
|
+
paddingVertical: 10
|
|
3376
|
+
},
|
|
3377
|
+
triggerText: {
|
|
3378
|
+
flex: 1,
|
|
3379
|
+
fontSize: 14
|
|
3380
|
+
}
|
|
3381
|
+
}), Je = {
|
|
3382
|
+
address: pe,
|
|
3383
|
+
autocomplete: ge,
|
|
3384
|
+
checkbox: _e,
|
|
3385
|
+
date: ve,
|
|
3386
|
+
daterange: ye,
|
|
3387
|
+
file: be,
|
|
3388
|
+
hidden: xe,
|
|
3389
|
+
http: Me,
|
|
3390
|
+
number: Ne,
|
|
3391
|
+
password: Fe,
|
|
3392
|
+
radio: Le,
|
|
3393
|
+
select: Re,
|
|
3394
|
+
submit: ze,
|
|
3395
|
+
switch: Be,
|
|
3396
|
+
text: We,
|
|
3397
|
+
textarea: He,
|
|
3398
|
+
time: Ke,
|
|
3399
|
+
timerange: qe
|
|
3400
|
+
}, Ye = ({ step: e, label: n, children: r, canGoBack: a, isLastStep: o, canContinue: s, isSubmitting: c, onBack: l, onContinue: u }) => {
|
|
3401
|
+
let { colors: d } = h(), f = t(), p = !s || c, m = e.nodes.find((e) => i(e) && e.data.type === "submit"), g = m && i(m) ? f(m.data.label) : void 0, _ = o ? g || f("renderer.defaultSubmitButton.submit") : f("renderer.step.continue");
|
|
3402
|
+
return /* @__PURE__ */ F(H, { children: [
|
|
3403
|
+
n ? /* @__PURE__ */ P(B, {
|
|
3404
|
+
style: [Xe.label, { color: d.text }],
|
|
3405
|
+
children: n
|
|
3406
|
+
}) : null,
|
|
3407
|
+
/* @__PURE__ */ P(H, {
|
|
3408
|
+
style: Xe.content,
|
|
3409
|
+
children: r
|
|
3410
|
+
}),
|
|
3411
|
+
/* @__PURE__ */ F(H, {
|
|
3412
|
+
style: Xe.actions,
|
|
3413
|
+
children: [a ? /* @__PURE__ */ P(V, {
|
|
3414
|
+
style: [
|
|
3415
|
+
Xe.backButton,
|
|
3416
|
+
{ borderColor: d.border },
|
|
3417
|
+
c && Xe.disabled
|
|
3418
|
+
],
|
|
3419
|
+
onPress: l,
|
|
3420
|
+
disabled: c,
|
|
3421
|
+
activeOpacity: .7,
|
|
3422
|
+
children: /* @__PURE__ */ P(B, {
|
|
3423
|
+
style: [Xe.backButtonText, { color: d.text }],
|
|
3424
|
+
children: f("renderer.step.back")
|
|
3425
|
+
})
|
|
3426
|
+
}) : /* @__PURE__ */ P(H, {}), /* @__PURE__ */ P(V, {
|
|
3427
|
+
style: [
|
|
3428
|
+
Xe.continueButton,
|
|
3429
|
+
{ backgroundColor: d.primary },
|
|
3430
|
+
p && {
|
|
3431
|
+
backgroundColor: d.primaryDisabled,
|
|
3432
|
+
opacity: .6
|
|
3433
|
+
}
|
|
3434
|
+
],
|
|
3435
|
+
onPress: u,
|
|
3436
|
+
disabled: p,
|
|
3437
|
+
activeOpacity: .7,
|
|
3438
|
+
children: c ? /* @__PURE__ */ P(re, { color: d.primaryForeground }) : /* @__PURE__ */ P(B, {
|
|
3439
|
+
style: [Xe.continueButtonText, { color: d.primaryForeground }],
|
|
3440
|
+
children: _
|
|
3441
|
+
})
|
|
3442
|
+
})]
|
|
3443
|
+
})
|
|
3444
|
+
] });
|
|
3445
|
+
}, Xe = z.create({
|
|
3446
|
+
actions: {
|
|
3447
|
+
alignItems: "center",
|
|
3448
|
+
flexDirection: "row",
|
|
3449
|
+
justifyContent: "space-between",
|
|
3450
|
+
marginTop: 24
|
|
3451
|
+
},
|
|
3452
|
+
backButton: {
|
|
3453
|
+
borderRadius: 6,
|
|
3454
|
+
borderWidth: 1,
|
|
3455
|
+
paddingHorizontal: 16,
|
|
3456
|
+
paddingVertical: 10
|
|
3457
|
+
},
|
|
3458
|
+
backButtonText: {
|
|
3459
|
+
fontSize: 14,
|
|
3460
|
+
fontWeight: "500"
|
|
3461
|
+
},
|
|
3462
|
+
content: { gap: 8 },
|
|
3463
|
+
continueButton: {
|
|
3464
|
+
alignItems: "center",
|
|
3465
|
+
borderRadius: 6,
|
|
3466
|
+
justifyContent: "center",
|
|
3467
|
+
paddingHorizontal: 24,
|
|
3468
|
+
paddingVertical: 12
|
|
3469
|
+
},
|
|
3470
|
+
continueButtonText: {
|
|
3471
|
+
fontSize: 14,
|
|
3472
|
+
fontWeight: "600"
|
|
3473
|
+
},
|
|
3474
|
+
disabled: { opacity: .5 },
|
|
3475
|
+
label: {
|
|
3476
|
+
fontSize: 16,
|
|
3477
|
+
fontWeight: "600",
|
|
3478
|
+
marginBottom: 12
|
|
3479
|
+
}
|
|
3480
|
+
}), Ze = ({ children: e = "Submit", disabled: t, isSubmitting: n, onPress: r }) => {
|
|
3481
|
+
let { colors: i } = h();
|
|
3482
|
+
return /* @__PURE__ */ P(V, {
|
|
3483
|
+
style: [
|
|
3484
|
+
Qe.button,
|
|
3485
|
+
{ backgroundColor: i.primary },
|
|
3486
|
+
(t || n) && {
|
|
3487
|
+
backgroundColor: i.primaryDisabled,
|
|
3488
|
+
opacity: .6
|
|
3489
|
+
}
|
|
3490
|
+
],
|
|
3491
|
+
disabled: t || n,
|
|
3492
|
+
onPress: r,
|
|
3493
|
+
activeOpacity: .7,
|
|
3494
|
+
children: n ? /* @__PURE__ */ P(re, { color: i.primaryForeground }) : /* @__PURE__ */ P(B, {
|
|
3495
|
+
style: [Qe.buttonText, { color: i.primaryForeground }],
|
|
3496
|
+
children: e
|
|
3497
|
+
})
|
|
3498
|
+
});
|
|
3499
|
+
}, Qe = z.create({
|
|
3500
|
+
button: {
|
|
3501
|
+
alignItems: "center",
|
|
3502
|
+
borderRadius: 6,
|
|
3503
|
+
justifyContent: "center",
|
|
3504
|
+
marginTop: 16,
|
|
3505
|
+
paddingHorizontal: 24,
|
|
3506
|
+
paddingVertical: 12
|
|
3507
|
+
},
|
|
3508
|
+
buttonText: {
|
|
3509
|
+
fontSize: 16,
|
|
3510
|
+
fontWeight: "600"
|
|
3511
|
+
}
|
|
3512
|
+
}), $e = ({ children: e }) => e, et = ({ node: e }) => {
|
|
3513
|
+
let n = t(), { colors: r } = h(), i = n(e.data?.label);
|
|
3514
|
+
return /* @__PURE__ */ P(B, {
|
|
3515
|
+
style: [nt.title, { color: r.text }],
|
|
3516
|
+
children: i
|
|
3517
|
+
});
|
|
3518
|
+
}, tt = () => {
|
|
3519
|
+
let { colors: e } = h();
|
|
3520
|
+
return /* @__PURE__ */ P(H, { style: [nt.divider, { backgroundColor: e.separator }] });
|
|
3521
|
+
}, nt = z.create({
|
|
3522
|
+
divider: {
|
|
3523
|
+
height: 1,
|
|
3524
|
+
marginBottom: 16,
|
|
3525
|
+
marginTop: 0
|
|
3526
|
+
},
|
|
3527
|
+
title: {
|
|
3528
|
+
fontSize: 20,
|
|
3529
|
+
fontWeight: "700",
|
|
3530
|
+
marginBottom: 16
|
|
3531
|
+
}
|
|
3532
|
+
}), rt = {
|
|
3533
|
+
divider: tt,
|
|
3534
|
+
title: et
|
|
3535
|
+
}, it = ({ node: e, children: t }) => {
|
|
3536
|
+
let { image: n } = e.data;
|
|
3537
|
+
return /* @__PURE__ */ F(H, { children: [n && /* @__PURE__ */ P(L, {
|
|
3538
|
+
source: { uri: n },
|
|
3539
|
+
style: at.image,
|
|
3540
|
+
resizeMode: "cover"
|
|
3541
|
+
}), t] });
|
|
3542
|
+
}, at = z.create({ image: {
|
|
3543
|
+
borderRadius: 6,
|
|
3544
|
+
height: 160,
|
|
3545
|
+
marginBottom: 8,
|
|
3546
|
+
width: "100%"
|
|
3547
|
+
} }), ot = ({ style: e }) => {
|
|
3548
|
+
let { colors: t } = h(), n = M(new I.Value(.5)).current;
|
|
3549
|
+
return A(() => {
|
|
3550
|
+
let e = I.loop(I.sequence([I.timing(n, {
|
|
3551
|
+
duration: 600,
|
|
3552
|
+
toValue: 1,
|
|
3553
|
+
useNativeDriver: !0
|
|
3554
|
+
}), I.timing(n, {
|
|
3555
|
+
duration: 600,
|
|
3556
|
+
toValue: .5,
|
|
3557
|
+
useNativeDriver: !0
|
|
3558
|
+
})]));
|
|
3559
|
+
return e.start(), () => e.stop();
|
|
3560
|
+
}, [n]), /* @__PURE__ */ P(I.View, { style: [
|
|
3561
|
+
ct.bar,
|
|
3562
|
+
{
|
|
3563
|
+
backgroundColor: t.muted,
|
|
3564
|
+
opacity: n
|
|
3565
|
+
},
|
|
3566
|
+
e
|
|
3567
|
+
] });
|
|
3568
|
+
}, st = () => /* @__PURE__ */ F(H, {
|
|
3569
|
+
accessibilityState: { busy: !0 },
|
|
3570
|
+
children: [
|
|
3571
|
+
/* @__PURE__ */ P(ot, { style: ct.title }),
|
|
3572
|
+
/* @__PURE__ */ P(H, {
|
|
3573
|
+
style: ct.fields,
|
|
3574
|
+
children: [
|
|
3575
|
+
0,
|
|
3576
|
+
1,
|
|
3577
|
+
2
|
|
3578
|
+
].map((e) => /* @__PURE__ */ F(H, {
|
|
3579
|
+
style: ct.field,
|
|
3580
|
+
children: [/* @__PURE__ */ P(ot, { style: ct.fieldLabel }), /* @__PURE__ */ P(ot, { style: ct.fieldInput })]
|
|
3581
|
+
}, e))
|
|
3582
|
+
}),
|
|
3583
|
+
/* @__PURE__ */ P(H, {
|
|
3584
|
+
style: ct.actions,
|
|
3585
|
+
children: /* @__PURE__ */ P(ot, { style: ct.button })
|
|
3586
|
+
})
|
|
3587
|
+
]
|
|
3588
|
+
}), ct = z.create({
|
|
3589
|
+
actions: {
|
|
3590
|
+
alignItems: "flex-end",
|
|
3591
|
+
marginTop: 24
|
|
3592
|
+
},
|
|
3593
|
+
bar: { borderRadius: 6 },
|
|
3594
|
+
button: {
|
|
3595
|
+
height: 44,
|
|
3596
|
+
width: 120
|
|
3597
|
+
},
|
|
3598
|
+
field: { gap: 8 },
|
|
3599
|
+
fieldInput: {
|
|
3600
|
+
height: 44,
|
|
3601
|
+
width: "100%"
|
|
3602
|
+
},
|
|
3603
|
+
fieldLabel: {
|
|
3604
|
+
height: 16,
|
|
3605
|
+
width: "25%"
|
|
3606
|
+
},
|
|
3607
|
+
fields: { gap: 24 },
|
|
3608
|
+
title: {
|
|
3609
|
+
height: 24,
|
|
3610
|
+
marginBottom: 24,
|
|
3611
|
+
width: "33%"
|
|
3612
|
+
}
|
|
3613
|
+
}), lt = ({ baseUrl: t, components: n, contentContainerStyle: r, flow: i, googleApiKey: a, headers: o, initialValues: s, isLoading: c = !1, isSubmitting: l = !1, language: u, onBack: d, onChange: f, onSubmit: p, showPoweredBy: m, style: g, theme: _, validate: v, validationMode: y }) => {
|
|
3614
|
+
let { colors: b } = h(), { canContinueStep: x, canSubmit: S, clearSubmitMessage: C, config: w, currentStep: T, currentStepGroupNode: D, currentStepIndex: ee, formErrors: O, formValues: A, goToNextStep: M, goToPreviousStep: N, handleSubmit: ne, inputNodes: re, isFirstStep: ie, isLastStep: I, isSubmitting: ae, missingRequiredFields: L, setFieldValue: oe, steps: z, submitMessage: se, t: ce } = E({
|
|
3615
|
+
baseUrl: t,
|
|
3616
|
+
components: n,
|
|
3617
|
+
flow: i,
|
|
3618
|
+
googleApiKey: a,
|
|
3619
|
+
headers: o,
|
|
3620
|
+
initialValues: s,
|
|
3621
|
+
language: u,
|
|
3622
|
+
onChange: f,
|
|
3623
|
+
onSubmit: p,
|
|
3624
|
+
showPoweredBy: m,
|
|
3625
|
+
theme: _,
|
|
3626
|
+
validate: v,
|
|
3627
|
+
validationMode: y
|
|
3628
|
+
}), V = l || ae, { FormWrapper: ue, SubmitButtonWrapper: de, renderNode: fe } = k({
|
|
3629
|
+
config: w,
|
|
3630
|
+
DefaultFormWrapper: le,
|
|
3631
|
+
DefaultInputWrapper: it,
|
|
3632
|
+
DefaultSubmitButton: Ze,
|
|
3633
|
+
DefaultSubmitButtonWrapper: $e,
|
|
3634
|
+
defaultInputRenderers: Je,
|
|
3635
|
+
defaultUI: rt,
|
|
3636
|
+
formErrors: O,
|
|
3637
|
+
formValues: A,
|
|
3638
|
+
inputNodes: re,
|
|
3639
|
+
isSubmitting: V,
|
|
3640
|
+
missingRequiredFields: L,
|
|
3641
|
+
setFieldValue: oe
|
|
3642
|
+
}), pe = w.components.step ?? Ye, U = w.components.loadingSkeleton ?? st, me = j(() => ce(D?.data?.label), [ce, D]), he = te(() => {
|
|
3643
|
+
if (I) {
|
|
3644
|
+
ne();
|
|
3645
|
+
return;
|
|
3646
|
+
}
|
|
3647
|
+
M();
|
|
3648
|
+
}, [
|
|
3649
|
+
I,
|
|
3650
|
+
ne,
|
|
3651
|
+
M
|
|
3652
|
+
]), ge = te(() => {
|
|
3653
|
+
if (ie) {
|
|
3654
|
+
d?.();
|
|
3655
|
+
return;
|
|
3656
|
+
}
|
|
3657
|
+
N();
|
|
3658
|
+
}, [
|
|
3659
|
+
ie,
|
|
3660
|
+
d,
|
|
3661
|
+
N
|
|
3662
|
+
]), W = !ie || !!d;
|
|
3663
|
+
return /* @__PURE__ */ P(R, {
|
|
3664
|
+
nestedScrollEnabled: !0,
|
|
3665
|
+
style: [
|
|
3666
|
+
dt.container,
|
|
3667
|
+
{ backgroundColor: b.background },
|
|
3668
|
+
g
|
|
3669
|
+
],
|
|
3670
|
+
contentContainerStyle: r,
|
|
3671
|
+
children: c ? /* @__PURE__ */ P(U, {}) : /* @__PURE__ */ F(e, {
|
|
3672
|
+
value: {
|
|
3673
|
+
baseUrl: w.baseUrl,
|
|
3674
|
+
flow: i,
|
|
3675
|
+
formErrors: O,
|
|
3676
|
+
formValues: A,
|
|
3677
|
+
googleApiKey: w.googleApiKey,
|
|
3678
|
+
headers: w.headers,
|
|
3679
|
+
inputNodes: re,
|
|
3680
|
+
language: w.language,
|
|
3681
|
+
setFieldValue: oe
|
|
3682
|
+
},
|
|
3683
|
+
children: [/* @__PURE__ */ F(ue, {
|
|
3684
|
+
onSubmit: ne,
|
|
3685
|
+
children: [T && /* @__PURE__ */ P(de, {
|
|
3686
|
+
missingFields: L,
|
|
3687
|
+
children: /* @__PURE__ */ P(pe, {
|
|
3688
|
+
step: T,
|
|
3689
|
+
groupNode: D,
|
|
3690
|
+
stepIndex: ee,
|
|
3691
|
+
totalSteps: z.length,
|
|
3692
|
+
isFirstStep: ie,
|
|
3693
|
+
isLastStep: I,
|
|
3694
|
+
canContinue: x && (!I || S),
|
|
3695
|
+
canGoBack: W,
|
|
3696
|
+
isSubmitting: V,
|
|
3697
|
+
onBack: ge,
|
|
3698
|
+
onContinue: he,
|
|
3699
|
+
label: me,
|
|
3700
|
+
children: T.nodes.map((e) => fe(e))
|
|
3701
|
+
})
|
|
3702
|
+
}), w.showPoweredBy && /* @__PURE__ */ P(B, {
|
|
3703
|
+
style: [dt.poweredBy, { color: b.textMuted }],
|
|
3704
|
+
children: "Powered by Treege"
|
|
3705
|
+
})]
|
|
3706
|
+
}), se && /* @__PURE__ */ F(H, {
|
|
3707
|
+
style: [dt.message, { backgroundColor: se.type === "success" ? b.successBg : b.errorBg }],
|
|
3708
|
+
children: [/* @__PURE__ */ P(B, {
|
|
3709
|
+
style: [dt.messageText, { color: se.type === "success" ? b.success : b.error }],
|
|
3710
|
+
children: se.message
|
|
3711
|
+
}), /* @__PURE__ */ P(B, {
|
|
3712
|
+
style: [dt.messageClose, { color: se.type === "success" ? b.success : b.error }],
|
|
3713
|
+
onPress: C,
|
|
3714
|
+
children: ce("common.close")
|
|
3715
|
+
})]
|
|
3716
|
+
})]
|
|
3717
|
+
})
|
|
3718
|
+
});
|
|
3719
|
+
}, ut = (e) => /* @__PURE__ */ P(b, {
|
|
3720
|
+
theme: e.theme,
|
|
3721
|
+
storageKey: "treege-renderer-theme",
|
|
3722
|
+
children: /* @__PURE__ */ P(lt, { ...e })
|
|
3723
|
+
}), dt = z.create({
|
|
3724
|
+
container: { flex: 1 },
|
|
3725
|
+
message: {
|
|
3726
|
+
borderRadius: 6,
|
|
3727
|
+
marginVertical: 16,
|
|
3728
|
+
padding: 16
|
|
3729
|
+
},
|
|
3730
|
+
messageClose: {
|
|
3731
|
+
fontSize: 14,
|
|
3732
|
+
marginTop: 8,
|
|
3733
|
+
textDecorationLine: "underline"
|
|
3734
|
+
},
|
|
3735
|
+
messageText: {
|
|
3736
|
+
fontSize: 14,
|
|
3737
|
+
fontWeight: "500"
|
|
3738
|
+
},
|
|
3739
|
+
poweredBy: {
|
|
3740
|
+
fontSize: 12,
|
|
3741
|
+
paddingVertical: 8,
|
|
3742
|
+
textAlign: "right"
|
|
3743
|
+
}
|
|
3744
|
+
});
|
|
3745
|
+
//#endregion
|
|
3746
|
+
export { pe as DefaultAddressInput, ge as DefaultAutocompleteInput, _e as DefaultCheckboxInput, ve as DefaultDateInput, ye as DefaultDateRangeInput, tt as DefaultDividerUI, be as DefaultFileInput, xe as DefaultHiddenInput, Me as DefaultHttpInput, Ne as DefaultNumberInput, Fe as DefaultPasswordInput, Le as DefaultRadioInput, Re as DefaultSelectInput, Be as DefaultSwitchInput, We as DefaultTextInput, He as DefaultTextareaInput, Ke as DefaultTimeInput, qe as DefaultTimeRangeInput, et as DefaultTitleUI, ut as TreegeRenderer, C as TreegeRendererProvider, v as applyReferenceTransformation, f as buildInitialFormValues, c as calculateReferenceFieldUpdates, g as checkFormFieldHasValue, y as convertFormValuesToNamedFormat, Je as defaultInputRenderers, rt as defaultUI, D as evaluateCondition, O as evaluateConditions, _ as fileToSerializable, m as filesToSerializable, ee as findStartNode, w as getFlowRenderState, r as getTranslatedText, u as isFieldEmpty, S as isStartNode, Ee as sanitize, Oe as sanitizeHttpResponse, d as serializableToFile, E as useTreegeRenderer, T as useTreegeRendererConfig };
|