@codefast/ui 0.5.0-canary.1 → 0.5.0-canary.3
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 +39 -0
- package/dist/components/attachment.d.mts +136 -0
- package/dist/components/attachment.mjs +112 -0
- package/dist/components/avatar.mjs +1 -1
- package/dist/components/bubble.d.mts +67 -0
- package/dist/components/bubble.mjs +58 -0
- package/dist/components/card.mjs +2 -2
- package/dist/components/carousel.mjs +12 -3
- package/dist/components/chart.mjs +2 -1
- package/dist/components/empty.mjs +1 -1
- package/dist/components/form.mjs +2 -1
- package/dist/components/marker.d.mts +49 -0
- package/dist/components/marker.mjs +42 -0
- package/dist/components/message-scroller.d.mts +89 -0
- package/dist/components/message-scroller.mjs +77 -0
- package/dist/components/message.d.mts +86 -0
- package/dist/components/message.mjs +66 -0
- package/dist/components/sidebar.mjs +6 -3
- package/dist/hooks/use-animated-value.mjs +3 -1
- package/dist/hooks/use-message-scroller-commands.d.mts +39 -0
- package/dist/hooks/use-message-scroller-commands.mjs +165 -0
- package/dist/hooks/use-message-scroller-controller.d.mts +19 -0
- package/dist/hooks/use-message-scroller-controller.mjs +382 -0
- package/dist/hooks/use-message-scroller-refs.d.mts +60 -0
- package/dist/hooks/use-message-scroller-refs.mjs +77 -0
- package/dist/hooks/use-pagination.mjs +18 -12
- package/dist/index.d.mts +11 -1
- package/dist/index.mjs +11 -2
- package/dist/lib/message-scroller/geometry.d.mts +136 -0
- package/dist/lib/message-scroller/geometry.mjs +199 -0
- package/dist/lib/message-scroller/stores.d.mts +21 -0
- package/dist/lib/message-scroller/stores.mjs +52 -0
- package/dist/lib/message-scroller/types.d.mts +171 -0
- package/dist/lib/message-scroller/types.mjs +53 -0
- package/dist/lib/message-scroller/utils.d.mts +7 -0
- package/dist/lib/message-scroller/utils.mjs +12 -0
- package/dist/lib/use-render.d.mts +43 -0
- package/dist/lib/use-render.mjs +84 -0
- package/dist/primitives/checkbox-group.mjs +20 -10
- package/dist/primitives/message-scroller.d.mts +88 -0
- package/dist/primitives/message-scroller.mjs +240 -0
- package/dist/variants/attachment.d.mts +42 -0
- package/dist/variants/attachment.mjs +42 -0
- package/dist/variants/bubble.d.mts +45 -0
- package/dist/variants/bubble.mjs +45 -0
- package/dist/variants/marker.d.mts +21 -0
- package/dist/variants/marker.mjs +18 -0
- package/package.json +57 -11
- package/src/components/attachment.tsx +284 -0
- package/src/components/avatar.tsx +1 -1
- package/src/components/bubble.tsx +116 -0
- package/src/components/card.tsx +2 -2
- package/src/components/carousel.tsx +12 -3
- package/src/components/empty.tsx +1 -1
- package/src/components/marker.tsx +94 -0
- package/src/components/message-scroller.tsx +213 -0
- package/src/components/message.tsx +173 -0
- package/src/components/sidebar.tsx +11 -4
- package/src/css/foundation/tokens.css +6 -18
- package/src/css/foundation/utilities.css +451 -0
- package/src/css/preset.css +2 -1
- package/src/hooks/use-message-scroller-commands.ts +312 -0
- package/src/hooks/use-message-scroller-controller.ts +651 -0
- package/src/hooks/use-message-scroller-refs.ts +168 -0
- package/src/index.ts +72 -0
- package/src/lib/message-scroller/geometry.ts +398 -0
- package/src/lib/message-scroller/stores.ts +89 -0
- package/src/lib/message-scroller/types.ts +310 -0
- package/src/lib/message-scroller/utils.ts +15 -0
- package/src/lib/use-render.ts +202 -0
- package/src/primitives/message-scroller.tsx +399 -0
- package/src/variants/attachment.ts +73 -0
- package/src/variants/bubble.ts +81 -0
- package/src/variants/marker.ts +38 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,44 @@
|
|
|
1
1
|
# @codefast/ui
|
|
2
2
|
|
|
3
|
+
## 0.5.0-canary.3
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#552](https://github.com/codefastlabs/codefast/pull/552) [`78bf5a4`](https://github.com/codefastlabs/codefast/commit/78bf5a494de8276f5eeb262bc5dc45c882bb63f7) Thanks [@thevuong](https://github.com/thevuong)! - Refine two surfaces after comparing with shadcn radix-nova:
|
|
8
|
+
|
|
9
|
+
- `CardFooter` is now a distinct tinted tray by default (`border-t bg-muted/50` with full `--card-spacing` padding). `Card` drops its bottom padding when a footer is present (`has-data-[slot=card-footer]:pb-0`) so the tint reaches the card's bottom edge. Footers that previously relied on the transparent, opt-in-border behavior will now render with a background and top border.
|
|
10
|
+
- `Empty` uses `rounded-xl` instead of `rounded-lg`, matching `Card`'s corner radius for a consistent container language.
|
|
11
|
+
|
|
12
|
+
- [#552](https://github.com/codefastlabs/codefast/pull/552) [`e7839f2`](https://github.com/codefastlabs/codefast/commit/e7839f2d49da7b3af805aafcb6863a32e18e9563) Thanks [@thevuong](https://github.com/thevuong)! - Add chat surface components adapted from shadcn radix-nova: `Attachment` (file/media card with upload states, three sizes, and horizontal/vertical orientations), `Bubble` (message bubble with seven variants, alignment, and reaction pills), `Message` (avatar + content row with start/end alignment), and `Marker` (inline feed divider). Each ships per-component and `./variants/*` subpath exports, stories, and unit tests.
|
|
13
|
+
|
|
14
|
+
Also adds `scroll-fade-*` (scroll-aware, RTL-mirrored edge fades) and `shimmer` (text loading shimmer) utilities to the foundation preset, used by these components and available on any scroller.
|
|
15
|
+
|
|
16
|
+
- [#552](https://github.com/codefastlabs/codefast/pull/552) [`5e74e3e`](https://github.com/codefastlabs/codefast/commit/5e74e3e426a10d26f86a053a15acf971dc0115dc) Thanks [@thevuong](https://github.com/thevuong)! - Add `MessageScroller`, a headless-driven scroll manager for chat transcripts: follow-the-bottom autoscroll, scroll preservation on prepend, anchored streaming turns, `defaultScrollPosition`, and a self-hiding scroll-to-edge button. Ships the styled component (`@codefast/ui/message-scroller`), the headless primitive (`@codefast/ui/primitives/message-scroller`), and the `useMessageScroller`, `useMessageScrollerScrollable`, and `useMessageScrollerVisibility` hooks.
|
|
17
|
+
|
|
18
|
+
The scroll engine (geometry, stores, and controller hooks) is vendored from shadcn's `@shadcn/react/message-scroller` into `@codefast/ui` internals and adapted to codefast conventions, so it carries no extra runtime dependency. Adds an internal `useRender` utility that backs the primitives' `render` prop.
|
|
19
|
+
|
|
20
|
+
- [#552](https://github.com/codefastlabs/codefast/pull/552) [`feb5639`](https://github.com/codefastlabs/codefast/commit/feb5639ea4443b8c1c90e638e3f9d12e6a32b14e) Thanks [@thevuong](https://github.com/thevuong)! - Complete RTL hardening across the component library, closing the last physical-direction gaps and making the carousel direction-aware.
|
|
21
|
+
|
|
22
|
+
- `AvatarGroup` now flips its overlap in RTL (`rtl:space-x-reverse`).
|
|
23
|
+
- `SidebarRail`'s off-canvas drag line mirrors correctly (`after:start-full`).
|
|
24
|
+
- **`Carousel` is now direction-aware:** it forwards the resolved reading direction to Embla (so drag/snap physics mirror in RTL) and swaps the arrow-key mapping (in RTL the **Left** arrow advances, **Right** retreats). An explicit `opts.direction` still wins. This is a behavior change for RTL consumers who relied on the previous physical arrow-key mapping.
|
|
25
|
+
|
|
26
|
+
Also adds an internal `audit:rtl` script and a Direction (LTR/RTL) Storybook toolbar to keep physical-direction utilities from regressing.
|
|
27
|
+
|
|
28
|
+
### Patch Changes
|
|
29
|
+
|
|
30
|
+
- [#552](https://github.com/codefastlabs/codefast/pull/552) [`04c82de`](https://github.com/codefastlabs/codefast/commit/04c82ded0a01a6a12a4dd66cd35d5635718ba699) Thanks [@thevuong](https://github.com/thevuong)! - Fix a hydration mismatch in `SidebarMenuSkeleton`: its placeholder width was derived from `Math.random()`, which produced different values on the server and client. It now derives a stable, varied width (50–90%) from `useId`, so server and client render the same markup.
|
|
31
|
+
|
|
32
|
+
- Updated dependencies []:
|
|
33
|
+
- @codefast/tailwind-variants@0.5.0-canary.3
|
|
34
|
+
|
|
35
|
+
## 0.5.0-canary.2
|
|
36
|
+
|
|
37
|
+
### Patch Changes
|
|
38
|
+
|
|
39
|
+
- Updated dependencies []:
|
|
40
|
+
- @codefast/tailwind-variants@0.5.0-canary.2
|
|
41
|
+
|
|
3
42
|
## 0.5.0-canary.1
|
|
4
43
|
|
|
5
44
|
### Patch Changes
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { Button } from "./button.mjs";
|
|
2
|
+
import { AttachmentMediaVariants, AttachmentVariants } from "../variants/attachment.mjs";
|
|
3
|
+
import { ComponentProps, JSX } from "react";
|
|
4
|
+
|
|
5
|
+
//#region src/components/attachment.d.ts
|
|
6
|
+
/**
|
|
7
|
+
* File/media attachment card. `state` drives the upload lifecycle styling.
|
|
8
|
+
*
|
|
9
|
+
* @since 0.5.0-canary.3
|
|
10
|
+
*/
|
|
11
|
+
interface AttachmentProps extends ComponentProps<"div">, AttachmentVariants {
|
|
12
|
+
state?: "idle" | "uploading" | "processing" | "error" | "done";
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* @since 0.5.0-canary.3
|
|
16
|
+
*/
|
|
17
|
+
declare function Attachment({
|
|
18
|
+
className,
|
|
19
|
+
orientation,
|
|
20
|
+
size,
|
|
21
|
+
state,
|
|
22
|
+
...props
|
|
23
|
+
}: AttachmentProps): JSX.Element;
|
|
24
|
+
/**
|
|
25
|
+
* Thumbnail slot — an icon tile or a cover image.
|
|
26
|
+
*
|
|
27
|
+
* @since 0.5.0-canary.3
|
|
28
|
+
*/
|
|
29
|
+
interface AttachmentMediaProps extends ComponentProps<"div">, AttachmentMediaVariants {}
|
|
30
|
+
/**
|
|
31
|
+
* @since 0.5.0-canary.3
|
|
32
|
+
*/
|
|
33
|
+
declare function AttachmentMedia({
|
|
34
|
+
className,
|
|
35
|
+
variant,
|
|
36
|
+
...props
|
|
37
|
+
}: AttachmentMediaProps): JSX.Element;
|
|
38
|
+
/**
|
|
39
|
+
* Text column holding the title and description.
|
|
40
|
+
*
|
|
41
|
+
* @since 0.5.0-canary.3
|
|
42
|
+
*/
|
|
43
|
+
type AttachmentContentProps = ComponentProps<"div">;
|
|
44
|
+
/**
|
|
45
|
+
* @since 0.5.0-canary.3
|
|
46
|
+
*/
|
|
47
|
+
declare function AttachmentContent({
|
|
48
|
+
className,
|
|
49
|
+
...props
|
|
50
|
+
}: AttachmentContentProps): JSX.Element;
|
|
51
|
+
/**
|
|
52
|
+
* File name; shimmers while uploading or processing.
|
|
53
|
+
*
|
|
54
|
+
* @since 0.5.0-canary.3
|
|
55
|
+
*/
|
|
56
|
+
type AttachmentTitleProps = ComponentProps<"span">;
|
|
57
|
+
/**
|
|
58
|
+
* @since 0.5.0-canary.3
|
|
59
|
+
*/
|
|
60
|
+
declare function AttachmentTitle({
|
|
61
|
+
className,
|
|
62
|
+
...props
|
|
63
|
+
}: AttachmentTitleProps): JSX.Element;
|
|
64
|
+
/**
|
|
65
|
+
* Secondary line (size, type); turns destructive on error.
|
|
66
|
+
*
|
|
67
|
+
* @since 0.5.0-canary.3
|
|
68
|
+
*/
|
|
69
|
+
type AttachmentDescriptionProps = ComponentProps<"span">;
|
|
70
|
+
/**
|
|
71
|
+
* @since 0.5.0-canary.3
|
|
72
|
+
*/
|
|
73
|
+
declare function AttachmentDescription({
|
|
74
|
+
className,
|
|
75
|
+
...props
|
|
76
|
+
}: AttachmentDescriptionProps): JSX.Element;
|
|
77
|
+
/**
|
|
78
|
+
* Action cluster; floats to the top corner in the vertical orientation.
|
|
79
|
+
*
|
|
80
|
+
* @since 0.5.0-canary.3
|
|
81
|
+
*/
|
|
82
|
+
type AttachmentActionsProps = ComponentProps<"div">;
|
|
83
|
+
/**
|
|
84
|
+
* @since 0.5.0-canary.3
|
|
85
|
+
*/
|
|
86
|
+
declare function AttachmentActions({
|
|
87
|
+
className,
|
|
88
|
+
...props
|
|
89
|
+
}: AttachmentActionsProps): JSX.Element;
|
|
90
|
+
/**
|
|
91
|
+
* A single action button; defaults to a ghost icon button.
|
|
92
|
+
*
|
|
93
|
+
* @since 0.5.0-canary.3
|
|
94
|
+
*/
|
|
95
|
+
interface AttachmentActionProps extends ComponentProps<typeof Button> {}
|
|
96
|
+
/**
|
|
97
|
+
* @since 0.5.0-canary.3
|
|
98
|
+
*/
|
|
99
|
+
declare function AttachmentAction({
|
|
100
|
+
className,
|
|
101
|
+
size,
|
|
102
|
+
variant,
|
|
103
|
+
...props
|
|
104
|
+
}: AttachmentActionProps): JSX.Element;
|
|
105
|
+
/**
|
|
106
|
+
* Full-card overlay trigger for opening/previewing the attachment.
|
|
107
|
+
*
|
|
108
|
+
* @since 0.5.0-canary.3
|
|
109
|
+
*/
|
|
110
|
+
interface AttachmentTriggerProps extends ComponentProps<"button"> {
|
|
111
|
+
asChild?: boolean;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* @since 0.5.0-canary.3
|
|
115
|
+
*/
|
|
116
|
+
declare function AttachmentTrigger({
|
|
117
|
+
asChild,
|
|
118
|
+
className,
|
|
119
|
+
type,
|
|
120
|
+
...props
|
|
121
|
+
}: AttachmentTriggerProps): JSX.Element;
|
|
122
|
+
/**
|
|
123
|
+
* Horizontally scrollable row of attachments with snap and edge fade.
|
|
124
|
+
*
|
|
125
|
+
* @since 0.5.0-canary.3
|
|
126
|
+
*/
|
|
127
|
+
type AttachmentGroupProps = ComponentProps<"div">;
|
|
128
|
+
/**
|
|
129
|
+
* @since 0.5.0-canary.3
|
|
130
|
+
*/
|
|
131
|
+
declare function AttachmentGroup({
|
|
132
|
+
className,
|
|
133
|
+
...props
|
|
134
|
+
}: AttachmentGroupProps): JSX.Element;
|
|
135
|
+
//#endregion
|
|
136
|
+
export { Attachment, AttachmentAction, type AttachmentActionProps, AttachmentActions, type AttachmentActionsProps, AttachmentContent, type AttachmentContentProps, AttachmentDescription, type AttachmentDescriptionProps, AttachmentGroup, type AttachmentGroupProps, AttachmentMedia, type AttachmentMediaProps, type AttachmentProps, AttachmentTitle, type AttachmentTitleProps, AttachmentTrigger, type AttachmentTriggerProps };
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { cn } from "../lib/utils.mjs";
|
|
2
|
+
import { Button } from "./button.mjs";
|
|
3
|
+
import { attachmentMediaVariants, attachmentVariants } from "../variants/attachment.mjs";
|
|
4
|
+
import { Slot } from "radix-ui";
|
|
5
|
+
import { jsx } from "react/jsx-runtime";
|
|
6
|
+
//#region src/components/attachment.tsx
|
|
7
|
+
/**
|
|
8
|
+
* @since 0.5.0-canary.3
|
|
9
|
+
*/
|
|
10
|
+
function Attachment({ className, orientation = "horizontal", size = "default", state = "done", ...props }) {
|
|
11
|
+
return /* @__PURE__ */ jsx("div", {
|
|
12
|
+
className: attachmentVariants({
|
|
13
|
+
className,
|
|
14
|
+
orientation,
|
|
15
|
+
size
|
|
16
|
+
}),
|
|
17
|
+
"data-orientation": orientation,
|
|
18
|
+
"data-size": size,
|
|
19
|
+
"data-slot": "attachment",
|
|
20
|
+
"data-state": state,
|
|
21
|
+
...props
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* @since 0.5.0-canary.3
|
|
26
|
+
*/
|
|
27
|
+
function AttachmentMedia({ className, variant = "icon", ...props }) {
|
|
28
|
+
return /* @__PURE__ */ jsx("div", {
|
|
29
|
+
className: attachmentMediaVariants({
|
|
30
|
+
className,
|
|
31
|
+
variant
|
|
32
|
+
}),
|
|
33
|
+
"data-slot": "attachment-media",
|
|
34
|
+
"data-variant": variant,
|
|
35
|
+
...props
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* @since 0.5.0-canary.3
|
|
40
|
+
*/
|
|
41
|
+
function AttachmentContent({ className, ...props }) {
|
|
42
|
+
return /* @__PURE__ */ jsx("div", {
|
|
43
|
+
className: cn("max-w-full min-w-0 flex-1 leading-tight group-data-[orientation=vertical]/attachment:px-1", className),
|
|
44
|
+
"data-slot": "attachment-content",
|
|
45
|
+
...props
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* @since 0.5.0-canary.3
|
|
50
|
+
*/
|
|
51
|
+
function AttachmentTitle({ className, ...props }) {
|
|
52
|
+
return /* @__PURE__ */ jsx("span", {
|
|
53
|
+
className: cn("block max-w-full min-w-0 truncate font-medium group-data-[state=processing]/attachment:shimmer group-data-[state=uploading]/attachment:shimmer", className),
|
|
54
|
+
"data-slot": "attachment-title",
|
|
55
|
+
...props
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* @since 0.5.0-canary.3
|
|
60
|
+
*/
|
|
61
|
+
function AttachmentDescription({ className, ...props }) {
|
|
62
|
+
return /* @__PURE__ */ jsx("span", {
|
|
63
|
+
className: cn("mt-0.5 block max-w-full min-w-0 truncate text-xs text-muted-foreground group-data-[state=error]/attachment:text-destructive/80", className),
|
|
64
|
+
"data-slot": "attachment-description",
|
|
65
|
+
...props
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* @since 0.5.0-canary.3
|
|
70
|
+
*/
|
|
71
|
+
function AttachmentActions({ className, ...props }) {
|
|
72
|
+
return /* @__PURE__ */ jsx("div", {
|
|
73
|
+
className: cn("relative z-20 flex shrink-0 items-center group-data-[orientation=vertical]/attachment:absolute group-data-[orientation=vertical]/attachment:end-3 group-data-[orientation=vertical]/attachment:top-3 group-data-[orientation=vertical]/attachment:gap-1", className),
|
|
74
|
+
"data-slot": "attachment-actions",
|
|
75
|
+
...props
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* @since 0.5.0-canary.3
|
|
80
|
+
*/
|
|
81
|
+
function AttachmentAction({ className, size = "icon-xs", variant, ...props }) {
|
|
82
|
+
return /* @__PURE__ */ jsx(Button, {
|
|
83
|
+
className: cn(className),
|
|
84
|
+
"data-slot": "attachment-action",
|
|
85
|
+
size,
|
|
86
|
+
variant: variant ?? "ghost",
|
|
87
|
+
...props
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* @since 0.5.0-canary.3
|
|
92
|
+
*/
|
|
93
|
+
function AttachmentTrigger({ asChild = false, className, type, ...props }) {
|
|
94
|
+
return /* @__PURE__ */ jsx(asChild ? Slot.Root : "button", {
|
|
95
|
+
className: cn("absolute inset-0 z-10 outline-none", className),
|
|
96
|
+
"data-slot": "attachment-trigger",
|
|
97
|
+
type: asChild ? void 0 : type ?? "button",
|
|
98
|
+
...props
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* @since 0.5.0-canary.3
|
|
103
|
+
*/
|
|
104
|
+
function AttachmentGroup({ className, ...props }) {
|
|
105
|
+
return /* @__PURE__ */ jsx("div", {
|
|
106
|
+
className: cn("flex min-w-0 scroll-fade-x snap-x snap-mandatory scroll-px-1 scrollbar-none gap-3 overflow-x-auto overscroll-x-contain py-1 *:data-[slot=attachment]:flex-none *:data-[slot=attachment]:snap-start", className),
|
|
107
|
+
"data-slot": "attachment-group",
|
|
108
|
+
...props
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
//#endregion
|
|
112
|
+
export { Attachment, AttachmentAction, AttachmentActions, AttachmentContent, AttachmentDescription, AttachmentGroup, AttachmentMedia, AttachmentTitle, AttachmentTrigger };
|
|
@@ -48,7 +48,7 @@ function AvatarBadge({ className, ...props }) {
|
|
|
48
48
|
*/
|
|
49
49
|
function AvatarGroup({ className, ...props }) {
|
|
50
50
|
return /* @__PURE__ */ jsx("div", {
|
|
51
|
-
className: cn("group/avatar-group flex -space-x-2 *:data-[slot=avatar]:ring-2 *:data-[slot=avatar]:ring-background", className),
|
|
51
|
+
className: cn("group/avatar-group flex -space-x-2 *:data-[slot=avatar]:ring-2 *:data-[slot=avatar]:ring-background rtl:space-x-reverse", className),
|
|
52
52
|
"data-slot": "avatar-group",
|
|
53
53
|
...props
|
|
54
54
|
});
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { BubbleReactionsVariants, BubbleVariants } from "../variants/bubble.mjs";
|
|
2
|
+
import { ComponentProps, JSX } from "react";
|
|
3
|
+
|
|
4
|
+
//#region src/components/bubble.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* Vertical stack of consecutive bubbles from one author.
|
|
7
|
+
*
|
|
8
|
+
* @since 0.5.0-canary.3
|
|
9
|
+
*/
|
|
10
|
+
type BubbleGroupProps = ComponentProps<"div">;
|
|
11
|
+
/**
|
|
12
|
+
* @since 0.5.0-canary.3
|
|
13
|
+
*/
|
|
14
|
+
declare function BubbleGroup({
|
|
15
|
+
className,
|
|
16
|
+
...props
|
|
17
|
+
}: BubbleGroupProps): JSX.Element;
|
|
18
|
+
/**
|
|
19
|
+
* Chat bubble wrapper. `variant` colors the content; `align` sets the side.
|
|
20
|
+
*
|
|
21
|
+
* @since 0.5.0-canary.3
|
|
22
|
+
*/
|
|
23
|
+
interface BubbleProps extends ComponentProps<"div">, BubbleVariants {
|
|
24
|
+
align?: "start" | "end";
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* @since 0.5.0-canary.3
|
|
28
|
+
*/
|
|
29
|
+
declare function Bubble({
|
|
30
|
+
align,
|
|
31
|
+
className,
|
|
32
|
+
variant,
|
|
33
|
+
...props
|
|
34
|
+
}: BubbleProps): JSX.Element;
|
|
35
|
+
/**
|
|
36
|
+
* The bubble's colored surface; render as a button/link with `asChild`.
|
|
37
|
+
*
|
|
38
|
+
* @since 0.5.0-canary.3
|
|
39
|
+
*/
|
|
40
|
+
interface BubbleContentProps extends ComponentProps<"div"> {
|
|
41
|
+
asChild?: boolean;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* @since 0.5.0-canary.3
|
|
45
|
+
*/
|
|
46
|
+
declare function BubbleContent({
|
|
47
|
+
asChild,
|
|
48
|
+
className,
|
|
49
|
+
...props
|
|
50
|
+
}: BubbleContentProps): JSX.Element;
|
|
51
|
+
/**
|
|
52
|
+
* Reaction pill overlapping a bubble corner.
|
|
53
|
+
*
|
|
54
|
+
* @since 0.5.0-canary.3
|
|
55
|
+
*/
|
|
56
|
+
interface BubbleReactionsProps extends ComponentProps<"div">, BubbleReactionsVariants {}
|
|
57
|
+
/**
|
|
58
|
+
* @since 0.5.0-canary.3
|
|
59
|
+
*/
|
|
60
|
+
declare function BubbleReactions({
|
|
61
|
+
align,
|
|
62
|
+
className,
|
|
63
|
+
side,
|
|
64
|
+
...props
|
|
65
|
+
}: BubbleReactionsProps): JSX.Element;
|
|
66
|
+
//#endregion
|
|
67
|
+
export { Bubble, BubbleContent, type BubbleContentProps, BubbleGroup, type BubbleGroupProps, type BubbleProps, BubbleReactions, type BubbleReactionsProps };
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { cn } from "../lib/utils.mjs";
|
|
2
|
+
import { bubbleReactionsVariants, bubbleVariants } from "../variants/bubble.mjs";
|
|
3
|
+
import { Slot } from "radix-ui";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
//#region src/components/bubble.tsx
|
|
6
|
+
/**
|
|
7
|
+
* @since 0.5.0-canary.3
|
|
8
|
+
*/
|
|
9
|
+
function BubbleGroup({ className, ...props }) {
|
|
10
|
+
return /* @__PURE__ */ jsx("div", {
|
|
11
|
+
className: cn("flex min-w-0 flex-col gap-2", className),
|
|
12
|
+
"data-slot": "bubble-group",
|
|
13
|
+
...props
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* @since 0.5.0-canary.3
|
|
18
|
+
*/
|
|
19
|
+
function Bubble({ align = "start", className, variant = "default", ...props }) {
|
|
20
|
+
return /* @__PURE__ */ jsx("div", {
|
|
21
|
+
className: bubbleVariants({
|
|
22
|
+
className,
|
|
23
|
+
variant
|
|
24
|
+
}),
|
|
25
|
+
"data-align": align,
|
|
26
|
+
"data-slot": "bubble",
|
|
27
|
+
"data-variant": variant,
|
|
28
|
+
...props
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* @since 0.5.0-canary.3
|
|
33
|
+
*/
|
|
34
|
+
function BubbleContent({ asChild = false, className, ...props }) {
|
|
35
|
+
return /* @__PURE__ */ jsx(asChild ? Slot.Root : "div", {
|
|
36
|
+
className: cn("w-fit max-w-full min-w-0 overflow-hidden rounded-xl border border-transparent px-3 py-2 text-sm leading-relaxed wrap-break-word group-data-[align=end]/bubble:self-end [button]:text-start [button,a]:transition-colors [button,a]:outline-none [button,a]:focus-visible:border-ring [button,a]:focus-visible:ring-3 [button,a]:focus-visible:ring-ring/50", className),
|
|
37
|
+
"data-slot": "bubble-content",
|
|
38
|
+
...props
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* @since 0.5.0-canary.3
|
|
43
|
+
*/
|
|
44
|
+
function BubbleReactions({ align = "end", className, side = "bottom", ...props }) {
|
|
45
|
+
return /* @__PURE__ */ jsx("div", {
|
|
46
|
+
className: bubbleReactionsVariants({
|
|
47
|
+
align,
|
|
48
|
+
className,
|
|
49
|
+
side
|
|
50
|
+
}),
|
|
51
|
+
"data-align": align,
|
|
52
|
+
"data-side": side,
|
|
53
|
+
"data-slot": "bubble-reactions",
|
|
54
|
+
...props
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
//#endregion
|
|
58
|
+
export { Bubble, BubbleContent, BubbleGroup, BubbleReactions };
|
package/dist/components/card.mjs
CHANGED
|
@@ -6,7 +6,7 @@ import { jsx } from "react/jsx-runtime";
|
|
|
6
6
|
*/
|
|
7
7
|
function Card({ className, size = "default", ...props }) {
|
|
8
8
|
return /* @__PURE__ */ jsx("div", {
|
|
9
|
-
className: cn("group/card flex flex-col gap-(--card-spacing) overflow-hidden rounded-xl bg-card py-(--card-spacing) text-sm text-card-foreground shadow-xs ring-1 ring-foreground/10 [--card-spacing:--spacing(6)] has-[>img:first-child]:pt-0 data-[size=sm]:[--card-spacing:--spacing(4)] *:[img:first-child]:rounded-t-xl *:[img:last-child]:rounded-b-xl", className),
|
|
9
|
+
className: cn("group/card flex flex-col gap-(--card-spacing) overflow-hidden rounded-xl bg-card py-(--card-spacing) text-sm text-card-foreground shadow-xs ring-1 ring-foreground/10 [--card-spacing:--spacing(6)] has-data-[slot=card-footer]:pb-0 has-[>img:first-child]:pt-0 data-[size=sm]:[--card-spacing:--spacing(4)] *:[img:first-child]:rounded-t-xl *:[img:last-child]:rounded-b-xl", className),
|
|
10
10
|
"data-size": size,
|
|
11
11
|
"data-slot": "card",
|
|
12
12
|
...props
|
|
@@ -57,7 +57,7 @@ function CardContent({ className, ...props }) {
|
|
|
57
57
|
*/
|
|
58
58
|
function CardFooter({ className, ...props }) {
|
|
59
59
|
return /* @__PURE__ */ jsx("div", {
|
|
60
|
-
className: cn("flex items-center rounded-b-xl
|
|
60
|
+
className: cn("flex items-center rounded-b-xl border-t bg-muted/50 p-(--card-spacing)", className),
|
|
61
61
|
"data-slot": "card-footer",
|
|
62
62
|
...props
|
|
63
63
|
});
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { cn } from "../lib/utils.mjs";
|
|
2
2
|
import { Button } from "./button.mjs";
|
|
3
|
+
import { useDirection } from "./direction.mjs";
|
|
3
4
|
import { ChevronLeftIcon, ChevronRightIcon } from "lucide-react";
|
|
4
5
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
6
|
import { useCallback, useEffect, useState } from "react";
|
|
@@ -13,7 +14,9 @@ const [CarouselContextProvider, useCarouselContext] = createCarouselContext(CARO
|
|
|
13
14
|
* @since 0.3.16-canary.0
|
|
14
15
|
*/
|
|
15
16
|
function Carousel({ __scopeCarousel, children, className, opts, orientation, plugins, setApi, ...props }) {
|
|
17
|
+
const direction = useDirection();
|
|
16
18
|
const [carouselRef, api] = useEmblaCarousel({
|
|
19
|
+
direction,
|
|
17
20
|
...opts,
|
|
18
21
|
axis: orientation === "vertical" ? "y" : "x"
|
|
19
22
|
}, plugins);
|
|
@@ -31,14 +34,20 @@ function Carousel({ __scopeCarousel, children, className, opts, orientation, plu
|
|
|
31
34
|
api?.scrollNext();
|
|
32
35
|
}, [api]);
|
|
33
36
|
const handleKeyDown = useCallback((event) => {
|
|
34
|
-
|
|
37
|
+
const previousKey = direction === "rtl" ? "ArrowRight" : "ArrowLeft";
|
|
38
|
+
const nextKey = direction === "rtl" ? "ArrowLeft" : "ArrowRight";
|
|
39
|
+
if (event.key === previousKey) {
|
|
35
40
|
event.preventDefault();
|
|
36
41
|
scrollPrevious();
|
|
37
|
-
} else if (event.key ===
|
|
42
|
+
} else if (event.key === nextKey) {
|
|
38
43
|
event.preventDefault();
|
|
39
44
|
scrollNext();
|
|
40
45
|
}
|
|
41
|
-
}, [
|
|
46
|
+
}, [
|
|
47
|
+
direction,
|
|
48
|
+
scrollPrevious,
|
|
49
|
+
scrollNext
|
|
50
|
+
]);
|
|
42
51
|
useEffect(() => {
|
|
43
52
|
if (!api || !setApi) return;
|
|
44
53
|
setApi(api);
|
|
@@ -61,7 +61,8 @@ function ChartTooltipContent({ __scopeChart, active, className, color, formatter
|
|
|
61
61
|
if (hideLabel || payload.length === 0) return null;
|
|
62
62
|
const item = payload[0];
|
|
63
63
|
if (item === void 0) return null;
|
|
64
|
-
const
|
|
64
|
+
const key = safeToString(labelKey ?? item.dataKey ?? item.name ?? "value");
|
|
65
|
+
const itemConfig = getPayloadConfigFromPayload(config, item, key);
|
|
65
66
|
const configEntry = typeof label === "string" && label in config ? config[label] : void 0;
|
|
66
67
|
const value = !labelKey && typeof label === "string" ? configEntry !== void 0 ? configEntry.label ?? label : label : itemConfig?.label;
|
|
67
68
|
if (labelFormatter) return /* @__PURE__ */ jsx("div", {
|
|
@@ -7,7 +7,7 @@ import { jsx } from "react/jsx-runtime";
|
|
|
7
7
|
*/
|
|
8
8
|
function Empty({ className, ...props }) {
|
|
9
9
|
return /* @__PURE__ */ jsx("div", {
|
|
10
|
-
className: cn("flex w-full min-w-0 flex-1 flex-col items-center justify-center gap-4 rounded-
|
|
10
|
+
className: cn("flex w-full min-w-0 flex-1 flex-col items-center justify-center gap-4 rounded-xl border-dashed p-12 text-center text-balance", className),
|
|
11
11
|
"data-slot": "empty",
|
|
12
12
|
...props
|
|
13
13
|
});
|
package/dist/components/form.mjs
CHANGED
|
@@ -43,8 +43,9 @@ const [FormItemContextProvider, useFormItemContext] = createFormFieldContext("Fo
|
|
|
43
43
|
* @since 0.3.16-canary.0
|
|
44
44
|
*/
|
|
45
45
|
function FormItem({ __scopeFormField, className, ...props }) {
|
|
46
|
+
const id = useId();
|
|
46
47
|
return /* @__PURE__ */ jsx(FormItemContextProvider, {
|
|
47
|
-
id
|
|
48
|
+
id,
|
|
48
49
|
scope: __scopeFormField,
|
|
49
50
|
children: /* @__PURE__ */ jsx("div", {
|
|
50
51
|
className: cn("grid gap-2", className),
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { MarkerVariants } from "../variants/marker.mjs";
|
|
2
|
+
import { ComponentProps, JSX } from "react";
|
|
3
|
+
|
|
4
|
+
//#region src/components/marker.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* Inline divider for a message feed — a date, unread line, or section label.
|
|
7
|
+
*
|
|
8
|
+
* @since 0.5.0-canary.3
|
|
9
|
+
*/
|
|
10
|
+
interface MarkerProps extends ComponentProps<"div">, MarkerVariants {
|
|
11
|
+
asChild?: boolean;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* @since 0.5.0-canary.3
|
|
15
|
+
*/
|
|
16
|
+
declare function Marker({
|
|
17
|
+
asChild,
|
|
18
|
+
className,
|
|
19
|
+
variant,
|
|
20
|
+
...props
|
|
21
|
+
}: MarkerProps): JSX.Element;
|
|
22
|
+
/**
|
|
23
|
+
* Decorative leading icon for a marker.
|
|
24
|
+
*
|
|
25
|
+
* @since 0.5.0-canary.3
|
|
26
|
+
*/
|
|
27
|
+
type MarkerIconProps = ComponentProps<"span">;
|
|
28
|
+
/**
|
|
29
|
+
* @since 0.5.0-canary.3
|
|
30
|
+
*/
|
|
31
|
+
declare function MarkerIcon({
|
|
32
|
+
className,
|
|
33
|
+
...props
|
|
34
|
+
}: MarkerIconProps): JSX.Element;
|
|
35
|
+
/**
|
|
36
|
+
* Marker label; centers between the rules in the `separator` variant.
|
|
37
|
+
*
|
|
38
|
+
* @since 0.5.0-canary.3
|
|
39
|
+
*/
|
|
40
|
+
type MarkerContentProps = ComponentProps<"span">;
|
|
41
|
+
/**
|
|
42
|
+
* @since 0.5.0-canary.3
|
|
43
|
+
*/
|
|
44
|
+
declare function MarkerContent({
|
|
45
|
+
className,
|
|
46
|
+
...props
|
|
47
|
+
}: MarkerContentProps): JSX.Element;
|
|
48
|
+
//#endregion
|
|
49
|
+
export { Marker, MarkerContent, type MarkerContentProps, MarkerIcon, type MarkerIconProps, type MarkerProps };
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { cn } from "../lib/utils.mjs";
|
|
2
|
+
import { markerVariants } from "../variants/marker.mjs";
|
|
3
|
+
import { Slot } from "radix-ui";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
//#region src/components/marker.tsx
|
|
6
|
+
/**
|
|
7
|
+
* @since 0.5.0-canary.3
|
|
8
|
+
*/
|
|
9
|
+
function Marker({ asChild = false, className, variant = "default", ...props }) {
|
|
10
|
+
return /* @__PURE__ */ jsx(asChild ? Slot.Root : "div", {
|
|
11
|
+
className: markerVariants({
|
|
12
|
+
className,
|
|
13
|
+
variant
|
|
14
|
+
}),
|
|
15
|
+
"data-slot": "marker",
|
|
16
|
+
"data-variant": variant,
|
|
17
|
+
...props
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* @since 0.5.0-canary.3
|
|
22
|
+
*/
|
|
23
|
+
function MarkerIcon({ className, ...props }) {
|
|
24
|
+
return /* @__PURE__ */ jsx("span", {
|
|
25
|
+
"aria-hidden": "true",
|
|
26
|
+
className: cn("size-4 shrink-0 [&_svg:not([class*='size-'])]:size-4", className),
|
|
27
|
+
"data-slot": "marker-icon",
|
|
28
|
+
...props
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* @since 0.5.0-canary.3
|
|
33
|
+
*/
|
|
34
|
+
function MarkerContent({ className, ...props }) {
|
|
35
|
+
return /* @__PURE__ */ jsx("span", {
|
|
36
|
+
className: cn("min-w-0 wrap-break-word group-data-[variant=separator]/marker:flex-none group-data-[variant=separator]/marker:text-center *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground", className),
|
|
37
|
+
"data-slot": "marker-content",
|
|
38
|
+
...props
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
//#endregion
|
|
42
|
+
export { Marker, MarkerContent, MarkerIcon };
|