@aglyn/shared-data-forms 1.0.0-beta.143 → 1.0.0-beta.144

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 (2) hide show
  1. package/README.md +49 -2
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -1,3 +1,50 @@
1
- # shared-data-forms
1
+ # @aglyn/shared-data-forms
2
2
 
3
- This library was generated with [Nx](https://nx.dev).
3
+ Ready-made field schemas and validator lists for [data-driven-forms](https://github.com/data-driven-forms/react-forms): email, password, name, phone, message and postal address fields. Install it if you render forms with `@data-driven-forms/react-form-renderer` and want these common fields predefined. Inside Aglyn the console builds its sign-in and account forms from it.
4
+
5
+ > Beta. Published from the Aglyn monorepo under the `beta` dist-tag; APIs can change between beta releases.
6
+
7
+ ## Install
8
+
9
+ npm install @aglyn/shared-data-forms@beta
10
+
11
+ No peer dependencies. `@data-driven-forms/react-form-renderer` is a regular dependency; the schemas use its `componentTypes` and `validatorTypes`.
12
+
13
+ ## What's in it
14
+
15
+ All exports are plain objects and arrays. There is no React code here.
16
+
17
+ - Validator lists: `VALIDATOR_LIST_EMAIL`, `VALIDATOR_LIST_PASSWORD`.
18
+ - Account fields: `FIELD_SCHEMA_EMAIL`, `FIELD_SCHEMA_PASSWORD`, `FIELD_SCHEMA_PASSWORD_OLD`, `FIELD_SCHEMA_PASSWORD_CONFIRM`, `FIELD_SCHEMA_FIRST_NAME`, `FIELD_SCHEMA_LAST_NAME`, `FIELD_SCHEMA_ORGANIZATION_NAME`, `FIELD_SCHEMA_PHONE_NUMBER`.
19
+ - Text fields: `FIELD_SCHEMA_MESSAGE_SHORT`, `FIELD_SCHEMA_MESSAGE_LONG`, `FIELD_SCHEMA_DESCRIPTION_SHORT`, `FIELD_SCHEMA_DESCRIPTION_LONG`.
20
+ - Address fields: `FIELD_SCHEMA_ADDRESS_LINE1`, `FIELD_SCHEMA_ADDRESS_LINE2`, `FIELD_SCHEMA_ADDRESS_CITY`, `FIELD_SCHEMA_ADDRESS_STATE`, `FIELD_SCHEMA_ADDRESS_POSTAL_CODE`, `FIELD_SCHEMA_ADDRESS_COUNTRY`.
21
+
22
+ Entry points: `.` and `@aglyn/shared-data-forms/fields`.
23
+
24
+ ## Usage
25
+
26
+ Each constant is a data-driven-forms field. Put them in a schema's `fields` array, spreading to override a property:
27
+
28
+ ```ts
29
+ import {
30
+ FIELD_SCHEMA_EMAIL,
31
+ FIELD_SCHEMA_PASSWORD,
32
+ } from '@aglyn/shared-data-forms'
33
+
34
+ export const signInSchema = {
35
+ fields: [
36
+ FIELD_SCHEMA_EMAIL,
37
+ { ...FIELD_SCHEMA_PASSWORD, label: 'Your password' },
38
+ ],
39
+ }
40
+ ```
41
+
42
+ Pass the schema to a `FormRenderer` together with a component mapper. `@aglyn/shared-ui-jsx-forms` provides a Material UI mapper.
43
+
44
+ ## How it fits
45
+
46
+ A `shared` data package. It depends on `@aglyn/shared-data-regex` for the patterns its validators use. Shared packages are generic: they import only other shared packages and hold no plugin's domain.
47
+
48
+ ## License
49
+
50
+ Apache-2.0. Source: https://github.com/aglyn/aglyn/tree/main/libs/shared/data/forms
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aglyn/shared-data-forms",
3
- "version": "1.0.0-beta.143",
3
+ "version": "1.0.0-beta.144",
4
4
  "license": "Apache-2.0",
5
5
  "homepage": "https://aglyn.com",
6
6
  "repository": {
@@ -25,7 +25,7 @@
25
25
  "./package.json": "./package.json"
26
26
  },
27
27
  "dependencies": {
28
- "@aglyn/shared-data-regex": "1.0.0-beta.143",
28
+ "@aglyn/shared-data-regex": "1.0.0-beta.144",
29
29
  "@data-driven-forms/react-form-renderer": "^4.2.0",
30
30
  "@swc/helpers": "0.5.23"
31
31
  },