@use-stall/ui 0.0.9 → 0.1.0

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
@@ -24,6 +24,7 @@ import * as react_hook_form from 'react-hook-form';
24
24
  import { FieldValues, FieldPath, ControllerProps } from 'react-hook-form';
25
25
  import * as LabelPrimitive from '@radix-ui/react-label';
26
26
  import * as input_otp from 'input-otp';
27
+ import * as RPNInput from 'react-phone-number-input';
27
28
  import * as PopoverPrimitive from '@radix-ui/react-popover';
28
29
  import * as ProgressPrimitive from '@radix-ui/react-progress';
29
30
  import * as ScrollAreaPrimitive from '@radix-ui/react-scroll-area';
@@ -663,6 +664,13 @@ interface PasswordInputProps extends React__default.InputHTMLAttributes<HTMLInpu
663
664
  onSubmit?: (event: React__default.FormEvent) => void;
664
665
  }
665
666
 
667
+ type PhoneProps = {
668
+ className?: string;
669
+ value: string | number;
670
+ onChange: (value: any) => void;
671
+ } & React__default.ComponentProps<typeof RPNInput.default>;
672
+ declare function PhoneNumberInput({ className, ...props }: PhoneProps): react_jsx_runtime.JSX.Element;
673
+
666
674
  declare const Popover: React$1.FC<PopoverPrimitive.PopoverProps>;
667
675
  declare const PopoverTrigger: React$1.ForwardRefExoticComponent<PopoverPrimitive.PopoverTriggerProps & React$1.RefAttributes<HTMLButtonElement>>;
668
676
  interface PopoverProps extends React$1.ComponentPropsWithoutRef<typeof PopoverPrimitive.Content> {
@@ -774,4 +782,4 @@ declare const TooltipContent: React$1.ForwardRefExoticComponent<Omit<TooltipPrim
774
782
 
775
783
  declare function cn(...inputs: ClassValue[]): string;
776
784
 
777
- 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, type PolymorphicComponent, type PolymorphicComponentProps, type PolymorphicComponentPropsWithRef, type PolymorphicRef, Popover, PopoverContent, PopoverTrigger, PriceInput, 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, useComboboxFilter, useFormField };
785
+ 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, PriceInput, 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, useComboboxFilter, useFormField };
package/dist/index.d.ts CHANGED
@@ -24,6 +24,7 @@ import * as react_hook_form from 'react-hook-form';
24
24
  import { FieldValues, FieldPath, ControllerProps } from 'react-hook-form';
25
25
  import * as LabelPrimitive from '@radix-ui/react-label';
26
26
  import * as input_otp from 'input-otp';
27
+ import * as RPNInput from 'react-phone-number-input';
27
28
  import * as PopoverPrimitive from '@radix-ui/react-popover';
28
29
  import * as ProgressPrimitive from '@radix-ui/react-progress';
29
30
  import * as ScrollAreaPrimitive from '@radix-ui/react-scroll-area';
@@ -663,6 +664,13 @@ interface PasswordInputProps extends React__default.InputHTMLAttributes<HTMLInpu
663
664
  onSubmit?: (event: React__default.FormEvent) => void;
664
665
  }
665
666
 
667
+ type PhoneProps = {
668
+ className?: string;
669
+ value: string | number;
670
+ onChange: (value: any) => void;
671
+ } & React__default.ComponentProps<typeof RPNInput.default>;
672
+ declare function PhoneNumberInput({ className, ...props }: PhoneProps): react_jsx_runtime.JSX.Element;
673
+
666
674
  declare const Popover: React$1.FC<PopoverPrimitive.PopoverProps>;
667
675
  declare const PopoverTrigger: React$1.ForwardRefExoticComponent<PopoverPrimitive.PopoverTriggerProps & React$1.RefAttributes<HTMLButtonElement>>;
668
676
  interface PopoverProps extends React$1.ComponentPropsWithoutRef<typeof PopoverPrimitive.Content> {
@@ -774,4 +782,4 @@ declare const TooltipContent: React$1.ForwardRefExoticComponent<Omit<TooltipPrim
774
782
 
775
783
  declare function cn(...inputs: ClassValue[]): string;
776
784
 
777
- 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, type PolymorphicComponent, type PolymorphicComponentProps, type PolymorphicComponentPropsWithRef, type PolymorphicRef, Popover, PopoverContent, PopoverTrigger, PriceInput, 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, useComboboxFilter, useFormField };
785
+ 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, PriceInput, 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, 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,
@@ -2804,6 +2805,35 @@ var RPNInput = __toESM(require("react-phone-number-input"));
2804
2805
  var import_flags = __toESM(require("react-phone-number-input/flags"));
