@ostack.tech/ui-kform 0.13.2 → 0.14.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 (32) hide show
  1. package/dist/chunks/{en-3JcwFYXc.js → en-Cb79GQnj.js} +8 -1
  2. package/dist/chunks/en-Cb79GQnj.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 +7 -0
  6. package/dist/locales/fr-FR.js.map +1 -1
  7. package/dist/locales/pt-PT.js +7 -0
  8. package/dist/locales/pt-PT.js.map +1 -1
  9. package/dist/ostack-ui-kform.css +10 -0
  10. package/dist/ostack-ui-kform.js +196 -181
  11. package/dist/ostack-ui-kform.js.map +1 -1
  12. package/dist/types/components/CheckboxControl/CheckboxControl.d.ts +1 -1
  13. package/dist/types/components/CheckboxGroupControl/CheckboxGroupControl.d.ts +3 -1
  14. package/dist/types/components/DateControl/DateControl.d.ts +1 -1
  15. package/dist/types/components/DateRangeControl/DateRangeControl.d.ts +1 -1
  16. package/dist/types/components/FileControl/FileControl.d.ts +1 -1
  17. package/dist/types/components/FormPages/FormPagesSelect.d.ts +2 -3
  18. package/dist/types/components/NumericControl/NumericControl.d.ts +1 -1
  19. package/dist/types/components/RadioGroupControl/RadioGroupControl.d.ts +3 -1
  20. package/dist/types/components/SelectControl/SelectControl.d.ts +3 -1
  21. package/dist/types/components/SelectMultipleControl/SelectMultipleControl.d.ts +5 -3
  22. package/dist/types/components/TextControl/TextControl.d.ts +2 -2
  23. package/dist/types/components/UnknownValue/UnknownValue.d.ts +9 -0
  24. package/dist/types/components/UnknownValue/index.d.ts +1 -0
  25. package/dist/types/providers/LocalizationProvider/LocalizationObject.d.ts +10 -0
  26. package/dist/types/utils/selectionTransformations.d.ts +11 -3
  27. package/package.json +8 -8
  28. package/scss/_utils.scss +1 -0
  29. package/scss/components/UnknownValue/_UnknownValue-variables.scss +10 -0
  30. package/scss/components/UnknownValue/_UnknownValue.scss +14 -0
  31. package/scss/index.scss +1 -0
  32. package/dist/chunks/en-3JcwFYXc.js.map +0 -1
@@ -4,7 +4,7 @@ import { Checkbox, CheckboxChecked } from '@ostack.tech/ui';
4
4
  import { ComponentPropsWithoutRef, ComponentPropsWithRef, ComponentRef, ReactNode, Ref } from 'react';
5
5
  import { IssueMessages, IssueMessagesByCode } from '../IssueMessages';
6
6
  /** Properties of the checkbox control component. */
