@planetaexo/design-system 0.46.3 → 0.48.2

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 CHANGED
@@ -219,11 +219,13 @@ function DialogContent(_a) {
219
219
  var _b = _a, {
220
220
  className,
221
221
  children,
222
- showCloseButton = true
222
+ showCloseButton = true,
223
+ closeLabel = "Close"
223
224
  } = _b, props = __objRest(_b, [
224
225
  "className",
225
226
  "children",
226
- "showCloseButton"
227
+ "showCloseButton",
228
+ "closeLabel"
227
229
  ]);
228
230
  return /* @__PURE__ */ jsxRuntime.jsxs(DialogPortal, { children: [
229
231
  /* @__PURE__ */ jsxRuntime.jsx(DialogOverlay, {}),
@@ -255,7 +257,7 @@ function DialogContent(_a) {
255
257
  lucideReact.XIcon,
256
258
  {}
257
259
  ),
258
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Close" })
260
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: closeLabel })
259
261
  ]
260
262
  }
261
263
  )
@@ -278,10 +280,12 @@ function DialogFooter(_a) {
278
280
  var _b = _a, {
279
281
  className,
280
282
  showCloseButton = false,
283
+ closeLabel = "Close",
281
284
  children
282
285
  } = _b, props = __objRest(_b, [
283
286
  "className",
284
287
  "showCloseButton",
288
+ "closeLabel",
285
289
  "children"
286
290
  ]);
287
291
  return /* @__PURE__ */ jsxRuntime.jsxs(
@@ -295,7 +299,7 @@ function DialogFooter(_a) {
295
299
  }, props), {
296
300
  children: [
297
301
  children,
298
- showCloseButton && /* @__PURE__ */ jsxRuntime.jsx(dialog.Dialog.Close, { render: /* @__PURE__ */ jsxRuntime.jsx(Button2, { variant: "outline" }), children: "Close" })
302
+ showCloseButton && /* @__PURE__ */ jsxRuntime.jsx(dialog.Dialog.Close, { render: /* @__PURE__ */ jsxRuntime.jsx(Button2, { variant: "outline" }), children: closeLabel })
299
303
  ]
300
304
  })
301
305
  );
@@ -7381,6 +7385,37 @@ function BookingForm({
7381
7385
  }
7382
7386
  );
7383
7387
  }
7388
+
7389
+ // src/lib/cpf.ts
7390
+ function formatCpf(value) {
7391
+ const digits = value.replace(/\D/g, "").slice(0, 11);
7392
+ if (digits.length <= 3) return digits;
7393
+ if (digits.length <= 6) return `${digits.slice(0, 3)}.${digits.slice(3)}`;
7394
+ if (digits.length <= 9) {
7395
+ return `${digits.slice(0, 3)}.${digits.slice(3, 6)}.${digits.slice(6)}`;
7396
+ }
7397
+ return `${digits.slice(0, 3)}.${digits.slice(3, 6)}.${digits.slice(6, 9)}-${digits.slice(9)}`;
7398
+ }
7399
+ function validateCpf(value) {
7400
+ const digits = value.replace(/\D/g, "");
7401
+ if (digits.length !== 11) return false;
7402
+ if (/^(\d)\1{10}$/.test(digits)) return false;
7403
+ let sum = 0;
7404
+ for (let i = 0; i < 9; i++) {
7405
+ sum += parseInt(digits[i], 10) * (10 - i);
7406
+ }
7407
+ let remainder = sum % 11;
7408
+ const firstDigit = remainder < 2 ? 0 : 11 - remainder;
7409
+ if (firstDigit !== parseInt(digits[9], 10)) return false;
7410
+ sum = 0;
7411
+ for (let i = 0; i < 10; i++) {
7412
+ sum += parseInt(digits[i], 10) * (11 - i);
7413
+ }
7414
+ remainder = sum % 11;
7415
+ const secondDigit = remainder < 2 ? 0 : 11 - remainder;
7416
+ if (secondDigit !== parseInt(digits[10], 10)) return false;
7417
+ return true;
7418
+ }
7384
7419
  var DEFAULT_LABELS11 = {
7385
7420
  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
7421
  detailsSectionTitle: "Your details",
@@ -8003,6 +8038,82 @@ function FieldRenderer({
8003
8038
  }
8004
8039
  );
8005
8040
  }
