@ttoss/forms 0.39.1 → 0.40.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 +39 -0
- package/dist/Brazil/index.d.ts +1 -1
- package/dist/{FormFieldPatternFormat-D5CI6eUA.d.ts → FormFieldPatternFormat-kaO0pl1R.d.ts} +1 -1
- package/dist/esm/Brazil/index.js +1 -1
- package/dist/esm/MultistepForm/index.js +2 -2
- package/dist/esm/{chunk-QJQFXN4B.js → chunk-BL55OAIO.js} +3 -2
- package/dist/esm/{chunk-EGHO72SX.js → chunk-ILQOS34E.js} +1 -1
- package/dist/esm/index.js +2 -2
- package/dist/index.d.ts +2 -2
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -233,6 +233,7 @@ All form field components share common props:
|
|
|
233
233
|
- `defaultValue`: Initial field value
|
|
234
234
|
- `tooltip`: Label tooltip configuration
|
|
235
235
|
- `warning`: Warning message displayed below the field
|
|
236
|
+
- `auxiliaryCheckbox`: Optional auxiliary checkbox configuration
|
|
236
237
|
- `sx`: Theme-UI styling object
|
|
237
238
|
|
|
238
239
|
### Disabling Form Fields
|
|
@@ -284,6 +285,44 @@ const formMethods = useForm({
|
|
|
284
285
|
<FormFieldInput name="id" label="ID" disabled />;
|
|
285
286
|
```
|
|
286
287
|
|
|
288
|
+
### Auxiliary Checkbox
|
|
289
|
+
|
|
290
|
+
Form fields can include an optional auxiliary checkbox rendered between the field and error message. This is useful for input confirmation, terms acceptance, or conditional display of other fields.
|
|
291
|
+
|
|
292
|
+
```tsx
|
|
293
|
+
<FormFieldInput
|
|
294
|
+
name="email"
|
|
295
|
+
label="Email"
|
|
296
|
+
auxiliaryCheckbox={{
|
|
297
|
+
name: 'confirmEmail',
|
|
298
|
+
label: 'Send me promotional emails',
|
|
299
|
+
}}
|
|
300
|
+
/>
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
The auxiliary checkbox can be disabled independently of the main field:
|
|
304
|
+
|
|
305
|
+
```tsx
|
|
306
|
+
<FormFieldInput
|
|
307
|
+
name="email"
|
|
308
|
+
label="Email"
|
|
309
|
+
auxiliaryCheckbox={{
|
|
310
|
+
name: 'confirmEmail',
|
|
311
|
+
label: 'Send me promotional emails',
|
|
312
|
+
disabled: true, // Checkbox is disabled, but email field is enabled
|
|
313
|
+
}}
|
|
314
|
+
/>
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
**Props for `auxiliaryCheckbox`:**
|
|
318
|
+
|
|
319
|
+
- `name` (required): Field name for the checkbox
|
|
320
|
+
- `label` (required): Checkbox label text
|
|
321
|
+
- `disabled`: Disables the checkbox (independent of field disabled state)
|
|
322
|
+
- `defaultValue`: Initial checkbox value
|
|
323
|
+
|
|
324
|
+
The auxiliary checkbox's disabled state is the logical OR of its own `disabled` prop and the field's disabled state.
|
|
325
|
+
|
|
287
326
|
### FormFieldInput
|
|
288
327
|
|
|
289
328
|
Text input field supporting all HTML input types.
|
package/dist/Brazil/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import { FieldValues, FieldPath } from 'react-hook-form';
|
|
3
|
-
import { a as FormFieldPatternFormatProps, F as FormFieldProps } from '../FormFieldPatternFormat-
|
|
3
|
+
import { a as FormFieldPatternFormatProps, F as FormFieldProps } from '../FormFieldPatternFormat-kaO0pl1R.js';
|
|
4
4
|
import { PatternFormatProps, NumberFormatBaseProps } from 'react-number-format';
|
|
5
5
|
import '@ttoss/ui';
|
|
6
6
|
import 'react';
|
|
@@ -46,7 +46,7 @@ type FormFieldProps<TFieldValues extends FieldValues = FieldValues, TName extend
|
|
|
46
46
|
* Optional auxiliary checkbox to render between the field and error message.
|
|
47
47
|
* Useful for input confirmation or conditional display of other fields.
|
|
48
48
|
*/
|
|
49
|
-
auxiliaryCheckbox?:
|
|
49
|
+
auxiliaryCheckbox?: AuxiliaryCheckboxProps<TFieldValues, FieldPath<TFieldValues>>;
|
|
50
50
|
} & SxProp;
|
|
51
51
|
type FormFieldCompleteProps<TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>> = {
|
|
52
52
|
render: (props: UseControllerReturn<TFieldValues, TName>) => React.ReactElement;
|
package/dist/esm/Brazil/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** Powered by @ttoss/config. https://ttoss.dev/docs/modules/packages/config/ */
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import { FormField, FormFieldCNPJ, FormFieldCPF, FormFieldPatternFormat, __name, isCnpjValid, isCpfValid } from "../chunk-
|
|
3
|
+
import { FormField, FormFieldCNPJ, FormFieldCPF, FormFieldPatternFormat, __name, isCnpjValid, isCpfValid } from "../chunk-BL55OAIO.js";
|
|
4
4
|
|
|
5
5
|
// src/Brazil/FormFieldCEP.tsx
|
|
6
6
|
var FormFieldCEP = /* @__PURE__ */__name(({
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/** Powered by @ttoss/config. https://ttoss.dev/docs/modules/packages/config/ */
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import { Form, useForm, yupResolver } from "../chunk-
|
|
4
|
-
import { __name } from "../chunk-
|
|
3
|
+
import { Form, useForm, yupResolver } from "../chunk-ILQOS34E.js";
|
|
4
|
+
import { __name } from "../chunk-BL55OAIO.js";
|
|
5
5
|
|
|
6
6
|
// src/MultistepForm/MultistepForm.tsx
|
|
7
7
|
import { Flex as Flex6 } from "@ttoss/ui";
|
|
@@ -81,7 +81,8 @@ var AuxiliaryCheckbox = /* @__PURE__ */__name(({
|
|
|
81
81
|
sx: {
|
|
82
82
|
flexDirection: "row",
|
|
83
83
|
alignItems: "center",
|
|
84
|
-
cursor: isDisabled ? "not-allowed" : "pointer"
|
|
84
|
+
cursor: isDisabled ? "not-allowed" : "pointer",
|
|
85
|
+
opacity: isDisabled ? 0.5 : 1
|
|
85
86
|
}
|
|
86
87
|
}, /* @__PURE__ */React2.createElement(Flex, {
|
|
87
88
|
sx: {
|
|
@@ -190,7 +191,7 @@ var FormField = /* @__PURE__ */__name(({
|
|
|
190
191
|
css
|
|
191
192
|
}, memoizedRender, auxiliaryCheckbox && /* @__PURE__ */React3.createElement(AuxiliaryCheckbox, {
|
|
192
193
|
...auxiliaryCheckbox,
|
|
193
|
-
disabled
|
|
194
|
+
disabled: auxiliaryCheckbox.disabled || disabled
|
|
194
195
|
}), /* @__PURE__ */React3.createElement(FormErrorMessage, {
|
|
195
196
|
name: errorNameToDisplay
|
|
196
197
|
}), warning && !hasError && /* @__PURE__ */React3.createElement(Flex2, {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** Powered by @ttoss/config. https://ttoss.dev/docs/modules/packages/config/ */
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import { FormErrorMessage, FormField, FormFieldPatternFormat, __name, isCnpjValid, isCpfValid } from "./chunk-
|
|
3
|
+
import { FormErrorMessage, FormField, FormFieldPatternFormat, __name, isCnpjValid, isCpfValid } from "./chunk-BL55OAIO.js";
|
|
4
4
|
|
|
5
5
|
// src/Form.tsx
|
|
6
6
|
import { Box } from "@ttoss/ui";
|
package/dist/esm/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/** Powered by @ttoss/config. https://ttoss.dev/docs/modules/packages/config/ */
|
|
2
|
-
import { Controller, Form, FormFieldCheckbox, FormFieldCreditCardNumber, FormFieldCurrencyInput, FormFieldDatePicker, FormFieldInput, FormFieldNumericFormat, FormFieldPassword, FormFieldRadio, FormFieldRadioCard, FormFieldRadioCardIcony, FormFieldSegmentedControl, FormFieldSelect, FormFieldSwitch, FormFieldTextarea, FormGroup, FormProvider, useController, useFieldArray, useForm, useFormContext, useFormGroup, useFormState, useWatch, yup, yupResolver } from "./chunk-
|
|
3
|
-
import { FormErrorMessage, FormField, FormFieldPatternFormat } from "./chunk-
|
|
2
|
+
import { Controller, Form, FormFieldCheckbox, FormFieldCreditCardNumber, FormFieldCurrencyInput, FormFieldDatePicker, FormFieldInput, FormFieldNumericFormat, FormFieldPassword, FormFieldRadio, FormFieldRadioCard, FormFieldRadioCardIcony, FormFieldSegmentedControl, FormFieldSelect, FormFieldSwitch, FormFieldTextarea, FormGroup, FormProvider, useController, useFieldArray, useForm, useFormContext, useFormGroup, useFormState, useWatch, yup, yupResolver } from "./chunk-ILQOS34E.js";
|
|
3
|
+
import { FormErrorMessage, FormField, FormFieldPatternFormat } from "./chunk-BL55OAIO.js";
|
|
4
4
|
export { Controller, Form, FormErrorMessage, FormField, FormFieldCheckbox, FormFieldCreditCardNumber, FormFieldCurrencyInput, FormFieldDatePicker, FormFieldInput, FormFieldNumericFormat, FormFieldPassword, FormFieldPatternFormat, FormFieldRadio, FormFieldRadioCard, FormFieldRadioCardIcony, FormFieldSegmentedControl, FormFieldSelect, FormFieldSwitch, FormFieldTextarea, FormGroup, FormProvider, useController, useFieldArray, useForm, useFormContext, useFormGroup, useFormState, useWatch, yup, yupResolver };
|
package/dist/index.d.ts
CHANGED
|
@@ -4,8 +4,8 @@ import * as React from 'react';
|
|
|
4
4
|
import { FieldValues, FormProviderProps, FieldName, FieldPath } from 'react-hook-form';
|
|
5
5
|
export * from 'react-hook-form';
|
|
6
6
|
export { Controller, FormProvider, useController, useFieldArray, useForm, useFormContext, useFormState, useWatch } from 'react-hook-form';
|
|
7
|
-
import { F as FormFieldProps, a as FormFieldPatternFormatProps } from './FormFieldPatternFormat-
|
|
8
|
-
export { b as FormField, c as FormFieldPatternFormat } from './FormFieldPatternFormat-
|
|
7
|
+
import { F as FormFieldProps, a as FormFieldPatternFormatProps } from './FormFieldPatternFormat-kaO0pl1R.js';
|
|
8
|
+
export { b as FormField, c as FormFieldPatternFormat } from './FormFieldPatternFormat-kaO0pl1R.js';
|
|
9
9
|
import { NumericFormatProps } from 'react-number-format';
|
|
10
10
|
import { DateRange } from '@ttoss/components/DatePicker';
|
|
11
11
|
import './typings.d-BZ6kUiQ4.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ttoss/forms",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.40.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "ttoss",
|
|
6
6
|
"contributors": [
|
|
@@ -40,8 +40,8 @@
|
|
|
40
40
|
"peerDependencies": {
|
|
41
41
|
"react": ">=16.8.0",
|
|
42
42
|
"@ttoss/components": "^2.12.6",
|
|
43
|
-
"@ttoss/
|
|
44
|
-
"@ttoss/
|
|
43
|
+
"@ttoss/ui": "^6.5.1",
|
|
44
|
+
"@ttoss/react-i18n": "^2.0.26"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@types/jest": "^30.0.0",
|
|
@@ -53,11 +53,11 @@
|
|
|
53
53
|
"yup": "^1.7.1",
|
|
54
54
|
"@ttoss/components": "^2.12.6",
|
|
55
55
|
"@ttoss/i18n-cli": "^0.7.38",
|
|
56
|
-
"@ttoss/config": "^1.35.12",
|
|
57
56
|
"@ttoss/react-i18n": "^2.0.26",
|
|
58
57
|
"@ttoss/test-utils": "^4.0.3",
|
|
59
58
|
"@ttoss/ui": "^6.5.1",
|
|
60
|
-
"@ttoss/react-icons": "^0.5.7"
|
|
59
|
+
"@ttoss/react-icons": "^0.5.7",
|
|
60
|
+
"@ttoss/config": "^1.35.12"
|
|
61
61
|
},
|
|
62
62
|
"publishConfig": {
|
|
63
63
|
"access": "public",
|