@sillsdev/config-r 1.0.0-alpha.17 → 1.0.0-alpha.19
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 +19 -2
- package/dist/ConfigrPane.d.ts +5 -5
- package/dist/ContentPane.d.ts +16 -6
- package/dist/configr.cjs.js +454 -0
- package/dist/configr.cjs.js.map +1 -0
- package/dist/configr.es.js +25364 -7299
- package/dist/configr.es.js.map +1 -1
- package/package.json +14 -13
- package/dist/configr.umd.js +0 -235
- package/dist/configr.umd.js.map +0 -1
package/README.md
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
A React library for a settings UI similar to that of Chrome.
|
|
4
4
|
|
|
5
|
-
[](https://www.repostatus.org/#wip)
|
|
6
6
|
|
|
7
|
-
> :warning: We ship this as part of our [product](https://github.com/BloomBooks/BloomDesktop), but search has not made it to production yet. In addition, we may make visual changes over time.
|
|
7
|
+
> :warning: We ship this as part of our [product](https://github.com/BloomBooks/BloomDesktop), but search has not made it to production yet. In addition, we may make visual changes over time. For now, the only documentation is the code and the storybook stories.
|
|
8
8
|
|
|
9
9
|
## Screenshots
|
|
10
10
|
|
|
@@ -12,6 +12,10 @@ A React library for a settings UI similar to that of Chrome.
|
|
|
12
12
|
|
|
13
13
|

|
|
14
14
|
|
|
15
|
+
## Demo
|
|
16
|
+
|
|
17
|
+
You can play around with [the disorganized stories](https://sillsdev.github.io/config-r).
|
|
18
|
+
|
|
15
19
|
## Running
|
|
16
20
|
|
|
17
21
|
```
|
|
@@ -24,3 +28,16 @@ yarn dev
|
|
|
24
28
|
```
|
|
25
29
|
npm install @sillsdev/config-r
|
|
26
30
|
```
|
|
31
|
+
|
|
32
|
+
## Migration from v1.0.0-alpha.15 to v1.0.0-alpha18
|
|
33
|
+
|
|
34
|
+
Use [src/stories/bloom.stories.tsx](src/stories/bloom.stories.tsx) as the canonical reference for alpha18 API usage. The current codebase enforces several structural rules and new props; the fastest path is to align your code with those patterns.
|
|
35
|
+
|
|
36
|
+
- `ConfigrPane` children must be `ConfigrPage` or `ConfigrArea` elements only. Wrap groups of pages in `ConfigrArea` to get the left-nav section headings.
|
|
37
|
+
- `ConfigrPage` now requires `pageKey` and throws if it is missing. Keep these keys stable and unique within a pane.
|
|
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
|
+
- `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` options accept numbers or `{ label, value, description }` objects; descriptions become tooltips.
|
|
41
|
+
- Override/locking behavior is standardized: most controls accept `overrideValue` + `overrideDescription`; `ConfigrBoolean` adds `locked` and `immediateEffect`.
|
|
42
|
+
- Custom inputs use `ConfigrCustomStringInput`, `ConfigrCustomNumberInput`, or `ConfigrCustomObjectInput` with a `control` component that receives `value`, `onChange`, and `disabled`.
|
|
43
|
+
- `ConfigrPane` adds UI props like `showAppBar`, `showSearch`, `showJson`, `themeOverrides`, and `initiallySelectedTopLevelPageIndex`.
|
package/dist/ConfigrPane.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { ThemeOptions } from '@mui/material';
|
|
2
|
+
import { ConfigrArea, ConfigrPage, ConfigrValues } from './ContentPane';
|
|
2
3
|
import * as React from 'react';
|
|
3
|
-
import { ConfigrPage } from './ContentPane';
|
|
4
4
|
export declare const ConfigrPane: React.FunctionComponent<React.PropsWithChildren<{
|
|
5
5
|
label: string;
|
|
6
|
-
initialValues:
|
|
7
|
-
children: React.ReactElement<typeof ConfigrPage
|
|
8
|
-
|
|
6
|
+
initialValues: ConfigrValues;
|
|
7
|
+
children: React.ReactElement<React.ComponentProps<typeof ConfigrPage>> | React.ReactElement<React.ComponentProps<typeof ConfigrArea>> | Array<React.ReactElement<React.ComponentProps<typeof ConfigrPage>> | React.ReactElement<React.ComponentProps<typeof ConfigrArea>>>;
|
|
8
|
+
/** Called with the latest values as a plain object (not a JSON string). */
|
|
9
|
+
onChange?: (currentValues: ConfigrValues) => void;
|
|
9
10
|
showAppBar?: boolean;
|
|
10
11
|
showSearch?: boolean;
|
|
11
|
-
showAllGroups?: boolean;
|
|
12
12
|
themeOverrides?: ThemeOptions;
|
|
13
13
|
showJson?: boolean;
|
|
14
14
|
className?: string;
|
package/dist/ContentPane.d.ts
CHANGED
|
@@ -1,13 +1,21 @@
|
|
|
1
1
|
import { SerializedStyles } from '@emotion/react';
|
|
2
|
-
import * as React from 'react';
|
|
3
2
|
import { ReactNode } from 'react';
|
|
4
|
-
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
export type ConfigrValues = Record<string, unknown>;
|
|
5
|
+
type valueGetter = () => ConfigrValues;
|
|
6
|
+
export declare const ConfigrArea: React.FunctionComponent<React.PropsWithChildren<{
|
|
7
|
+
label: string;
|
|
8
|
+
pageKey?: string;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
content?: React.ReactNode;
|
|
11
|
+
}>>;
|
|
5
12
|
export declare const ContentPane: React.FunctionComponent<React.PropsWithChildren<{
|
|
6
|
-
initialValues:
|
|
13
|
+
initialValues: ConfigrValues;
|
|
7
14
|
currentTopLevelPageIndex?: number;
|
|
8
|
-
children: React.ReactElement<typeof ConfigrPage
|
|
15
|
+
children: React.ReactElement<React.ComponentProps<typeof ConfigrPage>> | React.ReactElement<React.ComponentProps<typeof ConfigrPage>>[];
|
|
9
16
|
setValueGetter?: (vg: valueGetter) => void;
|
|
10
|
-
|
|
17
|
+
/** Called with the latest values as a plain object (not a JSON string). */
|
|
18
|
+
onChange?: (currentValues: ConfigrValues) => void;
|
|
11
19
|
}>>;
|
|
12
20
|
type BooleanEditorComponent = React.FunctionComponent<{
|
|
13
21
|
value: boolean;
|
|
@@ -72,6 +80,7 @@ interface ISelectProps extends IConfigrProps<string> {
|
|
|
72
80
|
getErrorMessage?: (data: any) => string | undefined;
|
|
73
81
|
}
|
|
74
82
|
export declare const ConfigrSelect: React.FunctionComponent<React.PropsWithChildren<ISelectProps>>;
|
|
83
|
+
export declare const ConfigrStatic: React.FunctionComponent<React.PropsWithChildren<{}>>;
|
|
75
84
|
export declare const ConfigrGroup: React.FunctionComponent<React.PropsWithChildren<{
|
|
76
85
|
label?: string;
|
|
77
86
|
searchTerms?: string;
|
|
@@ -83,11 +92,12 @@ export type PageChild = React.ReactElement<typeof ConfigrGroup> | false | undefi
|
|
|
83
92
|
export declare const ConfigrPage: React.FunctionComponent<React.PropsWithChildren<{
|
|
84
93
|
label: string;
|
|
85
94
|
labelCss?: SerializedStyles;
|
|
86
|
-
pageKey
|
|
95
|
+
pageKey: string;
|
|
87
96
|
searchTerms?: string;
|
|
88
97
|
topLevel?: boolean;
|
|
89
98
|
getErrorMessage?: (data: any) => string | undefined;
|
|
90
99
|
inFocussedPage?: boolean;
|
|
100
|
+
disabled?: boolean;
|
|
91
101
|
children: PageChild | PageChild[];
|
|
92
102
|
}>>;
|
|
93
103
|
export declare const ConfigrForEach: React.FunctionComponent<React.PropsWithChildren<{
|