@planetaexo/design-system 0.46.3 → 0.48.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 +109 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +31 -2
- package/dist/index.d.ts +31 -2
- package/dist/index.js +108 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -7381,6 +7381,37 @@ function BookingForm({
|
|
|
7381
7381
|
}
|
|
7382
7382
|
);
|
|
7383
7383
|
}
|
|
7384
|
+
|
|
7385
|
+
// src/lib/cpf.ts
|
|
7386
|
+
function formatCpf(value) {
|
|
7387
|
+
const digits = value.replace(/\D/g, "").slice(0, 11);
|
|
7388
|
+
if (digits.length <= 3) return digits;
|
|
7389
|
+
if (digits.length <= 6) return `${digits.slice(0, 3)}.${digits.slice(3)}`;
|
|
7390
|
+
if (digits.length <= 9) {
|
|
7391
|
+
return `${digits.slice(0, 3)}.${digits.slice(3, 6)}.${digits.slice(6)}`;
|
|
7392
|
+
}
|
|
7393
|
+
return `${digits.slice(0, 3)}.${digits.slice(3, 6)}.${digits.slice(6, 9)}-${digits.slice(9)}`;
|
|
7394
|
+
}
|
|
7395
|
+
function validateCpf(value) {
|
|
7396
|
+
const digits = value.replace(/\D/g, "");
|
|
7397
|
+
if (digits.length !== 11) return false;
|
|
7398
|
+
if (/^(\d)\1{10}$/.test(digits)) return false;
|
|
7399
|
+
let sum = 0;
|
|
7400
|
+
for (let i = 0; i < 9; i++) {
|
|
7401
|
+
sum += parseInt(digits[i], 10) * (10 - i);
|
|
7402
|
+
}
|
|
7403
|
+
let remainder = sum % 11;
|
|
7404
|
+
const firstDigit = remainder < 2 ? 0 : 11 - remainder;
|
|
7405
|
+
if (firstDigit !== parseInt(digits[9], 10)) return false;
|
|
7406
|
+
sum = 0;
|
|
7407
|
+
for (let i = 0; i < 10; i++) {
|
|
7408
|
+
sum += parseInt(digits[i], 10) * (11 - i);
|
|
7409
|
+
}
|
|
7410
|
+
remainder = sum % 11;
|
|
7411
|
+
const secondDigit = remainder < 2 ? 0 : 11 - remainder;
|
|
7412
|
+
if (secondDigit !== parseInt(digits[10], 10)) return false;
|
|
7413
|
+
return true;
|
|
7414
|
+
}
|
|
7384
7415
|
var DEFAULT_LABELS11 = {
|
|
7385
7416
|
formSubtitle: "To confirm your participation, please complete this short form. It's required for all travellers and helps us coordinate logistics with our local partners and tailor the experience to you.",
|
|
7386
7417
|
detailsSectionTitle: "Your details",
|
|
@@ -8003,6 +8034,82 @@ function FieldRenderer({
|
|
|
8003
8034
|
}
|
|
8004
8035
|
);
|
|
8005
8036
|
}
|
|
8037
|
+
if (field.type === "address") {
|
|
8038
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
8039
|
+
FloatingInput,
|
|
8040
|
+
{
|
|
8041
|
+
label: field.label,
|
|
8042
|
+
required: field.required,
|
|
8043
|
+
disabled,
|
|
8044
|
+
autoComplete: "address-line1",
|
|
8045
|
+
value: typeof value === "string" ? value : "",
|
|
8046
|
+
onChange: (e) => onChange(e.target.value),
|
|
8047
|
+
error
|
|
8048
|
+
}
|
|
8049
|
+
);
|
|
8050
|
+
}
|
|
8051
|
+
if (field.type === "addressLine2") {
|
|
8052
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
8053
|
+
FloatingInput,
|
|
8054
|
+
{
|
|
8055
|
+
label: field.label,
|
|
8056
|
+
required: field.required,
|
|
8057
|
+
disabled,
|
|
8058
|
+
autoComplete: "address-line2",
|
|
8059
|
+
value: typeof value === "string" ? value : "",
|
|
8060
|
+
onChange: (e) => onChange(e.target.value),
|
|
8061
|
+
error
|
|
8062
|
+
}
|
|
8063
|
+
);
|
|
8064
|
+
}
|
|
8065
|
+
if (field.type === "city") {
|
|
8066
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
8067
|
+
FloatingInput,
|
|
8068
|
+
{
|
|
8069
|
+
label: field.label,
|
|
8070
|
+
required: field.required,
|
|
8071
|
+
disabled,
|
|
8072
|
+
autoComplete: "address-level2",
|
|
8073
|
+
value: typeof value === "string" ? value : "",
|
|
8074
|
+
onChange: (e) => onChange(e.target.value),
|
|
8075
|
+
error
|
|
8076
|
+
}
|
|
8077
|
+
);
|
|
8078
|
+
}
|
|
8079
|
+
if (field.type === "postalCode") {
|
|
8080
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
8081
|
+
FloatingInput,
|
|
8082
|
+
{
|
|
8083
|
+
label: field.label,
|
|
8084
|
+
required: field.required,
|
|
8085
|
+
disabled,
|
|
8086
|
+
autoComplete: "postal-code",
|
|
8087
|
+
value: typeof value === "string" ? value : "",
|
|
8088
|
+
onChange: (e) => onChange(e.target.value),
|
|
8089
|
+
error
|
|
8090
|
+
}
|
|
8091
|
+
);
|
|
8092
|
+
}
|
|
8093
|
+
if (field.type === "document") {
|
|
8094
|
+
const raw = typeof value === "string" ? value : "";
|
|
8095
|
+
const displayValue = validateCpf(raw) ? formatCpf(raw) : raw;
|
|
8096
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
8097
|
+
FloatingInput,
|
|
8098
|
+
{
|
|
8099
|
+
label: field.label,
|
|
8100
|
+
required: field.required,
|
|
8101
|
+
disabled,
|
|
8102
|
+
autoComplete: "off",
|
|
8103
|
+
value: displayValue,
|
|
8104
|
+
onChange: (e) => {
|
|
8105
|
+
const next = e.target.value;
|
|
8106
|
+
const hasLetters = /[a-zA-Z]/.test(next);
|
|
8107
|
+
onChange(hasLetters ? next : next.replace(/\D/g, ""));
|
|
8108
|
+
},
|
|
8109
|
+
error
|
|
8110
|
+
}
|
|
8111
|
+
);
|
|
8112
|
+
}
|
|
8006
8113
|
const htmlType = field.label.toLowerCase().includes("mail") ? "email" : "text";
|
|
8007
8114
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
8008
8115
|
FloatingInput,
|
|
@@ -13962,9 +14069,11 @@ exports.TrustpilotEmbed = TrustpilotEmbed;
|
|
|
13962
14069
|
exports.buttonVariants = buttonVariants;
|
|
13963
14070
|
exports.cn = cn;
|
|
13964
14071
|
exports.emailTokens = emailTokens;
|
|
14072
|
+
exports.formatCpf = formatCpf;
|
|
13965
14073
|
exports.getStripeAppearance = getStripeAppearance;
|
|
13966
14074
|
exports.itineraryDaySpecIcons = itineraryDaySpecIcons;
|
|
13967
14075
|
exports.stripeAppearance = stripeAppearance;
|
|
14076
|
+
exports.validateCpf = validateCpf;
|
|
13968
14077
|
exports.wrapEmailHtml = wrapEmailHtml;
|
|
13969
14078
|
//# sourceMappingURL=index.cjs.map
|
|
13970
14079
|
//# sourceMappingURL=index.cjs.map
|