@ttoss/forms 0.33.2 → 0.33.4

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.
@@ -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, FormFieldPatternFormat, __name, isCnpjValid } from "../chunk-UO6326GP.js";
3
+ import { FormField, FormFieldCNPJ, FormFieldPatternFormat, __name, isCnpjValid } from "../chunk-TS4CHDPS.js";
4
4
 
5
5
  // src/Brazil/FormFieldPhone.tsx
6
6
  import { Input } from "@ttoss/ui";
@@ -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-GAPBDW3G.js";
4
- import { __name } from "../chunk-UO6326GP.js";
3
+ import { Form, useForm, yupResolver } from "../chunk-LTFTNMQO.js";
4
+ import { __name } from "../chunk-TS4CHDPS.js";
5
5
 
6
6
  // src/MultistepForm/MultistepForm.tsx
7
7
  import { Flex as Flex6 } from "@ttoss/ui";
@@ -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 } from "./chunk-UO6326GP.js";
3
+ import { FormErrorMessage, FormField, FormFieldPatternFormat, __name, isCnpjValid } from "./chunk-TS4CHDPS.js";
4
4
 
5
5
  // src/Form.tsx
6
6
  import { Box } from "@ttoss/ui";
@@ -95,29 +95,27 @@ var FormField = /* @__PURE__ */__name(({
95
95
  if (! /* @__PURE__ */React2.isValidElement(child)) {
96
96
  return null;
97
97
  }
98
- const childProps = child.props;
99
- const elementProps = {
98
+ const mergeProps = {
100
99
  id,
101
- ...childProps,
102
100
  ...(warning && {
103
101
  trailingIcon: "warning-alt"
104
102
  })
105
103
  };
106
104
  if (label && isCheckboxOrSwitch(child)) {
107
- return /* @__PURE__ */React2.createElement(Flex, {
105
+ return /* @__PURE__ */React2.createElement(Label, {
106
+ "aria-disabled": disabled,
107
+ htmlFor: id,
108
+ tooltip: labelTooltip,
108
109
  sx: {
109
110
  flexDirection: "row",
110
- alignItems: "center"
111
+ alignItems: "center",
112
+ cursor: disabled ? "not-allowed" : "pointer"
111
113
  }
112
114
  }, /* @__PURE__ */React2.createElement(Flex, {
113
115
  sx: {
114
116
  position: "relative"
115
117
  }
116
- }, /* @__PURE__ */React2.createElement(child.type, elementProps)), /* @__PURE__ */React2.createElement(Label, {
117
- "aria-disabled": disabled,
118
- htmlFor: id,
119
- tooltip: labelTooltip
120
- }, label));
118
+ }, /* @__PURE__ */React2.cloneElement(child, mergeProps)), label);
121
119
  }
122
120
  return /* @__PURE__ */React2.createElement(Flex, {
123
121
  sx: {
@@ -129,7 +127,7 @@ var FormField = /* @__PURE__ */__name(({
129
127
  "aria-disabled": disabled,
130
128
  htmlFor: id,
131
129
  tooltip: labelTooltip
132
- }, label), /* @__PURE__ */React2.createElement(child.type, elementProps));
130
+ }, label), /* @__PURE__ */React2.cloneElement(child, mergeProps));
133
131
  });
134
132
  }, [render, controllerReturnWithDisabled, label, disabled, id, labelTooltip, warning]);
135
133
  return /* @__PURE__ */React2.createElement(Flex, {
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, FormFieldInput, FormFieldNumericFormat, FormFieldPassword, FormFieldRadio, FormFieldRadioCard, FormFieldRadioCardIcony, FormFieldSelect, FormFieldSwitch, FormFieldTextarea, FormGroup, FormProvider, useController, useFieldArray, useForm, useFormContext, useFormGroup, useFormState, useWatch, yup, yupResolver } from "./chunk-GAPBDW3G.js";
3
- import { FormErrorMessage, FormField, FormFieldPatternFormat } from "./chunk-UO6326GP.js";
2
+ import { Controller, Form, FormFieldCheckbox, FormFieldCreditCardNumber, FormFieldCurrencyInput, FormFieldInput, FormFieldNumericFormat, FormFieldPassword, FormFieldRadio, FormFieldRadioCard, FormFieldRadioCardIcony, FormFieldSelect, FormFieldSwitch, FormFieldTextarea, FormGroup, FormProvider, useController, useFieldArray, useForm, useFormContext, useFormGroup, useFormState, useWatch, yup, yupResolver } from "./chunk-LTFTNMQO.js";
3
+ import { FormErrorMessage, FormField, FormFieldPatternFormat } from "./chunk-TS4CHDPS.js";
4
4
  export { Controller, Form, FormErrorMessage, FormField, FormFieldCheckbox, FormFieldCreditCardNumber, FormFieldCurrencyInput, FormFieldInput, FormFieldNumericFormat, FormFieldPassword, FormFieldPatternFormat, FormFieldRadio, FormFieldRadioCard, FormFieldRadioCardIcony, FormFieldSelect, FormFieldSwitch, FormFieldTextarea, FormGroup, FormProvider, useController, useFieldArray, useForm, useFormContext, useFormGroup, useFormState, useWatch, yup, yupResolver };
package/dist/index.d.ts CHANGED
@@ -23,7 +23,9 @@ declare const FormErrorMessage: <TFieldValues extends FieldValues = FieldValues>
23
23
  disabled?: boolean;
24
24
  }) => react_jsx_runtime.JSX.Element;
25
25
 
26
- type FormFieldCheckboxProps<TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>> = FormFieldProps<TFieldValues, TName> & Omit<CheckboxProps, 'name'>;
26
+ type FormFieldCheckboxProps<TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>> = Omit<FormFieldProps<TFieldValues, TName>, 'defaultValue'> & Omit<CheckboxProps, 'name' | 'defaultValue'> & {
27
+ defaultValue?: boolean;
28
+ };
27
29
  declare const FormFieldCheckbox: <TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>({ defaultValue, disabled, ...props }: FormFieldCheckboxProps<TFieldValues, TName>) => react_jsx_runtime.JSX.Element;
28
30
 
29
31
  type FormFieldCreditCardNumberProps<TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>> = FormFieldPatternFormatProps<TFieldValues, TName>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ttoss/forms",
3
- "version": "0.33.2",
3
+ "version": "0.33.4",
4
4
  "license": "MIT",
5
5
  "author": "ttoss",
6
6
  "contributors": [
@@ -40,7 +40,7 @@
40
40
  "peerDependencies": {
41
41
  "react": ">=16.8.0",
42
42
  "@ttoss/react-i18n": "^2.0.24",
43
- "@ttoss/ui": "^6.0.2"
43
+ "@ttoss/ui": "^6.0.4"
44
44
  },
45
45
  "devDependencies": {
46
46
  "@types/jest": "^30.0.0",
@@ -52,10 +52,10 @@
52
52
  "yup": "^1.7.1",
53
53
  "@ttoss/config": "^1.35.12",
54
54
  "@ttoss/i18n-cli": "^0.7.38",
55
- "@ttoss/react-icons": "^0.5.5",
56
55
  "@ttoss/react-i18n": "^2.0.24",
57
- "@ttoss/ui": "^6.0.2",
58
- "@ttoss/test-utils": "^4.0.1"
56
+ "@ttoss/react-icons": "^0.5.5",
57
+ "@ttoss/test-utils": "^4.0.1",
58
+ "@ttoss/ui": "^6.0.4"
59
59
  },
60
60
  "publishConfig": {
61
61
  "access": "public",