@ostack.tech/ui-kform 1.0.0-rc.0 → 1.0.0-rc.2
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-CBhjKaFE.js → en-D4xMcf6Q.js} +2 -2
- package/dist/chunks/{en-CBhjKaFE.js.map → en-D4xMcf6Q.js.map} +1 -1
- package/dist/locales/en-GB.js +1 -1
- package/dist/locales/en-US.js +1 -1
- package/dist/locales/fr-FR.js +1 -1
- package/dist/locales/index.js +5 -0
- package/dist/locales/pt-PT.js +1 -1
- package/dist/ostack-ui-kform.css +5 -0
- package/dist/ostack-ui-kform.js +173 -196
- package/dist/ostack-ui-kform.js.map +1 -1
- package/package.json +6 -2
- package/scss/components/TopBar/_TopBar.scss +6 -0
- package/types/components/ControlField/ControlField.d.ts +26 -30
- package/types/components/ControlField/index.d.ts +0 -1
- package/types/components/FormPages/FormPagesContext.d.ts +2 -1
- package/types/components/IssueMessages/IssueMessages.d.ts +6 -1
- package/types/components/TopBar/TopBar.d.ts +3 -1
- package/types/components/TopBar/TopBarActions.d.ts +1 -1
- package/types/index.d.ts +0 -1
- package/types/providers/LocalizationProvider/LocalizationObject.d.ts +2 -2
- package/types/utils/useControlIssues.d.ts +5 -3
- package/types/components/ControlField/ControlFieldContext.d.ts +0 -32
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": "1.0.0-rc.
|
|
4
|
+
"version": "1.0.0-rc.2",
|
|
5
5
|
"homepage": "https://ui.ostack.tech/",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "Opensoft",
|
|
@@ -22,6 +22,10 @@
|
|
|
22
22
|
"types": "./types/index.d.ts",
|
|
23
23
|
"import": "./dist/ostack-ui-kform.js"
|
|
24
24
|
},
|
|
25
|
+
"./locales": {
|
|
26
|
+
"types": "./types/locales/index.d.ts",
|
|
27
|
+
"import": "./dist/locales/index.js"
|
|
28
|
+
},
|
|
25
29
|
"./locales/*": {
|
|
26
30
|
"types": "./types/locales/*.d.ts",
|
|
27
31
|
"import": "./dist/locales/*.js"
|
|
@@ -51,7 +55,7 @@
|
|
|
51
55
|
"@fortawesome/free-solid-svg-icons": "^6.2.0 || ^7.0.0",
|
|
52
56
|
"@ostack.tech/kform": "~1.0.0-rc.1",
|
|
53
57
|
"@ostack.tech/kform-react": "~1.0.0-rc.1",
|
|
54
|
-
"@ostack.tech/ui": "~1.0.0-rc.
|
|
58
|
+
"@ostack.tech/ui": "~1.0.0-rc.2",
|
|
55
59
|
"@types/react": "^19.0.0",
|
|
56
60
|
"@types/react-dom": "^19.0.0",
|
|
57
61
|
"date-fns": "^4.1.0",
|
|
@@ -4,35 +4,6 @@ import { type FieldProps } from "@ostack.tech/ui";
|
|
|
4
4
|
export interface ControlFieldProps extends FieldProps {
|
|
5
5
|
/** Path of the field; inner control paths will be relative to this path. */
|
|
6
6
|
path?: string | Path;
|
|
7
|
-
/**
|
|
8
|
-
* Whether to show the control field.
|
|
9
|
-
*
|
|
10
|
-
* The component will, by default, automatically reset its inner controls when
|
|
11
|
-
* the control field becomes hidden.
|
|
12
|
-
*
|
|
13
|
-
* @default true
|
|
14
|
-
*/
|
|
15
|
-
shown?: boolean;
|
|
16
|
-
/**
|
|
17
|
-
* Whether to reset the inner controls when the control field becomes hidden.
|
|
18
|
-
*
|
|
19
|
-
* @default true
|
|
20
|
-
*/
|
|
21
|
-
resetOnHide?: boolean;
|
|
22
|
-
/**
|
|
23
|
-
* Whether to set inner controls as untouched when the control field becomes
|
|
24
|
-
* hidden.
|
|
25
|
-
*
|
|
26
|
-
* @default resetOnHide
|
|
27
|
-
*/
|
|
28
|
-
setUntouchedOnHide?: boolean;
|
|
29
|
-
/**
|
|
30
|
-
* Whether to set inner controls as pristine when the control field becomes
|
|
31
|
-
* hidden.
|
|
32
|
-
*
|
|
33
|
-
* @default resetOnHide
|
|
34
|
-
*/
|
|
35
|
-
setPristineOnHide?: boolean;
|
|
36
7
|
}
|
|
37
8
|
/**
|
|
38
9
|
* Component used to group controls with a label, helper text, and/or feedback.
|
|
@@ -45,5 +16,30 @@ export interface ControlFieldProps extends FieldProps {
|
|
|
45
16
|
*
|
|
46
17
|
* Aria descriptions and error messages are set on the control based on the
|
|
47
18
|
* provided helper texts or feedbacks.
|
|
19
|
+
*
|
|
20
|
+
* @deprecated Use the `@ostack.tech/ui` {@link Field} component instead. Set the
|
|
21
|
+
* `path` on the control directly instead.
|
|
22
|
+
*
|
|
23
|
+
* Change from:
|
|
24
|
+
*
|
|
25
|
+
* ```tsx
|
|
26
|
+
* <ControlField path="name">
|
|
27
|
+
* <Label>Name</Label>
|
|
28
|
+
* <TextControl />
|
|
29
|
+
* </ControlField>;
|
|
30
|
+
* ```
|
|
31
|
+
*
|
|
32
|
+
* To:
|
|
33
|
+
*
|
|
34
|
+
* ```tsx
|
|
35
|
+
* <Field>
|
|
36
|
+
* <Label>Name</Label>
|
|
37
|
+
* <TextControl path="name" />
|
|
38
|
+
* </Field>;
|
|
39
|
+
* ```
|
|
40
|
+
*
|
|
41
|
+
* If you were using `shown` (together with `resetOnHide`), use the
|
|
42
|
+
* `ResetOnChange` component or the `useResetOnChange` hook instead on the
|
|
43
|
+
* control that is the cause of the reset instead.
|
|
48
44
|
*/
|
|
49
|
-
export declare function ControlField({ path,
|
|
45
|
+
export declare function ControlField({ path, ...otherProps }: ControlFieldProps): import("react").JSX.Element;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AbsolutePath, type DisplayStatus, type Path, type SealedValidationIssue } from "@ostack.tech/kform";
|
|
1
|
+
import { AbsolutePath, type DisplayStatus, type Path, type Schema, type SealedValidationIssue } from "@ostack.tech/kform";
|
|
2
2
|
import { type ReactNode } from "react";
|
|
3
3
|
import type { FormPageObject } from "./FormPage.tsx";
|
|
4
4
|
import type { FormPagesProps } from "./FormPages.tsx";
|
|
@@ -11,6 +11,7 @@ export interface ResolvedFormPageObject extends FormPageObject {
|
|
|
11
11
|
/** Form page state. */
|
|
12
12
|
export interface FormPageState {
|
|
13
13
|
path: AbsolutePath;
|
|
14
|
+
schema: Schema;
|
|
14
15
|
exists: boolean;
|
|
15
16
|
deferredDisplayStatus: DisplayStatus | undefined;
|
|
16
17
|
deferredIssuesToDisplay: SealedValidationIssue[];
|
|
@@ -14,6 +14,11 @@ export interface IssueMessagesProps extends FeedbackListProps {
|
|
|
14
14
|
* component will query the issues from the form manager.
|
|
15
15
|
*/
|
|
16
16
|
issues?: SealedValidationIssue[];
|
|
17
|
+
/**
|
|
18
|
+
* Schema associated with the issues. If not provided, the component will
|
|
19
|
+
* query the schema from the form manager.
|
|
20
|
+
*/
|
|
21
|
+
schema?: Schema;
|
|
17
22
|
/** Mapping from an issue's code to its message. */
|
|
18
23
|
messages?: IssueMessagesByCode;
|
|
19
24
|
/**
|
|
@@ -79,4 +84,4 @@ export interface IssueMessagesProps extends FeedbackListProps {
|
|
|
79
84
|
* If `path` contains an issue without an associated issue message, a generic
|
|
80
85
|
* message is displayed together with a console warning.
|
|
81
86
|
*/
|
|
82
|
-
export declare function IssueMessages({ path, issues, messages, displayIssueCodes, messagesDataKey, visuallyHiddenErrorCodePrefix, visuallyHiddenWarningCodePrefix, unknownErrorMessage, unknownWarningMessage, unwrapped, ...otherProps }: IssueMessagesProps): import("react").JSX.Element;
|
|
87
|
+
export declare function IssueMessages({ path, issues, schema, messages, displayIssueCodes, messagesDataKey, visuallyHiddenErrorCodePrefix, visuallyHiddenWarningCodePrefix, unknownErrorMessage, unknownWarningMessage, unwrapped, ...otherProps }: IssueMessagesProps): import("react").JSX.Element;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { type ComponentProps } from "react";
|
|
2
|
+
import { type IssuesPopoverProps } from "../IssuesPopover";
|
|
2
3
|
/** Properties of the top bar component. */
|
|
3
4
|
export interface TopBarProps extends ComponentProps<"div"> {
|
|
5
|
+
globalIssuesProps?: IssuesPopoverProps;
|
|
4
6
|
}
|
|
5
7
|
/** Top bar component. */
|
|
6
|
-
export declare function TopBar({ className, ref, ...otherProps }: TopBarProps): import("react").JSX.Element;
|
|
8
|
+
export declare function TopBar({ className, ref, children, globalIssuesProps, ...otherProps }: TopBarProps): import("react").JSX.Element;
|
|
@@ -3,4 +3,4 @@ import { type ActionsProps } from "@ostack.tech/ui";
|
|
|
3
3
|
export interface TopBarActionsProps extends ActionsProps {
|
|
4
4
|
}
|
|
5
5
|
/** Container of the top bar actions. */
|
|
6
|
-
export declare function TopBarActions({ className, containerProps,
|
|
6
|
+
export declare function TopBarActions({ className, containerProps, ...otherProps }: TopBarActionsProps): import("react").JSX.Element;
|
package/types/index.d.ts
CHANGED
|
@@ -16,7 +16,7 @@ import type { SaveActionProps } from "../../components/SaveAction";
|
|
|
16
16
|
import type { SelectControlProps } from "../../components/SelectControl";
|
|
17
17
|
import type { SelectMultipleControlProps } from "../../components/SelectMultipleControl";
|
|
18
18
|
import type { SubmitActionProps } from "../../components/SubmitAction";
|
|
19
|
-
import type { TableControlAddRowTriggerChildlessProps, TableControlContentProps, TableControlIndexColumnProps, TableControlRemoveRowTriggerChildlessProps } from "../../components/TableControl";
|
|
19
|
+
import type { TableControlActionsColumnProps, TableControlAddRowTriggerChildlessProps, TableControlContentProps, TableControlIndexColumnProps, TableControlRemoveRowTriggerChildlessProps } from "../../components/TableControl";
|
|
20
20
|
import type { UnknownValueProps } from "../../components/UnknownValue";
|
|
21
21
|
import type { ValidateActionProps } from "../../components/ValidateAction";
|
|
22
22
|
/** Localization object representation. */
|
|
@@ -40,7 +40,7 @@ export interface LocalizationObject {
|
|
|
40
40
|
SelectMultipleControl: Pick<SelectMultipleControlProps, "unknownValueLabel">;
|
|
41
41
|
PrintAction: Pick<PrintActionProps, "label" | "keybinds">;
|
|
42
42
|
SubmitAction: Pick<SubmitActionProps, "label" | "keybinds" | "dialogTitle" | "dialogDescription" | "dialogBody" | "dialogOkText" | "dialogCancelText" | "confirmWarningsCheckboxLabel" | "successMessage" | "errorMessage">;
|
|
43
|
-
TableControlActionsColumn: Pick<
|
|
43
|
+
TableControlActionsColumn: Pick<TableControlActionsColumnProps, "label">;
|
|
44
44
|
TableControlAddRowTrigger: Pick<TableControlAddRowTriggerChildlessProps, "label">;
|
|
45
45
|
TableControlContent: Pick<TableControlContentProps, "emptyMessage">;
|
|
46
46
|
TableControlIndexColumn: Pick<TableControlIndexColumnProps, "label">;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { SealedValidationIssue } from "@ostack.tech/kform";
|
|
1
|
+
import type { Schema, SealedValidationIssue } from "@ostack.tech/kform";
|
|
2
2
|
import { type ControlVariant } from "@ostack.tech/ui";
|
|
3
3
|
import type { ReactNode } from "react";
|
|
4
4
|
import { type IssueMessagesByCode, type IssueMessagesProps } from "../components/IssueMessages";
|
|
@@ -7,7 +7,9 @@ export interface UseControlIssuesOptions {
|
|
|
7
7
|
/** Mapping from path to issues to display. */
|
|
8
8
|
issuesToDisplay: Record<string, SealedValidationIssue[]>;
|
|
9
9
|
/** Mapping from path to issue messages by code. */
|
|
10
|
-
issueMessages
|
|
10
|
+
issueMessages: Record<string, IssueMessagesByCode | undefined>;
|
|
11
|
+
/** Schemas of each path. */
|
|
12
|
+
schemas: Record<string, Schema>;
|
|
11
13
|
/** Whether issues should be displayed. */
|
|
12
14
|
displayIssues?: boolean;
|
|
13
15
|
/** Properties to pass to the `IssueMessages` component. */
|
|
@@ -29,4 +31,4 @@ export interface UseControlIssuesResult {
|
|
|
29
31
|
popoverIssues: ReactNode;
|
|
30
32
|
}
|
|
31
33
|
/** Hook which helps a control component render its issues. */
|
|
32
|
-
export declare function useControlIssues({ issuesToDisplay, issueMessages, displayIssues, issueMessagesProps, variant, }: UseControlIssuesOptions): UseControlIssuesResult;
|
|
34
|
+
export declare function useControlIssues({ issuesToDisplay, issueMessages, schemas, displayIssues, issueMessagesProps, variant, }: UseControlIssuesOptions): UseControlIssuesResult;
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import type { AbsolutePath, FormManager, Schema, SealedValidationIssue } from "@ostack.tech/kform";
|
|
2
|
-
import type { Controller } from "@ostack.tech/kform-react";
|
|
3
|
-
/** Value of the control field context. */
|
|
4
|
-
export type ControlFieldContextValue = ControlFieldStore;
|
|
5
|
-
/** State of the control field. */
|
|
6
|
-
export interface ControlFieldState {
|
|
7
|
-
controlStates: Record<string, ControlState>;
|
|
8
|
-
}
|
|
9
|
-
/** State of a control accessible to the whole field. */
|
|
10
|
-
export interface ControlState {
|
|
11
|
-
formManager: FormManager;
|
|
12
|
-
schema: Schema;
|
|
13
|
-
path: AbsolutePath;
|
|
14
|
-
exists: boolean;
|
|
15
|
-
deferredIssuesToDisplay: SealedValidationIssue[];
|
|
16
|
-
}
|
|
17
|
-
/** Control field store. */
|
|
18
|
-
export type ControlFieldStore = ReturnType<typeof useCreateControlFieldContext>;
|
|
19
|
-
/** Control field context. */
|
|
20
|
-
export declare const ControlFieldContext: import("react").Context<import("zustand").StoreApi<ControlFieldState> | null>;
|
|
21
|
-
/** Hook which creates the control field context value. */
|
|
22
|
-
export declare function useCreateControlFieldContext(): import("zustand").StoreApi<ControlFieldState>;
|
|
23
|
-
/** Hook that returns access to the control field's store. */
|
|
24
|
-
export declare function useControlFieldStore<T>(selector: (state: Partial<ControlFieldState>) => T): T;
|
|
25
|
-
/** Hook exposing whether a component is being rendered within a control field. */
|
|
26
|
-
export declare function useIsInControlField(): boolean;
|
|
27
|
-
/**
|
|
28
|
-
* Hook that makes a control field aware of a controller.
|
|
29
|
-
*
|
|
30
|
-
* The passed `controller` object should not be different on every render.
|
|
31
|
-
*/
|
|
32
|
-
export declare function useRegisterControllerWithinControlField<T = unknown>(controller: Controller<T>, deferredIssuesToDisplay: SealedValidationIssue[]): void;
|