@sesionario/blocks 1.41.0 → 1.42.0-rc.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 CHANGED
@@ -6469,6 +6469,59 @@ var FlagComponent = ({ country, countryName }) => {
6469
6469
  return /* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex h-4 w-6 overflow-hidden rounded-sm bg-foreground/20 [&_svg:not([class*='size-'])]:size-full", children: Flag2 && /* @__PURE__ */ jsxRuntime.jsx(Flag2, { title: countryName }) });
6470
6470
  };
6471
6471
 
6472
+ // src/lib/rfc.ts
6473
+ var RFC_PERSONA_FISICA_RE = /^[A-ZÑ&]{4}\d{6}[A-Z0-9]{2}[0-9A]$/;
6474
+ var RFC_PERSONA_MORAL_RE = /^[A-ZÑ&]{3}\d{6}[A-Z0-9]{2}[0-9A]$/;
6475
+ var RFC_INPUT_CHARS_RE = /[^A-ZÑ&0-9]/g;
6476
+ function normalizeRfc(rfc) {
6477
+ return rfc.trim().toUpperCase().replace(/\s|-/g, "");
6478
+ }
6479
+ function formatRfcInput(raw, kind = "both") {
6480
+ const cleaned = raw.toUpperCase().replace(RFC_INPUT_CHARS_RE, "");
6481
+ const max = kind === "moral" ? 12 : 13;
6482
+ return cleaned.slice(0, max);
6483
+ }
6484
+ function isValidPersonaFisicaRfc(rfc) {
6485
+ const value = normalizeRfc(rfc);
6486
+ return value.length === 13 && RFC_PERSONA_FISICA_RE.test(value);
6487
+ }
6488
+ function isValidPersonaMoralRfc(rfc) {
6489
+ const value = normalizeRfc(rfc);
6490
+ return value.length === 12 && RFC_PERSONA_MORAL_RE.test(value);
6491
+ }
6492
+ function isValidRfc(rfc) {
6493
+ return isValidPersonaFisicaRfc(rfc) || isValidPersonaMoralRfc(rfc);
6494
+ }
6495
+ var RfcInput = React2__namespace.forwardRef(
6496
+ ({
6497
+ className,
6498
+ value,
6499
+ onChange,
6500
+ kind = "both",
6501
+ autoComplete = "off",
6502
+ ...props
6503
+ }, ref) => {
6504
+ const maxLength = kind === "moral" ? 12 : 13;
6505
+ return /* @__PURE__ */ jsxRuntime.jsx(
6506
+ Input,
6507
+ {
6508
+ ...props,
6509
+ ref,
6510
+ type: "text",
6511
+ autoCapitalize: "characters",
6512
+ autoCorrect: "off",
6513
+ spellCheck: false,
6514
+ autoComplete,
6515
+ maxLength,
6516
+ value,
6517
+ className: cn("uppercase tracking-wide", className),
6518
+ onChange: (event) => onChange(formatRfcInput(event.target.value, kind))
6519
+ }
6520
+ );
6521
+ }
6522
+ );
6523
+ RfcInput.displayName = "RfcInput";
6524
+
6472
6525
  // src/data/mexicoStates.ts
6473
6526
  var MEXICO_STATES = [
6474
6527
  { id: "MXAGU", name: "Aguascalientes" },
@@ -9196,6 +9249,7 @@ exports.PaymentIcon = PaymentIcon;
9196
9249
  exports.PhoneInput = PhoneInput;
9197
9250
  exports.PlatformAccountMenu = PlatformAccountMenu;
9198
9251
  exports.PlatformNavbar = PlatformNavbar;
9252
+ exports.RfcInput = RfcInput;
9199
9253
  exports.SafeImage = SafeImage;
9200
9254
  exports.ScrollRestorationProvider = ScrollRestorationProvider;
9201
9255
  exports.SearchCommand = SearchCommand;
@@ -9214,14 +9268,19 @@ exports.cn = cn;
9214
9268
  exports.createSupportChatClient = createSupportChatClient;
9215
9269
  exports.defaultLanguages = defaultLanguages;
9216
9270
  exports.formatPaymentCardBrand = formatPaymentCardBrand;
9271
+ exports.formatRfcInput = formatRfcInput;
9217
9272
  exports.fuzzyMatch = fuzzyMatch;
9218
9273
  exports.getAvatarColors = getAvatarColors;
9219
9274
  exports.getInitials = getInitials;
9220
9275
  exports.insertAtCaret = insertAtCaret;
9276
+ exports.isValidPersonaFisicaRfc = isValidPersonaFisicaRfc;
9277
+ exports.isValidPersonaMoralRfc = isValidPersonaMoralRfc;
9278
+ exports.isValidRfc = isValidRfc;
9221
9279
  exports.markerVariants = markerVariants;
9222
9280
  exports.mergePlatformAccountOrgs = mergePlatformAccountOrgs;
9223
9281
  exports.normalizeEmojiQuery = normalizeEmojiQuery;
9224
9282
  exports.normalizePaymentCardBrand = normalizePaymentCardBrand;
9283
+ exports.normalizeRfc = normalizeRfc;
9225
9284
  exports.paymentIconBrandFromStripe = paymentIconBrandFromStripe;
9226
9285
  exports.paymentTypeFromStripeBrand = paymentTypeFromStripeBrand;
9227
9286
  exports.prefersReducedMotion = prefersReducedMotion;