@waveso/ui 0.3.0 → 0.4.1
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/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.d.ts.map +1 -1
- package/dist/combobox.js +14 -11
- package/dist/combobox.js.map +1 -1
- package/dist/input-otp.js +1 -1
- package/dist/input-otp.js.map +1 -1
- package/dist/item.d.ts +1 -1
- package/dist/progress.js +1 -1
- package/dist/progress.js.map +1 -1
- package/dist/sidebar.js +1 -1
- package/dist/sidebar.js.map +1 -1
- package/dist/styles.css +109 -5
- 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.js +15 -15
- package/dist/toast.js.map +1 -1
- package/dist/toggle.js +1 -1
- package/dist/toggle.js.map +1 -1
- package/package.json +19 -10
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 transition-
|
|
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 transition-[color,background-color,border-color,box-shadow] 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 transition-
|
|
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 transition-[color,background-color,border-color,box-shadow] 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,4jBACA,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/badge.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ import * as _$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" | "link" | "solid" | "
|
|
8
|
+
variant?: "default" | "link" | "solid" | "success" | "destructive" | "warning" | "secondary" | "outline" | "ghost" | 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 transition-
|
|
7
|
+
const badgeVariants = cva("h-5 gap-1 rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium transition-[color,background-color,border-color,box-shadow] 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 transition-
|
|
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 transition-[color,background-color,border-color,box-shadow] 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,uhBACA;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" | "link" | "solid" | "
|
|
10
|
-
size?: "default" | "
|
|
9
|
+
variant?: "default" | "link" | "solid" | "success" | "destructive" | "secondary" | "outline" | "ghost" | 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 transition-
|
|
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 transition-[color,background-color,border-color,box-shadow] 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 transition-
|
|
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 transition-[color,background-color,border-color,box-shadow] 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,knBACA;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.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"combobox.d.ts","names":[],"sources":["../src/combobox.tsx"],"mappings":";;;;;KAeK,aAAA,GAAgB,KAAA,CAAM,cAAA,QAAsB,UAAA,CAAkB,IAAA;AAAA,KAE9D,kBAAA,GAAqB,KAAA,CAAM,cAAA,QAAsB,UAAA,CAAkB,KAAA;AAAA,KACnE,oBAAA,GAAuB,KAAA,CAAM,cAAA,QAAsB,UAAA,CAAkB,OAAA;AAAA,KACrE,kBAAA,GAAqB,KAAA,CAAM,cAAA,QAAsB,UAAA,CAAkB,KAAA;AAAA,KACnE,kBAAA,GAAqB,KAAA,CAAM,cAAA,QAAsB,UAAA,CAAkB,KAAA;AAAA,KAGnE,uBAAA,GAA0B,KAAA,CAAM,cAAA,QAAsB,UAAA,CAAkB,UAAA;AAAA,KACxE,kBAAA,GAAqB,K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}) {
|
|
|
34
34
|
variant: "ghost",
|
|
35
35
|
size: "icon-xs"
|
|
36
36
|
}),
|
|
37
|
-
className: cn(className),
|
|
37
|
+
className: cn("motion-scale", className),
|
|
38
38
|
...props,
|
|
39
39
|
children: /* @__PURE__ */ jsx(CloseIcon, { className: "pointer-events-none" })
|
|
40
40
|
});
|
|
@@ -47,17 +47,20 @@ function ComboboxInput({ className, children, disabled = false, showTrigger = tr
|
|
|
47
47
|
render: /* @__PURE__ */ jsx(InputGroupInput, { disabled }),
|
|
48
48
|
...props
|
|
49
49
|
}),
|
|
50
|
-
/* @__PURE__ */
|
|
50
|
+
/* @__PURE__ */ jsx(InputGroupAddon, {
|
|
51
51
|
align: "inline-end",
|
|
52
|
-
children:
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
52
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
53
|
+
className: "relative grid size-6 *:[grid-area:1/1]",
|
|
54
|
+
children: [showTrigger ? /* @__PURE__ */ jsx(InputGroupButton, {
|
|
55
|
+
size: "icon-xs",
|
|
56
|
+
variant: "ghost",
|
|
57
|
+
nativeButton: true,
|
|
58
|
+
render: /* @__PURE__ */ jsx(ComboboxTrigger, {}),
|
|
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)]"),
|
|
61
|
+
disabled
|
|
62
|
+
}) : null, showClear ? /* @__PURE__ */ jsx(ComboboxClear, { disabled }) : null]
|
|
63
|
+
})
|
|
61
64
|
}),
|
|
62
65
|
children
|
|
63
66
|
]
|
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(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 {showTrigger ? (\n <InputGroupButton\n size=\"icon-xs\"\n variant=\"ghost\"\n nativeButton\n render={<ComboboxTrigger />}\n data-slot=\"input-group-button\"\n className=\"group-has-data-[slot=combobox-clear]/input-group:hidden data-pressed:bg-transparent\"\n disabled={disabled}\n />\n ) : null}\n {showClear ? <ComboboxClear disabled={disabled} /> : null}\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,UAAU;EACxB,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,EAA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BAACA,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\", 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,W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BAAkB,EAAE,WAAW,GAAG,SAAiC;AAC1E,QACE,oBAACA,WAAkB,WAAnB;EACE,aAAU;EACV,WAAW,GAAG,6BAA6B,UAAU;EACrD,GAAI;EACJ,CAAA;;AAIN,SAAS,cAAc,EAAE,WAAW,GAAG,SAA6B;AAClE,QACE,oBAACA,WAAkB,OAAnB;EACE,aAAU;EACV,WAAW,GACT,mcACA,UACD;EACD,GAAI;EACJ,CAAA;;AAIN,SAAS,aAAa,EACpB,WACA,UACA,aAAa,MACb,GAAG,SACwB;AAC3B,QACE,qBAACA,WAAkB,MAAnB;EACE,aAAU;EACV,WAAW,GACT,8RACA,UACD;EACD,GAAI;YANN,CAQG,UACA,aACC,oBAACA,WAAkB,YAAnB;GACE,QAAQ,oBAAC,QAAD;IAAQ,SAAQ;IAAQ,MAAK;IAAY,CAAA;GACjD,WAAU;GACV,aAAU;aAEV,oBAAC,WAAD,EACE,WAAU,uBACV,CAAA;GAC2B,CAAA,GAC7B,KACmB;;;AAI7B,SAAS,mBAAmB,EAAE,WAAW,GAAG,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"}
|
package/dist/input-otp.js
CHANGED
|
@@ -26,7 +26,7 @@ function InputOTPSlot({ index, className, ...props }) {
|
|
|
26
26
|
return /* @__PURE__ */ jsxs("div", {
|
|
27
27
|
"data-slot": "input-otp-slot",
|
|
28
28
|
"data-active": isActive || void 0,
|
|
29
|
-
className: cn("border-input dark:bg-input/30 relative flex size-9 items-center justify-center border-y border-r text-sm transition-
|
|
29
|
+
className: cn("border-input dark:bg-input/30 relative flex size-9 items-center justify-center border-y border-r text-sm transition-[color,background-color,border-color,box-shadow] outline-none first:rounded-l-lg first:border-l last:rounded-r-lg", "data-active:border-ring data-active:ring-3 data-active:ring-ring/50 data-active:z-10", "aria-invalid:border-destructive data-active:aria-invalid:border-destructive data-active:aria-invalid:ring-destructive/20 dark:data-active:aria-invalid:ring-destructive/40", className),
|
|
30
30
|
...props,
|
|
31
31
|
children: [char, hasFakeCaret && /* @__PURE__ */ jsx("div", {
|
|
32
32
|
className: "pointer-events-none absolute inset-0 flex items-center justify-center",
|
package/dist/input-otp.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input-otp.js","names":[],"sources":["../src/input-otp.tsx"],"sourcesContent":["\"use client\"\n\nimport * as React from \"react\"\nimport { OTPInput, OTPInputContext } from \"input-otp\"\n\nimport { cn } from \"./lib/utils\"\nimport { MinusIcon } from \"./lib/internal-icons\"\n\ntype InputOTPProps = React.ComponentProps<typeof OTPInput> & {\n containerClassName?: string\n}\n\nfunction InputOTP({\n className,\n containerClassName,\n ...props\n}: InputOTPProps) {\n return (\n <OTPInput\n data-slot=\"input-otp\"\n containerClassName={cn(\n \"flex items-center has-disabled:opacity-50\",\n containerClassName,\n )}\n spellCheck={false}\n className={cn(\"disabled:cursor-not-allowed\", className)}\n {...props}\n />\n )\n}\n\ntype InputOTPGroupProps = React.ComponentProps<\"div\">\n\nfunction InputOTPGroup({ className, ...props }: InputOTPGroupProps) {\n return (\n <div\n data-slot=\"input-otp-group\"\n className={cn(\n \"flex items-center rounded-lg has-aria-invalid:border-destructive has-aria-invalid:ring-3 has-aria-invalid:ring-destructive/20 dark:has-aria-invalid:ring-destructive/40\",\n className,\n )}\n {...props}\n />\n )\n}\n\ntype InputOTPSlotProps = React.ComponentProps<\"div\"> & {\n index: number\n}\n\nfunction InputOTPSlot({ index, className, ...props }: InputOTPSlotProps) {\n const inputOTPContext = React.useContext(OTPInputContext)\n const { char, hasFakeCaret, isActive } = inputOTPContext?.slots[index] ?? {}\n\n return (\n <div\n data-slot=\"input-otp-slot\"\n data-active={isActive || undefined}\n className={cn(\n \"border-input dark:bg-input/30 relative flex size-9 items-center justify-center border-y border-r text-sm transition-
|
|
1
|
+
{"version":3,"file":"input-otp.js","names":[],"sources":["../src/input-otp.tsx"],"sourcesContent":["\"use client\"\n\nimport * as React from \"react\"\nimport { OTPInput, OTPInputContext } from \"input-otp\"\n\nimport { cn } from \"./lib/utils\"\nimport { MinusIcon } from \"./lib/internal-icons\"\n\ntype InputOTPProps = React.ComponentProps<typeof OTPInput> & {\n containerClassName?: string\n}\n\nfunction InputOTP({\n className,\n containerClassName,\n ...props\n}: InputOTPProps) {\n return (\n <OTPInput\n data-slot=\"input-otp\"\n containerClassName={cn(\n \"flex items-center has-disabled:opacity-50\",\n containerClassName,\n )}\n spellCheck={false}\n className={cn(\"disabled:cursor-not-allowed\", className)}\n {...props}\n />\n )\n}\n\ntype InputOTPGroupProps = React.ComponentProps<\"div\">\n\nfunction InputOTPGroup({ className, ...props }: InputOTPGroupProps) {\n return (\n <div\n data-slot=\"input-otp-group\"\n className={cn(\n \"flex items-center rounded-lg has-aria-invalid:border-destructive has-aria-invalid:ring-3 has-aria-invalid:ring-destructive/20 dark:has-aria-invalid:ring-destructive/40\",\n className,\n )}\n {...props}\n />\n )\n}\n\ntype InputOTPSlotProps = React.ComponentProps<\"div\"> & {\n index: number\n}\n\nfunction InputOTPSlot({ index, className, ...props }: InputOTPSlotProps) {\n const inputOTPContext = React.useContext(OTPInputContext)\n const { char, hasFakeCaret, isActive } = inputOTPContext?.slots[index] ?? {}\n\n return (\n <div\n data-slot=\"input-otp-slot\"\n data-active={isActive || undefined}\n className={cn(\n \"border-input dark:bg-input/30 relative flex size-9 items-center justify-center border-y border-r text-sm transition-[color,background-color,border-color,box-shadow] outline-none first:rounded-l-lg first:border-l last:rounded-r-lg\",\n \"data-active:border-ring data-active:ring-3 data-active:ring-ring/50 data-active:z-10\",\n \"aria-invalid:border-destructive data-active:aria-invalid:border-destructive data-active:aria-invalid:ring-destructive/20 dark:data-active:aria-invalid:ring-destructive/40\",\n className,\n )}\n {...props}\n >\n {char}\n {hasFakeCaret && (\n <div className=\"pointer-events-none absolute inset-0 flex items-center justify-center\">\n <div className=\"animate-caret-blink bg-foreground h-4 w-px duration-1000\" />\n </div>\n )}\n </div>\n )\n}\n\ntype InputOTPSeparatorProps = React.ComponentProps<\"div\">\n\nfunction InputOTPSeparator({ className, ...props }: InputOTPSeparatorProps) {\n return (\n <div\n data-slot=\"input-otp-separator\"\n className={cn(\n \"flex items-center [&_svg:not([class*='size-'])]:size-4\",\n className,\n )}\n role=\"separator\"\n {...props}\n >\n <MinusIcon />\n </div>\n )\n}\n\nexport {\n InputOTP,\n InputOTPGroup,\n InputOTPSlot,\n InputOTPSeparator\n}\n"],"mappings":";;;;;;;AAYA,SAAS,SAAS,EAChB,WACA,oBACA,GAAG,SACa;AAChB,QACE,oBAAC,UAAD;EACE,aAAU;EACV,oBAAoB,GAClB,6CACA,mBACD;EACD,YAAY;EACZ,WAAW,GAAG,+BAA+B,UAAU;EACvD,GAAI;EACJ,CAAA;;AAMN,SAAS,cAAc,EAAE,WAAW,GAAG,SAA6B;AAClE,QACE,oBAAC,OAAD;EACE,aAAU;EACV,WAAW,GACT,2KACA,UACD;EACD,GAAI;EACJ,CAAA;;AAQN,SAAS,aAAa,EAAE,OAAO,WAAW,GAAG,SAA4B;CAEvE,MAAM,EAAE,MAAM,cAAc,aADJ,MAAM,WAAW,gBACe,EAAE,MAAM,UAAU,EAAE;AAE5E,QACE,qBAAC,OAAD;EACE,aAAU;EACV,eAAa,YAAY,KAAA;EACzB,WAAW,GACT,yOACA,wFACA,8KACA,UACD;EACD,GAAI;YATN,CAWG,MACA,gBACC,oBAAC,OAAD;GAAK,WAAU;aACb,oBAAC,OAAD,EAAK,WAAU,4DAA6D,CAAA;GACxE,CAAA,CAEJ;;;AAMV,SAAS,kBAAkB,EAAE,WAAW,GAAG,SAAiC;AAC1E,QACE,oBAAC,OAAD;EACE,aAAU;EACV,WAAW,GACT,0DACA,UACD;EACD,MAAK;EACL,GAAI;YAEJ,oBAAC,WAAD,EAAa,CAAA;EACT,CAAA"}
|
package/dist/item.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ declare const itemVariants: (props?: ({
|
|
|
11
11
|
size?: "default" | "xs" | "sm" | null | undefined;
|
|
12
12
|
} & _$class_variance_authority_types0.ClassProp) | undefined) => string;
|
|
13
13
|
declare const itemMediaVariants: (props?: ({
|
|
14
|
-
variant?: "default" | "
|
|
14
|
+
variant?: "default" | "image" | "icon" | null | undefined;
|
|
15
15
|
} & _$class_variance_authority_types0.ClassProp) | undefined) => string;
|
|
16
16
|
type ItemGroupProps = React.ComponentProps<"div">;
|
|
17
17
|
type ItemSeparatorProps = React.ComponentProps<typeof Separator>;
|
package/dist/progress.js
CHANGED
|
@@ -23,7 +23,7 @@ function ProgressTrack({ className, ...props }) {
|
|
|
23
23
|
function ProgressIndicator({ className, ...props }) {
|
|
24
24
|
return /* @__PURE__ */ jsx(Progress$1.Indicator, {
|
|
25
25
|
"data-slot": "progress-indicator",
|
|
26
|
-
className: cn("bg-primary h-full transition-
|
|
26
|
+
className: cn("bg-primary h-full transition-[width]", className),
|
|
27
27
|
...props
|
|
28
28
|
});
|
|
29
29
|
}
|
package/dist/progress.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"progress.js","names":["ProgressPrimitive"],"sources":["../src/progress.tsx"],"sourcesContent":["\"use client\"\n\nimport * as React from \"react\"\nimport { Progress as ProgressPrimitive } from \"@base-ui/react/progress\"\n\nimport { cn } from \"./lib/utils\"\n\ntype ProgressProps = React.ComponentProps<typeof ProgressPrimitive.Root>\ntype ProgressTrackProps = React.ComponentProps<typeof ProgressPrimitive.Track>\ntype ProgressIndicatorProps = React.ComponentProps<typeof ProgressPrimitive.Indicator>\ntype ProgressLabelProps = React.ComponentProps<typeof ProgressPrimitive.Label>\ntype ProgressValueProps = React.ComponentProps<typeof ProgressPrimitive.Value>\n\nfunction Progress({ className, children, value, ...props }: ProgressProps) {\n return (\n <ProgressPrimitive.Root\n value={value}\n data-slot=\"progress\"\n className={cn(\"flex flex-wrap gap-3\", className)}\n {...props}\n >\n {children}\n <ProgressTrack>\n <ProgressIndicator />\n </ProgressTrack>\n </ProgressPrimitive.Root>\n )\n}\n\nfunction ProgressTrack({ className, ...props }: ProgressTrackProps) {\n return (\n <ProgressPrimitive.Track\n className={cn(\n \"bg-muted relative flex h-1 w-full items-center overflow-x-hidden rounded-full\",\n className\n )}\n data-slot=\"progress-track\"\n {...props}\n />\n )\n}\n\nfunction ProgressIndicator({ className, ...props }: ProgressIndicatorProps) {\n return (\n <ProgressPrimitive.Indicator\n data-slot=\"progress-indicator\"\n className={cn(\n \"bg-primary h-full transition-
|
|
1
|
+
{"version":3,"file":"progress.js","names":["ProgressPrimitive"],"sources":["../src/progress.tsx"],"sourcesContent":["\"use client\"\n\nimport * as React from \"react\"\nimport { Progress as ProgressPrimitive } from \"@base-ui/react/progress\"\n\nimport { cn } from \"./lib/utils\"\n\ntype ProgressProps = React.ComponentProps<typeof ProgressPrimitive.Root>\ntype ProgressTrackProps = React.ComponentProps<typeof ProgressPrimitive.Track>\ntype ProgressIndicatorProps = React.ComponentProps<typeof ProgressPrimitive.Indicator>\ntype ProgressLabelProps = React.ComponentProps<typeof ProgressPrimitive.Label>\ntype ProgressValueProps = React.ComponentProps<typeof ProgressPrimitive.Value>\n\nfunction Progress({ className, children, value, ...props }: ProgressProps) {\n return (\n <ProgressPrimitive.Root\n value={value}\n data-slot=\"progress\"\n className={cn(\"flex flex-wrap gap-3\", className)}\n {...props}\n >\n {children}\n <ProgressTrack>\n <ProgressIndicator />\n </ProgressTrack>\n </ProgressPrimitive.Root>\n )\n}\n\nfunction ProgressTrack({ className, ...props }: ProgressTrackProps) {\n return (\n <ProgressPrimitive.Track\n className={cn(\n \"bg-muted relative flex h-1 w-full items-center overflow-x-hidden rounded-full\",\n className\n )}\n data-slot=\"progress-track\"\n {...props}\n />\n )\n}\n\nfunction ProgressIndicator({ className, ...props }: ProgressIndicatorProps) {\n return (\n <ProgressPrimitive.Indicator\n data-slot=\"progress-indicator\"\n className={cn(\n \"bg-primary h-full transition-[width]\",\n className\n )}\n {...props}\n />\n )\n}\n\nfunction ProgressLabel({ className, ...props }: ProgressLabelProps) {\n return (\n <ProgressPrimitive.Label\n className={cn(\"text-sm font-medium\", className)}\n data-slot=\"progress-label\"\n {...props}\n />\n )\n}\n\nfunction ProgressValue({ className, ...props }: ProgressValueProps) {\n return (\n <ProgressPrimitive.Value\n className={cn(\n \"text-muted-foreground ml-auto text-sm tabular-nums\",\n className\n )}\n data-slot=\"progress-value\"\n {...props}\n />\n )\n}\n\nexport {\n Progress,\n ProgressTrack,\n ProgressIndicator,\n ProgressLabel,\n ProgressValue,\n}\n"],"mappings":";;;;;;AAaA,SAAS,SAAS,EAAE,WAAW,UAAU,OAAO,GAAG,SAAwB;AACzE,QACE,qBAACA,WAAkB,MAAnB;EACS;EACP,aAAU;EACV,WAAW,GAAG,wBAAwB,UAAU;EAChD,GAAI;YAJN,CAMG,UACD,oBAAC,eAAD,EAAA,UACE,oBAAC,mBAAD,EAAqB,CAAA,EACP,CAAA,CACO;;;AAI7B,SAAS,cAAc,EAAE,WAAW,GAAG,SAA6B;AAClE,QACE,oBAACA,WAAkB,OAAnB;EACE,WAAW,GACT,iFACA,UACD;EACD,aAAU;EACV,GAAI;EACJ,CAAA;;AAIN,SAAS,kBAAkB,EAAE,WAAW,GAAG,SAAiC;AAC1E,QACE,oBAACA,WAAkB,WAAnB;EACE,aAAU;EACV,WAAW,GACT,wCACA,UACD;EACD,GAAI;EACJ,CAAA;;AAIN,SAAS,cAAc,EAAE,WAAW,GAAG,SAA6B;AAClE,QACE,oBAACA,WAAkB,OAAnB;EACE,WAAW,GAAG,uBAAuB,UAAU;EAC/C,aAAU;EACV,GAAI;EACJ,CAAA;;AAIN,SAAS,cAAc,EAAE,WAAW,GAAG,SAA6B;AAClE,QACE,oBAACA,WAAkB,OAAnB;EACE,WAAW,GACT,sDACA,UACD;EACD,aAAU;EACV,GAAI;EACJ,CAAA"}
|
package/dist/sidebar.js
CHANGED
|
@@ -203,7 +203,7 @@ function SidebarRail({ className, ...props }) {
|
|
|
203
203
|
tabIndex: -1,
|
|
204
204
|
onClick: toggleSidebar,
|
|
205
205
|
title: "Toggle Sidebar",
|
|
206
|
-
className: cn("hover:after:bg-sidebar-border absolute inset-y-0 z-20 hidden w-4 -translate-x-1/2 transition-
|
|
206
|
+
className: cn("hover:after:bg-sidebar-border absolute inset-y-0 z-20 hidden w-4 -translate-x-1/2 transition-[left,right,transform] duration-200 ease-linear group-data-[side=left]:-right-4 group-data-[side=right]:left-0 after:absolute after:inset-y-0 after:left-1/2 after:w-[2px] sm:flex", "in-data-[side=left]:cursor-w-resize in-data-[side=right]:cursor-e-resize", "[[data-side=left][data-closed]_&]:cursor-e-resize [[data-side=right][data-closed]_&]:cursor-w-resize", "hover:group-data-[collapsible=offcanvas]:bg-sidebar group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full", "[[data-side=left][data-collapsible=offcanvas]_&]:-right-2", "[[data-side=right][data-collapsible=offcanvas]_&]:-left-2", className),
|
|
207
207
|
...props
|
|
208
208
|
});
|
|
209
209
|
}
|
package/dist/sidebar.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sidebar.js","names":["CollapsiblePrimitive"],"sources":["../src/sidebar.tsx"],"sourcesContent":["\"use client\"\n\nimport * as React from \"react\"\nimport { Collapsible as CollapsiblePrimitive } from \"@base-ui/react/collapsible\"\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\"\nimport { Button } from \"./button\"\nimport {\n Drawer,\n DrawerContent,\n DrawerDescription,\n DrawerHeader,\n DrawerTitle,\n} from \"./drawer\"\nimport { Input } from \"./input\"\nimport { Separator } from \"./separator\"\nimport { Skeleton } from \"./skeleton\"\nimport {\n Tooltip,\n TooltipContent,\n TooltipProvider,\n TooltipTrigger,\n} from \"./tooltip\"\nimport { useIsMobile } from \"./hooks/use-mobile\"\nimport { SidebarPanelIcon } from \"./lib/internal-icons\"\n\nconst SIDEBAR_WIDTH = \"16rem\"\nconst SIDEBAR_WIDTH_MOBILE = \"18rem\"\nconst SIDEBAR_WIDTH_ICON = \"3rem\"\nconst SIDEBAR_DEFAULT_KEYBOARD_SHORTCUT = \"b\"\n\n// ---------------------------------------------------------------------------\n// Persistence helpers — ready-made functions for the `persist` prop.\n// ---------------------------------------------------------------------------\n\n/**\n * Persist sidebar state to a cookie.\n *\n * @param name - Cookie name. Defaults to `\"sidebar-state\"`.\n * @param maxAge - Cookie max-age in seconds. Defaults to 7 days (604 800).\n *\n * @example\n * ```tsx\n * <SidebarProvider persist={cookiePersist()}>\n * <SidebarProvider persist={cookiePersist(\"my-sidebar\", 86400)}>\n * ```\n */\nfunction cookiePersist(name = \"sidebar-state\", maxAge = 60 * 60 * 24 * 7) {\n return (open: boolean) => {\n document.cookie = `${name}=${open}; path=/; max-age=${maxAge}`\n }\n}\n\n/**\n * Persist sidebar state to localStorage.\n *\n * @param key - Storage key. Defaults to `\"sidebar-state\"`.\n *\n * @example\n * ```tsx\n * <SidebarProvider persist={localStoragePersist()}>\n * <SidebarProvider persist={localStoragePersist(\"my-sidebar\")}>\n * ```\n */\nfunction localStoragePersist(key = \"sidebar-state\") {\n return (open: boolean) => {\n try {\n localStorage.setItem(key, String(open))\n } catch {\n // Storage full or unavailable (SSR, private browsing) — silently ignore.\n }\n }\n}\n\ntype SidebarContextProps = {\n state: \"expanded\" | \"collapsed\"\n open: boolean\n setOpen: (open: boolean) => void\n openMobile: boolean\n setOpenMobile: (open: boolean) => void\n isMobile: boolean\n toggleSidebar: () => void\n}\n\nconst SidebarContext = React.createContext<SidebarContextProps | null>(null)\n\nfunction useSidebar() {\n const context = React.useContext(SidebarContext)\n if (!context) {\n throw new Error(\"useSidebar must be used within a SidebarProvider.\")\n }\n\n return context\n}\n\nfunction SidebarProvider({\n defaultOpen = true,\n open: openProp,\n onOpenChange: setOpenProp,\n persist,\n keyboardShortcut = SIDEBAR_DEFAULT_KEYBOARD_SHORTCUT,\n mobileBreakpoint,\n className,\n style,\n children,\n ...props\n}: React.ComponentProps<\"div\"> & {\n defaultOpen?: boolean\n open?: boolean\n onOpenChange?: (open: boolean) => void\n /**\n * Optional callback to persist open state. Called on every toggle.\n * Use the built-in helpers `cookiePersist()` or `localStoragePersist()`,\n * or provide a custom function (e.g. server action).\n *\n * @example\n * ```tsx\n * <SidebarProvider persist={cookiePersist()}>\n * <SidebarProvider persist={localStoragePersist(\"sidebar\")}>\n * <SidebarProvider persist={(open) => saveToServer(open)}>\n * ```\n */\n persist?: (open: boolean) => void\n /** Key for Cmd/Ctrl+key toggle shortcut. Defaults to \"b\". Pass `false` to disable. */\n keyboardShortcut?: string | false\n /** Breakpoint (px) below which the sidebar uses a mobile drawer. Defaults to 768. */\n mobileBreakpoint?: number\n}) {\n const isMobile = useIsMobile(mobileBreakpoint)\n const [openMobile, setOpenMobile] = React.useState(false)\n\n const [_open, _setOpen] = React.useState(defaultOpen)\n const open = openProp ?? _open\n const persistRef = React.useRef(persist)\n persistRef.current = persist\n\n const setOpen = React.useCallback(\n (value: boolean | ((value: boolean) => boolean)) => {\n const openState = typeof value === \"function\" ? value(open) : value\n if (setOpenProp) {\n setOpenProp(openState)\n } else {\n _setOpen(openState)\n }\n\n persistRef.current?.(openState)\n },\n [setOpenProp, open]\n )\n\n const toggleSidebar = React.useCallback(() => {\n return isMobile ? setOpenMobile((open) => !open) : setOpen((open) => !open)\n }, [isMobile, setOpen, setOpenMobile])\n\n React.useEffect(() => {\n if (keyboardShortcut === false) return\n\n const handleKeyDown = (event: KeyboardEvent) => {\n if (\n event.key === keyboardShortcut &&\n (event.metaKey || event.ctrlKey)\n ) {\n event.preventDefault()\n toggleSidebar()\n }\n }\n\n window.addEventListener(\"keydown\", handleKeyDown)\n return () => window.removeEventListener(\"keydown\", handleKeyDown)\n }, [toggleSidebar, keyboardShortcut])\n\n // On mobile the sidebar renders as a full-width drawer, so always treat as expanded.\n const state = isMobile || open ? \"expanded\" : \"collapsed\"\n\n const contextValue = React.useMemo<SidebarContextProps>(\n () => ({\n state,\n open,\n setOpen,\n isMobile,\n openMobile,\n setOpenMobile,\n toggleSidebar,\n }),\n [state, open, setOpen, isMobile, openMobile, setOpenMobile, toggleSidebar]\n )\n\n return (\n <SidebarContext.Provider value={contextValue}>\n <div\n data-slot=\"sidebar-wrapper\"\n style={\n {\n \"--sidebar-width\": SIDEBAR_WIDTH,\n \"--sidebar-width-icon\": SIDEBAR_WIDTH_ICON,\n ...style,\n } as React.CSSProperties\n }\n className={cn(\n \"group/sidebar-wrapper has-data-[variant=inset]:bg-sidebar flex min-h-svh w-full\",\n className\n )}\n {...props}\n >\n {children}\n </div>\n </SidebarContext.Provider>\n )\n}\n\nfunction Sidebar({\n side = \"left\",\n variant = \"sidebar\",\n collapsible = \"offcanvas\",\n className,\n children,\n ...props\n}: React.ComponentProps<\"div\"> & {\n side?: \"left\" | \"right\"\n variant?: \"sidebar\" | \"floating\" | \"inset\"\n collapsible?: \"offcanvas\" | \"icon\" | \"none\"\n}) {\n const { isMobile, state, open, setOpen, openMobile, setOpenMobile } = useSidebar()\n\n if (collapsible === \"none\") {\n return (\n <div\n data-slot=\"sidebar\"\n className={cn(\n \"bg-sidebar text-sidebar-foreground flex h-full w-(--sidebar-width) flex-col\",\n className\n )}\n {...props}\n >\n {children}\n </div>\n )\n }\n\n if (isMobile) {\n return (\n <Drawer\n open={openMobile}\n onOpenChange={setOpenMobile}\n swipeDirection={side}\n >\n <DrawerContent\n data-slot=\"sidebar\"\n data-mobile=\"true\"\n className=\"bg-sidebar text-sidebar-foreground w-(--sidebar-width) max-w-none rounded-none border-0 p-0 sm:max-w-none\"\n style={\n {\n \"--sidebar-width\": SIDEBAR_WIDTH_MOBILE,\n } as React.CSSProperties\n }\n >\n <DrawerHeader className=\"sr-only\">\n <DrawerTitle>Sidebar</DrawerTitle>\n <DrawerDescription>Displays the mobile sidebar.</DrawerDescription>\n </DrawerHeader>\n <div className=\"flex h-full w-full flex-col\">{children}</div>\n </DrawerContent>\n </Drawer>\n )\n }\n\n return (\n <CollapsiblePrimitive.Root\n open={open}\n onOpenChange={setOpen}\n className=\"group peer text-sidebar-foreground hidden md:block\"\n data-collapsible={state === \"collapsed\" ? collapsible : \"\"}\n data-variant={variant}\n data-side={side}\n data-slot=\"sidebar\"\n >\n {/* This is what handles the sidebar gap on desktop */}\n <div\n data-slot=\"sidebar-gap\"\n className={cn(\n \"relative w-(--sidebar-width) bg-transparent transition-[width] duration-200 ease-linear\",\n \"group-data-[collapsible=offcanvas]:w-0\",\n \"group-data-[side=right]:rotate-180\",\n variant === \"floating\" || variant === \"inset\"\n ? \"group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]\"\n : \"group-data-[collapsible=icon]:w-(--sidebar-width-icon)\"\n )}\n />\n <div\n data-slot=\"sidebar-container\"\n className={cn(\n \"fixed inset-y-0 z-10 hidden h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear md:flex\",\n side === \"left\"\n ? \"left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]\"\n : \"right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]\",\n variant === \"floating\" || variant === \"inset\"\n ? \"p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]\"\n : \"group-data-[collapsible=icon]:w-(--sidebar-width-icon) after:absolute after:inset-y-0 after:w-px after:bg-sidebar-border\" + (side === \"left\" ? \" after:right-0\" : \" after:left-0\"),\n className\n )}\n {...props}\n >\n <TooltipProvider delay={0} closeDelay={300}>\n <div\n data-slot=\"sidebar-inner\"\n className=\"bg-sidebar group-data-[variant=floating]:ring-sidebar-border group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:shadow-sm group-data-[variant=floating]:ring-1 flex size-full flex-col\"\n >\n {children}\n </div>\n </TooltipProvider>\n </div>\n </CollapsiblePrimitive.Root>\n )\n}\n\nfunction SidebarTrigger({\n className,\n onClick,\n ...props\n}: React.ComponentProps<typeof Button>) {\n const { toggleSidebar } = useSidebar()\n\n return (\n <Button\n data-slot=\"sidebar-trigger\"\n variant=\"ghost\"\n size=\"icon-sm\"\n className={cn(className)}\n onClick={(event) => {\n onClick?.(event)\n toggleSidebar()\n }}\n {...props}\n >\n <SidebarPanelIcon />\n <span className=\"sr-only\">Toggle Sidebar</span>\n </Button>\n )\n}\n\nfunction SidebarRail({ className, ...props }: React.ComponentProps<\"button\">) {\n const { toggleSidebar } = useSidebar()\n\n return (\n <button\n data-slot=\"sidebar-rail\"\n aria-label=\"Toggle Sidebar\"\n tabIndex={-1}\n onClick={toggleSidebar}\n title=\"Toggle Sidebar\"\n className={cn(\n \"hover:after:bg-sidebar-border absolute inset-y-0 z-20 hidden w-4 -translate-x-1/2 transition-all ease-linear group-data-[side=left]:-right-4 group-data-[side=right]:left-0 after:absolute after:inset-y-0 after:left-1/2 after:w-[2px] sm:flex\",\n \"in-data-[side=left]:cursor-w-resize in-data-[side=right]:cursor-e-resize\",\n \"[[data-side=left][data-closed]_&]:cursor-e-resize [[data-side=right][data-closed]_&]:cursor-w-resize\",\n \"hover:group-data-[collapsible=offcanvas]:bg-sidebar group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full\",\n \"[[data-side=left][data-collapsible=offcanvas]_&]:-right-2\",\n \"[[data-side=right][data-collapsible=offcanvas]_&]:-left-2\",\n className\n )}\n {...props}\n />\n )\n}\n\nfunction SidebarInset({ className, ...props }: React.ComponentProps<\"main\">) {\n return (\n <main\n data-slot=\"sidebar-inset\"\n className={cn(\n \"bg-background md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow-sm md:peer-data-[variant=inset]:peer-data-[closed]:ml-2 relative flex min-w-0 w-full flex-1 flex-col\",\n className\n )}\n {...props}\n />\n )\n}\n\nfunction SidebarInput({\n className,\n ...props\n}: React.ComponentProps<typeof Input>) {\n return (\n <Input\n data-slot=\"sidebar-input\"\n className={cn(\"bg-background h-8 w-full shadow-none\", className)}\n {...props}\n />\n )\n}\n\nfunction SidebarHeader({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"sidebar-header\"\n className={cn(\"gap-2 p-2 flex flex-col\", className)}\n {...props}\n />\n )\n}\n\nfunction SidebarFooter({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"sidebar-footer\"\n className={cn(\"gap-2 p-2 flex flex-col\", className)}\n {...props}\n />\n )\n}\n\nfunction SidebarSeparator({\n className,\n ...props\n}: React.ComponentProps<typeof Separator>) {\n return (\n <Separator\n data-slot=\"sidebar-separator\"\n className={cn(\"bg-sidebar-border mx-2 data-[orientation=horizontal]:w-auto\", className)}\n {...props}\n />\n )\n}\n\nfunction SidebarContent({ className, style, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"sidebar-content\"\n className={cn(\n \"gap-1 flex min-h-0 flex-1 flex-col overflow-auto scrollbar-none group-data-[collapsible=icon]:overflow-x-hidden\",\n className\n )}\n style={{\n maskImage: \"linear-gradient(to bottom, black calc(100% - 44px), transparent 100%)\",\n WebkitMaskImage: \"linear-gradient(to bottom, black calc(100% - 44px), transparent 100%)\",\n ...style,\n }}\n {...props}\n />\n )\n}\n\nfunction SidebarGroup({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"sidebar-group\"\n className={cn(\n \"px-2 first:pt-2 last:pb-2 relative flex w-full min-w-0 flex-col\",\n className\n )}\n {...props}\n />\n )\n}\n\nfunction SidebarGroupLabel({\n className,\n render,\n ...props\n}: useRender.ComponentProps<\"div\"> & React.ComponentProps<\"div\">) {\n return useRender({\n defaultTagName: \"div\",\n props: mergeProps<\"div\">(\n {\n className: cn(\n \"text-sidebar-foreground/70 ring-sidebar-ring h-8 rounded-md px-2 text-xs font-medium group-data-[collapsible=icon]:hidden focus-visible:ring-2 [&>svg]:size-4 flex shrink-0 items-center outline-hidden [&>svg]:shrink-0\",\n className\n ),\n },\n props\n ),\n render,\n state: {\n slot: \"sidebar-group-label\",\n },\n })\n}\n\nfunction SidebarGroupAction({\n className,\n render,\n ...props\n}: useRender.ComponentProps<\"button\"> & React.ComponentProps<\"button\">) {\n return useRender({\n defaultTagName: \"button\",\n props: mergeProps<\"button\">(\n {\n className: cn(\n \"text-sidebar-foreground ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground absolute top-1.5 right-3 w-5 rounded-xs p-0 focus-visible:ring-2 [&>svg]:size-4 flex aspect-square items-center justify-center outline-hidden transition-transform [&>svg]:shrink-0 after:absolute after:-inset-2 md:after:hidden group-data-[collapsible=icon]:hidden\",\n className\n ),\n },\n props\n ),\n render,\n state: {\n slot: \"sidebar-group-action\",\n },\n })\n}\n\nfunction SidebarGroupContent({\n className,\n ...props\n}: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"sidebar-group-content\"\n className={cn(\"text-sm w-full\", className)}\n {...props}\n />\n )\n}\n\nfunction SidebarMenu({ className, ...props }: React.ComponentProps<\"ul\">) {\n return (\n <ul\n data-slot=\"sidebar-menu\"\n className={cn(\"gap-1 flex w-full min-w-0 flex-col\", className)}\n {...props}\n />\n )\n}\n\nfunction SidebarMenuItem({ className, ...props }: React.ComponentProps<\"li\">) {\n return (\n <li\n data-slot=\"sidebar-menu-item\"\n className={cn(\"group/menu-item relative has-data-[slot=sidebar-menu-sub]:mb-[-0.25rem]\", className)}\n {...props}\n />\n )\n}\n\nconst sidebarMenuButtonVariants = cva(\n \"ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground active:bg-sidebar-accent active:text-sidebar-accent-foreground data-active:bg-sidebar-accent data-active:text-sidebar-accent-foreground data-open:hover:bg-sidebar-accent data-open:hover:text-sidebar-accent-foreground gap-2 rounded-lg p-2 text-left text-sm transition-[width,height,padding] group-has-data-[slot=sidebar-menu-action]/menu-item:pr-8 group-data-[collapsible=icon]:w-full group-data-[collapsible=icon]:aspect-square group-data-[collapsible=icon]:h-11 focus-visible:ring-2 data-active:font-medium peer/menu-button flex w-full items-center overflow-hidden outline-hidden group/menu-button disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&>span:last-child]:truncate [&_svg]:shrink-0\",\n {\n variants: {\n variant: {\n default: \"hover:bg-sidebar-accent hover:text-sidebar-accent-foreground\",\n outline: \"bg-background hover:bg-sidebar-accent hover:text-sidebar-accent-foreground ring-1 ring-sidebar-border hover:ring-sidebar-accent\",\n },\n size: {\n default: \"h-11 text-sm\",\n sm: \"h-8 text-xs\",\n lg: \"h-12 text-sm\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n size: \"default\",\n },\n }\n)\n\nfunction SidebarMenuButton({\n render,\n isActive = false,\n variant = \"default\",\n size = \"default\",\n tooltip,\n className,\n ...props\n}: useRender.ComponentProps<\"button\"> &\n React.ComponentProps<\"button\"> & {\n isActive?: boolean\n tooltip?: string | React.ComponentProps<typeof TooltipContent>\n } & VariantProps<typeof sidebarMenuButtonVariants>) {\n const { isMobile, state } = useSidebar()\n\n if (process.env.NODE_ENV === \"development\" && tooltip && render) {\n console.warn(\n \"[SidebarMenuButton] Both `render` and `tooltip` were provided. \" +\n \"When `tooltip` is set, the button is wrapped in a TooltipTrigger and the `render` prop is ignored.\"\n )\n }\n\n const comp = useRender({\n defaultTagName: \"button\",\n props: mergeProps<\"button\">(\n {\n className: cn(sidebarMenuButtonVariants({ variant, size }), className),\n },\n props\n ),\n render: !tooltip ? render : TooltipTrigger,\n state: {\n slot: \"sidebar-menu-button\",\n size,\n active: isActive,\n },\n })\n\n if (!tooltip) {\n return comp\n }\n\n if (typeof tooltip === \"string\") {\n tooltip = {\n children: tooltip,\n }\n }\n\n return (\n <Tooltip>\n {comp}\n <TooltipContent\n side=\"right\"\n align=\"center\"\n hidden={state !== \"collapsed\" || isMobile}\n {...tooltip}\n />\n </Tooltip>\n )\n}\n\nfunction SidebarMenuAction({\n className,\n render,\n showOnHover = false,\n ...props\n}: useRender.ComponentProps<\"button\"> &\n React.ComponentProps<\"button\"> & {\n showOnHover?: boolean\n }) {\n return useRender({\n defaultTagName: \"button\",\n props: mergeProps<\"button\">(\n {\n className: cn(\n \"text-sidebar-foreground ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground peer-hover/menu-button:text-sidebar-accent-foreground absolute top-1/2 -translate-y-1/2 right-1 aspect-square w-5 rounded-xs p-0 focus-visible:ring-2 [&>svg]:size-4 flex items-center justify-center outline-hidden transition-transform group-data-[collapsible=icon]:hidden after:absolute after:-inset-2 md:after:hidden [&>svg]:shrink-0\",\n showOnHover &&\n \"peer-data-active/menu-button:text-sidebar-accent-foreground group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 data-open:opacity-100 md:opacity-0\",\n className\n ),\n },\n props\n ),\n render,\n state: {\n slot: \"sidebar-menu-action\",\n },\n })\n}\n\nfunction SidebarMenuBadge({\n className,\n ...props\n}: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"sidebar-menu-badge\"\n className={cn(\n \"text-sidebar-foreground peer-hover/menu-button:text-sidebar-accent-foreground peer-data-active/menu-button:text-sidebar-accent-foreground pointer-events-none absolute right-1 top-1/2 -translate-y-1/2 flex h-5 min-w-5 items-center justify-center rounded-md px-1 text-xs font-medium tabular-nums select-none group-data-[collapsible=icon]:hidden\",\n className\n )}\n {...props}\n />\n )\n}\n\nfunction SidebarMenuSkeleton({\n className,\n showIcon = false,\n ...props\n}: React.ComponentProps<\"div\"> & {\n showIcon?: boolean\n}) {\n const [width] = React.useState(() => {\n return `${Math.floor(Math.random() * 40) + 50}%`\n })\n\n return (\n <div\n data-slot=\"sidebar-menu-skeleton\"\n className={cn(\"h-8 gap-2 rounded-md px-2 flex items-center\", className)}\n {...props}\n >\n {showIcon && (\n <Skeleton className=\"size-4 rounded-md\" />\n )}\n <Skeleton\n className=\"h-4 max-w-(--skeleton-width) flex-1\"\n style={\n {\n \"--skeleton-width\": width,\n } as React.CSSProperties\n }\n />\n </div>\n )\n}\n\nfunction SidebarMenuSub({ className, ...props }: React.ComponentProps<\"ul\">) {\n return (\n <ul\n data-slot=\"sidebar-menu-sub\"\n className={cn(\"border-sidebar-border ml-3.5 mr-0 translate-x-px gap-0.5 border-l pl-2.5 pr-0 py-0.5 group-data-[collapsible=icon]:hidden flex min-w-0 flex-col\", className)}\n {...props}\n />\n )\n}\n\nfunction SidebarMenuSubItem({\n className,\n ...props\n}: React.ComponentProps<\"li\">) {\n return (\n <li\n data-slot=\"sidebar-menu-sub-item\"\n className={cn(\"group/menu-sub-item relative\", className)}\n {...props}\n />\n )\n}\n\nfunction SidebarMenuSubButton({\n render,\n size = \"md\",\n isActive = false,\n className,\n ...props\n}: useRender.ComponentProps<\"a\"> &\n React.ComponentProps<\"a\"> & {\n size?: \"sm\" | \"md\"\n isActive?: boolean\n }) {\n return useRender({\n defaultTagName: \"a\",\n props: mergeProps<\"a\">(\n {\n className: cn(\n \"text-sidebar-foreground ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground active:bg-sidebar-accent active:text-sidebar-accent-foreground [&>svg]:text-sidebar-accent-foreground data-active:bg-sidebar-accent data-active:text-sidebar-accent-foreground h-7 gap-2 rounded-md px-2 focus-visible:ring-2 data-[size=md]:text-sm data-[size=sm]:text-xs [&>svg]:size-4 flex min-w-0 -translate-x-px items-center overflow-hidden outline-hidden group-data-[collapsible=icon]:hidden disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&>span:last-child]:truncate [&>svg]:shrink-0\",\n className\n ),\n },\n props\n ),\n render,\n state: {\n slot: \"sidebar-menu-sub-button\",\n size,\n active: isActive,\n },\n })\n}\n\nexport {\n cookiePersist,\n localStoragePersist,\n Sidebar,\n SidebarContent,\n SidebarFooter,\n SidebarGroup,\n SidebarGroupAction,\n SidebarGroupContent,\n SidebarGroupLabel,\n SidebarHeader,\n SidebarInput,\n SidebarInset,\n SidebarMenu,\n SidebarMenuAction,\n SidebarMenuBadge,\n SidebarMenuButton,\n SidebarMenuItem,\n SidebarMenuSkeleton,\n SidebarMenuSub,\n SidebarMenuSubButton,\n SidebarMenuSubItem,\n SidebarProvider,\n SidebarRail,\n SidebarSeparator,\n SidebarTrigger,\n useSidebar,\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AA6BA,MAAM,gBAAgB;AACtB,MAAM,uBAAuB;AAC7B,MAAM,qBAAqB;AAC3B,MAAM,oCAAoC;;;;;;;;;;;;;AAkB1C,SAAS,cAAc,OAAO,iBAAiB,SAAS,OAAU,KAAK,GAAG;AACxE,SAAQ,SAAkB;AACxB,WAAS,SAAS,GAAG,KAAK,GAAG,KAAK,oBAAoB;;;;;;;;;;;;;;AAe1D,SAAS,oBAAoB,MAAM,iBAAiB;AAClD,SAAQ,SAAkB;AACxB,MAAI;AACF,gBAAa,QAAQ,KAAK,OAAO,KAAK,CAAC;UACjC;;;AAgBZ,MAAM,iBAAiB,MAAM,cAA0C,KAAK;AAE5E,SAAS,aAAa;CACpB,MAAM,UAAU,MAAM,WAAW,eAAe;AAChD,KAAI,CAAC,QACH,OAAM,IAAI,MAAM,oDAAoD;AAGtE,QAAO;;AAGT,SAAS,gBAAgB,EACvB,cAAc,MACd,MAAM,UACN,cAAc,aACd,SACA,mBAAmB,mCACnB,kBACA,WACA,OACA,UACA,GAAG,SAsBF;CACD,MAAM,WAAW,YAAY,iBAAiB;CAC9C,MAAM,CAAC,YAAY,iBAAiB,MAAM,SAAS,MAAM;CAEzD,MAAM,CAAC,OAAO,YAAY,MAAM,SAAS,YAAY;CACrD,MAAM,OAAO,YAAY;CACzB,MAAM,aAAa,MAAM,OAAO,QAAQ;AACxC,YAAW,UAAU;CAErB,M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AG,SAC0B;AAC7B,QACE,oBAAC,MAAD;EACE,aAAU;EACV,WAAW,GAAG,gCAAgC,UAAU;EACxD,GAAI;EACJ,CAAA;;AAIN,SAAS,qBAAqB,EAC5B,QACA,OAAO,MACP,WAAW,OACX,WACA,GAAG,SAKA;AACH,QAAO,UAAU;EACf,gBAAgB;EAChB,OAAO,WACL,EACE,WAAW,GACT,6oBACA,UACD,EACF,EACD,MACD;EACD;EACA,OAAO;GACL,MAAM;GACN;GACA,QAAQ;GACT;EACF,CAAC"}
|
|
1
|
+
{"version":3,"file":"sidebar.js","names":["CollapsiblePrimitive"],"sources":["../src/sidebar.tsx"],"sourcesContent":["\"use client\"\n\nimport * as React from \"react\"\nimport { Collapsible as CollapsiblePrimitive } from \"@base-ui/react/collapsible\"\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\"\nimport { Button } from \"./button\"\nimport {\n Drawer,\n DrawerContent,\n DrawerDescription,\n DrawerHeader,\n DrawerTitle,\n} from \"./drawer\"\nimport { Input } from \"./input\"\nimport { Separator } from \"./separator\"\nimport { Skeleton } from \"./skeleton\"\nimport {\n Tooltip,\n TooltipContent,\n TooltipProvider,\n TooltipTrigger,\n} from \"./tooltip\"\nimport { useIsMobile } from \"./hooks/use-mobile\"\nimport { SidebarPanelIcon } from \"./lib/internal-icons\"\n\nconst SIDEBAR_WIDTH = \"16rem\"\nconst SIDEBAR_WIDTH_MOBILE = \"18rem\"\nconst SIDEBAR_WIDTH_ICON = \"3rem\"\nconst SIDEBAR_DEFAULT_KEYBOARD_SHORTCUT = \"b\"\n\n// ---------------------------------------------------------------------------\n// Persistence helpers — ready-made functions for the `persist` prop.\n// ---------------------------------------------------------------------------\n\n/**\n * Persist sidebar state to a cookie.\n *\n * @param name - Cookie name. Defaults to `\"sidebar-state\"`.\n * @param maxAge - Cookie max-age in seconds. Defaults to 7 days (604 800).\n *\n * @example\n * ```tsx\n * <SidebarProvider persist={cookiePersist()}>\n * <SidebarProvider persist={cookiePersist(\"my-sidebar\", 86400)}>\n * ```\n */\nfunction cookiePersist(name = \"sidebar-state\", maxAge = 60 * 60 * 24 * 7) {\n return (open: boolean) => {\n document.cookie = `${name}=${open}; path=/; max-age=${maxAge}`\n }\n}\n\n/**\n * Persist sidebar state to localStorage.\n *\n * @param key - Storage key. Defaults to `\"sidebar-state\"`.\n *\n * @example\n * ```tsx\n * <SidebarProvider persist={localStoragePersist()}>\n * <SidebarProvider persist={localStoragePersist(\"my-sidebar\")}>\n * ```\n */\nfunction localStoragePersist(key = \"sidebar-state\") {\n return (open: boolean) => {\n try {\n localStorage.setItem(key, String(open))\n } catch {\n // Storage full or unavailable (SSR, private browsing) — silently ignore.\n }\n }\n}\n\ntype SidebarContextProps = {\n state: \"expanded\" | \"collapsed\"\n open: boolean\n setOpen: (open: boolean) => void\n openMobile: boolean\n setOpenMobile: (open: boolean) => void\n isMobile: boolean\n toggleSidebar: () => void\n}\n\nconst SidebarContext = React.createContext<SidebarContextProps | null>(null)\n\nfunction useSidebar() {\n const context = React.useContext(SidebarContext)\n if (!context) {\n throw new Error(\"useSidebar must be used within a SidebarProvider.\")\n }\n\n return context\n}\n\nfunction SidebarProvider({\n defaultOpen = true,\n open: openProp,\n onOpenChange: setOpenProp,\n persist,\n keyboardShortcut = SIDEBAR_DEFAULT_KEYBOARD_SHORTCUT,\n mobileBreakpoint,\n className,\n style,\n children,\n ...props\n}: React.ComponentProps<\"div\"> & {\n defaultOpen?: boolean\n open?: boolean\n onOpenChange?: (open: boolean) => void\n /**\n * Optional callback to persist open state. Called on every toggle.\n * Use the built-in helpers `cookiePersist()` or `localStoragePersist()`,\n * or provide a custom function (e.g. server action).\n *\n * @example\n * ```tsx\n * <SidebarProvider persist={cookiePersist()}>\n * <SidebarProvider persist={localStoragePersist(\"sidebar\")}>\n * <SidebarProvider persist={(open) => saveToServer(open)}>\n * ```\n */\n persist?: (open: boolean) => void\n /** Key for Cmd/Ctrl+key toggle shortcut. Defaults to \"b\". Pass `false` to disable. */\n keyboardShortcut?: string | false\n /** Breakpoint (px) below which the sidebar uses a mobile drawer. Defaults to 768. */\n mobileBreakpoint?: number\n}) {\n const isMobile = useIsMobile(mobileBreakpoint)\n const [openMobile, setOpenMobile] = React.useState(false)\n\n const [_open, _setOpen] = React.useState(defaultOpen)\n const open = openProp ?? _open\n const persistRef = React.useRef(persist)\n persistRef.current = persist\n\n const setOpen = React.useCallback(\n (value: boolean | ((value: boolean) => boolean)) => {\n const openState = typeof value === \"function\" ? value(open) : value\n if (setOpenProp) {\n setOpenProp(openState)\n } else {\n _setOpen(openState)\n }\n\n persistRef.current?.(openState)\n },\n [setOpenProp, open]\n )\n\n const toggleSidebar = React.useCallback(() => {\n return isMobile ? setOpenMobile((open) => !open) : setOpen((open) => !open)\n }, [isMobile, setOpen, setOpenMobile])\n\n React.useEffect(() => {\n if (keyboardShortcut === false) return\n\n const handleKeyDown = (event: KeyboardEvent) => {\n if (\n event.key === keyboardShortcut &&\n (event.metaKey || event.ctrlKey)\n ) {\n event.preventDefault()\n toggleSidebar()\n }\n }\n\n window.addEventListener(\"keydown\", handleKeyDown)\n return () => window.removeEventListener(\"keydown\", handleKeyDown)\n }, [toggleSidebar, keyboardShortcut])\n\n // On mobile the sidebar renders as a full-width drawer, so always treat as expanded.\n const state = isMobile || open ? \"expanded\" : \"collapsed\"\n\n const contextValue = React.useMemo<SidebarContextProps>(\n () => ({\n state,\n open,\n setOpen,\n isMobile,\n openMobile,\n setOpenMobile,\n toggleSidebar,\n }),\n [state, open, setOpen, isMobile, openMobile, setOpenMobile, toggleSidebar]\n )\n\n return (\n <SidebarContext.Provider value={contextValue}>\n <div\n data-slot=\"sidebar-wrapper\"\n style={\n {\n \"--sidebar-width\": SIDEBAR_WIDTH,\n \"--sidebar-width-icon\": SIDEBAR_WIDTH_ICON,\n ...style,\n } as React.CSSProperties\n }\n className={cn(\n \"group/sidebar-wrapper has-data-[variant=inset]:bg-sidebar flex min-h-svh w-full\",\n className\n )}\n {...props}\n >\n {children}\n </div>\n </SidebarContext.Provider>\n )\n}\n\nfunction Sidebar({\n side = \"left\",\n variant = \"sidebar\",\n collapsible = \"offcanvas\",\n className,\n children,\n ...props\n}: React.ComponentProps<\"div\"> & {\n side?: \"left\" | \"right\"\n variant?: \"sidebar\" | \"floating\" | \"inset\"\n collapsible?: \"offcanvas\" | \"icon\" | \"none\"\n}) {\n const { isMobile, state, open, setOpen, openMobile, setOpenMobile } = useSidebar()\n\n if (collapsible === \"none\") {\n return (\n <div\n data-slot=\"sidebar\"\n className={cn(\n \"bg-sidebar text-sidebar-foreground flex h-full w-(--sidebar-width) flex-col\",\n className\n )}\n {...props}\n >\n {children}\n </div>\n )\n }\n\n if (isMobile) {\n return (\n <Drawer\n open={openMobile}\n onOpenChange={setOpenMobile}\n swipeDirection={side}\n >\n <DrawerContent\n data-slot=\"sidebar\"\n data-mobile=\"true\"\n className=\"bg-sidebar text-sidebar-foreground w-(--sidebar-width) max-w-none rounded-none border-0 p-0 sm:max-w-none\"\n style={\n {\n \"--sidebar-width\": SIDEBAR_WIDTH_MOBILE,\n } as React.CSSProperties\n }\n >\n <DrawerHeader className=\"sr-only\">\n <DrawerTitle>Sidebar</DrawerTitle>\n <DrawerDescription>Displays the mobile sidebar.</DrawerDescription>\n </DrawerHeader>\n <div className=\"flex h-full w-full flex-col\">{children}</div>\n </DrawerContent>\n </Drawer>\n )\n }\n\n return (\n <CollapsiblePrimitive.Root\n open={open}\n onOpenChange={setOpen}\n className=\"group peer text-sidebar-foreground hidden md:block\"\n data-collapsible={state === \"collapsed\" ? collapsible : \"\"}\n data-variant={variant}\n data-side={side}\n data-slot=\"sidebar\"\n >\n {/* This is what handles the sidebar gap on desktop */}\n <div\n data-slot=\"sidebar-gap\"\n className={cn(\n \"relative w-(--sidebar-width) bg-transparent transition-[width] duration-200 ease-linear\",\n \"group-data-[collapsible=offcanvas]:w-0\",\n \"group-data-[side=right]:rotate-180\",\n variant === \"floating\" || variant === \"inset\"\n ? \"group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]\"\n : \"group-data-[collapsible=icon]:w-(--sidebar-width-icon)\"\n )}\n />\n <div\n data-slot=\"sidebar-container\"\n className={cn(\n \"fixed inset-y-0 z-10 hidden h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear md:flex\",\n side === \"left\"\n ? \"left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]\"\n : \"right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]\",\n variant === \"floating\" || variant === \"inset\"\n ? \"p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]\"\n : \"group-data-[collapsible=icon]:w-(--sidebar-width-icon) after:absolute after:inset-y-0 after:w-px after:bg-sidebar-border\" + (side === \"left\" ? \" after:right-0\" : \" after:left-0\"),\n className\n )}\n {...props}\n >\n <TooltipProvider delay={0} closeDelay={300}>\n <div\n data-slot=\"sidebar-inner\"\n className=\"bg-sidebar group-data-[variant=floating]:ring-sidebar-border group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:shadow-sm group-data-[variant=floating]:ring-1 flex size-full flex-col\"\n >\n {children}\n </div>\n </TooltipProvider>\n </div>\n </CollapsiblePrimitive.Root>\n )\n}\n\nfunction SidebarTrigger({\n className,\n onClick,\n ...props\n}: React.ComponentProps<typeof Button>) {\n const { toggleSidebar } = useSidebar()\n\n return (\n <Button\n data-slot=\"sidebar-trigger\"\n variant=\"ghost\"\n size=\"icon-sm\"\n className={cn(className)}\n onClick={(event) => {\n onClick?.(event)\n toggleSidebar()\n }}\n {...props}\n >\n <SidebarPanelIcon />\n <span className=\"sr-only\">Toggle Sidebar</span>\n </Button>\n )\n}\n\nfunction SidebarRail({ className, ...props }: React.ComponentProps<\"button\">) {\n const { toggleSidebar } = useSidebar()\n\n return (\n <button\n data-slot=\"sidebar-rail\"\n aria-label=\"Toggle Sidebar\"\n tabIndex={-1}\n onClick={toggleSidebar}\n title=\"Toggle Sidebar\"\n className={cn(\n \"hover:after:bg-sidebar-border absolute inset-y-0 z-20 hidden w-4 -translate-x-1/2 transition-[left,right,transform] duration-200 ease-linear group-data-[side=left]:-right-4 group-data-[side=right]:left-0 after:absolute after:inset-y-0 after:left-1/2 after:w-[2px] sm:flex\",\n \"in-data-[side=left]:cursor-w-resize in-data-[side=right]:cursor-e-resize\",\n \"[[data-side=left][data-closed]_&]:cursor-e-resize [[data-side=right][data-closed]_&]:cursor-w-resize\",\n \"hover:group-data-[collapsible=offcanvas]:bg-sidebar group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full\",\n \"[[data-side=left][data-collapsible=offcanvas]_&]:-right-2\",\n \"[[data-side=right][data-collapsible=offcanvas]_&]:-left-2\",\n className\n )}\n {...props}\n />\n )\n}\n\nfunction SidebarInset({ className, ...props }: React.ComponentProps<\"main\">) {\n return (\n <main\n data-slot=\"sidebar-inset\"\n className={cn(\n \"bg-background md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow-sm md:peer-data-[variant=inset]:peer-data-[closed]:ml-2 relative flex min-w-0 w-full flex-1 flex-col\",\n className\n )}\n {...props}\n />\n )\n}\n\nfunction SidebarInput({\n className,\n ...props\n}: React.ComponentProps<typeof Input>) {\n return (\n <Input\n data-slot=\"sidebar-input\"\n className={cn(\"bg-background h-8 w-full shadow-none\", className)}\n {...props}\n />\n )\n}\n\nfunction SidebarHeader({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"sidebar-header\"\n className={cn(\"gap-2 p-2 flex flex-col\", className)}\n {...props}\n />\n )\n}\n\nfunction SidebarFooter({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"sidebar-footer\"\n className={cn(\"gap-2 p-2 flex flex-col\", className)}\n {...props}\n />\n )\n}\n\nfunction SidebarSeparator({\n className,\n ...props\n}: React.ComponentProps<typeof Separator>) {\n return (\n <Separator\n data-slot=\"sidebar-separator\"\n className={cn(\"bg-sidebar-border mx-2 data-[orientation=horizontal]:w-auto\", className)}\n {...props}\n />\n )\n}\n\nfunction SidebarContent({ className, style, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"sidebar-content\"\n className={cn(\n \"gap-1 flex min-h-0 flex-1 flex-col overflow-auto scrollbar-none group-data-[collapsible=icon]:overflow-x-hidden\",\n className\n )}\n style={{\n maskImage: \"linear-gradient(to bottom, black calc(100% - 44px), transparent 100%)\",\n WebkitMaskImage: \"linear-gradient(to bottom, black calc(100% - 44px), transparent 100%)\",\n ...style,\n }}\n {...props}\n />\n )\n}\n\nfunction SidebarGroup({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"sidebar-group\"\n className={cn(\n \"px-2 first:pt-2 last:pb-2 relative flex w-full min-w-0 flex-col\",\n className\n )}\n {...props}\n />\n )\n}\n\nfunction SidebarGroupLabel({\n className,\n render,\n ...props\n}: useRender.ComponentProps<\"div\"> & React.ComponentProps<\"div\">) {\n return useRender({\n defaultTagName: \"div\",\n props: mergeProps<\"div\">(\n {\n className: cn(\n \"text-sidebar-foreground/70 ring-sidebar-ring h-8 rounded-md px-2 text-xs font-medium group-data-[collapsible=icon]:hidden focus-visible:ring-2 [&>svg]:size-4 flex shrink-0 items-center outline-hidden [&>svg]:shrink-0\",\n className\n ),\n },\n props\n ),\n render,\n state: {\n slot: \"sidebar-group-label\",\n },\n })\n}\n\nfunction SidebarGroupAction({\n className,\n render,\n ...props\n}: useRender.ComponentProps<\"button\"> & React.ComponentProps<\"button\">) {\n return useRender({\n defaultTagName: \"button\",\n props: mergeProps<\"button\">(\n {\n className: cn(\n \"text-sidebar-foreground ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground absolute top-1.5 right-3 w-5 rounded-xs p-0 focus-visible:ring-2 [&>svg]:size-4 flex aspect-square items-center justify-center outline-hidden transition-transform [&>svg]:shrink-0 after:absolute after:-inset-2 md:after:hidden group-data-[collapsible=icon]:hidden\",\n className\n ),\n },\n props\n ),\n render,\n state: {\n slot: \"sidebar-group-action\",\n },\n })\n}\n\nfunction SidebarGroupContent({\n className,\n ...props\n}: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"sidebar-group-content\"\n className={cn(\"text-sm w-full\", className)}\n {...props}\n />\n )\n}\n\nfunction SidebarMenu({ className, ...props }: React.ComponentProps<\"ul\">) {\n return (\n <ul\n data-slot=\"sidebar-menu\"\n className={cn(\"gap-1 flex w-full min-w-0 flex-col\", className)}\n {...props}\n />\n )\n}\n\nfunction SidebarMenuItem({ className, ...props }: React.ComponentProps<\"li\">) {\n return (\n <li\n data-slot=\"sidebar-menu-item\"\n className={cn(\"group/menu-item relative has-data-[slot=sidebar-menu-sub]:mb-[-0.25rem]\", className)}\n {...props}\n />\n )\n}\n\nconst sidebarMenuButtonVariants = cva(\n \"ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground active:bg-sidebar-accent active:text-sidebar-accent-foreground data-active:bg-sidebar-accent data-active:text-sidebar-accent-foreground data-open:hover:bg-sidebar-accent data-open:hover:text-sidebar-accent-foreground gap-2 rounded-lg p-2 text-left text-sm transition-[width,height,padding] group-has-data-[slot=sidebar-menu-action]/menu-item:pr-8 group-data-[collapsible=icon]:w-full group-data-[collapsible=icon]:aspect-square group-data-[collapsible=icon]:h-11 focus-visible:ring-2 data-active:font-medium peer/menu-button flex w-full items-center overflow-hidden outline-hidden group/menu-button disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&>span:last-child]:truncate [&_svg]:shrink-0\",\n {\n variants: {\n variant: {\n default: \"hover:bg-sidebar-accent hover:text-sidebar-accent-foreground\",\n outline: \"bg-background hover:bg-sidebar-accent hover:text-sidebar-accent-foreground ring-1 ring-sidebar-border hover:ring-sidebar-accent\",\n },\n size: {\n default: \"h-11 text-sm\",\n sm: \"h-8 text-xs\",\n lg: \"h-12 text-sm\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n size: \"default\",\n },\n }\n)\n\nfunction SidebarMenuButton({\n render,\n isActive = false,\n variant = \"default\",\n size = \"default\",\n tooltip,\n className,\n ...props\n}: useRender.ComponentProps<\"button\"> &\n React.ComponentProps<\"button\"> & {\n isActive?: boolean\n tooltip?: string | React.ComponentProps<typeof TooltipContent>\n } & VariantProps<typeof sidebarMenuButtonVariants>) {\n const { isMobile, state } = useSidebar()\n\n if (process.env.NODE_ENV === \"development\" && tooltip && render) {\n console.warn(\n \"[SidebarMenuButton] Both `render` and `tooltip` were provided. \" +\n \"When `tooltip` is set, the button is wrapped in a TooltipTrigger and the `render` prop is ignored.\"\n )\n }\n\n const comp = useRender({\n defaultTagName: \"button\",\n props: mergeProps<\"button\">(\n {\n className: cn(sidebarMenuButtonVariants({ variant, size }), className),\n },\n props\n ),\n render: !tooltip ? render : TooltipTrigger,\n state: {\n slot: \"sidebar-menu-button\",\n size,\n active: isActive,\n },\n })\n\n if (!tooltip) {\n return comp\n }\n\n if (typeof tooltip === \"string\") {\n tooltip = {\n children: tooltip,\n }\n }\n\n return (\n <Tooltip>\n {comp}\n <TooltipContent\n side=\"right\"\n align=\"center\"\n hidden={state !== \"collapsed\" || isMobile}\n {...tooltip}\n />\n </Tooltip>\n )\n}\n\nfunction SidebarMenuAction({\n className,\n render,\n showOnHover = false,\n ...props\n}: useRender.ComponentProps<\"button\"> &\n React.ComponentProps<\"button\"> & {\n showOnHover?: boolean\n }) {\n return useRender({\n defaultTagName: \"button\",\n props: mergeProps<\"button\">(\n {\n className: cn(\n \"text-sidebar-foreground ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground peer-hover/menu-button:text-sidebar-accent-foreground absolute top-1/2 -translate-y-1/2 right-1 aspect-square w-5 rounded-xs p-0 focus-visible:ring-2 [&>svg]:size-4 flex items-center justify-center outline-hidden transition-transform group-data-[collapsible=icon]:hidden after:absolute after:-inset-2 md:after:hidden [&>svg]:shrink-0\",\n showOnHover &&\n \"peer-data-active/menu-button:text-sidebar-accent-foreground group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 data-open:opacity-100 md:opacity-0\",\n className\n ),\n },\n props\n ),\n render,\n state: {\n slot: \"sidebar-menu-action\",\n },\n })\n}\n\nfunction SidebarMenuBadge({\n className,\n ...props\n}: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"sidebar-menu-badge\"\n className={cn(\n \"text-sidebar-foreground peer-hover/menu-button:text-sidebar-accent-foreground peer-data-active/menu-button:text-sidebar-accent-foreground pointer-events-none absolute right-1 top-1/2 -translate-y-1/2 flex h-5 min-w-5 items-center justify-center rounded-md px-1 text-xs font-medium tabular-nums select-none group-data-[collapsible=icon]:hidden\",\n className\n )}\n {...props}\n />\n )\n}\n\nfunction SidebarMenuSkeleton({\n className,\n showIcon = false,\n ...props\n}: React.ComponentProps<\"div\"> & {\n showIcon?: boolean\n}) {\n const [width] = React.useState(() => {\n return `${Math.floor(Math.random() * 40) + 50}%`\n })\n\n return (\n <div\n data-slot=\"sidebar-menu-skeleton\"\n className={cn(\"h-8 gap-2 rounded-md px-2 flex items-center\", className)}\n {...props}\n >\n {showIcon && (\n <Skeleton className=\"size-4 rounded-md\" />\n )}\n <Skeleton\n className=\"h-4 max-w-(--skeleton-width) flex-1\"\n style={\n {\n \"--skeleton-width\": width,\n } as React.CSSProperties\n }\n />\n </div>\n )\n}\n\nfunction SidebarMenuSub({ className, ...props }: React.ComponentProps<\"ul\">) {\n return (\n <ul\n data-slot=\"sidebar-menu-sub\"\n className={cn(\"border-sidebar-border ml-3.5 mr-0 translate-x-px gap-0.5 border-l pl-2.5 pr-0 py-0.5 group-data-[collapsible=icon]:hidden flex min-w-0 flex-col\", className)}\n {...props}\n />\n )\n}\n\nfunction SidebarMenuSubItem({\n className,\n ...props\n}: React.ComponentProps<\"li\">) {\n return (\n <li\n data-slot=\"sidebar-menu-sub-item\"\n className={cn(\"group/menu-sub-item relative\", className)}\n {...props}\n />\n )\n}\n\nfunction SidebarMenuSubButton({\n render,\n size = \"md\",\n isActive = false,\n className,\n ...props\n}: useRender.ComponentProps<\"a\"> &\n React.ComponentProps<\"a\"> & {\n size?: \"sm\" | \"md\"\n isActive?: boolean\n }) {\n return useRender({\n defaultTagName: \"a\",\n props: mergeProps<\"a\">(\n {\n className: cn(\n \"text-sidebar-foreground ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground active:bg-sidebar-accent active:text-sidebar-accent-foreground [&>svg]:text-sidebar-accent-foreground data-active:bg-sidebar-accent data-active:text-sidebar-accent-foreground h-7 gap-2 rounded-md px-2 focus-visible:ring-2 data-[size=md]:text-sm data-[size=sm]:text-xs [&>svg]:size-4 flex min-w-0 -translate-x-px items-center overflow-hidden outline-hidden group-data-[collapsible=icon]:hidden disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&>span:last-child]:truncate [&>svg]:shrink-0\",\n className\n ),\n },\n props\n ),\n render,\n state: {\n slot: \"sidebar-menu-sub-button\",\n size,\n active: isActive,\n },\n })\n}\n\nexport {\n cookiePersist,\n localStoragePersist,\n Sidebar,\n SidebarContent,\n SidebarFooter,\n SidebarGroup,\n SidebarGroupAction,\n SidebarGroupContent,\n SidebarGroupLabel,\n SidebarHeader,\n SidebarInput,\n SidebarInset,\n SidebarMenu,\n SidebarMenuAction,\n SidebarMenuBadge,\n SidebarMenuButton,\n SidebarMenuItem,\n SidebarMenuSkeleton,\n SidebarMenuSub,\n SidebarMenuSubButton,\n SidebarMenuSubItem,\n SidebarProvider,\n SidebarRail,\n SidebarSeparator,\n SidebarTrigger,\n useSidebar,\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AA6BA,MAAM,gBAAgB;AACtB,MAAM,uBAAuB;AA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|
+
* @waveso/ui — fully self-contained styles entry.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
4
|
+
* In your app's CSS entry, import Tailwind, then this file:
|
|
5
5
|
*
|
|
6
|
-
* @import '@waveso/ui/styles.css';
|
|
7
6
|
* @import 'tailwindcss';
|
|
7
|
+
* @import '@waveso/ui/styles.css';
|
|
8
8
|
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
9
|
+
* This brings the `tw-animate-css` keyframe utilities the components
|
|
10
|
+
* rely on, the `dark` variant, every theme token (override in your own
|
|
11
|
+
* :root / .dark), motion tokens + recipes, and the `@source` rule. No
|
|
12
|
+
* other library-related imports needed.
|
|
11
13
|
*/
|
|
12
14
|
|
|
15
|
+
/* Keyframe animation utilities used by popup components
|
|
16
|
+
* (`data-open:animate-in`, `fade-in-0`, `zoom-in-95`, etc.). */
|
|
17
|
+
@import "tw-animate-css";
|
|
18
|
+
|
|
13
19
|
/* Auto-register component source files so Tailwind generates CSS for all
|
|
14
20
|
* utility classes used by @waveso/ui components. Resolves relative to this
|
|
15
21
|
* file's location in node_modules/@waveso/ui/dist/. */
|
|
16
22
|
@source "./";
|
|
17
23
|
|
|
24
|
+
/* Tailwind v4 `dark:` variant — applied when any ancestor has `.dark`. */
|
|
25
|
+
@custom-variant dark (&:is(.dark *));
|
|
26
|
+
|
|
18
27
|
/* ---------------------------------------------------------------------------
|
|
19
28
|
* Light theme (default)
|
|
20
29
|
* ------------------------------------------------------------------------- */
|
|
@@ -74,10 +83,29 @@
|
|
|
74
83
|
/* Radius */
|
|
75
84
|
--radius: 0.625rem;
|
|
76
85
|
|
|
86
|
+
/* Typography — sensible default stacks; override in your own :root
|
|
87
|
+
* to swap the library's typeface globally. The `@theme inline` block
|
|
88
|
+
* below maps these into Tailwind's `font-sans` / `font-mono` utilities. */
|
|
89
|
+
--font-sans: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
|
|
90
|
+
"Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
|
|
91
|
+
--font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
|
|
92
|
+
"Liberation Mono", "Courier New", monospace;
|
|
93
|
+
|
|
77
94
|
/* Cursor — `pointer` is the modern "everything interactive is clickable"
|
|
78
95
|
* default. Set `--cursor-clickable: default` in your own :root for
|
|
79
96
|
* native / HIG behavior; real links keep their own pointer regardless. */
|
|
80
97
|
--cursor-clickable: pointer;
|
|
98
|
+
|
|
99
|
+
/* Motion — tokens consumed by the `motion-*` recipes (see Utilities).
|
|
100
|
+
* Override any value in your own :root. `prefers-reduced-motion` zeroes
|
|
101
|
+
* them in one block (bottom of file), so every recipe collapses safely. */
|
|
102
|
+
--duration: 250ms;
|
|
103
|
+
--ease: ease-out; /* default — fade/blur, no transform */
|
|
104
|
+
--spring: cubic-bezier(0.34, 1.45, 0.64, 1); /* only with translate/scale */
|
|
105
|
+
--blur: 2px; /* enter/exit blur amount */
|
|
106
|
+
--scale: 0.97; /* enter/exit scale-down */
|
|
107
|
+
--offset: 4px; /* enter/exit translate offset */
|
|
108
|
+
--stagger: 70ms; /* per-item list delay */
|
|
81
109
|
}
|
|
82
110
|
|
|
83
111
|
/* ---------------------------------------------------------------------------
|
|
@@ -196,6 +224,7 @@
|
|
|
196
224
|
--color-sidebar-ring: var(--sidebar-ring);
|
|
197
225
|
|
|
198
226
|
/* Radius */
|
|
227
|
+
--radius-xs: calc(var(--radius) - 6px);
|
|
199
228
|
--radius-sm: calc(var(--radius) - 4px);
|
|
200
229
|
--radius-md: calc(var(--radius) - 2px);
|
|
201
230
|
--radius-lg: var(--radius);
|
|
@@ -203,6 +232,12 @@
|
|
|
203
232
|
--radius-2xl: calc(var(--radius) + 8px);
|
|
204
233
|
--radius-3xl: calc(var(--radius) + 12px);
|
|
205
234
|
--radius-4xl: calc(var(--radius) + 16px);
|
|
235
|
+
|
|
236
|
+
/* Typography — passthroughs so consumers' `--font-sans` /
|
|
237
|
+
* `--font-geist-mono` flow through to Tailwind's `font-sans` /
|
|
238
|
+
* `font-mono` utilities. */
|
|
239
|
+
--font-sans: var(--font-sans);
|
|
240
|
+
--font-mono: var(--font-mono);
|
|
206
241
|
}
|
|
207
242
|
|
|
208
243
|
/* ---------------------------------------------------------------------------
|
|
@@ -215,3 +250,72 @@
|
|
|
215
250
|
@utility cursor-clickable {
|
|
216
251
|
cursor: var(--cursor-clickable);
|
|
217
252
|
}
|
|
253
|
+
|
|
254
|
+
/* Motion recipes — Base UI primitives emit `data-starting-style` (enter)
|
|
255
|
+
* and `data-ending-style` (exit). Each recipe declares its `transition`,
|
|
256
|
+
* resting state, and enter/exit state in one `@utility` (the `utilities`
|
|
257
|
+
* layer) so `group-has` overrides (also utilities) win over the resting
|
|
258
|
+
* state by normal cascade order. Co-locating `transition` here is only safe
|
|
259
|
+
* because the library ships no `transition-all` — nothing else in the
|
|
260
|
+
* utilities layer sets `transition` on a recipe-bearing element and clobbers
|
|
261
|
+
* it. (If `transition-all` ever returns, these break; keep them specific.)
|
|
262
|
+
*
|
|
263
|
+
* `0.001px` resting blur defeats Lightning CSS's `blur(0) → blur()`
|
|
264
|
+
* minification (which emits invalid CSS); it is visually equivalent to 0. */
|
|
265
|
+
|
|
266
|
+
/* `motion-fade` — opacity + blur. For simple show/hide on small surfaces. */
|
|
267
|
+
@utility motion-fade {
|
|
268
|
+
transition: opacity var(--duration) var(--ease),
|
|
269
|
+
filter var(--duration) var(--ease);
|
|
270
|
+
filter: blur(0.001px);
|
|
271
|
+
&[data-starting-style],
|
|
272
|
+
&[data-ending-style] {
|
|
273
|
+
opacity: 0;
|
|
274
|
+
filter: blur(var(--blur));
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
/* `motion-scale` — opacity + blur + scale-down. For icon-sized targets. */
|
|
279
|
+
@utility motion-scale {
|
|
280
|
+
transition: opacity var(--duration) var(--ease),
|
|
281
|
+
filter var(--duration) var(--ease),
|
|
282
|
+
scale var(--duration) var(--ease);
|
|
283
|
+
filter: blur(0.001px);
|
|
284
|
+
scale: 1;
|
|
285
|
+
&[data-starting-style],
|
|
286
|
+
&[data-ending-style] {
|
|
287
|
+
opacity: 0;
|
|
288
|
+
filter: blur(var(--blur));
|
|
289
|
+
scale: var(--scale);
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
/* `motion-rise` — opacity + blur + translate-y, spring ease. For larger
|
|
294
|
+
* content surfaces (alerts, menus, cards) — spring overshoot only reads
|
|
295
|
+
* with translate. */
|
|
296
|
+
@utility motion-rise {
|
|
297
|
+
transition: opacity var(--duration) var(--spring),
|
|
298
|
+
filter var(--duration) var(--spring),
|
|
299
|
+
translate var(--duration) var(--spring);
|
|
300
|
+
filter: blur(0.001px);
|
|
301
|
+
translate: 0;
|
|
302
|
+
&[data-starting-style],
|
|
303
|
+
&[data-ending-style] {
|
|
304
|
+
opacity: 0;
|
|
305
|
+
filter: blur(var(--blur));
|
|
306
|
+
translate: 0 var(--offset);
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
/* ---------------------------------------------------------------------------
|
|
311
|
+
* Reduced motion — one block, every token zeroes, every recipe collapses.
|
|
312
|
+
* ------------------------------------------------------------------------- */
|
|
313
|
+
@media (prefers-reduced-motion: reduce) {
|
|
314
|
+
:root {
|
|
315
|
+
--duration: 0ms;
|
|
316
|
+
--blur: 0px;
|
|
317
|
+
--scale: 1;
|
|
318
|
+
--offset: 0px;
|
|
319
|
+
--stagger: 0ms;
|
|
320
|
+
}
|
|
321
|
+
}
|
package/dist/switch.js
CHANGED
|
@@ -8,7 +8,7 @@ function Switch({ className, size = "default", ...props }) {
|
|
|
8
8
|
return /* @__PURE__ */ jsx(Switch$1.Root, {
|
|
9
9
|
"data-slot": "switch",
|
|
10
10
|
"data-size": size,
|
|
11
|
-
className: cn("cursor-clickable data-checked:bg-primary data-unchecked:bg-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 dark:data-unchecked:bg-input/80 peer group/switch relative inline-flex shrink-0 items-center rounded-full border border-transparent transition-
|
|
11
|
+
className: cn("cursor-clickable data-checked:bg-primary data-unchecked:bg-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 dark:data-unchecked:bg-input/80 peer group/switch relative inline-flex shrink-0 items-center rounded-full border border-transparent transition-[color,background-color,border-color,box-shadow] outline-none after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:ring-3 aria-invalid:ring-3 data-disabled:cursor-not-allowed data-disabled:opacity-50 data-[size=default]:h-[18.4px] data-[size=default]:w-[32px] data-[size=sm]:h-[14px] data-[size=sm]:w-[24px]", className),
|
|
12
12
|
...props,
|
|
13
13
|
children: /* @__PURE__ */ jsx(Switch$1.Thumb, {
|
|
14
14
|
"data-slot": "switch-thumb",
|
package/dist/switch.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"switch.js","names":["SwitchPrimitive"],"sources":["../src/switch.tsx"],"sourcesContent":["\"use client\"\n\nimport * as React from \"react\"\nimport { Switch as SwitchPrimitive } from \"@base-ui/react/switch\"\n\nimport { cn } from \"./lib/utils\"\n\ntype SwitchProps = React.ComponentProps<typeof SwitchPrimitive.Root> & {\n size?: \"sm\" | \"default\"\n}\n\nfunction Switch({ className, size = \"default\", ...props }: SwitchProps) {\n return (\n <SwitchPrimitive.Root\n data-slot=\"switch\"\n data-size={size}\n className={cn(\n \"cursor-clickable data-checked:bg-primary data-unchecked:bg-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 dark:data-unchecked:bg-input/80 peer group/switch relative inline-flex shrink-0 items-center rounded-full border border-transparent transition-
|
|
1
|
+
{"version":3,"file":"switch.js","names":["SwitchPrimitive"],"sources":["../src/switch.tsx"],"sourcesContent":["\"use client\"\n\nimport * as React from \"react\"\nimport { Switch as SwitchPrimitive } from \"@base-ui/react/switch\"\n\nimport { cn } from \"./lib/utils\"\n\ntype SwitchProps = React.ComponentProps<typeof SwitchPrimitive.Root> & {\n size?: \"sm\" | \"default\"\n}\n\nfunction Switch({ className, size = \"default\", ...props }: SwitchProps) {\n return (\n <SwitchPrimitive.Root\n data-slot=\"switch\"\n data-size={size}\n className={cn(\n \"cursor-clickable data-checked:bg-primary data-unchecked:bg-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 dark:data-unchecked:bg-input/80 peer group/switch relative inline-flex shrink-0 items-center rounded-full border border-transparent transition-[color,background-color,border-color,box-shadow] outline-none after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:ring-3 aria-invalid:ring-3 data-disabled:cursor-not-allowed data-disabled:opacity-50 data-[size=default]:h-[18.4px] data-[size=default]:w-[32px] data-[size=sm]:h-[14px] data-[size=sm]:w-[24px]\",\n className\n )}\n {...props}\n >\n <SwitchPrimitive.Thumb\n data-slot=\"switch-thumb\"\n className=\"bg-background dark:data-unchecked:bg-foreground dark:data-checked:bg-primary-foreground pointer-events-none block rounded-full ring-0 transition-transform group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:size-3 group-data-[size=default]/switch:data-checked:translate-x-[calc(100%-2px)] group-data-[size=sm]/switch:data-checked:translate-x-[calc(100%-2px)] group-data-[size=default]/switch:data-unchecked:translate-x-0 group-data-[size=sm]/switch:data-unchecked:translate-x-0\"\n />\n </SwitchPrimitive.Root>\n )\n}\n\nexport { Switch }\n"],"mappings":";;;;;;AAWA,SAAS,OAAO,EAAE,WAAW,OAAO,WAAW,GAAG,SAAsB;AACtE,QACE,oBAACA,SAAgB,MAAjB;EACE,aAAU;EACV,aAAW;EACX,WAAW,GACT,qtBACA,UACD;EACD,GAAI;YAEJ,oBAACA,SAAgB,OAAjB;GACE,aAAU;GACV,WAAU;GACV,CAAA;EACmB,CAAA"}
|
package/dist/tabs.js
CHANGED
|
@@ -31,7 +31,7 @@ function TabsList({ className, variant = "default", ...props }) {
|
|
|
31
31
|
function TabsTrigger({ className, ...props }) {
|
|
32
32
|
return /* @__PURE__ */ jsx(Tabs$1.Tab, {
|
|
33
33
|
"data-slot": "tabs-trigger",
|
|
34
|
-
className: cn("cursor-clickable text-foreground/60 hover:text-foreground dark:text-muted-foreground dark:hover:text-foreground relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-1.5 py-0.5 text-sm font-medium whitespace-nowrap transition-
|
|
34
|
+
className: cn("cursor-clickable text-foreground/60 hover:text-foreground dark:text-muted-foreground dark:hover:text-foreground relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-1.5 py-0.5 text-sm font-medium whitespace-nowrap transition-[color,background-color,border-color,box-shadow] focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:outline-ring focus-visible:ring-3 focus-visible:outline-1 disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 group-data-[orientation=vertical]/tabs:w-full group-data-[orientation=vertical]/tabs:justify-start [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", "data-active:bg-background data-active:text-foreground data-active:shadow-sm dark:data-active:text-foreground dark:data-active:border-input dark:data-active:bg-input/30", "group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-active:bg-transparent group-data-[variant=line]/tabs-list:data-active:shadow-none dark:group-data-[variant=line]/tabs-list:data-active:border-transparent dark:group-data-[variant=line]/tabs-list:data-active:bg-transparent", "after:bg-foreground after:absolute after:opacity-0 after:transition-opacity group-data-[orientation=horizontal]/tabs:after:inset-x-0 group-data-[orientation=horizontal]/tabs:after:bottom-[-5px] group-data-[orientation=horizontal]/tabs:after:h-0.5 group-data-[orientation=vertical]/tabs:after:inset-y-0 group-data-[orientation=vertical]/tabs:after:-right-1 group-data-[orientation=vertical]/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-active:after:opacity-100", className),
|
|
35
35
|
...props
|
|
36
36
|
});
|
|
37
37
|
}
|
package/dist/tabs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tabs.js","names":["TabsPrimitive"],"sources":["../src/tabs.tsx"],"sourcesContent":["\"use client\"\n\nimport * as React from \"react\"\n\nimport { Tabs as TabsPrimitive } from \"@base-ui/react/tabs\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\n\nimport { cn } from \"./lib/utils\"\n\n// --- CVA variants ---\n\nconst tabsListVariants = cva(\n \"group/tabs-list inline-flex w-fit items-center justify-center rounded-lg p-[3px] text-muted-foreground group-data-[orientation=horizontal]/tabs:h-8 group-data-[orientation=vertical]/tabs:h-fit group-data-[orientation=vertical]/tabs:flex-col data-[variant=line]:rounded-none\",\n {\n variants: {\n variant: {\n default: \"bg-muted\",\n line: \"gap-1 bg-transparent\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n },\n }\n)\n\n// --- Types ---\n\ntype TabsProps = React.ComponentProps<typeof TabsPrimitive.Root>\n\ntype TabsListBaseProps = React.ComponentProps<typeof TabsPrimitive.List>\n\ntype TabsListProps = TabsListBaseProps & VariantProps<typeof tabsListVariants>\n\ntype TabsTriggerProps = React.ComponentProps<typeof TabsPrimitive.Tab>\n\ntype TabsContentProps = React.ComponentProps<typeof TabsPrimitive.Panel>\n\n// --- Components ---\n\nfunction Tabs({\n className,\n orientation = \"horizontal\",\n ...props\n}: TabsProps) {\n return (\n <TabsPrimitive.Root\n data-slot=\"tabs\"\n orientation={orientation}\n className={cn(\n \"group/tabs flex gap-2 data-[orientation=horizontal]:flex-col\",\n className\n )}\n {...props}\n />\n )\n}\n\nfunction TabsList({\n className,\n variant = \"default\",\n ...props\n}: TabsListProps) {\n return (\n <TabsPrimitive.List\n data-slot=\"tabs-list\"\n data-variant={variant}\n className={cn(tabsListVariants({ variant }), className)}\n {...props}\n />\n )\n}\n\nfunction TabsTrigger({ className, ...props }: TabsTriggerProps) {\n return (\n <TabsPrimitive.Tab\n data-slot=\"tabs-trigger\"\n className={cn(\n \"cursor-clickable text-foreground/60 hover:text-foreground dark:text-muted-foreground dark:hover:text-foreground relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-1.5 py-0.5 text-sm font-medium whitespace-nowrap transition-
|
|
1
|
+
{"version":3,"file":"tabs.js","names":["TabsPrimitive"],"sources":["../src/tabs.tsx"],"sourcesContent":["\"use client\"\n\nimport * as React from \"react\"\n\nimport { Tabs as TabsPrimitive } from \"@base-ui/react/tabs\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\n\nimport { cn } from \"./lib/utils\"\n\n// --- CVA variants ---\n\nconst tabsListVariants = cva(\n \"group/tabs-list inline-flex w-fit items-center justify-center rounded-lg p-[3px] text-muted-foreground group-data-[orientation=horizontal]/tabs:h-8 group-data-[orientation=vertical]/tabs:h-fit group-data-[orientation=vertical]/tabs:flex-col data-[variant=line]:rounded-none\",\n {\n variants: {\n variant: {\n default: \"bg-muted\",\n line: \"gap-1 bg-transparent\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n },\n }\n)\n\n// --- Types ---\n\ntype TabsProps = React.ComponentProps<typeof TabsPrimitive.Root>\n\ntype TabsListBaseProps = React.ComponentProps<typeof TabsPrimitive.List>\n\ntype TabsListProps = TabsListBaseProps & VariantProps<typeof tabsListVariants>\n\ntype TabsTriggerProps = React.ComponentProps<typeof TabsPrimitive.Tab>\n\ntype TabsContentProps = React.ComponentProps<typeof TabsPrimitive.Panel>\n\n// --- Components ---\n\nfunction Tabs({\n className,\n orientation = \"horizontal\",\n ...props\n}: TabsProps) {\n return (\n <TabsPrimitive.Root\n data-slot=\"tabs\"\n orientation={orientation}\n className={cn(\n \"group/tabs flex gap-2 data-[orientation=horizontal]:flex-col\",\n className\n )}\n {...props}\n />\n )\n}\n\nfunction TabsList({\n className,\n variant = \"default\",\n ...props\n}: TabsListProps) {\n return (\n <TabsPrimitive.List\n data-slot=\"tabs-list\"\n data-variant={variant}\n className={cn(tabsListVariants({ variant }), className)}\n {...props}\n />\n )\n}\n\nfunction TabsTrigger({ className, ...props }: TabsTriggerProps) {\n return (\n <TabsPrimitive.Tab\n data-slot=\"tabs-trigger\"\n className={cn(\n \"cursor-clickable text-foreground/60 hover:text-foreground dark:text-muted-foreground dark:hover:text-foreground relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-1.5 py-0.5 text-sm font-medium whitespace-nowrap transition-[color,background-color,border-color,box-shadow] focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:outline-ring focus-visible:ring-3 focus-visible:outline-1 disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 group-data-[orientation=vertical]/tabs:w-full group-data-[orientation=vertical]/tabs:justify-start [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4\",\n \"data-active:bg-background data-active:text-foreground data-active:shadow-sm dark:data-active:text-foreground dark:data-active:border-input dark:data-active:bg-input/30\",\n \"group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-active:bg-transparent group-data-[variant=line]/tabs-list:data-active:shadow-none dark:group-data-[variant=line]/tabs-list:data-active:border-transparent dark:group-data-[variant=line]/tabs-list:data-active:bg-transparent\",\n \"after:bg-foreground after:absolute after:opacity-0 after:transition-opacity group-data-[orientation=horizontal]/tabs:after:inset-x-0 group-data-[orientation=horizontal]/tabs:after:bottom-[-5px] group-data-[orientation=horizontal]/tabs:after:h-0.5 group-data-[orientation=vertical]/tabs:after:inset-y-0 group-data-[orientation=vertical]/tabs:after:-right-1 group-data-[orientation=vertical]/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-active:after:opacity-100\",\n className\n )}\n {...props}\n />\n )\n}\n\nfunction TabsContent({ className, ...props }: TabsContentProps) {\n return (\n <TabsPrimitive.Panel\n data-slot=\"tabs-content\"\n className={cn(\"flex-1 text-sm outline-none\", className)}\n {...props}\n />\n )\n}\n\n// --- Exports ---\n\nexport {\n Tabs,\n TabsList,\n TabsTrigger,\n TabsContent,\n tabsListVariants,\n}\n"],"mappings":";;;;;;;AAWA,MAAM,mBAAmB,IACvB,qRACA;CACE,UAAU,EACR,SAAS;EACP,SAAS;EACT,MAAM;EACP,EACF;CACD,iBAAiB,EACf,SAAS,WACV;CACF,CACF;AAgBD,SAAS,KAAK,EACZ,WACA,cAAc,cACd,GAAG,SACS;AACZ,QACE,oBAACA,OAAc,MAAf;EACE,aAAU;EACG;EACb,WAAW,GACT,gEACA,UACD;EACD,GAAI;EACJ,CAAA;;AAIN,SAAS,SAAS,EAChB,WACA,UAAU,WACV,GAAG,SACa;AAChB,QACE,oBAACA,OAAc,MAAf;EACE,aAAU;EACV,gBAAc;EACd,WAAW,GAAG,iBAAiB,EAAE,SAAS,CAAC,EAAE,UAAU;EACvD,GAAI;EACJ,CAAA;;AAIN,SAAS,YAAY,EAAE,WAAW,GAAG,SAA2B;AAC9D,QACE,oBAACA,OAAc,KAAf;EACE,aAAU;EACV,WAAW,GACT,yvBACA,2KACA,6TACA,4dACA,UACD;EACD,GAAI;EACJ,CAAA;;AAIN,SAAS,YAAY,EAAE,WAAW,GAAG,SAA2B;AAC9D,QACE,oBAACA,OAAc,OAAf;EACE,aAAU;EACV,WAAW,GAAG,+BAA+B,UAAU;EACvD,GAAI;EACJ,CAAA"}
|
package/dist/toast.js
CHANGED
|
@@ -119,40 +119,40 @@ function ToastClose({ className, children, ...props }) {
|
|
|
119
119
|
});
|
|
120
120
|
}
|
|
121
121
|
const STACKING_BASE = [
|
|
122
|
-
"[--gap:0.5rem]",
|
|
123
|
-
"[--peek:0.5rem]",
|
|
124
|
-
"[--scale:calc(max(0,1-(var(--toast-index)*0.05)))]",
|
|
125
|
-
"[--shrink:calc(1-var(--scale))]",
|
|
126
|
-
"[--height:var(--toast-frontmost-height,var(--toast-height))]",
|
|
122
|
+
"[--toast-gap:0.5rem]",
|
|
123
|
+
"[--toast-peek:0.5rem]",
|
|
124
|
+
"[--toast-scale:calc(max(0,1-(var(--toast-index)*0.05)))]",
|
|
125
|
+
"[--toast-shrink:calc(1-var(--toast-scale))]",
|
|
126
|
+
"[--toast-stack-height:var(--toast-frontmost-height,var(--toast-height))]",
|
|
127
127
|
"absolute w-full",
|
|
128
128
|
"[z-index:calc(1000-var(--toast-index))]",
|
|
129
|
-
"h-[var(--height)] data-[expanded]:h-[var(--toast-height)]",
|
|
129
|
+
"h-[var(--toast-stack-height)] data-[expanded]:h-[var(--toast-height)]",
|
|
130
130
|
"[filter:blur(calc(var(--toast-index)*0.4px))]",
|
|
131
131
|
"data-[expanded]:[filter:none]",
|
|
132
|
-
"data-[expanded]:[transform:translateX(var(--toast-swipe-movement-x))_translateY(calc(var(--offset-y)))]",
|
|
132
|
+
"data-[expanded]:[transform:translateX(var(--toast-swipe-movement-x))_translateY(calc(var(--toast-stack-offset-y)))]",
|
|
133
133
|
"data-[ending-style]:opacity-0",
|
|
134
134
|
"data-[ending-style]:data-[swipe-direction=down]:[transform:translateY(calc(var(--toast-swipe-movement-y)+150%))]",
|
|
135
135
|
"data-[expanded]:data-[ending-style]:data-[swipe-direction=down]:[transform:translateY(calc(var(--toast-swipe-movement-y)+150%))]",
|
|
136
|
-
"data-[ending-style]:data-[swipe-direction=right]:[transform:translateX(calc(var(--toast-swipe-movement-x)+150%))_translateY(var(--offset-y))]",
|
|
137
|
-
"data-[expanded]:data-[ending-style]:data-[swipe-direction=right]:[transform:translateX(calc(var(--toast-swipe-movement-x)+150%))_translateY(var(--offset-y))]",
|
|
136
|
+
"data-[ending-style]:data-[swipe-direction=right]:[transform:translateX(calc(var(--toast-swipe-movement-x)+150%))_translateY(var(--toast-stack-offset-y))]",
|
|
137
|
+
"data-[expanded]:data-[ending-style]:data-[swipe-direction=right]:[transform:translateX(calc(var(--toast-swipe-movement-x)+150%))_translateY(var(--toast-stack-offset-y))]",
|
|
138
138
|
"data-[ending-style]:data-[swipe-direction=up]:[transform:translateY(calc(var(--toast-swipe-movement-y)-150%))]",
|
|
139
139
|
"data-[expanded]:data-[ending-style]:data-[swipe-direction=up]:[transform:translateY(calc(var(--toast-swipe-movement-y)-150%))]",
|
|
140
140
|
"data-[limited]:opacity-0",
|
|
141
141
|
"[transition:transform_0.5s_cubic-bezier(0.22,1,0.36,1),opacity_0.5s,filter_0.5s,height_0.15s]"
|
|
142
142
|
].join(" ");
|
|
143
143
|
const STACKING_TOP = [
|
|
144
|
-
"[--offset-y:calc(var(--toast-offset-y)+calc(var(--toast-index)*var(--gap))+var(--toast-swipe-movement-y))]",
|
|
144
|
+
"[--toast-stack-offset-y:calc(var(--toast-offset-y)+calc(var(--toast-index)*var(--toast-gap))+var(--toast-swipe-movement-y))]",
|
|
145
145
|
"top-0 origin-top",
|
|
146
|
-
"[transform:translateX(var(--toast-swipe-movement-x))_translateY(calc(var(--toast-swipe-movement-y)+(var(--toast-index)*var(--peek))+(var(--shrink)*var(--height))))_scale(var(--scale))]",
|
|
147
|
-
"after:absolute after:bottom-full after:left-0 after:h-[calc(var(--gap)+1px)] after:w-full after:content-['']",
|
|
146
|
+
"[transform:translateX(var(--toast-swipe-movement-x))_translateY(calc(var(--toast-swipe-movement-y)+(var(--toast-index)*var(--toast-peek))+(var(--toast-shrink)*var(--toast-stack-height))))_scale(var(--toast-scale))]",
|
|
147
|
+
"after:absolute after:bottom-full after:left-0 after:h-[calc(var(--toast-gap)+1px)] after:w-full after:content-['']",
|
|
148
148
|
"data-[starting-style]:[transform:translateY(-150%)]",
|
|
149
149
|
"[&[data-ending-style]:not([data-limited]):not([data-swipe-direction])]:[transform:translateY(-150%)]"
|
|
150
150
|
].join(" ");
|
|
151
151
|
const STACKING_BOTTOM = [
|
|
152
|
-
"[--offset-y:calc(var(--toast-offset-y)*-1+calc(var(--toast-index)*var(--gap)*-1)+var(--toast-swipe-movement-y))]",
|
|
152
|
+
"[--toast-stack-offset-y:calc(var(--toast-offset-y)*-1+calc(var(--toast-index)*var(--toast-gap)*-1)+var(--toast-swipe-movement-y))]",
|
|
153
153
|
"bottom-0 origin-bottom",
|
|
154
|
-
"[transform:translateX(var(--toast-swipe-movement-x))_translateY(calc(var(--toast-swipe-movement-y)-(var(--toast-index)*var(--peek))-(var(--shrink)*var(--height))))_scale(var(--scale))]",
|
|
155
|
-
"after:absolute after:top-full after:left-0 after:h-[calc(var(--gap)+1px)] after:w-full after:content-['']",
|
|
154
|
+
"[transform:translateX(var(--toast-swipe-movement-x))_translateY(calc(var(--toast-swipe-movement-y)-(var(--toast-index)*var(--toast-peek))-(var(--toast-shrink)*var(--toast-stack-height))))_scale(var(--toast-scale))]",
|
|
155
|
+
"after:absolute after:top-full after:left-0 after:h-[calc(var(--toast-gap)+1px)] after:w-full after:content-['']",
|
|
156
156
|
"data-[starting-style]:[transform:translateY(150%)]",
|
|
157
157
|
"[&[data-ending-style]:not([data-limited]):not([data-swipe-direction])]:[transform:translateY(150%)]"
|
|
158
158
|
].join(" ");
|
package/dist/toast.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toast.js","names":["ToastPrimitive"],"sources":["../src/toast.tsx"],"sourcesContent":["\"use client\"\n\nimport * as React from \"react\"\nimport { Toast as ToastPrimitive } from \"@base-ui/react/toast\"\nimport { cva } from \"class-variance-authority\"\n\nimport { cn } from \"./lib/utils\"\nimport {\n CloseIcon,\n SuccessCircleIcon,\n InfoCircleIcon,\n AlertTriangleIcon,\n ErrorCircleIcon,\n LoaderIcon,\n} from \"./lib/internal-icons\"\n\n// ---------------------------------------------------------------------------\n// Styles\n// ---------------------------------------------------------------------------\n\nconst toastRootClass =\n \"bg-popover text-popover-foreground ring-foreground/10 rounded-lg p-4 text-sm shadow-lg ring-1 outline-none select-none\"\n\nconst toastIconVariants = cva(\n \"mt-0.5 size-4 shrink-0\",\n {\n variants: {\n type: {\n loading: \"text-muted-foreground animate-spin\",\n success: \"text-emerald-500\",\n info: \"text-blue-500\",\n warning: \"text-amber-500\",\n error: \"text-red-500\",\n },\n },\n }\n)\n\nconst toastViewportVariants = cva(\n \"fixed z-[100] flex w-full outline-none sm:max-w-sm\",\n {\n variants: {\n position: {\n \"top-left\": \"top-4 left-4\",\n \"top-center\": \"top-4 right-0 left-0 mx-auto\",\n \"top-right\": \"top-4 right-4\",\n \"bottom-left\": \"bottom-4 left-4\",\n \"bottom-center\": \"bottom-4 right-0 left-0 mx-auto\",\n \"bottom-right\": \"bottom-4 right-4\",\n },\n },\n defaultVariants: {\n position: \"bottom-right\",\n },\n },\n)\n\n// ---------------------------------------------------------------------------\n// Types\n// ---------------------------------------------------------------------------\n\ntype ToastType = \"loading\" | \"success\" | \"info\" | \"warning\" | \"error\"\n\ntype ToastOptions = {\n title?: string\n description?: string\n type?: ToastType\n timeout?: number\n priority?: \"low\" | \"high\"\n actionProps?: React.ComponentPropsWithoutRef<\"button\">\n onClose?: () => void\n onRemove?: () => void\n}\n\ntype ToasterPosition =\n | \"top-left\"\n | \"top-center\"\n | \"top-right\"\n | \"bottom-left\"\n | \"bottom-center\"\n | \"bottom-right\"\n\ntype ToasterProps = {\n position?: ToasterPosition\n limit?: number\n timeout?: number\n}\n\ntype ToastProps = React.ComponentProps<typeof ToastPrimitive.Root>\ntype ToastTitleProps = React.ComponentProps<typeof ToastPrimitive.Title>\ntype ToastDescriptionProps = React.ComponentProps<typeof ToastPrimitive.Description>\ntype ToastActionProps = React.ComponentProps<typeof ToastPrimitive.Action>\ntype ToastCloseProps = React.ComponentProps<typeof ToastPrimitive.Close>\n\n// ---------------------------------------------------------------------------\n// Toast manager API\n// ---------------------------------------------------------------------------\n\nconst toastManager = ToastPrimitive.createToastManager()\n\nconst toast = Object.assign(\n (titleOrOptions: string | ToastOptions) => {\n const options =\n typeof titleOrOptions === \"string\"\n ? { title: titleOrOptions }\n : titleOrOptions\n return toastManager.add(options)\n },\n {\n success: (title: string, options?: Omit<ToastOptions, \"type\" | \"title\">) =>\n toastManager.add({ ...options, type: \"success\", title }),\n\n error: (title: string, options?: Omit<ToastOptions, \"type\" | \"title\">) =>\n toastManager.add({ ...options, type: \"error\", title }),\n\n warning: (title: string, options?: Omit<ToastOptions, \"type\" | \"title\">) =>\n toastManager.add({ ...options, type: \"warning\", title }),\n\n info: (title: string, options?: Omit<ToastOptions, \"type\" | \"title\">) =>\n toastManager.add({ ...options, type: \"info\", title }),\n\n loading: (title: string, options?: Omit<ToastOptions, \"type\" | \"title\">) =>\n toastManager.add({\n ...options,\n type: \"loading\",\n title,\n timeout: options?.timeout ?? 0,\n }),\n\n dismiss: (id: string) => toastManager.close(id),\n\n update: (id: string, updates: Partial<ToastOptions>) =>\n toastManager.update(id, updates),\n\n promise: toastManager.promise.bind(toastManager),\n },\n)\n\n// ---------------------------------------------------------------------------\n// Icons\n// ---------------------------------------------------------------------------\n\nconst iconMap = {\n loading: LoaderIcon,\n success: SuccessCircleIcon,\n info: InfoCircleIcon,\n warning: AlertTriangleIcon,\n error: ErrorCircleIcon,\n} as const\n\nfunction ToastIcon({ type }: { type?: ToastType }) {\n if (!type) return null\n const Icon = iconMap[type]\n return <Icon className={cn(toastIconVariants({ type }))} />\n}\n\n// ---------------------------------------------------------------------------\n// Toast primitives\n// ---------------------------------------------------------------------------\n\nfunction Toast({ className, ...props }: ToastProps) {\n return (\n <ToastPrimitive.Root\n data-slot=\"toast\"\n className={cn(toastRootClass, className)}\n {...props}\n />\n )\n}\n\nfunction ToastBody({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"toast-body\"\n className={cn(\"flex flex-1 flex-col gap-1\", className)}\n {...props}\n />\n )\n}\n\nfunction ToastTitle({ className, ...props }: ToastTitleProps) {\n return (\n <ToastPrimitive.Title\n data-slot=\"toast-title\"\n className={cn(\"text-sm font-medium\", className)}\n {...props}\n />\n )\n}\n\nfunction ToastDescription({ className, ...props }: ToastDescriptionProps) {\n return (\n <ToastPrimitive.Description\n data-slot=\"toast-description\"\n className={cn(\"text-muted-foreground text-sm\", className)}\n {...props}\n />\n )\n}\n\nfunction ToastAction({ className, ...props }: ToastActionProps) {\n return (\n <ToastPrimitive.Action\n data-slot=\"toast-action\"\n className={cn(\n \"hover:bg-muted inline-flex h-7 items-center rounded-md border px-2.5 text-xs font-medium transition-colors\",\n className,\n )}\n {...props}\n />\n )\n}\n\nfunction ToastClose({ className, children, ...props }: ToastCloseProps) {\n return (\n <ToastPrimitive.Close\n data-slot=\"toast-close\"\n className={cn(\n \"text-muted-foreground hover:text-foreground shrink-0 rounded-md p-0.5 transition-colors\",\n className,\n )}\n {...props}\n >\n {children ?? (\n <>\n <CloseIcon className=\"size-4\" />\n <span className=\"sr-only\">Close</span>\n </>\n )}\n </ToastPrimitive.Close>\n )\n}\n\n// ---------------------------------------------------------------------------\n// 3D stacking\n// ---------------------------------------------------------------------------\n\n// Shared classes for both top and bottom positions\nconst STACKING_BASE = [\n // CSS custom properties\n \"[--gap:0.5rem]\",\n \"[--peek:0.5rem]\",\n \"[--scale:calc(max(0,1-(var(--toast-index)*0.05)))]\",\n \"[--shrink:calc(1-var(--scale))]\",\n \"[--height:var(--toast-frontmost-height,var(--toast-height))]\",\n // Layout\n \"absolute w-full\",\n \"[z-index:calc(1000-var(--toast-index))]\",\n \"h-[var(--height)] data-[expanded]:h-[var(--toast-height)]\",\n // Depth blur — subtle defocus on behind toasts, cleared on expand\n \"[filter:blur(calc(var(--toast-index)*0.4px))]\",\n \"data-[expanded]:[filter:none]\",\n // Expanded (hover)\n \"data-[expanded]:[transform:translateX(var(--toast-swipe-movement-x))_translateY(calc(var(--offset-y)))]\",\n // Exit — shared\n \"data-[ending-style]:opacity-0\",\n \"data-[ending-style]:data-[swipe-direction=down]:[transform:translateY(calc(var(--toast-swipe-movement-y)+150%))]\",\n \"data-[expanded]:data-[ending-style]:data-[swipe-direction=down]:[transform:translateY(calc(var(--toast-swipe-movement-y)+150%))]\",\n \"data-[ending-style]:data-[swipe-direction=right]:[transform:translateX(calc(var(--toast-swipe-movement-x)+150%))_translateY(var(--offset-y))]\",\n \"data-[expanded]:data-[ending-style]:data-[swipe-direction=right]:[transform:translateX(calc(var(--toast-swipe-movement-x)+150%))_translateY(var(--offset-y))]\",\n \"data-[ending-style]:data-[swipe-direction=up]:[transform:translateY(calc(var(--toast-swipe-movement-y)-150%))]\",\n \"data-[expanded]:data-[ending-style]:data-[swipe-direction=up]:[transform:translateY(calc(var(--toast-swipe-movement-y)-150%))]\",\n \"data-[limited]:opacity-0\",\n \"[transition:transform_0.5s_cubic-bezier(0.22,1,0.36,1),opacity_0.5s,filter_0.5s,height_0.15s]\",\n].join(\" \")\n\n// Direction-specific classes — sign flips for anchor, offset, transform, enter/exit\nconst STACKING_TOP = [\n \"[--offset-y:calc(var(--toast-offset-y)+calc(var(--toast-index)*var(--gap))+var(--toast-swipe-movement-y))]\",\n \"top-0 origin-top\",\n \"[transform:translateX(var(--toast-swipe-movement-x))_translateY(calc(var(--toast-swipe-movement-y)+(var(--toast-index)*var(--peek))+(var(--shrink)*var(--height))))_scale(var(--scale))]\",\n \"after:absolute after:bottom-full after:left-0 after:h-[calc(var(--gap)+1px)] after:w-full after:content-['']\",\n \"data-[starting-style]:[transform:translateY(-150%)]\",\n \"[&[data-ending-style]:not([data-limited]):not([data-swipe-direction])]:[transform:translateY(-150%)]\",\n].join(\" \")\n\nconst STACKING_BOTTOM = [\n \"[--offset-y:calc(var(--toast-offset-y)*-1+calc(var(--toast-index)*var(--gap)*-1)+var(--toast-swipe-movement-y))]\",\n \"bottom-0 origin-bottom\",\n \"[transform:translateX(var(--toast-swipe-movement-x))_translateY(calc(var(--toast-swipe-movement-y)-(var(--toast-index)*var(--peek))-(var(--shrink)*var(--height))))_scale(var(--scale))]\",\n \"after:absolute after:top-full after:left-0 after:h-[calc(var(--gap)+1px)] after:w-full after:content-['']\",\n \"data-[starting-style]:[transform:translateY(150%)]\",\n \"[&[data-ending-style]:not([data-limited]):not([data-swipe-direction])]:[transform:translateY(150%)]\",\n].join(\" \")\n\nconst STACKING_TOP_CLASS = `${STACKING_BASE} ${STACKING_TOP}`\nconst STACKING_BOTTOM_CLASS = `${STACKING_BASE} ${STACKING_BOTTOM}`\n\n// ---------------------------------------------------------------------------\n// Toaster\n// ---------------------------------------------------------------------------\n\nfunction ToasterContent({ position = \"bottom-right\" }: Pick<ToasterProps, \"position\">) {\n const { toasts } = ToastPrimitive.useToastManager()\n const isTop = position.startsWith(\"top\")\n\n return (\n <ToastPrimitive.Portal>\n <ToastPrimitive.Viewport\n data-slot=\"toast-viewport\"\n className={cn(toastViewportVariants({ position }))}\n >\n {toasts.map((t) => (\n <Toast\n key={t.id}\n toast={t}\n swipeDirection={isTop ? [\"up\", \"right\"] : [\"down\", \"right\"]}\n className={isTop ? STACKING_TOP_CLASS : STACKING_BOTTOM_CLASS}\n >\n <ToastPrimitive.Content\n data-slot=\"toast-content\"\n className=\"flex items-start gap-3 overflow-hidden transition-opacity duration-250 data-[behind]:pointer-events-none data-[behind]:opacity-0 data-[expanded]:pointer-events-auto data-[expanded]:opacity-100\"\n >\n <ToastIcon type={t.type as ToastType | undefined} />\n\n <ToastBody>\n {t.title && <ToastTitle>{t.title}</ToastTitle>}\n {t.description && (\n <ToastDescription>{t.description}</ToastDescription>\n )}\n {t.actionProps && (\n <div className=\"mt-1.5\">\n <ToastAction {...t.actionProps} />\n </div>\n )}\n </ToastBody>\n\n <ToastClose />\n </ToastPrimitive.Content>\n </Toast>\n ))}\n </ToastPrimitive.Viewport>\n </ToastPrimitive.Portal>\n )\n}\n\nfunction Toaster({ position, limit, timeout }: ToasterProps) {\n return (\n <ToastPrimitive.Provider\n toastManager={toastManager}\n limit={limit}\n timeout={timeout}\n >\n <ToasterContent position={position} />\n </ToastPrimitive.Provider>\n )\n}\n\nexport {\n toastRootClass,\n toastIconVariants,\n toastViewportVariants,\n toastManager,\n toast,\n Toaster,\n Toast,\n ToastIcon,\n ToastTitle,\n ToastDescription,\n ToastAction,\n ToastClose,\n}\n\nexport type {\n ToastType,\n ToastOptions,\n ToasterPosition,\n ToasterProps\n}"],"mappings":";;;;;;;;AAoBA,MAAM,iBACJ;AAEF,MAAM,oBAAoB,IACxB,0BACA,EACE,UAAU,EACR,MAAM;CACJ,SAAS;CACT,SAAS;CACT,MAAM;CACN,SAAS;CACT,OAAO;CACR,EACF,EACF,CACF;AAED,MAAM,wBAAwB,IAC5B,sDACA;CACE,UAAU,EACR,UAAU;EACR,YAAY;EACZ,cAAc;EACd,aAAa;EACb,eAAe;EACf,iBAAiB;EACjB,gBAAgB;EACjB,EACF;CACD,iBAAiB,EACf,UAAU,gBACX;CACF,CACF;AA2CD,MAAM,eAAeA,QAAe,oBAAoB;AAExD,MAAM,QAAQ,OAAO,QAClB,mBAA0C;CACzC,MAAM,UACJ,OAAO,mBAAmB,WACtB,EAAE,OAAO,gBAAgB,GACzB;AACN,QAAO,aAAa,IAAI,QAAQ;GAElC;CACE,UAAU,OAAe,YACvB,aAAa,IAAI;EAAE,GAAG;EAAS,MAAM;EAAW;EAAO,CAAC;CAE1D,QAAQ,OAAe,YACrB,aAAa,IAAI;EAAE,GAAG;EAAS,MAAM;EAAS;EAAO,CAAC;CAExD,UAAU,OAAe,YACvB,aAAa,IAAI;EAAE,GAAG;EAAS,MAAM;EAAW;EAAO,CAAC;CAE1D,OAAO,OAAe,YACpB,aAAa,IAAI;EAAE,GAAG;EAAS,MAAM;EAAQ;EAAO,CAAC;CAEvD,UAAU,OAAe,YACvB,aAAa,IAAI;EACf,GAAG;EACH,MAAM;EACN;EACA,SAAS,SAAS,WAAW;EAC9B,CAAC;CAEJ,UAAU,OAAe,aAAa,MAAM,GAAG;CAE/C,SAAS,IAAY,YACnB,aAAa,OAAO,IAAI,QAAQ;CAElC,SAAS,aAAa,QAAQ,KAAK,aAA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CACR;EACsB,CAAA,EACJ,CAAA;;AAI5B,SAAS,QAAQ,EAAE,UAAU,OAAO,WAAyB;AAC3D,QACE,oBAACA,QAAe,UAAhB;EACgB;EACP;EACE;YAET,oBAAC,gBAAD,EAA0B,UAAY,CAAA;EACd,CAAA"}
|
|
1
|
+
{"version":3,"file":"toast.js","names":["ToastPrimitive"],"sources":["../src/toast.tsx"],"sourcesContent":["\"use client\"\n\nimport * as React from \"react\"\nimport { Toast as ToastPrimitive } from \"@base-ui/react/toast\"\nimport { cva } from \"class-variance-authority\"\n\nimport { cn } from \"./lib/utils\"\nimport {\n CloseIcon,\n SuccessCircleIcon,\n InfoCircleIcon,\n AlertTriangleIcon,\n ErrorCircleIcon,\n LoaderIcon,\n} from \"./lib/internal-icons\"\n\n// ---------------------------------------------------------------------------\n// Styles\n// ---------------------------------------------------------------------------\n\nconst toastRootClass =\n \"bg-popover text-popover-foreground ring-foreground/10 rounded-lg p-4 text-sm shadow-lg ring-1 outline-none select-none\"\n\nconst toastIconVariants = cva(\n \"mt-0.5 size-4 shrink-0\",\n {\n variants: {\n type: {\n loading: \"text-muted-foreground animate-spin\",\n success: \"text-emerald-500\",\n info: \"text-blue-500\",\n warning: \"text-amber-500\",\n error: \"text-red-500\",\n },\n },\n }\n)\n\nconst toastViewportVariants = cva(\n \"fixed z-[100] flex w-full outline-none sm:max-w-sm\",\n {\n variants: {\n position: {\n \"top-left\": \"top-4 left-4\",\n \"top-center\": \"top-4 right-0 left-0 mx-auto\",\n \"top-right\": \"top-4 right-4\",\n \"bottom-left\": \"bottom-4 left-4\",\n \"bottom-center\": \"bottom-4 right-0 left-0 mx-auto\",\n \"bottom-right\": \"bottom-4 right-4\",\n },\n },\n defaultVariants: {\n position: \"bottom-right\",\n },\n },\n)\n\n// ---------------------------------------------------------------------------\n// Types\n// ---------------------------------------------------------------------------\n\ntype ToastType = \"loading\" | \"success\" | \"info\" | \"warning\" | \"error\"\n\ntype ToastOptions = {\n title?: string\n description?: string\n type?: ToastType\n timeout?: number\n priority?: \"low\" | \"high\"\n actionProps?: React.ComponentPropsWithoutRef<\"button\">\n onClose?: () => void\n onRemove?: () => void\n}\n\ntype ToasterPosition =\n | \"top-left\"\n | \"top-center\"\n | \"top-right\"\n | \"bottom-left\"\n | \"bottom-center\"\n | \"bottom-right\"\n\ntype ToasterProps = {\n position?: ToasterPosition\n limit?: number\n timeout?: number\n}\n\ntype ToastProps = React.ComponentProps<typeof ToastPrimitive.Root>\ntype ToastTitleProps = React.ComponentProps<typeof ToastPrimitive.Title>\ntype ToastDescriptionProps = React.ComponentProps<typeof ToastPrimitive.Description>\ntype ToastActionProps = React.ComponentProps<typeof ToastPrimitive.Action>\ntype ToastCloseProps = React.ComponentProps<typeof ToastPrimitive.Close>\n\n// ---------------------------------------------------------------------------\n// Toast manager API\n// ---------------------------------------------------------------------------\n\nconst toastManager = ToastPrimitive.createToastManager()\n\nconst toast = Object.assign(\n (titleOrOptions: string | ToastOptions) => {\n const options =\n typeof titleOrOptions === \"string\"\n ? { title: titleOrOptions }\n : titleOrOptions\n return toastManager.add(options)\n },\n {\n success: (title: string, options?: Omit<ToastOptions, \"type\" | \"title\">) =>\n toastManager.add({ ...options, type: \"success\", title }),\n\n error: (title: string, options?: Omit<ToastOptions, \"type\" | \"title\">) =>\n toastManager.add({ ...options, type: \"error\", title }),\n\n warning: (title: string, options?: Omit<ToastOptions, \"type\" | \"title\">) =>\n toastManager.add({ ...options, type: \"warning\", title }),\n\n info: (title: string, options?: Omit<ToastOptions, \"type\" | \"title\">) =>\n toastManager.add({ ...options, type: \"info\", title }),\n\n loading: (title: string, options?: Omit<ToastOptions, \"type\" | \"title\">) =>\n toastManager.add({\n ...options,\n type: \"loading\",\n title,\n timeout: options?.timeout ?? 0,\n }),\n\n dismiss: (id: string) => toastManager.close(id),\n\n update: (id: string, updates: Partial<ToastOptions>) =>\n toastManager.update(id, updates),\n\n promise: toastManager.promise.bind(toastManager),\n },\n)\n\n// ---------------------------------------------------------------------------\n// Icons\n// ---------------------------------------------------------------------------\n\nconst iconMap = {\n loading: LoaderIcon,\n success: SuccessCircleIcon,\n info: InfoCircleIcon,\n warning: AlertTriangleIcon,\n error: ErrorCircleIcon,\n} as const\n\nfunction ToastIcon({ type }: { type?: ToastType }) {\n if (!type) return null\n const Icon = iconMap[type]\n return <Icon className={cn(toastIconVariants({ type }))} />\n}\n\n// ---------------------------------------------------------------------------\n// Toast primitives\n// ---------------------------------------------------------------------------\n\nfunction Toast({ className, ...props }: ToastProps) {\n return (\n <ToastPrimitive.Root\n data-slot=\"toast\"\n className={cn(toastRootClass, className)}\n {...props}\n />\n )\n}\n\nfunction ToastBody({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"toast-body\"\n className={cn(\"flex flex-1 flex-col gap-1\", className)}\n {...props}\n />\n )\n}\n\nfunction ToastTitle({ className, ...props }: ToastTitleProps) {\n return (\n <ToastPrimitive.Title\n data-slot=\"toast-title\"\n className={cn(\"text-sm font-medium\", className)}\n {...props}\n />\n )\n}\n\nfunction ToastDescription({ className, ...props }: ToastDescriptionProps) {\n return (\n <ToastPrimitive.Description\n data-slot=\"toast-description\"\n className={cn(\"text-muted-foreground text-sm\", className)}\n {...props}\n />\n )\n}\n\nfunction ToastAction({ className, ...props }: ToastActionProps) {\n return (\n <ToastPrimitive.Action\n data-slot=\"toast-action\"\n className={cn(\n \"hover:bg-muted inline-flex h-7 items-center rounded-md border px-2.5 text-xs font-medium transition-colors\",\n className,\n )}\n {...props}\n />\n )\n}\n\nfunction ToastClose({ className, children, ...props }: ToastCloseProps) {\n return (\n <ToastPrimitive.Close\n data-slot=\"toast-close\"\n className={cn(\n \"text-muted-foreground hover:text-foreground shrink-0 rounded-md p-0.5 transition-colors\",\n className,\n )}\n {...props}\n >\n {children ?? (\n <>\n <CloseIcon className=\"size-4\" />\n <span className=\"sr-only\">Close</span>\n </>\n )}\n </ToastPrimitive.Close>\n )\n}\n\n// ---------------------------------------------------------------------------\n// 3D stacking\n// ---------------------------------------------------------------------------\n\n// Shared classes for both top and bottom positions\nconst STACKING_BASE = [\n // CSS custom properties\n \"[--toast-gap:0.5rem]\",\n \"[--toast-peek:0.5rem]\",\n \"[--toast-scale:calc(max(0,1-(var(--toast-index)*0.05)))]\",\n \"[--toast-shrink:calc(1-var(--toast-scale))]\",\n \"[--toast-stack-height:var(--toast-frontmost-height,var(--toast-height))]\",\n // Layout\n \"absolute w-full\",\n \"[z-index:calc(1000-var(--toast-index))]\",\n \"h-[var(--toast-stack-height)] data-[expanded]:h-[var(--toast-height)]\",\n // Depth blur — subtle defocus on behind toasts, cleared on expand\n \"[filter:blur(calc(var(--toast-index)*0.4px))]\",\n \"data-[expanded]:[filter:none]\",\n // Expanded (hover)\n \"data-[expanded]:[transform:translateX(var(--toast-swipe-movement-x))_translateY(calc(var(--toast-stack-offset-y)))]\",\n // Exit — shared\n \"data-[ending-style]:opacity-0\",\n \"data-[ending-style]:data-[swipe-direction=down]:[transform:translateY(calc(var(--toast-swipe-movement-y)+150%))]\",\n \"data-[expanded]:data-[ending-style]:data-[swipe-direction=down]:[transform:translateY(calc(var(--toast-swipe-movement-y)+150%))]\",\n \"data-[ending-style]:data-[swipe-direction=right]:[transform:translateX(calc(var(--toast-swipe-movement-x)+150%))_translateY(var(--toast-stack-offset-y))]\",\n \"data-[expanded]:data-[ending-style]:data-[swipe-direction=right]:[transform:translateX(calc(var(--toast-swipe-movement-x)+150%))_translateY(var(--toast-stack-offset-y))]\",\n \"data-[ending-style]:data-[swipe-direction=up]:[transform:translateY(calc(var(--toast-swipe-movement-y)-150%))]\",\n \"data-[expanded]:data-[ending-style]:data-[swipe-direction=up]:[transform:translateY(calc(var(--toast-swipe-movement-y)-150%))]\",\n \"data-[limited]:opacity-0\",\n \"[transition:transform_0.5s_cubic-bezier(0.22,1,0.36,1),opacity_0.5s,filter_0.5s,height_0.15s]\",\n].join(\" \")\n\n// Direction-specific classes — sign flips for anchor, offset, transform, enter/exit\nconst STACKING_TOP = [\n \"[--toast-stack-offset-y:calc(var(--toast-offset-y)+calc(var(--toast-index)*var(--toast-gap))+var(--toast-swipe-movement-y))]\",\n \"top-0 origin-top\",\n \"[transform:translateX(var(--toast-swipe-movement-x))_translateY(calc(var(--toast-swipe-movement-y)+(var(--toast-index)*var(--toast-peek))+(var(--toast-shrink)*var(--toast-stack-height))))_scale(var(--toast-scale))]\",\n \"after:absolute after:bottom-full after:left-0 after:h-[calc(var(--toast-gap)+1px)] after:w-full after:content-['']\",\n \"data-[starting-style]:[transform:translateY(-150%)]\",\n \"[&[data-ending-style]:not([data-limited]):not([data-swipe-direction])]:[transform:translateY(-150%)]\",\n].join(\" \")\n\nconst STACKING_BOTTOM = [\n \"[--toast-stack-offset-y:calc(var(--toast-offset-y)*-1+calc(var(--toast-index)*var(--toast-gap)*-1)+var(--toast-swipe-movement-y))]\",\n \"bottom-0 origin-bottom\",\n \"[transform:translateX(var(--toast-swipe-movement-x))_translateY(calc(var(--toast-swipe-movement-y)-(var(--toast-index)*var(--toast-peek))-(var(--toast-shrink)*var(--toast-stack-height))))_scale(var(--toast-scale))]\",\n \"after:absolute after:top-full after:left-0 after:h-[calc(var(--toast-gap)+1px)] after:w-full after:content-['']\",\n \"data-[starting-style]:[transform:translateY(150%)]\",\n \"[&[data-ending-style]:not([data-limited]):not([data-swipe-direction])]:[transform:translateY(150%)]\",\n].join(\" \")\n\nconst STACKING_TOP_CLASS = `${STACKING_BASE} ${STACKING_TOP}`\nconst STACKING_BOTTOM_CLASS = `${STACKING_BASE} ${STACKING_BOTTOM}`\n\n// ---------------------------------------------------------------------------\n// Toaster\n// ---------------------------------------------------------------------------\n\nfunction ToasterContent({ position = \"bottom-right\" }: Pick<ToasterProps, \"position\">) {\n const { toasts } = ToastPrimitive.useToastManager()\n const isTop = position.startsWith(\"top\")\n\n return (\n <ToastPrimitive.Portal>\n <ToastPrimitive.Viewport\n data-slot=\"toast-viewport\"\n className={cn(toastViewportVariants({ position }))}\n >\n {toasts.map((t) => (\n <Toast\n key={t.id}\n toast={t}\n swipeDirection={isTop ? [\"up\", \"right\"] : [\"down\", \"right\"]}\n className={isTop ? STACKING_TOP_CLASS : STACKING_BOTTOM_CLASS}\n >\n <ToastPrimitive.Content\n data-slot=\"toast-content\"\n className=\"flex items-start gap-3 overflow-hidden transition-opacity duration-250 data-[behind]:pointer-events-none data-[behind]:opacity-0 data-[expanded]:pointer-events-auto data-[expanded]:opacity-100\"\n >\n <ToastIcon type={t.type as ToastType | undefined} />\n\n <ToastBody>\n {t.title && <ToastTitle>{t.title}</ToastTitle>}\n {t.description && (\n <ToastDescription>{t.description}</ToastDescription>\n )}\n {t.actionProps && (\n <div className=\"mt-1.5\">\n <ToastAction {...t.actionProps} />\n </div>\n )}\n </ToastBody>\n\n <ToastClose />\n </ToastPrimitive.Content>\n </Toast>\n ))}\n </ToastPrimitive.Viewport>\n </ToastPrimitive.Portal>\n )\n}\n\nfunction Toaster({ position, limit, timeout }: ToasterProps) {\n return (\n <ToastPrimitive.Provider\n toastManager={toastManager}\n limit={limit}\n timeout={timeout}\n >\n <ToasterContent position={position} />\n </ToastPrimitive.Provider>\n )\n}\n\nexport {\n toastRootClass,\n toastIconVariants,\n toastViewportVariants,\n toastManager,\n toast,\n Toaster,\n Toast,\n ToastIcon,\n ToastTitle,\n ToastDescription,\n ToastAction,\n ToastClose,\n}\n\nexport type {\n ToastType,\n ToastOptions,\n ToasterPosition,\n ToasterProps\n}"],"mappings":";;;;;;;;AAoBA,MAAM,iBACJ;AAEF,MAAM,oBAAoB,IACxB,0BACA,EACE,UAAU,EACR,MAAM;CACJ,SAAS;CACT,SAAS;CACT,MAAM;CACN,SAAS;CACT,OAAO;CACR,EACF,EACF,CACF;AAED,MAAM,wBAAwB,IAC5B,sDACA;CACE,UAAU,EACR,UAAU;EACR,YAAY;EACZ,cAAc;EACd,aAAa;EACb,eAAe;EACf,iBAAiB;EACjB,gBAAgB;EACjB,EACF;CACD,iBAAiB,EACf,UAAU,gBACX;CACF,C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AExC,QACE,oBAACA,QAAe,QAAhB,EAAA,UACE,oBAACA,QAAe,UAAhB;EACE,aAAU;EACV,WAAW,GAAG,sBAAsB,EAAE,UAAU,CAAC,CAAC;YAEjD,OAAO,KAAK,MACX,oBAAC,OAAD;GAEE,OAAO;GACP,gBAAgB,QAAQ,CAAC,MAAM,QAAQ,GAAG,CAAC,QAAQ,QAAQ;GAC3D,WAAW,QAAQ,qBAAqB;aAExC,qBAACA,QAAe,SAAhB;IACE,aAAU;IACV,WAAU;cAFZ;KAIE,oBAAC,WAAD,EAAW,MAAM,EAAE,MAAiC,CAAA;KAEpD,qBAAC,WAAD,EAAA,UAAA;MACG,EAAE,SAAS,oBAAC,YAAD,EAAA,UAAa,EAAE,OAAmB,CAAA;MAC7C,EAAE,eACD,oBAAC,kBAAD,EAAA,UAAmB,EAAE,aAA+B,CAAA;MAErD,EAAE,eACD,oBAAC,OAAD;OAAK,WAAU;iBACb,oBAAC,aAAD,EAAa,GAAI,EAAE,aAAe,CAAA;OAC9B,CAAA;MAEE,EAAA,CAAA;KAEZ,oBAAC,YAAD,EAAc,CAAA;KACS;;GACnB,EAzBD,EAAE,GAyBD,CACR;EACsB,CAAA,EACJ,CAAA;;AAI5B,SAAS,QAAQ,EAAE,UAAU,OAAO,WAAyB;AAC3D,QACE,oBAACA,QAAe,UAAhB;EACgB;EACP;EACE;YAET,oBAAC,gBAAD,EAA0B,UAAY,CAAA;EACd,CAAA"}
|
package/dist/toggle.js
CHANGED
|
@@ -5,7 +5,7 @@ import { jsx } from "react/jsx-runtime";
|
|
|
5
5
|
import { cva } from "class-variance-authority";
|
|
6
6
|
import { Toggle as Toggle$1 } from "@base-ui/react/toggle";
|
|
7
7
|
//#region src/toggle.tsx
|
|
8
|
-
const toggleVariants = cva("cursor-clickable hover:text-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive data-pressed:bg-muted gap-1 rounded-lg text-sm font-medium transition-
|
|
8
|
+
const toggleVariants = cva("cursor-clickable hover:text-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive data-pressed:bg-muted gap-1 rounded-lg text-sm font-medium transition-[color,background-color,border-color,box-shadow] [&_svg:not([class*='size-'])]:size-4 group/toggle hover:bg-muted inline-flex items-center justify-center whitespace-nowrap outline-none focus-visible:ring-3 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0", {
|
|
9
9
|
variants: {
|
|
10
10
|
variant: {
|
|
11
11
|
default: "bg-transparent",
|
package/dist/toggle.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toggle.js","names":["TogglePrimitive"],"sources":["../src/toggle.tsx"],"sourcesContent":["\"use client\"\n\nimport * as React from \"react\"\nimport { Toggle as TogglePrimitive } from \"@base-ui/react/toggle\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\n\nimport { cn } from \"./lib/utils\"\n\nconst toggleVariants = cva(\n \"cursor-clickable hover:text-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive data-pressed:bg-muted gap-1 rounded-lg text-sm font-medium transition-
|
|
1
|
+
{"version":3,"file":"toggle.js","names":["TogglePrimitive"],"sources":["../src/toggle.tsx"],"sourcesContent":["\"use client\"\n\nimport * as React from \"react\"\nimport { Toggle as TogglePrimitive } from \"@base-ui/react/toggle\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\n\nimport { cn } from \"./lib/utils\"\n\nconst toggleVariants = cva(\n \"cursor-clickable hover:text-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive data-pressed:bg-muted gap-1 rounded-lg text-sm font-medium transition-[color,background-color,border-color,box-shadow] [&_svg:not([class*='size-'])]:size-4 group/toggle hover:bg-muted inline-flex items-center justify-center whitespace-nowrap outline-none focus-visible:ring-3 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0\",\n {\n variants: {\n variant: {\n default: \"bg-transparent\",\n outline: \"border-input hover:bg-muted border bg-transparent\",\n },\n size: {\n default: \"h-8 min-w-8 px-2\",\n sm: \"h-7 min-w-7 rounded-[min(var(--radius-md),12px)] px-1.5 text-[0.8rem]\",\n lg: \"h-9 min-w-9 px-2.5\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n size: \"default\",\n },\n },\n)\n\ntype ToggleProps = React.ComponentProps<typeof TogglePrimitive> &\n VariantProps<typeof toggleVariants>\n\nfunction Toggle({\n className,\n variant = \"default\",\n size = \"default\",\n ...props\n}: ToggleProps) {\n return (\n <TogglePrimitive\n data-slot=\"toggle\"\n className={cn(toggleVariants({ variant, size, className }))}\n {...props}\n />\n )\n}\n\nexport { Toggle, toggleVariants }\n"],"mappings":";;;;;;;AAQA,MAAM,iBAAiB,IACrB,wjBACA;CACE,UAAU;EACR,SAAS;GACP,SAAS;GACT,SAAS;GACV;EACD,MAAM;GACJ,SAAS;GACT,IAAI;GACJ,IAAI;GACL;EACF;CACD,iBAAiB;EACf,SAAS;EACT,MAAM;EACP;CACF,CACF;AAKD,SAAS,OAAO,EACd,WACA,UAAU,WACV,OAAO,WACP,GAAG,SACW;AACd,QACE,oBAACA,UAAD;EACE,aAAU;EACV,WAAW,GAAG,eAAe;GAAE;GAAS;GAAM;GAAW,CAAC,CAAC;EAC3D,GAAI;EACJ,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@waveso/ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.1",
|
|
4
4
|
"description": "Wave UI component library built on Base UI and Tailwind CSS",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": [
|
|
@@ -29,6 +29,8 @@
|
|
|
29
29
|
"build": "tsdown && cp src/styles.css dist/styles.css",
|
|
30
30
|
"dev": "tsdown --watch",
|
|
31
31
|
"typecheck": "tsc --noEmit",
|
|
32
|
+
"test": "vitest run",
|
|
33
|
+
"test:watch": "vitest",
|
|
32
34
|
"clean": "rm -rf dist",
|
|
33
35
|
"storybook": "storybook dev -p 6006",
|
|
34
36
|
"build-storybook": "storybook build",
|
|
@@ -38,7 +40,7 @@
|
|
|
38
40
|
"release": "npm run build && changeset publish"
|
|
39
41
|
},
|
|
40
42
|
"peerDependencies": {
|
|
41
|
-
"@base-ui/react": "^1.
|
|
43
|
+
"@base-ui/react": "^1.5.0",
|
|
42
44
|
"class-variance-authority": "^0.7.0",
|
|
43
45
|
"clsx": "^2.0.0",
|
|
44
46
|
"react": "^19.0.0",
|
|
@@ -66,31 +68,38 @@
|
|
|
66
68
|
}
|
|
67
69
|
},
|
|
68
70
|
"devDependencies": {
|
|
69
|
-
"@base-ui/react": "^1.
|
|
71
|
+
"@base-ui/react": "^1.5.0",
|
|
70
72
|
"@changesets/cli": "^2.27.0",
|
|
71
|
-
"@storybook/addon-a11y": "
|
|
72
|
-
"@storybook/addon-docs": "
|
|
73
|
-
"@storybook/addon-themes": "
|
|
74
|
-
"@storybook/react-vite": "
|
|
73
|
+
"@storybook/addon-a11y": "~10.4.0",
|
|
74
|
+
"@storybook/addon-docs": "~10.4.0",
|
|
75
|
+
"@storybook/addon-themes": "~10.4.0",
|
|
76
|
+
"@storybook/react-vite": "~10.4.0",
|
|
75
77
|
"@tailwindcss/vite": "^4.2.1",
|
|
78
|
+
"@testing-library/dom": "^10.4.1",
|
|
79
|
+
"@testing-library/react": "^16.3.2",
|
|
80
|
+
"@testing-library/user-event": "^14.6.1",
|
|
76
81
|
"@types/react": "^19",
|
|
77
82
|
"@types/react-dom": "^19",
|
|
78
83
|
"class-variance-authority": "^0.7.1",
|
|
79
84
|
"clsx": "^2.1.1",
|
|
80
85
|
"embla-carousel-react": "^8.6.0",
|
|
81
86
|
"input-otp": "^1.4.2",
|
|
87
|
+
"jsdom": "^29.1.1",
|
|
82
88
|
"motion": "^12.31.0",
|
|
83
89
|
"react": "^19.2.0",
|
|
84
90
|
"react-day-picker": "^9.13.0",
|
|
85
91
|
"react-dom": "^19.2.0",
|
|
86
92
|
"react-hook-form": "^7.66.0",
|
|
87
|
-
"storybook": "
|
|
93
|
+
"storybook": "~10.4.0",
|
|
88
94
|
"tailwind-merge": "^3.4.0",
|
|
89
95
|
"tailwindcss": "^4.2.1",
|
|
90
96
|
"tsdown": "0.21.10",
|
|
91
|
-
"tw-animate-css": "^1.4.0",
|
|
92
97
|
"typescript": "^5.7.0",
|
|
93
98
|
"usehooks-ts": "^3.1.1",
|
|
94
|
-
"vite": "^7.3.1"
|
|
99
|
+
"vite": "^7.3.1",
|
|
100
|
+
"vitest": "^4.1.7"
|
|
101
|
+
},
|
|
102
|
+
"dependencies": {
|
|
103
|
+
"tw-animate-css": "^1.4.0"
|
|
95
104
|
}
|
|
96
105
|
}
|