@sillsdev/config-r 1.0.0-alpha.33 → 1.0.0-alpha.35
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 +2 -1
- package/dist/ContentPane.d.ts +11 -8
- package/dist/configr.cjs.js +168 -116
- package/dist/configr.cjs.js.map +1 -1
- package/dist/configr.es.js +14721 -11764
- package/dist/configr.es.js.map +1 -1
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -37,7 +37,8 @@ Use [src/stories/bloom.stories.tsx](src/stories/bloom.stories.tsx) as the canoni
|
|
|
37
37
|
- `ConfigrPage` now requires `pageKey` and throws if it is missing. Keep these keys stable and unique within a pane.
|
|
38
38
|
- `ConfigrPage` children are restricted to `ConfigrGroup`, `ConfigrForEach`, or `ConfigrStatic`. Move any custom layout into `ConfigrGroup` or wrap text/UI-only blocks in `ConfigrStatic`.
|
|
39
39
|
- `ConfigrForEach` now uses a render signature of `(pathPrefix, index) => ReactNode`; build full Formik paths from the prefix (see the languages loop in the story).
|
|
40
|
-
- `ConfigrSelect`
|
|
40
|
+
- `ConfigrSelect` takes `{ value, label?, description? }` options whose values are strings or numbers; descriptions become tooltips, a missing label shows the value, and a label starting with `--` draws a divider. Bare numbers are no longer accepted as options; write `{ value: 12 }`.
|
|
41
|
+
- Choosing an option stores its `value` exactly as given, so `{ value: 0, label: 'Auto' }` stores the number `0`, not `'0'`; a stored number shows its option as selected. The select's value type is inferred from its options (`string`, `number`, or `string | number` when they mix, e.g. a `''` default beside numbers), and `validation` and `overrideValue` take that type. Each option's value must be distinct as text: a select can't hold both `1` and `'1'`, because MUI matches the selection as text and would show the first one's label.
|
|
41
42
|
- Override/locking behavior is standardized: most controls accept `overrideValue` + `overrideDescription`; `ConfigrBoolean` adds `locked` and `immediateEffect`.
|
|
42
43
|
- Leaf controls support `required` and `validation`. `validation` receives the current field value and may return `true`, `false`, or a string. `false` renders a generic `Invalid value` message, while a string is shown inline in red.
|
|
43
44
|
- Required fields show a `*` beside the control. The fallback `Required` message for empty required fields is controlled at the pane level with `showRequiredMessage` and defaults to `true`.
|
package/dist/ContentPane.d.ts
CHANGED
|
@@ -54,6 +54,7 @@ interface ICustomStringInputProps extends IConfigrProps<string> {
|
|
|
54
54
|
}>;
|
|
55
55
|
getErrorMessage?: ConfigrErrorMessageGetter;
|
|
56
56
|
}
|
|
57
|
+
export declare function useConfigrValue<T>(path: string): [T, (value: T) => void];
|
|
57
58
|
export declare const ConfigrCustomStringInput: React.FunctionComponent<React.PropsWithChildren<ICustomStringInputProps>>;
|
|
58
59
|
interface ICustomBooleanInputProps extends IConfigrProps<boolean> {
|
|
59
60
|
control: BooleanEditorComponent;
|
|
@@ -78,17 +79,18 @@ interface ICustomObjectInputProps<T> extends IConfigrProps<unknown> {
|
|
|
78
79
|
getErrorMessage?: ConfigrErrorMessageGetter;
|
|
79
80
|
}
|
|
80
81
|
export declare function ConfigrCustomObjectInput<T>(props: React.PropsWithChildren<ICustomObjectInputProps<T>>): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
81
|
-
interface
|
|
82
|
+
export interface ConfigrSelectOption<T extends string | number> {
|
|
83
|
+
value: T;
|
|
84
|
+
label?: string;
|
|
85
|
+
description?: string;
|
|
86
|
+
}
|
|
87
|
+
export type ConfigrSelectValue<O extends ConfigrSelectOption<string | number>> = O['value'] extends infer V ? (V extends string ? string : number) : never;
|
|
88
|
+
interface ISelectProps<O extends ConfigrSelectOption<string | number>> extends IConfigrProps<ConfigrSelectValue<O>> {
|
|
82
89
|
indented?: boolean;
|
|
83
|
-
options:
|
|
84
|
-
value: string;
|
|
85
|
-
label?: string;
|
|
86
|
-
description?: string;
|
|
87
|
-
} | number>;
|
|
90
|
+
options: O[];
|
|
88
91
|
enableWhen?: string | ((currentValues: object) => boolean);
|
|
89
|
-
getErrorMessage?: ConfigrErrorMessageGetter;
|
|
90
92
|
}
|
|
91
|
-
export declare
|
|
93
|
+
export declare function ConfigrSelect<O extends ConfigrSelectOption<string | number>>(originalProps: React.PropsWithChildren<ISelectProps<O>>): React.ReactElement;
|
|
92
94
|
export declare const ConfigrStatic: React.FunctionComponent<React.PropsWithChildren<{}>>;
|
|
93
95
|
export declare const ConfigrGroup: React.FunctionComponent<React.PropsWithChildren<{
|
|
94
96
|
label?: string;
|
|
@@ -96,6 +98,7 @@ export declare const ConfigrGroup: React.FunctionComponent<React.PropsWithChildr
|
|
|
96
98
|
description?: string | React.ReactNode;
|
|
97
99
|
getErrorMessage?: ConfigrErrorMessageGetter;
|
|
98
100
|
inFocussedPage?: boolean;
|
|
101
|
+
headerAction?: React.ReactNode;
|
|
99
102
|
}>>;
|
|
100
103
|
export type PageChild = React.ReactElement<typeof ConfigrGroup> | false | undefined | null;
|
|
101
104
|
export declare const ConfigrPage: React.FunctionComponent<React.PropsWithChildren<{
|