@ctrl-ui/react 0.9.11 → 0.9.13
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/README.md +3 -1
- package/dist/control-variants.d.ts +1 -1
- package/dist/control-variants.js +1 -0
- package/dist/knob-contracts/button-knobs.d.ts +1 -1
- package/dist/knob-contracts/button-knobs.js +11 -5
- package/dist/knob-contracts/dropzone-knobs.d.ts +1 -1
- package/dist/knob-contracts/dropzone-knobs.js +5 -1
- package/dist/knob-contracts/field-knobs.d.ts +1 -1
- package/dist/knob-contracts/field-knobs.js +10 -0
- package/dist/knob-contracts/gradient-editor-knobs.d.ts +1 -1
- package/dist/knob-contracts/gradient-editor-knobs.js +1 -4
- package/dist/knob-contracts/page-layout-knobs.d.ts +1 -1
- package/dist/knob-contracts/page-layout-knobs.js +1 -0
- package/dist/knob-contracts/popup-knobs.d.ts +1 -1
- package/dist/knob-contracts/popup-knobs.js +5 -2
- package/dist/knob-contracts/sidebar-knobs.d.ts +1 -1
- package/dist/knob-contracts/sidebar-knobs.js +1 -0
- package/dist/styles/recipes/avatar.css +2 -0
- package/dist/styles/recipes/button-states.css +43 -0
- package/dist/styles/recipes/button.css +29 -21
- package/dist/styles/recipes/card.css +8 -0
- package/dist/styles/recipes/color-picker-values.css +4 -18
- package/dist/styles/recipes/color-picker.css +3 -4
- package/dist/styles/recipes/dropzone.css +47 -4
- package/dist/styles/recipes/field-parts.css +101 -1
- package/dist/styles/recipes/gradient-editor.css +3 -47
- package/dist/styles/recipes/markdown.css +5 -1
- package/dist/styles/recipes/page-layout.css +8 -1
- package/dist/styles/recipes/popup-controls.css +7 -1
- package/dist/styles/recipes/popup-lists.css +30 -5
- package/dist/styles/recipes/popup.css +5 -6
- package/dist/styles/recipes/sidebar-parts.css +6 -0
- package/dist/styles/recipes/sidebar.css +9 -8
- package/dist/styles/recipes/table.css +29 -0
- package/dist/styles/theme.css +4 -0
- package/dist/ui/autocomplete.d.ts +3 -0
- package/dist/ui/autocomplete.js +17 -2
- package/dist/ui/chart-cartesian.d.ts +60 -57
- package/dist/ui/chart-cartesian.js +7 -7
- package/dist/ui/chart-colors.d.ts +4 -2
- package/dist/ui/chart-colors.js +6 -2
- package/dist/ui/chart-marks.d.ts +4 -4
- package/dist/ui/chart-marks.js +14 -5
- package/dist/ui/chart-series.d.ts +9 -6
- package/dist/ui/chart-series.js +3 -2
- package/dist/ui/color-picker-swatches.d.ts +4 -3
- package/dist/ui/color-picker-swatches.js +7 -8
- package/dist/ui/command.d.ts +12 -0
- package/dist/ui/command.js +32 -2
- package/dist/ui/dropzone.d.ts +4 -1
- package/dist/ui/dropzone.js +16 -8
- package/dist/ui/field.d.ts +4 -1
- package/dist/ui/field.js +4 -2
- package/dist/ui/gradient-editor.d.ts +3 -2
- package/dist/ui/gradient-editor.js +7 -8
- package/dist/ui/markdown-components.d.ts +27 -0
- package/dist/ui/markdown-components.js +57 -0
- package/dist/ui/markdown-elements.d.ts +6 -25
- package/dist/ui/markdown-elements.js +19 -53
- package/dist/ui/markdown.d.ts +2 -7
- package/dist/ui/markdown.js +3 -20
- package/dist/ui/table.d.ts +6 -0
- package/dist/ui/table.js +17 -1
- package/lint/class-policy.mjs +31 -1
- package/lint/eslint-plugin.mjs +48 -4
- package/lint/grit-rules.mjs +52 -11
- package/lint/no-component-style-classes.grit +41 -6
- package/lint/no-raw-type-classes.grit +1 -1
- package/package.json +5 -1
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ButtonKnobStyle } from "../knob-contracts/button-knobs.js";
|
|
1
2
|
import { ColorPickerKnobStyle } from "../knob-contracts/color-picker-knobs.js";
|
|
2
3
|
import { CSSProperties, ComponentProps, ReactNode } from "react";
|
|
3
4
|
//#region src/ui/color-picker-swatches.d.ts
|
|
@@ -12,12 +13,12 @@ export type ColorPickerSwatchProps = Omit<Omit<ComponentProps<"button">, "color"
|
|
|
12
13
|
} & {
|
|
13
14
|
color: string;
|
|
14
15
|
};
|
|
15
|
-
export type ColorPickerSwatchAddProps = Omit<
|
|
16
|
-
style?: CSSProperties &
|
|
16
|
+
export type ColorPickerSwatchAddProps = Omit<ComponentProps<"button">, "onClick" | "style"> & {
|
|
17
|
+
style?: CSSProperties & ButtonKnobStyle;
|
|
17
18
|
} & {
|
|
18
19
|
onAdd?: (value: string) => void;
|
|
19
20
|
};
|
|
20
21
|
export declare function ColorPickerSwatches({ colors, label, className, children, ...props }: ColorPickerSwatchesProps): import("react").JSX.Element;
|
|
21
22
|
export declare function ColorPickerSwatch({ color, className, "aria-label": ariaLabel, ...props }: ColorPickerSwatchProps): import("react").JSX.Element;
|
|
22
|
-
export declare function ColorPickerSwatchAdd({ onAdd,
|
|
23
|
+
export declare function ColorPickerSwatchAdd({ onAdd, children, ...props }: ColorPickerSwatchAddProps): import("react").JSX.Element;
|
|
23
24
|
//#endregion
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { cn } from "../lib/cn.js";
|
|
3
|
+
import { Button } from "./button.js";
|
|
3
4
|
import { formatColor, parseColor } from "../lib/color.js";
|
|
4
5
|
import { useColorPicker } from "./color-picker-context.js";
|
|
5
6
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -57,17 +58,16 @@ function ColorPickerSwatch({ color, className, "aria-label": ariaLabel, ...props
|
|
|
57
58
|
})]
|
|
58
59
|
});
|
|
59
60
|
}
|
|
60
|
-
function ColorPickerSwatchAdd({ onAdd,
|
|
61
|
+
function ColorPickerSwatchAdd({ onAdd, children, ...props }) {
|
|
61
62
|
const { valueString, disabled } = useColorPicker();
|
|
62
|
-
return /* @__PURE__ */ jsx(
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
"data-
|
|
63
|
+
return /* @__PURE__ */ jsx(Button, {
|
|
64
|
+
variant: "dashed",
|
|
65
|
+
size: "xs",
|
|
66
|
+
iconOnly: true,
|
|
67
|
+
"data-color-picker-swatch-add": "true",
|
|
67
68
|
"aria-label": "Add current color",
|
|
68
69
|
disabled,
|
|
69
70
|
onClick: () => onAdd?.(valueString),
|
|
70
|
-
className: cn("relative flex shrink-0 cursor-pointer items-center justify-center disabled:cursor-not-allowed", className),
|
|
71
71
|
...props,
|
|
72
72
|
children: children ?? /* @__PURE__ */ jsx(PlusIcon, {})
|
|
73
73
|
});
|
|
@@ -81,7 +81,6 @@ function sameColor(a, b) {
|
|
|
81
81
|
function PlusIcon() {
|
|
82
82
|
return /* @__PURE__ */ jsx("svg", {
|
|
83
83
|
viewBox: "0 0 16 16",
|
|
84
|
-
className: "size-3.5",
|
|
85
84
|
fill: "none",
|
|
86
85
|
stroke: "currentColor",
|
|
87
86
|
strokeWidth: "1.5",
|
package/dist/ui/command.d.ts
CHANGED
|
@@ -46,6 +46,18 @@ export type CommandItemProps = Omit<ComponentProps<typeof Command$1.Item>, "styl
|
|
|
46
46
|
style?: CSSProperties & PopupKnobStyle;
|
|
47
47
|
};
|
|
48
48
|
export declare function CommandItem({ className, disabled, onSelect, ...props }: CommandItemProps): import("react").JSX.Element;
|
|
49
|
+
export type CommandItemContentProps = Omit<ComponentProps<"div">, "style"> & {
|
|
50
|
+
style?: CSSProperties & PopupKnobStyle;
|
|
51
|
+
};
|
|
52
|
+
export declare function CommandItemContent({ className, ...props }: CommandItemContentProps): import("react").JSX.Element;
|
|
53
|
+
export type CommandItemTitleProps = Omit<ComponentProps<"span">, "style"> & {
|
|
54
|
+
style?: CSSProperties & PopupKnobStyle;
|
|
55
|
+
};
|
|
56
|
+
export declare function CommandItemTitle({ className, ...props }: CommandItemTitleProps): import("react").JSX.Element;
|
|
57
|
+
export type CommandItemDescriptionProps = Omit<ComponentProps<"span">, "style"> & {
|
|
58
|
+
style?: CSSProperties & PopupKnobStyle;
|
|
59
|
+
};
|
|
60
|
+
export declare function CommandItemDescription({ className, ...props }: CommandItemDescriptionProps): import("react").JSX.Element;
|
|
49
61
|
export type CommandShortcutProps = Omit<ComponentProps<"span">, "style"> & {
|
|
50
62
|
style?: CSSProperties & PopupKnobStyle;
|
|
51
63
|
};
|
package/dist/ui/command.js
CHANGED
|
@@ -46,7 +46,7 @@ function CommandDialog({ title = "Command palette", description = "Search for a
|
|
|
46
46
|
"data-popup-kind": "command",
|
|
47
47
|
"data-control-family": "popup",
|
|
48
48
|
"data-slot": "dialog-root",
|
|
49
|
-
className: cn("grid grid-rows-[auto_1fr]
|
|
49
|
+
className: cn("grid grid-rows-[auto_1fr]", commandProps?.className),
|
|
50
50
|
children
|
|
51
51
|
})
|
|
52
52
|
]
|
|
@@ -225,6 +225,36 @@ function CommandItem({ className, disabled, onSelect, ...props }) {
|
|
|
225
225
|
onSelect: handleSelect
|
|
226
226
|
});
|
|
227
227
|
}
|
|
228
|
+
function CommandItemContent({ className, ...props }) {
|
|
229
|
+
return /* @__PURE__ */ jsx("div", {
|
|
230
|
+
"data-control-ui": "command",
|
|
231
|
+
"data-popup-kind": "command",
|
|
232
|
+
"data-control-family": "popup",
|
|
233
|
+
"data-slot": "item-content",
|
|
234
|
+
className: cn("flex min-w-0 flex-1 flex-col", className),
|
|
235
|
+
...props
|
|
236
|
+
});
|
|
237
|
+
}
|
|
238
|
+
function CommandItemTitle({ className, ...props }) {
|
|
239
|
+
return /* @__PURE__ */ jsx("span", {
|
|
240
|
+
"data-control-ui": "command",
|
|
241
|
+
"data-popup-kind": "command",
|
|
242
|
+
"data-control-family": "popup",
|
|
243
|
+
"data-slot": "item-title",
|
|
244
|
+
className: cn("truncate", className),
|
|
245
|
+
...props
|
|
246
|
+
});
|
|
247
|
+
}
|
|
248
|
+
function CommandItemDescription({ className, ...props }) {
|
|
249
|
+
return /* @__PURE__ */ jsx("span", {
|
|
250
|
+
"data-control-ui": "command",
|
|
251
|
+
"data-popup-kind": "command",
|
|
252
|
+
"data-control-family": "popup",
|
|
253
|
+
"data-slot": "item-description",
|
|
254
|
+
className: cn("truncate", className),
|
|
255
|
+
...props
|
|
256
|
+
});
|
|
257
|
+
}
|
|
228
258
|
function CommandShortcut({ className, ...props }) {
|
|
229
259
|
return /* @__PURE__ */ jsx("span", {
|
|
230
260
|
"data-control-ui": "command",
|
|
@@ -238,4 +268,4 @@ function CommandShortcut({ className, ...props }) {
|
|
|
238
268
|
});
|
|
239
269
|
}
|
|
240
270
|
//#endregion
|
|
241
|
-
export { Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandLoading, CommandSeparator, CommandShortcut };
|
|
271
|
+
export { Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandItemContent, CommandItemDescription, CommandItemTitle, CommandList, CommandLoading, CommandSeparator, CommandShortcut };
|
package/dist/ui/dropzone.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ import { DropzoneKnobStyle } from "../knob-contracts/dropzone-knobs.js";
|
|
|
5
5
|
import { CSSProperties, ComponentProps, ReactNode } from "react";
|
|
6
6
|
//#region src/ui/dropzone.d.ts
|
|
7
7
|
export type DropzoneOverlayScope = "local" | "global";
|
|
8
|
+
export type DropzoneSize = "default" | "sm";
|
|
8
9
|
export type DropzoneProps = Omit<ComponentProps<"div">, "defaultValue" | "onChange" | "onDrop" | "onError"> & {
|
|
9
10
|
value?: readonly File[];
|
|
10
11
|
defaultValue?: readonly File[];
|
|
@@ -16,6 +17,7 @@ export type DropzoneProps = Omit<ComponentProps<"div">, "defaultValue" | "onChan
|
|
|
16
17
|
getFilesFromEvent?: DropzoneGetFilesFromEvent;
|
|
17
18
|
onDrop?: (details: DropzoneDropDetails) => void;
|
|
18
19
|
onError?: (error: Error) => void;
|
|
20
|
+
size?: DropzoneSize;
|
|
19
21
|
} & {
|
|
20
22
|
style?: CSSProperties & DropzoneKnobStyle;
|
|
21
23
|
};
|
|
@@ -44,6 +46,7 @@ export type DropzoneRejectionListProps = Omit<ComponentProps<"ul">, "children">
|
|
|
44
46
|
};
|
|
45
47
|
export type DropzoneContextValue = UseDropzoneReturn & {
|
|
46
48
|
registerGlobalOverlay: () => () => void;
|
|
49
|
+
size: DropzoneSize;
|
|
47
50
|
};
|
|
48
51
|
export type DropzoneStatusProps = Omit<ComponentProps<"div">, "children" | "style"> & {
|
|
49
52
|
children?: (state: DropzoneContextValue) => ReactNode;
|
|
@@ -54,7 +57,7 @@ export type DropzoneRemoveProps = ComponentProps<typeof Button> & {
|
|
|
54
57
|
};
|
|
55
58
|
export type DropzoneClearProps = ComponentProps<typeof Button>;
|
|
56
59
|
export declare function useDropzoneContext(): DropzoneContextValue;
|
|
57
|
-
export declare function Dropzone({ value, defaultValue, onValueChange, policy, disabled, drag, paste, getFilesFromEvent, onDrop, onError, className, children, ...props }: DropzoneProps): import("react").JSX.Element;
|
|
60
|
+
export declare function Dropzone({ value, defaultValue, onValueChange, policy, disabled, drag, paste, getFilesFromEvent, onDrop, onError, size, className, children, ...props }: DropzoneProps): import("react").JSX.Element;
|
|
58
61
|
export declare function DropzoneArea({ className, ...props }: DropzoneAreaProps): import("react").JSX.Element;
|
|
59
62
|
export declare function DropzoneInput({ className, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, ...props }: DropzoneInputProps): import("react").JSX.Element;
|
|
60
63
|
export declare function DropzoneTrigger({ className, children, onClick, disabled, ref, ...props }: DropzoneTriggerProps): import("react").JSX.Element;
|
package/dist/ui/dropzone.js
CHANGED
|
@@ -64,7 +64,7 @@ function useFocusTargetRef(kind, ref) {
|
|
|
64
64
|
};
|
|
65
65
|
};
|
|
66
66
|
}
|
|
67
|
-
function Dropzone({ value, defaultValue, onValueChange, policy, disabled, drag, paste, getFilesFromEvent, onDrop, onError, className, children, ...props }) {
|
|
67
|
+
function Dropzone({ value, defaultValue, onValueChange, policy, disabled, drag, paste, getFilesFromEvent, onDrop, onError, size = "default", className, children, ...props }) {
|
|
68
68
|
const [globalOverlayCount, setGlobalOverlayCount] = useState(0);
|
|
69
69
|
const [focusTargets] = useState(createFocusTargets);
|
|
70
70
|
const [registerGlobalOverlay] = useState(() => () => {
|
|
@@ -91,7 +91,8 @@ function Dropzone({ value, defaultValue, onValueChange, policy, disabled, drag,
|
|
|
91
91
|
});
|
|
92
92
|
const context = {
|
|
93
93
|
...dropzone,
|
|
94
|
-
registerGlobalOverlay
|
|
94
|
+
registerGlobalOverlay,
|
|
95
|
+
size
|
|
95
96
|
};
|
|
96
97
|
const empty = dropzone.value.length === 0 && dropzone.fileRejections.length === 0;
|
|
97
98
|
return /* @__PURE__ */ jsx(DropzoneContext.Provider, {
|
|
@@ -103,6 +104,7 @@ function Dropzone({ value, defaultValue, onValueChange, policy, disabled, drag,
|
|
|
103
104
|
"data-control-ui": "dropzone",
|
|
104
105
|
"data-control-family": "dropzone",
|
|
105
106
|
"data-slot": "root",
|
|
107
|
+
"data-size": size,
|
|
106
108
|
"data-disabled": dropzone.disabled ? "true" : void 0,
|
|
107
109
|
"data-empty": empty ? "true" : void 0,
|
|
108
110
|
className: cn("min-w-0", className),
|
|
@@ -156,13 +158,16 @@ function DropzoneTrigger({ className, children, onClick, disabled, ref, ...props
|
|
|
156
158
|
"data-slot": "trigger",
|
|
157
159
|
"data-state": context.visualState,
|
|
158
160
|
"data-disabled": triggerDisabled || busy ? "true" : void 0,
|
|
159
|
-
className: cn("flex w-full cursor-pointer
|
|
161
|
+
className: cn("flex w-full cursor-pointer items-center disabled:cursor-not-allowed aria-disabled:cursor-not-allowed", context.size === "sm" ? "flex-row justify-start [&>svg]:size-4 [&>svg]:shrink-0" : "flex-col justify-center", className),
|
|
160
162
|
onClick: (event) => {
|
|
161
163
|
if (busy) return;
|
|
162
164
|
onClick?.(event);
|
|
163
165
|
if (!event.defaultPrevented) context.open();
|
|
164
166
|
},
|
|
165
|
-
children: children ?? /* @__PURE__ */ jsx(DropzoneFeedback, {
|
|
167
|
+
children: children ?? /* @__PURE__ */ jsx(DropzoneFeedback, {
|
|
168
|
+
state: context.visualState,
|
|
169
|
+
size: context.size
|
|
170
|
+
})
|
|
166
171
|
});
|
|
167
172
|
}
|
|
168
173
|
function DropzoneOverlay({ scope = "local", className, children, ...props }) {
|
|
@@ -182,7 +187,10 @@ function DropzoneOverlay({ scope = "local", className, children, ...props }) {
|
|
|
182
187
|
"data-active": active ? "true" : void 0,
|
|
183
188
|
"data-scope": scope,
|
|
184
189
|
className: cn("pointer-events-none absolute inset-0 z-10 hidden items-center justify-center data-[active=true]:flex", className),
|
|
185
|
-
children: children ?? /* @__PURE__ */ jsx(DropzoneFeedback, {
|
|
190
|
+
children: children ?? /* @__PURE__ */ jsx(DropzoneFeedback, {
|
|
191
|
+
state: context.visualState,
|
|
192
|
+
size: context.size
|
|
193
|
+
})
|
|
186
194
|
});
|
|
187
195
|
}
|
|
188
196
|
function DropzoneFileList({ className, children, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, ...props }) {
|
|
@@ -284,7 +292,7 @@ function DropzoneClear({ children, onClick, disabled, ...props }) {
|
|
|
284
292
|
children: children ?? "Clear all"
|
|
285
293
|
});
|
|
286
294
|
}
|
|
287
|
-
function DropzoneFeedback({ state }) {
|
|
295
|
+
function DropzoneFeedback({ state, size }) {
|
|
288
296
|
let icon = /* @__PURE__ */ jsx(CloudUpload, { "aria-hidden": "true" });
|
|
289
297
|
let message = "Drop files here or choose files.";
|
|
290
298
|
if (state === "processing") {
|
|
@@ -310,12 +318,12 @@ function DropzoneFeedback({ state }) {
|
|
|
310
318
|
"data-control-ui": "dropzone",
|
|
311
319
|
"data-control-family": "dropzone",
|
|
312
320
|
"data-slot": "feedback",
|
|
313
|
-
className: "flex flex-
|
|
321
|
+
className: cn("flex items-center", size === "sm" ? "flex-row" : "flex-col"),
|
|
314
322
|
children: [/* @__PURE__ */ jsx("span", {
|
|
315
323
|
"data-control-ui": "dropzone",
|
|
316
324
|
"data-control-family": "dropzone",
|
|
317
325
|
"data-slot": "feedback-icon",
|
|
318
|
-
className: "[&>svg]:size-6",
|
|
326
|
+
className: size === "sm" ? "flex [&>svg]:size-4" : "[&>svg]:size-6",
|
|
319
327
|
children: icon
|
|
320
328
|
}), /* @__PURE__ */ jsx("span", {
|
|
321
329
|
"data-control-ui": "dropzone",
|
package/dist/ui/field.d.ts
CHANGED
|
@@ -11,7 +11,9 @@ export type FieldProps = ComponentProps<"div"> & {
|
|
|
11
11
|
} & {
|
|
12
12
|
style?: CSSProperties & FieldKnobStyle;
|
|
13
13
|
};
|
|
14
|
+
export type FieldLabelVariant = "default" | "card";
|
|
14
15
|
export type FieldLabelProps = Omit<ComponentProps<"label">, "style"> & {
|
|
16
|
+
variant?: FieldLabelVariant;
|
|
15
17
|
style?: CSSProperties & FieldKnobStyle;
|
|
16
18
|
};
|
|
17
19
|
export type FieldContentProps = ComponentProps<"div"> & {
|
|
@@ -41,6 +43,7 @@ export type FieldSeparatorProps = Omit<ComponentProps<"div">, "style"> & {
|
|
|
41
43
|
style?: CSSProperties & FieldKnobStyle;
|
|
42
44
|
};
|
|
43
45
|
export type FieldItemProps = ComponentProps<"div"> & {
|
|
46
|
+
disabled?: boolean;
|
|
44
47
|
style?: CSSProperties & FieldKnobStyle;
|
|
45
48
|
};
|
|
46
49
|
export type FieldSetProps = Omit<ComponentProps<"fieldset">, "style"> & {
|
|
@@ -54,7 +57,7 @@ export type FieldLegendProps = Omit<ComponentProps<"div">, "style"> & {
|
|
|
54
57
|
export declare function Field({ className, orientation, ...props }: FieldProps): import("react").JSX.Element;
|
|
55
58
|
export declare function FieldContent({ className, ...props }: FieldContentProps): import("react").JSX.Element;
|
|
56
59
|
export declare function FieldTitle({ className, ...props }: FieldTitleProps): import("react").JSX.Element;
|
|
57
|
-
export declare function FieldLabel({ className, ...props }: FieldLabelProps): import("react").JSX.Element;
|
|
60
|
+
export declare function FieldLabel({ className, variant, ...props }: FieldLabelProps): import("react").JSX.Element;
|
|
58
61
|
type RefinedFieldControlProps = FieldControlProps & Pick<ComponentProps<typeof Field$1.Control>, "render">;
|
|
59
62
|
export declare function FieldControl({ className, render, ...props }: RefinedFieldControlProps): import("react").JSX.Element;
|
|
60
63
|
export declare function FieldDescription({ className, ...props }: FieldDescriptionProps): import("react").JSX.Element;
|
package/dist/ui/field.js
CHANGED
|
@@ -45,13 +45,15 @@ function FieldTitle({ className, ...props }) {
|
|
|
45
45
|
...props
|
|
46
46
|
});
|
|
47
47
|
}
|
|
48
|
-
function FieldLabel({ className, ...props }) {
|
|
48
|
+
function FieldLabel({ className, variant = "default", ...props }) {
|
|
49
49
|
return /* @__PURE__ */ jsx(Field$1.Label, {
|
|
50
50
|
"data-control-ui": "field",
|
|
51
51
|
"data-control-family": "field",
|
|
52
52
|
"data-field-kind": "field",
|
|
53
53
|
"data-slot": "label",
|
|
54
|
-
|
|
54
|
+
"data-variant": variant,
|
|
55
|
+
"data-focus-ring": variant === "card" ? "within" : void 0,
|
|
56
|
+
className: cn(variant === "card" && "flex w-full cursor-pointer items-start gap-3 self-stretch has-[[data-disabled]]:cursor-not-allowed [&>[data-control-family=choice]]:mt-[calc((1lh_-_var(--spacing)*4)/2)]", className),
|
|
55
57
|
...props
|
|
56
58
|
});
|
|
57
59
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ButtonKnobStyle } from "../knob-contracts/button-knobs.js";
|
|
1
2
|
import { GradientEditorKnobStyle } from "../knob-contracts/gradient-editor-knobs.js";
|
|
2
3
|
import { GradientInterpolation, GradientStop, GradientType, GradientValue } from "../lib/gradient.js";
|
|
3
4
|
import { CSSProperties, ComponentProps, RefObject } from "react";
|
|
@@ -20,7 +21,7 @@ export type GradientEditorStopProps = Omit<ComponentProps<"button">, "style"> &
|
|
|
20
21
|
style?: CSSProperties & GradientEditorKnobStyle;
|
|
21
22
|
};
|
|
22
23
|
export type GradientEditorStopAddProps = Omit<ComponentProps<"button">, "onClick" | "style"> & {
|
|
23
|
-
style?: CSSProperties &
|
|
24
|
+
style?: CSSProperties & ButtonKnobStyle;
|
|
24
25
|
};
|
|
25
26
|
type GradientEditorContextValue = GradientValue & {
|
|
26
27
|
gradient: string;
|
|
@@ -42,6 +43,6 @@ export declare function GradientEditor({ value: controlledValue, defaultValue, o
|
|
|
42
43
|
export declare function GradientEditorPreview({ className, style, "aria-label": ariaLabel, ...props }: GradientEditorPreviewProps): import("react").JSX.Element;
|
|
43
44
|
export declare function GradientEditorTrack({ className, children, style, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, ...props }: GradientEditorTrackProps): import("react").JSX.Element;
|
|
44
45
|
export declare function GradientEditorStop({ stop, className, style, onPointerDown, onKeyDown, onFocus, onDoubleClick, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, ref, ...props }: GradientEditorStopProps): import("react").JSX.Element;
|
|
45
|
-
export declare function GradientEditorStopAdd({
|
|
46
|
+
export declare function GradientEditorStopAdd({ children, ...props }: GradientEditorStopAddProps): import("react").JSX.Element;
|
|
46
47
|
//#endregion
|
|
47
48
|
export type { GradientInterpolation, GradientStop, GradientType, GradientValue };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { cn } from "../lib/cn.js";
|
|
3
|
+
import { Button } from "./button.js";
|
|
3
4
|
import { useColorArea } from "../hooks/use-color-area.js";
|
|
4
5
|
import { formatGradient, gradientColorAt } from "../lib/gradient.js";
|
|
5
6
|
import { createContext, useContext, useRef, useState } from "react";
|
|
@@ -244,20 +245,18 @@ function GradientEditorStop({ stop, className, style, onPointerDown, onKeyDown,
|
|
|
244
245
|
...props
|
|
245
246
|
});
|
|
246
247
|
}
|
|
247
|
-
function GradientEditorStopAdd({
|
|
248
|
+
function GradientEditorStopAdd({ children, ...props }) {
|
|
248
249
|
const { addStop } = useGradientEditor();
|
|
249
|
-
return /* @__PURE__ */ jsx(
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
"data-
|
|
250
|
+
return /* @__PURE__ */ jsx(Button, {
|
|
251
|
+
variant: "dashed",
|
|
252
|
+
size: "xs",
|
|
253
|
+
iconOnly: true,
|
|
254
|
+
"data-gradient-editor-stop-add": "true",
|
|
254
255
|
"aria-label": "Add gradient stop",
|
|
255
256
|
onClick: () => addStop(.5),
|
|
256
|
-
className: cn("flex shrink-0 cursor-pointer items-center justify-center", className),
|
|
257
257
|
...props,
|
|
258
258
|
children: children ?? /* @__PURE__ */ jsx("svg", {
|
|
259
259
|
viewBox: "0 0 16 16",
|
|
260
|
-
className: "size-3.5",
|
|
261
260
|
fill: "none",
|
|
262
261
|
stroke: "currentColor",
|
|
263
262
|
strokeWidth: "1.5",
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { MarkdownA, MarkdownBlockquote, MarkdownCodeProps, MarkdownEm, MarkdownH1, MarkdownH2, MarkdownH3, MarkdownH4, MarkdownH5, MarkdownH6, MarkdownHr, MarkdownInlineCode, MarkdownInput, MarkdownLi, MarkdownOl, MarkdownP, MarkdownStrong, MarkdownTable, MarkdownTd, MarkdownTh, MarkdownUl } from "./markdown-elements.js";
|
|
2
|
+
//#region src/ui/markdown-components.d.ts
|
|
3
|
+
export declare function MarkdownCode({ className, children, node: _node, ...props }: MarkdownCodeProps): import("react").JSX.Element;
|
|
4
|
+
export declare const markdownComponents: {
|
|
5
|
+
input: typeof MarkdownInput;
|
|
6
|
+
code: typeof MarkdownCode;
|
|
7
|
+
inlineCode: typeof MarkdownInlineCode;
|
|
8
|
+
h1: typeof MarkdownH1;
|
|
9
|
+
h2: typeof MarkdownH2;
|
|
10
|
+
h3: typeof MarkdownH3;
|
|
11
|
+
h4: typeof MarkdownH4;
|
|
12
|
+
h5: typeof MarkdownH5;
|
|
13
|
+
h6: typeof MarkdownH6;
|
|
14
|
+
p: typeof MarkdownP;
|
|
15
|
+
ul: typeof MarkdownUl;
|
|
16
|
+
ol: typeof MarkdownOl;
|
|
17
|
+
li: typeof MarkdownLi;
|
|
18
|
+
a: typeof MarkdownA;
|
|
19
|
+
blockquote: typeof MarkdownBlockquote;
|
|
20
|
+
hr: typeof MarkdownHr;
|
|
21
|
+
strong: typeof MarkdownStrong;
|
|
22
|
+
em: typeof MarkdownEm;
|
|
23
|
+
table: typeof MarkdownTable;
|
|
24
|
+
th: typeof MarkdownTh;
|
|
25
|
+
td: typeof MarkdownTd;
|
|
26
|
+
};
|
|
27
|
+
//#endregion
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Code, CodeActions, CodeContent, CodeCopy, CodeHeader, CodeTitle } from "./code.js";
|
|
3
|
+
import { CodeDiff } from "./code-diff.js";
|
|
4
|
+
import { MarkdownA, MarkdownBlockquote, MarkdownEm, MarkdownH1, MarkdownH2, MarkdownH3, MarkdownH4, MarkdownH5, MarkdownH6, MarkdownHr, MarkdownInlineCode, MarkdownInput, MarkdownLi, MarkdownOl, MarkdownP, MarkdownStrong, MarkdownTable, MarkdownTd, MarkdownTh, MarkdownUl } from "./markdown-elements.js";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
//#region src/ui/markdown-components.tsx
|
|
7
|
+
function textValue(children) {
|
|
8
|
+
return Array.isArray(children) ? children.join("") : String(children ?? "");
|
|
9
|
+
}
|
|
10
|
+
function languageFromClassName(className) {
|
|
11
|
+
return /language-([\w-]+)/.exec(className ?? "")?.[1];
|
|
12
|
+
}
|
|
13
|
+
function MarkdownCode({ className, children, node: _node, ...props }) {
|
|
14
|
+
const lang = languageFromClassName(className);
|
|
15
|
+
const rawValue = textValue(children);
|
|
16
|
+
if (!lang && !rawValue.includes("\n")) return /* @__PURE__ */ jsx(MarkdownInlineCode, {
|
|
17
|
+
className,
|
|
18
|
+
...props,
|
|
19
|
+
children
|
|
20
|
+
});
|
|
21
|
+
const value = rawValue.replace(/^\n/, "").replace(/\n$/, "");
|
|
22
|
+
if (lang === "diff" && value.includes("@@")) return /* @__PURE__ */ jsx(CodeDiff, {
|
|
23
|
+
patch: value,
|
|
24
|
+
lang: "diff",
|
|
25
|
+
diffStyle: "unified"
|
|
26
|
+
});
|
|
27
|
+
return /* @__PURE__ */ jsxs(Code, { children: [/* @__PURE__ */ jsxs(CodeHeader, { children: [lang ? /* @__PURE__ */ jsx(CodeTitle, { children: lang }) : null, /* @__PURE__ */ jsx(CodeActions, { children: /* @__PURE__ */ jsx(CodeCopy, { value }) })] }), /* @__PURE__ */ jsx(CodeContent, {
|
|
28
|
+
code: value,
|
|
29
|
+
lang,
|
|
30
|
+
highlight: lang ? "auto" : "none"
|
|
31
|
+
})] });
|
|
32
|
+
}
|
|
33
|
+
const markdownComponents = {
|
|
34
|
+
input: MarkdownInput,
|
|
35
|
+
code: MarkdownCode,
|
|
36
|
+
inlineCode: MarkdownInlineCode,
|
|
37
|
+
h1: MarkdownH1,
|
|
38
|
+
h2: MarkdownH2,
|
|
39
|
+
h3: MarkdownH3,
|
|
40
|
+
h4: MarkdownH4,
|
|
41
|
+
h5: MarkdownH5,
|
|
42
|
+
h6: MarkdownH6,
|
|
43
|
+
p: MarkdownP,
|
|
44
|
+
ul: MarkdownUl,
|
|
45
|
+
ol: MarkdownOl,
|
|
46
|
+
li: MarkdownLi,
|
|
47
|
+
a: MarkdownA,
|
|
48
|
+
blockquote: MarkdownBlockquote,
|
|
49
|
+
hr: MarkdownHr,
|
|
50
|
+
strong: MarkdownStrong,
|
|
51
|
+
em: MarkdownEm,
|
|
52
|
+
table: MarkdownTable,
|
|
53
|
+
th: MarkdownTh,
|
|
54
|
+
td: MarkdownTd
|
|
55
|
+
};
|
|
56
|
+
//#endregion
|
|
57
|
+
export { MarkdownCode, markdownComponents };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { MarkdownKnobStyle } from "../knob-contracts/markdown-knobs.js";
|
|
2
2
|
import { CSSProperties, ComponentProps, JSX } from "react";
|
|
3
3
|
//#region src/ui/markdown-elements.d.ts
|
|
4
|
-
type MarkdownCodeProps = ComponentProps<"code"> & {
|
|
4
|
+
export type MarkdownCodeProps = ComponentProps<"code"> & {
|
|
5
5
|
node?: unknown;
|
|
6
6
|
} & {
|
|
7
7
|
style?: CSSProperties & MarkdownKnobStyle;
|
|
@@ -11,10 +11,14 @@ type MarkdownElementProps<Tag extends keyof JSX.IntrinsicElements> = ComponentPr
|
|
|
11
11
|
} & {
|
|
12
12
|
style?: CSSProperties & MarkdownKnobStyle;
|
|
13
13
|
};
|
|
14
|
+
export type MarkdownRootProps = Omit<ComponentProps<"div">, "style"> & {
|
|
15
|
+
style?: CSSProperties & MarkdownKnobStyle;
|
|
16
|
+
};
|
|
17
|
+
export declare function MarkdownRoot({ className, ...props }: MarkdownRootProps): JSX.Element;
|
|
18
|
+
export declare function MarkdownFlow(props: MarkdownRootProps): JSX.Element;
|
|
14
19
|
export declare function MarkdownInput({ type, checked, className, node: _node, ...props }: MarkdownElementProps<"input">): JSX.Element;
|
|
15
20
|
export declare function MarkdownInlineCode({ className, children, node: _node, ...props }: MarkdownCodeProps): JSX.Element;
|
|
16
21
|
export declare function MarkdownPre({ children, node: _node }: MarkdownElementProps<"pre">): JSX.Element;
|
|
17
|
-
export declare function MarkdownCode({ className, children, node: _node, ...props }: MarkdownCodeProps): JSX.Element;
|
|
18
22
|
export declare function MarkdownH1({ className, node: _node, ...props }: MarkdownElementProps<"h1">): JSX.Element;
|
|
19
23
|
export declare function MarkdownH2({ className, node: _node, ...props }: MarkdownElementProps<"h2">): JSX.Element;
|
|
20
24
|
export declare function MarkdownH3({ className, node: _node, ...props }: MarkdownElementProps<"h3">): JSX.Element;
|
|
@@ -33,27 +37,4 @@ export declare function MarkdownEm({ className, node: _node, ...props }: Markdow
|
|
|
33
37
|
export declare function MarkdownTable({ className, children, node: _node, ...props }: MarkdownElementProps<"table">): JSX.Element;
|
|
34
38
|
export declare function MarkdownTh({ className, node: _node, ...props }: MarkdownElementProps<"th">): JSX.Element;
|
|
35
39
|
export declare function MarkdownTd({ className, node: _node, ...props }: MarkdownElementProps<"td">): JSX.Element;
|
|
36
|
-
export declare const markdownComponents: {
|
|
37
|
-
input: typeof MarkdownInput;
|
|
38
|
-
code: typeof MarkdownCode;
|
|
39
|
-
inlineCode: typeof MarkdownInlineCode;
|
|
40
|
-
h1: typeof MarkdownH1;
|
|
41
|
-
h2: typeof MarkdownH2;
|
|
42
|
-
h3: typeof MarkdownH3;
|
|
43
|
-
h4: typeof MarkdownH4;
|
|
44
|
-
h5: typeof MarkdownH5;
|
|
45
|
-
h6: typeof MarkdownH6;
|
|
46
|
-
p: typeof MarkdownP;
|
|
47
|
-
ul: typeof MarkdownUl;
|
|
48
|
-
ol: typeof MarkdownOl;
|
|
49
|
-
li: typeof MarkdownLi;
|
|
50
|
-
a: typeof MarkdownA;
|
|
51
|
-
blockquote: typeof MarkdownBlockquote;
|
|
52
|
-
hr: typeof MarkdownHr;
|
|
53
|
-
strong: typeof MarkdownStrong;
|
|
54
|
-
em: typeof MarkdownEm;
|
|
55
|
-
table: typeof MarkdownTable;
|
|
56
|
-
th: typeof MarkdownTh;
|
|
57
|
-
td: typeof MarkdownTd;
|
|
58
|
-
};
|
|
59
40
|
//#endregion
|
|
@@ -2,13 +2,28 @@
|
|
|
2
2
|
import { cn } from "../lib/cn.js";
|
|
3
3
|
import { ScrollArea } from "./scroll-area.js";
|
|
4
4
|
import { Heading } from "./typography.js";
|
|
5
|
-
import { Code, CodeActions, CodeContent, CodeCopy, CodeHeader, CodeTitle } from "./code.js";
|
|
6
5
|
import { Checkbox } from "./checkbox.js";
|
|
7
|
-
import { CodeDiff } from "./code-diff.js";
|
|
8
6
|
import { markdownHeadingAttributes } from "./markdown-heading.js";
|
|
9
7
|
import { createContext, use, useId } from "react";
|
|
10
|
-
import { Fragment as Fragment$1, jsx
|
|
8
|
+
import { Fragment as Fragment$1, jsx } from "react/jsx-runtime";
|
|
11
9
|
//#region src/ui/markdown-elements.tsx
|
|
10
|
+
function MarkdownRoot({ className, ...props }) {
|
|
11
|
+
return /* @__PURE__ */ jsx("div", {
|
|
12
|
+
"data-control-ui": "markdown",
|
|
13
|
+
"data-control-family": "markdown",
|
|
14
|
+
"data-slot": "root",
|
|
15
|
+
className: cn("[&>*:first-child]:mt-0 [&>*:last-child]:mb-0", className),
|
|
16
|
+
...props
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
function MarkdownFlow(props) {
|
|
20
|
+
return /* @__PURE__ */ jsx("div", {
|
|
21
|
+
"data-control-ui": "markdown",
|
|
22
|
+
"data-control-family": "markdown",
|
|
23
|
+
"data-slot": "flow",
|
|
24
|
+
...props
|
|
25
|
+
});
|
|
26
|
+
}
|
|
12
27
|
const MarkdownTaskLabelContext = createContext(void 0);
|
|
13
28
|
function MarkdownInput({ type, checked, className, node: _node, ...props }) {
|
|
14
29
|
const labelId = use(MarkdownTaskLabelContext);
|
|
@@ -26,12 +41,6 @@ function MarkdownInput({ type, checked, className, node: _node, ...props }) {
|
|
|
26
41
|
"aria-labelledby": labelId
|
|
27
42
|
});
|
|
28
43
|
}
|
|
29
|
-
function textValue(children) {
|
|
30
|
-
return Array.isArray(children) ? children.join("") : String(children ?? "");
|
|
31
|
-
}
|
|
32
|
-
function languageFromClassName(className) {
|
|
33
|
-
return /language-([\w-]+)/.exec(className ?? "")?.[1];
|
|
34
|
-
}
|
|
35
44
|
function MarkdownInlineCode({ className, children, node: _node, ...props }) {
|
|
36
45
|
return /* @__PURE__ */ jsx("code", {
|
|
37
46
|
"data-control-ui": "markdown",
|
|
@@ -45,26 +54,6 @@ function MarkdownInlineCode({ className, children, node: _node, ...props }) {
|
|
|
45
54
|
function MarkdownPre({ children, node: _node }) {
|
|
46
55
|
return /* @__PURE__ */ jsx(Fragment$1, { children });
|
|
47
56
|
}
|
|
48
|
-
function MarkdownCode({ className, children, node: _node, ...props }) {
|
|
49
|
-
const lang = languageFromClassName(className);
|
|
50
|
-
const rawValue = textValue(children);
|
|
51
|
-
if (!lang && !rawValue.includes("\n")) return /* @__PURE__ */ jsx(MarkdownInlineCode, {
|
|
52
|
-
className,
|
|
53
|
-
...props,
|
|
54
|
-
children
|
|
55
|
-
});
|
|
56
|
-
const value = rawValue.replace(/^\n/, "").replace(/\n$/, "");
|
|
57
|
-
if (lang === "diff" && value.includes("@@")) return /* @__PURE__ */ jsx(CodeDiff, {
|
|
58
|
-
patch: value,
|
|
59
|
-
lang: "diff",
|
|
60
|
-
diffStyle: "unified"
|
|
61
|
-
});
|
|
62
|
-
return /* @__PURE__ */ jsxs(Code, { children: [/* @__PURE__ */ jsxs(CodeHeader, { children: [lang ? /* @__PURE__ */ jsx(CodeTitle, { children: lang }) : null, /* @__PURE__ */ jsx(CodeActions, { children: /* @__PURE__ */ jsx(CodeCopy, { value }) })] }), /* @__PURE__ */ jsx(CodeContent, {
|
|
63
|
-
code: value,
|
|
64
|
-
lang,
|
|
65
|
-
highlight: lang ? "auto" : "none"
|
|
66
|
-
})] });
|
|
67
|
-
}
|
|
68
57
|
function MarkdownH1({ className, node: _node, ...props }) {
|
|
69
58
|
const { class: headingClass } = markdownHeadingAttributes(1);
|
|
70
59
|
return /* @__PURE__ */ jsx(Heading, {
|
|
@@ -253,28 +242,5 @@ function MarkdownTd({ className, node: _node, ...props }) {
|
|
|
253
242
|
...props
|
|
254
243
|
});
|
|
255
244
|
}
|
|
256
|
-
const markdownComponents = {
|
|
257
|
-
input: MarkdownInput,
|
|
258
|
-
code: MarkdownCode,
|
|
259
|
-
inlineCode: MarkdownInlineCode,
|
|
260
|
-
h1: MarkdownH1,
|
|
261
|
-
h2: MarkdownH2,
|
|
262
|
-
h3: MarkdownH3,
|
|
263
|
-
h4: MarkdownH4,
|
|
264
|
-
h5: MarkdownH5,
|
|
265
|
-
h6: MarkdownH6,
|
|
266
|
-
p: MarkdownP,
|
|
267
|
-
ul: MarkdownUl,
|
|
268
|
-
ol: MarkdownOl,
|
|
269
|
-
li: MarkdownLi,
|
|
270
|
-
a: MarkdownA,
|
|
271
|
-
blockquote: MarkdownBlockquote,
|
|
272
|
-
hr: MarkdownHr,
|
|
273
|
-
strong: MarkdownStrong,
|
|
274
|
-
em: MarkdownEm,
|
|
275
|
-
table: MarkdownTable,
|
|
276
|
-
th: MarkdownTh,
|
|
277
|
-
td: MarkdownTd
|
|
278
|
-
};
|
|
279
245
|
//#endregion
|
|
280
|
-
export { MarkdownA, MarkdownBlockquote,
|
|
246
|
+
export { MarkdownA, MarkdownBlockquote, MarkdownEm, MarkdownFlow, MarkdownH1, MarkdownH2, MarkdownH3, MarkdownH4, MarkdownH5, MarkdownH6, MarkdownHr, MarkdownInlineCode, MarkdownInput, MarkdownLi, MarkdownOl, MarkdownP, MarkdownPre, MarkdownRoot, MarkdownStrong, MarkdownTable, MarkdownTd, MarkdownTh, MarkdownUl };
|
package/dist/ui/markdown.d.ts
CHANGED
|
@@ -1,15 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { MarkdownRootProps } from "./markdown-elements.js";
|
|
2
|
+
import { ComponentProps } from "react";
|
|
3
3
|
//#region src/ui/markdown.d.ts
|
|
4
|
-
export type MarkdownRootProps = Omit<ComponentProps<"div">, "style"> & {
|
|
5
|
-
style?: CSSProperties & MarkdownKnobStyle;
|
|
6
|
-
};
|
|
7
4
|
export type MarkdownProps = Omit<MarkdownRootProps, "children"> & {
|
|
8
5
|
content: string;
|
|
9
6
|
mode?: "streaming" | "static";
|
|
10
7
|
};
|
|
11
|
-
export declare function MarkdownRoot({ className, ...props }: MarkdownRootProps): import("react").JSX.Element;
|
|
12
|
-
export declare function MarkdownFlow(props: MarkdownRootProps): import("react").JSX.Element;
|
|
13
8
|
export declare function Markdown({ content, mode, className, ...props }: MarkdownProps): import("react").JSX.Element;
|
|
14
9
|
export type MarkdownComponentProps = ComponentProps<typeof Markdown>;
|
|
15
10
|
//#endregion
|
package/dist/ui/markdown.js
CHANGED
|
@@ -1,26 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
import { markdownComponents } from "./markdown-
|
|
2
|
+
import { MarkdownFlow, MarkdownRoot } from "./markdown-elements.js";
|
|
3
|
+
import { markdownComponents } from "./markdown-components.js";
|
|
4
4
|
import { jsx } from "react/jsx-runtime";
|
|
5
5
|
import { Streamdown } from "streamdown";
|
|
6
6
|
//#region src/ui/markdown.tsx
|
|
7
|
-
function MarkdownRoot({ className, ...props }) {
|
|
8
|
-
return /* @__PURE__ */ jsx("div", {
|
|
9
|
-
"data-control-ui": "markdown",
|
|
10
|
-
"data-control-family": "markdown",
|
|
11
|
-
"data-slot": "root",
|
|
12
|
-
className: cn("[&>*:first-child]:mt-0 [&>*:last-child]:mb-0", className),
|
|
13
|
-
...props
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
function MarkdownFlow(props) {
|
|
17
|
-
return /* @__PURE__ */ jsx("div", {
|
|
18
|
-
"data-control-ui": "markdown",
|
|
19
|
-
"data-control-family": "markdown",
|
|
20
|
-
"data-slot": "flow",
|
|
21
|
-
...props
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
7
|
function Markdown({ content, mode = "streaming", className, ...props }) {
|
|
25
8
|
return /* @__PURE__ */ jsx(MarkdownRoot, {
|
|
26
9
|
className,
|
|
@@ -36,4 +19,4 @@ function Markdown({ content, mode = "streaming", className, ...props }) {
|
|
|
36
19
|
});
|
|
37
20
|
}
|
|
38
21
|
//#endregion
|
|
39
|
-
export { Markdown
|
|
22
|
+
export { Markdown };
|