@planetaexo/design-system 0.4.21 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +225 -114
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +19 -5
- package/dist/index.d.ts +19 -5
- package/dist/index.js +225 -115
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -15,6 +15,7 @@ import { Checkbox as Checkbox$1 } from '@base-ui/react/checkbox';
|
|
|
15
15
|
import { Accordion as Accordion$1 } from '@base-ui/react/accordion';
|
|
16
16
|
import { mergeProps } from '@base-ui/react/merge-props';
|
|
17
17
|
import { useRender } from '@base-ui/react/use-render';
|
|
18
|
+
import { createPortal } from 'react-dom';
|
|
18
19
|
import { Input as Input$1 } from '@base-ui/react/input';
|
|
19
20
|
|
|
20
21
|
var __defProp = Object.defineProperty;
|
|
@@ -607,7 +608,8 @@ var PHONE_COUNTRIES = [...PHONE_PRIORITY, ...PHONE_REST];
|
|
|
607
608
|
function PhoneCountrySelect({
|
|
608
609
|
value,
|
|
609
610
|
onChange,
|
|
610
|
-
className
|
|
611
|
+
className,
|
|
612
|
+
disabled
|
|
611
613
|
}) {
|
|
612
614
|
var _a;
|
|
613
615
|
const [open, setOpen] = React22.useState(false);
|
|
@@ -631,6 +633,7 @@ function PhoneCountrySelect({
|
|
|
631
633
|
activeEl == null ? void 0 : activeEl.scrollIntoView({ block: "nearest" });
|
|
632
634
|
}, [open]);
|
|
633
635
|
const handleSelect = (code) => {
|
|
636
|
+
if (disabled) return;
|
|
634
637
|
onChange(code);
|
|
635
638
|
setOpen(false);
|
|
636
639
|
};
|
|
@@ -639,14 +642,19 @@ function PhoneCountrySelect({
|
|
|
639
642
|
"button",
|
|
640
643
|
{
|
|
641
644
|
type: "button",
|
|
642
|
-
onClick: () =>
|
|
645
|
+
onClick: () => {
|
|
646
|
+
if (disabled) return;
|
|
647
|
+
setOpen((v) => !v);
|
|
648
|
+
},
|
|
643
649
|
"aria-haspopup": "listbox",
|
|
644
650
|
"aria-expanded": open,
|
|
651
|
+
disabled,
|
|
645
652
|
className: cn(
|
|
646
653
|
"flex h-14 items-center gap-1.5 rounded-l-lg border border-r-0 border-border bg-muted",
|
|
647
654
|
"px-3 font-ui text-sm text-foreground transition-colors",
|
|
648
655
|
"focus:outline-none focus:border-primary focus:ring-1 focus:ring-primary",
|
|
649
|
-
open && "border-primary ring-1 ring-primary"
|
|
656
|
+
open && "border-primary ring-1 ring-primary",
|
|
657
|
+
disabled && "opacity-50 cursor-not-allowed pointer-events-none"
|
|
650
658
|
),
|
|
651
659
|
children: [
|
|
652
660
|
/* @__PURE__ */ jsx("span", { className: "text-base leading-none", children: selected.flag }),
|
|
@@ -918,7 +926,8 @@ function BirthDateField({
|
|
|
918
926
|
value,
|
|
919
927
|
onChange,
|
|
920
928
|
error,
|
|
921
|
-
className
|
|
929
|
+
className,
|
|
930
|
+
disabled
|
|
922
931
|
}) {
|
|
923
932
|
const [open, setOpen] = React22.useState(false);
|
|
924
933
|
const [text, setText] = React22.useState(
|
|
@@ -983,8 +992,9 @@ function BirthDateField({
|
|
|
983
992
|
inputMode: "numeric",
|
|
984
993
|
value: text,
|
|
985
994
|
onChange: handleTextChange,
|
|
995
|
+
disabled,
|
|
986
996
|
placeholder: "dd/mm/yyyy",
|
|
987
|
-
className: "block h-full w-full bg-transparent px-3 pt-5 pb-2 text-base text-foreground font-ui focus:outline-none placeholder:text-muted-foreground/50"
|
|
997
|
+
className: "block h-full w-full bg-transparent px-3 pt-5 pb-2 text-base text-foreground font-ui focus:outline-none placeholder:text-muted-foreground/50 disabled:opacity-50 disabled:cursor-not-allowed"
|
|
988
998
|
}
|
|
989
999
|
)
|
|
990
1000
|
] }),
|
|
@@ -992,10 +1002,14 @@ function BirthDateField({
|
|
|
992
1002
|
"button",
|
|
993
1003
|
{
|
|
994
1004
|
type: "button",
|
|
995
|
-
onClick: () =>
|
|
1005
|
+
onClick: () => {
|
|
1006
|
+
if (disabled) return;
|
|
1007
|
+
setOpen((v) => !v);
|
|
1008
|
+
},
|
|
996
1009
|
tabIndex: -1,
|
|
1010
|
+
disabled,
|
|
997
1011
|
"aria-label": "Open calendar",
|
|
998
|
-
className: "px-3 h-full flex items-center text-muted-foreground hover:text-primary transition-colors focus:outline-none",
|
|
1012
|
+
className: "px-3 h-full flex items-center text-muted-foreground hover:text-primary transition-colors focus:outline-none disabled:opacity-50 disabled:cursor-not-allowed",
|
|
999
1013
|
children: /* @__PURE__ */ jsx(CalendarIcon, { className: "h-4 w-4" })
|
|
1000
1014
|
}
|
|
1001
1015
|
)
|
|
@@ -1128,7 +1142,8 @@ function CountrySearchField({
|
|
|
1128
1142
|
label = "Country",
|
|
1129
1143
|
countries,
|
|
1130
1144
|
placeholder = "Search country\u2026",
|
|
1131
|
-
className
|
|
1145
|
+
className,
|
|
1146
|
+
disabled
|
|
1132
1147
|
}) {
|
|
1133
1148
|
var _a;
|
|
1134
1149
|
const list = countries != null ? countries : COUNTRIES;
|
|
@@ -1152,6 +1167,7 @@ function CountrySearchField({
|
|
|
1152
1167
|
return () => document.removeEventListener("mousedown", handler);
|
|
1153
1168
|
}, [open]);
|
|
1154
1169
|
const handleOpen = () => {
|
|
1170
|
+
if (disabled) return;
|
|
1155
1171
|
setOpen(true);
|
|
1156
1172
|
setQuery("");
|
|
1157
1173
|
setTimeout(() => {
|
|
@@ -1170,9 +1186,11 @@ function CountrySearchField({
|
|
|
1170
1186
|
{
|
|
1171
1187
|
type: "button",
|
|
1172
1188
|
onClick: handleOpen,
|
|
1189
|
+
disabled,
|
|
1173
1190
|
className: cn(
|
|
1174
1191
|
"relative flex w-full items-center rounded-lg border border-border bg-background h-14 px-3 text-left transition-colors",
|
|
1175
|
-
open && "border-primary ring-1 ring-primary"
|
|
1192
|
+
open && "border-primary ring-1 ring-primary",
|
|
1193
|
+
disabled && "opacity-50 cursor-not-allowed pointer-events-none"
|
|
1176
1194
|
),
|
|
1177
1195
|
children: [
|
|
1178
1196
|
/* @__PURE__ */ jsxs(
|
|
@@ -4182,14 +4200,15 @@ function isFieldEmpty(field, value) {
|
|
|
4182
4200
|
return typeof value === "string" ? !value.trim() : false;
|
|
4183
4201
|
}
|
|
4184
4202
|
}
|
|
4185
|
-
function PhoneInput({ id, label, required, value, onChange, error }) {
|
|
4203
|
+
function PhoneInput({ id, label, required, value, onChange, error, disabled }) {
|
|
4186
4204
|
return /* @__PURE__ */ jsxs("div", { className: "flex w-full min-w-0", children: [
|
|
4187
4205
|
/* @__PURE__ */ jsx(
|
|
4188
4206
|
PhoneCountrySelect,
|
|
4189
4207
|
{
|
|
4190
4208
|
value: value.country,
|
|
4191
4209
|
onChange: (country) => onChange(__spreadProps(__spreadValues({}, value), { country })),
|
|
4192
|
-
className: "shrink-0"
|
|
4210
|
+
className: "shrink-0",
|
|
4211
|
+
disabled
|
|
4193
4212
|
}
|
|
4194
4213
|
),
|
|
4195
4214
|
/* @__PURE__ */ jsxs("div", { className: "relative min-w-0 flex-1", children: [
|
|
@@ -4201,6 +4220,7 @@ function PhoneInput({ id, label, required, value, onChange, error }) {
|
|
|
4201
4220
|
placeholder: " ",
|
|
4202
4221
|
value: value.nationalNumber,
|
|
4203
4222
|
required,
|
|
4223
|
+
disabled,
|
|
4204
4224
|
onChange: (e) => onChange(__spreadProps(__spreadValues({}, value), { nationalNumber: e.target.value })),
|
|
4205
4225
|
className: cn(
|
|
4206
4226
|
"peer block h-14 w-full rounded-r-lg border border-border bg-background",
|
|
@@ -4237,7 +4257,8 @@ function FloatingTextarea({
|
|
|
4237
4257
|
optionalHint,
|
|
4238
4258
|
value,
|
|
4239
4259
|
onChange,
|
|
4240
|
-
error
|
|
4260
|
+
error,
|
|
4261
|
+
disabled
|
|
4241
4262
|
}) {
|
|
4242
4263
|
return /* @__PURE__ */ jsxs("div", { className: "relative", children: [
|
|
4243
4264
|
/* @__PURE__ */ jsx(
|
|
@@ -4248,6 +4269,7 @@ function FloatingTextarea({
|
|
|
4248
4269
|
rows: 5,
|
|
4249
4270
|
value,
|
|
4250
4271
|
required,
|
|
4272
|
+
disabled,
|
|
4251
4273
|
onChange: (e) => onChange(e.target.value),
|
|
4252
4274
|
className: cn(
|
|
4253
4275
|
"peer block w-full resize-none rounded-lg border border-border bg-background",
|
|
@@ -4276,7 +4298,7 @@ function FloatingTextarea({
|
|
|
4276
4298
|
)
|
|
4277
4299
|
] });
|
|
4278
4300
|
}
|
|
4279
|
-
function SelectField({ field, value, onChange, error }) {
|
|
4301
|
+
function SelectField({ field, value, onChange, error, disabled }) {
|
|
4280
4302
|
var _a, _b, _c;
|
|
4281
4303
|
const [open, setOpen] = React22.useState(false);
|
|
4282
4304
|
const containerRef = React22.useRef(null);
|
|
@@ -4297,11 +4319,16 @@ function SelectField({ field, value, onChange, error }) {
|
|
|
4297
4319
|
"button",
|
|
4298
4320
|
{
|
|
4299
4321
|
type: "button",
|
|
4300
|
-
onClick: () =>
|
|
4322
|
+
onClick: () => {
|
|
4323
|
+
if (disabled) return;
|
|
4324
|
+
setOpen((o) => !o);
|
|
4325
|
+
},
|
|
4326
|
+
disabled,
|
|
4301
4327
|
className: cn(
|
|
4302
4328
|
"relative flex w-full items-center rounded-lg border border-border bg-background h-14 px-3 text-left transition-colors",
|
|
4303
4329
|
open && "border-primary ring-1 ring-primary",
|
|
4304
|
-
error && !open && "border-destructive"
|
|
4330
|
+
error && !open && "border-destructive",
|
|
4331
|
+
disabled && "opacity-50 cursor-not-allowed pointer-events-none"
|
|
4305
4332
|
),
|
|
4306
4333
|
children: [
|
|
4307
4334
|
/* @__PURE__ */ jsxs(
|
|
@@ -4359,7 +4386,8 @@ function FieldRenderer({
|
|
|
4359
4386
|
onChange,
|
|
4360
4387
|
defaultPhoneCountry,
|
|
4361
4388
|
labels,
|
|
4362
|
-
error
|
|
4389
|
+
error,
|
|
4390
|
+
disabled
|
|
4363
4391
|
}) {
|
|
4364
4392
|
var _a, _b;
|
|
4365
4393
|
const fieldId = `rf-${field.id}`;
|
|
@@ -4376,6 +4404,7 @@ function FieldRenderer({
|
|
|
4376
4404
|
{
|
|
4377
4405
|
label: labels.firstNameLabel,
|
|
4378
4406
|
required: field.required,
|
|
4407
|
+
disabled,
|
|
4379
4408
|
value: v.firstName,
|
|
4380
4409
|
onChange: (e) => onChange(__spreadProps(__spreadValues({}, v), { firstName: e.target.value })),
|
|
4381
4410
|
error: error && !v.firstName.trim() ? error : void 0
|
|
@@ -4386,6 +4415,7 @@ function FieldRenderer({
|
|
|
4386
4415
|
{
|
|
4387
4416
|
label: labels.lastNameLabel,
|
|
4388
4417
|
required: field.required,
|
|
4418
|
+
disabled,
|
|
4389
4419
|
value: v.lastName,
|
|
4390
4420
|
onChange: (e) => onChange(__spreadProps(__spreadValues({}, v), { lastName: e.target.value })),
|
|
4391
4421
|
error: error && !v.lastName.trim() ? error : void 0
|
|
@@ -4404,7 +4434,8 @@ function FieldRenderer({
|
|
|
4404
4434
|
required: field.required,
|
|
4405
4435
|
value: v,
|
|
4406
4436
|
onChange,
|
|
4407
|
-
error
|
|
4437
|
+
error,
|
|
4438
|
+
disabled
|
|
4408
4439
|
}
|
|
4409
4440
|
);
|
|
4410
4441
|
}
|
|
@@ -4422,6 +4453,7 @@ function FieldRenderer({
|
|
|
4422
4453
|
{
|
|
4423
4454
|
label: labels.emergencyContactFirstName,
|
|
4424
4455
|
required: field.required,
|
|
4456
|
+
disabled,
|
|
4425
4457
|
value: v.contactName.firstName,
|
|
4426
4458
|
onChange: (e) => onChange(__spreadProps(__spreadValues({}, v), {
|
|
4427
4459
|
contactName: __spreadProps(__spreadValues({}, v.contactName), {
|
|
@@ -4436,6 +4468,7 @@ function FieldRenderer({
|
|
|
4436
4468
|
{
|
|
4437
4469
|
label: labels.emergencyContactLastName,
|
|
4438
4470
|
required: field.required,
|
|
4471
|
+
disabled,
|
|
4439
4472
|
value: v.contactName.lastName,
|
|
4440
4473
|
onChange: (e) => onChange(__spreadProps(__spreadValues({}, v), {
|
|
4441
4474
|
contactName: __spreadProps(__spreadValues({}, v.contactName), {
|
|
@@ -4454,7 +4487,8 @@ function FieldRenderer({
|
|
|
4454
4487
|
required: field.required,
|
|
4455
4488
|
value: v.phone,
|
|
4456
4489
|
onChange: (phone) => onChange(__spreadProps(__spreadValues({}, v), { phone })),
|
|
4457
|
-
error: error && !v.phone.nationalNumber.trim() ? error : void 0
|
|
4490
|
+
error: error && !v.phone.nationalNumber.trim() ? error : void 0,
|
|
4491
|
+
disabled
|
|
4458
4492
|
}
|
|
4459
4493
|
)
|
|
4460
4494
|
] })
|
|
@@ -4470,7 +4504,8 @@ function FieldRenderer({
|
|
|
4470
4504
|
optionalHint: !field.required ? labels.optionalLabel : void 0,
|
|
4471
4505
|
value: typeof value === "string" ? value : "",
|
|
4472
4506
|
onChange,
|
|
4473
|
-
error
|
|
4507
|
+
error,
|
|
4508
|
+
disabled
|
|
4474
4509
|
}
|
|
4475
4510
|
);
|
|
4476
4511
|
}
|
|
@@ -4481,7 +4516,8 @@ function FieldRenderer({
|
|
|
4481
4516
|
field,
|
|
4482
4517
|
value: typeof value === "string" ? value : "",
|
|
4483
4518
|
onChange: (v) => onChange(v),
|
|
4484
|
-
error
|
|
4519
|
+
error,
|
|
4520
|
+
disabled
|
|
4485
4521
|
}
|
|
4486
4522
|
);
|
|
4487
4523
|
}
|
|
@@ -4511,6 +4547,7 @@ function FieldRenderer({
|
|
|
4511
4547
|
value: opt.value,
|
|
4512
4548
|
checked: value === opt.value,
|
|
4513
4549
|
required: field.required,
|
|
4550
|
+
disabled,
|
|
4514
4551
|
onChange: () => onChange(opt.value),
|
|
4515
4552
|
className: "h-4 w-4 shrink-0 accent-primary cursor-pointer"
|
|
4516
4553
|
}
|
|
@@ -4534,6 +4571,7 @@ function FieldRenderer({
|
|
|
4534
4571
|
{
|
|
4535
4572
|
type: "checkbox",
|
|
4536
4573
|
checked: value === true,
|
|
4574
|
+
disabled,
|
|
4537
4575
|
onChange: (e) => onChange(e.target.checked),
|
|
4538
4576
|
className: "h-4 w-4 shrink-0 accent-primary cursor-pointer"
|
|
4539
4577
|
}
|
|
@@ -4559,6 +4597,7 @@ function FieldRenderer({
|
|
|
4559
4597
|
{
|
|
4560
4598
|
type: "checkbox",
|
|
4561
4599
|
checked,
|
|
4600
|
+
disabled,
|
|
4562
4601
|
onChange: (e) => onChange(
|
|
4563
4602
|
e.target.checked ? [...selected, opt.value] : selected.filter((x) => x !== opt.value)
|
|
4564
4603
|
),
|
|
@@ -4580,7 +4619,8 @@ function FieldRenderer({
|
|
|
4580
4619
|
label: field.label,
|
|
4581
4620
|
required: field.required,
|
|
4582
4621
|
value: typeof value === "string" ? value : "",
|
|
4583
|
-
onChange: (code) => onChange(code)
|
|
4622
|
+
onChange: (code) => onChange(code),
|
|
4623
|
+
disabled
|
|
4584
4624
|
}
|
|
4585
4625
|
);
|
|
4586
4626
|
}
|
|
@@ -4592,7 +4632,8 @@ function FieldRenderer({
|
|
|
4592
4632
|
required: field.required,
|
|
4593
4633
|
value: asDate(value),
|
|
4594
4634
|
onChange: (d) => onChange(d),
|
|
4595
|
-
error
|
|
4635
|
+
error,
|
|
4636
|
+
disabled
|
|
4596
4637
|
}
|
|
4597
4638
|
);
|
|
4598
4639
|
}
|
|
@@ -4603,6 +4644,7 @@ function FieldRenderer({
|
|
|
4603
4644
|
label: field.label,
|
|
4604
4645
|
required: field.required,
|
|
4605
4646
|
type: "number",
|
|
4647
|
+
disabled,
|
|
4606
4648
|
value: value == null ? "" : String(value),
|
|
4607
4649
|
onChange: (e) => onChange(e.target.value),
|
|
4608
4650
|
error
|
|
@@ -4616,6 +4658,7 @@ function FieldRenderer({
|
|
|
4616
4658
|
label: field.label,
|
|
4617
4659
|
required: field.required,
|
|
4618
4660
|
type: htmlType,
|
|
4661
|
+
disabled,
|
|
4619
4662
|
value: typeof value === "string" ? value : "",
|
|
4620
4663
|
onChange: (e) => onChange(e.target.value),
|
|
4621
4664
|
error
|
|
@@ -4646,7 +4689,8 @@ function RegistrationForm({
|
|
|
4646
4689
|
defaultPhoneCountry = "BR",
|
|
4647
4690
|
dateFormatter,
|
|
4648
4691
|
labels,
|
|
4649
|
-
className
|
|
4692
|
+
className,
|
|
4693
|
+
readOnly = false
|
|
4650
4694
|
}) {
|
|
4651
4695
|
var _a;
|
|
4652
4696
|
const L = React22.useMemo(
|
|
@@ -4809,105 +4853,111 @@ function RegistrationForm({
|
|
|
4809
4853
|
/* @__PURE__ */ jsx("dd", { className: "text-foreground font-medium text-right min-w-0 break-words", children: traveller.fullName })
|
|
4810
4854
|
] })
|
|
4811
4855
|
] }) }),
|
|
4812
|
-
/* @__PURE__ */ jsx(
|
|
4813
|
-
|
|
4814
|
-
|
|
4815
|
-
/* @__PURE__ */
|
|
4816
|
-
|
|
4817
|
-
|
|
4818
|
-
|
|
4819
|
-
|
|
4820
|
-
|
|
4821
|
-
|
|
4822
|
-
|
|
4823
|
-
|
|
4824
|
-
|
|
4825
|
-
|
|
4826
|
-
|
|
4827
|
-
|
|
4828
|
-
|
|
4829
|
-
|
|
4830
|
-
|
|
4831
|
-
|
|
4832
|
-
/* @__PURE__ */
|
|
4833
|
-
|
|
4834
|
-
|
|
4835
|
-
|
|
4836
|
-
|
|
4837
|
-
|
|
4838
|
-
|
|
4839
|
-
|
|
4840
|
-
/* @__PURE__ */ jsx(
|
|
4841
|
-
"input",
|
|
4842
|
-
{
|
|
4843
|
-
type: "checkbox",
|
|
4844
|
-
checked: termsAccepted,
|
|
4845
|
-
required: true,
|
|
4846
|
-
onChange: (e) => setField(TERMS_ACCEPT_KEY, e.target.checked),
|
|
4847
|
-
className: "mt-0.5 h-4 w-4 shrink-0 accent-primary cursor-pointer"
|
|
4848
|
-
}
|
|
4849
|
-
),
|
|
4850
|
-
/* @__PURE__ */ jsxs("span", { children: [
|
|
4851
|
-
L.termsAccept,
|
|
4852
|
-
/* @__PURE__ */ jsx("span", { className: "text-primary ml-0.5", children: "*" })
|
|
4853
|
-
] })
|
|
4854
|
-
]
|
|
4855
|
-
}
|
|
4856
|
-
),
|
|
4857
|
-
termsError && /* @__PURE__ */ jsx("p", { className: "text-xs text-destructive font-ui", children: L.requiredFieldError })
|
|
4858
|
-
] }) : /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1.5", children: [
|
|
4859
|
-
/* @__PURE__ */ jsxs(
|
|
4860
|
-
"div",
|
|
4861
|
-
{
|
|
4862
|
-
role: "radiogroup",
|
|
4863
|
-
"aria-label": L.termsSectionTitle,
|
|
4864
|
-
className: "flex flex-wrap items-center gap-x-6 gap-y-3",
|
|
4865
|
-
children: [
|
|
4866
|
-
/* @__PURE__ */ jsxs(
|
|
4867
|
-
"label",
|
|
4868
|
-
{
|
|
4869
|
-
className: cn(
|
|
4870
|
-
"flex min-h-9 cursor-pointer items-center gap-2.5 font-ui text-sm",
|
|
4871
|
-
termsError ? "text-destructive" : "text-foreground"
|
|
4872
|
-
),
|
|
4873
|
-
children: [
|
|
4874
|
-
/* @__PURE__ */ jsx(
|
|
4875
|
-
"input",
|
|
4876
|
-
{
|
|
4877
|
-
type: "radio",
|
|
4878
|
-
name: "registration-terms-accept",
|
|
4879
|
-
checked: termsAccepted,
|
|
4880
|
-
required: true,
|
|
4881
|
-
onChange: () => setField(TERMS_ACCEPT_KEY, true),
|
|
4882
|
-
className: "h-4 w-4 shrink-0 accent-primary cursor-pointer"
|
|
4883
|
-
}
|
|
4884
|
-
),
|
|
4885
|
-
L.termsAccept,
|
|
4886
|
-
/* @__PURE__ */ jsx("span", { className: "text-primary ml-0.5", children: "*" })
|
|
4887
|
-
]
|
|
4888
|
-
}
|
|
4856
|
+
/* @__PURE__ */ jsx("div", { className: cn(readOnly && "cursor-not-allowed"), children: /* @__PURE__ */ jsxs("div", { className: cn(readOnly && "pointer-events-none opacity-50 select-none"), children: [
|
|
4857
|
+
/* @__PURE__ */ jsx(FormSection2, { title: L.detailsSectionTitle, children: sortedFields.map((field) => {
|
|
4858
|
+
var _a2;
|
|
4859
|
+
return /* @__PURE__ */ jsxs("div", { id: `rf-${field.id}`, className: "flex flex-col gap-1.5", children: [
|
|
4860
|
+
/* @__PURE__ */ jsx(
|
|
4861
|
+
FieldRenderer,
|
|
4862
|
+
{
|
|
4863
|
+
field,
|
|
4864
|
+
value: current[field.id],
|
|
4865
|
+
onChange: (v) => setField(field.id, v),
|
|
4866
|
+
defaultPhoneCountry,
|
|
4867
|
+
labels: L,
|
|
4868
|
+
error: fieldErrors[field.id],
|
|
4869
|
+
disabled: readOnly
|
|
4870
|
+
}
|
|
4871
|
+
),
|
|
4872
|
+
((_a2 = field.helpText) == null ? void 0 : _a2.trim()) && /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground font-ui leading-relaxed", children: field.helpText.trim() })
|
|
4873
|
+
] }, field.id);
|
|
4874
|
+
}) }),
|
|
4875
|
+
termsEnabled && terms && /* @__PURE__ */ jsx("div", { id: "rf-terms", children: /* @__PURE__ */ jsxs(FormSection2, { title: L.termsSectionTitle, children: [
|
|
4876
|
+
/* @__PURE__ */ jsx("div", { className: "max-h-72 overflow-y-auto rounded-lg border border-border bg-muted/30 p-4", children: /* @__PURE__ */ jsx("div", { className: "whitespace-pre-wrap text-sm leading-relaxed text-foreground font-ui", children: terms.markdown }) }),
|
|
4877
|
+
acceptControl === "checkbox" ? /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1.5", children: [
|
|
4878
|
+
/* @__PURE__ */ jsxs(
|
|
4879
|
+
"label",
|
|
4880
|
+
{
|
|
4881
|
+
className: cn(
|
|
4882
|
+
"flex cursor-pointer items-start gap-2.5 font-ui text-sm",
|
|
4883
|
+
termsError ? "text-destructive" : "text-foreground"
|
|
4889
4884
|
),
|
|
4890
|
-
|
|
4885
|
+
children: [
|
|
4891
4886
|
/* @__PURE__ */ jsx(
|
|
4892
4887
|
"input",
|
|
4893
4888
|
{
|
|
4894
|
-
type: "
|
|
4895
|
-
|
|
4896
|
-
|
|
4897
|
-
|
|
4898
|
-
|
|
4889
|
+
type: "checkbox",
|
|
4890
|
+
checked: termsAccepted,
|
|
4891
|
+
required: true,
|
|
4892
|
+
disabled: readOnly,
|
|
4893
|
+
onChange: (e) => setField(TERMS_ACCEPT_KEY, e.target.checked),
|
|
4894
|
+
className: "mt-0.5 h-4 w-4 shrink-0 accent-primary cursor-pointer"
|
|
4899
4895
|
}
|
|
4900
4896
|
),
|
|
4901
|
-
|
|
4902
|
-
|
|
4903
|
-
|
|
4904
|
-
|
|
4905
|
-
|
|
4906
|
-
|
|
4907
|
-
|
|
4897
|
+
/* @__PURE__ */ jsxs("span", { children: [
|
|
4898
|
+
L.termsAccept,
|
|
4899
|
+
/* @__PURE__ */ jsx("span", { className: "text-primary ml-0.5", children: "*" })
|
|
4900
|
+
] })
|
|
4901
|
+
]
|
|
4902
|
+
}
|
|
4903
|
+
),
|
|
4904
|
+
termsError && /* @__PURE__ */ jsx("p", { className: "text-xs text-destructive font-ui", children: L.requiredFieldError })
|
|
4905
|
+
] }) : /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1.5", children: [
|
|
4906
|
+
/* @__PURE__ */ jsxs(
|
|
4907
|
+
"div",
|
|
4908
|
+
{
|
|
4909
|
+
role: "radiogroup",
|
|
4910
|
+
"aria-label": L.termsSectionTitle,
|
|
4911
|
+
className: "flex flex-wrap items-center gap-x-6 gap-y-3",
|
|
4912
|
+
children: [
|
|
4913
|
+
/* @__PURE__ */ jsxs(
|
|
4914
|
+
"label",
|
|
4915
|
+
{
|
|
4916
|
+
className: cn(
|
|
4917
|
+
"flex min-h-9 cursor-pointer items-center gap-2.5 font-ui text-sm",
|
|
4918
|
+
termsError ? "text-destructive" : "text-foreground"
|
|
4919
|
+
),
|
|
4920
|
+
children: [
|
|
4921
|
+
/* @__PURE__ */ jsx(
|
|
4922
|
+
"input",
|
|
4923
|
+
{
|
|
4924
|
+
type: "radio",
|
|
4925
|
+
name: "registration-terms-accept",
|
|
4926
|
+
checked: termsAccepted,
|
|
4927
|
+
required: true,
|
|
4928
|
+
disabled: readOnly,
|
|
4929
|
+
onChange: () => setField(TERMS_ACCEPT_KEY, true),
|
|
4930
|
+
className: "h-4 w-4 shrink-0 accent-primary cursor-pointer"
|
|
4931
|
+
}
|
|
4932
|
+
),
|
|
4933
|
+
L.termsAccept,
|
|
4934
|
+
/* @__PURE__ */ jsx("span", { className: "text-primary ml-0.5", children: "*" })
|
|
4935
|
+
]
|
|
4936
|
+
}
|
|
4937
|
+
),
|
|
4938
|
+
/* @__PURE__ */ jsxs("label", { className: "flex min-h-9 cursor-pointer items-center gap-2.5 font-ui text-sm text-muted-foreground", children: [
|
|
4939
|
+
/* @__PURE__ */ jsx(
|
|
4940
|
+
"input",
|
|
4941
|
+
{
|
|
4942
|
+
type: "radio",
|
|
4943
|
+
name: "registration-terms-accept",
|
|
4944
|
+
checked: current[TERMS_ACCEPT_KEY] === false,
|
|
4945
|
+
disabled: readOnly,
|
|
4946
|
+
onChange: () => setField(TERMS_ACCEPT_KEY, false),
|
|
4947
|
+
className: "h-4 w-4 shrink-0 accent-primary cursor-pointer"
|
|
4948
|
+
}
|
|
4949
|
+
),
|
|
4950
|
+
L.termsDecline
|
|
4951
|
+
] })
|
|
4952
|
+
]
|
|
4953
|
+
}
|
|
4954
|
+
),
|
|
4955
|
+
termsError && /* @__PURE__ */ jsx("p", { className: "text-xs text-destructive font-ui", children: L.requiredFieldError })
|
|
4956
|
+
] })
|
|
4957
|
+
] }) })
|
|
4908
4958
|
] }) }),
|
|
4909
4959
|
error && /* @__PURE__ */ jsx("p", { role: "alert", className: "text-sm text-destructive font-ui", children: error }),
|
|
4910
|
-
/* @__PURE__ */ jsx("div", { className: "flex justify-center pt-2", children: /* @__PURE__ */ jsx(
|
|
4960
|
+
!readOnly && /* @__PURE__ */ jsx("div", { className: "flex justify-center pt-2", children: /* @__PURE__ */ jsx(
|
|
4911
4961
|
"button",
|
|
4912
4962
|
{
|
|
4913
4963
|
type: "submit",
|
|
@@ -7879,6 +7929,66 @@ function ActivityCard({
|
|
|
7879
7929
|
}
|
|
7880
7930
|
);
|
|
7881
7931
|
}
|
|
7932
|
+
var variantStyles = {
|
|
7933
|
+
info: "bg-[oklch(0.96_0.015_174)] border-[#47bca9] text-[#2e2d2c]",
|
|
7934
|
+
success: "bg-[oklch(0.96_0.055_160)] border-green-500 text-[#2e2d2c]",
|
|
7935
|
+
warning: "bg-amber-50 border-amber-400 text-[#2e2d2c]",
|
|
7936
|
+
error: "bg-red-50 border-red-400 text-[#2e2d2c]"
|
|
7937
|
+
};
|
|
7938
|
+
function Toast({
|
|
7939
|
+
message,
|
|
7940
|
+
variant = "info",
|
|
7941
|
+
onClose,
|
|
7942
|
+
duration = 6e3,
|
|
7943
|
+
className
|
|
7944
|
+
}) {
|
|
7945
|
+
const [mounted, setMounted] = React22.useState(false);
|
|
7946
|
+
const [visible, setVisible] = React22.useState(true);
|
|
7947
|
+
React22.useEffect(() => {
|
|
7948
|
+
setMounted(true);
|
|
7949
|
+
}, []);
|
|
7950
|
+
React22.useEffect(() => {
|
|
7951
|
+
if (duration === 0) return;
|
|
7952
|
+
const t = setTimeout(() => {
|
|
7953
|
+
setVisible(false);
|
|
7954
|
+
setTimeout(() => onClose == null ? void 0 : onClose(), 300);
|
|
7955
|
+
}, duration);
|
|
7956
|
+
return () => clearTimeout(t);
|
|
7957
|
+
}, [duration, onClose]);
|
|
7958
|
+
if (!mounted || !visible) return null;
|
|
7959
|
+
return createPortal(
|
|
7960
|
+
/* @__PURE__ */ jsxs(
|
|
7961
|
+
"div",
|
|
7962
|
+
{
|
|
7963
|
+
role: "alert",
|
|
7964
|
+
className: cn(
|
|
7965
|
+
"fixed top-4 left-4 z-[9999] flex items-start gap-3 rounded-lg border px-4 py-3 shadow-lg",
|
|
7966
|
+
"max-w-sm text-sm font-ui leading-snug",
|
|
7967
|
+
"animate-in fade-in slide-in-from-left-4 duration-300",
|
|
7968
|
+
variantStyles[variant],
|
|
7969
|
+
className
|
|
7970
|
+
),
|
|
7971
|
+
children: [
|
|
7972
|
+
/* @__PURE__ */ jsx("span", { className: "flex-1", children: message }),
|
|
7973
|
+
onClose && /* @__PURE__ */ jsx(
|
|
7974
|
+
"button",
|
|
7975
|
+
{
|
|
7976
|
+
type: "button",
|
|
7977
|
+
onClick: () => {
|
|
7978
|
+
setVisible(false);
|
|
7979
|
+
setTimeout(() => onClose(), 300);
|
|
7980
|
+
},
|
|
7981
|
+
className: "shrink-0 opacity-60 hover:opacity-100 transition-opacity",
|
|
7982
|
+
"aria-label": "Fechar",
|
|
7983
|
+
children: /* @__PURE__ */ jsx(XIcon, { size: 14 })
|
|
7984
|
+
}
|
|
7985
|
+
)
|
|
7986
|
+
]
|
|
7987
|
+
}
|
|
7988
|
+
),
|
|
7989
|
+
document.body
|
|
7990
|
+
);
|
|
7991
|
+
}
|
|
7882
7992
|
function PaymentModalShell({
|
|
7883
7993
|
open,
|
|
7884
7994
|
title,
|
|
@@ -8541,6 +8651,6 @@ function LeadCapturePopup({
|
|
|
8541
8651
|
);
|
|
8542
8652
|
}
|
|
8543
8653
|
|
|
8544
|
-
export { ActivityCard, Alert, BirthDateField, BookingConfirmation, BookingConfirmationEmail, BookingConfirmedCard, BookingDetails, BookingForm, BookingOtpEmail, BookingShell, Button, COUNTRIES, CounterField, CountrySearchField, DEFAULT_HEADER_LINKS, DEFAULT_LANGUAGES, DatePickerField, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, FilterPanel, FloatingInput, FloatingSelect, Itinerary, LOGO_PLANETAEXO_DATA_URI, LeadCapturePopup, MenuTrip, OTPCodeInput, Offer, OfferAdventureCard, PaymentAmountSelector, PaymentMethodSelector, PaymentModalShell, PhoneCountrySelect, PhotoGallery, PricingTrip, RegistrationForm, RegistrationSuccessCard, SiteHeader, TERMS_ACCEPT_KEY, TermsSection, ThemeToggle, TravellerFormInviteEmail, TripCard, TripHeader, TripPage, buttonVariants, cn, emailTokens, getStripeAppearance, stripeAppearance, wrapEmailHtml };
|
|
8654
|
+
export { ActivityCard, Alert, BirthDateField, BookingConfirmation, BookingConfirmationEmail, BookingConfirmedCard, BookingDetails, BookingForm, BookingOtpEmail, BookingShell, Button, COUNTRIES, CounterField, CountrySearchField, DEFAULT_HEADER_LINKS, DEFAULT_LANGUAGES, DatePickerField, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, FilterPanel, FloatingInput, FloatingSelect, Itinerary, LOGO_PLANETAEXO_DATA_URI, LeadCapturePopup, MenuTrip, OTPCodeInput, Offer, OfferAdventureCard, PaymentAmountSelector, PaymentMethodSelector, PaymentModalShell, PhoneCountrySelect, PhotoGallery, PricingTrip, RegistrationForm, RegistrationSuccessCard, SiteHeader, TERMS_ACCEPT_KEY, TermsSection, ThemeToggle, Toast, TravellerFormInviteEmail, TripCard, TripHeader, TripPage, buttonVariants, cn, emailTokens, getStripeAppearance, stripeAppearance, wrapEmailHtml };
|
|
8545
8655
|
//# sourceMappingURL=index.js.map
|
|
8546
8656
|
//# sourceMappingURL=index.js.map
|