@ostack.tech/ui-kform 0.10.4 → 0.11.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.
Files changed (30) hide show
  1. package/dist/chunks/{en-B9UXLueo.js → en-3JcwFYXc.js} +3 -3
  2. package/dist/chunks/{en-B9UXLueo.js.map → en-3JcwFYXc.js.map} +1 -1
  3. package/dist/locales/en-GB.js +1 -1
  4. package/dist/locales/en-US.js +1 -1
  5. package/dist/locales/fr-FR.js +2 -2
  6. package/dist/locales/fr-FR.js.map +1 -1
  7. package/dist/locales/pt-PT.js +2 -2
  8. package/dist/locales/pt-PT.js.map +1 -1
  9. package/dist/ostack-ui-kform.css +11 -8
  10. package/dist/ostack-ui-kform.js +97 -54
  11. package/dist/ostack-ui-kform.js.map +1 -1
  12. package/dist/types/components/Annexes/Annex.d.ts +3 -3
  13. package/dist/types/components/FormApp/FormApp.d.ts +8 -8
  14. package/dist/types/components/FormPages/FormPage.d.ts +3 -3
  15. package/dist/types/components/FormStepper/FormStep.d.ts +43 -6
  16. package/dist/types/components/FormStepper/FormStepButton.d.ts +8 -0
  17. package/dist/types/components/FormStepper/FormStepList.d.ts +1 -1
  18. package/dist/types/components/FormStepper/FormStepper.d.ts +1 -1
  19. package/dist/types/components/FormStepper/FormStepperFinishTrigger.d.ts +2 -0
  20. package/dist/types/components/FormStepper/FormStepperNextTrigger.d.ts +2 -0
  21. package/dist/types/components/FormStepper/FormStepperPreviousTrigger.d.ts +2 -0
  22. package/dist/types/components/FormStepper/FormStepperState.d.ts +3 -0
  23. package/dist/types/components/FormStepper/index.d.ts +4 -1
  24. package/dist/types/components/TableControl/TableControlAddRowTrigger.d.ts +24 -10
  25. package/dist/types/components/TableControl/TableControlRemoveRowTrigger.d.ts +21 -11
  26. package/dist/types/providers/LocalizationProvider/LocalizationObject.d.ts +3 -3
  27. package/package.json +2 -2
  28. package/scss/components/Annexes/_Annexes.scss +5 -1
  29. package/scss/components/FormPages/_FormPages.scss +2 -1
  30. package/dist/types/components/FormStepper/FormStepContent.d.ts +0 -20
@@ -17,9 +17,9 @@ export interface AnnexProps extends AnnexObject, Omit<ComponentPropsWithoutRef<t
17
17
  *
18
18
  * These messages are used by the `IssueMessages` component.
19
19
  *
20
- * **Note:** Changes to `issueMessages` are handled correctly, but are not
21
- * efficient. Please make sure that the identity of the provided value doesn't
22
- * change at every render.
20
+ * > **Note:** Changes to `issueMessages` are handled correctly, but are not
21
+ * > efficient. Please make sure that the identity of the provided value doesn't
22
+ * > change at every render.
23
23
  *
24
24
  * Example value:
25
25
  *
@@ -49,9 +49,9 @@ export type FormAppProps<T = any> = Pick<ComponentPropsWithoutRef<typeof Root>,
49
49
  *
50
50
  * These messages are used by the `IssueMessages` component.
51
51
  *
52
- * **Note:** Changes to `issueMessages` are handled correctly, but are not
53
- * efficient. Please make sure that the identity of the provided value
54
- * doesn't change at every render.
52
+ * > **Note:** Changes to `issueMessages` are handled correctly, but are not
53
+ * > efficient. Please make sure that the identity of the provided value
54
+ * > doesn't change at every render.
55
55
  *
56
56
  * Example value:
57
57
  *
@@ -76,7 +76,7 @@ export type FormAppProps<T = any> = Pick<ComponentPropsWithoutRef<typeof Root>,
76
76
  * for navigating issues.
77
77
  * - `panel` mode displays issue messages within the bottom issues panel.
78
78
  *
79
- * @default inline
79
+ * @default "inline"
80
80
  */
81
81
  issuesDisplayMode?: IssuesDisplayMode;
