react-country-kit-ui 1.2.0 β 2.0.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/components/CountryMultiSelect.d.ts +2 -3
- package/dist/components/CountryPicker.d.ts +2 -3
- package/dist/components/CurrencyMultiSelect.d.ts +2 -3
- package/dist/components/CurrencyPicker.d.ts +2 -3
- package/dist/components/DivisionPicker.d.ts +2 -3
- package/dist/components/LanguagePicker.d.ts +2 -3
- package/dist/components/PhoneInput.d.ts +2 -3
- package/dist/components/TimezonePicker.d.ts +2 -3
- package/dist/components/primitives.d.ts +0 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +3 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +846 -1084
- package/dist/index.mjs.map +1 -1
- package/dist/lib/utils.d.ts +0 -1
- package/package.json +5 -5
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
export declare function CountryMultiSelect({ value, onChange, placeholder, maxItems, showFlags, searchable, disabled, className, label, }: CountryMultiSelectProps): import("react/jsx-runtime").JSX.Element;
|
|
1
|
+
import { ICountryMultiSelectProps } from 'react-country-kit-core';
|
|
2
|
+
export declare function CountryMultiSelect({ value, onChange, placeholder, maxItems, showFlags, searchable, disabled, className, label, }: ICountryMultiSelectProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
export declare function CountryPicker({ value, onChange, placeholder, searchable, showFlag, showPhoneCode, disabled, className, label, }: CountryPickerProps): import("react/jsx-runtime").JSX.Element;
|
|
1
|
+
import { ICountryPickerProps } from 'react-country-kit-core';
|
|
2
|
+
export declare function CountryPicker({ value, onChange, placeholder, searchable, showFlag, showPhoneCode, disabled, className, label, }: ICountryPickerProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
export declare function CurrencyMultiSelect({ value, onChange, placeholder, maxItems, showSymbol, searchable, disabled, className, label, }: CurrencyMultiSelectProps): import("react/jsx-runtime").JSX.Element;
|
|
1
|
+
import { ICurrencyMultiSelectProps } from 'react-country-kit-core';
|
|
2
|
+
export declare function CurrencyMultiSelect({ value, onChange, placeholder, maxItems, showSymbol, searchable, disabled, className, label, }: ICurrencyMultiSelectProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
export declare function CurrencyPicker({ value, onChange, placeholder, searchable, showSymbol, countryIso2, autoSelect, disabled, className, label, }: CurrencyPickerProps): import("react/jsx-runtime").JSX.Element;
|
|
1
|
+
import { ICurrencyPickerProps } from 'react-country-kit-core';
|
|
2
|
+
export declare function CurrencyPicker({ value, onChange, placeholder, searchable, showSymbol, countryIso2, autoSelect, disabled, className, label, }: ICurrencyPickerProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
export declare function DivisionPicker({ countryIso2, value, onChange, placeholder, searchable, disabled, className, label, }: DivisionPickerProps): import("react/jsx-runtime").JSX.Element;
|
|
1
|
+
import { IDivisionPickerProps } from 'react-country-kit-core';
|
|
2
|
+
export declare function DivisionPicker({ countryIso2, value, onChange, placeholder, searchable, disabled, className, label, }: IDivisionPickerProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
export declare function LanguagePicker({ value, onChange, placeholder, searchable, showNativeName, disabled, className, label, }: LanguagePickerProps): import("react/jsx-runtime").JSX.Element;
|
|
1
|
+
import { ILanguagePickerProps } from 'react-country-kit-core';
|
|
2
|
+
export declare function LanguagePicker({ value, onChange, placeholder, searchable, showNativeName, disabled, className, label, }: ILanguagePickerProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
export declare const PhoneInput: React.ForwardRefExoticComponent<PhoneInputProps & React.RefAttributes<HTMLDivElement>>;
|
|
2
|
+
import { IPhoneInputProps } from 'react-country-kit-core';
|
|
3
|
+
export declare const PhoneInput: React.ForwardRefExoticComponent<IPhoneInputProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
export declare function TimezonePicker({ value, onChange, placeholder, searchable, countryIso2, autoSelect, disabled, className, label, }: TimezonePickerProps): import("react/jsx-runtime").JSX.Element;
|
|
1
|
+
import { ITimezonePickerProps } from 'react-country-kit-core';
|
|
2
|
+
export declare function TimezonePicker({ value, onChange, placeholder, searchable, countryIso2, autoSelect, disabled, className, label, }: ITimezonePickerProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
-
|
|
3
2
|
import * as PopoverPrimitive from '@radix-ui/react-popover';
|
|
4
3
|
export declare const Popover: React.FC<PopoverPrimitive.PopoverProps>;
|
|
5
4
|
export declare const PopoverTrigger: React.ForwardRefExoticComponent<PopoverPrimitive.PopoverTriggerProps & React.RefAttributes<HTMLButtonElement>>;
|
package/dist/index.d.ts
CHANGED
|
@@ -14,4 +14,4 @@ export { PhoneInput } from './components/PhoneInput';
|
|
|
14
14
|
export { TimezonePicker } from './components/TimezonePicker';
|
|
15
15
|
export { Badge, CheckIcon, CommandEmpty, CommandInput, CommandItem, CommandList, CommandRoot, Flag, PickerTrigger, Popover, PopoverContent, PopoverTrigger } from './components/primitives';
|
|
16
16
|
export { cn } from './lib/utils';
|
|
17
|
-
export * from '
|
|
17
|
+
export * from 'react-country-kit-core';
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),b=require("react"),U=require("@radix-ui/react-popover"),$=require("clsx"),I=require("tailwind-merge"),N=require("react-country-kit-core");function X(s){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(s){for(const l in s)if(l!=="default"){const i=Object.getOwnPropertyDescriptor(s,l);Object.defineProperty(t,l,i.get?i:{enumerable:!0,get:()=>s[l]})}}return t.default=s,Object.freeze(t)}const E=X(U);function y(...s){return I.twMerge($.clsx(s))}const M=E.Root,A=E.Trigger,R=({className:s})=>e.jsx("svg",{className:y("h-4 w-4 text-primary",s),viewBox:"0 0 20 20",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("polyline",{points:"4 10 8 14 16 6"})});R.displayName="CheckIcon";const V=({children:s,className:t})=>e.jsx("label",{className:y("text-[0.65rem] font-bold uppercase tracking-[0.12em] text-muted-foreground/80 ml-1 mb-1.5 block",t),children:s});V.displayName="FieldLabel";const w=({children:s,className:t})=>e.jsx("span",{className:y("inline-flex items-center rounded-full bg-primary/20 px-2.5 py-0.5 text-[0.7rem] font-bold text-primary tracking-tight",t),children:s});w.displayName="Badge";const _=({iso2:s,flag:t,flagUrl:l,className:i})=>e.jsx("span",{className:y("inline-flex items-center justify-center shrink-0 overflow-hidden",i),children:e.jsx("img",{src:l,alt:s,className:"h-[1em] w-[1.5em] object-cover rounded-[1px] shadow-[0_0_0_1px_rgba(0,0,0,0.05)]",onError:o=>{if(o.target.style.display="none",o.target.parentElement){const c=document.createElement("span");c.textContent=t,o.target.parentElement.appendChild(c)}}})});_.displayName="Flag";const q=b.forwardRef(({className:s,align:t="start",sideOffset:l=6,onCloseAutoFocus:i,...o},c)=>e.jsx(E.Portal,{children:e.jsx(E.Content,{ref:c,align:t,sideOffset:l,onCloseAutoFocus:u=>{u.preventDefault(),i==null||i(u)},className:y("z-50 w-[var(--radix-popover-trigger-width)] rounded-xl border border-border bg-popover p-0 shadow-lg","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=top]:slide-in-from-bottom-2",s),...o})}));q.displayName="PopoverContent";const S=b.forwardRef(({className:s,...t},l)=>e.jsx("div",{ref:l,className:y("flex h-full w-full flex-col overflow-hidden rounded-xl bg-popover text-popover-foreground",s),...t}));S.displayName="CommandRoot";const v=b.forwardRef(({className:s,onValueChange:t,...l},i)=>e.jsx("div",{className:"px-3 pt-3 pb-2 border-b border-border",children:e.jsxs("div",{className:y("flex items-center gap-2 px-3 py-1.5 rounded-lg border border-border bg-muted/40 transition-colors","focus-within:border-primary/50 focus-within:ring-2 focus-within:ring-primary/10"),children:[e.jsxs("svg",{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground",viewBox:"0 0 20 20",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("circle",{cx:"8.5",cy:"8.5",r:"5.5"}),e.jsx("path",{d:"M17 17l-4-4",strokeLinecap:"round"})]}),e.jsx("input",{ref:i,type:"text",autoComplete:"off",autoCorrect:"off",spellCheck:!1,className:y("flex h-8 w-full bg-transparent text-sm outline-none","placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",s),onChange:o=>t==null?void 0:t(o.target.value),...l})]})}));v.displayName="CommandInput";const P=b.forwardRef(({className:s,...t},l)=>e.jsx("div",{ref:l,role:"listbox",className:y("max-h-72 overflow-y-auto overflow-x-hidden p-1",s),...t}));P.displayName="CommandList";const L=b.forwardRef((s,t)=>e.jsx("div",{ref:t,className:"flex flex-col items-center justify-center gap-1 py-8 text-sm text-muted-foreground",...s}));L.displayName="CommandEmpty";const O=b.forwardRef(({className:s,onSelect:t,onMouseDown:l,onKeyDown:i,disabled:o,selected:c,value:u,...k},h)=>e.jsx("div",{ref:h,role:"option","aria-disabled":o||void 0,"aria-selected":c,"data-disabled":o||void 0,"data-selected":c||void 0,tabIndex:o?void 0:0,className:y("relative flex cursor-pointer select-none items-center gap-2 rounded-lg px-2 py-2 text-sm outline-none","focus:bg-accent focus:text-accent-foreground","data-[disabled]:pointer-events-none data-[disabled]:opacity-50","hover:bg-accent/50 transition-colors",c&&"bg-accent text-accent-foreground font-semibold",s),onMouseDown:r=>{r.preventDefault(),l==null||l(r)},onClick:o?void 0:()=>t==null?void 0:t(),onKeyDown:r=>{!o&&r.key==="Enter"&&(r.preventDefault(),t==null||t()),i==null||i(r)},...k}));O.displayName="CommandItem";const T=b.forwardRef(({className:s,isOpen:t,children:l,placeholder:i,hasValue:o,...c},u)=>e.jsxs("button",{ref:u,type:"button",role:"combobox","aria-expanded":t,"aria-haspopup":"listbox",className:y("flex h-12 w-full items-center justify-between gap-3 rounded-xl border border-input bg-background px-4 py-2 text-sm ring-offset-background","placeholder:text-muted-foreground","focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2","disabled:cursor-not-allowed disabled:opacity-50","hover:bg-accent/10 transition-all",!o&&"text-muted-foreground",s),...c,children:[e.jsx("span",{className:"flex min-w-0 flex-1 items-center gap-2 truncate",children:l||e.jsx("span",{children:i})}),e.jsx("svg",{className:y("h-4 w-4 shrink-0 text-muted-foreground/60 transition-transform duration-200",t&&"rotate-180"),viewBox:"0 0 20 20",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("polyline",{points:"6 8 10 12 14 8"})})]}));T.displayName="PickerTrigger";const B=b.forwardRef(({label:s,trigger:t,children:l,open:i,onOpenChange:o,className:c},u)=>e.jsxs("div",{ref:u,className:y("flex flex-col gap-0",c),children:[s&&e.jsx(V,{children:s}),e.jsxs(M,{open:i,onOpenChange:o,children:[e.jsx(A,{asChild:!0,children:t}),e.jsx(q,{className:"p-0",children:l})]})]}));B.displayName="BasePicker";const F=b.forwardRef(({value:s,onRemove:t,onClear:l,isOpen:i,placeholder:o,renderChip:c,maxVisible:u=3,className:k,disabled:h,...r},d)=>{const f=s.slice(0,u),g=s.length-u;return e.jsxs("button",{ref:d,type:"button","aria-haspopup":"listbox","aria-expanded":i,disabled:h,className:y("flex min-h-[3rem] w-full items-center gap-3 rounded-xl border border-input bg-background px-4 py-2","text-sm ring-offset-background focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2","disabled:cursor-not-allowed disabled:opacity-50 hover:bg-accent/10 transition-all text-start",i&&"ring-2 ring-ring ring-offset-2",k),...r,children:[e.jsx("div",{className:"flex flex-1 flex-wrap gap-1.5 min-w-0 items-center",children:s.length===0?e.jsx("span",{className:"text-muted-foreground",children:o}):e.jsxs(e.Fragment,{children:[f.map((m,j)=>e.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full bg-primary/10 px-2 py-0.5 text-[0.75rem] font-semibold text-primary",children:[c(m),e.jsx("span",{role:"button",tabIndex:h?-1:0,onClick:x=>{x.stopPropagation(),h||t(m,x)},onKeyDown:x=>{(x.key==="Enter"||x.key===" ")&&(x.preventDefault(),x.stopPropagation(),h||t(m,x))},className:"ml-0.5 rounded-full text-primary/60 hover:text-primary transition-colors cursor-pointer","aria-label":"Remove",children:e.jsxs("svg",{width:"9",height:"9",viewBox:"0 0 20 20",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",children:[e.jsx("line",{x1:"5",y1:"5",x2:"15",y2:"15"}),e.jsx("line",{x1:"15",y1:"5",x2:"5",y2:"15"})]})})]},j)),g>0&&e.jsxs(w,{className:"bg-muted text-muted-foreground/80 px-2",children:["+",g]})]})}),e.jsxs("div",{className:"flex shrink-0 items-center gap-1 ml-auto",children:[s.length>0&&e.jsx("span",{role:"button",tabIndex:h?-1:0,onClick:m=>{m.stopPropagation(),h||l(m)},onKeyDown:m=>{(m.key==="Enter"||m.key===" ")&&(m.preventDefault(),m.stopPropagation(),h||l(m))},className:"rounded p-0.5 text-muted-foreground hover:text-foreground hover:bg-accent/30 transition-colors cursor-pointer","aria-label":"Clear all",children:e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 20 20",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",children:[e.jsx("line",{x1:"5",y1:"5",x2:"15",y2:"15"}),e.jsx("line",{x1:"15",y1:"5",x2:"5",y2:"15"})]})}),e.jsx("svg",{className:y("h-4 w-4 text-muted-foreground/60 transition-transform duration-200",i&&"rotate-180"),viewBox:"0 0 20 20",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("polyline",{points:"6 8 10 12 14 8"})})]})]})});F.displayName="MultiSelectTrigger";const Q=3;function G({value:s,onChange:t,placeholder:l="Select countries...",maxItems:i,showFlags:o=!0,searchable:c=!0,disabled:u=!1,className:k,label:h}){const[r,d]=b.useState(!1),[f,g]=b.useState(""),m=f?N.searchCountries(f):N.getAllCountries(),j=n=>s.some(C=>C.iso2===n.iso2),x=n=>{if(j(n))t(s.filter(C=>C.iso2!==n.iso2));else{if(i!==void 0&&s.length>=i)return;t([...s,n])}},a=(n,C)=>{C.stopPropagation(),t(s.filter(z=>z.iso2!==n.iso2))},p=n=>{n.stopPropagation(),t([])};return s.slice(0,Q),s.length-Q,e.jsxs(B,{label:h,className:k,open:r,onOpenChange:d,trigger:e.jsx(F,{value:s,onRemove:a,onClear:p,isOpen:r,placeholder:l,disabled:u,renderChip:n=>e.jsxs(e.Fragment,{children:[o&&e.jsx(_,{iso2:n.iso2,flag:n.flag,flagUrl:n.flag_url}),e.jsx("span",{className:"max-w-[80px] truncate",children:n.name})]})}),children:[e.jsxs(S,{children:[c&&e.jsx(v,{placeholder:"Search countries...",value:f,onValueChange:g}),e.jsxs(P,{children:[m.length===0&&e.jsxs(L,{children:[e.jsx("span",{className:"text-2xl opacity-40",children:"π"}),e.jsx("span",{children:"No countries found"})]}),m.map(n=>{const C=j(n);return e.jsxs(O,{onSelect:()=>x(n),selected:C,children:[e.jsx("div",{className:y("h-4 w-4 shrink-0 rounded-full border border-border flex items-center justify-center",C&&"bg-primary border-primary"),children:C&&e.jsx("svg",{className:"h-2.5 w-2.5 stroke-white",viewBox:"0 0 20 20",fill:"none",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("polyline",{points:"4 10 8 14 16 6"})})}),o&&e.jsx(_,{iso2:n.iso2,flag:n.flag,flagUrl:n.flag_url}),e.jsxs("div",{className:"flex flex-1 flex-col min-w-0",children:[e.jsx("span",{className:"truncate font-medium",children:n.name}),e.jsxs("span",{className:"text-[0.7rem] text-muted-foreground",children:[n.iso3," Β· +",n.phone_code]})]})]},n.iso2)})]})]}),s.length>0&&e.jsxs("div",{className:"flex items-center justify-between border-t border-border px-3 py-2 text-xs text-muted-foreground",children:[e.jsxs("span",{children:[s.length," selected",i?` / ${i}`:""]}),e.jsx("button",{type:"button",onClick:()=>{t([]),d(!1)},className:"text-destructive hover:underline font-medium",children:"Clear all"})]})]})}function H({value:s,onChange:t,placeholder:l="Select a country...",searchable:i=!0,showFlag:o=!0,showPhoneCode:c=!1,disabled:u=!1,className:k,label:h}){const[r,d]=b.useState(!1),[f,g]=b.useState(""),m=f?N.searchCountries(f):N.getAllCountries(),j=x=>{const a=N.getAllCountries().find(p=>p.iso2.toLowerCase()===x.toLowerCase());a&&(t(a),d(!1),g(""))};return e.jsx(B,{label:h,className:k,open:r,onOpenChange:d,trigger:e.jsx(T,{isOpen:r,hasValue:!!s,placeholder:l,disabled:u,children:s&&e.jsxs(e.Fragment,{children:[o&&e.jsx(_,{iso2:s.iso2,flag:s.flag,flagUrl:s.flag_url}),e.jsx("span",{className:"flex-1 text-start truncate",children:s.name}),c&&e.jsxs(w,{children:["+",s.phone_code]})]})}),children:e.jsxs(S,{children:[i&&e.jsx(v,{placeholder:"Search country...",value:f,onValueChange:g}),e.jsxs(P,{children:[m.length===0&&e.jsxs(L,{children:[e.jsx("span",{className:"text-2xl opacity-40",children:"π"}),e.jsx("span",{children:"No countries found"})]}),m.map(x=>{const a=(s==null?void 0:s.iso2)===x.iso2;return e.jsxs(O,{onSelect:()=>j(x.iso2),selected:a,children:[o&&e.jsx(_,{iso2:x.iso2,flag:x.flag,flagUrl:x.flag_url}),e.jsxs("div",{className:"flex flex-1 flex-col gap-0 min-w-0",children:[e.jsx("span",{className:"truncate font-medium",children:x.name}),e.jsxs("span",{className:"text-[0.7rem] text-muted-foreground",children:[x.iso3," Β· ",x.division_type]})]}),e.jsxs("div",{className:"flex items-center gap-1.5 ml-auto shrink-0",children:[c&&e.jsxs("span",{className:"text-[0.7rem] text-muted-foreground tabular-nums bg-muted px-1.5 py-0.5 rounded",children:["+",x.phone_code]}),a&&e.jsx(R,{})]})]},x.iso2)})]})]})})}const W=3;function J({value:s,onChange:t,placeholder:l="Select currencies...",maxItems:i,showSymbol:o=!0,searchable:c=!0,disabled:u=!1,className:k,label:h}){const[r,d]=b.useState(!1),[f,g]=b.useState(""),m=f?N.searchCurrencies(f):N.getAllCurrencies(),j=n=>s.some(C=>C.code===n.code),x=n=>{if(j(n))t(s.filter(C=>C.code!==n.code));else{if(i!==void 0&&s.length>=i)return;t([...s,n])}},a=(n,C)=>{C.stopPropagation(),t(s.filter(z=>z.code!==n.code))},p=n=>{n.stopPropagation(),t([])};return s.slice(0,W),s.length-W,e.jsxs(B,{label:h,className:k,open:r,onOpenChange:d,trigger:e.jsx(F,{value:s,onRemove:a,onClear:p,isOpen:r,placeholder:l,disabled:u,renderChip:n=>e.jsxs(e.Fragment,{children:[o&&e.jsx("span",{className:"font-bold",children:n.symbol}),e.jsx("span",{children:n.code})]})}),children:[e.jsxs(S,{children:[c&&e.jsx(v,{placeholder:"Search currencies...",value:f,onValueChange:g}),e.jsxs(P,{children:[m.length===0&&e.jsxs(L,{children:[e.jsx("span",{className:"text-2xl opacity-40",children:"π°"}),e.jsx("span",{children:"No currencies found"})]}),m.map(n=>{const C=j(n);return e.jsxs(O,{onSelect:()=>x(n),selected:C,children:[e.jsx("div",{className:y("h-4 w-4 shrink-0 rounded-full border border-border flex items-center justify-center",C&&"bg-primary border-primary"),children:C&&e.jsx("svg",{className:"h-2.5 w-2.5 stroke-white",viewBox:"0 0 20 20",fill:"none",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("polyline",{points:"4 10 8 14 16 6"})})}),o&&e.jsx("span",{className:"min-w-[1.5rem] text-center font-bold text-primary",children:n.symbol}),e.jsxs("div",{className:"flex flex-1 flex-col min-w-0",children:[e.jsx("span",{className:"truncate font-medium",children:n.name}),e.jsx("span",{className:"text-[0.7rem] text-muted-foreground",children:n.code})]})]},n.code)})]})]}),s.length>0&&e.jsxs("div",{className:"flex items-center justify-between border-t border-border px-3 py-2 text-xs text-muted-foreground",children:[e.jsxs("span",{children:[s.length," selected",i?` / ${i}`:""]}),e.jsx("button",{type:"button",onClick:()=>{t([]),d(!1)},className:"text-destructive hover:underline font-medium",children:"Clear all"})]})]})}function K({value:s,onChange:t,placeholder:l="Select a currency...",searchable:i=!0,showSymbol:o=!0,countryIso2:c,autoSelect:u=!0,disabled:k=!1,className:h,label:r}){const[d,f]=b.useState(!1),[g,m]=b.useState("");b.useEffect(()=>{if(c&&u&&!s){const p=N.getCurrencyByCountry(c);p&&t(p)}},[c,u,s,t]);const x=g?N.searchCurrencies(g,c):(()=>{if(c){const p=N.getCurrencyByCountry(c);return p?[p]:[]}return N.getAllCurrencies()})(),a=p=>{const n=N.getAllCurrencies().find(C=>C.code.toLowerCase()===p.toLowerCase());n&&(t(n),f(!1),m(""))};return e.jsx(B,{label:r,className:h,open:d,onOpenChange:f,trigger:e.jsx(T,{isOpen:d,hasValue:!!s,placeholder:l,disabled:k,children:s&&e.jsxs(e.Fragment,{children:[o&&e.jsx("span",{className:"min-w-[1.5rem] text-center font-bold text-primary text-base",children:s.symbol}),e.jsxs("span",{className:"flex-1 text-start truncate",children:[s.code," β ",s.name]})]})}),children:e.jsxs(S,{children:[i&&e.jsx(v,{placeholder:"Search currency...",value:g,onValueChange:m}),e.jsxs(P,{children:[x.length===0&&e.jsxs(L,{children:[e.jsx("span",{className:"text-2xl opacity-40",children:"π°"}),e.jsx("span",{children:"No currencies found"})]}),x.map(p=>{const n=(s==null?void 0:s.code)===p.code;return e.jsxs(O,{onSelect:()=>a(p.code),selected:n,children:[o&&e.jsx("span",{className:"min-w-[1.5rem] text-center font-bold text-primary",children:p.symbol}),e.jsxs("div",{className:"flex flex-1 flex-col gap-0 min-w-0",children:[e.jsx("span",{className:"truncate font-medium",children:p.name}),e.jsx("span",{className:"text-[0.7rem] text-muted-foreground",children:p.code})]}),n&&e.jsx(R,{className:"ml-auto shrink-0"})]},p.code)})]})]})})}function Y({countryIso2:s,value:t,onChange:l,placeholder:i="Select a division...",searchable:o=!0,disabled:c=!1,className:u,label:k}){const[h,r]=b.useState(!1),[d,f]=b.useState(""),g=N.getDivisionsByCountry(s),m=d?g.filter(a=>a.name.toLowerCase().includes(d.toLowerCase())||a.iso2.toLowerCase().includes(d.toLowerCase())||a.timezone.toLowerCase().includes(d.toLowerCase())):g,j=c||!s||g.length===0,x=a=>{const p=g.find(n=>n.name===a);p&&(l(p),r(!1),f(""))};return e.jsx(B,{label:k,className:u,open:h,onOpenChange:a=>!j&&r(a),trigger:e.jsx(T,{isOpen:h,hasValue:!!t,placeholder:s?i:"Select a country first",disabled:j,children:t&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"flex-1 text-start truncate",children:t.name}),e.jsx(w,{children:t.iso2})]})}),children:e.jsxs(S,{children:[o&&e.jsx(v,{placeholder:"Search division...",value:d,onValueChange:f}),e.jsxs(P,{children:[m.length===0&&e.jsxs(L,{children:[e.jsx("span",{className:"text-2xl opacity-40",children:"πΊοΈ"}),e.jsx("span",{children:"No divisions found"})]}),m.map(a=>{const p=(t==null?void 0:t.iso2)===a.iso2&&(t==null?void 0:t.name)===a.name;return e.jsxs(O,{onSelect:()=>x(a.name),selected:p,children:[e.jsxs("div",{className:"flex flex-1 flex-col gap-0 min-w-0",children:[e.jsx("span",{className:"truncate font-medium",children:a.name}),e.jsx("span",{className:"text-[0.7rem] text-muted-foreground truncate",children:a.timezone})]}),e.jsxs("div",{className:"flex items-center gap-1.5 ml-auto shrink-0",children:[e.jsx(w,{children:a.iso2}),p&&e.jsx(R,{})]})]},`${a.iso2}-${a.name}`)})]})]})})}function Z({value:s,onChange:t,placeholder:l="Select a language...",searchable:i=!0,showNativeName:o=!0,disabled:c=!1,className:u,label:k}){const[h,r]=b.useState(!1),[d,f]=b.useState(""),g=d?N.searchLanguages(d):N.getAllLanguages(),m=j=>{const x=N.getAllLanguages().find(a=>a.code.toLowerCase()===j.toLowerCase());x&&(t(x),r(!1),f(""))};return e.jsx(B,{label:k,className:u,open:h,onOpenChange:r,trigger:e.jsx(T,{isOpen:h,hasValue:!!s,placeholder:l,disabled:c,children:s&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"flex-1 text-start truncate",children:s.english_name}),o&&s.native_name!==s.english_name&&e.jsx("span",{className:"text-xs italic text-muted-foreground shrink-0",children:s.native_name})]})}),children:e.jsxs(S,{children:[i&&e.jsx(v,{placeholder:"Search language...",value:d,onValueChange:f}),e.jsxs(P,{children:[g.length===0&&e.jsxs(L,{children:[e.jsx("span",{className:"text-2xl opacity-40",children:"π"}),e.jsx("span",{children:"No languages found"})]}),g.map(j=>{const x=(s==null?void 0:s.code)===j.code;return e.jsxs(O,{onSelect:()=>m(j.code),selected:x,children:[e.jsxs("div",{className:"flex flex-1 flex-col gap-0 min-w-0",children:[e.jsx("span",{className:"truncate font-medium",children:j.english_name}),o&&j.native_name!==j.english_name&&e.jsx("span",{className:"text-[0.7rem] text-muted-foreground italic",children:j.native_name})]}),e.jsxs("div",{className:"flex items-center gap-1.5 ml-auto shrink-0",children:[e.jsx(w,{className:"text-[0.6rem]",children:j.code}),x&&e.jsx(R,{})]})]},j.code)})]})]})})}const D=b.forwardRef(({value:s,onChange:t,defaultCountryIso2:l="US",placeholder:i="Phone number",showFlag:o=!0,disabled:c=!1,className:u,label:k},h)=>{const r=N.usePhoneInput(s,t,l);return e.jsxs("div",{ref:h,className:y("flex flex-col gap-0",u),children:[k&&e.jsx(V,{children:k}),e.jsxs("div",{className:y("flex h-12 items-stretch overflow-hidden rounded-xl border border-input bg-background ring-offset-background","focus-within:ring-2 focus-within:ring-ring focus-within:ring-offset-2","transition-shadow",c&&"opacity-50 pointer-events-none"),children:[e.jsxs(M,{open:r.isOpen,onOpenChange:d=>d?r.toggle():r.close(),children:[e.jsx(A,{asChild:!0,children:e.jsxs("button",{type:"button",disabled:c,className:y("flex h-full shrink-0 items-center gap-1.5 border-r border-input bg-muted px-3","text-sm font-semibold text-foreground transition-colors outline-none","hover:bg-accent/30 focus-visible:bg-accent/30"),children:[o&&r.country&&e.jsx(_,{iso2:r.country.iso2,flag:r.country.flag,flagUrl:r.country.flag_url}),e.jsx("span",{className:"tabular-nums text-primary",children:r.country?`+${r.country.phone_code}`:"+?"}),e.jsx("svg",{className:y("h-3.5 w-3.5 shrink-0 text-muted-foreground transition-transform duration-200",r.isOpen&&"rotate-180"),viewBox:"0 0 20 20",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",children:e.jsx("polyline",{points:"5 8 10 13 15 8"})})]})}),e.jsx(q,{align:"start",side:"bottom",sideOffset:4,className:"w-72",children:e.jsxs(S,{children:[e.jsx(v,{placeholder:"Search country or code...",value:r.searchQuery,onValueChange:r.setSearchQuery}),e.jsxs(P,{children:[r.filteredCountries.length===0&&e.jsxs(L,{children:[e.jsx("span",{className:"text-2xl opacity-40",children:"π"}),e.jsx("span",{children:"No countries found"})]}),r.filteredCountries.map(d=>{var g;const f=((g=r.country)==null?void 0:g.iso2)===d.iso2;return e.jsxs(O,{onSelect:()=>r.selectCountry(d),selected:f,children:[e.jsx(_,{iso2:d.iso2,flag:d.flag,flagUrl:d.flag_url}),e.jsx("div",{className:"flex flex-1 flex-col min-w-0",children:e.jsx("span",{className:"truncate font-medium text-sm",children:d.name})}),e.jsxs(w,{className:"ml-auto tabular-nums text-[0.7rem]",children:["+",d.phone_code]})]},d.iso2)})]})]})})]}),e.jsx("input",{type:"tel",value:r.number,onChange:d=>r.setNumber(d.target.value),placeholder:i,disabled:c,minLength:r.minLength,maxLength:r.maxLength,inputMode:"numeric",autoComplete:"tel-national",className:y("flex-1 min-w-0 bg-transparent px-3 text-sm text-foreground","placeholder:text-muted-foreground","focus:outline-none")})]}),r.value&&e.jsxs("p",{className:"text-[0.7rem] text-muted-foreground tabular-nums pl-0.5",children:["Full:"," ",e.jsx("span",{className:"font-mono text-primary",children:r.value.full})]})]})});D.displayName="PhoneInput";function ee({value:s,onChange:t,placeholder:l="Select a timezone...",searchable:i=!0,countryIso2:o,autoSelect:c=!0,disabled:u=!1,className:k,label:h}){const[r,d]=b.useState(!1),[f,g]=b.useState("");b.useEffect(()=>{if(o&&c&&!s){const a=N.getTimezonesByCountry(o);a&&a.length>0&&t(a[0])}},[o,c,s,t]);const m=o?N.getTimezonesByCountry(o):N.getAllTimezones(),j=f?N.searchTimezones(f,o):m,x=a=>{const p=m.find(n=>n.name===a);p&&(t(p),d(!1),g(""))};return e.jsx(B,{label:h,className:k,open:r,onOpenChange:d,trigger:e.jsx(T,{isOpen:r,hasValue:!!s,placeholder:l,disabled:u,children:s&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"flex-1 text-start truncate",children:s.name}),e.jsx(w,{children:s.offset_name})]})}),children:e.jsxs(S,{children:[i&&e.jsx(v,{placeholder:"Search timezone...",value:f,onValueChange:g}),e.jsxs(P,{children:[j.length===0&&e.jsxs(L,{children:[e.jsx("span",{className:"text-2xl opacity-40",children:"π"}),e.jsx("span",{children:"No timezones found"})]}),j.map(a=>{const p=(s==null?void 0:s.name)===a.name;return e.jsxs(O,{onSelect:()=>x(a.name),selected:p,children:[e.jsxs("div",{className:"flex flex-1 flex-col gap-0 min-w-0",children:[e.jsx("span",{className:"truncate font-medium",children:a.name}),e.jsxs("span",{className:"text-[0.7rem] text-muted-foreground",children:[a.tzName," Β· ",a.abbreviation]})]}),e.jsxs("div",{className:"flex items-center gap-1.5 ml-auto shrink-0",children:[e.jsx(w,{className:"tabular-nums text-[0.65rem]",children:a.offset_name}),p&&e.jsx(R,{})]})]},a.name)})]})]})})}exports.Badge=w;exports.CheckIcon=R;exports.CommandEmpty=L;exports.CommandInput=v;exports.CommandItem=O;exports.CommandList=P;exports.CommandRoot=S;exports.CountryMultiSelect=G;exports.CountryPicker=H;exports.CurrencyMultiSelect=J;exports.CurrencyPicker=K;exports.DivisionPicker=Y;exports.Flag=_;exports.LanguagePicker=Z;exports.PhoneInput=D;exports.PickerTrigger=T;exports.Popover=M;exports.PopoverContent=q;exports.PopoverTrigger=A;exports.TimezonePicker=ee;exports.cn=y;Object.keys(N).forEach(s=>{s!=="default"&&!Object.prototype.hasOwnProperty.call(exports,s)&&Object.defineProperty(exports,s,{enumerable:!0,get:()=>N[s]})});
|
|
2
|
-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var I=Object.create,W=Object.defineProperty,K=Object.getOwnPropertyDescriptor,X=Object.getOwnPropertyNames,G=Object.getPrototypeOf,H=Object.prototype.hasOwnProperty,J=(t,s,i,c)=>{if(s&&typeof s=="object"||typeof s=="function")for(var o=X(s),l=0,p=o.length,j;l<p;l++)j=o[l],!H.call(t,j)&&j!==i&&W(t,j,{get:(f=>s[f]).bind(null,j),enumerable:!(c=K(s,j))||c.enumerable});return t},U=(t,s,i)=>(i=t!=null?I(G(t)):{},J(s||!t||!t.__esModule?W(i,"default",{value:t,enumerable:!0}):i,t));let g=require("react");g=U(g,1);let R=require("@radix-ui/react-popover");R=U(R,1);let Y=require("clsx"),Z=require("tailwind-merge"),e=require("react/jsx-runtime"),y=require("react-country-kit-core");function w(...t){return(0,Z.twMerge)((0,Y.clsx)(t))}var A=R.Root,V=R.Trigger,D=({className:t})=>(0,e.jsx)("svg",{className:w("h-4 w-4 text-primary",t),viewBox:"0 0 20 20",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:(0,e.jsx)("polyline",{points:"4 10 8 14 16 6"})});D.displayName="CheckIcon";var q=({children:t,className:s})=>(0,e.jsx)("label",{className:w("text-[0.65rem] font-bold uppercase tracking-[0.12em] text-muted-foreground/80 ml-1 mb-1.5 block",s),children:t});q.displayName="FieldLabel";var v=({children:t,className:s})=>(0,e.jsx)("span",{className:w("inline-flex items-center rounded-full bg-primary/20 px-2.5 py-0.5 text-[0.7rem] font-bold text-primary tracking-tight",s),children:t});v.displayName="Badge";var O=({iso2:t,flag:s,flagUrl:i,className:c})=>(0,e.jsx)("span",{className:w("inline-flex items-center justify-center shrink-0 overflow-hidden",c),children:(0,e.jsx)("img",{src:i,alt:t,className:"h-[1em] w-[1.5em] object-cover rounded-[1px] shadow-[0_0_0_1px_rgba(0,0,0,0.05)]",onError:o=>{if(o.target.style.display="none",o.target.parentElement){const l=document.createElement("span");l.textContent=s,o.target.parentElement.appendChild(l)}}})});O.displayName="Flag";var M=g.default.forwardRef(({className:t,align:s="start",sideOffset:i=6,onCloseAutoFocus:c,...o},l)=>(0,e.jsx)(R.Portal,{children:(0,e.jsx)(R.Content,{ref:l,align:s,sideOffset:i,onCloseAutoFocus:p=>{p.preventDefault(),c?.(p)},className:w("z-50 w-[var(--radix-popover-trigger-width)] rounded-xl border border-border bg-popover p-0 shadow-lg","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=top]:slide-in-from-bottom-2",t),...o})}));M.displayName="PopoverContent";var k=g.default.forwardRef(({className:t,...s},i)=>(0,e.jsx)("div",{ref:i,className:w("flex h-full w-full flex-col overflow-hidden rounded-xl bg-popover text-popover-foreground",t),...s}));k.displayName="CommandRoot";var S=g.default.forwardRef(({className:t,onValueChange:s,...i},c)=>(0,e.jsx)("div",{className:"px-3 pt-3 pb-2 border-b border-border",children:(0,e.jsxs)("div",{className:w("flex items-center gap-2 px-3 py-1.5 rounded-lg border border-border bg-muted/40 transition-colors","focus-within:border-primary/50 focus-within:ring-2 focus-within:ring-primary/10"),children:[(0,e.jsxs)("svg",{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground",viewBox:"0 0 20 20",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[(0,e.jsx)("circle",{cx:"8.5",cy:"8.5",r:"5.5"}),(0,e.jsx)("path",{d:"M17 17l-4-4",strokeLinecap:"round"})]}),(0,e.jsx)("input",{ref:c,type:"text",autoComplete:"off",autoCorrect:"off",spellCheck:!1,className:w("flex h-8 w-full bg-transparent text-sm outline-none","placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",t),onChange:o=>s?.(o.target.value),...i})]})}));S.displayName="CommandInput";var _=g.default.forwardRef(({className:t,...s},i)=>(0,e.jsx)("div",{ref:i,role:"listbox",className:w("max-h-72 overflow-y-auto overflow-x-hidden p-1",t),...s}));_.displayName="CommandList";var P=g.default.forwardRef((t,s)=>(0,e.jsx)("div",{ref:s,className:"flex flex-col items-center justify-center gap-1 py-8 text-sm text-muted-foreground",...t}));P.displayName="CommandEmpty";var L=g.default.forwardRef(({className:t,onSelect:s,onMouseDown:i,onKeyDown:c,disabled:o,selected:l,value:p,...j},f)=>(0,e.jsx)("div",{ref:f,role:"option","aria-disabled":o||void 0,"aria-selected":l,"data-disabled":o||void 0,"data-selected":l||void 0,tabIndex:o?void 0:0,className:w("relative flex cursor-pointer select-none items-center gap-2 rounded-lg px-2 py-2 text-sm outline-none","focus:bg-accent focus:text-accent-foreground","data-[disabled]:pointer-events-none data-[disabled]:opacity-50","hover:bg-accent/50 transition-colors",l&&"bg-accent text-accent-foreground font-semibold",t),onMouseDown:r=>{r.preventDefault(),i?.(r)},onClick:o?void 0:()=>s?.(),onKeyDown:r=>{!o&&r.key==="Enter"&&(r.preventDefault(),s?.()),c?.(r)},...j}));L.displayName="CommandItem";var E=g.default.forwardRef(({className:t,isOpen:s,children:i,placeholder:c,hasValue:o,...l},p)=>(0,e.jsxs)("button",{ref:p,type:"button",role:"combobox","aria-expanded":s,"aria-haspopup":"listbox",className:w("flex h-12 w-full items-center justify-between gap-3 rounded-xl border border-input bg-background px-4 py-2 text-sm ring-offset-background","placeholder:text-muted-foreground","focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2","disabled:cursor-not-allowed disabled:opacity-50","hover:bg-accent/10 transition-all",!o&&"text-muted-foreground",t),...l,children:[(0,e.jsx)("span",{className:"flex min-w-0 flex-1 items-center gap-2 truncate",children:i||(0,e.jsx)("span",{children:c})}),(0,e.jsx)("svg",{className:w("h-4 w-4 shrink-0 text-muted-foreground/60 transition-transform duration-200",s&&"rotate-180"),viewBox:"0 0 20 20",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:(0,e.jsx)("polyline",{points:"6 8 10 12 14 8"})})]}));E.displayName="PickerTrigger";var B=g.default.forwardRef(({label:t,trigger:s,children:i,open:c,onOpenChange:o,className:l},p)=>(0,e.jsxs)("div",{ref:p,className:w("flex flex-col gap-0",l),children:[t&&(0,e.jsx)(q,{children:t}),(0,e.jsxs)(A,{open:c,onOpenChange:o,children:[(0,e.jsx)(V,{asChild:!0,children:s}),(0,e.jsx)(M,{className:"p-0",children:i})]})]}));B.displayName="BasePicker";var F=g.default.forwardRef(({value:t,onRemove:s,onClear:i,isOpen:c,placeholder:o,renderChip:l,maxVisible:p=3,className:j,disabled:f,...r},h)=>{const d=t.slice(0,p),N=t.length-p;return(0,e.jsxs)("button",{ref:h,type:"button","aria-haspopup":"listbox","aria-expanded":c,disabled:f,className:w("flex min-h-[3rem] w-full items-center gap-3 rounded-xl border border-input bg-background px-4 py-2","text-sm ring-offset-background focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2","disabled:cursor-not-allowed disabled:opacity-50 hover:bg-accent/10 transition-all text-start",c&&"ring-2 ring-ring ring-offset-2",j),...r,children:[(0,e.jsx)("div",{className:"flex flex-1 flex-wrap gap-1.5 min-w-0 items-center",children:t.length===0?(0,e.jsx)("span",{className:"text-muted-foreground",children:o}):(0,e.jsxs)(e.Fragment,{children:[d.map((m,b)=>(0,e.jsxs)("span",{className:"inline-flex items-center gap-1 rounded-full bg-primary/10 px-2 py-0.5 text-[0.75rem] font-semibold text-primary",children:[l(m),(0,e.jsx)("span",{role:"button",tabIndex:f?-1:0,onClick:x=>{x.stopPropagation(),f||s(m,x)},onKeyDown:x=>{(x.key==="Enter"||x.key===" ")&&(x.preventDefault(),x.stopPropagation(),f||s(m,x))},className:"ml-0.5 rounded-full text-primary/60 hover:text-primary transition-colors cursor-pointer","aria-label":"Remove",children:(0,e.jsxs)("svg",{width:"9",height:"9",viewBox:"0 0 20 20",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",children:[(0,e.jsx)("line",{x1:"5",y1:"5",x2:"15",y2:"15"}),(0,e.jsx)("line",{x1:"15",y1:"5",x2:"5",y2:"15"})]})})]},b)),N>0&&(0,e.jsxs)(v,{className:"bg-muted text-muted-foreground/80 px-2",children:["+",N]})]})}),(0,e.jsxs)("div",{className:"flex shrink-0 items-center gap-1 ml-auto",children:[t.length>0&&(0,e.jsx)("span",{role:"button",tabIndex:f?-1:0,onClick:m=>{m.stopPropagation(),f||i(m)},onKeyDown:m=>{(m.key==="Enter"||m.key===" ")&&(m.preventDefault(),m.stopPropagation(),f||i(m))},className:"rounded p-0.5 text-muted-foreground hover:text-foreground hover:bg-accent/30 transition-colors cursor-pointer","aria-label":"Clear all",children:(0,e.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 20 20",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",children:[(0,e.jsx)("line",{x1:"5",y1:"5",x2:"15",y2:"15"}),(0,e.jsx)("line",{x1:"15",y1:"5",x2:"5",y2:"15"})]})}),(0,e.jsx)("svg",{className:w("h-4 w-4 text-muted-foreground/60 transition-transform duration-200",c&&"rotate-180"),viewBox:"0 0 20 20",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:(0,e.jsx)("polyline",{points:"6 8 10 12 14 8"})})]})]})});F.displayName="MultiSelectTrigger";var z=3;function ee({value:t,onChange:s,placeholder:i="Select countries...",maxItems:c,showFlags:o=!0,searchable:l=!0,disabled:p=!1,className:j,label:f}){const[r,h]=(0,g.useState)(!1),[d,N]=(0,g.useState)(""),m=d?(0,y.searchCountries)(d):(0,y.getAllCountries)(),b=n=>t.some(C=>C.iso2===n.iso2),x=n=>{if(b(n))s(t.filter(C=>C.iso2!==n.iso2));else{if(c!==void 0&&t.length>=c)return;s([...t,n])}},a=(n,C)=>{C.stopPropagation(),s(t.filter(T=>T.iso2!==n.iso2))},u=n=>{n.stopPropagation(),s([])};return t.slice(0,z),t.length-z,(0,e.jsxs)(B,{label:f,className:j,open:r,onOpenChange:h,trigger:(0,e.jsx)(F,{value:t,onRemove:a,onClear:u,isOpen:r,placeholder:i,disabled:p,renderChip:n=>(0,e.jsxs)(e.Fragment,{children:[o&&(0,e.jsx)(O,{iso2:n.iso2,flag:n.flag,flagUrl:n.flag_url}),(0,e.jsx)("span",{className:"max-w-[80px] truncate",children:n.name})]})}),children:[(0,e.jsxs)(k,{children:[l&&(0,e.jsx)(S,{placeholder:"Search countries...",value:d,onValueChange:N}),(0,e.jsxs)(_,{children:[m.length===0&&(0,e.jsxs)(P,{children:[(0,e.jsx)("span",{className:"text-2xl opacity-40",children:"π"}),(0,e.jsx)("span",{children:"No countries found"})]}),m.map(n=>{const C=b(n);return(0,e.jsxs)(L,{onSelect:()=>x(n),selected:C,children:[(0,e.jsx)("div",{className:w("h-4 w-4 shrink-0 rounded-full border border-border flex items-center justify-center",C&&"bg-primary border-primary"),children:C&&(0,e.jsx)("svg",{className:"h-2.5 w-2.5 stroke-white",viewBox:"0 0 20 20",fill:"none",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",children:(0,e.jsx)("polyline",{points:"4 10 8 14 16 6"})})}),o&&(0,e.jsx)(O,{iso2:n.iso2,flag:n.flag,flagUrl:n.flag_url}),(0,e.jsxs)("div",{className:"flex flex-1 flex-col min-w-0",children:[(0,e.jsx)("span",{className:"truncate font-medium",children:n.name}),(0,e.jsxs)("span",{className:"text-[0.7rem] text-muted-foreground",children:[n.iso3," Β· +",n.phone_code]})]})]},n.iso2)})]})]}),t.length>0&&(0,e.jsxs)("div",{className:"flex items-center justify-between border-t border-border px-3 py-2 text-xs text-muted-foreground",children:[(0,e.jsxs)("span",{children:[t.length," selected",c?` / ${c}`:""]}),(0,e.jsx)("button",{type:"button",onClick:()=>{s([]),h(!1)},className:"text-destructive hover:underline font-medium",children:"Clear all"})]})]})}function te({value:t,onChange:s,placeholder:i="Select a country...",searchable:c=!0,showFlag:o=!0,showPhoneCode:l=!1,disabled:p=!1,className:j,label:f}){const[r,h]=(0,g.useState)(!1),[d,N]=(0,g.useState)(""),m=d?(0,y.searchCountries)(d):(0,y.getAllCountries)(),b=x=>{const a=(0,y.getAllCountries)().find(u=>u.iso2.toLowerCase()===x.toLowerCase());a&&(s(a),h(!1),N(""))};return(0,e.jsx)(B,{label:f,className:j,open:r,onOpenChange:h,trigger:(0,e.jsx)(E,{isOpen:r,hasValue:!!t,placeholder:i,disabled:p,children:t&&(0,e.jsxs)(e.Fragment,{children:[o&&(0,e.jsx)(O,{iso2:t.iso2,flag:t.flag,flagUrl:t.flag_url}),(0,e.jsx)("span",{className:"flex-1 text-start truncate",children:t.name}),l&&(0,e.jsxs)(v,{children:["+",t.phone_code]})]})}),children:(0,e.jsxs)(k,{children:[c&&(0,e.jsx)(S,{placeholder:"Search country...",value:d,onValueChange:N}),(0,e.jsxs)(_,{children:[m.length===0&&(0,e.jsxs)(P,{children:[(0,e.jsx)("span",{className:"text-2xl opacity-40",children:"π"}),(0,e.jsx)("span",{children:"No countries found"})]}),m.map(x=>{const a=t?.iso2===x.iso2;return(0,e.jsxs)(L,{onSelect:()=>b(x.iso2),selected:a,children:[o&&(0,e.jsx)(O,{iso2:x.iso2,flag:x.flag,flagUrl:x.flag_url}),(0,e.jsxs)("div",{className:"flex flex-1 flex-col gap-0 min-w-0",children:[(0,e.jsx)("span",{className:"truncate font-medium",children:x.name}),(0,e.jsxs)("span",{className:"text-[0.7rem] text-muted-foreground",children:[x.iso3," Β· ",x.division_type]})]}),(0,e.jsxs)("div",{className:"flex items-center gap-1.5 ml-auto shrink-0",children:[l&&(0,e.jsxs)("span",{className:"text-[0.7rem] text-muted-foreground tabular-nums bg-muted px-1.5 py-0.5 rounded",children:["+",x.phone_code]}),a&&(0,e.jsx)(D,{})]})]},x.iso2)})]})]})})}var Q=3;function se({value:t,onChange:s,placeholder:i="Select currencies...",maxItems:c,showSymbol:o=!0,searchable:l=!0,disabled:p=!1,className:j,label:f}){const[r,h]=(0,g.useState)(!1),[d,N]=(0,g.useState)(""),m=d?(0,y.searchCurrencies)(d):(0,y.getAllCurrencies)(),b=n=>t.some(C=>C.code===n.code),x=n=>{if(b(n))s(t.filter(C=>C.code!==n.code));else{if(c!==void 0&&t.length>=c)return;s([...t,n])}},a=(n,C)=>{C.stopPropagation(),s(t.filter(T=>T.code!==n.code))},u=n=>{n.stopPropagation(),s([])};return t.slice(0,Q),t.length-Q,(0,e.jsxs)(B,{label:f,className:j,open:r,onOpenChange:h,trigger:(0,e.jsx)(F,{value:t,onRemove:a,onClear:u,isOpen:r,placeholder:i,disabled:p,renderChip:n=>(0,e.jsxs)(e.Fragment,{children:[o&&(0,e.jsx)("span",{className:"font-bold",children:n.symbol}),(0,e.jsx)("span",{children:n.code})]})}),children:[(0,e.jsxs)(k,{children:[l&&(0,e.jsx)(S,{placeholder:"Search currencies...",value:d,onValueChange:N}),(0,e.jsxs)(_,{children:[m.length===0&&(0,e.jsxs)(P,{children:[(0,e.jsx)("span",{className:"text-2xl opacity-40",children:"π°"}),(0,e.jsx)("span",{children:"No currencies found"})]}),m.map(n=>{const C=b(n);return(0,e.jsxs)(L,{onSelect:()=>x(n),selected:C,children:[(0,e.jsx)("div",{className:w("h-4 w-4 shrink-0 rounded-full border border-border flex items-center justify-center",C&&"bg-primary border-primary"),children:C&&(0,e.jsx)("svg",{className:"h-2.5 w-2.5 stroke-white",viewBox:"0 0 20 20",fill:"none",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",children:(0,e.jsx)("polyline",{points:"4 10 8 14 16 6"})})}),o&&(0,e.jsx)("span",{className:"min-w-[1.5rem] text-center font-bold text-primary",children:n.symbol}),(0,e.jsxs)("div",{className:"flex flex-1 flex-col min-w-0",children:[(0,e.jsx)("span",{className:"truncate font-medium",children:n.name}),(0,e.jsx)("span",{className:"text-[0.7rem] text-muted-foreground",children:n.code})]})]},n.code)})]})]}),t.length>0&&(0,e.jsxs)("div",{className:"flex items-center justify-between border-t border-border px-3 py-2 text-xs text-muted-foreground",children:[(0,e.jsxs)("span",{children:[t.length," selected",c?` / ${c}`:""]}),(0,e.jsx)("button",{type:"button",onClick:()=>{s([]),h(!1)},className:"text-destructive hover:underline font-medium",children:"Clear all"})]})]})}function ne({value:t,onChange:s,placeholder:i="Select a currency...",searchable:c=!0,showSymbol:o=!0,countryIso2:l,autoSelect:p=!0,disabled:j=!1,className:f,label:r}){const[h,d]=(0,g.useState)(!1),[N,m]=(0,g.useState)("");(0,g.useEffect)(()=>{if(l&&p&&!t){const u=(0,y.getCurrencyByCountry)(l);u&&s(u)}},[l,p,t,s]);const x=N?(0,y.searchCurrencies)(N,l):(()=>{if(l){const u=(0,y.getCurrencyByCountry)(l);return u?[u]:[]}return(0,y.getAllCurrencies)()})(),a=u=>{const n=(0,y.getAllCurrencies)().find(C=>C.code.toLowerCase()===u.toLowerCase());n&&(s(n),d(!1),m(""))};return(0,e.jsx)(B,{label:r,className:f,open:h,onOpenChange:d,trigger:(0,e.jsx)(E,{isOpen:h,hasValue:!!t,placeholder:i,disabled:j,children:t&&(0,e.jsxs)(e.Fragment,{children:[o&&(0,e.jsx)("span",{className:"min-w-[1.5rem] text-center font-bold text-primary text-base",children:t.symbol}),(0,e.jsxs)("span",{className:"flex-1 text-start truncate",children:[t.code," β ",t.name]})]})}),children:(0,e.jsxs)(k,{children:[c&&(0,e.jsx)(S,{placeholder:"Search currency...",value:N,onValueChange:m}),(0,e.jsxs)(_,{children:[x.length===0&&(0,e.jsxs)(P,{children:[(0,e.jsx)("span",{className:"text-2xl opacity-40",children:"π°"}),(0,e.jsx)("span",{children:"No currencies found"})]}),x.map(u=>{const n=t?.code===u.code;return(0,e.jsxs)(L,{onSelect:()=>a(u.code),selected:n,children:[o&&(0,e.jsx)("span",{className:"min-w-[1.5rem] text-center font-bold text-primary",children:u.symbol}),(0,e.jsxs)("div",{className:"flex flex-1 flex-col gap-0 min-w-0",children:[(0,e.jsx)("span",{className:"truncate font-medium",children:u.name}),(0,e.jsx)("span",{className:"text-[0.7rem] text-muted-foreground",children:u.code})]}),n&&(0,e.jsx)(D,{className:"ml-auto shrink-0"})]},u.code)})]})]})})}function re({countryIso2:t,value:s,onChange:i,placeholder:c="Select a division...",searchable:o=!0,disabled:l=!1,className:p,label:j}){const[f,r]=(0,g.useState)(!1),[h,d]=(0,g.useState)(""),N=(0,y.getDivisionsByCountry)(t),m=h?N.filter(a=>a.name.toLowerCase().includes(h.toLowerCase())||a.iso2.toLowerCase().includes(h.toLowerCase())||a.timezone.toLowerCase().includes(h.toLowerCase())):N,b=l||!t||N.length===0,x=a=>{const u=N.find(n=>n.name===a);u&&(i(u),r(!1),d(""))};return(0,e.jsx)(B,{label:j,className:p,open:f,onOpenChange:a=>!b&&r(a),trigger:(0,e.jsx)(E,{isOpen:f,hasValue:!!s,placeholder:t?c:"Select a country first",disabled:b,children:s&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("span",{className:"flex-1 text-start truncate",children:s.name}),(0,e.jsx)(v,{children:s.iso2})]})}),children:(0,e.jsxs)(k,{children:[o&&(0,e.jsx)(S,{placeholder:"Search division...",value:h,onValueChange:d}),(0,e.jsxs)(_,{children:[m.length===0&&(0,e.jsxs)(P,{children:[(0,e.jsx)("span",{className:"text-2xl opacity-40",children:"πΊοΈ"}),(0,e.jsx)("span",{children:"No divisions found"})]}),m.map(a=>{const u=s?.iso2===a.iso2&&s?.name===a.name;return(0,e.jsxs)(L,{onSelect:()=>x(a.name),selected:u,children:[(0,e.jsxs)("div",{className:"flex flex-1 flex-col gap-0 min-w-0",children:[(0,e.jsx)("span",{className:"truncate font-medium",children:a.name}),(0,e.jsx)("span",{className:"text-[0.7rem] text-muted-foreground truncate",children:a.timezone})]}),(0,e.jsxs)("div",{className:"flex items-center gap-1.5 ml-auto shrink-0",children:[(0,e.jsx)(v,{children:a.iso2}),u&&(0,e.jsx)(D,{})]})]},`${a.iso2}-${a.name}`)})]})]})})}function oe({value:t,onChange:s,placeholder:i="Select a language...",searchable:c=!0,showNativeName:o=!0,disabled:l=!1,className:p,label:j}){const[f,r]=(0,g.useState)(!1),[h,d]=(0,g.useState)(""),N=h?(0,y.searchLanguages)(h):(0,y.getAllLanguages)(),m=b=>{const x=(0,y.getAllLanguages)().find(a=>a.code.toLowerCase()===b.toLowerCase());x&&(s(x),r(!1),d(""))};return(0,e.jsx)(B,{label:j,className:p,open:f,onOpenChange:r,trigger:(0,e.jsx)(E,{isOpen:f,hasValue:!!t,placeholder:i,disabled:l,children:t&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("span",{className:"flex-1 text-start truncate",children:t.english_name}),o&&t.native_name!==t.english_name&&(0,e.jsx)("span",{className:"text-xs italic text-muted-foreground shrink-0",children:t.native_name})]})}),children:(0,e.jsxs)(k,{children:[c&&(0,e.jsx)(S,{placeholder:"Search language...",value:h,onValueChange:d}),(0,e.jsxs)(_,{children:[N.length===0&&(0,e.jsxs)(P,{children:[(0,e.jsx)("span",{className:"text-2xl opacity-40",children:"π"}),(0,e.jsx)("span",{children:"No languages found"})]}),N.map(b=>{const x=t?.code===b.code;return(0,e.jsxs)(L,{onSelect:()=>m(b.code),selected:x,children:[(0,e.jsxs)("div",{className:"flex flex-1 flex-col gap-0 min-w-0",children:[(0,e.jsx)("span",{className:"truncate font-medium",children:b.english_name}),o&&b.native_name!==b.english_name&&(0,e.jsx)("span",{className:"text-[0.7rem] text-muted-foreground italic",children:b.native_name})]}),(0,e.jsxs)("div",{className:"flex items-center gap-1.5 ml-auto shrink-0",children:[(0,e.jsx)(v,{className:"text-[0.6rem]",children:b.code}),x&&(0,e.jsx)(D,{})]})]},b.code)})]})]})})}var $=g.default.forwardRef(({value:t,onChange:s,defaultCountryIso2:i="US",placeholder:c="Phone number",showFlag:o=!0,disabled:l=!1,className:p,label:j},f)=>{const r=(0,y.usePhoneInput)(t,s,i),h=(0,y.useCountry)(r.country?.iso2);return(0,e.jsxs)("div",{ref:f,className:w("flex flex-col gap-0",p),children:[j&&(0,e.jsx)(q,{children:j}),(0,e.jsxs)("div",{className:w("flex h-12 items-stretch overflow-hidden rounded-xl border border-input bg-background ring-offset-background","focus-within:ring-2 focus-within:ring-ring focus-within:ring-offset-2","transition-shadow",l&&"opacity-50 pointer-events-none"),children:[(0,e.jsxs)(A,{open:r.isOpen,onOpenChange:d=>d?r.toggle():r.close(),children:[(0,e.jsx)(V,{asChild:!0,children:(0,e.jsxs)("button",{type:"button",disabled:l,className:w("flex h-full shrink-0 items-center gap-1.5 border-r border-input bg-muted px-3","text-sm font-semibold text-foreground transition-colors outline-none","hover:bg-accent/30 focus-visible:bg-accent/30"),children:[o&&r.country&&(0,e.jsx)(O,{iso2:r.country.iso2,flag:r.country.flag,flagUrl:r.country.flag_url}),(0,e.jsx)("span",{className:"tabular-nums text-primary",children:r.country?`+${r.country.phone_code}`:"+?"}),(0,e.jsx)("svg",{className:w("h-3.5 w-3.5 shrink-0 text-muted-foreground transition-transform duration-200",r.isOpen&&"rotate-180"),viewBox:"0 0 20 20",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",children:(0,e.jsx)("polyline",{points:"5 8 10 13 15 8"})})]})}),(0,e.jsx)(M,{align:"start",side:"bottom",sideOffset:4,className:"w-72",children:(0,e.jsxs)(k,{children:[(0,e.jsx)(S,{placeholder:"Search country or code...",value:r.searchQuery,onValueChange:r.setSearchQuery}),(0,e.jsxs)(_,{children:[r.filteredCountries.length===0&&(0,e.jsxs)(P,{children:[(0,e.jsx)("span",{className:"text-2xl opacity-40",children:"π"}),(0,e.jsx)("span",{children:"No countries found"})]}),r.filteredCountries.map(d=>(0,e.jsxs)(L,{onSelect:()=>r.selectCountry(d),selected:r.country?.iso2===d.iso2,children:[(0,e.jsx)(O,{iso2:d.iso2,flag:d.flag,flagUrl:d.flag_url}),(0,e.jsx)("div",{className:"flex flex-1 flex-col min-w-0",children:(0,e.jsx)("span",{className:"truncate font-medium text-sm",children:d.name})}),(0,e.jsxs)(v,{className:"ml-auto tabular-nums text-[0.7rem]",children:["+",d.phone_code]})]},d.iso2))]})]})})]}),(0,e.jsx)("input",{type:"tel",value:r.number,onChange:d=>r.setNumber(d.target.value),placeholder:c,disabled:l,minLength:h.phoneLengths.min,maxLength:h.phoneLengths.max,inputMode:"numeric",autoComplete:"tel-national",className:w("flex-1 min-w-0 bg-transparent px-3 text-sm text-foreground","placeholder:text-muted-foreground","focus:outline-none")})]}),r.value&&(0,e.jsxs)("p",{className:"text-[0.7rem] text-muted-foreground tabular-nums pl-0.5",children:["Full:"," ",(0,e.jsx)("span",{className:"font-mono text-primary",children:r.value.full})]})]})});$.displayName="PhoneInput";function ae({value:t,onChange:s,placeholder:i="Select a timezone...",searchable:c=!0,countryIso2:o,autoSelect:l=!0,disabled:p=!1,className:j,label:f}){const[r,h]=(0,g.useState)(!1),[d,N]=(0,g.useState)("");(0,g.useEffect)(()=>{if(o&&l&&!t){const a=(0,y.getTimezonesByCountry)(o);a&&a.length>0&&s(a[0])}},[o,l,t,s]);const m=o?(0,y.getTimezonesByCountry)(o):(0,y.getAllTimezones)(),b=d?(0,y.searchTimezones)(d,o):m,x=a=>{const u=m.find(n=>n.name===a);u&&(s(u),h(!1),N(""))};return(0,e.jsx)(B,{label:f,className:j,open:r,onOpenChange:h,trigger:(0,e.jsx)(E,{isOpen:r,hasValue:!!t,placeholder:i,disabled:p,children:t&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("span",{className:"flex-1 text-start truncate",children:t.name}),(0,e.jsx)(v,{children:t.offset_name})]})}),children:(0,e.jsxs)(k,{children:[c&&(0,e.jsx)(S,{placeholder:"Search timezone...",value:d,onValueChange:N}),(0,e.jsxs)(_,{children:[b.length===0&&(0,e.jsxs)(P,{children:[(0,e.jsx)("span",{className:"text-2xl opacity-40",children:"π"}),(0,e.jsx)("span",{children:"No timezones found"})]}),b.map(a=>{const u=t?.name===a.name;return(0,e.jsxs)(L,{onSelect:()=>x(a.name),selected:u,children:[(0,e.jsxs)("div",{className:"flex flex-1 flex-col gap-0 min-w-0",children:[(0,e.jsx)("span",{className:"truncate font-medium",children:a.name}),(0,e.jsxs)("span",{className:"text-[0.7rem] text-muted-foreground",children:[a.tzName," Β· ",a.abbreviation]})]}),(0,e.jsxs)("div",{className:"flex items-center gap-1.5 ml-auto shrink-0",children:[(0,e.jsx)(v,{className:"tabular-nums text-[0.65rem]",children:a.offset_name}),u&&(0,e.jsx)(D,{})]})]},a.name)})]})]})})}exports.Badge=v;exports.CheckIcon=D;exports.CommandEmpty=P;exports.CommandInput=S;exports.CommandItem=L;exports.CommandList=_;exports.CommandRoot=k;exports.CountryMultiSelect=ee;exports.CountryPicker=te;exports.CurrencyMultiSelect=se;exports.CurrencyPicker=ne;exports.DivisionPicker=re;exports.Flag=O;exports.LanguagePicker=oe;exports.PhoneInput=$;exports.PickerTrigger=E;exports.Popover=A;exports.PopoverContent=M;exports.PopoverTrigger=V;exports.TimezonePicker=ae;exports.cn=w;Object.keys(y).forEach(function(t){t!=="default"&&!Object.prototype.hasOwnProperty.call(exports,t)&&Object.defineProperty(exports,t,{enumerable:!0,get:function(){return y[t]}})});
|
|
2
|
+
|
|
3
|
+
//# sourceMappingURL=index.js.map
|