@ctrl-ui/react 0.8.17 → 0.8.19
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/blocks/coding-agent.js +1 -1
- package/dist/blocks/design-canvas-inspector.js +1 -1
- package/dist/blocks/design-canvas.js +9 -5
- package/dist/blocks/discussion-markdown-input.d.ts +12 -0
- package/dist/blocks/discussion-markdown-input.js +34 -0
- package/dist/blocks/discussion.d.ts +7 -3
- package/dist/blocks/discussion.js +77 -16
- package/dist/blocks/file-explorer.js +4 -4
- package/dist/blocks/settings.js +5 -3
- package/dist/knob-contracts/label-knobs.d.ts +4 -0
- package/dist/knob-contracts/label-knobs.js +4 -0
- package/dist/knob-contracts/markdown-editor-knobs.d.ts +4 -0
- package/dist/knob-contracts/markdown-editor-knobs.js +16 -0
- package/dist/knob-contracts/switch-knobs.d.ts +1 -1
- package/dist/knob-contracts/switch-knobs.js +1 -0
- package/dist/markdown-editor/context.d.ts +22 -0
- package/dist/markdown-editor/context.js +10 -0
- package/dist/markdown-editor/extensions.d.ts +10 -0
- package/dist/markdown-editor/extensions.js +139 -0
- package/dist/markdown-editor/toolbar.d.ts +9 -0
- package/dist/markdown-editor/toolbar.js +336 -0
- package/dist/markdown-editor/uploads.d.ts +23 -0
- package/dist/markdown-editor/uploads.js +32 -0
- package/dist/markdown-editor/use-image-uploads.d.ts +12 -0
- package/dist/markdown-editor/use-image-uploads.js +120 -0
- package/dist/markdown-editor.d.ts +27 -0
- package/dist/markdown-editor.js +192 -0
- package/dist/styles/index.css +4 -2
- package/dist/styles/recipes/code.css +4 -0
- package/dist/styles/recipes/field.css +1 -1
- package/dist/styles/recipes/label.css +19 -0
- package/dist/styles/recipes/markdown-editor.css +196 -0
- package/dist/styles/recipes/switch.css +17 -5
- package/dist/styles/theme.css +25 -0
- package/dist/styles/type-scale.css +28 -2
- package/dist/ui/app-shell.js +1 -1
- package/dist/ui/autocomplete.js +1 -1
- package/dist/ui/code.js +1 -0
- package/dist/ui/combobox.js +1 -1
- package/dist/ui/command.js +1 -1
- package/dist/ui/dockable-panel.js +1 -1
- package/dist/ui/label.d.ts +8 -0
- package/dist/ui/label.js +14 -0
- package/dist/ui/markdown.d.ts +2 -1
- package/dist/ui/markdown.js +3 -3
- package/dist/ui/responsive-dialog.js +1 -1
- package/dist/ui/sidebar-menu.js +1 -1
- package/dist/ui/sidebar.js +1 -1
- package/dist/ui/typography.d.ts +44 -0
- package/dist/ui/typography.js +59 -0
- package/dist/ui/use-switch-drag.js +1 -1
- package/package.json +37 -1
package/dist/ui/markdown.d.ts
CHANGED
|
@@ -6,9 +6,10 @@ export type MarkdownRootProps = Omit<ComponentProps<"div">, "style"> & {
|
|
|
6
6
|
};
|
|
7
7
|
export type MarkdownProps = Omit<MarkdownRootProps, "children"> & {
|
|
8
8
|
content: string;
|
|
9
|
+
mode?: "streaming" | "static";
|
|
9
10
|
};
|
|
10
11
|
export declare function MarkdownRoot({ className, ...props }: MarkdownRootProps): import("react").JSX.Element;
|
|
11
12
|
export declare function MarkdownFlow(props: MarkdownRootProps): import("react").JSX.Element;
|
|
12
|
-
export declare function Markdown({ content, className, ...props }: MarkdownProps): import("react").JSX.Element;
|
|
13
|
+
export declare function Markdown({ content, mode, className, ...props }: MarkdownProps): import("react").JSX.Element;
|
|
13
14
|
export type MarkdownComponentProps = ComponentProps<typeof Markdown>;
|
|
14
15
|
//#endregion
|
package/dist/ui/markdown.js
CHANGED
|
@@ -21,13 +21,13 @@ function MarkdownFlow(props) {
|
|
|
21
21
|
...props
|
|
22
22
|
});
|
|
23
23
|
}
|
|
24
|
-
function Markdown({ content, className, ...props }) {
|
|
24
|
+
function Markdown({ content, mode = "streaming", className, ...props }) {
|
|
25
25
|
return /* @__PURE__ */ jsx(MarkdownRoot, {
|
|
26
26
|
className,
|
|
27
27
|
...props,
|
|
28
28
|
children: /* @__PURE__ */ jsx(MarkdownFlow, { children: /* @__PURE__ */ jsx(Streamdown, {
|
|
29
|
-
mode
|
|
30
|
-
parseIncompleteMarkdown:
|
|
29
|
+
mode,
|
|
30
|
+
parseIncompleteMarkdown: mode === "streaming",
|
|
31
31
|
controls: false,
|
|
32
32
|
components: markdownComponents,
|
|
33
33
|
className: "cui-markdown-streamdown [&>[data-control-family]]:[margin-block:revert-layer]",
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
import { cn } from "../lib/cn.js";
|
|
3
3
|
import { Button } from "./button.js";
|
|
4
4
|
import { PopupCloseButton } from "../popup-parts.js";
|
|
5
|
-
import { Drawer, DrawerBody, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerTitle, DrawerTrigger } from "./drawer.js";
|
|
6
5
|
import { Dialog, DialogBody, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger } from "./dialog.js";
|
|
6
|
+
import { Drawer, DrawerBody, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerTitle, DrawerTrigger } from "./drawer.js";
|
|
7
7
|
import { createContext, useContext, useState, useSyncExternalStore } from "react";
|
|
8
8
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
9
|
//#region src/ui/responsive-dialog.tsx
|
package/dist/ui/sidebar-menu.js
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
import { cn } from "../lib/cn.js";
|
|
3
3
|
import { useSkin } from "../skin-provider.js";
|
|
4
4
|
import { Tooltip, TooltipContent, TooltipTrigger } from "./tooltip.js";
|
|
5
|
-
import { SidebarSurfaceContext, useSidebar } from "./sidebar-provider.js";
|
|
6
5
|
import { TrackHighlight } from "../extensions/track-highlight.js";
|
|
6
|
+
import { SidebarSurfaceContext, useSidebar } from "./sidebar-provider.js";
|
|
7
7
|
import { createContext, useContext, useRef, useState } from "react";
|
|
8
8
|
import { useRender } from "@base-ui/react/use-render";
|
|
9
9
|
import { jsx, jsxs } from "react/jsx-runtime";
|
package/dist/ui/sidebar.js
CHANGED
|
@@ -257,7 +257,7 @@ function SidebarContent({ className, children, ...props }) {
|
|
|
257
257
|
"data-slot": "content",
|
|
258
258
|
className: cn("min-h-0 flex-1 group-data-[collapsible=icon]:overflow-hidden", className),
|
|
259
259
|
lockAxis: "x",
|
|
260
|
-
viewportClassName: "overscroll-contain",
|
|
260
|
+
viewportClassName: "overscroll-y-contain",
|
|
261
261
|
...props,
|
|
262
262
|
children: /* @__PURE__ */ jsx("div", {
|
|
263
263
|
"data-control-ui": "sidebar",
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { ComponentProps, HTMLAttributes, Ref } from "react";
|
|
2
|
+
//#region src/ui/typography.d.ts
|
|
3
|
+
declare const sizeClassNames: {
|
|
4
|
+
readonly display: "text-display";
|
|
5
|
+
readonly "heading-1": "text-heading-1";
|
|
6
|
+
readonly "heading-2": "text-heading-2";
|
|
7
|
+
readonly "heading-3": "text-heading-3";
|
|
8
|
+
readonly "heading-4": "text-heading-4";
|
|
9
|
+
readonly "body-lg": "text-body-lg";
|
|
10
|
+
readonly body: "text-body";
|
|
11
|
+
readonly label: "text-label";
|
|
12
|
+
readonly caption: "text-caption";
|
|
13
|
+
readonly micro: "text-micro";
|
|
14
|
+
};
|
|
15
|
+
declare const toneClassNames: {
|
|
16
|
+
readonly default: undefined;
|
|
17
|
+
readonly muted: "text-muted-foreground";
|
|
18
|
+
readonly destructive: "text-destructive-text";
|
|
19
|
+
};
|
|
20
|
+
declare const weightClassNames: {
|
|
21
|
+
readonly normal: "font-normal";
|
|
22
|
+
readonly medium: "font-medium";
|
|
23
|
+
readonly semibold: "font-semibold";
|
|
24
|
+
};
|
|
25
|
+
export type TypeSize = keyof typeof sizeClassNames;
|
|
26
|
+
export type TypeTone = keyof typeof toneClassNames;
|
|
27
|
+
export type TextWeight = keyof typeof weightClassNames;
|
|
28
|
+
export type HeadingLevel = 1 | 2 | 3 | 4 | 5 | 6;
|
|
29
|
+
export type HeadingProps = ComponentProps<"h1"> & {
|
|
30
|
+
level: HeadingLevel;
|
|
31
|
+
size?: TypeSize;
|
|
32
|
+
tone?: TypeTone;
|
|
33
|
+
};
|
|
34
|
+
export declare function Heading({ level, size, tone, className, ...props }: HeadingProps): import("react").JSX.Element;
|
|
35
|
+
export type TextTag = "p" | "span" | "div" | "small" | "strong" | "em" | "li" | "dt" | "dd" | "figcaption" | "legend" | "blockquote";
|
|
36
|
+
export type TextProps = HTMLAttributes<HTMLElement> & {
|
|
37
|
+
ref?: Ref<HTMLElement>;
|
|
38
|
+
as?: TextTag;
|
|
39
|
+
size?: TypeSize;
|
|
40
|
+
weight?: TextWeight;
|
|
41
|
+
tone?: TypeTone;
|
|
42
|
+
};
|
|
43
|
+
export declare function Text({ as: Tag, size, weight, tone, className, ref, ...props }: TextProps): import("react").JSX.Element;
|
|
44
|
+
//#endregion
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { cn } from "../lib/cn.js";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
//#region src/ui/typography.tsx
|
|
4
|
+
const sizeClassNames = {
|
|
5
|
+
display: "text-display",
|
|
6
|
+
"heading-1": "text-heading-1",
|
|
7
|
+
"heading-2": "text-heading-2",
|
|
8
|
+
"heading-3": "text-heading-3",
|
|
9
|
+
"heading-4": "text-heading-4",
|
|
10
|
+
"body-lg": "text-body-lg",
|
|
11
|
+
body: "text-body",
|
|
12
|
+
label: "text-label",
|
|
13
|
+
caption: "text-caption",
|
|
14
|
+
micro: "text-micro"
|
|
15
|
+
};
|
|
16
|
+
const toneClassNames = {
|
|
17
|
+
default: void 0,
|
|
18
|
+
muted: "text-muted-foreground",
|
|
19
|
+
destructive: "text-destructive-text"
|
|
20
|
+
};
|
|
21
|
+
const weightClassNames = {
|
|
22
|
+
normal: "font-normal",
|
|
23
|
+
medium: "font-medium",
|
|
24
|
+
semibold: "font-semibold"
|
|
25
|
+
};
|
|
26
|
+
const headingSizeByLevel = {
|
|
27
|
+
1: "heading-1",
|
|
28
|
+
2: "heading-2",
|
|
29
|
+
3: "heading-3",
|
|
30
|
+
4: "heading-4",
|
|
31
|
+
5: "heading-4",
|
|
32
|
+
6: "heading-4"
|
|
33
|
+
};
|
|
34
|
+
function Heading({ level, size = headingSizeByLevel[level], tone = "default", className, ...props }) {
|
|
35
|
+
const Tag = `h${level}`;
|
|
36
|
+
return /* @__PURE__ */ jsx(Tag, {
|
|
37
|
+
"data-control-ui": "typography",
|
|
38
|
+
"data-control-family": "typography",
|
|
39
|
+
"data-slot": "heading",
|
|
40
|
+
className: cn(sizeClassNames[size], toneClassNames[tone], className),
|
|
41
|
+
...props
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
function attachRef(ref, node) {
|
|
45
|
+
if (typeof ref === "function") return ref(node);
|
|
46
|
+
if (ref) ref.current = node;
|
|
47
|
+
}
|
|
48
|
+
function Text({ as: Tag = "span", size = "body", weight, tone = "default", className, ref, ...props }) {
|
|
49
|
+
return /* @__PURE__ */ jsx(Tag, {
|
|
50
|
+
ref: (node) => attachRef(ref, node),
|
|
51
|
+
"data-control-ui": "typography",
|
|
52
|
+
"data-control-family": "typography",
|
|
53
|
+
"data-slot": "text",
|
|
54
|
+
className: cn(sizeClassNames[size], weight ? weightClassNames[weight] : void 0, toneClassNames[tone], className),
|
|
55
|
+
...props
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
//#endregion
|
|
59
|
+
export { Heading, Text };
|
|
@@ -25,7 +25,7 @@ function useSwitchDrag() {
|
|
|
25
25
|
if (!(event.isPrimary && event.button === 0 && !isSwitchLocked(root)) || !thumbRef.current) return;
|
|
26
26
|
setDragProgress(null);
|
|
27
27
|
const styles = getComputedStyle(root);
|
|
28
|
-
const travel = root.clientWidth - Number.parseFloat(styles.paddingLeft) - Number.parseFloat(styles.paddingRight) -
|
|
28
|
+
const travel = root.clientWidth - Number.parseFloat(styles.paddingLeft) - Number.parseFloat(styles.paddingRight) - Number.parseFloat(styles.getPropertyValue("--cui-switch-thumb-inline-size"));
|
|
29
29
|
if (travel <= 0) return;
|
|
30
30
|
const progress = root.hasAttribute("data-checked") ? 1 : 0;
|
|
31
31
|
gestureRef.current = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ctrl-ui/react",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.19",
|
|
4
4
|
"description": "Control UI components, blocks, and primitives with neutral defaults and consumer-owned themes.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -36,6 +36,15 @@
|
|
|
36
36
|
"peerDependencies": {
|
|
37
37
|
"@base-ui/react": "^1.8.0",
|
|
38
38
|
"@tanstack/react-virtual": "^3.14.13",
|
|
39
|
+
"@tiptap/core": "3.31.4",
|
|
40
|
+
"@tiptap/extension-image": "3.31.4",
|
|
41
|
+
"@tiptap/extension-list": "3.31.4",
|
|
42
|
+
"@tiptap/extension-paragraph": "3.31.4",
|
|
43
|
+
"@tiptap/extension-table": "3.31.4",
|
|
44
|
+
"@tiptap/markdown": "3.31.4",
|
|
45
|
+
"@tiptap/pm": "3.31.4",
|
|
46
|
+
"@tiptap/react": "3.31.4",
|
|
47
|
+
"@tiptap/starter-kit": "3.31.4",
|
|
39
48
|
"class-variance-authority": "^0.7.1",
|
|
40
49
|
"clsx": "^2.1.1",
|
|
41
50
|
"cmdk": "^1.1.1",
|
|
@@ -64,6 +73,33 @@
|
|
|
64
73
|
"@tanstack/react-virtual": {
|
|
65
74
|
"optional": true
|
|
66
75
|
},
|
|
76
|
+
"@tiptap/core": {
|
|
77
|
+
"optional": true
|
|
78
|
+
},
|
|
79
|
+
"@tiptap/extension-image": {
|
|
80
|
+
"optional": true
|
|
81
|
+
},
|
|
82
|
+
"@tiptap/extension-list": {
|
|
83
|
+
"optional": true
|
|
84
|
+
},
|
|
85
|
+
"@tiptap/extension-paragraph": {
|
|
86
|
+
"optional": true
|
|
87
|
+
},
|
|
88
|
+
"@tiptap/extension-table": {
|
|
89
|
+
"optional": true
|
|
90
|
+
},
|
|
91
|
+
"@tiptap/markdown": {
|
|
92
|
+
"optional": true
|
|
93
|
+
},
|
|
94
|
+
"@tiptap/pm": {
|
|
95
|
+
"optional": true
|
|
96
|
+
},
|
|
97
|
+
"@tiptap/react": {
|
|
98
|
+
"optional": true
|
|
99
|
+
},
|
|
100
|
+
"@tiptap/starter-kit": {
|
|
101
|
+
"optional": true
|
|
102
|
+
},
|
|
67
103
|
"cmdk": {
|
|
68
104
|
"optional": true
|
|
69
105
|
},
|