2805
2806
  var import_react_phone_number_input = require("react-phone-number-input");
2806
2807
  var import_jsx_runtime28 = require("react/jsx-runtime");
2808
+ function PhoneNumberInput({
2809
+ className = "",
2810
+ ...props
2811
+ }) {
2812
+ const [error, setError] = (0, import_react5.useState)(null);
2813
+ const handleChange = (newValue) => {
2814
+ if (newValue && !(0, import_react_phone_number_input.isValidPhoneNumber)(newValue)) {
2815
+ setError("Invalid phone number");
2816
+ } else {
2817
+ setError(null);
2818
+ }
2819
+ props.onChange(newValue ?? "");
2820
+ };
2821
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: cn(className), children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
2822
+ RPNInput.default,
2823
+ {
2824
+ className: cn("flex rounded-md", error && "border border-red-500/70"),
2825
+ international: true,
2826
+ flagComponent: FlagComponent,
2827
+ countrySelectComponent: CountrySelect,
2828
+ inputComponent: PhoneInput,
2829
+ id: "input-46",
2830
+ placeholder: "Enter phone number",
2831
+ ...props,
2832
+ value: props.value,
2833
+ onChange: (e) => handleChange(e ?? "")
2834
+ }
2835
+ ) });
2836
+ }
2807
2837
  var PhoneInput = (0, import_react5.forwardRef)(
2808
2838
  ({ className, ...props }, ref) => {
2809
2839
  return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
@@ -2820,6 +2850,53 @@ var PhoneInput = (0, import_react5.forwardRef)(
2820
2850
  }
2821
2851
  );
2822
2852
  PhoneInput.displayName = "PhoneInput";
2853
+ var CountrySelect = ({
2854
+ disabled,
2855
+ value,
2856
+ onChange,
2857
+ options: options2
2858
+ }) => {
2859
+ const handleSelect = (event) => {
2860
+ onChange(event.target.value);
2861
+ };
2862
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
2863
+ "div",
2864
+ {
2865
+ className: cn(`relative inline-flex items-center self-stretch rounded-s-10 border border-input
2866
+ bg-inherit py-2 pe-2 ps-3 text-muted-foreground transition-shadow focus-within:z-10
2867
+ focus-within:border-ring focus-within:outline-none focus-within:ring-[3px] focus-within:ring-ring/20
2868
+ hover:text-foreground has-disabled:pointer-events-none has-disabled:opacity-50`),
2869
+ children: [
2870
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "inline-flex items-center gap-1", "aria-hidden": "true", children: [
2871
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(FlagComponent, { country: value, countryName: value, "aria-hidden": "true" }),
2872
+ /* @__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" }) })
2873
+ ] }),
2874
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
2875
+ "select",
2876
+ {
2877
+ disabled,
2878
+ value,
2879
+ onChange: handleSelect,
2880
+ className: "absolute inset-0 text-sm opacity-0",
2881
+ "aria-label": "Select country",
2882
+ children: [
2883
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("option", { value: "", children: "Select a country" }, "default"),
2884
+ options2.filter((x) => x.value).map((option, i) => /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("option", { value: option.value, children: [
2885
+ option.label,
2886
+ " ",
2887
+ option.value && `+${RPNInput.getCountryCallingCode(option.value)}`
2888
+ ] }, option.value ?? `empty-${i}`))
2889
+ ]
2890
+ }
2891
+ )
2892
+ ]
2893
+ }
2894
+ );
2895
+ };
2896
+ var FlagComponent = ({ country, countryName }) => {
2897
+ const Flag = import_flags.default[country];
2898
+ 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" }) });
2899
+ };
2823
2900
 
2824
2901
  // src/components/price-input.tsx
2825
2902
  var import_react6 = __toESM(require("react"));
@@ -3673,6 +3750,7 @@ TooltipContent.displayName = TooltipPrimitive.Content.displayName;
3673
3750
  InputOTPSlot,
3674
3751
  Label,
3675
3752
  MultiSelect,
3753
+ PhoneNumberInput,
3676
3754
  Popover,
3677
3755
  PopoverContent,
3678
3756
  PopoverTrigger,
package/dist/index.mjs CHANGED
@@ -2586,6 +2586,35 @@ import * as RPNInput from "react-phone-number-input";
2586
2586
  import flags from "react-phone-number-input/flags";
2587
2587
  import { isValidPhoneNumber } from "react-phone-number-input";
2588
2588
  import { jsx as jsx28, jsxs as jsxs18 } from "react/jsx-runtime";
2589
+ function PhoneNumberInput({
2590
+ className = "",
2591
+ ...props
2592
+ }) {
2593
+ const [error, setError] = useState3(null);
2594
+ const handleChange = (newValue) => {
2595
+ if (newValue && !isValidPhoneNumber(newValue)) {
2596
+ setError("Invalid phone number");
2597
+ } else {
2598
+ setError(null);
2599
+ }
2600
+ props.onChange(newValue ?? "");
2601
+ };
2602
+ return /* @__PURE__ */ jsx28("div", { className: cn(className), children: /* @__PURE__ */ jsx28(
2603
+ RPNInput.default,
2604
+ {
2605
+ className: cn("flex rounded-md", error && "border border-red-500/70"),
2606
+ international: true,
2607
+ flagComponent: FlagComponent,
2608
+ countrySelectComponent: CountrySelect,
2609
+ inputComponent: PhoneInput,
2610
+ id: "input-46",
2611
+ placeholder: "Enter phone number",
2612
+ ...props,
2613
+ value: props.value,
2614
+ onChange: (e) => handleChange(e ?? "")
2615
+ }
2616
+ ) });
2617
+ }
2589
2618
  var PhoneInput = forwardRef16(
2590
2619
  ({ className, ...props }, ref) => {
2591
2620
  return /* @__PURE__ */ jsx28(
@@ -2602,6 +2631,53 @@ var PhoneInput = forwardRef16(
2602
2631
  }
2603
2632
  );
2604
2633
  PhoneInput.displayName = "PhoneInput";
2634
+ var CountrySelect = ({
2635
+ disabled,
2636
+ value,
2637
+ onChange,
2638
+ options: options2
2639
+ }) => {
2640
+ const handleSelect = (event) => {
2641
+ onChange(event.target.value);
2642
+ };
2643
+ return /* @__PURE__ */ jsxs18(
2644
+ "div",
2645
+ {
2646
+ className: cn(`relative inline-flex items-center self-stretch rounded-s-10 border border-input
2647
+ bg-inherit py-2 pe-2 ps-3 text-muted-foreground transition-shadow focus-within:z-10
2648
+ focus-within:border-ring focus-within:outline-none focus-within:ring-[3px] focus-within:ring-ring/20
2649
+ hover:text-foreground has-disabled:pointer-events-none has-disabled:opacity-50`),
2650
+ children: [
2651
+ /* @__PURE__ */ jsxs18("div", { className: "inline-flex items-center gap-1", "aria-hidden": "true", children: [
2652
+ /* @__PURE__ */ jsx28(FlagComponent, { country: value, countryName: value, "aria-hidden": "true" }),
2653
+ /* @__PURE__ */ jsx28("span", { className: "text-muted-foreground/80", children: /* @__PURE__ */ jsx28(ChevronDown2, { size: 16, strokeWidth: 2, "aria-hidden": "true" }) })
2654
+ ] }),
2655
+ /* @__PURE__ */ jsxs18(
2656
+ "select",
2657
+ {
2658
+ disabled,
2659
+ value,
2660
+ onChange: handleSelect,
2661
+ className: "absolute inset-0 text-sm opacity-0",
2662
+ "aria-label": "Select country",
2663
+ children: [
2664
+ /* @__PURE__ */ jsx28("option", { value: "", children: "Select a country" }, "default"),
2665
+ options2.filter((x) => x.value).map((option, i) => /* @__PURE__ */ jsxs18("option", { value: option.value, children: [
2666
+ option.label,
2667
+ " ",
2668
+ option.value && `+${RPNInput.getCountryCallingCode(option.value)}`
2669
+ ] }, option.value ?? `empty-${i}`))
2670
+ ]
2671
+ }
2672
+ )
2673
+ ]
2674
+ }
2675
+ );
2676
+ };
2677
+ var FlagComponent = ({ country, countryName }) => {
2678
+ const Flag = flags[country];
2679
+ 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" }) });
2680
+ };
2605
2681
 
2606
2682
  // src/components/price-input.tsx
2607
2683
  import React25 from "react";
@@ -3454,6 +3530,7 @@ export {
3454
3530
  InputOTPSlot,
3455
3531
  Label2 as Label,
3456
3532
  MultiSelect,
3533
+ PhoneNumberInput,
3457
3534
  Popover,
3458
3535
  PopoverContent,
3459
3536
  PopoverTrigger,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@use-stall/ui",
3
- "version": "0.0.9",
3
+ "version": "0.1.0",
4
4
  "author": "Stall",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",