@waveso/ui 0.4.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/accordion.js +1 -1
- package/dist/accordion.js.map +1 -1
- package/dist/alert-dialog.js +2 -2
- package/dist/alert-dialog.js.map +1 -1
- package/dist/animate.d.ts +5 -2
- package/dist/animate.d.ts.map +1 -1
- package/dist/animate.js +14 -8
- package/dist/animate.js.map +1 -1
- package/dist/autocomplete.js +1 -1
- package/dist/autocomplete.js.map +1 -1
- package/dist/badge.d.ts +1 -1
- package/dist/badge.js +1 -1
- package/dist/badge.js.map +1 -1
- package/dist/button.d.ts +2 -2
- package/dist/button.js +1 -1
- package/dist/button.js.map +1 -1
- package/dist/combobox.js +3 -3
- package/dist/combobox.js.map +1 -1
- package/dist/context-menu.js +1 -1
- package/dist/context-menu.js.map +1 -1
- package/dist/dialog.js +2 -2
- package/dist/dialog.js.map +1 -1
- package/dist/drawer.js +2 -2
- package/dist/drawer.js.map +1 -1
- package/dist/input-group.d.ts +1 -1
- package/dist/input-otp.js +1 -1
- package/dist/input-otp.js.map +1 -1
- package/dist/item.d.ts +2 -2
- package/dist/item.js +1 -1
- package/dist/item.js.map +1 -1
- package/dist/menu.js +1 -1
- package/dist/menu.js.map +1 -1
- package/dist/popover.js +1 -1
- package/dist/popover.js.map +1 -1
- package/dist/preview-card.js +1 -1
- package/dist/preview-card.js.map +1 -1
- package/dist/progress.js +1 -1
- package/dist/progress.js.map +1 -1
- package/dist/scroll-area.js +1 -1
- package/dist/scroll-area.js.map +1 -1
- package/dist/select.js +1 -1
- package/dist/select.js.map +1 -1
- package/dist/sidebar.js +1 -1
- package/dist/sidebar.js.map +1 -1
- package/dist/slider.js +2 -2
- package/dist/slider.js.map +1 -1
- package/dist/styles.css +76 -27
- package/dist/switch.js +1 -1
- package/dist/switch.js.map +1 -1
- package/dist/tabs.js +1 -1
- package/dist/tabs.js.map +1 -1
- package/dist/toast.d.ts +1 -1
- package/dist/toast.js +1 -1
- package/dist/toast.js.map +1 -1
- package/dist/toggle.js +1 -1
- package/dist/toggle.js.map +1 -1
- package/dist/tooltip.js +1 -1
- package/dist/tooltip.js.map +1 -1
- package/package.json +1 -1
package/dist/accordion.js
CHANGED
|
@@ -25,7 +25,7 @@ function AccordionTrigger({ className, children, ...props }) {
|
|
|
25
25
|
className: "flex",
|
|
26
26
|
children: /* @__PURE__ */ jsxs(Accordion$1.Trigger, {
|
|
27
27
|
"data-slot": "accordion-trigger",
|
|
28
|
-
className: cn("cursor-clickable focus-visible:ring-ring/50 focus-visible:border-ring focus-visible:after:border-ring **:data-[slot=accordion-trigger-icon]:text-muted-foreground group/accordion-trigger relative flex flex-1 items-start justify-between rounded-lg border border-transparent py-2.5 text-left text-sm font-medium
|
|
28
|
+
className: cn("cursor-clickable focus-visible:ring-ring/50 focus-visible:border-ring focus-visible:after:border-ring **:data-[slot=accordion-trigger-icon]:text-muted-foreground group/accordion-trigger relative flex flex-1 items-start justify-between rounded-lg border border-transparent py-2.5 text-left text-sm font-medium motion-color outline-none hover:underline focus-visible:ring-3 aria-disabled:pointer-events-none aria-disabled:opacity-50 **:data-[slot=accordion-trigger-icon]:ml-auto **:data-[slot=accordion-trigger-icon]:size-4", className),
|
|
29
29
|
...props,
|
|
30
30
|
children: [
|
|
31
31
|
children,
|
package/dist/accordion.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"accordion.js","names":["AccordionPrimitive"],"sources":["../src/accordion.tsx"],"sourcesContent":["\"use client\"\n\nimport * as React from \"react\"\n\nimport { Accordion as AccordionPrimitive } from \"@base-ui/react/accordion\"\n\nimport { cn } from \"./lib/utils\"\n\nimport { ChevronDownIcon, ChevronUpIcon } from \"./lib/internal-icons\"\n\ntype AccordionProps = React.ComponentProps<typeof AccordionPrimitive.Root>\ntype AccordionItemProps = React.ComponentProps<typeof AccordionPrimitive.Item>\ntype AccordionTriggerProps = React.ComponentProps<typeof AccordionPrimitive.Trigger>\ntype AccordionContentProps = React.ComponentProps<typeof AccordionPrimitive.Panel>\n\nfunction Accordion({ className, ...props }: AccordionProps) {\n return (\n <AccordionPrimitive.Root\n data-slot=\"accordion\"\n className={cn(\n \"overflow-hidden flex w-full flex-col\",\n className\n )}\n {...props}\n />\n )\n}\n\nfunction AccordionItem({ className, ...props }: AccordionItemProps) {\n return (\n <AccordionPrimitive.Item\n data-slot=\"accordion-item\"\n className={cn(\n \"not-last:border-b\",\n className\n )}\n {...props}\n />\n )\n}\n\nfunction AccordionTrigger({\n className,\n children,\n ...props\n}: AccordionTriggerProps) {\n return (\n <AccordionPrimitive.Header data-slot=\"accordion-header\" className=\"flex\">\n <AccordionPrimitive.Trigger\n data-slot=\"accordion-trigger\"\n className={cn(\n \"cursor-clickable focus-visible:ring-ring/50 focus-visible:border-ring focus-visible:after:border-ring **:data-[slot=accordion-trigger-icon]:text-muted-foreground group/accordion-trigger relative flex flex-1 items-start justify-between rounded-lg border border-transparent py-2.5 text-left text-sm font-medium
|
|
1
|
+
{"version":3,"file":"accordion.js","names":["AccordionPrimitive"],"sources":["../src/accordion.tsx"],"sourcesContent":["\"use client\"\n\nimport * as React from \"react\"\n\nimport { Accordion as AccordionPrimitive } from \"@base-ui/react/accordion\"\n\nimport { cn } from \"./lib/utils\"\n\nimport { ChevronDownIcon, ChevronUpIcon } from \"./lib/internal-icons\"\n\ntype AccordionProps = React.ComponentProps<typeof AccordionPrimitive.Root>\ntype AccordionItemProps = React.ComponentProps<typeof AccordionPrimitive.Item>\ntype AccordionTriggerProps = React.ComponentProps<typeof AccordionPrimitive.Trigger>\ntype AccordionContentProps = React.ComponentProps<typeof AccordionPrimitive.Panel>\n\nfunction Accordion({ className, ...props }: AccordionProps) {\n return (\n <AccordionPrimitive.Root\n data-slot=\"accordion\"\n className={cn(\n \"overflow-hidden flex w-full flex-col\",\n className\n )}\n {...props}\n />\n )\n}\n\nfunction AccordionItem({ className, ...props }: AccordionItemProps) {\n return (\n <AccordionPrimitive.Item\n data-slot=\"accordion-item\"\n className={cn(\n \"not-last:border-b\",\n className\n )}\n {...props}\n />\n )\n}\n\nfunction AccordionTrigger({\n className,\n children,\n ...props\n}: AccordionTriggerProps) {\n return (\n <AccordionPrimitive.Header data-slot=\"accordion-header\" className=\"flex\">\n <AccordionPrimitive.Trigger\n data-slot=\"accordion-trigger\"\n className={cn(\n \"cursor-clickable focus-visible:ring-ring/50 focus-visible:border-ring focus-visible:after:border-ring **:data-[slot=accordion-trigger-icon]:text-muted-foreground group/accordion-trigger relative flex flex-1 items-start justify-between rounded-lg border border-transparent py-2.5 text-left text-sm font-medium motion-color outline-none hover:underline focus-visible:ring-3 aria-disabled:pointer-events-none aria-disabled:opacity-50 **:data-[slot=accordion-trigger-icon]:ml-auto **:data-[slot=accordion-trigger-icon]:size-4\",\n className\n )}\n {...props}\n >\n {children}\n <ChevronDownIcon data-slot=\"accordion-trigger-icon\" className=\"pointer-events-none shrink-0 group-aria-expanded/accordion-trigger:hidden\" />\n <ChevronUpIcon data-slot=\"accordion-trigger-icon\" className=\"pointer-events-none hidden shrink-0 group-aria-expanded/accordion-trigger:inline\" />\n </AccordionPrimitive.Trigger>\n </AccordionPrimitive.Header>\n )\n}\n\nfunction AccordionContent({\n className,\n children,\n ...props\n}: AccordionContentProps) {\n return (\n <AccordionPrimitive.Panel\n data-slot=\"accordion-panel\"\n className=\"data-open:animate-accordion-down data-closed:animate-accordion-up overflow-hidden text-sm\"\n {...props}\n >\n <div\n data-slot=\"accordion-content\"\n className={cn(\n \"[&_a]:hover:text-foreground h-(--accordion-panel-height) pt-0 pb-2.5 data-ending-style:h-0 data-starting-style:h-0 [&_a]:underline [&_a]:underline-offset-3 [&_p:not(:last-child)]:mb-4\",\n className\n )}\n >\n {children}\n </div>\n </AccordionPrimitive.Panel>\n )\n}\n\nexport {\n Accordion,\n AccordionItem,\n AccordionTrigger,\n AccordionContent,\n}\n"],"mappings":";;;;;;;AAeA,SAAS,UAAU,EAAE,WAAW,GAAG,SAAyB;AAC1D,QACE,oBAACA,YAAmB,MAApB;EACE,aAAU;EACV,WAAW,GACT,wCACA,UACD;EACD,GAAI;EACJ,CAAA;;AAIN,SAAS,cAAc,EAAE,WAAW,GAAG,SAA6B;AAClE,QACE,oBAACA,YAAmB,MAApB;EACE,aAAU;EACV,WAAW,GACT,qBACA,UACD;EACD,GAAI;EACJ,CAAA;;AAIN,SAAS,iBAAiB,EACxB,WACA,UACA,GAAG,SACqB;AACxB,QACE,oBAACA,YAAmB,QAApB;EAA2B,aAAU;EAAmB,WAAU;YAChE,qBAACA,YAAmB,SAApB;GACE,aAAU;GACV,WAAW,GACT,6gBACA,UACD;GACD,GAAI;aANN;IAQG;IACD,oBAAC,iBAAD;KAAiB,aAAU;KAAyB,WAAU;KAA8E,CAAA;IAC5I,oBAAC,eAAD;KAAe,aAAU;KAAyB,WAAU;KAAqF,CAAA;IACtH;;EACH,CAAA;;AAIhC,SAAS,iBAAiB,EACxB,WACA,UACA,GAAG,SACqB;AACxB,QACE,oBAACA,YAAmB,OAApB;EACE,aAAU;EACV,WAAU;EACV,GAAI;YAEJ,oBAAC,OAAD;GACE,aAAU;GACV,WAAW,GACT,2LACA,UACD;GAEA;GACG,CAAA;EACmB,CAAA"}
|
package/dist/alert-dialog.js
CHANGED
|
@@ -26,7 +26,7 @@ function AlertDialogPortal({ ...props }) {
|
|
|
26
26
|
function AlertDialogOverlay({ className, ...props }) {
|
|
27
27
|
return /* @__PURE__ */ jsx(AlertDialog$1.Backdrop, {
|
|
28
28
|
"data-slot": "alert-dialog-overlay",
|
|
29
|
-
className: cn("
|
|
29
|
+
className: cn("motion-scrim fixed inset-0 isolate z-50 bg-black/10 supports-backdrop-filter:backdrop-blur-xs", className),
|
|
30
30
|
...props
|
|
31
31
|
});
|
|
32
32
|
}
|
|
@@ -34,7 +34,7 @@ function AlertDialogContent({ className, size = "default", ...props }) {
|
|
|
34
34
|
return /* @__PURE__ */ jsxs(AlertDialogPortal, { children: [/* @__PURE__ */ jsx(AlertDialogOverlay, {}), /* @__PURE__ */ jsx(AlertDialog$1.Popup, {
|
|
35
35
|
"data-slot": "alert-dialog-content",
|
|
36
36
|
"data-size": size,
|
|
37
|
-
className: cn("
|
|
37
|
+
className: cn("motion-scale bg-background ring-foreground/10 group/alert-dialog-content fixed top-1/2 left-1/2 z-50 grid w-full -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl p-4 ring-1 outline-none data-[size=default]:max-w-xs data-[size=sm]:max-w-xs data-[size=lg]:max-w-lg data-[size=xl]:max-w-xl data-[size=default]:sm:max-w-sm data-[size=lg]:sm:max-w-lg data-[size=xl]:sm:max-w-xl", className),
|
|
38
38
|
...props
|
|
39
39
|
})] });
|
|
40
40
|
}
|
package/dist/alert-dialog.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"alert-dialog.js","names":["AlertDialogPrimitive"],"sources":["../src/alert-dialog.tsx"],"sourcesContent":["\"use client\"\n\nimport * as React from \"react\"\nimport { AlertDialog as AlertDialogPrimitive } from \"@base-ui/react/alert-dialog\"\n\nimport { Button } from \"./button\"\nimport { cn } from \"./lib/utils\"\n\ntype AlertDialogProps = React.ComponentProps<typeof AlertDialogPrimitive.Root>\n\ntype AlertDialogTriggerProps = React.ComponentProps<typeof AlertDialogPrimitive.Trigger>\n\ntype AlertDialogPortalProps = React.ComponentProps<typeof AlertDialogPrimitive.Portal>\n\ntype AlertDialogOverlayProps = React.ComponentProps<typeof AlertDialogPrimitive.Backdrop>\n\ntype AlertDialogContentProps = React.ComponentProps<typeof AlertDialogPrimitive.Popup> & {\n size?: \"default\" | \"sm\" | \"lg\" | \"xl\"\n}\n\ntype AlertDialogHeaderProps = React.ComponentProps<\"div\">\n\ntype AlertDialogFooterProps = React.ComponentProps<\"div\">\n\ntype AlertDialogMediaProps = React.ComponentProps<\"div\">\n\ntype AlertDialogTitleProps = React.ComponentProps<typeof AlertDialogPrimitive.Title>\n\ntype AlertDialogDescriptionProps = React.ComponentProps<typeof AlertDialogPrimitive.Description>\n\ntype AlertDialogActionProps = React.ComponentProps<typeof Button>\n\ntype AlertDialogCancelProps = React.ComponentProps<typeof AlertDialogPrimitive.Close> &\n Pick<React.ComponentProps<typeof Button>, \"variant\" | \"size\">\n\nfunction AlertDialog({ ...props }: AlertDialogProps) {\n return <AlertDialogPrimitive.Root data-slot=\"alert-dialog\" {...props} />\n}\n\nfunction AlertDialogTrigger({ ...props }: AlertDialogTriggerProps) {\n return <AlertDialogPrimitive.Trigger data-slot=\"alert-dialog-trigger\" {...props} />\n}\n\nfunction AlertDialogPortal({ ...props }: AlertDialogPortalProps) {\n return <AlertDialogPrimitive.Portal data-slot=\"alert-dialog-portal\" {...props} />\n}\n\nfunction AlertDialogOverlay({ className, ...props }: AlertDialogOverlayProps) {\n return (\n <AlertDialogPrimitive.Backdrop\n data-slot=\"alert-dialog-overlay\"\n className={cn(\n \"
|
|
1
|
+
{"version":3,"file":"alert-dialog.js","names":["AlertDialogPrimitive"],"sources":["../src/alert-dialog.tsx"],"sourcesContent":["\"use client\"\n\nimport * as React from \"react\"\nimport { AlertDialog as AlertDialogPrimitive } from \"@base-ui/react/alert-dialog\"\n\nimport { Button } from \"./button\"\nimport { cn } from \"./lib/utils\"\n\ntype AlertDialogProps = React.ComponentProps<typeof AlertDialogPrimitive.Root>\n\ntype AlertDialogTriggerProps = React.ComponentProps<typeof AlertDialogPrimitive.Trigger>\n\ntype AlertDialogPortalProps = React.ComponentProps<typeof AlertDialogPrimitive.Portal>\n\ntype AlertDialogOverlayProps = React.ComponentProps<typeof AlertDialogPrimitive.Backdrop>\n\ntype AlertDialogContentProps = React.ComponentProps<typeof AlertDialogPrimitive.Popup> & {\n size?: \"default\" | \"sm\" | \"lg\" | \"xl\"\n}\n\ntype AlertDialogHeaderProps = React.ComponentProps<\"div\">\n\ntype AlertDialogFooterProps = React.ComponentProps<\"div\">\n\ntype AlertDialogMediaProps = React.ComponentProps<\"div\">\n\ntype AlertDialogTitleProps = React.ComponentProps<typeof AlertDialogPrimitive.Title>\n\ntype AlertDialogDescriptionProps = React.ComponentProps<typeof AlertDialogPrimitive.Description>\n\ntype AlertDialogActionProps = React.ComponentProps<typeof Button>\n\ntype AlertDialogCancelProps = React.ComponentProps<typeof AlertDialogPrimitive.Close> &\n Pick<React.ComponentProps<typeof Button>, \"variant\" | \"size\">\n\nfunction AlertDialog({ ...props }: AlertDialogProps) {\n return <AlertDialogPrimitive.Root data-slot=\"alert-dialog\" {...props} />\n}\n\nfunction AlertDialogTrigger({ ...props }: AlertDialogTriggerProps) {\n return <AlertDialogPrimitive.Trigger data-slot=\"alert-dialog-trigger\" {...props} />\n}\n\nfunction AlertDialogPortal({ ...props }: AlertDialogPortalProps) {\n return <AlertDialogPrimitive.Portal data-slot=\"alert-dialog-portal\" {...props} />\n}\n\nfunction AlertDialogOverlay({ className, ...props }: AlertDialogOverlayProps) {\n return (\n <AlertDialogPrimitive.Backdrop\n data-slot=\"alert-dialog-overlay\"\n className={cn(\n \"motion-scrim fixed inset-0 isolate z-50 bg-black/10 supports-backdrop-filter:backdrop-blur-xs\",\n className,\n )}\n {...props}\n />\n )\n}\n\nfunction AlertDialogContent({\n className,\n size = \"default\",\n ...props\n}: AlertDialogContentProps) {\n return (\n <AlertDialogPortal>\n <AlertDialogOverlay />\n <AlertDialogPrimitive.Popup\n data-slot=\"alert-dialog-content\"\n data-size={size}\n className={cn(\n \"motion-scale bg-background ring-foreground/10 group/alert-dialog-content fixed top-1/2 left-1/2 z-50 grid w-full -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl p-4 ring-1 outline-none data-[size=default]:max-w-xs data-[size=sm]:max-w-xs data-[size=lg]:max-w-lg data-[size=xl]:max-w-xl data-[size=default]:sm:max-w-sm data-[size=lg]:sm:max-w-lg data-[size=xl]:sm:max-w-xl\",\n className,\n )}\n {...props}\n />\n </AlertDialogPortal>\n )\n}\n\nfunction AlertDialogHeader({ className, ...props }: AlertDialogHeaderProps) {\n return (\n <div\n data-slot=\"alert-dialog-header\"\n className={cn(\n \"grid grid-rows-[auto_1fr] place-items-center gap-1.5 text-center has-data-[slot=alert-dialog-media]:grid-rows-[auto_auto_1fr] has-data-[slot=alert-dialog-media]:gap-x-4 sm:group-data-[size=default]/alert-dialog-content:place-items-start sm:group-data-[size=default]/alert-dialog-content:text-left sm:group-data-[size=default]/alert-dialog-content:has-data-[slot=alert-dialog-media]:grid-rows-[auto_1fr] group-data-[size=lg]/alert-dialog-content:place-items-start group-data-[size=lg]/alert-dialog-content:text-left group-data-[size=xl]/alert-dialog-content:place-items-start group-data-[size=xl]/alert-dialog-content:text-left\",\n className,\n )}\n {...props}\n />\n )\n}\n\nfunction AlertDialogFooter({ className, ...props }: AlertDialogFooterProps) {\n return (\n <div\n data-slot=\"alert-dialog-footer\"\n className={cn(\n \"bg-muted/50 -mx-4 -mb-4 flex flex-col-reverse gap-2 rounded-b-xl border-t p-4 group-data-[size=sm]/alert-dialog-content:grid group-data-[size=sm]/alert-dialog-content:grid-cols-2 sm:flex-row sm:justify-end\",\n className,\n )}\n {...props}\n />\n )\n}\n\nfunction AlertDialogMedia({ className, ...props }: AlertDialogMediaProps) {\n return (\n <div\n data-slot=\"alert-dialog-media\"\n className={cn(\n \"bg-muted mb-2 inline-flex size-10 items-center justify-center rounded-md sm:group-data-[size=default]/alert-dialog-content:row-span-2 *:[svg:not([class*='size-'])]:size-6\",\n className,\n )}\n {...props}\n />\n )\n}\n\nfunction AlertDialogTitle({ className, ...props }: AlertDialogTitleProps) {\n return (\n <AlertDialogPrimitive.Title\n data-slot=\"alert-dialog-title\"\n className={cn(\n \"text-base font-medium sm:group-data-[size=default]/alert-dialog-content:group-has-data-[slot=alert-dialog-media]/alert-dialog-content:col-start-2\",\n className,\n )}\n {...props}\n />\n )\n}\n\nfunction AlertDialogDescription({\n className,\n ...props\n}: AlertDialogDescriptionProps) {\n return (\n <AlertDialogPrimitive.Description\n data-slot=\"alert-dialog-description\"\n className={cn(\n \"text-muted-foreground *:[a]:hover:text-foreground text-sm text-balance md:text-pretty *:[a]:underline *:[a]:underline-offset-3\",\n className,\n )}\n {...props}\n />\n )\n}\n\nfunction AlertDialogAction({\n className,\n ...props\n}: AlertDialogActionProps) {\n return (\n <Button\n data-slot=\"alert-dialog-action\"\n className={cn(className)}\n {...props}\n />\n )\n}\n\nfunction AlertDialogCancel({\n className,\n variant = \"outline\",\n size = \"default\",\n ...props\n}: AlertDialogCancelProps) {\n return (\n <AlertDialogPrimitive.Close\n data-slot=\"alert-dialog-cancel\"\n className={className}\n render={<Button variant={variant} size={size} />}\n {...props}\n />\n )\n}\n\nexport {\n AlertDialog,\n AlertDialogAction,\n AlertDialogCancel,\n AlertDialogContent,\n AlertDialogDescription,\n AlertDialogFooter,\n AlertDialogHeader,\n AlertDialogMedia,\n AlertDialogOverlay,\n AlertDialogPortal,\n AlertDialogTitle,\n AlertDialogTrigger,\n}\n"],"mappings":";;;;;;;AAmCA,SAAS,YAAY,EAAE,GAAG,SAA2B;AACnD,QAAO,oBAACA,cAAqB,MAAtB;EAA2B,aAAU;EAAe,GAAI;EAAS,CAAA;;AAG1E,SAAS,mBAAmB,EAAE,GAAG,SAAkC;AACjE,QAAO,oBAACA,cAAqB,SAAtB;EAA8B,aAAU;EAAuB,GAAI;EAAS,CAAA;;AAGrF,SAAS,kBAAkB,EAAE,GAAG,SAAiC;AAC/D,QAAO,oBAACA,cAAqB,QAAtB;EAA6B,aAAU;EAAsB,GAAI;EAAS,CAAA;;AAGnF,SAAS,mBAAmB,EAAE,WAAW,GAAG,SAAkC;AAC5E,QACE,oBAACA,cAAqB,UAAtB;EACE,aAAU;EACV,WAAW,GACT,iGACA,UACD;EACD,GAAI;EACJ,CAAA;;AAIN,SAAS,mBAAmB,EAC1B,WACA,OAAO,WACP,GAAG,SACuB;AAC1B,QACE,qBAAC,mBAAD,EAAA,UAAA,CACE,oBAAC,oBAAD,EAAsB,CAAA,EACtB,oBAACA,cAAqB,OAAtB;EACE,aAAU;EACV,aAAW;EACX,WAAW,GACT,0XACA,UACD;EACD,GAAI;EACJ,CAAA,CACgB,EAAA,CAAA;;AAIxB,SAAS,kBAAkB,EAAE,WAAW,GAAG,SAAiC;AAC1E,QACE,oBAAC,OAAD;EACE,aAAU;EACV,WAAW,GACT,snBACA,UACD;EACD,GAAI;EACJ,CAAA;;AAIN,SAAS,kBAAkB,EAAE,WAAW,GAAG,SAAiC;AAC1E,QACE,oBAAC,OAAD;EACE,aAAU;EACV,WAAW,GACT,iNACA,UACD;EACD,GAAI;EACJ,CAAA;;AAIN,SAAS,iBAAiB,EAAE,WAAW,GAAG,SAAgC;AACxE,QACE,oBAAC,OAAD;EACE,aAAU;EACV,WAAW,GACT,8KACA,UACD;EACD,GAAI;EACJ,CAAA;;AAIN,SAAS,iBAAiB,EAAE,WAAW,GAAG,SAAgC;AACxE,QACE,oBAACA,cAAqB,OAAtB;EACE,aAAU;EACV,WAAW,GACT,qJACA,UACD;EACD,GAAI;EACJ,CAAA;;AAIN,SAAS,uBAAuB,EAC9B,WACA,GAAG,SAC2B;AAC9B,QACE,oBAACA,cAAqB,aAAtB;EACE,aAAU;EACV,WAAW,GACT,kIACA,UACD;EACD,GAAI;EACJ,CAAA;;AAIN,SAAS,kBAAkB,EACzB,WACA,GAAG,SACsB;AACzB,QACE,oBAAC,QAAD;EACE,aAAU;EACV,WAAW,GAAG,UAAU;EACxB,GAAI;EACJ,CAAA;;AAIN,SAAS,kBAAkB,EACzB,WACA,UAAU,WACV,OAAO,WACP,GAAG,SACsB;AACzB,QACE,oBAACA,cAAqB,OAAtB;EACE,aAAU;EACC;EACX,QAAQ,oBAAC,QAAD;GAAiB;GAAe;GAAQ,CAAA;EAChD,GAAI;EACJ,CAAA"}
|
package/dist/animate.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ interface AnimateOnViewProps {
|
|
|
11
11
|
delay?: number;
|
|
12
12
|
/** Direction to animate from. Default: 'down' */
|
|
13
13
|
from?: Direction;
|
|
14
|
-
/** Distance in px. Default:
|
|
14
|
+
/** Distance in px. Default: 16 (scroll reveals need more travel than `AnimateIn`) */
|
|
15
15
|
distance?: number;
|
|
16
16
|
/** Also scale in (0.85 → 1). Default: false */
|
|
17
17
|
scale?: boolean;
|
|
@@ -34,7 +34,7 @@ interface AnimateInProps {
|
|
|
34
34
|
delay?: number;
|
|
35
35
|
/** Direction to animate from. Default: 'down' */
|
|
36
36
|
from?: Direction;
|
|
37
|
-
/** Distance in px. Default:
|
|
37
|
+
/** Distance in px. Default: 4 */
|
|
38
38
|
distance?: number;
|
|
39
39
|
/** Also scale in (0.85 → 1). Default: false */
|
|
40
40
|
scale?: boolean;
|
|
@@ -83,6 +83,9 @@ interface FloatProps {
|
|
|
83
83
|
/**
|
|
84
84
|
* Animates a child element when it scrolls into view.
|
|
85
85
|
*
|
|
86
|
+
* Defaults are tuned for scroll reveals — larger travel and a slower duration
|
|
87
|
+
* than `AnimateIn` — so the motion reads as the content enters the viewport.
|
|
88
|
+
*
|
|
86
89
|
* Zero DOM overhead — applies styles directly to the child via cloneElement.
|
|
87
90
|
* Renders children unchanged on server to avoid hydration mismatch.
|
|
88
91
|
*
|
package/dist/animate.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"animate.d.ts","names":[],"sources":["../src/animate.tsx"],"mappings":";;;;;;KAkBK,SAAA;AAAA,UAEK,kBAAA;EACR,QAAA,EAAU,YAAA;;EAEV,KAAA;EALY;EAOZ,IAAA,GAAO,SAAA;EAPK;EASZ,QAAA;EAPQ;EASR,KAAA;;EAEA,IAAA;EANO;EAQP,MAAA;EAQuB;EANvB,IAAA;EAdA;EAgBA,MAAA;EAdA;EAgBA,IAAA;EAdO;EAgBP,UAAA,GAAa,UAAA;AAAA;AAAA,UAGL,cAAA;EACR,QAAA,EAAU,YAAA;EAVV;EAYA,KAAA;EARA;EAUA,IAAA,GAAO,SAAA;EARM;EAUb,QAAA;EAVuB;EAYvB,KAAA;EATsB;EAWtB,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A;EAdA;EAgBA,MAAA;AAAA;AAAA,UAGQ,UAAA;EACR,QAAA,EAAU,YAAA;EAfQ;EAiBlB,QAAA;EAhBsB;EAkBtB,QAAA;EAlBU;EAoBV,MAAA;EAhBA;EAkBA,MAAA;AAAA;;;;AAZM;;;;;;;;;;;;AAYA;iBAgIC,aAAA,CAAA;EACP,QAAA;EACA,KAAA;EACA,IAAA;EACA,QAAA;EACA,KAAA;EACA,IAAA;EACA,MAAA;EACA,IAAA;EACA,MAAA;EACA,IAAA;EACA;AAAA,GACC,kBAAA,GAAkB,YAAA,mBAAA,OAAA,CAAA,qBAAA;;;;;;;;;;;;;;iBAoDZ,SAAA,CAAA;EACP,QAAA;EACA,KAAA;EACA,IAAA;EACA,QAAA;EACA,KAAA;EACA,IAAA;EACA,MAAA;EACA,IAAA;EACA,MAAA;EACA;AAAA,GACC,cAAA,GAAc,YAAA,mBAAA,OAAA,CAAA,qBAAA;;;;;;;;;;;;;iBA8CR,OAAA,CAAA;EACP,QAAA;EACA,QAAA;EACA;AAAA,GACC,YAAA,GAAY,oBAAA,CAAA,GAAA,CAAA,OAAA;;;;;;;;;;;;iBA0BN,KAAA,CAAA;EACP,QAAA;EACA,GAAA;EACA,GAAA;EACA,QAAA;EACA,OAAA;EACA;AAAA,GACC,UAAA,GAAU,oBAAA,CAAA,GAAA,CAAA,OAAA;;;;;;AAlJQ;;;;;;iBAsMZ,KAAA,CAAA;EACP,QAAA;EACA,QAAA;EACA,QAAA;EACA,MAAA;EACA;AAAA,GACC,UAAA,GAAU,oBAAA,CAAA,GAAA,CAAA,OAAA"}
|
package/dist/animate.js
CHANGED
|
@@ -32,8 +32,11 @@ const FLIP_MAP = {
|
|
|
32
32
|
left: "rotateY(-90deg)",
|
|
33
33
|
right: "rotateY(90deg)"
|
|
34
34
|
};
|
|
35
|
-
/**
|
|
36
|
-
|
|
35
|
+
/** Overshoot ("spring") easing for the opt-in `spring` prop on
|
|
36
|
+
* `AnimateIn` / `AnimateOnView`. This is `animate.tsx`'s own page-entrance
|
|
37
|
+
* bounce — the CSS recipe system intentionally has no spring (one circ-out
|
|
38
|
+
* curve), so this is a standalone constant, not a shared token. */
|
|
39
|
+
const SPRING_EASE = "cubic-bezier(0.34, 1.45, 0.64, 1)";
|
|
37
40
|
function buildStyles(opts) {
|
|
38
41
|
const { from, distance, doScale, blur, rotate, flip } = opts;
|
|
39
42
|
const dir = DIRECTION_MAP[from];
|
|
@@ -49,7 +52,7 @@ function buildStyles(opts) {
|
|
|
49
52
|
if (doScale) visibleParts.push("scale(1)");
|
|
50
53
|
if (rotate) visibleParts.push("rotate(0deg)");
|
|
51
54
|
if (flip) visibleParts.push(from === "up" || from === "down" ? "rotateX(0deg)" : "rotateY(0deg)");
|
|
52
|
-
const blurPx = blur === true ?
|
|
55
|
+
const blurPx = blur === true ? 8 : typeof blur === "number" ? blur : 0;
|
|
53
56
|
const hidden = {
|
|
54
57
|
opacity: "0",
|
|
55
58
|
transform: hiddenParts.join(" ")
|
|
@@ -76,9 +79,9 @@ function mergeRefs(...refs) {
|
|
|
76
79
|
});
|
|
77
80
|
};
|
|
78
81
|
}
|
|
79
|
-
function getTransitionParams(transition, useSpring) {
|
|
82
|
+
function getTransitionParams(transition, useSpring, fallbackDuration = .15) {
|
|
80
83
|
return {
|
|
81
|
-
duration: transition?.duration ??
|
|
84
|
+
duration: transition?.duration ?? fallbackDuration,
|
|
82
85
|
ease: useSpring ? SPRING_EASE : transition?.ease ?? "ease-out"
|
|
83
86
|
};
|
|
84
87
|
}
|
|
@@ -90,6 +93,9 @@ function buildTransitionStr(duration, ease, delay, hasFilter) {
|
|
|
90
93
|
/**
|
|
91
94
|
* Animates a child element when it scrolls into view.
|
|
92
95
|
*
|
|
96
|
+
* Defaults are tuned for scroll reveals — larger travel and a slower duration
|
|
97
|
+
* than `AnimateIn` — so the motion reads as the content enters the viewport.
|
|
98
|
+
*
|
|
93
99
|
* Zero DOM overhead — applies styles directly to the child via cloneElement.
|
|
94
100
|
* Renders children unchanged on server to avoid hydration mismatch.
|
|
95
101
|
*
|
|
@@ -100,7 +106,7 @@ function buildTransitionStr(duration, ease, delay, hasFilter) {
|
|
|
100
106
|
* </AnimateOnView>
|
|
101
107
|
* ```
|
|
102
108
|
*/
|
|
103
|
-
function AnimateOnView({ children, delay = 0, from = "down", distance =
|
|
109
|
+
function AnimateOnView({ children, delay = 0, from = "down", distance = 16, scale = false, blur = false, rotate = 0, flip = false, spring = false, once = true, transition }) {
|
|
104
110
|
const ref = useRef(null);
|
|
105
111
|
const [hydrated, setHydrated] = useState(false);
|
|
106
112
|
const isInView = useInView(ref, {
|
|
@@ -123,7 +129,7 @@ function AnimateOnView({ children, delay = 0, from = "down", distance = 20, scal
|
|
|
123
129
|
rotate,
|
|
124
130
|
flip
|
|
125
131
|
});
|
|
126
|
-
const { duration, ease } = getTransitionParams(transition, spring);
|
|
132
|
+
const { duration, ease } = getTransitionParams(transition, spring, .4);
|
|
127
133
|
const currentStyle = isInView ? styles.visible : styles.hidden;
|
|
128
134
|
const transitionStr = buildTransitionStr(duration, ease, delay, styles.hasFilter);
|
|
129
135
|
return cloneElement(children, {
|
|
@@ -149,7 +155,7 @@ function AnimateOnView({ children, delay = 0, from = "down", distance = 20, scal
|
|
|
149
155
|
* </AnimateIn>
|
|
150
156
|
* ```
|
|
151
157
|
*/
|
|
152
|
-
function AnimateIn({ children, delay = 0, from = "down", distance =
|
|
158
|
+
function AnimateIn({ children, delay = 0, from = "down", distance = 4, scale = false, blur = false, rotate = 0, flip = false, spring = false, transition }) {
|
|
153
159
|
const ref = useRef(null);
|
|
154
160
|
const [visible, setVisible] = useState(false);
|
|
155
161
|
useEffect(() => {
|
package/dist/animate.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"animate.js","names":[],"sources":["../src/animate.tsx"],"sourcesContent":["\"use client\"\n\nimport {\n Children,\n type CSSProperties,\n type ReactElement,\n type Ref,\n cloneElement,\n isValidElement,\n useEffect,\n useId,\n useRef,\n useState,\n} from \"react\"\nimport { useInView, type Transition } from \"motion/react\"\n\n// ── Types ────────────────────────────────────────────────────────────\n\ntype Direction = \"up\" | \"down\" | \"left\" | \"right\"\n\ninterface AnimateOnViewProps {\n children: ReactElement\n /** Delay in seconds before animation starts. Default: 0 */\n delay?: number\n /** Direction to animate from. Default: 'down' */\n from?: Direction\n /** Distance in px. Default: 20 */\n distance?: number\n /** Also scale in (0.85 → 1). Default: false */\n scale?: boolean\n /** Blur in from a given amount in px. Default: false */\n blur?: boolean | number\n /** Rotate in from a given angle in degrees. Default: 0 */\n rotate?: number\n /** 3D flip entrance along the axis matching `from`. Default: false */\n flip?: boolean\n /** Spring easing with overshoot. Default: false */\n spring?: boolean\n /** Trigger once or every time it enters view. Default: true */\n once?: boolean\n /** Custom transition override */\n transition?: Transition\n}\n\ninterface AnimateInProps {\n children: ReactElement\n /** Delay in seconds before animation starts. Default: 0 */\n delay?: number\n /** Direction to animate from. Default: 'down' */\n from?: Direction\n /** Distance in px. Default: 20 */\n distance?: number\n /** Also scale in (0.85 → 1). Default: false */\n scale?: boolean\n /** Blur in from a given amount in px. Default: false */\n blur?: boolean | number\n /** Rotate in from a given angle in degrees. Default: 0 */\n rotate?: number\n /** 3D flip entrance along the axis matching `from`. Default: false */\n flip?: boolean\n /** Spring easing with overshoot. Default: false */\n spring?: boolean\n /** Custom transition override */\n transition?: Transition\n}\n\ninterface StaggerProps {\n children: ReactElement[]\n /** Delay increment between each child in seconds. Default: 0.08 */\n interval?: number\n /** Base delay before the first child animates in seconds. Default: 0 */\n baseDelay?: number\n}\n\ninterface PulseProps {\n children: ReactElement\n /** Min scale factor. Default: 0.97 */\n min?: number\n /** Max scale factor. Default: 1.03 */\n max?: number\n /** Animation duration in seconds. Default: 2 */\n duration?: number\n /** Also pulse opacity between these bounds [min, max]. Off by default. */\n opacity?: [number, number]\n /** Pause animation. Default: false */\n paused?: boolean\n}\n\ninterface FloatProps {\n children: ReactElement\n /** Vertical float distance in px. Default: 6 */\n distance?: number\n /** Animation duration in seconds. Default: 3 */\n duration?: number\n /** Also rotate slightly while floating (degrees). Default: 0 */\n rotate?: number\n /** Pause animation. Default: false */\n paused?: boolean\n}\n\n// ── Internals ────────────────────────────────────────────────────────\n\n/**\n * Direction map: `from` means where the element COMES FROM.\n * `from=\"left\"` = starts to the left, slides right into place.\n */\nconst DIRECTION_MAP = {\n up: { prop: \"translateY\", value: -1 },\n down: { prop: \"translateY\", value: 1 },\n left: { prop: \"translateX\", value: -1 },\n right: { prop: \"translateX\", value: 1 },\n} as const\n\n/** Flip axis: vertical directions flip around X, horizontal around Y */\nconst FLIP_MAP = {\n up: \"rotateX(90deg)\",\n down: \"rotateX(-90deg)\",\n left: \"rotateY(-90deg)\",\n right: \"rotateY(90deg)\",\n} as const\n\n/** CSS cubic-bezier that overshoots then settles — feels like a spring */\nconst SPRING_EASE = \"cubic-bezier(0.34, 1.56, 0.64, 1)\"\n\ninterface BuildStylesOptions {\n from: Direction\n distance: number\n doScale: boolean\n blur: boolean | number\n rotate: number\n flip: boolean\n}\n\nfunction buildStyles(opts: BuildStylesOptions) {\n const { from, distance, doScale, blur, rotate, flip } = opts\n const dir = DIRECTION_MAP[from]\n\n const hiddenParts: string[] = []\n if (flip) hiddenParts.push(\"perspective(800px)\")\n hiddenParts.push(`${dir.prop}(${dir.value * distance}px)`)\n if (doScale) hiddenParts.push(\"scale(0.85)\")\n if (rotate) hiddenParts.push(`rotate(${rotate}deg)`)\n if (flip) hiddenParts.push(FLIP_MAP[from])\n\n const visibleParts: string[] = []\n if (flip) visibleParts.push(\"perspective(800px)\")\n visibleParts.push(\"translateX(0) translateY(0)\")\n if (doScale) visibleParts.push(\"scale(1)\")\n if (rotate) visibleParts.push(\"rotate(0deg)\")\n if (flip) visibleParts.push(from === \"up\" || from === \"down\" ? \"rotateX(0deg)\" : \"rotateY(0deg)\")\n\n const blurPx = blur === true ? 10 : typeof blur === \"number\" ? blur : 0\n\n const hidden: CSSProperties = {\n opacity: \"0\",\n transform: hiddenParts.join(\" \"),\n }\n\n const visible: CSSProperties = {\n opacity: \"1\",\n transform: visibleParts.join(\" \"),\n }\n\n if (blurPx > 0) {\n hidden.filter = `blur(${blurPx}px)`\n visible.filter = \"blur(0px)\"\n }\n\n return { hidden, visible, hasFilter: blurPx > 0 }\n}\n\nfunction mergeRefs<T>(...refs: (Ref<T> | undefined)[]) {\n return (el: T | null) => {\n refs.forEach((ref) => {\n if (typeof ref === \"function\") ref(el)\n else if (ref && typeof ref === \"object\") {\n ;(ref as { current: T | null }).current = el\n }\n })\n }\n}\n\nfunction getTransitionParams(transition?: Transition, useSpring?: boolean) {\n const duration =\n (transition as Record<string, number>)?.duration ?? 0.5\n const ease =\n useSpring ? SPRING_EASE : ((transition as Record<string, string>)?.ease ?? \"ease-out\")\n return { duration, ease }\n}\n\nfunction buildTransitionStr(\n duration: number,\n ease: string,\n delay: number,\n hasFilter: boolean,\n) {\n const parts = [\n `opacity ${duration}s ${ease} ${delay}s`,\n `transform ${duration}s ${ease} ${delay}s`,\n ]\n if (hasFilter) parts.push(`filter ${duration}s ${ease} ${delay}s`)\n return parts.join(\", \")\n}\n\n// ── AnimateOnView ────────────────────────────────────────────────────\n\n/**\n * Animates a child element when it scrolls into view.\n *\n * Zero DOM overhead — applies styles directly to the child via cloneElement.\n * Renders children unchanged on server to avoid hydration mismatch.\n *\n * @example\n * ```tsx\n * <AnimateOnView from=\"up\" blur scale>\n * <Card>Hello</Card>\n * </AnimateOnView>\n * ```\n */\nfunction AnimateOnView({\n children,\n delay = 0,\n from = \"down\",\n distance = 20,\n scale = false,\n blur = false,\n rotate = 0,\n flip = false,\n spring = false,\n once = true,\n transition,\n}: AnimateOnViewProps) {\n const ref = useRef<HTMLElement>(null)\n const [hydrated, setHydrated] = useState(false)\n const isInView = useInView(ref, { once, margin: \"-50px\" })\n\n useEffect(() => {\n setHydrated(true)\n }, [])\n\n if (!isValidElement(children)) return children\n\n const childProps = children.props as Record<string, unknown>\n const existingStyle = (childProps.style ?? {}) as CSSProperties\n const existingRef = (childProps as { ref?: Ref<HTMLElement> }).ref\n\n if (!hydrated) {\n return cloneElement(children, {\n ref: mergeRefs(ref, existingRef),\n } as Record<string, unknown>)\n }\n\n const styles = buildStyles({ from, distance, doScale: scale, blur, rotate, flip })\n const { duration, ease } = getTransitionParams(transition, spring)\n const currentStyle = isInView ? styles.visible : styles.hidden\n const transitionStr = buildTransitionStr(duration, ease, delay, styles.hasFilter)\n\n return cloneElement(children, {\n ref: mergeRefs(ref, existingRef),\n style: {\n ...existingStyle,\n ...currentStyle,\n ...(isInView ? { transition: transitionStr } : {}),\n willChange: \"opacity, transform\",\n },\n } as Record<string, unknown>)\n}\n\n// ── AnimateIn ────────────────────────────────────────────────────────\n\n/**\n * Animates a child element immediately on mount.\n *\n * Zero DOM overhead — applies styles directly to the child via cloneElement.\n * Uses a two-phase approach: hidden → visible with requestAnimationFrame.\n *\n * @example\n * ```tsx\n * <AnimateIn from=\"up\" blur spring>\n * <h1>Welcome</h1>\n * </AnimateIn>\n * ```\n */\nfunction AnimateIn({\n children,\n delay = 0,\n from = \"down\",\n distance = 20,\n scale = false,\n blur = false,\n rotate = 0,\n flip = false,\n spring = false,\n transition,\n}: AnimateInProps) {\n const ref = useRef<HTMLElement>(null)\n const [visible, setVisible] = useState(false)\n\n useEffect(() => {\n requestAnimationFrame(() => {\n requestAnimationFrame(() => setVisible(true))\n })\n }, [])\n\n if (!isValidElement(children)) return children\n\n const childProps = children.props as Record<string, unknown>\n const existingStyle = (childProps.style ?? {}) as CSSProperties\n const existingRef = (childProps as { ref?: Ref<HTMLElement> }).ref\n\n const styles = buildStyles({ from, distance, doScale: scale, blur, rotate, flip })\n const { duration, ease } = getTransitionParams(transition, spring)\n const currentStyle = visible ? styles.visible : styles.hidden\n const transitionStr = buildTransitionStr(duration, ease, delay, styles.hasFilter)\n\n return cloneElement(children, {\n ref: mergeRefs(ref, existingRef),\n style: {\n ...existingStyle,\n ...currentStyle,\n ...(visible ? { transition: transitionStr } : {}),\n willChange: \"opacity, transform\",\n },\n } as Record<string, unknown>)\n}\n\n// ── Stagger ──────────────────────────────────────────────────────────\n\n/**\n * Auto-staggers delay on child AnimateIn/AnimateOnView elements.\n * Eliminates manual `delay={i * 0.08}` math.\n *\n * @example\n * ```tsx\n * <Stagger interval={0.1}>\n * <AnimateIn from=\"up\"><Card>One</Card></AnimateIn>\n * <AnimateIn from=\"up\"><Card>Two</Card></AnimateIn>\n * </Stagger>\n * ```\n */\nfunction Stagger({\n children,\n interval = 0.08,\n baseDelay = 0,\n}: StaggerProps) {\n return (\n <>\n {Children.map(children, (child, index) => {\n if (!isValidElement(child)) return child\n return cloneElement(child as ReactElement<{ delay?: number }>, {\n delay: baseDelay + index * interval,\n })\n })}\n </>\n )\n}\n\n// ── Pulse ────────────────────────────────────────────────────────────\n\n/**\n * Continuous, subtle scale pulse. Great for live indicators and CTAs.\n * Zero DOM overhead — injects a scoped keyframe via `<style>`.\n *\n * @example\n * ```tsx\n * <Pulse>\n * <span className=\"size-3 rounded-full bg-green-500\" />\n * </Pulse>\n * ```\n */\nfunction Pulse({\n children,\n min = 0.97,\n max = 1.03,\n duration = 2,\n opacity,\n paused = false,\n}: PulseProps) {\n const id = useId().replace(/:/g, \"\")\n const [hydrated, setHydrated] = useState(false)\n\n useEffect(() => {\n setHydrated(true)\n }, [])\n\n if (!isValidElement(children)) return children\n if (!hydrated) return children\n\n const name = `pulse-${id}`\n const opacityFrom = opacity?.[0] ?? 1\n const opacityTo = opacity?.[1] ?? 1\n\n const keyframes = `@keyframes ${name} {\n 0%, 100% { transform: scale(${min}); opacity: ${opacityFrom}; }\n 50% { transform: scale(${max}); opacity: ${opacityTo}; }\n}`\n\n const childProps = children.props as Record<string, unknown>\n const existingStyle = (childProps.style ?? {}) as CSSProperties\n const existingRef = (childProps as { ref?: Ref<HTMLElement> }).ref\n\n return (\n <>\n <style>{keyframes}</style>\n {cloneElement(children, {\n ref: existingRef ? mergeRefs(existingRef) : undefined,\n style: {\n ...existingStyle,\n animation: `${name} ${duration}s ease-in-out infinite`,\n animationPlayState: paused ? \"paused\" : \"running\",\n },\n } as Record<string, unknown>)}\n </>\n )\n}\n\n// ── Float ────────────────────────────────────────────────────────────\n\n/**\n * Gentle continuous up/down float. Perfect for decorative elements.\n * Zero DOM overhead — injects a scoped keyframe via `<style>`.\n *\n * @example\n * ```tsx\n * <Float distance={10} duration={4}>\n * <Card>Floating</Card>\n * </Float>\n * ```\n */\nfunction Float({\n children,\n distance = 6,\n duration = 3,\n rotate = 0,\n paused = false,\n}: FloatProps) {\n const id = useId().replace(/:/g, \"\")\n const [hydrated, setHydrated] = useState(false)\n\n useEffect(() => {\n setHydrated(true)\n }, [])\n\n if (!isValidElement(children)) return children\n if (!hydrated) return children\n\n const name = `float-${id}`\n const rotA = rotate ? ` rotate(${-rotate}deg)` : \"\"\n const rotB = rotate ? ` rotate(${rotate}deg)` : \"\"\n\n const keyframes = `@keyframes ${name} {\n 0%, 100% { transform: translateY(0px)${rotA}; }\n 50% { transform: translateY(${-distance}px)${rotB}; }\n}`\n\n const childProps = children.props as Record<string, unknown>\n const existingStyle = (childProps.style ?? {}) as CSSProperties\n const existingRef = (childProps as { ref?: Ref<HTMLElement> }).ref\n\n return (\n <>\n <style>{keyframes}</style>\n {cloneElement(children, {\n ...(existingRef ? { ref: existingRef } : {}),\n style: {\n ...existingStyle,\n animation: `${name} ${duration}s ease-in-out infinite`,\n animationPlayState: paused ? \"paused\" : \"running\",\n },\n } as Record<string, unknown>)}\n </>\n )\n}\n\n// ── Exports ──────────────────────────────────────────────────────────\n\nexport { AnimateOnView, AnimateIn, Stagger, Pulse, Float }\nexport type {\n AnimateOnViewProps,\n AnimateInProps,\n StaggerProps,\n PulseProps,\n FloatProps,\n Direction,\n}\n"],"mappings":";;;;;;;;;AA0GA,MAAM,gBAAgB;CACpB,IAAI;EAAE,MAAM;EAAc,OAAO;EAAI;CACrC,MAAM;EAAE,MAAM;EAAc,OAAO;EAAG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M,YAAY,cAAc,KAAK;yCACE,KAAK;gCACd,CAAC,SAAS,KAAK,KAAK;;CAGlD,MAAM,aAAa,SAAS;CAC5B,MAAM,gBAAiB,WAAW,SAAS,EAAE;CAC7C,MAAM,cAAe,WAA0C;AAE/D,QACE,qBAAA,UAAA,EAAA,UAAA,CACE,oBAAC,SAAD,EAAA,UAAQ,WAAkB,CAAA,EACzB,aAAa,UAAU;EACtB,GAAI,cAAc,EAAE,KAAK,aAAa,GAAG,EAAE;EAC3C,OAAO;GACL,GAAG;GACH,WAAW,GAAG,KAAK,GAAG,SAAS;GAC/B,oBAAoB,SAAS,WAAW;GACzC;EACF,CAA4B,CAC5B,EAAA,CAAA"}
|
|
1
|
+
{"version":3,"file":"animate.js","names":[],"sources":["../src/animate.tsx"],"sourcesContent":["\"use client\"\n\nimport {\n Children,\n type CSSProperties,\n type ReactElement,\n type Ref,\n cloneElement,\n isValidElement,\n useEffect,\n useId,\n useRef,\n useState,\n} from \"react\"\nimport { useInView, type Transition } from \"motion/react\"\n\n// ── Types ────────────────────────────────────────────────────────────\n\ntype Direction = \"up\" | \"down\" | \"left\" | \"right\"\n\ninterface AnimateOnViewProps {\n children: ReactElement\n /** Delay in seconds before animation starts. Default: 0 */\n delay?: number\n /** Direction to animate from. Default: 'down' */\n from?: Direction\n /** Distance in px. Default: 16 (scroll reveals need more travel than `AnimateIn`) */\n distance?: number\n /** Also scale in (0.85 → 1). Default: false */\n scale?: boolean\n /** Blur in from a given amount in px. Default: false */\n blur?: boolean | number\n /** Rotate in from a given angle in degrees. Default: 0 */\n rotate?: number\n /** 3D flip entrance along the axis matching `from`. Default: false */\n flip?: boolean\n /** Spring easing with overshoot. Default: false */\n spring?: boolean\n /** Trigger once or every time it enters view. Default: true */\n once?: boolean\n /** Custom transition override */\n transition?: Transition\n}\n\ninterface AnimateInProps {\n children: ReactElement\n /** Delay in seconds before animation starts. Default: 0 */\n delay?: number\n /** Direction to animate from. Default: 'down' */\n from?: Direction\n /** Distance in px. Default: 4 */\n distance?: number\n /** Also scale in (0.85 → 1). Default: false */\n scale?: boolean\n /** Blur in from a given amount in px. Default: false */\n blur?: boolean | number\n /** Rotate in from a given angle in degrees. Default: 0 */\n rotate?: number\n /** 3D flip entrance along the axis matching `from`. Default: false */\n flip?: boolean\n /** Spring easing with overshoot. Default: false */\n spring?: boolean\n /** Custom transition override */\n transition?: Transition\n}\n\ninterface StaggerProps {\n children: ReactElement[]\n /** Delay increment between each child in seconds. Default: 0.08 */\n interval?: number\n /** Base delay before the first child animates in seconds. Default: 0 */\n baseDelay?: number\n}\n\ninterface PulseProps {\n children: ReactElement\n /** Min scale factor. Default: 0.97 */\n min?: number\n /** Max scale factor. Default: 1.03 */\n max?: number\n /** Animation duration in seconds. Default: 2 */\n duration?: number\n /** Also pulse opacity between these bounds [min, max]. Off by default. */\n opacity?: [number, number]\n /** Pause animation. Default: false */\n paused?: boolean\n}\n\ninterface FloatProps {\n children: ReactElement\n /** Vertical float distance in px. Default: 6 */\n distance?: number\n /** Animation duration in seconds. Default: 3 */\n duration?: number\n /** Also rotate slightly while floating (degrees). Default: 0 */\n rotate?: number\n /** Pause animation. Default: false */\n paused?: boolean\n}\n\n// ── Internals ────────────────────────────────────────────────────────\n\n/**\n * Direction map: `from` means where the element COMES FROM.\n * `from=\"left\"` = starts to the left, slides right into place.\n */\nconst DIRECTION_MAP = {\n up: { prop: \"translateY\", value: -1 },\n down: { prop: \"translateY\", value: 1 },\n left: { prop: \"translateX\", value: -1 },\n right: { prop: \"translateX\", value: 1 },\n} as const\n\n/** Flip axis: vertical directions flip around X, horizontal around Y */\nconst FLIP_MAP = {\n up: \"rotateX(90deg)\",\n down: \"rotateX(-90deg)\",\n left: \"rotateY(-90deg)\",\n right: \"rotateY(90deg)\",\n} as const\n\n/** Overshoot (\"spring\") easing for the opt-in `spring` prop on\n * `AnimateIn` / `AnimateOnView`. This is `animate.tsx`'s own page-entrance\n * bounce — the CSS recipe system intentionally has no spring (one circ-out\n * curve), so this is a standalone constant, not a shared token. */\nconst SPRING_EASE = \"cubic-bezier(0.34, 1.45, 0.64, 1)\"\n\ninterface BuildStylesOptions {\n from: Direction\n distance: number\n doScale: boolean\n blur: boolean | number\n rotate: number\n flip: boolean\n}\n\nfunction buildStyles(opts: BuildStylesOptions) {\n const { from, distance, doScale, blur, rotate, flip } = opts\n const dir = DIRECTION_MAP[from]\n\n const hiddenParts: string[] = []\n if (flip) hiddenParts.push(\"perspective(800px)\")\n hiddenParts.push(`${dir.prop}(${dir.value * distance}px)`)\n if (doScale) hiddenParts.push(\"scale(0.85)\")\n if (rotate) hiddenParts.push(`rotate(${rotate}deg)`)\n if (flip) hiddenParts.push(FLIP_MAP[from])\n\n const visibleParts: string[] = []\n if (flip) visibleParts.push(\"perspective(800px)\")\n visibleParts.push(\"translateX(0) translateY(0)\")\n if (doScale) visibleParts.push(\"scale(1)\")\n if (rotate) visibleParts.push(\"rotate(0deg)\")\n if (flip) visibleParts.push(from === \"up\" || from === \"down\" ? \"rotateX(0deg)\" : \"rotateY(0deg)\")\n\n const blurPx = blur === true ? 8 : typeof blur === \"number\" ? blur : 0\n\n const hidden: CSSProperties = {\n opacity: \"0\",\n transform: hiddenParts.join(\" \"),\n }\n\n const visible: CSSProperties = {\n opacity: \"1\",\n transform: visibleParts.join(\" \"),\n }\n\n if (blurPx > 0) {\n hidden.filter = `blur(${blurPx}px)`\n visible.filter = \"blur(0px)\"\n }\n\n return { hidden, visible, hasFilter: blurPx > 0 }\n}\n\nfunction mergeRefs<T>(...refs: (Ref<T> | undefined)[]) {\n return (el: T | null) => {\n refs.forEach((ref) => {\n if (typeof ref === \"function\") ref(el)\n else if (ref && typeof ref === \"object\") {\n ;(ref as { current: T | null }).current = el\n }\n })\n }\n}\n\nfunction getTransitionParams(transition?: Transition, useSpring?: boolean, fallbackDuration = 0.15) {\n const duration =\n (transition as Record<string, number>)?.duration ?? fallbackDuration\n const ease =\n useSpring ? SPRING_EASE : ((transition as Record<string, string>)?.ease ?? \"ease-out\")\n return { duration, ease }\n}\n\nfunction buildTransitionStr(\n duration: number,\n ease: string,\n delay: number,\n hasFilter: boolean,\n) {\n const parts = [\n `opacity ${duration}s ${ease} ${delay}s`,\n `transform ${duration}s ${ease} ${delay}s`,\n ]\n if (hasFilter) parts.push(`filter ${duration}s ${ease} ${delay}s`)\n return parts.join(\", \")\n}\n\n// ── AnimateOnView ────────────────────────────────────────────────────\n\n/**\n * Animates a child element when it scrolls into view.\n *\n * Defaults are tuned for scroll reveals — larger travel and a slower duration\n * than `AnimateIn` — so the motion reads as the content enters the viewport.\n *\n * Zero DOM overhead — applies styles directly to the child via cloneElement.\n * Renders children unchanged on server to avoid hydration mismatch.\n *\n * @example\n * ```tsx\n * <AnimateOnView from=\"up\" blur scale>\n * <Card>Hello</Card>\n * </AnimateOnView>\n * ```\n */\nfunction AnimateOnView({\n children,\n delay = 0,\n from = \"down\",\n distance = 16,\n scale = false,\n blur = false,\n rotate = 0,\n flip = false,\n spring = false,\n once = true,\n transition,\n}: AnimateOnViewProps) {\n const ref = useRef<HTMLElement>(null)\n const [hydrated, setHydrated] = useState(false)\n const isInView = useInView(ref, { once, margin: \"-50px\" })\n\n useEffect(() => {\n setHydrated(true)\n }, [])\n\n if (!isValidElement(children)) return children\n\n const childProps = children.props as Record<string, unknown>\n const existingStyle = (childProps.style ?? {}) as CSSProperties\n const existingRef = (childProps as { ref?: Ref<HTMLElement> }).ref\n\n if (!hydrated) {\n return cloneElement(children, {\n ref: mergeRefs(ref, existingRef),\n } as Record<string, unknown>)\n }\n\n const styles = buildStyles({ from, distance, doScale: scale, blur, rotate, flip })\n const { duration, ease } = getTransitionParams(transition, spring, 0.4)\n const currentStyle = isInView ? styles.visible : styles.hidden\n const transitionStr = buildTransitionStr(duration, ease, delay, styles.hasFilter)\n\n return cloneElement(children, {\n ref: mergeRefs(ref, existingRef),\n style: {\n ...existingStyle,\n ...currentStyle,\n ...(isInView ? { transition: transitionStr } : {}),\n willChange: \"opacity, transform\",\n },\n } as Record<string, unknown>)\n}\n\n// ── AnimateIn ────────────────────────────────────────────────────────\n\n/**\n * Animates a child element immediately on mount.\n *\n * Zero DOM overhead — applies styles directly to the child via cloneElement.\n * Uses a two-phase approach: hidden → visible with requestAnimationFrame.\n *\n * @example\n * ```tsx\n * <AnimateIn from=\"up\" blur spring>\n * <h1>Welcome</h1>\n * </AnimateIn>\n * ```\n */\nfunction AnimateIn({\n children,\n delay = 0,\n from = \"down\",\n distance = 4,\n scale = false,\n blur = false,\n rotate = 0,\n flip = false,\n spring = false,\n transition,\n}: AnimateInProps) {\n const ref = useRef<HTMLElement>(null)\n const [visible, setVisible] = useState(false)\n\n useEffect(() => {\n requestAnimationFrame(() => {\n requestAnimationFrame(() => setVisible(true))\n })\n }, [])\n\n if (!isValidElement(children)) return children\n\n const childProps = children.props as Record<string, unknown>\n const existingStyle = (childProps.style ?? {}) as CSSProperties\n const existingRef = (childProps as { ref?: Ref<HTMLElement> }).ref\n\n const styles = buildStyles({ from, distance, doScale: scale, blur, rotate, flip })\n const { duration, ease } = getTransitionParams(transition, spring)\n const currentStyle = visible ? styles.visible : styles.hidden\n const transitionStr = buildTransitionStr(duration, ease, delay, styles.hasFilter)\n\n return cloneElement(children, {\n ref: mergeRefs(ref, existingRef),\n style: {\n ...existingStyle,\n ...currentStyle,\n ...(visible ? { transition: transitionStr } : {}),\n willChange: \"opacity, transform\",\n },\n } as Record<string, unknown>)\n}\n\n// ── Stagger ──────────────────────────────────────────────────────────\n\n/**\n * Auto-staggers delay on child AnimateIn/AnimateOnView elements.\n * Eliminates manual `delay={i * 0.08}` math.\n *\n * @example\n * ```tsx\n * <Stagger interval={0.1}>\n * <AnimateIn from=\"up\"><Card>One</Card></AnimateIn>\n * <AnimateIn from=\"up\"><Card>Two</Card></AnimateIn>\n * </Stagger>\n * ```\n */\nfunction Stagger({\n children,\n interval = 0.08,\n baseDelay = 0,\n}: StaggerProps) {\n return (\n <>\n {Children.map(children, (child, index) => {\n if (!isValidElement(child)) return child\n return cloneElement(child as ReactElement<{ delay?: number }>, {\n delay: baseDelay + index * interval,\n })\n })}\n </>\n )\n}\n\n// ── Pulse ────────────────────────────────────────────────────────────\n\n/**\n * Continuous, subtle scale pulse. Great for live indicators and CTAs.\n * Zero DOM overhead — injects a scoped keyframe via `<style>`.\n *\n * @example\n * ```tsx\n * <Pulse>\n * <span className=\"size-3 rounded-full bg-green-500\" />\n * </Pulse>\n * ```\n */\nfunction Pulse({\n children,\n min = 0.97,\n max = 1.03,\n duration = 2,\n opacity,\n paused = false,\n}: PulseProps) {\n const id = useId().replace(/:/g, \"\")\n const [hydrated, setHydrated] = useState(false)\n\n useEffect(() => {\n setHydrated(true)\n }, [])\n\n if (!isValidElement(children)) return children\n if (!hydrated) return children\n\n const name = `pulse-${id}`\n const opacityFrom = opacity?.[0] ?? 1\n const opacityTo = opacity?.[1] ?? 1\n\n const keyframes = `@keyframes ${name} {\n 0%, 100% { transform: scale(${min}); opacity: ${opacityFrom}; }\n 50% { transform: scale(${max}); opacity: ${opacityTo}; }\n}`\n\n const childProps = children.props as Record<string, unknown>\n const existingStyle = (childProps.style ?? {}) as CSSProperties\n const existingRef = (childProps as { ref?: Ref<HTMLElement> }).ref\n\n return (\n <>\n <style>{keyframes}</style>\n {cloneElement(children, {\n ref: existingRef ? mergeRefs(existingRef) : undefined,\n style: {\n ...existingStyle,\n animation: `${name} ${duration}s ease-in-out infinite`,\n animationPlayState: paused ? \"paused\" : \"running\",\n },\n } as Record<string, unknown>)}\n </>\n )\n}\n\n// ── Float ────────────────────────────────────────────────────────────\n\n/**\n * Gentle continuous up/down float. Perfect for decorative elements.\n * Zero DOM overhead — injects a scoped keyframe via `<style>`.\n *\n * @example\n * ```tsx\n * <Float distance={10} duration={4}>\n * <Card>Floating</Card>\n * </Float>\n * ```\n */\nfunction Float({\n children,\n distance = 6,\n duration = 3,\n rotate = 0,\n paused = false,\n}: FloatProps) {\n const id = useId().replace(/:/g, \"\")\n const [hydrated, setHydrated] = useState(false)\n\n useEffect(() => {\n setHydrated(true)\n }, [])\n\n if (!isValidElement(children)) return children\n if (!hydrated) return children\n\n const name = `float-${id}`\n const rotA = rotate ? ` rotate(${-rotate}deg)` : \"\"\n const rotB = rotate ? ` rotate(${rotate}deg)` : \"\"\n\n const keyframes = `@keyframes ${name} {\n 0%, 100% { transform: translateY(0px)${rotA}; }\n 50% { transform: translateY(${-distance}px)${rotB}; }\n}`\n\n const childProps = children.props as Record<string, unknown>\n const existingStyle = (childProps.style ?? {}) as CSSProperties\n const existingRef = (childProps as { ref?: Ref<HTMLElement> }).ref\n\n return (\n <>\n <style>{keyframes}</style>\n {cloneElement(children, {\n ...(existingRef ? { ref: existingRef } : {}),\n style: {\n ...existingStyle,\n animation: `${name} ${duration}s ease-in-out infinite`,\n animationPlayState: paused ? \"paused\" : \"running\",\n },\n } as Record<string, unknown>)}\n </>\n )\n}\n\n// ── Exports ──────────────────────────────────────────────────────────\n\nexport { AnimateOnView, AnimateIn, Stagger, Pulse, Float }\nexport type {\n AnimateOnViewProps,\n AnimateInProps,\n StaggerProps,\n PulseProps,\n FloatProps,\n Direction,\n}\n"],"mappings":";;;;;;;;;AA0GA,MAAM,gBAAgB;CACpB,IAAI;EAAE,MAAM;EAAc,OAAO;EAAI;CACrC,MAAM;EAAE,MAAM;EAAc,OAAO;EAAG;CACtC,MAAM;EAAE,MAAM;EAAc,OAAO;EAAI;CACvC,OAAO;EAAE,MAAM;EAAc,OAAO;EAAG;CACxC;;AAGD,MAAM,WAAW;CACf,IAAI;CACJ,MAAM;CACN,MAAM;CACN,OAAO;CACR;;;;;AAMD,MAAM,cAAc;AAWpB,SAAS,YAAY,MAA0B;CAC7C,MAAM,EAAE,MAAM,UAAU,SAAS,MAAM,QAAQ,SAAS;CACxD,MAAM,MAAM,cAAc;CAE1B,MAAM,cAAwB,EAAE;AAChC,KAAI,KAAM,aAAY,KAAK,qBAAqB;AAChD,aAAY,KAAK,GAAG,IAAI,KAAK,GAAG,IAAI,QAAQ,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,WAAW;GACzC;EACF,CAA4B,CAC5B,EAAA,CAAA"}
|
package/dist/autocomplete.js
CHANGED
|
@@ -68,7 +68,7 @@ function AutocompletePositioner({ className, ...props }) {
|
|
|
68
68
|
function AutocompletePopup({ className, ...props }) {
|
|
69
69
|
return /* @__PURE__ */ jsx(Autocomplete$1.Popup, {
|
|
70
70
|
"data-slot": "autocomplete-popup",
|
|
71
|
-
className: cn("bg-popover text-popover-foreground
|
|
71
|
+
className: cn("motion-slide bg-popover text-popover-foreground ring-foreground/10 group/autocomplete-content relative max-h-(--available-height) min-w-(--anchor-width) origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-lg shadow-md ring-1", className),
|
|
72
72
|
...props
|
|
73
73
|
});
|
|
74
74
|
}
|
package/dist/autocomplete.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"autocomplete.js","names":["AutocompletePrimitive"],"sources":["../src/autocomplete.tsx"],"sourcesContent":["\"use client\"\n\nimport * as React from \"react\"\n\nimport { Autocomplete as AutocompletePrimitive } from \"@base-ui/react/autocomplete\"\n\nimport { cn } from \"./lib/utils\"\n\ntype AutocompleteProps = React.ComponentProps<typeof AutocompletePrimitive.Root>\ntype AutocompleteInputProps = React.ComponentProps<typeof AutocompletePrimitive.Input>\ntype AutocompleteTriggerProps = React.ComponentProps<typeof AutocompletePrimitive.Trigger>\ntype AutocompleteIconProps = React.ComponentProps<typeof AutocompletePrimitive.Icon>\ntype AutocompleteClearProps = React.ComponentProps<typeof AutocompletePrimitive.Clear>\ntype AutocompleteValueProps = React.ComponentProps<typeof AutocompletePrimitive.Value>\n\ntype AutocompletePortalProps = React.ComponentProps<typeof AutocompletePrimitive.Portal>\ntype AutocompleteBackdropProps = React.ComponentProps<typeof AutocompletePrimitive.Backdrop>\ntype AutocompletePositionerProps = React.ComponentProps<typeof AutocompletePrimitive.Positioner>\ntype AutocompletePopupProps = React.ComponentProps<typeof AutocompletePrimitive.Popup>\ntype AutocompleteArrowProps = React.ComponentProps<typeof AutocompletePrimitive.Arrow>\ntype AutocompleteStatusProps = React.ComponentProps<typeof AutocompletePrimitive.Status>\ntype AutocompleteEmptyProps = React.ComponentProps<typeof AutocompletePrimitive.Empty>\n\ntype AutocompleteListProps = React.ComponentProps<typeof AutocompletePrimitive.List>\ntype AutocompleteRowProps = React.ComponentProps<typeof AutocompletePrimitive.Row>\ntype AutocompleteItemProps = React.ComponentProps<typeof AutocompletePrimitive.Item>\ntype AutocompleteSeparatorProps = React.ComponentProps<typeof AutocompletePrimitive.Separator>\ntype AutocompleteGroupProps = React.ComponentProps<typeof AutocompletePrimitive.Group>\ntype AutocompleteGroupLabelProps = React.ComponentProps<typeof AutocompletePrimitive.GroupLabel>\ntype AutocompleteCollectionProps = React.ComponentProps<typeof AutocompletePrimitive.Collection>\n\ntype AutocompleteContentProps = AutocompletePopupProps &\n Pick<\n AutocompletePositionerProps,\n \"align\" | \"alignOffset\" | \"side\" | \"sideOffset\"\n >\n\nfunction Autocomplete({ ...props }: AutocompleteProps) {\n return <AutocompletePrimitive.Root data-slot=\"autocomplete\" {...props} />\n}\n\nfunction AutocompleteInput({ className, ...props }: AutocompleteInputProps) {\n return (\n <AutocompletePrimitive.Input\n data-slot=\"autocomplete-input\"\n className={cn(\n \"dark:bg-input/30 border-input focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 disabled:bg-input/50 dark:disabled:bg-input/80 placeholder:text-muted-foreground h-8 w-full min-w-0 rounded-lg border bg-transparent px-2.5 py-1 text-base transition-colors outline-none focus-visible:ring-3 disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:ring-3 md:text-sm\",\n className,\n )}\n {...props}\n />\n )\n}\n\nfunction AutocompleteTrigger({ className, ...props }: AutocompleteTriggerProps) {\n return (\n <AutocompletePrimitive.Trigger\n data-slot=\"autocomplete-trigger\"\n className={cn(\"shrink-0\", className)}\n {...props}\n />\n )\n}\n\nfunction AutocompleteIcon({ className, ...props }: AutocompleteIconProps) {\n return (\n <AutocompletePrimitive.Icon\n data-slot=\"autocomplete-icon\"\n className={cn(\"shrink-0\", className)}\n {...props}\n />\n )\n}\n\nfunction AutocompleteClear({ className, ...props }: AutocompleteClearProps) {\n return (\n <AutocompletePrimitive.Clear\n data-slot=\"autocomplete-clear\"\n className={cn(\"shrink-0\", className)}\n {...props}\n />\n )\n}\n\nfunction AutocompleteValue({ ...props }: AutocompleteValueProps) {\n return (\n <AutocompletePrimitive.Value data-slot=\"autocomplete-value\" {...props} />\n )\n}\n\nfunction AutocompletePortal({ className, ...props }: AutocompletePortalProps) {\n return (\n <AutocompletePrimitive.Portal\n data-slot=\"autocomplete-portal\"\n className={cn(className)}\n {...props}\n />\n )\n}\n\nfunction AutocompleteBackdrop({ className, ...props }: AutocompleteBackdropProps) {\n return (\n <AutocompletePrimitive.Backdrop\n data-slot=\"autocomplete-backdrop\"\n className={cn(\"fixed inset-0\", className)}\n {...props}\n />\n )\n}\n\nfunction AutocompletePositioner({ className, ...props }: AutocompletePositionerProps) {\n return (\n <AutocompletePrimitive.Positioner\n data-slot=\"autocomplete-positioner\"\n className={cn(className)}\n {...props}\n />\n )\n}\n\nfunction AutocompletePopup({ className, ...props }: AutocompletePopupProps) {\n return (\n <AutocompletePrimitive.Popup\n data-slot=\"autocomplete-popup\"\n className={cn(\n \"bg-popover text-popover-foreground data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 ring-foreground/10 group/autocomplete-content relative max-h-(--available-height) min-w-(--anchor-width) origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-lg shadow-md ring-1 duration-100\",\n className,\n )}\n {...props}\n />\n )\n}\n\nfunction AutocompleteArrow({ className, ...props }: AutocompleteArrowProps) {\n return (\n <AutocompletePrimitive.Arrow\n data-slot=\"autocomplete-arrow\"\n className={cn(\"fill-popover\", className)}\n {...props}\n />\n )\n}\n\nfunction AutocompleteStatus({ className, ...props }: AutocompleteStatusProps) {\n return (\n <AutocompletePrimitive.Status\n data-slot=\"autocomplete-status\"\n className={cn(\"text-muted-foreground flex w-full justify-center py-2 text-center text-sm\", className)}\n {...props}\n />\n )\n}\n\nfunction AutocompleteEmpty({ className, ...props }: AutocompleteEmptyProps) {\n return (\n <AutocompletePrimitive.Empty\n data-slot=\"autocomplete-empty\"\n className={cn(\"text-muted-foreground hidden w-full justify-center py-2 text-center text-sm group-data-empty/autocomplete-content:flex\", className)}\n {...props}\n />\n )\n}\n\nfunction AutocompleteList({ className, ...props }: AutocompleteListProps) {\n return (\n <AutocompletePrimitive.List\n data-slot=\"autocomplete-list\"\n className={cn(\"scroll-py-1 overflow-y-auto overscroll-contain p-1 data-empty:p-0\", className)}\n {...props}\n />\n )\n}\n\nfunction AutocompleteRow({ className, ...props }: AutocompleteRowProps) {\n return (\n <AutocompletePrimitive.Row\n data-slot=\"autocomplete-row\"\n className={cn(className)}\n {...props}\n />\n )\n}\n\nfunction AutocompleteItem({ className, ...props }: AutocompleteItemProps) {\n return (\n <AutocompletePrimitive.Item\n data-slot=\"autocomplete-item\"\n className={cn(\n \"data-highlighted:bg-accent data-highlighted:text-accent-foreground relative flex w-full cursor-clickable items-center gap-2 rounded-md py-1 pl-1.5 pr-1.5 text-sm outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4\",\n className,\n )}\n {...props}\n />\n )\n}\n\nfunction AutocompleteSeparator({ className, ...props }: AutocompleteSeparatorProps) {\n return (\n <AutocompletePrimitive.Separator\n data-slot=\"autocomplete-separator\"\n className={cn(\"bg-border -mx-1 my-1 h-px\", className)}\n {...props}\n />\n )\n}\n\nfunction AutocompleteGroup({ className, ...props }: AutocompleteGroupProps) {\n return (\n <AutocompletePrimitive.Group\n data-slot=\"autocomplete-group\"\n className={cn(\"pt-1\", className)}\n {...props}\n />\n )\n}\n\nfunction AutocompleteGroupLabel({ className, ...props }: AutocompleteGroupLabelProps) {\n return (\n <AutocompletePrimitive.GroupLabel\n data-slot=\"autocomplete-group-label\"\n className={cn(\"text-muted-foreground px-2 py-1.5 text-xs\", className)}\n {...props}\n />\n )\n}\n\nfunction AutocompleteCollection({ ...props }: AutocompleteCollectionProps) {\n return (\n <AutocompletePrimitive.Collection\n data-slot=\"autocomplete-collection\"\n {...props}\n />\n )\n}\n\nfunction AutocompleteContent({\n className,\n align = \"start\",\n alignOffset = 0,\n side = \"bottom\",\n sideOffset = 6,\n ...props\n}: AutocompleteContentProps) {\n return (\n <AutocompletePortal>\n <AutocompletePositioner\n align={align}\n alignOffset={alignOffset}\n side={side}\n sideOffset={sideOffset}\n className=\"isolate z-50\"\n >\n <AutocompletePopup className={className} {...props} />\n </AutocompletePositioner>\n </AutocompletePortal>\n )\n}\n\nexport {\n Autocomplete,\n AutocompleteArrow,\n AutocompleteBackdrop,\n AutocompleteClear,\n AutocompleteCollection,\n AutocompleteContent,\n AutocompleteEmpty,\n AutocompleteGroup,\n AutocompleteGroupLabel,\n AutocompleteIcon,\n AutocompleteInput,\n AutocompleteItem,\n AutocompleteList,\n AutocompletePopup,\n AutocompletePortal,\n AutocompletePositioner,\n AutocompleteRow,\n AutocompleteSeparator,\n AutocompleteStatus,\n AutocompleteTrigger,\n AutocompleteValue,\n}"],"mappings":";;;;;;AAqCA,SAAS,aAAa,EAAE,GAAG,SAA4B;AACrD,QAAO,oBAACA,eAAsB,MAAvB;EAA4B,aAAU;EAAe,GAAI;EAAS,CAAA;;AAG3E,SAAS,kBAAkB,EAAE,WAAW,GAAG,SAAiC;AAC1E,QACE,oBAACA,eAAsB,OAAvB;EACE,aAAU;EACV,WAAW,GACT,giBACA,UACD;EACD,GAAI;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AACzE,QACE,oBAACA,eAAsB,YAAvB;EACE,aAAU;EACV,GAAI;EACJ,CAAA;;AAIN,SAAS,oBAAoB,EAC3B,WACA,QAAQ,SACR,cAAc,GACd,OAAO,UACP,aAAa,GACb,GAAG,SACwB;AAC3B,QACE,oBAAC,oBAAD,EAAA,UACE,oBAAC,wBAAD;EACS;EACM;EACP;EACM;EACZ,WAAU;YAEV,oBAAC,mBAAD;GAA8B;GAAW,GAAI;GAAS,CAAA;EAC/B,CAAA,EACN,CAAA"}
|
|
1
|
+
{"version":3,"file":"autocomplete.js","names":["AutocompletePrimitive"],"sources":["../src/autocomplete.tsx"],"sourcesContent":["\"use client\"\n\nimport * as React from \"react\"\n\nimport { Autocomplete as AutocompletePrimitive } from \"@base-ui/react/autocomplete\"\n\nimport { cn } from \"./lib/utils\"\n\ntype AutocompleteProps = React.ComponentProps<typeof AutocompletePrimitive.Root>\ntype AutocompleteInputProps = React.ComponentProps<typeof AutocompletePrimitive.Input>\ntype AutocompleteTriggerProps = React.ComponentProps<typeof AutocompletePrimitive.Trigger>\ntype AutocompleteIconProps = React.ComponentProps<typeof AutocompletePrimitive.Icon>\ntype AutocompleteClearProps = React.ComponentProps<typeof AutocompletePrimitive.Clear>\ntype AutocompleteValueProps = React.ComponentProps<typeof AutocompletePrimitive.Value>\n\ntype AutocompletePortalProps = React.ComponentProps<typeof AutocompletePrimitive.Portal>\ntype AutocompleteBackdropProps = React.ComponentProps<typeof AutocompletePrimitive.Backdrop>\ntype AutocompletePositionerProps = React.ComponentProps<typeof AutocompletePrimitive.Positioner>\ntype AutocompletePopupProps = React.ComponentProps<typeof AutocompletePrimitive.Popup>\ntype AutocompleteArrowProps = React.ComponentProps<typeof AutocompletePrimitive.Arrow>\ntype AutocompleteStatusProps = React.ComponentProps<typeof AutocompletePrimitive.Status>\ntype AutocompleteEmptyProps = React.ComponentProps<typeof AutocompletePrimitive.Empty>\n\ntype AutocompleteListProps = React.ComponentProps<typeof AutocompletePrimitive.List>\ntype AutocompleteRowProps = React.ComponentProps<typeof AutocompletePrimitive.Row>\ntype AutocompleteItemProps = React.ComponentProps<typeof AutocompletePrimitive.Item>\ntype AutocompleteSeparatorProps = React.ComponentProps<typeof AutocompletePrimitive.Separator>\ntype AutocompleteGroupProps = React.ComponentProps<typeof AutocompletePrimitive.Group>\ntype AutocompleteGroupLabelProps = React.ComponentProps<typeof AutocompletePrimitive.GroupLabel>\ntype AutocompleteCollectionProps = React.ComponentProps<typeof AutocompletePrimitive.Collection>\n\ntype AutocompleteContentProps = AutocompletePopupProps &\n Pick<\n AutocompletePositionerProps,\n \"align\" | \"alignOffset\" | \"side\" | \"sideOffset\"\n >\n\nfunction Autocomplete({ ...props }: AutocompleteProps) {\n return <AutocompletePrimitive.Root data-slot=\"autocomplete\" {...props} />\n}\n\nfunction AutocompleteInput({ className, ...props }: AutocompleteInputProps) {\n return (\n <AutocompletePrimitive.Input\n data-slot=\"autocomplete-input\"\n className={cn(\n \"dark:bg-input/30 border-input focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 disabled:bg-input/50 dark:disabled:bg-input/80 placeholder:text-muted-foreground h-8 w-full min-w-0 rounded-lg border bg-transparent px-2.5 py-1 text-base transition-colors outline-none focus-visible:ring-3 disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:ring-3 md:text-sm\",\n className,\n )}\n {...props}\n />\n )\n}\n\nfunction AutocompleteTrigger({ className, ...props }: AutocompleteTriggerProps) {\n return (\n <AutocompletePrimitive.Trigger\n data-slot=\"autocomplete-trigger\"\n className={cn(\"shrink-0\", className)}\n {...props}\n />\n )\n}\n\nfunction AutocompleteIcon({ className, ...props }: AutocompleteIconProps) {\n return (\n <AutocompletePrimitive.Icon\n data-slot=\"autocomplete-icon\"\n className={cn(\"shrink-0\", className)}\n {...props}\n />\n )\n}\n\nfunction AutocompleteClear({ className, ...props }: AutocompleteClearProps) {\n return (\n <AutocompletePrimitive.Clear\n data-slot=\"autocomplete-clear\"\n className={cn(\"shrink-0\", className)}\n {...props}\n />\n )\n}\n\nfunction AutocompleteValue({ ...props }: AutocompleteValueProps) {\n return (\n <AutocompletePrimitive.Value data-slot=\"autocomplete-value\" {...props} />\n )\n}\n\nfunction AutocompletePortal({ className, ...props }: AutocompletePortalProps) {\n return (\n <AutocompletePrimitive.Portal\n data-slot=\"autocomplete-portal\"\n className={cn(className)}\n {...props}\n />\n )\n}\n\nfunction AutocompleteBackdrop({ className, ...props }: AutocompleteBackdropProps) {\n return (\n <AutocompletePrimitive.Backdrop\n data-slot=\"autocomplete-backdrop\"\n className={cn(\"fixed inset-0\", className)}\n {...props}\n />\n )\n}\n\nfunction AutocompletePositioner({ className, ...props }: AutocompletePositionerProps) {\n return (\n <AutocompletePrimitive.Positioner\n data-slot=\"autocomplete-positioner\"\n className={cn(className)}\n {...props}\n />\n )\n}\n\nfunction AutocompletePopup({ className, ...props }: AutocompletePopupProps) {\n return (\n <AutocompletePrimitive.Popup\n data-slot=\"autocomplete-popup\"\n className={cn(\n \"motion-slide bg-popover text-popover-foreground ring-foreground/10 group/autocomplete-content relative max-h-(--available-height) min-w-(--anchor-width) origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-lg shadow-md ring-1\",\n className,\n )}\n {...props}\n />\n )\n}\n\nfunction AutocompleteArrow({ className, ...props }: AutocompleteArrowProps) {\n return (\n <AutocompletePrimitive.Arrow\n data-slot=\"autocomplete-arrow\"\n className={cn(\"fill-popover\", className)}\n {...props}\n />\n )\n}\n\nfunction AutocompleteStatus({ className, ...props }: AutocompleteStatusProps) {\n return (\n <AutocompletePrimitive.Status\n data-slot=\"autocomplete-status\"\n className={cn(\"text-muted-foreground flex w-full justify-center py-2 text-center text-sm\", className)}\n {...props}\n />\n )\n}\n\nfunction AutocompleteEmpty({ className, ...props }: AutocompleteEmptyProps) {\n return (\n <AutocompletePrimitive.Empty\n data-slot=\"autocomplete-empty\"\n className={cn(\"text-muted-foreground hidden w-full justify-center py-2 text-center text-sm group-data-empty/autocomplete-content:flex\", className)}\n {...props}\n />\n )\n}\n\nfunction AutocompleteList({ className, ...props }: AutocompleteListProps) {\n return (\n <AutocompletePrimitive.List\n data-slot=\"autocomplete-list\"\n className={cn(\"scroll-py-1 overflow-y-auto overscroll-contain p-1 data-empty:p-0\", className)}\n {...props}\n />\n )\n}\n\nfunction AutocompleteRow({ className, ...props }: AutocompleteRowProps) {\n return (\n <AutocompletePrimitive.Row\n data-slot=\"autocomplete-row\"\n className={cn(className)}\n {...props}\n />\n )\n}\n\nfunction AutocompleteItem({ className, ...props }: AutocompleteItemProps) {\n return (\n <AutocompletePrimitive.Item\n data-slot=\"autocomplete-item\"\n className={cn(\n \"data-highlighted:bg-accent data-highlighted:text-accent-foreground relative flex w-full cursor-clickable items-center gap-2 rounded-md py-1 pl-1.5 pr-1.5 text-sm outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4\",\n className,\n )}\n {...props}\n />\n )\n}\n\nfunction AutocompleteSeparator({ className, ...props }: AutocompleteSeparatorProps) {\n return (\n <AutocompletePrimitive.Separator\n data-slot=\"autocomplete-separator\"\n className={cn(\"bg-border -mx-1 my-1 h-px\", className)}\n {...props}\n />\n )\n}\n\nfunction AutocompleteGroup({ className, ...props }: AutocompleteGroupProps) {\n return (\n <AutocompletePrimitive.Group\n data-slot=\"autocomplete-group\"\n className={cn(\"pt-1\", className)}\n {...props}\n />\n )\n}\n\nfunction AutocompleteGroupLabel({ className, ...props }: AutocompleteGroupLabelProps) {\n return (\n <AutocompletePrimitive.GroupLabel\n data-slot=\"autocomplete-group-label\"\n className={cn(\"text-muted-foreground px-2 py-1.5 text-xs\", className)}\n {...props}\n />\n )\n}\n\nfunction AutocompleteCollection({ ...props }: AutocompleteCollectionProps) {\n return (\n <AutocompletePrimitive.Collection\n data-slot=\"autocomplete-collection\"\n {...props}\n />\n )\n}\n\nfunction AutocompleteContent({\n className,\n align = \"start\",\n alignOffset = 0,\n side = \"bottom\",\n sideOffset = 6,\n ...props\n}: AutocompleteContentProps) {\n return (\n <AutocompletePortal>\n <AutocompletePositioner\n align={align}\n alignOffset={alignOffset}\n side={side}\n sideOffset={sideOffset}\n className=\"isolate z-50\"\n >\n <AutocompletePopup className={className} {...props} />\n </AutocompletePositioner>\n </AutocompletePortal>\n )\n}\n\nexport {\n Autocomplete,\n AutocompleteArrow,\n AutocompleteBackdrop,\n AutocompleteClear,\n AutocompleteCollection,\n AutocompleteContent,\n AutocompleteEmpty,\n AutocompleteGroup,\n AutocompleteGroupLabel,\n AutocompleteIcon,\n AutocompleteInput,\n AutocompleteItem,\n AutocompleteList,\n AutocompletePopup,\n AutocompletePortal,\n AutocompletePositioner,\n AutocompleteRow,\n AutocompleteSeparator,\n AutocompleteStatus,\n AutocompleteTrigger,\n AutocompleteValue,\n}"],"mappings":";;;;;;AAqCA,SAAS,aAAa,EAAE,GAAG,SAA4B;AACrD,QAAO,oBAACA,eAAsB,MAAvB;EAA4B,aAAU;EAAe,GAAI;EAAS,CAAA;;AAG3E,SAAS,kBAAkB,EAAE,WAAW,GAAG,SAAiC;AAC1E,QACE,oBAACA,eAAsB,OAAvB;EACE,aAAU;EACV,WAAW,GACT,giBACA,UACD;EACD,GAAI;EACJ,CAAA;;AAIN,SAAS,oBAAoB,EAAE,WAAW,GAAG,SAAmC;AAC9E,QACE,oBAACA,eAAsB,SAAvB;EACE,aAAU;EACV,WAAW,GAAG,YAAY,UAAU;EACpC,GAAI;EACJ,CAAA;;AAIN,SAAS,iBAAiB,EAAE,WAAW,GAAG,SAAgC;AACxE,QACE,oBAACA,eAAsB,MAAvB;EACE,aAAU;EACV,WAAW,GAAG,YAAY,UAAU;EACpC,GAAI;EACJ,CAAA;;AAIN,SAAS,kBAAkB,EAAE,WAAW,GAAG,SAAiC;AAC1E,QACE,oBAACA,eAA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class_variance_authority_types0 from "class-variance-authority/typ
|
|
|
5
5
|
|
|
6
6
|
//#region src/badge.d.ts
|
|
7
7
|
declare const badgeVariants: (props?: ({
|
|
8
|
-
variant?: "default" | "
|
|
8
|
+
variant?: "default" | "link" | "solid" | "outline" | "secondary" | "ghost" | "success" | "destructive" | "warning" | null | undefined;
|
|
9
9
|
} & _$class_variance_authority_types0.ClassProp) | undefined) => string;
|
|
10
10
|
type BadgeProps = useRender.ComponentProps<"span"> & VariantProps<typeof badgeVariants>;
|
|
11
11
|
declare function Badge({
|
package/dist/badge.js
CHANGED
|
@@ -4,7 +4,7 @@ import { cva } from "class-variance-authority";
|
|
|
4
4
|
import { mergeProps } from "@base-ui/react/merge-props";
|
|
5
5
|
import { useRender } from "@base-ui/react/use-render";
|
|
6
6
|
//#region src/badge.tsx
|
|
7
|
-
const badgeVariants = cva("h-5 gap-1 rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium
|
|
7
|
+
const badgeVariants = cva("h-5 gap-1 rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium motion-color has-data-[icon=inline-start]:pl-1.5 has-data-[icon=inline-end]:pr-1.5 [&>svg]:size-3! inline-flex items-center justify-center w-fit whitespace-nowrap shrink-0 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive overflow-hidden group/badge", {
|
|
8
8
|
variants: { variant: {
|
|
9
9
|
default: "bg-input/30 text-primary border-primary/20 [a]:hover:bg-input/50",
|
|
10
10
|
solid: "bg-primary text-primary-foreground [a]:hover:bg-primary/80",
|
package/dist/badge.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"badge.js","names":[],"sources":["../src/badge.tsx"],"sourcesContent":["\"use client\"\n\nimport { mergeProps } from \"@base-ui/react/merge-props\"\nimport { useRender } from \"@base-ui/react/use-render\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\n\nimport { cn } from \"./lib/utils\"\n\nconst badgeVariants = cva(\n \"h-5 gap-1 rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium
|
|
1
|
+
{"version":3,"file":"badge.js","names":[],"sources":["../src/badge.tsx"],"sourcesContent":["\"use client\"\n\nimport { mergeProps } from \"@base-ui/react/merge-props\"\nimport { useRender } from \"@base-ui/react/use-render\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\n\nimport { cn } from \"./lib/utils\"\n\nconst badgeVariants = cva(\n \"h-5 gap-1 rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium motion-color has-data-[icon=inline-start]:pl-1.5 has-data-[icon=inline-end]:pr-1.5 [&>svg]:size-3! inline-flex items-center justify-center w-fit whitespace-nowrap shrink-0 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive overflow-hidden group/badge\",\n {\n variants: {\n variant: {\n default:\n \"bg-input/30 text-primary border-primary/20 [a]:hover:bg-input/50\",\n solid:\n \"bg-primary text-primary-foreground [a]:hover:bg-primary/80\",\n success:\n \"bg-success/10 [a]:hover:bg-success/20 focus-visible:ring-success/20 dark:focus-visible:ring-success/40 text-success dark:bg-success/20\",\n destructive:\n \"bg-destructive/10 text-destructive [a]:hover:bg-destructive/20 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/20\",\n warning:\n \"bg-warning/10 text-warning [a]:hover:bg-warning/20 focus-visible:ring-warning/20 dark:focus-visible:ring-warning/40 dark:bg-warning/20\",\n secondary:\n \"bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80\",\n outline:\n \"border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground\",\n ghost:\n \"hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50\",\n link: \"text-primary underline-offset-4 hover:underline\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n },\n }\n)\n\ntype BadgeProps = useRender.ComponentProps<\"span\"> & VariantProps<typeof badgeVariants>\n\nfunction Badge({\n className,\n variant = \"default\",\n render,\n ...props\n}: BadgeProps) {\n return useRender({\n defaultTagName: \"span\",\n props: mergeProps<\"span\">(\n {\n className: cn(badgeVariants({ className, variant })),\n },\n props\n ),\n render,\n state: {\n slot: \"badge\",\n variant,\n },\n })\n}\n\nexport { Badge, badgeVariants }\n"],"mappings":";;;;;;AAQA,MAAM,gBAAgB,IACpB,weACA;CACE,UAAU,EACR,SAAS;EACP,SACE;EACF,OACE;EACF,SACE;EACF,aACE;EACF,SACE;EACF,WACE;EACF,SACE;EACF,OACE;EACF,MAAM;EACP,EACF;CACD,iBAAiB,EACf,SAAS,WACV;CACF,CACF;AAID,SAAS,MAAM,EACb,WACA,UAAU,WACV,QACA,GAAG,SACU;AACb,QAAO,UAAU;EACf,gBAAgB;EAChB,OAAO,WACL,EACE,WAAW,GAAG,cAAc;GAAE;GAAW;GAAS,CAAC,CAAC,EACrD,EACD,MACD;EACD;EACA,OAAO;GACL,MAAM;GACN;GACD;EACF,CAAC"}
|
package/dist/button.d.ts
CHANGED
|
@@ -6,8 +6,8 @@ import * as _$class_variance_authority_types0 from "class-variance-authority/typ
|
|
|
6
6
|
|
|
7
7
|
//#region src/button.d.ts
|
|
8
8
|
declare const buttonVariants: (props?: ({
|
|
9
|
-
variant?: "default" | "
|
|
10
|
-
size?: "default" | "
|
|
9
|
+
variant?: "default" | "link" | "solid" | "outline" | "secondary" | "ghost" | "success" | "destructive" | null | undefined;
|
|
10
|
+
size?: "default" | "xs" | "sm" | "lg" | "xl" | "icon" | "icon-xs" | "icon-sm" | "icon-lg" | null | undefined;
|
|
11
11
|
} & _$class_variance_authority_types0.ClassProp) | undefined) => string;
|
|
12
12
|
type ButtonProps = React.ComponentProps<typeof Button$1> & VariantProps<typeof buttonVariants>;
|
|
13
13
|
declare function Button({
|
package/dist/button.js
CHANGED
|
@@ -5,7 +5,7 @@ import { jsx } from "react/jsx-runtime";
|
|
|
5
5
|
import { Button as Button$1 } from "@base-ui/react/button";
|
|
6
6
|
import { cva } from "class-variance-authority";
|
|
7
7
|
//#region src/button.tsx
|
|
8
|
-
const buttonVariants = cva("cursor-clickable focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 rounded-lg border border-transparent bg-clip-padding text-sm font-medium focus-visible:ring-3 aria-invalid:ring-3 [&_svg:not([class*='size-'])]:size-4 inline-flex items-center justify-center whitespace-nowrap
|
|
8
|
+
const buttonVariants = cva("cursor-clickable focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 rounded-lg border border-transparent bg-clip-padding text-sm font-medium focus-visible:ring-3 aria-invalid:ring-3 [&_svg:not([class*='size-'])]:size-4 inline-flex items-center justify-center whitespace-nowrap motion-color disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none shrink-0 [&_svg]:shrink-0 outline-none group/button select-none", {
|
|
9
9
|
variants: {
|
|
10
10
|
variant: {
|
|
11
11
|
default: "bg-primary/10 text-primary hover:bg-primary/20",
|
package/dist/button.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button.js","names":["ButtonPrimitive"],"sources":["../src/button.tsx"],"sourcesContent":["\"use client\"\n\nimport * as React from \"react\"\nimport { Button as ButtonPrimitive } from \"@base-ui/react/button\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\n\nimport { cn } from \"./lib/utils\"\n\nconst buttonVariants = cva(\n \"cursor-clickable focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 rounded-lg border border-transparent bg-clip-padding text-sm font-medium focus-visible:ring-3 aria-invalid:ring-3 [&_svg:not([class*='size-'])]:size-4 inline-flex items-center justify-center whitespace-nowrap
|
|
1
|
+
{"version":3,"file":"button.js","names":["ButtonPrimitive"],"sources":["../src/button.tsx"],"sourcesContent":["\"use client\"\n\nimport * as React from \"react\"\nimport { Button as ButtonPrimitive } from \"@base-ui/react/button\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\n\nimport { cn } from \"./lib/utils\"\n\nconst buttonVariants = cva(\n \"cursor-clickable focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 rounded-lg border border-transparent bg-clip-padding text-sm font-medium focus-visible:ring-3 aria-invalid:ring-3 [&_svg:not([class*='size-'])]:size-4 inline-flex items-center justify-center whitespace-nowrap motion-color disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none shrink-0 [&_svg]:shrink-0 outline-none group/button select-none\",\n {\n variants: {\n variant: {\n default: \"bg-primary/10 text-primary hover:bg-primary/20\",\n solid: \"bg-primary text-primary-foreground hover:bg-primary/80\",\n outline: \"border-border bg-background hover:bg-muted hover:text-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50 aria-expanded:bg-muted aria-expanded:text-foreground\",\n secondary: \"bg-secondary text-secondary-foreground hover:bg-secondary/80 aria-expanded:bg-secondary aria-expanded:text-secondary-foreground\",\n ghost: \"hover:bg-muted hover:text-foreground dark:hover:bg-muted/50 aria-expanded:bg-muted aria-expanded:text-foreground\",\n success: \"bg-success/10 hover:bg-success/20 focus-visible:ring-success/20 dark:focus-visible:ring-success/40 dark:bg-success/20 text-success focus-visible:border-success/40 dark:hover:bg-success/30\",\n destructive: \"bg-destructive/10 hover:bg-destructive/20 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/20 text-destructive focus-visible:border-destructive/40 dark:hover:bg-destructive/30\",\n link: \"text-primary underline-offset-4 hover:underline\",\n },\n size: {\n default: \"h-8 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2\",\n xs: \"h-6 gap-1 rounded-[min(var(--radius-md),10px)] px-2 text-xs in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3\",\n sm: \"h-7 gap-1 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5\",\n lg: \"h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-3 has-data-[icon=inline-start]:pl-3\",\n xl: \"h-10 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-3 has-data-[icon=inline-start]:pl-3\",\n icon: \"size-8\",\n \"icon-xs\":\n \"size-6 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-lg [&_svg:not([class*='size-'])]:size-3\",\n \"icon-sm\":\n \"size-7 rounded-[min(var(--radius-md),12px)] in-data-[slot=button-group]:rounded-lg\",\n \"icon-lg\": \"size-9\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n size: \"default\",\n },\n }\n)\n\ntype ButtonProps = React.ComponentProps<typeof ButtonPrimitive> & VariantProps<typeof buttonVariants>\n\nfunction Button({\n className,\n variant = \"default\",\n size = \"default\",\n ...props\n}: ButtonProps) {\n return (\n <ButtonPrimitive\n data-slot=\"button\"\n nativeButton={props.render ? false : undefined}\n className={cn(buttonVariants({ variant, size }), className)}\n {...props}\n />\n )\n}\n\nexport { Button, buttonVariants }\n"],"mappings":";;;;;;;AAQA,MAAM,iBAAiB,IACrB,mkBACA;CACE,UAAU;EACR,SAAS;GACP,SAAS;GACT,OAAO;GACP,SAAS;GACT,WAAW;GACX,OAAO;GACP,SAAS;GACT,aAAa;GACb,MAAM;GACP;EACD,MAAM;GACJ,SAAS;GACT,IAAI;GACJ,IAAI;GACJ,IAAI;GACJ,IAAI;GACJ,MAAM;GACN,WACE;GACF,WACE;GACF,WAAW;GACZ;EACF;CACD,iBAAiB;EACf,SAAS;EACT,MAAM;EACP;CACF,CACF;AAID,SAAS,OAAO,EACd,WACA,UAAU,WACV,OAAO,WACP,GAAG,SACW;AACd,QACE,oBAACA,UAAD;EACE,aAAU;EACV,cAAc,MAAM,SAAS,QAAQ,KAAA;EACrC,WAAW,GAAG,eAAe;GAAE;GAAS;GAAM,CAAC,EAAE,UAAU;EAC3D,GAAI;EACJ,CAAA"}
|
package/dist/combobox.js
CHANGED
|
@@ -34,7 +34,7 @@ function ComboboxClear({ className, ...props }) {
|
|
|
34
34
|
variant: "ghost",
|
|
35
35
|
size: "icon-xs"
|
|
36
36
|
}),
|
|
37
|
-
className: cn("motion-scale", className),
|
|
37
|
+
className: cn("motion-scale [--motion-scale-blur:2px]", className),
|
|
38
38
|
...props,
|
|
39
39
|
children: /* @__PURE__ */ jsx(CloseIcon, { className: "pointer-events-none" })
|
|
40
40
|
});
|
|
@@ -57,7 +57,7 @@ function ComboboxInput({ className, children, disabled = false, showTrigger = tr
|
|
|
57
57
|
nativeButton: true,
|
|
58
58
|
render: /* @__PURE__ */ jsx(ComboboxTrigger, {}),
|
|
59
59
|
"data-slot": "input-group-button",
|
|
60
|
-
className: cn("motion-scale data-pressed:bg-transparent", "group-has-[[data-slot=combobox-clear][data-visible]]/input-group:pointer-events-none", "group-has-[[data-slot=combobox-clear][data-visible]]/input-group:opacity-0", "group-has-[[data-slot=combobox-clear][data-visible]]/input-group:[filter:blur(var(--blur))]", "group-has-[[data-slot=combobox-clear][data-visible]]/input-group:scale-[var(--scale)]"),
|
|
60
|
+
className: cn("motion-scale [--motion-scale-blur:2px] data-pressed:bg-transparent", "group-has-[[data-slot=combobox-clear][data-visible]]/input-group:pointer-events-none", "group-has-[[data-slot=combobox-clear][data-visible]]/input-group:opacity-0", "group-has-[[data-slot=combobox-clear][data-visible]]/input-group:[filter:blur(var(--blur))]", "group-has-[[data-slot=combobox-clear][data-visible]]/input-group:scale-[var(--scale)]"),
|
|
61
61
|
disabled
|
|
62
62
|
}) : null, showClear ? /* @__PURE__ */ jsx(ComboboxClear, { disabled }) : null]
|
|
63
63
|
})
|
|
@@ -89,7 +89,7 @@ function ComboboxContent({ className, side = "bottom", sideOffset = 6, align = "
|
|
|
89
89
|
className: "isolate z-50",
|
|
90
90
|
children: /* @__PURE__ */ jsx(Combobox$1.Popup, {
|
|
91
91
|
"data-slot": "combobox-content",
|
|
92
|
-
className: cn("bg-popover text-popover-foreground
|
|
92
|
+
className: cn("motion-slide bg-popover text-popover-foreground ring-foreground/10 *:data-[slot=input-group]:bg-input/30 *:data-[slot=input-group]:border-input/30 group/combobox-content relative max-h-(--available-height) max-w-(--available-width) min-w-(--anchor-width) origin-(--transform-origin) overflow-hidden rounded-lg shadow-md ring-1 *:data-[slot=input-group]:m-1 *:data-[slot=input-group]:mb-0 *:data-[slot=input-group]:h-8 *:data-[slot=input-group]:shadow-none", className),
|
|
93
93
|
...props
|
|
94
94
|
})
|
|
95
95
|
}) });
|
package/dist/combobox.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"combobox.js","names":["ComboboxPrimitive"],"sources":["../src/combobox.tsx"],"sourcesContent":["\"use client\"\n\nimport * as React from \"react\"\nimport { Combobox as ComboboxPrimitive } from \"@base-ui/react/combobox\"\n\nimport { cn } from \"./lib/utils\"\nimport { Button } from \"./button\"\nimport {\n InputGroup,\n InputGroupAddon,\n InputGroupButton,\n InputGroupInput,\n} from \"./input-group\"\nimport { ChevronDownIcon, CloseIcon, CheckIcon } from \"./lib/internal-icons\"\n\ntype ComboboxProps = React.ComponentProps<typeof ComboboxPrimitive.Root>\n\ntype ComboboxValueProps = React.ComponentProps<typeof ComboboxPrimitive.Value>\ntype ComboboxTriggerProps = React.ComponentProps<typeof ComboboxPrimitive.Trigger>\ntype ComboboxClearProps = React.ComponentProps<typeof ComboboxPrimitive.Clear>\ntype ComboboxInputProps = React.ComponentProps<typeof ComboboxPrimitive.Input>\n\ntype ComboboxPortalProps = React.ComponentProps<typeof ComboboxPrimitive.Portal>\ntype ComboboxPositionerProps = React.ComponentProps<typeof ComboboxPrimitive.Positioner>\ntype ComboboxPopupProps = React.ComponentProps<typeof ComboboxPrimitive.Popup>\n\ntype ComboboxListProps = React.ComponentProps<typeof ComboboxPrimitive.List>\ntype ComboboxItemProps = React.ComponentProps<typeof ComboboxPrimitive.Item>\ntype ComboboxGroupProps = React.ComponentProps<typeof ComboboxPrimitive.Group>\ntype ComboboxLabelProps = React.ComponentProps<typeof ComboboxPrimitive.GroupLabel>\ntype ComboboxCollectionProps = React.ComponentProps<typeof ComboboxPrimitive.Collection>\ntype ComboboxEmptyProps = React.ComponentProps<typeof ComboboxPrimitive.Empty>\ntype ComboboxSeparatorProps = React.ComponentProps<typeof ComboboxPrimitive.Separator>\ntype ComboboxChipsProps = React.ComponentProps<typeof ComboboxPrimitive.Chips>\ntype ComboboxChipProps = React.ComponentProps<typeof ComboboxPrimitive.Chip>\ntype ComboboxChipsInputProps = React.ComponentProps<typeof ComboboxPrimitive.Input>\n\ntype ComboboxInputWrapperProps = ComboboxInputProps & {\n showTrigger?: boolean\n showClear?: boolean\n}\n\ntype ComboboxChipWrapperProps = ComboboxChipProps & {\n showRemove?: boolean\n}\n\ntype ComboboxContentProps = ComboboxPopupProps &\n Pick<\n ComboboxPositionerProps,\n \"side\" | \"align\" | \"sideOffset\" | \"alignOffset\" | \"anchor\"\n >\n\nfunction Combobox({ ...props }: ComboboxProps) {\n return <ComboboxPrimitive.Root data-slot=\"combobox\" {...props} />\n}\n\nfunction ComboboxValue({ ...props }: ComboboxValueProps) {\n return <ComboboxPrimitive.Value data-slot=\"combobox-value\" {...props} />\n}\n\nfunction ComboboxTrigger({ className, children, ...props }: ComboboxTriggerProps) {\n return (\n <ComboboxPrimitive.Trigger\n data-slot=\"combobox-trigger\"\n className={cn(\n \"[&_svg:not([class*='size-'])]:size-4\",\n className\n )}\n {...props}\n >\n {children}\n <ChevronDownIcon\n className=\"text-muted-foreground pointer-events-none size-4\"\n />\n </ComboboxPrimitive.Trigger>\n )\n}\n\nfunction ComboboxClear({ className, ...props }: ComboboxClearProps) {\n return (\n <ComboboxPrimitive.Clear\n data-slot=\"combobox-clear\"\n render={<InputGroupButton variant=\"ghost\" size=\"icon-xs\" />}\n className={cn(\"motion-scale\", className)}\n {...props}\n >\n <CloseIcon\n className=\"pointer-events-none\"\n />\n </ComboboxPrimitive.Clear>\n )\n}\n\nfunction ComboboxInput({\n className,\n children,\n disabled = false,\n showTrigger = true,\n showClear = false,\n ...props\n}: ComboboxInputWrapperProps) {\n return (\n <ComboboxPrimitive.InputGroup render={<InputGroup className={cn(className)} />}>\n <ComboboxPrimitive.Input render={<InputGroupInput disabled={disabled} />} {...props} />\n <InputGroupAddon align=\"inline-end\">\n {/* Stack the trigger chevron and clear button in one cell so they\n * cross-fade. In single-select mode Base UI mounts the Clear only\n * when a value is *selected* (not while typing), and marks it with\n * a persistent `data-visible` attribute. The chevron keys its\n * fade-out (opacity/blur/scale via `motion-scale`) off that exact\n * attribute. Both behaviours are pinned by `combobox.test.tsx` —\n * verified against the rendered DOM, not inferred. */}\n <div className=\"relative grid size-6 *:[grid-area:1/1]\">\n {showTrigger ? (\n <InputGroupButton\n size=\"icon-xs\"\n variant=\"ghost\"\n nativeButton\n render={<ComboboxTrigger />}\n data-slot=\"input-group-button\"\n className={cn(\n \"motion-scale data-pressed:bg-transparent\",\n \"group-has-[[data-slot=combobox-clear][data-visible]]/input-group:pointer-events-none\",\n \"group-has-[[data-slot=combobox-clear][data-visible]]/input-group:opacity-0\",\n \"group-has-[[data-slot=combobox-clear][data-visible]]/input-group:[filter:blur(var(--blur))]\",\n \"group-has-[[data-slot=combobox-clear][data-visible]]/input-group:scale-[var(--scale)]\",\n )}\n disabled={disabled}\n />\n ) : null}\n {showClear ? <ComboboxClear disabled={disabled} /> : null}\n </div>\n </InputGroupAddon>\n {children}\n </ComboboxPrimitive.InputGroup>\n )\n}\n\nfunction ComboboxPortal({ ...props }: ComboboxPortalProps) {\n return <ComboboxPrimitive.Portal data-slot=\"combobox-portal\" {...props} />\n}\n\nfunction ComboboxPositioner({ className, ...props }: ComboboxPositionerProps) {\n return (\n <ComboboxPrimitive.Positioner\n data-slot=\"combobox-positioner\"\n className={className}\n {...props}\n />\n )\n}\n\nfunction ComboboxContent({\n className,\n side = \"bottom\",\n sideOffset = 6,\n align = \"start\",\n alignOffset = 0,\n anchor,\n ...props\n}: ComboboxContentProps) {\n return (\n <ComboboxPortal>\n <ComboboxPositioner\n side={side}\n sideOffset={sideOffset}\n align={align}\n alignOffset={alignOffset}\n anchor={anchor}\n className=\"isolate z-50\"\n >\n <ComboboxPrimitive.Popup\n data-slot=\"combobox-content\"\n className={cn(\n \"bg-popover text-popover-foreground data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 ring-foreground/10 *:data-[slot=input-group]:bg-input/30 *:data-[slot=input-group]:border-input/30 data-[side=inline-start]:slide-in-from-right-2 data-[side=inline-end]:slide-in-from-left-2 group/combobox-content relative max-h-(--available-height) max-w-(--available-width) min-w-(--anchor-width) origin-(--transform-origin) overflow-hidden rounded-lg shadow-md ring-1 duration-100 *:data-[slot=input-group]:m-1 *:data-[slot=input-group]:mb-0 *:data-[slot=input-group]:h-8 *:data-[slot=input-group]:shadow-none\",\n className,\n )}\n {...props}\n />\n </ComboboxPositioner>\n </ComboboxPortal>\n )\n}\n\nfunction ComboboxList({ className, ...props }: ComboboxListProps) {\n return (\n <ComboboxPrimitive.List\n data-slot=\"combobox-list\"\n className={cn(\n \"[scrollbar-width:none] [&::-webkit-scrollbar]:hidden max-h-[min(calc(--spacing(72)---spacing(9)),calc(var(--available-height)---spacing(9)))] scroll-py-1 overflow-y-auto overscroll-contain p-1 data-empty:p-0\",\n className,\n )}\n {...props}\n />\n )\n}\n\nfunction ComboboxItem({ className, children, ...props }: ComboboxItemProps) {\n return (\n <ComboboxPrimitive.Item\n data-slot=\"combobox-item\"\n className={cn(\n \"data-highlighted:bg-accent data-highlighted:text-accent-foreground not-data-[variant=destructive]:data-highlighted:**:text-accent-foreground relative flex w-full cursor-clickable items-center gap-2 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4\",\n className,\n )}\n {...props}\n >\n {children}\n <ComboboxPrimitive.ItemIndicator\n render={\n <span data-slot=\"combobox-item-indicator\" className=\"pointer-events-none absolute right-2 flex size-4 items-center justify-center\" />\n }\n >\n <CheckIcon\n className=\"pointer-events-none\"\n />\n </ComboboxPrimitive.ItemIndicator>\n </ComboboxPrimitive.Item>\n )\n}\n\nfunction ComboboxGroup({ className, ...props }: ComboboxGroupProps) {\n return (\n <ComboboxPrimitive.Group\n data-slot=\"combobox-group\"\n className={cn(className)}\n {...props}\n />\n )\n}\n\nfunction ComboboxLabel({ className, ...props }: ComboboxLabelProps) {\n return (\n <ComboboxPrimitive.GroupLabel\n data-slot=\"combobox-label\"\n className={cn(\"text-muted-foreground px-2 py-1.5 text-xs\", className)}\n {...props}\n />\n )\n}\n\nfunction ComboboxCollection({ ...props }: ComboboxCollectionProps) {\n return <ComboboxPrimitive.Collection data-slot=\"combobox-collection\" {...props} />\n}\n\nfunction ComboboxEmpty({ className, ...props }: ComboboxEmptyProps) {\n return (\n <ComboboxPrimitive.Empty\n data-slot=\"combobox-empty\"\n className={cn(\n \"text-muted-foreground hidden w-full justify-center py-2 text-center text-sm group-data-empty/combobox-content:flex\",\n className,\n )}\n {...props}\n />\n )\n}\n\nfunction ComboboxSeparator({ className, ...props }: ComboboxSeparatorProps) {\n return (\n <ComboboxPrimitive.Separator\n data-slot=\"combobox-separator\"\n className={cn(\"bg-border -mx-1 my-1 h-px\", className)}\n {...props}\n />\n )\n}\n\nfunction ComboboxChips({ className, ...props }: ComboboxChipsProps) {\n return (\n <ComboboxPrimitive.Chips\n data-slot=\"combobox-chips\"\n className={cn(\n \"dark:bg-input/30 border-input focus-within:border-ring focus-within:ring-ring/50 has-aria-invalid:ring-destructive/20 dark:has-aria-invalid:ring-destructive/40 has-aria-invalid:border-destructive dark:has-aria-invalid:border-destructive/50 flex min-h-8 flex-wrap items-center gap-1 rounded-lg border bg-transparent bg-clip-padding px-2.5 py-1 text-sm transition-colors focus-within:ring-3 has-aria-invalid:ring-3 has-data-[slot=combobox-chip]:px-1\",\n className,\n )}\n {...props}\n />\n )\n}\n\nfunction ComboboxChip({\n className,\n children,\n showRemove = true,\n ...props\n}: ComboboxChipWrapperProps) {\n return (\n <ComboboxPrimitive.Chip\n data-slot=\"combobox-chip\"\n className={cn(\n \"bg-muted text-foreground flex h-[calc(--spacing(5.25))] w-fit items-center justify-center gap-1 rounded-sm px-1.5 text-xs font-medium whitespace-nowrap has-disabled:pointer-events-none has-disabled:cursor-not-allowed has-disabled:opacity-50 has-data-[slot=combobox-chip-remove]:pr-0\",\n className,\n )}\n {...props}\n >\n {children}\n {showRemove ? (\n <ComboboxPrimitive.ChipRemove\n render={<Button variant=\"ghost\" size=\"icon-xs\" />}\n className=\"-ml-1 opacity-50 hover:opacity-100\"\n data-slot=\"combobox-chip-remove\"\n >\n <CloseIcon\n className=\"pointer-events-none\"\n />\n </ComboboxPrimitive.ChipRemove>\n ) : null}\n </ComboboxPrimitive.Chip>\n )\n}\n\nfunction ComboboxChipsInput({ className, ...props }: ComboboxChipsInputProps) {\n return (\n <ComboboxPrimitive.Input\n data-slot=\"combobox-chip-input\"\n className={cn(\"min-w-16 flex-1 outline-none\", className)}\n {...props}\n />\n )\n}\n\nfunction useComboboxAnchor() {\n return React.useRef<HTMLDivElement | null>(null)\n}\n\nexport {\n Combobox,\n ComboboxInput,\n ComboboxContent,\n ComboboxList,\n ComboboxItem,\n ComboboxGroup,\n ComboboxLabel,\n ComboboxCollection,\n ComboboxEmpty,\n ComboboxSeparator,\n ComboboxChips,\n ComboboxChip,\n ComboboxChipsInput,\n ComboboxTrigger,\n ComboboxValue,\n ComboboxClear,\n useComboboxAnchor,\n}\n"],"mappings":";;;;;;;;;AAoDA,SAAS,SAAS,EAAE,GAAG,SAAwB;AAC7C,QAAO,oBAACA,WAAkB,MAAnB;EAAwB,aAAU;EAAW,GAAI;EAAS,CAAA;;AAGnE,SAAS,cAAc,EAAE,GAAG,SAA6B;AACvD,QAAO,oBAACA,WAAkB,OAAnB;EAAyB,aAAU;EAAiB,GAAI;EAAS,CAAA;;AAG1E,SAAS,gBAAgB,EAAE,WAAW,UAAU,GAAG,SAA+B;AAChF,QACE,qBAACA,WAAkB,SAAnB;EACE,aAAU;EACV,WAAW,GACT,wCACA,UACD;EACD,GAAI;YANN,CAQG,UACD,oBAAC,iBAAD,EACE,WAAU,oDACV,CAAA,CACwB;;;AAIhC,SAAS,cAAc,EAAE,WAAW,GAAG,SAA6B;AAClE,QACE,oBAACA,WAAkB,OAAnB;EACE,aAAU;EACV,QAAQ,oBAAC,kBAAD;GAAkB,SAAQ;GAAQ,MAAK;GAAY,CAAA;EAC3D,WAAW,GAAG,gBAAgB,UAAU;EACxC,GAAI;YAEJ,oBAAC,WAAD,EACE,WAAU,uBACV,CAAA;EACsB,CAAA;;AAI9B,SAAS,cAAc,EACrB,WACA,UACA,WAAW,OACX,cAAc,MACd,YAAY,OACZ,GAAG,SACyB;AAC5B,QACE,qBAACA,WAAkB,YAAnB;EAA8B,QAAQ,oBAAC,YAAD,EAAY,WAAW,GAAG,UAAU,EAAI,CAAA;YAA9E;GACE,oBAACA,WAAkB,OAAnB;IAAyB,QAAQ,oBAAC,iBAAD,EAA2B,UAAY,CAAA;IAAE,GAAI;IAAS,CAAA;GACvF,oBAAC,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AG,SAAkC;AAC5E,QACE,oBAACA,WAAkB,OAAnB;EACE,aAAU;EACV,WAAW,GAAG,gCAAgC,UAAU;EACxD,GAAI;EACJ,CAAA;;AAIN,SAAS,oBAAoB;AAC3B,QAAO,MAAM,OAA8B,KAAK"}
|
|
1
|
+
{"version":3,"file":"combobox.js","names":["ComboboxPrimitive"],"sources":["../src/combobox.tsx"],"sourcesContent":["\"use client\"\n\nimport * as React from \"react\"\nimport { Combobox as ComboboxPrimitive } from \"@base-ui/react/combobox\"\n\nimport { cn } from \"./lib/utils\"\nimport { Button } from \"./button\"\nimport {\n InputGroup,\n InputGroupAddon,\n InputGroupButton,\n InputGroupInput,\n} from \"./input-group\"\nimport { ChevronDownIcon, CloseIcon, CheckIcon } from \"./lib/internal-icons\"\n\ntype ComboboxProps = React.ComponentProps<typeof ComboboxPrimitive.Root>\n\ntype ComboboxValueProps = React.ComponentProps<typeof ComboboxPrimitive.Value>\ntype ComboboxTriggerProps = React.ComponentProps<typeof ComboboxPrimitive.Trigger>\ntype ComboboxClearProps = React.ComponentProps<typeof ComboboxPrimitive.Clear>\ntype ComboboxInputProps = React.ComponentProps<typeof ComboboxPrimitive.Input>\n\ntype ComboboxPortalProps = React.ComponentProps<typeof ComboboxPrimitive.Portal>\ntype ComboboxPositionerProps = React.ComponentProps<typeof ComboboxPrimitive.Positioner>\ntype ComboboxPopupProps = React.ComponentProps<typeof ComboboxPrimitive.Popup>\n\ntype ComboboxListProps = React.ComponentProps<typeof ComboboxPrimitive.List>\ntype ComboboxItemProps = React.ComponentProps<typeof ComboboxPrimitive.Item>\ntype ComboboxGroupProps = React.ComponentProps<typeof ComboboxPrimitive.Group>\ntype ComboboxLabelProps = React.ComponentProps<typeof ComboboxPrimitive.GroupLabel>\ntype ComboboxCollectionProps = React.ComponentProps<typeof ComboboxPrimitive.Collection>\ntype ComboboxEmptyProps = React.ComponentProps<typeof ComboboxPrimitive.Empty>\ntype ComboboxSeparatorProps = React.ComponentProps<typeof ComboboxPrimitive.Separator>\ntype ComboboxChipsProps = React.ComponentProps<typeof ComboboxPrimitive.Chips>\ntype ComboboxChipProps = React.ComponentProps<typeof ComboboxPrimitive.Chip>\ntype ComboboxChipsInputProps = React.ComponentProps<typeof ComboboxPrimitive.Input>\n\ntype ComboboxInputWrapperProps = ComboboxInputProps & {\n showTrigger?: boolean\n showClear?: boolean\n}\n\ntype ComboboxChipWrapperProps = ComboboxChipProps & {\n showRemove?: boolean\n}\n\ntype ComboboxContentProps = ComboboxPopupProps &\n Pick<\n ComboboxPositionerProps,\n \"side\" | \"align\" | \"sideOffset\" | \"alignOffset\" | \"anchor\"\n >\n\nfunction Combobox({ ...props }: ComboboxProps) {\n return <ComboboxPrimitive.Root data-slot=\"combobox\" {...props} />\n}\n\nfunction ComboboxValue({ ...props }: ComboboxValueProps) {\n return <ComboboxPrimitive.Value data-slot=\"combobox-value\" {...props} />\n}\n\nfunction ComboboxTrigger({ className, children, ...props }: ComboboxTriggerProps) {\n return (\n <ComboboxPrimitive.Trigger\n data-slot=\"combobox-trigger\"\n className={cn(\n \"[&_svg:not([class*='size-'])]:size-4\",\n className\n )}\n {...props}\n >\n {children}\n <ChevronDownIcon\n className=\"text-muted-foreground pointer-events-none size-4\"\n />\n </ComboboxPrimitive.Trigger>\n )\n}\n\nfunction ComboboxClear({ className, ...props }: ComboboxClearProps) {\n return (\n <ComboboxPrimitive.Clear\n data-slot=\"combobox-clear\"\n render={<InputGroupButton variant=\"ghost\" size=\"icon-xs\" />}\n className={cn(\"motion-scale [--motion-scale-blur:2px]\", className)}\n {...props}\n >\n <CloseIcon\n className=\"pointer-events-none\"\n />\n </ComboboxPrimitive.Clear>\n )\n}\n\nfunction ComboboxInput({\n className,\n children,\n disabled = false,\n showTrigger = true,\n showClear = false,\n ...props\n}: ComboboxInputWrapperProps) {\n return (\n <ComboboxPrimitive.InputGroup render={<InputGroup className={cn(className)} />}>\n <ComboboxPrimitive.Input render={<InputGroupInput disabled={disabled} />} {...props} />\n <InputGroupAddon align=\"inline-end\">\n {/* Stack the trigger chevron and clear button in one cell so they\n * cross-fade. In single-select mode Base UI mounts the Clear only\n * when a value is *selected* (not while typing), and marks it with\n * a persistent `data-visible` attribute. The chevron keys its\n * fade-out (opacity/blur/scale via `motion-scale`) off that exact\n * attribute. Both behaviours are pinned by `combobox.test.tsx` —\n * verified against the rendered DOM, not inferred. */}\n <div className=\"relative grid size-6 *:[grid-area:1/1]\">\n {showTrigger ? (\n <InputGroupButton\n size=\"icon-xs\"\n variant=\"ghost\"\n nativeButton\n render={<ComboboxTrigger />}\n data-slot=\"input-group-button\"\n className={cn(\n \"motion-scale [--motion-scale-blur:2px] data-pressed:bg-transparent\",\n \"group-has-[[data-slot=combobox-clear][data-visible]]/input-group:pointer-events-none\",\n \"group-has-[[data-slot=combobox-clear][data-visible]]/input-group:opacity-0\",\n \"group-has-[[data-slot=combobox-clear][data-visible]]/input-group:[filter:blur(var(--blur))]\",\n \"group-has-[[data-slot=combobox-clear][data-visible]]/input-group:scale-[var(--scale)]\",\n )}\n disabled={disabled}\n />\n ) : null}\n {showClear ? <ComboboxClear disabled={disabled} /> : null}\n </div>\n </InputGroupAddon>\n {children}\n </ComboboxPrimitive.InputGroup>\n )\n}\n\nfunction ComboboxPortal({ ...props }: ComboboxPortalProps) {\n return <ComboboxPrimitive.Portal data-slot=\"combobox-portal\" {...props} />\n}\n\nfunction ComboboxPositioner({ className, ...props }: ComboboxPositionerProps) {\n return (\n <ComboboxPrimitive.Positioner\n data-slot=\"combobox-positioner\"\n className={className}\n {...props}\n />\n )\n}\n\nfunction ComboboxContent({\n className,\n side = \"bottom\",\n sideOffset = 6,\n align = \"start\",\n alignOffset = 0,\n anchor,\n ...props\n}: ComboboxContentProps) {\n return (\n <ComboboxPortal>\n <ComboboxPositioner\n side={side}\n sideOffset={sideOffset}\n align={align}\n alignOffset={alignOffset}\n anchor={anchor}\n className=\"isolate z-50\"\n >\n <ComboboxPrimitive.Popup\n data-slot=\"combobox-content\"\n className={cn(\n \"motion-slide bg-popover text-popover-foreground ring-foreground/10 *:data-[slot=input-group]:bg-input/30 *:data-[slot=input-group]:border-input/30 group/combobox-content relative max-h-(--available-height) max-w-(--available-width) min-w-(--anchor-width) origin-(--transform-origin) overflow-hidden rounded-lg shadow-md ring-1 *:data-[slot=input-group]:m-1 *:data-[slot=input-group]:mb-0 *:data-[slot=input-group]:h-8 *:data-[slot=input-group]:shadow-none\",\n className,\n )}\n {...props}\n />\n </ComboboxPositioner>\n </ComboboxPortal>\n )\n}\n\nfunction ComboboxList({ className, ...props }: ComboboxListProps) {\n return (\n <ComboboxPrimitive.List\n data-slot=\"combobox-list\"\n className={cn(\n \"[scrollbar-width:none] [&::-webkit-scrollbar]:hidden max-h-[min(calc(--spacing(72)---spacing(9)),calc(var(--available-height)---spacing(9)))] scroll-py-1 overflow-y-auto overscroll-contain p-1 data-empty:p-0\",\n className,\n )}\n {...props}\n />\n )\n}\n\nfunction ComboboxItem({ className, children, ...props }: ComboboxItemProps) {\n return (\n <ComboboxPrimitive.Item\n data-slot=\"combobox-item\"\n className={cn(\n \"data-highlighted:bg-accent data-highlighted:text-accent-foreground not-data-[variant=destructive]:data-highlighted:**:text-accent-foreground relative flex w-full cursor-clickable items-center gap-2 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4\",\n className,\n )}\n {...props}\n >\n {children}\n <ComboboxPrimitive.ItemIndicator\n render={\n <span data-slot=\"combobox-item-indicator\" className=\"pointer-events-none absolute right-2 flex size-4 items-center justify-center\" />\n }\n >\n <CheckIcon\n className=\"pointer-events-none\"\n />\n </ComboboxPrimitive.ItemIndicator>\n </ComboboxPrimitive.Item>\n )\n}\n\nfunction ComboboxGroup({ className, ...props }: ComboboxGroupProps) {\n return (\n <ComboboxPrimitive.Group\n data-slot=\"combobox-group\"\n className={cn(className)}\n {...props}\n />\n )\n}\n\nfunction ComboboxLabel({ className, ...props }: ComboboxLabelProps) {\n return (\n <ComboboxPrimitive.GroupLabel\n data-slot=\"combobox-label\"\n className={cn(\"text-muted-foreground px-2 py-1.5 text-xs\", className)}\n {...props}\n />\n )\n}\n\nfunction ComboboxCollection({ ...props }: ComboboxCollectionProps) {\n return <ComboboxPrimitive.Collection data-slot=\"combobox-collection\" {...props} />\n}\n\nfunction ComboboxEmpty({ className, ...props }: ComboboxEmptyProps) {\n return (\n <ComboboxPrimitive.Empty\n data-slot=\"combobox-empty\"\n className={cn(\n \"text-muted-foreground hidden w-full justify-center py-2 text-center text-sm group-data-empty/combobox-content:flex\",\n className,\n )}\n {...props}\n />\n )\n}\n\nfunction ComboboxSeparator({ className, ...props }: ComboboxSeparatorProps) {\n return (\n <ComboboxPrimitive.Separator\n data-slot=\"combobox-separator\"\n className={cn(\"bg-border -mx-1 my-1 h-px\", className)}\n {...props}\n />\n )\n}\n\nfunction ComboboxChips({ className, ...props }: ComboboxChipsProps) {\n return (\n <ComboboxPrimitive.Chips\n data-slot=\"combobox-chips\"\n className={cn(\n \"dark:bg-input/30 border-input focus-within:border-ring focus-within:ring-ring/50 has-aria-invalid:ring-destructive/20 dark:has-aria-invalid:ring-destructive/40 has-aria-invalid:border-destructive dark:has-aria-invalid:border-destructive/50 flex min-h-8 flex-wrap items-center gap-1 rounded-lg border bg-transparent bg-clip-padding px-2.5 py-1 text-sm transition-colors focus-within:ring-3 has-aria-invalid:ring-3 has-data-[slot=combobox-chip]:px-1\",\n className,\n )}\n {...props}\n />\n )\n}\n\nfunction ComboboxChip({\n className,\n children,\n showRemove = true,\n ...props\n}: ComboboxChipWrapperProps) {\n return (\n <ComboboxPrimitive.Chip\n data-slot=\"combobox-chip\"\n className={cn(\n \"bg-muted text-foreground flex h-[calc(--spacing(5.25))] w-fit items-center justify-center gap-1 rounded-sm px-1.5 text-xs font-medium whitespace-nowrap has-disabled:pointer-events-none has-disabled:cursor-not-allowed has-disabled:opacity-50 has-data-[slot=combobox-chip-remove]:pr-0\",\n className,\n )}\n {...props}\n >\n {children}\n {showRemove ? (\n <ComboboxPrimitive.ChipRemove\n render={<Button variant=\"ghost\" size=\"icon-xs\" />}\n className=\"-ml-1 opacity-50 hover:opacity-100\"\n data-slot=\"combobox-chip-remove\"\n >\n <CloseIcon\n className=\"pointer-events-none\"\n />\n </ComboboxPrimitive.ChipRemove>\n ) : null}\n </ComboboxPrimitive.Chip>\n )\n}\n\nfunction ComboboxChipsInput({ className, ...props }: ComboboxChipsInputProps) {\n return (\n <ComboboxPrimitive.Input\n data-slot=\"combobox-chip-input\"\n className={cn(\"min-w-16 flex-1 outline-none\", className)}\n {...props}\n />\n )\n}\n\nfunction useComboboxAnchor() {\n return React.useRef<HTMLDivElement | null>(null)\n}\n\nexport {\n Combobox,\n ComboboxInput,\n ComboboxContent,\n ComboboxList,\n ComboboxItem,\n ComboboxGroup,\n ComboboxLabel,\n ComboboxCollection,\n ComboboxEmpty,\n ComboboxSeparator,\n ComboboxChips,\n ComboboxChip,\n ComboboxChipsInput,\n ComboboxTrigger,\n ComboboxValue,\n ComboboxClear,\n useComboboxAnchor,\n}\n"],"mappings":";;;;;;;;;AAoDA,SAAS,SAAS,EAAE,GAAG,SAAwB;AAC7C,QAAO,oBAACA,WAAkB,MAAnB;EAAwB,aAAU;EAAW,GAAI;EAAS,CAAA;;AAGnE,SAAS,cAAc,EAAE,GAAG,SAA6B;AACvD,QAAO,oBAACA,WAAkB,OAAnB;EAAyB,aAAU;EAAiB,GAAI;EAAS,CAAA;;AAG1E,SAAS,gBAAgB,EAAE,WAAW,UAAU,GAAG,SAA+B;AAChF,QACE,qBAACA,WAAkB,SAAnB;EACE,aAAU;EACV,WAAW,GACT,wCACA,UACD;EACD,GAAI;YANN,CAQG,UACD,oBAAC,iBAAD,EACE,WAAU,oDACV,CAAA,CACwB;;;AAIhC,SAAS,cAAc,EAAE,WAAW,GAAG,SAA6B;AAClE,QACE,oBAACA,WAAkB,OAAnB;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