@alexgorbatchev/shadcn 0.0.104 → 0.0.106
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/chunk-38barrma.js +110 -0
- package/dist/{chunk-p8bdmafq.js → chunk-j7fvvgyp.js} +2 -2
- package/dist/{chunk-23ppkypt.js → chunk-me64e034.js} +1 -100
- package/dist/{chunk-e1hkq1mw.js → chunk-rxmcz0j1.js} +617 -481
- package/dist/components/ActionBar.d.ts +31 -0
- package/dist/components/ErrorSummary.d.ts +21 -0
- package/dist/components/Outline.d.ts +20 -0
- package/dist/components/data-grid/index.js +7 -5
- package/dist/components/image-viewer/ImageRegionFields.d.ts +15 -0
- package/dist/components/image-viewer/ImageRegionSelect.d.ts +11 -6
- package/dist/components/image-viewer/imageRegion.d.ts +21 -0
- package/dist/components/image-viewer/index.d.ts +3 -0
- package/dist/components/image-viewer/index.js +247 -92
- package/dist/components/json-render/JsonDropdownMenu.d.ts +4 -0
- package/dist/components/json-render/JsonForm.d.ts +90 -0
- package/dist/components/json-render/catalog.js +1 -1
- package/dist/components/json-render/index.d.ts +2 -0
- package/dist/components/json-render/index.js +487 -228
- package/dist/index.d.ts +5 -0
- package/dist/index.js +26 -10
- package/dist/prototype.js +1 -1
- package/llms/components/data-display/ImageViewer.md +2 -2
- package/llms/components/data-display/JsonRenderForm.md +99 -0
- package/llms/components/feedback/ErrorSummary.md +46 -0
- package/llms/components/layout/ActionBar.md +65 -0
- package/llms/components/navigation/Outline.md +42 -0
- package/llms.txt +5 -1
- package/package.json +1 -1
|
@@ -1,3 +1,7 @@
|
|
|
1
1
|
import { type BaseComponentProps } from "@json-render/react";
|
|
2
2
|
import { type JsonProps } from "./catalog.js";
|
|
3
|
+
/**
|
|
4
|
+
* A menu of actions, or with a bound value a choice: the label then names the question, the trigger shows the chosen
|
|
5
|
+
* item ("Choose…" before a choice) and the open menu marks the chosen item checked.
|
|
6
|
+
*/
|
|
3
7
|
export declare const JsonDropdownMenu: ({ props, bindings, emit }: BaseComponentProps<JsonProps<"DropdownMenu">>) => import("react").JSX.Element;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { type ReactElement, type ReactNode } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* How bound answer controls render:
|
|
4
|
+
* - `edit`: ordinary controls.
|
|
5
|
+
* - `locked`: controls stay in place but take no input, for example while the answers are being sent.
|
|
6
|
+
* - `values`: each control renders its label and its value as text, for example on a read-only page.
|
|
7
|
+
*
|
|
8
|
+
* Reading controls (Tabs, Collapsible, Dialog, Drawer) work in every mode.
|
|
9
|
+
*/
|
|
10
|
+
export type JsonFormMode = "edit" | "locked" | "values";
|
|
11
|
+
interface IJsonFormContext {
|
|
12
|
+
mode: JsonFormMode;
|
|
13
|
+
errors: Readonly<Record<string, string>>;
|
|
14
|
+
}
|
|
15
|
+
export interface IJsonFormProviderProps {
|
|
16
|
+
mode?: JsonFormMode;
|
|
17
|
+
/**
|
|
18
|
+
* Field messages keyed by binding path, such as `{ "/answers/company": "Company: Enter a name" }`. While a provider is
|
|
19
|
+
* present, the consumer owns every field message: the controls show these messages and never their own checks'
|
|
20
|
+
* messages, so no message appears before the consumer decides to show it.
|
|
21
|
+
*/
|
|
22
|
+
errors?: Readonly<Record<string, string>>;
|
|
23
|
+
children?: ReactNode;
|
|
24
|
+
}
|
|
25
|
+
/** Sets the mode and the field messages of the bound controls rendered inside it. */
|
|
26
|
+
export declare function JsonFormProvider({ mode, errors, children }: IJsonFormProviderProps): ReactElement;
|
|
27
|
+
/** The nearest `JsonFormProvider`'s mode and messages, or `undefined` outside one. */
|
|
28
|
+
export declare function useJsonForm(): IJsonFormContext | undefined;
|
|
29
|
+
type Reveal = () => void;
|
|
30
|
+
export interface IJsonRevealScopeProps {
|
|
31
|
+
/** Opens this container: selects its tab, expands its section or opens its dialog. */
|
|
32
|
+
onReveal: () => void;
|
|
33
|
+
children?: ReactNode;
|
|
34
|
+
}
|
|
35
|
+
/** Marks its children as hidden behind a container that `useJsonReveal` can open. Scopes nest. */
|
|
36
|
+
export declare function JsonRevealScope({ onReveal, children }: IJsonRevealScopeProps): ReactElement;
|
|
37
|
+
/**
|
|
38
|
+
* Returns a function that opens every container hiding the calling component, outermost first: the tab whose panel
|
|
39
|
+
* holds it and each collapsed section around it. The containers render the change on the next frame, so focus or
|
|
40
|
+
* scroll the target after it.
|
|
41
|
+
*/
|
|
42
|
+
export declare function useJsonReveal(): Reveal;
|
|
43
|
+
interface IValidationCheck {
|
|
44
|
+
type: string;
|
|
45
|
+
}
|
|
46
|
+
export interface IJsonFieldOptions {
|
|
47
|
+
/** The control's binding path; messages are keyed by it. */
|
|
48
|
+
path?: string;
|
|
49
|
+
label?: string | null;
|
|
50
|
+
checks?: readonly IValidationCheck[] | null;
|
|
51
|
+
/** The control's own validation messages, shown only outside a `JsonFormProvider`. */
|
|
52
|
+
ownErrors?: readonly string[];
|
|
53
|
+
}
|
|
54
|
+
export interface IJsonField {
|
|
55
|
+
/** The label without a trailing "*": the "Required" tag replaces it. */
|
|
56
|
+
label: string;
|
|
57
|
+
isRequired: boolean;
|
|
58
|
+
error?: string;
|
|
59
|
+
mode: JsonFormMode;
|
|
60
|
+
messageId: string;
|
|
61
|
+
/** ARIA state for the control: required, invalid and described by its message. */
|
|
62
|
+
controlProps: {
|
|
63
|
+
"aria-required"?: true;
|
|
64
|
+
"aria-invalid"?: true;
|
|
65
|
+
"aria-describedby"?: string;
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
/** Removes a trailing "*" an author typed to mark a required question. */
|
|
69
|
+
export declare function stripRequiredMark(label: string): string;
|
|
70
|
+
/** A bound control's label, required state, message and mode, from its props and the nearest `JsonFormProvider`. */
|
|
71
|
+
export declare function useJsonField({ path, label, checks, ownErrors }: IJsonFieldOptions): IJsonField;
|
|
72
|
+
export interface IJsonFieldLabelProps {
|
|
73
|
+
field: IJsonField;
|
|
74
|
+
id?: string;
|
|
75
|
+
htmlFor?: string;
|
|
76
|
+
}
|
|
77
|
+
/** The field's label followed by its "Required" tag. */
|
|
78
|
+
export declare function JsonFieldLabel({ field, id, htmlFor }: IJsonFieldLabelProps): ReactElement | null;
|
|
79
|
+
/** The field's message, referenced by the control's `aria-describedby`. */
|
|
80
|
+
export declare function JsonFieldMessage({ field }: {
|
|
81
|
+
field: IJsonField;
|
|
82
|
+
}): ReactElement | null;
|
|
83
|
+
export interface IJsonFieldValueProps {
|
|
84
|
+
field: IJsonField;
|
|
85
|
+
/** The value as text; empty renders "No answer". */
|
|
86
|
+
text: string;
|
|
87
|
+
}
|
|
88
|
+
/** The field as read-only text: its label, then its value, grouped and named by the label. */
|
|
89
|
+
export declare function JsonFieldValue({ field, text }: IJsonFieldValueProps): ReactElement;
|
|
90
|
+
export {};
|
|
@@ -37,3 +37,5 @@ export declare const components: {
|
|
|
37
37
|
Pagination: ({ props, bindings, emit }: import("@json-render/react").BaseComponentProps<import("./catalog.js").JsonProps<"Pagination">>) => import("react").JSX.Element;
|
|
38
38
|
};
|
|
39
39
|
export { componentDefinitions } from "./catalog.js";
|
|
40
|
+
export { JsonFieldLabel, JsonFieldMessage, JsonFieldValue, JsonFormProvider, JsonRevealScope, stripRequiredMark, useJsonField, useJsonForm, useJsonReveal, } from "./JsonForm.js";
|
|
41
|
+
export type { IJsonField, IJsonFieldLabelProps, IJsonFieldOptions, IJsonFieldValueProps, IJsonFormProviderProps, IJsonRevealScopeProps, JsonFormMode, } from "./JsonForm.js";
|