@c-rex/ui 0.0.8 → 0.0.9
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/alert.cjs +2 -0
- package/dist/alert.cjs.map +1 -0
- package/dist/alert.d.cts +11 -0
- package/dist/alert.d.ts +11 -0
- package/dist/alert.js +2 -0
- package/dist/alert.js.map +1 -0
- package/dist/breadcrumb.cjs +2 -0
- package/dist/breadcrumb.cjs.map +1 -0
- package/dist/breadcrumb.d.cts +22 -0
- package/dist/breadcrumb.d.ts +22 -0
- package/dist/breadcrumb.js +2 -0
- package/dist/breadcrumb.js.map +1 -0
- package/dist/button.cjs +2 -0
- package/dist/button.cjs.map +1 -0
- package/dist/button.d.cts +15 -0
- package/dist/button.d.ts +15 -0
- package/dist/button.js +2 -0
- package/dist/button.js.map +1 -0
- package/dist/command.cjs +2 -0
- package/dist/command.cjs.map +1 -0
- package/dist/command.d.cts +83 -0
- package/dist/command.d.ts +83 -0
- package/dist/command.js +2 -0
- package/dist/command.js.map +1 -0
- package/dist/dialog.cjs +2 -0
- package/dist/dialog.cjs.map +1 -0
- package/dist/dialog.d.cts +22 -0
- package/dist/dialog.d.ts +22 -0
- package/dist/dialog.js +2 -0
- package/dist/dialog.js.map +1 -0
- package/dist/hooks/use-mobile.cjs +2 -0
- package/dist/hooks/use-mobile.cjs.map +1 -0
- package/dist/hooks/use-mobile.d.cts +3 -0
- package/dist/hooks/use-mobile.d.ts +3 -0
- package/dist/hooks/use-mobile.js +2 -0
- package/dist/hooks/use-mobile.js.map +1 -0
- package/dist/input.cjs +2 -0
- package/dist/input.cjs.map +1 -0
- package/dist/input.d.cts +5 -0
- package/dist/input.d.ts +5 -0
- package/dist/input.js +2 -0
- package/dist/input.js.map +1 -0
- package/dist/popover.cjs +2 -0
- package/dist/popover.cjs.map +1 -0
- package/dist/popover.d.cts +9 -0
- package/dist/popover.d.ts +9 -0
- package/dist/popover.js +2 -0
- package/dist/popover.js.map +1 -0
- package/dist/select.cjs +2 -0
- package/dist/select.cjs.map +1 -0
- package/dist/select.d.cts +15 -0
- package/dist/select.d.ts +15 -0
- package/dist/select.js +2 -0
- package/dist/select.js.map +1 -0
- package/dist/separator.cjs +2 -0
- package/dist/separator.cjs.map +1 -0
- package/dist/separator.d.cts +6 -0
- package/dist/separator.d.ts +6 -0
- package/dist/separator.js +2 -0
- package/dist/separator.js.map +1 -0
- package/dist/sheet.cjs +2 -0
- package/dist/sheet.cjs.map +1 -0
- package/dist/sheet.d.cts +29 -0
- package/dist/sheet.d.ts +29 -0
- package/dist/sheet.js +2 -0
- package/dist/sheet.js.map +1 -0
- package/dist/sidebar.cjs +2 -0
- package/dist/sidebar.cjs.map +1 -0
- package/dist/sidebar.d.cts +72 -0
- package/dist/sidebar.d.ts +72 -0
- package/dist/sidebar.js +2 -0
- package/dist/sidebar.js.map +1 -0
- package/dist/skeleton.cjs +2 -0
- package/dist/skeleton.cjs.map +1 -0
- package/dist/skeleton.d.cts +5 -0
- package/dist/skeleton.d.ts +5 -0
- package/dist/skeleton.js +2 -0
- package/dist/skeleton.js.map +1 -0
- package/dist/table.cjs +2 -0
- package/dist/table.cjs.map +1 -0
- package/dist/table.d.cts +12 -0
- package/dist/table.d.ts +12 -0
- package/dist/table.js +2 -0
- package/dist/table.js.map +1 -0
- package/dist/tooltip.cjs +2 -0
- package/dist/tooltip.cjs.map +1 -0
- package/dist/tooltip.d.cts +9 -0
- package/dist/tooltip.d.ts +9 -0
- package/dist/tooltip.js +2 -0
- package/dist/tooltip.js.map +1 -0
- package/package.json +114 -97
- package/src/alert.tsx +0 -58
- package/src/breadcrumb.tsx +0 -115
- package/src/button.tsx +0 -66
- package/src/command.tsx +0 -151
- package/src/dialog.tsx +0 -122
- package/src/hooks/use-mobile.tsx +0 -19
- package/src/input.tsx +0 -22
- package/src/popover.tsx +0 -31
- package/src/select.tsx +0 -157
- package/src/separator.tsx +0 -29
- package/src/sheet.tsx +0 -140
- package/src/sidebar.tsx +0 -785
- package/src/skeleton.tsx +0 -15
- package/src/table.tsx +0 -120
- package/src/tooltip.tsx +0 -30
package/dist/alert.cjs
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var f=Object.create;var i=Object.defineProperty;var g=Object.getOwnPropertyDescriptor;var u=Object.getOwnPropertyNames;var T=Object.getPrototypeOf,b=Object.prototype.hasOwnProperty;var H=(e,t)=>{for(var r in t)i(e,r,{get:t[r],enumerable:!0})},d=(e,t,r,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of u(t))!b.call(e,a)&&a!==r&&i(e,a,{get:()=>t[a],enumerable:!(s=g(t,a))||s.enumerable});return e};var R=(e,t,r)=>(r=e!=null?f(T(e)):{},d(t||!e||!e.__esModule?i(r,"default",{value:e,enumerable:!0}):r,e)),x=e=>d(i({},"__esModule",{value:!0}),e);var L={};H(L,{Alert:()=>m,AlertDescription:()=>v,AlertTitle:()=>p});module.exports=x(L);var l=R(require("react"),1),c=require("class-variance-authority"),o=require("@c-rex/utils"),n=require("react/jsx-runtime"),A=(0,c.cva)("relative w-full rounded-lg border px-4 py-3 text-sm [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground [&>svg~*]:pl-7",{variants:{variant:{default:"bg-background text-foreground",destructive:"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive"}},defaultVariants:{variant:"default"}}),m=l.forwardRef(({className:e,variant:t,...r},s)=>(0,n.jsx)("div",{ref:s,role:"alert",className:(0,o.cn)(A({variant:t}),e),...r}));m.displayName="Alert";var p=l.forwardRef(({className:e,...t},r)=>(0,n.jsx)("h5",{ref:r,className:(0,o.cn)("mb-1 font-medium leading-none tracking-tight",e),...t}));p.displayName="AlertTitle";var v=l.forwardRef(({className:e,...t},r)=>(0,n.jsx)("div",{ref:r,className:(0,o.cn)("text-sm [&_p]:leading-relaxed",e),...t}));v.displayName="AlertDescription";0&&(module.exports={Alert,AlertDescription,AlertTitle});
|
|
2
|
+
//# sourceMappingURL=alert.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/alert.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\nimport { cn } from \"@c-rex/utils\";\n\nconst alertVariants = cva(\n \"relative w-full rounded-lg border px-4 py-3 text-sm [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground [&>svg~*]:pl-7\",\n {\n variants: {\n variant: {\n default: \"bg-background text-foreground\",\n destructive:\n \"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n },\n },\n);\n\nconst Alert = React.forwardRef<\n HTMLDivElement,\n React.HTMLAttributes<HTMLDivElement> & VariantProps<typeof alertVariants>\n>(({ className, variant, ...props }, ref) => (\n <div\n ref={ref}\n role=\"alert\"\n className={cn(alertVariants({ variant }), className)}\n {...props}\n />\n));\nAlert.displayName = \"Alert\";\n\nconst AlertTitle = React.forwardRef<\n HTMLParagraphElement,\n React.HTMLAttributes<HTMLHeadingElement>\n>(({ className, ...props }, ref) => (\n <h5\n ref={ref}\n className={cn(\"mb-1 font-medium leading-none tracking-tight\", className)}\n {...props}\n />\n));\nAlertTitle.displayName = \"AlertTitle\";\n\nconst AlertDescription = React.forwardRef<\n HTMLParagraphElement,\n React.HTMLAttributes<HTMLParagraphElement>\n>(({ className, ...props }, ref) => (\n <div\n ref={ref}\n className={cn(\"text-sm [&_p]:leading-relaxed\", className)}\n {...props}\n />\n));\nAlertDescription.displayName = \"AlertDescription\";\n\nexport { Alert, AlertTitle, AlertDescription };\n"],"mappings":"0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,WAAAE,EAAA,qBAAAC,EAAA,eAAAC,IAAA,eAAAC,EAAAL,GAAA,IAAAM,EAAuB,sBACvBC,EAAuC,oCACvCC,EAAmB,wBAsBfC,EAAA,6BApBEC,KAAgB,OAClB,0KACA,CACI,SAAU,CACN,QAAS,CACL,QAAS,gCACT,YACI,yFACR,CACJ,EACA,gBAAiB,CACb,QAAS,SACb,CACJ,CACJ,EAEMR,EAAc,aAGlB,CAAC,CAAE,UAAAS,EAAW,QAAAC,EAAS,GAAGC,CAAM,EAAGC,OACjC,OAAC,OACG,IAAKA,EACL,KAAK,QACL,aAAW,MAAGJ,EAAc,CAAE,QAAAE,CAAQ,CAAC,EAAGD,CAAS,EAClD,GAAGE,EACR,CACH,EACDX,EAAM,YAAc,QAEpB,IAAME,EAAmB,aAGvB,CAAC,CAAE,UAAAO,EAAW,GAAGE,CAAM,EAAGC,OACxB,OAAC,MACG,IAAKA,EACL,aAAW,MAAG,+CAAgDH,CAAS,EACtE,GAAGE,EACR,CACH,EACDT,EAAW,YAAc,aAEzB,IAAMD,EAAyB,aAG7B,CAAC,CAAE,UAAAQ,EAAW,GAAGE,CAAM,EAAGC,OACxB,OAAC,OACG,IAAKA,EACL,aAAW,MAAG,gCAAiCH,CAAS,EACvD,GAAGE,EACR,CACH,EACDV,EAAiB,YAAc","names":["alert_exports","__export","Alert","AlertDescription","AlertTitle","__toCommonJS","React","import_class_variance_authority","import_utils","import_jsx_runtime","alertVariants","className","variant","props","ref"]}
|
package/dist/alert.d.cts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as class_variance_authority_dist_types from 'class-variance-authority/dist/types';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { VariantProps } from 'class-variance-authority';
|
|
4
|
+
|
|
5
|
+
declare const Alert: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & VariantProps<(props?: ({
|
|
6
|
+
variant?: "default" | "destructive" | null | undefined;
|
|
7
|
+
} & class_variance_authority_dist_types.ClassProp) | undefined) => string> & React.RefAttributes<HTMLDivElement>>;
|
|
8
|
+
declare const AlertTitle: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLHeadingElement> & React.RefAttributes<HTMLParagraphElement>>;
|
|
9
|
+
declare const AlertDescription: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLParagraphElement> & React.RefAttributes<HTMLParagraphElement>>;
|
|
10
|
+
|
|
11
|
+
export { Alert, AlertDescription, AlertTitle };
|
package/dist/alert.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as class_variance_authority_dist_types from 'class-variance-authority/dist/types';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { VariantProps } from 'class-variance-authority';
|
|
4
|
+
|
|
5
|
+
declare const Alert: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & VariantProps<(props?: ({
|
|
6
|
+
variant?: "default" | "destructive" | null | undefined;
|
|
7
|
+
} & class_variance_authority_dist_types.ClassProp) | undefined) => string> & React.RefAttributes<HTMLDivElement>>;
|
|
8
|
+
declare const AlertTitle: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLHeadingElement> & React.RefAttributes<HTMLParagraphElement>>;
|
|
9
|
+
declare const AlertDescription: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLParagraphElement> & React.RefAttributes<HTMLParagraphElement>>;
|
|
10
|
+
|
|
11
|
+
export { Alert, AlertDescription, AlertTitle };
|
package/dist/alert.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import*as a from"react";import{cva as o}from"class-variance-authority";import{cn as s}from"@c-rex/utils";import{jsx as i}from"react/jsx-runtime";var n=o("relative w-full rounded-lg border px-4 py-3 text-sm [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground [&>svg~*]:pl-7",{variants:{variant:{default:"bg-background text-foreground",destructive:"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive"}},defaultVariants:{variant:"default"}}),d=a.forwardRef(({className:e,variant:t,...r},l)=>i("div",{ref:l,role:"alert",className:s(n({variant:t}),e),...r}));d.displayName="Alert";var c=a.forwardRef(({className:e,...t},r)=>i("h5",{ref:r,className:s("mb-1 font-medium leading-none tracking-tight",e),...t}));c.displayName="AlertTitle";var m=a.forwardRef(({className:e,...t},r)=>i("div",{ref:r,className:s("text-sm [&_p]:leading-relaxed",e),...t}));m.displayName="AlertDescription";export{d as Alert,m as AlertDescription,c as AlertTitle};
|
|
2
|
+
//# sourceMappingURL=alert.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/alert.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\nimport { cn } from \"@c-rex/utils\";\n\nconst alertVariants = cva(\n \"relative w-full rounded-lg border px-4 py-3 text-sm [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground [&>svg~*]:pl-7\",\n {\n variants: {\n variant: {\n default: \"bg-background text-foreground\",\n destructive:\n \"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n },\n },\n);\n\nconst Alert = React.forwardRef<\n HTMLDivElement,\n React.HTMLAttributes<HTMLDivElement> & VariantProps<typeof alertVariants>\n>(({ className, variant, ...props }, ref) => (\n <div\n ref={ref}\n role=\"alert\"\n className={cn(alertVariants({ variant }), className)}\n {...props}\n />\n));\nAlert.displayName = \"Alert\";\n\nconst AlertTitle = React.forwardRef<\n HTMLParagraphElement,\n React.HTMLAttributes<HTMLHeadingElement>\n>(({ className, ...props }, ref) => (\n <h5\n ref={ref}\n className={cn(\"mb-1 font-medium leading-none tracking-tight\", className)}\n {...props}\n />\n));\nAlertTitle.displayName = \"AlertTitle\";\n\nconst AlertDescription = React.forwardRef<\n HTMLParagraphElement,\n React.HTMLAttributes<HTMLParagraphElement>\n>(({ className, ...props }, ref) => (\n <div\n ref={ref}\n className={cn(\"text-sm [&_p]:leading-relaxed\", className)}\n {...props}\n />\n));\nAlertDescription.displayName = \"AlertDescription\";\n\nexport { Alert, AlertTitle, AlertDescription };\n"],"mappings":"AAAA,UAAYA,MAAW,QACvB,OAAS,OAAAC,MAA8B,2BACvC,OAAS,MAAAC,MAAU,eAsBf,cAAAC,MAAA,oBApBJ,IAAMC,EAAgBH,EAClB,0KACA,CACI,SAAU,CACN,QAAS,CACL,QAAS,gCACT,YACI,yFACR,CACJ,EACA,gBAAiB,CACb,QAAS,SACb,CACJ,CACJ,EAEMI,EAAc,aAGlB,CAAC,CAAE,UAAAC,EAAW,QAAAC,EAAS,GAAGC,CAAM,EAAGC,IACjCN,EAAC,OACG,IAAKM,EACL,KAAK,QACL,UAAWP,EAAGE,EAAc,CAAE,QAAAG,CAAQ,CAAC,EAAGD,CAAS,EAClD,GAAGE,EACR,CACH,EACDH,EAAM,YAAc,QAEpB,IAAMK,EAAmB,aAGvB,CAAC,CAAE,UAAAJ,EAAW,GAAGE,CAAM,EAAGC,IACxBN,EAAC,MACG,IAAKM,EACL,UAAWP,EAAG,+CAAgDI,CAAS,EACtE,GAAGE,EACR,CACH,EACDE,EAAW,YAAc,aAEzB,IAAMC,EAAyB,aAG7B,CAAC,CAAE,UAAAL,EAAW,GAAGE,CAAM,EAAGC,IACxBN,EAAC,OACG,IAAKM,EACL,UAAWP,EAAG,gCAAiCI,CAAS,EACvD,GAAGE,EACR,CACH,EACDG,EAAiB,YAAc","names":["React","cva","cn","jsx","alertVariants","Alert","className","variant","props","ref","AlertTitle","AlertDescription"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var I=Object.create;var u=Object.defineProperty;var H=Object.getOwnPropertyDescriptor;var T=Object.getOwnPropertyNames;var M=Object.getPrototypeOf,_=Object.prototype.hasOwnProperty;var O=(e,t)=>{for(var r in t)u(e,r,{get:t[r],enumerable:!0})},h=(e,t,r,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of T(t))!_.call(e,n)&&n!==r&&u(e,n,{get:()=>t[n],enumerable:!(o=H(t,n))||o.enumerable});return e};var y=(e,t,r)=>(r=e!=null?I(M(e)):{},h(t||!e||!e.__esModule?u(r,"default",{value:e,enumerable:!0}):r,e)),V=e=>h(u({},"__esModule",{value:!0}),e);var Z={};O(Z,{Breadcrumb:()=>E,BreadcrumbEllipsis:()=>v,BreadcrumbItem:()=>x,BreadcrumbLink:()=>P,BreadcrumbList:()=>B,BreadcrumbPage:()=>w,BreadcrumbSeparator:()=>L});module.exports=V(Z);var m=y(require("react"),1);var a=y(require("react"),1);var k=y(require("react"),1);function C(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function N(...e){return t=>{let r=!1,o=e.map(n=>{let l=C(n,t);return!r&&typeof l=="function"&&(r=!0),l});if(r)return()=>{for(let n=0;n<o.length;n++){let l=o[n];typeof l=="function"?l():C(e[n],null)}}}}var d=require("react/jsx-runtime");function A(e){let t=j(e),r=a.forwardRef((o,n)=>{let{children:l,...p}=o,i=a.Children.toArray(l),b=i.find(D);if(b){let f=b.props.children,W=i.map(g=>g===b?a.Children.count(f)>1?a.Children.only(null):a.isValidElement(f)?f.props.children:null:g);return(0,d.jsx)(t,{...p,ref:n,children:a.isValidElement(f)?a.cloneElement(f,void 0,W):null})}return(0,d.jsx)(t,{...p,ref:n,children:l})});return r.displayName=`${e}.Slot`,r}var S=A("Slot");function j(e){let t=a.forwardRef((r,o)=>{let{children:n,...l}=r;if(a.isValidElement(n)){let p=z(n),i=$(l,n.props);return n.type!==a.Fragment&&(i.ref=o?N(o,p):p),a.cloneElement(n,i)}return a.Children.count(n)>1?a.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var F=Symbol("radix.slottable");function D(e){return a.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===F}function $(e,t){let r={...t};for(let o in t){let n=e[o],l=t[o];/^on[A-Z]/.test(o)?n&&l?r[o]=(...i)=>{l(...i),n(...i)}:n&&(r[o]=n):o==="style"?r[o]={...n,...l}:o==="className"&&(r[o]=[n,l].filter(Boolean).join(" "))}return{...e,...r}}function z(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var R=require("lucide-react"),c=require("@c-rex/utils"),s=require("react/jsx-runtime"),E=m.forwardRef(({...e},t)=>(0,s.jsx)("nav",{ref:t,"aria-label":"breadcrumb",...e}));E.displayName="Breadcrumb";var B=m.forwardRef(({className:e,...t},r)=>(0,s.jsx)("ol",{ref:r,className:(0,c.cn)("flex flex-wrap items-center gap-1.5 break-words text-sm text-muted-foreground sm:gap-2.5",e),...t}));B.displayName="BreadcrumbList";var x=m.forwardRef(({className:e,...t},r)=>(0,s.jsx)("li",{ref:r,className:(0,c.cn)("inline-flex items-center gap-1.5",e),...t}));x.displayName="BreadcrumbItem";var P=m.forwardRef(({asChild:e,className:t,...r},o)=>(0,s.jsx)(e?S:"a",{ref:o,className:(0,c.cn)("transition-colors hover:text-foreground",t),...r}));P.displayName="BreadcrumbLink";var w=m.forwardRef(({className:e,...t},r)=>(0,s.jsx)("span",{ref:r,role:"link","aria-disabled":"true","aria-current":"page",className:(0,c.cn)("font-normal text-foreground",e),...t}));w.displayName="BreadcrumbPage";var L=({children:e,className:t,...r})=>(0,s.jsx)("li",{role:"presentation","aria-hidden":"true",className:(0,c.cn)("[&>svg]:w-3.5 [&>svg]:h-3.5",t),...r,children:e??(0,s.jsx)(R.ChevronRight,{})});L.displayName="BreadcrumbSeparator";var v=({className:e,...t})=>(0,s.jsxs)("span",{role:"presentation","aria-hidden":"true",className:(0,c.cn)("flex h-9 w-9 items-center justify-center",e),...t,children:[(0,s.jsx)(R.MoreHorizontal,{className:"h-4 w-4"}),(0,s.jsx)("span",{className:"sr-only",children:"More"})]});v.displayName="BreadcrumbElipssis";0&&(module.exports={Breadcrumb,BreadcrumbEllipsis,BreadcrumbItem,BreadcrumbLink,BreadcrumbList,BreadcrumbPage,BreadcrumbSeparator});
|
|
2
|
+
//# sourceMappingURL=breadcrumb.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/breadcrumb.tsx","../../../node_modules/@radix-ui/react-slot/src/slot.tsx","../../../node_modules/@radix-ui/react-compose-refs/src/compose-refs.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { Slot } from \"@radix-ui/react-slot\";\nimport { ChevronRight, MoreHorizontal } from \"lucide-react\";\n\nimport { cn } from \"@c-rex/utils\";\n\nconst Breadcrumb = React.forwardRef<\n HTMLElement,\n React.ComponentPropsWithoutRef<\"nav\"> & {\n separator?: React.ReactNode;\n }\n>(({ ...props }, ref) => <nav ref={ref} aria-label=\"breadcrumb\" {...props} />);\nBreadcrumb.displayName = \"Breadcrumb\";\n\nconst BreadcrumbList = React.forwardRef<\n HTMLOListElement,\n React.ComponentPropsWithoutRef<\"ol\">\n>(({ className, ...props }, ref) => (\n <ol\n ref={ref}\n className={cn(\n \"flex flex-wrap items-center gap-1.5 break-words text-sm text-muted-foreground sm:gap-2.5\",\n className,\n )}\n {...props}\n />\n));\nBreadcrumbList.displayName = \"BreadcrumbList\";\n\nconst BreadcrumbItem = React.forwardRef<\n HTMLLIElement,\n React.ComponentPropsWithoutRef<\"li\">\n>(({ className, ...props }, ref) => (\n <li\n ref={ref}\n className={cn(\"inline-flex items-center gap-1.5\", className)}\n {...props}\n />\n));\nBreadcrumbItem.displayName = \"BreadcrumbItem\";\n\nconst BreadcrumbLink = React.forwardRef<\n HTMLAnchorElement,\n React.ComponentPropsWithoutRef<\"a\"> & {\n asChild?: boolean;\n }\n>(({ asChild, className, ...props }, ref) => {\n const Comp = asChild ? Slot : \"a\";\n\n return (\n <Comp\n ref={ref}\n className={cn(\"transition-colors hover:text-foreground\", className)}\n {...props}\n />\n );\n});\nBreadcrumbLink.displayName = \"BreadcrumbLink\";\n\nconst BreadcrumbPage = React.forwardRef<\n HTMLSpanElement,\n React.ComponentPropsWithoutRef<\"span\">\n>(({ className, ...props }, ref) => (\n <span\n ref={ref}\n role=\"link\"\n aria-disabled=\"true\"\n aria-current=\"page\"\n className={cn(\"font-normal text-foreground\", className)}\n {...props}\n />\n));\nBreadcrumbPage.displayName = \"BreadcrumbPage\";\n\nconst BreadcrumbSeparator = ({\n children,\n className,\n ...props\n}: React.ComponentProps<\"li\">) => (\n <li\n role=\"presentation\"\n aria-hidden=\"true\"\n className={cn(\"[&>svg]:w-3.5 [&>svg]:h-3.5\", className)}\n {...props}\n >\n {children ?? <ChevronRight />}\n </li>\n);\nBreadcrumbSeparator.displayName = \"BreadcrumbSeparator\";\n\nconst BreadcrumbEllipsis = ({\n className,\n ...props\n}: React.ComponentProps<\"span\">) => (\n <span\n role=\"presentation\"\n aria-hidden=\"true\"\n className={cn(\"flex h-9 w-9 items-center justify-center\", className)}\n {...props}\n >\n <MoreHorizontal className=\"h-4 w-4\" />\n <span className=\"sr-only\">More</span>\n </span>\n);\nBreadcrumbEllipsis.displayName = \"BreadcrumbElipssis\";\n\nexport {\n Breadcrumb,\n BreadcrumbList,\n BreadcrumbItem,\n BreadcrumbLink,\n BreadcrumbPage,\n BreadcrumbSeparator,\n BreadcrumbEllipsis,\n};\n","import * as React from 'react';\nimport { composeRefs } from '@radix-ui/react-compose-refs';\n\n/* -------------------------------------------------------------------------------------------------\n * Slot\n * -----------------------------------------------------------------------------------------------*/\n\ninterface SlotProps extends React.HTMLAttributes<HTMLElement> {\n children?: React.ReactNode;\n}\n\n/* @__NO_SIDE_EFFECTS__ */ export function createSlot(ownerName: string) {\n const SlotClone = createSlotClone(ownerName);\n const Slot = React.forwardRef<HTMLElement, SlotProps>((props, forwardedRef) => {\n const { children, ...slotProps } = props;\n const childrenArray = React.Children.toArray(children);\n const slottable = childrenArray.find(isSlottable);\n\n if (slottable) {\n // the new element to render is the one passed as a child of `Slottable`\n const newElement = slottable.props.children;\n\n const newChildren = childrenArray.map((child) => {\n if (child === slottable) {\n // because the new element will be the one rendered, we are only interested\n // in grabbing its children (`newElement.props.children`)\n if (React.Children.count(newElement) > 1) return React.Children.only(null);\n return React.isValidElement(newElement)\n ? (newElement.props as { children: React.ReactNode }).children\n : null;\n } else {\n return child;\n }\n });\n\n return (\n <SlotClone {...slotProps} ref={forwardedRef}>\n {React.isValidElement(newElement)\n ? React.cloneElement(newElement, undefined, newChildren)\n : null}\n </SlotClone>\n );\n }\n\n return (\n <SlotClone {...slotProps} ref={forwardedRef}>\n {children}\n </SlotClone>\n );\n });\n\n Slot.displayName = `${ownerName}.Slot`;\n return Slot;\n}\n\nconst Slot = createSlot('Slot');\n\n/* -------------------------------------------------------------------------------------------------\n * SlotClone\n * -----------------------------------------------------------------------------------------------*/\n\ninterface SlotCloneProps {\n children: React.ReactNode;\n}\n\n/* @__NO_SIDE_EFFECTS__ */ function createSlotClone(ownerName: string) {\n const SlotClone = React.forwardRef<any, SlotCloneProps>((props, forwardedRef) => {\n const { children, ...slotProps } = props;\n\n if (React.isValidElement(children)) {\n const childrenRef = getElementRef(children);\n const props = mergeProps(slotProps, children.props as AnyProps);\n // do not pass ref to React.Fragment for React 19 compatibility\n if (children.type !== React.Fragment) {\n props.ref = forwardedRef ? composeRefs(forwardedRef, childrenRef) : childrenRef;\n }\n return React.cloneElement(children, props);\n }\n\n return React.Children.count(children) > 1 ? React.Children.only(null) : null;\n });\n\n SlotClone.displayName = `${ownerName}.SlotClone`;\n return SlotClone;\n}\n\n/* -------------------------------------------------------------------------------------------------\n * Slottable\n * -----------------------------------------------------------------------------------------------*/\n\nconst SLOTTABLE_IDENTIFIER = Symbol('radix.slottable');\n\ninterface SlottableProps {\n children: React.ReactNode;\n}\n\ninterface SlottableComponent extends React.FC<SlottableProps> {\n __radixId: symbol;\n}\n\n/* @__NO_SIDE_EFFECTS__ */ export function createSlottable(ownerName: string) {\n const Slottable: SlottableComponent = ({ children }) => {\n return <>{children}</>;\n };\n Slottable.displayName = `${ownerName}.Slottable`;\n Slottable.__radixId = SLOTTABLE_IDENTIFIER;\n return Slottable;\n}\n\nconst Slottable = createSlottable('Slottable');\n\n/* ---------------------------------------------------------------------------------------------- */\n\ntype AnyProps = Record<string, any>;\n\nfunction isSlottable(\n child: React.ReactNode\n): child is React.ReactElement<SlottableProps, typeof Slottable> {\n return (\n React.isValidElement(child) &&\n typeof child.type === 'function' &&\n '__radixId' in child.type &&\n child.type.__radixId === SLOTTABLE_IDENTIFIER\n );\n}\n\nfunction mergeProps(slotProps: AnyProps, childProps: AnyProps) {\n // all child props should override\n const overrideProps = { ...childProps };\n\n for (const propName in childProps) {\n const slotPropValue = slotProps[propName];\n const childPropValue = childProps[propName];\n\n const isHandler = /^on[A-Z]/.test(propName);\n if (isHandler) {\n // if the handler exists on both, we compose them\n if (slotPropValue && childPropValue) {\n overrideProps[propName] = (...args: unknown[]) => {\n childPropValue(...args);\n slotPropValue(...args);\n };\n }\n // but if it exists only on the slot, we use only this one\n else if (slotPropValue) {\n overrideProps[propName] = slotPropValue;\n }\n }\n // if it's `style`, we merge them\n else if (propName === 'style') {\n overrideProps[propName] = { ...slotPropValue, ...childPropValue };\n } else if (propName === 'className') {\n overrideProps[propName] = [slotPropValue, childPropValue].filter(Boolean).join(' ');\n }\n }\n\n return { ...slotProps, ...overrideProps };\n}\n\n// Before React 19 accessing `element.props.ref` will throw a warning and suggest using `element.ref`\n// After React 19 accessing `element.ref` does the opposite.\n// https://github.com/facebook/react/pull/28348\n//\n// Access the ref using the method that doesn't yield a warning.\nfunction getElementRef(element: React.ReactElement) {\n // React <=18 in DEV\n let getter = Object.getOwnPropertyDescriptor(element.props, 'ref')?.get;\n let mayWarn = getter && 'isReactWarning' in getter && getter.isReactWarning;\n if (mayWarn) {\n return (element as any).ref;\n }\n\n // React 19 in DEV\n getter = Object.getOwnPropertyDescriptor(element, 'ref')?.get;\n mayWarn = getter && 'isReactWarning' in getter && getter.isReactWarning;\n if (mayWarn) {\n return (element.props as { ref?: React.Ref<unknown> }).ref;\n }\n\n // Not DEV\n return (element.props as { ref?: React.Ref<unknown> }).ref || (element as any).ref;\n}\n\nexport {\n Slot,\n Slottable,\n //\n Slot as Root,\n};\nexport type { SlotProps };\n","import * as React from 'react';\n\ntype PossibleRef<T> = React.Ref<T> | undefined;\n\n/**\n * Set a given ref to a given value\n * This utility takes care of different types of refs: callback refs and RefObject(s)\n */\nfunction setRef<T>(ref: PossibleRef<T>, value: T) {\n if (typeof ref === 'function') {\n return ref(value);\n } else if (ref !== null && ref !== undefined) {\n ref.current = value;\n }\n}\n\n/**\n * A utility to compose multiple refs together\n * Accepts callback refs and RefObject(s)\n */\nfunction composeRefs<T>(...refs: PossibleRef<T>[]): React.RefCallback<T> {\n return (node) => {\n let hasCleanup = false;\n const cleanups = refs.map((ref) => {\n const cleanup = setRef(ref, node);\n if (!hasCleanup && typeof cleanup == 'function') {\n hasCleanup = true;\n }\n return cleanup;\n });\n\n // React <19 will log an error to the console if a callback ref returns a\n // value. We don't use ref cleanups internally so this will only happen if a\n // user's ref callback returns a value, which we only expect if they are\n // using the cleanup functionality added in React 19.\n if (hasCleanup) {\n return () => {\n for (let i = 0; i < cleanups.length; i++) {\n const cleanup = cleanups[i];\n if (typeof cleanup == 'function') {\n cleanup();\n } else {\n setRef(refs[i], null);\n }\n }\n };\n }\n };\n}\n\n/**\n * A custom hook that composes multiple refs\n * Accepts callback refs and RefObject(s)\n */\nfunction useComposedRefs<T>(...refs: PossibleRef<T>[]): React.RefCallback<T> {\n // eslint-disable-next-line react-hooks/exhaustive-deps\n return React.useCallback(composeRefs(...refs), refs);\n}\n\nexport { composeRefs, useComposedRefs };\n"],"mappings":"0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,gBAAAE,EAAA,uBAAAC,EAAA,mBAAAC,EAAA,mBAAAC,EAAA,mBAAAC,EAAA,mBAAAC,EAAA,wBAAAC,IAAA,eAAAC,EAAAT,GAAA,IAAAU,EAAuB,sBCAvB,IAAAC,EAAuB,sBCAvB,IAAAC,EAAuB,sBAQvB,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OAAC,QACG,IAAKA,EACL,KAAK,OACL,gBAAc,OACd,eAAa,OACb,aAAW,MAAG,8BAA+BE,CAAS,EACrD,GAAGH,EACR,CACH,EACDQ,EAAe,YAAc,iBAE7B,IAAMC,EAAsB,CAAC,CACzB,SAAAC,EACA,UAAAP,EACA,GAAGH,CACP,OACI,OAAC,MACG,KAAK,eACL,cAAY,OACZ,aAAW,MAAG,8BAA+BG,CAAS,EACrD,GAAGH,EAEH,SAAAU,MAAY,OAAC,iBAAa,EAC/B,EAEJD,EAAoB,YAAc,sBAElC,IAAME,EAAqB,CAAC,CACxB,UAAAR,EACA,GAAGH,CACP,OACI,QAAC,QACG,KAAK,eACL,cAAY,OACZ,aAAW,MAAG,2CAA4CG,CAAS,EAClE,GAAGH,EAEJ,oBAAC,kBAAe,UAAU,UAAU,KACpC,OAAC,QAAK,UAAU,UAAU,gBAAI,GAClC,EAEJW,EAAmB,YAAc","names":["breadcrumb_exports","__export","Breadcrumb","BreadcrumbEllipsis","BreadcrumbItem","BreadcrumbLink","BreadcrumbList","BreadcrumbPage","BreadcrumbSeparator","__toCommonJS","React","React","React","setRef","ref","value","composeRefs","refs","node","hasCleanup","cleanups","cleanup","i","import_jsx_runtime","createSlot","ownerName","SlotClone","createSlotClone","Slot","props","forwardedRef","children","slotProps","childrenArray","slottable","isSlottable","newElement","newChildren","child","childrenRef","getElementRef","mergeProps","composeRefs","SLOTTABLE_IDENTIFIER","isSlottable","child","SLOTTABLE_IDENTIFIER","mergeProps","slotProps","childProps","overrideProps","propName","slotPropValue","childPropValue","args","getElementRef","element","getter","mayWarn","import_lucide_react","import_utils","import_jsx_runtime","Breadcrumb","props","ref","BreadcrumbList","className","BreadcrumbItem","BreadcrumbLink","asChild","Slot","BreadcrumbPage","BreadcrumbSeparator","children","BreadcrumbEllipsis"]}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
|
|
4
|
+
declare const Breadcrumb: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>, "ref"> & {
|
|
5
|
+
separator?: React.ReactNode;
|
|
6
|
+
} & React.RefAttributes<HTMLElement>>;
|
|
7
|
+
declare const BreadcrumbList: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.OlHTMLAttributes<HTMLOListElement>, HTMLOListElement>, "ref"> & React.RefAttributes<HTMLOListElement>>;
|
|
8
|
+
declare const BreadcrumbItem: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.LiHTMLAttributes<HTMLLIElement>, HTMLLIElement>, "ref"> & React.RefAttributes<HTMLLIElement>>;
|
|
9
|
+
declare const BreadcrumbLink: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>, "ref"> & {
|
|
10
|
+
asChild?: boolean;
|
|
11
|
+
} & React.RefAttributes<HTMLAnchorElement>>;
|
|
12
|
+
declare const BreadcrumbPage: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref"> & React.RefAttributes<HTMLSpanElement>>;
|
|
13
|
+
declare const BreadcrumbSeparator: {
|
|
14
|
+
({ children, className, ...props }: React.ComponentProps<"li">): react_jsx_runtime.JSX.Element;
|
|
15
|
+
displayName: string;
|
|
16
|
+
};
|
|
17
|
+
declare const BreadcrumbEllipsis: {
|
|
18
|
+
({ className, ...props }: React.ComponentProps<"span">): react_jsx_runtime.JSX.Element;
|
|
19
|
+
displayName: string;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export { Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
|
|
4
|
+
declare const Breadcrumb: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>, "ref"> & {
|
|
5
|
+
separator?: React.ReactNode;
|
|
6
|
+
} & React.RefAttributes<HTMLElement>>;
|
|
7
|
+
declare const BreadcrumbList: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.OlHTMLAttributes<HTMLOListElement>, HTMLOListElement>, "ref"> & React.RefAttributes<HTMLOListElement>>;
|
|
8
|
+
declare const BreadcrumbItem: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.LiHTMLAttributes<HTMLLIElement>, HTMLLIElement>, "ref"> & React.RefAttributes<HTMLLIElement>>;
|
|
9
|
+
declare const BreadcrumbLink: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>, "ref"> & {
|
|
10
|
+
asChild?: boolean;
|
|
11
|
+
} & React.RefAttributes<HTMLAnchorElement>>;
|
|
12
|
+
declare const BreadcrumbPage: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref"> & React.RefAttributes<HTMLSpanElement>>;
|
|
13
|
+
declare const BreadcrumbSeparator: {
|
|
14
|
+
({ children, className, ...props }: React.ComponentProps<"li">): react_jsx_runtime.JSX.Element;
|
|
15
|
+
displayName: string;
|
|
16
|
+
};
|
|
17
|
+
declare const BreadcrumbEllipsis: {
|
|
18
|
+
({ className, ...props }: React.ComponentProps<"span">): react_jsx_runtime.JSX.Element;
|
|
19
|
+
displayName: string;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export { Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import*as p from"react";import*as a from"react";import*as C from"react";function R(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function b(...e){return t=>{let r=!1,o=e.map(n=>{let l=R(n,t);return!r&&typeof l=="function"&&(r=!0),l});if(r)return()=>{for(let n=0;n<o.length;n++){let l=o[n];typeof l=="function"?l():R(e[n],null)}}}}import{Fragment as j,jsx as y}from"react/jsx-runtime";function N(e){let t=S(e),r=a.forwardRef((o,n)=>{let{children:l,...c}=o,i=a.Children.toArray(l),u=i.find(B);if(u){let f=u.props.children,h=i.map(d=>d===u?a.Children.count(f)>1?a.Children.only(null):a.isValidElement(f)?f.props.children:null:d);return y(t,{...c,ref:n,children:a.isValidElement(f)?a.cloneElement(f,void 0,h):null})}return y(t,{...c,ref:n,children:l})});return r.displayName=`${e}.Slot`,r}var g=N("Slot");function S(e){let t=a.forwardRef((r,o)=>{let{children:n,...l}=r;if(a.isValidElement(n)){let c=P(n),i=x(l,n.props);return n.type!==a.Fragment&&(i.ref=o?b(o,c):c),a.cloneElement(n,i)}return a.Children.count(n)>1?a.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var E=Symbol("radix.slottable");function B(e){return a.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===E}function x(e,t){let r={...t};for(let o in t){let n=e[o],l=t[o];/^on[A-Z]/.test(o)?n&&l?r[o]=(...i)=>{l(...i),n(...i)}:n&&(r[o]=n):o==="style"?r[o]={...n,...l}:o==="className"&&(r[o]=[n,l].filter(Boolean).join(" "))}return{...e,...r}}function P(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}import{ChevronRight as w,MoreHorizontal as L}from"lucide-react";import{cn as m}from"@c-rex/utils";import{jsx as s,jsxs as O}from"react/jsx-runtime";var v=p.forwardRef(({...e},t)=>s("nav",{ref:t,"aria-label":"breadcrumb",...e}));v.displayName="Breadcrumb";var W=p.forwardRef(({className:e,...t},r)=>s("ol",{ref:r,className:m("flex flex-wrap items-center gap-1.5 break-words text-sm text-muted-foreground sm:gap-2.5",e),...t}));W.displayName="BreadcrumbList";var I=p.forwardRef(({className:e,...t},r)=>s("li",{ref:r,className:m("inline-flex items-center gap-1.5",e),...t}));I.displayName="BreadcrumbItem";var H=p.forwardRef(({asChild:e,className:t,...r},o)=>s(e?g:"a",{ref:o,className:m("transition-colors hover:text-foreground",t),...r}));H.displayName="BreadcrumbLink";var T=p.forwardRef(({className:e,...t},r)=>s("span",{ref:r,role:"link","aria-disabled":"true","aria-current":"page",className:m("font-normal text-foreground",e),...t}));T.displayName="BreadcrumbPage";var M=({children:e,className:t,...r})=>s("li",{role:"presentation","aria-hidden":"true",className:m("[&>svg]:w-3.5 [&>svg]:h-3.5",t),...r,children:e??s(w,{})});M.displayName="BreadcrumbSeparator";var _=({className:e,...t})=>O("span",{role:"presentation","aria-hidden":"true",className:m("flex h-9 w-9 items-center justify-center",e),...t,children:[s(L,{className:"h-4 w-4"}),s("span",{className:"sr-only",children:"More"})]});_.displayName="BreadcrumbElipssis";export{v as Breadcrumb,_ as BreadcrumbEllipsis,I as BreadcrumbItem,H as BreadcrumbLink,W as BreadcrumbList,T as BreadcrumbPage,M as BreadcrumbSeparator};
|
|
2
|
+
//# sourceMappingURL=breadcrumb.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/breadcrumb.tsx","../../../node_modules/@radix-ui/react-slot/src/slot.tsx","../../../node_modules/@radix-ui/react-compose-refs/src/compose-refs.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { Slot } from \"@radix-ui/react-slot\";\nimport { ChevronRight, MoreHorizontal } from \"lucide-react\";\n\nimport { cn } from \"@c-rex/utils\";\n\nconst Breadcrumb = React.forwardRef<\n HTMLElement,\n React.ComponentPropsWithoutRef<\"nav\"> & {\n separator?: React.ReactNode;\n }\n>(({ ...props }, ref) => <nav ref={ref} aria-label=\"breadcrumb\" {...props} />);\nBreadcrumb.displayName = \"Breadcrumb\";\n\nconst BreadcrumbList = React.forwardRef<\n HTMLOListElement,\n React.ComponentPropsWithoutRef<\"ol\">\n>(({ className, ...props }, ref) => (\n <ol\n ref={ref}\n className={cn(\n \"flex flex-wrap items-center gap-1.5 break-words text-sm text-muted-foreground sm:gap-2.5\",\n className,\n )}\n {...props}\n />\n));\nBreadcrumbList.displayName = \"BreadcrumbList\";\n\nconst BreadcrumbItem = React.forwardRef<\n HTMLLIElement,\n React.ComponentPropsWithoutRef<\"li\">\n>(({ className, ...props }, ref) => (\n <li\n ref={ref}\n className={cn(\"inline-flex items-center gap-1.5\", className)}\n {...props}\n />\n));\nBreadcrumbItem.displayName = \"BreadcrumbItem\";\n\nconst BreadcrumbLink = React.forwardRef<\n HTMLAnchorElement,\n React.ComponentPropsWithoutRef<\"a\"> & {\n asChild?: boolean;\n }\n>(({ asChild, className, ...props }, ref) => {\n const Comp = asChild ? Slot : \"a\";\n\n return (\n <Comp\n ref={ref}\n className={cn(\"transition-colors hover:text-foreground\", className)}\n {...props}\n />\n );\n});\nBreadcrumbLink.displayName = \"BreadcrumbLink\";\n\nconst BreadcrumbPage = React.forwardRef<\n HTMLSpanElement,\n React.ComponentPropsWithoutRef<\"span\">\n>(({ className, ...props }, ref) => (\n <span\n ref={ref}\n role=\"link\"\n aria-disabled=\"true\"\n aria-current=\"page\"\n className={cn(\"font-normal text-foreground\", className)}\n {...props}\n />\n));\nBreadcrumbPage.displayName = \"BreadcrumbPage\";\n\nconst BreadcrumbSeparator = ({\n children,\n className,\n ...props\n}: React.ComponentProps<\"li\">) => (\n <li\n role=\"presentation\"\n aria-hidden=\"true\"\n className={cn(\"[&>svg]:w-3.5 [&>svg]:h-3.5\", className)}\n {...props}\n >\n {children ?? <ChevronRight />}\n </li>\n);\nBreadcrumbSeparator.displayName = \"BreadcrumbSeparator\";\n\nconst BreadcrumbEllipsis = ({\n className,\n ...props\n}: React.ComponentProps<\"span\">) => (\n <span\n role=\"presentation\"\n aria-hidden=\"true\"\n className={cn(\"flex h-9 w-9 items-center justify-center\", className)}\n {...props}\n >\n <MoreHorizontal className=\"h-4 w-4\" />\n <span className=\"sr-only\">More</span>\n </span>\n);\nBreadcrumbEllipsis.displayName = \"BreadcrumbElipssis\";\n\nexport {\n Breadcrumb,\n BreadcrumbList,\n BreadcrumbItem,\n BreadcrumbLink,\n BreadcrumbPage,\n BreadcrumbSeparator,\n BreadcrumbEllipsis,\n};\n","import * as React from 'react';\nimport { composeRefs } from '@radix-ui/react-compose-refs';\n\n/* -------------------------------------------------------------------------------------------------\n * Slot\n * -----------------------------------------------------------------------------------------------*/\n\ninterface SlotProps extends React.HTMLAttributes<HTMLElement> {\n children?: React.ReactNode;\n}\n\n/* @__NO_SIDE_EFFECTS__ */ export function createSlot(ownerName: string) {\n const SlotClone = createSlotClone(ownerName);\n const Slot = React.forwardRef<HTMLElement, SlotProps>((props, forwardedRef) => {\n const { children, ...slotProps } = props;\n const childrenArray = React.Children.toArray(children);\n const slottable = childrenArray.find(isSlottable);\n\n if (slottable) {\n // the new element to render is the one passed as a child of `Slottable`\n const newElement = slottable.props.children;\n\n const newChildren = childrenArray.map((child) => {\n if (child === slottable) {\n // because the new element will be the one rendered, we are only interested\n // in grabbing its children (`newElement.props.children`)\n if (React.Children.count(newElement) > 1) return React.Children.only(null);\n return React.isValidElement(newElement)\n ? (newElement.props as { children: React.ReactNode }).children\n : null;\n } else {\n return child;\n }\n });\n\n return (\n <SlotClone {...slotProps} ref={forwardedRef}>\n {React.isValidElement(newElement)\n ? React.cloneElement(newElement, undefined, newChildren)\n : null}\n </SlotClone>\n );\n }\n\n return (\n <SlotClone {...slotProps} ref={forwardedRef}>\n {children}\n </SlotClone>\n );\n });\n\n Slot.displayName = `${ownerName}.Slot`;\n return Slot;\n}\n\nconst Slot = createSlot('Slot');\n\n/* -------------------------------------------------------------------------------------------------\n * SlotClone\n * -----------------------------------------------------------------------------------------------*/\n\ninterface SlotCloneProps {\n children: React.ReactNode;\n}\n\n/* @__NO_SIDE_EFFECTS__ */ function createSlotClone(ownerName: string) {\n const SlotClone = React.forwardRef<any, SlotCloneProps>((props, forwardedRef) => {\n const { children, ...slotProps } = props;\n\n if (React.isValidElement(children)) {\n const childrenRef = getElementRef(children);\n const props = mergeProps(slotProps, children.props as AnyProps);\n // do not pass ref to React.Fragment for React 19 compatibility\n if (children.type !== React.Fragment) {\n props.ref = forwardedRef ? composeRefs(forwardedRef, childrenRef) : childrenRef;\n }\n return React.cloneElement(children, props);\n }\n\n return React.Children.count(children) > 1 ? React.Children.only(null) : null;\n });\n\n SlotClone.displayName = `${ownerName}.SlotClone`;\n return SlotClone;\n}\n\n/* -------------------------------------------------------------------------------------------------\n * Slottable\n * -----------------------------------------------------------------------------------------------*/\n\nconst SLOTTABLE_IDENTIFIER = Symbol('radix.slottable');\n\ninterface SlottableProps {\n children: React.ReactNode;\n}\n\ninterface SlottableComponent extends React.FC<SlottableProps> {\n __radixId: symbol;\n}\n\n/* @__NO_SIDE_EFFECTS__ */ export function createSlottable(ownerName: string) {\n const Slottable: SlottableComponent = ({ children }) => {\n return <>{children}</>;\n };\n Slottable.displayName = `${ownerName}.Slottable`;\n Slottable.__radixId = SLOTTABLE_IDENTIFIER;\n return Slottable;\n}\n\nconst Slottable = createSlottable('Slottable');\n\n/* ---------------------------------------------------------------------------------------------- */\n\ntype AnyProps = Record<string, any>;\n\nfunction isSlottable(\n child: React.ReactNode\n): child is React.ReactElement<SlottableProps, typeof Slottable> {\n return (\n React.isValidElement(child) &&\n typeof child.type === 'function' &&\n '__radixId' in child.type &&\n child.type.__radixId === SLOTTABLE_IDENTIFIER\n );\n}\n\nfunction mergeProps(slotProps: AnyProps, childProps: AnyProps) {\n // all child props should override\n const overrideProps = { ...childProps };\n\n for (const propName in childProps) {\n const slotPropValue = slotProps[propName];\n const childPropValue = childProps[propName];\n\n const isHandler = /^on[A-Z]/.test(propName);\n if (isHandler) {\n // if the handler exists on both, we compose them\n if (slotPropValue && childPropValue) {\n overrideProps[propName] = (...args: unknown[]) => {\n childPropValue(...args);\n slotPropValue(...args);\n };\n }\n // but if it exists only on the slot, we use only this one\n else if (slotPropValue) {\n overrideProps[propName] = slotPropValue;\n }\n }\n // if it's `style`, we merge them\n else if (propName === 'style') {\n overrideProps[propName] = { ...slotPropValue, ...childPropValue };\n } else if (propName === 'className') {\n overrideProps[propName] = [slotPropValue, childPropValue].filter(Boolean).join(' ');\n }\n }\n\n return { ...slotProps, ...overrideProps };\n}\n\n// Before React 19 accessing `element.props.ref` will throw a warning and suggest using `element.ref`\n// After React 19 accessing `element.ref` does the opposite.\n// https://github.com/facebook/react/pull/28348\n//\n// Access the ref using the method that doesn't yield a warning.\nfunction getElementRef(element: React.ReactElement) {\n // React <=18 in DEV\n let getter = Object.getOwnPropertyDescriptor(element.props, 'ref')?.get;\n let mayWarn = getter && 'isReactWarning' in getter && getter.isReactWarning;\n if (mayWarn) {\n return (element as any).ref;\n }\n\n // React 19 in DEV\n getter = Object.getOwnPropertyDescriptor(element, 'ref')?.get;\n mayWarn = getter && 'isReactWarning' in getter && getter.isReactWarning;\n if (mayWarn) {\n return (element.props as { ref?: React.Ref<unknown> }).ref;\n }\n\n // Not DEV\n return (element.props as { ref?: React.Ref<unknown> }).ref || (element as any).ref;\n}\n\nexport {\n Slot,\n Slottable,\n //\n Slot as Root,\n};\nexport type { SlotProps };\n","import * as React from 'react';\n\ntype PossibleRef<T> = React.Ref<T> | undefined;\n\n/**\n * Set a given ref to a given value\n * This utility takes care of different types of refs: callback refs and RefObject(s)\n */\nfunction setRef<T>(ref: PossibleRef<T>, value: T) {\n if (typeof ref === 'function') {\n return ref(value);\n } else if (ref !== null && ref !== undefined) {\n ref.current = value;\n }\n}\n\n/**\n * A utility to compose multiple refs together\n * Accepts callback refs and RefObject(s)\n */\nfunction composeRefs<T>(...refs: PossibleRef<T>[]): React.RefCallback<T> {\n return (node) => {\n let hasCleanup = false;\n const cleanups = refs.map((ref) => {\n const cleanup = setRef(ref, node);\n if (!hasCleanup && typeof cleanup == 'function') {\n hasCleanup = true;\n }\n return cleanup;\n });\n\n // React <19 will log an error to the console if a callback ref returns a\n // value. We don't use ref cleanups internally so this will only happen if a\n // user's ref callback returns a value, which we only expect if they are\n // using the cleanup functionality added in React 19.\n if (hasCleanup) {\n return () => {\n for (let i = 0; i < cleanups.length; i++) {\n const cleanup = cleanups[i];\n if (typeof cleanup == 'function') {\n cleanup();\n } else {\n setRef(refs[i], null);\n }\n }\n };\n }\n };\n}\n\n/**\n * A custom hook that composes multiple refs\n * Accepts callback refs and RefObject(s)\n */\nfunction useComposedRefs<T>(...refs: PossibleRef<T>[]): React.RefCallback<T> {\n // eslint-disable-next-line react-hooks/exhaustive-deps\n return React.useCallback(composeRefs(...refs), refs);\n}\n\nexport { composeRefs, useComposedRefs };\n"],"mappings":"AAAA,UAAYA,MAAW,QCAvB,UAAYC,MAAW,QCAvB,UAAYC,MAAW,QAQvB,SAASC,EAAUC,EAAqBC,EAAU,CAChD,GAAI,OAAOD,GAAQ,WACjB,OAAOA,EAAIC,CAAK,EACPD,GAAQ,OACjBA,EAAI,QAAUC,EAElB,CAMA,SAASC,KAAkBC,EAA8C,CACvE,OAAQC,GAAS,CACf,IAAIC,EAAa,GACXC,EAAWH,EAAK,IAAKH,GAAQ,CACjC,IAAMO,EAAUR,EAAOC,EAAKI,CAAI,EAChC,MAAI,CAACC,GAAc,OAAOE,GAAW,aACnCF,EAAa,IAERE,CACT,CAAC,EAMD,GAAIF,EACF,MAAO,IAAM,CACX,QAASG,EAAI,EAAGA,EAAIF,EAAS,OAAQE,IAAK,CACxC,IAAMD,EAAUD,EAASE,CAAC,EACtB,OAAOD,GAAW,WACpBA,EAAQ,EAERR,EAAOI,EAAKK,CAAC,EAAG,IAAI,CAExB,CACF,CAEJ,CACF,CDZQ,OAkEG,YAAAC,EAlEH,OAAAC,MAAA,oBAzB0B,S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,UAAAH,EAACF,EAAA,CAAe,UAAU,UAAU,EACpCE,EAAC,QAAK,UAAU,UAAU,gBAAI,GAClC,EAEJc,EAAmB,YAAc","names":["React","React","React","setRef","ref","value","composeRefs","refs","node","hasCleanup","cleanups","cleanup","i","Fragment","jsx","createSlot","ownerName","SlotClone","createSlotClone","Slot","props","forwardedRef","children","slotProps","childrenArray","slottable","isSlottable","newElement","newChildren","child","childrenRef","getElementRef","mergeProps","composeRefs","SLOTTABLE_IDENTIFIER","isSlottable","child","SLOTTABLE_IDENTIFIER","mergeProps","slotProps","childProps","overrideProps","propName","slotPropValue","childPropValue","args","getElementRef","element","getter","mayWarn","ChevronRight","MoreHorizontal","cn","jsx","jsxs","Breadcrumb","props","ref","BreadcrumbList","className","BreadcrumbItem","BreadcrumbLink","asChild","Slot","BreadcrumbPage","BreadcrumbSeparator","children","BreadcrumbEllipsis"]}
|
package/dist/button.cjs
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var V=Object.create;var u=Object.defineProperty;var _=Object.getOwnPropertyDescriptor;var B=Object.getOwnPropertyNames;var P=Object.getPrototypeOf,N=Object.prototype.hasOwnProperty;var I=(e,t)=>{for(var r in t)u(e,r,{get:t[r],enumerable:!0})},g=(e,t,r,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of B(t))!N.call(e,n)&&n!==r&&u(e,n,{get:()=>t[n],enumerable:!(o=_(t,n))||o.enumerable});return e};var p=(e,t,r)=>(r=e!=null?V(P(e)):{},g(t||!e||!e.__esModule?u(r,"default",{value:e,enumerable:!0}):r,e)),T=e=>g(u({},"__esModule",{value:!0}),e);var F={};I(F,{Button:()=>C,buttonVariants:()=>S});module.exports=T(F);var h=p(require("react"),1);var a=p(require("react"),1);var A=p(require("react"),1);function b(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function y(...e){return t=>{let r=!1,o=e.map(n=>{let i=b(n,t);return!r&&typeof i=="function"&&(r=!0),i});if(r)return()=>{for(let n=0;n<o.length;n++){let i=o[n];typeof i=="function"?i():b(e[n],null)}}}}var d=require("react/jsx-runtime");function H(e){let t=L(e),r=a.forwardRef((o,n)=>{let{children:i,...l}=o,s=a.Children.toArray(i),f=s.find(W);if(f){let c=f.props.children,w=s.map(m=>m===f?a.Children.count(c)>1?a.Children.only(null):a.isValidElement(c)?c.props.children:null:m);return(0,d.jsx)(t,{...l,ref:n,children:a.isValidElement(c)?a.cloneElement(c,void 0,w):null})}return(0,d.jsx)(t,{...l,ref:n,children:i})});return r.displayName=`${e}.Slot`,r}var R=H("Slot");function L(e){let t=a.forwardRef((r,o)=>{let{children:n,...i}=r;if(a.isValidElement(n)){let l=k(n),s=j(i,n.props);return n.type!==a.Fragment&&(s.ref=o?y(o,l):l),a.cloneElement(n,s)}return a.Children.count(n)>1?a.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var O=Symbol("radix.slottable");function W(e){return a.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===O}function j(e,t){let r={...t};for(let o in t){let n=e[o],i=t[o];/^on[A-Z]/.test(o)?n&&i?r[o]=(...s)=>{i(...s),n(...s)}:n&&(r[o]=n):o==="style"?r[o]={...n,...i}:o==="className"&&(r[o]=[n,i].filter(Boolean).join(" "))}return{...e,...r}}function k(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var v=require("class-variance-authority"),x=require("@c-rex/utils"),E=require("react/jsx-runtime"),S=(0,v.cva)("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground shadow hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",outline:"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"h-9 w-9"},rounded:{default:"rounded-md",sm:"rounded-sm",lg:"rounded-lg",xl:"rounded-xl","2xl":"rounded-2xl",full:"rounded-full"}},defaultVariants:{variant:"default",size:"default",rounded:"default"}}),C=h.forwardRef(({className:e,variant:t,size:r,rounded:o,asChild:n=!1,...i},l)=>(0,E.jsx)(n?R:"button",{className:(0,x.cn)(S({variant:t,size:r,rounded:o,className:e})),ref:l,...i}));C.displayName="Button";0&&(module.exports={Button,buttonVariants});
|
|
2
|
+
//# sourceMappingURL=button.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/button.tsx","../../../node_modules/@radix-ui/react-slot/src/slot.tsx","../../../node_modules/@radix-ui/react-compose-refs/src/compose-refs.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { Slot } from \"@radix-ui/react-slot\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\n\nimport { cn } from \"@c-rex/utils\";\n\nconst buttonVariants = cva(\n \"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0\",\n {\n variants: {\n variant: {\n default:\n \"bg-primary text-primary-foreground shadow hover:bg-primary/90\",\n destructive:\n \"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90\",\n outline:\n \"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground\",\n secondary:\n \"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80\",\n ghost: \"hover:bg-accent hover:text-accent-foreground\",\n link: \"text-primary underline-offset-4 hover:underline\",\n },\n size: {\n default: \"h-9 px-4 py-2\",\n sm: \"h-8 rounded-md px-3 text-xs\",\n lg: \"h-10 rounded-md px-8\",\n icon: \"h-9 w-9\",\n },\n rounded: {\n default: \"rounded-md\",\n sm: \"rounded-sm\",\n lg: \"rounded-lg\",\n xl: \"rounded-xl\",\n \"2xl\": \"rounded-2xl\",\n full: \"rounded-full\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n size: \"default\",\n rounded: \"default\",\n },\n },\n);\n\nexport interface ButtonProps\n extends React.ButtonHTMLAttributes<HTMLButtonElement>,\n VariantProps<typeof buttonVariants> {\n asChild?: boolean;\n}\n\nconst Button = React.forwardRef<HTMLButtonElement, ButtonProps>(\n ({ className, variant, size, rounded, asChild = false, ...props }, ref) => {\n const Comp = asChild ? Slot : \"button\";\n return (\n <Comp\n className={cn(buttonVariants({ variant, size, rounded, className }))}\n ref={ref}\n {...props}\n />\n );\n },\n);\nButton.displayName = \"Button\";\n\nexport { Button, buttonVariants };\n","import * as React from 'react';\nimport { composeRefs } from '@radix-ui/react-compose-refs';\n\n/* -------------------------------------------------------------------------------------------------\n * Slot\n * -----------------------------------------------------------------------------------------------*/\n\ninterface SlotProps extends React.HTMLAttributes<HTMLElement> {\n children?: React.ReactNode;\n}\n\n/* @__NO_SIDE_EFFECTS__ */ export function createSlot(ownerName: string) {\n const SlotClone = createSlotClone(ownerName);\n const Slot = React.forwardRef<HTMLElement, SlotProps>((props, forwardedRef) => {\n const { children, ...slotProps } = props;\n const childrenArray = React.Children.toArray(children);\n const slottable = childrenArray.find(isSlottable);\n\n if (slottable) {\n // the new element to render is the one passed as a child of `Slottable`\n const newElement = slottable.props.children;\n\n const newChildren = childrenArray.map((child) => {\n if (child === slottable) {\n // because the new element will be the one rendered, we are only interested\n // in grabbing its children (`newElement.props.children`)\n if (React.Children.count(newElement) > 1) return React.Children.only(null);\n return React.isValidElement(newElement)\n ? (newElement.props as { children: React.ReactNode }).children\n : null;\n } else {\n return child;\n }\n });\n\n return (\n <SlotClone {...slotProps} ref={forwardedRef}>\n {React.isValidElement(newElement)\n ? React.cloneElement(newElement, undefined, newChildren)\n : null}\n </SlotClone>\n );\n }\n\n return (\n <SlotClone {...slotProps} ref={forwardedRef}>\n {children}\n </SlotClone>\n );\n });\n\n Slot.displayName = `${ownerName}.Slot`;\n return Slot;\n}\n\nconst Slot = createSlot('Slot');\n\n/* -------------------------------------------------------------------------------------------------\n * SlotClone\n * -----------------------------------------------------------------------------------------------*/\n\ninterface SlotCloneProps {\n children: React.ReactNode;\n}\n\n/* @__NO_SIDE_EFFECTS__ */ function createSlotClone(ownerName: string) {\n const SlotClone = React.forwardRef<any, SlotCloneProps>((props, forwardedRef) => {\n const { children, ...slotProps } = props;\n\n if (React.isValidElement(children)) {\n const childrenRef = getElementRef(children);\n const props = mergeProps(slotProps, children.props as AnyProps);\n // do not pass ref to React.Fragment for React 19 compatibility\n if (children.type !== React.Fragment) {\n props.ref = forwardedRef ? composeRefs(forwardedRef, childrenRef) : childrenRef;\n }\n return React.cloneElement(children, props);\n }\n\n return React.Children.count(children) > 1 ? React.Children.only(null) : null;\n });\n\n SlotClone.displayName = `${ownerName}.SlotClone`;\n return SlotClone;\n}\n\n/* -------------------------------------------------------------------------------------------------\n * Slottable\n * -----------------------------------------------------------------------------------------------*/\n\nconst SLOTTABLE_IDENTIFIER = Symbol('radix.slottable');\n\ninterface SlottableProps {\n children: React.ReactNode;\n}\n\ninterface SlottableComponent extends React.FC<SlottableProps> {\n __radixId: symbol;\n}\n\n/* @__NO_SIDE_EFFECTS__ */ export function createSlottable(ownerName: string) {\n const Slottable: SlottableComponent = ({ children }) => {\n return <>{children}</>;\n };\n Slottable.displayName = `${ownerName}.Slottable`;\n Slottable.__radixId = SLOTTABLE_IDENTIFIER;\n return Slottable;\n}\n\nconst Slottable = createSlottable('Slottable');\n\n/* ---------------------------------------------------------------------------------------------- */\n\ntype AnyProps = Record<string, any>;\n\nfunction isSlottable(\n child: React.ReactNode\n): child is React.ReactElement<SlottableProps, typeof Slottable> {\n return (\n React.isValidElement(child) &&\n typeof child.type === 'function' &&\n '__radixId' in child.type &&\n child.type.__radixId === SLOTTABLE_IDENTIFIER\n );\n}\n\nfunction mergeProps(slotProps: AnyProps, childProps: AnyProps) {\n // all child props should override\n const overrideProps = { ...childProps };\n\n for (const propName in childProps) {\n const slotPropValue = slotProps[propName];\n const childPropValue = childProps[propName];\n\n const isHandler = /^on[A-Z]/.test(propName);\n if (isHandler) {\n // if the handler exists on both, we compose them\n if (slotPropValue && childPropValue) {\n overrideProps[propName] = (...args: unknown[]) => {\n childPropValue(...args);\n slotPropValue(...args);\n };\n }\n // but if it exists only on the slot, we use only this one\n else if (slotPropValue) {\n overrideProps[propName] = slotPropValue;\n }\n }\n // if it's `style`, we merge them\n else if (propName === 'style') {\n overrideProps[propName] = { ...slotPropValue, ...childPropValue };\n } else if (propName === 'className') {\n overrideProps[propName] = [slotPropValue, childPropValue].filter(Boolean).join(' ');\n }\n }\n\n return { ...slotProps, ...overrideProps };\n}\n\n// Before React 19 accessing `element.props.ref` will throw a warning and suggest using `element.ref`\n// After React 19 accessing `element.ref` does the opposite.\n// https://github.com/facebook/react/pull/28348\n//\n// Access the ref using the method that doesn't yield a warning.\nfunction getElementRef(element: React.ReactElement) {\n // React <=18 in DEV\n let getter = Object.getOwnPropertyDescriptor(element.props, 'ref')?.get;\n let mayWarn = getter && 'isReactWarning' in getter && getter.isReactWarning;\n if (mayWarn) {\n return (element as any).ref;\n }\n\n // React 19 in DEV\n getter = Object.getOwnPropertyDescriptor(element, 'ref')?.get;\n mayWarn = getter && 'isReactWarning' in getter && getter.isReactWarning;\n if (mayWarn) {\n return (element.props as { ref?: React.Ref<unknown> }).ref;\n }\n\n // Not DEV\n return (element.props as { ref?: React.Ref<unknown> }).ref || (element as any).ref;\n}\n\nexport {\n Slot,\n Slottable,\n //\n Slot as Root,\n};\nexport type { SlotProps };\n","import * as React from 'react';\n\ntype PossibleRef<T> = React.Ref<T> | undefined;\n\n/**\n * Set a given ref to a given value\n * This utility takes care of different types of refs: callback refs and RefObject(s)\n */\nfunction setRef<T>(ref: PossibleRef<T>, value: T) {\n if (typeof ref === 'function') {\n return ref(value);\n } else if (ref !== null && ref !== undefined) {\n ref.current = value;\n }\n}\n\n/**\n * A utility to compose multiple refs together\n * Accepts callback refs and RefObject(s)\n */\nfunction composeRefs<T>(...refs: PossibleRef<T>[]): React.RefCallback<T> {\n return (node) => {\n let hasCleanup = false;\n const cleanups = refs.map((ref) => {\n const cleanup = setRef(ref, node);\n if (!hasCleanup && typeof cleanup == 'function') {\n hasCleanup = true;\n }\n return cleanup;\n });\n\n // React <19 will log an error to the console if a callback ref returns a\n // value. We don't use ref cleanups internally so this will only happen if a\n // user's ref callback returns a value, which we only expect if they are\n // using the cleanup functionality added in React 19.\n if (hasCleanup) {\n return () => {\n for (let i = 0; i < cleanups.length; i++) {\n const cleanup = cleanups[i];\n if (typeof cleanup == 'function') {\n cleanup();\n } else {\n setRef(refs[i], null);\n }\n }\n };\n }\n };\n}\n\n/**\n * A custom hook that composes multiple refs\n * Accepts callback refs and RefObject(s)\n */\nfunction useComposedRefs<T>(...refs: PossibleRef<T>[]): React.RefCallback<T> {\n // eslint-disable-next-line react-hooks/exhaustive-deps\n return React.useCallback(composeRefs(...refs), refs);\n}\n\nexport { composeRefs, useComposedRefs };\n"],"mappings":"0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,YAAAE,EAAA,mBAAAC,IAAA,eAAAC,EAAAJ,GAAA,IAAAK,EAAuB,sBCAvB,IAAAC,EAAuB,sBCAvB,IAAAC,EAAuB,sBAQvB,SAASC,EAAUC,EAAqBC,EAAU,CAChD,GAAI,OAAOD,GAAQ,WACjB,OAAOA,EAAIC,CAAK,EACPD,GAAQ,OACjBA,EAAI,QAAUC,EAElB,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AIC,EAAS,OAAO,yBAAyBD,EAAQ,MAAO,KAAK,GAAG,IAChEE,EAAUD,GAAU,mBAAoBA,GAAUA,EAAO,eAC7D,OAAIC,EACMF,EAAgB,KAI1BC,EAAS,OAAO,yBAAyBD,EAAS,KAAK,GAAG,IAC1DE,EAAUD,GAAU,mBAAoBA,GAAUA,EAAO,eACrDC,EACMF,EAAQ,MAAuC,IAIjDA,EAAQ,MAAuC,KAAQA,EAAgB,IACjF,CDnLA,IAAAG,EAAuC,oCAEvCC,EAAmB,wBAmDPC,EAAA,6BAjDNC,KAAiB,OACnB,wSACA,CACI,SAAU,CACN,QAAS,CACL,QACI,gEACJ,YACI,+EACJ,QACI,2FACJ,UACI,yEACJ,MAAO,+CACP,KAAM,iDACV,EACA,KAAM,CACF,QAAS,gBACT,GAAI,8BACJ,GAAI,uBACJ,KAAM,SACV,EACA,QAAS,CACL,QAAS,aACT,GAAI,aACJ,GAAI,aACJ,GAAI,aACJ,MAAO,cACP,KAAM,cACV,CACJ,EACA,gBAAiB,CACb,QAAS,UACT,KAAM,UACN,QAAS,SACb,CACJ,CACJ,EAQMC,EAAe,aACjB,CAAC,CAAE,UAAAC,EAAW,QAAAC,EAAS,KAAAC,EAAM,QAAAC,EAAS,QAAAC,EAAU,GAAO,GAAGC,CAAM,EAAGC,OAG3D,OAFSF,EAAUG,EAAO,SAEzB,CACG,aAAW,MAAGT,EAAe,CAAE,QAAAG,EAAS,KAAAC,EAAM,QAAAC,EAAS,UAAAH,CAAU,CAAC,CAAC,EACnE,IAAKM,EACJ,GAAGD,EACR,CAGZ,EACAN,EAAO,YAAc","names":["button_exports","__export","Button","buttonVariants","__toCommonJS","React","React","React","setRef","ref","value","composeRefs","refs","node","hasCleanup","cleanups","cleanup","i","import_jsx_runtime","createSlot","ownerName","SlotClone","createSlotClone","Slot","props","forwardedRef","children","slotProps","childrenArray","slottable","isSlottable","newElement","newChildren","child","childrenRef","getElementRef","mergeProps","composeRefs","SLOTTABLE_IDENTIFIER","isSlottable","child","SLOTTABLE_IDENTIFIER","mergeProps","slotProps","childProps","overrideProps","propName","slotPropValue","childPropValue","args","getElementRef","element","getter","mayWarn","import_class_variance_authority","import_utils","import_jsx_runtime","buttonVariants","Button","className","variant","size","rounded","asChild","props","ref","Slot"]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as class_variance_authority_dist_types from 'class-variance-authority/dist/types';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { VariantProps } from 'class-variance-authority';
|
|
4
|
+
|
|
5
|
+
declare const buttonVariants: (props?: ({
|
|
6
|
+
variant?: "default" | "destructive" | "outline" | "secondary" | "ghost" | "link" | null | undefined;
|
|
7
|
+
size?: "default" | "sm" | "lg" | "icon" | null | undefined;
|
|
8
|
+
rounded?: "default" | "sm" | "lg" | "xl" | "2xl" | "full" | null | undefined;
|
|
9
|
+
} & class_variance_authority_dist_types.ClassProp) | undefined) => string;
|
|
10
|
+
interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof buttonVariants> {
|
|
11
|
+
asChild?: boolean;
|
|
12
|
+
}
|
|
13
|
+
declare const Button: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
14
|
+
|
|
15
|
+
export { Button, type ButtonProps, buttonVariants };
|
package/dist/button.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as class_variance_authority_dist_types from 'class-variance-authority/dist/types';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { VariantProps } from 'class-variance-authority';
|
|
4
|
+
|
|
5
|
+
declare const buttonVariants: (props?: ({
|
|
6
|
+
variant?: "default" | "destructive" | "outline" | "secondary" | "ghost" | "link" | null | undefined;
|
|
7
|
+
size?: "default" | "sm" | "lg" | "icon" | null | undefined;
|
|
8
|
+
rounded?: "default" | "sm" | "lg" | "xl" | "2xl" | "full" | null | undefined;
|
|
9
|
+
} & class_variance_authority_dist_types.ClassProp) | undefined) => string;
|
|
10
|
+
interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof buttonVariants> {
|
|
11
|
+
asChild?: boolean;
|
|
12
|
+
}
|
|
13
|
+
declare const Button: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
14
|
+
|
|
15
|
+
export { Button, type ButtonProps, buttonVariants };
|
package/dist/button.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import*as b from"react";import*as a from"react";import*as R from"react";function f(e,n){if(typeof e=="function")return e(n);e!=null&&(e.current=n)}function p(...e){return n=>{let r=!1,o=e.map(t=>{let i=f(t,n);return!r&&typeof i=="function"&&(r=!0),i});if(r)return()=>{for(let t=0;t<o.length;t++){let i=o[t];typeof i=="function"?i():f(e[t],null)}}}}import{Fragment as A,jsx as m}from"react/jsx-runtime";function h(e){let n=v(e),r=a.forwardRef((o,t)=>{let{children:i,...l}=o,s=a.Children.toArray(i),u=s.find(S);if(u){let c=u.props.children,y=s.map(d=>d===u?a.Children.count(c)>1?a.Children.only(null):a.isValidElement(c)?c.props.children:null:d);return m(n,{...l,ref:t,children:a.isValidElement(c)?a.cloneElement(c,void 0,y):null})}return m(n,{...l,ref:t,children:i})});return r.displayName=`${e}.Slot`,r}var g=h("Slot");function v(e){let n=a.forwardRef((r,o)=>{let{children:t,...i}=r;if(a.isValidElement(t)){let l=E(t),s=C(i,t.props);return t.type!==a.Fragment&&(s.ref=o?p(o,l):l),a.cloneElement(t,s)}return a.Children.count(t)>1?a.Children.only(null):null});return n.displayName=`${e}.SlotClone`,n}var x=Symbol("radix.slottable");function S(e){return a.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===x}function C(e,n){let r={...n};for(let o in n){let t=e[o],i=n[o];/^on[A-Z]/.test(o)?t&&i?r[o]=(...s)=>{i(...s),t(...s)}:t&&(r[o]=t):o==="style"?r[o]={...t,...i}:o==="className"&&(r[o]=[t,i].filter(Boolean).join(" "))}return{...e,...r}}function E(e){let n=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=n&&"isReactWarning"in n&&n.isReactWarning;return r?e.ref:(n=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=n&&"isReactWarning"in n&&n.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}import{cva as w}from"class-variance-authority";import{cn as V}from"@c-rex/utils";import{jsx as P}from"react/jsx-runtime";var _=w("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground shadow hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",outline:"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"h-9 w-9"},rounded:{default:"rounded-md",sm:"rounded-sm",lg:"rounded-lg",xl:"rounded-xl","2xl":"rounded-2xl",full:"rounded-full"}},defaultVariants:{variant:"default",size:"default",rounded:"default"}}),B=b.forwardRef(({className:e,variant:n,size:r,rounded:o,asChild:t=!1,...i},l)=>P(t?g:"button",{className:V(_({variant:n,size:r,rounded:o,className:e})),ref:l,...i}));B.displayName="Button";export{B as Button,_ as buttonVariants};
|
|
2
|
+
//# sourceMappingURL=button.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/button.tsx","../../../node_modules/@radix-ui/react-slot/src/slot.tsx","../../../node_modules/@radix-ui/react-compose-refs/src/compose-refs.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { Slot } from \"@radix-ui/react-slot\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\n\nimport { cn } from \"@c-rex/utils\";\n\nconst buttonVariants = cva(\n \"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0\",\n {\n variants: {\n variant: {\n default:\n \"bg-primary text-primary-foreground shadow hover:bg-primary/90\",\n destructive:\n \"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90\",\n outline:\n \"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground\",\n secondary:\n \"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80\",\n ghost: \"hover:bg-accent hover:text-accent-foreground\",\n link: \"text-primary underline-offset-4 hover:underline\",\n },\n size: {\n default: \"h-9 px-4 py-2\",\n sm: \"h-8 rounded-md px-3 text-xs\",\n lg: \"h-10 rounded-md px-8\",\n icon: \"h-9 w-9\",\n },\n rounded: {\n default: \"rounded-md\",\n sm: \"rounded-sm\",\n lg: \"rounded-lg\",\n xl: \"rounded-xl\",\n \"2xl\": \"rounded-2xl\",\n full: \"rounded-full\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n size: \"default\",\n rounded: \"default\",\n },\n },\n);\n\nexport interface ButtonProps\n extends React.ButtonHTMLAttributes<HTMLButtonElement>,\n VariantProps<typeof buttonVariants> {\n asChild?: boolean;\n}\n\nconst Button = React.forwardRef<HTMLButtonElement, ButtonProps>(\n ({ className, variant, size, rounded, asChild = false, ...props }, ref) => {\n const Comp = asChild ? Slot : \"button\";\n return (\n <Comp\n className={cn(buttonVariants({ variant, size, rounded, className }))}\n ref={ref}\n {...props}\n />\n );\n },\n);\nButton.displayName = \"Button\";\n\nexport { Button, buttonVariants };\n","import * as React from 'react';\nimport { composeRefs } from '@radix-ui/react-compose-refs';\n\n/* -------------------------------------------------------------------------------------------------\n * Slot\n * -----------------------------------------------------------------------------------------------*/\n\ninterface SlotProps extends React.HTMLAttributes<HTMLElement> {\n children?: React.ReactNode;\n}\n\n/* @__NO_SIDE_EFFECTS__ */ export function createSlot(ownerName: string) {\n const SlotClone = createSlotClone(ownerName);\n const Slot = React.forwardRef<HTMLElement, SlotProps>((props, forwardedRef) => {\n const { children, ...slotProps } = props;\n const childrenArray = React.Children.toArray(children);\n const slottable = childrenArray.find(isSlottable);\n\n if (slottable) {\n // the new element to render is the one passed as a child of `Slottable`\n const newElement = slottable.props.children;\n\n const newChildren = childrenArray.map((child) => {\n if (child === slottable) {\n // because the new element will be the one rendered, we are only interested\n // in grabbing its children (`newElement.props.children`)\n if (React.Children.count(newElement) > 1) return React.Children.only(null);\n return React.isValidElement(newElement)\n ? (newElement.props as { children: React.ReactNode }).children\n : null;\n } else {\n return child;\n }\n });\n\n return (\n <SlotClone {...slotProps} ref={forwardedRef}>\n {React.isValidElement(newElement)\n ? React.cloneElement(newElement, undefined, newChildren)\n : null}\n </SlotClone>\n );\n }\n\n return (\n <SlotClone {...slotProps} ref={forwardedRef}>\n {children}\n </SlotClone>\n );\n });\n\n Slot.displayName = `${ownerName}.Slot`;\n return Slot;\n}\n\nconst Slot = createSlot('Slot');\n\n/* -------------------------------------------------------------------------------------------------\n * SlotClone\n * -----------------------------------------------------------------------------------------------*/\n\ninterface SlotCloneProps {\n children: React.ReactNode;\n}\n\n/* @__NO_SIDE_EFFECTS__ */ function createSlotClone(ownerName: string) {\n const SlotClone = React.forwardRef<any, SlotCloneProps>((props, forwardedRef) => {\n const { children, ...slotProps } = props;\n\n if (React.isValidElement(children)) {\n const childrenRef = getElementRef(children);\n const props = mergeProps(slotProps, children.props as AnyProps);\n // do not pass ref to React.Fragment for React 19 compatibility\n if (children.type !== React.Fragment) {\n props.ref = forwardedRef ? composeRefs(forwardedRef, childrenRef) : childrenRef;\n }\n return React.cloneElement(children, props);\n }\n\n return React.Children.count(children) > 1 ? React.Children.only(null) : null;\n });\n\n SlotClone.displayName = `${ownerName}.SlotClone`;\n return SlotClone;\n}\n\n/* -------------------------------------------------------------------------------------------------\n * Slottable\n * -----------------------------------------------------------------------------------------------*/\n\nconst SLOTTABLE_IDENTIFIER = Symbol('radix.slottable');\n\ninterface SlottableProps {\n children: React.ReactNode;\n}\n\ninterface SlottableComponent extends React.FC<SlottableProps> {\n __radixId: symbol;\n}\n\n/* @__NO_SIDE_EFFECTS__ */ export function createSlottable(ownerName: string) {\n const Slottable: SlottableComponent = ({ children }) => {\n return <>{children}</>;\n };\n Slottable.displayName = `${ownerName}.Slottable`;\n Slottable.__radixId = SLOTTABLE_IDENTIFIER;\n return Slottable;\n}\n\nconst Slottable = createSlottable('Slottable');\n\n/* ---------------------------------------------------------------------------------------------- */\n\ntype AnyProps = Record<string, any>;\n\nfunction isSlottable(\n child: React.ReactNode\n): child is React.ReactElement<SlottableProps, typeof Slottable> {\n return (\n React.isValidElement(child) &&\n typeof child.type === 'function' &&\n '__radixId' in child.type &&\n child.type.__radixId === SLOTTABLE_IDENTIFIER\n );\n}\n\nfunction mergeProps(slotProps: AnyProps, childProps: AnyProps) {\n // all child props should override\n const overrideProps = { ...childProps };\n\n for (const propName in childProps) {\n const slotPropValue = slotProps[propName];\n const childPropValue = childProps[propName];\n\n const isHandler = /^on[A-Z]/.test(propName);\n if (isHandler) {\n // if the handler exists on both, we compose them\n if (slotPropValue && childPropValue) {\n overrideProps[propName] = (...args: unknown[]) => {\n childPropValue(...args);\n slotPropValue(...args);\n };\n }\n // but if it exists only on the slot, we use only this one\n else if (slotPropValue) {\n overrideProps[propName] = slotPropValue;\n }\n }\n // if it's `style`, we merge them\n else if (propName === 'style') {\n overrideProps[propName] = { ...slotPropValue, ...childPropValue };\n } else if (propName === 'className') {\n overrideProps[propName] = [slotPropValue, childPropValue].filter(Boolean).join(' ');\n }\n }\n\n return { ...slotProps, ...overrideProps };\n}\n\n// Before React 19 accessing `element.props.ref` will throw a warning and suggest using `element.ref`\n// After React 19 accessing `element.ref` does the opposite.\n// https://github.com/facebook/react/pull/28348\n//\n// Access the ref using the method that doesn't yield a warning.\nfunction getElementRef(element: React.ReactElement) {\n // React <=18 in DEV\n let getter = Object.getOwnPropertyDescriptor(element.props, 'ref')?.get;\n let mayWarn = getter && 'isReactWarning' in getter && getter.isReactWarning;\n if (mayWarn) {\n return (element as any).ref;\n }\n\n // React 19 in DEV\n getter = Object.getOwnPropertyDescriptor(element, 'ref')?.get;\n mayWarn = getter && 'isReactWarning' in getter && getter.isReactWarning;\n if (mayWarn) {\n return (element.props as { ref?: React.Ref<unknown> }).ref;\n }\n\n // Not DEV\n return (element.props as { ref?: React.Ref<unknown> }).ref || (element as any).ref;\n}\n\nexport {\n Slot,\n Slottable,\n //\n Slot as Root,\n};\nexport type { SlotProps };\n","import * as React from 'react';\n\ntype PossibleRef<T> = React.Ref<T> | undefined;\n\n/**\n * Set a given ref to a given value\n * This utility takes care of different types of refs: callback refs and RefObject(s)\n */\nfunction setRef<T>(ref: PossibleRef<T>, value: T) {\n if (typeof ref === 'function') {\n return ref(value);\n } else if (ref !== null && ref !== undefined) {\n ref.current = value;\n }\n}\n\n/**\n * A utility to compose multiple refs together\n * Accepts callback refs and RefObject(s)\n */\nfunction composeRefs<T>(...refs: PossibleRef<T>[]): React.RefCallback<T> {\n return (node) => {\n let hasCleanup = false;\n const cleanups = refs.map((ref) => {\n const cleanup = setRef(ref, node);\n if (!hasCleanup && typeof cleanup == 'function') {\n hasCleanup = true;\n }\n return cleanup;\n });\n\n // React <19 will log an error to the console if a callback ref returns a\n // value. We don't use ref cleanups internally so this will only happen if a\n // user's ref callback returns a value, which we only expect if they are\n // using the cleanup functionality added in React 19.\n if (hasCleanup) {\n return () => {\n for (let i = 0; i < cleanups.length; i++) {\n const cleanup = cleanups[i];\n if (typeof cleanup == 'function') {\n cleanup();\n } else {\n setRef(refs[i], null);\n }\n }\n };\n }\n };\n}\n\n/**\n * A custom hook that composes multiple refs\n * Accepts callback refs and RefObject(s)\n */\nfunction useComposedRefs<T>(...refs: PossibleRef<T>[]): React.RefCallback<T> {\n // eslint-disable-next-line react-hooks/exhaustive-deps\n return React.useCallback(composeRefs(...refs), refs);\n}\n\nexport { composeRefs, useComposedRefs };\n"],"mappings":"AAAA,UAAYA,MAAW,QCAvB,UAAYC,MAAW,QCAvB,UAAYC,MAAW,QAQvB,SAASC,EAAUC,EAAqBC,EAAU,CAChD,GAAI,OAAOD,GAAQ,WACjB,OAAOA,EAAIC,CAAK,EACPD,GAAQ,OACjBA,EAAI,QAAUC,EAElB,CAMA,SAASC,KAAkBC,EAA8C,CACvE,OAAQC,GAAS,CACf,IAAIC,EAAa,GACXC,EAAWH,EAAK,IAAKH,GAAQ,CACjC,IAAMO,EAAUR,EAAOC,EAAKI,CAAI,EAChC,MAAI,CAACC,GAAc,OAAOE,GAAW,aACnCF,EAAa,IAERE,CACT,CAAC,EAMD,GAAIF,EACF,MAAO,IAAM,CACX,QAASG,EAAI,EAAGA,EAAIF,EAAS,OAAQE,IAAK,CACxC,IAAMD,EAAUD,EAASE,CAAC,EACtB,OAAOD,GAAW,WACpBA,EAAQ,EAERR,EAAOI,EAAKK,CAAC,EAAG,IAAI,CAExB,CACF,CAEJ,CACF,CDZQ,OAkEG,YAAAC,EAlEH,OAAAC,MAAA,oBAzB0B,SAASC,EAAWC,EAAmB,CACvE,IAAMC,EAAYC,EAAgBF,CAAS,EACrCG,EAAa,aAAmC,CAACC,EAAOC,IAAiB,CAC7E,GAAM,CAAE,SAAAC,EAAU,GAAGC,CAAU,EAAIH,EAC7BI,EAAsB,WAAS,QAAQF,CAAQ,EAC/CG,EAAYD,EAAc,KAAKE,CAAW,EAEhD,GAAID,EAAW,CAEb,IAAME,EAAaF,EAAU,MAAM,SAE7BG,EAAcJ,EAAc,IAAKK,GACjCA,IAAUJ,EAGF,WAAS,MAAME,CAAU,EAAI,EAAgB,WAAS,KAAK,IAAI,EAC5D,iBAAeA,CAAU,EACjCA,EAAW,MAAwC,SACpD,KAE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,SAEzB,CACG,UAAWX,EAAGE,EAAe,CAAE,QAAAG,EAAS,KAAAC,EAAM,QAAAC,EAAS,UAAAH,CAAU,CAAC,CAAC,EACnE,IAAKM,EACJ,GAAGD,EACR,CAGZ,EACAN,EAAO,YAAc","names":["React","React","React","setRef","ref","value","composeRefs","refs","node","hasCleanup","cleanups","cleanup","i","Fragment","jsx","createSlot","ownerName","SlotClone","createSlotClone","Slot","props","forwardedRef","children","slotProps","childrenArray","slottable","isSlottable","newElement","newChildren","child","childrenRef","getElementRef","mergeProps","composeRefs","SLOTTABLE_IDENTIFIER","isSlottable","child","SLOTTABLE_IDENTIFIER","mergeProps","slotProps","childProps","overrideProps","propName","slotPropValue","childPropValue","args","getElementRef","element","getter","mayWarn","cva","cn","jsx","buttonVariants","Button","className","variant","size","rounded","asChild","props","ref","Slot"]}
|
package/dist/command.cjs
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var E=Object.create;var f=Object.defineProperty;var T=Object.getOwnPropertyDescriptor;var L=Object.getOwnPropertyNames;var W=Object.getPrototypeOf,I=Object.prototype.hasOwnProperty;var S=(e,t)=>{for(var o in t)f(e,o,{get:t[o],enumerable:!0})},R=(e,t,o,c)=>{if(t&&typeof t=="object"||typeof t=="function")for(let l of L(t))!I.call(e,l)&&l!==o&&f(e,l,{get:()=>t[l],enumerable:!(c=T(t,l))||c.enumerable});return e};var g=(e,t,o)=>(o=e!=null?E(W(e)):{},R(t||!e||!e.__esModule?f(o,"default",{value:e,enumerable:!0}):o,e)),H=e=>R(f({},"__esModule",{value:!0}),e);var X={};S(X,{Command:()=>y,CommandDialog:()=>F,CommandEmpty:()=>h,CommandGroup:()=>w,CommandInput:()=>x,CommandItem:()=>_,CommandList:()=>N,CommandSeparator:()=>k,CommandShortcut:()=>b});module.exports=H(X);var n=g(require("react"),1),m=require("cmdk"),D=require("lucide-react"),s=require("@c-rex/utils");var p=g(require("react"),1),a=g(require("@radix-ui/react-dialog"),1),v=require("lucide-react"),d=require("@c-rex/utils"),r=require("react/jsx-runtime"),P=a.Root;var M=a.Portal;var C=p.forwardRef(({className:e,...t},o)=>(0,r.jsx)(a.Overlay,{ref:o,className:(0,d.cn)("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t}));C.displayName=a.Overlay.displayName;var u=p.forwardRef(({className:e,children:t,...o},c)=>(0,r.jsxs)(M,{children:[(0,r.jsx)(C,{}),(0,r.jsxs)(a.Content,{ref:c,className:(0,d.cn)("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",e),...o,children:[t,(0,r.jsxs)(a.Close,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[(0,r.jsx)(v.X,{className:"h-4 w-4"}),(0,r.jsx)("span",{className:"sr-only",children:"Close"})]})]})]}));u.displayName=a.Content.displayName;var z=({className:e,...t})=>(0,r.jsx)("div",{className:(0,d.cn)("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});z.displayName="DialogHeader";var G=({className:e,...t})=>(0,r.jsx)("div",{className:(0,d.cn)("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});G.displayName="DialogFooter";var O=p.forwardRef(({className:e,...t},o)=>(0,r.jsx)(a.Title,{ref:o,className:(0,d.cn)("text-lg font-semibold leading-none tracking-tight",e),...t}));O.displayName=a.Title.displayName;var A=p.forwardRef(({className:e,...t},o)=>(0,r.jsx)(a.Description,{ref:o,className:(0,d.cn)("text-sm text-muted-foreground",e),...t}));A.displayName=a.Description.displayName;var i=require("react/jsx-runtime"),y=n.forwardRef(({className:e,...t},o)=>(0,i.jsx)(m.Command,{ref:o,className:(0,s.cn)("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",e),...t}));y.displayName=m.Command.displayName;var F=({children:e,...t})=>(0,i.jsx)(P,{...t,children:(0,i.jsx)(u,{className:"overflow-hidden p-0",children:(0,i.jsx)(y,{className:"[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-group]]:px-2 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5",children:e})})}),x=n.forwardRef(({className:e,...t},o)=>(0,i.jsxs)("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[(0,i.jsx)(D.Search,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),(0,i.jsx)(m.Command.Input,{ref:o,className:(0,s.cn)("flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",e),...t})]}));x.displayName=m.Command.Input.displayName;var N=n.forwardRef(({className:e,...t},o)=>(0,i.jsx)(m.Command.List,{ref:o,className:(0,s.cn)("max-h-[300px] overflow-y-auto overflow-x-hidden",e),...t}));N.displayName=m.Command.List.displayName;var h=n.forwardRef((e,t)=>(0,i.jsx)(m.Command.Empty,{ref:t,className:"py-6 text-center text-sm",...e}));h.displayName=m.Command.Empty.displayName;var w=n.forwardRef(({className:e,...t},o)=>(0,i.jsx)(m.Command.Group,{ref:o,className:(0,s.cn)("overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",e),...t}));w.displayName=m.Command.Group.displayName;var k=n.forwardRef(({className:e,...t},o)=>(0,i.jsx)(m.Command.Separator,{ref:o,className:(0,s.cn)("-mx-1 h-px bg-border",e),...t}));k.displayName=m.Command.Separator.displayName;var _=n.forwardRef(({className:e,...t},o)=>(0,i.jsx)(m.Command.Item,{ref:o,className:(0,s.cn)("relative flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",e),...t}));_.displayName=m.Command.Item.displayName;var b=({className:e,...t})=>(0,i.jsx)("span",{className:(0,s.cn)("ml-auto text-xs tracking-widest text-muted-foreground",e),...t});b.displayName="CommandShortcut";0&&(module.exports={Command,CommandDialog,CommandEmpty,CommandGroup,CommandInput,CommandItem,CommandList,CommandSeparator,CommandShortcut});
|
|
2
|
+
//# sourceMappingURL=command.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/command.tsx","../src/dialog.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { type DialogProps } from \"@radix-ui/react-dialog\";\nimport { Command as CommandPrimitive } from \"cmdk\";\nimport { Search } from \"lucide-react\";\n\nimport { cn } from \"@c-rex/utils\";\nimport { Dialog, DialogContent } from \"./dialog\";\n\nconst Command = React.forwardRef<\n React.ElementRef<typeof CommandPrimitive>,\n React.ComponentPropsWithoutRef<typeof CommandPrimitive>\n>(({ className, ...props }, ref) => (\n <CommandPrimitive\n ref={ref}\n className={cn(\n \"flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground\",\n className,\n )}\n {...props}\n />\n));\nCommand.displayName = CommandPrimitive.displayName;\n\nconst CommandDialog = ({ children, ...props }: DialogProps) => {\n return (\n <Dialog {...props}>\n <DialogContent className=\"overflow-hidden p-0\">\n <Command className=\"[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-group]]:px-2 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5\">\n {children}\n </Command>\n </DialogContent>\n </Dialog>\n );\n};\n\nconst CommandInput = React.forwardRef<\n React.ElementRef<typeof CommandPrimitive.Input>,\n React.ComponentPropsWithoutRef<typeof CommandPrimitive.Input>\n>(({ className, ...props }, ref) => (\n <div className=\"flex items-center border-b px-3\" cmdk-input-wrapper=\"\">\n <Search className=\"mr-2 h-4 w-4 shrink-0 opacity-50\" />\n <CommandPrimitive.Input\n ref={ref}\n className={cn(\n \"flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50\",\n className,\n )}\n {...props}\n />\n </div>\n));\n\nCommandInput.displayName = CommandPrimitive.Input.displayName;\n\nconst CommandList = React.forwardRef<\n React.ElementRef<typeof CommandPrimitive.List>,\n React.ComponentPropsWithoutRef<typeof CommandPrimitive.List>\n>(({ className, ...props }, ref) => (\n <CommandPrimitive.List\n ref={ref}\n className={cn(\"max-h-[300px] overflow-y-auto overflow-x-hidden\", className)}\n {...props}\n />\n));\n\nCommandList.displayName = CommandPrimitive.List.displayName;\n\nconst CommandEmpty = React.forwardRef<\n React.ElementRef<typeof CommandPrimitive.Empty>,\n React.ComponentPropsWithoutRef<typeof CommandPrimitive.Empty>\n>((props, ref) => (\n <CommandPrimitive.Empty\n ref={ref}\n className=\"py-6 text-center text-sm\"\n {...props}\n />\n));\n\nCommandEmpty.displayName = CommandPrimitive.Empty.displayName;\n\nconst CommandGroup = React.forwardRef<\n React.ElementRef<typeof CommandPrimitive.Group>,\n React.ComponentPropsWithoutRef<typeof CommandPrimitive.Group>\n>(({ className, ...props }, ref) => (\n <CommandPrimitive.Group\n ref={ref}\n className={cn(\n \"overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground\",\n className,\n )}\n {...props}\n />\n));\n\nCommandGroup.displayName = CommandPrimitive.Group.displayName;\n\nconst CommandSeparator = React.forwardRef<\n React.ElementRef<typeof CommandPrimitive.Separator>,\n React.ComponentPropsWithoutRef<typeof CommandPrimitive.Separator>\n>(({ className, ...props }, ref) => (\n <CommandPrimitive.Separator\n ref={ref}\n className={cn(\"-mx-1 h-px bg-border\", className)}\n {...props}\n />\n));\nCommandSeparator.displayName = CommandPrimitive.Separator.displayName;\n\nconst CommandItem = React.forwardRef<\n React.ElementRef<typeof CommandPrimitive.Item>,\n React.ComponentPropsWithoutRef<typeof CommandPrimitive.Item>\n>(({ className, ...props }, ref) => (\n <CommandPrimitive.Item\n ref={ref}\n className={cn(\n \"relative flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0\",\n className,\n )}\n {...props}\n />\n));\n\nCommandItem.displayName = CommandPrimitive.Item.displayName;\n\nconst CommandShortcut = ({\n className,\n ...props\n}: React.HTMLAttributes<HTMLSpanElement>) => {\n return (\n <span\n className={cn(\n \"ml-auto text-xs tracking-widest text-muted-foreground\",\n className,\n )}\n {...props}\n />\n );\n};\nCommandShortcut.displayName = \"CommandShortcut\";\n\nexport {\n Command,\n CommandDialog,\n CommandInput,\n CommandList,\n CommandEmpty,\n CommandGroup,\n CommandItem,\n CommandShortcut,\n CommandSeparator,\n};\n","\"use client\";\n\nimport * as React from \"react\";\nimport * as DialogPrimitive from \"@radix-ui/react-dialog\";\nimport { X } from \"lucide-react\";\n\nimport { cn } from \"@c-rex/utils\";\n\nconst Dialog = DialogPrimitive.Root;\n\nconst DialogTrigger = DialogPrimitive.Trigger;\n\nconst DialogPortal = DialogPrimitive.Portal;\n\nconst DialogClose = DialogPrimitive.Close;\n\nconst DialogOverlay = React.forwardRef<\n React.ElementRef<typeof DialogPrimitive.Overlay>,\n React.ComponentPropsWithoutRef<typeof DialogPrimitive.Overlay>\n>(({ className, ...props }, ref) => (\n <DialogPrimitive.Overlay\n ref={ref}\n className={cn(\n \"fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0\",\n className,\n )}\n {...props}\n />\n));\nDialogOverlay.displayName = DialogPrimitive.Overlay.displayName;\n\nconst DialogContent = React.forwardRef<\n React.ElementRef<typeof DialogPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content>\n>(({ className, children, ...props }, ref) => (\n <DialogPortal>\n <DialogOverlay />\n <DialogPrimitive.Content\n ref={ref}\n className={cn(\n \"fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg\",\n className,\n )}\n {...props}\n >\n {children}\n <DialogPrimitive.Close className=\"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground\">\n <X className=\"h-4 w-4\" />\n <span className=\"sr-only\">Close</span>\n </DialogPrimitive.Close>\n </DialogPrimitive.Content>\n </DialogPortal>\n));\nDialogContent.displayName = DialogPrimitive.Content.displayName;\n\nconst DialogHeader = ({\n className,\n ...props\n}: React.HTMLAttributes<HTMLDivElement>) => (\n <div\n className={cn(\n \"flex flex-col space-y-1.5 text-center sm:text-left\",\n className,\n )}\n {...props}\n />\n);\nDialogHeader.displayName = \"DialogHeader\";\n\nconst DialogFooter = ({\n className,\n ...props\n}: React.HTMLAttributes<HTMLDivElement>) => (\n <div\n className={cn(\n \"flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2\",\n className,\n )}\n {...props}\n />\n);\nDialogFooter.displayName = \"DialogFooter\";\n\nconst DialogTitle = React.forwardRef<\n React.ElementRef<typeof DialogPrimitive.Title>,\n React.ComponentPropsWithoutRef<typeof DialogPrimitive.Title>\n>(({ className, ...props }, ref) => (\n <DialogPrimitive.Title\n ref={ref}\n className={cn(\n \"text-lg font-semibold leading-none tracking-tight\",\n className,\n )}\n {...props}\n />\n));\nDialogTitle.displayName = DialogPrimitive.Title.displayName;\n\nconst DialogDescription = React.forwardRef<\n React.ElementRef<typeof DialogPrimitive.Description>,\n React.ComponentPropsWithoutRef<typeof DialogPrimitive.Description>\n>(({ className, ...props }, ref) => (\n <DialogPrimitive.Description\n ref={ref}\n className={cn(\"text-sm text-muted-foreground\", className)}\n {...props}\n />\n));\nDialogDescription.displayName = DialogPrimitive.Description.displayName;\n\nexport {\n Dialog,\n DialogPortal,\n DialogOverlay,\n DialogTrigger,\n DialogClose,\n DialogContent,\n DialogHeader,\n DialogFooter,\n Dial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Q,EAAY,YAAc,EAAAN,QAAiB,KAAK,YAEhD,IAAMO,EAAqB,aAGzB,CAACT,EAAOC,OACN,OAAC,EAAAC,QAAiB,MAAjB,CACG,IAAKD,EACL,UAAU,2BACT,GAAGD,EACR,CACH,EAEDS,EAAa,YAAc,EAAAP,QAAiB,MAAM,YAElD,IAAMQ,EAAqB,aAGzB,CAAC,CAAE,UAAAX,EAAW,GAAGC,CAAM,EAAGC,OACxB,OAAC,EAAAC,QAAiB,MAAjB,CACG,IAAKD,EACL,aAAW,MACP,yNACAF,CACJ,EACC,GAAGC,EACR,CACH,EAEDU,EAAa,YAAc,EAAAR,QAAiB,MAAM,YAElD,IAAMS,EAAyB,aAG7B,CAAC,CAAE,UAAAZ,EAAW,GAAGC,CAAM,EAAGC,OACxB,OAAC,EAAAC,QAAiB,UAAjB,CACG,IAAKD,EACL,aAAW,MAAG,uBAAwBF,CAAS,EAC9C,GAAGC,EACR,CACH,EACDW,EAAiB,YAAc,EAAAT,QAAiB,UAAU,YAE1D,IAAMU,EAAoB,aAGxB,CAAC,CAAE,UAAAb,EAAW,GAAGC,CAAM,EAAGC,OACxB,OAAC,EAAAC,QAAiB,KAAjB,CACG,IAAKD,EACL,aAAW,MACP,0TACAF,CACJ,EACC,GAAGC,EACR,CACH,EAEDY,EAAY,YAAc,EAAAV,QAAiB,KAAK,YAEhD,IAAMW,EAAkB,CAAC,CACrB,UAAAd,EACA,GAAGC,CACP,OAEQ,OAAC,QACG,aAAW,MACP,wDACAD,CACJ,EACC,GAAGC,EACR,EAGRa,EAAgB,YAAc","names":["command_exports","__export","Command","CommandDialog","CommandEmpty","CommandGroup","CommandInput","CommandItem","CommandList","CommandSeparator","CommandShortcut","__toCommonJS","React","import_cmdk","import_lucide_react","import_utils","React","DialogPrimitive","import_lucide_react","import_utils","import_jsx_runtime","Dialog","DialogPortal","DialogOverlay","className","props","ref","DialogContent","children","DialogPortal","DialogHeader","DialogFooter","DialogTitle","DialogDescription","import_jsx_runtime","Command","className","props","ref","CommandPrimitive","CommandDialog","children","Dialog","DialogContent","CommandInput","CommandList","CommandEmpty","CommandGroup","CommandSeparator","CommandItem","CommandShortcut"]}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { DialogProps } from '@radix-ui/react-dialog';
|
|
4
|
+
|
|
5
|
+
declare const Command: React.ForwardRefExoticComponent<Omit<{
|
|
6
|
+
children?: React.ReactNode;
|
|
7
|
+
} & Pick<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof React.HTMLAttributes<HTMLDivElement>> & {
|
|
8
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
9
|
+
} & {
|
|
10
|
+
asChild?: boolean;
|
|
11
|
+
}, "asChild" | "key" | keyof React.HTMLAttributes<HTMLDivElement>> & {
|
|
12
|
+
label?: string;
|
|
13
|
+
shouldFilter?: boolean;
|
|
14
|
+
filter?: (value: string, search: string, keywords?: string[]) => number;
|
|
15
|
+
defaultValue?: string;
|
|
16
|
+
value?: string;
|
|
17
|
+
onValueChange?: (value: string) => void;
|
|
18
|
+
loop?: boolean;
|
|
19
|
+
disablePointerSelection?: boolean;
|
|
20
|
+
vimBindings?: boolean;
|
|
21
|
+
} & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
22
|
+
declare const CommandDialog: ({ children, ...props }: DialogProps) => react_jsx_runtime.JSX.Element;
|
|
23
|
+
declare const CommandInput: React.ForwardRefExoticComponent<Omit<Omit<Pick<Pick<React.DetailedHTMLProps<React.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "key" | keyof React.InputHTMLAttributes<HTMLInputElement>> & {
|
|
24
|
+
ref?: React.Ref<HTMLInputElement>;
|
|
25
|
+
} & {
|
|
26
|
+
asChild?: boolean;
|
|
27
|
+
}, "asChild" | "key" | keyof React.InputHTMLAttributes<HTMLInputElement>>, "type" | "value" | "onChange"> & {
|
|
28
|
+
value?: string;
|
|
29
|
+
onValueChange?: (search: string) => void;
|
|
30
|
+
} & React.RefAttributes<HTMLInputElement>, "ref"> & React.RefAttributes<HTMLInputElement>>;
|
|
31
|
+
declare const CommandList: React.ForwardRefExoticComponent<Omit<{
|
|
32
|
+
children?: React.ReactNode;
|
|
33
|
+
} & Pick<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof React.HTMLAttributes<HTMLDivElement>> & {
|
|
34
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
35
|
+
} & {
|
|
36
|
+
asChild?: boolean;
|
|
37
|
+
}, "asChild" | "key" | keyof React.HTMLAttributes<HTMLDivElement>> & {
|
|
38
|
+
label?: string;
|
|
39
|
+
} & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
40
|
+
declare const CommandEmpty: React.ForwardRefExoticComponent<Omit<{
|
|
41
|
+
children?: React.ReactNode;
|
|
42
|
+
} & Pick<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof React.HTMLAttributes<HTMLDivElement>> & {
|
|
43
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
44
|
+
} & {
|
|
45
|
+
asChild?: boolean;
|
|
46
|
+
}, "asChild" | "key" | keyof React.HTMLAttributes<HTMLDivElement>> & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
47
|
+
declare const CommandGroup: React.ForwardRefExoticComponent<Omit<{
|
|
48
|
+
children?: React.ReactNode;
|
|
49
|
+
} & Omit<Pick<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof React.HTMLAttributes<HTMLDivElement>> & {
|
|
50
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
51
|
+
} & {
|
|
52
|
+
asChild?: boolean;
|
|
53
|
+
}, "asChild" | "key" | keyof React.HTMLAttributes<HTMLDivElement>>, "value" | "heading"> & {
|
|
54
|
+
heading?: React.ReactNode;
|
|
55
|
+
value?: string;
|
|
56
|
+
forceMount?: boolean;
|
|
57
|
+
} & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
58
|
+
declare const CommandSeparator: React.ForwardRefExoticComponent<Omit<Pick<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof React.HTMLAttributes<HTMLDivElement>> & {
|
|
59
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
60
|
+
} & {
|
|
61
|
+
asChild?: boolean;
|
|
62
|
+
}, "asChild" | "key" | keyof React.HTMLAttributes<HTMLDivElement>> & {
|
|
63
|
+
alwaysRender?: boolean;
|
|
64
|
+
} & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
65
|
+
declare const CommandItem: React.ForwardRefExoticComponent<Omit<{
|
|
66
|
+
children?: React.ReactNode;
|
|
67
|
+
} & Omit<Pick<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof React.HTMLAttributes<HTMLDivElement>> & {
|
|
68
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
69
|
+
} & {
|
|
70
|
+
asChild?: boolean;
|
|
71
|
+
}, "asChild" | "key" | keyof React.HTMLAttributes<HTMLDivElement>>, "disabled" | "value" | "onSelect"> & {
|
|
72
|
+
disabled?: boolean;
|
|
73
|
+
onSelect?: (value: string) => void;
|
|
74
|
+
value?: string;
|
|
75
|
+
keywords?: string[];
|
|
76
|
+
forceMount?: boolean;
|
|
77
|
+
} & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
78
|
+
declare const CommandShortcut: {
|
|
79
|
+
({ className, ...props }: React.HTMLAttributes<HTMLSpanElement>): react_jsx_runtime.JSX.Element;
|
|
80
|
+
displayName: string;
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
export { Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut };
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { DialogProps } from '@radix-ui/react-dialog';
|
|
4
|
+
|
|
5
|
+
declare const Command: React.ForwardRefExoticComponent<Omit<{
|
|
6
|
+
children?: React.ReactNode;
|
|
7
|
+
} & Pick<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof React.HTMLAttributes<HTMLDivElement>> & {
|
|
8
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
9
|
+
} & {
|
|
10
|
+
asChild?: boolean;
|
|
11
|
+
}, "asChild" | "key" | keyof React.HTMLAttributes<HTMLDivElement>> & {
|
|
12
|
+
label?: string;
|
|
13
|
+
shouldFilter?: boolean;
|
|
14
|
+
filter?: (value: string, search: string, keywords?: string[]) => number;
|
|
15
|
+
defaultValue?: string;
|
|
16
|
+
value?: string;
|
|
17
|
+
onValueChange?: (value: string) => void;
|
|
18
|
+
loop?: boolean;
|
|
19
|
+
disablePointerSelection?: boolean;
|
|
20
|
+
vimBindings?: boolean;
|
|
21
|
+
} & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
22
|
+
declare const CommandDialog: ({ children, ...props }: DialogProps) => react_jsx_runtime.JSX.Element;
|
|
23
|
+
declare const CommandInput: React.ForwardRefExoticComponent<Omit<Omit<Pick<Pick<React.DetailedHTMLProps<React.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "key" | keyof React.InputHTMLAttributes<HTMLInputElement>> & {
|
|
24
|
+
ref?: React.Ref<HTMLInputElement>;
|
|
25
|
+
} & {
|
|
26
|
+
asChild?: boolean;
|
|
27
|
+
}, "asChild" | "key" | keyof React.InputHTMLAttributes<HTMLInputElement>>, "type" | "value" | "onChange"> & {
|
|
28
|
+
value?: string;
|
|
29
|
+
onValueChange?: (search: string) => void;
|
|
30
|
+
} & React.RefAttributes<HTMLInputElement>, "ref"> & React.RefAttributes<HTMLInputElement>>;
|
|
31
|
+
declare const CommandList: React.ForwardRefExoticComponent<Omit<{
|
|
32
|
+
children?: React.ReactNode;
|
|
33
|
+
} & Pick<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof React.HTMLAttributes<HTMLDivElement>> & {
|
|
34
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
35
|
+
} & {
|
|
36
|
+
asChild?: boolean;
|
|
37
|
+
}, "asChild" | "key" | keyof React.HTMLAttributes<HTMLDivElement>> & {
|
|
38
|
+
label?: string;
|
|
39
|
+
} & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
40
|
+
declare const CommandEmpty: React.ForwardRefExoticComponent<Omit<{
|
|
41
|
+
children?: React.ReactNode;
|
|
42
|
+
} & Pick<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof React.HTMLAttributes<HTMLDivElement>> & {
|
|
43
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
44
|
+
} & {
|
|
45
|
+
asChild?: boolean;
|
|
46
|
+
}, "asChild" | "key" | keyof React.HTMLAttributes<HTMLDivElement>> & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
47
|
+
declare const CommandGroup: React.ForwardRefExoticComponent<Omit<{
|
|
48
|
+
children?: React.ReactNode;
|
|
49
|
+
} & Omit<Pick<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof React.HTMLAttributes<HTMLDivElement>> & {
|
|
50
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
51
|
+
} & {
|
|
52
|
+
asChild?: boolean;
|
|
53
|
+
}, "asChild" | "key" | keyof React.HTMLAttributes<HTMLDivElement>>, "value" | "heading"> & {
|
|
54
|
+
heading?: React.ReactNode;
|
|
55
|
+
value?: string;
|
|
56
|
+
forceMount?: boolean;
|
|
57
|
+
} & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
58
|
+
declare const CommandSeparator: React.ForwardRefExoticComponent<Omit<Pick<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof React.HTMLAttributes<HTMLDivElement>> & {
|
|
59
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
60
|
+
} & {
|
|
61
|
+
asChild?: boolean;
|
|
62
|
+
}, "asChild" | "key" | keyof React.HTMLAttributes<HTMLDivElement>> & {
|
|
63
|
+
alwaysRender?: boolean;
|
|
64
|
+
} & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
65
|
+
declare const CommandItem: React.ForwardRefExoticComponent<Omit<{
|
|
66
|
+
children?: React.ReactNode;
|
|
67
|
+
} & Omit<Pick<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof React.HTMLAttributes<HTMLDivElement>> & {
|
|
68
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
69
|
+
} & {
|
|
70
|
+
asChild?: boolean;
|
|
71
|
+
}, "asChild" | "key" | keyof React.HTMLAttributes<HTMLDivElement>>, "disabled" | "value" | "onSelect"> & {
|
|
72
|
+
disabled?: boolean;
|
|
73
|
+
onSelect?: (value: string) => void;
|
|
74
|
+
value?: string;
|
|
75
|
+
keywords?: string[];
|
|
76
|
+
forceMount?: boolean;
|
|
77
|
+
} & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
78
|
+
declare const CommandShortcut: {
|
|
79
|
+
({ className, ...props }: React.HTMLAttributes<HTMLSpanElement>): react_jsx_runtime.JSX.Element;
|
|
80
|
+
displayName: string;
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
export { Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut };
|