@ostack.tech/ui-kform 0.1.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.
- package/README.md +3 -0
- package/dist/ostack-ui-kform.cjs +7534 -0
- package/dist/ostack-ui-kform.cjs.map +1 -0
- package/dist/ostack-ui-kform.css +858 -0
- package/dist/ostack-ui-kform.css.map +1 -0
- package/dist/ostack-ui-kform.js +7518 -0
- package/dist/ostack-ui-kform.js.map +1 -0
- package/dist/types/components/Annexes/Annex.d.ts +46 -0
- package/dist/types/components/Annexes/AnnexTab.d.ts +5 -0
- package/dist/types/components/Annexes/Annexes.d.ts +95 -0
- package/dist/types/components/Annexes/AnnexesContext.d.ts +87 -0
- package/dist/types/components/Annexes/AnnexesManager.d.ts +47 -0
- package/dist/types/components/Annexes/AnnexesMenu.d.ts +10 -0
- package/dist/types/components/Annexes/AnnexesTabList.d.ts +8 -0
- package/dist/types/components/Annexes/index.d.ts +3 -0
- package/dist/types/components/CheckboxControl/CheckboxControl.d.ts +48 -0
- package/dist/types/components/CheckboxControl/index.d.ts +1 -0
- package/dist/types/components/CheckboxGroupControl/CheckboxGroupControl.d.ts +63 -0
- package/dist/types/components/CheckboxGroupControl/index.d.ts +1 -0
- package/dist/types/components/ControlField/ControlField.d.ts +50 -0
- package/dist/types/components/ControlField/ControlFieldContext.d.ts +33 -0
- package/dist/types/components/ControlField/index.d.ts +2 -0
- package/dist/types/components/DateControl/DateControl.d.ts +45 -0
- package/dist/types/components/DateControl/index.d.ts +1 -0
- package/dist/types/components/DateRangeControl/DateRangeControl.d.ts +79 -0
- package/dist/types/components/DateRangeControl/index.d.ts +1 -0
- package/dist/types/components/FileControl/FileControl.d.ts +68 -0
- package/dist/types/components/FileControl/index.d.ts +1 -0
- package/dist/types/components/FormApp/FormApp.d.ts +210 -0
- package/dist/types/components/FormApp/FormAppContext.d.ts +181 -0
- package/dist/types/components/FormApp/FormAppIssueMessages.d.ts +45 -0
- package/dist/types/components/FormApp/FormAppStatus.d.ts +23 -0
- package/dist/types/components/FormApp/index.d.ts +4 -0
- package/dist/types/components/FormPages/FormPage.d.ts +86 -0
- package/dist/types/components/FormPages/FormPageHeader.d.ts +7 -0
- package/dist/types/components/FormPages/FormPageSidebarItem.d.ts +6 -0
- package/dist/types/components/FormPages/FormPages.d.ts +40 -0
- package/dist/types/components/FormPages/FormPagesContext.d.ts +67 -0
- package/dist/types/components/FormPages/FormPagesNavigation.d.ts +12 -0
- package/dist/types/components/FormPages/FormPagesSelect.d.ts +7 -0
- package/dist/types/components/FormPages/FormPagesSelectOption.d.ts +6 -0
- package/dist/types/components/FormPages/FormPagesSidebar.d.ts +6 -0
- package/dist/types/components/FormPages/index.d.ts +3 -0
- package/dist/types/components/FormStepper/FormStep.d.ts +8 -0
- package/dist/types/components/FormStepper/FormStepContent.d.ts +20 -0
- package/dist/types/components/FormStepper/FormStepList.d.ts +7 -0
- package/dist/types/components/FormStepper/FormStepper.d.ts +71 -0
- package/dist/types/components/FormStepper/FormStepperContext.d.ts +65 -0
- package/dist/types/components/FormStepper/index.d.ts +3 -0
- package/dist/types/components/IssueAlert/IssueAlert.d.ts +13 -0
- package/dist/types/components/IssueAlert/index.d.ts +1 -0
- package/dist/types/components/IssueMessage/IssueMessage.d.ts +14 -0
- package/dist/types/components/IssueMessage/index.d.ts +1 -0
- package/dist/types/components/IssueMessages/IssueMessages.d.ts +70 -0
- package/dist/types/components/IssueMessages/index.d.ts +1 -0
- package/dist/types/components/IssuesPanel/IssuesPanel.d.ts +106 -0
- package/dist/types/components/IssuesPanel/IssuesPanelControls.d.ts +19 -0
- package/dist/types/components/IssuesPanel/IssuesPanelMessagesCard.d.ts +13 -0
- package/dist/types/components/IssuesPanel/IssuesPanelSummaryCard.d.ts +9 -0
- package/dist/types/components/IssuesPanel/index.d.ts +1 -0
- package/dist/types/components/IssuesPopover/IssuesPopover.d.ts +15 -0
- package/dist/types/components/IssuesPopover/index.d.ts +1 -0
- package/dist/types/components/LoadAction/LoadAction.d.ts +22 -0
- package/dist/types/components/LoadAction/index.d.ts +1 -0
- package/dist/types/components/NumericControl/NumericControl.d.ts +45 -0
- package/dist/types/components/NumericControl/index.d.ts +1 -0
- package/dist/types/components/PathLink/PathLink.d.ts +16 -0
- package/dist/types/components/PathLink/index.d.ts +1 -0
- package/dist/types/components/RadioGroupControl/RadioGroupControl.d.ts +56 -0
- package/dist/types/components/RadioGroupControl/index.d.ts +1 -0
- package/dist/types/components/SaveAction/SaveAction.d.ts +51 -0
- package/dist/types/components/SaveAction/index.d.ts +1 -0
- package/dist/types/components/SelectControl/SelectControl.d.ts +48 -0
- package/dist/types/components/SelectControl/index.d.ts +1 -0
- package/dist/types/components/SelectMultipleControl/SelectMultipleControl.d.ts +55 -0
- package/dist/types/components/SelectMultipleControl/index.d.ts +1 -0
- package/dist/types/components/SubmitAction/SubmitAction.d.ts +94 -0
- package/dist/types/components/SubmitAction/index.d.ts +1 -0
- package/dist/types/components/TableControl/TableControl.d.ts +64 -0
- package/dist/types/components/TableControl/TableControlAddRowTrigger.d.ts +25 -0
- package/dist/types/components/TableControl/TableControlApi.d.ts +25 -0
- package/dist/types/components/TableControl/TableControlCell.d.ts +7 -0
- package/dist/types/components/TableControl/TableControlColumn.d.ts +58 -0
- package/dist/types/components/TableControl/TableControlContent.d.ts +7 -0
- package/dist/types/components/TableControl/TableControlContext.d.ts +26 -0
- package/dist/types/components/TableControl/TableControlPagination.d.ts +2 -0
- package/dist/types/components/TableControl/TableControlRemoveRowTrigger.d.ts +61 -0
- package/dist/types/components/TableControl/TableControlRow.d.ts +7 -0
- package/dist/types/components/TableControl/TableControlRowsPerPage.d.ts +2 -0
- package/dist/types/components/TableControl/index.d.ts +8 -0
- package/dist/types/components/TextControl/TextControl.d.ts +66 -0
- package/dist/types/components/TextControl/index.d.ts +1 -0
- package/dist/types/components/TopBar/TopBar.d.ts +6 -0
- package/dist/types/components/TopBar/TopBarActions.d.ts +7 -0
- package/dist/types/components/TopBar/index.d.ts +2 -0
- package/dist/types/components/ValidateAction/ValidateAction.d.ts +21 -0
- package/dist/types/components/ValidateAction/index.d.ts +1 -0
- package/dist/types/index.d.ts +36 -0
- package/dist/types/locale/LocalizationObject.d.ts +34 -0
- package/dist/types/locale/defaultLocale.d.ts +3 -0
- package/dist/types/locale/en-GB.d.ts +3 -0
- package/dist/types/locale/en-US.d.ts +3 -0
- package/dist/types/locale/en.d.ts +3 -0
- package/dist/types/locale/fr-FR.d.ts +3 -0
- package/dist/types/locale/index.d.ts +6 -0
- package/dist/types/locale/pt-PT.d.ts +3 -0
- package/dist/types/providers/LocalizationProvider/LocalizationContext.d.ts +6 -0
- package/dist/types/providers/LocalizationProvider/LocalizationProvider.d.ts +10 -0
- package/dist/types/providers/LocalizationProvider/index.d.ts +3 -0
- package/dist/types/providers/LocalizationProvider/useLocale.d.ts +3 -0
- package/dist/types/providers/PrefixSuffixProvider/PrefixSuffixContext.d.ts +5 -0
- package/dist/types/providers/PrefixSuffixProvider/PrefixSuffixProvider.d.ts +9 -0
- package/dist/types/providers/PrefixSuffixProvider/index.d.ts +3 -0
- package/dist/types/providers/PrefixSuffixProvider/usePrefix.d.ts +6 -0
- package/dist/types/utils/dateRestrictions.d.ts +6 -0
- package/dist/types/utils/displayStatusConversions.d.ts +6 -0
- package/dist/types/utils/mostSpecificPath.d.ts +13 -0
- package/dist/types/utils/options.d.ts +18 -0
- package/dist/types/utils/pathSpecificity.d.ts +18 -0
- package/dist/types/utils/selectionTransformations.d.ts +32 -0
- package/dist/types/utils/useControlAutofocus.d.ts +32 -0
- package/dist/types/utils/useControlIssues.d.ts +27 -0
- package/dist/types/utils/useEqualityFn.d.ts +1 -0
- package/dist/types/utils/useFormLoader.d.ts +83 -0
- package/dist/types/utils/useFormSaver.d.ts +96 -0
- package/dist/types/utils/useFormValidator.d.ts +28 -0
- package/dist/types/utils/useRegisterControl.d.ts +24 -0
- package/dist/types/utils/useReportValidationFailures.d.ts +5 -0
- package/dist/types/utils/useTemporalStringTransformer.d.ts +21 -0
- package/package.json +70 -0
- package/scss/_utils.scss +6 -0
- package/scss/components/Annexes/_Annexes-variables.scss +17 -0
- package/scss/components/Annexes/_Annexes.scss +234 -0
- package/scss/components/FileControl/_FileControl.scss +52 -0
- package/scss/components/FormApp/_FormApp.scss +67 -0
- package/scss/components/FormPages/_FormPages-variables.scss +62 -0
- package/scss/components/FormPages/_FormPages.scss +288 -0
- package/scss/components/IssueMessages/_IssueMessages.scss +13 -0
- package/scss/components/IssuesPanel/_IssuesPanel-variables.scss +82 -0
- package/scss/components/IssuesPanel/_IssuesPanel.scss +196 -0
- package/scss/components/TableControl/_TableControl.scss +21 -0
- package/scss/components/TopBar/_TopBar.scss +52 -0
- package/scss/index.scss +11 -0
- package/scss/scss/_base-variables.scss +5 -0
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { type AbsolutePath, Path } from "@ostack.tech/kform";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
/** Properties of the form page component. */
|
|
4
|
+
export interface FormPagesProps extends React.ComponentPropsWithoutRef<"div"> {
|
|
5
|
+
/** Base path for all declared form pages. */
|
|
6
|
+
path?: string | Path;
|
|
7
|
+
/** List of all form pages. */
|
|
8
|
+
pages: FormPageObject[];
|
|
9
|
+
/** Default active form page. */
|
|
10
|
+
defaultActivePage?: string | Path;
|
|
11
|
+
/** Controlled active form page. */
|
|
12
|
+
activePage?: string | Path;
|
|
13
|
+
/**
|
|
14
|
+
* Function called whenever the active form page changes.
|
|
15
|
+
*
|
|
16
|
+
* @param activePagePath Path of the new active form page.
|
|
17
|
+
*/
|
|
18
|
+
onActivePageChange?: (activePagePath: AbsolutePath | null) => void;
|
|
19
|
+
children?: React.ReactNode;
|
|
20
|
+
}
|
|
21
|
+
/** Object representation of a form page. */
|
|
22
|
+
export interface FormPageObject<T = any> {
|
|
23
|
+
/** Form page path. */
|
|
24
|
+
path?: string | Path;
|
|
25
|
+
/** Form page's title */
|
|
26
|
+
title: React.ReactNode | ((value: T) => React.ReactNode);
|
|
27
|
+
/**
|
|
28
|
+
* Title of the form page as a string to display in the document's title.
|
|
29
|
+
*
|
|
30
|
+
* Defaults to `title` when it is a string. A warning is printed if `title` is
|
|
31
|
+
* not a string and `documentTitle` is not provided.
|
|
32
|
+
*/
|
|
33
|
+
documentTitle?: string | null | ((value: T) => string | null);
|
|
34
|
+
/** Form page's code. */
|
|
35
|
+
code?: React.ReactNode;
|
|
36
|
+
/** Form page's label in the issues panel. The `title` is used by default. */
|
|
37
|
+
issuesPanelLabel?: React.ReactNode | ((value: T) => React.ReactNode);
|
|
38
|
+
}
|
|
39
|
+
/** Root component used to render form pages. */
|
|
40
|
+
export declare const FormPages: React.ForwardRefExoticComponent<FormPagesProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { AbsolutePath, type DisplayStatus, type Path, type SealedValidationIssue } from "@ostack.tech/kform";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { type FormPageObject, type FormPagesProps } from "./FormPages.tsx";
|
|
4
|
+
/** Value of the form pages context. */
|
|
5
|
+
export type FormPagesContextValue = FormPagesStore;
|
|
6
|
+
/** Resolved form page object. */
|
|
7
|
+
export interface ResolvedFormPageObject extends FormPageObject {
|
|
8
|
+
path: AbsolutePath;
|
|
9
|
+
}
|
|
10
|
+
/** Form page state. */
|
|
11
|
+
export interface FormPageState {
|
|
12
|
+
path: AbsolutePath;
|
|
13
|
+
exists: boolean;
|
|
14
|
+
deferredDisplayStatus: DisplayStatus | undefined;
|
|
15
|
+
deferredIssuesToDisplay: SealedValidationIssue[];
|
|
16
|
+
title?: React.ReactNode;
|
|
17
|
+
documentTitle?: string | null;
|
|
18
|
+
code?: React.ReactNode;
|
|
19
|
+
}
|
|
20
|
+
/** State of the form pages. */
|
|
21
|
+
export interface FormPagesState {
|
|
22
|
+
pages: ResolvedFormPageObject[];
|
|
23
|
+
activePage: AbsolutePath | null;
|
|
24
|
+
activePageIndex: () => number;
|
|
25
|
+
pageStates: [Record<string, FormPageState | null>];
|
|
26
|
+
pageHeaderHeights: [Map<string, number>];
|
|
27
|
+
navigationSelectHeight: number;
|
|
28
|
+
actions: FormPagesActions;
|
|
29
|
+
}
|
|
30
|
+
/** Actions of the form pages. */
|
|
31
|
+
export interface FormPagesActions {
|
|
32
|
+
getPageState: (path: AbsolutePath) => FormPageState | null;
|
|
33
|
+
setPages: (pages: ResolvedFormPageObject[]) => void;
|
|
34
|
+
setActivePage: (activePage: string | Path | null) => void;
|
|
35
|
+
updateActivePage: (oldActivePageIndex: number) => void;
|
|
36
|
+
registerPageState: (path: AbsolutePath, state: FormPageState) => void;
|
|
37
|
+
setPageHeaderHeight: (path: AbsolutePath, height: number | null) => void;
|
|
38
|
+
}
|
|
39
|
+
/** Form pages store. */
|
|
40
|
+
export type FormPagesStore = ReturnType<typeof useCreateFormPagesContext>;
|
|
41
|
+
/** Form pages context. */
|
|
42
|
+
export declare const FormPagesContext: React.Context<(Omit<import("zustand").StoreApi<FormPagesState>, "subscribe"> & {
|
|
43
|
+
subscribe: {
|
|
44
|
+
(listener: (selectedState: FormPagesState, previousSelectedState: FormPagesState) => void): () => void;
|
|
45
|
+
<U>(selector: (state: FormPagesState) => U, listener: (selectedState: U, previousSelectedState: U) => void, options?: {
|
|
46
|
+
equalityFn?: ((a: U, b: U) => boolean) | undefined;
|
|
47
|
+
fireImmediately?: boolean;
|
|
48
|
+
} | undefined): () => void;
|
|
49
|
+
};
|
|
50
|
+
}) | null>;
|
|
51
|
+
/** Options used to create the form pages context. */
|
|
52
|
+
export interface UseCreateFormPagesContextOptions extends Pick<FormPagesProps, "defaultActivePage" | "activePage" | "onActivePageChange"> {
|
|
53
|
+
basePath: AbsolutePath;
|
|
54
|
+
resolvedPages: ResolvedFormPageObject[];
|
|
55
|
+
}
|
|
56
|
+
/** Hook used to create the form pages context. */
|
|
57
|
+
export declare function useCreateFormPagesContext({ basePath, resolvedPages, defaultActivePage, activePage, onActivePageChange, }: UseCreateFormPagesContextOptions): Omit<import("zustand").StoreApi<FormPagesState>, "subscribe"> & {
|
|
58
|
+
subscribe: {
|
|
59
|
+
(listener: (selectedState: FormPagesState, previousSelectedState: FormPagesState) => void): () => void;
|
|
60
|
+
<U>(selector: (state: FormPagesState) => U, listener: (selectedState: U, previousSelectedState: U) => void, options?: {
|
|
61
|
+
equalityFn?: ((a: U, b: U) => boolean) | undefined;
|
|
62
|
+
fireImmediately?: boolean;
|
|
63
|
+
} | undefined): () => void;
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
export declare function useFormPagesContext(): FormPagesContextValue;
|
|
67
|
+
export declare function useFormPageState<T>(path: AbsolutePath, selector: (state: FormPageState | null) => T): T;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { FormPagesSelect } from "./FormPagesSelect.tsx";
|
|
3
|
+
import { FormPagesSidebar } from "./FormPagesSidebar.tsx";
|
|
4
|
+
/** Properties of the form pages navigation component. */
|
|
5
|
+
export interface FormPagesNavigationProps extends React.ComponentPropsWithoutRef<"nav"> {
|
|
6
|
+
/** Properties to pass to the sidebar component. */
|
|
7
|
+
sidebarProps?: React.ComponentPropsWithRef<typeof FormPagesSidebar>;
|
|
8
|
+
/** Properties to pass to the select component. */
|
|
9
|
+
selectProps?: React.ComponentPropsWithRef<typeof FormPagesSelect>;
|
|
10
|
+
}
|
|
11
|
+
/** Component allowing the navigation between form pages. */
|
|
12
|
+
export declare const FormPagesNavigation: React.ForwardRefExoticComponent<FormPagesNavigationProps & React.RefAttributes<HTMLElement>>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Select } from "@ostack.tech/ui";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
/** Properties of the form pages select component. */
|
|
4
|
+
export interface FormPagesSelectProps extends Omit<React.ComponentPropsWithoutRef<typeof Select>, "multiple" | "defaultValue" | "value" | "onValueChange" | "showClearButton"> {
|
|
5
|
+
}
|
|
6
|
+
/** Select component allowing the navigation between form pages. */
|
|
7
|
+
export declare const FormPagesSelect: React.ForwardRefExoticComponent<FormPagesSelectProps & React.RefAttributes<HTMLButtonElement>>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
/** Properties of the form pages sidebar component. */
|
|
3
|
+
export interface FormPagesSidebarProps extends React.ComponentPropsWithoutRef<"aside"> {
|
|
4
|
+
}
|
|
5
|
+
/** Sidebar component allowing the navigation between form pages. */
|
|
6
|
+
export declare const FormPagesSidebar: React.ForwardRefExoticComponent<FormPagesSidebarProps & React.RefAttributes<HTMLElement>>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type AbsolutePath } from "@ostack.tech/kform";
|
|
2
|
+
/** Properties of the form step component. */
|
|
3
|
+
export interface FormStepProps {
|
|
4
|
+
path: AbsolutePath;
|
|
5
|
+
index: number;
|
|
6
|
+
}
|
|
7
|
+
/** Form step. */
|
|
8
|
+
export declare function FormStep({ path, index }: FormStepProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { type Path } from "@ostack.tech/kform";
|
|
2
|
+
import { ErrorBoundary, StepContent } from "@ostack.tech/ui";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
/** Properties of the form step content component. */
|
|
5
|
+
export interface FormStepContentProps extends Omit<React.ComponentPropsWithoutRef<typeof StepContent>, "index" | "children"> {
|
|
6
|
+
/**
|
|
7
|
+
* Step path. This should match the path of the step provided to
|
|
8
|
+
* `FormStepper`.
|
|
9
|
+
*/
|
|
10
|
+
path?: string | Path;
|
|
11
|
+
/** Sets the step as disabled. */
|
|
12
|
+
disabled?: boolean;
|
|
13
|
+
/** Sets the step as read-only. */
|
|
14
|
+
readOnly?: boolean;
|
|
15
|
+
/** Properties to pass to the `ErrorBoundary` component. */
|
|
16
|
+
errorBoundaryProps?: React.ComponentPropsWithRef<typeof ErrorBoundary>;
|
|
17
|
+
children?: React.ReactNode;
|
|
18
|
+
}
|
|
19
|
+
/** Component containing the content of a form step. */
|
|
20
|
+
export declare const FormStepContent: React.ForwardRefExoticComponent<FormStepContentProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { StepList } from "@ostack.tech/ui";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
/** Properties of the form steps sidebar component. */
|
|
4
|
+
export interface FormStepListProps extends React.ComponentPropsWithoutRef<typeof StepList> {
|
|
5
|
+
}
|
|
6
|
+
/** Component displaying all form steps in a list. */
|
|
7
|
+
export declare const FormStepList: React.ForwardRefExoticComponent<FormStepListProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { type AbsolutePath, Path, type SealedLocatedValidationIssue } from "@ostack.tech/kform";
|
|
2
|
+
import { Stepper } from "@ostack.tech/ui";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
/** Properties of the form stepper component. */
|
|
5
|
+
export interface FormStepperProps extends Omit<React.ComponentPropsWithoutRef<typeof Stepper>, "defaultActiveStep" | "activeStep" | "onActiveStepChange"> {
|
|
6
|
+
/** Base path for all declared form steps. */
|
|
7
|
+
path?: string | Path;
|
|
8
|
+
/** List of all form steps. */
|
|
9
|
+
steps: FormStepObject[];
|
|
10
|
+
/** Default active form step. */
|
|
11
|
+
defaultActiveStep?: string | Path;
|
|
12
|
+
/** Controlled active form step. */
|
|
13
|
+
activeStep?: string | Path;
|
|
14
|
+
/**
|
|
15
|
+
* Function called whenever the active form step changes.
|
|
16
|
+
*
|
|
17
|
+
* @param activeStepPath Path of the new active form step.
|
|
18
|
+
* @param activeStepIndex Index of the new active form step.
|
|
19
|
+
*/
|
|
20
|
+
onActiveStepChange?: (activeStepPath: AbsolutePath | null, activeStepIndex: number) => void;
|
|
21
|
+
/**
|
|
22
|
+
* Function called when a step is touched and validated due to a navigation to
|
|
23
|
+
* a following step. This function is never called when
|
|
24
|
+
* `skipStepValidationOnForwardNavigation` is `true`.
|
|
25
|
+
*
|
|
26
|
+
* @param issues Issues present in the step.
|
|
27
|
+
*/
|
|
28
|
+
onStepValidation?: (issues: SealedLocatedValidationIssue[]) => void;
|
|
29
|
+
/**
|
|
30
|
+
* Whether to skip marking a step as touched and validating it when navigating
|
|
31
|
+
* to a following step.
|
|
32
|
+
*
|
|
33
|
+
* @default false
|
|
34
|
+
*/
|
|
35
|
+
skipStepValidationOnForwardNavigation?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Whether to allow navigation to a following step when a previous step
|
|
38
|
+
* contains errors. This is always `true` when
|
|
39
|
+
* `skipStepValidationOnForwardNavigation` is also `true`.
|
|
40
|
+
*
|
|
41
|
+
* @default false
|
|
42
|
+
*/
|
|
43
|
+
allowForwardNavigationOnError?: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Whether to prevent the focus of an invalid field when a step was validated
|
|
46
|
+
* and an error was found. This is always `true` if either
|
|
47
|
+
* `skipStepValidationOnForwardNavigation` or `allowForwardNavigationOnError`
|
|
48
|
+
* are `true`.
|
|
49
|
+
*
|
|
50
|
+
* @default false
|
|
51
|
+
*/
|
|
52
|
+
preventFocusOnError?: boolean;
|
|
53
|
+
}
|
|
54
|
+
/** Object representation of a form step. */
|
|
55
|
+
export interface FormStepObject<T = any> {
|
|
56
|
+
/** Form step path. */
|
|
57
|
+
path?: string | Path;
|
|
58
|
+
/** Form step's title. */
|
|
59
|
+
title: React.ReactNode | ((value: T) => React.ReactNode);
|
|
60
|
+
/**
|
|
61
|
+
* Title of the form step as a string to display in the document's title.
|
|
62
|
+
*
|
|
63
|
+
* Defaults to `title` when it is a string. A warning is printed if `title` is
|
|
64
|
+
* not a string and `documentTitle` is not provided.
|
|
65
|
+
*/
|
|
66
|
+
documentTitle?: string | null | ((value: T) => string | null);
|
|
67
|
+
/** Label of the form step in the issues panel. Uses the `title` by default. */
|
|
68
|
+
issuesPanelLabel?: React.ReactNode | ((value: T) => React.ReactNode);
|
|
69
|
+
}
|
|
70
|
+
/** Root component used to render form steps. */
|
|
71
|
+
export declare const FormStepper: React.ForwardRefExoticComponent<FormStepperProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { type AbsolutePath, type DisplayStatus, type FormManager } from "@ostack.tech/kform";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { type FormStepObject, type FormStepperProps } from "./FormStepper.tsx";
|
|
4
|
+
/** Value of the form stepper context. */
|
|
5
|
+
export type FormStepperContextValue = FormStepperStore;
|
|
6
|
+
/** Resolved form step object. */
|
|
7
|
+
export interface ResolvedFormStepObject extends FormStepObject {
|
|
8
|
+
path: AbsolutePath;
|
|
9
|
+
index: number;
|
|
10
|
+
}
|
|
11
|
+
/** Form step state. */
|
|
12
|
+
export interface FormStepState {
|
|
13
|
+
path: AbsolutePath;
|
|
14
|
+
index: number;
|
|
15
|
+
exists: boolean;
|
|
16
|
+
deferredDisplayStatus: DisplayStatus | undefined;
|
|
17
|
+
title?: React.ReactNode;
|
|
18
|
+
documentTitle?: string | null;
|
|
19
|
+
}
|
|
20
|
+
/** State of the form stepper. */
|
|
21
|
+
export interface FormStepperState {
|
|
22
|
+
steps: ResolvedFormStepObject[];
|
|
23
|
+
activeStep: ResolvedFormStepObject | null;
|
|
24
|
+
stepStates: [Record<string, FormStepState | null>];
|
|
25
|
+
actions: FormStepperActions;
|
|
26
|
+
}
|
|
27
|
+
/** Actions of the form stepper. */
|
|
28
|
+
export interface FormStepperActions {
|
|
29
|
+
getStepState: (path: AbsolutePath) => FormStepState | null;
|
|
30
|
+
setSteps: (steps: ResolvedFormStepObject[]) => void;
|
|
31
|
+
setActiveStep: (activeStep: ResolvedFormStepObject | null, callListener?: boolean) => void;
|
|
32
|
+
updateActiveStep: () => void;
|
|
33
|
+
registerStepState: (path: AbsolutePath, state: FormStepState) => void;
|
|
34
|
+
goToStep: (index: number) => Promise<void>;
|
|
35
|
+
}
|
|
36
|
+
/** Form stepper store. */
|
|
37
|
+
export type FormStepperStore = ReturnType<typeof useCreateFormStepperContext>;
|
|
38
|
+
/** Form stepper context. */
|
|
39
|
+
export declare const FormStepperContext: React.Context<(Omit<import("zustand").StoreApi<FormStepperState>, "subscribe"> & {
|
|
40
|
+
subscribe: {
|
|
41
|
+
(listener: (selectedState: FormStepperState, previousSelectedState: FormStepperState) => void): () => void;
|
|
42
|
+
<U>(selector: (state: FormStepperState) => U, listener: (selectedState: U, previousSelectedState: U) => void, options?: {
|
|
43
|
+
equalityFn?: ((a: U, b: U) => boolean) | undefined;
|
|
44
|
+
fireImmediately?: boolean;
|
|
45
|
+
} | undefined): () => void;
|
|
46
|
+
};
|
|
47
|
+
}) | null>;
|
|
48
|
+
/** Options used to create the form stepped context. */
|
|
49
|
+
export interface UseCreateFormStepperContextOptions extends Pick<FormStepperProps, "defaultActiveStep" | "activeStep" | "onActiveStepChange" | "onStepValidation" | "skipStepValidationOnForwardNavigation" | "allowForwardNavigationOnError" | "preventFocusOnError"> {
|
|
50
|
+
formManager: FormManager;
|
|
51
|
+
basePath: AbsolutePath;
|
|
52
|
+
resolvedSteps: ResolvedFormStepObject[];
|
|
53
|
+
}
|
|
54
|
+
/** Hook used to create the form stepper context. */
|
|
55
|
+
export declare function useCreateFormStepperContext({ formManager, basePath, resolvedSteps, defaultActiveStep, activeStep, onActiveStepChange, onStepValidation, skipStepValidationOnForwardNavigation, allowForwardNavigationOnError, preventFocusOnError, }: UseCreateFormStepperContextOptions): Omit<import("zustand").StoreApi<FormStepperState>, "subscribe"> & {
|
|
56
|
+
subscribe: {
|
|
57
|
+
(listener: (selectedState: FormStepperState, previousSelectedState: FormStepperState) => void): () => void;
|
|
58
|
+
<U>(selector: (state: FormStepperState) => U, listener: (selectedState: U, previousSelectedState: U) => void, options?: {
|
|
59
|
+
equalityFn?: ((a: U, b: U) => boolean) | undefined;
|
|
60
|
+
fireImmediately?: boolean;
|
|
61
|
+
} | undefined): () => void;
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
export declare function useFormStepperContext(): FormStepperContextValue;
|
|
65
|
+
export declare function useFormStepState<T>(path: AbsolutePath, selector: (state: FormStepState | null) => T): T;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type Path, type ValidationIssueData } from "@ostack.tech/kform";
|
|
2
|
+
import { Alert } from "@ostack.tech/ui";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
/** Properties of the issue alert component. */
|
|
5
|
+
export interface IssueAlertProps extends Omit<React.ComponentPropsWithoutRef<typeof Alert>, "severity" | "children"> {
|
|
6
|
+
/** Path of the value with the issue in question. */
|
|
7
|
+
path?: string | Path;
|
|
8
|
+
/** Code of the issue in question. */
|
|
9
|
+
code: string;
|
|
10
|
+
children?: React.ReactNode | ((issueData: ValidationIssueData) => React.ReactNode);
|
|
11
|
+
}
|
|
12
|
+
/** Component used to display an issue alert. */
|
|
13
|
+
export declare const IssueAlert: React.ForwardRefExoticComponent<IssueAlertProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./IssueAlert.tsx";
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type AbsolutePath, type Schema, type SealedValidationIssue } from "@ostack.tech/kform";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
/** Properties of the issue message component. */
|
|
4
|
+
export interface IssueMessageProps {
|
|
5
|
+
displayIssueCode?: boolean;
|
|
6
|
+
unknownErrorMessage?: React.ReactNode;
|
|
7
|
+
unknownWarningMessage?: React.ReactNode;
|
|
8
|
+
path: AbsolutePath;
|
|
9
|
+
issue: SealedValidationIssue;
|
|
10
|
+
schema: Schema;
|
|
11
|
+
issueCodeProps?: React.ComponentPropsWithRef<"span">;
|
|
12
|
+
}
|
|
13
|
+
/** Single issue message within the issue messages or issues panel components. */
|
|
14
|
+
export declare function IssueMessage({ path, issue, schema, displayIssueCode, unknownErrorMessage, unknownWarningMessage, issueCodeProps, }: IssueMessageProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./IssueMessage.tsx";
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { type AbsolutePath, type Path, type Schema, type SealedValidationIssue, type ValidationIssueData } from "@ostack.tech/kform";
|
|
2
|
+
import { FeedbackList } from "@ostack.tech/ui";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
/** Value of an issue message. */
|
|
5
|
+
export type IssueMessageValue = React.ReactNode | ((issueData: ValidationIssueData, schema: Schema, path: AbsolutePath) => React.ReactNode);
|
|
6
|
+
/** Mapping of issue message codes to their respective message. */
|
|
7
|
+
export type IssueMessagesByCode = Record<string, IssueMessageValue>;
|
|
8
|
+
/** Properties of the issue messages component. */
|
|
9
|
+
export interface IssueMessagesProps extends React.ComponentPropsWithoutRef<typeof FeedbackList> {
|
|
10
|
+
/** Path of the value for which to show issues. */
|
|
11
|
+
path?: string | Path;
|
|
12
|
+
/**
|
|
13
|
+
* Issues to show, associated with the provided path. If not provided, the
|
|
14
|
+
* component will query the issues from the form manager.
|
|
15
|
+
*/
|
|
16
|
+
issues?: SealedValidationIssue[];
|
|
17
|
+
/** Mapping from an issue's code to its message. */
|
|
18
|
+
messages?: IssueMessagesByCode;
|
|
19
|
+
/**
|
|
20
|
+
* Whether to display issue codes together with each issue message.
|
|
21
|
+
*
|
|
22
|
+
* This property can also be set globally via the `displayIssueCodes` property
|
|
23
|
+
* of the `FormApp`.
|
|
24
|
+
*/
|
|
25
|
+
displayIssueCodes?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Message to show for an error that does not have an associated message.
|
|
28
|
+
*
|
|
29
|
+
* This message will always automatically include the code of the issue in
|
|
30
|
+
* question.
|
|
31
|
+
*/
|
|
32
|
+
unknownErrorMessage?: React.ReactNode;
|
|
33
|
+
/**
|
|
34
|
+
* Message to show for a warning that does not have an associated message.
|
|
35
|
+
*
|
|
36
|
+
* This message will always automatically include the code of the issue in
|
|
37
|
+
* question.
|
|
38
|
+
*/
|
|
39
|
+
unknownWarningMessage?: React.ReactNode;
|
|
40
|
+
/**
|
|
41
|
+
* Whether to render the issue messages "unwrapped", i.e. outside a containing
|
|
42
|
+
* `FeedbackList`.
|
|
43
|
+
*
|
|
44
|
+
* This is useful together with components such as the `DateRangeControl`
|
|
45
|
+
* where you might want to show issues for multiple paths, all within the same
|
|
46
|
+
* `FeedbackList`:
|
|
47
|
+
*
|
|
48
|
+
* ```tsx
|
|
49
|
+
* <FeedbackList>
|
|
50
|
+
* <IssueMessages path="startDate" unwrapped />
|
|
51
|
+
* <IssueMessages path="endDate" unwrapped />
|
|
52
|
+
* </FeedbackList>;
|
|
53
|
+
* ```
|
|
54
|
+
*/
|
|
55
|
+
unwrapped?: boolean;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Component used to display all issues associated with the relevant path.
|
|
59
|
+
*
|
|
60
|
+
* Issue messages are automatically read from the scope (typically provided by
|
|
61
|
+
* setting the `issueMessages` property of a `FormApp`, `Annex`, or
|
|
62
|
+
* `FormPage`).
|
|
63
|
+
*
|
|
64
|
+
* Messages may also be passed directly to this component via the `messages`
|
|
65
|
+
* property.
|
|
66
|
+
*
|
|
67
|
+
* If `path` contains an issue without an associated issue message, a generic
|
|
68
|
+
* message is displayed together with a console warning.
|
|
69
|
+
*/
|
|
70
|
+
export declare const IssueMessages: React.ForwardRefExoticComponent<IssueMessagesProps & React.RefAttributes<HTMLUListElement>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./IssueMessages.tsx";
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { type IssuesTrackerOptions } from "@ostack.tech/kform-react";
|
|
2
|
+
import { type Card, type CardBody, type CardHeader, type CardTitle, type CloseButton, type Icon, type IconButton, type Spinner } from "@ostack.tech/ui";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
/** Properties of the issues navigation component. */
|
|
5
|
+
export interface IssuesPanelProps extends Pick<IssuesTrackerOptions, "issuesOrderCompareFn">, Omit<React.ComponentPropsWithoutRef<typeof Card>, "children" | "variant" | "color"> {
|
|
6
|
+
/** Default open state of the issues navigation panel. */
|
|
7
|
+
defaultOpen?: boolean;
|
|
8
|
+
/** Controlled open state of the issues navigation panel. */
|
|
9
|
+
open?: boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Function called whenever the open state of the issues navigation panel
|
|
12
|
+
* changes.
|
|
13
|
+
*
|
|
14
|
+
* @param open New open state.
|
|
15
|
+
*/
|
|
16
|
+
onOpenChange?: (open: boolean) => void;
|
|
17
|
+
/**
|
|
18
|
+
* Whether to display issue codes together with each issue message.
|
|
19
|
+
*
|
|
20
|
+
* This property can also be set globally via the `displayIssueCodes` property
|
|
21
|
+
* of the `FormApp`.
|
|
22
|
+
*/
|
|
23
|
+
displayIssueCodes?: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Message to show for an error that does not have an associated message.
|
|
26
|
+
*
|
|
27
|
+
* This message will always automatically include the code of the issue in
|
|
28
|
+
* question.
|
|
29
|
+
*/
|
|
30
|
+
unknownErrorMessage?: React.ReactNode;
|
|
31
|
+
/**
|
|
32
|
+
* Message to show for a warning that does not have an associated message.
|
|
33
|
+
*
|
|
34
|
+
* This message will always automatically include the code of the issue in
|
|
35
|
+
* question.
|
|
36
|
+
*/
|
|
37
|
+
unknownWarningMessage?: React.ReactNode;
|
|
38
|
+
/**
|
|
39
|
+
* Errors label.
|
|
40
|
+
*
|
|
41
|
+
* @param errors Number of errors. If undefined, the function should return a
|
|
42
|
+
* generic label with no number.
|
|
43
|
+
*/
|
|
44
|
+
errorsLabel?: (errors?: number) => React.ReactNode;
|
|
45
|
+
/**
|
|
46
|
+
* Warnings label.
|
|
47
|
+
*
|
|
48
|
+
* @param warnings Number of warnings. If undefined, the function should
|
|
49
|
+
* return a generic label with no number.
|
|
50
|
+
*/
|
|
51
|
+
warningsLabel?: (warnings?: number) => React.ReactNode;
|
|
52
|
+
/** Label of the focus button. */
|
|
53
|
+
focusButtonLabel?: string;
|
|
54
|
+
/** Label of the "previous issue" button. */
|
|
55
|
+
previousIssueButtonLabel?: string;
|
|
56
|
+
/** Label of the "next issue" button. */
|
|
57
|
+
nextIssueButtonLabel?: string;
|
|
58
|
+
/** Label of the "first issue" button. */
|
|
59
|
+
firstIssueButtonLabel?: string;
|
|
60
|
+
/** Label of the "last issue" button. */
|
|
61
|
+
lastIssueButtonLabel?: string;
|
|
62
|
+
/**
|
|
63
|
+
* Text announced to assistive technologies with the current page out of the
|
|
64
|
+
* total number of pages.
|
|
65
|
+
*
|
|
66
|
+
* @param currentPage Current page.
|
|
67
|
+
* @param totalPages Total number of pages.
|
|
68
|
+
*/
|
|
69
|
+
paginationLabel?: (currentPage: number, totalPages: number) => React.ReactNode;
|
|
70
|
+
/** Message to display when there are no issues to report. */
|
|
71
|
+
noIssuesMessage?: React.ReactNode;
|
|
72
|
+
/** Title to display when all issues of the active path have been resolved. */
|
|
73
|
+
resolvedTitle?: React.ReactNode;
|
|
74
|
+
/** Message to display when all issues of the active path have been resolved. */
|
|
75
|
+
resolvedMessage?: React.ReactNode;
|
|
76
|
+
/** Properties to pass to the container element. */
|
|
77
|
+
containerProps?: React.ComponentPropsWithRef<"div">;
|
|
78
|
+
/** Properties to pass to the card header component. */
|
|
79
|
+
headerProps?: React.ComponentPropsWithRef<typeof CardHeader>;
|
|
80
|
+
/** Properties to pass to the card body component. */
|
|
81
|
+
bodyProps?: React.ComponentPropsWithRef<typeof CardBody>;
|
|
82
|
+
/** Properties to pass to the loading `Spinner` component. */
|
|
83
|
+
loadingSpinnerProps?: React.ComponentPropsWithRef<typeof Spinner>;
|
|
84
|
+
/** Properties to pass to the validating `Spinner` component. */
|
|
85
|
+
validatingSpinnerProps?: React.ComponentPropsWithRef<typeof Spinner>;
|
|
86
|
+
/** Properties to pass to the pagination element. */
|
|
87
|
+
paginationProps?: React.ComponentPropsWithRef<"div">;
|
|
88
|
+
/** Properties to pass to the "focus" button component. */
|
|
89
|
+
focusButtonProps?: Omit<React.ComponentPropsWithRef<typeof IconButton>, "label">;
|
|
90
|
+
/** Properties to pass to the "previous issue" button component. */
|
|
91
|
+
previousIssueButtonProps?: Omit<React.ComponentPropsWithRef<typeof IconButton>, "label">;
|
|
92
|
+
/** Properties to pass to the "next issue" button component. */
|
|
93
|
+
nextIssueButtonProps?: Omit<React.ComponentPropsWithRef<typeof IconButton>, "label">;
|
|
94
|
+
/** Properties to pass to the "first issue" button component. */
|
|
95
|
+
firstIssueButtonProps?: Omit<React.ComponentPropsWithRef<typeof IconButton>, "label">;
|
|
96
|
+
/** Properties to pass to the "last issue" button component. */
|
|
97
|
+
lastIssueButtonProps?: Omit<React.ComponentPropsWithRef<typeof IconButton>, "label">;
|
|
98
|
+
/** Properties to pass to the icon component. */
|
|
99
|
+
iconProps?: Omit<React.ComponentPropsWithRef<typeof Icon>, "icon">;
|
|
100
|
+
/** Properties to pass to the title component. */
|
|
101
|
+
titleProps?: React.ComponentPropsWithRef<typeof CardTitle>;
|
|
102
|
+
/** Properties to pass to the close button component. */
|
|
103
|
+
closeButtonProps?: React.ComponentPropsWithRef<typeof CloseButton>;
|
|
104
|
+
}
|
|
105
|
+
/** Component used to navigate through the issues of the form. */
|
|
106
|
+
export declare const IssuesPanel: React.ForwardRefExoticComponent<IssuesPanelProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type AbsolutePath } from "@ostack.tech/kform";
|
|
2
|
+
import { type Controller } from "@ostack.tech/kform-react";
|
|
3
|
+
import { type IconButtonColor } from "@ostack.tech/ui";
|
|
4
|
+
import { type IssuesPanelProps } from "./IssuesPanel.tsx";
|
|
5
|
+
/** Properties of the issues panel controls component. */
|
|
6
|
+
export interface IssuesPanelControlsProps extends Pick<IssuesPanelProps, "focusButtonLabel" | "previousIssueButtonLabel" | "nextIssueButtonLabel" | "firstIssueButtonLabel" | "lastIssueButtonLabel" | "paginationLabel" | "validatingSpinnerProps" | "paginationProps" | "focusButtonProps" | "previousIssueButtonProps" | "nextIssueButtonProps" | "firstIssueButtonProps" | "lastIssueButtonProps" | "closeButtonProps"> {
|
|
7
|
+
currentPagePath: AbsolutePath | null;
|
|
8
|
+
currentPageIndex: number;
|
|
9
|
+
currentPageController: Controller;
|
|
10
|
+
nPages: number;
|
|
11
|
+
goToPreviousPage: () => void;
|
|
12
|
+
goToNextPage: () => void;
|
|
13
|
+
goToFirstPage: () => void;
|
|
14
|
+
goToLastPage: () => void;
|
|
15
|
+
buttonsColor?: IconButtonColor;
|
|
16
|
+
closePanel: () => void;
|
|
17
|
+
}
|
|
18
|
+
/** Controls of the issues panel. */
|
|
19
|
+
export declare function IssuesPanelControls({ currentPagePath, nPages, currentPageIndex, currentPageController, goToPreviousPage, goToNextPage, goToFirstPage, goToLastPage, buttonsColor, closePanel, focusButtonLabel, previousIssueButtonLabel, nextIssueButtonLabel, firstIssueButtonLabel, lastIssueButtonLabel, paginationLabel, validatingSpinnerProps, paginationProps, focusButtonProps, previousIssueButtonProps, nextIssueButtonProps, firstIssueButtonProps, lastIssueButtonProps, closeButtonProps, }: IssuesPanelControlsProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type AbsolutePath } from "@ostack.tech/kform";
|
|
2
|
+
import { type Controller, type IssuesTrackerResult } from "@ostack.tech/kform-react";
|
|
3
|
+
import { Card, type IconButtonColor } from "@ostack.tech/ui";
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
import { type IssuesPanelProps } from "./IssuesPanel.tsx";
|
|
6
|
+
export interface IssuesPanelMessagesCardProps extends React.ComponentPropsWithoutRef<typeof Card>, Pick<IssuesPanelProps, "displayIssueCodes" | "unknownErrorMessage" | "unknownWarningMessage" | "errorsLabel" | "warningsLabel" | "noIssuesMessage" | "resolvedTitle" | "resolvedMessage" | "headerProps" | "bodyProps" | "loadingSpinnerProps" | "titleProps" | "iconProps"> {
|
|
7
|
+
currentPagePath: AbsolutePath | null;
|
|
8
|
+
currentPageController: Controller;
|
|
9
|
+
issuesTrackerResult: IssuesTrackerResult;
|
|
10
|
+
currentPageIndex: number;
|
|
11
|
+
renderControls: (buttonsColor?: IconButtonColor) => React.ReactNode;
|
|
12
|
+
}
|
|
13
|
+
export declare const IssuesPanelMessagesCard: React.ForwardRefExoticComponent<IssuesPanelMessagesCardProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type IssuesTrackerResult } from "@ostack.tech/kform-react";
|
|
2
|
+
import { Card, type IconButtonColor } from "@ostack.tech/ui";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { type IssuesPanelProps } from "./IssuesPanel.tsx";
|
|
5
|
+
export interface IssuesPanelSummaryCardProps extends React.ComponentPropsWithoutRef<typeof Card>, Pick<IssuesPanelProps, "errorsLabel" | "warningsLabel" | "noIssuesMessage" | "headerProps" | "loadingSpinnerProps" | "titleProps" | "iconProps"> {
|
|
6
|
+
issuesTrackerResult: IssuesTrackerResult;
|
|
7
|
+
renderControls: (buttonsColor?: IconButtonColor) => React.ReactNode;
|
|
8
|
+
}
|
|
9
|
+
export declare const IssuesPanelSummaryCard: React.ForwardRefExoticComponent<IssuesPanelSummaryCardProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./IssuesPanel.tsx";
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type Path } from "@ostack.tech/kform";
|
|
2
|
+
import { FeedbackPopover } from "@ostack.tech/ui";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
/** Properties of the issues popover component. */
|
|
5
|
+
export interface IssuesPopoverProps extends React.ComponentPropsWithoutRef<typeof FeedbackPopover> {
|
|
6
|
+
path?: string | Path;
|
|
7
|
+
/**
|
|
8
|
+
* Paths relevant to this issues popover. When one of the relevant paths
|
|
9
|
+
* becomes active, the popover will automatically open. Defaults to `[path]`
|
|
10
|
+
* (or `[<current path>]` if no `path` is provided).
|
|
11
|
+
*/
|
|
12
|
+
relevantPaths?: (string | Path)[];
|
|
13
|
+
}
|
|
14
|
+
/** Component used to display issues within a popover. */
|
|
15
|
+
export declare const IssuesPopover: React.ForwardRefExoticComponent<IssuesPopoverProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./IssuesPopover.tsx";
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { type ButtonProps } from "@ostack.tech/ui";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { type FormLoaderOptions } from "../../utils/useFormLoader.tsx";
|
|
4
|
+
/** Properties of the load action. */
|
|
5
|
+
export interface LoadActionProps<T = unknown> extends Omit<ButtonProps, "children">, FormLoaderOptions<T> {
|
|
6
|
+
/** Action's label. */
|
|
7
|
+
label?: React.ReactNode;
|
|
8
|
+
/**
|
|
9
|
+
* Keybinds for triggering the action. Set to `null` to disable the keyboard
|
|
10
|
+
* shortcut.
|
|
11
|
+
*
|
|
12
|
+
* Keyboard handling is built on top of the
|
|
13
|
+
* [`tinykeys`](https://jamiebuilds.github.io/tinykeys) library. For
|
|
14
|
+
* information on keybinding syntax, read the [`tinykeys`
|
|
15
|
+
* documentation](https://github.com/jamiebuilds/tinykeys).
|
|
16
|
+
*
|
|
17
|
+
* Defaults to the keybinds defined by the current locale.
|
|
18
|
+
*/
|
|
19
|
+
keybinds?: string | string[] | null;
|
|
20
|
+
}
|
|
21
|
+
/** Action used to load a form from a file. */
|
|
22
|
+
export declare function LoadAction<T = unknown>({ label, keybinds, loading, disabled, onClick, decode, path, extensions, mimeTypes, description, startIn, id, setPristineOnLoad, validateOnLoad, successMessage, errorMessage, ...otherProps }: LoadActionProps<T>): import("react/jsx-runtime").JSX.Element;
|