@ostack.tech/ui-kform 0.1.2 → 0.2.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-C1hDoCmB.js +135 -0
- package/dist/chunks/en-C1hDoCmB.js.map +1 -0
- package/dist/locales/en-GB.js +10 -0
- package/dist/locales/en-GB.js.map +1 -0
- package/dist/locales/en-US.js +10 -0
- package/dist/locales/en-US.js.map +1 -0
- package/dist/locales/fr.js +137 -0
- package/dist/locales/fr.js.map +1 -0
- package/dist/locales/pt.js +137 -0
- package/dist/locales/pt.js.map +1 -0
- package/dist/ostack-ui-kform.js +1129 -1472
- package/dist/ostack-ui-kform.js.map +1 -1
- package/dist/types/components/Annexes/Annex.d.ts +5 -5
- package/dist/types/components/Annexes/Annexes.d.ts +10 -10
- package/dist/types/components/Annexes/AnnexesContext.d.ts +5 -5
- package/dist/types/components/Annexes/AnnexesManager.d.ts +15 -15
- package/dist/types/components/Annexes/AnnexesMenu.d.ts +4 -4
- package/dist/types/components/Annexes/AnnexesTabList.d.ts +3 -3
- package/dist/types/components/CheckboxControl/CheckboxControl.d.ts +6 -6
- package/dist/types/components/CheckboxGroupControl/CheckboxGroupControl.d.ts +9 -9
- package/dist/types/components/ControlField/ControlField.d.ts +3 -3
- package/dist/types/components/ControlField/ControlFieldContext.d.ts +1 -2
- package/dist/types/components/DateControl/DateControl.d.ts +6 -6
- package/dist/types/components/DateRangeControl/DateRangeControl.d.ts +9 -9
- package/dist/types/components/FileControl/FileControl.d.ts +9 -9
- package/dist/types/components/FormApp/FormApp.d.ts +23 -15
- package/dist/types/components/FormApp/FormAppAutoFocus.d.ts +2 -0
- package/dist/types/components/FormApp/FormAppContext.d.ts +11 -13
- package/dist/types/components/FormApp/FormAppElement.d.ts +9 -0
- package/dist/types/components/FormApp/FormAppIssueMessages.d.ts +3 -3
- package/dist/types/components/FormApp/FormAppStatus.d.ts +2 -2
- package/dist/types/components/FormPages/FormPage.d.ts +17 -17
- package/dist/types/components/FormPages/FormPageHeader.d.ts +3 -3
- package/dist/types/components/FormPages/FormPages.d.ts +7 -7
- package/dist/types/components/FormPages/FormPagesContext.d.ts +4 -4
- package/dist/types/components/FormPages/FormPagesNavigation.d.ts +5 -5
- package/dist/types/components/FormPages/FormPagesSelect.d.ts +3 -3
- package/dist/types/components/FormPages/FormPagesSidebar.d.ts +3 -3
- package/dist/types/components/FormStepper/FormStepContent.d.ts +5 -5
- package/dist/types/components/FormStepper/FormStepList.d.ts +3 -3
- package/dist/types/components/FormStepper/FormStepper.d.ts +5 -5
- package/dist/types/components/FormStepper/FormStepperContext.d.ts +3 -3
- package/dist/types/components/IssueAlert/IssueAlert.d.ts +4 -4
- package/dist/types/components/IssueMessage/IssueMessage.d.ts +4 -4
- package/dist/types/components/IssueMessages/IssueMessages.d.ts +6 -6
- package/dist/types/components/IssuesPanel/IssuesPanel.d.ts +25 -25
- package/dist/types/components/IssuesPanel/IssuesPanelMessagesCard.d.ts +4 -4
- package/dist/types/components/IssuesPanel/IssuesPanelSummaryCard.d.ts +4 -4
- package/dist/types/components/IssuesPopover/IssuesPopover.d.ts +3 -3
- package/dist/types/components/LoadAction/LoadAction.d.ts +2 -2
- package/dist/types/components/NumericControl/NumericControl.d.ts +6 -6
- package/dist/types/components/PathLink/PathLink.d.ts +2 -2
- package/dist/types/components/RadioGroupControl/RadioGroupControl.d.ts +9 -9
- package/dist/types/components/SaveAction/SaveAction.d.ts +6 -6
- package/dist/types/components/SelectControl/SelectControl.d.ts +6 -6
- package/dist/types/components/SelectMultipleControl/SelectMultipleControl.d.ts +6 -6
- package/dist/types/components/SubmitAction/SubmitAction.d.ts +20 -20
- package/dist/types/components/TableControl/TableControl.d.ts +7 -7
- package/dist/types/components/TableControl/TableControlAddRowTrigger.d.ts +4 -4
- package/dist/types/components/TableControl/TableControlApi.d.ts +2 -2
- package/dist/types/components/TableControl/TableControlCell.d.ts +3 -3
- package/dist/types/components/TableControl/TableControlColumn.d.ts +3 -3
- package/dist/types/components/TableControl/TableControlContent.d.ts +3 -3
- package/dist/types/components/TableControl/TableControlContext.d.ts +4 -4
- package/dist/types/components/TableControl/TableControlRemoveRowTrigger.d.ts +9 -9
- package/dist/types/components/TableControl/TableControlRow.d.ts +3 -3
- package/dist/types/components/TextControl/TextControl.d.ts +8 -8
- package/dist/types/components/TopBar/TopBar.d.ts +3 -3
- package/dist/types/components/TopBar/TopBarActions.d.ts +3 -3
- package/dist/types/components/ValidateAction/ValidateAction.d.ts +2 -2
- package/dist/types/index.d.ts +1 -1
- package/dist/types/locales/en-GB.d.ts +3 -0
- package/dist/types/locales/en-US.d.ts +3 -0
- package/dist/types/{locale → locales}/en.d.ts +2 -2
- package/dist/types/locales/fr.d.ts +3 -0
- package/dist/types/locales/index.d.ts +4 -0
- package/dist/types/locales/pt.d.ts +3 -0
- package/dist/types/providers/LocalizationProvider/LocalizationContext.d.ts +6 -4
- package/dist/types/{locale → providers/LocalizationProvider}/LocalizationObject.d.ts +14 -15
- package/dist/types/providers/LocalizationProvider/LocalizationProvider.d.ts +17 -6
- package/dist/types/providers/LocalizationProvider/index.d.ts +1 -0
- package/dist/types/providers/LocalizationProvider/useLocale.d.ts +6 -3
- package/dist/types/providers/PrefixSuffixProvider/PrefixSuffixContext.d.ts +1 -4
- package/dist/types/providers/PrefixSuffixProvider/PrefixSuffixProvider.d.ts +3 -3
- package/dist/types/providers/PrefixSuffixProvider/defaultPrefixSuffix.d.ts +12 -0
- package/dist/types/providers/PrefixSuffixProvider/index.d.ts +1 -0
- package/dist/types/utils/options.d.ts +4 -4
- package/dist/types/utils/selectionTransformations.d.ts +2 -1
- package/dist/types/utils/useControlAutofocus.d.ts +2 -2
- package/dist/types/utils/useControlIssues.d.ts +3 -3
- package/dist/types/utils/useFormLoader.d.ts +3 -3
- package/dist/types/utils/useFormSaver.d.ts +3 -3
- package/dist/types/utils/useRegisterControl.d.ts +6 -6
- package/package.json +21 -5
- package/dist/ostack-ui-kform.cjs +0 -7534
- package/dist/ostack-ui-kform.cjs.map +0 -1
- package/dist/types/locale/defaultLocale.d.ts +0 -3
- package/dist/types/locale/en-GB.d.ts +0 -3
- package/dist/types/locale/en-US.d.ts +0 -3
- package/dist/types/locale/fr-FR.d.ts +0 -3
- package/dist/types/locale/index.d.ts +0 -6
- package/dist/types/locale/pt-PT.d.ts +0 -3
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { type Path } from "@ostack.tech/kform";
|
|
2
2
|
import { type InputController, type InputOptions } from "@ostack.tech/kform-react";
|
|
3
3
|
import { Input, TextArea } from "@ostack.tech/ui";
|
|
4
|
-
import
|
|
4
|
+
import { type ComponentPropsWithoutRef, type ComponentPropsWithRef, type ComponentRef, type ReactNode, type Ref } from "react";
|
|
5
5
|
import { type IssueMessages, type IssueMessagesByCode } from "../IssueMessages";
|
|
6
6
|
/** Properties of the text control component. */
|
|
7
7
|
export type TextControlProps<T extends string | null = string | null> = TextControlPropsSingleline<T> | TextControlPropsMultiline<T>;
|
|
8
|
-
export type TextControlPropsSingleline<T extends string | null = string | null> = Omit<
|
|
8
|
+
export type TextControlPropsSingleline<T extends string | null = string | null> = Omit<ComponentPropsWithoutRef<typeof Input>, "defaultValue" | "value" | "status"> & TextControlPropsBase<T> & {
|
|
9
9
|
multiline?: false;
|
|
10
10
|
};
|
|
11
|
-
export type TextControlPropsMultiline<T extends string | null = string | null> = Omit<
|
|
11
|
+
export type TextControlPropsMultiline<T extends string | null = string | null> = Omit<ComponentPropsWithoutRef<typeof TextArea>, "defaultValue" | "value" | "status"> & TextControlPropsBase<T> & {
|
|
12
12
|
multiline: true;
|
|
13
13
|
pattern?: never;
|
|
14
14
|
};
|
|
15
|
-
export type TextControlPropsBase<T extends string | null = string | null> = Omit<InputOptions<T, string,
|
|
15
|
+
export type TextControlPropsBase<T extends string | null = string | null> = Omit<InputOptions<T, string, ComponentRef<typeof Input | typeof TextArea>>, "enabled" | "format" | "parse"> & {
|
|
16
16
|
/** Path to the value. */
|
|
17
17
|
path?: string | Path;
|
|
18
18
|
/**
|
|
@@ -27,7 +27,7 @@ export type TextControlPropsBase<T extends string | null = string | null> = Omit
|
|
|
27
27
|
*
|
|
28
28
|
* This label has priority over the field's `ControlLabel`.
|
|
29
29
|
*/
|
|
30
|
-
issuesPanelLabel?:
|
|
30
|
+
issuesPanelLabel?: ReactNode;
|
|
31
31
|
/**
|
|
32
32
|
* Whether to display the issues associated with this control.
|
|
33
33
|
*
|
|
@@ -48,9 +48,9 @@ export type TextControlPropsBase<T extends string | null = string | null> = Omit
|
|
|
48
48
|
/** Whether to render a multiline text control. */
|
|
49
49
|
multiline?: boolean;
|
|
50
50
|
/** Reference to the control's API. */
|
|
51
|
-
apiRef?:
|
|
51
|
+
apiRef?: Ref<InputController<T, string, ComponentRef<typeof Input | typeof TextArea>> | undefined>;
|
|
52
52
|
/** Properties to pass to the `IssueMessages` component. */
|
|
53
|
-
issueMessagesProps?: Omit<
|
|
53
|
+
issueMessagesProps?: Omit<ComponentPropsWithRef<typeof IssueMessages>, "path" | "issues" | "messages">;
|
|
54
54
|
};
|
|
55
55
|
/**
|
|
56
56
|
* Text control component supporting (possibly nullable) schemas of type
|
|
@@ -63,4 +63,4 @@ export type TextControlPropsBase<T extends string | null = string | null> = Omit
|
|
|
63
63
|
* The component further supports either single or multiple lines via the
|
|
64
64
|
* `multiline` prop.
|
|
65
65
|
*/
|
|
66
|
-
export declare const TextControl:
|
|
66
|
+
export declare const TextControl: import("react").ForwardRefExoticComponent<TextControlProps<string | null> & import("react").RefAttributes<HTMLInputElement | HTMLTextAreaElement>>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { type ComponentPropsWithoutRef } from "react";
|
|
2
2
|
/** Properties of the top bar component. */
|
|
3
|
-
export interface TopBarProps extends
|
|
3
|
+
export interface TopBarProps extends ComponentPropsWithoutRef<"div"> {
|
|
4
4
|
}
|
|
5
5
|
/** Top bar component. */
|
|
6
|
-
export declare const TopBar:
|
|
6
|
+
export declare const TopBar: import("react").ForwardRefExoticComponent<TopBarProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Stack } from "@ostack.tech/ui";
|
|
2
|
-
import
|
|
2
|
+
import { type ComponentPropsWithoutRef } from "react";
|
|
3
3
|
/** Properties of the top bar actions component. */
|
|
4
|
-
export interface TopBarActionsProps extends
|
|
4
|
+
export interface TopBarActionsProps extends ComponentPropsWithoutRef<typeof Stack> {
|
|
5
5
|
}
|
|
6
6
|
/** Container used to display actions within the top bar. */
|
|
7
|
-
export declare const TopBarActions:
|
|
7
|
+
export declare const TopBarActions: import("react").ForwardRefExoticComponent<TopBarActionsProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { type ButtonProps } from "@ostack.tech/ui";
|
|
2
|
-
import
|
|
2
|
+
import { type ReactNode } from "react";
|
|
3
3
|
/** Properties of the validate action. */
|
|
4
4
|
export interface ValidateActionProps extends Omit<ButtonProps, "children"> {
|
|
5
5
|
/** Action's label. */
|
|
6
|
-
label?:
|
|
6
|
+
label?: ReactNode;
|
|
7
7
|
/**
|
|
8
8
|
* Keybinds for triggering the action. Set to `null` to disable the keyboard
|
|
9
9
|
* shortcut.
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { type LocalizationObject } from "
|
|
1
|
+
import { type LocalizationObject } from "../providers/LocalizationProvider";
|
|
2
2
|
/** `en` locale (partial). */
|
|
3
|
-
export declare const en: Omit<LocalizationObject, "languageTag" | "
|
|
3
|
+
export declare const en: Omit<LocalizationObject, "languageTag" | "baseLocale">;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { type LocalizationObject } from "../../locale/LocalizationObject.ts";
|
|
1
|
+
import { type LocalizationObject } from "./LocalizationObject.ts";
|
|
3
2
|
/** Value of the localisation context. */
|
|
4
|
-
export
|
|
3
|
+
export interface LocalizationContextValue {
|
|
4
|
+
locale: LocalizationObject;
|
|
5
|
+
setLocale: (locale: LocalizationObject) => void;
|
|
6
|
+
}
|
|
5
7
|
/** Localisation context. */
|
|
6
|
-
export declare const LocalizationContext:
|
|
8
|
+
export declare const LocalizationContext: import("react").Context<LocalizationContextValue | null>;
|
|
@@ -1,21 +1,20 @@
|
|
|
1
1
|
import { type LocalizationObject as UiLocalizationObject } from "@ostack.tech/ui";
|
|
2
|
-
import { type AnnexesManagerProps } from "
|
|
3
|
-
import { type DateRangeControlProps } from "
|
|
4
|
-
import { type FileControlProps } from "
|
|
5
|
-
import { type FormAppProps } from "
|
|
6
|
-
import { type FormPageProps, type FormPagesNavigationProps } from "
|
|
7
|
-
import { type IssueMessagesProps } from "
|
|
8
|
-
import { type IssuesPanelProps } from "
|
|
9
|
-
import { type IssuesPopoverProps } from "
|
|
10
|
-
import { type LoadActionProps } from "
|
|
11
|
-
import { type SaveActionProps } from "
|
|
12
|
-
import { type SubmitActionProps } from "
|
|
13
|
-
import { type TableControlAddRowTriggerProps, type TableControlRemoveRowTriggerProps } from "
|
|
14
|
-
import { type ValidateActionProps } from "
|
|
2
|
+
import { type AnnexesManagerProps } from "../../components/Annexes";
|
|
3
|
+
import { type DateRangeControlProps } from "../../components/DateRangeControl";
|
|
4
|
+
import { type FileControlProps } from "../../components/FileControl";
|
|
5
|
+
import { type FormAppProps } from "../../components/FormApp";
|
|
6
|
+
import { type FormPageProps, type FormPagesNavigationProps } from "../../components/FormPages";
|
|
7
|
+
import { type IssueMessagesProps } from "../../components/IssueMessages";
|
|
8
|
+
import { type IssuesPanelProps } from "../../components/IssuesPanel";
|
|
9
|
+
import { type IssuesPopoverProps } from "../../components/IssuesPopover";
|
|
10
|
+
import { type LoadActionProps } from "../../components/LoadAction";
|
|
11
|
+
import { type SaveActionProps } from "../../components/SaveAction";
|
|
12
|
+
import { type SubmitActionProps } from "../../components/SubmitAction";
|
|
13
|
+
import { type TableControlAddRowTriggerProps, type TableControlRemoveRowTriggerProps } from "../../components/TableControl";
|
|
14
|
+
import { type ValidateActionProps } from "../../components/ValidateAction";
|
|
15
15
|
/** Localization object representation. */
|
|
16
16
|
export interface LocalizationObject {
|
|
17
|
-
|
|
18
|
-
uiLocale: UiLocalizationObject;
|
|
17
|
+
baseLocale: UiLocalizationObject;
|
|
19
18
|
AnnexesManager: Pick<AnnexesManagerProps, "aria-label" | "menuButtonText" | "addAnnexText" | "removeAnnexButtonLabel" | "removeAnnexKeyboardHint" | "removeAnnexConfirmDialogTitle" | "removeAnnexConfirmDialogMessage" | "removeAnnexConfirmDialogOkText" | "removeAnnexConfirmDialogCancelText">;
|
|
20
19
|
DateRangeControl: Pick<DateRangeControlProps, "issuesPanelStartLabelSuffix" | "issuesPanelEndLabelSuffix">;
|
|
21
20
|
FileControl: Pick<FileControlProps, "viewFileButtonLabel" | "downloadFileButtonLabel" | "fallbackText">;
|
|
@@ -1,10 +1,21 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { type LocalizationObject } from "
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
import { type LocalizationObject } from "./LocalizationObject.ts";
|
|
3
3
|
/** Properties of the localisation provider. */
|
|
4
4
|
export interface LocalizationProviderProps {
|
|
5
|
-
/**
|
|
5
|
+
/** Uncontrolled locale to use. */
|
|
6
|
+
defaultLocale?: LocalizationObject;
|
|
7
|
+
/** Controlled locale to use. */
|
|
6
8
|
locale?: LocalizationObject;
|
|
7
|
-
|
|
9
|
+
/**
|
|
10
|
+
* Function called when the locale changes.
|
|
11
|
+
*
|
|
12
|
+
* @param locale New locale.
|
|
13
|
+
*/
|
|
14
|
+
onLocaleChange?: (locale: LocalizationObject) => void;
|
|
15
|
+
children: ReactNode;
|
|
8
16
|
}
|
|
9
|
-
/**
|
|
10
|
-
|
|
17
|
+
/**
|
|
18
|
+
* Localisation provider (also sets the `@ostack.tech/ui` localisation
|
|
19
|
+
* provider).
|
|
20
|
+
*/
|
|
21
|
+
export declare function LocalizationProvider({ defaultLocale, locale: controlledLocale, onLocaleChange, children, }: LocalizationProviderProps): string | number | bigint | boolean | Iterable<ReactNode> | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | import("react/jsx-runtime").JSX.Element | null | undefined;
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
-
import { type LocalizationObject } from "
|
|
2
|
-
/** Hook used to get the current locale. */
|
|
3
|
-
export declare function useLocale():
|
|
1
|
+
import { type LocalizationObject } from "./LocalizationObject.ts";
|
|
2
|
+
/** Hook used to get and set the current locale. */
|
|
3
|
+
export declare function useLocale(): [
|
|
4
|
+
LocalizationObject,
|
|
5
|
+
(locale: LocalizationObject) => void
|
|
6
|
+
];
|
|
@@ -1,5 +1,2 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
/** Default library prefix-suffix. */
|
|
3
|
-
export declare const DEFAULT_PREFIX_SUFFIX = "kform-";
|
|
4
1
|
/** Prefix-suffix context. */
|
|
5
|
-
export declare const PrefixSuffixContext:
|
|
2
|
+
export declare const PrefixSuffixContext: import("react").Context<string | null>;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
2
|
/** Properties of the prefix-suffix provider. */
|
|
3
3
|
export interface PrefixSuffixProviderProps {
|
|
4
4
|
/** Suffix to add to ostack/UI's prefix. */
|
|
5
5
|
prefixSuffix?: string;
|
|
6
|
-
children:
|
|
6
|
+
children: ReactNode;
|
|
7
7
|
}
|
|
8
8
|
/** Prefix-suffix provider. */
|
|
9
|
-
export declare function PrefixSuffixProvider({ prefixSuffix, children, }: PrefixSuffixProviderProps): string | number | bigint | boolean | Iterable<
|
|
9
|
+
export declare function PrefixSuffixProvider({ prefixSuffix, children, }: PrefixSuffixProviderProps): string | number | bigint | boolean | Iterable<ReactNode> | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | import("react/jsx-runtime").JSX.Element | null | undefined;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/** Store holding the default prefix-suffix. */
|
|
2
|
+
export declare const defaultPrefixSuffixStore: import("zustand").StoreApi<{
|
|
3
|
+
defaultPrefixSuffix: string;
|
|
4
|
+
}>;
|
|
5
|
+
/**
|
|
6
|
+
* Function used to set the default library's prefix-suffix. The default library
|
|
7
|
+
* prefix-suffix can be overridden by providing a `prefixSuffix` property to the
|
|
8
|
+
* `PrefixSuffixProvider` or `FormApp` components.
|
|
9
|
+
*
|
|
10
|
+
* @param defaultPrefixSuffix Prefix-suffix to set as the library's default.
|
|
11
|
+
*/
|
|
12
|
+
export declare function setDefaultPrefixSuffix(defaultPrefixSuffix: string): void;
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { type OptionProps, type OptionsGroupProps } from "@ostack.tech/ui";
|
|
2
|
-
import type
|
|
2
|
+
import { type Key, type ReactNode } from "react";
|
|
3
3
|
/** Object representation of an options group. */
|
|
4
4
|
export type OptionsGroupObject<T = unknown> = Omit<OptionsGroupProps, "children"> & {
|
|
5
5
|
/** Group's options. */
|
|
6
6
|
options: OptionObject<T>[];
|
|
7
7
|
/** Group's unique key. */
|
|
8
|
-
key?:
|
|
8
|
+
key?: Key;
|
|
9
9
|
};
|
|
10
10
|
/** Object representation of an option. */
|
|
11
11
|
export type OptionObject<T = unknown> = Omit<OptionProps, "value" | "children"> & {
|
|
12
12
|
/** Option value. */
|
|
13
13
|
value: T;
|
|
14
14
|
/** Option's rendered text. */
|
|
15
|
-
text?:
|
|
15
|
+
text?: ReactNode;
|
|
16
16
|
/** Option's unique key. */
|
|
17
|
-
key?:
|
|
17
|
+
key?: Key;
|
|
18
18
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type Schema } from "@ostack.tech/kform";
|
|
2
2
|
import { type Listable } from "@ostack.tech/kform-react";
|
|
3
|
+
import { type JSX } from "react";
|
|
3
4
|
import { type OptionObject, type OptionsGroupObject } from "./options.ts";
|
|
4
5
|
/**
|
|
5
6
|
* Parses a selection value from the (string) index of an option (or empty
|
|
@@ -29,4 +30,4 @@ export declare function formatSelectionValuesAsOptionIndices<T>(arrayValue: T[]
|
|
|
29
30
|
* @param options Option objects.
|
|
30
31
|
* @returns React nodes representing the objects.
|
|
31
32
|
*/
|
|
32
|
-
export declare function optionObjectsToNodes<T>(options: (OptionsGroupObject<T> | OptionObject<T>)[]):
|
|
33
|
+
export declare function optionObjectsToNodes<T>(options: (OptionsGroupObject<T> | OptionObject<T>)[]): JSX.Element[];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type Controller } from "@ostack.tech/kform-react";
|
|
2
|
-
import
|
|
2
|
+
import { type RefObject } from "react";
|
|
3
3
|
/**
|
|
4
4
|
* Function used to scroll an element into view.
|
|
5
5
|
*
|
|
@@ -16,7 +16,7 @@ export type ScrollIntoViewFn = (el: HTMLElement, options?: ScrollIntoViewOptions
|
|
|
16
16
|
* @returns Reference that should be set on the focusable element of the
|
|
17
17
|
* control.
|
|
18
18
|
*/
|
|
19
|
-
export declare function useControlAutofocus<T = unknown, TElem extends HTMLElement = HTMLElement>({ usePath, useExists }: Controller<T>, enabled?: boolean):
|
|
19
|
+
export declare function useControlAutofocus<T = unknown, TElem extends HTMLElement = HTMLElement>({ usePath, useExists }: Controller<T>, enabled?: boolean): RefObject<TElem | null>;
|
|
20
20
|
/**
|
|
21
21
|
* Visibly focuses the provided element.
|
|
22
22
|
*
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type SealedValidationIssue } from "@ostack.tech/kform";
|
|
2
|
-
import
|
|
2
|
+
import { type ComponentPropsWithRef, type ReactNode } from "react";
|
|
3
3
|
import { IssueMessages, type IssueMessagesByCode } from "../components/IssueMessages";
|
|
4
4
|
/** Options of the `useControlIssues` hook. */
|
|
5
5
|
export interface UseControlIssuesOptions {
|
|
@@ -10,7 +10,7 @@ export interface UseControlIssuesOptions {
|
|
|
10
10
|
/** Whether issues should be displayed. */
|
|
11
11
|
displayIssues?: boolean;
|
|
12
12
|
/** Properties to pass to the `IssueMessages` component. */
|
|
13
|
-
issueMessagesProps?: Omit<
|
|
13
|
+
issueMessagesProps?: Omit<ComponentPropsWithRef<typeof IssueMessages>, "path" | "issues" | "messages" | "unwrapped">;
|
|
14
14
|
}
|
|
15
15
|
/**
|
|
16
16
|
* Hook which helps a control component render its issues.
|
|
@@ -24,4 +24,4 @@ export interface UseControlIssuesOptions {
|
|
|
24
24
|
* the issues are to appear within a popover. This will be `null` if the
|
|
25
25
|
* issues should not appear in a popover.
|
|
26
26
|
*/
|
|
27
|
-
export declare function useControlIssues({ issuesToDisplay, issueMessages, displayIssues, issueMessagesProps, }: UseControlIssuesOptions): [
|
|
27
|
+
export declare function useControlIssues({ issuesToDisplay, issueMessages, displayIssues, issueMessagesProps, }: UseControlIssuesOptions): [ReactNode, ReactNode];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AbsolutePath } from "@ostack.tech/kform";
|
|
2
2
|
import { type FileSystemHandle, type FileWithHandle, type WellKnownDirectory } from "browser-fs-access";
|
|
3
|
-
import
|
|
3
|
+
import { type ReactNode } from "react";
|
|
4
4
|
/**
|
|
5
5
|
* Options that can be passed to the {@link useFormLoader} hook, or to its
|
|
6
6
|
* resulting `load` function.
|
|
@@ -53,7 +53,7 @@ export interface FormLoaderOptions<T = unknown> {
|
|
|
53
53
|
* @param file Loaded file.
|
|
54
54
|
* @returns Message to show in a toast.
|
|
55
55
|
*/
|
|
56
|
-
successMessage?: (file: FileWithHandle) =>
|
|
56
|
+
successMessage?: (file: FileWithHandle) => ReactNode;
|
|
57
57
|
/**
|
|
58
58
|
* Message to show in a toast when an error occurs while loading the form from
|
|
59
59
|
* a file.
|
|
@@ -63,7 +63,7 @@ export interface FormLoaderOptions<T = unknown> {
|
|
|
63
63
|
* @param error Error that occurred.
|
|
64
64
|
* @returns Message to show in a toast.
|
|
65
65
|
*/
|
|
66
|
-
errorMessage?: (file: FileWithHandle | null, error: unknown) =>
|
|
66
|
+
errorMessage?: (file: FileWithHandle | null, error: unknown) => ReactNode;
|
|
67
67
|
}
|
|
68
68
|
/** Result of the {@link useFormLoader} hook. */
|
|
69
69
|
export interface FormLoaderResult<T> {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AbsolutePath } from "@ostack.tech/kform";
|
|
2
2
|
import { type FileSystemHandle, type WellKnownDirectory } from "browser-fs-access";
|
|
3
|
-
import
|
|
3
|
+
import { type ReactNode } from "react";
|
|
4
4
|
/**
|
|
5
5
|
* Options that can be passed to the {@link useFormSaver} hook, or to its
|
|
6
6
|
* resulting `save`/`saveAs` functions.
|
|
@@ -66,7 +66,7 @@ export interface FormSaverOptions<T = unknown> {
|
|
|
66
66
|
* @param fileHandle Handle to the saved file.
|
|
67
67
|
* @returns Message to show in a toast.
|
|
68
68
|
*/
|
|
69
|
-
successMessage?: (fileHandle: FileSystemFileHandle) =>
|
|
69
|
+
successMessage?: (fileHandle: FileSystemFileHandle) => ReactNode;
|
|
70
70
|
/**
|
|
71
71
|
* Message to show in a toast when an error occurs while saving the form to a
|
|
72
72
|
* file.
|
|
@@ -76,7 +76,7 @@ export interface FormSaverOptions<T = unknown> {
|
|
|
76
76
|
* @param error Error that occurred.
|
|
77
77
|
* @returns Message to show in a toast.
|
|
78
78
|
*/
|
|
79
|
-
errorMessage?: (fileHandle: FileSystemFileHandle | null, error: unknown) =>
|
|
79
|
+
errorMessage?: (fileHandle: FileSystemFileHandle | null, error: unknown) => ReactNode;
|
|
80
80
|
}
|
|
81
81
|
/** Result of the {@link useFormSaver} hook. */
|
|
82
82
|
export interface FormSaverResult<T> {
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { type DisplayStatus, type SealedValidationIssue } from "@ostack.tech/kform";
|
|
2
2
|
import { type Controller } from "@ostack.tech/kform-react";
|
|
3
|
-
import
|
|
3
|
+
import { type FocusEvent, type ReactNode, type Ref, type RefObject } from "react";
|
|
4
4
|
/** Options when registering the control. */
|
|
5
5
|
export interface UseRegisterControlOptions<T> {
|
|
6
6
|
controller: Controller<T>;
|
|
7
|
-
issuesPanelLabel?:
|
|
7
|
+
issuesPanelLabel?: ReactNode;
|
|
8
8
|
ariaLabel?: string;
|
|
9
|
-
issuesPanelLabelSuffix?:
|
|
9
|
+
issuesPanelLabelSuffix?: ReactNode;
|
|
10
10
|
preventAutoFocus?: boolean;
|
|
11
|
-
apiRef?:
|
|
11
|
+
apiRef?: Ref<Controller<T> | undefined>;
|
|
12
12
|
}
|
|
13
13
|
/** Result of registering the control. */
|
|
14
14
|
export interface UseRegisterControlResult<TElem> {
|
|
@@ -17,8 +17,8 @@ export interface UseRegisterControlResult<TElem> {
|
|
|
17
17
|
displayReadOnly: boolean;
|
|
18
18
|
displayStatusToDisplay: DisplayStatus | undefined;
|
|
19
19
|
issuesToDisplay: SealedValidationIssue[];
|
|
20
|
-
autofocusRef:
|
|
21
|
-
handleFocus: (event:
|
|
20
|
+
autofocusRef: RefObject<TElem | null>;
|
|
21
|
+
handleFocus: (event: FocusEvent) => void;
|
|
22
22
|
}
|
|
23
23
|
/** Hook used to register a control within the form app. */
|
|
24
24
|
export declare function useRegisterControl<T, TElem extends HTMLElement = HTMLElement>({ controller, issuesPanelLabel, ariaLabel, issuesPanelLabelSuffix, preventAutoFocus, apiRef, }: UseRegisterControlOptions<T>): UseRegisterControlResult<TElem>;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ostack.tech/ui-kform",
|
|
3
3
|
"description": "Integration of ostack/UI with ostack/KForm.",
|
|
4
|
-
"version": "0.1
|
|
4
|
+
"version": "0.2.1",
|
|
5
5
|
"homepage": "https://ui.ostack.tech/",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "Opensoft",
|
|
@@ -16,21 +16,37 @@
|
|
|
16
16
|
"engines": {
|
|
17
17
|
"node": ">=10"
|
|
18
18
|
},
|
|
19
|
-
"main": "dist/ostack-ui-kform.
|
|
19
|
+
"main": "dist/ostack-ui-kform.js",
|
|
20
20
|
"types": "dist/types/index.d.ts",
|
|
21
21
|
"sass": "scss/index.scss",
|
|
22
22
|
"style": "dist/ostack-ui-kform.css",
|
|
23
23
|
"exports": {
|
|
24
24
|
".": {
|
|
25
25
|
"types": "./dist/types/index.d.ts",
|
|
26
|
-
"import": "./dist/ostack-ui-kform.js"
|
|
27
|
-
|
|
26
|
+
"import": "./dist/ostack-ui-kform.js"
|
|
27
|
+
},
|
|
28
|
+
"./locales/en-GB": {
|
|
29
|
+
"types": "./dist/types/locales/en-GB.d.ts",
|
|
30
|
+
"import": "./dist/locales/en-GB.js"
|
|
31
|
+
},
|
|
32
|
+
"./locales/en-US": {
|
|
33
|
+
"types": "./dist/types/locales/en-US.d.ts",
|
|
34
|
+
"import": "./dist/locales/en-US.js"
|
|
35
|
+
},
|
|
36
|
+
"./locales/fr": {
|
|
37
|
+
"types": "./dist/types/locales/fr.d.ts",
|
|
38
|
+
"import": "./dist/locales/fr.js"
|
|
39
|
+
},
|
|
40
|
+
"./locales/pt": {
|
|
41
|
+
"types": "./dist/types/locales/pt.d.ts",
|
|
42
|
+
"import": "./dist/locales/pt.js"
|
|
28
43
|
},
|
|
29
44
|
"./css": "./dist/ostack-ui-kform.css",
|
|
30
45
|
"./scss": "./scss/index.scss",
|
|
31
46
|
"./scss/*": "./scss/*",
|
|
32
47
|
"./package.json": "./package.json"
|
|
33
48
|
},
|
|
49
|
+
"sideEffects": false,
|
|
34
50
|
"files": [
|
|
35
51
|
"dist/",
|
|
36
52
|
"scss/"
|
|
@@ -51,7 +67,7 @@
|
|
|
51
67
|
"@fortawesome/free-solid-svg-icons": "^6.2.0 || ^7.0.0",
|
|
52
68
|
"@ostack.tech/kform": "~0.31.0",
|
|
53
69
|
"@ostack.tech/kform-react": "~0.31.0",
|
|
54
|
-
"@ostack.tech/ui": "~0.1
|
|
70
|
+
"@ostack.tech/ui": "~0.2.1",
|
|
55
71
|
"@types/react": "^18.0.0 || ^19.0.0",
|
|
56
72
|
"@types/react-dom": "^18.0.0 || ^19.0.0",
|
|
57
73
|
"date-fns": "^4.1.0",
|