@use-stall/ui 0.0.1 → 0.0.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.
package/dist/index.d.mts CHANGED
@@ -25,6 +25,7 @@ import * as react_hook_form from 'react-hook-form';
25
25
  import { FieldValues, FieldPath, ControllerProps } from 'react-hook-form';
26
26
  import * as LabelPrimitive from '@radix-ui/react-label';
27
27
  import * as input_otp from 'input-otp';
28
+ import * as RPNInput from 'react-phone-number-input';
28
29
  import * as PopoverPrimitive from '@radix-ui/react-popover';
29
30
  import * as ProgressPrimitive from '@radix-ui/react-progress';
30
31
  import * as ScrollAreaPrimitive from '@radix-ui/react-scroll-area';
@@ -632,10 +633,10 @@ declare const InputOTPSlot: React$1.ForwardRefExoticComponent<Omit<React$1.Detai
632
633
  } & React$1.RefAttributes<HTMLDivElement>>;
633
634
  declare const InputOTPSeparator: React$1.ForwardRefExoticComponent<Omit<React$1.DetailedHTMLProps<React$1.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & React$1.RefAttributes<HTMLDivElement>>;
634
635
 
635
- interface InputProps$1 extends React$1.InputHTMLAttributes<HTMLInputElement> {
636
+ interface InputProps extends React$1.InputHTMLAttributes<HTMLInputElement> {
636
637
  removeFocusIndicator?: boolean;
637
638
  }
638
- declare const Input: React$1.ForwardRefExoticComponent<InputProps$1 & React$1.RefAttributes<HTMLInputElement>>;
639
+ declare const Input: React$1.ForwardRefExoticComponent<InputProps & React$1.RefAttributes<HTMLInputElement>>;
639
640
 
640
641
  declare const Label: React$1.ForwardRefExoticComponent<Omit<LabelPrimitive.LabelProps & React$1.RefAttributes<HTMLLabelElement>, "ref"> & VariantProps<(props?: class_variance_authority_dist_types.ClassProp | undefined) => string> & React$1.RefAttributes<HTMLLabelElement>>;
641
642
 
@@ -662,11 +663,18 @@ declare const MultiSelect: {
662
663
  displayName: string;
663
664
  };
664
665
 
665
- interface InputProps extends React__default.InputHTMLAttributes<HTMLInputElement> {
666
+ interface PasswordInputProps extends React__default.InputHTMLAttributes<HTMLInputElement> {
666
667
  showStrength?: boolean;
667
668
  onSubmit?: (event: React__default.FormEvent) => void;
668
669
  }
669
670
 
671
+ type PhoneProps = {
672
+ className?: string;
673
+ value: string | number;
674
+ onChange: (value: string | number) => void;
675
+ } & React__default.ComponentProps<typeof RPNInput.default>;
676
+ declare function PhoneNumberInput({ className, ...props }: PhoneProps): react_jsx_runtime.JSX.Element;
677
+
670
678
  declare const Popover: React$1.FC<PopoverPrimitive.PopoverProps>;
671
679
  declare const PopoverTrigger: React$1.ForwardRefExoticComponent<PopoverPrimitive.PopoverTriggerProps & React$1.RefAttributes<HTMLButtonElement>>;
672
680
  interface PopoverProps extends React$1.ComponentPropsWithoutRef<typeof PopoverPrimitive.Content> {
@@ -767,4 +775,4 @@ declare const TooltipContent: React$1.ForwardRefExoticComponent<Omit<TooltipPrim
767
775
 
768
776
  declare function cn(...inputs: ClassValue[]): string;
769
777
 
770
- export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, AlertDialog, AlertDialogBackdrop, AlertDialogClose, AlertDialogPopup as AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogBackdrop as AlertDialogOverlay, AlertDialogPopup, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, Avatar, AvatarFallback, AvatarImage, Badge, type InputProps$1 as BaseInputProps, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Checkbox, Combobox, ComboboxChip, ComboboxChips, ComboboxClear, ComboboxCollection, ComboboxEmpty, ComboboxGroup, ComboboxGroupLabel, ComboboxInput, ComboboxItem, ComboboxList, Combobox$1 as ComboboxMulti, ComboboxPopup, ComboboxRow, ComboboxSeparator, ComboboxStatus, ComboboxTrigger, ComboboxValue, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, ConfirmDialog, CopyButton, CountryPicker, Dialog, DialogBackdrop, DialogClose, DialogPopup as DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogBackdrop as DialogOverlay, DialogPopup, DialogPortal, DialogTitle, DialogTrigger, Drawer, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerPortal, DrawerTitle, DrawerTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, ButtonRoot as FancyButton, Field, FieldControl, FieldDescription, FieldError, FieldLabel, FieldValidity, Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, ButtonIcon as Icon, Input, InputOTP, InputOTPGroup, InputOTPSeparator, InputOTPSlot, type InputProps, Label, MultiSelect, type InputProps as PasswordInputProps, type PolymorphicComponent, type PolymorphicComponentProps, type PolymorphicComponentPropsWithRef, type PolymorphicRef, Popover, PopoverContent, PopoverTrigger, Progress, ButtonRoot as Root, ScrollArea, ScrollBar, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetOverlay, SheetPortal, SheetTitle, SheetTrigger, Skeleton, StatusIndicator, Switch, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, type TextareaProps, Timeline, TimelineConnector, TimelineContent, TimelineDescription, TimelineDot, type TimelineDotProps, TimelineItem, type TimelineProps, TimelineSeparator, TimelineTitle, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, badgeVariants, buttonVariants, cn, statusIndicatorVariants, tv, useComboboxFilter, useFormField };
778
+ export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, AlertDialog, AlertDialogBackdrop, AlertDialogClose, AlertDialogPopup as AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogBackdrop as AlertDialogOverlay, AlertDialogPopup, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, Avatar, AvatarFallback, AvatarImage, Badge, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Checkbox, Combobox, ComboboxChip, ComboboxChips, ComboboxClear, ComboboxCollection, ComboboxEmpty, ComboboxGroup, ComboboxGroupLabel, ComboboxInput, ComboboxItem, ComboboxList, Combobox$1 as ComboboxMulti, ComboboxPopup, ComboboxRow, ComboboxSeparator, ComboboxStatus, ComboboxTrigger, ComboboxValue, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, ConfirmDialog, CopyButton, CountryPicker, Dialog, DialogBackdrop, DialogClose, DialogPopup as DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogBackdrop as DialogOverlay, DialogPopup, DialogPortal, DialogTitle, DialogTrigger, Drawer, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerPortal, DrawerTitle, DrawerTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, ButtonRoot as FancyButton, Field, FieldControl, FieldDescription, FieldError, FieldLabel, FieldValidity, Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, ButtonIcon as Icon, Input, InputOTP, InputOTPGroup, InputOTPSeparator, InputOTPSlot, type InputProps, Label, MultiSelect, type PasswordInputProps, PhoneNumberInput, type PolymorphicComponent, type PolymorphicComponentProps, type PolymorphicComponentPropsWithRef, type PolymorphicRef, Popover, PopoverContent, PopoverTrigger, Progress, ButtonRoot as Root, ScrollArea, ScrollBar, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetOverlay, SheetPortal, SheetTitle, SheetTrigger, Skeleton, StatusIndicator, Switch, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, type TextareaProps, Timeline, TimelineConnector, TimelineContent, TimelineDescription, TimelineDot, type TimelineDotProps, TimelineItem, type TimelineProps, TimelineSeparator, TimelineTitle, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, badgeVariants, buttonVariants, cn, statusIndicatorVariants, tv, useComboboxFilter, useFormField };
package/dist/index.d.ts CHANGED
@@ -25,6 +25,7 @@ import * as react_hook_form from 'react-hook-form';
25
25
  import { FieldValues, FieldPath, ControllerProps } from 'react-hook-form';
26
26
  import * as LabelPrimitive from '@radix-ui/react-label';
27
27
  import * as input_otp from 'input-otp';
28
+ import * as RPNInput from 'react-phone-number-input';
28
29
  import * as PopoverPrimitive from '@radix-ui/react-popover';
29
30
  import * as ProgressPrimitive from '@radix-ui/react-progress';
30
31
  import * as ScrollAreaPrimitive from '@radix-ui/react-scroll-area';
@@ -632,10 +633,10 @@ declare const InputOTPSlot: React$1.ForwardRefExoticComponent<Omit<React$1.Detai
632
633
  } & React$1.RefAttributes<HTMLDivElement>>;
