@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.
Files changed (111) hide show
  1. package/dist/chunks/{en-CaLvO1z0.js → en-CKrk2smU.js} +14 -5
  2. package/dist/chunks/en-CKrk2smU.js.map +1 -0
  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 +21 -12
  6. package/dist/locales/fr-FR.js.map +1 -1
  7. package/dist/locales/pt-PT.js +13 -4
  8. package/dist/locales/pt-PT.js.map +1 -1
  9. package/dist/ostack-ui-kform.css +13 -0
  10. package/dist/ostack-ui-kform.js +1806 -709
  11. package/dist/ostack-ui-kform.js.map +1 -1
  12. package/package.json +6 -5
  13. package/scss/_utils.scss +1 -0
  14. package/scss/components/FormPages/_FormPages.scss +8 -0
  15. package/scss/components/SubmitAction/_SubmitAction-variables.scss +3 -0
  16. package/scss/components/SubmitAction/_SubmitAction.scss +13 -0
  17. package/scss/index.scss +1 -0
  18. package/types/components/Annexes/Annex.d.ts +71 -7
  19. package/types/components/Annexes/Annexes.d.ts +49 -65
  20. package/types/components/Annexes/AnnexesContext.d.ts +2 -1
  21. package/types/components/Annexes/AnnexesManager.d.ts +15 -10
  22. package/types/components/Annexes/AnnexesMenu.d.ts +5 -6
  23. package/types/components/Annexes/AnnexesTabList.d.ts +3 -4
  24. package/types/components/CheckboxControl/CheckboxControl.d.ts +38 -9
  25. package/types/components/CheckboxGroupControl/CheckboxGroupControl.d.ts +64 -22
  26. package/types/components/CheckboxGroupControl/CheckboxGroupControlItem.d.ts +26 -0
  27. package/types/components/CheckboxGroupControl/index.d.ts +1 -0
  28. package/types/components/ControlField/ControlField.d.ts +3 -4
  29. package/types/components/DateControl/DateControl.d.ts +38 -8
  30. package/types/components/DateRangeControl/DateRangeControl.d.ts +56 -24
  31. package/types/components/DebugInfo/DebugInfo.d.ts +26 -0
  32. package/types/components/DebugInfo/DebugInfoControlAddonTrigger.d.ts +9 -0
  33. package/types/components/DebugInfo/index.d.ts +2 -0
  34. package/types/components/FileControl/FileControl.d.ts +37 -8
  35. package/types/components/FileControl/FileControlDownloadAddon.d.ts +8 -0
  36. package/types/components/FileControl/FileControlViewAddon.d.ts +10 -0
  37. package/types/components/FormApp/FormApp.d.ts +60 -139
  38. package/types/components/FormApp/FormAppContext.d.ts +13 -3
  39. package/types/components/FormApp/FormAppElement.d.ts +3 -3
  40. package/types/components/FormApp/index.d.ts +1 -1
  41. package/types/components/FormPages/FormPage.d.ts +38 -20
  42. package/types/components/FormPages/FormPageHeader.d.ts +3 -3
  43. package/types/components/FormPages/FormPages.d.ts +45 -24
  44. package/types/components/FormPages/FormPagesContext.d.ts +2 -1
  45. package/types/components/FormPages/FormPagesNavigation.d.ts +11 -8
  46. package/types/components/FormPages/FormPagesSelect.d.ts +1 -1
  47. package/types/components/FormPages/FormPagesSidebar.d.ts +3 -3
  48. package/types/components/FormStepper/FormStep.d.ts +23 -7
  49. package/types/components/FormStepper/FormStepList.d.ts +3 -4
  50. package/types/components/FormStepper/FormStepper.d.ts +52 -21
  51. package/types/components/FormStepper/FormStepperContext.d.ts +2 -1
  52. package/types/components/FormStepper/FormStepperFinishTrigger.d.ts +4 -1
  53. package/types/components/FormStepper/FormStepperNextTrigger.d.ts +4 -1
  54. package/types/components/FormStepper/FormStepperPreviousTrigger.d.ts +4 -1
  55. package/types/components/FormStepper/FormStepperState.d.ts +3 -1
  56. package/types/components/IssueMessage/IssueMessage.d.ts +2 -2
  57. package/types/components/IssueMessages/IssueMessages.d.ts +4 -4
  58. package/types/components/IssuesAlert/IssuesAlert.d.ts +4 -5
  59. package/types/components/IssuesPanel/IssuesPanel.d.ts +18 -18
  60. package/types/components/IssuesPanel/IssuesPanelMessagesCard.d.ts +4 -4
  61. package/types/components/IssuesPanel/IssuesPanelSummaryCard.d.ts +4 -4
  62. package/types/components/IssuesPopover/IssuesPopover.d.ts +3 -4
  63. package/types/components/LoadAction/LoadAction.d.ts +34 -4
  64. package/types/components/NumericControl/NumericControl.d.ts +56 -8
  65. package/types/components/PathLink/PathLink.d.ts +2 -2
  66. package/types/components/PrintAction/PrintAction.d.ts +41 -16
  67. package/types/components/RadioGroupControl/RadioGroupControl.d.ts +54 -19
  68. package/types/components/RadioGroupControl/RadioGroupControlItem.d.ts +25 -0
  69. package/types/components/RadioGroupControl/index.d.ts +1 -0
  70. package/types/components/SaveAction/SaveAction.d.ts +45 -7
  71. package/types/components/SelectControl/SelectControl.d.ts +55 -10
  72. package/types/components/SelectControl/SelectControlItem.d.ts +23 -0
  73. package/types/components/SelectControl/SelectControlItemGroup.d.ts +23 -0
  74. package/types/components/SelectControl/index.d.ts +2 -0
  75. package/types/components/SelectMultipleControl/SelectMultipleControl.d.ts +71 -14
  76. package/types/components/SelectMultipleControl/SelectMultipleControlItem.d.ts +13 -0
  77. package/types/components/SelectMultipleControl/SelectMultipleControlItemGroup.d.ts +13 -0
  78. package/types/components/SelectMultipleControl/index.d.ts +2 -0
  79. package/types/components/SubmitAction/SubmitAction.d.ts +50 -14
  80. package/types/components/TableControl/TableControl.d.ts +108 -13
  81. package/types/components/TableControl/TableControlActionsColumn.d.ts +21 -0
  82. package/types/components/TableControl/TableControlActionsColumnLabel.d.ts +2 -0
  83. package/types/components/TableControl/TableControlAddRowTrigger.d.ts +12 -5
  84. package/types/components/TableControl/TableControlCell.d.ts +3 -4
  85. package/types/components/TableControl/TableControlColumn.d.ts +24 -56
  86. package/types/components/TableControl/TableControlColumnFns.d.ts +113 -0
  87. package/types/components/TableControl/TableControlColumnGroup.d.ts +25 -0
  88. package/types/components/TableControl/TableControlColumns.d.ts +14 -0
  89. package/types/components/TableControl/TableControlContent.d.ts +3 -4
  90. package/types/components/TableControl/TableControlContext.d.ts +2 -1
  91. package/types/components/TableControl/TableControlIndexColumn.d.ts +10 -0
  92. package/types/components/TableControl/TableControlIndexColumnLabel.d.ts +2 -0
  93. package/types/components/TableControl/TableControlPagination.d.ts +4 -1
  94. package/types/components/TableControl/TableControlRemoveRowTrigger.d.ts +5 -5
  95. package/types/components/TableControl/TableControlRow.d.ts +11 -4
  96. package/types/components/TableControl/TableControlRowsPerPage.d.ts +4 -1
  97. package/types/components/TableControl/index.d.ts +6 -0
  98. package/types/components/TextControl/TextControl.d.ts +47 -21
  99. package/types/components/TopBar/TopBar.d.ts +3 -3
  100. package/types/components/TopBar/TopBarActions.d.ts +3 -4
  101. package/types/components/ValidateAction/ValidateAction.d.ts +24 -2
  102. package/types/index.d.ts +1 -0
  103. package/types/providers/LocalizationProvider/LocalizationObject.d.ts +5 -1
  104. package/types/utils/__tests__/pathSpecificity.test.d.ts +1 -0
  105. package/types/utils/options.d.ts +13 -18
  106. package/types/utils/promiseUtils.d.ts +7 -0
  107. package/types/utils/selectionTransformations.d.ts +9 -9
  108. package/types/utils/useControlIssues.d.ts +21 -19
  109. package/types/utils/useFormLoader.d.ts +7 -1
  110. package/types/utils/useFormSaver.d.ts +3 -3
  111. package/dist/chunks/en-CaLvO1z0.js.map +0 -1
