@fairmint/ui 0.2.2 → 0.2.3

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.
@@ -24822,6 +24822,29 @@ function PhoneField({ error: error2, ...rest }) {
24822
24822
  }
24823
24823
  );
24824
24824
  }
24825
+ const US_ZIP_REGEX = /^\d{5}(-\d{4})?$/;
24826
+ const INTL_POSTAL_REGEX = /^[A-Z0-9]+(?:[ -][A-Z0-9]+)*$/i;
24827
+ function createZipSchema(options) {
24828
+ if (options?.international) {
24829
+ return stringType().trim().min(3, "Please enter a valid postal code").max(10, "Please enter a valid postal code").regex(INTL_POSTAL_REGEX, "Please enter a valid postal code");
24830
+ }
24831
+ return stringType().trim().regex(US_ZIP_REGEX, "Please enter a valid ZIP code (e.g. 94105 or 94105-1234)");
24832
+ }
24833
+ const zipSchema = createZipSchema();
24834
+ function ZipField({ error: error2, international = false, ...rest }) {
24835
+ return /* @__PURE__ */ jsx(
24836
+ TextInput,
24837
+ {
24838
+ type: "text",
24839
+ label: rest.label ?? "ZIP / Postal Code",
24840
+ placeholder: rest.placeholder ?? (international ? "SW1A 2AA" : "94105"),
24841
+ autoComplete: "postal-code",
24842
+ inputMode: "text",
24843
+ error: error2,
24844
+ ...rest
24845
+ }
24846
+ );
24847
+ }
24825
24848
  const ANIMATION_MAP = {
24826
24849
  up: "fadeUp",
24827
24850
  down: "fadeDown",
@@ -25821,8 +25844,10 @@ export {
25821
25844
  UserMenu,
25822
25845
  WalletList,
25823
25846
  ZERO_ETHEREUM_ADDRESS,
25847
+ ZipField,
25824
25848
  brandColors,
25825
25849
  colors,
25850
+ createZipSchema,
25826
25851
  emailSchema,
25827
25852
  formatCurrency,
25828
25853
  formatCurrencyPrecise,
@@ -25853,6 +25878,7 @@ export {
25853
25878
  useScrollIntoView,
25854
25879
  useViewportSize,
25855
25880
  validateEthereumAddress,
25856
- z
25881
+ z,
25882
+ zipSchema
25857
25883
  };
25858
25884
  //# sourceMappingURL=fairmint-ui.js.map