633
634
  declare const InputOTPSeparator: React$1.ForwardRefExoticComponent<Omit<React$1.DetailedHTMLProps<React$1.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & React$1.RefAttributes<HTMLDivElement>>;
634
635
 
635
- interface InputProps$1 extends React$1.InputHTMLAttributes<HTMLInputElement> {
636
+ interface InputProps extends React$1.InputHTMLAttributes<HTMLInputElement> {
636
637
  removeFocusIndicator?: boolean;
637
638
  }
638
- declare const Input: React$1.ForwardRefExoticComponent<InputProps$1 & React$1.RefAttributes<HTMLInputElement>>;
639
+ declare const Input: React$1.ForwardRefExoticComponent<InputProps & React$1.RefAttributes<HTMLInputElement>>;
639
640
 
640
641
  declare const Label: React$1.ForwardRefExoticComponent<Omit<LabelPrimitive.LabelProps & React$1.RefAttributes<HTMLLabelElement>, "ref"> & VariantProps<(props?: class_variance_authority_dist_types.ClassProp | undefined) => string> & React$1.RefAttributes<HTMLLabelElement>>;
641
642
 
@@ -662,11 +663,18 @@ declare const MultiSelect: {
662
663
  displayName: string;
663
664
  };
664
665
 
665
- interface InputProps extends React__default.InputHTMLAttributes<HTMLInputElement> {
666
+ interface PasswordInputProps extends React__default.InputHTMLAttributes<HTMLInputElement> {
666
667
  showStrength?: boolean;
667
668
  onSubmit?: (event: React__default.FormEvent) => void;
668
669
  }
669
670
 
671
+ type PhoneProps = {
672
+ className?: string;
673
+ value: string | number;
674
+ onChange: (value: string | number) => void;
675
+ } & React__default.ComponentProps<typeof RPNInput.default>;
676
+ declare function PhoneNumberInput({ className, ...props }: PhoneProps): react_jsx_runtime.JSX.Element;
677
+
670
678
  declare const Popover: React$1.FC<PopoverPrimitive.PopoverProps>;
671
679
  declare const PopoverTrigger: React$1.ForwardRefExoticComponent<PopoverPrimitive.PopoverTriggerProps & React$1.RefAttributes<HTMLButtonElement>>;
672
680
  interface PopoverProps extends React$1.ComponentPropsWithoutRef<typeof PopoverPrimitive.Content> {
@@ -767,4 +775,4 @@ declare const TooltipContent: React$1.ForwardRefExoticComponent<Omit<TooltipPrim
767
775
 
768
776
  declare function cn(...inputs: ClassValue[]): string;
769
777
 
770
- export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, AlertDialog, AlertDialogBackdrop, AlertDialogClose, AlertDialogPopup as AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogBackdrop as AlertDialogOverlay, AlertDialogPopup, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, Avatar, AvatarFallback, AvatarImage, Badge, type InputProps$1 as BaseInputProps, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Checkbox, Combobox, ComboboxChip, ComboboxChips, ComboboxClear, ComboboxCollection, ComboboxEmpty, ComboboxGroup, ComboboxGroupLabel, ComboboxInput, ComboboxItem, ComboboxList, Combobox$1 as ComboboxMulti, ComboboxPopup, ComboboxRow, ComboboxSeparator, ComboboxStatus, ComboboxTrigger, ComboboxValue, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, ConfirmDialog, CopyButton, CountryPicker, Dialog, DialogBackdrop, DialogClose, DialogPopup as DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogBackdrop as DialogOverlay, DialogPopup, DialogPortal, DialogTitle, DialogTrigger, Drawer, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerPortal, DrawerTitle, DrawerTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, ButtonRoot as FancyButton, Field, FieldControl, FieldDescription, FieldError, FieldLabel, FieldValidity, Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, ButtonIcon as Icon, Input, InputOTP, InputOTPGroup, InputOTPSeparator, InputOTPSlot, type InputProps, Label, MultiSelect, type InputProps as PasswordInputProps, type PolymorphicComponent, type PolymorphicComponentProps, type PolymorphicComponentPropsWithRef, type PolymorphicRef, Popover, PopoverContent, PopoverTrigger, Progress, ButtonRoot as Root, ScrollArea, ScrollBar, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetOverlay, SheetPortal, SheetTitle, SheetTrigger, Skeleton, StatusIndicator, Switch, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, type TextareaProps, Timeline, TimelineConnector, TimelineContent, TimelineDescription, TimelineDot, type TimelineDotProps, TimelineItem, type TimelineProps, TimelineSeparator, TimelineTitle, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, badgeVariants, buttonVariants, cn, statusIndicatorVariants, tv, useComboboxFilter, useFormField };
778
+ export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, AlertDialog, AlertDialogBackdrop, AlertDialogClose, AlertDialogPopup as AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogBackdrop as AlertDialogOverlay, AlertDialogPopup, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, Avatar, AvatarFallback, AvatarImage, Badge, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Checkbox, Combobox, ComboboxChip, ComboboxChips, ComboboxClear, ComboboxCollection, ComboboxEmpty, ComboboxGroup, ComboboxGroupLabel, ComboboxInput, ComboboxItem, ComboboxList, Combobox$1 as ComboboxMulti, ComboboxPopup, ComboboxRow, ComboboxSeparator, ComboboxStatus, ComboboxTrigger, ComboboxValue, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, ConfirmDialog, CopyButton, CountryPicker, Dialog, DialogBackdrop, DialogClose, DialogPopup as DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogBackdrop as DialogOverlay, DialogPopup, DialogPortal, DialogTitle, DialogTrigger, Drawer, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerPortal, DrawerTitle, DrawerTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, ButtonRoot as FancyButton, Field, FieldControl, FieldDescription, FieldError, FieldLabel, FieldValidity, Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, ButtonIcon as Icon, Input, InputOTP, InputOTPGroup, InputOTPSeparator, InputOTPSlot, type InputProps, Label, MultiSelect, type PasswordInputProps, PhoneNumberInput, type PolymorphicComponent, type PolymorphicComponentProps, type PolymorphicComponentPropsWithRef, type PolymorphicRef, Popover, PopoverContent, PopoverTrigger, Progress, ButtonRoot as Root, ScrollArea, ScrollBar, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetOverlay, SheetPortal, SheetTitle, SheetTrigger, Skeleton, StatusIndicator, Switch, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, type TextareaProps, Timeline, TimelineConnector, TimelineContent, TimelineDescription, TimelineDot, type TimelineDotProps, TimelineItem, type TimelineProps, TimelineSeparator, TimelineTitle, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, badgeVariants, buttonVariants, cn, statusIndicatorVariants, tv, useComboboxFilter, useFormField };
package/dist/index.js CHANGED
@@ -154,6 +154,7 @@ __export(index_exports, {
154
154
  InputOTPSlot: () => InputOTPSlot,
155
155
  Label: () => Label2,
156
156
  MultiSelect: () => MultiSelect,
157
+ PhoneNumberInput: () => PhoneNumberInput,
157
158
  Popover: () => Popover,
158
159
  PopoverContent: () => PopoverContent,
159
160
  PopoverTrigger: () => PopoverTrigger,
@@ -2811,6 +2812,35 @@ var RPNInput = __toESM(require("react-phone-number-input"));
2811
2812
  var import_flags = __toESM(require("react-phone-number-input/flags"));
2812
2813
  var import_react_phone_number_input = require("react-phone-number-input");
2813
2814
  var import_jsx_runtime28 = require("react/jsx-runtime");
2815
+ function PhoneNumberInput({
2816
+ className = "",
2817
+ ...props
2818
+ }) {
2819
+ const [error, setError] = (0, import_react5.useState)(null);
2820
+ const handleChange = (newValue) => {
2821
+ if (newValue && !(0, import_react_phone_number_input.isValidPhoneNumber)(newValue)) {
2822
+ setError("Invalid phone number");
2823
+ } else {
2824
+ setError(null);
2825
+ }
2826
+ props.onChange(newValue ?? "");
2827
+ };
2828
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className, children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
2829
+ RPNInput.default,
2830
+ {
2831
+ className: cn("flex rounded-md shadow-xs", error && "border border-red-500/70"),
2832
+ international: true,
2833
+ flagComponent: FlagComponent,
2834
+ countrySelectComponent: CountrySelect,
2835
+ inputComponent: PhoneInput,
2836
+ id: "input-46",
2837
+ placeholder: "Enter phone number",
2838
+ ...props,
2839
+ value: props.value,
2840
+ onChange: (e) => handleChange(e ?? "")
2841
+ }
2842
+ ) });
2843
+ }
2814
2844
  var PhoneInput = (0, import_react5.forwardRef)(
2815
2845
  ({ className, ...props }, ref) => {
2816
2846
  return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
@@ -2827,6 +2857,50 @@ var PhoneInput = (0, import_react5.forwardRef)(
2827
2857
  }
2828
2858
  );
2829
2859
  PhoneInput.displayName = "PhoneInput";
2860
+ var CountrySelect = ({
2861
+ disabled,
2862
+ value,
2863
+ onChange,
2864
+ options: options2
2865
+ }) => {
2866
+ const handleSelect = (event) => {
2867
+ onChange(event.target.value);
2868
+ };
2869
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
2870
+ "div",
2871
+ {
2872
+ className: "relative inline-flex items-center self-stretch rounded-s-md border border-input\n bg-background py-2 pe-2 ps-3 text-muted-foreground transition-shadow focus-within:z-10\n focus-within:border-ring focus-within:outline-hidden focus-within:ring-[3px] focus-within:ring-ring/20\n hover:text-foreground has-disabled:pointer-events-none has-disabled:opacity-50",
2873
+ children: [
2874
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "inline-flex items-center gap-1", "aria-hidden": "true", children: [
2875
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(FlagComponent, { country: value, countryName: value, "aria-hidden": "true" }),
2876
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "text-muted-foreground/80", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_lucide_react12.ChevronDown, { size: 16, strokeWidth: 2, "aria-hidden": "true" }) })
2877
+ ] }),
2878
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
2879
+ "select",
2880
+ {
2881
+ disabled,
2882
+ value,
2883
+ onChange: handleSelect,
2884
+ className: "absolute inset-0 text-sm opacity-0",
2885
+ "aria-label": "Select country",
2886
+ children: [
2887
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("option", { value: "", children: "Select a country" }, "default"),
2888
+ options2.filter((x) => x.value).map((option, i) => /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("option", { value: option.value, children: [
2889
+ option.label,
2890
+ " ",
2891
+ option.value && `+${RPNInput.getCountryCallingCode(option.value)}`
2892
+ ] }, option.value ?? `empty-${i}`))
2893
+ ]
2894
+ }
2895
+ )
2896
+ ]
2897
+ }
2898
+ );
2899
+ };
2900
+ var FlagComponent = ({ country, countryName }) => {
2901
+ const Flag = import_flags.default[country];
2902
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "w-5 overflow-hidden rounded-sm", children: Flag ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Flag, { title: countryName }) : /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_lucide_react12.Phone, { size: 16, "aria-hidden": "true" }) });
2903
+ };
2830
2904
 
