@ttoss/forms 0.17.0 → 0.17.2

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/dist/esm/index.js CHANGED
@@ -207,16 +207,17 @@ var FormFieldInput = ({
207
207
  });
208
208
  };
209
209
 
210
- // src/FormFieldRadio.tsx
211
- import { Box as Box2, Flex as Flex4, Label as Label4, Radio } from "@ttoss/ui";
210
+ // src/FormFieldPassword.tsx
212
211
  import { useController as useController4 } from "react-hook-form";
212
+ import { Flex as Flex4, InputPassword, Label as Label4 } from "@ttoss/ui";
213
213
  import { jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
214
- var FormFieldRadio = ({
214
+ var FormFieldPassword = ({
215
215
  label,
216
216
  name,
217
- options,
217
+ tooltip,
218
+ onTooltipClick,
218
219
  sx,
219
- ...radioProps
220
+ ...inputProps
220
221
  }) => {
221
222
  const {
222
223
  field: {
@@ -224,11 +225,16 @@ var FormFieldRadio = ({
224
225
  onBlur,
225
226
  value,
226
227
  ref
228
+ },
229
+ formState: {
230
+ errors
227
231
  }
228
232
  } = useController4({
229
233
  name,
230
234
  defaultValue: ""
231
235
  });
236
+ const id = `form-field-password-${name}`;
237
+ const hasError = !!errors[name]?.message;
232
238
  return /* @__PURE__ */jsxs4(Flex4, {
233
239
  sx: {
234
240
  flexDirection: "column",
@@ -236,13 +242,62 @@ var FormFieldRadio = ({
236
242
  ...sx
237
243
  },
238
244
  children: [label && /* @__PURE__ */jsx6(Label4, {
245
+ "aria-disabled": inputProps.disabled,
246
+ htmlFor: id,
247
+ tooltip,
248
+ onTooltipClick,
249
+ children: label
250
+ }), /* @__PURE__ */jsx6(InputPassword, {
251
+ ref,
252
+ onChange,
253
+ className: hasError ? "error" : "",
254
+ onBlur,
255
+ value,
256
+ name,
257
+ id,
258
+ ...inputProps
259
+ }), /* @__PURE__ */jsx6(ErrorMessage, {
260
+ name
261
+ })]
262
+ });
263
+ };
264
+
265
+ // src/FormFieldRadio.tsx
266
+ import { Box as Box2, Flex as Flex5, Label as Label5, Radio } from "@ttoss/ui";
267
+ import { useController as useController5 } from "react-hook-form";
268
+ import { jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
269
+ var FormFieldRadio = ({
270
+ label,
271
+ name,
272
+ options,
273
+ sx,
274
+ ...radioProps
275
+ }) => {
276
+ const {
277
+ field: {
278
+ onChange,
279
+ onBlur,
280
+ value,
281
+ ref
282
+ }
283
+ } = useController5({
284
+ name,
285
+ defaultValue: ""
286
+ });
287
+ return /* @__PURE__ */jsxs5(Flex5, {
288
+ sx: {
289
+ flexDirection: "column",
290
+ width: "100%",
291
+ ...sx
292
+ },
293
+ children: [label && /* @__PURE__ */jsx7(Label5, {
239
294
  children: label
240
- }), /* @__PURE__ */jsx6(Box2, {
295
+ }), /* @__PURE__ */jsx7(Box2, {
241
296
  children: options.map(option => {
242
297
  const id = `form-field-radio-${name}-${option.value}`;
243
- return /* @__PURE__ */jsxs4(Label4, {
298
+ return /* @__PURE__ */jsxs5(Label5, {
244
299
  htmlFor: id,
245
- children: [/* @__PURE__ */jsx6(Radio, {
300
+ children: [/* @__PURE__ */jsx7(Radio, {
246
301
  ref,
247
302
  onChange,
248
303
  onBlur,
@@ -254,16 +309,16 @@ var FormFieldRadio = ({
254
309
  }), option.label]
255
310
  }, id);
256
311
  })
257
- }), /* @__PURE__ */jsx6(ErrorMessage, {
312
+ }), /* @__PURE__ */jsx7(ErrorMessage, {
258
313
  name
259
314
  })]
260
315
  });
261
316
  };
262
317
 
263
318
  // src/FormFieldSelect.tsx
264
- import { useController as useController5 } from "react-hook-form";
265
- import { Flex as Flex5, Label as Label5, Select } from "@ttoss/ui";
266
- import { jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
319
+ import { useController as useController6 } from "react-hook-form";
320
+ import { Flex as Flex6, Label as Label6, Select } from "@ttoss/ui";
321
+ import { jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
267
322
  var checkDefaultValue = (options, defaultValue, placeholder) => {
268
323
  const hasEmptyValue = options.some(opt => {
269
324
  return opt.value === "" || opt.value === 0;
@@ -299,21 +354,21 @@ var FormFieldSelect = ({
299
354
  value,
300
355
  ref
301
356
  }
302
- } = useController5({
357
+ } = useController6({
303
358
  name,
304
359
  defaultValue: checkedDefaultValue
305
360
  });
306
361
  const id = `form-field-select-${name}`;
307
- return /* @__PURE__ */jsxs5(Flex5, {
362
+ return /* @__PURE__ */jsxs6(Flex6, {
308
363
  sx: {
309
364
  flexDirection: "column",
310
365
  width: "100%",
311
366
  ...sx
312
367
  },
313
- children: [label && /* @__PURE__ */jsx7(Label5, {
368
+ children: [label && /* @__PURE__ */jsx8(Label6, {
314
369
  htmlFor: id,
315
370
  children: label
316
- }), /* @__PURE__ */jsx7(Select, {
371
+ }), /* @__PURE__ */jsx8(Select, {
317
372
  ref,
318
373
  name,
319
374
  onChange,
@@ -325,12 +380,12 @@ var FormFieldSelect = ({
325
380
  defaultValue: void 0
326
381
  },
327
382
  children: options.map(option => {
328
- return /* @__PURE__ */jsx7("option", {
383
+ return /* @__PURE__ */jsx8("option", {
329
384
  value: option.value,
330
385
  children: option.label
331
386
  }, option.label);
332
387
  })
333
- }), /* @__PURE__ */jsx7(ErrorMessage, {
388
+ }), /* @__PURE__ */jsx8(ErrorMessage, {
334
389
  name
335
390
  })]
336
391
  });
@@ -338,7 +393,7 @@ var FormFieldSelect = ({
338
393
 
339
394
  // src/FormFieldTextarea.tsx
340
395
  import { Textarea } from "@ttoss/ui";
341
- import { jsx as jsx8 } from "react/jsx-runtime";
396
+ import { jsx as jsx9 } from "react/jsx-runtime";
342
397
  var FormFieldTextarea = ({
343
398
  label,
344
399
  name,
@@ -346,7 +401,7 @@ var FormFieldTextarea = ({
346
401
  ...textareaProps
347
402
  }) => {
348
403
  const id = `form-field-textarea-${name}`;
349
- return /* @__PURE__ */jsx8(FormField, {
404
+ return /* @__PURE__ */jsx9(FormField, {
350
405
  label,
351
406
  name,
352
407
  id,
@@ -354,7 +409,7 @@ var FormFieldTextarea = ({
354
409
  render: ({
355
410
  field
356
411
  }) => {
357
- return /* @__PURE__ */jsx8(Textarea, {
412
+ return /* @__PURE__ */jsx9(Textarea, {
358
413
  ...field,
359
414
  ...textareaProps
360
415
  });
@@ -364,8 +419,8 @@ var FormFieldTextarea = ({
364
419
 
365
420
  // src/FormGroup.tsx
366
421
  import * as React3 from "react";
367
- import { Box as Box3, Flex as Flex6, Text } from "@ttoss/ui";
368
- import { jsx as jsx9, jsxs as jsxs6 } from "react/jsx-runtime";
422
+ import { Box as Box3, Flex as Flex7, Text } from "@ttoss/ui";
423
+ import { jsx as jsx10, jsxs as jsxs7 } from "react/jsx-runtime";
369
424
  var FormGroupLevelsManagerContext = /*#__PURE__*/React3.createContext({
370
425
  levelsLength: 1,
371
426
  registerChild: () => {
@@ -381,7 +436,7 @@ var FormGroupLevelsManager = ({
381
436
  setLevelsLength(level + 1);
382
437
  }
383
438
  }, [levelsLength]);
384
- return /* @__PURE__ */jsx9(FormGroupLevelsManagerContext.Provider, {
439
+ return /* @__PURE__ */jsx10(FormGroupLevelsManagerContext.Provider, {
385
440
  value: {
386
441
  levelsLength,
387
442
  registerChild
@@ -424,7 +479,7 @@ var FormGroupWrapper = ({
424
479
  gap: "md",
425
480
  width: "100%"
426
481
  };
427
- return /* @__PURE__ */jsxs6(Box3, {
482
+ return /* @__PURE__ */jsxs7(Box3, {
428
483
  "aria-level": level,
429
484
  ...boxProps,
430
485
  sx: {
@@ -432,18 +487,18 @@ var FormGroupWrapper = ({
432
487
  marginBottom: "lg",
433
488
  ...boxProps.sx
434
489
  },
435
- children: [title && /* @__PURE__ */jsx9(Box3, {
490
+ children: [title && /* @__PURE__ */jsx10(Box3, {
436
491
  sx: {
437
492
  marginBottom: "md"
438
493
  },
439
- children: /* @__PURE__ */jsx9(Text, {
494
+ children: /* @__PURE__ */jsx10(Text, {
440
495
  sx: {
441
496
  fontSize: "2xl",
442
497
  fontWeight: "bold"
443
498
  },
444
499
  children: title
445
500
  })
446
- }), /* @__PURE__ */jsx9(Flex6, {
501
+ }), /* @__PURE__ */jsx10(Flex7, {
447
502
  sx: childrenContainerSx,
448
503
  children
449
504
  })]
@@ -454,17 +509,17 @@ var FormGroup = props => {
454
509
  level
455
510
  } = useFormGroup();
456
511
  const currentLevel = level === void 0 ? 0 : level + 1;
457
- return /* @__PURE__ */jsx9(FormGroupContext.Provider, {
512
+ return /* @__PURE__ */jsx10(FormGroupContext.Provider, {
458
513
  value: {
459
514
  parentLevel: currentLevel
460
515
  },
461
- children: currentLevel === 0 ? /* @__PURE__ */jsx9(FormGroupLevelsManager, {
462
- children: /* @__PURE__ */jsx9(FormGroupWrapper, {
516
+ children: currentLevel === 0 ? /* @__PURE__ */jsx10(FormGroupLevelsManager, {
517
+ children: /* @__PURE__ */jsx10(FormGroupWrapper, {
463
518
  ...props
464
519
  })
465
- }) : /* @__PURE__ */jsx9(FormGroupWrapper, {
520
+ }) : /* @__PURE__ */jsx10(FormGroupWrapper, {
466
521
  ...props
467
522
  })
468
523
  });
469
524
  };
470
- export { Form, FormField, FormFieldCheckbox, FormFieldInput, FormFieldRadio, FormFieldSelect, FormFieldTextarea, FormGroup, useFormGroup, yup, yupResolver };
525
+ export { Form, FormField, FormFieldCheckbox, FormFieldInput, FormFieldPassword, FormFieldRadio, FormFieldSelect, FormFieldTextarea, FormGroup, useFormGroup, yup, yupResolver };
package/dist/index.d.ts CHANGED
@@ -5,7 +5,7 @@ export * from 'react-hook-form';
5
5
  import * as yup from 'yup';
6
6
  export { yup };
7
7
  import * as React from 'react';
8
- import { BoxProps, FlexProps, CheckboxProps, InputProps, LabelProps, RadioProps, SelectProps, TextareaProps } from '@ttoss/ui';
8
+ import { BoxProps, FlexProps, CheckboxProps, InputProps, LabelProps, InputPasswordProps, RadioProps, SelectProps, TextareaProps } from '@ttoss/ui';
9
9
 
10
10
  declare const Form: <TFieldValues extends FieldValues = FieldValues>({ children, onSubmit, sx, ...formMethods }: {
11
11
  children?: React.ReactNode;
@@ -29,10 +29,17 @@ declare const FormFieldCheckbox: <TFieldValues extends FieldValues = FieldValues
29
29
  name: FieldPath<TFieldValues>;
30
30
  } & CheckboxProps) => JSX.Element;
31
31
 
32
- declare const FormFieldInput: <TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>({ label, name, tooltip, onTooltipClick, sx, ...inputProps }: {
33
- label?: string | undefined;
32
+ type FormFieldInputProps<TName> = {
33
+ label?: string;
34
+ name: TName;
35
+ } & InputProps & Pick<LabelProps, 'tooltip' | 'onTooltipClick'>;
36
+ declare const FormFieldInput: <TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>({ label, name, tooltip, onTooltipClick, sx, ...inputProps }: FormFieldInputProps<TName>) => JSX.Element;
37
+
38
+ type FormFieldPasswordProps<TName> = {
39
+ label?: string;
34
40
  name: TName;
35
- } & InputProps & Pick<LabelProps, "tooltip" | "onTooltipClick">) => JSX.Element;
41
+ } & InputPasswordProps & Pick<LabelProps, 'tooltip' | 'onTooltipClick'>;
42
+ declare const FormFieldPassword: <TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>({ label, name, tooltip, onTooltipClick, sx, ...inputProps }: FormFieldPasswordProps<TName>) => JSX.Element;
36
43
 
37
44
  type FormRadioOption$1 = {
38
45
  value: string | number;
@@ -74,4 +81,4 @@ type FormGroupProps = {
74
81
  } & BoxProps;
75
82
  declare const FormGroup: (props: FormGroupProps) => JSX.Element;
76
83
 
77
- export { Form, FormField, FormFieldCheckbox, FormFieldInput, FormFieldRadio, FormFieldSelect, FormFieldTextarea, FormGroup, useFormGroup };
84
+ export { Form, FormField, FormFieldCheckbox, FormFieldInput, FormFieldPassword, FormFieldRadio, FormFieldSelect, FormFieldTextarea, FormGroup, useFormGroup };
package/dist/index.js CHANGED
@@ -43,6 +43,7 @@ __export(src_exports, {
43
43
  FormField: () => FormField,
44
44
  FormFieldCheckbox: () => FormFieldCheckbox,
45
45
  FormFieldInput: () => FormFieldInput,
46
+ FormFieldPassword: () => FormFieldPassword,
46
47
  FormFieldRadio: () => FormFieldRadio,
47
48
  FormFieldSelect: () => FormFieldSelect,
48
49
  FormFieldTextarea: () => FormFieldTextarea,
@@ -258,16 +259,17 @@ var FormFieldInput = ({
258
259
  });
259
260
  };
260
261
 
261
- // src/FormFieldRadio.tsx
262
- var import_ui6 = require("@ttoss/ui");
262
+ // src/FormFieldPassword.tsx
263
263
  var import_react_hook_form6 = require("react-hook-form");
264
+ var import_ui6 = require("@ttoss/ui");
264
265
  var import_jsx_runtime6 = require("react/jsx-runtime");
265
- var FormFieldRadio = ({
266
+ var FormFieldPassword = ({
266
267
  label,
267
268
  name,
268
- options,
269
+ tooltip,
270
+ onTooltipClick,
269
271
  sx,
270
- ...radioProps
272
+ ...inputProps
271
273
  }) => {
272
274
  const {
273
275
  field: {
@@ -275,11 +277,16 @@ var FormFieldRadio = ({
275
277
  onBlur,
276
278
  value,
277
279
  ref
280
+ },
281
+ formState: {
282
+ errors
278
283
  }
279
284
  } = (0, import_react_hook_form6.useController)({
280
285
  name,
281
286
  defaultValue: ""
282
287
  });
288
+ const id = `form-field-password-${name}`;
289
+ const hasError = !!errors[name]?.message;
283
290
  return /* @__PURE__ */(0, import_jsx_runtime6.jsxs)(import_ui6.Flex, {
284
291
  sx: {
285
292
  flexDirection: "column",
@@ -287,13 +294,62 @@ var FormFieldRadio = ({
287
294
  ...sx
288
295
  },
289
296
  children: [label && /* @__PURE__ */(0, import_jsx_runtime6.jsx)(import_ui6.Label, {
297
+ "aria-disabled": inputProps.disabled,
298
+ htmlFor: id,
299
+ tooltip,
300
+ onTooltipClick,
301
+ children: label
302
+ }), /* @__PURE__ */(0, import_jsx_runtime6.jsx)(import_ui6.InputPassword, {
303
+ ref,
304
+ onChange,
305
+ className: hasError ? "error" : "",
306
+ onBlur,
307
+ value,
308
+ name,
309
+ id,
310
+ ...inputProps
311
+ }), /* @__PURE__ */(0, import_jsx_runtime6.jsx)(ErrorMessage, {
312
+ name
313
+ })]
314
+ });
315
+ };
316
+
317
+ // src/FormFieldRadio.tsx
318
+ var import_ui7 = require("@ttoss/ui");
319
+ var import_react_hook_form7 = require("react-hook-form");
320
+ var import_jsx_runtime7 = require("react/jsx-runtime");
321
+ var FormFieldRadio = ({
322
+ label,
323
+ name,
324
+ options,
325
+ sx,
326
+ ...radioProps
327
+ }) => {
328
+ const {
329
+ field: {
330
+ onChange,
331
+ onBlur,
332
+ value,
333
+ ref
334
+ }
335
+ } = (0, import_react_hook_form7.useController)({
336
+ name,
337
+ defaultValue: ""
338
+ });
339
+ return /* @__PURE__ */(0, import_jsx_runtime7.jsxs)(import_ui7.Flex, {
340
+ sx: {
341
+ flexDirection: "column",
342
+ width: "100%",
343
+ ...sx
344
+ },
345
+ children: [label && /* @__PURE__ */(0, import_jsx_runtime7.jsx)(import_ui7.Label, {
290
346
  children: label
291
- }), /* @__PURE__ */(0, import_jsx_runtime6.jsx)(import_ui6.Box, {
347
+ }), /* @__PURE__ */(0, import_jsx_runtime7.jsx)(import_ui7.Box, {
292
348
  children: options.map(option => {
293
349
  const id = `form-field-radio-${name}-${option.value}`;
294
- return /* @__PURE__ */(0, import_jsx_runtime6.jsxs)(import_ui6.Label, {
350
+ return /* @__PURE__ */(0, import_jsx_runtime7.jsxs)(import_ui7.Label, {
295
351
  htmlFor: id,
296
- children: [/* @__PURE__ */(0, import_jsx_runtime6.jsx)(import_ui6.Radio, {
352
+ children: [/* @__PURE__ */(0, import_jsx_runtime7.jsx)(import_ui7.Radio, {
297
353
  ref,
298
354
  onChange,
299
355
  onBlur,
@@ -305,16 +361,16 @@ var FormFieldRadio = ({
305
361
  }), option.label]
306
362
  }, id);
307
363
  })
308
- }), /* @__PURE__ */(0, import_jsx_runtime6.jsx)(ErrorMessage, {
364
+ }), /* @__PURE__ */(0, import_jsx_runtime7.jsx)(ErrorMessage, {
309
365
  name
310
366
  })]
311
367
  });
312
368
  };
313
369
 
314
370
  // src/FormFieldSelect.tsx
315
- var import_react_hook_form7 = require("react-hook-form");
316
- var import_ui7 = require("@ttoss/ui");
317
- var import_jsx_runtime7 = require("react/jsx-runtime");
371
+ var import_react_hook_form8 = require("react-hook-form");
372
+ var import_ui8 = require("@ttoss/ui");
373
+ var import_jsx_runtime8 = require("react/jsx-runtime");
318
374
  var checkDefaultValue = (options, defaultValue, placeholder) => {
319
375
  const hasEmptyValue = options.some(opt => {
320
376
  return opt.value === "" || opt.value === 0;
@@ -350,21 +406,21 @@ var FormFieldSelect = ({
350
406
  value,
351
407
  ref
352
408
  }
353
- } = (0, import_react_hook_form7.useController)({
409
+ } = (0, import_react_hook_form8.useController)({
354
410
  name,
355
411
  defaultValue: checkedDefaultValue
356
412
  });
357
413
  const id = `form-field-select-${name}`;
358
- return /* @__PURE__ */(0, import_jsx_runtime7.jsxs)(import_ui7.Flex, {
414
+ return /* @__PURE__ */(0, import_jsx_runtime8.jsxs)(import_ui8.Flex, {
359
415
  sx: {
360
416
  flexDirection: "column",
361
417
  width: "100%",
362
418
  ...sx
363
419
  },
364
- children: [label && /* @__PURE__ */(0, import_jsx_runtime7.jsx)(import_ui7.Label, {
420
+ children: [label && /* @__PURE__ */(0, import_jsx_runtime8.jsx)(import_ui8.Label, {
365
421
  htmlFor: id,
366
422
  children: label
367
- }), /* @__PURE__ */(0, import_jsx_runtime7.jsx)(import_ui7.Select, {
423
+ }), /* @__PURE__ */(0, import_jsx_runtime8.jsx)(import_ui8.Select, {
368
424
  ref,
369
425
  name,
370
426
  onChange,
@@ -376,20 +432,20 @@ var FormFieldSelect = ({
376
432
  defaultValue: void 0
377
433
  },
378
434
  children: options.map(option => {
379
- return /* @__PURE__ */(0, import_jsx_runtime7.jsx)("option", {
435
+ return /* @__PURE__ */(0, import_jsx_runtime8.jsx)("option", {
380
436
  value: option.value,
381
437
  children: option.label
382
438
  }, option.label);
383
439
  })
384
- }), /* @__PURE__ */(0, import_jsx_runtime7.jsx)(ErrorMessage, {
440
+ }), /* @__PURE__ */(0, import_jsx_runtime8.jsx)(ErrorMessage, {
385
441
  name
386
442
  })]
387
443
  });
388
444
  };
389
445
 
390
446
  // src/FormFieldTextarea.tsx
391
- var import_ui8 = require("@ttoss/ui");
392
- var import_jsx_runtime8 = require("react/jsx-runtime");
447
+ var import_ui9 = require("@ttoss/ui");
448
+ var import_jsx_runtime9 = require("react/jsx-runtime");
393
449
  var FormFieldTextarea = ({
394
450
  label,
395
451
  name,
@@ -397,7 +453,7 @@ var FormFieldTextarea = ({
397
453
  ...textareaProps
398
454
  }) => {
399
455
  const id = `form-field-textarea-${name}`;
400
- return /* @__PURE__ */(0, import_jsx_runtime8.jsx)(FormField, {
456
+ return /* @__PURE__ */(0, import_jsx_runtime9.jsx)(FormField, {
401
457
  label,
402
458
  name,
403
459
  id,
@@ -405,7 +461,7 @@ var FormFieldTextarea = ({
405
461
  render: ({
406
462
  field
407
463
  }) => {
408
- return /* @__PURE__ */(0, import_jsx_runtime8.jsx)(import_ui8.Textarea, {
464
+ return /* @__PURE__ */(0, import_jsx_runtime9.jsx)(import_ui9.Textarea, {
409
465
  ...field,
410
466
  ...textareaProps
411
467
  });
@@ -415,8 +471,8 @@ var FormFieldTextarea = ({
415
471
 
416
472
  // src/FormGroup.tsx
417
473
  var React3 = __toESM(require("react"));
418
- var import_ui9 = require("@ttoss/ui");
419
- var import_jsx_runtime9 = require("react/jsx-runtime");
474
+ var import_ui10 = require("@ttoss/ui");
475
+ var import_jsx_runtime10 = require("react/jsx-runtime");
420
476
  var FormGroupLevelsManagerContext = React3.createContext({
421
477
  levelsLength: 1,
422
478
  registerChild: () => {
@@ -432,7 +488,7 @@ var FormGroupLevelsManager = ({
432
488
  setLevelsLength(level + 1);
433
489
  }
434
490
  }, [levelsLength]);
435
- return /* @__PURE__ */(0, import_jsx_runtime9.jsx)(FormGroupLevelsManagerContext.Provider, {
491
+ return /* @__PURE__ */(0, import_jsx_runtime10.jsx)(FormGroupLevelsManagerContext.Provider, {
436
492
  value: {
437
493
  levelsLength,
438
494
  registerChild
@@ -475,7 +531,7 @@ var FormGroupWrapper = ({
475
531
  gap: "md",
476
532
  width: "100%"
477
533
  };
478
- return /* @__PURE__ */(0, import_jsx_runtime9.jsxs)(import_ui9.Box, {
534
+ return /* @__PURE__ */(0, import_jsx_runtime10.jsxs)(import_ui10.Box, {
479
535
  "aria-level": level,
480
536
  ...boxProps,
481
537
  sx: {
@@ -483,18 +539,18 @@ var FormGroupWrapper = ({
483
539
  marginBottom: "lg",
484
540
  ...boxProps.sx
485
541
  },
486
- children: [title && /* @__PURE__ */(0, import_jsx_runtime9.jsx)(import_ui9.Box, {
542
+ children: [title && /* @__PURE__ */(0, import_jsx_runtime10.jsx)(import_ui10.Box, {
487
543
  sx: {
488
544
  marginBottom: "md"
489
545
  },
490
- children: /* @__PURE__ */(0, import_jsx_runtime9.jsx)(import_ui9.Text, {
546
+ children: /* @__PURE__ */(0, import_jsx_runtime10.jsx)(import_ui10.Text, {
491
547
  sx: {
492
548
  fontSize: "2xl",
493
549
  fontWeight: "bold"
494
550
  },
495
551
  children: title
496
552
  })
497
- }), /* @__PURE__ */(0, import_jsx_runtime9.jsx)(import_ui9.Flex, {
553
+ }), /* @__PURE__ */(0, import_jsx_runtime10.jsx)(import_ui10.Flex, {
498
554
  sx: childrenContainerSx,
499
555
  children
500
556
  })]
@@ -505,15 +561,15 @@ var FormGroup = props => {
505
561
  level
506
562
  } = useFormGroup();
507
563
  const currentLevel = level === void 0 ? 0 : level + 1;
508
- return /* @__PURE__ */(0, import_jsx_runtime9.jsx)(FormGroupContext.Provider, {
564
+ return /* @__PURE__ */(0, import_jsx_runtime10.jsx)(FormGroupContext.Provider, {
509
565
  value: {
510
566
  parentLevel: currentLevel
511
567
  },
512
- children: currentLevel === 0 ? /* @__PURE__ */(0, import_jsx_runtime9.jsx)(FormGroupLevelsManager, {
513
- children: /* @__PURE__ */(0, import_jsx_runtime9.jsx)(FormGroupWrapper, {
568
+ children: currentLevel === 0 ? /* @__PURE__ */(0, import_jsx_runtime10.jsx)(FormGroupLevelsManager, {
569
+ children: /* @__PURE__ */(0, import_jsx_runtime10.jsx)(FormGroupWrapper, {
514
570
  ...props
515
571
  })
516
- }) : /* @__PURE__ */(0, import_jsx_runtime9.jsx)(FormGroupWrapper, {
572
+ }) : /* @__PURE__ */(0, import_jsx_runtime10.jsx)(FormGroupWrapper, {
517
573
  ...props
518
574
  })
519
575
  });
@@ -524,6 +580,7 @@ var FormGroup = props => {
524
580
  FormField,
525
581
  FormFieldCheckbox,
526
582
  FormFieldInput,
583
+ FormFieldPassword,
527
584
  FormFieldRadio,
528
585
  FormFieldSelect,
529
586
  FormFieldTextarea,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ttoss/forms",
3
- "version": "0.17.0",
3
+ "version": "0.17.2",
4
4
  "license": "UNLICENSED",
5
5
  "author": "ttoss",
6
6
  "contributors": [
@@ -12,10 +12,6 @@
12
12
  "dist",
13
13
  "src"
14
14
  ],
15
- "scripts": {
16
- "build": "tsup",
17
- "test": "jest"
18
- },
19
15
  "sideEffects": false,
20
16
  "typings": "dist/index.d.ts",
21
17
  "dependencies": {
@@ -25,13 +21,10 @@
25
21
  "yup": "^1.1.1"
26
22
  },
27
23
  "peerDependencies": {
28
- "@ttoss/ui": "^",
29
- "react": ">=16.8.0"
24
+ "react": ">=16.8.0",
25
+ "@ttoss/ui": "^1.36.2"
30
26
  },
31
27
  "devDependencies": {
32
- "@ttoss/config": "^1.30.0",
33
- "@ttoss/test-utils": "^1.23.0",
34
- "@ttoss/ui": "^1.36.0",
35
28
  "@types/jest": "^29.5.1",
36
29
  "@types/react": "^18.2.5",
37
30
  "jest": "^29.5.0",
@@ -39,10 +32,17 @@
39
32
  "react-hook-form": "^7.43.9",
40
33
  "theme-ui": "^0.15.7",
41
34
  "tsup": "^6.7.0",
42
- "yup": "^1.1.1"
35
+ "yup": "^1.1.1",
36
+ "@ttoss/config": "^1.30.0",
37
+ "@ttoss/test-utils": "^1.23.0",
38
+ "@ttoss/ui": "^1.36.2"
43
39
  },
44
40
  "publishConfig": {
45
41
  "access": "public"
46
42
  },
47
- "gitHead": "2b412ebe0b92fbccb102636f843f84bd7616b43b"
48
- }
43
+ "gitHead": "e2b509ee8717f07f7365191b651dcbb5f080e05a",
44
+ "scripts": {
45
+ "build": "tsup",
46
+ "test": "jest"
47
+ }
48
+ }
@@ -8,6 +8,12 @@ import {
8
8
  type LabelProps,
9
9
  } from '@ttoss/ui';
10
10
 
11
+ export type FormFieldInputProps<TName> = {
12
+ label?: string;
13
+ name: TName;
14
+ } & InputProps &
15
+ Pick<LabelProps, 'tooltip' | 'onTooltipClick'>;
16
+
11
17
  export const FormFieldInput = <
12
18
  TFieldValues extends FieldValues = FieldValues,
13
19
  TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>
@@ -18,11 +24,7 @@ export const FormFieldInput = <
18
24
  onTooltipClick,
19
25
  sx,
20
26
  ...inputProps
21
- }: {
22
- label?: string;
23
- name: TName;
24
- } & InputProps &
25
- Pick<LabelProps, 'tooltip' | 'onTooltipClick'>) => {
27
+ }: FormFieldInputProps<TName>) => {
26
28
  const {
27
29
  field: { onChange, onBlur, value, ref },
28
30
  formState: { errors },