7
- export interface CheckboxControlProps<T extends boolean | null = boolean | null> extends Omit<InputOptions<T, CheckboxChecked, ComponentRef<typeof Checkbox>>, "enabled" | "format" | "parse">, Omit<ComponentPropsWithoutRef<typeof Checkbox>, "defaultChecked" | "checked" | "status"> {
7
+ export interface CheckboxControlProps<T extends boolean | null = boolean | null> extends Omit<InputOptions<T, CheckboxChecked, ComponentRef<typeof Checkbox>>, "enabled" | "format" | "parse">, Omit<ComponentPropsWithoutRef<typeof Checkbox>, "defaultChecked" | "checked" | "status" | "validate" | "validationMode"> {
8
8
  /** Path to the value. */
9
9
  path?: string | Path;
10
10
  /**
@@ -13,7 +13,7 @@ export type CheckboxObject<T = unknown> = Omit<ComponentPropsWithRef<typeof Chec
13
13
  key?: Key;
14
14
  };
15
15
  /** Properties of the checkbox group control component. */
16
- export interface CheckboxGroupControlProps<T = unknown, TListable extends Listable<T> | null = Listable<T> | null> extends Omit<ListableInputOptions<T, TListable, string[], ComponentRef<typeof CheckboxGroup>>, "enabled" | "formatFromArray" | "parseToArray">, Omit<ComponentPropsWithoutRef<typeof CheckboxGroup>, "defaultValue" | "value" | "onValueChange" | "children" | "status"> {
16
+ export interface CheckboxGroupControlProps<T = unknown, TListable extends Listable<T> | null = Listable<T> | null> extends Omit<ListableInputOptions<T, TListable, T[] | null, ComponentRef<typeof CheckboxGroup>>, "enabled" | "formatFromArray" | "parseToArray">, Omit<ComponentPropsWithoutRef<typeof CheckboxGroup>, "defaultValue" | "value" | "onValueChange" | "children" | "status" | "validate" | "validationMode"> {
17
17
  /** Path to the value. */
18
18
  path?: string | Path;
19
19
  /** Checkbox group control options. */
@@ -37,6 +37,8 @@ export interface CheckboxGroupControlProps<T = unknown, TListable extends Listab
37
37
  * @default true
38
38
  */
39
39
  displayIssues?: boolean;
40
+ /** Label shown when a value of the control isn't one of the existing options. */
41
+ unknownValueLabel?: ReactNode;
40
42
  /**
41
43
  * Whether to prevent the auto-focusing behaviour that causes this control to
42
44
  * be focused when the form app's `focus` is called with this control's path.
@@ -4,7 +4,7 @@ import { DateInput } from '@ostack.tech/ui';
4
4
  import { ComponentPropsWithoutRef, ComponentPropsWithRef, ComponentRef, ReactNode, Ref } from 'react';
5
5
  import { IssueMessages, IssueMessagesByCode } 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"> {
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"> {
8
8
  /** Path to the value. */
9
9
  path?: string | Path;
10
10
  /**
@@ -4,7 +4,7 @@ import { DateRangeInput } from '@ostack.tech/ui';
4
4
  import { ComponentPropsWithoutRef, ComponentPropsWithRef, ReactNode, Ref } from 'react';
5
5
  import { IssueMessages, IssueMessagesByCode } 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"> {
7
+ export interface DateRangeControlProps<TStart extends Temporal | null = Temporal | null, TEnd extends Temporal | null = TStart> extends Omit<ComponentPropsWithoutRef<typeof DateRangeInput>, "defaultValue" | "value" | "validate" | "validationMode"> {
8
8
  /** Path to the start value. */
9
9
  startPath: string | Path;
10
10
  /** Path to the end value. */
@@ -15,7 +15,7 @@ import { 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"> {
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"> {
19
19
  /** Path to the value. */
20
20
  path?: string | Path;
21
21
  /**
@@ -1,7 +1,6 @@
1
- import { Select } from '@ostack.tech/ui';
2
- import { ComponentPropsWithoutRef } from 'react';
1
+ import { SelectSingleProps } from '@ostack.tech/ui';
3
2
  /** Properties of the form pages select component. */
4
- export interface FormPagesSelectProps extends Omit<ComponentPropsWithoutRef<typeof Select>, "multiple" | "defaultValue" | "value" | "onValueChange" | "showClearButton"> {
3
+ export interface FormPagesSelectProps extends Omit<SelectSingleProps, "defaultValue" | "value" | "onValueChange" | "showClearButton"> {
5
4
  }
6
5
  /** Select component allowing the navigation between form pages. */
7
6
  export declare const FormPagesSelect: import('react').ForwardRefExoticComponent<FormPagesSelectProps & import('react').RefAttributes<HTMLButtonElement>>;
@@ -4,7 +4,7 @@ import { NumericInput } from '@ostack.tech/ui';
4
4
  import { ComponentPropsWithoutRef, ComponentPropsWithRef, ComponentRef, ReactNode, Ref } from 'react';
5
5
  import { IssueMessages, IssueMessagesByCode } from '../IssueMessages';
6
6
  /** Properties of the numeric control component. */
7
- export interface NumericControlProps<T extends Numeric | null = Numeric | null> extends Omit<NumericInputOptions<T, string, ComponentRef<typeof NumericInput>>, "enabled" | "formatFromString" | "parseToString">, Omit<ComponentPropsWithoutRef<typeof NumericInput>, "defaultValue" | "value" | "onValueChange" | "valueIsUnformattedString" | "status"> {
7
+ export interface NumericControlProps<T extends Numeric | null = Numeric | null> extends Omit<NumericInputOptions<T, string, ComponentRef<typeof NumericInput>>, "enabled" | "formatFromString" | "parseToString">, Omit<ComponentPropsWithoutRef<typeof NumericInput>, "defaultValue" | "value" | "onValueChange" | "valueIsUnformattedString" | "status" | "validate" | "validationMode"> {
8
8
  /** Path to the value. */
9
9
  path?: string | Path;
10
10
  /**
@@ -13,7 +13,7 @@ export type RadioObject<T = unknown> = Omit<ComponentPropsWithRef<typeof Radio>,
13
13
  key?: Key;
14
14
  };
15
15
  /** Properties of the radio group control component. */
16
- export interface RadioGroupControlProps<T = unknown> extends Omit<InputOptions<T, string, ComponentRef<typeof RadioGroup>>, "enabled" | "format" | "parse">, Omit<ComponentPropsWithoutRef<typeof RadioGroup>, "defaultValue" | "value" | "onValueChange" | "children" | "status"> {
16
+ export interface RadioGroupControlProps<T = unknown> extends Omit<InputOptions<T, T, ComponentRef<typeof RadioGroup>>, "enabled" | "format" | "parse">, Omit<ComponentPropsWithoutRef<typeof RadioGroup>, "defaultValue" | "value" | "onValueChange" | "children" | "status" | "validate" | "validationMode"> {
17
17
  /** Path to the value. */
18
18
  path?: string | Path;
19
19
  /** RadioGroup control options. */
@@ -37,6 +37,8 @@ export interface RadioGroupControlProps<T = unknown> extends Omit<InputOptions<T
37
37
  * @default true
38
38
  */
39
39
  displayIssues?: boolean;
40
+ /** Label shown when the control's value isn't one of the existing options. */
41
+ unknownValueLabel?: ReactNode;
40
42
  /**
41
43
  * Whether to prevent the auto-focusing behaviour that causes this control to
42
44
  * be focused when the form app's `focus` is called with this control's path.
@@ -5,7 +5,7 @@ import { ComponentPropsWithoutRef, ComponentPropsWithRef, ComponentRef, ReactNod
5
5
  import { OptionObject, OptionsGroupObject } from '../../utils/options.ts';
6
6
  import { IssueMessages, IssueMessagesByCode } from '../IssueMessages';
7
7
  /** Properties of the select control component. */
8
- export interface SelectControlProps<T = unknown> extends Omit<InputOptions<T, string, ComponentRef<typeof Select>>, "enabled" | "format" | "parse">, Omit<ComponentPropsWithoutRef<typeof Select>, "multiple" | "defaultValue" | "value" | "onValueChange" | "children" | "status"> {
8
+ export interface SelectControlProps<T = unknown> extends Omit<InputOptions<T, T, ComponentRef<typeof Select>>, "enabled" | "format" | "parse">, Omit<ComponentPropsWithoutRef<typeof Select>, "multiple" | "defaultValue" | "value" | "onValueChange" | "children" | "status" | "validate" | "validationMode"> {
9
9
  /** Path to the value. */
10
10
  path?: string | Path;
11
11
  /** Select control options. */
@@ -29,6 +29,8 @@ export interface SelectControlProps<T = unknown> extends Omit<InputOptions<T, st
29
29
  * @default true
30
30
  */
31
31
  displayIssues?: boolean;
32
+ /** Label shown when the control's value isn't one of the existing options. */
33
+ unknownValueLabel?: ReactNode;
32
34
  /**
33
35
  * Whether to prevent the auto-focusing behaviour that causes this control to
34
36
  * be focused when the form app's `focus` is called with this control's path.
@@ -5,9 +5,11 @@ import { ComponentPropsWithoutRef, ComponentPropsWithRef, ComponentRef, ReactNod
5
5
  import { OptionObject, OptionsGroupObject } from '../../utils/options.ts';
6
6
  import { IssueMessages, IssueMessagesByCode } from '../IssueMessages';
7
7
  /** Properties of the select multiple control component. */
8
- export interface SelectMultipleControlProps<T = unknown, TListable extends Listable<T> | null = Listable<T> | null> extends Omit<ListableInputOptions<T, TListable, string[], ComponentRef<typeof Select>>, "enabled" | "formatFromArray" | "parseToArray">, Omit<ComponentPropsWithoutRef<typeof Select>, "multiple" | "defaultValue" | "value" | "onValueChange" | "children" | "status"> {
8
+ export interface SelectMultipleControlProps<T = unknown, TListable extends Listable<T> | null = Listable<T> | null> extends Omit<ListableInputOptions<T, TListable, T[] | null, ComponentRef<typeof Select>>, "enabled" | "formatFromArray" | "parseToArray">, Omit<ComponentPropsWithoutRef<typeof Select>, "multiple" | "defaultValue" | "value" | "onValueChange" | "children" | "status" | "validate" | "validationMode"> {
9
9
  /** Path to the value. */
10
10
  path?: string | Path;
11
+ /** Select multiple control options. */
12
+ options: (OptionsGroupObject<T> | OptionObject<T>)[];
11
13
  /**
12
14
  * Issue messages of this control.
13
15
  *
@@ -27,8 +29,8 @@ export interface SelectMultipleControlProps<T = unknown, TListable extends Lista
27
29
  * @default true
28
30
  */
29
31
  displayIssues?: boolean;
30
- /** Select multiple control options. */
31
- options: (OptionsGroupObject<T> | OptionObject<T>)[];
32
+ /** Label shown when a value of the control isn't one of the existing options. */
33
+ unknownValueLabel?: ReactNode;
32
34
  /**
33
35
  * Whether to prevent the auto-focusing behaviour that causes this control to
34
36
  * be focused when the form app's `focus` is called with this control's path.
@@ -5,10 +5,10 @@ import { ComponentPropsWithoutRef, ComponentPropsWithRef, ComponentRef, ReactNod
5
5
  import { IssueMessages, IssueMessagesByCode } from '../IssueMessages';
6
6
  /** Properties of the text control component. */
7
7
  export type TextControlProps<T extends string | null = string | null> = TextControlPropsSingleline<T> | TextControlPropsMultiline<T>;
8
- export type TextControlPropsSingleline<T extends string | null = string | null> = Omit<ComponentPropsWithoutRef<typeof Input>, "defaultValue" | "value" | "status"> & TextControlPropsBase<T> & {
8
+ export type TextControlPropsSingleline<T extends string | null = string | null> = Omit<ComponentPropsWithoutRef<typeof Input>, "defaultValue" | "value" | "onValueChange" | "status" | "validate" | "validationMode"> & TextControlPropsBase<T> & {
9
9
  multiline?: false;
10
10
  };
11
- export type TextControlPropsMultiline<T extends string | null = string | null> = Omit<ComponentPropsWithoutRef<typeof TextArea>, "defaultValue" | "value" | "status"> & TextControlPropsBase<T> & {
11
+ export type TextControlPropsMultiline<T extends string | null = string | null> = Omit<ComponentPropsWithoutRef<typeof TextArea>, "defaultValue" | "value" | "onValueChange" | "status" | "validate" | "validationMode"> & TextControlPropsBase<T> & {
12
12
  multiline: true;
13
13
  pattern?: never;
14
14
  };
@@ -0,0 +1,9 @@
1
+ import { ReactNode } from 'react';
2
+ /** Properties of the unknown value component. */
3
+ export interface UnknownValueProps<T = unknown> {
4
+ value?: T;
5
+ /** Label shown when a value isn't one of the existing options. */
6
+ label?: ReactNode;
7
+ }
8
+ /** Representation of an unknown value. */
9
+ export declare function UnknownValue<T = unknown>({ value, label, }: UnknownValueProps<T>): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1 @@
1
+ export * from './UnknownValue.tsx';
@@ -1,5 +1,6 @@
1
1
  import { LocalizationObject as UiLocalizationObject } from '@ostack.tech/ui';
2
2
  import { AnnexesManagerProps } from '../../components/Annexes';
3
+ import { CheckboxGroupControlProps } from '../../components/CheckboxGroupControl';
3
4
  import { DateRangeControlProps } from '../../components/DateRangeControl';
4
5
  import { FileControlProps } from '../../components/FileControl';
5
6
  import { FormAppProps } from '../../components/FormApp';
@@ -9,14 +10,19 @@ import { IssuesPanelProps } from '../../components/IssuesPanel';
9
10
  import { IssuesPopoverProps } from '../../components/IssuesPopover';
10
11
  import { LoadActionProps } from '../../components/LoadAction';
11
12
  import { PrintActionProps } from '../../components/PrintAction';
13
+ import { RadioGroupControlProps } from '../../components/RadioGroupControl';
12
14
  import { SaveActionProps } from '../../components/SaveAction';
15
+ import { SelectControlProps } from '../../components/SelectControl';
16
+ import { SelectMultipleControlProps } from '../../components/SelectMultipleControl';
13
17
  import { SubmitActionProps } from '../../components/SubmitAction';
14
18
  import { TableControlAddRowTriggerChildlessProps, TableControlRemoveRowTriggerChildlessProps } from '../../components/TableControl';
19
+ import { UnknownValueProps } from '../../components/UnknownValue';
15
20
  import { ValidateActionProps } from '../../components/ValidateAction';
16
21
  /** Localization object representation. */
17
22
  export interface LocalizationObject {
18
23
  baseLocale: UiLocalizationObject;
19
24
  AnnexesManager: Pick<AnnexesManagerProps, "aria-label" | "menuButtonText" | "menuButtonLabel" | "addAnnexText" | "addAnnexSuccessMessage" | "removeAnnexButtonLabel" | "removeAnnexKeyboardHint" | "removeAnnexConfirmDialogTitle" | "removeAnnexConfirmDialogMessage" | "removeAnnexConfirmDialogOkText" | "removeAnnexConfirmDialogCancelText">;
25
+ CheckboxGroupControl: Pick<CheckboxGroupControlProps, "unknownValueLabel">;
20
26
  DateRangeControl: Pick<DateRangeControlProps, "issuesPanelStartLabelSuffix" | "issuesPanelEndLabelSuffix">;
21
27
  FileControl: Pick<FileControlProps, "clearDescription" | "viewFileButtonLabel" | "downloadFileButtonLabel" | "fallbackText">;
22
28
  FormApp: Pick<FormAppProps, "formTitle" | "issuesPanelLabel" | "issueMessages" | "confirmUnloadMessage">;
@@ -26,10 +32,14 @@ export interface LocalizationObject {
26
32
  IssuesPanel: Pick<IssuesPanelProps, "errorsLabel" | "warningsLabel" | "focusButtonLabel" | "focusKeybinds" | "previousIssueButtonLabel" | "previousIssueKeybinds" | "nextIssueButtonLabel" | "nextIssueKeybinds" | "firstIssueButtonLabel" | "firstIssueKeybinds" | "lastIssueButtonLabel" | "lastIssueKeybinds" | "paginationLabel" | "noIssuesMessage" | "resolvedTitle" | "resolvedMessage">;
27
33
  IssuesPopover: Pick<IssuesPopoverProps, "label">;
28
34
  LoadAction: Pick<LoadActionProps, "label" | "keybinds" | "successMessage" | "errorMessage">;
35
+ RadioGroupControl: Pick<RadioGroupControlProps, "unknownValueLabel">;
29
36
  SaveAction: Pick<SaveActionProps, "label" | "keybinds" | "saveOptionsLabel" | "saveAsLabel" | "saveAsKeybinds" | "successMessage" | "errorMessage">;
37
+ SelectControl: Pick<SelectControlProps, "unknownValueLabel">;
38
+ SelectMultipleControl: Pick<SelectMultipleControlProps, "unknownValueLabel">;
30
39
  PrintAction: Pick<PrintActionProps, "label" | "keybinds">;
31
40
  SubmitAction: Pick<SubmitActionProps, "label" | "keybinds" | "dialogTitle" | "dialogDescription" | "dialogBody" | "dialogOkText" | "dialogCancelText" | "confirmWarningsCheckboxLabel" | "successMessage" | "errorMessage">;
32
41
  TableControlAddRowTrigger: Pick<TableControlAddRowTriggerChildlessProps, "label">;
33
42
  TableControlRemoveRowTrigger: Pick<TableControlRemoveRowTriggerChildlessProps, "label" | "confirmDialogTitle" | "confirmDialogMessage" | "confirmDialogOkText" | "confirmDialogCancelText">;
43
+ UnknownValue: Pick<UnknownValueProps, "label">;
34
44
  ValidateAction: Pick<ValidateActionProps, "label" | "keybinds">;
35
45
  }
@@ -2,13 +2,17 @@ import { Schema } from '@ostack.tech/kform';
2
2
  import { Listable } from '@ostack.tech/kform-react';
3
3
  import { JSX } from 'react';
4
4
  import { OptionObject, OptionsGroupObject } from './options.ts';
5
+ /** Whether the provided value isn't a known option. */
6
+ export declare function isUnknownValue<T>(value: T | null | undefined, options: {
7
+ value: T;
8
+ }[]): boolean;
5
9
  /**
6
10
  * Parses a selection value from the (string) index of an option (or empty
7
11
  * string).
8
12
  */
9
13
  export declare function parseSelectionValueFromOptionIndex<T>(formattedValue: string, schema: Schema<T>, options: {
10
14
  value: T;
11
- }[]): T;
15
+ }[], unknownValues: T[]): T;
12
16
  /**
13
17
  * Formats a selection value as the (string) index of an option (or empty
14
18
  * string).
@@ -16,14 +20,18 @@ export declare function parseSelectionValueFromOptionIndex<T>(formattedValue: st
16
20
  export declare function formatSelectionValueAsOptionIndex<T>(value: T | undefined, options: {
17
21
  value: T;
18
22
  }[]): string;
23
+ /** Values that aren't known options. */
24
+ export declare function getUnknownValues<T>(arrayValue: T[] | null | undefined, options: {
25
+ value: T;
26
+ }[]): T[];
19
27
  /** Parses an array of selection values from an array of (string) option indices. */
20
28
  export declare function parseSelectionValuesFromOptionIndices<T, TListable extends Listable<T> | null>(formattedValue: string[], schema: Schema<TListable>, options: {
21
29
  value: T;
22
- }[]): T[] | null;
30
+ }[], unknownValues: T[]): T[] | null;
23
31
  /** Formats an array of selection values as an array of (string) option indices. */
24
32
  export declare function formatSelectionValuesAsOptionIndices<T>(arrayValue: T[] | null | undefined, options: {
25
33
  value: T;
26
- }[]): string[];
34
+ }[], unknownValues: T[]): string[];
27
35
  /**
28
36
  * Transforms option objects into React nodes.
29
37
  *
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.13.2",
4
+ "version": "0.14.1",
5
5
  "homepage": "https://ui.ostack.tech/",
6
6
  "author": {
7
7
  "name": "Opensoft",
@@ -48,14 +48,14 @@
48
48
  "@fortawesome/fontawesome-svg-core": "^6.2.0 || ^7.0.0",
49
49
  "@fortawesome/free-regular-svg-icons": "^6.2.0 || ^7.0.0",
50
50
  "@fortawesome/free-solid-svg-icons": "^6.2.0 || ^7.0.0",
51
- "@ostack.tech/kform": "~0.32.0",
52
- "@ostack.tech/kform-react": "~0.32.0",
53
- "@ostack.tech/ui": "~0.13.2",
54
- "@types/react": "^18.0.0 || ^19.0.0",
55
- "@types/react-dom": "^18.0.0 || ^19.0.0",
51
+ "@ostack.tech/kform": "~0.34.1",
52
+ "@ostack.tech/kform-react": "~0.34.1",
53
+ "@ostack.tech/ui": "~0.14.1",
54
+ "@types/react": "^19.0.0",
55
+ "@types/react-dom": "^19.0.0",
56
56
  "date-fns": "^4.1.0",
57
- "react": "^18.0.0 || ^19.0.0",
58
- "react-dom": "^18.0.0 || ^19.0.0",
57
+ "react": "^19.0.0",
58
+ "react-dom": "^19.0.0",
59
59
  "react-to-print": "^3.0.0",
60
60
  "zustand": "^5.0.0"
61
61
  },
package/scss/_utils.scss CHANGED
@@ -6,3 +6,4 @@
6
6
  @forward "components/FormPages/FormPages-variables";
7
7
  @forward "components/IssuesPanel/IssuesPanel-variables";
8
8
  @forward "components/TopBar/TopBar-variables";
9
+ @forward "components/UnknownValue/UnknownValue-variables";
@@ -0,0 +1,10 @@
1
+ @use "@ostack.tech/ui/scss/utils" as o-ui;
2
+ @use "../../scss/base-variables" as *;
3
+
4
+ $unknown-value-text-decoration: underline !default;
5
+ $unknown-value-text-decoration-color: var(--#{o-ui.$prefix}danger-a7) !default;
6
+ $unknown-value-text-decoration-thickness: 2px !default;
7
+
8
+ // Label
9
+ $unknown-value-label-font-style: italic !default;
10
+ $unknown-value-label-opacity: o-ui.$control-placeholder-opacity !default;
@@ -0,0 +1,14 @@
1
+ @use "@ostack.tech/ui/scss/utils" as o-ui;
2
+ @use "UnknownValue-variables" as *;
3
+ @use "../../scss/base-variables" as *;
4
+
5
+ .#{$prefix}unknown-value {
6
+ text-decoration: $unknown-value-text-decoration;
7
+ text-decoration-color: $unknown-value-text-decoration-color;
8
+ text-decoration-thickness: $unknown-value-text-decoration-thickness;
9
+
10
+ &__label {
11
+ font-style: $unknown-value-label-font-style;
12
+ opacity: $unknown-value-label-opacity;
13
+ }
14
+ }
package/scss/index.scss CHANGED
@@ -9,3 +9,4 @@
9
9
  @forward "components/IssuesAlert/IssuesAlert";
10
10
  @forward "components/IssuesPanel/IssuesPanel";
11
11
  @forward "components/TopBar/TopBar";
12
+ @forward "components/UnknownValue/UnknownValue";
@@ -1 +0,0 @@
1
- {"version":3,"file":"en-3JcwFYXc.js","sources":["../../src/locales/en.tsx"],"sourcesContent":["import type { LocalizationObject } from \"../providers/LocalizationProvider\";\n\n/** `en` locale (partial). */\nexport const en: Omit<LocalizationObject, \"languageTag\" | \"baseLocale\"> = {\n AnnexesManager: {\n \"aria-label\": \"Annexes\",\n menuButtonText: \"Annexes\",\n menuButtonLabel: \"Annexes manager\",\n addAnnexText: \"Add annex\",\n removeAnnexButtonLabel: \"Remove annex\",\n removeAnnexKeyboardHint: \"Press “Delete” to remove the annex.\",\n removeAnnexConfirmDialogTitle: \"Remove annex\",\n removeAnnexConfirmDialogMessage: (annexName) => (\n <>Are you sure you want to remove annex {annexName}?</>\n ),\n removeAnnexConfirmDialogOkText: \"Remove\",\n },\n DateRangeControl: {\n issuesPanelStartLabelSuffix: \" (start date)\",\n issuesPanelEndLabelSuffix: \" (end date)\",\n },\n FileControl: {\n clearDescription: \"Press Backspace or Delete to clear.\",\n viewFileButtonLabel: \"View file\",\n downloadFileButtonLabel: \"Download file\",\n fallbackText: (\n <>\n The selected file cannot be viewed in this browser.\n <br />\n Please use the button above to download the file. You can then open it\n using an external application.\n </>\n ),\n },\n FormApp: {\n formTitle: \"Form\",\n issueMessages: {\n \"/**\": {\n valueMissing: \"Field is required.\",\n valueDisallowed: \"Indicated value is not allowed.\",\n rangeUnderflow: \"Value is under the minimum allowed.\",\n rangeOverflow: \"Value exceeds the maximum allowed.\",\n lengthMismatch: (_data, { typeInfo: { name, restrictions } }) =>\n name === \"String\" &&\n typeof restrictions.minLength === \"number\" &&\n restrictions.minLength === restrictions.maxLength\n ? `Value must have ${restrictions.minLength} character${\n restrictions.minLength === 1 ? \"\" : \"s\"\n }.`\n : \"Value has an invalid length.\",\n tooShort: (_data, { typeInfo: { name, restrictions } }) =>\n name === \"String\" && typeof restrictions.minLength === \"number\"\n ? `Value must not have under ${restrictions.minLength} character${\n restrictions.minLength === 1 ? \"\" : \"s\"\n }.`\n : \"Value is too short.\",\n tooLong: (_data, { typeInfo: { name, restrictions } }) =>\n name === \"String\" && typeof restrictions.maxLength === \"number\"\n ? `Value must not have over ${restrictions.maxLength} character${\n restrictions.maxLength === 1 ? \"\" : \"s\"\n }.`\n : \"Value is too long.\",\n sizeMismatch: (_data, { typeInfo: { restrictions } }) =>\n typeof restrictions.minSize === \"number\" &&\n restrictions.minSize === restrictions.maxSize\n ? `Field must have ${restrictions.minSize} item${\n restrictions.minSize === 1 ? \"\" : \"s\"\n }.`\n : \"Field has an invalid number of items.\",\n tooSmall: (_data, { typeInfo: { restrictions } }) =>\n typeof restrictions.minLength === \"number\"\n ? `Field must not have under ${restrictions.minLength} item${\n restrictions.minLength === 1 ? \"\" : \"s\"\n }.`\n : \"Field does not have enough items.\",\n tooLarge: (_data, { typeInfo: { restrictions } }) =>\n typeof restrictions.maxLength === \"number\"\n ? `Field must not have over ${restrictions.maxLength} item${\n restrictions.maxLength === 1 ? \"\" : \"s\"\n }.`\n : \"Number of items of field exceeds allowed limit.\",\n scaleMismatch: (_data, { typeInfo: { restrictions } }) =>\n typeof restrictions.scale === \"number\"\n ? `Value must have ${restrictions.scale} decimal place${\n restrictions.scale === 1 ? \"\" : \"s\"\n }.`\n : \"Value has invalid number of decimal places.\",\n patternMismatch: \"Value does not follow required pattern.\",\n emailPatternMismatch: \"Invalid email address.\",\n fileTypeMismatch: (_data, { typeInfo: { restrictions } }) =>\n Array.isArray(restrictions.acceptedFileTypes)\n ? `Only the following file types are allowed: ${restrictions.acceptedFileTypes.join(\", \")}.`\n : \"Indicated file’s type is not allowed.\",\n itemsRepeated: ({ firstIndex, secondIndex }) =>\n firstIndex != null && secondIndex != null\n ? `Items ${+firstIndex + 1} and ${+secondIndex + 1} are repeated.`\n : \"Field contains repeated items.\",\n computedValueMismatch: \"Value differs from the computed value.\",\n validationFailed: (data) =>\n process.env.NODE_ENV !== \"production\"\n ? data.exception\n : \"Something went wrong validating this field. \" +\n \"Please try again later.\",\n },\n },\n confirmUnloadMessage:\n \"Are you sure you want to leave the page? \" +\n \"Changes you made to the form may not have been saved.\",\n },\n FormPagesNavigation: {\n \"aria-label\": \"Pages\",\n },\n FormPage: {\n helperButtonLabel: \"Show help\",\n visuallyHiddenCodePrefix: \"Page\",\n },\n IssueMessages: {\n visuallyHiddenErrorCodePrefix: \"Error code,\",\n visuallyHiddenWarningCodePrefix: \"Warning code,\",\n unknownErrorMessage: \"Field with unknown error.\",\n unknownWarningMessage: \"Field with unknown warning.\",\n },\n IssuesPanel: {\n errorsLabel: (errors) =>\n errors === undefined ? (\n \"Errors\"\n ) : (\n <>\n {errors}&nbsp;{errors === 1 ? \"Error\" : \"Errors\"}\n </>\n ),\n warningsLabel: (warnings) =>\n warnings === undefined ? (\n \"Warnings\"\n ) : (\n <>\n {warnings}&nbsp;{warnings === 1 ? \"Warning\" : \"Warnings\"}\n </>\n ),\n focusButtonLabel: \"Focus field\",\n previousIssueButtonLabel: \"Previous field with issues\",\n nextIssueButtonLabel: \"Next field with issues\",\n firstIssueButtonLabel: \"First field with issues\",\n lastIssueButtonLabel: \"Last field with issues\",\n paginationLabel: (currentPage, totalPages) =>\n `Field with issues ${currentPage} of ${totalPages}.`,\n noIssuesMessage: \"No issues to report.\",\n resolvedTitle: \"Resolved\",\n resolvedMessage:\n \"Issues have been resolved. \" +\n \"Please advance to the next field with issues.\",\n },\n IssuesPopover: {\n label: \"Show issues\",\n },\n LoadAction: {\n label: \"Load\",\n successMessage: (file) => `File “${file.name}” loaded successfully.`,\n errorMessage: (file) =>\n file\n ? `Unable to load file “${file.name}”. ` +\n \"Please confirm that the indicated file is a valid file of the form.\"\n : \"Unable to load the indicated file. Please confirm that you have \" +\n \"the appropriate permissions to perform the operation.\",\n },\n PrintAction: {\n label: \"Print\",\n },\n SaveAction: {\n label: \"Save\",\n saveOptionsLabel: \"Save options\",\n saveAsLabel: \"Save as…\",\n successMessage: (fileHandle) =>\n `File “${fileHandle.name}” saved successfully.`,\n errorMessage: (fileHandle) =>\n fileHandle\n ? `Unable to save file “${fileHandle.name}”. ` +\n \"Please confirm that you have the appropriate permissions to \" +\n \"perform the operation.\"\n : \"Unable to save the indicated file. Please confirm that you have \" +\n \"the appropriate permissions to perform the operation.\",\n },\n SubmitAction: {\n label: \"Submit\",\n dialogTitle: \"Submit form\",\n dialogDescription:\n \"Please confirm that you wish to proceed with the form submission.\",\n dialogCancelText: \"Cancel\",\n confirmWarningsCheckboxLabel:\n \"I declare that I have been informed of the warnings generated by the \" +\n \"data in this form and that I wish to proceed without changing said \" +\n \"data.\",\n successMessage: \"Form submitted successfully.\",\n errorMessage:\n \"Something went wrong while submitting the form. Please try again later.\",\n },\n TableControlAddRowTrigger: {\n label: \"Add row\",\n },\n TableControlRemoveRowTrigger: {\n label: \"Remove row\",\n confirmDialogTitle: \"Remove row\",\n confirmDialogMessage: (index) => (\n <>Are you sure you want to remove line #{index + 1}?</>\n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