@tetrascience-npm/tetrascience-react-ui 1.0.0-beta.142.1 → 1.0.0-beta.144.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/components/composed/PlateMapEditor/PlateMapPlateSelector.cjs +1 -1
- package/dist/components/composed/PlateMapEditor/PlateMapPlateSelector.cjs.map +1 -1
- package/dist/components/composed/PlateMapEditor/PlateMapPlateSelector.js +33 -32
- package/dist/components/composed/PlateMapEditor/PlateMapPlateSelector.js.map +1 -1
- package/dist/components/ui/toggle-group.d.ts +16 -1
- package/dist/index.css +1 -1
- package/dist/index.tailwind.css +1 -1
- package/dist/ui/dialog.cjs +1 -1
- package/dist/ui/dialog.cjs.map +1 -1
- package/dist/ui/dialog.js +12 -0
- package/dist/ui/dialog.js.map +1 -1
- package/dist/ui/toggle-group.cjs +1 -1
- package/dist/ui/toggle-group.cjs.map +1 -1
- package/dist/ui/toggle-group.js +80 -52
- package/dist/ui/toggle-group.js.map +1 -1
- package/dist/ui/toggle.cjs +1 -1
- package/dist/ui/toggle.cjs.map +1 -1
- package/dist/ui/toggle.js +14 -14
- package/dist/ui/toggle.js.map +1 -1
- package/package.json +1 -1
package/dist/ui/dialog.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react/jsx-runtime"),g=require("lucide-react"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react/jsx-runtime"),g=require("lucide-react"),e=require("radix-ui"),s=require("./button.cjs"),l=require("../lib/utils.cjs");function c({...o}){return a.jsx(e.Dialog.Root,{"data-slot":"dialog",...o})}function u({...o}){return a.jsx(e.Dialog.Trigger,{"data-slot":"dialog-trigger",...o})}function r({...o}){return a.jsx(e.Dialog.Portal,{"data-slot":"dialog-portal",...o})}function x({...o}){return a.jsx(e.Dialog.Close,{"data-slot":"dialog-close",...o})}function d({className:o,...t}){return a.jsx(e.Dialog.Overlay,{"data-slot":"dialog-overlay",className:l.cn("fixed inset-0 isolate z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0",o),...t})}function f({className:o,children:t,showCloseButton:i=!0,...n}){return a.jsxs(r,{children:[a.jsx(d,{}),a.jsxs(e.Dialog.Content,{"data-slot":"dialog-content",className:l.cn("fixed top-1/2 left-1/2 z-50 flex flex-col w-[calc(100%-2rem)] max-w-lg max-h-[90svh] -translate-x-1/2 -translate-y-1/2 rounded-xl bg-card/90 dark:bg-background text-sm shadow-elevation-5 ring-1 ring-foreground/10 duration-100 outline-none data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95","[&>*:not([data-slot])]:mx-4 [&>*:not([data-slot])]:my-2 [&>*:not([data-slot])]:w-auto",o),...n,children:[t,i&&a.jsx(e.Dialog.Close,{"data-slot":"dialog-close",asChild:!0,children:a.jsxs(s.Button,{"data-slot":"dialog-close",variant:"ghost",className:"absolute top-2 right-2",size:"icon-sm",children:[a.jsx(g.XIcon,{}),a.jsx("span",{className:"sr-only",children:"Close"})]})})]})]})}function D({className:o,...t}){return a.jsx("div",{"data-slot":"dialog-header",className:l.cn("flex shrink-0 flex-col gap-2 px-4 pt-4 pb-2",o),...t})}function m({className:o,...t}){return a.jsx("div",{"data-slot":"dialog-body",className:l.cn("flex-1 overflow-y-auto px-4 py-2",o),...t})}function p({className:o,showCloseButton:t=!1,children:i,...n}){return a.jsxs("div",{"data-slot":"dialog-footer",className:l.cn("flex shrink-0 flex-col-reverse gap-2 rounded-b-xl border-t bg-muted/50 px-4 py-3 sm:flex-row sm:justify-end",o),...n,children:[i,t&&a.jsx(e.Dialog.Close,{asChild:!0,children:a.jsx(s.Button,{variant:"outline",children:"Close"})})]})}function j({className:o,...t}){return a.jsx(e.Dialog.Title,{"data-slot":"dialog-title",className:l.cn("text-base leading-none font-medium",o),...t})}function h({className:o,...t}){return a.jsx(e.Dialog.Description,{"data-slot":"dialog-description",className:l.cn("text-sm text-muted-foreground *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground",o),...t})}exports.Dialog=c;exports.DialogBody=m;exports.DialogClose=x;exports.DialogContent=f;exports.DialogDescription=h;exports.DialogFooter=p;exports.DialogHeader=D;exports.DialogOverlay=d;exports.DialogPortal=r;exports.DialogTitle=j;exports.DialogTrigger=u;
|
|
2
2
|
//# sourceMappingURL=dialog.cjs.map
|
package/dist/ui/dialog.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dialog.cjs","sources":["../../src/components/ui/dialog.tsx"],"sourcesContent":["import { XIcon } from \"lucide-react\"\nimport { Dialog as DialogPrimitive } from \"radix-ui\"\nimport * as React from \"react\"\n\nimport { Button } from \"@/components/ui/button\"\nimport { cn } from \"@/lib/utils\"\n\nfunction Dialog({\n ...props\n}: React.ComponentProps<typeof DialogPrimitive.Root>) {\n return <DialogPrimitive.Root data-slot=\"dialog\" {...props} />\n}\n\nfunction DialogTrigger({\n ...props\n}: React.ComponentProps<typeof DialogPrimitive.Trigger>) {\n return <DialogPrimitive.Trigger data-slot=\"dialog-trigger\" {...props} />\n}\n\nfunction DialogPortal({\n ...props\n}: React.ComponentProps<typeof DialogPrimitive.Portal>) {\n return <DialogPrimitive.Portal data-slot=\"dialog-portal\" {...props} />\n}\n\nfunction DialogClose({\n ...props\n}: React.ComponentProps<typeof DialogPrimitive.Close>) {\n return <DialogPrimitive.Close data-slot=\"dialog-close\" {...props} />\n}\n\nfunction DialogOverlay({\n className,\n ...props\n}: React.ComponentProps<typeof DialogPrimitive.Overlay>) {\n return (\n <DialogPrimitive.Overlay\n data-slot=\"dialog-overlay\"\n className={cn(\n \"fixed inset-0 isolate z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0\",\n className\n )}\n {...props}\n />\n )\n}\n\nfunction DialogContent({\n className,\n children,\n showCloseButton = true,\n ...props\n}: React.ComponentProps<typeof DialogPrimitive.Content> & {\n showCloseButton?: boolean\n}) {\n return (\n <DialogPortal>\n <DialogOverlay />\n <DialogPrimitive.Content\n data-slot=\"dialog-content\"\n className={cn(\n \"fixed top-1/2 left-1/2 z-50 flex flex-col w-[calc(100%-2rem)] max-w-lg max-h-[90svh] -translate-x-1/2 -translate-y-1/2 rounded-xl bg-card/90 dark:bg-background text-sm shadow-elevation-5 ring-1 ring-foreground/10 duration-100 outline-none data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95\",\n className\n )}\n {...props}\n >\n {children}\n {showCloseButton && (\n <DialogPrimitive.Close data-slot=\"dialog-close\" asChild>\n <Button\n variant=\"ghost\"\n className=\"absolute top-2 right-2\"\n size=\"icon-sm\"\n >\n <XIcon\n />\n <span className=\"sr-only\">Close</span>\n </Button>\n </DialogPrimitive.Close>\n )}\n </DialogPrimitive.Content>\n </DialogPortal>\n )\n}\n\nfunction DialogHeader({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"dialog-header\"\n className={cn(\"flex shrink-0 flex-col gap-2 px-4 pt-4 pb-2\", className)}\n {...props}\n />\n )\n}\n\nfunction DialogBody({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"dialog-body\"\n className={cn(\"flex-1 overflow-y-auto px-4 py-2\", className)}\n {...props}\n />\n )\n}\n\nfunction DialogFooter({\n className,\n showCloseButton = false,\n children,\n ...props\n}: React.ComponentProps<\"div\"> & {\n showCloseButton?: boolean\n}) {\n return (\n <div\n data-slot=\"dialog-footer\"\n className={cn(\n \"flex shrink-0 flex-col-reverse gap-2 rounded-b-xl border-t bg-muted/50 px-4 py-3 sm:flex-row sm:justify-end\",\n className\n )}\n {...props}\n >\n {children}\n {showCloseButton && (\n <DialogPrimitive.Close asChild>\n <Button variant=\"outline\">Close</Button>\n </DialogPrimitive.Close>\n )}\n </div>\n )\n}\n\nfunction DialogTitle({\n className,\n ...props\n}: React.ComponentProps<typeof DialogPrimitive.Title>) {\n return (\n <DialogPrimitive.Title\n data-slot=\"dialog-title\"\n className={cn(\"text-base leading-none font-medium\", className)}\n {...props}\n />\n )\n}\n\nfunction DialogDescription({\n className,\n ...props\n}: React.ComponentProps<typeof DialogPrimitive.Description>) {\n return (\n <DialogPrimitive.Description\n data-slot=\"dialog-description\"\n className={cn(\n \"text-sm text-muted-foreground *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground\",\n className\n )}\n {...props}\n />\n )\n}\n\nexport {\n Dialog,\n DialogBody,\n DialogClose,\n DialogContent,\n DialogDescription,\n DialogFooter,\n DialogHeader,\n DialogOverlay,\n DialogPortal,\n DialogTitle,\n DialogTrigger,\n}\n"],"names":["Dialog","props","DialogPrimitive","DialogTrigger","DialogPortal","DialogClose","DialogOverlay","className","jsx","cn","DialogContent","children","showCloseButton","jsxs","Button","XIcon","DialogHeader","DialogBody","DialogFooter","DialogTitle","DialogDescription"],"mappings":"6NAOA,SAASA,EAAO,CACd,GAAGC,CACL,EAAsD,CACpD,aAAQC,EAAAA,OAAgB,KAAhB,CAAqB,YAAU,SAAU,GAAGD,EAAO,CAC7D,CAEA,SAASE,EAAc,CACrB,GAAGF,CACL,EAAyD,CACvD,aAAQC,EAAAA,OAAgB,QAAhB,CAAwB,YAAU,iBAAkB,GAAGD,EAAO,CACxE,CAEA,SAASG,EAAa,CACpB,GAAGH,CACL,EAAwD,CACtD,aAAQC,EAAAA,OAAgB,OAAhB,CAAuB,YAAU,gBAAiB,GAAGD,EAAO,CACtE,CAEA,SAASI,EAAY,CACnB,GAAGJ,CACL,EAAuD,CACrD,aAAQC,EAAAA,OAAgB,MAAhB,CAAsB,YAAU,eAAgB,GAAGD,EAAO,CACpE,CAEA,SAASK,EAAc,CACrB,UAAAC,EACA,GAAGN,CACL,EAAyD,CACvD,OACEO,EAAAA,IAACN,EAAAA,OAAgB,QAAhB,CACC,YAAU,iBACV,UAAWO,EAAAA,GACT,wLACAF,CAAA,EAED,GAAGN,CAAA,CAAA,CAGV,CAEA,SAASS,EAAc,CACrB,UAAAH,EACA,SAAAI,EACA,gBAAAC,EAAkB,GAClB,GAAGX,CACL,EAEG,CACD,cACGG,EAAA,CACC,SAAA,CAAAI,EAAAA,IAACF,EAAA,EAAc,EACfO,EAAAA,KAACX,EAAAA,OAAgB,QAAhB,CACC,YAAU,iBACV,UAAWO,EAAAA,GACT,
|
|
1
|
+
{"version":3,"file":"dialog.cjs","sources":["../../src/components/ui/dialog.tsx"],"sourcesContent":["import { XIcon } from \"lucide-react\"\nimport { Dialog as DialogPrimitive } from \"radix-ui\"\nimport * as React from \"react\"\n\nimport { Button } from \"@/components/ui/button\"\nimport { cn } from \"@/lib/utils\"\n\nfunction Dialog({\n ...props\n}: React.ComponentProps<typeof DialogPrimitive.Root>) {\n return <DialogPrimitive.Root data-slot=\"dialog\" {...props} />\n}\n\nfunction DialogTrigger({\n ...props\n}: React.ComponentProps<typeof DialogPrimitive.Trigger>) {\n return <DialogPrimitive.Trigger data-slot=\"dialog-trigger\" {...props} />\n}\n\nfunction DialogPortal({\n ...props\n}: React.ComponentProps<typeof DialogPrimitive.Portal>) {\n return <DialogPrimitive.Portal data-slot=\"dialog-portal\" {...props} />\n}\n\nfunction DialogClose({\n ...props\n}: React.ComponentProps<typeof DialogPrimitive.Close>) {\n return <DialogPrimitive.Close data-slot=\"dialog-close\" {...props} />\n}\n\nfunction DialogOverlay({\n className,\n ...props\n}: React.ComponentProps<typeof DialogPrimitive.Overlay>) {\n return (\n <DialogPrimitive.Overlay\n data-slot=\"dialog-overlay\"\n className={cn(\n \"fixed inset-0 isolate z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0\",\n className\n )}\n {...props}\n />\n )\n}\n\nfunction DialogContent({\n className,\n children,\n showCloseButton = true,\n ...props\n}: React.ComponentProps<typeof DialogPrimitive.Content> & {\n showCloseButton?: boolean\n}) {\n return (\n <DialogPortal>\n <DialogOverlay />\n <DialogPrimitive.Content\n data-slot=\"dialog-content\"\n className={cn(\n \"fixed top-1/2 left-1/2 z-50 flex flex-col w-[calc(100%-2rem)] max-w-lg max-h-[90svh] -translate-x-1/2 -translate-y-1/2 rounded-xl bg-card/90 dark:bg-background text-sm shadow-elevation-5 ring-1 ring-foreground/10 duration-100 outline-none data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95\",\n // Safeguard: DialogContent itself has no padding (so the footer can\n // bleed full-width). Any *unslotted* child dropped straight in — raw\n // text/elements with no data-slot — is inset with mx-4 / my-2 so it's\n // never flush to the edges or butted onto the footer (SW-2528). A\n // present data-slot marks a known component (the dialog-* parts, but\n // also full-bleed children like Command in CommandDialog /\n // ModelSelector that intentionally pass p-0 + size-full), which we\n // must leave untouched. Margin (not padding) insets an element that\n // has its own background as a whole; w-auto overrides a child's w-full\n // so the margins actually shrink it instead of overflowing.\n \"[&>*:not([data-slot])]:mx-4 [&>*:not([data-slot])]:my-2 [&>*:not([data-slot])]:w-auto\",\n className\n )}\n {...props}\n >\n {children}\n {showCloseButton && (\n <DialogPrimitive.Close data-slot=\"dialog-close\" asChild>\n <Button\n // explicit dialog-close slot (overrides Button's own data-slot) so\n // the DialogContent padding safeguard above skips this button\n data-slot=\"dialog-close\"\n variant=\"ghost\"\n className=\"absolute top-2 right-2\"\n size=\"icon-sm\"\n >\n <XIcon\n />\n <span className=\"sr-only\">Close</span>\n </Button>\n </DialogPrimitive.Close>\n )}\n </DialogPrimitive.Content>\n </DialogPortal>\n )\n}\n\nfunction DialogHeader({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"dialog-header\"\n className={cn(\"flex shrink-0 flex-col gap-2 px-4 pt-4 pb-2\", className)}\n {...props}\n />\n )\n}\n\nfunction DialogBody({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"dialog-body\"\n className={cn(\"flex-1 overflow-y-auto px-4 py-2\", className)}\n {...props}\n />\n )\n}\n\nfunction DialogFooter({\n className,\n showCloseButton = false,\n children,\n ...props\n}: React.ComponentProps<\"div\"> & {\n showCloseButton?: boolean\n}) {\n return (\n <div\n data-slot=\"dialog-footer\"\n className={cn(\n \"flex shrink-0 flex-col-reverse gap-2 rounded-b-xl border-t bg-muted/50 px-4 py-3 sm:flex-row sm:justify-end\",\n className\n )}\n {...props}\n >\n {children}\n {showCloseButton && (\n <DialogPrimitive.Close asChild>\n <Button variant=\"outline\">Close</Button>\n </DialogPrimitive.Close>\n )}\n </div>\n )\n}\n\nfunction DialogTitle({\n className,\n ...props\n}: React.ComponentProps<typeof DialogPrimitive.Title>) {\n return (\n <DialogPrimitive.Title\n data-slot=\"dialog-title\"\n className={cn(\"text-base leading-none font-medium\", className)}\n {...props}\n />\n )\n}\n\nfunction DialogDescription({\n className,\n ...props\n}: React.ComponentProps<typeof DialogPrimitive.Description>) {\n return (\n <DialogPrimitive.Description\n data-slot=\"dialog-description\"\n className={cn(\n \"text-sm text-muted-foreground *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground\",\n className\n )}\n {...props}\n />\n )\n}\n\nexport {\n Dialog,\n DialogBody,\n DialogClose,\n DialogContent,\n DialogDescription,\n DialogFooter,\n DialogHeader,\n DialogOverlay,\n DialogPortal,\n DialogTitle,\n DialogTrigger,\n}\n"],"names":["Dialog","props","DialogPrimitive","DialogTrigger","DialogPortal","DialogClose","DialogOverlay","className","jsx","cn","DialogContent","children","showCloseButton","jsxs","Button","XIcon","DialogHeader","DialogBody","DialogFooter","DialogTitle","DialogDescription"],"mappings":"6NAOA,SAASA,EAAO,CACd,GAAGC,CACL,EAAsD,CACpD,aAAQC,EAAAA,OAAgB,KAAh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GN,GAAsC,CAC1E,OACEO,EAAAA,IAAC,MAAA,CACC,YAAU,gBACV,UAAWC,EAAAA,GAAG,8CAA+CF,CAAS,EACrE,GAAGN,CAAA,CAAA,CAGV,CAEA,SAASgB,EAAW,CAAE,UAAAV,EAAW,GAAGN,GAAsC,CACxE,OACEO,EAAAA,IAAC,MAAA,CACC,YAAU,cACV,UAAWC,EAAAA,GAAG,mCAAoCF,CAAS,EAC1D,GAAGN,CAAA,CAAA,CAGV,CAEA,SAASiB,EAAa,CACpB,UAAAX,EACA,gBAAAK,EAAkB,GAClB,SAAAD,EACA,GAAGV,CACL,EAEG,CACD,OACEY,EAAAA,KAAC,MAAA,CACC,YAAU,gBACV,UAAWJ,EAAAA,GACT,8GACAF,CAAA,EAED,GAAGN,EAEH,SAAA,CAAAU,EACAC,GACCJ,EAAAA,IAACN,EAAAA,OAAgB,MAAhB,CAAsB,QAAO,GAC5B,SAAAM,EAAAA,IAACM,EAAAA,OAAA,CAAO,QAAQ,UAAU,SAAA,OAAA,CAAK,CAAA,CACjC,CAAA,CAAA,CAAA,CAIR,CAEA,SAASK,EAAY,CACnB,UAAAZ,EACA,GAAGN,CACL,EAAuD,CACrD,OACEO,EAAAA,IAACN,EAAAA,OAAgB,MAAhB,CACC,YAAU,eACV,UAAWO,EAAAA,GAAG,qCAAsCF,CAAS,EAC5D,GAAGN,CAAA,CAAA,CAGV,CAEA,SAASmB,EAAkB,CACzB,UAAAb,EACA,GAAGN,CACL,EAA6D,CAC3D,OACEO,EAAAA,IAACN,EAAAA,OAAgB,YAAhB,CACC,YAAU,qBACV,UAAWO,EAAAA,GACT,qGACAF,CAAA,EAED,GAAGN,CAAA,CAAA,CAGV"}
|
package/dist/ui/dialog.js
CHANGED
|
@@ -53,6 +53,17 @@ function v({
|
|
|
53
53
|
"data-slot": "dialog-content",
|
|
54
54
|
className: l(
|
|
55
55
|
"fixed top-1/2 left-1/2 z-50 flex flex-col w-[calc(100%-2rem)] max-w-lg max-h-[90svh] -translate-x-1/2 -translate-y-1/2 rounded-xl bg-card/90 dark:bg-background text-sm shadow-elevation-5 ring-1 ring-foreground/10 duration-100 outline-none data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",
|
|
56
|
+
// Safeguard: DialogContent itself has no padding (so the footer can
|
|
57
|
+
// bleed full-width). Any *unslotted* child dropped straight in — raw
|
|
58
|
+
// text/elements with no data-slot — is inset with mx-4 / my-2 so it's
|
|
59
|
+
// never flush to the edges or butted onto the footer (SW-2528). A
|
|
60
|
+
// present data-slot marks a known component (the dialog-* parts, but
|
|
61
|
+
// also full-bleed children like Command in CommandDialog /
|
|
62
|
+
// ModelSelector that intentionally pass p-0 + size-full), which we
|
|
63
|
+
// must leave untouched. Margin (not padding) insets an element that
|
|
64
|
+
// has its own background as a whole; w-auto overrides a child's w-full
|
|
65
|
+
// so the margins actually shrink it instead of overflowing.
|
|
66
|
+
"[&>*:not([data-slot])]:mx-4 [&>*:not([data-slot])]:my-2 [&>*:not([data-slot])]:w-auto",
|
|
56
67
|
o
|
|
57
68
|
),
|
|
58
69
|
...i,
|
|
@@ -61,6 +72,7 @@ function v({
|
|
|
61
72
|
r && /* @__PURE__ */ a(e.Close, { "data-slot": "dialog-close", asChild: !0, children: /* @__PURE__ */ n(
|
|
62
73
|
d,
|
|
63
74
|
{
|
|
75
|
+
"data-slot": "dialog-close",
|
|
64
76
|
variant: "ghost",
|
|
65
77
|
className: "absolute top-2 right-2",
|
|
66
78
|
size: "icon-sm",
|
package/dist/ui/dialog.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dialog.js","sources":["../../src/components/ui/dialog.tsx"],"sourcesContent":["import { XIcon } from \"lucide-react\"\nimport { Dialog as DialogPrimitive } from \"radix-ui\"\nimport * as React from \"react\"\n\nimport { Button } from \"@/components/ui/button\"\nimport { cn } from \"@/lib/utils\"\n\nfunction Dialog({\n ...props\n}: React.ComponentProps<typeof DialogPrimitive.Root>) {\n return <DialogPrimitive.Root data-slot=\"dialog\" {...props} />\n}\n\nfunction DialogTrigger({\n ...props\n}: React.ComponentProps<typeof DialogPrimitive.Trigger>) {\n return <DialogPrimitive.Trigger data-slot=\"dialog-trigger\" {...props} />\n}\n\nfunction DialogPortal({\n ...props\n}: React.ComponentProps<typeof DialogPrimitive.Portal>) {\n return <DialogPrimitive.Portal data-slot=\"dialog-portal\" {...props} />\n}\n\nfunction DialogClose({\n ...props\n}: React.ComponentProps<typeof DialogPrimitive.Close>) {\n return <DialogPrimitive.Close data-slot=\"dialog-close\" {...props} />\n}\n\nfunction DialogOverlay({\n className,\n ...props\n}: React.ComponentProps<typeof DialogPrimitive.Overlay>) {\n return (\n <DialogPrimitive.Overlay\n data-slot=\"dialog-overlay\"\n className={cn(\n \"fixed inset-0 isolate z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0\",\n className\n )}\n {...props}\n />\n )\n}\n\nfunction DialogContent({\n className,\n children,\n showCloseButton = true,\n ...props\n}: React.ComponentProps<typeof DialogPrimitive.Content> & {\n showCloseButton?: boolean\n}) {\n return (\n <DialogPortal>\n <DialogOverlay />\n <DialogPrimitive.Content\n data-slot=\"dialog-content\"\n className={cn(\n \"fixed top-1/2 left-1/2 z-50 flex flex-col w-[calc(100%-2rem)] max-w-lg max-h-[90svh] -translate-x-1/2 -translate-y-1/2 rounded-xl bg-card/90 dark:bg-background text-sm shadow-elevation-5 ring-1 ring-foreground/10 duration-100 outline-none data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95\",\n className\n )}\n {...props}\n >\n {children}\n {showCloseButton && (\n <DialogPrimitive.Close data-slot=\"dialog-close\" asChild>\n <Button\n variant=\"ghost\"\n className=\"absolute top-2 right-2\"\n size=\"icon-sm\"\n >\n <XIcon\n />\n <span className=\"sr-only\">Close</span>\n </Button>\n </DialogPrimitive.Close>\n )}\n </DialogPrimitive.Content>\n </DialogPortal>\n )\n}\n\nfunction DialogHeader({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"dialog-header\"\n className={cn(\"flex shrink-0 flex-col gap-2 px-4 pt-4 pb-2\", className)}\n {...props}\n />\n )\n}\n\nfunction DialogBody({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"dialog-body\"\n className={cn(\"flex-1 overflow-y-auto px-4 py-2\", className)}\n {...props}\n />\n )\n}\n\nfunction DialogFooter({\n className,\n showCloseButton = false,\n children,\n ...props\n}: React.ComponentProps<\"div\"> & {\n showCloseButton?: boolean\n}) {\n return (\n <div\n data-slot=\"dialog-footer\"\n className={cn(\n \"flex shrink-0 flex-col-reverse gap-2 rounded-b-xl border-t bg-muted/50 px-4 py-3 sm:flex-row sm:justify-end\",\n className\n )}\n {...props}\n >\n {children}\n {showCloseButton && (\n <DialogPrimitive.Close asChild>\n <Button variant=\"outline\">Close</Button>\n </DialogPrimitive.Close>\n )}\n </div>\n )\n}\n\nfunction DialogTitle({\n className,\n ...props\n}: React.ComponentProps<typeof DialogPrimitive.Title>) {\n return (\n <DialogPrimitive.Title\n data-slot=\"dialog-title\"\n className={cn(\"text-base leading-none font-medium\", className)}\n {...props}\n />\n )\n}\n\nfunction DialogDescription({\n className,\n ...props\n}: React.ComponentProps<typeof DialogPrimitive.Description>) {\n return (\n <DialogPrimitive.Description\n data-slot=\"dialog-description\"\n className={cn(\n \"text-sm text-muted-foreground *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground\",\n className\n )}\n {...props}\n />\n )\n}\n\nexport {\n Dialog,\n DialogBody,\n DialogClose,\n DialogContent,\n DialogDescription,\n DialogFooter,\n DialogHeader,\n DialogOverlay,\n DialogPortal,\n DialogTitle,\n DialogTrigger,\n}\n"],"names":["Dialog","props","DialogPrimitive","DialogTrigger","DialogPortal","DialogClose","DialogOverlay","className","jsx","cn","DialogContent","children","showCloseButton","jsxs","Button","XIcon","DialogHeader","DialogBody","DialogFooter","DialogTitle","DialogDescription"],"mappings":";;;;;AAOA,SAASA,EAAO;AAAA,EACd,GAAGC;AACL,GAAsD;AACpD,2BAAQC,EAAgB,MAAhB,EAAqB,aAAU,UAAU,GAAGD,GAAO;AAC7D;AAEA,SAASE,EAAc;AAAA,EACrB,GAAGF;AACL,GAAyD;AACvD,2BAAQC,EAAgB,SAAhB,EAAwB,aAAU,kBAAkB,GAAGD,GAAO;AACxE;AAEA,SAASG,EAAa;AAAA,EACpB,GAAGH;AACL,GAAwD;AACtD,2BAAQC,EAAgB,QAAhB,EAAuB,aAAU,iBAAiB,GAAGD,GAAO;AACtE;AAEA,SAASI,EAAY;AAAA,EACnB,GAAGJ;AACL,GAAuD;AACrD,2BAAQC,EAAgB,OAAhB,EAAsB,aAAU,gBAAgB,GAAGD,GAAO;AACpE;AAEA,SAASK,EAAc;AAAA,EACrB,WAAAC;AAAA,EACA,GAAGN;AACL,GAAyD;AACvD,SACE,gBAAAO;AAAA,IAACN,EAAgB;AAAA,IAAhB;AAAA,MACC,aAAU;AAAA,MACV,WAAWO;AAAA,QACT;AAAA,QACAF;AAAA,MAAA;AAAA,MAED,GAAGN;AAAA,IAAA;AAAA,EAAA;AAGV;AAEA,SAASS,EAAc;AAAA,EACrB,WAAAH;AAAA,EACA,UAAAI;AAAA,EACA,iBAAAC,IAAkB;AAAA,EAClB,GAAGX;AACL,GAEG;AACD,2BACGG,GAAA,EACC,UAAA;AAAA,IAAA,gBAAAI,EAACF,GAAA,EAAc;AAAA,IACf,gBAAAO;AAAA,MAACX,EAAgB;AAAA,MAAhB;AAAA,QACC,aAAU;AAAA,QACV,WAAWO;AAAA,UACT;AAAA,UACAF;AAAA,QAAA;AAAA,QAED,GAAGN;AAAA,QAEH,UAAA;AAAA,UAAAU;AAAA,UACAC,uBACEV,EAAgB,OAAhB,EAAsB,aAAU,gBAAe,SAAO,IACrD,UAAA,gBAAAW;AAAA,YAACC;AAAA,YAAA;AAAA,
|
|
1
|
+
{"version":3,"file":"dialog.js","sources":["../../src/components/ui/dialog.tsx"],"sourcesContent":["import { XIcon } from \"lucide-react\"\nimport { Dialog as DialogPrimitive } from \"radix-ui\"\nimport * as React from \"react\"\n\nimport { Button } from \"@/components/ui/button\"\nimport { cn } from \"@/lib/utils\"\n\nfunction Dialog({\n ...props\n}: React.ComponentProps<typeof DialogPrimitive.Root>) {\n return <DialogPrimitive.Root data-slot=\"dialog\" {...props} />\n}\n\nfunction DialogTrigger({\n ...props\n}: React.ComponentProps<typeof DialogPrimitive.Trigger>) {\n return <DialogPrimitive.Trigger data-slot=\"dialog-trigger\" {...props} />\n}\n\nfunction DialogPortal({\n ...props\n}: React.ComponentProps<typeof DialogPrimitive.Portal>) {\n return <DialogPrimitive.Portal data-slot=\"dialog-portal\" {...props} />\n}\n\nfunction DialogClose({\n ...props\n}: React.ComponentProps<typeof DialogPrimitive.Close>) {\n return <DialogPrimitive.Close data-slot=\"dialog-close\" {...props} />\n}\n\nfunction DialogOverlay({\n className,\n ...props\n}: React.ComponentProps<typeof DialogPrimitive.Overlay>) {\n return (\n <DialogPrimitive.Overlay\n data-slot=\"dialog-overlay\"\n className={cn(\n \"fixed inset-0 isolate z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0\",\n className\n )}\n {...props}\n />\n )\n}\n\nfunction DialogContent({\n className,\n children,\n showCloseButton = true,\n ...props\n}: React.ComponentProps<typeof DialogPrimitive.Content> & {\n showCloseButton?: boolean\n}) {\n return (\n <DialogPortal>\n <DialogOverlay />\n <DialogPrimitive.Content\n data-slot=\"dialog-content\"\n className={cn(\n \"fixed top-1/2 left-1/2 z-50 flex flex-col w-[calc(100%-2rem)] max-w-lg max-h-[90svh] -translate-x-1/2 -translate-y-1/2 rounded-xl bg-card/90 dark:bg-background text-sm shadow-elevation-5 ring-1 ring-foreground/10 duration-100 outline-none data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95\",\n // Safeguard: DialogContent itself has no padding (so the footer can\n // bleed full-width). Any *unslotted* child dropped straight in — raw\n // text/elements with no data-slot — is inset with mx-4 / my-2 so it's\n // never flush to the edges or butted onto the footer (SW-2528). A\n // present data-slot marks a known component (the dialog-* parts, but\n // also full-bleed children like Command in CommandDialog /\n // ModelSelector that intentionally pass p-0 + size-full), which we\n // must leave untouched. Margin (not padding) insets an element that\n // has its own background as a whole; w-auto overrides a child's w-full\n // so the margins actually shrink it instead of overflowing.\n \"[&>*:not([data-slot])]:mx-4 [&>*:not([data-slot])]:my-2 [&>*:not([data-slot])]:w-auto\",\n className\n )}\n {...props}\n >\n {children}\n {showCloseButton && (\n <DialogPrimitive.Close data-slot=\"dialog-close\" asChild>\n <Button\n // explicit dialog-close slot (overrides Button's own data-slot) so\n // the DialogContent padding safeguard above skips this button\n data-slot=\"dialog-close\"\n variant=\"ghost\"\n className=\"absolute top-2 right-2\"\n size=\"icon-sm\"\n >\n <XIcon\n />\n <span className=\"sr-only\">Close</span>\n </Button>\n </DialogPrimitive.Close>\n )}\n </DialogPrimitive.Content>\n </DialogPortal>\n )\n}\n\nfunction DialogHeader({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"dialog-header\"\n className={cn(\"flex shrink-0 flex-col gap-2 px-4 pt-4 pb-2\", className)}\n {...props}\n />\n )\n}\n\nfunction DialogBody({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"dialog-body\"\n className={cn(\"flex-1 overflow-y-auto px-4 py-2\", className)}\n {...props}\n />\n )\n}\n\nfunction DialogFooter({\n className,\n showCloseButton = false,\n children,\n ...props\n}: React.ComponentProps<\"div\"> & {\n showCloseButton?: boolean\n}) {\n return (\n <div\n data-slot=\"dialog-footer\"\n className={cn(\n \"flex shrink-0 flex-col-reverse gap-2 rounded-b-xl border-t bg-muted/50 px-4 py-3 sm:flex-row sm:justify-end\",\n className\n )}\n {...props}\n >\n {children}\n {showCloseButton && (\n <DialogPrimitive.Close asChild>\n <Button variant=\"outline\">Close</Button>\n </DialogPrimitive.Close>\n )}\n </div>\n )\n}\n\nfunction DialogTitle({\n className,\n ...props\n}: React.ComponentProps<typeof DialogPrimitive.Title>) {\n return (\n <DialogPrimitive.Title\n data-slot=\"dialog-title\"\n className={cn(\"text-base leading-none font-medium\", className)}\n {...props}\n />\n )\n}\n\nfunction DialogDescription({\n className,\n ...props\n}: React.ComponentProps<typeof DialogPrimitive.Description>) {\n return (\n <DialogPrimitive.Description\n data-slot=\"dialog-description\"\n className={cn(\n \"text-sm text-muted-foreground *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground\",\n className\n )}\n {...props}\n />\n )\n}\n\nexport {\n Dialog,\n DialogBody,\n DialogClose,\n DialogContent,\n DialogDescription,\n DialogFooter,\n DialogHeader,\n DialogOverlay,\n DialogPortal,\n DialogTitle,\n DialogTrigger,\n}\n"],"names":["Dialog","props","DialogPrimitive","DialogTrigger","DialogPortal","DialogClose","DialogOverlay","className","jsx","cn","DialogContent","children","showCloseButton","jsxs","Button","XIcon","DialogHeader","DialogBody","DialogFooter","DialogTitle","DialogDescription"],"mappings":";;;;;AAOA,SAASA,EAAO;AAAA,EACd,GAAGC;AACL,GAAsD;AACpD,2BAAQC,EAAgB,MAAhB,EAAqB,aAAU,UAAU,GAAGD,GAAO;AAC7D;AAEA,SAASE,EAAc;AAAA,EACrB,GAAGF;AACL,GAAyD;AACvD,2BAAQC,EAAgB,SAAhB,EAAwB,aAAU,kBAAkB,GAAGD,GAAO;AACxE;AAEA,SAASG,EAAa;AAAA,EACpB,GAAGH;AACL,GAAwD;AACtD,2BAAQC,EAAgB,QAAhB,EAAuB,aAAU,iBAAiB,GAAGD,GAAO;AACtE;AAEA,SAASI,EAAY;AAAA,EACnB,GAAGJ;AACL,GAAuD;AACrD,2BAA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A,IAAA;AAAA,EAAA;AAGV;"}
|
package/dist/ui/toggle-group.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react/jsx-runtime"),d=require("lucide-react"),c=require("radix-ui"),m=require("react"),v=require("./toggle.cjs"),s=require("../lib/utils.cjs");function x(e){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const a=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,a.get?a:{enumerable:!0,get:()=>e[t]})}}return r.default=e,Object.freeze(r)}const u=x(m),p=u.createContext({size:"default",variant:"default",spacing:0,orientation:"horizontal"});function h({className:e,variant:r,size:t,spacing:a=0,orientation:g="horizontal",children:n,...o}){return i.jsx(c.ToggleGroup.Root,{"data-slot":"toggle-group","data-variant":r,"data-size":t,"data-spacing":a,"data-orientation":g,style:{"--gap":a},className:s.cn("group/toggle-group flex w-fit flex-row items-center gap-[--spacing(var(--gap))] rounded-lg data-[size=sm]:rounded-[min(var(--radius-md),10px)] data-vertical:flex-col data-vertical:items-stretch",e),...o,children:i.jsx(p.Provider,{value:{variant:r,size:t,spacing:a,orientation:g},children:n})})}function z({className:e,children:r,variant:t="default",size:a="default",selectedIndicator:g,...n}){const o=u.useContext(p),l=(o.spacing??0)===0,f=o.orientation==="vertical"?"[&:not(:first-child)]:border-t-0":"[&:not(:first-child)]:border-l-0";return i.jsxs(c.ToggleGroup.Item,{"data-slot":"toggle-group-item","data-variant":o.variant||t,"data-size":o.size||a,"data-spacing":o.spacing,className:s.cn("shrink-0 group-data-[spacing=0]/toggle-group:rounded-none group-data-[spacing=0]/toggle-group:px-2 focus:z-10 focus-visible:z-10 group-data-horizontal/toggle-group:data-[spacing=0]:first:rounded-l-lg group-data-vertical/toggle-group:data-[spacing=0]:first:rounded-t-lg group-data-horizontal/toggle-group:data-[spacing=0]:last:rounded-r-lg group-data-vertical/toggle-group:data-[spacing=0]:last:rounded-b-lg",v.toggleVariants({variant:o.variant||t,size:o.size||a}),l&&"border border-input",l&&f,e),...n,children:[g!=="none"&&i.jsxs("span",{"aria-hidden":!0,"data-slot":"toggle-group-indicator",className:s.cn("grid size-4 shrink-0 place-items-center [&>svg]:[grid-area:1/1]",g===void 0&&"group-has-[svg:not([data-slot=toggle-group-indicator]_svg)]/toggle:hidden"),children:[i.jsx(d.CircleDashed,{className:"size-3.5 text-muted-foreground/50 transition-opacity group-data-[state=on]/toggle:opacity-0"}),i.jsx(d.Check,{className:"size-3.5 opacity-0 transition-opacity group-data-[state=on]/toggle:opacity-100"})]}),r]})}exports.ToggleGroup=h;exports.ToggleGroupItem=z;
|
|
2
2
|
//# sourceMappingURL=toggle-group.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toggle-group.cjs","sources":["../../src/components/ui/toggle-group.tsx"],"sourcesContent":["import { type VariantProps } from \"class-variance-authority\"\nimport { ToggleGroup as ToggleGroupPrimitive } from \"radix-ui\"\nimport * as React from \"react\"\n\nimport { toggleVariants } from \"@/components/ui/toggle\"\nimport { cn } from \"@/lib/utils\"\n\nconst ToggleGroupContext = React.createContext<\n VariantProps<typeof toggleVariants> & {\n spacing?: number\n orientation?: \"horizontal\" | \"vertical\"\n }\n>({\n size: \"default\",\n variant: \"default\",\n spacing: 0,\n orientation: \"horizontal\",\n})\n\nfunction ToggleGroup({\n className,\n variant,\n size,\n spacing = 0,\n orientation = \"horizontal\",\n children,\n ...props\n}: React.ComponentProps<typeof ToggleGroupPrimitive.Root> &\n VariantProps<typeof toggleVariants> & {\n spacing?: number\n orientation?: \"horizontal\" | \"vertical\"\n }) {\n return (\n <ToggleGroupPrimitive.Root\n data-slot=\"toggle-group\"\n data-variant={variant}\n data-size={size}\n data-spacing={spacing}\n data-orientation={orientation}\n style={{ \"--gap\": spacing } as React.CSSProperties}\n className={cn(\n \"group/toggle-group flex w-fit flex-row items-center gap-[--spacing(var(--gap))] rounded-lg data-[size=sm]:rounded-[min(var(--radius-md),10px)] data-vertical:flex-col data-vertical:items-stretch\",\n className\n )}\n {...props}\n >\n <ToggleGroupContext.Provider\n value={{ variant, size, spacing, orientation }}\n >\n {children}\n </ToggleGroupContext.Provider>\n </ToggleGroupPrimitive.Root>\n )\n}\n\nfunction ToggleGroupItem({\n className,\n children,\n variant = \"default\",\n size = \"default\",\n ...props\n}: React.ComponentProps<typeof ToggleGroupPrimitive.Item> &\n VariantProps<typeof toggleVariants>) {\n const context = React.useContext(ToggleGroupContext)\n\n return (\n <ToggleGroupPrimitive.Item\n data-slot=\"toggle-group-item\"\n data-variant={context.variant || variant}\n data-size={context.size || size}\n data-spacing={context.spacing}\n className={cn(\n \"shrink-0 group-data-[spacing=0]/toggle-group:rounded-none group-data-[spacing=0]/toggle-group:px-2 focus:z-10 focus-visible:z-10 group-data-horizontal/toggle-group:data-[spacing=0]:first:rounded-l-lg group-data-vertical/toggle-group:data-[spacing=0]:first:rounded-t-lg group-data-horizontal/toggle-group:data-[spacing=0]:last:rounded-r-lg group-data-vertical/toggle-group:data-[spacing=0]:last:rounded-b-lg
|
|
1
|
+
{"version":3,"file":"toggle-group.cjs","sources":["../../src/components/ui/toggle-group.tsx"],"sourcesContent":["import { type VariantProps } from \"class-variance-authority\"\nimport { CircleDashed, Check } from \"lucide-react\"\nimport { ToggleGroup as ToggleGroupPrimitive } from \"radix-ui\"\nimport * as React from \"react\"\n\nimport { toggleVariants } from \"@/components/ui/toggle\"\nimport { cn } from \"@/lib/utils\"\n\nconst ToggleGroupContext = React.createContext<\n VariantProps<typeof toggleVariants> & {\n spacing?: number\n orientation?: \"horizontal\" | \"vertical\"\n }\n>({\n size: \"default\",\n variant: \"default\",\n spacing: 0,\n orientation: \"horizontal\",\n})\n\nfunction ToggleGroup({\n className,\n variant,\n size,\n spacing = 0,\n orientation = \"horizontal\",\n children,\n ...props\n}: React.ComponentProps<typeof ToggleGroupPrimitive.Root> &\n VariantProps<typeof toggleVariants> & {\n spacing?: number\n orientation?: \"horizontal\" | \"vertical\"\n }) {\n return (\n <ToggleGroupPrimitive.Root\n data-slot=\"toggle-group\"\n data-variant={variant}\n data-size={size}\n data-spacing={spacing}\n data-orientation={orientation}\n style={{ \"--gap\": spacing } as React.CSSProperties}\n className={cn(\n \"group/toggle-group flex w-fit flex-row items-center gap-[--spacing(var(--gap))] rounded-lg data-[size=sm]:rounded-[min(var(--radius-md),10px)] data-vertical:flex-col data-vertical:items-stretch\",\n className\n )}\n {...props}\n >\n <ToggleGroupContext.Provider\n value={{ variant, size, spacing, orientation }}\n >\n {children}\n </ToggleGroupContext.Provider>\n </ToggleGroupPrimitive.Root>\n )\n}\n\nfunction ToggleGroupItem({\n className,\n children,\n variant = \"default\",\n size = \"default\",\n selectedIndicator,\n ...props\n}: React.ComponentProps<typeof ToggleGroupPrimitive.Item> &\n VariantProps<typeof toggleVariants> & {\n /**\n * Leading indicator for the selectable state (SW-2445). `\"dot\"` shows a\n * faint dotted ring when off that cross-fades to a check when on — a resting\n * affordance so an item reads as \"selectable\" and stays legible when every\n * option is selected.\n *\n * Defaults by content: **label-only** items get `\"dot\"`; items that render\n * an **icon** (icon-only or icon + label) get `\"none\"` — the icon carries\n * the state and there's no room for a ring. The default is decided in CSS\n * from the rendered DOM (`:has(svg)`), not from the React children, so a\n * label wrapped in a `<span>`, a translation component or a tooltip still\n * keeps its ring. Pass the prop to override either way.\n */\n selectedIndicator?: \"dot\" | \"none\"\n }) {\n const context = React.useContext(ToggleGroupContext)\n\n // Segmented (spacing=0) items carry their own border. Applied as plain\n // `border` rather than a `group-data-*:` variant on purpose: a group-scoped\n // selector compiles to specificity (0,2,0) and would silently beat a\n // consumer's own `border-r-0`/`border-l-0` in `className` (0,1,0). Plain\n // utilities stay at (0,1,0), so `className` keeps winning — which is the\n // contract every other component here follows.\n const segmented = (context.spacing ?? 0) === 0\n const collapseLeadingEdge =\n context.orientation === \"vertical\"\n ? \"[&:not(:first-child)]:border-t-0\"\n : \"[&:not(:first-child)]:border-l-0\"\n\n return (\n <ToggleGroupPrimitive.Item\n data-slot=\"toggle-group-item\"\n data-variant={context.variant || variant}\n data-size={context.size || size}\n data-spacing={context.spacing}\n className={cn(\n \"shrink-0 group-data-[spacing=0]/toggle-group:rounded-none group-data-[spacing=0]/toggle-group:px-2 focus:z-10 focus-visible:z-10 group-data-horizontal/toggle-group:data-[spacing=0]:first:rounded-l-lg group-data-vertical/toggle-group:data-[spacing=0]:first:rounded-t-lg group-data-horizontal/toggle-group:data-[spacing=0]:last:rounded-r-lg group-data-vertical/toggle-group:data-[spacing=0]:last:rounded-b-lg\",\n toggleVariants({\n variant: context.variant || variant,\n size: context.size || size,\n }),\n // SW-2445: every segmented item is bordered (not only variant=outline),\n // so the group always reads as outlined and stays countable when all are\n // selected. Non-first items drop their shared (leading) edge so adjacent\n // borders collapse to a single divider. Border + rounded corners live on\n // the same element, so the selected fill always aligns with the outline.\n segmented && \"border border-input\",\n segmented && collapseLeadingEdge,\n className\n )}\n {...props}\n >\n {selectedIndicator !== \"none\" && (\n <span\n aria-hidden\n data-slot=\"toggle-group-indicator\"\n className={cn(\n \"grid size-4 shrink-0 place-items-center [&>svg]:[grid-area:1/1]\",\n // Content-aware default, decided in CSS rather than by inspecting\n // React children: hide the ring when the item renders any *other*\n // svg (an icon carries the state). Inspecting children would treat\n // a `<span>`-wrapped or translated label as \"has icon\" and silently\n // drop the ring — misaligning a group that mixes plain and wrapped\n // labels. `display:none` also drops the slot, so no layout shift.\n selectedIndicator === undefined &&\n \"group-has-[svg:not([data-slot=toggle-group-indicator]_svg)]/toggle:hidden\"\n )}\n >\n <CircleDashed className=\"size-3.5 text-muted-foreground/50 transition-opacity group-data-[state=on]/toggle:opacity-0\" />\n <Check className=\"size-3.5 opacity-0 transition-opacity group-data-[state=on]/toggle:opacity-100\" />\n </span>\n )}\n {children}\n </ToggleGroupPrimitive.Item>\n )\n}\n\nexport { ToggleGroup, ToggleGroupItem }\n"],"names":["ToggleGroupContext","React","ToggleGroup","className","variant","size","spacing","orientation","children","props","jsx","ToggleGroupPrimitive","cn","ToggleGroupItem","selectedIndicator","context","segmented","collapseLeadingEdge","jsxs","toggleVariants","CircleDashed","Check"],"mappings":"0gBAQMA,EAAqBC,EAAM,cAK/B,CACA,KAAM,UACN,QAAS,UACT,QAAS,EACT,YAAa,YACf,CAAC,EAED,SAASC,EAAY,CACnB,UAAAC,EACA,QAAAC,EACA,KAAAC,EACA,QAAAC,EAAU,EACV,YAAAC,EAAc,aACd,SAAAC,EACA,GAAGC,CACL,EAIK,CACH,OACEC,EAAAA,IAACC,EAAAA,YAAqB,KAArB,CACC,YAAU,eACV,eAAcP,EACd,YAAWC,EACX,eAAcC,EACd,mBAAkBC,EAClB,MAAO,CAAE,QAASD,CAAA,EAClB,UAAWM,EAAAA,GACT,oMACAT,CAAA,EAED,GAAGM,EAEJ,SAAAC,EAAAA,IAACV,EAAmB,SAAnB,CACC,MAAO,CAAE,QAAAI,EAAS,KAAAC,EAAM,QAAAC,EAAS,YAAAC,CAAA,EAEhC,SAAAC,CAAA,CAAA,CACH,CAAA,CAGN,CAEA,SAASK,EAAgB,CACvB,UAAAV,EACA,SAAAK,EACA,QAAAJ,EAAU,UACV,KAAAC,EAAO,UACP,kBAAAS,EACA,GAAGL,CACL,EAgBK,CACH,MAAMM,EAAUd,EAAM,WAAWD,CAAkB,EAQ7CgB,GAAaD,EAAQ,SAAW,KAAO,EACvCE,EACJF,EAAQ,cAAgB,WACpB,mCACA,mCAEN,OACEG,EAAAA,KAACP,EAAAA,YAAqB,KAArB,CACC,YAAU,oBACV,eAAcI,EAAQ,SAAWX,EACjC,YAAWW,EAAQ,MAAQV,EAC3B,eAAcU,EAAQ,QACtB,UAAWH,EAAAA,GACT,yZACAO,iBAAe,CACb,QAASJ,EAAQ,SAAWX,EAC5B,KAAMW,EAAQ,MAAQV,CAAA,CACvB,EAMDW,GAAa,sBACbA,GAAaC,EACbd,CAAA,EAED,GAAGM,EAEH,SAAA,CAAAK,IAAsB,QACrBI,EAAAA,KAAC,OAAA,CACC,cAAW,GACX,YAAU,yBACV,UAAWN,EAAAA,GACT,kEAOAE,IAAsB,QACpB,2EAAA,EAGJ,SAAA,CAAAJ,EAAAA,IAACU,EAAAA,aAAA,CAAa,UAAU,6FAAA,CAA8F,EACtHV,EAAAA,IAACW,EAAAA,MAAA,CAAM,UAAU,gFAAA,CAAiF,CAAA,CAAA,CAAA,EAGrGb,CAAA,CAAA,CAAA,CAGP"}
|
package/dist/ui/toggle-group.js
CHANGED
|
@@ -1,81 +1,109 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
|
|
1
|
+
import { jsx as g, jsxs as l } from "react/jsx-runtime";
|
|
2
|
+
import { CircleDashed as f, Check as v } from "lucide-react";
|
|
3
|
+
import { ToggleGroup as p } from "radix-ui";
|
|
4
|
+
import * as c from "react";
|
|
5
|
+
import { toggleVariants as h } from "./toggle.js";
|
|
6
|
+
import { cn as s } from "../lib/utils.js";
|
|
7
|
+
const u = c.createContext({
|
|
7
8
|
size: "default",
|
|
8
9
|
variant: "default",
|
|
9
10
|
spacing: 0,
|
|
10
11
|
orientation: "horizontal"
|
|
11
12
|
});
|
|
12
|
-
function
|
|
13
|
-
className:
|
|
14
|
-
variant:
|
|
15
|
-
size:
|
|
16
|
-
spacing:
|
|
13
|
+
function G({
|
|
14
|
+
className: i,
|
|
15
|
+
variant: r,
|
|
16
|
+
size: o,
|
|
17
|
+
spacing: a = 0,
|
|
17
18
|
orientation: e = "horizontal",
|
|
18
|
-
children:
|
|
19
|
-
...
|
|
19
|
+
children: n,
|
|
20
|
+
...t
|
|
20
21
|
}) {
|
|
21
|
-
return /* @__PURE__ */
|
|
22
|
-
|
|
22
|
+
return /* @__PURE__ */ g(
|
|
23
|
+
p.Root,
|
|
23
24
|
{
|
|
24
25
|
"data-slot": "toggle-group",
|
|
25
|
-
"data-variant":
|
|
26
|
-
"data-size":
|
|
27
|
-
"data-spacing":
|
|
26
|
+
"data-variant": r,
|
|
27
|
+
"data-size": o,
|
|
28
|
+
"data-spacing": a,
|
|
28
29
|
"data-orientation": e,
|
|
29
|
-
style: { "--gap":
|
|
30
|
-
className:
|
|
30
|
+
style: { "--gap": a },
|
|
31
|
+
className: s(
|
|
31
32
|
"group/toggle-group flex w-fit flex-row items-center gap-[--spacing(var(--gap))] rounded-lg data-[size=sm]:rounded-[min(var(--radius-md),10px)] data-vertical:flex-col data-vertical:items-stretch",
|
|
32
|
-
|
|
33
|
+
i
|
|
33
34
|
),
|
|
34
|
-
...
|
|
35
|
-
children: /* @__PURE__ */
|
|
36
|
-
|
|
35
|
+
...t,
|
|
36
|
+
children: /* @__PURE__ */ g(
|
|
37
|
+
u.Provider,
|
|
37
38
|
{
|
|
38
|
-
value: { variant:
|
|
39
|
-
children:
|
|
39
|
+
value: { variant: r, size: o, spacing: a, orientation: e },
|
|
40
|
+
children: n
|
|
40
41
|
}
|
|
41
42
|
)
|
|
42
43
|
}
|
|
43
44
|
);
|
|
44
45
|
}
|
|
45
|
-
function
|
|
46
|
-
className:
|
|
47
|
-
children:
|
|
48
|
-
variant:
|
|
49
|
-
size:
|
|
50
|
-
|
|
46
|
+
function N({
|
|
47
|
+
className: i,
|
|
48
|
+
children: r,
|
|
49
|
+
variant: o = "default",
|
|
50
|
+
size: a = "default",
|
|
51
|
+
selectedIndicator: e,
|
|
52
|
+
...n
|
|
51
53
|
}) {
|
|
52
|
-
const
|
|
53
|
-
return /* @__PURE__ */
|
|
54
|
-
|
|
54
|
+
const t = c.useContext(u), d = (t.spacing ?? 0) === 0, m = t.orientation === "vertical" ? "[&:not(:first-child)]:border-t-0" : "[&:not(:first-child)]:border-l-0";
|
|
55
|
+
return /* @__PURE__ */ l(
|
|
56
|
+
p.Item,
|
|
55
57
|
{
|
|
56
58
|
"data-slot": "toggle-group-item",
|
|
57
|
-
"data-variant":
|
|
58
|
-
"data-size":
|
|
59
|
-
"data-spacing":
|
|
60
|
-
className:
|
|
61
|
-
"shrink-0 group-data-[spacing=0]/toggle-group:rounded-none group-data-[spacing=0]/toggle-group:px-2 focus:z-10 focus-visible:z-10 group-data-horizontal/toggle-group:data-[spacing=0]:first:rounded-l-lg group-data-vertical/toggle-group:data-[spacing=0]:first:rounded-t-lg group-data-horizontal/toggle-group:data-[spacing=0]:last:rounded-r-lg group-data-vertical/toggle-group:data-[spacing=0]:last:rounded-b-lg
|
|
62
|
-
|
|
63
|
-
variant:
|
|
64
|
-
size:
|
|
59
|
+
"data-variant": t.variant || o,
|
|
60
|
+
"data-size": t.size || a,
|
|
61
|
+
"data-spacing": t.spacing,
|
|
62
|
+
className: s(
|
|
63
|
+
"shrink-0 group-data-[spacing=0]/toggle-group:rounded-none group-data-[spacing=0]/toggle-group:px-2 focus:z-10 focus-visible:z-10 group-data-horizontal/toggle-group:data-[spacing=0]:first:rounded-l-lg group-data-vertical/toggle-group:data-[spacing=0]:first:rounded-t-lg group-data-horizontal/toggle-group:data-[spacing=0]:last:rounded-r-lg group-data-vertical/toggle-group:data-[spacing=0]:last:rounded-b-lg",
|
|
64
|
+
h({
|
|
65
|
+
variant: t.variant || o,
|
|
66
|
+
size: t.size || a
|
|
65
67
|
}),
|
|
66
|
-
// SW-
|
|
67
|
-
//
|
|
68
|
-
//
|
|
69
|
-
|
|
70
|
-
|
|
68
|
+
// SW-2445: every segmented item is bordered (not only variant=outline),
|
|
69
|
+
// so the group always reads as outlined and stays countable when all are
|
|
70
|
+
// selected. Non-first items drop their shared (leading) edge so adjacent
|
|
71
|
+
// borders collapse to a single divider. Border + rounded corners live on
|
|
72
|
+
// the same element, so the selected fill always aligns with the outline.
|
|
73
|
+
d && "border border-input",
|
|
74
|
+
d && m,
|
|
75
|
+
i
|
|
71
76
|
),
|
|
72
|
-
...
|
|
73
|
-
children:
|
|
77
|
+
...n,
|
|
78
|
+
children: [
|
|
79
|
+
e !== "none" && /* @__PURE__ */ l(
|
|
80
|
+
"span",
|
|
81
|
+
{
|
|
82
|
+
"aria-hidden": !0,
|
|
83
|
+
"data-slot": "toggle-group-indicator",
|
|
84
|
+
className: s(
|
|
85
|
+
"grid size-4 shrink-0 place-items-center [&>svg]:[grid-area:1/1]",
|
|
86
|
+
// Content-aware default, decided in CSS rather than by inspecting
|
|
87
|
+
// React children: hide the ring when the item renders any *other*
|
|
88
|
+
// svg (an icon carries the state). Inspecting children would treat
|
|
89
|
+
// a `<span>`-wrapped or translated label as "has icon" and silently
|
|
90
|
+
// drop the ring — misaligning a group that mixes plain and wrapped
|
|
91
|
+
// labels. `display:none` also drops the slot, so no layout shift.
|
|
92
|
+
e === void 0 && "group-has-[svg:not([data-slot=toggle-group-indicator]_svg)]/toggle:hidden"
|
|
93
|
+
),
|
|
94
|
+
children: [
|
|
95
|
+
/* @__PURE__ */ g(f, { className: "size-3.5 text-muted-foreground/50 transition-opacity group-data-[state=on]/toggle:opacity-0" }),
|
|
96
|
+
/* @__PURE__ */ g(v, { className: "size-3.5 opacity-0 transition-opacity group-data-[state=on]/toggle:opacity-100" })
|
|
97
|
+
]
|
|
98
|
+
}
|
|
99
|
+
),
|
|
100
|
+
r
|
|
101
|
+
]
|
|
74
102
|
}
|
|
75
103
|
);
|
|
76
104
|
}
|
|
77
105
|
export {
|
|
78
|
-
|
|
79
|
-
|
|
106
|
+
G as ToggleGroup,
|
|
107
|
+
N as ToggleGroupItem
|
|
80
108
|
};
|
|
81
109
|
//# sourceMappingURL=toggle-group.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toggle-group.js","sources":["../../src/components/ui/toggle-group.tsx"],"sourcesContent":["import { type VariantProps } from \"class-variance-authority\"\nimport { ToggleGroup as ToggleGroupPrimitive } from \"radix-ui\"\nimport * as React from \"react\"\n\nimport { toggleVariants } from \"@/components/ui/toggle\"\nimport { cn } from \"@/lib/utils\"\n\nconst ToggleGroupContext = React.createContext<\n VariantProps<typeof toggleVariants> & {\n spacing?: number\n orientation?: \"horizontal\" | \"vertical\"\n }\n>({\n size: \"default\",\n variant: \"default\",\n spacing: 0,\n orientation: \"horizontal\",\n})\n\nfunction ToggleGroup({\n className,\n variant,\n size,\n spacing = 0,\n orientation = \"horizontal\",\n children,\n ...props\n}: React.ComponentProps<typeof ToggleGroupPrimitive.Root> &\n VariantProps<typeof toggleVariants> & {\n spacing?: number\n orientation?: \"horizontal\" | \"vertical\"\n }) {\n return (\n <ToggleGroupPrimitive.Root\n data-slot=\"toggle-group\"\n data-variant={variant}\n data-size={size}\n data-spacing={spacing}\n data-orientation={orientation}\n style={{ \"--gap\": spacing } as React.CSSProperties}\n className={cn(\n \"group/toggle-group flex w-fit flex-row items-center gap-[--spacing(var(--gap))] rounded-lg data-[size=sm]:rounded-[min(var(--radius-md),10px)] data-vertical:flex-col data-vertical:items-stretch\",\n className\n )}\n {...props}\n >\n <ToggleGroupContext.Provider\n value={{ variant, size, spacing, orientation }}\n >\n {children}\n </ToggleGroupContext.Provider>\n </ToggleGroupPrimitive.Root>\n )\n}\n\nfunction ToggleGroupItem({\n className,\n children,\n variant = \"default\",\n size = \"default\",\n ...props\n}: React.ComponentProps<typeof ToggleGroupPrimitive.Item> &\n VariantProps<typeof toggleVariants>) {\n const context = React.useContext(ToggleGroupContext)\n\n return (\n <ToggleGroupPrimitive.Item\n data-slot=\"toggle-group-item\"\n data-variant={context.variant || variant}\n data-size={context.size || size}\n data-spacing={context.spacing}\n className={cn(\n \"shrink-0 group-data-[spacing=0]/toggle-group:rounded-none group-data-[spacing=0]/toggle-group:px-2 focus:z-10 focus-visible:z-10 group-data-horizontal/toggle-group:data-[spacing=0]:first:rounded-l-lg group-data-vertical/toggle-group:data-[spacing=0]:first:rounded-t-lg group-data-horizontal/toggle-group:data-[spacing=0]:last:rounded-r-lg group-data-vertical/toggle-group:data-[spacing=0]:last:rounded-b-lg
|
|
1
|
+
{"version":3,"file":"toggle-group.js","sources":["../../src/components/ui/toggle-group.tsx"],"sourcesContent":["import { type VariantProps } from \"class-variance-authority\"\nimport { CircleDashed, Check } from \"lucide-react\"\nimport { ToggleGroup as ToggleGroupPrimitive } from \"radix-ui\"\nimport * as React from \"react\"\n\nimport { toggleVariants } from \"@/components/ui/toggle\"\nimport { cn } from \"@/lib/utils\"\n\nconst ToggleGroupContext = React.createContext<\n VariantProps<typeof toggleVariants> & {\n spacing?: number\n orientation?: \"horizontal\" | \"vertical\"\n }\n>({\n size: \"default\",\n variant: \"default\",\n spacing: 0,\n orientation: \"horizontal\",\n})\n\nfunction ToggleGroup({\n className,\n variant,\n size,\n spacing = 0,\n orientation = \"horizontal\",\n children,\n ...props\n}: React.ComponentProps<typeof ToggleGroupPrimitive.Root> &\n VariantProps<typeof toggleVariants> & {\n spacing?: number\n orientation?: \"horizontal\" | \"vertical\"\n }) {\n return (\n <ToggleGroupPrimitive.Root\n data-slot=\"toggle-group\"\n data-variant={variant}\n data-size={size}\n data-spacing={spacing}\n data-orientation={orientation}\n style={{ \"--gap\": spacing } as React.CSSProperties}\n className={cn(\n \"group/toggle-group flex w-fit flex-row items-center gap-[--spacing(var(--gap))] rounded-lg data-[size=sm]:rounded-[min(var(--radius-md),10px)] data-vertical:flex-col data-vertical:items-stretch\",\n className\n )}\n {...props}\n >\n <ToggleGroupContext.Provider\n value={{ variant, size, spacing, orientation }}\n >\n {children}\n </ToggleGroupContext.Provider>\n </ToggleGroupPrimitive.Root>\n )\n}\n\nfunction ToggleGroupItem({\n className,\n children,\n variant = \"default\",\n size = \"default\",\n selectedIndicator,\n ...props\n}: React.ComponentProps<typeof ToggleGroupPrimitive.Item> &\n VariantProps<typeof toggleVariants> & {\n /**\n * Leading indicator for the selectable state (SW-2445). `\"dot\"` shows a\n * faint dotted ring when off that cross-fades to a check when on — a resting\n * affordance so an item reads as \"selectable\" and stays legible when every\n * option is selected.\n *\n * Defaults by content: **label-only** items get `\"dot\"`; items that render\n * an **icon** (icon-only or icon + label) get `\"none\"` — the icon carries\n * the state and there's no room for a ring. The default is decided in CSS\n * from the rendered DOM (`:has(svg)`), not from the React children, so a\n * label wrapped in a `<span>`, a translation component or a tooltip still\n * keeps its ring. Pass the prop to override either way.\n */\n selectedIndicator?: \"dot\" | \"none\"\n }) {\n const context = React.useContext(ToggleGroupContext)\n\n // Segmented (spacing=0) items carry their own border. Applied as plain\n // `border` rather than a `group-data-*:` variant on purpose: a group-scoped\n // selector compiles to specificity (0,2,0) and would silently beat a\n // consumer's own `border-r-0`/`border-l-0` in `className` (0,1,0). Plain\n // utilities stay at (0,1,0), so `className` keeps winning — which is the\n // contract every other component here follows.\n const segmented = (context.spacing ?? 0) === 0\n const collapseLeadingEdge =\n context.orientation === \"vertical\"\n ? \"[&:not(:first-child)]:border-t-0\"\n : \"[&:not(:first-child)]:border-l-0\"\n\n return (\n <ToggleGroupPrimitive.Item\n data-slot=\"toggle-group-item\"\n data-variant={context.variant || variant}\n data-size={context.size || size}\n data-spacing={context.spacing}\n className={cn(\n \"shrink-0 group-data-[spacing=0]/toggle-group:rounded-none group-data-[spacing=0]/toggle-group:px-2 focus:z-10 focus-visible:z-10 group-data-horizontal/toggle-group:data-[spacing=0]:first:rounded-l-lg group-data-vertical/toggle-group:data-[spacing=0]:first:rounded-t-lg group-data-horizontal/toggle-group:data-[spacing=0]:last:rounded-r-lg group-data-vertical/toggle-group:data-[spacing=0]:last:rounded-b-lg\",\n toggleVariants({\n variant: context.variant || variant,\n size: context.size || size,\n }),\n // SW-2445: every segmented item is bordered (not only variant=outline),\n // so the group always reads as outlined and stays countable when all are\n // selected. Non-first items drop their shared (leading) edge so adjacent\n // borders collapse to a single divider. Border + rounded corners live on\n // the same element, so the selected fill always aligns with the outline.\n segmented && \"border border-input\",\n segmented && collapseLeadingEdge,\n className\n )}\n {...props}\n >\n {selectedIndicator !== \"none\" && (\n <span\n aria-hidden\n data-slot=\"toggle-group-indicator\"\n className={cn(\n \"grid size-4 shrink-0 place-items-center [&>svg]:[grid-area:1/1]\",\n // Content-aware default, decided in CSS rather than by inspecting\n // React children: hide the ring when the item renders any *other*\n // svg (an icon carries the state). Inspecting children would treat\n // a `<span>`-wrapped or translated label as \"has icon\" and silently\n // drop the ring — misaligning a group that mixes plain and wrapped\n // labels. `display:none` also drops the slot, so no layout shift.\n selectedIndicator === undefined &&\n \"group-has-[svg:not([data-slot=toggle-group-indicator]_svg)]/toggle:hidden\"\n )}\n >\n <CircleDashed className=\"size-3.5 text-muted-foreground/50 transition-opacity group-data-[state=on]/toggle:opacity-0\" />\n <Check className=\"size-3.5 opacity-0 transition-opacity group-data-[state=on]/toggle:opacity-100\" />\n </span>\n )}\n {children}\n </ToggleGroupPrimitive.Item>\n )\n}\n\nexport { ToggleGroup, ToggleGroupItem }\n"],"names":["ToggleGroupContext","React","ToggleGroup","className","variant","size","spacing","orientation","children","props","jsx","ToggleGroupPrimitive","cn","ToggleGroupItem","selectedIndicator","context","segmented","collapseLeadingEdge","jsxs","toggleVariants","CircleDashed","Check"],"mappings":";;;;;;AAQA,MAAMA,IAAqBC,EAAM,cAK/B;AAAA,EACA,MAAM;AAAA,EACN,SAAS;AAAA,EACT,SAAS;AAAA,EACT,aAAa;AACf,CAAC;AAED,SAASC,EAAY;AAAA,EACnB,WAAAC;AAAA,EACA,SAAAC;AAAA,EACA,MAAAC;AAAA,EACA,SAAAC,IAAU;AAAA,EACV,aAAAC,IAAc;AAAA,EACd,UAAAC;AAAA,EACA,GAAGC;AACL,GAIK;AACH,SACE,gBAAAC;AAAA,IAACC,EAAqB;AAAA,IAArB;AAAA,MACC,aAAU;AAAA,MACV,gBAAcP;AAAA,MACd,aAAWC;AAAA,MACX,gBAAcC;AAAA,MACd,oBAAkBC;AAAA,MAClB,OAAO,EAAE,SAASD,EAAA;AAAA,MAClB,WAAWM;AAAA,QACT;AAAA,QACAT;AAAA,MAAA;AAAA,MAED,GAAGM;AAAA,MAEJ,UAAA,gBAA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AAA,UAAA;AAAA,QAAA;AAAA,QAGrGb;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGP;"}
|
package/dist/ui/toggle.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),o=require("class-variance-authority"),i=require("radix-ui"),d=require("../lib/utils.cjs"),e=o.cva("group/toggle inline-flex items-center justify-center gap-1 rounded-lg text-sm font-medium whitespace-nowrap transition-all outline-none hover:bg-accent hover:text-accent-foreground focus-visible:border-ring focus-visible:shadow-focus disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:shadow-focus aria-pressed:bg-selected aria-pressed:text-selected-foreground aria-pressed:shadow-(--shadow-inset-pressed) data-[state=on]:bg-selected data-[state=on]:text-selected-foreground data-[state=on]:shadow-(--shadow-inset-pressed) [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",{variants:{variant:{default:"bg-transparent",outline:"border border-input bg-transparent hover:bg-accent aria-pressed:border-selected-border data-[state=on]:border-selected-border"},size:{default:"h-8 min-w-8 px-2",sm:"h-7 min-w-7 rounded-[min(var(--radius-md),12px)] px-1.5 text-[0.8rem]",lg:"h-9 min-w-9 px-2.5"}},defaultVariants:{variant:"default",size:"default"}});function l({className:t,variant:a="default",size:r="default",...s}){return n.jsx(i.Toggle.Root,{"data-slot":"toggle",className:d.cn(e({variant:a,size:r,className:t})),...s})}exports.Toggle=l;exports.toggleVariants=e;
|
|
2
2
|
//# sourceMappingURL=toggle.cjs.map
|
package/dist/ui/toggle.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toggle.cjs","sources":["../../src/components/ui/toggle.tsx"],"sourcesContent":["import { cva, type VariantProps } from \"class-variance-authority\"\nimport { Toggle as TogglePrimitive } from \"radix-ui\"\nimport * as React from \"react\"\n\nimport { cn } from \"@/lib/utils\"\n\nconst toggleVariants = cva(\n \"group/toggle inline-flex items-center justify-center gap-1 rounded-lg text-sm font-medium whitespace-nowrap transition-all outline-none hover:bg-accent hover:text-accent-foreground focus-visible:border-ring focus-visible:shadow-focus disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:shadow-focus aria-pressed:bg-
|
|
1
|
+
{"version":3,"file":"toggle.cjs","sources":["../../src/components/ui/toggle.tsx"],"sourcesContent":["import { cva, type VariantProps } from \"class-variance-authority\"\nimport { Toggle as TogglePrimitive } from \"radix-ui\"\nimport * as React from \"react\"\n\nimport { cn } from \"@/lib/utils\"\n\nconst toggleVariants = cva(\n \"group/toggle inline-flex items-center justify-center gap-1 rounded-lg text-sm font-medium whitespace-nowrap transition-all outline-none hover:bg-accent hover:text-accent-foreground focus-visible:border-ring focus-visible:shadow-focus disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:shadow-focus aria-pressed:bg-selected aria-pressed:text-selected-foreground aria-pressed:shadow-(--shadow-inset-pressed) data-[state=on]:bg-selected data-[state=on]:text-selected-foreground data-[state=on]:shadow-(--shadow-inset-pressed) [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4\",\n {\n variants: {\n variant: {\n default: \"bg-transparent\",\n outline:\n \"border border-input bg-transparent hover:bg-accent aria-pressed:border-selected-border data-[state=on]:border-selected-border\",\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\nfunction Toggle({\n className,\n variant = \"default\",\n size = \"default\",\n ...props\n}: React.ComponentProps<typeof TogglePrimitive.Root> &\n VariantProps<typeof toggleVariants>) {\n return (\n <TogglePrimitive.Root\n data-slot=\"toggle\"\n className={cn(toggleVariants({ variant, size, className }))}\n {...props}\n />\n )\n}\n\nexport { Toggle, toggleVariants }\n"],"names":["toggleVariants","cva","Toggle","className","variant","size","props","jsx","TogglePrimitive","cn"],"mappings":"+MAMMA,EAAiBC,EAAAA,IACrB,0oBACA,CACE,SAAU,CACR,QAAS,CACP,QAAS,iBACT,QACE,+HAAA,EAEJ,KAAM,CACJ,QAAS,mBACT,GAAI,wEACJ,GAAI,oBAAA,CACN,EAEF,gBAAiB,CACf,QAAS,UACT,KAAM,SAAA,CACR,CAEJ,EAEA,SAASC,EAAO,CACd,UAAAC,EACA,QAAAC,EAAU,UACV,KAAAC,EAAO,UACP,GAAGC,CACL,EACuC,CACrC,OACEC,EAAAA,IAACC,EAAAA,OAAgB,KAAhB,CACC,YAAU,SACV,UAAWC,EAAAA,GAAGT,EAAe,CAAE,QAAAI,EAAS,KAAAC,EAAM,UAAAF,CAAA,CAAW,CAAC,EACzD,GAAGG,CAAA,CAAA,CAGV"}
|
package/dist/ui/toggle.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as s } from "react/jsx-runtime";
|
|
2
2
|
import { cva as o } from "class-variance-authority";
|
|
3
|
-
import { Toggle as
|
|
4
|
-
import { cn as
|
|
5
|
-
const
|
|
6
|
-
"group/toggle inline-flex items-center justify-center gap-1 rounded-lg text-sm font-medium whitespace-nowrap transition-all outline-none hover:bg-accent hover:text-accent-foreground focus-visible:border-ring focus-visible:shadow-focus disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:shadow-focus aria-pressed:bg-
|
|
3
|
+
import { Toggle as n } from "radix-ui";
|
|
4
|
+
import { cn as d } from "../lib/utils.js";
|
|
5
|
+
const i = o(
|
|
6
|
+
"group/toggle inline-flex items-center justify-center gap-1 rounded-lg text-sm font-medium whitespace-nowrap transition-all outline-none hover:bg-accent hover:text-accent-foreground focus-visible:border-ring focus-visible:shadow-focus disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:shadow-focus aria-pressed:bg-selected aria-pressed:text-selected-foreground aria-pressed:shadow-(--shadow-inset-pressed) data-[state=on]:bg-selected data-[state=on]:text-selected-foreground data-[state=on]:shadow-(--shadow-inset-pressed) [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
7
7
|
{
|
|
8
8
|
variants: {
|
|
9
9
|
variant: {
|
|
10
10
|
default: "bg-transparent",
|
|
11
|
-
outline: "border border-input bg-transparent hover:bg-accent"
|
|
11
|
+
outline: "border border-input bg-transparent hover:bg-accent aria-pressed:border-selected-border data-[state=on]:border-selected-border"
|
|
12
12
|
},
|
|
13
13
|
size: {
|
|
14
14
|
default: "h-8 min-w-8 px-2",
|
|
@@ -22,23 +22,23 @@ const d = o(
|
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
24
|
);
|
|
25
|
-
function
|
|
25
|
+
function p({
|
|
26
26
|
className: e,
|
|
27
27
|
variant: t = "default",
|
|
28
28
|
size: a = "default",
|
|
29
|
-
...
|
|
29
|
+
...r
|
|
30
30
|
}) {
|
|
31
|
-
return /* @__PURE__ */
|
|
32
|
-
|
|
31
|
+
return /* @__PURE__ */ s(
|
|
32
|
+
n.Root,
|
|
33
33
|
{
|
|
34
34
|
"data-slot": "toggle",
|
|
35
|
-
className:
|
|
36
|
-
...
|
|
35
|
+
className: d(i({ variant: t, size: a, className: e })),
|
|
36
|
+
...r
|
|
37
37
|
}
|
|
38
38
|
);
|
|
39
39
|
}
|
|
40
40
|
export {
|
|
41
|
-
|
|
42
|
-
|
|
41
|
+
p as Toggle,
|
|
42
|
+
i as toggleVariants
|
|
43
43
|
};
|
|
44
44
|
//# sourceMappingURL=toggle.js.map
|
package/dist/ui/toggle.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toggle.js","sources":["../../src/components/ui/toggle.tsx"],"sourcesContent":["import { cva, type VariantProps } from \"class-variance-authority\"\nimport { Toggle as TogglePrimitive } from \"radix-ui\"\nimport * as React from \"react\"\n\nimport { cn } from \"@/lib/utils\"\n\nconst toggleVariants = cva(\n \"group/toggle inline-flex items-center justify-center gap-1 rounded-lg text-sm font-medium whitespace-nowrap transition-all outline-none hover:bg-accent hover:text-accent-foreground focus-visible:border-ring focus-visible:shadow-focus disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:shadow-focus aria-pressed:bg-
|
|
1
|
+
{"version":3,"file":"toggle.js","sources":["../../src/components/ui/toggle.tsx"],"sourcesContent":["import { cva, type VariantProps } from \"class-variance-authority\"\nimport { Toggle as TogglePrimitive } from \"radix-ui\"\nimport * as React from \"react\"\n\nimport { cn } from \"@/lib/utils\"\n\nconst toggleVariants = cva(\n \"group/toggle inline-flex items-center justify-center gap-1 rounded-lg text-sm font-medium whitespace-nowrap transition-all outline-none hover:bg-accent hover:text-accent-foreground focus-visible:border-ring focus-visible:shadow-focus disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:shadow-focus aria-pressed:bg-selected aria-pressed:text-selected-foreground aria-pressed:shadow-(--shadow-inset-pressed) data-[state=on]:bg-selected data-[state=on]:text-selected-foreground data-[state=on]:shadow-(--shadow-inset-pressed) [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4\",\n {\n variants: {\n variant: {\n default: \"bg-transparent\",\n outline:\n \"border border-input bg-transparent hover:bg-accent aria-pressed:border-selected-border data-[state=on]:border-selected-border\",\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\nfunction Toggle({\n className,\n variant = \"default\",\n size = \"default\",\n ...props\n}: React.ComponentProps<typeof TogglePrimitive.Root> &\n VariantProps<typeof toggleVariants>) {\n return (\n <TogglePrimitive.Root\n data-slot=\"toggle\"\n className={cn(toggleVariants({ variant, size, className }))}\n {...props}\n />\n )\n}\n\nexport { Toggle, toggleVariants }\n"],"names":["toggleVariants","cva","Toggle","className","variant","size","props","jsx","TogglePrimitive","cn"],"mappings":";;;;AAMA,MAAMA,IAAiBC;AAAA,EACrB;AAAA,EACA;AAAA,IACE,UAAU;AAAA,MACR,SAAS;AAAA,QACP,SAAS;AAAA,QACT,SACE;AAAA,MAAA;AAAA,MAEJ,MAAM;AAAA,QACJ,SAAS;AAAA,QACT,IAAI;AAAA,QACJ,IAAI;AAAA,MAAA;AAAA,IACN;AAAA,IAEF,iBAAiB;AAAA,MACf,SAAS;AAAA,MACT,MAAM;AAAA,IAAA;AAAA,EACR;AAEJ;AAEA,SAASC,EAAO;AAAA,EACd,WAAAC;AAAA,EACA,SAAAC,IAAU;AAAA,EACV,MAAAC,IAAO;AAAA,EACP,GAAGC;AACL,GACuC;AACrC,SACE,gBAAAC;AAAA,IAACC,EAAgB;AAAA,IAAhB;AAAA,MACC,aAAU;AAAA,MACV,WAAWC,EAAGT,EAAe,EAAE,SAAAI,GAAS,MAAAC,GAAM,WAAAF,EAAA,CAAW,CAAC;AAAA,MACzD,GAAGG;AAAA,IAAA;AAAA,EAAA;AAGV;"}
|