react-context-form 2.9.0 → 2.11.1
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 +30 -12
- package/build/AutoFocus/AutoFocus.d.ts +1 -1
- package/build/AutoUpdate/AutoUpdate.d.ts +1 -1
- package/build/AutoValidate/AutoValidate.d.ts +2 -2
- package/build/AutoValidate/AutoValidateProps.d.ts +1 -1
- package/build/Button/BaseButton.d.ts +2 -2
- package/build/Button/Button.d.ts +160 -110
- package/build/Button/Checkbox.d.ts +160 -110
- package/build/Form/Form.d.ts +4 -3
- package/build/Form/FormProps.d.ts +1 -0
- package/build/FormGroup/FormGroup.d.ts +160 -110
- package/build/Hint/Hint.d.ts +132 -107
- package/build/Input/BaseInput.d.ts +160 -110
- package/build/Model/Model.d.ts +1 -1
- package/build/OnValidate/OnValidate.d.ts +4 -4
- package/build/ResetButton/ResetButton.d.ts +1 -1
- package/build/ShowPasswordButton/ShowPasswordButton.d.ts +159 -109
- package/build/SlowSubmitButton/SlowSubmitButton.d.ts +496 -447
- package/build/SubmitButton/SubmitButton.d.ts +160 -110
- package/build/index.js +13 -9
- package/docs/AutoFocus.md +21 -0
- package/docs/AutoUpdate.md +29 -0
- package/docs/AutoValidate.md +32 -0
- package/docs/Button.md +21 -0
- package/docs/Checkbox.md +19 -0
- package/docs/EventInterceptor.md +25 -0
- package/docs/Form.md +28 -2
- package/docs/FormGroup.md +22 -22
- package/docs/Hint.md +13 -0
- package/docs/HintPopup.md +13 -0
- package/docs/Input.md +19 -0
- package/docs/InputRange.md +22 -0
- package/docs/Label.md +13 -0
- package/docs/Model.md +22 -4
- package/docs/NumericInput.md +16 -0
- package/docs/OnValidate.md +31 -0
- package/docs/PasswordGroup.md +15 -0
- package/docs/ResetButton.md +11 -0
- package/docs/ShowPasswordButton.md +24 -0
- package/docs/SlowSubmitButton.md +19 -0
- package/docs/SubmitButton.md +17 -0
- package/docs/TextArea.md +19 -0
- package/package.json +12 -13
- package/tsconfig.json +2 -1
- package/tslint.json +1 -0
- package/webpack.config.js +2 -2
- package/.vscode/settings.json +0 -3
package/docs/Button.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# <Button \/> Component
|
|
2
|
+
This component is represents button for [<Form \/>](./Form.md).
|
|
3
|
+
It requires [context](../src/FormGroup/FormGroupContext.ts) which is provided by [<FormGroup \/>](./FormGroup.md).
|
|
4
|
+
|
|
5
|
+
### Usage
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
<Form {...FormProps}>
|
|
9
|
+
<FormGroup {...FormGroupProps}>
|
|
10
|
+
<Button
|
|
11
|
+
action="button clicked"
|
|
12
|
+
activeClassName="is-active"
|
|
13
|
+
{...HTMLButtonElementProps}
|
|
14
|
+
/>
|
|
15
|
+
</FormGroup>
|
|
16
|
+
</Form>
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
where:
|
|
20
|
+
- `action` - value, that passed to model. Requried.
|
|
21
|
+
- `activeClassName` - className that attaching when `action` prop value is the same as value in model. Optional. Default - `is-active`.
|
package/docs/Checkbox.md
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# <Checkbox \/> Component
|
|
2
|
+
This component is represents checkbox for [<Form \/>](./Form.md).
|
|
3
|
+
It requires [context](../src/FormGroup/FormGroupContext.ts) which is provided by [<FormGroup \/>](./FormGroup.md).
|
|
4
|
+
|
|
5
|
+
### Usage
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
<Form {...FormProps}>
|
|
9
|
+
<FormGroup {...FormGroupProps}>
|
|
10
|
+
<Checkbox
|
|
11
|
+
activeClassName="is-active"
|
|
12
|
+
{...HTMLButtonElementProps}
|
|
13
|
+
/>
|
|
14
|
+
</FormGroup>
|
|
15
|
+
</Form>
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
where:
|
|
19
|
+
- `activeClassName` - className that attaching when checkbox checked. Optional. Default - `is-active`.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# <EventInterceptor \/> Component
|
|
2
|
+
This component is responsible for catching events in [<Form \/>](./Form.md).
|
|
3
|
+
It requires [context](../src/Form/FormContext.ts) which is provided by [<Form \/>](./Form.md)
|
|
4
|
+
|
|
5
|
+
### Usage
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
<Form {...FormProps}>
|
|
9
|
+
<EventInterceptor
|
|
10
|
+
events={[Event.onChange, Event.onFocus, Event.onBlur]}
|
|
11
|
+
onBlur={(attribute: string, value: string) => console.log(attribute, value)}
|
|
12
|
+
onFocus={(attribute: string, value: string) => console.log(attribute, value)}
|
|
13
|
+
onFocus={(attribute: string, value: string) => console.log(attribute, value)}
|
|
14
|
+
onChange={(attribute: string, nextValue: string, prevValue: string) => console.log(attribute, nextValue, prevValue)}
|
|
15
|
+
>
|
|
16
|
+
// ...
|
|
17
|
+
</EventInterceptor>
|
|
18
|
+
</Form>
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
where:
|
|
22
|
+
- `events` - list of catching events. Required.
|
|
23
|
+
- `onBlur` - callback, that triggered when some input is submit `blur` event. Optional.
|
|
24
|
+
- `onFocus` - callback, that triggered when some input is submit `focus` event. Optional.
|
|
25
|
+
- `onChange` - callback, that triggered when some input is submit `change` event. Optional.
|
package/docs/Form.md
CHANGED
|
@@ -1,4 +1,30 @@
|
|
|
1
1
|
# <Form \/> Component
|
|
2
|
-
This component is responsible for handling changing and providing values to [<FormGroup\/>](./FormGroup)
|
|
2
|
+
This component is responsible for handling changing and providing values to [<FormGroup \/>](./FormGroup.md)
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
### Usage
|
|
5
|
+
|
|
6
|
+
```tsx
|
|
7
|
+
<Form
|
|
8
|
+
storageKey="my-form"
|
|
9
|
+
resetAfterSubmit={true}
|
|
10
|
+
storage={window.localStorage}
|
|
11
|
+
instantiate={() => new ExampleModel()}
|
|
12
|
+
afterSubmit={() => console.log("Submit is completed")}
|
|
13
|
+
onSubmit={async (model: ExampleModel, childContext: FormContext) => /* submit code */}
|
|
14
|
+
onValidate={(groups: Array<{ name: string, isValid: boolean }>) => console.log(groups)}
|
|
15
|
+
>
|
|
16
|
+
// ...
|
|
17
|
+
</Form>
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
where:
|
|
21
|
+
- `storageKey` - unique string to store values in provided storage. Optional. If not passed - values does not be stored.
|
|
22
|
+
- `resetAfterSubmit` - resets model to defaults after success submit. Optional.
|
|
23
|
+
- `storage` - storage, that contains values. Optional. If not passed - localStorage will be used.
|
|
24
|
+
- `instantiate` - function, that return instance of `Model`. Required.
|
|
25
|
+
- `afterSubmit` - callback, that triggered after success submit. Optional.
|
|
26
|
+
- `onSubmit` - function, that implements submit. Optional. If not passed - `method` prop must be pased.
|
|
27
|
+
- `method` - string, that using when `onSubmit` prop does not passed.
|
|
28
|
+
- `onValidate` - callback, that triggered when some fields are validated. Optional.
|
|
29
|
+
|
|
30
|
+
*NOTE: `storage` must implement `getItem` and `setItem` methods*
|
package/docs/FormGroup.md
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
|
|
1
|
+
# <FormGroup \/> Component
|
|
2
2
|
This component is wrapper for input/textarea/select and hint/label.
|
|
3
|
-
It requires [context](../src/Form/FormContext.ts) which is provided by [<Form\/>](./Form.md)
|
|
4
|
-
[Props](../src/FormGroup/FormGroupProps.ts)
|
|
3
|
+
It requires [context](../src/Form/FormContext.ts) which is provided by [<Form \/>](./Form.md)
|
|
5
4
|
|
|
5
|
+
### Usage
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
7
|
+
```tsx
|
|
8
|
+
<Form {...FormProps}>
|
|
9
|
+
<FormGroup
|
|
10
|
+
name="phone"
|
|
11
|
+
errorClassName="has-error"
|
|
12
|
+
focusClassName="has-focus"
|
|
13
|
+
valueClassName="has-value"
|
|
14
|
+
idPrefix="custom-phone-input"
|
|
15
|
+
{...HTMLDivElementProps}
|
|
16
|
+
>
|
|
17
|
+
// ...
|
|
18
|
+
</FormGroup>
|
|
19
|
+
</Form>
|
|
19
20
|
```
|
|
20
21
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
```
|
|
22
|
+
where:
|
|
23
|
+
- `name` - field model name (will be passed to input). Required.
|
|
24
|
+
- `idPrefix` - id prefix for input and label. Optional.
|
|
25
|
+
- `errorClassName` - className, that attaching to `FormGroup` when input does not passed validation. Optional. Default - `has-error`.
|
|
26
|
+
- `focusClassName` - className, that attaching to `FormGroup` when input emit `focus` event. Optional. Default - `has-focus`.
|
|
27
|
+
- `valueClassName` - className, that attaching to `FormGroup` when input has value. Optional. Default - `has-value`.
|
package/docs/Hint.md
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# <Hint \/> Component
|
|
2
|
+
This component is represents error hint for [<Form \/>](./Form.md).
|
|
3
|
+
It requires [context](../src/Form/FormGroupContext.ts) which is provided by [<FormGroup \/>](./FormGroup.md).
|
|
4
|
+
|
|
5
|
+
### Usage
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
<Form {...FormProps}>
|
|
9
|
+
<FormGroup {...FormGroupProps}>
|
|
10
|
+
<Hint {...HTMLDivElementProps} />
|
|
11
|
+
</FormGroup>
|
|
12
|
+
</Form>
|
|
13
|
+
```
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# <HintPopup \/> Component
|
|
2
|
+
This component is represents error hint popup for [<Form \/>](./Form.md).
|
|
3
|
+
It requires [context](../src/Form/FormGroupContext.ts) which is provided by [<FormGroup \/>](./FormGroup.md).
|
|
4
|
+
|
|
5
|
+
### Usage
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
<Form {...FormProps}>
|
|
9
|
+
<FormGroup {...FormGroupProps}>
|
|
10
|
+
<HintPopup {...HTMLDivElementProps} />
|
|
11
|
+
</FormGroup>
|
|
12
|
+
</Form>
|
|
13
|
+
```
|
package/docs/Input.md
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# <Input \/> Component
|
|
2
|
+
This component is represents input for [<Form \/>](./Form.md).
|
|
3
|
+
It requires [context](../src/FormGroup/FormGroupContext.ts) which is provided by [<FormGroup \/>](./FormGroup.md).
|
|
4
|
+
|
|
5
|
+
### Usage
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
<Form {...FormProps}>
|
|
9
|
+
<FormGroup {...FormGroupProps}>
|
|
10
|
+
<Input
|
|
11
|
+
transform={TransformTypes.capitalize}
|
|
12
|
+
{...HTMLInputElementProps}
|
|
13
|
+
/>
|
|
14
|
+
</FormGroup>
|
|
15
|
+
</Form>
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
where:
|
|
19
|
+
- `transform` - transform input value with specific preset. Optional. Can take on values: `TransformTypes.capitalize`, `TransformTypes.upperCase`, `TransformTypes.none`.
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# <NumericRange \/> Component
|
|
2
|
+
This component is represents range for [<NumericInput \/>](./NumericInput.md).
|
|
3
|
+
It requires [context](../src/FormGroup/FormGroupContext.ts) which is provided by [<FormGroup \/>](./FormGroup.md).
|
|
4
|
+
|
|
5
|
+
### Usage
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
<Form {...FormProps}>
|
|
9
|
+
<FormGroup {...FormGroupProps}>
|
|
10
|
+
<InputRange
|
|
11
|
+
max={900}
|
|
12
|
+
min={1}
|
|
13
|
+
>
|
|
14
|
+
<NumericInput {...HTMLInputProps} />
|
|
15
|
+
</InputRange>
|
|
16
|
+
</FormGroup>
|
|
17
|
+
</Form>
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
where:
|
|
21
|
+
- `max` - max value for input. Required.
|
|
22
|
+
- `min` - min value for input. Optional.
|
package/docs/Label.md
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# <Label \/> Component
|
|
2
|
+
This component is represents label for [<Form \/>](./Form.md).
|
|
3
|
+
It requires [context](../src/Form/FormGroupContext.ts) which is provided by [<FormGroup \/>](./FormGroup.md).
|
|
4
|
+
|
|
5
|
+
### Usage
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
<Form {...FormProps}>
|
|
9
|
+
<FormGroup {...FormGroupProps}>
|
|
10
|
+
<Label {...HTMLLabelElementProps} />
|
|
11
|
+
</FormGroup>
|
|
12
|
+
</Form>
|
|
13
|
+
```
|
package/docs/Model.md
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
# Model Class
|
|
2
2
|
This class is representation of your forms data.
|
|
3
3
|
It also contains validation rules.
|
|
4
|
+
|
|
5
|
+
Implemented interface can be founded [here](../src/Model.ts).
|
|
4
6
|
|
|
5
7
|
[class-validator](https://github.com/pleerock/class-validator) is used for setting validation rules.
|
|
6
8
|
|
|
7
|
-
|
|
9
|
+
### Usage
|
|
8
10
|
|
|
9
|
-
```
|
|
11
|
+
```ts
|
|
10
12
|
import {Model, ModelGroups} from "react-context-form";
|
|
11
13
|
import {IsBoolean, IsNotEmpty, IsString, Length, MaxLength, MinLength} from "class-validator";
|
|
12
14
|
|
|
@@ -42,6 +44,22 @@ export class TaskModel extends Model {
|
|
|
42
44
|
}
|
|
43
45
|
}
|
|
44
46
|
```
|
|
45
|
-
*You need to specify attributes list for correct empty fields validation*
|
|
46
|
-
*You need to specify attributes groups to correct work of `AutoValidate` component*
|
|
47
47
|
|
|
48
|
+
*NOTE: You need to specify attributes list for correct empty fields validation*
|
|
49
|
+
*NOTE: You need to specify attributes groups to correct work of `AutoValidate` component*
|
|
50
|
+
|
|
51
|
+
You can also specify default values:
|
|
52
|
+
|
|
53
|
+
```ts
|
|
54
|
+
const model = new TaskModel({
|
|
55
|
+
name: "default name",
|
|
56
|
+
completed: true
|
|
57
|
+
});
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Model instance can be reseted to defaults or cleared:
|
|
61
|
+
|
|
62
|
+
```ts
|
|
63
|
+
model.reset(); // Fills fields with default values
|
|
64
|
+
model.clear(); // Clear all fields
|
|
65
|
+
```
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# <NumericInput \/> Component
|
|
2
|
+
This component is represents numeric input for [<Form \/>](./Form.md).
|
|
3
|
+
It requires [context](../src/FormGroup/FormGroupContext.ts) which is provided by [<FormGroup \/>](./FormGroup.md).
|
|
4
|
+
|
|
5
|
+
### Usage
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
<Form {...FormProps}>
|
|
9
|
+
<FormGroup {...FormGroupProps}>
|
|
10
|
+
<NumericInput {...HTMLInputElementProps} />
|
|
11
|
+
</FormGroup>
|
|
12
|
+
</Form>
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
*NOTE: This input have type `tel`*
|
|
16
|
+
*NOTE: This input can not contains chars besides numbers*
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# <OnValidate \/> Component
|
|
2
|
+
This component is responsible for handling validation result for specific inputs.
|
|
3
|
+
It requires [context](../src/Form/FormContext.ts) which is provided by [<Form \/>](./Form.md).
|
|
4
|
+
|
|
5
|
+
### Usage
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
<Form {...FormProps}>
|
|
9
|
+
<OnValidate
|
|
10
|
+
groups={["phone", "email"]}
|
|
11
|
+
onValidate={(isAllValid: boolean) => isAllValid ? console.log("Group is valid") : console.log("Group is invalid")}
|
|
12
|
+
>
|
|
13
|
+
<FormGroup name="phone" {...FormGroupProps}>
|
|
14
|
+
// ...
|
|
15
|
+
</FormGroup>
|
|
16
|
+
<FormGroup name="email" {...FormGroupProps}>
|
|
17
|
+
// ...
|
|
18
|
+
</FormGroup>
|
|
19
|
+
<FormGroup name="name" {...FormGroupProps}>
|
|
20
|
+
// ...
|
|
21
|
+
</FormGroup>
|
|
22
|
+
</OnValidate>
|
|
23
|
+
<FormGroup name="middleName" {...FormGroupProps}>
|
|
24
|
+
// ...
|
|
25
|
+
</FormGroup>
|
|
26
|
+
</Form>
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
where:
|
|
30
|
+
- `groups` - list of inputs name, that are in validation group. Required.
|
|
31
|
+
- `onValidate` - callback, that triggered on validation. Required.
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# <PasswordGroup \/> Component
|
|
2
|
+
This component is represents wrapper for [<Input \/>](./Input.md), that must be password.
|
|
3
|
+
It requires [context](../src/Form/FormContext.ts) which is provided by [<Form \/>](./Form.md).
|
|
4
|
+
|
|
5
|
+
### Usage
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
<Form {...FormProps}>
|
|
9
|
+
<FormGroup {...FormGroupProps}>
|
|
10
|
+
<PasswordGroup {...HTMLDivElementProps}>
|
|
11
|
+
<Input {...HTMLInputProps} />
|
|
12
|
+
</InputRange>
|
|
13
|
+
</FormGroup>
|
|
14
|
+
</Form>
|
|
15
|
+
```
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# <ResetButton \/> Component
|
|
2
|
+
This component is represents button, that reset [<Form \/>](./Form.md) to defaults.
|
|
3
|
+
It requires [context](../src/Form/FormContext.ts) which is provided by [<Form \/>](./Form.md).
|
|
4
|
+
|
|
5
|
+
### Usage
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
<Form {...FormProps}>
|
|
9
|
+
<ResetButton {...HTMLButtonElementProps} />
|
|
10
|
+
</Form>
|
|
11
|
+
```
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# <ShowPasswordButton \/> Component
|
|
2
|
+
This component is represents control visibility button for password [<Input \/>](./Input.md).
|
|
3
|
+
It requires [context](../src/PasswordGroup/PasswordGroupContext.ts) which is provided by [<PasswordGroup \/>](./PasswordGroup.md).
|
|
4
|
+
|
|
5
|
+
### Usage
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
<Form {...FormProps}>
|
|
9
|
+
<FormGroup {...FormGroupProps}>
|
|
10
|
+
<PasswordGroup {...HTMLDivElementProps}>
|
|
11
|
+
<Input {...HTMLInputProps} />
|
|
12
|
+
<ShowPasswordButton
|
|
13
|
+
clickToShow={true}
|
|
14
|
+
hoverToShow={false}
|
|
15
|
+
{...HTMLButtonElementProps}
|
|
16
|
+
/>
|
|
17
|
+
</InputRange>
|
|
18
|
+
</FormGroup>
|
|
19
|
+
</Form>
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
where:
|
|
23
|
+
- `clickToShow` - show password on click. Optional. Default - `true`.
|
|
24
|
+
- `hoverToShow` - show password on hover. Optional. Default - `false`.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# <SlowSubmitButton \/> Component
|
|
2
|
+
This component is represents button with type `submit` for [<Form \/>](./Form.md) with delay.
|
|
3
|
+
It requires [context](../src/Form/FormContext.ts) which is provided by [<Form \/>](./Form.md).
|
|
4
|
+
|
|
5
|
+
### Usage
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
<Form {...FormProps}>
|
|
9
|
+
<SlowSubmitButton
|
|
10
|
+
{...HTMLButtonElementProps}
|
|
11
|
+
loadingComponent={<span>...</span>}
|
|
12
|
+
duration={500}
|
|
13
|
+
/>
|
|
14
|
+
</Form>
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
where:
|
|
18
|
+
- `loadingComponent` - markup, that attaching to button on submit. Required.
|
|
19
|
+
- `duration` - time, that button be in loading state. Optional. Default - `500`.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# <SubmitButton \/> Component
|
|
2
|
+
This component is represents button with type `submit` for [<Form \/>](./Form.md).
|
|
3
|
+
It requires [context](../src/Form/FormContext.ts) which is provided by [<Form \/>](./Form.md).
|
|
4
|
+
|
|
5
|
+
### Usage
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
<Form {...FormProps}>
|
|
9
|
+
<SubmitButton
|
|
10
|
+
{...HTMLButtonElementProps}
|
|
11
|
+
loadingComponent={<span>...</span>}
|
|
12
|
+
/>
|
|
13
|
+
</Form>
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
where:
|
|
17
|
+
- `loadingComponent` - markup, that attaching to button on submit. Required.
|
package/docs/TextArea.md
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# <TextArea \/> Component
|
|
2
|
+
This component is represents textarea for [<Form \/>](./Form.md).
|
|
3
|
+
It requires [context](../src/FormGroup/FormGroupContext.ts) which is provided by [<FormGroup \/>](./FormGroup.md).
|
|
4
|
+
|
|
5
|
+
### Usage
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
<Form {...FormProps}>
|
|
9
|
+
<FormGroup {...FormGroupProps}>
|
|
10
|
+
<TextArea
|
|
11
|
+
transform={TransformTypes.capitalize}
|
|
12
|
+
{...HTMLTextAreaElementProps}
|
|
13
|
+
/>
|
|
14
|
+
</FormGroup>
|
|
15
|
+
</Form>
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
where:
|
|
19
|
+
- `transform` - transform input value with specific preset. Optional. Can take on values: `TransformTypes.capitalize`, `TransformTypes.upperCase`, `TransformTypes.none`.
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-context-form",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.11.1",
|
|
4
4
|
"description": "One more way to handle forms on React",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"typings": "build/index.d.ts",
|
|
7
7
|
"scripts": {
|
|
8
|
-
"test": "cross-env TS_NODE_PROJECT=tsconfig.test.json ./node_modules/.bin/nyc mocha -r jsdom-global/register -r ts-node/register -r source-map-support/register tests/bootstrap.ts tests/**-specs.ts tests/**-specs.tsx",
|
|
8
|
+
"test": "cross-env TS_NODE_PROJECT=tsconfig.test.json ./node_modules/.bin/nyc mocha --exit -r jsdom-global/register -r ts-node/register -r source-map-support/register tests/bootstrap.ts tests/**-specs.ts tests/**-specs.tsx",
|
|
9
9
|
"build": "cross-env NODE_ENV=production ./node_modules/.bin/webpack",
|
|
10
10
|
"dev": "./node_modules/.bin/webpack-dev-server",
|
|
11
11
|
"coverage": "./node_modules/.bin/nyc report --reporter=text-lcov > coverage.lcov && codecov",
|
|
@@ -32,10 +32,10 @@
|
|
|
32
32
|
},
|
|
33
33
|
"homepage": "https://github.com/Horat1us/react-formgroup#readme",
|
|
34
34
|
"devDependencies": {
|
|
35
|
-
"@types/chai": "^4.
|
|
36
|
-
"@types/cheerio": "^0.22.
|
|
35
|
+
"@types/chai": "^4.3.4",
|
|
36
|
+
"@types/cheerio": "^0.22.31",
|
|
37
37
|
"@types/enzyme": "^2.8.9",
|
|
38
|
-
"@types/mocha": "^
|
|
38
|
+
"@types/mocha": "^10.0.0",
|
|
39
39
|
"@types/node": "^10.3.3",
|
|
40
40
|
"@types/prop-types": "^15.5.3",
|
|
41
41
|
"@types/react": "^16.3.17",
|
|
@@ -48,8 +48,8 @@
|
|
|
48
48
|
"babel-preset-env": "^1.7.0",
|
|
49
49
|
"babel-preset-react": "^6.24.1",
|
|
50
50
|
"babel-regenerator-runtime": "^6.5.0",
|
|
51
|
-
"chai": "^4.
|
|
52
|
-
"cheerio": "^1.0.0-rc.
|
|
51
|
+
"chai": "^4.3.7",
|
|
52
|
+
"cheerio": "^1.0.0-rc.12",
|
|
53
53
|
"circular-dependency-plugin": "^4.4.0",
|
|
54
54
|
"class-validator": "^0.7.2",
|
|
55
55
|
"clean-webpack-plugin": "^0.1.19",
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"enzyme-adapter-react-16": "^1.1.1",
|
|
60
60
|
"jsdom": "^11.11.0",
|
|
61
61
|
"jsdom-global": "^3.0.2",
|
|
62
|
-
"mocha": "^
|
|
62
|
+
"mocha": "^10.1.0",
|
|
63
63
|
"nyc": "^11.9.0",
|
|
64
64
|
"pre-commit": "^1.2.2",
|
|
65
65
|
"prop-types": "^15.6.1",
|
|
@@ -72,15 +72,15 @@
|
|
|
72
72
|
"ts-node": "^3.3.0",
|
|
73
73
|
"tslint": "^5.10.0",
|
|
74
74
|
"tslint-react": "^3.6.0",
|
|
75
|
-
"typescript": "^
|
|
75
|
+
"typescript": "^3.9.10",
|
|
76
76
|
"webpack": "^3.12.0",
|
|
77
77
|
"webpack-dev-server": "^2.11.2",
|
|
78
78
|
"webpack-node-externals": "^1.7.2"
|
|
79
79
|
},
|
|
80
80
|
"peerDependencies": {
|
|
81
|
-
"class-validator": "
|
|
82
|
-
"prop-types": "
|
|
83
|
-
"react": "
|
|
81
|
+
"class-validator": ">=0.7.2",
|
|
82
|
+
"prop-types": ">=15.6.0",
|
|
83
|
+
"react": ">=16.2.0"
|
|
84
84
|
},
|
|
85
85
|
"nyc": {
|
|
86
86
|
"extension": [
|
|
@@ -99,7 +99,6 @@
|
|
|
99
99
|
],
|
|
100
100
|
"report-dir": "./tests/output"
|
|
101
101
|
},
|
|
102
|
-
"dependencies": {},
|
|
103
102
|
"pre-commit": [
|
|
104
103
|
"lint",
|
|
105
104
|
"test"
|
package/tsconfig.json
CHANGED
package/tslint.json
CHANGED
package/webpack.config.js
CHANGED
|
@@ -55,7 +55,7 @@ const config = {
|
|
|
55
55
|
'react',
|
|
56
56
|
['env', {
|
|
57
57
|
"targets": {
|
|
58
|
-
"browsers": ["last 2 versions"
|
|
58
|
+
"browsers": ["last 2 versions"]
|
|
59
59
|
}
|
|
60
60
|
}]
|
|
61
61
|
],
|
|
@@ -76,7 +76,7 @@ const config = {
|
|
|
76
76
|
'react',
|
|
77
77
|
['env', {
|
|
78
78
|
"targets": {
|
|
79
|
-
"browsers": ["last 2 versions", "safari >= 10"
|
|
79
|
+
"browsers": ["last 2 versions", "safari >= 10"]
|
|
80
80
|
}
|
|
81
81
|
}]
|
|
82
82
|
],
|
package/.vscode/settings.json
DELETED