@xploreu/components 0.4.19 → 0.4.21
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-IIFWJ2BW.js → chunk-22HCPCIZ.js} +2 -2
- package/dist/{chunk-IIFWJ2BW.js.map → chunk-22HCPCIZ.js.map} +1 -1
- package/dist/{chunk-3C5RPQNM.js → chunk-2AOIAHWJ.js} +2 -2
- package/dist/{chunk-3C5RPQNM.js.map → chunk-2AOIAHWJ.js.map} +1 -1
- package/dist/chunk-2HZWQU6H.js +2 -0
- package/dist/{chunk-IJOZ7E2J.js.map → chunk-2HZWQU6H.js.map} +1 -1
- package/dist/{chunk-BSWTMWP5.js → chunk-3Q6I6MHN.js} +2 -2
- package/dist/{chunk-BSWTMWP5.js.map → chunk-3Q6I6MHN.js.map} +1 -1
- package/dist/chunk-6RI2ROVI.js +2 -0
- package/dist/chunk-6RI2ROVI.js.map +1 -0
- package/dist/{chunk-2DT7JWOY.js → chunk-7LXFJQSH.js} +2 -2
- package/dist/{chunk-2DT7JWOY.js.map → chunk-7LXFJQSH.js.map} +1 -1
- package/dist/{chunk-IYWIRZKV.js → chunk-AA2XSKFM.js} +2 -2
- package/dist/{chunk-IYWIRZKV.js.map → chunk-AA2XSKFM.js.map} +1 -1
- package/dist/chunk-CQEBQK7U.js +2 -0
- package/dist/chunk-CQEBQK7U.js.map +1 -0
- package/dist/chunk-DUSAF7E7.js +2 -0
- package/dist/chunk-DUSAF7E7.js.map +1 -0
- package/dist/{chunk-OK4K7DSW.js → chunk-GI2M7Q4F.js} +2 -2
- package/dist/{chunk-OK4K7DSW.js.map → chunk-GI2M7Q4F.js.map} +1 -1
- package/dist/{chunk-PU426AFH.js → chunk-GUQAFHTY.js} +2 -2
- package/dist/{chunk-PU426AFH.js.map → chunk-GUQAFHTY.js.map} +1 -1
- package/dist/chunk-HVR2PWQX.js +2 -0
- package/dist/chunk-HVR2PWQX.js.map +1 -0
- package/dist/{chunk-F2QUDOBO.js → chunk-IF2CKGBN.js} +2 -2
- package/dist/{chunk-F2QUDOBO.js.map → chunk-IF2CKGBN.js.map} +1 -1
- package/dist/chunk-JONVMB6C.js +2 -0
- package/dist/chunk-JONVMB6C.js.map +1 -0
- package/dist/{chunk-FWY7JNT2.js → chunk-RMHUCROW.js} +2 -2
- package/dist/{chunk-FWY7JNT2.js.map → chunk-RMHUCROW.js.map} +1 -1
- package/dist/chunk-U3IMR5VI.js +2 -0
- package/dist/{chunk-LTSUNU7E.js.map → chunk-U3IMR5VI.js.map} +1 -1
- package/dist/composites/combobox-chip-outside.d.ts +3 -0
- package/dist/composites/combobox-chip-outside.js +1 -1
- package/dist/composites/combobox-chip.d.ts +3 -0
- package/dist/composites/combobox-chip.js +1 -1
- package/dist/composites/combobox-simple.d.ts +3 -0
- package/dist/composites/combobox-simple.js +1 -1
- package/dist/composites/filter-combobox.d.ts +3 -0
- package/dist/composites/filter-combobox.js +1 -1
- package/dist/composites/index.d.ts +3 -0
- package/dist/composites/index.js +1 -1
- package/dist/composites/phone-input.js +1 -1
- package/dist/composites/profile-avatar.d.ts +5 -4
- package/dist/composites/profile-avatar.js +1 -1
- package/dist/form/form-input.js +1 -1
- package/dist/form/index.js +1 -1
- package/dist/icons/index.js +1 -1
- package/dist/primitives/avatar.d.ts +11 -0
- package/dist/primitives/avatar.js +2 -0
- package/dist/primitives/avatar.js.map +1 -0
- package/dist/primitives/dialog.js +1 -1
- package/dist/primitives/index.d.ts +2 -0
- package/dist/primitives/index.js +1 -1
- package/dist/primitives/sheet.js +1 -1
- package/dist/ui/avatar.d.ts +17 -0
- package/dist/ui/avatar.js +2 -0
- package/dist/ui/avatar.js.map +1 -0
- package/dist/ui/badge.d.ts +3 -3
- package/dist/ui/button.d.ts +1 -1
- package/dist/ui/combobox.d.ts +13 -1
- package/dist/ui/combobox.js +1 -1
- package/dist/ui/date-multiple-picker.js +1 -1
- package/dist/ui/date-picker.js +1 -1
- package/dist/ui/date-range-picker.js +1 -1
- package/dist/ui/dialog.js +1 -1
- package/dist/ui/index.d.ts +5 -2
- package/dist/ui/index.js +1 -1
- package/dist/ui/input.d.ts +1 -1
- package/dist/ui/input.js +1 -1
- package/dist/ui/pagination.js +1 -1
- package/dist/ui/sheet.js +1 -1
- package/dist/ui/table.js +1 -1
- package/dist/ui/toast.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-6AKSAK5F.js +0 -2
- package/dist/chunk-6AKSAK5F.js.map +0 -1
- package/dist/chunk-C7KUNTTO.js +0 -2
- package/dist/chunk-C7KUNTTO.js.map +0 -1
- package/dist/chunk-GNQKITNA.js +0 -2
- package/dist/chunk-GNQKITNA.js.map +0 -1
- package/dist/chunk-IJOZ7E2J.js +0 -2
- package/dist/chunk-LTSUNU7E.js +0 -2
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {a,b,i,m,q,s,w,x,
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import {a,b,i,m,q,s,w,x,H}from'./chunk-DUSAF7E7.js';import {a as a$1}from'./chunk-JH6RZ3QH.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';function B({items:t,value:f,defaultValue:g,onValueChange:d,placeholder:I="Select",icon:l,container:S,isPending:y,className:P,triggerClassName:V,contentClassName:v,disabled:N,size:h="md",infiniteScroll:R}){return jsxs(a,{items:t,value:f,defaultValue:g,onValueChange:d,isItemEqualToValue:(e,T)=>e.value===T.value,disabled:N,children:[jsxs(b,{className:cn(a$1({size:h}),"group flex cursor-pointer items-center gap-2 pr-3 text-left",V,P),children:[l&&jsx("span",{className:"size-4.5 shrink-0 text-fg-quaternary",children:l}),jsx("span",{className:"flex-1 truncate",children:jsx(i,{children:e=>jsx("span",{className:e?"text-text-primary":"text-text-placeholder",children:e?.label??I})})}),jsx(ChevronDownIcon,{className:"size-4 shrink-0 text-fg-quaternary transition-transform group-data-[popup-open]:rotate-180"})]}),jsxs(m,{container:S,className:cn("w-72",v),align:"start",sideOffset:8,children:[jsx(q,{status:y||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,{...R})]})]})]})}export{B as a};//# sourceMappingURL=chunk-22HCPCIZ.js.map
|
|
2
|
+
//# sourceMappingURL=chunk-22HCPCIZ.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/composites/combobox-simple.tsx"],"names":["ComboboxSimple","items","value","defaultValue","onValueChange","placeholder","icon","container","isPending","className","triggerClassName","contentClassName","disabled","size","infiniteScroll","jsxs","Combobox","a","b","ComboboxTrigger","cn","inputVariants","jsx","ComboboxValue","item","ChevronDownIcon","ComboboxPopup","ComboboxStatus","ComboboxList","ComboboxItem","ComboboxItemTitle","ComboboxInfiniteScroll"],"mappings":"mQA8CA,SAASA,CAAAA,CAAe,CACtB,KAAA,CAAAC,CAAAA,CACA,MAAAC,CAAAA,CACA,YAAA,CAAAC,EACA,aAAA,CAAAC,CAAAA,CACA,YAAAC,CAAAA,CAAc,QAAA,CACd,KAAAC,CAAAA,CACA,SAAA,CAAAC,EACA,SAAA,CAAAC,CAAAA,CACA,UAAAC,CAAAA,CACA,gBAAA,CAAAC,EACA,gBAAA,CAAAC,CAAAA,CACA,SAAAC,CAAAA,CACA,IAAA,CAAAC,EAAO,IAAA,CACP,cAAA,CAAAC,CACF,CAAA,CAAwB,CACtB,OACEC,IAAAA,CAACC,CAAAA,CAAA,CACC,KAAA,CAAOf,CAAAA,CACP,MAAOC,CAAAA,CACP,YAAA,CAAcC,EACd,aAAA,CAAeC,CAAAA,CACf,mBAAoB,CAACa,CAAAA,CAAGC,IAAMD,CAAAA,CAAE,KAAA,GAAUC,EAAE,KAAA,CAC5C,QAAA,CAAUN,EAEV,QAAA,CAAA,CAAAG,IAAAA,CAACI,EAAA,CACC,SAAA,CAAWC,GACTC,GAAAA,CAAc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obox-simple.tsx"],"names":["ComboboxSimple","items","value","defaultValue","onValueChange","placeholder","icon","container","isPending","className","triggerClassName","contentClassName","disabled","size","infiniteScroll","jsxs","Combobox","a","b","ComboboxTrigger","cn","inputVariants","jsx","ComboboxValue","item","ChevronDownIcon","ComboboxPopup","ComboboxStatus","ComboboxList","ComboboxItem","ComboboxItemTitle","ComboboxInfiniteScroll"],"mappings":"mQA8CA,SAASA,CAAAA,CAAe,CACtB,KAAA,CAAAC,CAAAA,CACA,MAAAC,CAAAA,CACA,YAAA,CAAAC,EACA,aAAA,CAAAC,CAAAA,CACA,YAAAC,CAAAA,CAAc,QAAA,CACd,KAAAC,CAAAA,CACA,SAAA,CAAAC,EACA,SAAA,CAAAC,CAAAA,CACA,UAAAC,CAAAA,CACA,gBAAA,CAAAC,EACA,gBAAA,CAAAC,CAAAA,CACA,SAAAC,CAAAA,CACA,IAAA,CAAAC,EAAO,IAAA,CACP,cAAA,CAAAC,CACF,CAAA,CAAwB,CACtB,OACEC,IAAAA,CAACC,CAAAA,CAAA,CACC,KAAA,CAAOf,CAAAA,CACP,MAAOC,CAAAA,CACP,YAAA,CAAcC,EACd,aAAA,CAAeC,CAAAA,CACf,mBAAoB,CAACa,CAAAA,CAAGC,IAAMD,CAAAA,CAAE,KAAA,GAAUC,EAAE,KAAA,CAC5C,QAAA,CAAUN,EAEV,QAAA,CAAA,CAAAG,IAAAA,CAACI,EAAA,CACC,SAAA,CAAWC,GACTC,GAAAA,CAAc,CAAE,KAAAR,CAAK,CAAC,EACtB,6DAAA,CACAH,CAAAA,CACAD,CACF,CAAA,CAEC,QAAA,CAAA,CAAAH,CAAAA,EACCgB,GAAAA,CAAC,MAAA,CAAA,CAAK,SAAA,CAAU,uCAAwC,QAAA,CAAAhB,CAAAA,CAAK,EAE/DgB,GAAAA,CAAC,MAAA,CAAA,CAAK,UAAU,iBAAA,CACd,QAAA,CAAAA,IAACC,CAAAA,CAAA,CACE,SAACC,CAAAA,EACAF,GAAAA,CAAC,QAAK,SAAA,CAAWE,CAAAA,CAAO,oBAAsB,uBAAA,CAC3C,QAAA,CAAAA,GAAM,KAAA,EAASnB,CAAAA,CAClB,EAEJ,CAAA,CACF,CAAA,CACAiB,IAACG,eAAAA,CAAA,CACC,UAAU,4FAAA,CACZ,CAAA,CAAA,CACF,EAEAV,IAAAA,CAACW,CAAAA,CAAA,CACC,SAAA,CAAWnB,CAAAA,CACX,UAAWa,EAAAA,CAAG,MAAA,CAAQT,CAAgB,CAAA,CACtC,KAAA,CAAM,QACN,UAAA,CAAY,CAAA,CAEZ,UAAAW,GAAAA,CAACK,CAAAA,CAAA,CACC,MAAA,CACEnB,CAAAA,EAAaP,IAAU,MAAA,CACnB,SAAA,CACAA,EAAM,MAAA,GAAW,CAAA,CACf,QACA,IAAA,CAEV,CAAA,CACAc,KAACa,CAAAA,CAAA,CACE,UAAA3B,CAAAA,EAAO,GAAA,CAAKuB,GACXF,GAAAA,CAACO,CAAAA,CAAA,CAA8B,KAAA,CAAOL,CAAAA,CACpC,SAAAF,GAAAA,CAACQ,CAAAA,CAAA,CACE,QAAA,CAAAN,CAAAA,CAAK,MACR,CAAA,CAAA,CAHiBA,CAAAA,CAAK,KAIxB,CACD,CAAA,CACDF,IAACS,CAAAA,CAAA,CAAwB,GAAGjB,CAAAA,CAAgB,CAAA,CAAA,CAC9C,CAAA,CAAA,CACF,CAAA,CAAA,CACF,CAEJ","file":"chunk-22HCPCIZ.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 } from \"../ui/combobox\"\r\nimport {\r\n Combobox,\r\n ComboboxInfiniteScroll,\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\nexport type ComboboxSimpleProps = {\r\n items: ComboboxSimpleItem[] | undefined\r\n value?: ComboboxSimpleItem | null\r\n defaultValue?: ComboboxSimpleItem | null\r\n onValueChange?: (value: ComboboxSimpleItem | null) => void\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 size?: VariantProps<typeof inputVariants>[\"size\"]\r\n infiniteScroll?: React.ComponentProps<typeof ComboboxInfiniteScroll>\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 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}: 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 isItemEqualToValue={(a, b) => a.value === b.value}\r\n disabled={disabled}\r\n >\r\n <ComboboxTrigger\r\n className={cn(\r\n inputVariants({ size }),\r\n \"group flex cursor-pointer items-center gap-2 pr-3 text-left\",\r\n triggerClassName,\r\n className\r\n )}\r\n >\r\n {icon && (\r\n <span className=\"size-4.5 shrink-0 text-fg-quaternary\">{icon}</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=\"size-4 shrink-0 text-fg-quaternary transition-transform group-data-[popup-open]:rotate-180\"\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 <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"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {a,b,c}from'./chunk-2RHSXF3X.js';import {a as a$
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import {a,b,c}from'./chunk-2RHSXF3X.js';import {a as a$1}from'./chunk-UCCQUPMT.js';import {a as a$3}from'./chunk-5ETIHFSE.js';import {a as a$2}from'./chunk-XJTOYNCA.js';import'react';import {InfoIcon}from'lucide-react';import {cn}from'@xploreu/lib/cn';import {jsx,jsxs,Fragment}from'react/jsx-runtime';function E({className:t,...r}){return jsx("div",{className:"relative w-full overflow-x-auto rounded-xl border border-border-primary bg-bg-primary","data-slot":"table-container",children:jsx("table",{className:cn("w-full caption-bottom text-body-regular-2",t),"data-slot":"table",...r})})}function S({className:t,...r}){return jsx("thead",{className:cn("bg-bg-secondary [&_tr]:border-border-tertiary",t),"data-slot":"table-header",...r})}function A({className:t,...r}){return jsx("tbody",{className:cn("[&_tr:last-child]:border-0",t),"data-slot":"table-body",...r})}function j({className:t,...r}){return jsx("tfoot",{className:cn("border-t border-border-primary bg-bg-secondary font-medium [&>tr]:last:border-b-0",t),"data-slot":"table-footer",...r})}function q({className:t,...r}){return jsx("tr",{className:cn("border-b border-border-secondary transition-colors hover:bg-bg-secondary data-[state=selected]:bg-bg-brand-primary/40",t),"data-slot":"table-row",...r})}function B({className:t,align:r,variant:c$1="string",tooltip:n,sortable:o,sortDirection:b$1,onSort:p,children:N,...C}){let s=r||(c$1==="number"?"end":"start"),i=!!(n||o),P=s==="end",m=n?jsxs(a,{children:[jsx(b,{render:jsx("button",{type:"button",className:"inline-flex items-center justify-center text-fg-quaternary hover:text-text-primary"}),children:jsx(InfoIcon,{className:"size-3.5"})}),jsx(c,{side:"top",children:n})]}):null,u=o?jsx("button",{type:"button",onClick:p,className:"inline-flex items-center text-fg-quaternary hover:text-text-primary focus:outline-none","aria-label":"Sort column",children:b$1==="asc"?jsx(a$1,{size:12}):b$1==="desc"?jsx(a$2,{size:12}):jsx(a$3,{size:12})}):null,d=jsx("span",{className:cn("truncate",o&&"cursor-pointer select-none"),onClick:o?p:void 0,children:N});return jsx("th",{className:cn("text-label-bold-3 text-text-tertiary h-10 px-4 py-3 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0",!i&&s==="end"&&"text-right",!i&&s==="start"&&"text-left",!i&&s==="center"&&"text-center",t),"data-slot":"table-head",...C,children:i?jsx("div",{className:"flex w-full items-center justify-between gap-2",children:P?jsxs(Fragment,{children:[jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[m,u]}),jsx("div",{className:"flex items-center shrink-0 justify-end",children:d})]}):jsxs(Fragment,{children:[d,jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[m,u]})]})}):d})}function D({className:t,align:r,variant:c="string",...n}){let o=r||(c==="number"?"end":"start");return jsx("td",{className:cn("text-text-primary px-4 py-3 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0",o==="end"&&"text-right",o==="start"&&"text-left",o==="center"&&"text-center",t),"data-slot":"table-cell",...n})}function O({className:t,...r}){return jsx("caption",{className:cn("text-text-secondary mt-4 text-body-regular-2",t),"data-slot":"table-caption",...r})}export{E as a,S as b,A as c,j as d,q as e,B as f,D as g,O as h};//# sourceMappingURL=chunk-2AOIAHWJ.js.map
|
|
2
|
+
//# sourceMappingURL=chunk-2AOIAHWJ.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/ui/table.tsx"],"names":["Table","className","props","jsx","cn","TableHeader","TableBody","TableFooter","TableRow","TableHead","align","variant","tooltip","sortable","sortDirection","onSort","children","effectiveAlign","hasControls","isEnd","tooltipElement","jsxs","Tooltip","TooltipTrigger","InfoIcon","TooltipPopup","sortElement","sort_ascending_icon_default","sort_descending_icon_default","sort_default_icon_default","titleElement","Fragment","TableCell","TableCaption"],"mappings":"8SAWA,SAASA,CAAAA,CAAM,CAAE,SAAA,CAAAC,CAAAA,CAAW,GAAGC,CAAM,CAAA,CAAkC,CACrE,OACEC,GAAAA,CAAC,KAAA,CAAA,CACC,UAAU,uFAAA,CACV,WAAA,CAAU,iBAAA,CAEV,QAAA,CAAAA,GAAAA,CAAC,OAAA,CAAA,CACC,UAAWC,EAAAA,CAAG,2CAAA,CAA6CH,CAAS,CAAA,CACpE,WAAA,CAAU,QACT,GAAGC,CAAAA,CACN,CAAA,CACF,CAEJ,CAEA,SAASG,EAAY,CAAE,SAAA,CAAAJ,EAAW,GAAGC,CAAM,EAAkC,CAC3E,OACEC,IAAC,OAAA,CAAA,CACC,SAAA,CAAWC,GACT,+CAAA,CACAH,CACF,EACA,WAAA,CAAU,cAAA,CACT,GAAGC,CAAAA,CACN,CAEJ,CAEA,SAASI,CAAAA,CAAU,CAAE,UAAAL,CAAAA,CAAW,GAAGC,CAAM,CAAA,CAAkC,CACzE,OACEC,GAAAA,CAAC,OAAA,CAAA,CACC,SAAA,CAAWC,EAAAA,CAAG,4BAAA,CAA8BH,CAAS,EACrD,WAAA,CAAU,YAAA,CACT,GAAGC,CAAAA,CACN,CAEJ,CAEA,SAASK,CAAAA,CAAY,CAAE,SAAA,CAAAN,CAAAA,CAAW,GAAGC,CAAM,CAAA,CAAkC,CAC3E,OACEC,GAAAA,CAAC,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AAA,CACAM,GACH,CAAA,CAAA,CACF,CAAA,CAEJ,EAEAI,CAAAA,CAEJ,CAEJ,CAOA,SAASE,CAAAA,CAAU,CACjB,UAAA/B,CAAAA,CACA,KAAA,CAAAS,EACA,OAAA,CAAAC,CAAAA,CAAU,SACV,GAAGT,CACL,CAAA,CAAmB,CACjB,IAAMe,CAAAA,CAAiBP,IAAUC,CAAAA,GAAY,QAAA,CAAW,MAAQ,OAAA,CAAA,CAEhE,OACER,IAAC,IAAA,CAAA,CACC,SAAA,CAAWC,GACT,0FAAA,CACAa,CAAAA,GAAmB,OAAS,YAAA,CAC5BA,CAAAA,GAAmB,SAAW,WAAA,CAC9BA,CAAAA,GAAmB,UAAY,aAAA,CAC/BhB,CACF,CAAA,CACA,WAAA,CAAU,YAAA,CACT,GAAGC,EACN,CAEJ,CAEA,SAAS+B,CAAAA,CAAa,CACpB,UAAAhC,CAAAA,CACA,GAAGC,CACL,CAAA,CAAoC,CAClC,OACEC,IAAC,SAAA,CAAA,CACC,SAAA,CAAWC,GAAG,8CAAA,CAAgDH,CAAS,EACvE,WAAA,CAAU,eAAA,CACT,GAAGC,CAAAA,CACN,CAEJ","file":"chunk-3C5RPQNM.js","sourcesContent":["import * as React from \"react\"\r\nimport { InfoIcon } from \"lucide-react\"\r\n\r\nimport { cn } from \"@xploreu/lib/cn\"\r\nimport { SortAscendingIcon, SortDefaultIcon, SortDescendingIcon } from \"../icons\"\r\nimport {\r\n Tooltip,\r\n TooltipPopup,\r\n TooltipTrigger,\r\n} from \"./tooltip\"\r\n\r\nfunction Table({ className, ...props }: React.ComponentProps<\"table\">) {\r\n return (\r\n <div\r\n className=\"relative w-full overflow-x-auto rounded-xl border border-border-primary bg-bg-primary\"\r\n data-slot=\"table-container\"\r\n >\r\n <table\r\n className={cn(\"w-full caption-bottom text-body-regular-2\", className)}\r\n data-slot=\"table\"\r\n {...props}\r\n />\r\n </div>\r\n )\r\n}\r\n\r\nfunction TableHeader({ className, ...props }: React.ComponentProps<\"thead\">) {\r\n return (\r\n <thead\r\n className={cn(\r\n \"bg-bg-secondary [&_tr]:border-border-tertiary\",\r\n className\r\n )}\r\n data-slot=\"table-header\"\r\n {...props}\r\n />\r\n )\r\n}\r\n\r\nfunction TableBody({ className, ...props }: React.ComponentProps<\"tbody\">) {\r\n return (\r\n <tbody\r\n className={cn(\"[&_tr:last-child]:border-0\", className)}\r\n data-slot=\"table-body\"\r\n {...props}\r\n />\r\n )\r\n}\r\n\r\nfunction TableFooter({ className, ...props }: React.ComponentProps<\"tfoot\">) {\r\n return (\r\n <tfoot\r\n className={cn(\r\n \"border-t border-border-primary bg-bg-secondary font-medium [&>tr]:last:border-b-0\",\r\n className\r\n )}\r\n data-slot=\"table-footer\"\r\n {...props}\r\n />\r\n )\r\n}\r\n\r\nfunction TableRow({ className, ...props }: React.ComponentProps<\"tr\">) {\r\n return (\r\n <tr\r\n className={cn(\r\n \"border-b border-border-secondary transition-colors hover:bg-bg-secondary data-[state=selected]:bg-bg-brand-primary/40\",\r\n className\r\n )}\r\n data-slot=\"table-row\"\r\n {...props}\r\n />\r\n )\r\n}\r\n\r\ninterface TableHeadProps extends Omit<React.ComponentProps<\"th\">, \"align\"> {\r\n align?: \"start\" | \"end\" | \"center\"\r\n variant?: \"string\" | \"number\"\r\n tooltip?: React.ReactNode\r\n sortable?: boolean\r\n sortDirection?: \"asc\" | \"desc\" | false | null\r\n onSort?: () => void\r\n}\r\n\r\nfunction TableHead({\r\n className,\r\n align,\r\n variant = \"string\",\r\n tooltip,\r\n sortable,\r\n sortDirection,\r\n onSort,\r\n children,\r\n ...props\r\n}: TableHeadProps) {\r\n const effectiveAlign = align || (variant === \"number\" ? \"end\" : \"start\")\r\n const hasControls = Boolean(tooltip || sortable)\r\n const isEnd = effectiveAlign === \"end\"\r\n\r\n const tooltipElement = tooltip ? (\r\n <Tooltip>\r\n <TooltipTrigger\r\n render={\r\n <button\r\n type=\"button\"\r\n className=\"inline-flex items-center justify-center text-fg-quaternary hover:text-text-primary\"\r\n />\r\n }\r\n >\r\n <InfoIcon className=\"size-3.5\" />\r\n </TooltipTrigger>\r\n <TooltipPopup side=\"top\">{tooltip}</TooltipPopup>\r\n </Tooltip>\r\n ) : null\r\n\r\n const sortElement = sortable ? (\r\n <button\r\n type=\"button\"\r\n onClick={onSort}\r\n className=\"inline-flex items-center text-fg-quaternary hover:text-text-primary focus:outline-none\"\r\n aria-label=\"Sort column\"\r\n >\r\n {sortDirection === \"asc\" ? (\r\n <SortAscendingIcon size={12} />\r\n ) : sortDirection === \"desc\" ? (\r\n <SortDescendingIcon size={12} />\r\n ) : (\r\n <SortDefaultIcon size={12} />\r\n )}\r\n </button>\r\n ) : null\r\n\r\n const titleElement = (\r\n <span\r\n className={cn(\"truncate\", sortable && \"cursor-pointer select-none\")}\r\n onClick={sortable ? onSort : undefined}\r\n >\r\n {children}\r\n </span>\r\n )\r\n\r\n return (\r\n <th\r\n className={cn(\r\n \"text-label-bold-3 text-text-tertiary h-10 px-4 py-3 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0\",\r\n !hasControls && effectiveAlign === \"end\" && \"text-right\",\r\n !hasControls && effectiveAlign === \"start\" && \"text-left\",\r\n !hasControls && effectiveAlign === \"center\" && \"text-center\",\r\n className\r\n )}\r\n data-slot=\"table-head\"\r\n {...props}\r\n >\r\n {hasControls ? (\r\n <div className=\"flex w-full items-center justify-between gap-2\">\r\n {isEnd ? (\r\n <>\r\n <div className=\"flex items-center gap-1.5 shrink-0\">\r\n {tooltipElement}\r\n {sortElement}\r\n </div>\r\n <div className=\"flex items-center shrink-0 justify-end\">\r\n {titleElement}\r\n </div>\r\n </>\r\n ) : (\r\n <>\r\n {titleElement}\r\n <div className=\"flex items-center gap-1.5 shrink-0\">\r\n {tooltipElement}\r\n {sortElement}\r\n </div>\r\n </>\r\n )}\r\n </div>\r\n ) : (\r\n titleElement\r\n )}\r\n </th>\r\n )\r\n}\r\n\r\ninterface TableCellProps extends Omit<React.ComponentProps<\"td\">, \"align\"> {\r\n align?: \"start\" | \"end\" | \"center\"\r\n variant?: \"string\" | \"number\"\r\n}\r\n\r\nfunction TableCell({\r\n className,\r\n align,\r\n variant = \"string\",\r\n ...props\r\n}: TableCellProps) {\r\n const effectiveAlign = align || (variant === \"number\" ? \"end\" : \"start\")\r\n\r\n return (\r\n <td\r\n className={cn(\r\n \"text-text-primary px-4 py-3 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0\",\r\n effectiveAlign === \"end\" && \"text-right\",\r\n effectiveAlign === \"start\" && \"text-left\",\r\n effectiveAlign === \"center\" && \"text-center\",\r\n className\r\n )}\r\n data-slot=\"table-cell\"\r\n {...props}\r\n />\r\n )\r\n}\r\n\r\nfunction TableCaption({\r\n className,\r\n ...props\r\n}: React.ComponentProps<\"caption\">) {\r\n return (\r\n <caption\r\n className={cn(\"text-text-secondary mt-4 text-body-regular-2\", className)}\r\n data-slot=\"table-caption\"\r\n {...props}\r\n />\r\n )\r\n}\r\n\r\nexport {\r\n Table,\r\n TableBody,\r\n TableCaption,\r\n TableCell,\r\n TableFooter,\r\n TableHead,\r\n TableHeader,\r\n TableRow,\r\n type TableCellProps,\r\n type TableHeadProps,\r\n}"]}
|
|
1
|
+
{"version":3,"sources":["../src/ui/table.tsx"],"names":["Table","className","props","jsx","cn","TableHeader","TableBody","TableFooter","TableRow","TableHead","align","variant","tooltip","sortable","sortDirection","onSort","children","effectiveAlign","hasControls","isEnd","tooltipElement","jsxs","Tooltip","TooltipTrigger","InfoIcon","TooltipPopup","sortElement","sort_ascending_icon_default","sort_descending_icon_default","sort_default_icon_default","titleElement","Fragment","TableCell","TableCaption"],"mappings":"8SAWA,SAASA,CAAAA,CAAM,CAAE,SAAA,CAAAC,CAAAA,CAAW,GAAGC,CAAM,CAAA,CAAkC,CACrE,OACEC,GAAAA,CAAC,KAAA,CAAA,CACC,UAAU,uFAAA,CACV,WAAA,CAAU,iBAAA,CAEV,QAAA,CAAAA,GAAAA,CAAC,OAAA,CAAA,CAC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,OACEC,IAAC,SAAA,CAAA,CACC,SAAA,CAAWC,GAAG,8CAAA,CAAgDH,CAAS,EACvE,WAAA,CAAU,eAAA,CACT,GAAGC,CAAAA,CACN,CAEJ","file":"chunk-2AOIAHWJ.js","sourcesContent":["import * as React from \"react\"\r\nimport { InfoIcon } from \"lucide-react\"\r\n\r\nimport { cn } from \"@xploreu/lib/cn\"\r\nimport { SortAscendingIcon, SortDefaultIcon, SortDescendingIcon } from \"../icons\"\r\nimport {\r\n Tooltip,\r\n TooltipPopup,\r\n TooltipTrigger,\r\n} from \"./tooltip\"\r\n\r\nfunction Table({ className, ...props }: React.ComponentProps<\"table\">) {\r\n return (\r\n <div\r\n className=\"relative w-full overflow-x-auto rounded-xl border border-border-primary bg-bg-primary\"\r\n data-slot=\"table-container\"\r\n >\r\n <table\r\n className={cn(\"w-full caption-bottom text-body-regular-2\", className)}\r\n data-slot=\"table\"\r\n {...props}\r\n />\r\n </div>\r\n )\r\n}\r\n\r\nfunction TableHeader({ className, ...props }: React.ComponentProps<\"thead\">) {\r\n return (\r\n <thead\r\n className={cn(\r\n \"bg-bg-secondary [&_tr]:border-border-tertiary\",\r\n className\r\n )}\r\n data-slot=\"table-header\"\r\n {...props}\r\n />\r\n )\r\n}\r\n\r\nfunction TableBody({ className, ...props }: React.ComponentProps<\"tbody\">) {\r\n return (\r\n <tbody\r\n className={cn(\"[&_tr:last-child]:border-0\", className)}\r\n data-slot=\"table-body\"\r\n {...props}\r\n />\r\n )\r\n}\r\n\r\nfunction TableFooter({ className, ...props }: React.ComponentProps<\"tfoot\">) {\r\n return (\r\n <tfoot\r\n className={cn(\r\n \"border-t border-border-primary bg-bg-secondary font-medium [&>tr]:last:border-b-0\",\r\n className\r\n )}\r\n data-slot=\"table-footer\"\r\n {...props}\r\n />\r\n )\r\n}\r\n\r\nfunction TableRow({ className, ...props }: React.ComponentProps<\"tr\">) {\r\n return (\r\n <tr\r\n className={cn(\r\n \"border-b border-border-secondary transition-colors hover:bg-bg-secondary data-[state=selected]:bg-bg-brand-primary/40\",\r\n className\r\n )}\r\n data-slot=\"table-row\"\r\n {...props}\r\n />\r\n )\r\n}\r\n\r\ninterface TableHeadProps extends Omit<React.ComponentProps<\"th\">, \"align\"> {\r\n align?: \"start\" | \"end\" | \"center\"\r\n variant?: \"string\" | \"number\"\r\n tooltip?: React.ReactNode\r\n sortable?: boolean\r\n sortDirection?: \"asc\" | \"desc\" | false | null\r\n onSort?: () => void\r\n}\r\n\r\nfunction TableHead({\r\n className,\r\n align,\r\n variant = \"string\",\r\n tooltip,\r\n sortable,\r\n sortDirection,\r\n onSort,\r\n children,\r\n ...props\r\n}: TableHeadProps) {\r\n const effectiveAlign = align || (variant === \"number\" ? \"end\" : \"start\")\r\n const hasControls = Boolean(tooltip || sortable)\r\n const isEnd = effectiveAlign === \"end\"\r\n\r\n const tooltipElement = tooltip ? (\r\n <Tooltip>\r\n <TooltipTrigger\r\n render={\r\n <button\r\n type=\"button\"\r\n className=\"inline-flex items-center justify-center text-fg-quaternary hover:text-text-primary\"\r\n />\r\n }\r\n >\r\n <InfoIcon className=\"size-3.5\" />\r\n </TooltipTrigger>\r\n <TooltipPopup side=\"top\">{tooltip}</TooltipPopup>\r\n </Tooltip>\r\n ) : null\r\n\r\n const sortElement = sortable ? (\r\n <button\r\n type=\"button\"\r\n onClick={onSort}\r\n className=\"inline-flex items-center text-fg-quaternary hover:text-text-primary focus:outline-none\"\r\n aria-label=\"Sort column\"\r\n >\r\n {sortDirection === \"asc\" ? (\r\n <SortAscendingIcon size={12} />\r\n ) : sortDirection === \"desc\" ? (\r\n <SortDescendingIcon size={12} />\r\n ) : (\r\n <SortDefaultIcon size={12} />\r\n )}\r\n </button>\r\n ) : null\r\n\r\n const titleElement = (\r\n <span\r\n className={cn(\"truncate\", sortable && \"cursor-pointer select-none\")}\r\n onClick={sortable ? onSort : undefined}\r\n >\r\n {children}\r\n </span>\r\n )\r\n\r\n return (\r\n <th\r\n className={cn(\r\n \"text-label-bold-3 text-text-tertiary h-10 px-4 py-3 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0\",\r\n !hasControls && effectiveAlign === \"end\" && \"text-right\",\r\n !hasControls && effectiveAlign === \"start\" && \"text-left\",\r\n !hasControls && effectiveAlign === \"center\" && \"text-center\",\r\n className\r\n )}\r\n data-slot=\"table-head\"\r\n {...props}\r\n >\r\n {hasControls ? (\r\n <div className=\"flex w-full items-center justify-between gap-2\">\r\n {isEnd ? (\r\n <>\r\n <div className=\"flex items-center gap-1.5 shrink-0\">\r\n {tooltipElement}\r\n {sortElement}\r\n </div>\r\n <div className=\"flex items-center shrink-0 justify-end\">\r\n {titleElement}\r\n </div>\r\n </>\r\n ) : (\r\n <>\r\n {titleElement}\r\n <div className=\"flex items-center gap-1.5 shrink-0\">\r\n {tooltipElement}\r\n {sortElement}\r\n </div>\r\n </>\r\n )}\r\n </div>\r\n ) : (\r\n titleElement\r\n )}\r\n </th>\r\n )\r\n}\r\n\r\ninterface TableCellProps extends Omit<React.ComponentProps<\"td\">, \"align\"> {\r\n align?: \"start\" | \"end\" | \"center\"\r\n variant?: \"string\" | \"number\"\r\n}\r\n\r\nfunction TableCell({\r\n className,\r\n align,\r\n variant = \"string\",\r\n ...props\r\n}: TableCellProps) {\r\n const effectiveAlign = align || (variant === \"number\" ? \"end\" : \"start\")\r\n\r\n return (\r\n <td\r\n className={cn(\r\n \"text-text-primary px-4 py-3 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0\",\r\n effectiveAlign === \"end\" && \"text-right\",\r\n effectiveAlign === \"start\" && \"text-left\",\r\n effectiveAlign === \"center\" && \"text-center\",\r\n className\r\n )}\r\n data-slot=\"table-cell\"\r\n {...props}\r\n />\r\n )\r\n}\r\n\r\nfunction TableCaption({\r\n className,\r\n ...props\r\n}: React.ComponentProps<\"caption\">) {\r\n return (\r\n <caption\r\n className={cn(\"text-text-secondary mt-4 text-body-regular-2\", className)}\r\n data-slot=\"table-caption\"\r\n {...props}\r\n />\r\n )\r\n}\r\n\r\nexport {\r\n Table,\r\n TableBody,\r\n TableCaption,\r\n TableCell,\r\n TableFooter,\r\n TableHead,\r\n TableHeader,\r\n TableRow,\r\n type TableCellProps,\r\n type TableHeadProps,\r\n}"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import*as r from'react';import {Dialog}from'@base-ui/react/dialog';import {AnimatePresence,motion}from'motion/react';import {useControlledState}from'@xploreu/hooks/use-controlled-state';import {getStrictContext}from'@xploreu/lib/get-strict-context';import {cn}from'@xploreu/lib/cn';import {jsx}from'react/jsx-runtime';var [T,D]=getStrictContext("DialogContext");function M(o){let[i,a]=useControlledState({value:o?.open,defaultValue:o?.defaultOpen,onChange:o?.onOpenChange});return jsx(T,{value:{open:i,setOpen:a},children:jsx(Dialog.Root,{"data-slot":"dialog",...o,onOpenChange:a})})}function H(o){return jsx(Dialog.Trigger,{"data-slot":"dialog-trigger",...o})}function h(o){let{open:i}=D();return jsx(AnimatePresence,{children:i&&jsx(Dialog.Portal,{"data-slot":"dialog-portal",keepMounted:true,...o})})}function B({transition:o={duration:.2,ease:"easeInOut"},...i}){return jsx(Dialog.Backdrop,{"data-slot":"dialog-backdrop",render:jsx(motion.div,{initial:{opacity:0,filter:"blur(4px)"},animate:{opacity:1,filter:"blur(0px)"},exit:{opacity:0,filter:"blur(4px)"},transition:o,...i},"dialog-backdrop")})}function A({from:o="top",initialFocus:i,finalFocus:a,transition:P={type:"spring",stiffness:150,damping:25},className:d,...u}){let l=o==="bottom"||o==="left"?"5deg":"-5deg",p=o==="top"||o==="bottom"?"rotateX":"rotateY",[m,s]=r.useState(false),{open:g}=D();return r.useEffect(()=>{g||s(false);},[g]),jsx(Dialog.Popup,{initialFocus:i,finalFocus:a,render:jsx(motion.div,{"data-slot":"dialog-popup","data-opened":m?"":void 0,className:cn("data-[opened]:!transform-none",d),animate:{opacity:1,filter:"blur(0px)",transform:`perspective(500px) ${p}(0deg) scale(1)`},exit:{opacity:0,filter:"blur(4px)",transform:`perspective(500px) ${p}(${l}) scale(0.8)`},initial:{opacity:0,filter:"blur(4px)",transform:`perspective(500px) ${p}(${l}) scale(0.8)`},transition:P,onAnimationComplete:n=>{typeof n=="object"&&"opacity"in n&&n.opacity!==1||requestAnimationFrame(()=>{s(true);});},...u},"dialog-popup")})}function $(o){return jsx(Dialog.Close,{"data-slot":"dialog-close",...o})}function L(o){return jsx("div",{"data-slot":"dialog-header",...o})}function S(o){return jsx("div",{"data-slot":"dialog-footer",...o})}function V(o){return jsx(Dialog.Title,{"data-slot":"dialog-title",...o})}function q(o){return jsx(Dialog.Description,{"data-slot":"dialog-description",...o})}export{D as a,M as b,H as c,h as d,B as e,A as f,$ as g,L as h,S as i,V as j,q as k};//# sourceMappingURL=chunk-2HZWQU6H.js.map
|
|
2
|
+
//# sourceMappingURL=chunk-2HZWQU6H.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/primitives/dialog.tsx"],"names":["DialogProvider","useDialog","getStrictContext","Dialog","props","open","setOpen","useControlledState","jsx","DialogPrimitive","DialogTrigger","DialogPortal","AnimatePresence","DialogBackdrop","transition","motion","DialogPopup","from","initialFocus","finalFocus","className","initialRotation","rotateAxis","opened","setOpened","cn","latest","DialogClose","DialogHeader","DialogFooter","DialogTitle","DialogDescription"],"mappings":"8TAeA,IAAM,CAACA,EAAgBC,CAAS,CAAA,CAC9BC,gBAAAA,CAAoC,eAAe,EAIrD,SAASC,EAAOC,CAAAA,CAAoB,CAClC,GAAM,CAACC,CAAAA,CAAMC,CAAO,CAAA,CAAIC,kBAAAA,CAAmB,CACzC,KAAA,CAAOH,CAAAA,EAAO,IAAA,CACd,aAAcA,CAAAA,EAAO,WAAA,CACrB,SAAUA,CAAAA,EAAO,YACnB,CAAC,CAAA,CAED,OACEI,GAAAA,CAACR,CAAAA,CAAA,CAAe,KAAA,CAAO,CAAE,IAAA,CAAAK,CAAAA,CAAM,QAAAC,CAAQ,CAAA,CACrC,SAAAE,GAAAA,CA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,CAAO,UAAY,CAAA,EAE5E,qBAAA,CAAsB,IAAM,CAC1BF,CAAAA,CAAU,IAAI,EAChB,CAAC,EACH,EACC,GAAGpB,CAAAA,CAAAA,CA3BA,cA4BN,CAAA,CAEJ,CAEJ,CAIA,SAASuB,CAAAA,CAAYvB,CAAAA,CAAyB,CAC5C,OAAOI,GAAAA,CAACC,OAAgB,KAAA,CAAhB,CAAsB,YAAU,cAAA,CAAgB,GAAGL,EAAO,CACpE,CAIA,SAASwB,CAAAA,CAAaxB,CAAAA,CAA0B,CAC9C,OAAOI,GAAAA,CAAC,KAAA,CAAA,CAAI,YAAU,eAAA,CAAiB,GAAGJ,EAAO,CACnD,CAIA,SAASyB,CAAAA,CAAazB,CAAAA,CAA0B,CAC9C,OAAOI,GAAAA,CAAC,KAAA,CAAA,CAAI,YAAU,eAAA,CAAiB,GAAGJ,EAAO,CACnD,CAIA,SAAS0B,CAAAA,CAAY1B,CAAAA,CAAyB,CAC5C,OAAOI,GAAAA,CAACC,MAAAA,CAAgB,MAAhB,CAAsB,WAAA,CAAU,eAAgB,GAAGL,CAAAA,CAAO,CACpE,CAMA,SAAS2B,CAAAA,CAAkB3B,EAA+B,CACxD,OACEI,IAACC,MAAAA,CAAgB,WAAA,CAAhB,CAA4B,WAAA,CAAU,oBAAA,CAAsB,GAAGL,CAAAA,CAAO,CAE3E","file":"chunk-IJOZ7E2J.js","sourcesContent":["'use client';\r\n\r\nimport * as React from 'react';\r\nimport { Dialog as DialogPrimitive } from '@base-ui/react/dialog';\r\nimport { AnimatePresence, motion, type HTMLMotionProps } from 'motion/react';\r\n\r\nimport { useControlledState } from '@xploreu/hooks/use-controlled-state';\r\nimport { getStrictContext } from '@xploreu/lib/get-strict-context';\r\nimport { cn } from '@xploreu/lib/cn';\r\n\r\ntype DialogContextType = {\r\n open: boolean;\r\n setOpen: DialogProps['onOpenChange'];\r\n};\r\n\r\nconst [DialogProvider, useDialog] =\r\n getStrictContext<DialogContextType>('DialogContext');\r\n\r\ntype DialogProps = React.ComponentProps<typeof DialogPrimitive.Root>;\r\n\r\nfunction Dialog(props: DialogProps) {\r\n const [open, setOpen] = useControlledState({\r\n value: props?.open,\r\n defaultValue: props?.defaultOpen,\r\n onChange: props?.onOpenChange,\r\n });\r\n\r\n return (\r\n <DialogProvider value={{ open, setOpen }}>\r\n <DialogPrimitive.Root\r\n data-slot=\"dialog\"\r\n {...props}\r\n onOpenChange={setOpen}\r\n />\r\n </DialogProvider>\r\n );\r\n}\r\n\r\ntype DialogTriggerProps = React.ComponentProps<typeof DialogPrimitive.Trigger>;\r\n\r\nfunction DialogTrigger(props: DialogTriggerProps) {\r\n return <DialogPrimitive.Trigger data-slot=\"dialog-trigger\" {...props} />;\r\n}\r\n\r\ntype DialogPortalProps = Omit<\r\n React.ComponentProps<typeof DialogPrimitive.Portal>,\r\n 'keepMounted'\r\n>;\r\n\r\nfunction DialogPortal(props: DialogPortalProps) {\r\n const { open } = useDialog();\r\n\r\n return (\r\n <AnimatePresence>\r\n {open && (\r\n <DialogPrimitive.Portal\r\n data-slot=\"dialog-portal\"\r\n keepMounted\r\n {...props}\r\n />\r\n )}\r\n </AnimatePresence>\r\n );\r\n}\r\n\r\ntype DialogBackdropProps = Omit<\r\n React.ComponentProps<typeof DialogPrimitive.Backdrop>,\r\n 'render'\r\n> &\r\n HTMLMotionProps<'div'>;\r\n\r\nfunction DialogBackdrop({\r\n transition = { duration: 0.2, ease: 'easeInOut' },\r\n ...props\r\n}: DialogBackdropProps) {\r\n return (\r\n <DialogPrimitive.Backdrop\r\n data-slot=\"dialog-backdrop\"\r\n render={\r\n <motion.div\r\n key=\"dialog-backdrop\"\r\n initial={{ opacity: 0, filter: 'blur(4px)' }}\r\n animate={{ opacity: 1, filter: 'blur(0px)' }}\r\n exit={{ opacity: 0, filter: 'blur(4px)' }}\r\n transition={transition}\r\n {...props}\r\n />\r\n }\r\n />\r\n );\r\n}\r\n\r\ntype DialogFlipDirection = 'top' | 'bottom' | 'left' | 'right';\r\n\r\ntype DialogPopupProps = Omit<\r\n React.ComponentProps<typeof DialogPrimitive.Popup>,\r\n 'render'\r\n> &\r\n HTMLMotionProps<'div'> & {\r\n from?: DialogFlipDirection;\r\n };\r\n\r\nfunction DialogPopup({\r\n from = 'top',\r\n initialFocus,\r\n finalFocus,\r\n transition = { type: 'spring', stiffness: 150, damping: 25 },\r\n className,\r\n ...props\r\n}: DialogPopupProps) {\r\n const initialRotation =\r\n from === 'bottom' || from === 'left' ? '20deg' : '-20deg';\r\n const isVertical = from === 'top' || from === 'bottom';\r\n const rotateAxis = isVertical ? 'rotateX' : 'rotateY';\r\n\r\n const [opened, setOpened] = React.useState(false);\r\n\r\n const { open } = useDialog()\r\n\r\n React.useEffect(() => {\r\n if (open) return\r\n\r\n setOpened(false)\r\n }, [open])\r\n\r\n return (\r\n <DialogPrimitive.Popup\r\n initialFocus={initialFocus}\r\n finalFocus={finalFocus}\r\n render={\r\n <motion.div\r\n key=\"dialog-popup\"\r\n data-slot=\"dialog-popup\"\r\n data-opened={opened ? \"\" : undefined}\r\n className={cn(\"data-[opened]:!transform-none\", className)}\r\n animate={{\r\n opacity: 1,\r\n filter: \"blur(0px)\",\r\n transform: `perspective(500px) ${rotateAxis}(0deg) scale(1)`,\r\n }}\r\n exit={{\r\n opacity: 0,\r\n filter: \"blur(4px)\",\r\n transform: `perspective(500px) ${rotateAxis}(${initialRotation}) scale(0.8)`,\r\n }}\r\n initial={{\r\n opacity: 0,\r\n filter: \"blur(4px)\",\r\n transform: `perspective(500px) ${rotateAxis}(${initialRotation}) scale(0.8)`,\r\n }}\r\n transition={transition}\r\n onAnimationComplete={(latest) => {\r\n if (typeof latest === \"object\" && \"opacity\" in latest && latest.opacity !== 1) return\r\n\r\n requestAnimationFrame(() => {\r\n setOpened(true)\r\n })\r\n }}\r\n {...props}\r\n />\r\n }\r\n />\r\n );\r\n}\r\n\r\ntype DialogCloseProps = React.ComponentProps<typeof DialogPrimitive.Close>;\r\n\r\nfunction DialogClose(props: DialogCloseProps) {\r\n return <DialogPrimitive.Close data-slot=\"dialog-close\" {...props} />;\r\n}\r\n\r\ntype DialogHeaderProps = React.ComponentProps<'div'>;\r\n\r\nfunction DialogHeader(props: DialogHeaderProps) {\r\n return <div data-slot=\"dialog-header\" {...props} />;\r\n}\r\n\r\ntype DialogFooterProps = React.ComponentProps<'div'>;\r\n\r\nfunction DialogFooter(props: DialogFooterProps) {\r\n return <div data-slot=\"dialog-footer\" {...props} />;\r\n}\r\n\r\ntype DialogTitleProps = React.ComponentProps<typeof DialogPrimitive.Title>;\r\n\r\nfunction DialogTitle(props: DialogTitleProps) {\r\n return <DialogPrimitive.Title data-slot=\"dialog-title\" {...props} />;\r\n}\r\n\r\ntype DialogDescriptionProps = React.ComponentProps<\r\n typeof DialogPrimitive.Description\r\n>;\r\n\r\nfunction DialogDescription(props: DialogDescriptionProps) {\r\n return (\r\n <DialogPrimitive.Description data-slot=\"dialog-description\" {...props} />\r\n );\r\n}\r\n\r\nexport {\r\n Dialog,\r\n DialogPortal,\r\n DialogBackdrop,\r\n DialogClose,\r\n DialogTrigger,\r\n DialogPopup,\r\n DialogHeader,\r\n DialogFooter,\r\n DialogTitle,\r\n DialogDescription,\r\n useDialog,\r\n type DialogProps,\r\n type DialogTriggerProps,\r\n type DialogPortalProps,\r\n type DialogCloseProps,\r\n type DialogBackdropProps,\r\n type DialogPopupProps,\r\n type DialogHeaderProps,\r\n type DialogFooterProps,\r\n type DialogTitleProps,\r\n type DialogDescriptionProps,\r\n type DialogContextType,\r\n type DialogFlipDirection,\r\n};"]}
|
|
1
|
+
{"version":3,"sources":["../src/primitives/dialog.tsx"],"names":["DialogProvider","useDialog","getStrictContext","Dialog","props","open","setOpen","useControlledState","jsx","DialogPrimitive","DialogTrigger","DialogPortal","AnimatePresence","DialogBackdrop","transition","motion","DialogPopup","from","initialFocus","finalFocus","className","initialRotation","rotateAxis","opened","setOpened","cn","latest","DialogClose","DialogHeader","DialogFooter","DialogTitle","DialogDescription"],"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sB,GAAGL,CAAAA,CAAO,CAE3E","file":"chunk-2HZWQU6H.js","sourcesContent":["'use client';\r\n\r\nimport * as React from 'react';\r\nimport { Dialog as DialogPrimitive } from '@base-ui/react/dialog';\r\nimport { AnimatePresence, motion, type HTMLMotionProps } from 'motion/react';\r\n\r\nimport { useControlledState } from '@xploreu/hooks/use-controlled-state';\r\nimport { getStrictContext } from '@xploreu/lib/get-strict-context';\r\nimport { cn } from '@xploreu/lib/cn';\r\n\r\ntype DialogContextType = {\r\n open: boolean;\r\n setOpen: DialogProps['onOpenChange'];\r\n};\r\n\r\nconst [DialogProvider, useDialog] =\r\n getStrictContext<DialogContextType>('DialogContext');\r\n\r\ntype DialogProps = React.ComponentProps<typeof DialogPrimitive.Root>;\r\n\r\nfunction Dialog(props: DialogProps) {\r\n const [open, setOpen] = useControlledState({\r\n value: props?.open,\r\n defaultValue: props?.defaultOpen,\r\n onChange: props?.onOpenChange,\r\n });\r\n\r\n return (\r\n <DialogProvider value={{ open, setOpen }}>\r\n <DialogPrimitive.Root\r\n data-slot=\"dialog\"\r\n {...props}\r\n onOpenChange={setOpen}\r\n />\r\n </DialogProvider>\r\n );\r\n}\r\n\r\ntype DialogTriggerProps = React.ComponentProps<typeof DialogPrimitive.Trigger>;\r\n\r\nfunction DialogTrigger(props: DialogTriggerProps) {\r\n return <DialogPrimitive.Trigger data-slot=\"dialog-trigger\" {...props} />;\r\n}\r\n\r\ntype DialogPortalProps = Omit<\r\n React.ComponentProps<typeof DialogPrimitive.Portal>,\r\n 'keepMounted'\r\n>;\r\n\r\nfunction DialogPortal(props: DialogPortalProps) {\r\n const { open } = useDialog();\r\n\r\n return (\r\n <AnimatePresence>\r\n {open && (\r\n <DialogPrimitive.Portal\r\n data-slot=\"dialog-portal\"\r\n keepMounted\r\n {...props}\r\n />\r\n )}\r\n </AnimatePresence>\r\n );\r\n}\r\n\r\ntype DialogBackdropProps = Omit<\r\n React.ComponentProps<typeof DialogPrimitive.Backdrop>,\r\n 'render'\r\n> &\r\n HTMLMotionProps<'div'>;\r\n\r\nfunction DialogBackdrop({\r\n transition = { duration: 0.2, ease: 'easeInOut' },\r\n ...props\r\n}: DialogBackdropProps) {\r\n return (\r\n <DialogPrimitive.Backdrop\r\n data-slot=\"dialog-backdrop\"\r\n render={\r\n <motion.div\r\n key=\"dialog-backdrop\"\r\n initial={{ opacity: 0, filter: 'blur(4px)' }}\r\n animate={{ opacity: 1, filter: 'blur(0px)' }}\r\n exit={{ opacity: 0, filter: 'blur(4px)' }}\r\n transition={transition}\r\n {...props}\r\n />\r\n }\r\n />\r\n );\r\n}\r\n\r\ntype DialogFlipDirection = 'top' | 'bottom' | 'left' | 'right';\r\n\r\ntype DialogPopupProps = Omit<\r\n React.ComponentProps<typeof DialogPrimitive.Popup>,\r\n 'render'\r\n> &\r\n HTMLMotionProps<'div'> & {\r\n from?: DialogFlipDirection;\r\n };\r\n\r\nfunction DialogPopup({\r\n from = 'top',\r\n initialFocus,\r\n finalFocus,\r\n transition = { type: 'spring', stiffness: 150, damping: 25 },\r\n className,\r\n ...props\r\n}: DialogPopupProps) {\r\n const initialRotation =\r\n from === 'bottom' || from === 'left' ? '5deg' : '-5deg';\r\n const isVertical = from === 'top' || from === 'bottom';\r\n const rotateAxis = isVertical ? 'rotateX' : 'rotateY';\r\n\r\n const [opened, setOpened] = React.useState(false);\r\n\r\n const { open } = useDialog()\r\n\r\n React.useEffect(() => {\r\n if (open) return\r\n\r\n setOpened(false)\r\n }, [open])\r\n\r\n return (\r\n <DialogPrimitive.Popup\r\n initialFocus={initialFocus}\r\n finalFocus={finalFocus}\r\n render={\r\n <motion.div\r\n key=\"dialog-popup\"\r\n data-slot=\"dialog-popup\"\r\n data-opened={opened ? \"\" : undefined}\r\n className={cn(\"data-[opened]:!transform-none\", className)}\r\n animate={{\r\n opacity: 1,\r\n filter: \"blur(0px)\",\r\n transform: `perspective(500px) ${rotateAxis}(0deg) scale(1)`,\r\n }}\r\n exit={{\r\n opacity: 0,\r\n filter: \"blur(4px)\",\r\n transform: `perspective(500px) ${rotateAxis}(${initialRotation}) scale(0.8)`,\r\n }}\r\n initial={{\r\n opacity: 0,\r\n filter: \"blur(4px)\",\r\n transform: `perspective(500px) ${rotateAxis}(${initialRotation}) scale(0.8)`,\r\n }}\r\n transition={transition}\r\n onAnimationComplete={(latest) => {\r\n if (typeof latest === \"object\" && \"opacity\" in latest && latest.opacity !== 1) return\r\n\r\n requestAnimationFrame(() => {\r\n setOpened(true)\r\n })\r\n }}\r\n {...props}\r\n />\r\n }\r\n />\r\n );\r\n}\r\n\r\ntype DialogCloseProps = React.ComponentProps<typeof DialogPrimitive.Close>;\r\n\r\nfunction DialogClose(props: DialogCloseProps) {\r\n return <DialogPrimitive.Close data-slot=\"dialog-close\" {...props} />;\r\n}\r\n\r\ntype DialogHeaderProps = React.ComponentProps<'div'>;\r\n\r\nfunction DialogHeader(props: DialogHeaderProps) {\r\n return <div data-slot=\"dialog-header\" {...props} />;\r\n}\r\n\r\ntype DialogFooterProps = React.ComponentProps<'div'>;\r\n\r\nfunction DialogFooter(props: DialogFooterProps) {\r\n return <div data-slot=\"dialog-footer\" {...props} />;\r\n}\r\n\r\ntype DialogTitleProps = React.ComponentProps<typeof DialogPrimitive.Title>;\r\n\r\nfunction DialogTitle(props: DialogTitleProps) {\r\n return <DialogPrimitive.Title data-slot=\"dialog-title\" {...props} />;\r\n}\r\n\r\ntype DialogDescriptionProps = React.ComponentProps<\r\n typeof DialogPrimitive.Description\r\n>;\r\n\r\nfunction DialogDescription(props: DialogDescriptionProps) {\r\n return (\r\n <DialogPrimitive.Description data-slot=\"dialog-description\" {...props} />\r\n );\r\n}\r\n\r\nexport {\r\n Dialog,\r\n DialogPortal,\r\n DialogBackdrop,\r\n DialogClose,\r\n DialogTrigger,\r\n DialogPopup,\r\n DialogHeader,\r\n DialogFooter,\r\n DialogTitle,\r\n DialogDescription,\r\n useDialog,\r\n type DialogProps,\r\n type DialogTriggerProps,\r\n type DialogPortalProps,\r\n type DialogCloseProps,\r\n type DialogBackdropProps,\r\n type DialogPopupProps,\r\n type DialogHeaderProps,\r\n type DialogFooterProps,\r\n type DialogTitleProps,\r\n type DialogDescriptionProps,\r\n type DialogContextType,\r\n type DialogFlipDirection,\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-DUSAF7E7.js';import {a}from'./chunk-JH6RZ3QH.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-3Q6I6MHN.js.map
|
|
2
|
+
//# sourceMappingURL=chunk-3Q6I6MHN.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,QAAA,CAAAC,CAAAA,CACA,KAAA,CAAOC,CAAAA,CACP,QAASC,GAAAA,CACT,QAAA,CA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E,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-BSWTMWP5.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,CAAOC,CAAAA,CACP,QAASC,GAAAA,CACT,QAAA,CAAAC,CACF,CAAA,CAAuB,CACrB,G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AAAxC,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-3Q6I6MHN.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"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import {a as a$1}from'./chunk-AGKZWMW5.js';import {a}from'./chunk-W2HFGSVH.js';import {b,c,d}from'./chunk-CQEBQK7U.js';import {b as b$1}from'./chunk-JLZNZFOO.js';import*as i from'react';import {Slot}from'@radix-ui/react-slot';import {cva}from'class-variance-authority';import {CircleIcon}from'lucide-react';import {cn}from'@xploreu/lib/cn';import {jsxs,jsx}from'react/jsx-runtime';var M=[{status:"open-to-all",label:"Open to All Opportunities",badgeColor:"gray"},{status:"open-to-work",label:"Open to Work",badgeColor:"success"},{status:"open-to-freelance",label:"Open to Freelance",badgeColor:"warning"},{status:"open-to-coach",label:"Open to Coach",badgeColor:"blue-light"}],S=cva("flex flex-col items-center relative",{variants:{size:{xs:"gap-0.5 w-6",sm:"gap-0.5 w-8",md:"gap-0.5 w-10",lg:"gap-1 w-12",xl:"gap-1 w-14","2xl":"gap-2 w-16","3xl":"gap-2 w-20"}},defaultVariants:{size:"sm"}}),E=cva(void 0,{variants:{size:{xs:"p-0.5 h-2 font-semibold text-[5px] leading-2",sm:"p-1 h-2.5 font-semibold text-[6px] leading-2.5",md:"px-1 h-3.5 font-semibold text-[6px] leading-2.5",lg:"px-1 h-4 text-body-semibold-caption",xl:"px-1 h-6 text-body-semibold-xs","2xl":"px-2 h-9 text-body-semibold-sm","3xl":"px-2 h-10 text-label-semibold-4"}},defaultVariants:{size:"sm"}}),W=cva(void 0,{variants:{size:{xs:"p-[1.5px]",sm:"p-xp-xxs",md:"p-[2.5px]",lg:"p-xp-xs",xl:"p-[3.5px]","2xl":"p-1","3xl":"p-1"}},defaultVariants:{size:"sm"}});function X({avatarClassName:N,badgeClassName:A,imageSrc:r,avatarImageClassName:z,imageAlt:f,className:w,status:a$2,size:l,isVerified:j,onEdit:v,onClickAvatar:P,variant:o="profile",isOnline:V,companyLogoSrc:s,bordered:n=true,badged:R=false,fallbackText:x,...O}){let d$1=i.useMemo(()=>M.find(q=>q.status===a$2),[a$2]),y=!!a$2,B=n&&y&&o==="profile"?"div":Slot,I=i.useMemo(()=>{switch(o){case "company":return "/images/fallback-company.jpeg";case "university":return "/images/fallback-university.jpeg";case "group":return "/images/fallback-user-group.jpeg";default:return "/images/fallback-user.jpeg"}},[o]),U=i.useMemo(()=>{if(r)return typeof r=="string"?r:URL.createObjectURL(r)},[r]),m=i.useMemo(()=>{if(s)return typeof s=="string"?s:URL.createObjectURL(s)},[s]);return jsxs("div",{className:cn(S({size:l,className:w})),"data-slot":"profile-avatar",...O,children:[jsx(B,{className:cn("rounded-xp-card-base",n?cn(a$2==="open-to-work"&&"bg-gradient-avatar-outline-opentowork",a$2==="open-to-freelance"&&"bg-gradient-avatar-outline-opentoprofesional",a$2==="open-to-coach"&&"bg-gradient-avatar-outline-opentocoach",a$2==="open-to-all"&&"bg-gradient-avatar-outline-opentowork",!a$2&&o==="profile"&&"bg-border-secondary"):void 0,n&&o==="profile"&&W({size:l})),children:jsxs("div",{className:"relative group",children:[jsxs(b,{className:cn(n&&y&&"border-0",N),size:l,onClick:P,children:[jsx(c,{alt:f,className:cn("bg-bg-primary object-cover",z),src:U}),x?jsx(d,{render:jsx("div",{className:"flex aspect-square size-full items-center justify-center rounded-xp-card-base-sm border-2 border-border-secondary bg-bg-tertiary text-label-semibold-2 text-text-quaternary",children:x})}):jsx(d,{render:jsx("img",{alt:f||"Avatar Fallback",className:"aspect-square size-full bg-bg-primary object-cover",src:I})})]}),v&&jsx("div",{className:"absolute inset-0 flex opacity-0 hover:opacity-100 hover:bg-background-primary-subtle-press/25 rounded-xp-card-base transition-opacity duration-200 items-center justify-center cursor-pointer",id:"avatar-upload-trigger",onClick:v,children:jsx("div",{className:"flex items-center p-2 hover:bg-background-primary-subtle-hover justify-center rounded-xp-card-base-sm bg-background-canvas-subtle",children:jsx(a,{className:"size-6"})})}),V&&!m&&jsx(CircleIcon,{className:"text-bg-primary-replace fill-fg-success-secondary size-[11.5px] absolute -bottom-[3.5px] -right-[3.5px]"}),m!==void 0&&jsxs(b,{className:"border border-bg-primary-replace size-[15px] rounded-xs absolute -bottom-[3.5px] -right-[3.5px]",children:[jsx(c,{alt:"Company Logo",className:"bg-bg-primary object-cover",src:m}),jsx(d,{render:jsx("img",{alt:"Company Logo Fallback",className:"aspect-square size-full bg-bg-primary object-cover",src:"/images/fallback-company.jpeg"})})]})]})}),R&&d$1&&jsx(b$1,{className:cn(E({size:l,className:A})),color:d$1.badgeColor,size:"sm",children:d$1.label}),j&&jsx("div",{className:"absolute -bottom-1 -right-1",children:jsx(a$1,{className:"size-4 text-[#068BEE]"})})]})}export{X as a};//# sourceMappingURL=chunk-6RI2ROVI.js.map
|
|
2
|
+
//# sourceMappingURL=chunk-6RI2ROVI.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/composites/profile-avatar.tsx"],"names":["profileAvatarStatus","profileAvatarVariants","cva","profileAvatarBadgeVariants","profileAvatarPaddingVariants","ProfileAvatar","avatarClassName","badgeClassName","imageSrc","avatarImageClassName","imageAlt","className","status","size","isVerified","onEdit","onClickAvatar","variant","isOnline","companyLogoSrc","bordered","badged","fallbackText","props","activeStatus","s","hasActiveStatus","Comp","Slot","fallbackImage","normalizedImageSrc","normalizedCompanyLogoSrc","jsxs","cn","jsx","Avatar","AvatarImage","AvatarFallback","upload_pictures_on_profile_icon_default","CircleIcon","Badge","verified_icon_default"],"mappings":"6XAuBA,IAAMA,CAAAA,CAIA,CACF,CACE,MAAA,CAAQ,aAAA,CACR,KAAA,CAAO,2BAAA,CACP,UAAA,CAAY,MACd,CAAA,CACA,CACE,MAAA,CAAQ,cAAA,CACR,KAAA,CAAO,cAAA,C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AAA,CACF,CAAA,CACCb,CAAAA,EACCG,GAAAA,EACEU,GAAAA,CAACM,GAAAA,CAAA,CACC,SAAA,CAAWP,EAAAA,CAAG9B,CAAAA,CAA2B,CAAE,IAAA,CAAAU,CAAAA,CAAM,SAAA,CAAWN,CAAe,CAAC,CAAC,CAAA,CAC7E,KAAA,CAAOiB,GAAAA,CAAa,UAAA,CACpB,IAAA,CAAK,IAAA,CAEJ,QAAA,CAAAA,GAAAA,CAAa,KAAA,CAChB,CAAA,CAGHV,CAAAA,EACCoB,GAAAA,CAAC,KAAA,CAAA,CAAI,SAAA,CAAU,6BAAA,CACb,QAAA,CAAAA,GAAAA,CAACO,GAAAA,CAAA,CAAa,SAAA,CAAU,uBAAA,CAAwB,CAAA,CAClD,GAEJ,CAEJ","file":"chunk-6RI2ROVI.js","sourcesContent":["\"use client\"\r\n\r\nimport * as React from \"react\"\r\n\r\nimport { Slot } from \"@radix-ui/react-slot\"\r\nimport { cva, type VariantProps } from \"class-variance-authority\"\r\nimport { CircleIcon } from \"lucide-react\"\r\n\r\nimport { cn } from \"@xploreu/lib/cn\"\r\n\r\nimport { UploadPicturesOnProfileIcon, VerifiedIcon } from \"../icons\"\r\nimport { Avatar, AvatarFallback, AvatarImage } from \"../ui/avatar\"\r\nimport { Badge } from \"../ui/badge\"\r\n\r\nexport type ProfileAvatarStatus =\r\n | \"open-to-all\"\r\n | \"open-to-work\"\r\n | \"open-to-freelance\"\r\n | \"open-to-coach\"\r\n | undefined\r\n\r\nexport type ProfileAvatarVariant = \"profile\" | \"company\" | \"university\" | \"group\"\r\n\r\nconst profileAvatarStatus: {\r\n status: ProfileAvatarStatus\r\n label: string\r\n badgeColor?: React.ComponentProps<typeof Badge>[\"color\"]\r\n}[] = [\r\n {\r\n status: \"open-to-all\",\r\n label: \"Open to All Opportunities\",\r\n badgeColor: \"gray\",\r\n },\r\n {\r\n status: \"open-to-work\",\r\n label: \"Open to Work\",\r\n badgeColor: \"success\",\r\n },\r\n {\r\n status: \"open-to-freelance\",\r\n label: \"Open to Freelance\",\r\n badgeColor: \"warning\",\r\n },\r\n {\r\n status: \"open-to-coach\",\r\n label: \"Open to Coach\",\r\n badgeColor: \"blue-light\",\r\n },\r\n ]\r\n\r\nconst profileAvatarVariants = cva(\"flex flex-col items-center relative\", {\r\n variants: {\r\n size: {\r\n xs: \"gap-0.5 w-6\",\r\n sm: \"gap-0.5 w-8\",\r\n md: \"gap-0.5 w-10\",\r\n lg: \"gap-1 w-12\",\r\n xl: \"gap-1 w-14\",\r\n \"2xl\": \"gap-2 w-16\",\r\n \"3xl\": \"gap-2 w-20\",\r\n },\r\n },\r\n defaultVariants: {\r\n size: \"sm\",\r\n },\r\n})\r\n\r\nconst profileAvatarBadgeVariants = cva(undefined, {\r\n variants: {\r\n size: {\r\n xs: \"p-0.5 h-2 font-semibold text-[5px] leading-2\",\r\n sm: \"p-1 h-2.5 font-semibold text-[6px] leading-2.5\",\r\n md: \"px-1 h-3.5 font-semibold text-[6px] leading-2.5\",\r\n lg: \"px-1 h-4 text-body-semibold-caption\",\r\n xl: \"px-1 h-6 text-body-semibold-xs\",\r\n \"2xl\": \"px-2 h-9 text-body-semibold-sm\",\r\n \"3xl\": \"px-2 h-10 text-label-semibold-4\",\r\n },\r\n },\r\n defaultVariants: {\r\n size: \"sm\",\r\n },\r\n})\r\n\r\nconst profileAvatarPaddingVariants = cva(undefined, {\r\n variants: {\r\n size: {\r\n xs: \"p-[1.5px]\",\r\n sm: \"p-xp-xxs\",\r\n md: \"p-[2.5px]\",\r\n lg: \"p-xp-xs\",\r\n xl: \"p-[3.5px]\",\r\n \"2xl\": \"p-1\",\r\n \"3xl\": \"p-1\",\r\n },\r\n },\r\n defaultVariants: {\r\n size: \"sm\",\r\n },\r\n})\r\n\r\nfunction ProfileAvatar({\r\n avatarClassName,\r\n badgeClassName,\r\n imageSrc,\r\n avatarImageClassName,\r\n imageAlt,\r\n className,\r\n status,\r\n size,\r\n isVerified,\r\n onEdit,\r\n onClickAvatar,\r\n variant = \"profile\",\r\n isOnline,\r\n companyLogoSrc,\r\n bordered = true,\r\n badged = false,\r\n fallbackText,\r\n ...props\r\n}: React.ComponentProps<\"div\"> & {\r\n avatarClassName?: string\r\n badgeClassName?: string\r\n imageSrc?: string | Blob\r\n imageAlt?: string\r\n isVerified?: boolean\r\n avatarImageClassName?: string\r\n size?: VariantProps<typeof profileAvatarVariants>[\"size\"]\r\n status?: ProfileAvatarStatus\r\n onEdit?: () => void\r\n onClickAvatar?: () => void\r\n variant?: ProfileAvatarVariant\r\n isOnline?: boolean\r\n companyLogoSrc?: string | Blob\r\n bordered?: boolean\r\n badged?: boolean\r\n fallbackText?: string\r\n}) {\r\n const activeStatus = React.useMemo(() => {\r\n return profileAvatarStatus.find((s) => s.status === status)\r\n }, [status])\r\n\r\n const hasActiveStatus = !!status\r\n const Comp = bordered && hasActiveStatus && variant === \"profile\" ? \"div\" : Slot\r\n\r\n const fallbackImage = React.useMemo(() => {\r\n switch (variant) {\r\n case \"company\":\r\n return \"/images/fallback-company.jpeg\"\r\n case \"university\":\r\n return \"/images/fallback-university.jpeg\"\r\n case \"group\":\r\n return \"/images/fallback-user-group.jpeg\"\r\n default:\r\n return \"/images/fallback-user.jpeg\"\r\n }\r\n }, [variant])\r\n\r\n const normalizedImageSrc = React.useMemo(() => {\r\n if (!imageSrc) return undefined\r\n if (typeof imageSrc === \"string\") return imageSrc\r\n return URL.createObjectURL(imageSrc)\r\n }, [imageSrc])\r\n\r\n const normalizedCompanyLogoSrc = React.useMemo(() => {\r\n if (!companyLogoSrc) return undefined\r\n if (typeof companyLogoSrc === \"string\") return companyLogoSrc\r\n return URL.createObjectURL(companyLogoSrc)\r\n }, [companyLogoSrc])\r\n\r\n return (\r\n <div\r\n className={cn(profileAvatarVariants({ size, className }))}\r\n data-slot=\"profile-avatar\"\r\n {...props}\r\n >\r\n <Comp\r\n className={cn(\r\n \"rounded-xp-card-base\",\r\n bordered\r\n ? cn(\r\n status === \"open-to-work\" && \"bg-gradient-avatar-outline-opentowork\",\r\n status === \"open-to-freelance\" && \"bg-gradient-avatar-outline-opentoprofesional\",\r\n status === \"open-to-coach\" && \"bg-gradient-avatar-outline-opentocoach\",\r\n status === \"open-to-all\" && \"bg-gradient-avatar-outline-opentowork\",\r\n !status && variant === \"profile\" && \"bg-border-secondary\"\r\n )\r\n : undefined,\r\n bordered && variant === \"profile\" && profileAvatarPaddingVariants({ size })\r\n )}\r\n >\r\n <div className=\"relative group\">\r\n <Avatar\r\n className={cn(\r\n bordered && hasActiveStatus && \"border-0\",\r\n avatarClassName\r\n )}\r\n size={size}\r\n onClick={onClickAvatar}\r\n >\r\n <AvatarImage\r\n alt={imageAlt}\r\n className={cn(\"bg-bg-primary object-cover\", avatarImageClassName)}\r\n src={normalizedImageSrc}\r\n />\r\n {fallbackText ? (\r\n <AvatarFallback\r\n render={\r\n <div className=\"flex aspect-square size-full items-center justify-center rounded-xp-card-base-sm border-2 border-border-secondary bg-bg-tertiary text-label-semibold-2 text-text-quaternary\">\r\n {fallbackText}\r\n </div>\r\n }\r\n />\r\n ) : (\r\n <AvatarFallback\r\n render={\r\n // eslint-disable-next-line @next/next/no-img-element\r\n <img\r\n alt={imageAlt || \"Avatar Fallback\"}\r\n className=\"aspect-square size-full bg-bg-primary object-cover\"\r\n src={fallbackImage}\r\n />\r\n }\r\n />\r\n )}\r\n </Avatar>\r\n\r\n {onEdit && (\r\n <div\r\n className=\"absolute inset-0 flex opacity-0 hover:opacity-100 hover:bg-background-primary-subtle-press/25 rounded-xp-card-base transition-opacity duration-200 items-center justify-center cursor-pointer\"\r\n id=\"avatar-upload-trigger\"\r\n onClick={onEdit}\r\n >\r\n <div className=\"flex items-center p-2 hover:bg-background-primary-subtle-hover justify-center rounded-xp-card-base-sm bg-background-canvas-subtle\">\r\n <UploadPicturesOnProfileIcon className=\"size-6\" />\r\n </div>\r\n </div>\r\n )}\r\n {isOnline && !normalizedCompanyLogoSrc && (\r\n <CircleIcon className=\"text-bg-primary-replace fill-fg-success-secondary size-[11.5px] absolute -bottom-[3.5px] -right-[3.5px]\" />\r\n )}\r\n {normalizedCompanyLogoSrc !== undefined && (\r\n <Avatar className=\"border border-bg-primary-replace size-[15px] rounded-xs absolute -bottom-[3.5px] -right-[3.5px]\">\r\n <AvatarImage\r\n alt=\"Company Logo\"\r\n className=\"bg-bg-primary object-cover\"\r\n src={normalizedCompanyLogoSrc}\r\n />\r\n <AvatarFallback\r\n render={\r\n // eslint-disable-next-line @next/next/no-img-element\r\n <img\r\n alt=\"Company Logo Fallback\"\r\n className=\"aspect-square size-full bg-bg-primary object-cover\"\r\n src=\"/images/fallback-company.jpeg\"\r\n />\r\n }\r\n />\r\n </Avatar>\r\n )}\r\n </div>\r\n </Comp>\r\n {badged &&\r\n activeStatus && (\r\n <Badge\r\n className={cn(profileAvatarBadgeVariants({ size, className: badgeClassName }))}\r\n color={activeStatus.badgeColor}\r\n size=\"sm\"\r\n >\r\n {activeStatus.label}\r\n </Badge>\r\n )}\r\n\r\n {isVerified && (\r\n <div className=\"absolute -bottom-1 -right-1\">\r\n <VerifiedIcon className=\"size-4 text-[#068BEE]\" />\r\n </div>\r\n )}\r\n </div>\r\n )\r\n}\r\n\r\nexport { ProfileAvatar }\r\n"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {b as b$1,c,d,e,g,h,i,j,k as k$1,a}from'./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import {b as b$1,c,d,e,g,h,i,j,k as k$1,a}from'./chunk-2HZWQU6H.js';import'react';import {Dialog}from'@base-ui/react/dialog';import {motion}from'motion/react';import {cn}from'@xploreu/lib/cn';import {jsx}from'react/jsx-runtime';var M=b$1,O=c,k=d,L=e,R=g,b=h,B=i,N=j,w=k$1,A=a,T={top:{y:"-100%"},bottom:{y:"100%"},left:{x:"-100%"},right:{x:"100%"}};function E({side:e="right",initialFocus:t,finalFocus:S,transition:D={type:"spring",stiffness:150,damping:25},className:c,...d}){let p=T[e];return jsx(Dialog.Popup,{initialFocus:t,finalFocus:S,render:jsx(motion.div,{"data-slot":"sheet-popup","data-side":e,className:c,initial:{opacity:0,...p},animate:{opacity:1,x:0,y:0},exit:{opacity:0,...p},transition:D,...d},"sheet-popup")})}function q({className:e,...t}){return jsx("div",{"data-slot":"sheet-content",className:cn("flex-1 overflow-y-auto px-6 py-4",e),...t})}export{M as a,O as b,k as c,L as d,R as e,b as f,B as g,N as h,w as i,A as j,E as k,q as l};//# sourceMappingURL=chunk-7LXFJQSH.js.map
|
|
2
|
+
//# sourceMappingURL=chunk-7LXFJQSH.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/primitives/sheet.tsx"],"names":["Sheet","Dialog","SheetTrigger","DialogTrigger","SheetPortal","DialogPortal","SheetOverlay","DialogBackdrop","SheetClose","DialogClose","SheetHeader","DialogHeader","SheetFooter","DialogFooter","SheetTitle","DialogTitle","SheetDescription","DialogDescription","useSheet","useDialog","sideOffsets","SheetPopup","side","initialFocus","finalFocus","transition","className","props","offset","jsx","DialogPrimitive","motion","SheetContent","cn"],"mappings":"oOAgCA,IAAMA,CAAAA,CAAQC,GAAAA,CACRC,CAAAA,CAAeC,EACfC,CAAAA,CAAcC,CAAAA,CACdC,CAAAA,CAAeC,CAAAA,CACfC,EAAaC,CAAAA,CACbC,CAAAA,CAAcC,CAAAA,CACdC,CAAAA,CAAcC,EACdC,CAAAA,CAAaC,CAAAA,CACbC,EAAmBC,GAAAA,CACnBC,CAAAA,CAAWC,EAIXC,CAAAA,CAA6D,CACjE,GAAA,CAAK,CAAE,EAAG,OAAQ,CAAA,CAClB,MAAA,CAAQ,CAAE,EAAG,MAAO,CAAA,CACpB,IAAA,CAAM,CAAE,EAAG,OAAQ,CAAA,CACnB,MAAO,CAAE,CAAA,CAAG,MAAO,CACrB,EAUA,SAASC,CAAAA,CAAW,CAClB,IAAA,CAAAC,CAAAA,CAAO,OAAA,CACP,YAAA,CAAAC,EACA,UAAA,CAAAC,CAAAA,CACA,UAAA,CAAAC,CAAAA,CAAa,CAAE,IAAA,CAAM,QAAA,CAAU,UAAW,GAAA,CAAK,OAAA,CAAS,EAAG,CAAA,CAC3D,SAAA,CAAAC,CAAAA,CACA,GAAGC,CACL,CAAA,CAAoB,CAClB,IAAMC,CAAAA,CAASR,EAAYE,CAAI,CAAA,CAE/B,OACEO,GAAAA,CAACC,OAAgB,KAAA,CAAhB,CACC,aAAcP,CAAAA,CACd,UAAA,CAAYC,EACZ,MAAA,CACEK,GAAAA,CAACE,MAAAA,CAAO,GAAA,CAAP,CAEC,WAAA,CAAU,aAAA,CACV,WAAA,CAAWT,CAAAA,CACX,UAAWI,CAAAA,CACX,OAAA,CAAS,CAAE,OAAA,CAAS,EAAG,GAAGE,CAAO,EACjC,OAAA,CAAS,CAAE,QAAS,CAAA,CAAG,CAAA,CAAG,CAAA,CAAG,CAAA,CAAG,CAAE,CAAA,CAClC,IAAA,CAAM,CAAE,OAAA,CAAS,EAAG,GAAGA,CAAO,CAAA,CAC9B,UAAA,CAAYH,EACX,GAAGE,CAAAA,CAAAA,CARA,aASN,CAAA,CAEJ,CAEJ,CAIA,SAASK,CAAAA,CAAa,CAAE,SAAA,CAAAN,EAAW,GAAGC,CAAM,CAAA,CAAsB,CAChE,OACEE,GAAAA,CAAC,KAAA,CAAA,CACC,WAAA,CAAU,eAAA,CACV,UAAWI,EAAAA,CAAG,kCAAA,CAAoCP,CAAS,CAAA,CAC1D,GAAGC,EACN,CAEJ","file":"chunk-
|
|
1
|
+
{"version":3,"sources":["../src/primitives/sheet.tsx"],"names":["Sheet","Dialog","SheetTrigger","DialogTrigger","SheetPortal","DialogPortal","SheetOverlay","DialogBackdrop","SheetClose","DialogClose","SheetHeader","DialogHeader","SheetFooter","DialogFooter","SheetTitle","DialogTitle","SheetDescription","DialogDescription","useSheet","useDialog","sideOffsets","SheetPopup","side","initialFocus","finalFocus","transition","className","props","offset","jsx","DialogPrimitive","motion","SheetContent","cn"],"mapp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ASN,CAAA,CAEJ,CAEJ,CAIA,SAASK,CAAAA,CAAa,CAAE,SAAA,CAAAN,EAAW,GAAGC,CAAM,CAAA,CAAsB,CAChE,OACEE,GAAAA,CAAC,KAAA,CAAA,CACC,WAAA,CAAU,eAAA,CACV,UAAWI,EAAAA,CAAG,kCAAA,CAAoCP,CAAS,CAAA,CAC1D,GAAGC,EACN,CAEJ","file":"chunk-7LXFJQSH.js","sourcesContent":["'use client';\r\n\r\nimport * as React from 'react';\r\nimport { Dialog as DialogPrimitive } from '@base-ui/react/dialog';\r\nimport { motion, type HTMLMotionProps } from 'motion/react';\r\n\r\nimport {\r\n Dialog,\r\n DialogBackdrop,\r\n DialogClose,\r\n DialogDescription,\r\n DialogFooter,\r\n DialogHeader,\r\n DialogPortal,\r\n DialogTitle,\r\n DialogTrigger,\r\n useDialog,\r\n type DialogProps,\r\n type DialogTriggerProps,\r\n type DialogPortalProps,\r\n type DialogCloseProps,\r\n type DialogBackdropProps,\r\n type DialogHeaderProps,\r\n type DialogFooterProps,\r\n type DialogTitleProps,\r\n type DialogDescriptionProps,\r\n} from './dialog';\r\nimport { cn } from '@xploreu/lib/cn';\r\n\r\n// ponytail: Sheet reuses the Dialog context/state machinery; only the\r\n// popup animation differs (slide-in from an edge vs the 3D flip).\r\n// Upgrade path: split a shared DialogContext if sheet-specific state is needed.\r\nconst Sheet = Dialog;\r\nconst SheetTrigger = DialogTrigger;\r\nconst SheetPortal = DialogPortal;\r\nconst SheetOverlay = DialogBackdrop;\r\nconst SheetClose = DialogClose;\r\nconst SheetHeader = DialogHeader;\r\nconst SheetFooter = DialogFooter;\r\nconst SheetTitle = DialogTitle;\r\nconst SheetDescription = DialogDescription;\r\nconst useSheet = useDialog;\r\n\r\ntype SheetSide = 'top' | 'bottom' | 'left' | 'right';\r\n\r\nconst sideOffsets: Record<SheetSide, { x?: string; y?: string }> = {\r\n top: { y: '-100%' },\r\n bottom: { y: '100%' },\r\n left: { x: '-100%' },\r\n right: { x: '100%' },\r\n};\r\n\r\ntype SheetPopupProps = Omit<\r\n React.ComponentProps<typeof DialogPrimitive.Popup>,\r\n 'render'\r\n> &\r\n HTMLMotionProps<'div'> & {\r\n side?: SheetSide;\r\n };\r\n\r\nfunction SheetPopup({\r\n side = 'right',\r\n initialFocus,\r\n finalFocus,\r\n transition = { type: 'spring', stiffness: 150, damping: 25 },\r\n className,\r\n ...props\r\n}: SheetPopupProps) {\r\n const offset = sideOffsets[side];\r\n\r\n return (\r\n <DialogPrimitive.Popup\r\n initialFocus={initialFocus}\r\n finalFocus={finalFocus}\r\n render={\r\n <motion.div\r\n key=\"sheet-popup\"\r\n data-slot=\"sheet-popup\"\r\n data-side={side}\r\n className={className}\r\n initial={{ opacity: 0, ...offset }}\r\n animate={{ opacity: 1, x: 0, y: 0 }}\r\n exit={{ opacity: 0, ...offset }}\r\n transition={transition}\r\n {...props}\r\n />\r\n }\r\n />\r\n );\r\n}\r\n\r\ntype SheetContentProps = React.HTMLAttributes<HTMLDivElement>;\r\n\r\nfunction SheetContent({ className, ...props }: SheetContentProps) {\r\n return (\r\n <div\r\n data-slot=\"sheet-content\"\r\n className={cn('flex-1 overflow-y-auto px-6 py-4', className)}\r\n {...props}\r\n />\r\n );\r\n}\r\n\r\ntype SheetProps = DialogProps;\r\ntype SheetTriggerProps = DialogTriggerProps;\r\ntype SheetPortalProps = DialogPortalProps;\r\ntype SheetCloseProps = DialogCloseProps;\r\ntype SheetOverlayProps = DialogBackdropProps;\r\ntype SheetHeaderProps = DialogHeaderProps;\r\ntype SheetFooterProps = DialogFooterProps;\r\ntype SheetTitleProps = DialogTitleProps;\r\ntype SheetDescriptionProps = DialogDescriptionProps;\r\n\r\nexport {\r\n Sheet,\r\n SheetPortal,\r\n SheetOverlay,\r\n SheetClose,\r\n SheetTrigger,\r\n SheetPopup,\r\n SheetContent,\r\n SheetHeader,\r\n SheetFooter,\r\n SheetTitle,\r\n SheetDescription,\r\n useSheet,\r\n type SheetProps,\r\n type SheetTriggerProps,\r\n type SheetPortalProps,\r\n type SheetCloseProps,\r\n type SheetOverlayProps,\r\n type SheetPopupProps,\r\n type SheetContentProps,\r\n type SheetHeaderProps,\r\n type SheetFooterProps,\r\n type SheetTitleProps,\r\n type SheetDescriptionProps,\r\n type SheetSide,\r\n};\r\n"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {a}from'./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import {a}from'./chunk-6RI2ROVI.js';import {b,c,g,d,f,h,i,j as j$1,k as k$1,e}from'./chunk-2HZWQU6H.js';import'react';import {XIcon}from'lucide-react';import {cn}from'@xploreu/lib/cn';import {jsx,jsxs}from'react/jsx-runtime';function k(o){return jsx(b,{...o})}function A(o){return jsx(c,{...o})}function H(o){return jsx(g,{...o})}function _({className:o,...i}){return jsx(e,{className:cn("fixed inset-0 z-50 bg-black/50 backdrop-blur-sm",o),...i})}function B({className:o,children:i,showCloseButton:e=true,closeClassName:t,...l}){return jsxs(d,{children:[jsx(_,{}),jsxs(f,{className:cn("fixed left-[50%] top-[50%] z-50 grid w-[calc(100%-2rem)] max-w-lg translate-x-[-50%] translate-y-[-50%] bg-bg-primary shadow-xp-lg rounded-xl overflow-hidden",o),...l,children:[i,e&&jsxs(g,{className:cn("data-[state=open]:bg-bg-primary data-[state=open]:text-text-primary absolute top-3 right-4 rounded-xs transition-colors hover:text-text-error-primary-hover disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",t),children:[jsx(XIcon,{}),jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function F({className:o,...i}){return jsx(h,{className:cn("relative px-4 py-3 flex flex-col bg-bg-primary border-b border-border-tertiary bg-radial-[100%_200%_at_0%_0%] from-modal-dialog-stop-0 to-bg-primary has-[[data-slot=dialog-icon]]:pl-16 has-[[data-slot=dialog-avatar]]:pl-16",o),...i})}function z({className:o,...i}){return jsx("div",{"data-slot":"dialog-content",className:cn("px-4 py-4 max-h-[60vh] overflow-y-auto",o),...i})}function R({className:o,...i$1}){return jsx(i,{className:cn("flex gap-2 items-center justify-end bg-bg-primary border-t border-border-tertiary px-4 py-3 shadow-[0px_-1px_24px_0px_var(--color-shadow-xs)] peer-[[data-slot=dialog-content]]:border-0",o),...i$1})}function j({className:o,...i}){return jsx(j$1,{className:cn("text-label-bold-2 text-text-primary",o),...i})}function I({className:o,...i}){return jsx(k$1,{className:cn("mt-0.5 text-body-regular-3 text-text-secondary",o),...i})}function L({className:o,...i}){return jsx("div",{"data-slot":"dialog-icon",className:cn("absolute top-[13px] left-4 flex items-center justify-center rounded-lg bg-bg-primary p-2.5 [&_svg]:size-4 bg-bg-brand-solid text-fg-white shadow-[0px_1px_2px_-1px_var(--color-shadow-lg-01),0px_1px_3px_0px_var(--color-shadow-md-01),0px_0px_0px_4px_var(--color-focus-ring-secondary)]",o),...i})}function M({src:o,imageSrc:i,className:e,avatarClassName:t,imageAlt:l,variant:u="profile",...f}){return jsx("div",{"data-slot":"dialog-avatar",className:cn("absolute top-[13px] left-4 flex items-center justify-center size-9 rounded-lg overflow-hidden bg-bg-primary shadow-[0px_1px_2px_-1px_var(--color-shadow-lg-01),0px_1px_3px_0px_var(--color-shadow-md-01),0px_0px_0px_4px_var(--color-focus-ring-secondary)]",e),children:jsx(a,{imageSrc:o??i,imageAlt:l,variant:u,bordered:false,badged:false,className:cn("size-full shrink-0",t),...f})})}export{k as a,A as b,H as c,B as d,F as e,z as f,R as g,j as h,I as i,L as j,M as k};//# sourceMappingURL=chunk-AA2XSKFM.js.map
|
|
2
|
+
//# sourceMappingURL=chunk-AA2XSKFM.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/ui/dialog.tsx"],"names":["Dialog","props","jsx","DialogTrigger","DialogClose","DialogBackdrop","className","cn","DialogPopup","children","showCloseButton","closeClassName","jsxs","DialogPortal","XIcon","DialogHeader","DialogContent","DialogFooter","DialogTitle","DialogDescription","DialogIc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AAA,CACnT,GAAGL,CAAAA,CACN,CAEJ,CAQA,SAASoB,EAAa,CACpB,GAAA,CAAAC,CAAAA,CACA,QAAA,CAAAC,EACA,SAAA,CAAAjB,CAAAA,CACA,eAAA,CAAAkB,CAAAA,CACA,SAAAC,CAAAA,CACA,OAAA,CAAAC,CAAAA,CAAU,SAAA,CACV,GAAGzB,CACL,CAAA,CAAsB,CACpB,OACEC,IAAC,KAAA,CAAA,CACC,WAAA,CAAU,eAAA,CACV,SAAA,CAAWK,GACT,6PAAA,CACAD,CACF,CAAA,CAEA,QAAA,CAAAJ,IAACyB,CAAAA,CAAA,CACC,QAAA,CAAUL,CAAAA,EAAOC,EACjB,QAAA,CAAUE,CAAAA,CACV,OAAA,CAASC,CAAAA,CACT,SAAU,KAAA,CACV,MAAA,CAAQ,KAAA,CACR,SAAA,CAAWnB,GAAG,oBAAA,CAAsBiB,CAAe,EAClD,GAAGvB,CAAAA,CACN,EACF,CAEJ","file":"chunk-IYWIRZKV.js","sourcesContent":["import * as React from 'react';\r\nimport { XIcon } from 'lucide-react';\r\n\r\nimport {\r\n Dialog as DialogPrimitive,\r\n DialogPopup as DialogPopupPrimitive,\r\n DialogDescription as DialogDescriptionPrimitive,\r\n DialogFooter as DialogFooterPrimitive,\r\n DialogHeader as DialogHeaderPrimitive,\r\n DialogTitle as DialogTitlePrimitive,\r\n DialogTrigger as DialogTriggerPrimitive,\r\n DialogPortal as DialogPortalPrimitive,\r\n DialogBackdrop as DialogBackdropPrimitive,\r\n DialogClose as DialogClosePrimitive,\r\n type DialogProps as DialogPrimitiveProps,\r\n type DialogPopupProps as DialogPopupPrimitiveProps,\r\n type DialogDescriptionProps as DialogDescriptionPrimitiveProps,\r\n type DialogFooterProps as DialogFooterPrimitiveProps,\r\n type DialogHeaderProps as DialogHeaderPrimitiveProps,\r\n type DialogTitleProps as DialogTitlePrimitiveProps,\r\n type DialogTriggerProps as DialogTriggerPrimitiveProps,\r\n type DialogBackdropProps as DialogBackdropPrimitiveProps,\r\n type DialogCloseProps as DialogClosePrimitiveProps,\r\n} from '../primitives/dialog';\r\nimport { ProfileAvatar, type ProfileAvatarVariant } from '../composites/profile-avatar';\r\nimport { cn } from '@xploreu/lib/cn';\r\n\r\ntype DialogProps = DialogPrimitiveProps;\r\n\r\nfunction Dialog(props: DialogProps) {\r\n return <DialogPrimitive {...props} />;\r\n}\r\n\r\ntype DialogTriggerProps = DialogTriggerPrimitiveProps;\r\n\r\nfunction DialogTrigger(props: DialogTriggerProps) {\r\n return <DialogTriggerPrimitive {...props} />;\r\n}\r\n\r\ntype DialogCloseProps = DialogClosePrimitiveProps;\r\n\r\nfunction DialogClose(props: DialogCloseProps) {\r\n return <DialogClosePrimitive {...props} />;\r\n}\r\n\r\ntype DialogBackdropProps = DialogBackdropPrimitiveProps;\r\n\r\nfunction DialogBackdrop({ className, ...props }: DialogBackdropProps) {\r\n return (\r\n <DialogBackdropPrimitive\r\n className={cn('fixed inset-0 z-50 bg-black/50 backdrop-blur-sm', className)}\r\n {...props}\r\n />\r\n );\r\n}\r\n\r\ntype DialogPopupProps = DialogPopupPrimitiveProps & {\r\n showCloseButton?: boolean;\r\n closeClassName?: string;\r\n};\r\n\r\nfunction DialogPopup({\r\n className,\r\n children,\r\n showCloseButton = true,\r\n closeClassName,\r\n ...props\r\n}: DialogPopupProps) {\r\n return (\r\n <DialogPortalPrimitive>\r\n <DialogBackdrop />\r\n <DialogPopupPrimitive\r\n className={cn(\r\n \"fixed left-[50%] top-[50%] z-50 grid w-[calc(100%-2rem)] max-w-lg translate-x-[-50%] translate-y-[-50%] bg-bg-primary shadow-xp-lg rounded-xl overflow-hidden\",\r\n className,\r\n )}\r\n {...props}\r\n >\r\n {children}\r\n {showCloseButton && (\r\n <DialogClosePrimitive\r\n className={cn(\r\n \"data-[state=open]:bg-bg-primary data-[state=open]:text-text-primary absolute top-3 right-4 rounded-xs transition-colors hover:text-text-error-primary-hover disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4\",\r\n closeClassName\r\n )}\r\n >\r\n <XIcon />\r\n <span className=\"sr-only\">Close</span>\r\n </DialogClosePrimitive>\r\n )}\r\n </DialogPopupPrimitive>\r\n </DialogPortalPrimitive>\r\n );\r\n}\r\n\r\ntype DialogHeaderProps = DialogHeaderPrimitiveProps;\r\n\r\nfunction DialogHeader({ className, ...props }: DialogHeaderProps) {\r\n return (\r\n <DialogHeaderPrimitive\r\n className={cn(\"relative px-4 py-3 flex flex-col bg-bg-primary border-b border-border-tertiary bg-radial-[100%_200%_at_0%_0%] from-modal-dialog-stop-0 to-bg-primary has-[[data-slot=dialog-icon]]:pl-16 has-[[data-slot=dialog-avatar]]:pl-16\", className)}\r\n {...props}\r\n />\r\n );\r\n}\r\n\r\ntype DialogContentProps = React.HTMLAttributes<HTMLDivElement>;\r\n\r\nfunction DialogContent({ className, ...props }: DialogContentProps) {\r\n return (\r\n <div\r\n data-slot=\"dialog-content\"\r\n className={cn(\"px-4 py-4 max-h-[60vh] overflow-y-auto\", className)}\r\n {...props}\r\n />\r\n );\r\n}\r\n\r\ntype DialogFooterProps = DialogFooterPrimitiveProps;\r\n\r\nfunction DialogFooter({ className, ...props }: DialogFooterProps) {\r\n return (\r\n <DialogFooterPrimitive\r\n className={cn(\r\n \"flex gap-2 items-center justify-end bg-bg-primary border-t border-border-tertiary px-4 py-3 shadow-[0px_-1px_24px_0px_var(--color-shadow-xs)] peer-[[data-slot=dialog-content]]:border-0\",\r\n className\r\n )}\r\n {...props}\r\n />\r\n );\r\n}\r\n\r\ntype DialogTitleProps = DialogTitlePrimitiveProps;\r\n\r\nfunction DialogTitle({ className, ...props }: DialogTitleProps) {\r\n return (\r\n <DialogTitlePrimitive\r\n className={cn(\"text-label-bold-2 text-text-primary\", className)}\r\n {...props}\r\n />\r\n );\r\n}\r\n\r\ntype DialogDescriptionProps = DialogDescriptionPrimitiveProps;\r\n\r\nfunction DialogDescription({ className, ...props }: DialogDescriptionProps) {\r\n return (\r\n <DialogDescriptionPrimitive\r\n className={cn(\"mt-0.5 text-body-regular-3 text-text-secondary\", className)}\r\n {...props}\r\n />\r\n );\r\n}\r\n\r\nfunction DialogIcon({ className, ...props }: React.ComponentProps<\"div\">) {\r\n return (\r\n <div\r\n data-slot=\"dialog-icon\"\r\n className={cn(\"absolute top-[13px] left-4 flex items-center justify-center rounded-lg bg-bg-primary p-2.5 [&_svg]:size-4 bg-bg-brand-solid text-fg-white shadow-[0px_1px_2px_-1px_var(--color-shadow-lg-01),0px_1px_3px_0px_var(--color-shadow-md-01),0px_0px_0px_4px_var(--color-focus-ring-secondary)]\", className)}\r\n {...props}\r\n />\r\n );\r\n}\r\n\r\ntype DialogAvatarProps = Omit<React.ComponentProps<typeof ProfileAvatar>, \"size\" | \"bordered\" | \"badged\"> & {\r\n src?: string;\r\n imageAlt?: string;\r\n variant?: ProfileAvatarVariant;\r\n};\r\n\r\nfunction DialogAvatar({\r\n src,\r\n imageSrc,\r\n className,\r\n avatarClassName,\r\n imageAlt,\r\n variant = \"profile\",\r\n ...props\r\n}: DialogAvatarProps) {\r\n return (\r\n <div\r\n data-slot=\"dialog-avatar\"\r\n className={cn(\r\n \"absolute top-[13px] left-4 flex items-center justify-center size-9 rounded-lg overflow-hidden bg-bg-primary shadow-[0px_1px_2px_-1px_var(--color-shadow-lg-01),0px_1px_3px_0px_var(--color-shadow-md-01),0px_0px_0px_4px_var(--color-focus-ring-secondary)]\",\r\n className,\r\n )}\r\n >\r\n <ProfileAvatar\r\n imageSrc={src ?? imageSrc}\r\n imageAlt={imageAlt}\r\n variant={variant}\r\n bordered={false}\r\n badged={false}\r\n className={cn(\"size-full shrink-0\", avatarClassName)}\r\n {...props}\r\n />\r\n </div>\r\n );\r\n}\r\n\r\nexport {\r\n Dialog,\r\n DialogTrigger,\r\n DialogClose,\r\n DialogPopup,\r\n DialogHeader,\r\n DialogContent,\r\n DialogFooter,\r\n DialogTitle,\r\n DialogDescription,\r\n DialogIcon,\r\n DialogAvatar,\r\n type DialogProps,\r\n type DialogTriggerProps,\r\n type DialogCloseProps,\r\n type DialogPopupProps,\r\n type DialogHeaderProps,\r\n type DialogContentProps,\r\n type DialogFooterProps,\r\n type DialogTitleProps,\r\n type DialogDescriptionProps,\r\n type DialogAvatarProps,\r\n};"]}
|
|
1
|
+
{"version":3,"sources":["../src/ui/dialog.tsx"],"names":["Dialog","props","jsx","DialogTrigger","DialogClose","DialogBackdrop","className","cn","DialogPopup","children","showCloseButton","closeClassName","jsxs","DialogPortal","XIcon","DialogHeader","DialogContent","DialogFooter","DialogTitle","DialogDescription","DialogIcon","DialogAvatar","src","imageSrc","avatarClassName","imageAlt","variant","ProfileAvatar"],"mappings":"iOA6BA,SAASA,EAAOC,CAAAA,CAAoB,CAClC,OAAOC,GAAAA,CAACF,EAAA,CAAiB,GAAGC,CAAAA,CAAO,CACrC,CAIA,SAASE,CAAAA,CAAcF,CAAAA,CAA2B,CAChD,OAAOC,GAAAA,CAACC,CAAAA,CAAA,CAAwB,GAAGF,EAAO,CAC5C,CAIA,SAASG,CAAAA,CAAYH,EAAyB,CAC5C,OAAOC,GAAAA,CAACE,CAAAA,CAAA,CAAsB,GAAGH,CAAAA,CAAO,CAC1C,CAIA,SAASI,CAAAA,CAAe,CAAE,SAAA,CAAAC,CAAAA,CAAW,GAAGL,CAAM,CAAA,CAAwB,CACpE,OACEC,IAACG,CAAAA,CAAA,CACC,SAAA,CAAWE,EAAAA,CAAG,kDAAmDD,CAAS,CAAA,CACzE,GAAGL,CAAAA,CACN,CAEJ,CAOA,SAASO,EAAY,CACnB,SAAA,CAAAF,EACA,QAAA,CAAAG,CAAAA,CACA,eAAA,CAAAC,CAAAA,CAAkB,KAClB,cAAA,CAAAC,CAAAA,CACA,GAAGV,CACL,EAAqB,CACnB,OACEW,IAAAA,CAACC,CAAAA,CAAA,CACC,QAAA,CAAA,CAAAX,GAAAA,CAACG,CAAAA,CAAA,EAAe,EAChBO,IAAAA,CAACJ,CAAAA,CA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AAAA,CAAkB,CAAE,SAAA,CAAAb,CAAAA,CAAW,GAAGL,CAAM,CAAA,CAA2B,CAC1E,OACEC,IAACiB,GAAAA,CAAA,CACC,UAAWZ,EAAAA,CAAG,gDAAA,CAAkDD,CAAS,CAAA,CACxE,GAAGL,CAAAA,CACN,CAEJ,CAEA,SAASmB,CAAAA,CAAW,CAAE,SAAA,CAAAd,EAAW,GAAGL,CAAM,CAAA,CAAgC,CACxE,OACEC,GAAAA,CAAC,KAAA,CAAA,CACC,WAAA,CAAU,aAAA,CACV,UAAWK,EAAAA,CAAG,2RAAA,CAA6RD,CAAS,CAAA,CACnT,GAAGL,CAAAA,CACN,CAEJ,CAQA,SAASoB,EAAa,CACpB,GAAA,CAAAC,CAAAA,CACA,QAAA,CAAAC,EACA,SAAA,CAAAjB,CAAAA,CACA,eAAA,CAAAkB,CAAAA,CACA,SAAAC,CAAAA,CACA,OAAA,CAAAC,CAAAA,CAAU,SAAA,CACV,GAAGzB,CACL,CAAA,CAAsB,CACpB,OACEC,IAAC,KAAA,CAAA,CACC,WAAA,CAAU,eAAA,CACV,SAAA,CAAWK,GACT,6PAAA,CACAD,CACF,CAAA,CAEA,QAAA,CAAAJ,IAACyB,CAAAA,CAAA,CACC,QAAA,CAAUL,CAAAA,EAAOC,EACjB,QAAA,CAAUE,CAAAA,CACV,OAAA,CAASC,CAAAA,CACT,SAAU,KAAA,CACV,MAAA,CAAQ,KAAA,CACR,SAAA,CAAWnB,GAAG,oBAAA,CAAsBiB,CAAe,EAClD,GAAGvB,CAAAA,CACN,EACF,CAEJ","file":"chunk-AA2XSKFM.js","sourcesContent":["import * as React from 'react';\r\nimport { XIcon } from 'lucide-react';\r\n\r\nimport {\r\n Dialog as DialogPrimitive,\r\n DialogPopup as DialogPopupPrimitive,\r\n DialogDescription as DialogDescriptionPrimitive,\r\n DialogFooter as DialogFooterPrimitive,\r\n DialogHeader as DialogHeaderPrimitive,\r\n DialogTitle as DialogTitlePrimitive,\r\n DialogTrigger as DialogTriggerPrimitive,\r\n DialogPortal as DialogPortalPrimitive,\r\n DialogBackdrop as DialogBackdropPrimitive,\r\n DialogClose as DialogClosePrimitive,\r\n type DialogProps as DialogPrimitiveProps,\r\n type DialogPopupProps as DialogPopupPrimitiveProps,\r\n type DialogDescriptionProps as DialogDescriptionPrimitiveProps,\r\n type DialogFooterProps as DialogFooterPrimitiveProps,\r\n type DialogHeaderProps as DialogHeaderPrimitiveProps,\r\n type DialogTitleProps as DialogTitlePrimitiveProps,\r\n type DialogTriggerProps as DialogTriggerPrimitiveProps,\r\n type DialogBackdropProps as DialogBackdropPrimitiveProps,\r\n type DialogCloseProps as DialogClosePrimitiveProps,\r\n} from '../primitives/dialog';\r\nimport { ProfileAvatar, type ProfileAvatarVariant } from '../composites/profile-avatar';\r\nimport { cn } from '@xploreu/lib/cn';\r\n\r\ntype DialogProps = DialogPrimitiveProps;\r\n\r\nfunction Dialog(props: DialogProps) {\r\n return <DialogPrimitive {...props} />;\r\n}\r\n\r\ntype DialogTriggerProps = DialogTriggerPrimitiveProps;\r\n\r\nfunction DialogTrigger(props: DialogTriggerProps) {\r\n return <DialogTriggerPrimitive {...props} />;\r\n}\r\n\r\ntype DialogCloseProps = DialogClosePrimitiveProps;\r\n\r\nfunction DialogClose(props: DialogCloseProps) {\r\n return <DialogClosePrimitive {...props} />;\r\n}\r\n\r\ntype DialogBackdropProps = DialogBackdropPrimitiveProps;\r\n\r\nfunction DialogBackdrop({ className, ...props }: DialogBackdropProps) {\r\n return (\r\n <DialogBackdropPrimitive\r\n className={cn('fixed inset-0 z-50 bg-black/50 backdrop-blur-sm', className)}\r\n {...props}\r\n />\r\n );\r\n}\r\n\r\ntype DialogPopupProps = DialogPopupPrimitiveProps & {\r\n showCloseButton?: boolean;\r\n closeClassName?: string;\r\n};\r\n\r\nfunction DialogPopup({\r\n className,\r\n children,\r\n showCloseButton = true,\r\n closeClassName,\r\n ...props\r\n}: DialogPopupProps) {\r\n return (\r\n <DialogPortalPrimitive>\r\n <DialogBackdrop />\r\n <DialogPopupPrimitive\r\n className={cn(\r\n \"fixed left-[50%] top-[50%] z-50 grid w-[calc(100%-2rem)] max-w-lg translate-x-[-50%] translate-y-[-50%] bg-bg-primary shadow-xp-lg rounded-xl overflow-hidden\",\r\n className,\r\n )}\r\n {...props}\r\n >\r\n {children}\r\n {showCloseButton && (\r\n <DialogClosePrimitive\r\n className={cn(\r\n \"data-[state=open]:bg-bg-primary data-[state=open]:text-text-primary absolute top-3 right-4 rounded-xs transition-colors hover:text-text-error-primary-hover disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4\",\r\n closeClassName\r\n )}\r\n >\r\n <XIcon />\r\n <span className=\"sr-only\">Close</span>\r\n </DialogClosePrimitive>\r\n )}\r\n </DialogPopupPrimitive>\r\n </DialogPortalPrimitive>\r\n );\r\n}\r\n\r\ntype DialogHeaderProps = DialogHeaderPrimitiveProps;\r\n\r\nfunction DialogHeader({ className, ...props }: DialogHeaderProps) {\r\n return (\r\n <DialogHeaderPrimitive\r\n className={cn(\"relative px-4 py-3 flex flex-col bg-bg-primary border-b border-border-tertiary bg-radial-[100%_200%_at_0%_0%] from-modal-dialog-stop-0 to-bg-primary has-[[data-slot=dialog-icon]]:pl-16 has-[[data-slot=dialog-avatar]]:pl-16\", className)}\r\n {...props}\r\n />\r\n );\r\n}\r\n\r\ntype DialogContentProps = React.HTMLAttributes<HTMLDivElement>;\r\n\r\nfunction DialogContent({ className, ...props }: DialogContentProps) {\r\n return (\r\n <div\r\n data-slot=\"dialog-content\"\r\n className={cn(\"px-4 py-4 max-h-[60vh] overflow-y-auto\", className)}\r\n {...props}\r\n />\r\n );\r\n}\r\n\r\ntype DialogFooterProps = DialogFooterPrimitiveProps;\r\n\r\nfunction DialogFooter({ className, ...props }: DialogFooterProps) {\r\n return (\r\n <DialogFooterPrimitive\r\n className={cn(\r\n \"flex gap-2 items-center justify-end bg-bg-primary border-t border-border-tertiary px-4 py-3 shadow-[0px_-1px_24px_0px_var(--color-shadow-xs)] peer-[[data-slot=dialog-content]]:border-0\",\r\n className\r\n )}\r\n {...props}\r\n />\r\n );\r\n}\r\n\r\ntype DialogTitleProps = DialogTitlePrimitiveProps;\r\n\r\nfunction DialogTitle({ className, ...props }: DialogTitleProps) {\r\n return (\r\n <DialogTitlePrimitive\r\n className={cn(\"text-label-bold-2 text-text-primary\", className)}\r\n {...props}\r\n />\r\n );\r\n}\r\n\r\ntype DialogDescriptionProps = DialogDescriptionPrimitiveProps;\r\n\r\nfunction DialogDescription({ className, ...props }: DialogDescriptionProps) {\r\n return (\r\n <DialogDescriptionPrimitive\r\n className={cn(\"mt-0.5 text-body-regular-3 text-text-secondary\", className)}\r\n {...props}\r\n />\r\n );\r\n}\r\n\r\nfunction DialogIcon({ className, ...props }: React.ComponentProps<\"div\">) {\r\n return (\r\n <div\r\n data-slot=\"dialog-icon\"\r\n className={cn(\"absolute top-[13px] left-4 flex items-center justify-center rounded-lg bg-bg-primary p-2.5 [&_svg]:size-4 bg-bg-brand-solid text-fg-white shadow-[0px_1px_2px_-1px_var(--color-shadow-lg-01),0px_1px_3px_0px_var(--color-shadow-md-01),0px_0px_0px_4px_var(--color-focus-ring-secondary)]\", className)}\r\n {...props}\r\n />\r\n );\r\n}\r\n\r\ntype DialogAvatarProps = Omit<React.ComponentProps<typeof ProfileAvatar>, \"size\" | \"bordered\" | \"badged\"> & {\r\n src?: string;\r\n imageAlt?: string;\r\n variant?: ProfileAvatarVariant;\r\n};\r\n\r\nfunction DialogAvatar({\r\n src,\r\n imageSrc,\r\n className,\r\n avatarClassName,\r\n imageAlt,\r\n variant = \"profile\",\r\n ...props\r\n}: DialogAvatarProps) {\r\n return (\r\n <div\r\n data-slot=\"dialog-avatar\"\r\n className={cn(\r\n \"absolute top-[13px] left-4 flex items-center justify-center size-9 rounded-lg overflow-hidden bg-bg-primary shadow-[0px_1px_2px_-1px_var(--color-shadow-lg-01),0px_1px_3px_0px_var(--color-shadow-md-01),0px_0px_0px_4px_var(--color-focus-ring-secondary)]\",\r\n className,\r\n )}\r\n >\r\n <ProfileAvatar\r\n imageSrc={src ?? imageSrc}\r\n imageAlt={imageAlt}\r\n variant={variant}\r\n bordered={false}\r\n badged={false}\r\n className={cn(\"size-full shrink-0\", avatarClassName)}\r\n {...props}\r\n />\r\n </div>\r\n );\r\n}\r\n\r\nexport {\r\n Dialog,\r\n DialogTrigger,\r\n DialogClose,\r\n DialogPopup,\r\n DialogHeader,\r\n DialogContent,\r\n DialogFooter,\r\n DialogTitle,\r\n DialogDescription,\r\n DialogIcon,\r\n DialogAvatar,\r\n type DialogProps,\r\n type DialogTriggerProps,\r\n type DialogCloseProps,\r\n type DialogPopupProps,\r\n type DialogHeaderProps,\r\n type DialogContentProps,\r\n type DialogFooterProps,\r\n type DialogTitleProps,\r\n type DialogDescriptionProps,\r\n type DialogAvatarProps,\r\n};"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import {a,b as b$1,c}from'./chunk-HVR2PWQX.js';import'react';import {cva}from'class-variance-authority';import {cn}from'@xploreu/lib/cn';import {jsx}from'react/jsx-runtime';var l=cva("relative flex shrink-0 overflow-hidden rounded-xp-card-base",{variants:{size:{xs:"size-6",sm:"size-8",md:"size-10",lg:"size-12",xl:"size-14","2xl":"size-16","3xl":"size-20"}},defaultVariants:{size:"sm"}});function n({className:a$1,size:r,...t}){return jsx(a,{className:cn(l({size:r,className:a$1})),"data-slot":"avatar",...t})}function b({className:a,alt:r,...t}){return jsx(b$1,{alt:r||"Avatar",className:cn("bg-bg-primary object-cover",a),"data-slot":"avatar-image",...t})}function f({className:a,...r}){return jsx(c,{className:cn("aspect-square size-full",a),"data-slot":"avatar-fallback",...r})}export{l as a,n as b,b as c,f as d};//# sourceMappingURL=chunk-CQEBQK7U.js.map
|
|
2
|
+
//# sourceMappingURL=chunk-CQEBQK7U.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/ui/avatar.tsx"],"names":["avatarVariants","cva","Avatar","className","size","props","jsx","cn","AvatarImage","alt","AvatarFallback"],"mappings":"6KAeA,IAAMA,CAAAA,CAAiBC,GAAAA,CACrB,6DAAA,CACA,CACE,QAAA,CAAU,CACR,IAAA,CAAM,CACJ,EAAA,CAAI,QAAA,CACJ,EAAA,CAAI,QAAA,CACJ,EAAA,CAAI,SAAA,CACJ,EAAA,CAAI,SAAA,CACJ,EAAA,CAAI,SAAA,CACJ,KAAA,CAAO,SAAA,CACP,KAAA,CAAO,SACT,CACF,CAAA,CACA,eAAA,CAAiB,CACf,IAAA,CAAM,IACR,CACF,CACF,EAIA,SAASC,CAAAA,CAAO,CAAE,SAAA,CAAAC,GAAAA,CAAW,IAAA,CAAAC,CAAAA,CAAM,GAAGC,CAAM,CAAA,CAAgB,CAC1D,OACEC,GAAAA,CAACJ,CAAAA,CAAA,CACC,SAAA,CAAWK,GAAGP,CAAAA,CAAe,CAAE,IAAA,CAAAI,CAAAA,CAAM,SAAA,CAAAD,GAAU,CAAC,CAAC,CAAA,CACjD,WAAA,CAAU,QAAA,CACT,GAAGE,CAAAA,CACN,CAEJ,CAIA,SAASG,CAAAA,CAAY,CAAE,SAAA,CAAAL,CAAAA,CAAW,GAAA,CAAAM,CAAAA,CAAK,GAAGJ,CAAM,CAAA,CAAqB,CACnE,OACEC,GAAAA,CAACE,GAAAA,CAAA,CACC,GAAA,CAAKC,CAAAA,EAAO,SACZ,SAAA,CAAWF,EAAAA,CAAG,4BAAA,CAA8BJ,CAAS,CAAA,CACrD,WAAA,CAAU,cAAA,CACT,GAAGE,CAAAA,CACN,CAEJ,CAIA,SAASK,CAAAA,CAAe,CAAE,SAAA,CAAAP,CAAAA,CAAW,GAAGE,CAAM,CAAA,CAAwB,CACpE,OACEC,GAAAA,CAACI,CAAAA,CAAA,CACC,SAAA,CAAWH,EAAAA,CAAG,yBAAA,CAA2BJ,CAAS,CAAA,CAClD,WAAA,CAAU,iBAAA,CACT,GAAGE,EACN,CAEJ","file":"chunk-CQEBQK7U.js","sourcesContent":["'use client';\r\n\r\nimport * as React from 'react';\r\nimport { cva, type VariantProps } from 'class-variance-authority';\r\n\r\nimport { cn } from '@xploreu/lib/cn';\r\nimport {\r\n Avatar as AvatarPrimitive,\r\n AvatarImage as AvatarPrimitiveImage,\r\n AvatarFallback as AvatarPrimitiveFallback,\r\n type AvatarProps as AvatarPrimitiveProps,\r\n type AvatarImageProps as AvatarPrimitiveImageProps,\r\n type AvatarFallbackProps as AvatarPrimitiveFallbackProps,\r\n} from '../primitives/avatar';\r\n\r\nconst avatarVariants = cva(\r\n 'relative flex shrink-0 overflow-hidden rounded-xp-card-base',\r\n {\r\n variants: {\r\n size: {\r\n xs: 'size-6',\r\n sm: 'size-8',\r\n md: 'size-10',\r\n lg: 'size-12',\r\n xl: 'size-14',\r\n '2xl': 'size-16',\r\n '3xl': 'size-20',\r\n },\r\n },\r\n defaultVariants: {\r\n size: 'sm',\r\n },\r\n }\r\n);\r\n\r\ntype AvatarProps = AvatarPrimitiveProps & VariantProps<typeof avatarVariants>;\r\n\r\nfunction Avatar({ className, size, ...props }: AvatarProps) {\r\n return (\r\n <AvatarPrimitive\r\n className={cn(avatarVariants({ size, className }))}\r\n data-slot=\"avatar\"\r\n {...props}\r\n />\r\n );\r\n}\r\n\r\ntype AvatarImageProps = AvatarPrimitiveImageProps;\r\n\r\nfunction AvatarImage({ className, alt, ...props }: AvatarImageProps) {\r\n return (\r\n <AvatarPrimitiveImage\r\n alt={alt || 'Avatar'}\r\n className={cn('bg-bg-primary object-cover', className)}\r\n data-slot=\"avatar-image\"\r\n {...props}\r\n />\r\n );\r\n}\r\n\r\ntype AvatarFallbackProps = AvatarPrimitiveFallbackProps;\r\n\r\nfunction AvatarFallback({ className, ...props }: AvatarFallbackProps) {\r\n return (\r\n <AvatarPrimitiveFallback\r\n className={cn('aspect-square size-full', className)}\r\n data-slot=\"avatar-fallback\"\r\n {...props}\r\n />\r\n );\r\n}\r\n\r\nexport {\r\n Avatar,\r\n AvatarImage,\r\n AvatarFallback,\r\n avatarVariants,\r\n type AvatarProps,\r\n type AvatarImageProps,\r\n type AvatarFallbackProps,\r\n};\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,t,u,v,w,x,y,z,A,B,C,D}from'./chunk-ZNZVX4PT.js';import {a as a$2}from'./chunk-TED2PUK6.js';import {b}from'./chunk-JH6RZ3QH.js';import {a as a$1}from'./chunk-XG3W7QMP.js';import {b as b$2,c as c$1,d as d$1}from'./chunk-CQEBQK7U.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 fo(o){return jsx(c,{...o})}function to(o){let{className:t,...r}=o;return jsx(d,{className:cn("group/combobox-trigger flex items-center gap-2",t),...r})}function Io(o){let{className:t,...r}=o;return jsx(e,{className:cn("text-label-semibold-2 text-text-secondary",t),...r})}function No(o){let{className:t,...r}=o;return jsx(f,{className:cn("flex w-full items-center gap-2",t),...r})}function wo({className:o,wrapperClassName:t,...r}){return jsx("div",{className:cn("p-3 border-b border-border-primary",t),children:jsx(g,{className:o,render:jsx(b,{size:"sm",startContent:jsx(SearchIcon,{})}),...r})})}function ko({className:o,displayValueKey:t={label:"label",value:"value"},placeholder:r="Search and Select Company",inputProps:m,...i}){let{inputValue:p,setInputValue:s}=a(),{className:n,startContent:x,...oo}=m||{};return jsx("div",{className:cn("flex flex-col gap-2",o),children:jsxs(bo,{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",n),endContent:jsx(to,{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=>{s("",{reason:"none",event:C.nativeEvent,cancel:()=>{},allowPropagation:()=>{},isCanceled:false,isPropagationAllowed:true,trigger:void 0});}})}),placeholder:r,startContent:x??jsx(SearchIcon,{className:"!size-4 !text-fg-tertiary-hover"}),...oo}),...i}),jsx(ro,{children:C=>C?.map(y=>jsxs(io,{children:[y?.[t.label]||"",jsx(mo,{})]},y?.[t.value]||""))})]})})}function Lo(o){let{className:t,...r}=o;return jsx(h,{className:cn("text-text-secondary",t),...r})}function So(o){return jsx(i,{render:jsx(XIcon,{}),...o})}function ro(o){return jsx(j,{...o})}function bo({className:o,...t}){return jsx(k,{className:cn("flex flex-wrap gap-2",o),...t})}function io({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 mo({className:o,...t}){return jsx(e$1,{className:cn("text-fg-quaternary",o),render:jsx(m,{...t})})}function Go({className:o$1,align:t="start",sideOffset:r=4,container:m,initialFocus:i,finalFocus:p$1,style:s,children:n$1,...x}){return jsx(n,{container:m,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:p$1,initialFocus:i,style:s,children:jsx(so,{children:n$1})})})})}function Ro(o){return jsx(n,{...o})}function Ao(o$1){return jsx(o,{...o$1})}function Ho(o){let{className:t,...r}=o;return jsx(q,{className:cn("bg-black/30",t),...r})}function Vo({className:o,status:t,...r$1}){let{inputValue:m}=a(),i=m?.toString().trim(),s=t==="empty"&&i?`No matches for "${i}".`:t==="empty"&&!i?"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",!s&&"hidden",o),...r$1,children:s})}function To({className:o,...t}){return jsx(s,{className:cn("px-3 py-2 text-body-regular-2 text-text-secondary",o),...t})}function Bo({className:o,...t$1}){return jsx(t,{className:cn("max-h-[min(calc(--spacing(72)---spacing(9)),calc(var(--available-height)---spacing(9)))] overflow-auto scrollbar-thin flex flex-col p-1 focus-visible:outline-none data-[empty]:hidden",o),...t$1})}function so(o){let{className:t,...r}=o;return jsx(u,{className:cn("absolute inset-0 bg-bg-primary-hover",t),...r})}function po(o){return jsx(v,{...o})}function zo(o){let{className:t,...r}=o;return jsx(w,{className:cn("group/combobox-row",t),...r})}function Eo({className:o,children:t,indicator:r="check-circle",...m}){let{disabled:i}=m;return jsx(po,{activeClassName:"bg-bg-primary-hover rounded-md",disabled:i,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),...m,children:[t,jsx(ao,{className:"absolute group-data-[indicator=check-circle]/combobox-item:right-2 group-data-[indicator=checkbox]/combobox-item:left-2",keepMounted:r==="checkbox",render:(p,s)=>jsxs("span",{...p,children:[r==="check-circle"&&jsx(CheckCircle2Icon,{className:"size-4 text-fg-brand-primary shrink-0"}),r==="checkbox"&&jsx(a$1,{checked:s.selected})]})})]})})}function Mo({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 Do({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 Fo({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 qo({src:o,imageSrc:t,className:r,avatarClassName:m,imageAlt:i,fallbackText:p,children:s,...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",m),...n,children:[jsx(c$1,{alt:i,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:p??s})]})})}function ao(o){return jsx(y,{...o})}function Oo(o){let{className:t,...r}=o;return jsx(z,{className:cn("my-1 h-px bg-border-primary",t),...r})}function _o(o){let{className:t,...r}=o;return jsx(A,{className:cn("py-1",t),...r})}function jo(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 Uo(o){return jsx(C,{...o})}function Xo(o){let{className:t,...r}=o;return jsx(D,{className:cn("fill-bg-primary",t),...r})}function $o({hasMore:o,threshold:t=.5,...r}){return jsx(a$2,{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{qo as A,ao as B,Oo as C,_o as D,jo as E,Uo as F,Xo as G,$o as H,fo as a,to as b,Io as c,No as d,wo as e,ko as f,Lo as g,So as h,ro as i,bo as j,io as k,mo as l,Go as m,Ro as n,Ao as o,Ho as p,Vo as q,To as r,Bo as s,so as t,po as u,zo as v,Eo as w,Mo as x,Do as y,Fo as z};//# sourceMappingURL=chunk-DUSAF7E7.js.map
|
|
2
|
+
//# sourceMappingURL=chunk-DUSAF7E7.js.map
|