@alexgorbatchev/shadcn 0.0.104 → 0.0.105

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.
@@ -5749,7 +5749,7 @@ var componentDefinitions2 = {
5749
5749
  defaultOpen: boolean2().nullable()
5750
5750
  }),
5751
5751
  slots: ["default"],
5752
- description: "Collapsible section with trigger. Children render inside."
5752
+ description: "Collapsible section with trigger. Children render inside and stay mounted but hidden while it is closed."
5753
5753
  },
5754
5754
  Dialog: {
5755
5755
  props: object({
@@ -6003,7 +6003,7 @@ var componentDefinitions2 = {
6003
6003
  value: string2().nullable()
6004
6004
  }),
6005
6005
  events: ["select"],
6006
- description: "Dropdown menu with trigger button and selectable items. Use { $bindState } on value for selected item binding."
6006
+ description: "Dropdown menu with trigger button and selectable items. Without a binding the label is the trigger's text and items are actions. With { $bindState } on value it is a choice: the label names the question above the trigger, the trigger shows the chosen item's label ('Choose…' before a choice) and the open menu marks the chosen item checked."
6007
6007
  },
6008
6008
  Toggle: {
6009
6009
  props: object({
@@ -0,0 +1,31 @@
1
+ import type { ComponentProps, ReactElement } from "react";
2
+ interface IActionBarProps extends ComponentProps<"div"> {
3
+ /**
4
+ * Sticks the bar to the bottom of its scrolling container while the content it ends continues below the visible area;
5
+ * where the content ends, the bar rests in place.
6
+ */
7
+ sticky?: boolean;
8
+ /** Set while the bar is stuck, for its compact form: tighter spacing and no resting top padding. */
9
+ stuck?: boolean;
10
+ /** The surface the bar covers while stuck, so content scrolling under it stays hidden. */
11
+ surface?: "background" | "card";
12
+ /**
13
+ * A decorative meter along the bar's top edge, from 0 to 1. It is hidden from assistive technology: state the value in
14
+ * text, because screen readers report progress changes on their own.
15
+ */
16
+ progress?: number;
17
+ }
18
+ /** The bar that ends a form or a task: its status, what its action does and the action, in rows. */
19
+ declare function ActionBar({ sticky, stuck, surface, progress, className, children, ...props }: IActionBarProps): ReactElement;
20
+ interface IActionBarRowProps extends ComponentProps<"div"> {
21
+ /** How the row distributes its items; `between` puts the last item, usually the primary action, at the end. */
22
+ justify?: "start" | "between" | "end";
23
+ /** `end` aligns items to the row's bottom, so an action lines up with the last line of a multi-line status. */
24
+ align?: "center" | "end";
25
+ /** Whether items wrap onto further lines; a one-row bar sets it false. */
26
+ wrap?: boolean;
27
+ }
28
+ /** One row of an `ActionBar`. */
29
+ declare function ActionBarRow({ justify, align, wrap, className, ...props }: IActionBarRowProps): ReactElement;
30
+ export { ActionBar, ActionBarRow };
31
+ export type { IActionBarProps, IActionBarRowProps };
@@ -0,0 +1,21 @@
1
+ import { type ComponentProps, type ReactElement, type ReactNode } from "react";
2
+ interface IErrorSummaryProps extends Omit<ComponentProps<"section">, "title"> {
3
+ /** Names what is missing, such as "3 answers needed". */
4
+ title: ReactNode;
5
+ /** The heading level of the title within the page. */
6
+ headingLevel?: 2 | 3 | 4;
7
+ }
8
+ /**
9
+ * The list of problems that stop a form from completing, at the top of the form: a heading, then one link per problem
10
+ * that takes the person to its field.
11
+ */
12
+ declare function ErrorSummary({ title, headingLevel, className, children, ...props }: IErrorSummaryProps): ReactElement;
13
+ interface IErrorSummaryItemProps {
14
+ /** Moves to the problem's field: opens whatever hides it, then focuses it. */
15
+ onSelect: () => void;
16
+ children: ReactNode;
17
+ }
18
+ /** One problem in an `ErrorSummary`: a link-styled button that goes to its field. */
19
+ declare function ErrorSummaryItem({ onSelect, children }: IErrorSummaryItemProps): ReactElement;
20
+ export { ErrorSummary, ErrorSummaryItem };
21
+ export type { IErrorSummaryProps, IErrorSummaryItemProps };
@@ -0,0 +1,20 @@
1
+ import { type ComponentProps, type ReactElement, type ReactNode } from "react";
2
+ /** A list of a document's parts, each a button that goes to its part, grouped into titled sections. */
3
+ declare function Outline({ className, ...props }: ComponentProps<"div">): ReactElement;
4
+ interface IOutlineSectionProps {
5
+ title: ReactNode;
6
+ /** A short summary beside the title, such as "3 of 4 answered". */
7
+ meta?: ReactNode;
8
+ children: ReactNode;
9
+ }
10
+ /** A titled group of `OutlineItem`s, named by its title. */
11
+ declare function OutlineSection({ title, meta, children }: IOutlineSectionProps): ReactElement;
12
+ interface IOutlineItemProps {
13
+ label: ReactNode;
14
+ /** The part's state, such as "Not answered". */
15
+ state?: ReactNode;
16
+ onSelect: () => void;
17
+ }
18
+ /** One part in an `OutlineSection`: a button with the part's name and state that goes to it. */
19
+ declare function OutlineItem({ label, state, onSelect }: IOutlineItemProps): ReactElement;
20
+ export { Outline, OutlineSection, OutlineItem };
@@ -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 {};
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  componentDefinitions2
3
- } from "../../chunk-p8bdmafq.js";
3
+ } from "../../chunk-j7fvvgyp.js";
4
4
  export {
5
5
  componentDefinitions2 as componentDefinitions
6
6
  };
@@ -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";