@tristan2828/ui-foundation 4.58.0 → 4.59.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.
|
@@ -26,6 +26,13 @@ export type MarkdownProps = {
|
|
|
26
26
|
* text is never changed.
|
|
27
27
|
*/
|
|
28
28
|
foldKey?: string;
|
|
29
|
+
/**
|
|
30
|
+
* Set `false` to keep headings plain, with no fold buttons, even when a
|
|
31
|
+
* `foldKey` is given: a page-level switch (a print view, a short note)
|
|
32
|
+
* that leaves the key in place. Nothing is folded while it's off, and
|
|
33
|
+
* what was folded is remembered for when it's on again. Default `true`.
|
|
34
|
+
*/
|
|
35
|
+
foldable?: boolean;
|
|
29
36
|
className?: string;
|
|
30
37
|
} & Omit<ComponentProps<'div'>, 'children'>;
|
|
31
|
-
export declare function Markdown({ children, headingLevel, headingFrom, foldKey, className, ...rest }: MarkdownProps): import("react").JSX.Element;
|
|
38
|
+
export declare function Markdown({ children, headingLevel, headingFrom, foldKey: foldKeyProp, foldable, className, ...rest }: MarkdownProps): import("react").JSX.Element;
|
|
@@ -184,7 +184,8 @@ function componentsFor(top, textTop) {
|
|
|
184
184
|
}
|
|
185
185
|
return components;
|
|
186
186
|
}
|
|
187
|
-
export function Markdown({ children, headingLevel = DEFAULT_HEADING_LEVEL, headingFrom = 'hash', foldKey, className, ...rest }) {
|
|
187
|
+
export function Markdown({ children, headingLevel = DEFAULT_HEADING_LEVEL, headingFrom = 'hash', foldKey: foldKeyProp, foldable = true, className, ...rest }) {
|
|
188
|
+
const foldKey = foldable ? foldKeyProp : undefined;
|
|
188
189
|
const textTop = useMemo(() => (headingFrom === 'text' ? textTopHeading(children) : 1), [headingFrom, children]);
|
|
189
190
|
const components = useMemo(() => componentsFor(headingLevel, textTop), [headingLevel, textTop]);
|
|
190
191
|
const [folded, setFolded] = useFolds(foldKey);
|
|
@@ -80,6 +80,12 @@ export type RichTextEditorProps = {
|
|
|
80
80
|
* when it mounts.
|
|
81
81
|
*/
|
|
82
82
|
foldKey?: string;
|
|
83
|
+
/**
|
|
84
|
+
* `false` keeps headings plain, with no fold buttons or shortcuts, even
|
|
85
|
+
* with a `foldKey`, as on `<Markdown>`. Read once, when it mounts.
|
|
86
|
+
* Default `true`.
|
|
87
|
+
*/
|
|
88
|
+
foldable?: boolean;
|
|
83
89
|
className?: string;
|
|
84
90
|
/** The field's label. A rich-text area must have one: this, or `aria-labelledby`. */
|
|
85
91
|
'aria-label'?: string;
|
|
@@ -34,5 +34,5 @@ import { cn } from 'cn';
|
|
|
34
34
|
import { Skeleton } from '../ui/skeleton.js';
|
|
35
35
|
const MilkdownEditor = lazy(() => import('./milkdown-editor.js'));
|
|
36
36
|
export function RichTextEditor(props) {
|
|
37
|
-
return (_jsx(Suspense, { fallback: _jsxs("div", { "data-slot": "rich-text-editor", "data-state": "loading", className: cn('flex w-full flex-col', !props.inline && 'rounded-lg border border-input', props.className), children: [(props.toolbar ?? true) === true && _jsx("div", { className: "h-9 border-b border-input" }), _jsxs("div", { className: cn('flex flex-col gap-2', props.inline ? 'py-0.5' : 'min-h-24 px-2.5 py-2'), children: [_jsx(Skeleton, { className: "h-4 w-3/4" }), _jsx(Skeleton, { className: "h-4 w-1/2" })] })] }), children: _jsx(MilkdownEditor, { ...props }) }));
|
|
37
|
+
return (_jsx(Suspense, { fallback: _jsxs("div", { "data-slot": "rich-text-editor", "data-state": "loading", className: cn('flex w-full flex-col', !props.inline && 'rounded-lg border border-input', props.className), children: [(props.toolbar ?? true) === true && _jsx("div", { className: "h-9 border-b border-input" }), _jsxs("div", { className: cn('flex flex-col gap-2', props.inline ? 'py-0.5' : 'min-h-24 px-2.5 py-2'), children: [_jsx(Skeleton, { className: "h-4 w-3/4" }), _jsx(Skeleton, { className: "h-4 w-1/2" })] })] }), children: _jsx(MilkdownEditor, { ...props, foldKey: props.foldable === false ? undefined : props.foldKey }) }));
|
|
38
38
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tristan2828/ui-foundation",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.59.0",
|
|
4
4
|
"description": "Shared UI foundation for contract-first, database-backed React apps: shadcn primitives, DataTable/EntityForm composites, auth, the gateway error seam, design tokens, lint rules and the AI playbook.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|