@xploreu/components 0.4.43 → 0.4.45
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/{chunk-WN22TTEL.js → chunk-6QWQDSWL.js} +2 -2
- package/dist/{chunk-WN22TTEL.js.map → chunk-6QWQDSWL.js.map} +1 -1
- package/dist/{chunk-YNJZ2P52.js → chunk-C5HZCXIB.js} +2 -2
- package/dist/{chunk-YNJZ2P52.js.map → chunk-C5HZCXIB.js.map} +1 -1
- package/dist/{chunk-HGLHAEGH.js → chunk-G2GFDTP5.js} +2 -2
- package/dist/{chunk-HGLHAEGH.js.map → chunk-G2GFDTP5.js.map} +1 -1
- package/dist/{chunk-H6ETV455.js → chunk-G4DP36RY.js} +2 -2
- package/dist/{chunk-H6ETV455.js.map → chunk-G4DP36RY.js.map} +1 -1
- package/dist/{chunk-VIBM666E.js → chunk-M63WCJ22.js} +2 -2
- package/dist/{chunk-VIBM666E.js.map → chunk-M63WCJ22.js.map} +1 -1
- package/dist/chunk-SVNG3RLD.js +2 -0
- package/dist/chunk-SVNG3RLD.js.map +1 -0
- package/dist/chunk-XZN4XT6V.js +2 -0
- package/dist/chunk-XZN4XT6V.js.map +1 -0
- package/dist/{chunk-RAVBRPQS.js → chunk-Y2HN4RSA.js} +2 -2
- package/dist/{chunk-RAVBRPQS.js.map → chunk-Y2HN4RSA.js.map} +1 -1
- package/dist/composites/combobox-chip-outside.js +1 -1
- package/dist/composites/combobox-chip.js +1 -1
- package/dist/composites/combobox-simple.js +1 -1
- package/dist/composites/filter-combobox.js +1 -1
- package/dist/composites/index.js +1 -1
- package/dist/composites/index.js.map +1 -1
- package/dist/composites/phone-input.js +1 -1
- package/dist/ui/combobox.d.ts +4 -3
- package/dist/ui/combobox.js +1 -1
- package/dist/ui/index.js +1 -1
- package/dist/ui/pagination.js +1 -1
- package/dist/ui/tabs.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-F56BLRF2.js +0 -2
- package/dist/chunk-F56BLRF2.js.map +0 -1
- package/dist/chunk-RHWRIE3E.js +0 -2
- package/dist/chunk-RHWRIE3E.js.map +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {a,b,m,e,q,s,w,x,H}from'./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import {a,b,m,e,q,s,w,x,H}from'./chunk-SVNG3RLD.js';import'react';import {ChevronDownIcon}from'lucide-react';import {cn}from'@xploreu/lib/cn';import {useControlledState}from'@xploreu/hooks/use-controlled-state';import {jsxs,jsx,Fragment}from'react/jsx-runtime';function X({multiple:m$1,items:s$1,placeholder:t="Select",icon:d,container:T,isPending:F,className:M,triggerClassName:k,contentClassName:A,disabled:R,infiniteScroll:x$1,filter:c,...o}){let r=m$1===true,L=o.showTitle??r,g=o.showSearch??r,[n,C]=useControlledState({value:o?.value,defaultValue:o?.defaultValue,onChange:o.onValueChange}),[$,q$1]=useControlledState({value:o?.inputValue?.toString(),defaultValue:o?.defaultInputValue?.toString(),onChange:o?.onInputValueChange}),u=Array.isArray(n)?n:n?[n]:[],a$1=u.length>0,z=u.length,B=a$1?r?`${t} (${z})`:u[0]?.label??t:r?`All ${t}`:t,D=()=>{C(null);};return jsxs(a,{items:s$1,multiple:m$1,value:n,onValueChange:C,inputValue:$,onInputValueChange:q$1,filter:c===null||!g?null:c,isItemEqualToValue:(l,p)=>l.value===p.value,disabled:R,...o,children:[jsxs(b,{className:cn("group flex h-8 w-fit max-w-[220px] items-center gap-2 rounded-xp-card-base border bg-bg-primary px-3 text-body-medium-3 transition-colors","border-border-primary text-text-secondary hover:bg-bg-primary-hover",a$1&&"border-border-brand bg-bg-brand-primary text-text-brand-secondary hover:bg-bg-brand-primary-hover-alt","disabled:pointer-events-none disabled:opacity-50","data-[popup-open]:border-border-brand data-[popup-open]:bg-bg-brand-primary data-[popup-open]:text-text-brand-secondary",k,M),children:[d&&jsx("span",{className:cn("size-4 shrink-0 group-data-[popup-open]:text-fg-brand-primary",a$1?"text-fg-brand-primary":"text-fg-quaternary"),children:d}),jsx("span",{className:"truncate",children:B}),jsx(ChevronDownIcon,{className:cn("size-4 shrink-0 transition-transform group-data-[popup-open]:rotate-180 group-data-[popup-open]:text-fg-brand-primary",a$1?"text-fg-brand-primary":"text-fg-quaternary")})]}),jsx(m,{container:T,className:cn("w-72",A),align:"start",sideOffset:8,children:jsxs("div",{className:"flex flex-col",children:[L&&jsxs("div",{className:"flex items-center justify-between p-3 border-b border-border-primary",children:[jsx("span",{className:"text-label-semibold-3 text-text-primary",children:t}),jsx("button",{type:"button",disabled:!a$1,onClick:D,className:cn("text-label-semibold-3 transition-colors",a$1?"cursor-pointer text-text-error-primary hover:text-text-error-primary-hover":"cursor-not-allowed text-text-disabled"),children:"Clear All"})]}),g&&jsx(e,{placeholder:`Search ${t.toLowerCase()}...`}),jsx(q,{status:F||s$1===void 0?"pending":s$1?.length===0?"empty":null}),jsx(s,{children:(l,p,E)=>jsxs(Fragment,{children:[jsx(w,{indicator:r?"checkbox":void 0,value:l,children:jsx(x,{children:l.label})},l.value),p===E-1&&!!x$1&&jsx(H,{...x$1})]})})]})})]})}export{X as a};//# sourceMappingURL=chunk-6QWQDSWL.js.map
|
|
2
|
+
//# sourceMappingURL=chunk-6QWQDSWL.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/composites/filter-combobox.tsx"],"names":["FilterCombobox","multiple","items","placeholder","icon","container","isPending","className","triggerClassName","contentClassName","disabled","infiniteScroll","filter","props","isMultiple","showTitle","showSearch","value","setValue","useControlledState","inputValue","setInputValue","valueArray","hasValue","count","triggerLabel","handleClear","jsxs","Combobox","a","b","ComboboxTrigger","cn","jsx","ChevronDownIcon","ComboboxPopup","ComboboxInput","ComboboxStatus","ComboboxList","item","index","length","Fragment","ComboboxItem","ComboboxItemTitle","ComboboxInfiniteScroll"],"mappings":"qQA+CA,SAASA,EAA+F,CACtG,QAAA,CAAAC,IACA,KAAA,CAAAC,GAAA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AAA,CAA2C,SAAA9B,CAAAA,CAAY,CAAA,CACvE8B,IAAC,QAAA,CAAA,CACC,IAAA,CAAK,QAAA,CACL,QAAA,CAAU,CAACV,GAAAA,CACX,OAAA,CAASG,EACT,SAAA,CAAWM,EAAAA,CACT,0CACAT,GAAAA,CACI,4EAAA,CACA,uCACN,CAAA,CACD,qBAED,CAAA,CAAA,CACF,CAAA,CAGDP,GACCiB,GAAAA,CAACG,CAAAA,CAAA,CAAc,WAAA,CAAa,CAAA,OAAA,EAAUjC,CAAAA,CAAY,WAAA,EAAa,CAAA,GAAA,CAAA,CAAO,CAAA,CAGxE8B,IAACI,CAAAA,CAAA,CACC,OACE/B,CAAAA,EAAaJ,GAAAA,GAAU,OACnB,SAAA,CACCA,GAAAA,EAAQ,SAAW,CAAA,CAClB,OAAA,CACA,KAEV,CAAA,CACA+B,GAAAA,CAACK,EAAA,CACE,QAAA,CAAA,CAACC,CAAAA,CAAMC,CAAAA,CAAOC,IACbd,IAAAA,CAAAe,QAAAA,CAAA,CACE,QAAA,CAAA,CAAAT,GAAAA,CAACU,EAAA,CACC,SAAA,CAAW7B,CAAAA,CAAa,UAAA,CAAa,OAErC,KAAA,CAAOyB,CAAAA,CAEP,SAAAN,GAAAA,CAACW,CAAAA,CAAA,CAAmB,QAAA,CAAAL,CAAAA,CAAK,KAAA,CAAM,CAAA,CAAA,CAH1BA,EAAK,KAIZ,CAAA,CACCC,IAAUC,CAAAA,CAAS,CAAA,EAAK,CAAC,CAAC9B,GAAAA,EACzBsB,IAACY,CAAAA,CAAA,CAAwB,GAAGlC,GAAAA,CAAgB,CAAA,CAAA,CAEhD,EAEJ,CAAA,CAAA,CACF,CAAA,CACF,GACF,CAEJ","file":"chunk-WN22TTEL.js","sourcesContent":["\"use client\"\r\n\r\nimport * as React from \"react\"\r\nimport { ChevronDownIcon } from \"lucide-react\"\r\n\r\nimport { cn } from \"@xploreu/lib/cn\"\r\nimport { useControlledState } from \"@xploreu/hooks/use-controlled-state\"\r\nimport { ComboboxItem, ComboboxItemTitle, type ComboboxProps } from \"../ui/combobox\"\r\nimport {\r\n Combobox,\r\n ComboboxInfiniteScroll,\r\n ComboboxInput,\r\n ComboboxList,\r\n ComboboxPopup,\r\n ComboboxPortal,\r\n ComboboxStatus,\r\n ComboboxTrigger\r\n} from \"../ui/combobox\"\r\n\r\n// ─── Types ───\r\n\r\nexport type FilterComboboxItem = {\r\n label: string\r\n value: string\r\n}\r\n\r\ntype FilterComboboxValueType<Value extends FilterComboboxItem, Multiple extends boolean | undefined> = Multiple extends true ? Value[] : Value;\r\n\r\ntype BaseProps = {\r\n items: FilterComboboxItem[] | undefined\r\n placeholder?: string\r\n icon?: React.ReactNode\r\n container?: React.ComponentProps<typeof ComboboxPortal>[\"container\"]\r\n isPending?: boolean\r\n className?: string\r\n triggerClassName?: string\r\n contentClassName?: string\r\n disabled?: boolean\r\n infiniteScroll?: React.ComponentProps<typeof ComboboxInfiniteScroll>\r\n showTitle?: boolean\r\n showSearch?: boolean\r\n}\r\n\r\nexport type FilterComboboxProps<Value, Multiple extends boolean | undefined = false> = ComboboxProps<Value, Multiple> & BaseProps\r\n\r\n// ─── Component ───\r\n\r\nfunction FilterCombobox<Value extends FilterComboboxItem, Multiple extends boolean | undefined = false>({\r\n multiple,\r\n items,\r\n placeholder = \"Select\",\r\n icon,\r\n container,\r\n isPending,\r\n className,\r\n triggerClassName,\r\n contentClassName,\r\n disabled,\r\n infiniteScroll,\r\n filter,\r\n ...props\r\n}: FilterComboboxProps<Value, Multiple>) {\r\n const isMultiple = multiple === true\r\n const showTitle = props.showTitle ?? isMultiple\r\n const showSearch = props.showSearch ?? isMultiple\r\n\r\n const [value, setValue] = useControlledState<FilterComboboxValueType<Value, Multiple> | null>({\r\n value: props?.value,\r\n defaultValue: props?.defaultValue,\r\n onChange: props.onValueChange as (\r\n value: FilterComboboxValueType<Value, Multiple> | null\r\n ) => void\r\n })\r\n\r\n const [inputValue, setInputValue] = useControlledState({\r\n value: props?.inputValue?.toString(),\r\n defaultValue: props?.defaultInputValue?.toString(),\r\n onChange: props?.onInputValueChange,\r\n })\r\n\r\n // Normalize value to array for label & clear logic\r\n const valueArray = Array.isArray(value) ? value : value ? [value] : []\r\n const hasValue = valueArray.length > 0\r\n const count = valueArray.length\r\n\r\n const triggerLabel = !hasValue\r\n ? isMultiple\r\n ? `All ${placeholder}`\r\n : placeholder\r\n : isMultiple\r\n ? `${placeholder} (${count})`\r\n : valueArray[0]?.label ?? placeholder\r\n\r\n const handleClear = () => {\r\n setValue(null)\r\n }\r\n\r\n return (\r\n <Combobox\r\n items={items}\r\n multiple={multiple}\r\n value={value}\r\n onValueChange={setValue}\r\n inputValue={inputValue}\r\n onInputValueChange={setInputValue}\r\n filter={filter === null || !showSearch ? null : filter}\r\n isItemEqualToValue={(a, b) => a.value === b.value}\r\n disabled={disabled}\r\n {...props}\r\n >\r\n <ComboboxTrigger\r\n className={cn(\r\n \"group flex h-9 w-fit max-w-[220px] items-center gap-2 rounded-xp-card-base border bg-bg-primary px-3 text-body-medium-3 transition-colors\",\r\n \"border-border-primary text-text-secondary hover:bg-bg-primary-hover\",\r\n hasValue && \"border-border-brand bg-bg-brand-primary text-text-brand-secondary hover:bg-bg-brand-primary-hover-alt\",\r\n \"disabled:pointer-events-none disabled:opacity-50\",\r\n \"data-[popup-open]:border-border-brand data-[popup-open]:bg-bg-brand-primary data-[popup-open]:text-text-brand-secondary\",\r\n triggerClassName,\r\n className\r\n )}\r\n >\r\n {icon && (\r\n <span\r\n className={cn(\r\n \"size-4 shrink-0 group-data-[popup-open]:text-fg-brand-primary\",\r\n hasValue ? \"text-fg-brand-primary\" : \"text-fg-quaternary\"\r\n )}\r\n >\r\n {icon}\r\n </span>\r\n )}\r\n <span className=\"truncate\">{triggerLabel}</span>\r\n <ChevronDownIcon\r\n className={cn(\r\n \"size-4 shrink-0 transition-transform group-data-[popup-open]:rotate-180 group-data-[popup-open]:text-fg-brand-primary\",\r\n hasValue ? \"text-fg-brand-primary\" : \"text-fg-quaternary\"\r\n )}\r\n />\r\n </ComboboxTrigger>\r\n\r\n <ComboboxPopup\r\n container={container}\r\n className={cn(\"w-72\", contentClassName)}\r\n align=\"start\"\r\n sideOffset={8}\r\n >\r\n <div className=\"flex flex-col\">\r\n {showTitle && (\r\n <div className=\"flex items-center justify-between p-3 border-b border-border-primary\">\r\n <span className=\"text-label-semibold-3 text-text-primary\">{placeholder}</span>\r\n <button\r\n type=\"button\"\r\n disabled={!hasValue}\r\n onClick={handleClear}\r\n className={cn(\r\n \"text-label-semibold-3 transition-colors\",\r\n hasValue\r\n ? \"cursor-pointer text-text-error-primary hover:text-text-error-primary-hover\"\r\n : \"cursor-not-allowed text-text-disabled\"\r\n )}\r\n >\r\n Clear All\r\n </button>\r\n </div>\r\n )}\r\n\r\n {showSearch && (\r\n <ComboboxInput placeholder={`Search ${placeholder.toLowerCase()}...`} />\r\n )}\r\n\r\n <ComboboxStatus\r\n status={\r\n isPending || items === undefined\r\n ? \"pending\"\r\n : (items)?.length === 0\r\n ? \"empty\"\r\n : null\r\n }\r\n />\r\n <ComboboxList>\r\n {(item, index, length) => (\r\n <>\r\n <ComboboxItem\r\n indicator={isMultiple ? \"checkbox\" : undefined}\r\n key={item.value}\r\n value={item}\r\n >\r\n <ComboboxItemTitle>{item.label}</ComboboxItemTitle>\r\n </ComboboxItem>\r\n {index === length - 1 && !!infiniteScroll && (\r\n <ComboboxInfiniteScroll {...infiniteScroll} />\r\n )}\r\n </>\r\n )}\r\n </ComboboxList>\r\n </div>\r\n </ComboboxPopup>\r\n </Combobox>\r\n )\r\n}\r\n\r\nexport { FilterCombobox }\r\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/composites/filter-combobox.tsx"],"names":["FilterCombobox","multiple","items","placeholder","icon","container","isPending","className","triggerClassName","contentClassName","disabled","infiniteScroll","filter","props","isMultiple","showTitle","showSearch","value","setValue","useControlledState","inputValue","setInputValue","valueArray","hasValue","count","triggerLabel","handleClear","jsxs","Combobox","a","b","ComboboxTrigger","cn","jsx","ChevronDownIcon","ComboboxPopup","ComboboxInput","ComboboxStatus","ComboboxList","item","index","length","Fragment","ComboboxItem","ComboboxItemTitle","ComboboxInfiniteScroll"],"mappings":"qQA+CA,SAASA,EAA+F,CACtG,QAAA,CAAAC,IACA,KAAA,CAAAC,GAAAA,CACA,YAAAC,CAAAA,CAAc,QAAA,CACd,IAAA,CAAAC,CAAAA,CACA,UAAAC,CAAAA,CACA,SAAA,CAAAC,EACA,SAAA,CAAAC,CAAAA,CACA,iBAAAC,CAAAA,CACA,gBAAA,CAAAC,CAAAA,CACA,QAAA,CAAAC,EACA,cAAA,CAAAC,GAAAA,CACA,OAAAC,CAAAA,CACA,GAAGC,CACL,CAAA,CAAyC,CACvC,IAAMC,CAAAA,CAAab,MAAa,IAAA,CAC1Bc,CAAAA,CAAYF,EAAM,SAAA,EAAaC,CAAAA,CAC/BE,EAAaH,CAAAA,CAAM,UAAA,EAAcC,CAAAA,CAEjC,CAACG,EAAOC,CAAQ,CAAA,CAAIC,mBAAoE,CAC5F,KAAA,CAAON,GAAO,KAAA,CACd,YAAA,CAAcA,GAAO,YAAA,CACrB,QAAA,CAAUA,EAAM,aAGlB,CAAC,EAEK,CAACO,CAAAA,CAAYC,GAAa,CAAA,CAAIF,kBAAAA,CAAmB,CACrD,KAAA,CAAON,GAAO,UAAA,EAAY,QAAA,GAC1B,YAAA,CAAcA,CAAAA,EAAO,mBAAmB,QAAA,EAAS,CACjD,QAAA,CAAUA,CAAAA,EAAO,kBACnB,CAAC,CAAA,CAGKS,EAAa,KAAA,CAAM,OAAA,CAAQL,CAAK,CAAA,CAAIA,CAAAA,CAAQA,CAAAA,CAAQ,CAACA,CAAK,CAAA,CAAI,GAC9DM,GAAAA,CAAWD,CAAAA,CAAW,OAAS,CAAA,CAC/BE,CAAAA,CAAQF,EAAW,MAAA,CAEnBG,CAAAA,CAAgBF,IAIlBT,CAAAA,CACE,CAAA,EAAGX,CAAW,CAAA,EAAA,EAAK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F,CAAA,CACF,GACF,CAEJ","file":"chunk-6QWQDSWL.js","sourcesContent":["\"use client\"\r\n\r\nimport * as React from \"react\"\r\nimport { ChevronDownIcon } from \"lucide-react\"\r\n\r\nimport { cn } from \"@xploreu/lib/cn\"\r\nimport { useControlledState } from \"@xploreu/hooks/use-controlled-state\"\r\nimport { ComboboxItem, ComboboxItemTitle, type ComboboxProps } from \"../ui/combobox\"\r\nimport {\r\n Combobox,\r\n ComboboxInfiniteScroll,\r\n ComboboxInput,\r\n ComboboxList,\r\n ComboboxPopup,\r\n ComboboxPortal,\r\n ComboboxStatus,\r\n ComboboxTrigger\r\n} from \"../ui/combobox\"\r\n\r\n// ─── Types ───\r\n\r\nexport type FilterComboboxItem = {\r\n label: string\r\n value: string\r\n}\r\n\r\ntype FilterComboboxValueType<Value extends FilterComboboxItem, Multiple extends boolean | undefined> = Multiple extends true ? Value[] : Value;\r\n\r\ntype BaseProps = {\r\n items: FilterComboboxItem[] | undefined\r\n placeholder?: string\r\n icon?: React.ReactNode\r\n container?: React.ComponentProps<typeof ComboboxPortal>[\"container\"]\r\n isPending?: boolean\r\n className?: string\r\n triggerClassName?: string\r\n contentClassName?: string\r\n disabled?: boolean\r\n infiniteScroll?: React.ComponentProps<typeof ComboboxInfiniteScroll>\r\n showTitle?: boolean\r\n showSearch?: boolean\r\n}\r\n\r\nexport type FilterComboboxProps<Value, Multiple extends boolean | undefined = false> = ComboboxProps<Value, Multiple> & BaseProps\r\n\r\n// ─── Component ───\r\n\r\nfunction FilterCombobox<Value extends FilterComboboxItem, Multiple extends boolean | undefined = false>({\r\n multiple,\r\n items,\r\n placeholder = \"Select\",\r\n icon,\r\n container,\r\n isPending,\r\n className,\r\n triggerClassName,\r\n contentClassName,\r\n disabled,\r\n infiniteScroll,\r\n filter,\r\n ...props\r\n}: FilterComboboxProps<Value, Multiple>) {\r\n const isMultiple = multiple === true\r\n const showTitle = props.showTitle ?? isMultiple\r\n const showSearch = props.showSearch ?? isMultiple\r\n\r\n const [value, setValue] = useControlledState<FilterComboboxValueType<Value, Multiple> | null>({\r\n value: props?.value,\r\n defaultValue: props?.defaultValue,\r\n onChange: props.onValueChange as (\r\n value: FilterComboboxValueType<Value, Multiple> | null\r\n ) => void\r\n })\r\n\r\n const [inputValue, setInputValue] = useControlledState({\r\n value: props?.inputValue?.toString(),\r\n defaultValue: props?.defaultInputValue?.toString(),\r\n onChange: props?.onInputValueChange,\r\n })\r\n\r\n // Normalize value to array for label & clear logic\r\n const valueArray = Array.isArray(value) ? value : value ? [value] : []\r\n const hasValue = valueArray.length > 0\r\n const count = valueArray.length\r\n\r\n const triggerLabel = !hasValue\r\n ? isMultiple\r\n ? `All ${placeholder}`\r\n : placeholder\r\n : isMultiple\r\n ? `${placeholder} (${count})`\r\n : valueArray[0]?.label ?? placeholder\r\n\r\n const handleClear = () => {\r\n setValue(null)\r\n }\r\n\r\n return (\r\n <Combobox\r\n items={items}\r\n multiple={multiple}\r\n value={value}\r\n onValueChange={setValue}\r\n inputValue={inputValue}\r\n onInputValueChange={setInputValue}\r\n filter={filter === null || !showSearch ? null : filter}\r\n isItemEqualToValue={(a, b) => a.value === b.value}\r\n disabled={disabled}\r\n {...props}\r\n >\r\n <ComboboxTrigger\r\n className={cn(\r\n \"group flex h-8 w-fit max-w-[220px] items-center gap-2 rounded-xp-card-base border bg-bg-primary px-3 text-body-medium-3 transition-colors\",\r\n \"border-border-primary text-text-secondary hover:bg-bg-primary-hover\",\r\n hasValue && \"border-border-brand bg-bg-brand-primary text-text-brand-secondary hover:bg-bg-brand-primary-hover-alt\",\r\n \"disabled:pointer-events-none disabled:opacity-50\",\r\n \"data-[popup-open]:border-border-brand data-[popup-open]:bg-bg-brand-primary data-[popup-open]:text-text-brand-secondary\",\r\n triggerClassName,\r\n className\r\n )}\r\n >\r\n {icon && (\r\n <span\r\n className={cn(\r\n \"size-4 shrink-0 group-data-[popup-open]:text-fg-brand-primary\",\r\n hasValue ? \"text-fg-brand-primary\" : \"text-fg-quaternary\"\r\n )}\r\n >\r\n {icon}\r\n </span>\r\n )}\r\n <span className=\"truncate\">{triggerLabel}</span>\r\n <ChevronDownIcon\r\n className={cn(\r\n \"size-4 shrink-0 transition-transform group-data-[popup-open]:rotate-180 group-data-[popup-open]:text-fg-brand-primary\",\r\n hasValue ? \"text-fg-brand-primary\" : \"text-fg-quaternary\"\r\n )}\r\n />\r\n </ComboboxTrigger>\r\n\r\n <ComboboxPopup\r\n container={container}\r\n className={cn(\"w-72\", contentClassName)}\r\n align=\"start\"\r\n sideOffset={8}\r\n >\r\n <div className=\"flex flex-col\">\r\n {showTitle && (\r\n <div className=\"flex items-center justify-between p-3 border-b border-border-primary\">\r\n <span className=\"text-label-semibold-3 text-text-primary\">{placeholder}</span>\r\n <button\r\n type=\"button\"\r\n disabled={!hasValue}\r\n onClick={handleClear}\r\n className={cn(\r\n \"text-label-semibold-3 transition-colors\",\r\n hasValue\r\n ? \"cursor-pointer text-text-error-primary hover:text-text-error-primary-hover\"\r\n : \"cursor-not-allowed text-text-disabled\"\r\n )}\r\n >\r\n Clear All\r\n </button>\r\n </div>\r\n )}\r\n\r\n {showSearch && (\r\n <ComboboxInput placeholder={`Search ${placeholder.toLowerCase()}...`} />\r\n )}\r\n\r\n <ComboboxStatus\r\n status={\r\n isPending || items === undefined\r\n ? \"pending\"\r\n : (items)?.length === 0\r\n ? \"empty\"\r\n : null\r\n }\r\n />\r\n <ComboboxList>\r\n {(item, index, length) => (\r\n <>\r\n <ComboboxItem\r\n indicator={isMultiple ? \"checkbox\" : undefined}\r\n key={item.value}\r\n value={item}\r\n >\r\n <ComboboxItemTitle>{item.label}</ComboboxItemTitle>\r\n </ComboboxItem>\r\n {index === length - 1 && !!infiniteScroll && (\r\n <ComboboxInfiniteScroll {...infiniteScroll} />\r\n )}\r\n </>\r\n )}\r\n </ComboboxList>\r\n </div>\r\n </ComboboxPopup>\r\n </Combobox>\r\n )\r\n}\r\n\r\nexport { FilterCombobox }\r\n"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {a,b as b$1,j,i,k,l,m,q,s,w,x,H}from'./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import {a,b as b$1,j,i,k,l,m,q,s,w,x,H}from'./chunk-SVNG3RLD.js';import {g}from'./chunk-HHG7BSWN.js';import {b}from'./chunk-Y6TKCAAJ.js';import*as r from'react';import {cn}from'@xploreu/lib/cn';import {SearchIcon,XIcon}from'lucide-react';import {useControlledState}from'@xploreu/hooks/use-controlled-state';import {jsxs,jsx,Fragment}from'react/jsx-runtime';function ee({multiple:B=true,inputPlaceholder:q$1="Search...",container:A,items:u,infiniteScroll:H$1,isPending:U,taggable:b$2=false,maxVisible:i$1,...m$1}){let[h,x$1]=useControlledState({value:m$1?.inputValue?.toString(),defaultValue:m$1?.defaultInputValue?.toString(),onChange:m$1?.onInputValueChange}),[c,g$1]=useControlledState({value:m$1?.value??[],defaultValue:m$1?.defaultValue??[],onChange:m$1?.onValueChange}),[v,I]=r.useState([]),p=r.useRef(new Set);r.useEffect(()=>{let e=new Set(c.map(t=>t.value));I(t=>{let l=t.filter(a=>e.has(a.value));return l.length===t.length?t:(p.current=new Set(l.map(a=>a.value)),l)});},[c]);let n=h?.toString().trim()??"",X=r.useMemo(()=>n?c.some(e=>e.value.toLowerCase()===n.toLowerCase()):false,[n,c]),C=r.useMemo(()=>!b$2||!n?false:!u?.some(e=>e.label.toLowerCase()===n.toLowerCase()),[b$2,n,u]),D=r.useMemo(()=>{let e=[...u??[],...v];if(C){let t={label:n,value:n,tag:true};return [...e,t]}return e},[u,v,C,n]);return jsxs(a,{...m$1,behavior:"chip-outside",multiple:true,items:b$2?D:u,isItemEqualToValue:(e,t)=>e.value===t.value,onValueChange:(e,t)=>{if(b$2){let l=e.filter(a=>a?.tag===true&&!p.current.has(a.value));if(l.length>0){for(let a of l)p.current.add(a.value);I(a=>[...a,...l]);}}g$1(B?e:[e[e.length-1]],t);},onInputValueChange:x$1,children:[jsxs("div",{className:"flex flex-col gap-2",children:[jsx(g,{render:jsx(b,{className:"h-9 text-body-regular-3 pl-9 pr-7",endContent:jsx(b$1,{nativeButton:false,render:jsx(XIcon,{className:"!size-5 !right-1.5 data-[hidden=true]:opacity-0 opacity-100 transition-opacity duration-300 cursor-pointer","data-hidden":!h,"data-slot":"combobox-clear-input",onClick:e=>{x$1("",{reason:"none",event:e.nativeEvent,cancel:()=>{},allowPropagation:()=>{},isCanceled:false,isPropagationAllowed:true,trigger:void 0});}})}),placeholder:q$1,startContent:jsx(SearchIcon,{className:"!size-4 !text-fg-tertiary-hover"}),wrapperClassName:"w-full"})}),jsx(j,{className:cn(i$1!==void 0&&"flex-nowrap overflow-hidden"),onMouseDown:e=>e.preventBaseUIHandler(),children:jsx(i,{children:e=>{let t=i$1!==void 0?e.slice(0,i$1):e,l$1=i$1!==void 0?e.length-i$1:0;return jsxs(Fragment,{children:[t?.map(a=>jsxs(k,{className:cn(i$1!==void 0&&"min-w-0 shrink"),children:[i$1!==void 0?jsx("span",{className:"truncate",children:a?.label||""}):a?.label||"",jsx(l,{})]},a?.value||"")),l$1>0&&jsxs(k,{className:"shrink-0",children:["+",l$1]})]})}})})]}),jsxs(m,{container:A,children:[jsx(q,{status:U||u===void 0?"pending":u?.length===0&&!C?"empty":null}),jsxs(s,{children:[u?.map(e=>jsx(w,{value:{label:e.label,value:e.value},children:jsx(x,{children:e.label})},e.value)),C&&jsx(w,{value:{label:n,value:n,tag:true},children:jsxs("div",{className:"flex items-center gap-1.5 w-full min-w-0",children:[!X&&jsx("span",{className:"text-text-secondary",children:"Create:"}),jsx("span",{className:"font-medium text-text-primary truncate",children:n})]})}),jsx(H,{...H$1})]})]})]})}export{ee as a};//# sourceMappingURL=chunk-C5HZCXIB.js.map
|
|
2
|
+
//# sourceMappingURL=chunk-C5HZCXIB.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/composites/combobox-chip-outside.tsx"],"names":["ComboboxChipOutside","multiple","inputPlaceholder","container","items","infiniteScroll","isPending","taggable","maxVisible","props","inputValue","setInputValue","useControlledState","value","setValue","createdItems","setCreatedItems","createdValuesRef","currentValues","v","prev","next","item","trimmedInput","isInputSelected","isCreatingItem","combinedItems","base","createItem","jsxs","Combobox","a","b","eventDetails","newTags","tag","jsx","ComboboxInput","Input","ComboboxTrigger","XIcon","event","SearchIcon","ComboboxChips","cn","ComboboxValue","visible","overflow","Fragment","ComboboxChip","ComboboxChipRemove","ComboboxPopup","ComboboxStatus","ComboboxList","ComboboxItem","ComboboxItemTitle","ComboboxInfiniteScroll"],"mappings":"qWA6CA,SAASA,EAAAA,CAAgF,CACvF,QAAA,CAAAC,EAAW,IAAA,CACX,gBAAA,CAAAC,GAAAA,CAAmB,WAAA,CACnB,UAAAC,CAAAA,CACA,KAAA,CAAAC,CAAAA,CACA,cAAA,CAAAC,GAAAA,CACA,SAAA,CAAAC,CAAAA,CACA,QAAA,CAAAC,IAAW,KAAA,CACX,UAAA,CAAAC,GAAAA,CACA,GAAGC,GACL,CAAA,CAAoC,CAClC,GAAM,CAACC,EAAYC,GAAa,CAAA,CAAIC,kBAAAA,CAAmB,CACrD,KAAA,CAAOH,GAAAA,EAAO,UAAA,EAAY,QAAA,GAC1B,YAAA,CAAcA,GAAAA,EAAO,iBAAA,EAAmB,QAAA,GACxC,QAAA,CAAUA,GAAAA,EAAO,kBACnB,CAAC,EAEK,CAACI,CAAAA,CAAOC,GAAQ,CAAA,CAAIF,kBAAAA,CAAmB,CAC3C,KAAA,CAAOH,GAAAA,EAAO,OAAS,EAAC,CACxB,YAAA,CAAcA,GAAAA,EAAO,cAAgB,EAAC,CACtC,QAAA,CAAUA,GAAAA,EAAO,aACnB,CAAC,CAAA,CAIK,CAACM,CAAAA,CAAcC,CAAe,CAAA,CAAU,CAAA,CAAA,QAAA,CAAkB,EAAE,CAAA,CAC5DC,CAAAA,CAAyB,CAAA,CAAA,MAAA,CAAoB,IAAI,GAAK,CAAA,CAEtD,CAAA,CAA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CAAAA,CAAA,CACC,KAAA,CAAO,CAAE,KAAA,CAAO/B,CAAAA,CAAc,KAAA,CAAOA,CAAAA,CAAc,GAAA,CAAK,IAAK,EAE7D,QAAA,CAAAM,IAAAA,CAAC,KAAA,CAAA,CAAI,SAAA,CAAU,2CACZ,QAAA,CAAA,CAAA,CAACL,CAAAA,EACAY,GAAAA,CAAC,MAAA,CAAA,CAAK,UAAU,qBAAA,CAAsB,QAAA,CAAA,SAAA,CAAO,CAAA,CAE/CA,GAAAA,CAAC,QAAK,SAAA,CAAU,wCAAA,CACb,QAAA,CAAAb,CAAAA,CACH,GACF,CAAA,CACF,CAAA,CAEFa,GAAAA,CAACoB,CAAAA,CAAA,CAAwB,GAAGnD,GAAAA,CAAgB,CAAA,CAAA,CAC9C,CAAA,CAAA,CACF,GACF,CAEJ","file":"chunk-YNJZ2P52.js","sourcesContent":["import * as React from \"react\"\r\n\r\nimport { cn } from \"@xploreu/lib/cn\"\r\nimport { ComboboxInput as ComboboxInputPrimitive } from \"../primitives/combobox\"\r\nimport { Input } from \"../ui\"\r\nimport {\r\n Combobox,\r\n ComboboxChip,\r\n ComboboxChipRemove,\r\n ComboboxChips,\r\n ComboboxInfiniteScroll,\r\n ComboboxItem,\r\n ComboboxList,\r\n ComboboxPortal,\r\n ComboboxPopup,\r\n ComboboxStatus,\r\n ComboboxTrigger,\r\n ComboboxValue,\r\n type ComboboxProps,\r\n ComboboxItemTitle\r\n} from \"../ui/combobox\"\r\nimport { SearchIcon, XIcon } from \"lucide-react\"\r\nimport { useControlledState } from \"@xploreu/hooks/use-controlled-state\"\r\n\r\ntype ComboboxChipOutsideProps<Value> = Omit<ComboboxProps<Value, true>, \"multiple\"> & {\r\n multiple?: boolean\r\n inputPlaceholder?: string\r\n container?: React.ComponentProps<typeof ComboboxPortal>[\"container\"]\r\n items: ({ label: string; value: string }[]) | undefined\r\n infiniteScroll?: React.ComponentProps<typeof ComboboxInfiniteScroll>\r\n isPending?: boolean\r\n /**\r\n * When true, enables creatable / taggable mode.\r\n * If the typed value has no exact match in the current item list,\r\n * a \"Create \\\"…\\\"\" option is shown at the top of the dropdown.\r\n * Created items are appended to the value with `{ label, value, tag: true }`.\r\n */\r\n taggable?: boolean\r\n /**\r\n * Maximum number of chips to show before collapsing the rest into a \"+N\" chip.\r\n * When undefined, all chips are shown.\r\n */\r\n maxVisible?: number\r\n}\r\n\r\nfunction ComboboxChipOutside<Value extends { label: string; value: string; tag?: true }>({\r\n multiple = true,\r\n inputPlaceholder = \"Search...\",\r\n container,\r\n items,\r\n infiniteScroll,\r\n isPending,\r\n taggable = false,\r\n maxVisible,\r\n ...props\r\n}: ComboboxChipOutsideProps<Value>) {\r\n const [inputValue, setInputValue] = useControlledState({\r\n value: props?.inputValue?.toString(),\r\n defaultValue: props?.defaultInputValue?.toString(),\r\n onChange: props?.onInputValueChange,\r\n })\r\n\r\n const [value, setValue] = useControlledState({\r\n value: props?.value ?? [],\r\n defaultValue: props?.defaultValue ?? [],\r\n onChange: props?.onValueChange,\r\n })\r\n\r\n // Track items created via taggable mode\r\n // Sync with value to avoid stale tags when controlled value is reset from outside\r\n const [createdItems, setCreatedItems] = React.useState<Value[]>([])\r\n const createdValuesRef = React.useRef<Set<string>>(new Set())\r\n\r\n React.useEffect(() => {\r\n const currentValues = new Set(value.map((v) => v.value))\r\n setCreatedItems((prev) => {\r\n const next = prev.filter((item) => currentValues.has(item.value))\r\n if (next.length === prev.length) return prev\r\n createdValuesRef.current = new Set(next.map((v) => v.value))\r\n return next\r\n })\r\n }, [value])\r\n\r\n // Determine if the current input has no exact match in existing items\r\n const trimmedInput = inputValue?.toString().trim() ?? \"\"\r\n const isInputSelected = React.useMemo(() => {\r\n if (!trimmedInput) return false\r\n return value.some(\r\n (item) => item.value.toLowerCase() === trimmedInput.toLowerCase()\r\n )\r\n }, [trimmedInput, value])\r\n // true = show the taggable item in dropdown (either as \"Create:\" or as checked item)\r\n const isCreatingItem = React.useMemo(() => {\r\n if (!taggable || !trimmedInput) return false\r\n return !items?.some(\r\n (item) => item.label.toLowerCase() === trimmedInput.toLowerCase()\r\n )\r\n }, [taggable, trimmedInput, items])\r\n\r\n // Merge server items with locally created tags + the \"Create\" placeholder\r\n const combinedItems = React.useMemo(() => {\r\n const base: Value[] = [\r\n ...items ?? [],\r\n ...createdItems,\r\n ]\r\n\r\n if (isCreatingItem) {\r\n const createItem = {\r\n label: trimmedInput,\r\n value: trimmedInput,\r\n tag: true,\r\n }\r\n return [...base, createItem]\r\n }\r\n\r\n return base\r\n }, [items, createdItems, isCreatingItem, trimmedInput])\r\n\r\n const handleValueChange: ComboboxProps<Value, true>[\"onValueChange\"] = (value, eventDetails) => {\r\n // Capture newly created taggable items internally\r\n if (taggable) {\r\n const newTags = value.filter(\r\n (v) => v?.tag === true\r\n && !createdValuesRef.current.has(v.value)\r\n )\r\n if (newTags.length > 0) {\r\n for (const tag of newTags) {\r\n createdValuesRef.current.add(tag.value)\r\n }\r\n setCreatedItems((prev) => [...prev, ...newTags])\r\n }\r\n }\r\n\r\n // if multiple is false, we need to replace the value with the new value instead of adding to it\r\n if (!multiple) {\r\n setValue([value[value.length - 1]], eventDetails)\r\n } else {\r\n setValue(value, eventDetails)\r\n }\r\n }\r\n\r\n return (\r\n <Combobox\r\n {...props}\r\n behavior=\"chip-outside\"\r\n multiple\r\n items={taggable ? combinedItems : items}\r\n isItemEqualToValue={(a, b) => a.value === b.value}\r\n onValueChange={handleValueChange}\r\n onInputValueChange={setInputValue}\r\n >\r\n <div className=\"flex flex-col gap-2\">\r\n <ComboboxInputPrimitive\r\n render={\r\n <Input\r\n className=\"h-9 text-body-regular-3 pl-9 pr-7\"\r\n endContent={\r\n <ComboboxTrigger\r\n nativeButton={false}\r\n render={(\r\n <XIcon\r\n className=\"!size-5 !right-1.5 data-[hidden=true]:opacity-0 opacity-100 transition-opacity duration-300 cursor-pointer\"\r\n data-hidden={!inputValue}\r\n data-slot=\"combobox-clear-input\"\r\n onClick={(event) => {\r\n setInputValue(\"\", {\r\n reason: \"none\",\r\n event: event.nativeEvent,\r\n cancel: () => { },\r\n allowPropagation: () => { },\r\n isCanceled: false,\r\n isPropagationAllowed: true,\r\n trigger: undefined,\r\n })\r\n }}\r\n />\r\n )}\r\n />\r\n }\r\n placeholder={inputPlaceholder}\r\n startContent={<SearchIcon className=\"!size-4 !text-fg-tertiary-hover\" />}\r\n wrapperClassName=\"w-full\"\r\n />\r\n }\r\n />\r\n <ComboboxChips\r\n className={cn(maxVisible !== undefined && \"flex-nowrap overflow-hidden\")}\r\n onMouseDown={(e) => e.preventBaseUIHandler()}\r\n >\r\n <ComboboxValue>\r\n {(value: Value[]) => {\r\n const visible = maxVisible !== undefined ? value.slice(0, maxVisible) : value\r\n const overflow = maxVisible !== undefined ? value.length - maxVisible : 0\r\n return (\r\n <>\r\n {visible?.map((item) => (\r\n <ComboboxChip\r\n key={item?.value || \"\"}\r\n className={cn(maxVisible !== undefined && \"min-w-0 shrink\")}\r\n >\r\n {maxVisible !== undefined\r\n ? <span className=\"truncate\">{item?.label || \"\"}</span>\r\n : (item?.label || \"\")\r\n }\r\n <ComboboxChipRemove />\r\n </ComboboxChip>\r\n ))}\r\n {overflow > 0 && (\r\n <ComboboxChip className=\"shrink-0\">\r\n +{overflow}\r\n </ComboboxChip>\r\n )}\r\n </>\r\n )\r\n }}\r\n </ComboboxValue>\r\n </ComboboxChips>\r\n </div>\r\n <ComboboxPopup container={container}>\r\n <ComboboxStatus\r\n status={\r\n isPending || items === undefined\r\n ? \"pending\"\r\n : items?.length === 0 && !isCreatingItem\r\n ? \"empty\"\r\n : null\r\n }\r\n />\r\n <ComboboxList>\r\n {items?.map((item) => (\r\n <ComboboxItem\r\n key={item.value}\r\n value={{ label: item.label, value: item.value }}\r\n >\r\n <ComboboxItemTitle>\r\n {item.label}\r\n </ComboboxItemTitle>\r\n </ComboboxItem>\r\n ))}\r\n {isCreatingItem && (\r\n <ComboboxItem\r\n value={{ label: trimmedInput, value: trimmedInput, tag: true }}\r\n >\r\n <div className=\"flex items-center gap-1.5 w-full min-w-0\">\r\n {!isInputSelected && (\r\n <span className=\"text-text-secondary\">Create:</span>\r\n )}\r\n <span className=\"font-medium text-text-primary truncate\">\r\n {trimmedInput}\r\n </span>\r\n </div>\r\n </ComboboxItem>\r\n )}\r\n <ComboboxInfiniteScroll {...infiniteScroll} />\r\n </ComboboxList>\r\n </ComboboxPopup>\r\n </Combobox>\r\n )\r\n}\r\n\r\nexport { ComboboxChipOutside }"]}
|
|
1
|
+
{"version":3,"sources":["../src/composites/combobox-chip-outside.tsx"],"names":["ComboboxChipOutside","multiple","inputPlaceholder","container","items","infiniteScroll","isPending","taggable","maxVisible","props","inputValue","setInputValue","useControlledState","value","setValue","createdItems","setCreatedItems","createdValuesRef","currentValues","v","prev","next","item","trimmedInput","isInputSelected","isCreatingItem","combinedItems","base","createItem","jsxs","Combobox","a","b","eventDetails","newTags","tag","jsx","ComboboxInput","Input","ComboboxTrigger","XIcon","event","SearchIcon","ComboboxChips","cn","ComboboxValue","visible","overflow","Fragment","ComboboxChip","ComboboxChipRemove","ComboboxPopup","ComboboxStatus","ComboboxList","ComboboxItem","ComboboxItemTitle","ComboboxInfiniteScroll"],"mappings":"qWA6CA,SAASA,EAAAA,CAAgF,CACvF,QAAA,CAAAC,EAAW,IAAA,CACX,gBAAA,CAAAC,GAAAA,CAAmB,WAAA,CACnB,UAAAC,CAAAA,CACA,KAAA,CAAAC,CAAAA,CACA,cAAA,CAAAC,GAAAA,CACA,SAAA,CAAAC,CAAAA,CACA,QAAA,CAAAC,IAAW,KAAA,CACX,UAAA,CAAAC,GAAAA,CACA,GAAGC,GACL,CAAA,CAAoC,CAClC,GAAM,CAACC,EAAYC,GAAa,CAAA,CAAIC,kBAAAA,CAAmB,CACrD,KAAA,CAAOH,GAAAA,EAAO,UAAA,EAAY,QAAA,GAC1B,YAAA,CAAcA,GAAAA,EAAO,iBAAA,EAAmB,QAAA,GACxC,QAAA,CAAUA,GAAAA,EAAO,kBACnB,C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,IAAAA,CAACwB,CAAAA,CAAA,CACE,QAAA,CAAA,CAAAjD,CAAAA,EAAO,IAAKkB,CAAAA,EACXc,GAAAA,CAACkB,CAAAA,CAAA,CAEC,MAAO,CAAE,KAAA,CAAOhC,CAAAA,CAAK,KAAA,CAAO,MAAOA,CAAAA,CAAK,KAAM,CAAA,CAE9C,QAAA,CAAAc,GAAAA,CAACmB,CAAAA,CAAA,CACE,QAAA,CAAAjC,EAAK,KAAA,CACR,CAAA,CAAA,CALKA,CAAAA,CAAK,KAMZ,CACD,CAAA,CACAG,CAAAA,EACCW,GAAAA,CAACkB,CAAAA,CAAA,CACC,KAAA,CAAO,CAAE,KAAA,CAAO/B,CAAAA,CAAc,KAAA,CAAOA,CAAAA,CAAc,GAAA,CAAK,IAAK,EAE7D,QAAA,CAAAM,IAAAA,CAAC,KAAA,CAAA,CAAI,SAAA,CAAU,2CACZ,QAAA,CAAA,CAAA,CAACL,CAAAA,EACAY,GAAAA,CAAC,MAAA,CAAA,CAAK,UAAU,qBAAA,CAAsB,QAAA,CAAA,SAAA,CAAO,CAAA,CAE/CA,GAAAA,CAAC,QAAK,SAAA,CAAU,wCAAA,CACb,QAAA,CAAAb,CAAAA,CACH,GACF,CAAA,CACF,CAAA,CAEFa,GAAAA,CAACoB,CAAAA,CAAA,CAAwB,GAAGnD,GAAAA,CAAgB,CAAA,CAAA,CAC9C,CAAA,CAAA,CACF,GACF,CAEJ","file":"chunk-C5HZCXIB.js","sourcesContent":["import * as React from \"react\"\r\n\r\nimport { cn } from \"@xploreu/lib/cn\"\r\nimport { ComboboxInput as ComboboxInputPrimitive } from \"../primitives/combobox\"\r\nimport { Input } from \"../ui\"\r\nimport {\r\n Combobox,\r\n ComboboxChip,\r\n ComboboxChipRemove,\r\n ComboboxChips,\r\n ComboboxInfiniteScroll,\r\n ComboboxItem,\r\n ComboboxList,\r\n ComboboxPortal,\r\n ComboboxPopup,\r\n ComboboxStatus,\r\n ComboboxTrigger,\r\n ComboboxValue,\r\n type ComboboxProps,\r\n ComboboxItemTitle\r\n} from \"../ui/combobox\"\r\nimport { SearchIcon, XIcon } from \"lucide-react\"\r\nimport { useControlledState } from \"@xploreu/hooks/use-controlled-state\"\r\n\r\ntype ComboboxChipOutsideProps<Value> = Omit<ComboboxProps<Value, true>, \"multiple\"> & {\r\n multiple?: boolean\r\n inputPlaceholder?: string\r\n container?: React.ComponentProps<typeof ComboboxPortal>[\"container\"]\r\n items: ({ label: string; value: string }[]) | undefined\r\n infiniteScroll?: React.ComponentProps<typeof ComboboxInfiniteScroll>\r\n isPending?: boolean\r\n /**\r\n * When true, enables creatable / taggable mode.\r\n * If the typed value has no exact match in the current item list,\r\n * a \"Create \\\"…\\\"\" option is shown at the top of the dropdown.\r\n * Created items are appended to the value with `{ label, value, tag: true }`.\r\n */\r\n taggable?: boolean\r\n /**\r\n * Maximum number of chips to show before collapsing the rest into a \"+N\" chip.\r\n * When undefined, all chips are shown.\r\n */\r\n maxVisible?: number\r\n}\r\n\r\nfunction ComboboxChipOutside<Value extends { label: string; value: string; tag?: true }>({\r\n multiple = true,\r\n inputPlaceholder = \"Search...\",\r\n container,\r\n items,\r\n infiniteScroll,\r\n isPending,\r\n taggable = false,\r\n maxVisible,\r\n ...props\r\n}: ComboboxChipOutsideProps<Value>) {\r\n const [inputValue, setInputValue] = useControlledState({\r\n value: props?.inputValue?.toString(),\r\n defaultValue: props?.defaultInputValue?.toString(),\r\n onChange: props?.onInputValueChange,\r\n })\r\n\r\n const [value, setValue] = useControlledState({\r\n value: props?.value ?? [],\r\n defaultValue: props?.defaultValue ?? [],\r\n onChange: props?.onValueChange,\r\n })\r\n\r\n // Track items created via taggable mode\r\n // Sync with value to avoid stale tags when controlled value is reset from outside\r\n const [createdItems, setCreatedItems] = React.useState<Value[]>([])\r\n const createdValuesRef = React.useRef<Set<string>>(new Set())\r\n\r\n React.useEffect(() => {\r\n const currentValues = new Set(value.map((v) => v.value))\r\n setCreatedItems((prev) => {\r\n const next = prev.filter((item) => currentValues.has(item.value))\r\n if (next.length === prev.length) return prev\r\n createdValuesRef.current = new Set(next.map((v) => v.value))\r\n return next\r\n })\r\n }, [value])\r\n\r\n // Determine if the current input has no exact match in existing items\r\n const trimmedInput = inputValue?.toString().trim() ?? \"\"\r\n const isInputSelected = React.useMemo(() => {\r\n if (!trimmedInput) return false\r\n return value.some(\r\n (item) => item.value.toLowerCase() === trimmedInput.toLowerCase()\r\n )\r\n }, [trimmedInput, value])\r\n // true = show the taggable item in dropdown (either as \"Create:\" or as checked item)\r\n const isCreatingItem = React.useMemo(() => {\r\n if (!taggable || !trimmedInput) return false\r\n return !items?.some(\r\n (item) => item.label.toLowerCase() === trimmedInput.toLowerCase()\r\n )\r\n }, [taggable, trimmedInput, items])\r\n\r\n // Merge server items with locally created tags + the \"Create\" placeholder\r\n const combinedItems = React.useMemo(() => {\r\n const base: Value[] = [\r\n ...items ?? [],\r\n ...createdItems,\r\n ]\r\n\r\n if (isCreatingItem) {\r\n const createItem = {\r\n label: trimmedInput,\r\n value: trimmedInput,\r\n tag: true,\r\n }\r\n return [...base, createItem]\r\n }\r\n\r\n return base\r\n }, [items, createdItems, isCreatingItem, trimmedInput])\r\n\r\n const handleValueChange: ComboboxProps<Value, true>[\"onValueChange\"] = (value, eventDetails) => {\r\n // Capture newly created taggable items internally\r\n if (taggable) {\r\n const newTags = value.filter(\r\n (v) => v?.tag === true\r\n && !createdValuesRef.current.has(v.value)\r\n )\r\n if (newTags.length > 0) {\r\n for (const tag of newTags) {\r\n createdValuesRef.current.add(tag.value)\r\n }\r\n setCreatedItems((prev) => [...prev, ...newTags])\r\n }\r\n }\r\n\r\n // if multiple is false, we need to replace the value with the new value instead of adding to it\r\n if (!multiple) {\r\n setValue([value[value.length - 1]], eventDetails)\r\n } else {\r\n setValue(value, eventDetails)\r\n }\r\n }\r\n\r\n return (\r\n <Combobox\r\n {...props}\r\n behavior=\"chip-outside\"\r\n multiple\r\n items={taggable ? combinedItems : items}\r\n isItemEqualToValue={(a, b) => a.value === b.value}\r\n onValueChange={handleValueChange}\r\n onInputValueChange={setInputValue}\r\n >\r\n <div className=\"flex flex-col gap-2\">\r\n <ComboboxInputPrimitive\r\n render={\r\n <Input\r\n className=\"h-9 text-body-regular-3 pl-9 pr-7\"\r\n endContent={\r\n <ComboboxTrigger\r\n nativeButton={false}\r\n render={(\r\n <XIcon\r\n className=\"!size-5 !right-1.5 data-[hidden=true]:opacity-0 opacity-100 transition-opacity duration-300 cursor-pointer\"\r\n data-hidden={!inputValue}\r\n data-slot=\"combobox-clear-input\"\r\n onClick={(event) => {\r\n setInputValue(\"\", {\r\n reason: \"none\",\r\n event: event.nativeEvent,\r\n cancel: () => { },\r\n allowPropagation: () => { },\r\n isCanceled: false,\r\n isPropagationAllowed: true,\r\n trigger: undefined,\r\n })\r\n }}\r\n />\r\n )}\r\n />\r\n }\r\n placeholder={inputPlaceholder}\r\n startContent={<SearchIcon className=\"!size-4 !text-fg-tertiary-hover\" />}\r\n wrapperClassName=\"w-full\"\r\n />\r\n }\r\n />\r\n <ComboboxChips\r\n className={cn(maxVisible !== undefined && \"flex-nowrap overflow-hidden\")}\r\n onMouseDown={(e) => e.preventBaseUIHandler()}\r\n >\r\n <ComboboxValue>\r\n {(value: Value[]) => {\r\n const visible = maxVisible !== undefined ? value.slice(0, maxVisible) : value\r\n const overflow = maxVisible !== undefined ? value.length - maxVisible : 0\r\n return (\r\n <>\r\n {visible?.map((item) => (\r\n <ComboboxChip\r\n key={item?.value || \"\"}\r\n className={cn(maxVisible !== undefined && \"min-w-0 shrink\")}\r\n >\r\n {maxVisible !== undefined\r\n ? <span className=\"truncate\">{item?.label || \"\"}</span>\r\n : (item?.label || \"\")\r\n }\r\n <ComboboxChipRemove />\r\n </ComboboxChip>\r\n ))}\r\n {overflow > 0 && (\r\n <ComboboxChip className=\"shrink-0\">\r\n +{overflow}\r\n </ComboboxChip>\r\n )}\r\n </>\r\n )\r\n }}\r\n </ComboboxValue>\r\n </ComboboxChips>\r\n </div>\r\n <ComboboxPopup container={container}>\r\n <ComboboxStatus\r\n status={\r\n isPending || items === undefined\r\n ? \"pending\"\r\n : items?.length === 0 && !isCreatingItem\r\n ? \"empty\"\r\n : null\r\n }\r\n />\r\n <ComboboxList>\r\n {items?.map((item) => (\r\n <ComboboxItem\r\n key={item.value}\r\n value={{ label: item.label, value: item.value }}\r\n >\r\n <ComboboxItemTitle>\r\n {item.label}\r\n </ComboboxItemTitle>\r\n </ComboboxItem>\r\n ))}\r\n {isCreatingItem && (\r\n <ComboboxItem\r\n value={{ label: trimmedInput, value: trimmedInput, tag: true }}\r\n >\r\n <div className=\"flex items-center gap-1.5 w-full min-w-0\">\r\n {!isInputSelected && (\r\n <span className=\"text-text-secondary\">Create:</span>\r\n )}\r\n <span className=\"font-medium text-text-primary truncate\">\r\n {trimmedInput}\r\n </span>\r\n </div>\r\n </ComboboxItem>\r\n )}\r\n <ComboboxInfiniteScroll {...infiniteScroll} />\r\n </ComboboxList>\r\n </ComboboxPopup>\r\n </Combobox>\r\n )\r\n}\r\n\r\nexport { ComboboxChipOutside }"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {a,b,i,m,s,w}from'./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import {a,b,i,m,s,w}from'./chunk-SVNG3RLD.js';import*as l from'react';import {ChevronDownIcon,ChevronLeftIcon,ChevronRightIcon}from'lucide-react';import {cn}from'@xploreu/lib/cn';import {jsxs,Fragment,jsx}from'react/jsx-runtime';function j({page:r,pageSize:a$1,total:i$1,onPageChange:b$1,onPageSizeChange:n,pageSizeOptions:m$1=[10,20,50,100],showPageSize:c=true,showRange:d=true,className:C,...N}){let u=Math.max(1,Math.ceil(i$1/a$1)),h=i$1===0?0:(r-1)*a$1+1,P=Math.min(r*a$1,i$1),s$1=l.useMemo(()=>m$1.map(e=>({label:String(e),value:e})),[m$1]),I=l.useMemo(()=>s$1.find(e=>e.value===a$1)??s$1[0],[s$1,a$1]);return jsxs("div",{className:cn("flex w-full flex-col-reverse gap-3 mt-4 sm:flex-row sm:items-center sm:justify-between border-t border-border-primary pt-3 text-body-regular-2 text-text-secondary",C),"data-slot":"pagination",...N,children:[jsxs("div",{className:"flex items-center gap-2",children:[c&&n&&jsxs(Fragment,{children:[jsx("span",{className:"text-label-regular-3 text-text-tertiary",children:"Rows per page"}),jsxs(a,{items:s$1,value:I,onValueChange:e=>{e&&n&&n(e.value);},isItemEqualToValue:(e,w)=>e.value===w.value,children:[jsxs(b,{className:"h-8 gap-2 rounded-lg border border-border-primary bg-bg-primary px-3 text-label-semibold-3 text-text-primary hover:bg-bg-secondary focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border-brand-primary","aria-label":"Rows per page",children:[jsx(i,{children:e=>e?e.label:String(a$1)}),jsx(ChevronDownIcon,{className:"size-3.5 text-text-tertiary"})]}),jsx(m,{className:"w-24",children:jsx(s,{children:s$1.map(e=>jsx(w,{value:e,children:e.label},e.value))})})]})]}),c&&d&&jsx("span",{className:"text-text-tertiary",children:"\xB7"}),d&&jsxs("span",{className:"text-label-regular-3 text-text-tertiary",children:[h,"\u2013",P," of ",i$1]})]}),jsxs("div",{className:"flex items-center gap-1",children:[jsx("button",{type:"button",disabled:r<=1,onClick:()=>b$1(r-1),className:"inline-flex size-8 cursor-pointer items-center justify-center rounded-lg border border-border-primary bg-bg-primary text-text-secondary transition-colors hover:bg-bg-secondary hover:text-text-primary disabled:cursor-not-allowed disabled:opacity-40","aria-label":"Previous page",children:jsx(ChevronLeftIcon,{className:"size-4"})}),jsxs("span",{className:"px-2 text-label-semibold-3 text-text-primary",children:["Page ",r," / ",u]}),jsx("button",{type:"button",disabled:r>=u,onClick:()=>b$1(r+1),className:"inline-flex size-8 cursor-pointer items-center justify-center rounded-lg border border-border-primary bg-bg-primary text-text-secondary transition-colors hover:bg-bg-secondary hover:text-text-primary disabled:cursor-not-allowed disabled:opacity-40","aria-label":"Next page",children:jsx(ChevronRightIcon,{className:"size-4"})})]})]})}export{j as a};//# sourceMappingURL=chunk-G2GFDTP5.js.map
|
|
2
|
+
//# sourceMappingURL=chunk-G2GFDTP5.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/ui/pagination.tsx"],"names":["Pagination","page","pageSize","total","onPageChange","onPageSizeChange","pageSizeOptions","showPageSize","showRange","className","props","totalPages","startItem","endItem","items","opt","selectedItem","item","jsxs","cn","Fragment","jsx","Combobox","a","b","ComboboxTrigger","ComboboxValue","val","ChevronDownIcon","ComboboxPopup","ComboboxList","ComboboxItem","ChevronLeftIcon","ChevronRightIcon"],"mappings":"qOA6BO,SAASA,CAAAA,CAAW,CACzB,KAAAC,CAAAA,CACA,QAAA,CAAAC,GAAAA,CACA,KAAA,CAAAC,IACA,YAAA,CAAAC,GAAAA,CACA,gBAAA,CAAAC,CAAAA,CACA,gBAAAC,GAAAA,CAAkB,CAAC,EAAA,CAAI,EAAA,CAAI,GAAI,GAAG,CAAA,CAClC,YAAA,CAAAC,CAAAA,CAAe,KACf,SAAA,CAAAC,CAAAA,CAAY,IAAA,CACZ,SAAA,CAAAC,EACA,GAAGC,CACL,CAAA,CAAoB,CAClB,IAAMC,CAAAA,CAAa,IAAA,CAAK,GAAA,CAAI,CAAA,CAAG,KAAK,IAAA,CAAKR,GAAAA,CAAQD,GAAQ,CAAC,EACpDU,CAAAA,CAAYT,GAAAA,GAAU,CAAA,CAAI,CAAA,CAAA,CAAKF,EAAO,CAAA,EAAKC,GAAAA,CAAW,CAAA,CACtDW,CAAAA,CAAU,KAAK,GAAA,CAAIZ,CAAAA,CAAOC,GAAAA,CAAUC,GAAK,EAEzCW,GAAAA,CAAoC,CAAA,CAAA,OAAA,CACxC,IAAMR,GAAAA,CAAgB,IAAKS,CAAAA,GAAS,CAAE,KAAA,CAAO,MAAA,CAAOA,CAAG,CAAA,CAAG,KAAA,CAAOA,CAAI,CAAA,CAAE,EACvE,CAACT,GAAe,CAClB,CAAA,CAEMU,EAAqB,CAAA,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ACvC,CAAA,CAAA,CACF,GACF,CAEJ","file":"chunk-
|
|
1
|
+
{"version":3,"sources":["../src/ui/pagination.tsx"],"names":["Pagination","page","pageSize","total","onPageChange","onPageSizeChange","pageSizeOptions","showPageSize","showRange","className","props","totalPages","startItem","endItem","items","opt","selectedItem","item","jsxs","cn","Fragment","jsx","Combobox","a","b","ComboboxTrigger","ComboboxValue","val","ChevronDownIcon","ComboboxPopup","ComboboxList","ComboboxItem","ChevronLeftIcon","ChevronRightIcon"],"mappings":"qOA6BO,SAASA,CAAAA,CAAW,CACzB,KAAAC,CAAAA,CACA,QAAA,CAAAC,GAAAA,CACA,KAAA,CAAAC,IACA,YAAA,CAAAC,GAAAA,CACA,gBAAA,CAAAC,CAAAA,CACA,gBAAAC,GAAAA,CAAkB,CAAC,EAAA,CAAI,EAAA,CAAI,GAAI,GAAG,CAAA,CAClC,YAAA,CAAAC,CAAAA,CAAe,KACf,SAAA,CAAAC,CAAAA,CAAY,IAAA,CACZ,SAAA,CAAAC,EACA,GAAGC,CACL,CAAA,CAAoB,CAClB,IAAMC,CAAAA,CAAa,IAAA,CAAK,GAAA,CAAI,CAAA,CAAG,KAAK,IAAA,CAAKR,GAAAA,CAAQD,GAAQ,CAAC,EACpDU,CAAAA,CAAYT,GAAAA,GAAU,CAAA,CAAI,CAAA,CAAA,CAAKF,EAAO,CAAA,EAAKC,GAAAA,CAAW,CAAA,CACtDW,CAAAA,CAAU,KAAK,GAAA,CAAIZ,CAAAA,CAAOC,GAAAA,CAAUC,GAAK,EAEzCW,GAAAA,CAAoC,CAAA,CAAA,OAAA,CACxC,IAAMR,GAAAA,CAAgB,IAAKS,CAAAA,GAAS,CAAE,KAAA,CAAO,MAAA,CAAOA,CAAG,CAAA,CAAG,KAAA,CAAOA,CAAI,CAAA,CAAE,EACvE,CAACT,GAAe,CAClB,CAAA,CAEMU,EAAqB,CAAA,CAAA,OAAA,CACzB,IAAMF,GAAAA,CAAM,IAAA,CAAMG,GAASA,CAAAA,CAA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React from \"react\"\r\nimport { ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon } from \"lucide-react\"\r\n\r\nimport { cn } from \"@xploreu/lib/cn\"\r\nimport {\r\n Combobox,\r\n ComboboxItem,\r\n ComboboxList,\r\n ComboboxPopup,\r\n ComboboxTrigger,\r\n ComboboxValue,\r\n} from \"./combobox\"\r\n\r\nexport interface PaginationProps extends React.ComponentProps<\"div\"> {\r\n page: number\r\n pageSize: number\r\n total: number\r\n onPageChange: (page: number) => void\r\n onPageSizeChange?: (pageSize: number) => void\r\n pageSizeOptions?: number[]\r\n showPageSize?: boolean\r\n showRange?: boolean\r\n}\r\n\r\ntype PageSizeOptionItem = {\r\n label: string\r\n value: number\r\n}\r\n\r\nexport function Pagination({\r\n page,\r\n pageSize,\r\n total,\r\n onPageChange,\r\n onPageSizeChange,\r\n pageSizeOptions = [10, 20, 50, 100],\r\n showPageSize = true,\r\n showRange = true,\r\n className,\r\n ...props\r\n}: PaginationProps) {\r\n const totalPages = Math.max(1, Math.ceil(total / pageSize))\r\n const startItem = total === 0 ? 0 : (page - 1) * pageSize + 1\r\n const endItem = Math.min(page * pageSize, total)\r\n\r\n const items: PageSizeOptionItem[] = React.useMemo(\r\n () => pageSizeOptions.map((opt) => ({ label: String(opt), value: opt })),\r\n [pageSizeOptions]\r\n )\r\n\r\n const selectedItem = React.useMemo(\r\n () => items.find((item) => item.value === pageSize) ?? items[0],\r\n [items, pageSize]\r\n )\r\n\r\n return (\r\n <div\r\n className={cn(\r\n \"flex w-full flex-col-reverse gap-3 mt-4 sm:flex-row sm:items-center sm:justify-between border-t border-border-primary pt-3 text-body-regular-2 text-text-secondary\",\r\n className\r\n )}\r\n data-slot=\"pagination\"\r\n {...props}\r\n >\r\n {/* Left: Rows per page & range */}\r\n <div className=\"flex items-center gap-2\">\r\n {showPageSize && onPageSizeChange && (\r\n <>\r\n <span className=\"text-label-regular-3 text-text-tertiary\">\r\n Rows per page\r\n </span>\r\n <Combobox<PageSizeOptionItem>\r\n items={items}\r\n value={selectedItem}\r\n onValueChange={(item) => {\r\n if (item && onPageSizeChange) {\r\n onPageSizeChange(item.value)\r\n }\r\n }}\r\n isItemEqualToValue={(a, b) => a.value === b.value}\r\n >\r\n <ComboboxTrigger\r\n className=\"h-8 gap-2 rounded-lg border border-border-primary bg-bg-primary px-3 text-label-semibold-3 text-text-primary hover:bg-bg-secondary focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border-brand-primary\"\r\n aria-label=\"Rows per page\"\r\n >\r\n <ComboboxValue>\r\n {(val) => (val ? val.label : String(pageSize))}\r\n </ComboboxValue>\r\n <ChevronDownIcon className=\"size-3.5 text-text-tertiary\" />\r\n </ComboboxTrigger>\r\n\r\n <ComboboxPopup className=\"w-24\">\r\n <ComboboxList>\r\n {items.map((item) => (\r\n <ComboboxItem\r\n key={item.value}\r\n value={item}\r\n >\r\n {item.label}\r\n </ComboboxItem>\r\n ))}\r\n </ComboboxList>\r\n </ComboboxPopup>\r\n </Combobox>\r\n </>\r\n )}\r\n\r\n {showPageSize && showRange && (\r\n <span className=\"text-text-tertiary\">·</span>\r\n )}\r\n\r\n {showRange && (\r\n <span className=\"text-label-regular-3 text-text-tertiary\">\r\n {startItem}–{endItem} of {total}\r\n </span>\r\n )}\r\n </div>\r\n\r\n {/* Right: Page controls */}\r\n <div className=\"flex items-center gap-1\">\r\n <button\r\n type=\"button\"\r\n disabled={page <= 1}\r\n onClick={() => onPageChange(page - 1)}\r\n className=\"inline-flex size-8 cursor-pointer items-center justify-center rounded-lg border border-border-primary bg-bg-primary text-text-secondary transition-colors hover:bg-bg-secondary hover:text-text-primary disabled:cursor-not-allowed disabled:opacity-40\"\r\n aria-label=\"Previous page\"\r\n >\r\n <ChevronLeftIcon className=\"size-4\" />\r\n </button>\r\n\r\n <span className=\"px-2 text-label-semibold-3 text-text-primary\">\r\n Page {page} / {totalPages}\r\n </span>\r\n\r\n <button\r\n type=\"button\"\r\n disabled={page >= totalPages}\r\n onClick={() => onPageChange(page + 1)}\r\n className=\"inline-flex size-8 cursor-pointer items-center justify-center rounded-lg border border-border-primary bg-bg-primary text-text-secondary transition-colors hover:bg-bg-secondary hover:text-text-primary disabled:cursor-not-allowed disabled:opacity-40\"\r\n aria-label=\"Next page\"\r\n >\r\n <ChevronRightIcon className=\"size-4\" />\r\n </button>\r\n </div>\r\n </div>\r\n )\r\n}\r\n"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {a as a$1,b,m,e,q,s,w}from'./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import {a as a$1,b,m,e,q,s,w}from'./chunk-SVNG3RLD.js';import {a}from'./chunk-Y6TKCAAJ.js';import*as t from'react';import*as C from'react-phone-number-input';import Y from'react-phone-number-input/flags';import {cn}from'@xploreu/lib/cn';import'@base-ui/react/combobox';import {ChevronsUpDownIcon}from'lucide-react';import {jsx,jsxs}from'react/jsx-runtime';var R=({country:l,countryName:o})=>{let s=l?Y[l]:void 0;return jsx("span",{className:"flex h-4 w-6 shrink-0 overflow-hidden rounded-sm bg-fg-quaternary/20 [&_svg:not([class*='size-'])]:size-full",children:s&&jsx(s,{title:o})})},d=44,k=288,H=6;function D({disabled:l,value:o,options:s$1,onChange:i}){let[c,r]=t.useState(false),[b$1,g]=t.useState(""),[y,N]=t.useState(0),v=t.useRef(null),m$1=t.useMemo(()=>s$1.filter(e=>!!e.value),[s$1]),u=t.useMemo(()=>{let e=b$1.trim().toLowerCase();return e?m$1.filter(a=>{let f=C.getCountryCallingCode(a.value);return a.label.toLowerCase().includes(e)||a.value.toLowerCase().includes(e)||f.includes(e.replace(/^\+/,""))}):m$1},[b$1,m$1]),_=t.useMemo(()=>m$1.find(e=>e.value===o)??null,[m$1,o]);t.useEffect(()=>{N(0),v.current&&(v.current.scrollTop=0);},[b$1]);let z=Math.min(u.length*d,k),h=t.useMemo(()=>{let e=Math.floor(y/d),a=Math.max(0,e-H),f=Math.ceil(k/d),P=Math.min(u.length,e+f+H);return {startIndex:a,endIndex:P,items:u.slice(a,P)}},[u,y]),F=h.startIndex*d,U=Math.max(0,(u.length-h.endIndex)*d),q$1=t.useCallback(e=>{e?.value&&(i(e.value),g(""),r(false));},[i]);return jsxs(a$1,{behavior:"default",disabled:l,inputValue:b$1,items:u,open:c,value:_,virtualized:true,filter:null,isItemEqualToValue:(e,a)=>e.value===a.value,openOnInputClick:false,onValueChange:q$1,onInputValueChange:g,onOpenChange:e=>{r(e),e||g("");},children:[jsx(b,{render:jsxs("button",{type:"button",className:cn(a(),"h-11 w-18 shrink-0 justify-between gap-1 rounded-r-none border-r-0 px-3","hover:bg-bg-primary-hover focus-visible:z-10 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-brand","disabled:pointer-events-none disabled:opacity-50"),disabled:l,children:[jsxs("span",{className:"flex items-center gap-1.5 overflow-hidden",children:[jsx(R,{country:o,countryName:o}),o&&jsx("span",{className:"text-body-medium-3 text-text-primary",children:o})]}),jsx(ChevronsUpDownIcon,{className:"size-3.5 shrink-0 text-fg-quaternary"})]})}),jsxs(m,{className:"w-72",children:[jsx(e,{placeholder:"Search country...","aria-label":"Search country"}),jsx(q,{status:u.length===0?"empty":null}),jsx(s,{ref:v,className:"relative gap-0",style:{height:z},onScroll:e=>N(e.currentTarget.scrollTop),children:jsx("div",{className:"flex w-full shrink-0 flex-col",style:{paddingTop:F,paddingBottom:U},children:h.items.map((e,a)=>{let f=h.startIndex+a;return jsx(w,{index:f,value:e,children:jsxs("div",{className:"flex items-center gap-2 w-full min-w-0",children:[jsx(R,{country:e.value,countryName:e.label}),jsx("span",{className:"flex-1 text-sm truncate",children:e.label}),jsxs("span",{className:"text-sm text-text-tertiary shrink-0",children:["+",C.getCountryCallingCode(e.value)]})]})},e.value)})})})]})]})}var L=t.forwardRef(({className:l,onChange:o,...s},i)=>{let c=t.useCallback(r=>{r.currentTarget.value==="+"&&(r.currentTarget.value=""),o?.(r);},[o]);return jsx("input",{className:cn(a(),"h-11 flex-1 rounded-l-none text-body-regular-2",l),ref:i,type:"tel",onChange:c,...s})});L.displayName="InputComponent";var G=t.forwardRef(({className:l,onChange:o,value:s,...i},c)=>jsx(C.default,{ref:c,className:cn("flex w-full min-w-0 items-center",l),flagComponent:R,countrySelectComponent:D,inputComponent:L,smartCaret:false,value:s||void 0,onChange:r=>o?.(r||""),...i}));G.displayName="PhoneInput";export{G as a};//# sourceMappingURL=chunk-G4DP36RY.js.map
|
|
2
|
+
//# sourceMappingURL=chunk-G4DP36RY.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/composites/phone-input.tsx"],"names":["FlagComponent","country","countryName","Flag","flags","jsx","COUNTRY_ROW_HEIGHT","COUNTRY_LIST_HEIGHT","COUNTRY_OVERSCAN","CountrySelect","disabled","selectedCountry","countryList","onChange","open","setOpen","inputValue","setInputValue","scrollTop","setScrollTop","listRef","items","item","filteredItems","search","callingCode","value","listHeight","virtualRange","visibleStartIndex","startIndex","visibleCount","endIndex","paddingTop","paddingBottom","handleValueChange","jsxs","Combobox","a","b","ComboboxTrigger","cn","inputVariants","ChevronsUpDownIcon","ComboboxPopup","ComboboxInput","ComboboxStatus","ComboboxList","event","virtualIndex","index","ComboboxItem","InputComponent","className","props","ref","handleChange","PhoneInput"],"mappings":"oWAoCA,IAAMA,EAAgB,CAAC,CAAE,OAAA,CAAAC,CAAAA,CAAS,YAAAC,CAAY,CAAA,GAA0B,CACtE,IAAMC,EAAOF,CAAAA,CAAUG,CAAAA,CAAMH,CAAO,CAAA,CAAI,MAAA,CAExC,OACEI,GAAAA,CAAC,MAAA,CAAA,CAAK,UAAU,8GAAA,CACb,QAAA,CAAAF,CAAAA,EAAQE,GAAAA,CAACF,EAAA,CAAK,KAAA,CAAOD,CAAAA,CAAa,CAAA,CACrC,CAEJ,CAAA,CASMI,CAAAA,CAAqB,EAAA,CACrBC,CAAAA,CAAsB,IACtBC,CAAAA,CAAmB,CAAA,CASzB,SAASC,CAAAA,CAAc,CACrB,QA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CAAA,CAAA,CACF,GACF,CAEJ,CAMA,IAAM8B,CAAAA,CAAuB,aAG3B,CAAC,CAAE,SAAA,CAAAC,CAAAA,CAAW,SAAAxC,CAAAA,CAAU,GAAGyC,CAAM,CAAA,CAAGC,IAAQ,CAC5C,IAAMC,CAAAA,CAAqB,CAAA,CAAA,WAAA,CACxBR,GAA+C,CAC1CA,CAAAA,CAAM,aAAA,CAAc,KAAA,GAAU,MAChCA,CAAAA,CAAM,aAAA,CAAc,KAAA,CAAQ,EAAA,CAAA,CAG9BnC,IAAWmC,CAAK,EAClB,CAAA,CACA,CAACnC,CAAQ,CACX,CAAA,CAEA,OACER,IAAC,OAAA,CAAA,CACC,SAAA,CAAWoC,EAAAA,CACTC,CAAAA,GACA,gDAAA,CACAW,CACF,CAAA,CACA,GAAA,CAAKE,EACL,IAAA,CAAK,KAAA,CACL,QAAA,CAAUC,CAAAA,CACT,GAAGF,CAAAA,CACN,CAEJ,CAAC,CAAA,CACDF,EAAe,WAAA,CAAc,gBAAA,CAM7B,IAAMK,CAAAA,CACE,aAGJ,CAAC,CACD,SAAA,CAAAJ,CAAAA,CACA,SAAAxC,CAAAA,CACA,KAAA,CAAAa,CAAAA,CACA,GAAG4B,CACL,CAAA,CAAGC,CAAAA,GAEClD,GAAAA,CAAU,UAAT,CACC,GAAA,CAAKkD,CAAAA,CACL,SAAA,CAAWd,GACT,kCAAA,CACAY,CACF,CAAA,CACA,aAAA,CAAerD,EACf,sBAAA,CAAwBS,CAAAA,CACxB,cAAA,CAAgB2C,CAAAA,CAChB,WAAY,KAAA,CACZ,KAAA,CAAO1B,CAAAA,EAAS,MAAA,CAChB,SAAWA,CAAAA,EAAUb,CAAAA,GAAWa,CAAAA,EAAU,EAAqB,EAC9D,GAAG4B,CAAAA,CACN,CAEH,EACHG,EAAW,WAAA,CAAc,YAAA","file":"chunk-H6ETV455.js","sourcesContent":["\"use client\"\r\n\r\nimport * as React from \"react\"\r\nimport * as RPNInput from \"react-phone-number-input\"\r\nimport flags from \"react-phone-number-input/flags\"\r\n\r\nimport { cn } from \"@xploreu/lib/cn\"\r\nimport { Combobox as ComboboxPrimitive } from \"@base-ui/react/combobox\"\r\nimport {\r\n Combobox,\r\n ComboboxInput,\r\n ComboboxItem,\r\n ComboboxList,\r\n ComboboxPopup,\r\n ComboboxStatus,\r\n ComboboxTrigger,\r\n} from \"../ui/combobox\"\r\nimport { inputVariants } from \"../ui/input\"\r\nimport { ChevronsUpDownIcon } from \"lucide-react\"\r\n\r\n// ---------------------------------------------------------------------------\r\n// Types\r\n// ---------------------------------------------------------------------------\r\n\r\ntype PhoneInputProps = Omit<\r\n React.ComponentProps<\"input\">,\r\n \"onChange\" | \"value\" | \"ref\"\r\n> &\r\n Omit<RPNInput.Props<typeof RPNInput.default>, \"onChange\"> & {\r\n onChange?: (value: RPNInput.Value) => void\r\n }\r\n\r\n// ---------------------------------------------------------------------------\r\n// Flag\r\n// ---------------------------------------------------------------------------\r\n\r\nconst FlagComponent = ({ country, countryName }: RPNInput.FlagProps) => {\r\n const Flag = country ? flags[country] : undefined\r\n\r\n return (\r\n <span className=\"flex h-4 w-6 shrink-0 overflow-hidden rounded-sm bg-fg-quaternary/20 [&_svg:not([class*='size-'])]:size-full\">\r\n {Flag && <Flag title={countryName} />}\r\n </span>\r\n )\r\n}\r\n\r\n// ---------------------------------------------------------------------------\r\n// Country Select — uses base-ui Combobox\r\n// ---------------------------------------------------------------------------\r\n\r\ntype CountryEntry = { label: string; value: RPNInput.Country | undefined }\r\ntype CountryItem = { label: string; value: RPNInput.Country }\r\n\r\nconst COUNTRY_ROW_HEIGHT = 44\r\nconst COUNTRY_LIST_HEIGHT = 288\r\nconst COUNTRY_OVERSCAN = 6\r\n\r\ntype CountrySelectProps = {\r\n disabled?: boolean\r\n value: RPNInput.Country\r\n options: CountryEntry[]\r\n onChange: (country: RPNInput.Country) => void\r\n}\r\n\r\nfunction CountrySelect({\r\n disabled,\r\n value: selectedCountry,\r\n options: countryList,\r\n onChange,\r\n}: CountrySelectProps) {\r\n const [open, setOpen] = React.useState(false)\r\n const [inputValue, setInputValue] = React.useState(\"\")\r\n const [scrollTop, setScrollTop] = React.useState(0)\r\n const listRef = React.useRef<HTMLDivElement>(null)\r\n\r\n const items = React.useMemo(\r\n () => countryList.filter((item): item is CountryItem => Boolean(item.value)),\r\n [countryList]\r\n )\r\n\r\n const filteredItems = React.useMemo(() => {\r\n const search = inputValue.trim().toLowerCase()\r\n\r\n if (!search) return items\r\n\r\n return items.filter((item) => {\r\n const callingCode = RPNInput.getCountryCallingCode(item.value)\r\n\r\n return item.label.toLowerCase().includes(search)\r\n || item.value.toLowerCase().includes(search)\r\n || callingCode.includes(search.replace(/^\\+/, \"\"))\r\n })\r\n }, [inputValue, items])\r\n\r\n const value = React.useMemo(\r\n () => items.find((item) => item.value === selectedCountry) ?? null,\r\n [items, selectedCountry]\r\n )\r\n\r\n React.useEffect(() => {\r\n setScrollTop(0)\r\n if (listRef.current) listRef.current.scrollTop = 0\r\n }, [inputValue])\r\n\r\n const listHeight = Math.min(\r\n filteredItems.length * COUNTRY_ROW_HEIGHT,\r\n COUNTRY_LIST_HEIGHT\r\n )\r\n\r\n const virtualRange = React.useMemo(() => {\r\n const visibleStartIndex = Math.floor(scrollTop / COUNTRY_ROW_HEIGHT)\r\n const startIndex = Math.max(\r\n 0,\r\n visibleStartIndex - COUNTRY_OVERSCAN\r\n )\r\n const visibleCount = Math.ceil(COUNTRY_LIST_HEIGHT / COUNTRY_ROW_HEIGHT)\r\n const endIndex = Math.min(\r\n filteredItems.length,\r\n visibleStartIndex + visibleCount + COUNTRY_OVERSCAN\r\n )\r\n\r\n return {\r\n startIndex,\r\n endIndex,\r\n items: filteredItems.slice(startIndex, endIndex),\r\n }\r\n }, [filteredItems, scrollTop])\r\n\r\n const paddingTop = virtualRange.startIndex * COUNTRY_ROW_HEIGHT\r\n const paddingBottom = Math.max(\r\n 0,\r\n (filteredItems.length - virtualRange.endIndex) * COUNTRY_ROW_HEIGHT\r\n )\r\n\r\n const handleValueChange = React.useCallback(\r\n (item: CountryItem | null) => {\r\n if (!item?.value) return\r\n\r\n onChange(item.value)\r\n setInputValue(\"\")\r\n setOpen(false)\r\n },\r\n [onChange]\r\n )\r\n\r\n return (\r\n <Combobox\r\n behavior=\"default\"\r\n disabled={disabled}\r\n inputValue={inputValue}\r\n items={filteredItems}\r\n open={open}\r\n value={value}\r\n virtualized\r\n filter={null}\r\n isItemEqualToValue={(a, b) => a.value === b.value}\r\n openOnInputClick={false}\r\n onValueChange={handleValueChange}\r\n onInputValueChange={setInputValue}\r\n onOpenChange={(open) => {\r\n setOpen(open)\r\n if (!open) setInputValue(\"\")\r\n }}\r\n >\r\n {/* Visible trigger button styled as part of the input */}\r\n <ComboboxTrigger\r\n render={\r\n <button\r\n type=\"button\"\r\n className={cn(\r\n inputVariants(),\r\n \"h-11 w-18 shrink-0 justify-between gap-1 rounded-r-none border-r-0 px-3\",\r\n \"hover:bg-bg-primary-hover focus-visible:z-10 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-brand\",\r\n \"disabled:pointer-events-none disabled:opacity-50\"\r\n )}\r\n disabled={disabled}\r\n >\r\n <span className=\"flex items-center gap-1.5 overflow-hidden\">\r\n <FlagComponent\r\n country={selectedCountry}\r\n countryName={selectedCountry}\r\n />\r\n {selectedCountry && (\r\n <span className=\"text-body-medium-3 text-text-primary\">\r\n {selectedCountry}\r\n </span>\r\n )}\r\n </span>\r\n <ChevronsUpDownIcon className=\"size-3.5 shrink-0 text-fg-quaternary\" />\r\n </button>\r\n }\r\n />\r\n\r\n {/* Dropdown content */}\r\n <ComboboxPopup className=\"w-72\">\r\n <ComboboxInput\r\n placeholder=\"Search country...\"\r\n aria-label=\"Search country\"\r\n />\r\n <ComboboxStatus status={filteredItems.length === 0 ? \"empty\" : null} />\r\n <ComboboxList\r\n ref={listRef}\r\n className=\"relative gap-0\"\r\n style={{ height: listHeight }}\r\n onScroll={(event) => setScrollTop(event.currentTarget.scrollTop)}\r\n >\r\n <div\r\n className=\"flex w-full shrink-0 flex-col\"\r\n style={{ paddingTop, paddingBottom }}\r\n >\r\n {virtualRange.items.map((item, virtualIndex) => {\r\n const index = virtualRange.startIndex + virtualIndex\r\n\r\n return (\r\n <ComboboxItem\r\n key={item.value}\r\n index={index}\r\n value={item}\r\n >\r\n <div className=\"flex items-center gap-2 w-full min-w-0\">\r\n <FlagComponent country={item.value} countryName={item.label} />\r\n <span className=\"flex-1 text-sm truncate\">{item.label}</span>\r\n <span className=\"text-sm text-text-tertiary shrink-0\">\r\n +{RPNInput.getCountryCallingCode(item.value)}\r\n </span>\r\n </div>\r\n </ComboboxItem>\r\n )\r\n })}\r\n </div>\r\n </ComboboxList>\r\n </ComboboxPopup>\r\n </Combobox >\r\n )\r\n}\r\n\r\n// ---------------------------------------------------------------------------\r\n// Input Component\r\n// ---------------------------------------------------------------------------\r\n\r\nconst InputComponent = React.forwardRef<\r\n HTMLInputElement,\r\n React.ComponentProps<\"input\">\r\n>(({ className, onChange, ...props }, ref) => {\r\n const handleChange = React.useCallback(\r\n (event: React.ChangeEvent<HTMLInputElement>) => {\r\n if (event.currentTarget.value === \"+\") {\r\n event.currentTarget.value = \"\"\r\n }\r\n\r\n onChange?.(event)\r\n },\r\n [onChange]\r\n )\r\n\r\n return (\r\n <input\r\n className={cn(\r\n inputVariants(),\r\n \"h-11 flex-1 rounded-l-none text-body-regular-2\",\r\n className\r\n )}\r\n ref={ref}\r\n type=\"tel\"\r\n onChange={handleChange}\r\n {...props}\r\n />\r\n )\r\n})\r\nInputComponent.displayName = \"InputComponent\"\r\n\r\n// ---------------------------------------------------------------------------\r\n// Phone Input\r\n// ---------------------------------------------------------------------------\r\n\r\nconst PhoneInput: React.ForwardRefExoticComponent<PhoneInputProps> =\r\n React.forwardRef<\r\n React.ElementRef<typeof RPNInput.default>,\r\n PhoneInputProps\r\n >(({\r\n className,\r\n onChange,\r\n value,\r\n ...props\r\n }, ref) => {\r\n return (\r\n <RPNInput.default\r\n ref={ref}\r\n className={cn(\r\n \"flex w-full min-w-0 items-center\",\r\n className\r\n )}\r\n flagComponent={FlagComponent}\r\n countrySelectComponent={CountrySelect}\r\n inputComponent={InputComponent}\r\n smartCaret={false}\r\n value={value || undefined}\r\n onChange={(value) => onChange?.(value || (\"\" as RPNInput.Value))}\r\n {...props}\r\n />\r\n )\r\n })\r\nPhoneInput.displayName = \"PhoneInput\"\r\n\r\nexport { PhoneInput, type PhoneInputProps }\r\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/composites/phone-input.tsx"],"names":["FlagComponent","country","countryName","Flag","flags","jsx","COUNTRY_ROW_HEIGHT","COUNTRY_LIST_HEIGHT","COUNTRY_OVERSCAN","CountrySelect","disabled","selectedCountry","countryList","onChange","open","setOpen","inputValue","setInputValue","scrollTop","setScrollTop","listRef","items","item","filteredItems","search","callingCode","value","listHeight","virtualRange","visibleStartIndex","startIndex","visibleCount","endIndex","paddingTop","paddingBottom","handleValueChange","jsxs","Combobox","a","b","ComboboxTrigger","cn","inputVariants","ChevronsUpDownIcon","ComboboxPopup","ComboboxInput","ComboboxStatus","ComboboxList","event","virtualIndex","index","ComboboxItem","InputComponent","className","props","ref","handleChange","PhoneInput"],"mappings":"oWAoCA,IAAMA,EAAgB,CAAC,CAAE,OAAA,CAAAC,CAAAA,CAAS,YAAAC,CAAY,CAAA,GAA0B,CACtE,IAAMC,EAAOF,CAAAA,CAAUG,CAAAA,CAAMH,CAAO,CAAA,CAAI,MAAA,CAExC,OACEI,GAAAA,CAAC,MAAA,CAAA,CAAK,UAAU,8GAAA,CACb,QAAA,CAAAF,CAAAA,EAAQE,GAAAA,CAACF,EAAA,CAAK,KAAA,CAAOD,CAAAA,CAAa,CAAA,CACrC,CAEJ,CAAA,CASMI,CAAAA,CAAqB,EAAA,CACrBC,CAAAA,CAAsB,IACtBC,CAAAA,CAAmB,CAAA,CASzB,SAASC,CAAAA,CAAc,CACrB,QAAA,CAAAC,CAAAA,CACA,KAAA,CAA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A,IAAM8B,CAAAA,CAAuB,aAG3B,CAAC,CAAE,SAAA,CAAAC,CAAAA,CAAW,SAAAxC,CAAAA,CAAU,GAAGyC,CAAM,CAAA,CAAGC,IAAQ,CAC5C,IAAMC,CAAAA,CAAqB,CAAA,CAAA,WAAA,CACxBR,GAA+C,CAC1CA,CAAAA,CAAM,aAAA,CAAc,KAAA,GAAU,MAChCA,CAAAA,CAAM,aAAA,CAAc,KAAA,CAAQ,EAAA,CAAA,CAG9BnC,IAAWmC,CAAK,EAClB,CAAA,CACA,CAACnC,CAAQ,CACX,CAAA,CAEA,OACER,IAAC,OAAA,CAAA,CACC,SAAA,CAAWoC,EAAAA,CACTC,CAAAA,GACA,gDAAA,CACAW,CACF,CAAA,CACA,GAAA,CAAKE,EACL,IAAA,CAAK,KAAA,CACL,QAAA,CAAUC,CAAAA,CACT,GAAGF,CAAAA,CACN,CAEJ,CAAC,CAAA,CACDF,EAAe,WAAA,CAAc,gBAAA,CAM7B,IAAMK,CAAAA,CACE,aAGJ,CAAC,CACD,SAAA,CAAAJ,CAAAA,CACA,SAAAxC,CAAAA,CACA,KAAA,CAAAa,CAAAA,CACA,GAAG4B,CACL,CAAA,CAAGC,CAAAA,GAEClD,GAAAA,CAAU,UAAT,CACC,GAAA,CAAKkD,CAAAA,CACL,SAAA,CAAWd,GACT,kCAAA,CACAY,CACF,CAAA,CACA,aAAA,CAAerD,EACf,sBAAA,CAAwBS,CAAAA,CACxB,cAAA,CAAgB2C,CAAAA,CAChB,WAAY,KAAA,CACZ,KAAA,CAAO1B,CAAAA,EAAS,MAAA,CAChB,SAAWA,CAAAA,EAAUb,CAAAA,GAAWa,CAAAA,EAAU,EAAqB,EAC9D,GAAG4B,CAAAA,CACN,CAEH,EACHG,EAAW,WAAA,CAAc,YAAA","file":"chunk-G4DP36RY.js","sourcesContent":["\"use client\"\r\n\r\nimport * as React from \"react\"\r\nimport * as RPNInput from \"react-phone-number-input\"\r\nimport flags from \"react-phone-number-input/flags\"\r\n\r\nimport { cn } from \"@xploreu/lib/cn\"\r\nimport { Combobox as ComboboxPrimitive } from \"@base-ui/react/combobox\"\r\nimport {\r\n Combobox,\r\n ComboboxInput,\r\n ComboboxItem,\r\n ComboboxList,\r\n ComboboxPopup,\r\n ComboboxStatus,\r\n ComboboxTrigger,\r\n} from \"../ui/combobox\"\r\nimport { inputVariants } from \"../ui/input\"\r\nimport { ChevronsUpDownIcon } from \"lucide-react\"\r\n\r\n// ---------------------------------------------------------------------------\r\n// Types\r\n// ---------------------------------------------------------------------------\r\n\r\ntype PhoneInputProps = Omit<\r\n React.ComponentProps<\"input\">,\r\n \"onChange\" | \"value\" | \"ref\"\r\n> &\r\n Omit<RPNInput.Props<typeof RPNInput.default>, \"onChange\"> & {\r\n onChange?: (value: RPNInput.Value) => void\r\n }\r\n\r\n// ---------------------------------------------------------------------------\r\n// Flag\r\n// ---------------------------------------------------------------------------\r\n\r\nconst FlagComponent = ({ country, countryName }: RPNInput.FlagProps) => {\r\n const Flag = country ? flags[country] : undefined\r\n\r\n return (\r\n <span className=\"flex h-4 w-6 shrink-0 overflow-hidden rounded-sm bg-fg-quaternary/20 [&_svg:not([class*='size-'])]:size-full\">\r\n {Flag && <Flag title={countryName} />}\r\n </span>\r\n )\r\n}\r\n\r\n// ---------------------------------------------------------------------------\r\n// Country Select — uses base-ui Combobox\r\n// ---------------------------------------------------------------------------\r\n\r\ntype CountryEntry = { label: string; value: RPNInput.Country | undefined }\r\ntype CountryItem = { label: string; value: RPNInput.Country }\r\n\r\nconst COUNTRY_ROW_HEIGHT = 44\r\nconst COUNTRY_LIST_HEIGHT = 288\r\nconst COUNTRY_OVERSCAN = 6\r\n\r\ntype CountrySelectProps = {\r\n disabled?: boolean\r\n value: RPNInput.Country\r\n options: CountryEntry[]\r\n onChange: (country: RPNInput.Country) => void\r\n}\r\n\r\nfunction CountrySelect({\r\n disabled,\r\n value: selectedCountry,\r\n options: countryList,\r\n onChange,\r\n}: CountrySelectProps) {\r\n const [open, setOpen] = React.useState(false)\r\n const [inputValue, setInputValue] = React.useState(\"\")\r\n const [scrollTop, setScrollTop] = React.useState(0)\r\n const listRef = React.useRef<HTMLDivElement>(null)\r\n\r\n const items = React.useMemo(\r\n () => countryList.filter((item): item is CountryItem => Boolean(item.value)),\r\n [countryList]\r\n )\r\n\r\n const filteredItems = React.useMemo(() => {\r\n const search = inputValue.trim().toLowerCase()\r\n\r\n if (!search) return items\r\n\r\n return items.filter((item) => {\r\n const callingCode = RPNInput.getCountryCallingCode(item.value)\r\n\r\n return item.label.toLowerCase().includes(search)\r\n || item.value.toLowerCase().includes(search)\r\n || callingCode.includes(search.replace(/^\\+/, \"\"))\r\n })\r\n }, [inputValue, items])\r\n\r\n const value = React.useMemo(\r\n () => items.find((item) => item.value === selectedCountry) ?? null,\r\n [items, selectedCountry]\r\n )\r\n\r\n React.useEffect(() => {\r\n setScrollTop(0)\r\n if (listRef.current) listRef.current.scrollTop = 0\r\n }, [inputValue])\r\n\r\n const listHeight = Math.min(\r\n filteredItems.length * COUNTRY_ROW_HEIGHT,\r\n COUNTRY_LIST_HEIGHT\r\n )\r\n\r\n const virtualRange = React.useMemo(() => {\r\n const visibleStartIndex = Math.floor(scrollTop / COUNTRY_ROW_HEIGHT)\r\n const startIndex = Math.max(\r\n 0,\r\n visibleStartIndex - COUNTRY_OVERSCAN\r\n )\r\n const visibleCount = Math.ceil(COUNTRY_LIST_HEIGHT / COUNTRY_ROW_HEIGHT)\r\n const endIndex = Math.min(\r\n filteredItems.length,\r\n visibleStartIndex + visibleCount + COUNTRY_OVERSCAN\r\n )\r\n\r\n return {\r\n startIndex,\r\n endIndex,\r\n items: filteredItems.slice(startIndex, endIndex),\r\n }\r\n }, [filteredItems, scrollTop])\r\n\r\n const paddingTop = virtualRange.startIndex * COUNTRY_ROW_HEIGHT\r\n const paddingBottom = Math.max(\r\n 0,\r\n (filteredItems.length - virtualRange.endIndex) * COUNTRY_ROW_HEIGHT\r\n )\r\n\r\n const handleValueChange = React.useCallback(\r\n (item: CountryItem | null) => {\r\n if (!item?.value) return\r\n\r\n onChange(item.value)\r\n setInputValue(\"\")\r\n setOpen(false)\r\n },\r\n [onChange]\r\n )\r\n\r\n return (\r\n <Combobox\r\n behavior=\"default\"\r\n disabled={disabled}\r\n inputValue={inputValue}\r\n items={filteredItems}\r\n open={open}\r\n value={value}\r\n virtualized\r\n filter={null}\r\n isItemEqualToValue={(a, b) => a.value === b.value}\r\n openOnInputClick={false}\r\n onValueChange={handleValueChange}\r\n onInputValueChange={setInputValue}\r\n onOpenChange={(open) => {\r\n setOpen(open)\r\n if (!open) setInputValue(\"\")\r\n }}\r\n >\r\n {/* Visible trigger button styled as part of the input */}\r\n <ComboboxTrigger\r\n render={\r\n <button\r\n type=\"button\"\r\n className={cn(\r\n inputVariants(),\r\n \"h-11 w-18 shrink-0 justify-between gap-1 rounded-r-none border-r-0 px-3\",\r\n \"hover:bg-bg-primary-hover focus-visible:z-10 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-brand\",\r\n \"disabled:pointer-events-none disabled:opacity-50\"\r\n )}\r\n disabled={disabled}\r\n >\r\n <span className=\"flex items-center gap-1.5 overflow-hidden\">\r\n <FlagComponent\r\n country={selectedCountry}\r\n countryName={selectedCountry}\r\n />\r\n {selectedCountry && (\r\n <span className=\"text-body-medium-3 text-text-primary\">\r\n {selectedCountry}\r\n </span>\r\n )}\r\n </span>\r\n <ChevronsUpDownIcon className=\"size-3.5 shrink-0 text-fg-quaternary\" />\r\n </button>\r\n }\r\n />\r\n\r\n {/* Dropdown content */}\r\n <ComboboxPopup className=\"w-72\">\r\n <ComboboxInput\r\n placeholder=\"Search country...\"\r\n aria-label=\"Search country\"\r\n />\r\n <ComboboxStatus status={filteredItems.length === 0 ? \"empty\" : null} />\r\n <ComboboxList\r\n ref={listRef}\r\n className=\"relative gap-0\"\r\n style={{ height: listHeight }}\r\n onScroll={(event) => setScrollTop(event.currentTarget.scrollTop)}\r\n >\r\n <div\r\n className=\"flex w-full shrink-0 flex-col\"\r\n style={{ paddingTop, paddingBottom }}\r\n >\r\n {virtualRange.items.map((item, virtualIndex) => {\r\n const index = virtualRange.startIndex + virtualIndex\r\n\r\n return (\r\n <ComboboxItem\r\n key={item.value}\r\n index={index}\r\n value={item}\r\n >\r\n <div className=\"flex items-center gap-2 w-full min-w-0\">\r\n <FlagComponent country={item.value} countryName={item.label} />\r\n <span className=\"flex-1 text-sm truncate\">{item.label}</span>\r\n <span className=\"text-sm text-text-tertiary shrink-0\">\r\n +{RPNInput.getCountryCallingCode(item.value)}\r\n </span>\r\n </div>\r\n </ComboboxItem>\r\n )\r\n })}\r\n </div>\r\n </ComboboxList>\r\n </ComboboxPopup>\r\n </Combobox >\r\n )\r\n}\r\n\r\n// ---------------------------------------------------------------------------\r\n// Input Component\r\n// ---------------------------------------------------------------------------\r\n\r\nconst InputComponent = React.forwardRef<\r\n HTMLInputElement,\r\n React.ComponentProps<\"input\">\r\n>(({ className, onChange, ...props }, ref) => {\r\n const handleChange = React.useCallback(\r\n (event: React.ChangeEvent<HTMLInputElement>) => {\r\n if (event.currentTarget.value === \"+\") {\r\n event.currentTarget.value = \"\"\r\n }\r\n\r\n onChange?.(event)\r\n },\r\n [onChange]\r\n )\r\n\r\n return (\r\n <input\r\n className={cn(\r\n inputVariants(),\r\n \"h-11 flex-1 rounded-l-none text-body-regular-2\",\r\n className\r\n )}\r\n ref={ref}\r\n type=\"tel\"\r\n onChange={handleChange}\r\n {...props}\r\n />\r\n )\r\n})\r\nInputComponent.displayName = \"InputComponent\"\r\n\r\n// ---------------------------------------------------------------------------\r\n// Phone Input\r\n// ---------------------------------------------------------------------------\r\n\r\nconst PhoneInput: React.ForwardRefExoticComponent<PhoneInputProps> =\r\n React.forwardRef<\r\n React.ElementRef<typeof RPNInput.default>,\r\n PhoneInputProps\r\n >(({\r\n className,\r\n onChange,\r\n value,\r\n ...props\r\n }, ref) => {\r\n return (\r\n <RPNInput.default\r\n ref={ref}\r\n className={cn(\r\n \"flex w-full min-w-0 items-center\",\r\n className\r\n )}\r\n flagComponent={FlagComponent}\r\n countrySelectComponent={CountrySelect}\r\n inputComponent={InputComponent}\r\n smartCaret={false}\r\n value={value || undefined}\r\n onChange={(value) => onChange?.(value || (\"\" as RPNInput.Value))}\r\n {...props}\r\n />\r\n )\r\n })\r\nPhoneInput.displayName = \"PhoneInput\"\r\n\r\nexport { PhoneInput, type PhoneInputProps }\r\n"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {a,b,i,m,e,q,s,w,x,H}from'./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import {a,b,i,m,e,q,s,w,x,H}from'./chunk-SVNG3RLD.js';import {a as a$1}from'./chunk-Y6TKCAAJ.js';import'react';import {ChevronDownIcon}from'lucide-react';import'class-variance-authority';import {cn}from'@xploreu/lib/cn';import {jsxs,jsx}from'react/jsx-runtime';var y={"3xs":"size-3","2xs":"size-3.5",xs:"size-3.5",sm:"size-4",md:"size-4",lg:"size-4.5",xl:"size-5"},D={"3xs":"gap-1.5 pr-2","2xs":"gap-1.5 pr-2.5",xs:"gap-2 pr-2.5",sm:"gap-2 pr-3",md:"gap-2 pr-3",lg:"gap-2.5 pr-3.5",xl:"gap-2.5 pr-4"};function K({items:t,value:I,defaultValue:h,onValueChange:z,placeholder:m$1="Select",searchPlaceholder:N,icon:n,container:V,isPending:v,className:R,triggerClassName:T,contentClassName:k,disabled:q$1,size:a$2="md",infiniteScroll:w$1,showSearch:p=false,filter:l,...L}){return jsxs(a,{items:t,value:I,defaultValue:h,onValueChange:z,filter:l===null||!p?null:l,isItemEqualToValue:(e,B)=>e.value===B.value,disabled:q$1,...L,children:[jsxs(b,{className:cn(a$1({size:a$2}),"group flex cursor-pointer items-center text-left",D[a$2??"md"]??"gap-2 pr-3",T,R),children:[n&&jsx("span",{className:cn(y[a$2??"md"]??"size-4","shrink-0 text-fg-quaternary [&_svg]:size-full"),children:n}),jsx("span",{className:"flex-1 truncate",children:jsx(i,{children:e=>jsx("span",{className:e?"text-text-primary":"text-text-placeholder",children:e?.label??m$1})})}),jsx(ChevronDownIcon,{className:cn(y[a$2??"md"]??"size-4","shrink-0 text-fg-quaternary transition-transform group-data-[popup-open]:rotate-180")})]}),jsxs(m,{container:V,className:cn("w-72",k),align:"start",sideOffset:8,children:[p&&jsx(e,{placeholder:N??`Search ${m$1.toLowerCase()}...`}),jsx(q,{status:v||t===void 0?"pending":t.length===0?"empty":null}),jsxs(s,{children:[t?.map(e=>jsx(w,{value:e,children:jsx(x,{children:e.label})},e.value)),jsx(H,{...w$1})]})]})]})}export{K as a};//# sourceMappingURL=chunk-M63WCJ22.js.map
|
|
2
|
+
//# sourceMappingURL=chunk-M63WCJ22.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/composites/combobox-simple.tsx"],"names":["comboboxSimpleIconSizes","comboboxSimpleTriggerPaddings","ComboboxSimple","items","value","defaultValue","onValueChange","placeholder","searchPlaceholder","icon","container","isPending","className","triggerClassName","contentClassName","disabled","size","infiniteScroll","showSearch","filter","props","jsxs","Combobox","a","b","ComboboxTrigger","cn","inputVariants","jsx","ComboboxValue","item","ChevronDownIcon","ComboboxPopup","ComboboxInput","ComboboxStatus","ComboboxList","ComboboxItem","ComboboxItemTitle","ComboboxInfiniteScroll"],"mappings":"qQA8CA,IAAMA,CAAAA,CAAkD,CACtD,KAAA,CAAO,QAAA,CACP,KAAA,CAAO,UAAA,CACP,EAAA,CAAI,UAAA,CACJ,EAAA,CAAI,QAAA,CACJ,EAAA,CAAI,SACJ,EAAA,CAAI,UAAA,CACJ,EAAA,CAAI,QACN,CAAA,CAEMC,CAAAA,CAAwD,CAC5D,KAAA,CAAO,cAAA,CACP,KAAA,CAAO,gBAAA,CACP,EAAA,CAAI,cAAA,CACJ,EAAA,CAAI,YAAA,CACJ,EAAA,CAAI,aACJ,EAAA,CAAI,gBAAA,CACJ,EAAA,CAAI,cACN,CAAA,CAIA,SAASC,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AAAA,CAAK,KAAA,CACR,CAAA,CAAA,CAHiBA,CAAAA,CAAK,KAIxB,CACD,CAAA,CACDF,GAAAA,CAACU,CAAAA,CAAA,CAAwB,GAAGrB,GAAAA,CAAgB,CAAA,CAAA,CAC9C,CAAA,CAAA,CACF,GACF,CAEJ","file":"chunk-
|
|
1
|
+
{"version":3,"sources":["../src/composites/combobox-simple.tsx"],"names":["comboboxSimpleIconSizes","comboboxSimpleTriggerPaddings","ComboboxSimple","items","value","defaultValue","onValueChange","placeholder","searchPlaceholder","icon","container","isPending","className","triggerClassName","contentClassName","disabled","size","infiniteScroll","showSearch","filter","props","jsxs","Combobox","a","b","ComboboxTrigger","cn","inputVariants","jsx","ComboboxValue","item","ChevronDownIcon","ComboboxPopup","ComboboxInput","ComboboxStatus","ComboboxList","ComboboxItem","ComboboxItemTitle","ComboboxInfiniteScroll"],"mappings":"qQA8CA,IAAMA,CAAAA,CAAkD,CACtD,KAAA,CAAO,QAAA,CACP,KAAA,CAAO,UAAA,CACP,EAAA,CAAI,UAAA,CACJ,EAAA,CAAI,QAAA,CACJ,EAAA,CAAI,SACJ,EAAA,CAAI,UAAA,CACJ,EAAA,CAAI,QACN,CAAA,CAEMC,CAAAA,CAAwD,CAC5D,KAAA,CAAO,cAAA,CACP,KAAA,CAAO,gBAAA,CACP,EAAA,CAAI,cAAA,CACJ,EAAA,CAAI,YAAA,CACJ,EAAA,CAAI,aACJ,EAAA,CAAI,gBAAA,CACJ,EAAA,CAAI,cACN,CAAA,CAIA,SAASC,CAAAA,CAAe,CACtB,MAAAC,CAAAA,CACA,KAAA,CAAAC,CAAAA,CACA,YAAA,CAAAC,CAAAA,CACA,aAAA,CAAAC,CAAAA,CACA,WAAA,CAAAC,IAAc,QAAA,CACd,iBAAA,CAAAC,CAAAA,CACA,IAAA,CAAAC,CAAAA,CACA,SAAA,CAAAC,CAAAA,CACA,SAAA,CAAAC,CAAAA,CACA,SAAA,CAAAC,CAAAA,CACA,gBAAA,CAAAC,CAA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CAAAA,CAAAA,EAAM,KAAA,EAASvB,GAAAA,CAClB,CAAA,CAEJ,EACF,CAAA,CACAqB,GAAAA,CAACG,eAAAA,CAAA,CACC,SAAA,CAAWL,EAAAA,CACT1B,CAAAA,CAAwBgB,GAAAA,EAAQ,IAAI,CAAA,EAAK,QAAA,CACzC,qFACF,CAAA,CACF,CAAA,CAAA,CACF,CAAA,CAEAK,IAAAA,CAACW,CAAAA,CAAA,CACC,SAAA,CAAWtB,CAAAA,CACX,SAAA,CAAWgB,EAAAA,CAAG,MAAA,CAAQZ,CAAgB,CAAA,CACtC,KAAA,CAAM,OAAA,CACN,UAAA,CAAY,CAAA,CAEX,QAAA,CAAA,CAAAI,CAAAA,EACCU,GAAAA,CAACK,CAAAA,CAAA,CAAc,YAAazB,CAAAA,EAAqB,CAAA,OAAA,EAAUD,GAAAA,CAAY,WAAA,EAAa,CAAA,GAAA,CAAA,CAAO,CAAA,CAE7FqB,GAAAA,CAACM,EAAA,CACC,MAAA,CACEvB,CAAAA,EAAaR,CAAAA,GAAU,MAAA,CACnB,SAAA,CACAA,CAAAA,CAAM,MAAA,GAAW,EACf,OAAA,CACA,IAAA,CAEV,CAAA,CACAkB,IAAAA,CAACc,CAAAA,CAAA,CACE,QAAA,CAAA,CAAAhC,CAAAA,EAAO,GAAA,CAAK2B,CAAAA,EACXF,GAAAA,CAACQ,CAAAA,CAAA,CAA8B,KAAA,CAAON,CAAAA,CACpC,QAAA,CAAAF,IAACS,CAAAA,CAAA,CACE,QAAA,CAAAP,CAAAA,CAAK,KAAA,CACR,CAAA,CAAA,CAHiBA,CAAAA,CAAK,KAIxB,CACD,CAAA,CACDF,GAAAA,CAACU,CAAAA,CAAA,CAAwB,GAAGrB,GAAAA,CAAgB,CAAA,CAAA,CAC9C,CAAA,CAAA,CACF,GACF,CAEJ","file":"chunk-M63WCJ22.js","sourcesContent":["\"use client\"\r\n\r\nimport * as React from \"react\"\r\nimport { ChevronDownIcon } from \"lucide-react\"\r\nimport { type VariantProps } from \"class-variance-authority\"\r\n\r\nimport { cn } from \"@xploreu/lib/cn\"\r\nimport { inputVariants } from \"../ui/input\"\r\nimport { ComboboxItem, ComboboxItemTitle, type ComboboxProps } from \"../ui/combobox\"\r\nimport {\r\n Combobox,\r\n ComboboxInfiniteScroll,\r\n ComboboxInput,\r\n ComboboxList,\r\n ComboboxPopup,\r\n ComboboxPortal,\r\n ComboboxStatus,\r\n ComboboxTrigger,\r\n ComboboxValue,\r\n} from \"../ui/combobox\"\r\n\r\n// ─── Types ───\r\n\r\nexport type ComboboxSimpleItem = {\r\n label: string\r\n value: string\r\n}\r\n\r\ntype BaseProps = {\r\n items: ComboboxSimpleItem[] | undefined\r\n placeholder?: string\r\n searchPlaceholder?: string\r\n icon?: React.ReactNode\r\n container?: React.ComponentProps<typeof ComboboxPortal>[\"container\"]\r\n isPending?: boolean\r\n className?: string\r\n triggerClassName?: string\r\n contentClassName?: string\r\n disabled?: boolean\r\n size?: VariantProps<typeof inputVariants>[\"size\"]\r\n infiniteScroll?: React.ComponentProps<typeof ComboboxInfiniteScroll>\r\n showSearch?: boolean\r\n}\r\n\r\nexport type ComboboxSimpleProps = Omit<ComboboxProps<ComboboxSimpleItem, false>, \"multiple\" | \"items\"> & BaseProps\r\n\r\nconst comboboxSimpleIconSizes: Record<string, string> = {\r\n \"3xs\": \"size-3\",\r\n \"2xs\": \"size-3.5\",\r\n xs: \"size-3.5\",\r\n sm: \"size-4\",\r\n md: \"size-4\",\r\n lg: \"size-4.5\",\r\n xl: \"size-5\",\r\n}\r\n\r\nconst comboboxSimpleTriggerPaddings: Record<string, string> = {\r\n \"3xs\": \"gap-1.5 pr-2\",\r\n \"2xs\": \"gap-1.5 pr-2.5\",\r\n xs: \"gap-2 pr-2.5\",\r\n sm: \"gap-2 pr-3\",\r\n md: \"gap-2 pr-3\",\r\n lg: \"gap-2.5 pr-3.5\",\r\n xl: \"gap-2.5 pr-4\",\r\n}\r\n\r\n// ─── Component ───\r\n\r\nfunction ComboboxSimple({\r\n items,\r\n value,\r\n defaultValue,\r\n onValueChange,\r\n placeholder = \"Select\",\r\n searchPlaceholder,\r\n icon,\r\n container,\r\n isPending,\r\n className,\r\n triggerClassName,\r\n contentClassName,\r\n disabled,\r\n size = \"md\",\r\n infiniteScroll,\r\n showSearch = false,\r\n filter,\r\n ...props\r\n}: ComboboxSimpleProps) {\r\n return (\r\n <Combobox\r\n items={items}\r\n value={value}\r\n defaultValue={defaultValue}\r\n onValueChange={onValueChange}\r\n filter={filter === null || !showSearch ? null : filter}\r\n isItemEqualToValue={(a, b) => a.value === b.value}\r\n disabled={disabled}\r\n {...props}\r\n >\r\n <ComboboxTrigger\r\n className={cn(\r\n inputVariants({ size }),\r\n \"group flex cursor-pointer items-center text-left\",\r\n comboboxSimpleTriggerPaddings[size ?? \"md\"] ?? \"gap-2 pr-3\",\r\n triggerClassName,\r\n className\r\n )}\r\n >\r\n {icon && (\r\n <span className={cn(comboboxSimpleIconSizes[size ?? \"md\"] ?? \"size-4\", \"shrink-0 text-fg-quaternary [&_svg]:size-full\")}>\r\n {icon}\r\n </span>\r\n )}\r\n <span className=\"flex-1 truncate\">\r\n <ComboboxValue>\r\n {(item) => (\r\n <span className={item ? \"text-text-primary\" : \"text-text-placeholder\"}>\r\n {item?.label ?? placeholder}\r\n </span>\r\n )}\r\n </ComboboxValue>\r\n </span>\r\n <ChevronDownIcon\r\n className={cn(\r\n comboboxSimpleIconSizes[size ?? \"md\"] ?? \"size-4\",\r\n \"shrink-0 text-fg-quaternary transition-transform group-data-[popup-open]:rotate-180\"\r\n )}\r\n />\r\n </ComboboxTrigger>\r\n\r\n <ComboboxPopup\r\n container={container}\r\n className={cn(\"w-72\", contentClassName)}\r\n align=\"start\"\r\n sideOffset={8}\r\n >\r\n {showSearch && (\r\n <ComboboxInput placeholder={searchPlaceholder ?? `Search ${placeholder.toLowerCase()}...`} />\r\n )}\r\n <ComboboxStatus\r\n status={\r\n isPending || items === undefined\r\n ? \"pending\"\r\n : items.length === 0\r\n ? \"empty\"\r\n : null\r\n }\r\n />\r\n <ComboboxList>\r\n {items?.map((item) => (\r\n <ComboboxItem key={item.value} value={item}>\r\n <ComboboxItemTitle>\r\n {item.label}\r\n </ComboboxItemTitle>\r\n </ComboboxItem>\r\n ))}\r\n <ComboboxInfiniteScroll {...infiniteScroll} />\r\n </ComboboxList>\r\n </ComboboxPopup>\r\n </Combobox>\r\n )\r\n}\r\n\r\nexport { ComboboxSimple }\r\n"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import {c,d,e,f,g,a,h,i,j,k,l,m,n,o,p,q,r,s,E,t,u,v,w,x,y,z,A,B,C,D}from'./chunk-HHG7BSWN.js';import {a as a$3}from'./chunk-TED2PUK6.js';import {b}from'./chunk-Y6TKCAAJ.js';import {a as a$1}from'./chunk-7P4PFMCM.js';import {a as a$2}from'./chunk-XG3W7QMP.js';import {b as b$2,c as c$1,d as d$1}from'./chunk-BES6JPWQ.js';import {b as b$1,e as e$1}from'./chunk-JLZNZFOO.js';import'react';import {SearchIcon,XIcon,Loader2Icon,CheckCircle2Icon}from'lucide-react';import {cn}from'@xploreu/lib/cn';import {jsx,jsxs,Fragment}from'react/jsx-runtime';function wo(o){return jsx(c,{...o})}function io(o){let{className:t,...r}=o;return jsx(d,{className:cn("group/combobox-trigger flex items-center gap-2",t),...r})}function ko(o){let{className:t,...r}=o;return jsx(e,{className:cn("text-label-semibold-2 text-text-secondary",t),...r})}function Lo(o){let{className:t,...r}=o;return jsx(f,{className:cn("flex w-full items-center gap-2",t),...r})}function Ro({className:o,wrapperClassName:t,size:r="xs",...i}){return jsx("div",{className:cn("p-3 border-b border-border-primary",t),children:jsx(g,{className:o,render:jsx(b,{size:r,startContent:jsx(SearchIcon,{})}),...i})})}function So({className:o,displayValueKey:t={label:"label",value:"value"},placeholder:r="Search and Select Company",inputProps:i,size:m,...s}){let{inputValue:p,setInputValue:n}=a(),{className:x,startContent:to,...ro}=i||{};return jsx("div",{className:cn("flex flex-col gap-2",o),children:jsxs(so,{onMouseDown:C=>C.preventBaseUIHandler(),className:"flex-col",children:[jsx(g,{render:jsx(b,{className:cn("h-9 text-body-regular-3 pl-9 pr-7",x),endContent:jsx(io,{nativeButton:false,render:jsx(XIcon,{className:"!size-5 !right-1.5 data-[hidden=true]:opacity-0 opacity-100 transition-opacity duration-300 cursor-pointer","data-hidden":!p,"data-slot":"combobox-clear-input",onClick:C=>{n("",{reason:"none",event:C.nativeEvent,cancel:()=>{},allowPropagation:()=>{},isCanceled:false,isPropagationAllowed:true,trigger:void 0});}})}),placeholder:r,startContent:to??jsx(SearchIcon,{className:"!size-4 !text-fg-tertiary-hover"}),...ro}),...s}),jsx(mo,{children:C=>C?.map(y=>jsxs(po,{children:[y?.[t.label]||"",jsx(ao,{})]},y?.[t.value]||""))})]})})}function Go(o){let{className:t,...r}=o;return jsx(h,{className:cn("text-text-secondary",t),...r})}function Ao(o){return jsx(i,{render:jsx(XIcon,{}),...o})}function mo(o){return jsx(j,{...o})}function so({className:o,...t}){return jsx(k,{className:cn("flex flex-wrap gap-2",o),...t})}function po({className:o,...t}){return jsx(b$1,{className:cn("ring-1 ring-border-brand text-body-medium-3",o),color:"brand",render:jsx(l,{...t}),size:"lg"})}function ao({className:o,...t}){return jsx(e$1,{className:cn("text-fg-quaternary",o),render:jsx(m,{...t})})}function Ho({className:o$1,align:t="start",sideOffset:r=4,container:i,initialFocus:m,finalFocus:s,style:p$1,children:n$1,...x}){return jsx(n,{container:i,children:jsx(o,{align:t,className:"isolate z-50",sideOffset:r,...x,children:jsx(p,{className:cn("group/combobox-popup bg-bg-primary text-text-primary max-h-(--available-height) w-72 max-w-(--available-width) origin-(--transform-origin) rounded-md border border-border-primary shadow-md outline-hidden",o$1),finalFocus:s,initialFocus:m,style:p$1,children:jsx(no,{children:n$1})})})})}function zo(o){return jsx(n,{...o})}function Vo(o$1){return jsx(o,{...o$1})}function To(o){let{className:t,...r}=o;return jsx(q,{className:cn("bg-black/30",t),...r})}function Bo({className:o,status:t,...r$1}){let{inputValue:i}=a(),m=i?.toString().trim(),p=t==="empty"&&m?`No matches for "${m}".`:t==="empty"&&!m?"No results.":t==="pending"?jsxs(Fragment,{children:[jsx(Loader2Icon,{className:"animate-spin size-4"}),jsx("span",{children:"Searching..."})]}):null;return jsx(r,{className:cn("px-2 py-2.5 text-body-regular-2 text-text-disabled flex items-center gap-2",!p&&"hidden",o),...r$1,children:p})}function Eo({className:o,...t}){return jsx(s,{className:cn("px-3 py-2 text-body-regular-2 text-text-secondary",o),...t})}function Fo({className:o,children:t$1,...r}){let i=E();return jsx(a$1,{size:"sm",viewportRender:jsx(t,{className:cn("max-h-[min(calc(--spacing(72)---spacing(9)),calc(var(--available-height)---spacing(9)))] flex flex-col p-1 focus-visible:outline-none data-[empty]:hidden",o),...r,children:typeof t$1=="function"?(m,s)=>t$1(m,s,i.length):t$1})})}function no(o){let{className:t,...r}=o;return jsx(u,{className:cn("absolute inset-0 bg-bg-primary-hover",t),...r})}function xo(o){return jsx(v,{...o})}function Mo(o){let{className:t,...r}=o;return jsx(w,{className:cn("group/combobox-row",t),...r})}function Do({className:o,children:t,indicator:r="check-circle",...i}){let{disabled:m}=i;return jsx(xo,{activeClassName:"bg-bg-primary-hover rounded-md",disabled:m,children:jsxs(x,{"data-indicator":r,className:cn("group/combobox-item relative grid grid-cols-[auto_1fr] items-center gap-x-2 my-px p-xp-md cursor-default outline-none select-none [[data-indicator=check-circle][data-selected]]:pr-8 data-[indicator=checkbox]:pl-8",o),...i,children:[t,jsx(Co,{className:"absolute group-data-[indicator=check-circle]/combobox-item:right-2 group-data-[indicator=checkbox]/combobox-item:left-2",keepMounted:r==="checkbox",render:(s,p)=>jsxs("span",{...s,children:[r==="check-circle"&&jsx(CheckCircle2Icon,{className:"size-4 text-fg-brand-primary shrink-0"}),r==="checkbox"&&jsx(a$2,{checked:p.selected})]})})]})})}function Oo({className:o,...t}){return jsx("span",{"data-slot":"combobox-item-title",className:cn("col-start-2 text-body-medium-3 text-text-primary truncate row-span-2 group-has-[[data-slot=combobox-item-description]]/combobox-item:row-span-1",o),...t})}function qo({className:o,...t}){return jsx("span",{"data-slot":"combobox-item-description",className:cn("col-start-2 text-body-regular-3 text-text-secondary truncate",o),...t})}function _o({className:o,...t}){return jsx("div",{"data-slot":"combobox-item-icon",className:cn("row-span-2 col-start-1 flex items-center justify-center size-6 rounded-md bg-bg-brand-solid text-fg-white shrink-0 [&_svg]:size-3.5",o),...t})}function jo({src:o,imageSrc:t,className:r,avatarClassName:i,imageAlt:m,fallbackText:s,children:p,...n}){let x=o??t;return jsx("div",{"data-slot":"combobox-item-avatar",className:cn("row-span-2 col-start-1 size-6 rounded-full overflow-hidden shrink-0",r),children:jsxs(b$2,{className:cn("size-full shrink-0",i),...n,children:[jsx(c$1,{alt:m,src:x}),jsx(d$1,{className:"flex aspect-square size-full items-center justify-center bg-bg-tertiary text-label-semibold-2 text-text-quaternary",children:s??p})]})})}function Co(o){return jsx(y,{...o})}function Uo(o){let{className:t,...r}=o;return jsx(z,{className:cn("my-1 h-px bg-border-primary",t),...r})}function Xo(o){let{className:t,...r}=o;return jsx(A,{className:cn("py-1",t),...r})}function $o(o){let{className:t,...r}=o;return jsx(B,{className:cn("px-3 py-1 text-body-semibold-sm text-text-secondary",t),...r})}function Jo(o){return jsx(C,{...o})}function Ko(o){let{className:t,...r}=o;return jsx(D,{className:cn("fill-bg-primary",t),...r})}function Qo({hasMore:o,threshold:t=.5,...r}){return jsx(a$3,{hasMore:o,threshold:t,...r,children:o&&jsxs("div",{className:"px-2 py-2.5 text-body-regular-2 text-text-disabled flex items-center gap-2",children:[jsx(Loader2Icon,{className:"animate-spin size-4"}),jsx("span",{children:"Loading more..."})]})})}export{jo as A,Co as B,Uo as C,Xo as D,$o as E,Jo as F,Ko as G,Qo as H,wo as a,io as b,ko as c,Lo as d,Ro as e,So as f,Go as g,Ao as h,mo as i,so as j,po as k,ao as l,Ho as m,zo as n,Vo as o,To as p,Bo as q,Eo as r,Fo as s,no as t,xo as u,Mo as v,Do as w,Oo as x,qo as y,_o as z};//# sourceMappingURL=chunk-SVNG3RLD.js.map
|
|
2
|
+
//# sourceMappingURL=chunk-SVNG3RLD.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/ui/combobox.tsx"],"names":["Combobox","props","jsx","ComboboxTrigger","className","rest","cn","ComboboxLabel","ComboboxInputGroup","ComboboxInput","wrapperClassName","size","Input","SearchIcon","ComboboxInputFilter","displayValueKey","placeholder","inputProps","inputValue","setInputValue","useCombobox","inputClassName","startContent","restInputProps","jsxs","ComboboxChips","e","XIcon","event","ComboboxValue","value","item","ComboboxChip","ComboboxChipRemove","ComboboxIcon","ComboboxClear","Badge","BadgeButton","ComboboxPopup","align","sideOffset","container","initialFocus","finalFocus","style","children","ComboboxPortal","ComboboxPositioner","ComboboxHighlight","ComboboxBackdrop","ComboboxStatus","status","trimmedInputValue","text","Fragment","Loader2Icon","ComboboxEmpty","ComboboxList","items","useFilteredItems","ScrollArea","index","ComboboxHighlightItem","ComboboxRow","ComboboxItem","indicator","disabled","ComboboxItemIndicator","state","CheckCircle2Icon","Checkbox","ComboboxItemTitle","ComboboxItemDescription","ComboboxItemIcon","ComboboxItemAvatar","src","imageSrc","avatarClassName","imageAlt","fallbackText","finalSrc","Avatar","AvatarImage","AvatarFallback","ComboboxSeparator","ComboboxGroup","ComboboxGroupLabel","ComboboxCollection","ComboboxArrow","ComboboxInfiniteScroll","hasMore","threshold","InfiniteScroll"],"mappings":"8hBAgFA,SAASA,EAAAA,CAA8DC,CAAAA,CAAuC,CAC5G,OACEC,GAAAA,CAACF,CAAAA,CAAA,CAAmB,GAAGC,CAAAA,CAAO,CAElC,CAIA,SAASE,EAAAA,CAAgBF,CAAAA,CAA6B,CACpD,GAAM,CAAE,SAAA,CAAAG,CAAAA,CAAW,GAAGC,CAAK,CAAA,CAAIJ,CAAAA,CAE/B,OAAOC,GAAAA,CAACC,EAAA,CACN,SAAA,CA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AAA,CACzC,GAAGC,CAAAA,CACN,CACF,CAEA,SAASoF,EAAAA,CAAuB,CAC9B,OAAA,CAAAC,CAAAA,CACA,SAAA,CAAAC,CAAAA,CAAY,EAAA,CACZ,GAAG1F,CACL,CAAA,CAAkE,CAChE,OACEC,GAAAA,CAAC0F,GAAAA,CAAA,CACC,OAAA,CAASF,CAAAA,CACT,SAAA,CAAWC,CAAAA,CACV,GAAG1F,CAAAA,CAEH,QAAA,CAAAyF,CAAAA,EACClE,IAAAA,CAAC,KAAA,CAAA,CAAI,SAAA,CAAU,4EAAA,CACb,QAAA,CAAA,CAAAtB,IAACqD,WAAAA,CAAA,CAAY,SAAA,CAAU,qBAAA,CAAsB,EAC7CrD,GAAAA,CAAC,MAAA,CAAA,CAAK,QAAA,CAAA,iBAAA,CAEN,CAAA,CAAA,CACF,EAEJ,CAEJ","file":"chunk-SVNG3RLD.js","sourcesContent":["import * as React from \"react\"\r\n\r\nimport {\r\n CheckCircle2Icon,\r\n Loader2Icon,\r\n SearchIcon,\r\n XIcon\r\n} from \"lucide-react\"\r\n\r\nimport {\r\n Combobox as ComboboxPrimitive,\r\n ComboboxArrow as ComboboxArrowPrimitive,\r\n type ComboboxArrowProps as ComboboxArrowPrimitiveProps,\r\n ComboboxBackdrop as ComboboxBackdropPrimitive,\r\n type ComboboxBackdropProps as ComboboxBackdropPrimitiveProps,\r\n ComboboxChip as ComboboxChipPrimitive,\r\n type ComboboxChipProps as ComboboxChipPrimitiveProps,\r\n ComboboxChipRemove as ComboboxChipRemovePrimitive,\r\n type ComboboxChipRemoveProps as ComboboxChipRemovePrimitiveProps,\r\n ComboboxChips as ComboboxChipsPrimitive,\r\n type ComboboxChipsProps as ComboboxChipsPrimitiveProps,\r\n ComboboxClear as ComboboxClearPrimitive,\r\n type ComboboxClearProps as ComboboxClearPrimitiveProps,\r\n ComboboxCollection as ComboboxCollectionPrimitive,\r\n type ComboboxCollectionProps as ComboboxCollectionPrimitiveProps,\r\n ComboboxEmpty as ComboboxEmptyPrimitive,\r\n type ComboboxEmptyProps as ComboboxEmptyPrimitiveProps,\r\n ComboboxGroup as ComboboxGroupPrimitive,\r\n ComboboxGroupLabel as ComboboxGroupLabelPrimitive,\r\n type ComboboxGroupLabelProps as ComboboxGroupLabelPrimitiveProps,\r\n type ComboboxGroupProps as ComboboxGroupPrimitiveProps,\r\n ComboboxHighlight as ComboboxHighlightPrimitive,\r\n ComboboxHighlightItem as ComboboxHighlightItemPrimitive,\r\n type ComboboxHighlightItemProps as ComboboxHighlightItemPrimitiveProps,\r\n type ComboboxHighlightProps as ComboboxHighlightPrimitiveProps,\r\n ComboboxIcon as ComboboxIconPrimitive,\r\n type ComboboxIconProps as ComboboxIconPrimitiveProps,\r\n ComboboxInput as ComboboxInputPrimitive,\r\n ComboboxInputGroup as ComboboxInputGroupPrimitive,\r\n type ComboboxInputGroupProps as ComboboxInputGroupPrimitiveProps,\r\n type ComboboxInputProps as ComboboxInputPrimitiveProps,\r\n ComboboxItem as ComboboxItemPrimitive,\r\n ComboboxItemIndicator as ComboboxItemIndicatorPrimitive,\r\n type ComboboxItemIndicatorProps as ComboboxItemIndicatorPrimitiveProps,\r\n type ComboboxItemProps as ComboboxItemPrimitiveProps,\r\n ComboboxLabel as ComboboxLabelPrimitive,\r\n type ComboboxLabelProps as ComboboxLabelPrimitiveProps,\r\n ComboboxList as ComboboxListPrimitive,\r\n type ComboboxListProps as ComboboxListPrimitiveProps,\r\n ComboboxPopup as ComboboxPopupPrimitive,\r\n type ComboboxPopupProps as ComboboxPopupPrimitiveProps,\r\n ComboboxPortal as ComboboxPortalPrimitive,\r\n type ComboboxPortalProps as ComboboxPortalPrimitiveProps,\r\n ComboboxPositioner as ComboboxPositionerPrimitive,\r\n type ComboboxPositionerProps as ComboboxPositionerPrimitiveProps,\r\n type ComboboxProps as ComboboxPrimitiveProps,\r\n ComboboxRow as ComboboxRowPrimitive,\r\n type ComboboxRowProps as ComboboxRowPrimitiveProps,\r\n ComboboxSeparator as ComboboxSeparatorPrimitive,\r\n type ComboboxSeparatorProps as ComboboxSeparatorPrimitiveProps,\r\n ComboboxStatus as ComboboxStatusPrimitive,\r\n type ComboboxStatusProps as ComboboxStatusPrimitiveProps,\r\n ComboboxTrigger as ComboboxTriggerPrimitive,\r\n type ComboboxTriggerProps as ComboboxTriggerPrimitiveProps,\r\n ComboboxValue as ComboboxValuePrimitive,\r\n type ComboboxValueProps as ComboboxValuePrimitiveProps,\r\n useCombobox,\r\n useFilteredItems,\r\n} from \"../primitives/combobox\"\r\nimport { cn } from \"@xploreu/lib/cn\"\r\n\r\nimport { ScrollArea } from \"./scroll-area\"\r\nimport { Badge, BadgeButton } from \"./badge\"\r\nimport { InfiniteScroll } from \"./infinite-scroll\"\r\nimport { Input } from \"./input\"\r\nimport { Checkbox } from \"./checkbox\"\r\nimport { Avatar, AvatarFallback, AvatarImage } from \"./avatar\"\r\n\r\ntype ComboboxProps<Value, Multiple extends boolean | undefined = false> = ComboboxPrimitiveProps<Value, Multiple>\r\n\r\nfunction Combobox<Value, Multiple extends boolean | undefined = false>(props: ComboboxProps<Value, Multiple>) {\r\n return (\r\n <ComboboxPrimitive {...props} />\r\n )\r\n}\r\n\r\ntype ComboboxTriggerProps = ComboboxTriggerPrimitiveProps\r\n\r\nfunction ComboboxTrigger(props: ComboboxTriggerProps) {\r\n const { className, ...rest } = props\r\n\r\n return <ComboboxTriggerPrimitive\r\n className={cn(\r\n \"group/combobox-trigger flex items-center gap-2\",\r\n className,\r\n )}\r\n {...rest}\r\n />\r\n}\r\n\r\ntype ComboboxLabelProps = ComboboxLabelPrimitiveProps\r\n\r\nfunction ComboboxLabel(props: ComboboxLabelProps) {\r\n const { className, ...rest } = props\r\n\r\n return <ComboboxLabelPrimitive\r\n className={cn(\r\n \"text-label-semibold-2 text-text-secondary\",\r\n className,\r\n )}\r\n {...rest}\r\n />\r\n}\r\n\r\ntype ComboboxInputGroupProps = ComboboxInputGroupPrimitiveProps\r\n\r\nfunction ComboboxInputGroup(props: ComboboxInputGroupProps) {\r\n const { className, ...rest } = props\r\n\r\n return <ComboboxInputGroupPrimitive\r\n className={cn(\r\n \"flex w-full items-center gap-2\",\r\n className,\r\n )}\r\n {...rest}\r\n />\r\n}\r\n\r\ntype ComboboxInputProps = Omit<ComboboxInputPrimitiveProps, \"size\"> & {\r\n wrapperClassName?: string\r\n size?: React.ComponentProps<typeof Input>[\"size\"]\r\n}\r\n\r\nfunction ComboboxInput({\r\n className,\r\n wrapperClassName,\r\n size = \"xs\",\r\n ...props\r\n}: ComboboxInputProps) {\r\n\r\n return (\r\n <div className={cn(\"p-3 border-b border-border-primary\", wrapperClassName)}>\r\n <ComboboxInputPrimitive\r\n className={className}\r\n render={<Input size={size} startContent={<SearchIcon />} />}\r\n {...props}\r\n />\r\n </div>\r\n )\r\n}\r\n\r\nfunction ComboboxInputFilter({\r\n className,\r\n displayValueKey = { label: \"label\", value: \"value\" },\r\n placeholder = \"Search and Select Company\",\r\n inputProps,\r\n size,\r\n ...props\r\n}: ComboboxInputProps & {\r\n displayValueKey?: {\r\n label: string\r\n value: string\r\n }\r\n placeholder?: string\r\n inputProps?: React.ComponentProps<typeof Input>\r\n}) {\r\n const { inputValue, setInputValue } = useCombobox()\r\n const { className: inputClassName, startContent, ...restInputProps } = inputProps || {}\r\n\r\n return (\r\n <div className={cn(\"flex flex-col gap-2\", className)}>\r\n <ComboboxChips\r\n onMouseDown={(e) => e.preventBaseUIHandler()}\r\n className=\"flex-col\"\r\n >\r\n <ComboboxInputPrimitive\r\n render={\r\n <Input\r\n className={cn(\"h-9 text-body-regular-3 pl-9 pr-7\", inputClassName)}\r\n endContent={\r\n <ComboboxTrigger\r\n nativeButton={false}\r\n render={(\r\n <XIcon\r\n className=\"!size-5 !right-1.5 data-[hidden=true]:opacity-0 opacity-100 transition-opacity duration-300 cursor-pointer\"\r\n data-hidden={!inputValue}\r\n data-slot=\"combobox-clear-input\"\r\n onClick={(event) => {\r\n setInputValue(\"\", {\r\n reason: \"none\",\r\n event: event.nativeEvent,\r\n cancel: () => { },\r\n allowPropagation: () => { },\r\n isCanceled: false,\r\n isPropagationAllowed: true,\r\n trigger: undefined,\r\n })\r\n }}\r\n />\r\n )}\r\n />\r\n }\r\n placeholder={placeholder}\r\n startContent={startContent ?? <SearchIcon className=\"!size-4 !text-fg-tertiary-hover\" />}\r\n {...restInputProps}\r\n />\r\n }\r\n {...props}\r\n />\r\n <ComboboxValue>\r\n {/* eslint-disable-next-line @typescript-eslint/no-explicit-any */}\r\n {(value) => value?.map((item: any) => (\r\n <ComboboxChip key={item?.[displayValueKey.value] || \"\"}>\r\n {item?.[displayValueKey.label] || \"\"}\r\n <ComboboxChipRemove />\r\n </ComboboxChip>\r\n ))}\r\n </ComboboxValue>\r\n </ComboboxChips>\r\n </div>\r\n )\r\n}\r\n\r\ntype ComboboxIconProps = ComboboxIconPrimitiveProps\r\n\r\nfunction ComboboxIcon(props: ComboboxIconProps) {\r\n const { className, ...rest } = props\r\n\r\n return <ComboboxIconPrimitive\r\n className={cn(\"text-text-secondary\", className)}\r\n {...rest}\r\n />\r\n}\r\n\r\ntype ComboboxClearProps = ComboboxClearPrimitiveProps\r\n\r\nfunction ComboboxClear(props: ComboboxClearProps) {\r\n\r\n return (\r\n <ComboboxClearPrimitive\r\n render={<XIcon />}\r\n {...props}\r\n />\r\n )\r\n}\r\n\r\ntype ComboboxValueProps = ComboboxValuePrimitiveProps\r\n\r\nfunction ComboboxValue(props: ComboboxValueProps) {\r\n return <ComboboxValuePrimitive {...props} />\r\n}\r\n\r\ntype ComboboxChipsProps = ComboboxChipsPrimitiveProps\r\n\r\nfunction ComboboxChips({\r\n className,\r\n ...props\r\n}: ComboboxChipsProps) {\r\n return <ComboboxChipsPrimitive\r\n className={cn(\"flex flex-wrap gap-2\", className)}\r\n {...props}\r\n />\r\n}\r\n\r\ntype ComboboxChipProps = ComboboxChipPrimitiveProps\r\n\r\nfunction ComboboxChip({\r\n className,\r\n ...props\r\n}: ComboboxChipProps) {\r\n return (\r\n <Badge\r\n className={cn(\"ring-1 ring-border-brand text-body-medium-3\", className)}\r\n color=\"brand\"\r\n render={(\r\n <ComboboxChipPrimitive\r\n {...props}\r\n />\r\n )}\r\n size=\"lg\"\r\n />\r\n )\r\n}\r\n\r\ntype ComboboxChipRemoveProps = ComboboxChipRemovePrimitiveProps\r\n\r\nfunction ComboboxChipRemove({\r\n className,\r\n ...props\r\n}: ComboboxChipRemoveProps) {\r\n return (\r\n <BadgeButton\r\n className={cn(\"text-fg-quaternary\", className)}\r\n render={(\r\n <ComboboxChipRemovePrimitive\r\n {...props}\r\n />\r\n )}\r\n />\r\n )\r\n}\r\n\r\ntype ComboboxPopupProps = ComboboxPositionerPrimitiveProps &\r\n ComboboxPopupPrimitiveProps & {\r\n container?: React.ComponentProps<typeof ComboboxPortal>[\"container\"]\r\n }\r\n\r\nfunction ComboboxPopup({\r\n className,\r\n align = \"start\",\r\n sideOffset = 4,\r\n container,\r\n initialFocus,\r\n finalFocus,\r\n style,\r\n children,\r\n ...props\r\n}: ComboboxPopupProps) {\r\n return (\r\n <ComboboxPortalPrimitive container={container}>\r\n <ComboboxPositionerPrimitive\r\n align={align}\r\n className=\"isolate z-50\"\r\n sideOffset={sideOffset}\r\n {...props}\r\n >\r\n <ComboboxPopupPrimitive\r\n className={cn(\r\n \"group/combobox-popup bg-bg-primary text-text-primary max-h-(--available-height) w-72 max-w-(--available-width) origin-(--transform-origin) rounded-md border border-border-primary shadow-md outline-hidden\",\r\n className,\r\n )}\r\n finalFocus={finalFocus}\r\n initialFocus={initialFocus}\r\n style={style}\r\n >\r\n <ComboboxHighlight>\r\n {children}\r\n </ComboboxHighlight>\r\n </ComboboxPopupPrimitive>\r\n </ComboboxPositionerPrimitive>\r\n </ComboboxPortalPrimitive>\r\n )\r\n}\r\n\r\ntype ComboboxPortalProps = ComboboxPortalPrimitiveProps\r\n\r\nfunction ComboboxPortal(props: ComboboxPortalProps) {\r\n return <ComboboxPortalPrimitive {...props} />\r\n}\r\n\r\ntype ComboboxPositionerProps = ComboboxPositionerPrimitiveProps\r\n\r\nfunction ComboboxPositioner(props: ComboboxPositionerProps) {\r\n return <ComboboxPositionerPrimitive {...props} />\r\n}\r\n\r\ntype ComboboxBackdropProps = ComboboxBackdropPrimitiveProps\r\n\r\nfunction ComboboxBackdrop(props: ComboboxBackdropProps) {\r\n const { className, ...rest } = props\r\n\r\n return <ComboboxBackdropPrimitive\r\n className={cn(\"bg-black/30\", className)}\r\n {...rest}\r\n />\r\n}\r\n\r\ntype ComboboxStatusProps = ComboboxStatusPrimitiveProps\r\n\r\nfunction ComboboxStatus({\r\n className,\r\n status,\r\n ...props\r\n}: Omit<ComboboxStatusProps, \"children\"> & {\r\n status?: \"empty\" | \"pending\" | null\r\n}) {\r\n const { inputValue } = useCombobox()\r\n\r\n const trimmedInputValue = inputValue?.toString().trim()\r\n\r\n const getText = () => {\r\n if (status === \"empty\" && trimmedInputValue)\r\n return `No matches for \"${trimmedInputValue}\".`\r\n\r\n if (status === \"empty\" && !trimmedInputValue)\r\n return \"No results.\"\r\n\r\n if (status === \"pending\")\r\n return (\r\n <>\r\n <Loader2Icon className=\"animate-spin size-4\" />\r\n <span>\r\n Searching...\r\n </span>\r\n </>\r\n )\r\n\r\n return null\r\n }\r\n\r\n const text = getText()\r\n\r\n return (\r\n <ComboboxStatusPrimitive\r\n className={cn(\r\n \"px-2 py-2.5 text-body-regular-2 text-text-disabled flex items-center gap-2\",\r\n !text && \"hidden\",\r\n className\r\n )}\r\n {...props}\r\n >\r\n {text}\r\n </ComboboxStatusPrimitive>\r\n )\r\n}\r\n\r\ntype ComboboxLoadingProps = React.ComponentProps<\"div\">\r\n\r\ntype ComboboxEmptyProps = ComboboxEmptyPrimitiveProps\r\n\r\nfunction ComboboxEmpty({ className, ...props }: ComboboxEmptyProps) {\r\n return <ComboboxEmptyPrimitive\r\n className={cn(\"px-3 py-2 text-body-regular-2 text-text-secondary\", className)}\r\n {...props}\r\n />\r\n}\r\n\r\ntype ComboboxListProps = Omit<ComboboxListPrimitiveProps, \"children\"> & {\r\n children: React.ReactNode | ((item: any, index: number, itemsLength: number) => React.ReactNode)\r\n}\r\n\r\nfunction ComboboxList({\r\n className,\r\n children,\r\n ...props\r\n}: ComboboxListProps) {\r\n const items = useFilteredItems()\r\n\r\n return (\r\n <ScrollArea\r\n size=\"sm\"\r\n viewportRender={(\r\n <ComboboxListPrimitive\r\n className={cn(\"max-h-[min(calc(--spacing(72)---spacing(9)),calc(var(--available-height)---spacing(9)))] flex flex-col p-1 focus-visible:outline-none data-[empty]:hidden\", className)}\r\n {...props}\r\n >\r\n {\r\n typeof children === \"function\"\r\n ? (item, index) => (\r\n children(item, index, items.length)\r\n )\r\n : children\r\n }\r\n </ComboboxListPrimitive>\r\n )}\r\n />\r\n )\r\n}\r\n\r\ntype ComboboxHighlightProps = ComboboxHighlightPrimitiveProps\r\n\r\nfunction ComboboxHighlight(props: ComboboxHighlightProps) {\r\n const { className, ...rest } = props\r\n\r\n return (\r\n <ComboboxHighlightPrimitive\r\n className={cn(\"absolute inset-0 bg-bg-primary-hover\", className)}\r\n {...rest}\r\n />\r\n )\r\n}\r\n\r\ntype ComboboxHighlightItemProps = ComboboxHighlightItemPrimitiveProps\r\n\r\nfunction ComboboxHighlightItem(props: ComboboxHighlightItemProps) {\r\n return <ComboboxHighlightItemPrimitive {...props} />\r\n}\r\n\r\ntype ComboboxRowProps = ComboboxRowPrimitiveProps\r\n\r\nfunction ComboboxRow(props: ComboboxRowProps) {\r\n const { className, ...rest } = props\r\n\r\n return <ComboboxRowPrimitive\r\n className={cn(\"group/combobox-row\", className)}\r\n {...rest}\r\n />\r\n}\r\n\r\ntype ComboboxItemProps = ComboboxItemPrimitiveProps & {\r\n indicator?: \"check-circle\" | \"checkbox\"\r\n}\r\n\r\nfunction ComboboxItem({\r\n className,\r\n children,\r\n indicator = \"check-circle\",\r\n ...props\r\n}: ComboboxItemProps) {\r\n const { disabled } = props\r\n\r\n return (\r\n <ComboboxHighlightItem\r\n activeClassName=\"bg-bg-primary-hover rounded-md\"\r\n disabled={disabled}\r\n >\r\n <ComboboxItemPrimitive\r\n data-indicator={indicator}\r\n className={cn(\r\n \"group/combobox-item relative grid grid-cols-[auto_1fr] items-center gap-x-2 my-px p-xp-md cursor-default outline-none select-none [[data-indicator=check-circle][data-selected]]:pr-8 data-[indicator=checkbox]:pl-8\",\r\n className,\r\n )}\r\n {...props}\r\n >\r\n {children}\r\n <ComboboxItemIndicator\r\n className=\"absolute group-data-[indicator=check-circle]/combobox-item:right-2 group-data-[indicator=checkbox]/combobox-item:left-2\"\r\n keepMounted={indicator === \"checkbox\"}\r\n render={(props, state) => (\r\n <span {...props}>\r\n {indicator === \"check-circle\" && (\r\n <CheckCircle2Icon className=\"size-4 text-fg-brand-primary shrink-0\" />\r\n )}\r\n\r\n {indicator === \"checkbox\" && (\r\n <Checkbox checked={state.selected} />\r\n )}\r\n </span>\r\n )}\r\n />\r\n </ComboboxItemPrimitive>\r\n </ComboboxHighlightItem>\r\n )\r\n}\r\n\r\ntype ComboboxItemTitleProps = React.ComponentProps<\"span\">\r\n\r\nfunction ComboboxItemTitle({\r\n className,\r\n ...props\r\n}: ComboboxItemTitleProps) {\r\n return (\r\n <span\r\n data-slot=\"combobox-item-title\"\r\n className={cn(\r\n \"col-start-2 text-body-medium-3 text-text-primary truncate row-span-2 group-has-[[data-slot=combobox-item-description]]/combobox-item:row-span-1\",\r\n className\r\n )}\r\n {...props}\r\n />\r\n )\r\n}\r\n\r\ntype ComboboxItemDescriptionProps = React.ComponentProps<\"span\">\r\n\r\nfunction ComboboxItemDescription({\r\n className,\r\n ...props\r\n}: ComboboxItemDescriptionProps) {\r\n return (\r\n <span\r\n data-slot=\"combobox-item-description\"\r\n className={cn(\r\n \"col-start-2 text-body-regular-3 text-text-secondary truncate\",\r\n className\r\n )}\r\n {...props}\r\n />\r\n )\r\n}\r\n\r\nfunction ComboboxItemIcon({ className, ...props }: React.ComponentProps<\"div\">) {\r\n return (\r\n <div\r\n data-slot=\"combobox-item-icon\"\r\n className={cn(\r\n \"row-span-2 col-start-1 flex items-center justify-center size-6 rounded-md bg-bg-brand-solid text-fg-white shrink-0 [&_svg]:size-3.5\",\r\n className\r\n )}\r\n {...props}\r\n />\r\n )\r\n}\r\n\r\ntype ComboboxItemAvatarProps = React.ComponentProps<typeof Avatar> & {\r\n src?: string\r\n imageSrc?: string\r\n imageAlt?: string\r\n avatarClassName?: string\r\n fallbackText?: string\r\n}\r\n\r\nfunction ComboboxItemAvatar({\r\n src,\r\n imageSrc,\r\n className,\r\n avatarClassName,\r\n imageAlt,\r\n fallbackText,\r\n children,\r\n ...props\r\n}: ComboboxItemAvatarProps) {\r\n const finalSrc = src ?? imageSrc\r\n\r\n return (\r\n <div\r\n data-slot=\"combobox-item-avatar\"\r\n className={cn(\r\n \"row-span-2 col-start-1 size-6 rounded-full overflow-hidden shrink-0\",\r\n className\r\n )}\r\n >\r\n <Avatar\r\n className={cn(\"size-full shrink-0\", avatarClassName)}\r\n {...props}\r\n >\r\n <AvatarImage alt={imageAlt} src={finalSrc} />\r\n <AvatarFallback className=\"flex aspect-square size-full items-center justify-center bg-bg-tertiary text-label-semibold-2 text-text-quaternary\">\r\n {fallbackText ?? children}\r\n </AvatarFallback>\r\n </Avatar>\r\n </div>\r\n )\r\n}\r\n\r\ntype ComboboxItemIndicatorProps = ComboboxItemIndicatorPrimitiveProps\r\n\r\nfunction ComboboxItemIndicator(props: ComboboxItemIndicatorProps) {\r\n return (\r\n <ComboboxItemIndicatorPrimitive {...props} />\r\n )\r\n}\r\n\r\ntype ComboboxSeparatorProps = ComboboxSeparatorPrimitiveProps\r\n\r\nfunction ComboboxSeparator(props: ComboboxSeparatorProps) {\r\n const { className, ...rest } = props\r\n\r\n return <ComboboxSeparatorPrimitive\r\n className={cn(\"my-1 h-px bg-border-primary\", className)}\r\n {...rest}\r\n />\r\n}\r\n\r\ntype ComboboxGroupProps = ComboboxGroupPrimitiveProps\r\n\r\nfunction ComboboxGroup(props: ComboboxGroupProps) {\r\n const { className, ...rest } = props\r\n\r\n return <ComboboxGroupPrimitive\r\n className={cn(\"py-1\", className)}\r\n {...rest}\r\n />\r\n}\r\n\r\ntype ComboboxGroupLabelProps = ComboboxGroupLabelPrimitiveProps\r\n\r\nfunction ComboboxGroupLabel(props: ComboboxGroupLabelProps) {\r\n const { className, ...rest } = props\r\n\r\n return <ComboboxGroupLabelPrimitive\r\n className={cn(\"px-3 py-1 text-body-semibold-sm text-text-secondary\", className)}\r\n {...rest}\r\n />\r\n}\r\n\r\ntype ComboboxCollectionProps = ComboboxCollectionPrimitiveProps\r\n\r\nfunction ComboboxCollection(props: ComboboxCollectionProps) {\r\n return <ComboboxCollectionPrimitive {...props} />\r\n}\r\n\r\ntype ComboboxArrowProps = ComboboxArrowPrimitiveProps\r\n\r\nfunction ComboboxArrow(props: ComboboxArrowProps) {\r\n const { className, ...rest } = props\r\n\r\n return <ComboboxArrowPrimitive\r\n className={cn(\"fill-bg-primary\", className)}\r\n {...rest}\r\n />\r\n}\r\n\r\nfunction ComboboxInfiniteScroll({\r\n hasMore,\r\n threshold = 0.5,\r\n ...props\r\n}: Omit<React.ComponentProps<typeof InfiniteScroll>, \"children\">) {\r\n return (\r\n <InfiniteScroll\r\n hasMore={hasMore}\r\n threshold={threshold}\r\n {...props}\r\n >\r\n {hasMore && (\r\n <div className=\"px-2 py-2.5 text-body-regular-2 text-text-disabled flex items-center gap-2\">\r\n <Loader2Icon className=\"animate-spin size-4\" />\r\n <span>\r\n Loading more...\r\n </span>\r\n </div>\r\n )}\r\n </InfiniteScroll>\r\n )\r\n}\r\n\r\nexport {\r\n Combobox,\r\n ComboboxArrow,\r\n type ComboboxArrowProps,\r\n ComboboxBackdrop,\r\n type ComboboxBackdropProps,\r\n ComboboxChip,\r\n type ComboboxChipProps,\r\n ComboboxChipRemove,\r\n type ComboboxChipRemoveProps,\r\n ComboboxChips,\r\n type ComboboxChipsProps,\r\n ComboboxClear,\r\n type ComboboxClearProps,\r\n ComboboxCollection,\r\n type ComboboxCollectionProps,\r\n ComboboxPopup,\r\n type ComboboxPopupProps,\r\n ComboboxEmpty,\r\n type ComboboxEmptyProps,\r\n ComboboxGroup,\r\n ComboboxGroupLabel,\r\n type ComboboxGroupLabelProps,\r\n type ComboboxGroupProps,\r\n ComboboxHighlight,\r\n ComboboxHighlightItem,\r\n type ComboboxHighlightItemProps,\r\n type ComboboxHighlightProps,\r\n ComboboxIcon,\r\n type ComboboxIconProps,\r\n ComboboxInfiniteScroll,\r\n ComboboxInput,\r\n ComboboxInputFilter,\r\n ComboboxInputGroup,\r\n type ComboboxInputGroupProps,\r\n type ComboboxInputProps,\r\n ComboboxItem,\r\n ComboboxItemTitle,\r\n type ComboboxItemTitleProps,\r\n ComboboxItemDescription,\r\n type ComboboxItemDescriptionProps,\r\n ComboboxItemIcon,\r\n ComboboxItemAvatar,\r\n type ComboboxItemAvatarProps,\r\n ComboboxItemIndicator,\r\n type ComboboxItemIndicatorProps,\r\n type ComboboxItemProps,\r\n ComboboxLabel,\r\n type ComboboxLabelProps,\r\n ComboboxList,\r\n type ComboboxListProps,\r\n type ComboboxLoadingProps,\r\n ComboboxPortal,\r\n type ComboboxPortalProps,\r\n ComboboxPositioner,\r\n type ComboboxPositionerProps,\r\n type ComboboxProps,\r\n ComboboxRow,\r\n type ComboboxRowProps,\r\n ComboboxSeparator,\r\n type ComboboxSeparatorProps,\r\n ComboboxStatus,\r\n type ComboboxStatusProps,\r\n ComboboxTrigger,\r\n type ComboboxTriggerProps,\r\n ComboboxValue,\r\n type ComboboxValueProps\r\n}"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import {a,b,c as c$1,d,e,g,f as f$1}from'./chunk-6OC5NZB6.js';import {cn}from'@xploreu/lib/cn';import {jsx,jsxs}from'react/jsx-runtime';function c({className:t,variant:a$1="default",...i}){return jsx(a,{className:cn("group/tabs flex flex-col gap-2",t),"data-variant":a$1,...i})}function m({className:t,highlightClassName:a,...i}){return jsx(b,{className:cn("absolute z-0","group-data-[variant=default]/tabs:inset-0 group-data-[variant=default]/tabs:rounded-lg group-data-[variant=default]/tabs:bg-bg-primary-solid","group-data-[variant=underline]/tabs:bottom-0 group-data-[variant=underline]/tabs:h-0.5 group-data-[variant=underline]/tabs:w-full group-data-[variant=underline]/tabs:rounded-none group-data-[variant=underline]/tabs:bg-fg-brand-secondary","group-data-[variant=attract]/tabs:bottom-0 group-data-[variant=attract]/tabs:h-[3px] group-data-[variant=attract]/tabs:w-full group-data-[variant=attract]/tabs:rounded-t-full group-data-[variant=attract]/tabs:bg-gradient-to-r group-data-[variant=attract]/tabs:from-[var(--color-brand-light-500)] group-data-[variant=attract]/tabs:to-[var(--color-brand-light-700)]","group-data-[variant=topbar]/tabs:bottom-0 group-data-[variant=topbar]/tabs:h-[3px] group-data-[variant=topbar]/tabs:w-full group-data-[variant=topbar]/tabs:rounded-t-full group-data-[variant=topbar]/tabs:bg-[linear-gradient(90deg,#2F7EF0_0%,#FA0805_100%)]","group-data-[variant=segment]/tabs:inset-0 group-data-[variant=segment]/tabs:rounded-lg group-data-[variant=segment]/tabs:bg-bg-brand-primary group-data-[variant=segment]/tabs:data-[value=declined]:bg-bg-error-primary group-data-[variant=segment]/tabs:data-[value=rejected]:bg-bg-error-primary","group-data-[variant=solid]/tabs:inset-0 group-data-[variant=solid]/tabs:rounded-lg group-data-[variant=solid]/tabs:bg-gradient-buttons-gradient-blue group-data-[variant=solid]/tabs:shadow-xp-md","group-data-[variant=filter]/tabs:inset-0 group-data-[variant=filter]/tabs:rounded-xp-card-base group-data-[variant=filter]/tabs:border group-data-[variant=filter]/tabs:border-border-brand group-data-[variant=filter]/tabs:bg-bg-brand-primary",a),children:jsx(c$1,{className:cn("inline-flex w-fit items-center justify-center","group-data-[variant=default]/tabs:bg-bg-tertiary group-data-[variant=default]/tabs:rounded-lg group-data-[variant=default]/tabs:p-0.5 group-data-[variant=default]/tabs:gap-1 group-data-[variant=default]/tabs:border group-data-[variant=default]/tabs:border-border-primary","group-data-[variant=underline]/tabs:gap-7","group-data-[variant=attract]/tabs:w-full group-data-[variant=attract]/tabs:justify-start group-data-[variant=attract]/tabs:gap-6 group-data-[variant=attract]/tabs:border-b group-data-[variant=attract]/tabs:border-border-secondary group-data-[variant=attract]/tabs:px-6","group-data-[variant=topbar]/tabs:w-full group-data-[variant=topbar]/tabs:justify-start group-data-[variant=topbar]/tabs:gap-6 group-data-[variant=topbar]/tabs:border-b group-data-[variant=topbar]/tabs:border-border-secondary group-data-[variant=topbar]/tabs:px-6","group-data-[variant=segment]/tabs:bg-bg-primary group-data-[variant=segment]/tabs:rounded-[10px] group-data-[variant=segment]/tabs:p-0.5 group-data-[variant=segment]/tabs:gap-1 group-data-[variant=segment]/tabs:border group-data-[variant=segment]/tabs:border-border-primary group-data-[variant=segment]/tabs:shadow-xp-xs","group-data-[variant=solid]/tabs:bg-bg-primary group-data-[variant=solid]/tabs:rounded-[10px] group-data-[variant=solid]/tabs:p-0.5 group-data-[variant=solid]/tabs:gap-0.5 group-data-[variant=solid]/tabs:border group-data-[variant=solid]/tabs:border-border-primary","group-data-[variant=filter]/tabs:gap-2",t),...i})})}function f({className:t,count:a,children:i,...s}){return jsx(d,{value:s.value,className:"flex-1 group-data-[variant=attract]/tabs:flex-none group-data-[variant=topbar]/tabs:flex-none group-data-[variant=segment]/tabs:flex-none group-data-[variant=solid]/tabs:flex-none group-data-[variant=filter]/tabs:flex-none",children:jsxs(e,{className:cn("group/tabs-trigger data-[active=true]:text-text-brand-tertiary focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:outline-ring text-text-primary inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md w-full text-label-semibold-2 whitespace-nowrap transition-colors duration-300 ease-in-out focus-visible:ring-[3px] focus-visible:outline-1 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4","group-data-[variant=default]/tabs:px-3 group-data-[variant=default]/tabs:py-2 group-data-[variant=default]/tabs:rounded-lg group-data-[variant=default]/tabs:text-text-quaternary hover:group-data-[variant=default]/tabs:text-text-secondary group-data-[variant=default]/tabs:data-[active=true]:text-text-white","group-data-[variant=underline]/tabs:h-8.5 group-data-[variant=underline]/tabs:px-3 hover:group-data-[variant=underline]/tabs:text-text-brand-secondary","group-data-[variant=attract]/tabs:h-auto group-data-[variant=attract]/tabs:py-3 group-data-[variant=attract]/tabs:px-0 group-data-[variant=attract]/tabs:gap-2 group-data-[variant=attract]/tabs:rounded-none group-data-[variant=attract]/tabs:text-label-medium-2 group-data-[variant=attract]/tabs:text-text-quaternary hover:group-data-[variant=attract]/tabs:text-text-secondary group-data-[variant=attract]/tabs:data-[active=true]:text-text-brand-tertiary group-data-[variant=attract]/tabs:data-[active=true]:text-label-semibold-2","group-data-[variant=topbar]/tabs:h-9 group-data-[variant=topbar]/tabs:px-0 group-data-[variant=topbar]/tabs:gap-2 group-data-[variant=topbar]/tabs:rounded-none group-data-[variant=topbar]/tabs:text-body-regular-3 group-data-[variant=topbar]/tabs:text-text-quaternary hover:group-data-[variant=topbar]/tabs:text-text-secondary group-data-[variant=topbar]/tabs:data-[active=true]:text-text-primary group-data-[variant=topbar]/tabs:data-[active=true]:text-label-semibold-3","group-data-[variant=segment]/tabs:h-9 group-data-[variant=segment]/tabs:px-3 group-data-[variant=segment]/tabs:py-2 group-data-[variant=segment]/tabs:gap-1 group-data-[variant=segment]/tabs:rounded-lg group-data-[variant=segment]/tabs:text-label-semibold-3 group-data-[variant=segment]/tabs:text-text-quaternary hover:group-data-[variant=segment]/tabs:text-text-secondary group-data-[variant=segment]/tabs:data-[active=true]:text-text-brand-secondary-alt group-data-[variant=segment]/tabs:data-[active=true]:data-[value=declined]:text-text-error-primary group-data-[variant=segment]/tabs:data-[active=true]:data-[value=rejected]:text-text-error-primary","group-data-[variant=solid]/tabs:h-9 group-data-[variant=solid]/tabs:px-3.5 group-data-[variant=solid]/tabs:py-2 group-data-[variant=solid]/tabs:rounded-lg group-data-[variant=solid]/tabs:text-label-semibold-3 group-data-[variant=solid]/tabs:text-text-tertiary hover:group-data-[variant=solid]/tabs:text-text-secondary group-data-[variant=solid]/tabs:data-[active=true]:text-text-primary-on-brand","group-data-[variant=filter]/tabs:h-9 group-data-[variant=filter]/tabs:px-3 group-data-[variant=filter]/tabs:gap-2 group-data-[variant=filter]/tabs:rounded-xp-card-base group-data-[variant=filter]/tabs:border group-data-[variant=filter]/tabs:border-border-primary group-data-[variant=filter]/tabs:bg-transparent group-data-[variant=filter]/tabs:text-body-medium-3 group-data-[variant=filter]/tabs:text-text-secondary group-data-[variant=filter]/tabs:shadow-xp-xs hover:group-data-[variant=filter]/tabs:bg-bg-primary-hover group-data-[variant=filter]/tabs:data-[active=true]:border-transparent group-data-[variant=filter]/tabs:data-[active=true]:text-text-brand-secondary hover:group-data-[variant=filter]/tabs:data-[active=true]:bg-transparent group-data-[variant=filter]/tabs:[&_svg]:size-3.5 group-data-[variant=filter]/tabs:[&_svg]:text-fg-tertiary group-data-[variant=filter]/tabs:data-[active=true]:[&_svg]:text-fg-brand-primary",t),...s,children:[i,a!==void 0&&a!==0&&a!=="0"&&jsx("span",{className:cn("inline-flex items-center justify-center rounded-xp-card-base-xs px-0.5 py-px min-w-4 text-label-medium-4 transition-colors duration-300","group-data-[variant=default]/tabs:bg-bg-quaternary group-data-[variant=default]/tabs:text-text-quaternary group-data-[variant=default]/tabs:group-data-[active=true]/tabs-trigger:bg-bg-secondary-solid group-data-[variant=default]/tabs:group-data-[active=true]/tabs-trigger:text-text-primary-on-brand","group-data-[variant=underline]/tabs:bg-bg-quaternary group-data-[variant=underline]/tabs:text-text-quaternary group-data-[variant=underline]/tabs:group-data-[active=true]/tabs-trigger:bg-bg-brand-solid group-data-[variant=underline]/tabs:group-data-[active=true]/tabs-trigger:text-text-primary-on-brand","group-data-[variant=attract]/tabs:bg-bg-quaternary group-data-[variant=attract]/tabs:text-text-quaternary group-data-[variant=attract]/tabs:group-data-[active=true]/tabs-trigger:bg-bg-brand-solid group-data-[variant=attract]/tabs:group-data-[active=true]/tabs-trigger:text-text-primary-on-brand","group-data-[variant=topbar]/tabs:bg-bg-quaternary group-data-[variant=topbar]/tabs:text-text-quaternary group-data-[variant=topbar]/tabs:group-data-[active=true]/tabs-trigger:bg-bg-brand-solid group-data-[variant=topbar]/tabs:group-data-[active=true]/tabs-trigger:text-text-primary-on-brand","group-data-[variant=segment]/tabs:bg-bg-quaternary group-data-[variant=segment]/tabs:text-text-quaternary group-data-[variant=segment]/tabs:group-data-[active=true]/tabs-trigger:bg-bg-brand-solid group-data-[variant=segment]/tabs:group-data-[active=true]/tabs-trigger:text-text-white group-data-[variant=segment]/tabs:group-data-[active=true]/tabs-trigger:group-data-[value=declined]/tabs-trigger:bg-bg-error-solid group-data-[variant=segment]/tabs:group-data-[active=true]/tabs-trigger:group-data-[value=rejected]/tabs-trigger:bg-bg-error-solid","group-data-[variant=solid]/tabs:bg-bg-quaternary group-data-[variant=solid]/tabs:text-text-quaternary group-data-[variant=solid]/tabs:group-data-[active=true]/tabs-trigger:bg-bg-secondary-solid group-data-[variant=solid]/tabs:group-data-[active=true]/tabs-trigger:text-text-primary-on-brand","group-data-[variant=filter]/tabs:bg-bg-brand-solid group-data-[variant=filter]/tabs:text-text-primary-on-brand"),children:a})]})})}function y(t){return jsx(g,{...t})}function P({className:t,...a}){return jsx(f$1,{className:cn("flex-1 outline-none",t),...a})}export{c as a,m as b,f as c,y as d,P as e};//# sourceMappingURL=chunk-XZN4XT6V.js.map
|
|
2
|
+
//# sourceMappingURL=chunk-XZN4XT6V.js.map
|