@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,62 +1,30 @@
1
- import type { Controller } from "@ostack.tech/kform-react";
2
- import type { DataTableColumn } from "@ostack.tech/ui";
3
- import type { ComponentPropsWithRef, ReactNode } from "react";
4
- import { TableControlRemoveRowTrigger } from "./TableControlRemoveRowTrigger.tsx";
5
- /** Array of table control columns. */
6
- export type TableControlColumns<T = unknown> = (TableControlColumn<T> | ((tableControlStatus: TableControlStatus) => TableControlColumn<T> | false | null | undefined) | false | null | undefined)[];
7
- /** Status of the table control. */
8
- export interface TableControlStatus {
9
- /** Whether the table control is disabled. */
10
- disabled: boolean;
11
- /** Whether the table control is read-only. */
12
- readOnly: boolean;
13
- /** Whether the table is being printed. */
14
- printing: boolean;
15
- }
16
- /** Controller of a table row. */
17
- export type TableControlRowController<T = unknown> = Controller<T> & {
18
- /** Row index. */
19
- index: number;
20
- };
21
- /** Column of a table control. */
22
- export interface TableControlColumn<T = unknown, TValue = any> extends Omit<DataTableColumn<T, TValue>, "subColumns" | "getValue" | "format" | "render" | "compare" | "filterable" | "sortable" | "footer"> {
23
- /** Sub columns of this column. */
24
- subColumns?: TableControlColumns<T>;
25
- /** Function used to render the cell's content. */
26
- render?: (rowController: TableControlRowController<T>) => ReactNode;
1
+ import type { DataTableColumnObject } from "@ostack.tech/ui";
2
+ import type { ReactNode } from "react";
3
+ import type { TableControlRowController } from "./TableControlRow.tsx";
4
+ /** Object representation of a table control column. */
5
+ export interface TableControlColumnObject<T = unknown, TValue = any> extends Omit<DataTableColumnObject<T, TValue>, "getValue" | "format" | "render" | "compare" | "filterable" | "sortable" | "footer"> {
6
+ /** Rendering of the cell content. */
7
+ render?: ReactNode | ((rowController: TableControlRowController<T>) => ReactNode);
27
8
  /** Optional footer content to be rendered in the column footer. */
28
9
  footer?: ReactNode;
10
+ /**
11
+ * Whether this column should be shown when the table control is in read-only
12
+ * mode.
13
+ */
14
+ showWhenReadOnly?: boolean;
15
+ }
16
+ /** Properties of the table control column component. */
17
+ export interface TableControlColumnProps<T = any, TValue = any> extends Omit<TableControlColumnObject<T, TValue>, "subColumns"> {
18
+ /**
19
+ * Rendering of the cell content. If both `render` and `children` are
20
+ * provided, `render` takes priority.
21
+ */
22
+ children?: ReactNode | ((rowController: TableControlRowController<T>) => ReactNode);
29
23
  }
30
24
  /**
31
- * Pre-configured column used to display the index of each row. By default, it
32
- * sticks to left of the table.
33
- *
34
- * @param overrides Column properties to override the defaults.
35
- * @returns Table control column used to display the index of each row.
36
- */
37
- export declare function tableControlIndexColumn<T = unknown, TValue = any>(overrides?: TableControlColumn<T, TValue>): TableControlColumn<T, TValue>;
38
- /**
39
- * Pre-configured column used to display row actions. By default, it sticks to
40
- * the right of the table and renders the `TableControlRemoveRow` component.
41
- *
42
- * Its configuration can be overridden to show other actions, for example, an
43
- * edit button:
44
- *
45
- * ```tsx
46
- * tableControlActionsColumn({
47
- * width: 100,
48
- * render: () => (
49
- * <>
50
- * <IconButton label="Edit row" icon={faPencil} />
51
- * <TableControlRemoveRow />
52
- * </>
53
- * ),
54
- * });
55
- * ```
25
+ * Definition of a table control column.
56
26
  *
57
- * @param overrides Column properties used to display the actions of each row.
58
- * @returns Table control column used to display the actions of each row.
27
+ * This component doesn't actually render anything by itself; it is used by the
28
+ * `TableControl` component to automatically create the `columns` object.
59
29
  */
60
- export declare function tableControlActionsColumn<T = unknown, TValue = any>({ removeRowProps, ...columnOverrides }?: TableControlColumn<T, TValue> & {
61
- removeRowProps?: ComponentPropsWithRef<typeof TableControlRemoveRowTrigger>;
62
- }): (tableControlStatus: TableControlStatus) => TableControlColumn<T, TValue> | false;
30
+ export declare function TableControlColumn<T = any, TValue = any>(_props: TableControlColumnProps<T, TValue>): null;
@@ -0,0 +1,113 @@
1
+ import type { ReactNode } from "react";
2
+ import type { TableControlColumnObject } from "./TableControlColumn.tsx";
3
+ import { type TableControlRemoveRowTriggerProps } from "./TableControlRemoveRowTrigger.tsx";
4
+ /** Properties used to configure the `tableControlIndexColumn` function. */
5
+ export interface TableControlIndexColumnFnProps<T = unknown, TValue = any> extends TableControlColumnObject<T, TValue> {
6
+ }
7
+ /**
8
+ * Pre-configured column used to display the index of each row. By default, it
9
+ * sticks to left of the table.
10
+ *
11
+ * @param props Column properties to override the defaults.
12
+ * @returns Table control column used to display the index of each row.
13
+ */
14
+ export declare function tableControlIndexColumn<T = unknown, TValue = any>({ render, ...otherProps }?: TableControlIndexColumnFnProps<T, TValue>): TableControlColumnObject<T, TValue>;
15
+ /** Properties used to configure the `tableControlActionsColumn` function. */
16
+ export interface TableControlActionsColumnFnProps<T = unknown, TValue = any> extends TableControlColumnObject<T, TValue> {
17
+ /**
18
+ * Set the `label` property of the `TableControlRemoveRowTrigger` component
19
+ * rendered by default.
20
+ *
21
+ * **Note:** This property has no effect if the column's `render` function is
22
+ * overridden.
23
+ */
24
+ removeRowLabel?: ReactNode;
25
+ /**
26
+ * Sets the `showConfirmation` property of the `TableControlRemoveRowTrigger`
27
+ * component rendered by default.
28
+ *
29
+ * **Note:** This property has no effect if the column's `render` function is
30
+ * overridden.
31
+ */
32
+ showRowRemovalConfirmation?: boolean;
33
+ /**
34
+ * Sets the `onConfirmRowRemoval` property of the
35
+ * `TableControlRemoveRowTrigger` component rendered by default.
36
+ *
37
+ * **Note:** This property has no effect if the column's `render` function is
38
+ * overridden.
39
+ */
40
+ onConfirmRowRemoval?: () => void;
41
+ /**
42
+ * Sets the `onRowRemoved` property of the `TableControlRemoveRowTrigger`
43
+ * component rendered by default.
44
+ *
45
+ * **Note:** This property has no effect if the column's `render` function is
46
+ * overridden.
47
+ */
48
+ onRowRemoved?: () => void;
49
+ /**
50
+ * Sets the `confirmDialogTitle` property of the
51
+ * `TableControlRemoveRowTrigger` component rendered by default.
52
+ *
53
+ * **Note:** This property has no effect if the column's `render` function is
54
+ * overridden.
55
+ */
56
+ confirmRowRemovalDialogTitle?: ReactNode;
57
+ /**
58
+ * Sets the `confirmDialogMessage` property of the
59
+ * `TableControlRemoveRowTrigger` component rendered by default.
60
+ *
61
+ * **Note:** This property has no effect if the column's `render` function is
62
+ * overridden.
63
+ */
64
+ confirmRowRemovalDialogMessage?: (index: number) => ReactNode;
65
+ /**
66
+ * Sets the `confirmDialogOkText` property of the
67
+ * `TableControlRemoveRowTrigger` component rendered by default.
68
+ *
69
+ * **Note:** This property has no effect if the column's `render` function is
70
+ * overridden.
71
+ */
72
+ confirmRowRemovalDialogOkText?: ReactNode;
73
+ /**
74
+ * Sets the `confirmDialogCancelText` property of the
75
+ * `TableControlRemoveRowTrigger` component rendered by default.
76
+ *
77
+ * **Note:** This property has no effect if the column's `render` function is
78
+ * overridden.
79
+ */
80
+ confirmRowRemovalDialogCancelText?: ReactNode;
81
+ /**
82
+ * Properties to pass to the `TableControlRemoveRowTrigger` component rendered
83
+ * by default.
84
+ *
85
+ * **Note:** This property has no effect if the column's `render` function is
86
+ * overridden.
87
+ */
88
+ removeRowProps?: TableControlRemoveRowTriggerProps;
89
+ }
90
+ /**
91
+ * Pre-configured column used to display row actions. By default, it sticks to
92
+ * the right of the table and renders the `TableControlRemoveRowTrigger`
93
+ * component.
94
+ *
95
+ * Its configuration can be overridden to show other actions, for example, an
96
+ * edit button:
97
+ *
98
+ * ```tsx
99
+ * tableControlActionsColumn({
100
+ * width: 100,
101
+ * render: () => (
102
+ * <>
103
+ * <IconButton label="Edit row" icon={faPencil} />
104
+ * <TableControlRemoveRowTrigger />
105
+ * </>
106
+ * ),
107
+ * });
108
+ * ```
109
+ *
110
+ * @param overrides Column properties used to display the actions of each row.
111
+ * @returns Table control column used to display the actions of each row.
112
+ */
113
+ export declare function tableControlActionsColumn<T = unknown, TValue = any>({ removeRowLabel, showRowRemovalConfirmation, onConfirmRowRemoval, onRowRemoved, confirmRowRemovalDialogTitle, confirmRowRemovalDialogMessage, confirmRowRemovalDialogOkText, confirmRowRemovalDialogCancelText, removeRowProps, render, ...otherProps }?: TableControlActionsColumnFnProps<T, TValue>): TableControlColumnObject<T, TValue>;
@@ -0,0 +1,25 @@
1
+ import type { DataTableColumnGroupObject } from "@ostack.tech/ui";
2
+ import type { ReactNode } from "react";
3
+ import type { TableControlColumnObjects } from "./TableControl.tsx";
4
+ /** Object representation of a table control column. */
5
+ export interface TableControlColumnGroupObject<T = unknown> extends Omit<DataTableColumnGroupObject, "subColumns"> {
6
+ /** Sub columns of this column group. */
7
+ subColumns?: TableControlColumnObjects<T>;
8
+ /**
9
+ * Whether this column group should be shown when the table control is in
10
+ * read-only mode.
11
+ */
12
+ showWhenReadOnly?: boolean;
13
+ }
14
+ /** Properties of the table control column component. */
15
+ export interface TableControlColumnGroupProps extends Omit<TableControlColumnGroupObject, "subColumns"> {
16
+ /** Sub-columns of this table control column. */
17
+ children?: ReactNode;
18
+ }
19
+ /**
20
+ * Definition of a table control column group.
21
+ *
22
+ * This component doesn't actually render anything by itself; it is used by the
23
+ * `TableControl` component to automatically create the `columns` object.
24
+ */
25
+ export declare function TableControlColumnGroup(_props: TableControlColumnGroupProps): null;
@@ -0,0 +1,14 @@
1
+ import type { ReactNode } from "react";
2
+ /** Properties of the table control columns component. */
3
+ export interface TableControlColumnsProps {
4
+ /** Table control columns. */
5
+ children: ReactNode;
6
+ }
7
+ /**
8
+ * Container for the definition of all table control columns. This component
9
+ * must be a direct child of the `TableControl` component.
10
+ *
11
+ * This component doesn't actually render anything by itself; it is used by the
12
+ * `TableControl` component to automatically create the `columns` object.
13
+ */
14
+ export declare function TableControlColumns(_props: TableControlColumnsProps): null;
@@ -1,7 +1,6 @@
1
- import { DataTableContent } from "@ostack.tech/ui";
2
- import { type ComponentPropsWithoutRef } from "react";
1
+ import { type DataTableContentProps } from "@ostack.tech/ui";
3
2
  /** Properties of the table control content component. */
4
- export interface TableControlContentProps extends Omit<ComponentPropsWithoutRef<typeof DataTableContent>, "status"> {
3
+ export interface TableControlContentProps extends Omit<DataTableContentProps, "status"> {
5
4
  }
6
5
  /** Component containing the content of the table control. */
7
- export declare const TableControlContent: import("react").ForwardRefExoticComponent<TableControlContentProps & import("react").RefAttributes<HTMLTableElement>>;
6
+ export declare function TableControlContent({ scrollableProps, ...otherProps }: TableControlContentProps): import("react").JSX.Element;
@@ -2,7 +2,7 @@ import type { AbsolutePath, Table, TableRowId } from "@ostack.tech/kform";
2
2
  import type { FormatterController } from "@ostack.tech/kform-react";
3
3
  import { type Ref } from "react";
4
4
  import type { UseRegisterControlResult } from "../../utils/useRegisterControl.tsx";
5
- import type { TableControlRowController } from "./TableControlColumn.tsx";
5
+ import type { TableControlRowController } from "./TableControlRow.tsx";
6
6
  /** Value of the table control context. */
7
7
  export interface TableControlContextValue<T = any, TTable extends Table<T> | null = Table<T> | null> {
8
8
  controller: TableControlController<T, TTable>;
@@ -10,6 +10,7 @@ export interface TableControlContextValue<T = any, TTable extends Table<T> | nul
10
10
  handleFocus: UseRegisterControlResult<HTMLDivElement>["handleFocus"];
11
11
  size?: number;
12
12
  maxRows?: number;
13
+ debug?: boolean;
13
14
  }
14
15
  /** Controller of the table control. */
15
16
  export type TableControlController<T = any, TTable extends Table<T> | null = Table<T> | null> = FormatterController<TTable, TableRowId[]> & {
@@ -0,0 +1,10 @@
1
+ import { type TableControlColumnObject, type TableControlColumnProps } from "./TableControlColumn.tsx";
2
+ import { type TableControlIndexColumnFnProps } from "./TableControlColumnFns.tsx";
3
+ /** Properties of the table control index column. */
4
+ export interface TableControlIndexColumnProps extends TableControlColumnProps, Omit<TableControlIndexColumnFnProps, keyof TableControlColumnObject> {
5
+ }
6
+ /**
7
+ * Pre-configured column used to display the index of each row. By default, it
8
+ * sticks to left of the table.
9
+ */
10
+ export declare function TableControlIndexColumn({ render, children, ...otherProps }: TableControlIndexColumnProps): import("react").JSX.Element;
@@ -0,0 +1,2 @@
1
+ /** Default label of the table control's index column. */
2
+ export declare function TableControlIndexColumnLabel(): string | number | bigint | boolean | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<import("react").ReactNode> | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<import("react").ReactNode> | null | undefined>;
@@ -1,2 +1,5 @@
1
+ import { DataTablePagination, type DataTablePaginationProps } from "@ostack.tech/ui";
2
+ /** Properties of the table control pagination component. */
3
+ export type TableControlPaginationProps = DataTablePaginationProps;
1
4
  /** Table control pagination. */
2
- export declare const TableControlPagination: import("react").ForwardRefExoticComponent<import("@ostack.tech/ui").DataTablePaginationProps & import("react").RefAttributes<HTMLDivElement>>;
5
+ export declare const TableControlPagination: typeof DataTablePagination;
@@ -1,5 +1,5 @@
1
- import { IconButton } from "@ostack.tech/ui";
2
- import { type ComponentPropsWithoutRef, type ReactNode } from "react";
1
+ import { type IconButtonProps } from "@ostack.tech/ui";
2
+ import { type ComponentProps, type ReactNode } from "react";
3
3
  /** Properties of the table control remove row trigger component. */
4
4
  export type TableControlRemoveRowTriggerProps = TableControlRemoveRowTriggerChildlessProps | TableControlRemoveRowTriggerChildrenProps;
5
5
  /** Base properties of the table control remove row trigger component. */
@@ -46,7 +46,7 @@ export interface TableControlRemoveRowTriggerChildlessPropsBase {
46
46
  * Base properties of the table control remove row trigger component when
47
47
  * rendered without children.
48
48
  */
49
- export interface TableControlRemoveRowTriggerChildlessProps extends TableControlRemoveRowTriggerChildlessPropsBase, Omit<Partial<ComponentPropsWithoutRef<typeof IconButton<"button">>>, "asChild" | "children"> {
49
+ export interface TableControlRemoveRowTriggerChildlessProps extends TableControlRemoveRowTriggerChildlessPropsBase, Omit<Partial<IconButtonProps>, "asChild" | "children"> {
50
50
  /**
51
51
  * Label of the icon button.
52
52
  *
@@ -59,7 +59,7 @@ export interface TableControlRemoveRowTriggerChildlessProps extends TableControl
59
59
  * Base properties of the table control remove row trigger component when
60
60
  * rendered with children.
61
61
  */
62
- export interface TableControlRemoveRowTriggerChildrenProps extends TableControlRemoveRowTriggerChildlessPropsBase, Partial<ComponentPropsWithoutRef<"button">> {
62
+ export interface TableControlRemoveRowTriggerChildrenProps extends TableControlRemoveRowTriggerChildlessPropsBase, Partial<ComponentProps<"button">> {
63
63
  children: ReactNode;
64
64
  }
65
65
  /**
@@ -68,4 +68,4 @@ export interface TableControlRemoveRowTriggerChildrenProps extends TableControlR
68
68
  * By default, it renders an icon button with label `defaultButtonLabel`,
69
69
  * however, this can be overriden by providing `children`.
70
70
  */
71
- export declare const TableControlRemoveRowTrigger: import("react").ForwardRefExoticComponent<TableControlRemoveRowTriggerProps & import("react").RefAttributes<HTMLButtonElement>>;
71
+ export declare function TableControlRemoveRowTrigger({ showConfirmation, onConfirmRowRemoval, onRowRemoved, confirmDialogTitle, confirmDialogMessage, confirmDialogOkText, confirmDialogCancelText, showWhenReadOnly, disabled, onClick, children, ...otherProps }: TableControlRemoveRowTriggerProps): import("react").JSX.Element | null;
@@ -1,7 +1,14 @@
1
- import { DataTableRow } from "@ostack.tech/ui";
2
- import { type ComponentPropsWithoutRef } from "react";
1
+ import type { TableRowId } from "@ostack.tech/kform";
2
+ import { type Controller } from "@ostack.tech/kform-react";
3
+ import { type DataTableRowProps } from "@ostack.tech/ui";
4
+ /** Controller of a table row. */
5
+ export type TableControlRowController<T = unknown> = Controller<T> & {
6
+ /** Row index. */
7
+ index: number;
8
+ };
3
9
  /** Properties of the table control row. */
4
- export interface TableControlRowProps extends ComponentPropsWithoutRef<typeof DataTableRow> {
10
+ export interface TableControlRowProps extends DataTableRowProps {
11
+ row: TableRowId;
5
12
  }
6
13
  /** Row of a table control. */
7
- export declare const TableControlRow: import("react").NamedExoticComponent<TableControlRowProps & import("react").RefAttributes<HTMLTableRowElement>>;
14
+ export declare function TableControlRow({ row, index, ...otherProps }: TableControlRowProps): import("react").JSX.Element;
@@ -1,2 +1,5 @@
1
+ import { DataTableRowsPerPage, type DataTableRowsPerPageProps } from "@ostack.tech/ui";
2
+ /** Properties of the table control rows per page component. */
3
+ export type TableControlRowsPerPageProps = DataTableRowsPerPageProps;
1
4
  /** Table control rows per page. */
2
- export declare const TableControlRowsPerPage: import("react").ForwardRefExoticComponent<import("@ostack.tech/ui").DataTableRowsPerPageProps & import("react").RefAttributes<HTMLDivElement>>;
5
+ export declare const TableControlRowsPerPage: typeof DataTableRowsPerPage;
@@ -1,8 +1,14 @@
1
1
  export * from "./TableControl.tsx";
2
+ export * from "./TableControlActionsColumn.tsx";
2
3
  export * from "./TableControlAddRowTrigger.tsx";
3
4
  export * from "./TableControlApi.ts";
4
5
  export * from "./TableControlColumn.tsx";
6
+ export * from "./TableControlColumnFns.tsx";
7
+ export * from "./TableControlColumnGroup.tsx";
8
+ export * from "./TableControlColumns.tsx";
5
9
  export * from "./TableControlContent.tsx";
10
+ export * from "./TableControlIndexColumn.tsx";
6
11
  export * from "./TableControlPagination.tsx";
7
12
  export * from "./TableControlRemoveRowTrigger.tsx";
13
+ export { type TableControlRowController } from "./TableControlRow.tsx";
8
14
  export * from "./TableControlRowsPerPage.tsx";
@@ -1,17 +1,11 @@
1
1
  import type { Path } from "@ostack.tech/kform";
2
2
  import { type InputController, type InputOptions } from "@ostack.tech/kform-react";
3
- import { Input, TextArea } 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, TextArea, type TextAreaProps } 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 text control component. */
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<ComponentPropsWithoutRef<typeof Input>, "defaultValue" | "value" | "onValueChange" | "status" | "validate" | "validationMode"> & TextControlPropsBase<T> & {
9
- multiline?: false;
10
- };
11
- export type TextControlPropsMultiline<T extends string | null = string | null> = Omit<ComponentPropsWithoutRef<typeof TextArea>, "defaultValue" | "value" | "onValueChange" | "status" | "validate" | "validationMode"> & TextControlPropsBase<T> & {
12
- multiline: true;
13
- pattern?: never;
14
- };
7
+ export type TextControlProps<T extends string | null = string | null> = TextControlInputProps<T> | TextControlTextAreaProps<T>;
8
+ /** Base properties of the text control component. */
15
9
  export type TextControlPropsBase<T extends string | null = string | null> = Omit<InputOptions<T, string, ComponentRef<typeof Input | typeof TextArea>>, "enabled" | "format" | "parse"> & {
16
10
  /** Path to the value. */
17
11
  path?: string | Path;
@@ -25,7 +19,7 @@ export type TextControlPropsBase<T extends string | null = string | null> = Omit
25
19
  * Label to use in the issues panel when displaying issues associated with
26
20
  * this field.
27
21
  *
28
- * This label has priority over the field's `ControlLabel`.
22
+ * This label has priority over the field's `Label`.
29
23
  */
30
24
  issuesPanelLabel?: ReactNode;
31
25
  /**
@@ -47,20 +41,52 @@ export type TextControlPropsBase<T extends string | null = string | null> = Omit
47
41
  preventAutoFocus?: boolean;
48
42
  /** Whether to render a multiline text control. */
49
43
  multiline?: boolean;
44
+ /**
45
+ * Whether to show debug information. This property has no effect in
46
+ * production builds.
47
+ */
48
+ debug?: boolean;
50
49
  /** Reference to the control's API. */
51
50
  apiRef?: Ref<InputController<T, string, ComponentRef<typeof Input | typeof TextArea>> | undefined>;
52
51
  /** Properties to pass to the `IssueMessages` component. */
53
- issueMessagesProps?: Omit<ComponentPropsWithRef<typeof IssueMessages>, "path" | "issues" | "messages">;
52
+ issueMessagesProps?: Omit<IssueMessagesProps, "path" | "issues" | "messages">;
53
+ };
54
+ /** Properties of the text control component when `multiline` is **not** set. */
55
+ export type TextControlInputProps<T extends string | null = string | null> = Omit<InputProps, "defaultValue" | "value" | "onValueChange" | "status" | "validate" | "validationMode"> & TextControlPropsBase<T> & {
56
+ multiline?: false;
57
+ };
58
+ /** Properties of the text control component when `multiline` is set. */
59
+ export type TextControlTextAreaProps<T extends string | null = string | null> = Omit<TextAreaProps, "defaultValue" | "value" | "onValueChange" | "status" | "validate" | "validationMode"> & TextControlPropsBase<T> & {
60
+ multiline: true;
61
+ pattern?: never;
54
62
  };
55
63
  /**
56
- * Text control component supporting (possibly nullable) schemas of type
57
- * "String".
64
+ * The text control component is a KForm form control for values with (possibly
65
+ * [nullable](https://kform.ostack.tech/api/packages/kform/tech.ostack.kform.schemas/-nullable-schema/index.html))
66
+ * schemas of type
67
+ * [`StringSchema`](https://kform.ostack.tech/api/packages/kform/tech.ostack.kform.schemas/-string-schema/index.html).
68
+ * It supports both single and multiline text editing, being built on top of the
69
+ * [`Input`](/docs/ostack-ui-forms-input--docs) (for single-line) or
70
+ * [`TextArea`](/docs/ostack-ui-forms-text-area--docs) (for multiline)
71
+ * components.
72
+ *
73
+ * The following built-in KForm validations affect this control:
74
+ *
75
+ * - [`Required`](https://kform.ostack.tech/api/packages/kform/tech.ostack.kform.validations/-required/index.html):
76
+ * Sets the `required` property.
77
+ * - [`Length`](https://kform.ostack.tech/api/packages/kform/tech.ostack.kform.validations/-length/index.html)/[`MinLength`](https://kform.ostack.tech/api/packages/kform/tech.ostack.kform.validations/-min-length/index.html)/[`MaxLength`](https://kform.ostack.tech/api/packages/kform/tech.ostack.kform.validations/-max-length/index.html):
78
+ * Sets the `minLength` and/or `maxLength` properties.
79
+ * - [`Matches`](https://kform.ostack.tech/api/packages/kform/tech.ostack.kform.validations/-matches/index.html):
80
+ * Sets the `pattern` property.
81
+ *
82
+ * Example usage:
58
83
  *
59
- * If the schema is nullable, this component sets the form value to `null` when
60
- * the control is empty. Note, however, that the form may still hold an empty
61
- * string as value if set programmatically.
84
+ * ```tsx
85
+ * import { TextControl } from "@ostack.tech/ui-kform";
62
86
  *
63
- * The component further supports either single or multiple lines via the
64
- * `multiline` prop.
87
+ * function UsernameControl() {
88
+ * return <TextControl path="/username" placeholder="Enter username…" />;
89
+ * }
90
+ * ```
65
91
  */
66
- export declare const TextControl: import("react").ForwardRefExoticComponent<TextControlProps<string | null> & import("react").RefAttributes<HTMLInputElement | HTMLTextAreaElement>>;
92
+ export declare function TextControl<T extends string | null = string | null>({ path, issueMessages, issuesPanelLabel, displayIssues, preventAutoFocus, multiline, apiRef, issueMessagesProps, formManager, onInitialized, onFormManagerEvent, onValueChange, onValidationStatusChange, onDisplayStatusChange, onDirtyStatusChange, onTouchedStatusChange, required, minLength, maxLength, pattern, loading, showSpinner, disabled, readOnly, endAdornment, onChange, onFocus, onBlurToOutside, debug, ref, ...otherProps }: TextControlProps<T>): import("react").JSX.Element;
@@ -1,6 +1,6 @@
1
- import { type ComponentPropsWithoutRef } from "react";
1
+ import { type ComponentProps } from "react";
2
2
  /** Properties of the top bar component. */
3
- export interface TopBarProps extends ComponentPropsWithoutRef<"div"> {
3
+ export interface TopBarProps extends ComponentProps<"div"> {
4
4
  }
5
5
  /** Top bar component. */
6
- export declare const TopBar: import("react").ForwardRefExoticComponent<TopBarProps & import("react").RefAttributes<HTMLDivElement>>;
6
+ export declare function TopBar({ className, ref, ...otherProps }: TopBarProps): import("react").JSX.Element;
@@ -1,7 +1,6 @@
1
- import { Stack } from "@ostack.tech/ui";
2
- import { type ComponentPropsWithoutRef } from "react";
1
+ import { type StackProps } from "@ostack.tech/ui";
3
2
  /** Properties of the top bar actions component. */
4
- export interface TopBarActionsProps extends ComponentPropsWithoutRef<typeof Stack> {
3
+ export interface TopBarActionsProps extends StackProps {
5
4
  }
6
5
  /** Container used to display actions within the top bar. */
7
- export declare const TopBarActions: import("react").ForwardRefExoticComponent<TopBarActionsProps & import("react").RefAttributes<HTMLDivElement>>;
6
+ export declare function TopBarActions({ className, children, ...otherProps }: TopBarActionsProps): import("react").JSX.Element;
@@ -19,6 +19,28 @@ export interface ValidateActionProps extends Omit<ButtonProps, "children"> {
19
19
  * `DEFAULT_VALIDATE_KEYBINDS`.
20
20
  */
21
21
  keybinds?: string | string[] | null;
22
+ /**
23
+ * Whether to show the validate action when the form is read-only.
24
+ *
25
+ * @default false
26
+ */
27
+ showWhenReadOnly?: boolean;
22
28
  }
23
- /** Action used to validate the form. */
24
- export declare function ValidateAction({ label, keybinds, loading, disabled, onClick, ...otherProps }: ValidateActionProps): import("react").JSX.Element;
29
+ /**
30
+ * Form action used to validate the form. Built on top of the [`Button`
31
+ * component](/docs/ostack-ui-forms-button--docs) and `useFormValidator` hook.
32
+ *
33
+ * If the form contains an `IssuesPanel` component, it is shown as a result of
34
+ * triggering the action.
35
+ *
36
+ * Example usage:
37
+ *
38
+ * ```tsx
39
+ * import { ValidateAction } from "@ostack.tech/ui-kform";
40
+ *
41
+ * function ValidateForm() {
42
+ * return <ValidateAction />;
43
+ * }
44
+ * ```
45
+ */
46
+ export declare function ValidateAction({ label, keybinds, showWhenReadOnly, loading, disabled, onClick, ...otherProps }: ValidateActionProps): false | import("react").JSX.Element | undefined;
package/types/index.d.ts CHANGED
@@ -5,6 +5,7 @@ export * from "./components/CheckboxGroupControl";
5
5
  export * from "./components/ControlField";
6
6
  export * from "./components/DateControl";
7
7
  export * from "./components/DateRangeControl";
8
+ export * from "./components/DebugInfo";
8
9
  export * from "./components/FileControl";
9
10
  export * from "./components/FormApp";
10
11
  export * from "./components/FormPages";
@@ -2,6 +2,7 @@ import type { LocalizationObject as UiLocalizationObject } from "@ostack.tech/ui
2
2
  import type { AnnexesManagerProps } from "../../components/Annexes";
3
3
  import type { CheckboxGroupControlProps } from "../../components/CheckboxGroupControl";
4
4
  import type { DateRangeControlProps } from "../../components/DateRangeControl";
5
+ import type { DebugInfoProps } from "../../components/DebugInfo";
5
6
  import type { FileControlProps } from "../../components/FileControl";
6
7
  import type { FormAppProps } from "../../components/FormApp";
7
8
  import type { FormPageProps, FormPagesNavigationProps } from "../../components/FormPages";
@@ -15,7 +16,7 @@ import type { SaveActionProps } from "../../components/SaveAction";
15
16
  import type { SelectControlProps } from "../../components/SelectControl";
16
17
  import type { SelectMultipleControlProps } from "../../components/SelectMultipleControl";
17
18
  import type { SubmitActionProps } from "../../components/SubmitAction";
18
- import type { TableControlAddRowTriggerChildlessProps, TableControlRemoveRowTriggerChildlessProps } from "../../components/TableControl";
19
+ import type { TableControlAddRowTriggerChildlessProps, TableControlIndexColumnProps, TableControlRemoveRowTriggerChildlessProps } from "../../components/TableControl";
19
20
  import type { UnknownValueProps } from "../../components/UnknownValue";
20
21
  import type { ValidateActionProps } from "../../components/ValidateAction";
21
22
  /** Localization object representation. */
@@ -23,6 +24,7 @@ export interface LocalizationObject {
23
24
  baseLocale: UiLocalizationObject;
24
25
  AnnexesManager: Pick<AnnexesManagerProps, "aria-label" | "menuButtonText" | "menuButtonLabel" | "addAnnexText" | "addAnnexSuccessMessage" | "removeAnnexButtonLabel" | "removeAnnexKeyboardHint" | "removeAnnexConfirmDialogTitle" | "removeAnnexConfirmDialogMessage" | "removeAnnexConfirmDialogOkText" | "removeAnnexConfirmDialogCancelText">;
25
26
  CheckboxGroupControl: Pick<CheckboxGroupControlProps, "unknownValueLabel">;
27
+ DebugInfo?: Pick<DebugInfoProps, "label">;
26
28
  DateRangeControl: Pick<DateRangeControlProps, "issuesPanelStartLabelSuffix" | "issuesPanelEndLabelSuffix">;
27
29
  FileControl: Pick<FileControlProps, "clearDescription" | "viewFileButtonLabel" | "downloadFileButtonLabel" | "fallbackText">;
28
30
  FormApp: Pick<FormAppProps, "formTitle" | "issuesPanelLabel" | "issueMessages" | "confirmUnloadMessage">;
@@ -38,7 +40,9 @@ export interface LocalizationObject {
38
40
  SelectMultipleControl: Pick<SelectMultipleControlProps, "unknownValueLabel">;
39
41
  PrintAction: Pick<PrintActionProps, "label" | "keybinds">;
40
42
  SubmitAction: Pick<SubmitActionProps, "label" | "keybinds" | "dialogTitle" | "dialogDescription" | "dialogBody" | "dialogOkText" | "dialogCancelText" | "confirmWarningsCheckboxLabel" | "successMessage" | "errorMessage">;
43
+ TableControlActionsColumn: Pick<TableControlIndexColumnProps, "label">;
41
44
  TableControlAddRowTrigger: Pick<TableControlAddRowTriggerChildlessProps, "label">;
45
+ TableControlIndexColumn: Pick<TableControlIndexColumnProps, "label">;
42
46
  TableControlRemoveRowTrigger: Pick<TableControlRemoveRowTriggerChildlessProps, "label" | "confirmDialogTitle" | "confirmDialogMessage" | "confirmDialogOkText" | "confirmDialogCancelText">;
43
47
  UnknownValue: Pick<UnknownValueProps, "label">;
44
48
  ValidateAction: Pick<ValidateActionProps, "label" | "keybinds">;
@@ -0,0 +1 @@
1
+ export {};
@@ -1,18 +1,13 @@
1
- import type { OptionProps, OptionsGroupProps } from "@ostack.tech/ui";
2
- import type { Key, ReactNode } from "react";
3
- /** Object representation of an options group. */
4
- export type OptionsGroupObject<T = unknown> = Omit<OptionsGroupProps, "children"> & {
5
- /** Group's options. */
6
- options: OptionObject<T>[];
7
- /** Group's unique key. */
8
- key?: Key;
9
- };
10
- /** Object representation of an option. */
11
- export type OptionObject<T = unknown> = Omit<OptionProps, "value" | "children"> & {
12
- /** Option value. */
13
- value: T;
14
- /** Option's rendered text. */
15
- text?: ReactNode;
16
- /** Option's unique key. */
17
- key?: Key;
18
- };
1
+ import type { SelectControlItemGroupObject, SelectControlItemObject } from "../components/SelectControl";
2
+ /**
3
+ * @deprecated Use {@link SelectControlItemGroupObject} or
4
+ * {@link import("@ostack.tech/ui-kform").SelectMultipleControlItemGroupObject SelectMultipleControlItemGroupObject}
5
+ * instead.
6
+ */
7
+ export type OptionsGroupObject<T = unknown> = SelectControlItemGroupObject<T>;
8
+ /**
9
+ * @deprecated Use {@link SelectControlItemObject} or
10
+ * {@link import("@ostack.tech/ui-kform").SelectMultipleControlItemObject SelectMultipleControlItemObject}
11
+ * instead.
12
+ */
13
+ export type OptionObject<T = unknown> = SelectControlItemObject<T>;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Whether a given value is [promise-like]{@link PromiseLike}.
3
+ *
4
+ * @param value Value to check if it is promise-like.
5
+ * @returns Whether the provided value is like a promise.
6
+ */
7
+ export declare function isPromiseLike(value: unknown): value is PromiseLike<unknown>;