@cntrl-site/components 1.0.101 → 1.0.102
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/README.md +25 -1
- package/dist/Burger-C6jI6C1c.js +661 -0
- package/dist/Burger-EMSn7TPB.mjs +1807 -0
- package/dist/ClickGallerie-D_O1XhAO.mjs +270 -0
- package/dist/ClickGallerie-M9xdGR1G.js +36 -0
- package/dist/Components/Burger/BurgerComponent.d.ts +0 -1
- package/dist/Components/ClickGallerie/ClickGallerieComponent.d.ts +0 -1
- package/dist/Components/FAQ/FAQComponent.d.ts +0 -1
- package/dist/Components/Form/FormComponent.d.ts +0 -1
- package/dist/Components/Grid/GridComponent.d.ts +0 -1
- package/dist/Components/Helix/HelixComponent.d.ts +0 -1
- package/dist/Components/Hive/HiveComponent.d.ts +0 -1
- package/dist/Components/LightboxJournal/LightboxJournalComponent.d.ts +0 -1
- package/dist/Components/LightboxStrip/LightboxStripComponent.d.ts +0 -1
- package/dist/Components/List/ListComponent.d.ts +0 -1
- package/dist/Components/Marquee/MarqueeComponent.d.ts +0 -1
- package/dist/Components/MarqueeText/MarqueeTextComponent.d.ts +0 -1
- package/dist/Components/Mercury/MercuryComponent.d.ts +0 -1
- package/dist/Components/OnelinerForm/OnelinerFormComponent.d.ts +0 -1
- package/dist/Components/Pretext/PretextComponent.d.ts +0 -1
- package/dist/Components/Scale/ScaleComponent.d.ts +0 -1
- package/dist/Components/SimpleButton/SimpleButtonComponent.d.ts +0 -1
- package/dist/Components/Slider20/Slider20Component.d.ts +0 -1
- package/dist/Components/TestimonialGrid/TestimonialGridComponent.d.ts +0 -1
- package/dist/Components/TestimonialSingle/TestimonialSingleComponent.d.ts +0 -1
- package/dist/Components/Waterfall/WaterfallComponent.d.ts +0 -1
- package/dist/ControlSlider-SiOt22l_.js +1 -0
- package/dist/ControlSlider-pZv7H6BU.mjs +334 -0
- package/dist/FAQ-C7823fyi.js +166 -0
- package/dist/FAQ-CZ39u4m8.mjs +588 -0
- package/dist/Form-BX5_41nb.mjs +472 -0
- package/dist/Form-Dn-6A1He.js +153 -0
- package/dist/Grid-CemGhf3F.js +374 -0
- package/dist/Grid-cfQsXW3b.mjs +1553 -0
- package/dist/Helix-2Vr-9WBa.js +43 -0
- package/dist/Helix-BmkAKT1G.mjs +315 -0
- package/dist/Hive-BC6zQBsv.js +321 -0
- package/dist/Hive-BGMWinrW.mjs +1425 -0
- package/dist/HiveLightboxTitles-DhEeFKWs.mjs +507 -0
- package/dist/HiveLightboxTitles-DlyptAaK.js +1 -0
- package/dist/ImageRevealSlider-BBWtFjUF.js +1 -0
- package/dist/ImageRevealSlider-BdFGyVEP.mjs +184 -0
- package/dist/Lightbox-CIss_nOG.js +1 -0
- package/dist/Lightbox-eP9qAZzL.mjs +665 -0
- package/dist/LightboxJournal-D59ex6wH.mjs +1613 -0
- package/dist/LightboxJournal-DAEZOPDi.js +523 -0
- package/dist/LightboxStrip-BDjI1jyH.js +386 -0
- package/dist/LightboxStrip-YspzBP8N.mjs +1574 -0
- package/dist/List-C32WImI3.js +377 -0
- package/dist/List-DW7fyJbf.mjs +1891 -0
- package/dist/Marquee-BYClHHws.mjs +551 -0
- package/dist/Marquee-vmHaTGIP.js +133 -0
- package/dist/MarqueeText-4Rip_sQX.mjs +515 -0
- package/dist/MarqueeText-E6OubMOG.js +132 -0
- package/dist/Mercury-BwF_XW2w.js +267 -0
- package/dist/Mercury-DuKJQ1Zo.mjs +1701 -0
- package/dist/OnelinerForm-BEu7_sho.mjs +434 -0
- package/dist/OnelinerForm-C2Y_XMCY.js +194 -0
- package/dist/Pretext-10CcyP1E.mjs +2762 -0
- package/dist/Pretext-DvQ3xsni.js +231 -0
- package/dist/PretextComponent-C3YFICy8.js +1 -0
- package/dist/PretextComponent-Ct0newmn.mjs +11624 -0
- package/dist/RichTextRenderer-B6WtTYlR.mjs +32 -0
- package/dist/RichTextRenderer-CIy6yI8U.js +1 -0
- package/dist/Scale-976sjO8e.js +111 -0
- package/dist/Scale-rLNT4KAk.mjs +345 -0
- package/dist/SimpleButton-C-o2W9bS.mjs +451 -0
- package/dist/SimpleButton-nGEcO2gB.js +243 -0
- package/dist/Slider20-C9o2REDl.js +272 -0
- package/dist/Slider20-Dm8BeCli.mjs +851 -0
- package/dist/SvgImage-B5mR9y6q.mjs +51 -0
- package/dist/SvgImage-DFlmxAoL.js +1 -0
- package/dist/TestimonialGrid-CPu4qQ6B.mjs +492 -0
- package/dist/TestimonialGrid-D4ieiz9e.js +90 -0
- package/dist/TestimonialSingle-CVu15ZtV.js +125 -0
- package/dist/TestimonialSingle-DLdnAVF7.mjs +391 -0
- package/dist/Waterfall-A0FjM2my.mjs +1400 -0
- package/dist/Waterfall-DnPDHbCL.js +287 -0
- package/dist/buildColorVars-CE2D5cQV.js +1 -0
- package/dist/buildColorVars-CLyWQm5K.mjs +21 -0
- package/dist/components-OE3ac1dr.js +1 -0
- package/dist/components-w-jHX-2U.mjs +2053 -0
- package/dist/components.css +1 -1
- package/dist/elements.d.ts +7 -0
- package/dist/elements.js +1 -0
- package/dist/elements.mjs +63 -0
- package/dist/elements.node.d.ts +6 -0
- package/dist/elements.node.js +1 -0
- package/dist/elements.node.mjs +21 -0
- package/dist/forking.d.ts +1 -0
- package/dist/formFieldValidation-DZl2KVaF.js +1 -0
- package/dist/formFieldValidation-DvihFrq5.mjs +21 -0
- package/dist/getColorAlpha-BVBY0N5x.mjs +39 -0
- package/dist/getColorAlpha-CoSseoCn.js +1 -0
- package/dist/getImageRect-BQhQXvT8.js +1 -0
- package/dist/getImageRect-CBMhFNHM.mjs +109 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -28862
- package/dist/index.mjs +16 -62473
- package/dist/loadSvgMaskUrl-DfF7ay6h.js +1 -0
- package/dist/loadSvgMaskUrl-xHgGYgPe.mjs +20 -0
- package/dist/panelAvailability-D179wwJx.mjs +27 -0
- package/dist/panelAvailability-DnOe0rQ4.js +1 -0
- package/dist/react-splide.esm-CabaEmHi.js +6 -0
- package/dist/react-splide.esm-DQqds4PL.mjs +1750 -0
- package/dist/readTestimonialTextMeasure-BIXpGFEt.mjs +13 -0
- package/dist/readTestimonialTextMeasure-CEPaB4Sy.js +1 -0
- package/dist/scalingValue-C9JH5L6O.mjs +6 -0
- package/dist/scalingValue-CSHYgTZl.js +1 -0
- package/dist/sources.d.ts +1 -0
- package/dist/sources.js +23753 -0
- package/dist/sources.mjs +23779 -0
- package/dist/textStylesToCss-05Mn6I_2.mjs +32 -0
- package/dist/textStylesToCss-CNN3zZTV.js +1 -0
- package/dist/types/Component.d.ts +0 -1
- package/dist/useLightboxScrollLock-Hf16Eq4g.js +1 -0
- package/dist/useLightboxScrollLock-VQ07s7EJ.mjs +18 -0
- package/dist/useLightboxSwipeDismiss-Br9uE5G0.js +1 -0
- package/dist/useLightboxSwipeDismiss-SGv6Ra33.mjs +95 -0
- package/dist/useScopedStyles-Bf6yohVQ.js +1 -0
- package/dist/useScopedStyles-DhBG3557.mjs +11 -0
- package/dist/utils-033j3qNL.js +1 -0
- package/dist/utils-FxC9rcxw.mjs +247 -0
- package/dist/utils.js +1 -1
- package/dist/utils.mjs +17 -11
- package/package.json +31 -2
- package/dist/index-2JTNRDR1.js +0 -1
- package/dist/index-DA8t6EZ4.mjs +0 -255
- package/dist/panelAvailability-CgSic84c.mjs +0 -126
- package/dist/panelAvailability-D8c7cdbu.js +0 -1
|
@@ -0,0 +1,434 @@
|
|
|
1
|
+
import { jsxs as Y, jsx as c } from "react/jsx-runtime";
|
|
2
|
+
import { useState as z, useMemo as Ao } from "react";
|
|
3
|
+
import { s as l } from "./scalingValue-C9JH5L6O.mjs";
|
|
4
|
+
import { b as Lo } from "./buildColorVars-CLyWQm5K.mjs";
|
|
5
|
+
import { g as D } from "./formFieldValidation-DvihFrq5.mjs";
|
|
6
|
+
import { u as Mo } from "./useScopedStyles-DhBG3557.mjs";
|
|
7
|
+
import { o as A, t as L } from "./textStylesToCss-05Mn6I_2.mjs";
|
|
8
|
+
import { S as No } from "./SvgImage-B5mR9y6q.mjs";
|
|
9
|
+
function k(o) {
|
|
10
|
+
return `calc(var(--cntrl-article-width, 100vw) * ${o / 1440})`;
|
|
11
|
+
}
|
|
12
|
+
function Oo(o) {
|
|
13
|
+
return `
|
|
14
|
+
.${o}-wrapper {
|
|
15
|
+
display: flex;
|
|
16
|
+
flex-direction: column;
|
|
17
|
+
width: 100%;
|
|
18
|
+
height: 100%;
|
|
19
|
+
align-items: stretch;
|
|
20
|
+
justify-content: center;
|
|
21
|
+
}
|
|
22
|
+
.${o}-form {
|
|
23
|
+
display: flex;
|
|
24
|
+
width: 100%;
|
|
25
|
+
box-sizing: border-box;
|
|
26
|
+
align-items: stretch;
|
|
27
|
+
overflow: hidden;
|
|
28
|
+
border-color: var(--${o}-stroke-color);
|
|
29
|
+
transition: border-color 250ms;
|
|
30
|
+
}
|
|
31
|
+
.${o}-form:hover {
|
|
32
|
+
border-color: var(--${o}-hover-stroke-color, var(--${o}-stroke-color));
|
|
33
|
+
}
|
|
34
|
+
.${o}-form:focus-within {
|
|
35
|
+
border-color: var(--${o}-focus-stroke-color, var(--${o}-stroke-color));
|
|
36
|
+
}
|
|
37
|
+
.${o}-wrapper.${o}-state-hover .${o}-form {
|
|
38
|
+
border-color: var(--${o}-hover-stroke-color, var(--${o}-stroke-color));
|
|
39
|
+
}
|
|
40
|
+
.${o}-wrapper.${o}-state-focus .${o}-form {
|
|
41
|
+
border-color: var(--${o}-focus-stroke-color, var(--${o}-stroke-color));
|
|
42
|
+
}
|
|
43
|
+
.${o}-wrapper.${o}-state-filled .${o}-form {
|
|
44
|
+
border-color: var(--${o}-filled-stroke-color, var(--${o}-stroke-color));
|
|
45
|
+
}
|
|
46
|
+
.${o}-inputWrap {
|
|
47
|
+
position: relative;
|
|
48
|
+
display: flex;
|
|
49
|
+
align-items: center;
|
|
50
|
+
flex: 1;
|
|
51
|
+
min-width: 0;
|
|
52
|
+
background-color: var(--${o}-input-color);
|
|
53
|
+
transition: background-color 250ms;
|
|
54
|
+
}
|
|
55
|
+
.${o}-inputWrap:hover,
|
|
56
|
+
.${o}-wrapper.${o}-state-hover .${o}-inputWrap {
|
|
57
|
+
background-color: var(--${o}-hover-input-color, var(--${o}-input-color));
|
|
58
|
+
}
|
|
59
|
+
.${o}-inputWrap:focus-within,
|
|
60
|
+
.${o}-wrapper.${o}-state-focus .${o}-inputWrap {
|
|
61
|
+
background-color: var(--${o}-focus-input-color, var(--${o}-input-color));
|
|
62
|
+
}
|
|
63
|
+
.${o}-wrapper.${o}-state-filled .${o}-inputWrap {
|
|
64
|
+
background-color: var(--${o}-filled-input-color, var(--${o}-input-color));
|
|
65
|
+
}
|
|
66
|
+
.${o}-input {
|
|
67
|
+
flex: 1;
|
|
68
|
+
min-width: 0;
|
|
69
|
+
box-sizing: border-box;
|
|
70
|
+
background: transparent;
|
|
71
|
+
border: none;
|
|
72
|
+
outline: none;
|
|
73
|
+
-webkit-tap-highlight-color: transparent;
|
|
74
|
+
color: var(--${o}-input-text-color);
|
|
75
|
+
transition: color 250ms, background-color 250ms, border-color 250ms;
|
|
76
|
+
}
|
|
77
|
+
.${o}-input:hover {
|
|
78
|
+
color: var(--${o}-hover-input-text-color, var(--${o}-input-text-color));
|
|
79
|
+
}
|
|
80
|
+
.${o}-inputWrap:hover .${o}-input,
|
|
81
|
+
.${o}-wrapper.${o}-state-hover .${o}-input {
|
|
82
|
+
color: var(--${o}-hover-input-text-color, var(--${o}-input-text-color));
|
|
83
|
+
}
|
|
84
|
+
.${o}-input:focus,
|
|
85
|
+
.${o}-wrapper.${o}-state-focus .${o}-input {
|
|
86
|
+
color: var(--${o}-focus-input-text-color, var(--${o}-input-text-color));
|
|
87
|
+
}
|
|
88
|
+
.${o}-wrapper.${o}-state-filled .${o}-input {
|
|
89
|
+
color: var(--${o}-filled-input-text-color, var(--${o}-input-text-color));
|
|
90
|
+
}
|
|
91
|
+
.${o}-input::placeholder {
|
|
92
|
+
color: var(--${o}-placeholder-color);
|
|
93
|
+
opacity: 1;
|
|
94
|
+
transition: color 250ms, opacity 250ms;
|
|
95
|
+
}
|
|
96
|
+
.${o}-inputWrap:hover .${o}-input::placeholder,
|
|
97
|
+
.${o}-wrapper.${o}-state-hover .${o}-input::placeholder {
|
|
98
|
+
color: var(--${o}-hover-placeholder-color, var(--${o}-placeholder-color));
|
|
99
|
+
}
|
|
100
|
+
.${o}-inputWrap:focus-within .${o}-input::placeholder,
|
|
101
|
+
.${o}-wrapper.${o}-state-focus .${o}-input::placeholder {
|
|
102
|
+
color: var(--${o}-focus-placeholder-color, var(--${o}-placeholder-color));
|
|
103
|
+
}
|
|
104
|
+
.${o}-wrapper.${o}-state-filled .${o}-input::placeholder {
|
|
105
|
+
color: var(--${o}-filled-placeholder-color, var(--${o}-placeholder-color));
|
|
106
|
+
}
|
|
107
|
+
.${o}-submitBtn {
|
|
108
|
+
box-sizing: border-box;
|
|
109
|
+
height: 100%;
|
|
110
|
+
display: flex;
|
|
111
|
+
align-items: center;
|
|
112
|
+
justify-content: center;
|
|
113
|
+
border: none;
|
|
114
|
+
cursor: pointer;
|
|
115
|
+
white-space: nowrap;
|
|
116
|
+
background-color: var(--${o}-button-color);
|
|
117
|
+
color: var(--${o}-button-text-color);
|
|
118
|
+
border-left-style: solid;
|
|
119
|
+
border-left-color: var(--${o}-stroke-color);
|
|
120
|
+
transition: color 250ms, background-color 250ms, border-color 250ms;
|
|
121
|
+
}
|
|
122
|
+
.${o}-submitBtn img {
|
|
123
|
+
display: block;
|
|
124
|
+
box-sizing: border-box;
|
|
125
|
+
flex: 0 1 auto;
|
|
126
|
+
min-width: 0;
|
|
127
|
+
height: 100%;
|
|
128
|
+
width: auto;
|
|
129
|
+
max-width: 100%;
|
|
130
|
+
max-height: 100%;
|
|
131
|
+
object-fit: contain;
|
|
132
|
+
}
|
|
133
|
+
.${o}-submitBtn svg {
|
|
134
|
+
display: block;
|
|
135
|
+
box-sizing: border-box;
|
|
136
|
+
flex: 0 1 auto;
|
|
137
|
+
min-width: 0;
|
|
138
|
+
height: 100%;
|
|
139
|
+
width: auto;
|
|
140
|
+
max-width: 100%;
|
|
141
|
+
max-height: 100%;
|
|
142
|
+
}
|
|
143
|
+
.${o}-submitBtn .${o}-submitBtnIcon {
|
|
144
|
+
position: relative;
|
|
145
|
+
top: auto;
|
|
146
|
+
left: auto;
|
|
147
|
+
transform: none;
|
|
148
|
+
display: block;
|
|
149
|
+
box-sizing: border-box;
|
|
150
|
+
flex: 0 1 auto;
|
|
151
|
+
align-self: stretch;
|
|
152
|
+
min-width: 0;
|
|
153
|
+
width: auto;
|
|
154
|
+
height: auto;
|
|
155
|
+
aspect-ratio: 1;
|
|
156
|
+
max-width: 100%;
|
|
157
|
+
max-height: 100%;
|
|
158
|
+
}
|
|
159
|
+
.${o}-submitBtn:hover,
|
|
160
|
+
.${o}-wrapper.${o}-state-hover .${o}-submitBtn {
|
|
161
|
+
background-color: var(--${o}-hover-button-color, var(--${o}-button-color));
|
|
162
|
+
color: var(--${o}-hover-button-text-color, var(--${o}-button-text-color));
|
|
163
|
+
border-left-color: var(--${o}-hover-stroke-color, var(--${o}-stroke-color));
|
|
164
|
+
}
|
|
165
|
+
.${o}-submitBtn:focus,
|
|
166
|
+
.${o}-wrapper.${o}-state-focus .${o}-submitBtn {
|
|
167
|
+
background-color: var(--${o}-focus-button-color, var(--${o}-button-color));
|
|
168
|
+
color: var(--${o}-focus-button-text-color, var(--${o}-button-text-color));
|
|
169
|
+
border-left-color: var(--${o}-focus-stroke-color, var(--${o}-stroke-color));
|
|
170
|
+
}
|
|
171
|
+
.${o}-wrapper.${o}-state-filled .${o}-submitBtn {
|
|
172
|
+
background-color: var(--${o}-filled-button-color, var(--${o}-button-color));
|
|
173
|
+
color: var(--${o}-filled-button-text-color, var(--${o}-button-text-color));
|
|
174
|
+
border-left-color: var(--${o}-filled-stroke-color, var(--${o}-stroke-color));
|
|
175
|
+
}
|
|
176
|
+
.${o}-submitBtn:hover .${o}-submitBtnIcon,
|
|
177
|
+
.${o}-wrapper.${o}-state-hover .${o}-submitBtn .${o}-submitBtnIcon {
|
|
178
|
+
background-color: var(--${o}-hover-button-text-color, var(--${o}-button-text-color));
|
|
179
|
+
}
|
|
180
|
+
.${o}-submitBtn:focus .${o}-submitBtnIcon,
|
|
181
|
+
.${o}-wrapper.${o}-state-focus .${o}-submitBtn .${o}-submitBtnIcon {
|
|
182
|
+
background-color: var(--${o}-focus-button-text-color, var(--${o}-button-text-color));
|
|
183
|
+
}
|
|
184
|
+
.${o}-wrapper.${o}-state-filled .${o}-submitBtn .${o}-submitBtnIcon {
|
|
185
|
+
background-color: var(--${o}-filled-button-text-color, var(--${o}-button-text-color));
|
|
186
|
+
}
|
|
187
|
+
.${o}-wrapper.${o}-state-success .${o}-input,
|
|
188
|
+
.${o}-wrapper.${o}-state-success .${o}-submitBtn {
|
|
189
|
+
pointer-events: none;
|
|
190
|
+
}
|
|
191
|
+
.${o}-overlayAnchor {
|
|
192
|
+
position: relative;
|
|
193
|
+
display: flex;
|
|
194
|
+
align-items: center;
|
|
195
|
+
}
|
|
196
|
+
.${o}-success {
|
|
197
|
+
margin-top: ${k(8)};
|
|
198
|
+
font-size: ${k(14)};
|
|
199
|
+
color: var(--${o}-success-success-color, var(--${o}-success-color));
|
|
200
|
+
}
|
|
201
|
+
.${o}-error {
|
|
202
|
+
margin-top: ${k(8)};
|
|
203
|
+
font-size: ${k(14)};
|
|
204
|
+
color: var(--${o}-error-error-color, var(--${o}-error-color));
|
|
205
|
+
}
|
|
206
|
+
`;
|
|
207
|
+
}
|
|
208
|
+
const Do = ({ settings: o, isEditor: t, isPreviewMode: J, metadata: S, activeEvent: s }) => {
|
|
209
|
+
const { prefix: e } = Mo(), C = J && t || !t, {
|
|
210
|
+
fields: M = [{ name: "email", type: "email", placeholder: "Your email" }],
|
|
211
|
+
buttonIcon: p,
|
|
212
|
+
buttonLabel: K,
|
|
213
|
+
fieldsToShow: G = 1,
|
|
214
|
+
fontFamily: T,
|
|
215
|
+
inputFontSettings: $,
|
|
216
|
+
inputFontSize: Q,
|
|
217
|
+
inputLineHeight: X,
|
|
218
|
+
inputLetterSpacing: Z,
|
|
219
|
+
inputWordSpacing: E,
|
|
220
|
+
inputTextAppearance: P,
|
|
221
|
+
buttonFontSettings: d,
|
|
222
|
+
buttonFontSize: oo,
|
|
223
|
+
buttonLineHeight: ro,
|
|
224
|
+
buttonLetterSpacing: to,
|
|
225
|
+
buttonWordSpacing: eo,
|
|
226
|
+
buttonTextAppearance: lo,
|
|
227
|
+
statusFontSettings: m,
|
|
228
|
+
statusFontSize: ao,
|
|
229
|
+
statusLineHeight: no,
|
|
230
|
+
statusLetterSpacing: co,
|
|
231
|
+
statusWordSpacing: so,
|
|
232
|
+
statusTextAppearance: io,
|
|
233
|
+
iconMaxWidth: uo,
|
|
234
|
+
minHeight: N,
|
|
235
|
+
corners: po,
|
|
236
|
+
stroke: O,
|
|
237
|
+
stateOverrides: $o,
|
|
238
|
+
inputPadding: v,
|
|
239
|
+
buttonPadding: g,
|
|
240
|
+
successMessage: mo = "Thanks for subscribing!",
|
|
241
|
+
errorMessage: j = "Please, fill all required fields."
|
|
242
|
+
} = o, n = M.slice(0, Math.min(G, M.length)), [i, H] = z(
|
|
243
|
+
() => Object.fromEntries(n.map((r) => [r.name, ""]))
|
|
244
|
+
), [V, h] = z("idle"), [fo, x] = z(null), B = s === "success" ? "success" : s === "error" ? "error" : V, ho = s === "error" ? j : fo, R = s === "filled", W = Ao(() => {
|
|
245
|
+
if (!R) return i;
|
|
246
|
+
let r = null;
|
|
247
|
+
for (const u of n)
|
|
248
|
+
(i[u.name] ?? "").trim().length > 0 || (r = r ?? { ...i }, r[u.name] = "Filled");
|
|
249
|
+
return r ?? i;
|
|
250
|
+
}, [R, i, n]), bo = B === "error" ? D(n, W) : null, I = s && s !== "default" ? `${e}-state-${s}` : "", vo = n.some((r) => (W[r.name] ?? "").trim().length > 0), go = I !== `${e}-state-filled` && vo ? `${e}-state-filled` : "", xo = `${I} ${go}`.trim(), _ = S == null ? void 0 : S.submitUrl, q = K ?? "", F = (p == null ? void 0 : p.icon) ?? "", yo = (p == null ? void 0 : p.mode) === "On", wo = q || "Submit", y = {
|
|
251
|
+
fontSettings: {
|
|
252
|
+
fontFamily: T,
|
|
253
|
+
fontWeight: ($ == null ? void 0 : $.fontWeight) ?? 400,
|
|
254
|
+
fontStyle: ($ == null ? void 0 : $.fontStyle) ?? "normal"
|
|
255
|
+
},
|
|
256
|
+
fontSize: Q ?? 0.01,
|
|
257
|
+
lineHeight: X,
|
|
258
|
+
letterSpacing: Z ?? 0,
|
|
259
|
+
wordSpacing: E ?? 0,
|
|
260
|
+
textAppearance: P,
|
|
261
|
+
color: o.inputTextColor ?? "#111111"
|
|
262
|
+
}, w = {
|
|
263
|
+
fontSettings: {
|
|
264
|
+
fontFamily: T,
|
|
265
|
+
fontWeight: (d == null ? void 0 : d.fontWeight) ?? 400,
|
|
266
|
+
fontStyle: (d == null ? void 0 : d.fontStyle) ?? "normal"
|
|
267
|
+
},
|
|
268
|
+
fontSize: oo ?? 0.01,
|
|
269
|
+
lineHeight: ro,
|
|
270
|
+
letterSpacing: to ?? 0,
|
|
271
|
+
wordSpacing: eo ?? 0,
|
|
272
|
+
textAppearance: lo,
|
|
273
|
+
color: o.buttonTextColor ?? "#ffffff"
|
|
274
|
+
}, ko = {
|
|
275
|
+
fontSettings: {
|
|
276
|
+
fontFamily: T,
|
|
277
|
+
fontWeight: (m == null ? void 0 : m.fontWeight) ?? 400,
|
|
278
|
+
fontStyle: (m == null ? void 0 : m.fontStyle) ?? "normal"
|
|
279
|
+
},
|
|
280
|
+
fontSize: ao ?? 0.01,
|
|
281
|
+
lineHeight: no,
|
|
282
|
+
letterSpacing: co ?? 0,
|
|
283
|
+
wordSpacing: so ?? 0,
|
|
284
|
+
textAppearance: io,
|
|
285
|
+
color: o.successColor ?? "#22c55e"
|
|
286
|
+
}, So = A(L(y, t)), Co = A(L(w, t)), U = A(L(ko, t)), To = Lo(e, {
|
|
287
|
+
strokeColor: o.strokeColor,
|
|
288
|
+
inputColor: o.inputColor,
|
|
289
|
+
placeholderColor: o.placeholderColor,
|
|
290
|
+
buttonColor: o.buttonColor,
|
|
291
|
+
successColor: o.successColor,
|
|
292
|
+
errorColor: o.errorColor,
|
|
293
|
+
inputTextColor: o.inputTextColor ?? (y == null ? void 0 : y.color) ?? "#111111",
|
|
294
|
+
buttonTextColor: o.buttonTextColor ?? (w == null ? void 0 : w.color) ?? "#ffffff"
|
|
295
|
+
}, jo, Ho, $o), Bo = {
|
|
296
|
+
borderRadius: l(po, t),
|
|
297
|
+
borderWidth: l(O, t),
|
|
298
|
+
borderStyle: "solid"
|
|
299
|
+
}, Wo = { borderLeftWidth: l(O, t) }, zo = async (r) => {
|
|
300
|
+
if (r.preventDefault(), !C) return;
|
|
301
|
+
const u = Object.fromEntries(
|
|
302
|
+
n.map((a) => {
|
|
303
|
+
var f;
|
|
304
|
+
return [a.name, ((f = i[a.name]) == null ? void 0 : f.trim()) ?? ""];
|
|
305
|
+
}).filter(([, a]) => a)
|
|
306
|
+
);
|
|
307
|
+
if (!_) {
|
|
308
|
+
h("error"), x("No integrations were found for this form.");
|
|
309
|
+
return;
|
|
310
|
+
}
|
|
311
|
+
if (Object.keys(u).length === 0) return;
|
|
312
|
+
const b = D(n, i);
|
|
313
|
+
if (b) {
|
|
314
|
+
h("error"), x(b);
|
|
315
|
+
return;
|
|
316
|
+
}
|
|
317
|
+
h("submitting"), x(null);
|
|
318
|
+
try {
|
|
319
|
+
const a = await fetch(_, {
|
|
320
|
+
method: "POST",
|
|
321
|
+
headers: { "Content-Type": "application/json" },
|
|
322
|
+
body: JSON.stringify(u)
|
|
323
|
+
});
|
|
324
|
+
if (!a.ok) {
|
|
325
|
+
const f = await a.text();
|
|
326
|
+
throw new Error(f || `Request failed: ${a.status}`);
|
|
327
|
+
}
|
|
328
|
+
h("success"), H(Object.fromEntries(n.map((f) => [f.name, ""])));
|
|
329
|
+
} catch (a) {
|
|
330
|
+
h("error"), x(a instanceof Error ? a.message : "Something went wrong");
|
|
331
|
+
}
|
|
332
|
+
};
|
|
333
|
+
return /* @__PURE__ */ Y("div", { className: `${e}-wrapper ${xo}`.trim(), style: To, children: [
|
|
334
|
+
/* @__PURE__ */ c("style", { dangerouslySetInnerHTML: { __html: Oo(e) } }),
|
|
335
|
+
/* @__PURE__ */ Y(
|
|
336
|
+
"form",
|
|
337
|
+
{
|
|
338
|
+
onSubmit: zo,
|
|
339
|
+
className: `${e}-form`,
|
|
340
|
+
style: {
|
|
341
|
+
...Bo,
|
|
342
|
+
height: l(N, t),
|
|
343
|
+
minHeight: l(N, t)
|
|
344
|
+
},
|
|
345
|
+
children: [
|
|
346
|
+
/* @__PURE__ */ c(
|
|
347
|
+
"div",
|
|
348
|
+
{
|
|
349
|
+
className: `${e}-inputWrap ${e}-overlayAnchor`,
|
|
350
|
+
style: { flex: 1, minWidth: 0 },
|
|
351
|
+
children: n.map((r) => /* @__PURE__ */ c(
|
|
352
|
+
"input",
|
|
353
|
+
{
|
|
354
|
+
type: r.type === "email" ? "email" : r.type === "phone" ? "tel" : "text",
|
|
355
|
+
name: r.name,
|
|
356
|
+
autoComplete: "off",
|
|
357
|
+
value: W[r.name] ?? "",
|
|
358
|
+
onChange: (u) => H((b) => ({ ...b, [r.name]: u.target.value })),
|
|
359
|
+
placeholder: r.placeholder,
|
|
360
|
+
required: r.isRequired ?? r.type === "email",
|
|
361
|
+
className: `${e}-input`,
|
|
362
|
+
style: {
|
|
363
|
+
...So,
|
|
364
|
+
paddingRight: l(v.right, t),
|
|
365
|
+
paddingLeft: l(v.left, t),
|
|
366
|
+
paddingTop: l(v.top, t),
|
|
367
|
+
paddingBottom: l(v.bottom, t)
|
|
368
|
+
}
|
|
369
|
+
},
|
|
370
|
+
r.name
|
|
371
|
+
))
|
|
372
|
+
}
|
|
373
|
+
),
|
|
374
|
+
/* @__PURE__ */ c("div", { className: `${e}-overlayAnchor`, children: /* @__PURE__ */ c(
|
|
375
|
+
"button",
|
|
376
|
+
{
|
|
377
|
+
type: C ? "submit" : "button",
|
|
378
|
+
className: `${e}-submitBtn`,
|
|
379
|
+
"aria-label": wo,
|
|
380
|
+
style: {
|
|
381
|
+
...Co,
|
|
382
|
+
...Wo,
|
|
383
|
+
paddingRight: l(g.right, t),
|
|
384
|
+
paddingLeft: l(g.left, t),
|
|
385
|
+
paddingTop: l(g.top, t),
|
|
386
|
+
paddingBottom: l(g.bottom, t),
|
|
387
|
+
pointerEvents: C ? "auto" : void 0
|
|
388
|
+
},
|
|
389
|
+
children: V === "submitting" ? "..." : yo ? F && /* @__PURE__ */ c(
|
|
390
|
+
No,
|
|
391
|
+
{
|
|
392
|
+
url: F,
|
|
393
|
+
className: `${e}-submitBtnIcon`,
|
|
394
|
+
style: { maxWidth: l(uo ?? 0, t) },
|
|
395
|
+
fill: `var(--${e}-button-text-color)`,
|
|
396
|
+
hoverFill: `var(--${e}-button-text-color)`
|
|
397
|
+
}
|
|
398
|
+
) : q
|
|
399
|
+
}
|
|
400
|
+
) })
|
|
401
|
+
]
|
|
402
|
+
}
|
|
403
|
+
),
|
|
404
|
+
B === "success" && /* @__PURE__ */ c(
|
|
405
|
+
"p",
|
|
406
|
+
{
|
|
407
|
+
className: `${e}-success`,
|
|
408
|
+
style: { ...U },
|
|
409
|
+
children: mo
|
|
410
|
+
}
|
|
411
|
+
),
|
|
412
|
+
B === "error" && /* @__PURE__ */ c(
|
|
413
|
+
"p",
|
|
414
|
+
{
|
|
415
|
+
className: `${e}-error`,
|
|
416
|
+
style: { ...U },
|
|
417
|
+
role: "alert",
|
|
418
|
+
children: bo ?? ho ?? j
|
|
419
|
+
}
|
|
420
|
+
)
|
|
421
|
+
] });
|
|
422
|
+
}, jo = {
|
|
423
|
+
strokeColor: "stroke-color",
|
|
424
|
+
inputColor: "input-color",
|
|
425
|
+
placeholderColor: "placeholder-color",
|
|
426
|
+
buttonColor: "button-color",
|
|
427
|
+
inputTextColor: "input-text-color",
|
|
428
|
+
buttonTextColor: "button-text-color",
|
|
429
|
+
successColor: "success-color",
|
|
430
|
+
errorColor: "error-color"
|
|
431
|
+
}, Ho = ["hover", "focus", "filled", "success", "error"];
|
|
432
|
+
export {
|
|
433
|
+
Do as OnelinerForm
|
|
434
|
+
};
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),C=require("react"),l=require("./scalingValue-CSHYgTZl.js"),Vo=require("./buildColorVars-CE2D5cQV.js"),U=require("./formFieldValidation-DZl2KVaF.js"),Wo=require("./useScopedStyles-Bf6yohVQ.js"),m=require("./textStylesToCss-CNN3zZTV.js"),jo=require("./SvgImage-DFlmxAoL.js");function k(o){return`calc(var(--cntrl-article-width, 100vw) * ${o/1440})`}function zo(o){return`
|
|
2
|
+
.${o}-wrapper {
|
|
3
|
+
display: flex;
|
|
4
|
+
flex-direction: column;
|
|
5
|
+
width: 100%;
|
|
6
|
+
height: 100%;
|
|
7
|
+
align-items: stretch;
|
|
8
|
+
justify-content: center;
|
|
9
|
+
}
|
|
10
|
+
.${o}-form {
|
|
11
|
+
display: flex;
|
|
12
|
+
width: 100%;
|
|
13
|
+
box-sizing: border-box;
|
|
14
|
+
align-items: stretch;
|
|
15
|
+
overflow: hidden;
|
|
16
|
+
border-color: var(--${o}-stroke-color);
|
|
17
|
+
transition: border-color 250ms;
|
|
18
|
+
}
|
|
19
|
+
.${o}-form:hover {
|
|
20
|
+
border-color: var(--${o}-hover-stroke-color, var(--${o}-stroke-color));
|
|
21
|
+
}
|
|
22
|
+
.${o}-form:focus-within {
|
|
23
|
+
border-color: var(--${o}-focus-stroke-color, var(--${o}-stroke-color));
|
|
24
|
+
}
|
|
25
|
+
.${o}-wrapper.${o}-state-hover .${o}-form {
|
|
26
|
+
border-color: var(--${o}-hover-stroke-color, var(--${o}-stroke-color));
|
|
27
|
+
}
|
|
28
|
+
.${o}-wrapper.${o}-state-focus .${o}-form {
|
|
29
|
+
border-color: var(--${o}-focus-stroke-color, var(--${o}-stroke-color));
|
|
30
|
+
}
|
|
31
|
+
.${o}-wrapper.${o}-state-filled .${o}-form {
|
|
32
|
+
border-color: var(--${o}-filled-stroke-color, var(--${o}-stroke-color));
|
|
33
|
+
}
|
|
34
|
+
.${o}-inputWrap {
|
|
35
|
+
position: relative;
|
|
36
|
+
display: flex;
|
|
37
|
+
align-items: center;
|
|
38
|
+
flex: 1;
|
|
39
|
+
min-width: 0;
|
|
40
|
+
background-color: var(--${o}-input-color);
|
|
41
|
+
transition: background-color 250ms;
|
|
42
|
+
}
|
|
43
|
+
.${o}-inputWrap:hover,
|
|
44
|
+
.${o}-wrapper.${o}-state-hover .${o}-inputWrap {
|
|
45
|
+
background-color: var(--${o}-hover-input-color, var(--${o}-input-color));
|
|
46
|
+
}
|
|
47
|
+
.${o}-inputWrap:focus-within,
|
|
48
|
+
.${o}-wrapper.${o}-state-focus .${o}-inputWrap {
|
|
49
|
+
background-color: var(--${o}-focus-input-color, var(--${o}-input-color));
|
|
50
|
+
}
|
|
51
|
+
.${o}-wrapper.${o}-state-filled .${o}-inputWrap {
|
|
52
|
+
background-color: var(--${o}-filled-input-color, var(--${o}-input-color));
|
|
53
|
+
}
|
|
54
|
+
.${o}-input {
|
|
55
|
+
flex: 1;
|
|
56
|
+
min-width: 0;
|
|
57
|
+
box-sizing: border-box;
|
|
58
|
+
background: transparent;
|
|
59
|
+
border: none;
|
|
60
|
+
outline: none;
|
|
61
|
+
-webkit-tap-highlight-color: transparent;
|
|
62
|
+
color: var(--${o}-input-text-color);
|
|
63
|
+
transition: color 250ms, background-color 250ms, border-color 250ms;
|
|
64
|
+
}
|
|
65
|
+
.${o}-input:hover {
|
|
66
|
+
color: var(--${o}-hover-input-text-color, var(--${o}-input-text-color));
|
|
67
|
+
}
|
|
68
|
+
.${o}-inputWrap:hover .${o}-input,
|
|
69
|
+
.${o}-wrapper.${o}-state-hover .${o}-input {
|
|
70
|
+
color: var(--${o}-hover-input-text-color, var(--${o}-input-text-color));
|
|
71
|
+
}
|
|
72
|
+
.${o}-input:focus,
|
|
73
|
+
.${o}-wrapper.${o}-state-focus .${o}-input {
|
|
74
|
+
color: var(--${o}-focus-input-text-color, var(--${o}-input-text-color));
|
|
75
|
+
}
|
|
76
|
+
.${o}-wrapper.${o}-state-filled .${o}-input {
|
|
77
|
+
color: var(--${o}-filled-input-text-color, var(--${o}-input-text-color));
|
|
78
|
+
}
|
|
79
|
+
.${o}-input::placeholder {
|
|
80
|
+
color: var(--${o}-placeholder-color);
|
|
81
|
+
opacity: 1;
|
|
82
|
+
transition: color 250ms, opacity 250ms;
|
|
83
|
+
}
|
|
84
|
+
.${o}-inputWrap:hover .${o}-input::placeholder,
|
|
85
|
+
.${o}-wrapper.${o}-state-hover .${o}-input::placeholder {
|
|
86
|
+
color: var(--${o}-hover-placeholder-color, var(--${o}-placeholder-color));
|
|
87
|
+
}
|
|
88
|
+
.${o}-inputWrap:focus-within .${o}-input::placeholder,
|
|
89
|
+
.${o}-wrapper.${o}-state-focus .${o}-input::placeholder {
|
|
90
|
+
color: var(--${o}-focus-placeholder-color, var(--${o}-placeholder-color));
|
|
91
|
+
}
|
|
92
|
+
.${o}-wrapper.${o}-state-filled .${o}-input::placeholder {
|
|
93
|
+
color: var(--${o}-filled-placeholder-color, var(--${o}-placeholder-color));
|
|
94
|
+
}
|
|
95
|
+
.${o}-submitBtn {
|
|
96
|
+
box-sizing: border-box;
|
|
97
|
+
height: 100%;
|
|
98
|
+
display: flex;
|
|
99
|
+
align-items: center;
|
|
100
|
+
justify-content: center;
|
|
101
|
+
border: none;
|
|
102
|
+
cursor: pointer;
|
|
103
|
+
white-space: nowrap;
|
|
104
|
+
background-color: var(--${o}-button-color);
|
|
105
|
+
color: var(--${o}-button-text-color);
|
|
106
|
+
border-left-style: solid;
|
|
107
|
+
border-left-color: var(--${o}-stroke-color);
|
|
108
|
+
transition: color 250ms, background-color 250ms, border-color 250ms;
|
|
109
|
+
}
|
|
110
|
+
.${o}-submitBtn img {
|
|
111
|
+
display: block;
|
|
112
|
+
box-sizing: border-box;
|
|
113
|
+
flex: 0 1 auto;
|
|
114
|
+
min-width: 0;
|
|
115
|
+
height: 100%;
|
|
116
|
+
width: auto;
|
|
117
|
+
max-width: 100%;
|
|
118
|
+
max-height: 100%;
|
|
119
|
+
object-fit: contain;
|
|
120
|
+
}
|
|
121
|
+
.${o}-submitBtn svg {
|
|
122
|
+
display: block;
|
|
123
|
+
box-sizing: border-box;
|
|
124
|
+
flex: 0 1 auto;
|
|
125
|
+
min-width: 0;
|
|
126
|
+
height: 100%;
|
|
127
|
+
width: auto;
|
|
128
|
+
max-width: 100%;
|
|
129
|
+
max-height: 100%;
|
|
130
|
+
}
|
|
131
|
+
.${o}-submitBtn .${o}-submitBtnIcon {
|
|
132
|
+
position: relative;
|
|
133
|
+
top: auto;
|
|
134
|
+
left: auto;
|
|
135
|
+
transform: none;
|
|
136
|
+
display: block;
|
|
137
|
+
box-sizing: border-box;
|
|
138
|
+
flex: 0 1 auto;
|
|
139
|
+
align-self: stretch;
|
|
140
|
+
min-width: 0;
|
|
141
|
+
width: auto;
|
|
142
|
+
height: auto;
|
|
143
|
+
aspect-ratio: 1;
|
|
144
|
+
max-width: 100%;
|
|
145
|
+
max-height: 100%;
|
|
146
|
+
}
|
|
147
|
+
.${o}-submitBtn:hover,
|
|
148
|
+
.${o}-wrapper.${o}-state-hover .${o}-submitBtn {
|
|
149
|
+
background-color: var(--${o}-hover-button-color, var(--${o}-button-color));
|
|
150
|
+
color: var(--${o}-hover-button-text-color, var(--${o}-button-text-color));
|
|
151
|
+
border-left-color: var(--${o}-hover-stroke-color, var(--${o}-stroke-color));
|
|
152
|
+
}
|
|
153
|
+
.${o}-submitBtn:focus,
|
|
154
|
+
.${o}-wrapper.${o}-state-focus .${o}-submitBtn {
|
|
155
|
+
background-color: var(--${o}-focus-button-color, var(--${o}-button-color));
|
|
156
|
+
color: var(--${o}-focus-button-text-color, var(--${o}-button-text-color));
|
|
157
|
+
border-left-color: var(--${o}-focus-stroke-color, var(--${o}-stroke-color));
|
|
158
|
+
}
|
|
159
|
+
.${o}-wrapper.${o}-state-filled .${o}-submitBtn {
|
|
160
|
+
background-color: var(--${o}-filled-button-color, var(--${o}-button-color));
|
|
161
|
+
color: var(--${o}-filled-button-text-color, var(--${o}-button-text-color));
|
|
162
|
+
border-left-color: var(--${o}-filled-stroke-color, var(--${o}-stroke-color));
|
|
163
|
+
}
|
|
164
|
+
.${o}-submitBtn:hover .${o}-submitBtnIcon,
|
|
165
|
+
.${o}-wrapper.${o}-state-hover .${o}-submitBtn .${o}-submitBtnIcon {
|
|
166
|
+
background-color: var(--${o}-hover-button-text-color, var(--${o}-button-text-color));
|
|
167
|
+
}
|
|
168
|
+
.${o}-submitBtn:focus .${o}-submitBtnIcon,
|
|
169
|
+
.${o}-wrapper.${o}-state-focus .${o}-submitBtn .${o}-submitBtnIcon {
|
|
170
|
+
background-color: var(--${o}-focus-button-text-color, var(--${o}-button-text-color));
|
|
171
|
+
}
|
|
172
|
+
.${o}-wrapper.${o}-state-filled .${o}-submitBtn .${o}-submitBtnIcon {
|
|
173
|
+
background-color: var(--${o}-filled-button-text-color, var(--${o}-button-text-color));
|
|
174
|
+
}
|
|
175
|
+
.${o}-wrapper.${o}-state-success .${o}-input,
|
|
176
|
+
.${o}-wrapper.${o}-state-success .${o}-submitBtn {
|
|
177
|
+
pointer-events: none;
|
|
178
|
+
}
|
|
179
|
+
.${o}-overlayAnchor {
|
|
180
|
+
position: relative;
|
|
181
|
+
display: flex;
|
|
182
|
+
align-items: center;
|
|
183
|
+
}
|
|
184
|
+
.${o}-success {
|
|
185
|
+
margin-top: ${k(8)};
|
|
186
|
+
font-size: ${k(14)};
|
|
187
|
+
color: var(--${o}-success-success-color, var(--${o}-success-color));
|
|
188
|
+
}
|
|
189
|
+
.${o}-error {
|
|
190
|
+
margin-top: ${k(8)};
|
|
191
|
+
font-size: ${k(14)};
|
|
192
|
+
color: var(--${o}-error-error-color, var(--${o}-error-color));
|
|
193
|
+
}
|
|
194
|
+
`}const Ao=({settings:o,isEditor:t,isPreviewMode:Y,metadata:T,activeEvent:c})=>{const{prefix:e}=Wo.useScopedStyles(),B=Y&&t||!t,{fields:z=[{name:"email",type:"email",placeholder:"Your email"}],buttonIcon:p,buttonLabel:D,fieldsToShow:J=1,fontFamily:V,inputFontSettings:$,inputFontSize:K,inputLineHeight:G,inputLetterSpacing:Q,inputWordSpacing:X,inputTextAppearance:Z,buttonFontSettings:d,buttonFontSize:E,buttonLineHeight:P,buttonLetterSpacing:oo,buttonWordSpacing:ro,buttonTextAppearance:to,statusFontSettings:b,statusFontSize:eo,statusLineHeight:lo,statusLetterSpacing:ao,statusWordSpacing:no,statusTextAppearance:so,iconMaxWidth:co,minHeight:A,corners:io,stroke:L,stateOverrides:uo,inputPadding:v,buttonPadding:x,successMessage:po="Thanks for subscribing!",errorMessage:O="Please, fill all required fields."}=o,s=z.slice(0,Math.min(J,z.length)),[i,q]=C.useState(()=>Object.fromEntries(s.map(r=>[r.name,""]))),[M,f]=C.useState("idle"),[$o,y]=C.useState(null),W=c==="success"?"success":c==="error"?"error":M,bo=c==="error"?O:$o,N=c==="filled",j=C.useMemo(()=>{if(!N)return i;let r=null;for(const u of s)(i[u.name]??"").trim().length>0||(r=r??{...i},r[u.name]="Filled");return r??i},[N,i,s]),ho=W==="error"?U.getFormFieldValidationError(s,j):null,H=c&&c!=="default"?`${e}-state-${c}`:"",mo=s.some(r=>(j[r.name]??"").trim().length>0),fo=H!==`${e}-state-filled`&&mo?`${e}-state-filled`:"",go=`${H} ${fo}`.trim(),R=T==null?void 0:T.submitUrl,F=D??"",I=(p==null?void 0:p.icon)??"",vo=(p==null?void 0:p.mode)==="On",xo=F||"Submit",w={fontSettings:{fontFamily:V,fontWeight:($==null?void 0:$.fontWeight)??400,fontStyle:($==null?void 0:$.fontStyle)??"normal"},fontSize:K??.01,lineHeight:G,letterSpacing:Q??0,wordSpacing:X??0,textAppearance:Z,color:o.inputTextColor??"#111111"},S={fontSettings:{fontFamily:V,fontWeight:(d==null?void 0:d.fontWeight)??400,fontStyle:(d==null?void 0:d.fontStyle)??"normal"},fontSize:E??.01,lineHeight:P,letterSpacing:oo??0,wordSpacing:ro??0,textAppearance:to,color:o.buttonTextColor??"#ffffff"},yo={fontSettings:{fontFamily:V,fontWeight:(b==null?void 0:b.fontWeight)??400,fontStyle:(b==null?void 0:b.fontStyle)??"normal"},fontSize:eo??.01,lineHeight:lo,letterSpacing:ao??0,wordSpacing:no??0,textAppearance:so,color:o.successColor??"#22c55e"},wo=m.omitTextColors(m.textStylesToCss(w,t)),So=m.omitTextColors(m.textStylesToCss(S,t)),_=m.omitTextColors(m.textStylesToCss(yo,t)),Co=Vo.buildColorVars(e,{strokeColor:o.strokeColor,inputColor:o.inputColor,placeholderColor:o.placeholderColor,buttonColor:o.buttonColor,successColor:o.successColor,errorColor:o.errorColor,inputTextColor:o.inputTextColor??(w==null?void 0:w.color)??"#111111",buttonTextColor:o.buttonTextColor??(S==null?void 0:S.color)??"#ffffff"},Lo,Oo,uo),ko={borderRadius:l.scalingValue(io,t),borderWidth:l.scalingValue(L,t),borderStyle:"solid"},To={borderLeftWidth:l.scalingValue(L,t)},Bo=async r=>{if(r.preventDefault(),!B)return;const u=Object.fromEntries(s.map(a=>{var h;return[a.name,((h=i[a.name])==null?void 0:h.trim())??""]}).filter(([,a])=>a));if(!R){f("error"),y("No integrations were found for this form.");return}if(Object.keys(u).length===0)return;const g=U.getFormFieldValidationError(s,i);if(g){f("error"),y(g);return}f("submitting"),y(null);try{const a=await fetch(R,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(u)});if(!a.ok){const h=await a.text();throw new Error(h||`Request failed: ${a.status}`)}f("success"),q(Object.fromEntries(s.map(h=>[h.name,""])))}catch(a){f("error"),y(a instanceof Error?a.message:"Something went wrong")}};return n.jsxs("div",{className:`${e}-wrapper ${go}`.trim(),style:Co,children:[n.jsx("style",{dangerouslySetInnerHTML:{__html:zo(e)}}),n.jsxs("form",{onSubmit:Bo,className:`${e}-form`,style:{...ko,height:l.scalingValue(A,t),minHeight:l.scalingValue(A,t)},children:[n.jsx("div",{className:`${e}-inputWrap ${e}-overlayAnchor`,style:{flex:1,minWidth:0},children:s.map(r=>n.jsx("input",{type:r.type==="email"?"email":r.type==="phone"?"tel":"text",name:r.name,autoComplete:"off",value:j[r.name]??"",onChange:u=>q(g=>({...g,[r.name]:u.target.value})),placeholder:r.placeholder,required:r.isRequired??r.type==="email",className:`${e}-input`,style:{...wo,paddingRight:l.scalingValue(v.right,t),paddingLeft:l.scalingValue(v.left,t),paddingTop:l.scalingValue(v.top,t),paddingBottom:l.scalingValue(v.bottom,t)}},r.name))}),n.jsx("div",{className:`${e}-overlayAnchor`,children:n.jsx("button",{type:B?"submit":"button",className:`${e}-submitBtn`,"aria-label":xo,style:{...So,...To,paddingRight:l.scalingValue(x.right,t),paddingLeft:l.scalingValue(x.left,t),paddingTop:l.scalingValue(x.top,t),paddingBottom:l.scalingValue(x.bottom,t),pointerEvents:B?"auto":void 0},children:M==="submitting"?"...":vo?I&&n.jsx(jo.SvgImage,{url:I,className:`${e}-submitBtnIcon`,style:{maxWidth:l.scalingValue(co??0,t)},fill:`var(--${e}-button-text-color)`,hoverFill:`var(--${e}-button-text-color)`}):F})})]}),W==="success"&&n.jsx("p",{className:`${e}-success`,style:{..._},children:po}),W==="error"&&n.jsx("p",{className:`${e}-error`,style:{..._},role:"alert",children:ho??bo??O})]})},Lo={strokeColor:"stroke-color",inputColor:"input-color",placeholderColor:"placeholder-color",buttonColor:"button-color",inputTextColor:"input-text-color",buttonTextColor:"button-text-color",successColor:"success-color",errorColor:"error-color"},Oo=["hover","focus","filled","success","error"];exports.OnelinerForm=Ao;
|