@doujins/payments-ui 0.1.11 → 0.1.13

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.js CHANGED
@@ -509,7 +509,7 @@ var Input = React15.forwardRef(
509
509
  {
510
510
  type,
511
511
  className: cn(
512
- "flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-base ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
512
+ "placeholder:text-white/30 flex h-9 w-full rounded-md border border-white/30 bg-transparent px-3 py-1 text-base shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium font-light file:text-foreground text-foreground focus:outline-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
513
513
  className
514
514
  ),
515
515
  ref,
@@ -520,7 +520,7 @@ var Input = React15.forwardRef(
520
520
  );
521
521
  Input.displayName = "Input";
522
522
  var labelVariants = cva(
523
- "text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
523
+ "text-sm font-medium leading-none text-foreground peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
524
524
  );
525
525
  var Label = React15.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
526
526
  LabelPrimitive.Root,
@@ -538,7 +538,7 @@ var SelectTrigger = React15.forwardRef(({ className, children, ...props }, ref)
538
538
  {
539
539
  ref,
540
540
  className: cn(
541
- "flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background data-[placeholder]:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",
541
+ "flex h-9 w-full cursor-pointer items-center justify-between rounded-md border border-white/30 bg-transparent px-3 py-1 text-sm placeholder:text-white/30 focus:outline-none disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1 [&>span]:text-current",
542
542
  className
543
543
  ),
544
544
  ...props,
@@ -575,33 +575,25 @@ var SelectScrollDownButton = React15.forwardRef(({ className, ...props }, ref) =
575
575
  }
576
576
  ));
577
577
  SelectScrollDownButton.displayName = SelectPrimitive.ScrollDownButton.displayName;
578
- var SelectContent = React15.forwardRef(({ className, children, position = "popper", ...props }, ref) => /* @__PURE__ */ jsx(SelectPrimitive.Portal, { children: /* @__PURE__ */ jsxs(
578
+ var SelectContent = React15.forwardRef(({ className, children, position = "popper", ...props }, ref) => /* @__PURE__ */ jsxs(
579
579
  SelectPrimitive.Content,
580
580
  {
581
581
  ref,
582
582
  className: cn(
583
- "relative z-50 max-h-[--radix-select-content-available-height] min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-select-content-transform-origin]",
584
- position === "popper" && "data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",
583
+ "relative z-[200] max-h-64 overflow-y-auto overflow-x-hidden rounded-md border border-white/20 bg-background-regular text-foreground shadow-lg backdrop-blur-xl data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
584
+ position === "popper" && "w-[var(--radix-select-trigger-width)]",
585
585
  className
586
586
  ),
587
587
  position,
588
+ sideOffset: 4,
588
589
  ...props,
589
590
  children: [
590
591
  /* @__PURE__ */ jsx(SelectScrollUpButton, {}),
591
- /* @__PURE__ */ jsx(
592
- SelectPrimitive.Viewport,
593
- {
594
- className: cn(
595
- "p-1",
596
- position === "popper" && "h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"
597
- ),
598
- children
599
- }
600
- ),
592
+ /* @__PURE__ */ jsx(SelectPrimitive.Viewport, { className: "p-1", children }),
601
593
  /* @__PURE__ */ jsx(SelectScrollDownButton, {})
602
594
  ]
603
595
  }
604
- ) }));
596
+ ));
605
597
  SelectContent.displayName = SelectPrimitive.Content.displayName;
606
598
  var SelectLabel = React15.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
607
599
  SelectPrimitive.Label,
@@ -617,13 +609,13 @@ var SelectItem = React15.forwardRef(({ className, children, ...props }, ref) =>
617
609
  {
618
610
  ref,
619
611
  className: cn(
620
- "relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
612
+ "relative flex w-full cursor-pointer select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none hover:bg-foreground/10 focus:bg-foreground/10 data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
621
613
  className
622
614
  ),
623
615
  ...props,
624
616
  children: [
625
- /* @__PURE__ */ jsx("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ jsx(SelectPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx(Check, { className: "h-4 w-4" }) }) }),
626
- /* @__PURE__ */ jsx(SelectPrimitive.ItemText, { children })
617
+ /* @__PURE__ */ jsx(SelectPrimitive.ItemText, { children }),
618
+ /* @__PURE__ */ jsx("span", { className: "absolute right-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ jsx(SelectPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx(Check, { className: "h-4 w-4" }) }) })
627
619
  ]
628
620
  }
629
621
  ));
@@ -814,7 +806,8 @@ var CardDetailsForm = ({
814
806
  visible
815
807
  ]);
816
808
  const validate = () => {
817
- if (!firstName.trim() || !lastName.trim() || !address1.trim() || !city.trim() || !postalCode.trim() || !country.trim() || !email.trim()) {
809
+ const emailRequired = !defaultValues?.email && !config.defaultUser?.email;
810
+ if (!firstName.trim() || !lastName.trim() || !address1.trim() || !city.trim() || !postalCode.trim() || !country.trim() || emailRequired && !email.trim()) {
818
811
  setLocalError("Please complete all required billing fields.");
819
812
  return false;
820
813
  }
@@ -832,7 +825,8 @@ var CardDetailsForm = ({
832
825
  window.CollectJS.startPaymentRequest();
833
826
  };
834
827
  const errorMessage = localError ?? externalError;
835
- const collectFieldClass = "relative flex h-11 w-full items-center overflow-hidden rounded-md border border-border/60 bg-background/40 px-3 text-sm text-foreground";
828
+ const collectFieldClass = "relative flex h-9 w-full items-center overflow-hidden rounded-md border border-white/30 bg-transparent px-3 text-sm text-foreground";
829
+ const showEmailField = !defaultValues?.email && !config.defaultUser?.email;
836
830
  return /* @__PURE__ */ jsxs(
837
831
  "form",
838
832
  {
@@ -867,7 +861,7 @@ var CardDetailsForm = ({
867
861
  )
868
862
  ] })
869
863
  ] }),
870
- /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
864
+ showEmailField && /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
871
865
  /* @__PURE__ */ jsx(Label, { htmlFor: "email", children: "Email" }),
872
866
  /* @__PURE__ */ jsx(
873
867
  Input,
@@ -956,7 +950,7 @@ var CardDetailsForm = ({
956
950
  Button,
957
951
  {
958
952
  type: "submit",
959
- className: "w-full",
953
+ className: "w-full border-0 bg-emerald-600 text-white hover:bg-emerald-500 disabled:opacity-50",
960
954
  disabled: submitting || submitDisabled || isTokenizing,
961
955
  children: submitting || isTokenizing ? /* @__PURE__ */ jsxs(Fragment, { children: [
962
956
  /* @__PURE__ */ jsx(Loader2, { className: "mr-2 h-4 w-4 animate-spin" }),
@@ -2254,7 +2248,7 @@ var SubscriptionCheckoutModal = ({
2254
2248
  /* @__PURE__ */ jsx(Dialog, { open, onOpenChange: handleClose, children: /* @__PURE__ */ jsxs(
2255
2249
  DialogContent,
2256
2250
  {
2257
- className: "z-[100] max-w-3xl max-h-[90vh] overflow-y-auto border border-white/20 p-6 backdrop-blur-xl bg-background-regular rounded-md [&::-webkit-scrollbar]:hidden",
2251
+ className: "z-[100] max-w-xl max-h-[90vh] overflow-y-auto border border-white/20 p-6 backdrop-blur-xl bg-background-regular rounded-md [&::-webkit-scrollbar]:hidden",
2258
2252
  children: [
2259
2253
  /* @__PURE__ */ jsx(DialogHeader, { children: /* @__PURE__ */ jsx(DialogTitle, { className: "flex items-center gap-2 text-foreground", children: "Checkout" }) }),
2260
2254
  /* @__PURE__ */ jsx("div", { className: "space-y-4", children: !priceId ? /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 text-center px-3 py-2 text-sm text-destructive", children: [
@@ -3171,7 +3165,7 @@ var PaymentMethodsSection = ({
3171
3165
  /* @__PURE__ */ jsx(Dialog, { open: isModalOpen, onOpenChange: setIsModalOpen, children: /* @__PURE__ */ jsxs(
3172
3166
  DialogContent,
3173
3167
  {
3174
- className: "z-[100] max-w-3xl max-h-[90vh] overflow-y-auto border border-white/20 p-6 backdrop-blur-xl bg-background-regular rounded-md [&::-webkit-scrollbar]:hidden",
3168
+ className: "z-[100] max-w-xl max-h-[90vh] overflow-y-auto border border-white/20 p-6 backdrop-blur-xl bg-background-regular rounded-md [&::-webkit-scrollbar]:hidden",
3175
3169
  children: [
3176
3170
  /* @__PURE__ */ jsxs(DialogHeader, { children: [
3177
3171
  /* @__PURE__ */ jsx(DialogTitle, { className: "flex items-center gap-2 text-foreground", children: t.addNewCard }),