82
82
  /**
@@ -186,9 +186,9 @@ export declare const FormApp: import('react').ForwardRefExoticComponent<Pick<Omi
186
186
  *
187
187
  * These messages are used by the `IssueMessages` component.
188
188
  *
189
- * **Note:** Changes to `issueMessages` are handled correctly, but are not
190
- * efficient. Please make sure that the identity of the provided value
191
- * doesn't change at every render.
189
+ * > **Note:** Changes to `issueMessages` are handled correctly, but are not
190
+ * > efficient. Please make sure that the identity of the provided value
191
+ * > doesn't change at every render.
192
192
  *
193
193
  * Example value:
194
194
  *
@@ -213,7 +213,7 @@ export declare const FormApp: import('react').ForwardRefExoticComponent<Pick<Omi
213
213
  * for navigating issues.
214
214
  * - `panel` mode displays issue messages within the bottom issues panel.
215
215
  *
216
- * @default inline
216
+ * @default "inline"
217
217
  */
218
218
  issuesDisplayMode?: IssuesDisplayMode;
219
219
  /**
@@ -20,9 +20,9 @@ export interface FormPageProps extends FormPageObject, Omit<ComponentPropsWithou
20
20
  *
21
21
  * These messages are used by the `IssueMessages` component.
22
22
  *
23
- * **Note:** Changes to `issueMessages` are handled correctly, but are not
24
- * efficient. Please make sure that the identity of the provided value doesn't
25
- * change at every render.
23
+ * > **Note:** Changes to `issueMessages` are handled correctly, but are not
24
+ * > efficient. Please make sure that the identity of the provided value doesn't
25
+ * > change at every render.
26
26
  *
27
27
  * Example value:
28
28
  *
@@ -1,8 +1,45 @@
1
- import { AbsolutePath } from '@ostack.tech/kform';
1
+ import { ErrorBoundary, StepContent } from '@ostack.tech/ui';
2
+ import { ComponentPropsWithoutRef, ComponentPropsWithRef } from 'react';
3
+ import { IssueMessagesByCode } from '../IssueMessages';
4
+ import { FormStepObject } from './FormStepper.tsx';
2
5
  /** Properties of the form step component. */
