@ttoss/forms 0.40.0 → 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 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.
@@ -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-D5CI6eUA.js';
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?: Omit<AuxiliaryCheckboxProps<TFieldValues, FieldPath<TFieldValues>>, 'disabled'>;
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;
@@ -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-NBDCBFUP.js";
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-UM6UU5C2.js";
4
- import { __name } from "../chunk-NBDCBFUP.js";
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";
@@ -191,7 +191,7 @@ var FormField = /* @__PURE__ */__name(({
191
191
  css
192
192
  }, memoizedRender, auxiliaryCheckbox && /* @__PURE__ */React3.createElement(AuxiliaryCheckbox, {
193
193
  ...auxiliaryCheckbox,
194
- disabled
194
+ disabled: auxiliaryCheckbox.disabled || disabled
195
195
  }), /* @__PURE__ */React3.createElement(FormErrorMessage, {
196
196
  name: errorNameToDisplay
197
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-NBDCBFUP.js";
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-UM6UU5C2.js";
3
- import { FormErrorMessage, FormField, FormFieldPatternFormat } from "./chunk-NBDCBFUP.js";
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-D5CI6eUA.js';
8
- export { b as FormField, c as FormFieldPatternFormat } from './FormFieldPatternFormat-D5CI6eUA.js';
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.40.0",
3
+ "version": "0.40.1",
4
4
  "license": "MIT",
5
5
  "author": "ttoss",
6
6
  "contributors": [
@@ -39,9 +39,9 @@
39
39
  },
40
40
  "peerDependencies": {
41
41
  "react": ">=16.8.0",
42
- "@ttoss/react-i18n": "^2.0.26",
42
+ "@ttoss/components": "^2.12.6",
43
43
  "@ttoss/ui": "^6.5.1",
44
- "@ttoss/components": "^2.12.6"
44
+ "@ttoss/react-i18n": "^2.0.26"
45
45
  },
46
46
  "devDependencies": {
47
47
  "@types/jest": "^30.0.0",
@@ -52,12 +52,12 @@
52
52
  "tsup": "^8.5.1",
53
53
  "yup": "^1.7.1",
54
54
  "@ttoss/components": "^2.12.6",
55
- "@ttoss/config": "^1.35.12",
56
- "@ttoss/react-icons": "^0.5.7",
57
- "@ttoss/react-i18n": "^2.0.26",
58
55
  "@ttoss/i18n-cli": "^0.7.38",
56
+ "@ttoss/react-i18n": "^2.0.26",
57
+ "@ttoss/test-utils": "^4.0.3",
59
58
  "@ttoss/ui": "^6.5.1",
60
- "@ttoss/test-utils": "^4.0.3"
59
+ "@ttoss/react-icons": "^0.5.7",
60
+ "@ttoss/config": "^1.35.12"
61
61
  },
62
62
  "publishConfig": {
63
63
  "access": "public",