@ostack.tech/ui-kform 0.15.5 → 0.16.1
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/chunks/{en-CaLvO1z0.js → en-CKrk2smU.js} +14 -5
- package/dist/chunks/en-CKrk2smU.js.map +1 -0
- package/dist/locales/en-GB.js +1 -1
- package/dist/locales/en-US.js +1 -1
- package/dist/locales/fr-FR.js +21 -12
- package/dist/locales/fr-FR.js.map +1 -1
- package/dist/locales/pt-PT.js +13 -4
- package/dist/locales/pt-PT.js.map +1 -1
- package/dist/ostack-ui-kform.css +13 -0
- package/dist/ostack-ui-kform.js +1806 -709
- package/dist/ostack-ui-kform.js.map +1 -1
- package/package.json +6 -5
- package/scss/_utils.scss +1 -0
- package/scss/components/FormPages/_FormPages.scss +8 -0
- package/scss/components/SubmitAction/_SubmitAction-variables.scss +3 -0
- package/scss/components/SubmitAction/_SubmitAction.scss +13 -0
- package/scss/index.scss +1 -0
- package/types/components/Annexes/Annex.d.ts +71 -7
- package/types/components/Annexes/Annexes.d.ts +49 -65
- package/types/components/Annexes/AnnexesContext.d.ts +2 -1
- package/types/components/Annexes/AnnexesManager.d.ts +15 -10
- package/types/components/Annexes/AnnexesMenu.d.ts +5 -6
- package/types/components/Annexes/AnnexesTabList.d.ts +3 -4
- package/types/components/CheckboxControl/CheckboxControl.d.ts +38 -9
- package/types/components/CheckboxGroupControl/CheckboxGroupControl.d.ts +64 -22
- package/types/components/CheckboxGroupControl/CheckboxGroupControlItem.d.ts +26 -0
- package/types/components/CheckboxGroupControl/index.d.ts +1 -0
- package/types/components/ControlField/ControlField.d.ts +3 -4
- package/types/components/DateControl/DateControl.d.ts +38 -8
- package/types/components/DateRangeControl/DateRangeControl.d.ts +56 -24
- package/types/components/DebugInfo/DebugInfo.d.ts +26 -0
- package/types/components/DebugInfo/DebugInfoControlAddonTrigger.d.ts +9 -0
- package/types/components/DebugInfo/index.d.ts +2 -0
- package/types/components/FileControl/FileControl.d.ts +37 -8
- package/types/components/FileControl/FileControlDownloadAddon.d.ts +8 -0
- package/types/components/FileControl/FileControlViewAddon.d.ts +10 -0
- package/types/components/FormApp/FormApp.d.ts +60 -139
- package/types/components/FormApp/FormAppContext.d.ts +13 -3
- package/types/components/FormApp/FormAppElement.d.ts +3 -3
- package/types/components/FormApp/index.d.ts +1 -1
- package/types/components/FormPages/FormPage.d.ts +38 -20
- package/types/components/FormPages/FormPageHeader.d.ts +3 -3
- package/types/components/FormPages/FormPages.d.ts +45 -24
- package/types/components/FormPages/FormPagesContext.d.ts +2 -1
- package/types/components/FormPages/FormPagesNavigation.d.ts +11 -8
- package/types/components/FormPages/FormPagesSelect.d.ts +1 -1
- package/types/components/FormPages/FormPagesSidebar.d.ts +3 -3
- package/types/components/FormStepper/FormStep.d.ts +23 -7
- package/types/components/FormStepper/FormStepList.d.ts +3 -4
- package/types/components/FormStepper/FormStepper.d.ts +52 -21
- package/types/components/FormStepper/FormStepperContext.d.ts +2 -1
- package/types/components/FormStepper/FormStepperFinishTrigger.d.ts +4 -1
- package/types/components/FormStepper/FormStepperNextTrigger.d.ts +4 -1
- package/types/components/FormStepper/FormStepperPreviousTrigger.d.ts +4 -1
- package/types/components/FormStepper/FormStepperState.d.ts +3 -1
- package/types/components/IssueMessage/IssueMessage.d.ts +2 -2
- package/types/components/IssueMessages/IssueMessages.d.ts +4 -4
- package/types/components/IssuesAlert/IssuesAlert.d.ts +4 -5
- package/types/components/IssuesPanel/IssuesPanel.d.ts +18 -18
- package/types/components/IssuesPanel/IssuesPanelMessagesCard.d.ts +4 -4
- package/types/components/IssuesPanel/IssuesPanelSummaryCard.d.ts +4 -4
- package/types/components/IssuesPopover/IssuesPopover.d.ts +3 -4
- package/types/components/LoadAction/LoadAction.d.ts +34 -4
- package/types/components/NumericControl/NumericControl.d.ts +56 -8
- package/types/components/PathLink/PathLink.d.ts +2 -2
- package/types/components/PrintAction/PrintAction.d.ts +41 -16
- package/types/components/RadioGroupControl/RadioGroupControl.d.ts +54 -19
- package/types/components/RadioGroupControl/RadioGroupControlItem.d.ts +25 -0
- package/types/components/RadioGroupControl/index.d.ts +1 -0
- package/types/components/SaveAction/SaveAction.d.ts +45 -7
- package/types/components/SelectControl/SelectControl.d.ts +55 -10
- package/types/components/SelectControl/SelectControlItem.d.ts +23 -0
- package/types/components/SelectControl/SelectControlItemGroup.d.ts +23 -0
- package/types/components/SelectControl/index.d.ts +2 -0
- package/types/components/SelectMultipleControl/SelectMultipleControl.d.ts +71 -14
- package/types/components/SelectMultipleControl/SelectMultipleControlItem.d.ts +13 -0
- package/types/components/SelectMultipleControl/SelectMultipleControlItemGroup.d.ts +13 -0
- package/types/components/SelectMultipleControl/index.d.ts +2 -0
- package/types/components/SubmitAction/SubmitAction.d.ts +50 -14
- package/types/components/TableControl/TableControl.d.ts +108 -13
- package/types/components/TableControl/TableControlActionsColumn.d.ts +21 -0
- package/types/components/TableControl/TableControlActionsColumnLabel.d.ts +2 -0
- package/types/components/TableControl/TableControlAddRowTrigger.d.ts +12 -5
- package/types/components/TableControl/TableControlCell.d.ts +3 -4
- package/types/components/TableControl/TableControlColumn.d.ts +24 -56
- package/types/components/TableControl/TableControlColumnFns.d.ts +113 -0
- package/types/components/TableControl/TableControlColumnGroup.d.ts +25 -0
- package/types/components/TableControl/TableControlColumns.d.ts +14 -0
- package/types/components/TableControl/TableControlContent.d.ts +3 -4
- package/types/components/TableControl/TableControlContext.d.ts +2 -1
- package/types/components/TableControl/TableControlIndexColumn.d.ts +10 -0
- package/types/components/TableControl/TableControlIndexColumnLabel.d.ts +2 -0
- package/types/components/TableControl/TableControlPagination.d.ts +4 -1
- package/types/components/TableControl/TableControlRemoveRowTrigger.d.ts +5 -5
- package/types/components/TableControl/TableControlRow.d.ts +11 -4
- package/types/components/TableControl/TableControlRowsPerPage.d.ts +4 -1
- package/types/components/TableControl/index.d.ts +6 -0
- package/types/components/TextControl/TextControl.d.ts +47 -21
- package/types/components/TopBar/TopBar.d.ts +3 -3
- package/types/components/TopBar/TopBarActions.d.ts +3 -4
- package/types/components/ValidateAction/ValidateAction.d.ts +24 -2
- package/types/index.d.ts +1 -0
- package/types/providers/LocalizationProvider/LocalizationObject.d.ts +5 -1
- package/types/utils/__tests__/pathSpecificity.test.d.ts +1 -0
- package/types/utils/options.d.ts +13 -18
- package/types/utils/promiseUtils.d.ts +7 -0
- package/types/utils/selectionTransformations.d.ts +9 -9
- package/types/utils/useControlIssues.d.ts +21 -19
- package/types/utils/useFormLoader.d.ts +7 -1
- package/types/utils/useFormSaver.d.ts +3 -3
- package/dist/chunks/en-CaLvO1z0.js.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type IssuesTrackerOptions } from "@ostack.tech/kform-react";
|
|
2
|
-
import { type
|
|
3
|
-
import { type
|
|
2
|
+
import { type CardBodyProps, type CardHeaderProps, type CardProps, type CardTitleProps, type CloseButtonProps, type IconButtonProps, type IconProps, type SpinnerProps } from "@ostack.tech/ui";
|
|
3
|
+
import { type ComponentProps, type ReactNode } from "react";
|
|
4
4
|
/** Default “focus” keybinds. */
|
|
5
5
|
export declare const DEFAULT_FOCUS_KEYBINDS = "Alt+Shift+F";
|
|
6
6
|
/** Default “previous issue” keybinds. */
|
|
@@ -12,7 +12,7 @@ export declare const DEFAULT_FIRST_ISSUE_KEYBINDS = "Alt+Shift+Home";
|
|
|
12
12
|
/** Default “last issue” keybinds. */
|
|
13
13
|
export declare const DEFAULT_LAST_ISSUE_KEYBINDS = "Alt+Shift+End";
|
|
14
14
|
/** Properties of the issues navigation component. */
|
|
15
|
-
export interface IssuesPanelProps extends Pick<IssuesTrackerOptions, "issuesOrderCompareFn">, Omit<
|
|
15
|
+
export interface IssuesPanelProps extends Pick<IssuesTrackerOptions, "issuesOrderCompareFn">, Omit<CardProps, "children" | "variant" | "color"> {
|
|
16
16
|
/** Default open state of the issues navigation panel. */
|
|
17
17
|
defaultOpen?: boolean;
|
|
18
18
|
/** Controlled open state of the issues navigation panel. */
|
|
@@ -94,33 +94,33 @@ export interface IssuesPanelProps extends Pick<IssuesTrackerOptions, "issuesOrde
|
|
|
94
94
|
/** Message to display when all issues of the active path have been resolved. */
|
|
95
95
|
resolvedMessage?: ReactNode;
|
|
96
96
|
/** Properties to pass to the container element. */
|
|
97
|
-
containerProps?:
|
|
97
|
+
containerProps?: ComponentProps<"div">;
|
|
98
98
|
/** Properties to pass to the card header component. */
|
|
99
|
-
headerProps?:
|
|
99
|
+
headerProps?: CardHeaderProps;
|
|
100
100
|
/** Properties to pass to the card body component. */
|
|
101
|
-
bodyProps?:
|
|
101
|
+
bodyProps?: CardBodyProps;
|
|
102
102
|
/** Properties to pass to the loading `Spinner` component. */
|
|
103
|
-
loadingSpinnerProps?:
|
|
103
|
+
loadingSpinnerProps?: SpinnerProps;
|
|
104
104
|
/** Properties to pass to the validating `Spinner` component. */
|
|
105
|
-
validatingSpinnerProps?:
|
|
105
|
+
validatingSpinnerProps?: SpinnerProps;
|
|
106
106
|
/** Properties to pass to the pagination element. */
|
|
107
|
-
paginationProps?:
|
|
107
|
+
paginationProps?: ComponentProps<"div">;
|
|
108
108
|
/** Properties to pass to the "focus" button component. */
|
|
109
|
-
focusButtonProps?: Omit<
|
|
109
|
+
focusButtonProps?: Omit<IconButtonProps, "label">;
|
|
110
110
|
/** Properties to pass to the "previous issue" button component. */
|
|
111
|
-
previousIssueButtonProps?: Omit<
|
|
111
|
+
previousIssueButtonProps?: Omit<IconButtonProps, "label">;
|
|
112
112
|
/** Properties to pass to the "next issue" button component. */
|
|
113
|
-
nextIssueButtonProps?: Omit<
|
|
113
|
+
nextIssueButtonProps?: Omit<IconButtonProps, "label">;
|
|
114
114
|
/** Properties to pass to the "first issue" button component. */
|
|
115
|
-
firstIssueButtonProps?: Omit<
|
|
115
|
+
firstIssueButtonProps?: Omit<IconButtonProps, "label">;
|
|
116
116
|
/** Properties to pass to the "last issue" button component. */
|
|
117
|
-
lastIssueButtonProps?: Omit<
|
|
117
|
+
lastIssueButtonProps?: Omit<IconButtonProps, "label">;
|
|
118
118
|
/** Properties to pass to the icon component. */
|
|
119
|
-
iconProps?: Omit<
|
|
119
|
+
iconProps?: Omit<IconProps, "icon">;
|
|
120
120
|
/** Properties to pass to the title component. */
|
|
121
|
-
titleProps?:
|
|
121
|
+
titleProps?: CardTitleProps;
|
|
122
122
|
/** Properties to pass to the close button component. */
|
|
123
|
-
closeButtonProps?:
|
|
123
|
+
closeButtonProps?: CloseButtonProps;
|
|
124
124
|
}
|
|
125
125
|
/** Component used to navigate through the issues of the form. */
|
|
126
|
-
export declare
|
|
126
|
+
export declare function IssuesPanel({ defaultOpen, open: controlledOpen, onOpenChange, displayIssueCodes, issuesOrderCompareFn, unknownErrorMessage, unknownWarningMessage, errorsLabel, warningsLabel, focusButtonLabel, focusKeybinds: focusKeybindsProp, previousIssueButtonLabel, previousIssueKeybinds: previousIssueKeybindsProp, nextIssueButtonLabel, nextIssueKeybinds: nextIssueKeybindsProp, firstIssueButtonLabel, firstIssueKeybinds: firstIssueKeybindsProp, lastIssueButtonLabel, lastIssueKeybinds: lastIssueKeybindsProp, paginationLabel, noIssuesMessage, resolvedTitle, resolvedMessage, containerProps, headerProps, bodyProps, loadingSpinnerProps, validatingSpinnerProps, paginationProps, focusButtonProps, previousIssueButtonProps, nextIssueButtonProps, firstIssueButtonProps, lastIssueButtonProps, titleProps, iconProps, closeButtonProps, ...otherProps }: IssuesPanelProps): false | import("react").JSX.Element;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import type { AbsolutePath } from "@ostack.tech/kform";
|
|
2
2
|
import { type Controller, type IssuesTrackerResult } from "@ostack.tech/kform-react";
|
|
3
|
-
import {
|
|
4
|
-
import { type
|
|
3
|
+
import { type CardProps, type IconButtonColor } from "@ostack.tech/ui";
|
|
4
|
+
import { type ReactNode } from "react";
|
|
5
5
|
import type { IssuesPanelProps } from "./IssuesPanel.tsx";
|
|
6
|
-
export interface IssuesPanelMessagesCardProps extends
|
|
6
|
+
export interface IssuesPanelMessagesCardProps extends CardProps, Pick<IssuesPanelProps, "displayIssueCodes" | "unknownErrorMessage" | "unknownWarningMessage" | "errorsLabel" | "warningsLabel" | "noIssuesMessage" | "resolvedTitle" | "resolvedMessage" | "headerProps" | "bodyProps" | "loadingSpinnerProps" | "titleProps" | "iconProps"> {
|
|
7
7
|
currentPagePath: AbsolutePath | null;
|
|
8
8
|
currentPageController: Controller;
|
|
9
9
|
issuesTrackerResult: IssuesTrackerResult;
|
|
10
10
|
currentPageIndex: number;
|
|
11
11
|
renderControls: (buttonsColor?: IconButtonColor) => ReactNode;
|
|
12
12
|
}
|
|
13
|
-
export declare
|
|
13
|
+
export declare function IssuesPanelMessagesCard({ currentPagePath, currentPageController, issuesTrackerResult, currentPageIndex, errorsLabel, warningsLabel, noIssuesMessage, resolvedTitle, resolvedMessage, displayIssueCodes, unknownErrorMessage, unknownWarningMessage, renderControls, headerProps, bodyProps, loadingSpinnerProps, titleProps, iconProps, className, ref, ...otherProps }: IssuesPanelMessagesCardProps): import("react").JSX.Element;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { IssuesTrackerResult } from "@ostack.tech/kform-react";
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
2
|
+
import { type CardProps, type IconButtonColor } from "@ostack.tech/ui";
|
|
3
|
+
import type { ReactNode } from "react";
|
|
4
4
|
import type { IssuesPanelProps } from "./IssuesPanel.tsx";
|
|
5
|
-
export interface IssuesPanelSummaryCardProps extends
|
|
5
|
+
export interface IssuesPanelSummaryCardProps extends CardProps, Pick<IssuesPanelProps, "errorsLabel" | "warningsLabel" | "noIssuesMessage" | "headerProps" | "loadingSpinnerProps" | "titleProps" | "iconProps"> {
|
|
6
6
|
issuesTrackerResult: IssuesTrackerResult;
|
|
7
7
|
renderControls: (buttonsColor?: IconButtonColor) => ReactNode;
|
|
8
8
|
}
|
|
9
|
-
export declare
|
|
9
|
+
export declare function IssuesPanelSummaryCard({ issuesTrackerResult, errorsLabel, warningsLabel, noIssuesMessage, renderControls, headerProps, loadingSpinnerProps, titleProps, iconProps, className, ...otherProps }: IssuesPanelSummaryCardProps): import("react").JSX.Element;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { type Path } from "@ostack.tech/kform";
|
|
2
|
-
import {
|
|
3
|
-
import { type ComponentPropsWithoutRef } from "react";
|
|
2
|
+
import { type FeedbackPopoverProps } from "@ostack.tech/ui";
|
|
4
3
|
/** Properties of the issues popover component. */
|
|
5
|
-
export interface IssuesPopoverProps extends
|
|
4
|
+
export interface IssuesPopoverProps extends FeedbackPopoverProps {
|
|
6
5
|
path?: string | Path;
|
|
7
6
|
/**
|
|
8
7
|
* Paths relevant to this issues popover. When one of the relevant paths
|
|
@@ -12,4 +11,4 @@ export interface IssuesPopoverProps extends ComponentPropsWithoutRef<typeof Feed
|
|
|
12
11
|
relevantPaths?: (string | Path)[];
|
|
13
12
|
}
|
|
14
13
|
/** Component used to display issues within a popover. */
|
|
15
|
-
export declare
|
|
14
|
+
export declare function IssuesPopover({ path, relevantPaths, defaultOpen, open: controlledOpen, onOpenChange, label, ...otherProps }: IssuesPopoverProps): import("react").JSX.Element;
|
|
@@ -4,7 +4,7 @@ import { type FormLoaderOptions } from "../../utils/useFormLoader.tsx";
|
|
|
4
4
|
/** Default “load” keybinds. */
|
|
5
5
|
export declare const DEFAULT_LOAD_KEYBINDS = "$mod+O";
|
|
6
6
|
/** Properties of the load action. */
|
|
7
|
-
export interface LoadActionProps<T = unknown> extends Omit<ButtonProps, "children">, FormLoaderOptions<T> {
|
|
7
|
+
export interface LoadActionProps<T = unknown> extends Omit<ButtonProps, "children">, Omit<FormLoaderOptions<T>, "id"> {
|
|
8
8
|
/** Action's label. */
|
|
9
9
|
label?: ReactNode;
|
|
10
10
|
/**
|
|
@@ -17,9 +17,39 @@ export interface LoadActionProps<T = unknown> extends Omit<ButtonProps, "childre
|
|
|
17
17
|
* documentation](https://github.com/jamiebuilds/tinykeys).
|
|
18
18
|
*
|
|
19
19
|
* Defaults to the keybinds defined by the current locale or to
|
|
20
|
-
*
|
|
20
|
+
* {@link DEFAULT_LOAD_KEYBINDS}.
|
|
21
21
|
*/
|
|
22
22
|
keybinds?: string | string[] | null;
|
|
23
|
+
/**
|
|
24
|
+
* Whether to show the load action when the form is read-only.
|
|
25
|
+
*
|
|
26
|
+
* @default false
|
|
27
|
+
*/
|
|
28
|
+
showWhenReadOnly?: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* By specifying a filesystem ID, the user agent can remember different
|
|
31
|
+
* directories for different IDs.
|
|
32
|
+
*/
|
|
33
|
+
fileSystemId?: string;
|
|
23
34
|
}
|
|
24
|
-
/**
|
|
25
|
-
|
|
35
|
+
/**
|
|
36
|
+
* Form action used to load the form from a file. Built on top of the [`Button`
|
|
37
|
+
* component](/docs/ostack-ui-forms-button--docs) and `useFormLoader` hook.
|
|
38
|
+
*
|
|
39
|
+
* Example usage:
|
|
40
|
+
*
|
|
41
|
+
* ```tsx
|
|
42
|
+
* import { LoadAction } from "@ostack.tech/ui-kform";
|
|
43
|
+
*
|
|
44
|
+
* function LoadForm() {
|
|
45
|
+
* return (
|
|
46
|
+
* <LoadAction
|
|
47
|
+
* decode={async (file) => decodeFormFromJSON(await file.text())}
|
|
48
|
+
* mimeTypes={["application/json"]}
|
|
49
|
+
* extensions={[".json"]}
|
|
50
|
+
* />
|
|
51
|
+
* );
|
|
52
|
+
* }
|
|
53
|
+
* ```
|
|
54
|
+
*/
|
|
55
|
+
export declare function LoadAction<T = unknown>({ label, keybinds, showWhenReadOnly, fileSystemId, loading, disabled, onClick, decode, path, extensions, mimeTypes, description, startIn, setPristineOnLoad, validateOnLoad, successMessage, errorMessage, ...otherProps }: LoadActionProps<T>): false | import("react").JSX.Element | undefined;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { Path } from "@ostack.tech/kform";
|
|
2
2
|
import { type Numeric, type NumericInputController, type NumericInputOptions } from "@ostack.tech/kform-react";
|
|
3
|
-
import { NumericInput } from "@ostack.tech/ui";
|
|
4
|
-
import { type
|
|
5
|
-
import type {
|
|
3
|
+
import { NumericInput, type NumericInputProps } from "@ostack.tech/ui";
|
|
4
|
+
import { type ComponentRef, type ReactNode, type Ref } from "react";
|
|
5
|
+
import type { IssueMessagesByCode, IssueMessagesProps } from "../IssueMessages";
|
|
6
6
|
/** Properties of the numeric control component. */
|
|
7
|
-
export interface NumericControlProps<T extends Numeric | null = Numeric | null> extends Omit<NumericInputOptions<T, string, ComponentRef<typeof NumericInput>>, "enabled" | "formatFromString" | "parseToString">, Omit<
|
|
7
|
+
export interface NumericControlProps<T extends Numeric | null = Numeric | null> extends Omit<NumericInputOptions<T, string, ComponentRef<typeof NumericInput>>, "enabled" | "formatFromString" | "parseToString">, Omit<NumericInputProps, "defaultValue" | "value" | "onValueChange" | "valueIsUnformattedString" | "status" | "validate" | "validationMode"> {
|
|
8
8
|
/** Path to the value. */
|
|
9
9
|
path?: string | Path;
|
|
10
10
|
/**
|
|
@@ -17,7 +17,7 @@ export interface NumericControlProps<T extends Numeric | null = Numeric | null>
|
|
|
17
17
|
* Label to use in the issues panel when displaying issues associated with
|
|
18
18
|
* this field.
|
|
19
19
|
*
|
|
20
|
-
* This label has priority over the field's `
|
|
20
|
+
* This label has priority over the field's `Label`.
|
|
21
21
|
*/
|
|
22
22
|
issuesPanelLabel?: ReactNode;
|
|
23
23
|
/**
|
|
@@ -36,10 +36,58 @@ export interface NumericControlProps<T extends Numeric | null = Numeric | null>
|
|
|
36
36
|
* @default false
|
|
37
37
|
*/
|
|
38
38
|
preventAutoFocus?: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Whether to show debug information. This property has no effect in
|
|
41
|
+
* production builds.
|
|
42
|
+
*/
|
|
43
|
+
debug?: boolean;
|
|
39
44
|
/** Reference to the control's API. */
|
|
40
45
|
apiRef?: Ref<NumericInputController<T, string, ComponentRef<typeof NumericInput>> | undefined>;
|
|
41
46
|
/** Properties to pass to the `IssueMessages` component. */
|
|
42
|
-
issueMessagesProps?: Omit<
|
|
47
|
+
issueMessagesProps?: Omit<IssueMessagesProps, "path" | "issues" | "messages" | "unwrapped">;
|
|
43
48
|
}
|
|
44
|
-
/**
|
|
45
|
-
|
|
49
|
+
/**
|
|
50
|
+
* The numeric control component is a KForm form control for values with
|
|
51
|
+
* (typically nullable) numeric schemas. It is built on top of the
|
|
52
|
+
* [`NumericInput`](/docs/ostack-ui-forms-numeric-input--docs) component.
|
|
53
|
+
*
|
|
54
|
+
* The following (typically
|
|
55
|
+
* [nullable](https://kform.ostack.tech/api/packages/kform/tech.ostack.kform.schemas/-nullable-schema/index.html))
|
|
56
|
+
* KForm schemas are supported:
|
|
57
|
+
* [`ByteSchema`](https://kform.ostack.tech/api/packages/kform/tech.ostack.kform.schemas/-byte-schema/index.html),
|
|
58
|
+
* [`CharSchema`](https://kform.ostack.tech/api/packages/kform/tech.ostack.kform.schemas/-char-schema/index.html),
|
|
59
|
+
* [`ShortSchema`](https://kform.ostack.tech/api/packages/kform/tech.ostack.kform.schemas/-short-schema/index.html),
|
|
60
|
+
* [`IntSchema`](https://kform.ostack.tech/api/packages/kform/tech.ostack.kform.schemas/-int-schema/index.html),
|
|
61
|
+
* [`LongSchema`](https://kform.ostack.tech/api/packages/kform/tech.ostack.kform.schemas/-long-schema/index.html),
|
|
62
|
+
* [`FloatSchema`](https://kform.ostack.tech/api/packages/kform/tech.ostack.kform.schemas/-float-schema/index.html),
|
|
63
|
+
* [`DoubleSchema`](https://kform.ostack.tech/api/packages/kform/tech.ostack.kform.schemas/-double-schema/index.html),
|
|
64
|
+
* [`BigIntegerSchema`](https://kform.ostack.tech/api/packages/kform/tech.ostack.kform.schemas/-big-integer-schema/index.html),
|
|
65
|
+
* [`BigDecimalSchema`](https://kform.ostack.tech/api/packages/kform/tech.ostack.kform.schemas/-big-decimal-schema/index.html),
|
|
66
|
+
* and
|
|
67
|
+
* [`StringSchema`](https://kform.ostack.tech/api/packages/kform/tech.ostack.kform.schemas/-string-schema/index.html).
|
|
68
|
+
*
|
|
69
|
+
* The following built-in KForm validations affect this control:
|
|
70
|
+
*
|
|
71
|
+
* - [`Required`](https://kform.ostack.tech/api/packages/kform/tech.ostack.kform.validations/-required/index.html):
|
|
72
|
+
* Sets the `required` property.
|
|
73
|
+
* - [`Min`](https://kform.ostack.tech/api/packages/kform/tech.ostack.kform.validations/-min/index.html)/[`Max`](https://kform.ostack.tech/api/packages/kform/tech.ostack.kform.validations/-max/index.html)/[`ExclusiveMin`](https://kform.ostack.tech/api/packages/kform/tech.ostack.kform.validations/-exclusive-min/index.html)/[`ExclusiveMax`](https://kform.ostack.tech/api/packages/kform/tech.ostack.kform.validations/-exclusive-max/index.html):
|
|
74
|
+
* Sets the `min`/`max`/`minExclusive`/`maxExclusive` properties.
|
|
75
|
+
* - [`Scale`](https://kform.ostack.tech/api/packages/kform/tech.ostack.kform.validations/-scale/index.html)/[`MaxScale`](https://kform.ostack.tech/api/packages/kform/tech.ostack.kform.validations/-max-scale/index.html):
|
|
76
|
+
* Sets the `scale` property.
|
|
77
|
+
*
|
|
78
|
+
* The `valueIsInteger` property is further automatically set for integer
|
|
79
|
+
* schemas (`Byte`, `Char`, `Short`, `Int`, `Long`, and `BigInteger`).
|
|
80
|
+
*
|
|
81
|
+
* Example usage:
|
|
82
|
+
*
|
|
83
|
+
* ```tsx
|
|
84
|
+
* import { NumericControl } from "@ostack.tech/ui-kform";
|
|
85
|
+
*
|
|
86
|
+
* function QuantityControl() {
|
|
87
|
+
* return (
|
|
88
|
+
* <NumericControl path="/quantity" placeholder="Number of items…" />
|
|
89
|
+
* );
|
|
90
|
+
* }
|
|
91
|
+
* ```
|
|
92
|
+
*/
|
|
93
|
+
export declare function NumericControl<T extends Numeric | null = Numeric | null>({ path, issueMessages, issuesPanelLabel, displayIssues, preventAutoFocus, apiRef, issueMessagesProps, formManager, onInitialized, onFormManagerEvent, onValueChange, onValidationStatusChange, onDisplayStatusChange, onDirtyStatusChange, onTouchedStatusChange, valueIsInteger, scale, required, min, max, exclusiveMin, exclusiveMax, loading, showSpinner, disabled, readOnly, endAdornment, onFocus, onBlurToOutside, debug, ref, ...otherProps }: NumericControlProps<T>): import("react").JSX.Element;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Path } from "@ostack.tech/kform";
|
|
2
|
-
import { type LinkAs, type LinkOwnProps, type
|
|
2
|
+
import { type LinkAs, type LinkOwnProps, type PolymorphicProps } from "@ostack.tech/ui";
|
|
3
3
|
/** Elements a path link can be rendered as. */
|
|
4
4
|
export type PathLinkAs = LinkAs;
|
|
5
5
|
/** Properties of the path link component. */
|
|
@@ -10,4 +10,4 @@ export interface PathLinkOwnProps extends LinkOwnProps {
|
|
|
10
10
|
to: string | Path;
|
|
11
11
|
}
|
|
12
12
|
/** Link to a KForm path. */
|
|
13
|
-
export declare
|
|
13
|
+
export declare function PathLink<TAs extends PathLinkAs = "button">({ as, to, onClick, ...otherProps }: PathLinkProps<TAs>): import("react").JSX.Element;
|
|
@@ -19,26 +19,51 @@ export interface PrintActionProps extends Omit<ButtonProps, "children"> {
|
|
|
19
19
|
* `DEFAULT_PRINT_KEYBINDS`.
|
|
20
20
|
*/
|
|
21
21
|
keybinds?: string | string[] | null;
|
|
22
|
+
/**
|
|
23
|
+
* Whether to show the print action when the form is read-only.
|
|
24
|
+
*
|
|
25
|
+
* @default true
|
|
26
|
+
*/
|
|
27
|
+
showWhenReadOnly?: boolean;
|
|
22
28
|
}
|
|
23
29
|
/**
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
30
|
+
* Form action used to print the form application. Built on top of the
|
|
31
|
+
* [`Button`](/docs/ostack-ui-forms-button--docs) and
|
|
32
|
+
* [`PrinterTrigger`](/docs/ostack-ui-utilities-printer--docs) components.
|
|
27
33
|
*
|
|
28
|
-
*
|
|
34
|
+
* To print a whole form application, requires the `<FormApp>` component to be
|
|
35
|
+
* wrapped within a `<Printer>`, and for the `<PrinterContent>` to wrap all
|
|
36
|
+
* annexes, pages, and form controls.
|
|
37
|
+
*
|
|
38
|
+
* Example usage:
|
|
29
39
|
*
|
|
30
40
|
* ```tsx
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
41
|
+
* import { Printer, PrinterContent } from "@ostack.tech/ui";
|
|
42
|
+
* import {
|
|
43
|
+
* FormApp,
|
|
44
|
+
* PrintAction,
|
|
45
|
+
* TopBar,
|
|
46
|
+
* TopBarActions,
|
|
47
|
+
* } from "@ostack.tech/ui-kform";
|
|
48
|
+
*
|
|
49
|
+
* export function App() {
|
|
50
|
+
* return (
|
|
51
|
+
* <Printer>
|
|
52
|
+
* <FormApp schema={…}>
|
|
53
|
+
* <PrinterContent>
|
|
54
|
+
* <TopBar>
|
|
55
|
+
* …
|
|
56
|
+
* <TopBarActions>
|
|
57
|
+
* …
|
|
58
|
+
* <PrintAction />
|
|
59
|
+
* </TopBarActions>
|
|
60
|
+
* </TopBar>
|
|
61
|
+
* …
|
|
62
|
+
* </PrinterContent>
|
|
63
|
+
* </FormApp>
|
|
64
|
+
* </Printer>
|
|
65
|
+
* );
|
|
66
|
+
* }
|
|
42
67
|
* ```
|
|
43
68
|
*/
|
|
44
|
-
export declare function PrintAction({ label, keybinds, disabled, loading, onClick, ...otherProps }: PrintActionProps): import("react").JSX.Element;
|
|
69
|
+
export declare function PrintAction({ label, keybinds, showWhenReadOnly, disabled, loading, onClick, ...otherProps }: PrintActionProps): false | import("react").JSX.Element;
|
|
@@ -1,23 +1,15 @@
|
|
|
1
1
|
import type { Path } from "@ostack.tech/kform";
|
|
2
2
|
import { type InputController, type InputOptions } from "@ostack.tech/kform-react";
|
|
3
|
-
import {
|
|
4
|
-
import { type
|
|
5
|
-
import type {
|
|
6
|
-
|
|
7
|
-
export type RadioObject<T = unknown> = Omit<ComponentPropsWithRef<typeof Radio>, "value" | "children"> & {
|
|
8
|
-
/** Option value. */
|
|
9
|
-
value: T;
|
|
10
|
-
/** Option's rendered text. */
|
|
11
|
-
text?: ReactNode;
|
|
12
|
-
/** Option's unique key. */
|
|
13
|
-
key?: Key;
|
|
14
|
-
};
|
|
3
|
+
import { RadioGroup, type RadioGroupProps } from "@ostack.tech/ui";
|
|
4
|
+
import { type ComponentRef, type ReactNode, type Ref } from "react";
|
|
5
|
+
import type { IssueMessagesByCode, IssueMessagesProps } from "../IssueMessages";
|
|
6
|
+
import { type RadioGroupControlItemObject } from "./RadioGroupControlItem.tsx";
|
|
15
7
|
/** Properties of the radio group control component. */
|
|
16
|
-
export interface RadioGroupControlProps<T = unknown> extends Omit<InputOptions<T, T, ComponentRef<typeof RadioGroup>>, "enabled" | "format" | "parse">, Omit<
|
|
8
|
+
export interface RadioGroupControlProps<T = unknown> extends Omit<InputOptions<T, T, ComponentRef<typeof RadioGroup>>, "enabled" | "format" | "parse">, Omit<RadioGroupProps, "defaultValue" | "value" | "onValueChange" | "children" | "status" | "validate" | "validationMode"> {
|
|
17
9
|
/** Path to the value. */
|
|
18
10
|
path?: string | Path;
|
|
19
|
-
/**
|
|
20
|
-
options
|
|
11
|
+
/** Radio group control options. */
|
|
12
|
+
options?: RadioGroupControlItemObject<T>[];
|
|
21
13
|
/**
|
|
22
14
|
* Issue messages of this control.
|
|
23
15
|
*
|
|
@@ -28,7 +20,7 @@ export interface RadioGroupControlProps<T = unknown> extends Omit<InputOptions<T
|
|
|
28
20
|
* Label to use in the issues panel when displaying issues associated with
|
|
29
21
|
* this field.
|
|
30
22
|
*
|
|
31
|
-
* This label has priority over the field's `
|
|
23
|
+
* This label has priority over the field's `Label`.
|
|
32
24
|
*/
|
|
33
25
|
issuesPanelLabel?: ReactNode;
|
|
34
26
|
/**
|
|
@@ -49,10 +41,53 @@ export interface RadioGroupControlProps<T = unknown> extends Omit<InputOptions<T
|
|
|
49
41
|
* @default false
|
|
50
42
|
*/
|
|
51
43
|
preventAutoFocus?: boolean;
|
|
44
|
+
/** Radio group control children. */
|
|
45
|
+
children?: ReactNode;
|
|
46
|
+
/**
|
|
47
|
+
* Whether to show debug information. This property has no effect in
|
|
48
|
+
* production builds.
|
|
49
|
+
*/
|
|
50
|
+
debug?: boolean;
|
|
52
51
|
/** Reference to the control's API. */
|
|
53
52
|
apiRef?: Ref<InputController<T, string, ComponentRef<typeof RadioGroup>> | undefined>;
|
|
54
53
|
/** Properties to pass to the `IssueMessages` component. */
|
|
55
|
-
issueMessagesProps?: Omit<
|
|
54
|
+
issueMessagesProps?: Omit<IssueMessagesProps, "path" | "issues" | "messages" | "unwrapped">;
|
|
56
55
|
}
|
|
57
|
-
/**
|
|
58
|
-
|
|
56
|
+
/**
|
|
57
|
+
* The radio group control component is a KForm form control for values with any
|
|
58
|
+
* type of (typically
|
|
59
|
+
* [nullable](https://kform.ostack.tech/api/packages/kform/tech.ostack.kform.schemas/-nullable-schema/index.html))
|
|
60
|
+
* schema. It is built on top of the
|
|
61
|
+
* [`RadioGroup`](/docs/ostack-ui-forms-radio-group--docs) component.
|
|
62
|
+
*
|
|
63
|
+
* It composes the following subcomponent:
|
|
64
|
+
*
|
|
65
|
+
* - `RadioGroupControlItem`: Component used to define an item of the radio group
|
|
66
|
+
* control.
|
|
67
|
+
*
|
|
68
|
+
* The following built-in KForm validation affects this control:
|
|
69
|
+
*
|
|
70
|
+
* - [`Required`](https://kform.ostack.tech/api/packages/kform/tech.ostack.kform.validations/-required/index.html):
|
|
71
|
+
* Sets the `required` property.
|
|
72
|
+
*
|
|
73
|
+
* Example usage:
|
|
74
|
+
*
|
|
75
|
+
* ```tsx
|
|
76
|
+
* import {
|
|
77
|
+
* RadioGroupControl,
|
|
78
|
+
* RadioGroupControlItem,
|
|
79
|
+
* } from "@ostack.tech/ui-kform";
|
|
80
|
+
*
|
|
81
|
+
* function ShirtSizeControl() {
|
|
82
|
+
* return (
|
|
83
|
+
* <RadioGroupControl path="/shirtSize">
|
|
84
|
+
* <RadioGroupControlItem value="sm">Small</RadioGroupControlItem>
|
|
85
|
+
* <RadioGroupControlItem value="md">Medium</RadioGroupControlItem>
|
|
86
|
+
* <RadioGroupControlItem value="lg">Large</RadioGroupControlItem>
|
|
87
|
+
* <RadioGroupControlItem value="xl">X-Large</RadioGroupControlItem>
|
|
88
|
+
* </RadioGroupControl>
|
|
89
|
+
* );
|
|
90
|
+
* }
|
|
91
|
+
* ```
|
|
92
|
+
*/
|
|
93
|
+
export declare function RadioGroupControl<T = unknown>({ path, options, issueMessages, issuesPanelLabel, displayIssues, unknownValueLabel, preventAutoFocus, apiRef, issueMessagesProps, formManager, onInitialized, onFormManagerEvent, onValueChange, onValidationStatusChange, onDisplayStatusChange, onDirtyStatusChange, onTouchedStatusChange, required, loading, showSpinner, disabled, readOnly, showClearButton, endAdornment, onFocus, onBlurToOutside, children, debug, ref, ...otherProps }: RadioGroupControlProps<T>): import("react").JSX.Element;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { RadioProps } from "@ostack.tech/ui";
|
|
2
|
+
import type { Key, ReactNode } from "react";
|
|
3
|
+
/** @deprecated Use {@link RadioGroupControlItemObject} instead. */
|
|
4
|
+
export type RadioOption<T = unknown> = RadioGroupControlItemObject<T>;
|
|
5
|
+
/** Radio group control item in object notation. */
|
|
6
|
+
export interface RadioGroupControlItemObject<T = unknown> extends Omit<RadioProps, "value" | "children"> {
|
|
7
|
+
/** Item value. */
|
|
8
|
+
value: T;
|
|
9
|
+
/** Item's rendered text. */
|
|
10
|
+
text?: ReactNode;
|
|
11
|
+
/** Item's unique key. */
|
|
12
|
+
key?: Key;
|
|
13
|
+
}
|
|
14
|
+
/** Properties of the radio group control item component. */
|
|
15
|
+
export interface RadioGroupControlItemProps<T = unknown> extends Omit<RadioGroupControlItemObject<T>, "text"> {
|
|
16
|
+
/** Item's rendered text. */
|
|
17
|
+
children?: ReactNode;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Definition of a radio group control item.
|
|
21
|
+
*
|
|
22
|
+
* This component doesn't actually render anything by itself; it is used by the
|
|
23
|
+
* `RadioGroupControl` component to automatically create the `options` array.
|
|
24
|
+
*/
|
|
25
|
+
export declare function RadioGroupControlItem(_props: RadioGroupControlItemProps): null;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { type ButtonProps,
|
|
2
|
-
import type {
|
|
1
|
+
import { type ButtonProps, type DropdownMenuContentProps, type IconButtonProps } from "@ostack.tech/ui";
|
|
2
|
+
import type { ReactNode } from "react";
|
|
3
3
|
import { type FormSaverOptions } from "../../utils/useFormSaver.tsx";
|
|
4
4
|
/** Default “save” keybinds. */
|
|
5
5
|
export declare const DEFAULT_SAVE_KEYBINDS = "$mod+S";
|
|
6
6
|
/** Default “save as” keybinds. */
|
|
7
7
|
export declare const DEFAULT_SAVE_AS_KEYBINDS = "$mod+Shift+S";
|
|
8
8
|
/** Properties of the save action. */
|
|
9
|
-
export interface SaveActionProps<T = unknown> extends Omit<ButtonProps, "children">, Omit<FormSaverOptions<T>, "overwrite"> {
|
|
9
|
+
export interface SaveActionProps<T = unknown> extends Omit<ButtonProps, "children">, Omit<FormSaverOptions<T>, "id" | "overwrite"> {
|
|
10
10
|
/** Action's label. */
|
|
11
11
|
label?: ReactNode;
|
|
12
12
|
/**
|
|
@@ -22,6 +22,17 @@ export interface SaveActionProps<T = unknown> extends Omit<ButtonProps, "childre
|
|
|
22
22
|
* `DEFAULT_SAVE_KEYBINDS`.
|
|
23
23
|
*/
|
|
24
24
|
keybinds?: string | string[] | null;
|
|
25
|
+
/**
|
|
26
|
+
* Whether to show the save action when the form is read-only.
|
|
27
|
+
*
|
|
28
|
+
* @default true
|
|
29
|
+
*/
|
|
30
|
+
showWhenReadOnly?: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* By specifying a filesystem ID, the user agent can remember different
|
|
33
|
+
* directories for different IDs.
|
|
34
|
+
*/
|
|
35
|
+
fileSystemId?: string;
|
|
25
36
|
/**
|
|
26
37
|
* Whether to disable the overwriting behaviour of the “save” button. When
|
|
27
38
|
* set, the “save” button will function as the “save as” button and the “save
|
|
@@ -29,6 +40,8 @@ export interface SaveActionProps<T = unknown> extends Omit<ButtonProps, "childre
|
|
|
29
40
|
*
|
|
30
41
|
* This property only affects browsers that support modern file system APIs,
|
|
31
42
|
* since other browsers already function in the above-mentioned way.
|
|
43
|
+
*
|
|
44
|
+
* Defaults to `true` when the form is read-only and `false` otherwise.
|
|
32
45
|
*/
|
|
33
46
|
disableOverwrite?: boolean;
|
|
34
47
|
/** Label of the save options button. */
|
|
@@ -49,9 +62,34 @@ export interface SaveActionProps<T = unknown> extends Omit<ButtonProps, "childre
|
|
|
49
62
|
*/
|
|
50
63
|
saveAsKeybinds?: string | string[] | null;
|
|
51
64
|
/** Properties to pass to the save options button component. */
|
|
52
|
-
saveOptionsProps?: Omit<Partial<
|
|
65
|
+
saveOptionsProps?: Omit<Partial<IconButtonProps>, "label">;
|
|
53
66
|
/** Properties to pass to the save options dropdown menu component. */
|
|
54
|
-
dropdownMenuProps?:
|
|
67
|
+
dropdownMenuProps?: DropdownMenuContentProps;
|
|
55
68
|
}
|
|
56
|
-
/**
|
|
57
|
-
|
|
69
|
+
/**
|
|
70
|
+
* Form action used to save the form to a file, supporting both overwriting and
|
|
71
|
+
* non-overwriting behaviours (i.e. supporting both “save” and “save as”). Built
|
|
72
|
+
* on top of the [`ButtonGroup`](/docs/ostack-ui-layout-button-group--docs),
|
|
73
|
+
* [`Button`](/docs/ostack-ui-forms-button--docs), and
|
|
74
|
+
* [`DropdownMenu`](/docs/ostack-ui-overlay-dropdown-menu--docs) components, as
|
|
75
|
+
* well as the `useFormSaver` hook.
|
|
76
|
+
*
|
|
77
|
+
* Example usage:
|
|
78
|
+
*
|
|
79
|
+
* ```tsx
|
|
80
|
+
* import { SaveAction } from "@ostack.tech/ui-kform";
|
|
81
|
+
*
|
|
82
|
+
* function SaveForm() {
|
|
83
|
+
* return (
|
|
84
|
+
* <SaveAction
|
|
85
|
+
* encode={(formValue) =>
|
|
86
|
+
* encodeFormToJSON(formValue, { pretty: true })
|
|
87
|
+
* }
|
|
88
|
+
* mimeTypes={["application/json"]}
|
|
89
|
+
* extensions={[".json"]}
|
|
90
|
+
* />
|
|
91
|
+
* );
|
|
92
|
+
* }
|
|
93
|
+
* ```
|
|
94
|
+
*/
|
|
95
|
+
export declare function SaveAction<T = unknown>({ label, keybinds, showWhenReadOnly, fileSystemId, disableOverwrite, saveOptionsLabel, saveAsLabel, saveAsKeybinds, loading, disabled, onClick, variant, color, path, encode, fileName, extensions, description, mimeTypes, startIn, excludeAcceptAllOption, successMessage, errorMessage, saveOptionsProps, dropdownMenuProps, ...otherProps }: SaveActionProps<T>): false | import("react").JSX.Element;
|