@ttoss/forms 0.38.0 → 0.39.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.
|
@@ -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 { Form, useForm, yupResolver } from "../chunk-
|
|
3
|
+
import { Form, useForm, yupResolver } from "../chunk-EGHO72SX.js";
|
|
4
4
|
import { __name } from "../chunk-QJQFXN4B.js";
|
|
5
5
|
|
|
6
6
|
// src/MultistepForm/MultistepForm.tsx
|
|
@@ -134,7 +134,7 @@ var MultistepFormStepper = /* @__PURE__ */__name(({
|
|
|
134
134
|
}, submitLabel));
|
|
135
135
|
}, "MultistepFormStepper");
|
|
136
136
|
|
|
137
|
-
// ../../node_modules/.pnpm/@iconify-icon+react@2.3.0_react@19.2.
|
|
137
|
+
// ../../node_modules/.pnpm/@iconify-icon+react@2.3.0_react@19.2.3/node_modules/@iconify-icon/react/dist/iconify.mjs
|
|
138
138
|
import React5 from "react";
|
|
139
139
|
|
|
140
140
|
// ../../node_modules/.pnpm/iconify-icon@2.3.0/node_modules/iconify-icon/dist/iconify-icon.mjs
|
|
@@ -2263,7 +2263,7 @@ var {
|
|
|
2263
2263
|
_api
|
|
2264
2264
|
} = IconifyIconComponent;
|
|
2265
2265
|
|
|
2266
|
-
// ../../node_modules/.pnpm/@iconify-icon+react@2.3.0_react@19.2.
|
|
2266
|
+
// ../../node_modules/.pnpm/@iconify-icon+react@2.3.0_react@19.2.3/node_modules/@iconify-icon/react/dist/iconify.mjs
|
|
2267
2267
|
var Icon = React5.forwardRef((props, ref) => {
|
|
2268
2268
|
const newProps = {
|
|
2269
2269
|
...props,
|
|
@@ -93,16 +93,41 @@ var FormFieldCreditCardNumber = /* @__PURE__ */__name(({
|
|
|
93
93
|
});
|
|
94
94
|
}, "FormFieldCreditCardNumber");
|
|
95
95
|
|
|
96
|
-
// src/FormFieldCurrencyInput.tsx
|
|
97
|
-
import { defineMessages, useI18n } from "@ttoss/react-i18n";
|
|
98
|
-
|
|
99
96
|
// src/FormFieldNumericFormat.tsx
|
|
97
|
+
import { defineMessages, useI18n } from "@ttoss/react-i18n";
|
|
100
98
|
import { Input } from "@ttoss/ui";
|
|
101
99
|
import { NumericFormat } from "react-number-format";
|
|
100
|
+
var messages = defineMessages({
|
|
101
|
+
decimalSeparator: {
|
|
102
|
+
id: "i6IsKy",
|
|
103
|
+
defaultMessage: [{
|
|
104
|
+
"type": 0,
|
|
105
|
+
"value": "."
|
|
106
|
+
}]
|
|
107
|
+
},
|
|
108
|
+
thousandSeparator: {
|
|
109
|
+
id: "yktL1M",
|
|
110
|
+
defaultMessage: [{
|
|
111
|
+
"type": 0,
|
|
112
|
+
"value": ","
|
|
113
|
+
}]
|
|
114
|
+
}
|
|
115
|
+
});
|
|
102
116
|
var FormFieldNumericFormat = /* @__PURE__ */__name(({
|
|
103
117
|
disabled,
|
|
118
|
+
decimalSeparator,
|
|
119
|
+
thousandSeparator,
|
|
120
|
+
placeholder,
|
|
121
|
+
prefix,
|
|
122
|
+
decimalScale,
|
|
104
123
|
...props
|
|
105
124
|
}) => {
|
|
125
|
+
const {
|
|
126
|
+
intl
|
|
127
|
+
} = useI18n();
|
|
128
|
+
const finalDecimalSeparator = decimalSeparator ?? intl.formatMessage(messages.decimalSeparator);
|
|
129
|
+
const finalThousandSeparator = thousandSeparator ?? intl.formatMessage(messages.thousandSeparator);
|
|
130
|
+
const finalPlaceholder = placeholder ?? (prefix && decimalScale !== void 0 && decimalScale >= 0 ? `${prefix} 0${decimalScale > 0 ? finalDecimalSeparator : ""}${"0".repeat(decimalScale)}` : void 0);
|
|
106
131
|
const {
|
|
107
132
|
label,
|
|
108
133
|
name,
|
|
@@ -137,6 +162,11 @@ var FormFieldNumericFormat = /* @__PURE__ */__name(({
|
|
|
137
162
|
}) => {
|
|
138
163
|
return /* @__PURE__ */React.createElement(NumericFormat, {
|
|
139
164
|
...numericFormatProps,
|
|
165
|
+
decimalSeparator: finalDecimalSeparator,
|
|
166
|
+
thousandSeparator: finalThousandSeparator,
|
|
167
|
+
placeholder: finalPlaceholder,
|
|
168
|
+
prefix,
|
|
169
|
+
decimalScale,
|
|
140
170
|
name: field.name,
|
|
141
171
|
value: field.value,
|
|
142
172
|
onBlur: /* @__PURE__ */__name(e => {
|
|
@@ -157,40 +187,14 @@ var FormFieldNumericFormat = /* @__PURE__ */__name(({
|
|
|
157
187
|
}, "FormFieldNumericFormat");
|
|
158
188
|
|
|
159
189
|
// src/FormFieldCurrencyInput.tsx
|
|
160
|
-
var messages = defineMessages({
|
|
161
|
-
decimalSeparator: {
|
|
162
|
-
id: "JnCaDG",
|
|
163
|
-
defaultMessage: [{
|
|
164
|
-
"type": 0,
|
|
165
|
-
"value": "."
|
|
166
|
-
}]
|
|
167
|
-
},
|
|
168
|
-
thousandSeparator: {
|
|
169
|
-
id: "0+4wTp",
|
|
170
|
-
defaultMessage: [{
|
|
171
|
-
"type": 0,
|
|
172
|
-
"value": ","
|
|
173
|
-
}]
|
|
174
|
-
}
|
|
175
|
-
});
|
|
176
190
|
var FormFieldCurrencyInput = /* @__PURE__ */__name(({
|
|
177
191
|
prefix,
|
|
178
|
-
decimalSeparator,
|
|
179
|
-
thousandSeparator,
|
|
180
192
|
...formFieldNumericFormatProps
|
|
181
193
|
}) => {
|
|
182
|
-
const {
|
|
183
|
-
intl
|
|
184
|
-
} = useI18n();
|
|
185
|
-
const finalDecimalSeparator = decimalSeparator ?? intl.formatMessage(messages.decimalSeparator);
|
|
186
|
-
const finalThousandSeparator = thousandSeparator ?? intl.formatMessage(messages.thousandSeparator);
|
|
187
194
|
return /* @__PURE__ */React.createElement(FormFieldNumericFormat, {
|
|
188
195
|
fixedDecimalScale: true,
|
|
189
196
|
decimalScale: 2,
|
|
190
197
|
prefix,
|
|
191
|
-
decimalSeparator: finalDecimalSeparator,
|
|
192
|
-
thousandSeparator: finalThousandSeparator,
|
|
193
|
-
placeholder: `${prefix} 0${finalDecimalSeparator}00`,
|
|
194
198
|
allowNegative: false,
|
|
195
199
|
...formFieldNumericFormatProps
|
|
196
200
|
});
|
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-
|
|
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-EGHO72SX.js";
|
|
3
3
|
import { FormErrorMessage, FormField, FormFieldPatternFormat } from "./chunk-QJQFXN4B.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
|
@@ -33,12 +33,12 @@ type FormFieldCreditCardNumberProps<TFieldValues extends FieldValues = FieldValu
|
|
|
33
33
|
declare const FormFieldCreditCardNumber: <TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>({ format, placeholder, ...formFieldPatternFormatProps }: FormFieldCreditCardNumberProps<TFieldValues, TName>) => react_jsx_runtime.JSX.Element;
|
|
34
34
|
|
|
35
35
|
type FormFieldNumericFormatProps<TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>> = FormFieldProps<TFieldValues, TName> & Omit<NumericFormatProps, 'name'> & Pick<InputProps, 'leadingIcon' | 'trailingIcon'>;
|
|
36
|
-
declare const FormFieldNumericFormat: <TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>({ disabled, ...props }: FormFieldNumericFormatProps<TFieldValues, TName>) => react_jsx_runtime.JSX.Element;
|
|
36
|
+
declare const FormFieldNumericFormat: <TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>({ disabled, decimalSeparator, thousandSeparator, placeholder, prefix, decimalScale, ...props }: FormFieldNumericFormatProps<TFieldValues, TName>) => react_jsx_runtime.JSX.Element;
|
|
37
37
|
|
|
38
38
|
type FormFieldCurrencyInputProps<TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>> = FormFieldNumericFormatProps<TFieldValues, TName> & {
|
|
39
39
|
prefix: string;
|
|
40
40
|
};
|
|
41
|
-
declare const FormFieldCurrencyInput: <TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>({ prefix,
|
|
41
|
+
declare const FormFieldCurrencyInput: <TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>({ prefix, ...formFieldNumericFormatProps }: FormFieldCurrencyInputProps<TFieldValues, TName>) => react_jsx_runtime.JSX.Element;
|
|
42
42
|
|
|
43
43
|
interface DateRangePreset {
|
|
44
44
|
label: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ttoss/forms",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.39.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "ttoss",
|
|
6
6
|
"contributors": [
|
|
@@ -39,25 +39,25 @@
|
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
|
41
41
|
"react": ">=16.8.0",
|
|
42
|
-
"@ttoss/components": "^2.12.
|
|
43
|
-
"@ttoss/
|
|
44
|
-
"@ttoss/
|
|
42
|
+
"@ttoss/components": "^2.12.5",
|
|
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",
|
|
48
|
-
"@types/react": "^19.2.
|
|
48
|
+
"@types/react": "^19.2.8",
|
|
49
49
|
"jest": "^30.2.0",
|
|
50
|
-
"react": "^19.2.
|
|
50
|
+
"react": "^19.2.3",
|
|
51
51
|
"react-error-boundary": "^6.0.0",
|
|
52
52
|
"tsup": "^8.5.1",
|
|
53
53
|
"yup": "^1.7.1",
|
|
54
|
-
"@ttoss/components": "^2.12.
|
|
54
|
+
"@ttoss/components": "^2.12.5",
|
|
55
|
+
"@ttoss/react-i18n": "^2.0.26",
|
|
55
56
|
"@ttoss/config": "^1.35.12",
|
|
56
|
-
"@ttoss/react-
|
|
57
|
+
"@ttoss/react-icons": "^0.5.7",
|
|
57
58
|
"@ttoss/i18n-cli": "^0.7.38",
|
|
58
|
-
"@ttoss/
|
|
59
|
-
"@ttoss/
|
|
60
|
-
"@ttoss/ui": "^6.5.0"
|
|
59
|
+
"@ttoss/test-utils": "^4.0.3",
|
|
60
|
+
"@ttoss/ui": "^6.5.1"
|
|
61
61
|
},
|
|
62
62
|
"publishConfig": {
|
|
63
63
|
"access": "public",
|