@sillsdev/config-r 1.0.0-alpha.22 → 1.0.0-alpha.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +26 -2
- package/dist/ConfigrLocalizations.d.ts +10 -0
- package/dist/ConfigrPane.d.ts +3 -0
- package/dist/ContentPane.d.ts +17 -9
- package/dist/configr.cjs.js +160 -138
- package/dist/configr.cjs.js.map +1 -1
- package/dist/configr.es.js +5235 -5052
- package/dist/configr.es.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/validation.d.ts +21 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export type ConfigrValidationResult = boolean | string;
|
|
3
|
+
export type ConfigrValidation<T> = (value: T) => ConfigrValidationResult;
|
|
4
|
+
export type ConfigrErrorMessageGetter = (data: Record<string, unknown>) => string | undefined;
|
|
5
|
+
export declare const RequiredMessageContext: React.Context<boolean>;
|
|
6
|
+
export declare const ActiveFieldPathContext: React.Context<string | undefined>;
|
|
7
|
+
export declare function getFieldPathFromEventTarget(target: EventTarget | null): string | undefined;
|
|
8
|
+
type ValidationMessageProps<T> = {
|
|
9
|
+
path: string;
|
|
10
|
+
value: T;
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
required?: boolean;
|
|
13
|
+
validation?: ConfigrValidation<T>;
|
|
14
|
+
getErrorMessage?: ConfigrErrorMessageGetter;
|
|
15
|
+
};
|
|
16
|
+
export declare function useValidationMessage<T>(props: ValidationMessageProps<T>): string | undefined;
|
|
17
|
+
type ValidationConfig<T> = Omit<ValidationMessageProps<T>, 'value' | 'disabled'> & {
|
|
18
|
+
disabled?: boolean;
|
|
19
|
+
};
|
|
20
|
+
export declare function useValidationMessageForValue<T>(config: ValidationConfig<T>, value: T, disabled?: boolean | undefined): string | undefined;
|
|
21
|
+
export {};
|