@codefast/ui 0.10.2 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/README.md +15 -0
- package/dist/components/alert-dialog.js +4 -3
- package/dist/components/aspect-ratio.js +2 -1
- package/dist/components/collapsible.js +4 -3
- package/dist/components/context-menu.js +3 -2
- package/dist/components/dialog.js +4 -3
- package/dist/components/drawer.js +2 -1
- package/dist/components/dropdown-menu.js +4 -3
- package/dist/components/hover-card.js +2 -1
- package/dist/components/menubar.js +3 -2
- package/dist/components/popover.js +3 -2
- package/dist/components/radio-cards.js +2 -1
- package/dist/components/select.js +2 -1
- package/dist/components/sheet.js +2 -1
- package/dist/components/tooltip.js +2 -1
- package/dist/lib/slot.d.ts +15 -0
- package/dist/lib/slot.js +10 -0
- package/package.json +9 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @codefast/ui
|
|
2
2
|
|
|
3
|
+
## 0.11.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#1044](https://github.com/codefastlabs/codefast/pull/1044) A part that adds behavior but no styling — the dialog, alert-dialog, sheet, drawer, popover, hover-card, tooltip,
|
|
8
|
+
dropdown-menu and collapsible triggers, `DialogClose`, `PopoverAnchor`, the menu groups and `SelectValue` among them —
|
|
9
|
+
no longer stamps its `data-slot` when it composes onto a child with `asChild`, so the child keeps its own. An `Avatar`
|
|
10
|
+
under `HoverCardTrigger asChild` now stays `data-slot="avatar"` and `AvatarGroup` rings it like its siblings, and a
|
|
11
|
+
`Button` under `TooltipTrigger asChild` stays `data-slot="button"`. A selector on such a part's slot, like
|
|
12
|
+
`[data-slot=tooltip-trigger]`, matches only when the part renders its own element. The new `behaviorSlot` in
|
|
13
|
+
`@codefast/ui/lib/slot` gives a behavior wrapper of your own the same rule.
|
|
14
|
+
|
|
3
15
|
## 0.10.2
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -118,6 +118,21 @@ export function DocsLink() {
|
|
|
118
118
|
}
|
|
119
119
|
```
|
|
120
120
|
|
|
121
|
+
## Slots and `asChild`
|
|
122
|
+
|
|
123
|
+
Every element a component renders carries a `data-slot` naming the component that styles it, and components select each
|
|
124
|
+
other by it — `AvatarGroup` rings its children through `[data-slot=avatar]`. A part that adds behavior but no styling —
|
|
125
|
+
a dialog, popover, hover-card or tooltip trigger, a close, an anchor — lends no slot when it composes onto its child
|
|
126
|
+
with `asChild`, so the child keeps its own:
|
|
127
|
+
|
|
128
|
+
```tsx
|
|
129
|
+
<HoverCardTrigger asChild>
|
|
130
|
+
<Avatar /> {/* data-slot="avatar", still ringed by AvatarGroup */}
|
|
131
|
+
</HoverCardTrigger>
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
A behavior wrapper of your own does the same with `behaviorSlot` from `@codefast/ui/lib/slot`.
|
|
135
|
+
|
|
121
136
|
## Theming
|
|
122
137
|
|
|
123
138
|
Theme tokens live in plain CSS files. Swap `themes/neutral.css` in the imports above for any palette under
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import * as AlertDialogPrimitive from "radix-ui/alert-dialog";
|
|
3
3
|
import { Button } from "#components/button";
|
|
4
|
+
import { behaviorSlot } from "#lib/slot";
|
|
4
5
|
import { cn } from "#lib/utils";
|
|
5
6
|
/**
|
|
6
7
|
* @since 0.3.16-canary.0
|
|
@@ -12,7 +13,7 @@ function AlertDialog({ ...props }) {
|
|
|
12
13
|
* @since 0.3.16-canary.0
|
|
13
14
|
*/
|
|
14
15
|
function AlertDialogTrigger({ ...props }) {
|
|
15
|
-
return _jsx(AlertDialogPrimitive.Trigger, { "
|
|
16
|
+
return _jsx(AlertDialogPrimitive.Trigger, { ...behaviorSlot("alert-dialog-trigger", props.asChild), ...props });
|
|
16
17
|
}
|
|
17
18
|
/**
|
|
18
19
|
* @since 0.3.16-canary.0
|
|
@@ -60,13 +61,13 @@ function AlertDialogDescription({ className, ...props }) {
|
|
|
60
61
|
* @since 0.3.16-canary.0
|
|
61
62
|
*/
|
|
62
63
|
function AlertDialogAction({ size = "default", variant = "default", ...props }) {
|
|
63
|
-
return (_jsx(Button, { asChild: true, size: size, variant: variant, children: _jsx(AlertDialogPrimitive.Action, { "
|
|
64
|
+
return (_jsx(Button, { asChild: true, size: size, variant: variant, children: _jsx(AlertDialogPrimitive.Action, { ...behaviorSlot("alert-dialog-action", props.asChild), ...props }) }));
|
|
64
65
|
}
|
|
65
66
|
/**
|
|
66
67
|
* @since 0.3.16-canary.0
|
|
67
68
|
*/
|
|
68
69
|
function AlertDialogCancel({ size = "default", variant = "outline", ...props }) {
|
|
69
|
-
return (_jsx(Button, { asChild: true, size: size, variant: variant, children: _jsx(AlertDialogPrimitive.Cancel, { "
|
|
70
|
+
return (_jsx(Button, { asChild: true, size: size, variant: variant, children: _jsx(AlertDialogPrimitive.Cancel, { ...behaviorSlot("alert-dialog-cancel", props.asChild), ...props }) }));
|
|
70
71
|
}
|
|
71
72
|
// ── Exports ──────────────────────────────────────────────────────────────────────────────────────────────────────────
|
|
72
73
|
export { AlertDialog, AlertDialogAction, AlertDialogBody, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogMedia, AlertDialogTitle, AlertDialogTrigger, };
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import * as AspectRatioPrimitive from "radix-ui/aspect-ratio";
|
|
3
|
+
import { behaviorSlot } from "#lib/slot";
|
|
3
4
|
/**
|
|
4
5
|
* @since 0.3.16-canary.0
|
|
5
6
|
*/
|
|
6
7
|
function AspectRatio({ ...props }) {
|
|
7
|
-
return _jsx(AspectRatioPrimitive.Root, { "
|
|
8
|
+
return _jsx(AspectRatioPrimitive.Root, { ...behaviorSlot("aspect-ratio", props.asChild), ...props });
|
|
8
9
|
}
|
|
9
10
|
// ── Exports ──────────────────────────────────────────────────────────────────────────────────────────────────────────
|
|
10
11
|
export { AspectRatio };
|
|
@@ -1,22 +1,23 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import * as CollapsiblePrimitive from "radix-ui/collapsible";
|
|
3
|
+
import { behaviorSlot } from "#lib/slot";
|
|
3
4
|
/**
|
|
4
5
|
* @since 0.3.16-canary.0
|
|
5
6
|
*/
|
|
6
7
|
function Collapsible({ ...props }) {
|
|
7
|
-
return _jsx(CollapsiblePrimitive.Root, { "
|
|
8
|
+
return _jsx(CollapsiblePrimitive.Root, { ...behaviorSlot("collapsible", props.asChild), ...props });
|
|
8
9
|
}
|
|
9
10
|
/**
|
|
10
11
|
* @since 0.3.16-canary.0
|
|
11
12
|
*/
|
|
12
13
|
function CollapsibleTrigger({ ...props }) {
|
|
13
|
-
return _jsx(CollapsiblePrimitive.CollapsibleTrigger, { "
|
|
14
|
+
return _jsx(CollapsiblePrimitive.CollapsibleTrigger, { ...behaviorSlot("collapsible-trigger", props.asChild), ...props });
|
|
14
15
|
}
|
|
15
16
|
/**
|
|
16
17
|
* @since 0.3.16-canary.0
|
|
17
18
|
*/
|
|
18
19
|
function CollapsibleContent({ ...props }) {
|
|
19
|
-
return _jsx(CollapsiblePrimitive.CollapsibleContent, { "
|
|
20
|
+
return _jsx(CollapsiblePrimitive.CollapsibleContent, { ...behaviorSlot("collapsible-content", props.asChild), ...props });
|
|
20
21
|
}
|
|
21
22
|
// ── Exports ──────────────────────────────────────────────────────────────────────────────────────────────────────────
|
|
22
23
|
export { Collapsible, CollapsibleContent, CollapsibleTrigger };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { CheckIcon, ChevronRightIcon } from "lucide-react";
|
|
3
3
|
import * as ContextMenuPrimitive from "radix-ui/context-menu";
|
|
4
|
+
import { behaviorSlot } from "#lib/slot";
|
|
4
5
|
import { cn } from "#lib/utils";
|
|
5
6
|
/**
|
|
6
7
|
* @since 0.3.16-canary.0
|
|
@@ -18,7 +19,7 @@ function ContextMenuTrigger({ className, ...props }) {
|
|
|
18
19
|
* @since 0.3.16-canary.0
|
|
19
20
|
*/
|
|
20
21
|
function ContextMenuGroup({ ...props }) {
|
|
21
|
-
return _jsx(ContextMenuPrimitive.Group, { "
|
|
22
|
+
return _jsx(ContextMenuPrimitive.Group, { ...behaviorSlot("context-menu-group", props.asChild), ...props });
|
|
22
23
|
}
|
|
23
24
|
/**
|
|
24
25
|
* @since 0.3.16-canary.0
|
|
@@ -30,7 +31,7 @@ function ContextMenuSub({ ...props }) {
|
|
|
30
31
|
* @since 0.3.16-canary.0
|
|
31
32
|
*/
|
|
32
33
|
function ContextMenuRadioGroup({ ...props }) {
|
|
33
|
-
return _jsx(ContextMenuPrimitive.RadioGroup, { "
|
|
34
|
+
return _jsx(ContextMenuPrimitive.RadioGroup, { ...behaviorSlot("context-menu-radio-group", props.asChild), ...props });
|
|
34
35
|
}
|
|
35
36
|
/**
|
|
36
37
|
* @since 0.3.16-canary.0
|
|
@@ -2,6 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { XIcon } from "lucide-react";
|
|
3
3
|
import * as DialogPrimitive from "radix-ui/dialog";
|
|
4
4
|
import { Button } from "#components/button";
|
|
5
|
+
import { behaviorSlot } from "#lib/slot";
|
|
5
6
|
import { cn } from "#lib/utils";
|
|
6
7
|
/**
|
|
7
8
|
* @since 0.3.16-canary.0
|
|
@@ -13,13 +14,13 @@ function Dialog({ ...props }) {
|
|
|
13
14
|
* @since 0.3.16-canary.0
|
|
14
15
|
*/
|
|
15
16
|
function DialogTrigger({ ...props }) {
|
|
16
|
-
return _jsx(DialogPrimitive.Trigger, { "
|
|
17
|
+
return _jsx(DialogPrimitive.Trigger, { ...behaviorSlot("dialog-trigger", props.asChild), ...props });
|
|
17
18
|
}
|
|
18
19
|
/**
|
|
19
20
|
* @since 0.3.16-canary.0
|
|
20
21
|
*/
|
|
21
22
|
function DialogContent({ children, className, closeLabel = "Close", showCloseButton = true, ...props }) {
|
|
22
|
-
return (_jsxs(DialogPrimitive.Portal, { "data-slot": "dialog-portal", children: [_jsx(DialogPrimitive.Overlay, { className: "fixed inset-0 isolate z-50 bg-black/10 ease-gentle supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:animation-duration-overlay-in data-open:fade-in-0 data-closed:animate-out data-closed:ease-exit data-closed:animation-duration-overlay-out data-closed:fade-out-0", "data-slot": "dialog-overlay" }), _jsxs(DialogPrimitive.Content, { className: cn("fixed inset-s-1/2 top-1/2 z-50 flex max-h-[calc(100dvh-2rem)] w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 flex-col gap-4 overflow-y-auto rounded-xl bg-popover p-4 text-sm text-popover-foreground ring-1 ring-foreground/10 ease-ui outline-none sm:max-w-sm rtl:translate-x-1/2 data-open:animate-in data-open:animation-duration-overlay-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:ease-exit data-closed:animation-duration-overlay-out data-closed:fade-out-0 data-closed:zoom-out-95", className), "data-slot": "dialog-content", ...props, children: [children, showCloseButton ? (_jsx(DialogPrimitive.Close, { asChild: true,
|
|
23
|
+
return (_jsxs(DialogPrimitive.Portal, { "data-slot": "dialog-portal", children: [_jsx(DialogPrimitive.Overlay, { className: "fixed inset-0 isolate z-50 bg-black/10 ease-gentle supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:animation-duration-overlay-in data-open:fade-in-0 data-closed:animate-out data-closed:ease-exit data-closed:animation-duration-overlay-out data-closed:fade-out-0", "data-slot": "dialog-overlay" }), _jsxs(DialogPrimitive.Content, { className: cn("fixed inset-s-1/2 top-1/2 z-50 flex max-h-[calc(100dvh-2rem)] w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 flex-col gap-4 overflow-y-auto rounded-xl bg-popover p-4 text-sm text-popover-foreground ring-1 ring-foreground/10 ease-ui outline-none sm:max-w-sm rtl:translate-x-1/2 data-open:animate-in data-open:animation-duration-overlay-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:ease-exit data-closed:animation-duration-overlay-out data-closed:fade-out-0 data-closed:zoom-out-95", className), "data-slot": "dialog-content", ...props, children: [children, showCloseButton ? (_jsx(DialogPrimitive.Close, { asChild: true, children: _jsxs(Button, { className: "absolute inset-e-2 top-2", size: "icon-sm", variant: "ghost", children: [_jsx(XIcon, {}), _jsx("span", { className: "sr-only", children: closeLabel })] }) })) : null] })] }));
|
|
23
24
|
}
|
|
24
25
|
/**
|
|
25
26
|
* @since 0.3.16-canary.0
|
|
@@ -55,7 +56,7 @@ function DialogDescription({ className, ...props }) {
|
|
|
55
56
|
* @since 0.3.16-canary.0
|
|
56
57
|
*/
|
|
57
58
|
function DialogClose({ ...props }) {
|
|
58
|
-
return _jsx(DialogPrimitive.Close, { "
|
|
59
|
+
return _jsx(DialogPrimitive.Close, { ...behaviorSlot("dialog-close", props.asChild), ...props });
|
|
59
60
|
}
|
|
60
61
|
// ── Exports ──────────────────────────────────────────────────────────────────────────────────────────────────────────
|
|
61
62
|
export { Dialog, DialogBody, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger, };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Drawer as DrawerPrimitive } from "vaul";
|
|
3
|
+
import { behaviorSlot } from "#lib/slot";
|
|
3
4
|
import { cn } from "#lib/utils";
|
|
4
5
|
import { buttonVariants } from "#variants/button";
|
|
5
6
|
/**
|
|
@@ -12,7 +13,7 @@ function Drawer({ shouldScaleBackground = true, ...props }) {
|
|
|
12
13
|
* @since 0.3.16-canary.0
|
|
13
14
|
*/
|
|
14
15
|
function DrawerTrigger({ ...props }) {
|
|
15
|
-
return _jsx(DrawerPrimitive.Trigger, { "
|
|
16
|
+
return _jsx(DrawerPrimitive.Trigger, { ...behaviorSlot("drawer-trigger", props.asChild), ...props });
|
|
16
17
|
}
|
|
17
18
|
/**
|
|
18
19
|
* @since 0.3.16-canary.0
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { CheckIcon, ChevronRightIcon } from "lucide-react";
|
|
3
3
|
import * as DropdownMenuPrimitive from "radix-ui/dropdown-menu";
|
|
4
|
+
import { behaviorSlot } from "#lib/slot";
|
|
4
5
|
import { cn } from "#lib/utils";
|
|
5
6
|
/**
|
|
6
7
|
* @since 0.3.16-canary.0
|
|
@@ -12,13 +13,13 @@ function DropdownMenu({ ...props }) {
|
|
|
12
13
|
* @since 0.3.16-canary.0
|
|
13
14
|
*/
|
|
14
15
|
function DropdownMenuTrigger({ ...props }) {
|
|
15
|
-
return _jsx(DropdownMenuPrimitive.Trigger, { "
|
|
16
|
+
return _jsx(DropdownMenuPrimitive.Trigger, { ...behaviorSlot("dropdown-menu-trigger", props.asChild), ...props });
|
|
16
17
|
}
|
|
17
18
|
/**
|
|
18
19
|
* @since 0.3.16-canary.0
|
|
19
20
|
*/
|
|
20
21
|
function DropdownMenuGroup({ ...props }) {
|
|
21
|
-
return _jsx(DropdownMenuPrimitive.Group, { "
|
|
22
|
+
return _jsx(DropdownMenuPrimitive.Group, { ...behaviorSlot("dropdown-menu-group", props.asChild), ...props });
|
|
22
23
|
}
|
|
23
24
|
/**
|
|
24
25
|
* @since 0.3.16-canary.0
|
|
@@ -30,7 +31,7 @@ function DropdownMenuSub({ ...props }) {
|
|
|
30
31
|
* @since 0.3.16-canary.0
|
|
31
32
|
*/
|
|
32
33
|
function DropdownMenuRadioGroup({ ...props }) {
|
|
33
|
-
return _jsx(DropdownMenuPrimitive.RadioGroup, { "
|
|
34
|
+
return _jsx(DropdownMenuPrimitive.RadioGroup, { ...behaviorSlot("dropdown-menu-radio-group", props.asChild), ...props });
|
|
34
35
|
}
|
|
35
36
|
/**
|
|
36
37
|
* @since 0.3.16-canary.0
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import * as HoverCardPrimitive from "radix-ui/hover-card";
|
|
3
|
+
import { behaviorSlot } from "#lib/slot";
|
|
3
4
|
import { cn } from "#lib/utils";
|
|
4
5
|
/**
|
|
5
6
|
* @since 0.3.16-canary.0
|
|
@@ -11,7 +12,7 @@ function HoverCard({ ...props }) {
|
|
|
11
12
|
* @since 0.3.16-canary.0
|
|
12
13
|
*/
|
|
13
14
|
function HoverCardTrigger({ ...props }) {
|
|
14
|
-
return _jsx(HoverCardPrimitive.Trigger, { "
|
|
15
|
+
return _jsx(HoverCardPrimitive.Trigger, { ...behaviorSlot("hover-card-trigger", props.asChild), ...props });
|
|
15
16
|
}
|
|
16
17
|
/**
|
|
17
18
|
* @since 0.3.16-canary.0
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { CheckIcon, ChevronRightIcon } from "lucide-react";
|
|
3
3
|
import * as MenubarPrimitive from "radix-ui/menubar";
|
|
4
|
+
import { behaviorSlot } from "#lib/slot";
|
|
4
5
|
import { cn } from "#lib/utils";
|
|
5
6
|
/**
|
|
6
7
|
* @since 0.3.16-canary.0
|
|
@@ -18,7 +19,7 @@ function MenubarMenu({ ...props }) {
|
|
|
18
19
|
* @since 0.3.16-canary.0
|
|
19
20
|
*/
|
|
20
21
|
function MenubarGroup({ ...props }) {
|
|
21
|
-
return _jsx(MenubarPrimitive.Group, { "
|
|
22
|
+
return _jsx(MenubarPrimitive.Group, { ...behaviorSlot("menubar-group", props.asChild), ...props });
|
|
22
23
|
}
|
|
23
24
|
/**
|
|
24
25
|
* @since 0.3.16-canary.0
|
|
@@ -30,7 +31,7 @@ function MenubarSub({ ...props }) {
|
|
|
30
31
|
* @since 0.3.16-canary.0
|
|
31
32
|
*/
|
|
32
33
|
function MenubarRadioGroup({ ...props }) {
|
|
33
|
-
return _jsx(MenubarPrimitive.RadioGroup, { "
|
|
34
|
+
return _jsx(MenubarPrimitive.RadioGroup, { ...behaviorSlot("menubar-radio-group", props.asChild), ...props });
|
|
34
35
|
}
|
|
35
36
|
/**
|
|
36
37
|
* @since 0.3.16-canary.0
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import * as PopoverPrimitive from "radix-ui/popover";
|
|
3
|
+
import { behaviorSlot } from "#lib/slot";
|
|
3
4
|
import { cn } from "#lib/utils";
|
|
4
5
|
/**
|
|
5
6
|
* @since 0.3.16-canary.0
|
|
@@ -11,13 +12,13 @@ function Popover({ ...props }) {
|
|
|
11
12
|
* @since 0.3.16-canary.0
|
|
12
13
|
*/
|
|
13
14
|
function PopoverTrigger({ ...props }) {
|
|
14
|
-
return _jsx(PopoverPrimitive.Trigger, { "
|
|
15
|
+
return _jsx(PopoverPrimitive.Trigger, { ...behaviorSlot("popover-trigger", props.asChild), ...props });
|
|
15
16
|
}
|
|
16
17
|
/**
|
|
17
18
|
* @since 0.3.16-canary.0
|
|
18
19
|
*/
|
|
19
20
|
function PopoverAnchor({ ...props }) {
|
|
20
|
-
return _jsx(PopoverPrimitive.Anchor, { "
|
|
21
|
+
return _jsx(PopoverPrimitive.Anchor, { ...behaviorSlot("popover-anchor", props.asChild), ...props });
|
|
21
22
|
}
|
|
22
23
|
/**
|
|
23
24
|
* @since 0.3.16-canary.0
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import * as RadioGroupPrimitive from "radix-ui/radio-group";
|
|
3
3
|
import { Label } from "#components/label";
|
|
4
|
+
import { behaviorSlot } from "#lib/slot";
|
|
4
5
|
import { cn } from "#lib/utils";
|
|
5
6
|
/**
|
|
6
7
|
* @since 0.3.16-canary.0
|
|
7
8
|
*/
|
|
8
9
|
function RadioCards(props) {
|
|
9
|
-
return _jsx(RadioGroupPrimitive.Root, { "
|
|
10
|
+
return _jsx(RadioGroupPrimitive.Root, { ...behaviorSlot("radio-cards", props.asChild), ...props });
|
|
10
11
|
}
|
|
11
12
|
/**
|
|
12
13
|
* @since 0.3.16-canary.0
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { CheckIcon, ChevronDownIcon, ChevronUpIcon } from "lucide-react";
|
|
3
3
|
import * as SelectPrimitive from "radix-ui/select";
|
|
4
|
+
import { behaviorSlot } from "#lib/slot";
|
|
4
5
|
import { cn } from "#lib/utils";
|
|
5
6
|
/**
|
|
6
7
|
* @since 0.3.16-canary.0
|
|
@@ -18,7 +19,7 @@ function SelectGroup({ className, ...props }) {
|
|
|
18
19
|
* @since 0.3.16-canary.0
|
|
19
20
|
*/
|
|
20
21
|
function SelectValue({ ...props }) {
|
|
21
|
-
return _jsx(SelectPrimitive.Value, { "
|
|
22
|
+
return _jsx(SelectPrimitive.Value, { ...behaviorSlot("select-value", props.asChild), ...props });
|
|
22
23
|
}
|
|
23
24
|
/**
|
|
24
25
|
* @since 0.3.16-canary.0
|
package/dist/components/sheet.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { XIcon } from "lucide-react";
|
|
3
3
|
import * as SheetPrimitive from "radix-ui/dialog";
|
|
4
|
+
import { behaviorSlot } from "#lib/slot";
|
|
4
5
|
import { cn } from "#lib/utils";
|
|
5
6
|
import { buttonVariants } from "#variants/button";
|
|
6
7
|
import { sheetContentVariants } from "#variants/sheet";
|
|
@@ -14,7 +15,7 @@ function Sheet({ ...props }) {
|
|
|
14
15
|
* @since 0.3.16-canary.0
|
|
15
16
|
*/
|
|
16
17
|
function SheetTrigger({ ...props }) {
|
|
17
|
-
return _jsx(SheetPrimitive.Trigger, { "
|
|
18
|
+
return _jsx(SheetPrimitive.Trigger, { ...behaviorSlot("sheet-trigger", props.asChild), ...props });
|
|
18
19
|
}
|
|
19
20
|
/**
|
|
20
21
|
* @since 0.3.16-canary.0
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import * as TooltipPrimitive from "radix-ui/tooltip";
|
|
3
|
+
import { behaviorSlot } from "#lib/slot";
|
|
3
4
|
import { cn } from "#lib/utils";
|
|
4
5
|
/**
|
|
5
6
|
* @since 0.3.16-canary.0
|
|
@@ -17,7 +18,7 @@ function Tooltip({ ...props }) {
|
|
|
17
18
|
* @since 0.3.16-canary.0
|
|
18
19
|
*/
|
|
19
20
|
function TooltipTrigger({ ...props }) {
|
|
20
|
-
return _jsx(TooltipPrimitive.Trigger, { "
|
|
21
|
+
return _jsx(TooltipPrimitive.Trigger, { ...behaviorSlot("tooltip-trigger", props.asChild), ...props });
|
|
21
22
|
}
|
|
22
23
|
/**
|
|
23
24
|
* @since 0.3.16-canary.0
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The props that carry a part's `data-slot`.
|
|
3
|
+
*/
|
|
4
|
+
type BehaviorSlotProps = {
|
|
5
|
+
readonly "data-slot"?: string;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* Returns a behavior-only part's `data-slot` props, empty under `asChild` so the composed element keeps its own.
|
|
9
|
+
*
|
|
10
|
+
* @remarks The key is omitted rather than `undefined`, which `Slot` would forward over the child's slot.
|
|
11
|
+
*
|
|
12
|
+
* @since 0.11.0
|
|
13
|
+
*/
|
|
14
|
+
export declare function behaviorSlot(slot: string, asChild: boolean | undefined): BehaviorSlotProps;
|
|
15
|
+
export {};
|
package/dist/lib/slot.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns a behavior-only part's `data-slot` props, empty under `asChild` so the composed element keeps its own.
|
|
3
|
+
*
|
|
4
|
+
* @remarks The key is omitted rather than `undefined`, which `Slot` would forward over the child's slot.
|
|
5
|
+
*
|
|
6
|
+
* @since 0.11.0
|
|
7
|
+
*/
|
|
8
|
+
export function behaviorSlot(slot, asChild) {
|
|
9
|
+
return asChild ? {} : { "data-slot": slot };
|
|
10
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codefast/ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.0",
|
|
4
4
|
"description": "Core UI components library built with React and Tailwind CSS",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"components",
|
|
@@ -377,6 +377,10 @@
|
|
|
377
377
|
"types": "./dist/lib/message-scroller/types.d.ts",
|
|
378
378
|
"import": "./dist/lib/message-scroller/types.js"
|
|
379
379
|
},
|
|
380
|
+
"./lib/slot": {
|
|
381
|
+
"types": "./dist/lib/slot.d.ts",
|
|
382
|
+
"import": "./dist/lib/slot.js"
|
|
383
|
+
},
|
|
380
384
|
"./lib/use-render": {
|
|
381
385
|
"types": "./dist/lib/use-render.d.ts",
|
|
382
386
|
"import": "./dist/lib/use-render.js"
|
|
@@ -489,15 +493,15 @@
|
|
|
489
493
|
},
|
|
490
494
|
"dependencies": {
|
|
491
495
|
"@codefast/tailwind-variants": "0.9.1",
|
|
492
|
-
"@daypicker/react": "^10.0.
|
|
496
|
+
"@daypicker/react": "^10.0.2",
|
|
493
497
|
"cmdk": "^1.1.1",
|
|
494
498
|
"embla-carousel-react": "^8.6.0",
|
|
495
499
|
"input-otp": "^1.5.0",
|
|
496
|
-
"lucide-react": "^1.
|
|
500
|
+
"lucide-react": "^1.49.0",
|
|
497
501
|
"next-themes": "^0.4.6",
|
|
498
502
|
"radix-ui": "^1.6.7",
|
|
499
|
-
"react-hook-form": "^7.
|
|
500
|
-
"react-resizable-panels": "^4.
|
|
503
|
+
"react-hook-form": "^7.89.0",
|
|
504
|
+
"react-resizable-panels": "^4.14.1",
|
|
501
505
|
"recharts": "^3.10.1",
|
|
502
506
|
"sonner": "^2.0.8",
|
|
503
507
|
"tailwind-merge": "^3.7.0",
|