2831
2905
  // src/components/price-input.tsx
2832
2906
  var import_react6 = __toESM(require("react"));
@@ -3678,6 +3752,7 @@ TooltipContent.displayName = TooltipPrimitive.Content.displayName;
3678
3752
  InputOTPSlot,
3679
3753
  Label,
3680
3754
  MultiSelect,
3755
+ PhoneNumberInput,
3681
3756
  Popover,
3682
3757
  PopoverContent,
3683
3758
  PopoverTrigger,
package/dist/index.mjs CHANGED
@@ -2593,6 +2593,35 @@ import * as RPNInput from "react-phone-number-input";
2593
2593
  import flags from "react-phone-number-input/flags";
2594
2594
  import { isValidPhoneNumber } from "react-phone-number-input";
2595
2595
  import { jsx as jsx28, jsxs as jsxs18 } from "react/jsx-runtime";
2596
+ function PhoneNumberInput({
2597
+ className = "",
2598
+ ...props
2599
+ }) {
2600
+ const [error, setError] = useState3(null);
2601
+ const handleChange = (newValue) => {
2602
+ if (newValue && !isValidPhoneNumber(newValue)) {
2603
+ setError("Invalid phone number");
2604
+ } else {
2605
+ setError(null);
2606
+ }
2607
+ props.onChange(newValue ?? "");
2608
+ };
2609
+ return /* @__PURE__ */ jsx28("div", { className, children: /* @__PURE__ */ jsx28(
2610
+ RPNInput.default,
2611
+ {
2612
+ className: cn("flex rounded-md shadow-xs", error && "border border-red-500/70"),
2613
+ international: true,
2614
+ flagComponent: FlagComponent,
2615
+ countrySelectComponent: CountrySelect,
2616
+ inputComponent: PhoneInput,
2617
+ id: "input-46",
2618
+ placeholder: "Enter phone number",
2619
+ ...props,
2620
+ value: props.value,
2621
+ onChange: (e) => handleChange(e ?? "")
2622
+ }
2623
+ ) });
2624
+ }
2596
2625
  var PhoneInput = forwardRef16(
2597
2626
  ({ className, ...props }, ref) => {
2598
2627
  return /* @__PURE__ */ jsx28(
@@ -2609,6 +2638,50 @@ var PhoneInput = forwardRef16(
2609
2638
  }
2610
2639
  );
2611
2640
  PhoneInput.displayName = "PhoneInput";
2641
+ var CountrySelect = ({
2642
+ disabled,
2643
+ value,
2644
+ onChange,
2645
+ options: options2
2646
+ }) => {
2647
+ const handleSelect = (event) => {
2648
+ onChange(event.target.value);
2649
+ };
2650
+ return /* @__PURE__ */ jsxs18(
2651
+ "div",
2652
+ {
2653
+ className: "relative inline-flex items-center self-stretch rounded-s-md border border-input\n bg-background py-2 pe-2 ps-3 text-muted-foreground transition-shadow focus-within:z-10\n focus-within:border-ring focus-within:outline-hidden focus-within:ring-[3px] focus-within:ring-ring/20\n hover:text-foreground has-disabled:pointer-events-none has-disabled:opacity-50",
2654
+ children: [
2655
+ /* @__PURE__ */ jsxs18("div", { className: "inline-flex items-center gap-1", "aria-hidden": "true", children: [
2656
+ /* @__PURE__ */ jsx28(FlagComponent, { country: value, countryName: value, "aria-hidden": "true" }),
2657
+ /* @__PURE__ */ jsx28("span", { className: "text-muted-foreground/80", children: /* @__PURE__ */ jsx28(ChevronDown2, { size: 16, strokeWidth: 2, "aria-hidden": "true" }) })
2658
+ ] }),
2659
+ /* @__PURE__ */ jsxs18(
2660
+ "select",
2661
+ {
2662
+ disabled,
2663
+ value,
2664
+ onChange: handleSelect,
2665
+ className: "absolute inset-0 text-sm opacity-0",
2666
+ "aria-label": "Select country",
2667
+ children: [
2668
+ /* @__PURE__ */ jsx28("option", { value: "", children: "Select a country" }, "default"),
2669
+ options2.filter((x) => x.value).map((option, i) => /* @__PURE__ */ jsxs18("option", { value: option.value, children: [
2670
+ option.label,
2671
+ " ",
2672
+ option.value && `+${RPNInput.getCountryCallingCode(option.value)}`
2673
+ ] }, option.value ?? `empty-${i}`))
2674
+ ]
2675
+ }
2676
+ )
2677
+ ]
2678
+ }
2679
+ );
2680
+ };
2681
+ var FlagComponent = ({ country, countryName }) => {
2682
+ const Flag = flags[country];
2683
+ return /* @__PURE__ */ jsx28("span", { className: "w-5 overflow-hidden rounded-sm", children: Flag ? /* @__PURE__ */ jsx28(Flag, { title: countryName }) : /* @__PURE__ */ jsx28(Phone, { size: 16, "aria-hidden": "true" }) });
2684
+ };
2612
2685
 
2613
2686
  // src/components/price-input.tsx
2614
2687
  import React26 from "react";
@@ -3459,6 +3532,7 @@ export {
3459
3532
  InputOTPSlot,
3460
3533
  Label2 as Label,
3461
3534
  MultiSelect,
3535
+ PhoneNumberInput,
3462
3536
  Popover,
3463
3537
  PopoverContent,
3464
3538
  PopoverTrigger,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@use-stall/ui",
3
- "version": "0.0.1",
3
+ "version": "0.0.3",
4
4
  "author": "Stall",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",