@sillsdev/config-r 1.0.0-alpha.18 → 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 CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  A React library for a settings UI similar to that of Chrome.
4
4
 
5
- [![Project Status: WIP – Initial development is in progress, but there has not yet been a stable, usable release suitable for the public.](https://www.repostatus.org/badges/latest/wip.svg)](https://www.repostatus.org/#wip)
5
+ [![Project Status: WIP - Initial development is in progress, but there has not yet been a stable, usable release suitable for the public.](https://www.repostatus.org/badges/latest/wip.svg)](https://www.repostatus.org/#wip)
6
6
 
7
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
 
@@ -28,3 +28,16 @@ yarn dev
28
28
  ```
29
29
  npm install @sillsdev/config-r
30
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`.
@@ -1,14 +1,14 @@
1
1
  import { ThemeOptions } from '@mui/material';
2
- import { ConfigrPage } from './ContentPane';
2
+ import { ConfigrArea, ConfigrPage, ConfigrValues } from './ContentPane';
3
3
  import * as React from 'react';
4
4
  export declare const ConfigrPane: React.FunctionComponent<React.PropsWithChildren<{
5
5
  label: string;
6
- initialValues: object;
7
- children: React.ReactElement<typeof ConfigrPage> | React.ReactElement<typeof ConfigrPage>[];
8
- onChange?: (currentValues: any) => void;
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;
@@ -1,13 +1,21 @@
1
1
  import { SerializedStyles } from '@emotion/react';
2
2
  import { ReactNode } from 'react';
3
3
  import * as React from 'react';
4
- type valueGetter = () => Object;
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: object;
13
+ initialValues: ConfigrValues;
7
14
  currentTopLevelPageIndex?: number;
8
- children: React.ReactElement<typeof ConfigrPage> | 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
- onChange?: (currentValues: any) => void;
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;
@@ -89,6 +97,7 @@ export declare const ConfigrPage: React.FunctionComponent<React.PropsWithChildre
89
97
  topLevel?: boolean;
90
98
  getErrorMessage?: (data: any) => string | undefined;
91
99
  inFocussedPage?: boolean;
100
+ disabled?: boolean;
92
101
  children: PageChild | PageChild[];
93
102
  }>>;
94
103
  export declare const ConfigrForEach: React.FunctionComponent<React.PropsWithChildren<{