@homefile/components-v2 2.14.8 → 2.14.10

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,2 +1,2 @@
1
1
  import { TextFieldI } from '../../../../interfaces';
2
- export declare const NumberField: ({ id, label, placeholder, value }: TextFieldI) => import("react/jsx-runtime").JSX.Element;
2
+ export declare const NumberField: ({ description, icon, id, label, placeholder, value, }: TextFieldI) => import("react/jsx-runtime").JSX.Element;
@@ -1,19 +1,19 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { Controller, useFormContext } from 'react-hook-form';
3
3
  import { Flex, Input } from '@chakra-ui/react';
4
- import { LabeledField } from '../../..';
5
- export const NumberField = ({ id, label, placeholder, value }) => {
4
+ import { FieldDescription, LabeledField } from '../../..';
5
+ export const NumberField = ({ description, icon, id, label, placeholder, value, }) => {
6
6
  const { control } = useFormContext();
7
- return (_jsx(Flex, { align: "center", gap: "base", flex: "auto", children: _jsx(Controller, { control: control, name: id, defaultValue: value, render: ({ field: { value, onChange } }) => {
8
- return (_jsx(LabeledField, { label: label, children: _jsx(Input, { onChange: (e) => {
9
- const value = e.target.valueAsNumber;
10
- const isNumber = !isNaN(value);
11
- if (!isNumber) {
12
- onChange('');
13
- }
14
- else {
15
- onChange(value);
16
- }
17
- }, placeholder: placeholder, type: "number", pattern: "[1-9]", value: value, textAlign: "right", _placeholder: { color: 'gray.2' } }) }));
18
- } }) }));
7
+ return (_jsxs(Flex, { align: "center", gap: "base", flex: "auto", children: [_jsx(FieldDescription, { description: description, icon: icon }), _jsx(Controller, { control: control, name: id, defaultValue: value, render: ({ field: { value, onChange } }) => {
8
+ return (_jsx(LabeledField, { label: label, children: _jsx(Input, { onChange: (e) => {
9
+ const value = e.target.valueAsNumber;
10
+ const isNumber = !isNaN(value);
11
+ if (!isNumber) {
12
+ onChange('');
13
+ }
14
+ else {
15
+ onChange(value);
16
+ }
17
+ }, placeholder: placeholder, type: "number", pattern: "[1-9]", value: value, textAlign: "right", _placeholder: { color: 'gray.2' } }) }));
18
+ } })] }));
19
19
  };
@@ -1,2 +1,2 @@
1
1
  import { SelectFieldI } from '../../../../interfaces';
2
- export declare const SelectField: ({ description, id, label, options, placeholder, value, }: SelectFieldI) => import("react/jsx-runtime").JSX.Element;
2
+ export declare const SelectField: ({ description, id, icon, label, options, placeholder, value, }: SelectFieldI) => import("react/jsx-runtime").JSX.Element;
@@ -1,12 +1,12 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { Controller, useFormContext } from 'react-hook-form';
3
3
  import { Box, Flex } from '@chakra-ui/react';
4
- import { SelectInput } from '../../..';
5
- export const SelectField = ({ description, id, label, options, placeholder, value, }) => {
4
+ import { FieldDescription, SelectInput } from '../../..';
5
+ export const SelectField = ({ description, id, icon, label, options, placeholder, value, }) => {
6
6
  var _a;
7
7
  const { control } = useFormContext();
8
8
  const stringOptions = (_a = options === null || options === void 0 ? void 0 : options.map((option) => String(option))) !== null && _a !== void 0 ? _a : [];
9
- return (_jsx(Flex, { align: "start", gap: "base", flex: "auto", w: description ? '100%' : '40%', children: _jsx(Box, { w: description ? '102px' : '100%', children: _jsx(Controller, { control: control, name: id, defaultValue: value, render: ({ field: { value, onChange } }) => {
10
- return (_jsx(SelectInput, { handleClick: onChange, height: "md", initialValue: value !== null && value !== void 0 ? value : stringOptions[0], items: stringOptions, placeholder: !description ? placeholder : '', label: label, width: "100%" }));
11
- } }) }) }));
9
+ return (_jsxs(Flex, { align: "start", gap: "base", flex: "auto", w: description ? '100%' : '40%', children: [_jsx(FieldDescription, { description: description, icon: icon }), _jsx(Box, { w: description ? '102px' : '100%', children: _jsx(Controller, { control: control, name: id, defaultValue: value, render: ({ field: { value, onChange } }) => {
10
+ return (_jsx(SelectInput, { handleClick: onChange, height: "md", initialValue: value !== null && value !== void 0 ? value : stringOptions[0], items: stringOptions, placeholder: !description ? placeholder : '', label: label, width: "100%" }));
11
+ } }) })] }));
12
12
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@homefile/components-v2",
3
- "version": "2.14.8",
3
+ "version": "2.14.10",
4
4
  "author": "Homefile",
5
5
  "license": "UNLICENSED",
6
6
  "typings": "dist/index.d.ts",
@@ -1,12 +1,20 @@
1
1
  import { Controller, useFormContext } from 'react-hook-form'
2
2
  import { Flex, Input } from '@chakra-ui/react'
3
3
  import { TextFieldI } from '@/interfaces'
4
- import { LabeledField } from '@/components'
4
+ import { FieldDescription, LabeledField } from '@/components'
5
5
 
6
- export const NumberField = ({ id, label, placeholder, value }: TextFieldI) => {
6
+ export const NumberField = ({
7
+ description,
8
+ icon,
9
+ id,
10
+ label,
11
+ placeholder,
12
+ value,
13
+ }: TextFieldI) => {
7
14
  const { control } = useFormContext()
8
15
  return (
9
16
  <Flex align="center" gap="base" flex="auto">
17
+ <FieldDescription description={description} icon={icon} />
10
18
  <Controller
11
19
  control={control}
12
20
  name={id}
@@ -1,11 +1,12 @@
1
1
  import { Controller, useFormContext } from 'react-hook-form'
2
2
  import { Box, Flex } from '@chakra-ui/react'
3
- import { SelectInput } from '@/components'
3
+ import { FieldDescription, SelectInput } from '@/components'
4
4
  import { SelectFieldI } from '@/interfaces'
5
5
 
6
6
  export const SelectField = ({
7
7
  description,
8
8
  id,
9
+ icon,
9
10
  label,
10
11
  options,
11
12
  placeholder,
@@ -15,6 +16,7 @@ export const SelectField = ({
15
16
  const stringOptions = options?.map((option) => String(option)) ?? []
16
17
  return (
17
18
  <Flex align="start" gap="base" flex="auto" w={description ? '100%' : '40%'}>
19
+ <FieldDescription description={description} icon={icon} />
18
20
  <Box w={description ? '102px' : '100%'}>
19
21
  <Controller
20
22
  control={control}