@socotra/ec-react-components 0.0.0-alpha.5 → 2.0.1-alpha.0
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 +69 -21
- package/dist/index.d.ts +14 -1
- package/dist/index.es.js +5524 -5673
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +32 -32
- package/dist/index.umd.js.map +1 -1
- package/dist/style.css +1 -1
- package/package.json +5 -4
package/README.md
CHANGED
|
@@ -1,30 +1,78 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @socotra/ec-react-components
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
A React component library for generating forms and other components for EC.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
This library is styled via [tailwindcss](https://tailwindcss.com/) and [shadcn/ui](https://ui.shadcn.com/).
|
|
6
6
|
|
|
7
|
-
-
|
|
8
|
-
-
|
|
7
|
+
- **Package name**: `@socotra/ec-react-components`
|
|
8
|
+
- **Repo Path**: `packages/components`
|
|
9
|
+
- **Install**:
|
|
10
|
+
```sh
|
|
11
|
+
npm i @socotra/ec-react-components @tailwindcss/container-queries
|
|
12
|
+
```
|
|
13
|
+
- **Usage**:
|
|
9
14
|
|
|
10
|
-
|
|
15
|
+
```js
|
|
16
|
+
// Import style.css anywhere in your application, preferably at the root
|
|
17
|
+
import '@socotra/ec-react-components/dist/style.css';
|
|
11
18
|
|
|
12
|
-
|
|
19
|
+
import { MyComponent } from '@socotra/ec-react-components';
|
|
20
|
+
```
|
|
13
21
|
|
|
14
|
-
-
|
|
22
|
+
- Add the plugin to your `tailwind.config.js` file along with the content path:
|
|
15
23
|
|
|
16
|
-
```js
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}
|
|
24
|
+
```js
|
|
25
|
+
// tailwind.config.js
|
|
26
|
+
module.exports = {
|
|
27
|
+
content: [
|
|
28
|
+
// ...
|
|
29
|
+
'./node_modules/@socotra/ec-react-components/dist/**/*.js',
|
|
30
|
+
]
|
|
31
|
+
theme: {
|
|
32
|
+
// ...
|
|
33
|
+
},
|
|
34
|
+
plugins: [
|
|
35
|
+
require('@tailwindcss/container-queries'),
|
|
36
|
+
// ...
|
|
37
|
+
],
|
|
38
|
+
};
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Customization
|
|
42
|
+
|
|
43
|
+
As this library is styled via shadcn components and tailwind, customization can be achieved by installing shadcn in your project. Follow the installation guide from [shadcn](https://ui.shadcn.com/docs/installation) and adjust your theme using the [theme creator](https://ui.shadcn.com/themes).
|
|
44
|
+
|
|
45
|
+
Once you install shadcn, or if you are using it already, **delete the style.css import** to avoid style collisions
|
|
46
|
+
|
|
47
|
+
### Running the Project Locally
|
|
48
|
+
|
|
49
|
+
To build the package:
|
|
50
|
+
|
|
51
|
+
```sh
|
|
52
|
+
pnpm run build
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
To run tests:
|
|
56
|
+
|
|
57
|
+
```sh
|
|
58
|
+
pnpm run test
|
|
26
59
|
```
|
|
27
60
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
61
|
+
To run the linter:
|
|
62
|
+
|
|
63
|
+
```sh
|
|
64
|
+
pnpm run lint
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
To run the sandbox
|
|
68
|
+
|
|
69
|
+
```sh
|
|
70
|
+
cd ../sandbox
|
|
71
|
+
pnpm run dev
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
Installing directly for local development
|
|
75
|
+
|
|
76
|
+
```sh
|
|
77
|
+
pnpm i ../path/to/this/packages/components
|
|
78
|
+
```
|
package/dist/index.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ import { JSX as JSX_2 } from 'react/jsx-runtime';
|
|
|
8
8
|
* AccountForm is a form for creating or updating an account. It accepts a resolved data model, custom data types, and an optional account object to put the form in update mode. References: https://rjsf-team.github.io/react-jsonschema-form/docs/
|
|
9
9
|
*/
|
|
10
10
|
export declare const AccountForm: {
|
|
11
|
-
({ accountsModel, accountType, dataTypes, handleSubmit, hideSubmitButton, account, submitButtonText, id, }: Props): JSX_2.Element;
|
|
11
|
+
({ accountsModel, accountType, dataTypes, disabled, handleSubmit, isSubmitting, preventFormResetOnDisabled, hideSubmitButton, account, submitButtonText, id, }: Props): JSX_2.Element;
|
|
12
12
|
displayName: string;
|
|
13
13
|
};
|
|
14
14
|
|
|
@@ -34,6 +34,19 @@ declare type Props = {
|
|
|
34
34
|
* The function to call when the form is submitted. It will create an AccountCreateRequest or AccountUpdateRequest based on the form data
|
|
35
35
|
*/
|
|
36
36
|
handleSubmit: (data: AccountRequest) => void;
|
|
37
|
+
/**
|
|
38
|
+
* Set to true when the form is submitting to set fields to readonly and disable the submit button
|
|
39
|
+
*/
|
|
40
|
+
isSubmitting?: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Disables the form
|
|
43
|
+
*/
|
|
44
|
+
disabled?: boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Prevents the form from resetting when disabled
|
|
47
|
+
* default is false
|
|
48
|
+
*/
|
|
49
|
+
preventFormResetOnDisabled?: boolean;
|
|
37
50
|
/**
|
|
38
51
|
* The account object to put the form in update mode
|
|
39
52
|
*/
|