8041
+ if (field.type === "address") {
8042
+ return /* @__PURE__ */ jsxRuntime.jsx(
8043
+ FloatingInput,
8044
+ {
8045
+ label: field.label,
8046
+ required: field.required,
8047
+ disabled,
8048
+ autoComplete: "address-line1",
8049
+ value: typeof value === "string" ? value : "",
8050
+ onChange: (e) => onChange(e.target.value),
8051
+ error
8052
+ }
8053
+ );
8054
+ }
8055
+ if (field.type === "addressLine2") {
8056
+ return /* @__PURE__ */ jsxRuntime.jsx(
8057
+ FloatingInput,
8058
+ {
8059
+ label: field.label,
8060
+ required: field.required,
8061
+ disabled,
8062
+ autoComplete: "address-line2",
8063
+ value: typeof value === "string" ? value : "",
8064
+ onChange: (e) => onChange(e.target.value),
8065
+ error
8066
+ }
8067
+ );
8068
+ }
8069
+ if (field.type === "city") {
8070
+ return /* @__PURE__ */ jsxRuntime.jsx(
8071
+ FloatingInput,
8072
+ {
8073
+ label: field.label,
8074
+ required: field.required,
8075
+ disabled,
8076
+ autoComplete: "address-level2",
8077
+ value: typeof value === "string" ? value : "",
8078
+ onChange: (e) => onChange(e.target.value),
8079
+ error
8080
+ }
8081
+ );
8082
+ }
8083
+ if (field.type === "postalCode") {
8084
+ return /* @__PURE__ */ jsxRuntime.jsx(
8085
+ FloatingInput,
8086
+ {
8087
+ label: field.label,
8088
+ required: field.required,
8089
+ disabled,
8090
+ autoComplete: "postal-code",
8091
+ value: typeof value === "string" ? value : "",
8092
+ onChange: (e) => onChange(e.target.value),
8093
+ error
8094
+ }
8095
+ );
8096
+ }
8097
+ if (field.type === "document") {
8098
+ const raw = typeof value === "string" ? value : "";
8099
+ const displayValue = validateCpf(raw) ? formatCpf(raw) : raw;
8100
+ return /* @__PURE__ */ jsxRuntime.jsx(
8101
+ FloatingInput,
8102
+ {
8103
+ label: field.label,
8104
+ required: field.required,
8105
+ disabled,
8106
+ autoComplete: "off",
8107
+ value: displayValue,
8108
+ onChange: (e) => {
8109
+ const next = e.target.value;
8110
+ const hasLetters = /[a-zA-Z]/.test(next);
8111
+ onChange(hasLetters ? next : next.replace(/\D/g, ""));
8112
+ },
8113
+ error
8114
+ }
8115
+ );
8116
+ }
8006
8117
  const htmlType = field.label.toLowerCase().includes("mail") ? "email" : "text";
8007
8118
  return /* @__PURE__ */ jsxRuntime.jsx(
8008
8119
  FloatingInput,
@@ -11939,10 +12050,9 @@ function TripHeader({
11939
12050
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute inset-0 bg-gradient-to-t from-black/85 via-black/20 to-transparent" }),
11940
12051
  siteHeader && /* @__PURE__ */ jsxRuntime.jsx(
11941
12052
  SiteHeader,
11942
- {
11943
- links: Array.isArray(siteHeader) ? siteHeader : void 0,
12053
+ __spreadProps(__spreadValues({}, Array.isArray(siteHeader) ? { links: siteHeader } : typeof siteHeader === "object" ? siteHeader : {}), {
11944
12054
  position: "overlay"
11945
- }
12055
+ })
11946
12056
  ),
11947
12057
  !videoUrl && showCarousel && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
11948
12058
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -13962,9 +14072,11 @@ exports.TrustpilotEmbed = TrustpilotEmbed;
13962
14072
  exports.buttonVariants = buttonVariants;
13963
14073
  exports.cn = cn;
13964
14074
  exports.emailTokens = emailTokens;
14075
+ exports.formatCpf = formatCpf;
13965
14076
  exports.getStripeAppearance = getStripeAppearance;
13966
14077
  exports.itineraryDaySpecIcons = itineraryDaySpecIcons;
13967
14078
  exports.stripeAppearance = stripeAppearance;
14079
+ exports.validateCpf = validateCpf;
13968
14080
  exports.wrapEmailHtml = wrapEmailHtml;
13969
14081
  //# sourceMappingURL=index.cjs.map
13970
14082
  //# sourceMappingURL=index.cjs.map