@@ -1,8 +1,7 @@
1
1
  import { Path } from "@ostack.tech/kform";
2
- import { Field } from "@ostack.tech/ui";
3
- import { type ComponentPropsWithoutRef } from "react";
2
+ import { type FieldProps } from "@ostack.tech/ui";
4
3
  /** Properties of the control field component. */
5
- export interface ControlFieldProps extends ComponentPropsWithoutRef<typeof Field> {
4
+ export interface ControlFieldProps extends FieldProps {
6
5
  /** Path of the field; inner control paths will be relative to this path. */
7
6
  path?: string | Path;
8
7
  /**
@@ -47,4 +46,4 @@ export interface ControlFieldProps extends ComponentPropsWithoutRef<typeof Field
47
46
  * Aria descriptions and error messages are set on the control based on the
48
47
  * provided helper texts or feedbacks.
49
48
  */
50
- export declare const ControlField: import("react").ForwardRefExoticComponent<ControlFieldProps & import("react").RefAttributes<HTMLDivElement>>;
49
+ export declare function ControlField({ path, shown, resetOnHide, setUntouchedOnHide, setPristineOnHide, ...otherProps }: ControlFieldProps): false | import("react").JSX.Element;
@@ -1,10 +1,10 @@
1
1
  import type { Path } from "@ostack.tech/kform";
2
2
  import { type Temporal, type TemporalInputController, type TemporalInputOptions } from "@ostack.tech/kform-react";
3
- import { DateInput } from "@ostack.tech/ui";
4
- import { type ComponentPropsWithoutRef, type ComponentPropsWithRef, type ComponentRef, type ReactNode, type Ref } from "react";
5
- import type { IssueMessages, IssueMessagesByCode } from "../IssueMessages";
3
+ import { DateInput, type DateInputProps } 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 date control component. */
7
- export interface DateControlProps<T extends Temporal | null = Temporal | null> extends Omit<TemporalInputOptions<T, string, ComponentRef<typeof DateInput>>, "enabled" | "formatFromString" | "parseToString">, Omit<ComponentPropsWithoutRef<typeof DateInput>, "defaultValue" | "value" | "onValueChange" | "status" | "validate" | "validationMode"> {
7
+ export interface DateControlProps<T extends Temporal | null = Temporal | null> extends Omit<TemporalInputOptions<T, string, ComponentRef<typeof DateInput>>, "enabled" | "formatFromString" | "parseToString">, Omit<DateInputProps, "defaultValue" | "value" | "onValueChange" | "status" | "validate" | "validationMode"> {
8
8
  /** Path to the value. */
9
9
  path?: string | Path;
10
10
  /**
@@ -17,7 +17,7 @@ export interface DateControlProps<T extends Temporal | null = Temporal | null> e
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 `ControlLabel`.
20
+ * This label has priority over the field's `Label`.
21
21
  */
22
22
  issuesPanelLabel?: ReactNode;
23
23
  /**
@@ -36,10 +36,40 @@ export interface DateControlProps<T extends Temporal | null = Temporal | null> e
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<TemporalInputController<T, string, ComponentRef<typeof DateInput>> | undefined>;
41
46
  /** Properties to pass to the `IssueMessages` component. */
42
- issueMessagesProps?: Omit<ComponentPropsWithRef<typeof IssueMessages>, "path" | "issues" | "messages" | "unwrapped">;
47
+ issueMessagesProps?: Omit<IssueMessagesProps, "path" | "issues" | "messages" | "unwrapped">;
43
48
  }
44
- /** Date control component supporting nullable temporal schemas. */
45
- export declare const DateControl: import("react").ForwardRefExoticComponent<DateControlProps<Temporal | null> & import("react").RefAttributes<HTMLInputElement>>;
49
+ /**
50
+ * The date control component is a KForm form control for values with (typically
51
+ * nullable) schemas of type
52
+ * [`LocalDateSchema`](https://kform.ostack.tech/api/packages/kform/tech.ostack.kform.schemas/-local-date-schema/index.html)
53
+ * or
54
+ * [`StringSchema`](https://kform.ostack.tech/api/packages/kform/tech.ostack.kform.schemas/-string-schema/index.html).
55
+ * It is built on top of the
56
+ * [`DateInput`](/docs/ostack-ui-forms-date-input--docs) component.
57
+ *
58
+ * The following built-in KForm validations affect this control:
59
+ *
60
+ * - [`Required`](https://kform.ostack.tech/api/packages/kform/tech.ostack.kform.validations/-required/index.html):
61
+ * Sets the `required` property.
62
+ * - [`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):
63
+ * Sets the `minDate`/`maxDate` properties.
64
+ *
65
+ * Example usage:
66
+ *
67
+ * ```tsx
68
+ * import { DateControl } from "@ostack.tech/ui-kform";
69
+ *
70
+ * function ProjectDueDateControl() {
71
+ * return <DateControl path="/dueDate" />;
72
+ * }
73
+ * ```
74
+ */
75
+ export declare function DateControl<T extends Temporal | null = Temporal | null>({ path, issueMessages, issuesPanelLabel, displayIssues, preventAutoFocus, apiRef, issueMessagesProps, formManager, onInitialized, onFormManagerEvent, onValueChange, onValidationStatusChange, onDisplayStatusChange, onDirtyStatusChange, onTouchedStatusChange, format: dateFormat, required, minDate, maxDate, loading, showSpinner, disabled, readOnly, onFocus, onBlurToOutside, endAdornment, debug, ref, ...otherProps }: DateControlProps<T>): import("react").JSX.Element;
@@ -1,10 +1,10 @@
1
1
  import type { Path } from "@ostack.tech/kform";
2
2
  import { type Temporal, type TemporalInputController, type TemporalInputOptions } from "@ostack.tech/kform-react";
3
- import { DateRangeInput } from "@ostack.tech/ui";
4
- import { type ComponentPropsWithoutRef, type ComponentPropsWithRef, type ReactNode, type Ref } from "react";
5
- import type { IssueMessages, IssueMessagesByCode } from "../IssueMessages";
3
+ import { type DateRangeInputProps } from "@ostack.tech/ui";
4
+ import { type ReactNode, type Ref } from "react";
5
+ import type { IssueMessagesByCode, IssueMessagesProps } from "../IssueMessages";
6
6
  /** Properties of the date-range control component. */
7
- export interface DateRangeControlProps<TStart extends Temporal | null = Temporal | null, TEnd extends Temporal | null = TStart> extends Omit<ComponentPropsWithoutRef<typeof DateRangeInput>, "defaultValue" | "value" | "validate" | "validationMode"> {
7
+ export interface DateRangeControlProps<TStart extends Temporal | null = Temporal | null, TEnd extends Temporal | null = TStart> extends Omit<DateRangeInputProps, "defaultValue" | "value" | "validate" | "validationMode"> {
8
8
  /** Path to the start value. */
9
9
  startPath: string | Path;
10
10
  /** Path to the end value. */
@@ -25,7 +25,7 @@ export interface DateRangeControlProps<TStart extends Temporal | null = Temporal
25
25
  * Label to use in the issues panel when displaying issues associated with
26
26
  * this field.
27
27
  *
28
- * This label has priority over the field's `ControlLabel`.
28
+ * This label has priority over the field's `Label`.
29
29
  */
30
30
  issuesPanelLabel?: ReactNode;
31
31
  /**
@@ -54,26 +54,58 @@ export interface DateRangeControlProps<TStart extends Temporal | null = Temporal
54
54
  * @default false
55
55
  */
56
56
  preventAutoFocus?: boolean;
57
+ /**
58
+ * Whether to show debug information. This property has no effect in
59
+ * production builds.
60
+ */
61
+ debug?: boolean;
57
62
  /** Reference to the start control's API. */
58
- startApiRef?: Ref<TemporalInputController<TStart, string> | undefined>;
63
+ startApiRef?: Ref<TemporalInputController<TStart> | undefined>;
59
64
  /** Reference to the end control's API. */
60
- endApiRef?: Ref<TemporalInputController<TEnd, string> | undefined>;
65
+ endApiRef?: Ref<TemporalInputController<TEnd> | undefined>;
61
66
  /** Properties to pass to the `IssueMessages` component. */
62
- issueMessagesProps?: Omit<ComponentPropsWithRef<typeof IssueMessages>, "path" | "issues" | "messages" | "unwrapped">;
63
- onStartInitialized?: TemporalInputOptions<TStart, string>["onInitialized"];
64
- onStartFormManagerEvent?: TemporalInputOptions<TStart, string>["onFormManagerEvent"];
65
- onStartValueChange?: TemporalInputOptions<TStart, string>["onValueChange"];
66
- onStartValidationStatusChange?: TemporalInputOptions<TStart, string>["onValidationStatusChange"];
67
- onStartDisplayStatusChange?: TemporalInputOptions<TStart, string>["onDisplayStatusChange"];
68
- onStartDirtyStatusChange?: TemporalInputOptions<TStart, string>["onDirtyStatusChange"];
69
- onStartTouchedStatusChange?: TemporalInputOptions<TStart, string>["onTouchedStatusChange"];
70
- onEndInitialized?: TemporalInputOptions<TEnd, string>["onInitialized"];
71
- onEndFormManagerEvent?: TemporalInputOptions<TEnd, string>["onFormManagerEvent"];
72
- onEndValueChange?: TemporalInputOptions<TEnd, string>["onValueChange"];
73
- onEndValidationStatusChange?: TemporalInputOptions<TEnd, string>["onValidationStatusChange"];
74
- onEndDisplayStatusChange?: TemporalInputOptions<TEnd, string>["onDisplayStatusChange"];
75
- onEndDirtyStatusChange?: TemporalInputOptions<TEnd, string>["onDirtyStatusChange"];
76
- onEndTouchedStatusChange?: TemporalInputOptions<TEnd, string>["onTouchedStatusChange"];
67
+ issueMessagesProps?: Omit<IssueMessagesProps, "path" | "issues" | "messages" | "unwrapped">;
68
+ onStartInitialized?: TemporalInputOptions<TStart>["onInitialized"];
69
+ onStartFormManagerEvent?: TemporalInputOptions<TStart>["onFormManagerEvent"];
70
+ onStartValueChange?: TemporalInputOptions<TStart>["onValueChange"];
71
+ onStartValidationStatusChange?: TemporalInputOptions<TStart>["onValidationStatusChange"];
72
+ onStartDisplayStatusChange?: TemporalInputOptions<TStart>["onDisplayStatusChange"];
73
+ onStartDirtyStatusChange?: TemporalInputOptions<TStart>["onDirtyStatusChange"];
74
+ onStartTouchedStatusChange?: TemporalInputOptions<TStart>["onTouchedStatusChange"];
75
+ onEndInitialized?: TemporalInputOptions<TEnd>["onInitialized"];
76
+ onEndFormManagerEvent?: TemporalInputOptions<TEnd>["onFormManagerEvent"];
77
+ onEndValueChange?: TemporalInputOptions<TEnd>["onValueChange"];
78
+ onEndValidationStatusChange?: TemporalInputOptions<TEnd>["onValidationStatusChange"];
79
+ onEndDisplayStatusChange?: TemporalInputOptions<TEnd>["onDisplayStatusChange"];
80
+ onEndDirtyStatusChange?: TemporalInputOptions<TEnd>["onDirtyStatusChange"];
81
+ onEndTouchedStatusChange?: TemporalInputOptions<TEnd>["onTouchedStatusChange"];
77
82
  }
78
- /** Date-range control component supporting nullable temporal schemas. */
79
- export declare const DateRangeControl: import("react").ForwardRefExoticComponent<DateRangeControlProps<Temporal | null, Temporal | null> & import("react").RefAttributes<HTMLDivElement>>;
83
+ /**
84
+ * The date-range control component is a KForm form control for pairs of values
85
+ * (start and end dates) with (typically nullable) schemas of type
86
+ * [`LocalDateSchema`](https://kform.ostack.tech/api/packages/kform/tech.ostack.kform.schemas/-local-date-schema/index.html)
87
+ * or
88
+ * [`StringSchema`](https://kform.ostack.tech/api/packages/kform/tech.ostack.kform.schemas/-string-schema/index.html).
89
+ * It is built on top of the
90
+ * [`DateRangeInput`](/docs/ostack-ui-forms-date-range-input--docs) component.
91
+ *
92
+ * The following built-in KForm validations affect this control:
93
+ *
94
+ * - [`Required`](https://kform.ostack.tech/api/packages/kform/tech.ostack.kform.validations/-required/index.html):
95
+ * Sets the `required` property.
96
+ * - [`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):
97
+ * Sets the `minDate`/`maxDate` properties.
98
+ *
99
+ * Example usage:
100
+ *
101
+ * ```tsx
102
+ * import { DateRangeControl } from "@ostack.tech/ui-kform";
103
+ *
104
+ * function ReservationDatesControl() {
105
+ * return (
106
+ * <DateRangeControl startPath="/checkInDate" endPath="/checkOutDate" />
107
+ * );
108
+ * }
109
+ * ```
110
+ */
111
+ export declare function DateRangeControl<TStart extends Temporal | null = Temporal | null, TEnd extends Temporal | null = TStart>({ startPath, endPath, startIssueMessages, endIssueMessages, issuesPanelLabel, issuesPanelStartLabelSuffix, issuesPanelEndLabelSuffix, displayIssues, preventAutoFocus, startApiRef, endApiRef, issueMessagesProps, required, minDate, maxDate, loading, showSpinners, showStartSpinner, showEndSpinner, disabled, readOnly, startInputProps, endInputProps, onStartInitialized, onStartFormManagerEvent, onStartValueChange, onStartValidationStatusChange, onStartDisplayStatusChange, onStartDirtyStatusChange, onStartTouchedStatusChange, onEndInitialized, onEndFormManagerEvent, onEndValueChange, onEndValidationStatusChange, onEndDisplayStatusChange, onEndDirtyStatusChange, onEndTouchedStatusChange, onValueChange, format: dateFormat, onBlurToOutside, startMiddleAdornment, endAdornment, debug, ...otherProps }: DateRangeControlProps<TStart, TEnd>): import("react").JSX.Element;
@@ -0,0 +1,26 @@
1
+ import { Path } from "@ostack.tech/kform";
2
+ import { type FormatterControllerState } from "@ostack.tech/kform-react";
3
+ import { type IconButtonProps } from "@ostack.tech/ui";
4
+ import { type ReactElement, type ReactNode } from "react";
5
+ /** Properties of the debug info component. */
6
+ export interface DebugInfoProps<T = unknown, TFormatted extends ReactNode = string> extends Partial<IconButtonProps> {
7
+ defaultOpen?: boolean;
8
+ open?: boolean;
9
+ onOpenChange?: (open: boolean) => void;
10
+ /** Path of the value to debug. */
11
+ path?: string | Path;
12
+ /**
13
+ * Format function that transforms the form manager value to debug into a
14
+ * value to be output. The passed {@link value} is `undefined` when the form
15
+ * manager value does not exist.
16
+ *
17
+ * @param value Form manager value to transform.
18
+ * @param state Controller's state.
19
+ * @returns Transformed value.
20
+ */
21
+ format?: (value: T | undefined, state: FormatterControllerState<T, TFormatted>) => TFormatted;
22
+ /** Trigger used to toggle the debug info popover. */
23
+ children?: ReactElement;
24
+ }
25
+ /** Debug information. */
26
+ export declare function DebugInfo<T = unknown, TFormatted extends ReactNode = string>({ defaultOpen, open, onOpenChange, path, format, children, label, ...otherProps }: DebugInfoProps<T, TFormatted>): import("react").JSX.Element | null;
@@ -0,0 +1,9 @@
1
+ import { type ControlAddonProps } from "@ostack.tech/ui";
2
+ import type { ReactNode } from "react";
3
+ /** Properties of the debug info control addon trigger component. */
4
+ export interface DebugInfoControlAddonTriggerProps extends Partial<ControlAddonProps<"button">> {
5
+ /** Label of the button used to trigger the debug information. */
6
+ label?: ReactNode;
7
+ }
8
+ /** Debug info trigger as a control addon. */
9
+ export declare function DebugInfoControlAddonTrigger({ label, ...otherProps }: DebugInfoControlAddonTriggerProps): import("react").JSX.Element;
@@ -0,0 +1,2 @@
1
+ export * from "./DebugInfo.tsx";
2
+ export * from "./DebugInfoControlAddonTrigger.tsx";
@@ -1,8 +1,8 @@
1
1
  import type { File as KFormFile, Path } from "@ostack.tech/kform";
2
2
  import { type FileInputController, type FileInputOptions } from "@ostack.tech/kform-react";
3
- import { Input } from "@ostack.tech/ui";
4
- import { type ComponentPropsWithoutRef, type ComponentPropsWithRef, type ComponentRef, type ReactNode, type Ref } from "react";
5
- import type { IssueMessages, IssueMessagesByCode } from "../IssueMessages";
3
+ import { Input, type InputProps } from "@ostack.tech/ui";
4
+ import { type ComponentRef, type ReactNode, type Ref } from "react";
5
+ import type { IssueMessagesByCode, IssueMessagesProps } from "../IssueMessages";
6
6
  /**
7
7
  * File control's interaction with the selected file:
8
8
  *
@@ -15,7 +15,7 @@ import type { IssueMessages, IssueMessagesByCode } from "../IssueMessages";
15
15
  */
16
16
  export type FileControlFileInteraction = "view" | "download" | "none";
17
17
  /** Properties of the file control component. */
18
- export interface FileControlProps<T extends KFormFile | null = KFormFile | null> extends Omit<FileInputOptions<T, File | null, ComponentRef<typeof Input>>, "enabled" | "formatFromJsFile" | "parseToJsFile">, Omit<ComponentPropsWithoutRef<typeof Input>, "type" | "multiple" | "defaultValue" | "value" | "onValueChange" | "status" | "align" | "validate" | "validationMode"> {
18
+ export interface FileControlProps<T extends KFormFile | null = KFormFile | null> extends Omit<FileInputOptions<T, File | null, ComponentRef<typeof Input>>, "enabled" | "formatFromJsFile" | "parseToJsFile">, Omit<InputProps, "type" | "multiple" | "defaultValue" | "value" | "onValueChange" | "status" | "align" | "validate" | "validationMode"> {
19
19
  /** Path to the value. */
20
20
  path?: string | Path;
21
21
  /**
@@ -28,7 +28,7 @@ export interface FileControlProps<T extends KFormFile | null = KFormFile | null>
28
28
  * Label to use in the issues panel when displaying issues associated with
29
29
  * this field.
30
30
  *
31
- * This label has priority over the field's `ControlLabel`.
31
+ * This label has priority over the field's `Label`.
32
32
  */
33
33
  issuesPanelLabel?: ReactNode;
34
34
  /**
@@ -47,6 +47,11 @@ export interface FileControlProps<T extends KFormFile | null = KFormFile | null>
47
47
  * @default false
48
48
  */
49
49
  preventAutoFocus?: boolean;
50
+ /**
51
+ * Whether to show debug information. This property has no effect in
52
+ * production builds.
53
+ */
54
+ debug?: boolean;
50
55
  /** Reference to the control's API. */
51
56
  apiRef?: Ref<FileInputController<T, File | null, ComponentRef<typeof Input>> | undefined>;
52
57
  /**
@@ -62,7 +67,31 @@ export interface FileControlProps<T extends KFormFile | null = KFormFile | null>
62
67
  /** Text displayed when the file cannot be viewed. */
63
68
  fallbackText?: ReactNode;
64
69
  /** Properties to pass to the `IssueMessages` component. */
65
- issueMessagesProps?: Omit<ComponentPropsWithRef<typeof IssueMessages>, "path" | "issues" | "messages" | "unwrapped">;
70
+ issueMessagesProps?: Omit<IssueMessagesProps, "path" | "issues" | "messages" | "unwrapped">;
66
71
  }
67
- /** File control component supporting (possibly nullable) file schemas. */
68
- export declare const FileControl: import("react").ForwardRefExoticComponent<FileControlProps<KFormFile | null> & import("react").RefAttributes<HTMLInputElement>>;
72
+ /**
73
+ * The file control component is a KForm form control for values with (typically
74
+ * [nullable](https://kform.ostack.tech/api/packages/kform/tech.ostack.kform.schemas/-nullable-schema/index.html))
75
+ * schemas of type
76
+ * [`FileSchema`](https://kform.ostack.tech/api/packages/kform/tech.ostack.kform.schemas/-file-schema/index.html).
77
+ * It is built on top of the [`Input`](/docs/ostack-ui-forms-input--docs)
78
+ * component.
79
+ *
80
+ * The following built-in KForm validations affect this control:
81
+ *
82
+ * - [`Required`](https://kform.ostack.tech/api/packages/kform/tech.ostack.kform.validations/-required/index.html):
83
+ * Sets the `required` property.
84
+ * - [`Accepts`](https://kform.ostack.tech/api/packages/kform/tech.ostack.kform.validations/-accepts/index.html):
85
+ * Sets the `accept` property.
86
+ *
87
+ * Example usage:
88
+ *
89
+ * ```tsx
90
+ * import { FileControl } from "@ostack.tech/ui-kform";
91
+ *
92
+ * function IdProofControl() {
93
+ * return <FileControl path="/idProof" />;
94
+ * }
95
+ * ```
96
+ */
97
+ export declare function FileControl<T extends KFormFile | null = KFormFile | null>({ path, issueMessages, issuesPanelLabel, displayIssues, preventAutoFocus, apiRef, issueMessagesProps, fileInteraction, viewFileButtonLabel, downloadFileButtonLabel, fallbackText, formManager, onInitialized, onFormManagerEvent, onValueChange, onValidationStatusChange, onDisplayStatusChange, onDirtyStatusChange, onTouchedStatusChange, required, accept, loading, showSpinner, disabled, readOnly, showClearButton, clearDescription, endAdornment, onChange, onKeyDown, onFocus, onBlurToOutside, debug, clearButtonProps, ref, ...otherProps }: FileControlProps<T>): import("react").JSX.Element;
@@ -0,0 +1,8 @@
1
+ import { type ReactNode } from "react";
2
+ /** Properties of the file control download addon. */
3
+ export interface FileControlDownloadAddonProps {
4
+ file: File;
5
+ label: ReactNode;
6
+ }
7
+ /** Control addon used to download a file. */
8
+ export declare function FileControlDownloadAddon({ file, label, }: FileControlDownloadAddonProps): import("react").JSX.Element;
@@ -0,0 +1,10 @@
1
+ import { type ReactNode } from "react";
2
+ /** Properties of the file control view addon. */
3
+ export interface FileControlViewAddonProps {
4
+ file: File;
5
+ viewLabel: ReactNode;
6
+ downloadLabel: ReactNode;
7
+ fallbackText: ReactNode;
8
+ }
9
+ /** Control addon used to view a file. */
10
+ export declare function FileControlViewAddon({ file, viewLabel, downloadLabel, fallbackText, }: FileControlViewAddonProps): import("react").JSX.Element;
@@ -1,21 +1,21 @@
1
1
  import { AbsolutePath, type Path, type Schema, type SchemaKt } from "@ostack.tech/kform";
2
2
  import { type Controller, type FormOptions } from "@ostack.tech/kform-react";
3
- import { type Responsive, Root } from "@ostack.tech/ui";
4
- import { type ComponentPropsWithoutRef, type ReactNode, type Ref } from "react";
3
+ import { type Responsive, type RootProps } from "@ostack.tech/ui";
4
+ import { type ComponentProps, type ReactNode, type Ref } from "react";
5
5
  import { type OnActivePathChangeNavigationOptions } from "../../providers/ActivePathProvider";
6
6
  import type { LocalizationObject } from "../../providers/LocalizationProvider";
7
7
  import type { IssueMessagesByCode } from "../IssueMessages";
8
8
  /** Mode of displaying issue messages. */
9
9
  export type IssuesDisplayMode = "inline" | "panel";
10
10
  /** Properties of the form app component. */
11
- export type FormAppProps<T = any> = Pick<ComponentPropsWithoutRef<typeof Root>, "enableErrorReporting" | "reportError" | "errorReportingUrl" | "errorReportingMethod" | "encodeErrorReport" | "encodedErrorReportMimeType" | "errorReportingOptions" | "baseDocumentTitle" | "documentTitleBaseSeparator" | "documentTitleBreadcrumbsSeparator" | "portalsContainer" | "tooltipsDelayDuration" | "tooltipsSkipDelayDuration" | "disableTooltipsHoverableContent" | "toastsLabel" | "toastsDuration" | "toastsSwipeDirection" | "toastsSwipeThreshold" | "toastViewportPosition" | "toastViewportHotkey" | "toastViewportLabel" | "toastViewportProps" | "errorBoundaryProps"> & FormOptions<T> & Omit<ComponentPropsWithoutRef<"form">, "onSubmit" | "onReset"> & {
11
+ export interface FormAppProps<T = any> extends Pick<RootProps, "enableErrorReporting" | "reportError" | "errorReportingUrl" | "errorReportingMethod" | "encodeErrorReport" | "encodedErrorReportMimeType" | "errorReportingOptions" | "baseDocumentTitle" | "documentTitleBaseSeparator" | "documentTitleBreadcrumbsSeparator" | "portalsContainer" | "tooltipsDelayDuration" | "tooltipsSkipDelayDuration" | "disableTooltipsHoverableContent" | "toastsLabel" | "toastsDuration" | "toastsSwipeDirection" | "toastsSwipeThreshold" | "toastViewportPosition" | "toastViewportHotkey" | "toastViewportLabel" | "toastViewportProps" | "errorBoundaryProps">, FormOptions<T>, Omit<ComponentProps<"form">, "onSubmit" | "onReset"> {
12
12
  /** Schema of the form. */
13
13
  schema: Schema<T> | SchemaKt;
14
14
  /** Title of the form. */
15
15
  formTitle?: string;
16
16
  /**
17
- * Label to use in the issues panel when displaying issues associated with
18
- * the form app. Defaults to the `formTitle`.
17
+ * Label to use in the issues panel when displaying issues associated with the
18
+ * form app. Defaults to the `formTitle`.
19
19
  */
20
20
  issuesPanelLabel?: ReactNode;
21
21
  /** Whether to disable the whole form. */
@@ -23,8 +23,8 @@ export type FormAppProps<T = any> = Pick<ComponentPropsWithoutRef<typeof Root>,
23
23
  /** Whether to set the whole form as read-only. */
24
24
  readOnly?: boolean;
25
25
  /**
26
- * Custom suffix to add to the ostack/UI's prefix when prefixing all
27
- * component classes, styles, _etc._
26
+ * Custom suffix to add to the ostack/UI's prefix when prefixing all component
27
+ * classes, styles, etc.
28
28
  *
29
29
  * This prefix-suffix should match the `$prefix-suffix` SCSS variable.
30
30
  */
@@ -41,17 +41,16 @@ export type FormAppProps<T = any> = Pick<ComponentPropsWithoutRef<typeof Root>,
41
41
  onLocaleChange?: (locale: LocalizationObject) => void;
42
42
  /**
43
43
  * Mapping of issue messages from the path of the field with issues to the
44
- * issue messages of said field (which are themselves grouped by their
45
- * code).
44
+ * issue messages of said field (which are themselves grouped by their code).
46
45
  *
47
- * Provided paths may contain wildcards, which will have a lower priority
48
- * when matched against.
46
+ * Provided paths may contain wildcards, which will have a lower priority when
47
+ * matched against.
49
48
  *
50
49
  * These messages are used by the `IssueMessages` component.
51
50
  *
52
51
  * > **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
+ * > efficient. Please make sure that the identity of the provided value doesn't
53
+ * > change at every render.
55
54
  *
56
55
  * Example value:
57
56
  *
@@ -72,16 +71,16 @@ export type FormAppProps<T = any> = Pick<ComponentPropsWithoutRef<typeof Root>,
72
71
  * Mode of displaying issues:
73
72
  *
74
73
  * - `inline` mode dispays issue messages near the component containing the
75
- * issues. In this mode the bottom issues panel only functions as an aid
76
- * for navigating issues.
74
+ * issues. In this mode the bottom issues panel only functions as an aid for
75
+ * navigating issues.
77
76
  * - `panel` mode displays issue messages within the bottom issues panel.
78
77
  *
79
78
  * @default "inline"
80
79
  */
81
80
  issuesDisplayMode?: IssuesDisplayMode;
82
81
  /**
83
- * Global setting which specifies whether issue codes should be added to
84
- * each issue message.
82
+ * Global setting which specifies whether issue codes should be added to each
83
+ * issue message.
85
84
  *
86
85
  * @default false
87
86
  */
@@ -118,11 +117,16 @@ export type FormAppProps<T = any> = Pick<ComponentPropsWithoutRef<typeof Root>,
118
117
  * @default "100dvh"
119
118
  */
120
119
  minHeight?: Responsive<number | string>;
120
+ /**
121
+ * Show debug information for all form controls. This property has no effect
122
+ * in production builds.
123
+ */
124
+ debug?: boolean;
121
125
  /** Reference to the form app's API. */
122
126
  apiRef?: Ref<FormAppApi<T> | undefined>;
123
- };
127
+ }
124
128
  /** Imperative form app API. */
125
- export type FormAppApi<T = unknown> = Controller<T> & {
129
+ export type FormAppApi<T = any> = Controller<T> & {
126
130
  /**
127
131
  * Focuses the form element at the provided path.
128
132
  *
@@ -132,7 +136,9 @@ export type FormAppApi<T = unknown> = Controller<T> & {
132
136
  /**
133
137
  * Starts issues navigation (when an `IssuesPanel` component exists within).
134
138
  *
135
- * @param options Options used when starting issues validation.
139
+ * @param options Options used when starting issues navigation.
140
+ * @returns Promise which returns with whether issues navigation was started
141
+ * (whether an `IssuesPanel` component exists within).
136
142
  */
137
143
  startIssuesNavigation: (options: {
138
144
  validate?: boolean;
@@ -140,124 +146,39 @@ export type FormAppApi<T = unknown> = Controller<T> & {
140
146
  }) => PromiseLike<void>;
141
147
  };
142
148
  /**
143
- * Root component of a form application.
149
+ * Root component of a form application. Built on top of the
150
+ * ostack/KForm-React's `useForm` hook.
151
+ *
152
+ * The `FormApp` component automatically renders the ostack/UI's `Root`
153
+ * component when not rendered within one, in which case all `Root` component
154
+ * properties are supported. The ostack/UI's `locale` is automatically provided
155
+ * to the ostack/UI `Root` component from the provided `FormApp` `locale`.
144
156
  *
145
- * This component automatically renders the ostack/UI's `Root` component when
146
- * not rendered inside of one, in which case it accepts properties that would
147
- * otherwise be passed to the ostack/UI `Root` component. In this scenario, the
148
- * ostack/UI's `locale` is automatically provided to the ostack/UI `Root`
149
- * component from the provided `FormApp` `locale`.
157
+ * Example usage:
158
+ *
159
+ * ```tsx
160
+ * import { Button, Field, Label, Stack } from "@ostack.tech/ui";
161
+ * import { FormApp, TextControl } from "@ostack.tech/ui-kform";
162
+ *
163
+ * export function SignInForm() {
164
+ * return (
165
+ * <FormApp schema={SignInFormSchema} onSubmit={signIn} minHeight={0}>
166
+ * <Stack>
167
+ * <Field>
168
+ * <Label>Email</Label>
169
+ * <TextControl path="/email" type="email" />
170
+ * </Field>
171
+ * <Field>
172
+ * <Label>Password</Label>
173
+ * <TextControl path="/password" type="password" />
174
+ * </Field>
175
+ * <Button color="primary" type="submit">
176
+ * Sign in
177
+ * </Button>
178
+ * </Stack>
179
+ * </FormApp>
180
+ * );
181
+ * }
182
+ * ```
150
183
  */
151
- export declare const FormApp: import("react").ForwardRefExoticComponent<Pick<Omit<import("@ostack.tech/ui").RootProps & import("react").RefAttributes<HTMLDivElement>, "ref">, "reportError" | "errorReportingUrl" | "errorReportingMethod" | "encodeErrorReport" | "encodedErrorReportMimeType" | "errorReportingOptions" | "baseDocumentTitle" | "enableErrorReporting" | "documentTitleBaseSeparator" | "documentTitleBreadcrumbsSeparator" | "portalsContainer" | "tooltipsDelayDuration" | "tooltipsSkipDelayDuration" | "disableTooltipsHoverableContent" | "toastsLabel" | "toastsDuration" | "toastsSwipeDirection" | "toastsSwipeThreshold" | "toastViewportPosition" | "toastViewportHotkey" | "toastViewportLabel" | "toastViewportProps" | "errorBoundaryProps"> & Omit<import("@ostack.tech/kform-react").ControllerOptions<any, import("@ostack.tech/kform-react").FormControllerState<any>>, "formManager"> & import("@ostack.tech/kform-react").FormOwnOptions<any, unknown> & Omit<Omit<import("react").DetailedHTMLProps<import("react").FormHTMLAttributes<HTMLFormElement>, HTMLFormElement>, "ref">, "onReset" | "onSubmit"> & {
152
- /** Schema of the form. */
153
- schema: SchemaKt | Schema<any>;
154
- /** Title of the form. */
155
- formTitle?: string;
156
- /**
157
- * Label to use in the issues panel when displaying issues associated with
158
- * the form app. Defaults to the `formTitle`.
159
- */
160
- issuesPanelLabel?: ReactNode;
161
- /** Whether to disable the whole form. */
162
- disabled?: boolean;
163
- /** Whether to set the whole form as read-only. */
164
- readOnly?: boolean;
165
- /**
166
- * Custom suffix to add to the ostack/UI's prefix when prefixing all
167
- * component classes, styles, _etc._
168
- *
169
- * This prefix-suffix should match the `$prefix-suffix` SCSS variable.
170
- */
171
- prefixSuffix?: string;
172
- /** Uncontrolled form app locale. */
173
- defaultLocale?: LocalizationObject;
174
- /** Controlled form app locale. */
175
- locale?: LocalizationObject;
176
- /**
177
- * Function called when the locale changes.
178
- *
179
- * @param locale New locale.
180
- */
181
- onLocaleChange?: (locale: LocalizationObject) => void;
182
- /**
183
- * Mapping of issue messages from the path of the field with issues to the
184
- * issue messages of said field (which are themselves grouped by their
185
- * code).
186
- *
187
- * Provided paths may contain wildcards, which will have a lower priority
188
- * when matched against.
189
- *
190
- * These messages are used by the `IssueMessages` component.
191
- *
192
- * > **Note:** Changes to `issueMessages` are handled correctly, but are not
193
- * > efficient. Please make sure that the identity of the provided value
194
- * > doesn't change at every render.
195
- *
196
- * Example value:
197
- *
198
- * ```tsx
199
- * {
200
- * "/**": {
201
- * "valueMissing": "Field is required."
202
- * },
203
- * "/my/field": {
204
- * "valueMissing": "My field cannot be left empty!",
205
- * "someOtherError": "Text of the other error."
206
- * }
207
- * }
208
- * ```
209
- */
210
- issueMessages?: Record<string, IssueMessagesByCode>;
211
- /**
212
- * Mode of displaying issues:
213
- *
214
- * - `inline` mode dispays issue messages near the component containing the
215
- * issues. In this mode the bottom issues panel only functions as an aid
216
- * for navigating issues.
217
- * - `panel` mode displays issue messages within the bottom issues panel.
218
- *
219
- * @default "inline"
220
- */
221
- issuesDisplayMode?: IssuesDisplayMode;
222
- /**
223
- * Global setting which specifies whether issue codes should be added to
224
- * each issue message.
225
- *
226
- * @default false
227
- */
228
- displayIssueCodes?: boolean;
229
- /**
230
- * Name of the key in the data object of validation issues that possibly
231
- * contains the issue message to display. This message is only used if no
232
- * matching message is otherwise found.
233
- *
234
- * @default "message"
235
- */
236
- issueMessagesDataKey?: string;
237
- /** Uncontrolled default active path to use. */
238
- defaultActivePath?: string | Path;
239
- /** Controlled active path to use. */
240
- activePath?: string | Path;
241
- /**
242
- * Callback called whenever the active path changes.
243
- *
244
- * @param activePath New active path.
245
- * @param options Navigation options to use when controlling the active path
246
- * via the browser's URL.
247
- */
248
- onActivePathChange?: (activePath: AbsolutePath, options: OnActivePathChangeNavigationOptions) => void;
249
- /**
250
- * Function called when a form path is focused.
251
- *
252
- * @param path Focused path.
253
- */
254
- onPathFocus?: (path: AbsolutePath) => void;
255
- /**
256
- * Minimum height of the form app. Values should **not** be percentages.
257
- *
258
- * @default "100dvh"
259
- */
260
- minHeight?: Responsive<number | string>;
261
- /** Reference to the form app's API. */
262
- apiRef?: Ref<FormAppApi<any> | undefined> | undefined;
263
- } & import("react").RefAttributes<HTMLFormElement>>;
184
+ export declare function FormApp<T = any>({ enableErrorReporting, reportError, errorReportingUrl, errorReportingMethod, encodeErrorReport, encodedErrorReportMimeType, errorReportingOptions, baseDocumentTitle, documentTitleBaseSeparator, documentTitleBreadcrumbsSeparator, portalsContainer, tooltipsDelayDuration, tooltipsSkipDelayDuration, disableTooltipsHoverableContent, toastsLabel, toastsDuration, toastsSwipeDirection, toastsSwipeThreshold, toastViewportPosition, toastViewportHotkey, toastViewportLabel, toastViewportProps, errorBoundaryProps, schema, initialValue, formTitle, issuesPanelLabel, disabled, readOnly, prefix: newPrefix, prefixSuffix, defaultLocale, locale: controlledLocale, onLocaleChange, issueMessages, issuesDisplayMode, displayIssueCodes, issueMessagesDataKey, defaultActivePath, activePath, onActivePathChange, onPathFocus, minHeight, debug, apiRef, externalContexts, validationMode, confirmUnloadWhenDirty, confirmUnloadMessage, onSubmit, onInvalidSubmit, onSuccessfulSubmit, onFailedSubmit, validateOnSubmit, setTouchedOnSubmit, setPristineOnSuccessfulSubmit, convertExternalIssuesTableRowIndicesToIds, onReset, onInitialized, onUninitialized, onFormManagerEvent, onValueChange, onValidationStatusChange, onDisplayStatusChange, onDirtyStatusChange, onTouchedStatusChange, ...otherProps }: FormAppProps<T>): import("react").JSX.Element;