@codefast/ui 0.10.2 → 0.12.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 CHANGED
@@ -1,5 +1,33 @@
1
1
  # @codefast/ui
2
2
 
3
+ ## 0.12.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#1052](https://github.com/codefastlabs/codefast/pull/1052) The root entry, `@codefast/ui`, now re-exports `useHasHydrated` and `useLatest`, so every published hook is reachable
8
+ from it. The `@codefast/ui/hooks/use-message-scroller-commands`, `use-message-scroller-controller` and
9
+ `use-message-scroller-refs` subpaths are no longer published: they pass the message-scroller primitive's private ref
10
+ bags between its own parts and were never usable on their own — compose a scroller from
11
+ `@codefast/ui/primitives/message-scroller` or `@codefast/ui/message-scroller` instead.
12
+
13
+ ### Patch Changes
14
+
15
+ - [#1050](https://github.com/codefastlabs/codefast/pull/1050) The root entry, `@codefast/ui`, now re-exports `InputNumberField`, `InputNumberStepper`, `InputNumberIncrement` and
16
+ `InputNumberDecrement` with their prop types, which only `@codefast/ui/input-number` offered before, so an `InputNumber`
17
+ can be composed from the root import alone.
18
+
19
+ ## 0.11.0
20
+
21
+ ### Minor Changes
22
+
23
+ - [#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,
24
+ dropdown-menu and collapsible triggers, `DialogClose`, `PopoverAnchor`, the menu groups and `SelectValue` among them —
25
+ no longer stamps its `data-slot` when it composes onto a child with `asChild`, so the child keeps its own. An `Avatar`
26
+ under `HoverCardTrigger asChild` now stays `data-slot="avatar"` and `AvatarGroup` rings it like its siblings, and a
27
+ `Button` under `TooltipTrigger asChild` stays `data-slot="button"`. A selector on such a part's slot, like
28
+ `[data-slot=tooltip-trigger]`, matches only when the part renders its own element. The new `behaviorSlot` in
29
+ `@codefast/ui/lib/slot` gives a behavior wrapper of your own the same rule.
30
+
3
31
  ## 0.10.2
4
32
 
5
33
  ### Patch Changes
package/README.md CHANGED
@@ -96,7 +96,7 @@ All components, prop types, hooks, and variants are also re-exported from the ro
96
96
  Beyond the components, the package exposes:
97
97
 
98
98
  - `@codefast/ui/hooks/*` — standalone hooks such as `useMediaQuery` (`@codefast/ui/hooks/use-media-query`),
99
- `useIsMobile`, `useCopyToClipboard`, `useMutationObserver`, and `usePagination`.
99
+ `useIsMobile`, `useCopyToClipboard`, `useMutationObserver`, `usePagination`, `useHasHydrated`, and `useLatest`.
100
100
  - `@codefast/ui/variants/*` — the variant functions behind the styled components, such as `buttonVariants` from
101
101
  `@codefast/ui/variants/button`, for styling an element that isn't the component itself.
102
102
  - `@codefast/ui/primitives/*` — unstyled building blocks the styled components are composed from.
@@ -106,8 +106,8 @@ Beyond the components, the package exposes:
106
106
  For example, to style a link like a button:
107
107
 
108
108
  ```tsx
109
- import { buttonVariants } from "@codefast/ui/variants/button";
110
109
  import { cn } from "@codefast/ui/lib/utils";
110
+ import { buttonVariants } from "@codefast/ui/variants/button";
111
111
 
112
112
  export function DocsLink() {
113
113
  return (
@@ -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, { "data-slot": "alert-dialog-trigger", ...props });
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, { "data-slot": "alert-dialog-action", ...props }) }));
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, { "data-slot": "alert-dialog-cancel", ...props }) }));
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, { "data-slot": "aspect-ratio", ...props });
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, { "data-slot": "collapsible", ...props });
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, { "data-slot": "collapsible-trigger", ...props });
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, { "data-slot": "collapsible-content", ...props });
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, { "data-slot": "context-menu-group", ...props });
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, { "data-slot": "context-menu-radio-group", ...props });
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, { "data-slot": "dialog-trigger", ...props });
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, "data-slot": "dialog-close", 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
+ 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, { "data-slot": "dialog-close", ...props });
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, { "data-slot": "drawer-trigger", ...props });
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, { "data-slot": "dropdown-menu-trigger", ...props });
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, { "data-slot": "dropdown-menu-group", ...props });
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, { "data-slot": "dropdown-menu-radio-group", ...props });
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, { "data-slot": "hover-card-trigger", ...props });
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, { "data-slot": "menubar-group", ...props });
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, { "data-slot": "menubar-radio-group", ...props });
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, { "data-slot": "popover-trigger", ...props });
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, { "data-slot": "popover-anchor", ...props });
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, { "data-slot": "radio-cards", ...props });
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, { "data-slot": "select-value", ...props });
22
+ return _jsx(SelectPrimitive.Value, { ...behaviorSlot("select-value", props.asChild), ...props });
22
23
  }
23
24
  /**
24
25
  * @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 { 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, { "data-slot": "sheet-trigger", ...props });
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, { "data-slot": "tooltip-trigger", ...props });
21
+ return _jsx(TooltipPrimitive.Trigger, { ...behaviorSlot("tooltip-trigger", props.asChild), ...props });
21
22
  }
22
23
  /**
23
24
  * @since 0.3.16-canary.0
@@ -1,4 +1,3 @@
1
- import type { MessageScrollerRefs } from "#hooks/use-message-scroller-refs";
2
1
  import type { MessageScrollerContextValue, MessageScrollerProviderProps, MessageScrollerRegisterMessage } from "#lib/message-scroller/types";
3
2
  /**
4
3
  * Orchestrator hook. Decides when to scroll and delegates the moves to
@@ -11,5 +10,4 @@ declare function useMessageScrollerController({ autoScroll, defaultScrollPositio
11
10
  context: MessageScrollerContextValue;
12
11
  registerMessage: MessageScrollerRegisterMessage;
13
12
  };
14
- export { useMessageScrollerController };
15
- export type { MessageScrollerRefs };
13
+ export { useMessageScrollerController };
package/dist/index.d.ts CHANGED
@@ -59,8 +59,8 @@ export { Input } from "#components/input";
59
59
  export type { InputProps } from "#components/input";
60
60
  export { InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, InputGroupText, InputGroupTextarea, } from "#components/input-group";
61
61
  export type { InputGroupAddonProps, InputGroupButtonProps, InputGroupInputProps, InputGroupProps, InputGroupTextareaProps, InputGroupTextProps, } from "#components/input-group";
62
- export { InputNumber } from "#components/input-number";
63
- export type { InputNumberProps } from "#components/input-number";
62
+ export { InputNumber, InputNumberDecrement, InputNumberField, InputNumberIncrement, InputNumberStepper, } from "#components/input-number";
63
+ export type { InputNumberDecrementProps, InputNumberFieldProps, InputNumberIncrementProps, InputNumberProps, InputNumberStepperProps, } from "#components/input-number";
64
64
  export { InputOTP, InputOTPGroup, InputOTPSeparator, InputOTPSlot, REGEXP_ONLY_CHARS, REGEXP_ONLY_DIGITS, REGEXP_ONLY_DIGITS_AND_CHARS, } from "#components/input-otp";
65
65
  export type { InputOTPGroupProps, InputOTPProps, InputOTPSeparatorProps, InputOTPSlotProps, } from "#components/input-otp";
66
66
  export { InputPassword } from "#components/input-password";
@@ -135,7 +135,9 @@ export { Tooltip, TooltipArrow, TooltipContent, TooltipProvider, TooltipTrigger
135
135
  export type { TooltipArrowProps, TooltipContentProps, TooltipProps, TooltipProviderProps, TooltipTriggerProps, } from "#components/tooltip";
136
136
  export { useAnimatedValue } from "#hooks/use-animated-value";
137
137
  export { useCopyToClipboard } from "#hooks/use-copy-to-clipboard";
138
+ export { useHasHydrated } from "#hooks/use-has-hydrated";
138
139
  export { useIsMobile } from "#hooks/use-is-mobile";
140
+ export { useLatest } from "#hooks/use-latest";
139
141
  export { useMediaQuery } from "#hooks/use-media-query";
140
142
  export { useMutationObserver } from "#hooks/use-mutation-observer";
141
143
  export { ELLIPSIS, usePagination } from "#hooks/use-pagination";
package/dist/index.js CHANGED
@@ -29,7 +29,7 @@ export { createFormFieldScope, Form, FormControl, FormDescription, FormField, Fo
29
29
  export { HoverCard, HoverCardArrow, HoverCardContent, HoverCardTrigger } from "#components/hover-card";
30
30
  export { Input } from "#components/input";
31
31
  export { InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, InputGroupText, InputGroupTextarea, } from "#components/input-group";
32
- export { InputNumber } from "#components/input-number";
32
+ export { InputNumber, InputNumberDecrement, InputNumberField, InputNumberIncrement, InputNumberStepper, } from "#components/input-number";
33
33
  export { InputOTP, InputOTPGroup, InputOTPSeparator, InputOTPSlot, REGEXP_ONLY_CHARS, REGEXP_ONLY_DIGITS, REGEXP_ONLY_DIGITS_AND_CHARS, } from "#components/input-otp";
34
34
  export { InputPassword } from "#components/input-password";
35
35
  export { InputSearch } from "#components/input-search";
@@ -68,7 +68,9 @@ export { ToggleGroup, ToggleGroupItem } from "#components/toggle-group";
68
68
  export { Tooltip, TooltipArrow, TooltipContent, TooltipProvider, TooltipTrigger } from "#components/tooltip";
69
69
  export { useAnimatedValue } from "#hooks/use-animated-value";
70
70
  export { useCopyToClipboard } from "#hooks/use-copy-to-clipboard";
71
+ export { useHasHydrated } from "#hooks/use-has-hydrated";
71
72
  export { useIsMobile } from "#hooks/use-is-mobile";
73
+ export { useLatest } from "#hooks/use-latest";
72
74
  export { useMediaQuery } from "#hooks/use-media-query";
73
75
  export { useMutationObserver } from "#hooks/use-mutation-observer";
74
76
  export { ELLIPSIS, usePagination } from "#hooks/use-pagination";
@@ -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 {};
@@ -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
+ }
@@ -58,7 +58,7 @@ function CheckboxGroup({ __scopeCheckboxGroup, defaultValue, dir, disabled = fal
58
58
  return currentValue.filter((inputValue) => inputValue !== itemValue);
59
59
  });
60
60
  }, [setValue, required]);
61
- return (_jsx(CheckboxGroupContextProvider, { disabled: disabled, name: name, required: required, scope: __scopeCheckboxGroup, value: value, onItemCheck: handleItemCheck, onItemUncheck: handleItemUncheck, children: _jsx(RovingFocus.Root, { asChild: true, ...rovingFocusGroupScope, dir: direction, loop: loop, orientation: orientation, children: _jsx("div", { "data-disabled": disabled ? "" : undefined, dir: direction, role: "group", ...props }) }) }));
61
+ return (_jsx(CheckboxGroupContextProvider, { disabled: disabled, name: name, required: required, scope: __scopeCheckboxGroup, value: value, onItemCheck: handleItemCheck, onItemUncheck: handleItemUncheck, children: _jsx(RovingFocus.Root, { asChild: true, ...rovingFocusGroupScope, dir: direction, loop: loop, ...(orientation === undefined ? {} : { orientation }), children: _jsx("div", { "data-disabled": disabled ? "" : undefined, dir: direction, role: "group", ...props }) }) }));
62
62
  }
63
63
  // ── Component: CheckboxGroupItem ─────────────────────────────────────────────────────────────────────────────────────
64
64
  const ITEM_NAME = "CheckboxGroupItem";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codefast/ui",
3
- "version": "0.10.2",
3
+ "version": "0.12.0",
4
4
  "description": "Core UI components library built with React and Tailwind CSS",
5
5
  "keywords": [
6
6
  "components",
@@ -345,18 +345,6 @@
345
345
  "types": "./dist/hooks/use-media-query.d.ts",
346
346
  "import": "./dist/hooks/use-media-query.js"
347
347
  },
348
- "./hooks/use-message-scroller-commands": {
349
- "types": "./dist/hooks/use-message-scroller-commands.d.ts",
350
- "import": "./dist/hooks/use-message-scroller-commands.js"
351
- },
352
- "./hooks/use-message-scroller-controller": {
353
- "types": "./dist/hooks/use-message-scroller-controller.d.ts",
354
- "import": "./dist/hooks/use-message-scroller-controller.js"
355
- },
356
- "./hooks/use-message-scroller-refs": {
357
- "types": "./dist/hooks/use-message-scroller-refs.d.ts",
358
- "import": "./dist/hooks/use-message-scroller-refs.js"
359
- },
360
348
  "./hooks/use-mutation-observer": {
361
349
  "types": "./dist/hooks/use-mutation-observer.d.ts",
362
350
  "import": "./dist/hooks/use-mutation-observer.js"
@@ -377,6 +365,10 @@
377
365
  "types": "./dist/lib/message-scroller/types.d.ts",
378
366
  "import": "./dist/lib/message-scroller/types.js"
379
367
  },
368
+ "./lib/slot": {
369
+ "types": "./dist/lib/slot.d.ts",
370
+ "import": "./dist/lib/slot.js"
371
+ },
380
372
  "./lib/use-render": {
381
373
  "types": "./dist/lib/use-render.d.ts",
382
374
  "import": "./dist/lib/use-render.js"
@@ -489,15 +481,15 @@
489
481
  },
490
482
  "dependencies": {
491
483
  "@codefast/tailwind-variants": "0.9.1",
492
- "@daypicker/react": "^10.0.1",
484
+ "@daypicker/react": "^10.0.2",
493
485
  "cmdk": "^1.1.1",
494
486
  "embla-carousel-react": "^8.6.0",
495
487
  "input-otp": "^1.5.0",
496
- "lucide-react": "^1.48.0",
488
+ "lucide-react": "^1.54.0",
497
489
  "next-themes": "^0.4.6",
498
- "radix-ui": "^1.6.7",
499
- "react-hook-form": "^7.88.0",
500
- "react-resizable-panels": "^4.13.3",
490
+ "radix-ui": "^1.7.0",
491
+ "react-hook-form": "^7.89.0",
492
+ "react-resizable-panels": "^4.14.3",
501
493
  "recharts": "^3.10.1",
502
494
  "sonner": "^2.0.8",
503
495
  "tailwind-merge": "^3.7.0",