3
- export interface FormStepProps {
4
- path: AbsolutePath;
5
- index: number;
6
+ export interface FormStepProps extends FormStepObject, Omit<ComponentPropsWithoutRef<typeof StepContent>, "index" | "title"> {
7
+ /** Sets the step as disabled. */
8
+ disabled?: boolean;
9
+ /** Sets the step as read-only. */
10
+ readOnly?: boolean;
11
+ /**
12
+ * Mapping of issue messages from the path of the field with issues to the
13
+ * issue messages of said field (which are themselves grouped by their code).
14
+ *
15
+ * Provided paths are relative to the form step's path and may contain
16
+ * wildcards, which will have a lower priority when matched against.
17
+ *
18
+ * These messages are used by the `IssueMessages` component.
19
+ *
20
+ * > **Note:** Changes to `issueMessages` are handled correctly, but are not
21
+ * > efficient. Please make sure that the identity of the provided value doesn't
22
+ * > change at every render.
23
+ *
24
+ * Example value:
25
+ *
26
+ * ```tsx
27
+ * {
28
+ * "**": {
29
+ * "valueMissing": "Field is required."
30
+ * },
31
+ * "field": {
32
+ * "valueMissing": "My field cannot be left empty!",
33
+ * "someOtherError": "Text of the other error."
34
+ * }
35
+ * }
36
+ * ```
37
+ */
38
+ issueMessages?: Record<string, IssueMessagesByCode>;
39
+ /** Properties to pass to the `ErrorBoundary` component. */
40
+ errorBoundaryProps?: ComponentPropsWithRef<typeof ErrorBoundary>;
6
41
  }
7
- /** Form step. */
8
- export declare function FormStep({ path, index }: FormStepProps): import("react/jsx-runtime").JSX.Element;
42
+ /** Single form step. */
43
+ export declare const FormStep: import('react').ForwardRefExoticComponent<FormStepProps & import('react').RefAttributes<HTMLDivElement>>;
44
+ /** @deprecated Use `FormStep` instead. */
45
+ export declare const FormStepContent: import('react').ForwardRefExoticComponent<FormStepProps & import('react').RefAttributes<HTMLDivElement>>;
@@ -0,0 +1,8 @@
1
+ import { AbsolutePath } from '@ostack.tech/kform';
2
+ /** Properties of the form step button component. */
3
+ export interface FormStepButtonProps {
4
+ path: AbsolutePath;
5
+ index: number;
6
+ }
7
+ /** Form step button. */
8
+ export declare function FormStepButton({ path, index }: FormStepButtonProps): import("react/jsx-runtime").JSX.Element;
@@ -4,4 +4,4 @@ import { ComponentPropsWithoutRef } from 'react';
4
4
  export interface FormStepListProps extends ComponentPropsWithoutRef<typeof StepList> {
5
5
  }
6
6
  /** Component displaying all form steps in a list. */
7
- export declare const FormStepList: import('react').ForwardRefExoticComponent<FormStepListProps & import('react').RefAttributes<HTMLDivElement>>;
7
+ export declare const FormStepList: import('react').ForwardRefExoticComponent<FormStepListProps & import('react').RefAttributes<HTMLOListElement>>;
@@ -6,7 +6,7 @@ export interface FormStepperProps extends Omit<ComponentPropsWithoutRef<typeof S
6
6
  /** Base path for all declared form steps. */
7
7
  path?: string | Path;
8
8
  /** List of all form steps. */
9
- steps: FormStepObject[];
9
+ steps?: FormStepObject[];
10
10
  /** Default active form step. */
11
11
  defaultActiveStep?: string | Path;
12
12
  /** Controlled active form step. */
@@ -0,0 +1,2 @@
1
+ /** Trigger used to conclude the form stepper. */
2
+ export declare const FormStepperFinishTrigger: import('react').ForwardRefExoticComponent<import('@ostack.tech/ui').StepperFinishTriggerProps & import('react').RefAttributes<HTMLButtonElement>>;
@@ -0,0 +1,2 @@
1
+ /** Trigger used to go to the next step of the form stepper. */
2
+ export declare const FormStepperNextTrigger: import('react').ForwardRefExoticComponent<import('@ostack.tech/ui').StepperNextTriggerProps & import('react').RefAttributes<HTMLButtonElement>>;
@@ -0,0 +1,2 @@
1
+ /** Trigger used to go to the previous step of the form stepper. */
2
+ export declare const FormStepperPreviousTrigger: import('react').ForwardRefExoticComponent<import('@ostack.tech/ui').StepperPreviousTriggerProps & import('react').RefAttributes<HTMLButtonElement>>;
@@ -0,0 +1,3 @@
1
+ import { StepperState } from '@ostack.tech/ui';
2
+ /** Component used to access the state of the form stepper and act on its API. */
3
+ export declare const FormStepperState: typeof StepperState;
@@ -1,4 +1,7 @@
1
- export * from './FormStepContent.tsx';
1
+ export * from './FormStep.tsx';
2
2
  export * from './FormStepList.tsx';
3
3
  export * from './FormStepper.tsx';
4
+ export * from './FormStepperFinishTrigger.tsx';
5
+ export * from './FormStepperNextTrigger.tsx';
6
+ export * from './FormStepperPreviousTrigger.tsx';
4
7
  export { FormStepRegistrar } from './FormStepRegistrar.tsx';
@@ -1,12 +1,9 @@
1
1
  import { Button } from '@ostack.tech/ui';
2
2
  import { ComponentPropsWithoutRef, ReactNode } from 'react';
3
3
  /** Properties of the table control add row trigger component. */
4
- export interface TableControlAddRowTriggerProps extends ComponentPropsWithoutRef<typeof Button<"button">> {
5
- /**
6
- * Text displayed on the button rendered by default when no `children` are
7
- * provided. If `children` are provided, this property has no effect.
8
- */
9
- defaultButtonText?: ReactNode;
4
+ export type TableControlAddRowTriggerProps = TableControlAddRowTriggerChildlessProps | TableControlAddRowTriggerChildrenProps;
5
+ /** Base properties of the table control add row trigger component. */
6
+ export interface TableControlAddRowTriggerPropsBase {
10
7
  /** Function called after the row has been added. */
11
8
  onRowAdded?: () => void;
12
9
  /**
@@ -30,9 +27,26 @@ export interface TableControlAddRowTriggerProps extends ComponentPropsWithoutRef
30
27
  showWhilePrinting?: boolean;
31
28
  }
32
29
  /**
33
- * Trigger used to add a new row to a table control.
34
- *
35
- * By default, it renders a button with text `defaultButtonText`, however, this
36
- * can be overriden by providing `children`.
30
+ * Properties of the table control add row trigger component when rendered
31
+ * without children.
37
32
  */
33
+ export interface TableControlAddRowTriggerChildlessProps extends TableControlAddRowTriggerPropsBase, Omit<ComponentPropsWithoutRef<typeof Button<"button">>, "asChild" | "children"> {
34
+ /** Label displayed on the button. */
35
+ label?: ReactNode;
36
+ /**
37
+ * Label displayed on the button.
38
+ *
39
+ * @deprecated Use `label` instead.
40
+ */
41
+ defaultButtonText?: ReactNode;
42
+ children?: never;
43
+ }
44
+ /**
45
+ * Properties of the table control add row trigger component when rendered with
46
+ * children.
47
+ */
48
+ export interface TableControlAddRowTriggerChildrenProps extends TableControlAddRowTriggerPropsBase, ComponentPropsWithoutRef<"button"> {
49
+ children: ReactNode;
50
+ }
51
+ /** Trigger used to add a new row to a table control. */
38
52
  export declare const TableControlAddRowTrigger: import('react').ForwardRefExoticComponent<TableControlAddRowTriggerProps & import('react').RefAttributes<HTMLButtonElement>>;
@@ -1,7 +1,9 @@
1
1
  import { IconButton } from '@ostack.tech/ui';
2
2
  import { ComponentPropsWithoutRef, ReactNode } from 'react';
3
3
  /** Properties of the table control remove row trigger component. */
4
- export interface TableControlRemoveRowTriggerProps extends Omit<Partial<ComponentPropsWithoutRef<typeof IconButton<"button">>>, "children"> {
4
+ export type TableControlRemoveRowTriggerProps = TableControlRemoveRowTriggerChildlessProps | TableControlRemoveRowTriggerChildrenProps;
5
+ /** Base properties of the table control remove row trigger component. */
6
+ export interface TableControlRemoveRowTriggerChildlessPropsBase {
5
7
  /**
6
8
  * Whether to show a confirmation message when removing a row.
7
9
  *
@@ -15,11 +17,6 @@ export interface TableControlRemoveRowTriggerProps extends Omit<Partial<Componen
15
17
  onConfirmRowRemoval?: () => void;
16
18
  /** Function called after the row has been removed. */
17
19
  onRowRemoved?: () => void;
18
- /**
19
- * Label displayed on the icon button rendered by default when no `children`
20
- * are provided. If `children` are provided, this property has no effect.
21
- */
22
- defaultButtonLabel?: ReactNode;
23
20
  /** Title of the confirmation dialog when `showConfirmation` is `true`. */
24
21
  confirmDialogTitle?: ReactNode;
25
22
  /**
@@ -44,13 +41,26 @@ export interface TableControlRemoveRowTriggerProps extends Omit<Partial<Componen
44
41
  * @default false
45
42
  */
46
43
  showWhenReadOnly?: boolean;
44
+ }
45
+ /**
46
+ * Base properties of the table control remove row trigger component when
47
+ * rendered without children.
48
+ */
49
+ export interface TableControlRemoveRowTriggerChildlessProps extends TableControlRemoveRowTriggerChildlessPropsBase, Omit<Partial<ComponentPropsWithoutRef<typeof IconButton<"button">>>, "asChild" | "children"> {
47
50
  /**
48
- * Children of the remove row trigger component. By default, it is an
49
- * `IconButton` with label `defaultButtonLabel`. A function can be optionally
50
- * passed as children which will receive an argument with whether the row is
51
- * currently being removed.
51
+ * Label of the icon button.
52
+ *
53
+ * @deprecated Use `label` instead.
52
54
  */
53
- children?: ReactNode;
55
+ defaultButtonLabel?: ReactNode;
56
+ children?: never;
57
+ }
58
+ /**
59
+ * Base properties of the table control remove row trigger component when
60
+ * rendered with children.
61
+ */
62
+ export interface TableControlRemoveRowTriggerChildrenProps extends TableControlRemoveRowTriggerChildlessPropsBase, Partial<ComponentPropsWithoutRef<"button">> {
63
+ children: ReactNode;
54
64
  }
55
65
  /**
56
66
  * Trigger used to remove a row of a table controlled by a table control.
@@ -11,7 +11,7 @@ import { LoadActionProps } from '../../components/LoadAction';
11
11
  import { PrintActionProps } from '../../components/PrintAction';
12
12
  import { SaveActionProps } from '../../components/SaveAction';
13
13
  import { SubmitActionProps } from '../../components/SubmitAction';
14
- import { TableControlAddRowTriggerProps, TableControlRemoveRowTriggerProps } from '../../components/TableControl';
14
+ import { TableControlAddRowTriggerChildlessProps, TableControlRemoveRowTriggerChildlessProps } from '../../components/TableControl';
15
15
  import { ValidateActionProps } from '../../components/ValidateAction';
16
16
  /** Localization object representation. */
17
17
  export interface LocalizationObject {
@@ -29,7 +29,7 @@ export interface LocalizationObject {
29
29
  SaveAction: Pick<SaveActionProps, "label" | "keybinds" | "saveOptionsLabel" | "saveAsLabel" | "saveAsKeybinds" | "successMessage" | "errorMessage">;
30
30
  PrintAction: Pick<PrintActionProps, "label" | "keybinds">;
31
31
  SubmitAction: Pick<SubmitActionProps, "label" | "keybinds" | "dialogTitle" | "dialogDescription" | "dialogBody" | "dialogOkText" | "dialogCancelText" | "confirmWarningsCheckboxLabel" | "successMessage" | "errorMessage">;
32
- TableControlAddRowTrigger: Pick<TableControlAddRowTriggerProps, "defaultButtonText">;
33
- TableControlRemoveRowTrigger: Pick<TableControlRemoveRowTriggerProps, "defaultButtonLabel" | "confirmDialogTitle" | "confirmDialogMessage" | "confirmDialogOkText" | "confirmDialogCancelText">;
32
+ TableControlAddRowTrigger: Pick<TableControlAddRowTriggerChildlessProps, "label">;
33
+ TableControlRemoveRowTrigger: Pick<TableControlRemoveRowTriggerChildlessProps, "label" | "confirmDialogTitle" | "confirmDialogMessage" | "confirmDialogOkText" | "confirmDialogCancelText">;
34
34
  ValidateAction: Pick<ValidateActionProps, "label" | "keybinds">;
35
35
  }
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.10.4",
4
+ "version": "0.11.0",
5
5
  "homepage": "https://ui.ostack.tech/",
6
6
  "author": {
7
7
  "name": "Opensoft",
@@ -50,7 +50,7 @@
50
50
  "@fortawesome/free-solid-svg-icons": "^6.2.0 || ^7.0.0",
51
51
  "@ostack.tech/kform": "~0.32.0",
52
52
  "@ostack.tech/kform-react": "~0.32.0",
53
- "@ostack.tech/ui": "~0.10.4",
53
+ "@ostack.tech/ui": "~0.11.0",
54
54
  "@types/react": "^18.0.0 || ^19.0.0",
55
55
  "@types/react-dom": "^18.0.0 || ^19.0.0",
56
56
  "date-fns": "^4.1.0",
@@ -160,9 +160,13 @@
160
160
  }
161
161
 
162
162
  &__tab-inner {
163
+ min-height: $tab-height;
164
+ }
165
+
166
+ &__tab-text {
167
+ display: flex;
163
168
  flex-direction: column;
164
169
  height: 100%;
165
- min-height: $tab-height;
166
170
  }
167
171
 
168
172
  &__tab-title,
@@ -272,7 +272,8 @@
272
272
  var(--radix-popover-content-available-width)
273
273
  );
274
274
  max-height: min(600px, var(--radix-popover-content-available-height));
275
- padding: ostack-ui.spacing(1) ostack-ui.spacing(2);
275
+ padding: ostack-ui.$label-helper-popover-padding-y
276
+ ostack-ui.$label-helper-popover-padding-x;
276
277
  }
277
278
 
278
279
  &__page-content {
@@ -1,20 +0,0 @@
1
- import { Path } from '@ostack.tech/kform';
2
- import { ErrorBoundary, StepContent } from '@ostack.tech/ui';
3
- import { ComponentPropsWithoutRef, ComponentPropsWithRef, ReactNode } from 'react';
4
- /** Properties of the form step content component. */
5
- export interface FormStepContentProps extends Omit<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?: ComponentPropsWithRef<typeof ErrorBoundary>;
17
- children?: ReactNode;
18
- }
19
- /** Component containing the content of a form step. */
20
- export declare const FormStepContent: import('react').ForwardRefExoticComponent<FormStepContentProps & import('react').RefAttributes<HTMLDivElement>>;