@homefile/components-v2 2.14.9 → 2.14.11
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/components/forms/dynamicForm/fields/NumberField.d.ts +1 -1
- package/dist/components/forms/dynamicForm/fields/NumberField.js +15 -15
- package/dist/components/partner/panel/PartnerCategorySelect.js +53 -1
- package/package.json +1 -1
- package/src/components/forms/dynamicForm/fields/NumberField.tsx +10 -2
- package/src/components/partner/panel/PartnerCategorySelect.tsx +54 -2
|
@@ -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 (
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
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
|
};
|
|
@@ -3,9 +3,61 @@ import { useState } from 'react';
|
|
|
3
3
|
import { t } from 'i18next';
|
|
4
4
|
import { Image, Flex, Menu, Text } from '@chakra-ui/react';
|
|
5
5
|
import { SelectButton, SelectList, SelectItem } from '../..';
|
|
6
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
// categoryItems,
|
|
8
|
+
partnerCategoriesIcons, textOptionVariants, } from '../../../helpers';
|
|
7
9
|
export const PartnerCategorySelect = ({ onClick, width = '10rem', }) => {
|
|
8
10
|
const [category, setCategory] = useState(t('partner.categories.all'));
|
|
11
|
+
const categoryItems = [
|
|
12
|
+
{
|
|
13
|
+
name: t('partner.categories.all'),
|
|
14
|
+
_id: 'all',
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
name: t('partner.categories.insurance'),
|
|
18
|
+
_id: 'insurance',
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
name: t('partner.categories.maintenance'),
|
|
22
|
+
_id: 'maintenance',
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
name: t('partner.categories.warranty'),
|
|
26
|
+
_id: 'warranty',
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
name: t('partner.categories.construction'),
|
|
30
|
+
_id: 'construction',
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
name: t('partner.categories.finance'),
|
|
34
|
+
_id: 'finance',
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
name: t('partner.categories.plumbing'),
|
|
38
|
+
_id: 'plumbing',
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
name: t('partner.categories.electrical'),
|
|
42
|
+
_id: 'electrical',
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
name: t('partner.categories.design'),
|
|
46
|
+
_id: 'design',
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
name: t('partner.categories.organization'),
|
|
50
|
+
_id: 'organization',
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
name: t('partner.categories.misc'),
|
|
54
|
+
_id: 'misc',
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
name: t('partner.categories.other'),
|
|
58
|
+
_id: 'other',
|
|
59
|
+
},
|
|
60
|
+
];
|
|
9
61
|
return (_jsxs(Menu, { children: [_jsx(SelectButton, { variant: "primary", selectedValue: category, width: width }), _jsx(SelectList, { children: categoryItems.map(({ _id, name }) => {
|
|
10
62
|
const handleClick = () => {
|
|
11
63
|
setCategory(name);
|
package/package.json
CHANGED
|
@@ -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 = ({
|
|
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}
|
|
@@ -3,17 +3,69 @@ import { t } from 'i18next'
|
|
|
3
3
|
import { Image, Flex, Menu, Text } from '@chakra-ui/react'
|
|
4
4
|
import { SelectButton, SelectList, SelectItem } from '@/components'
|
|
5
5
|
import {
|
|
6
|
-
categoryItems,
|
|
6
|
+
// categoryItems,
|
|
7
7
|
partnerCategoriesIcons,
|
|
8
8
|
textOptionVariants,
|
|
9
9
|
} from '@/helpers'
|
|
10
|
-
import { PartnerCategorySelectI } from '@/interfaces'
|
|
10
|
+
import { PartnerCategorySelectI, SelectItemI, PartnerCategoryTypes } from '@/interfaces'
|
|
11
11
|
|
|
12
12
|
export const PartnerCategorySelect = ({
|
|
13
13
|
onClick,
|
|
14
14
|
width = '10rem',
|
|
15
15
|
}: PartnerCategorySelectI) => {
|
|
16
16
|
const [category, setCategory] = useState<string>(t('partner.categories.all'))
|
|
17
|
+
|
|
18
|
+
const categoryItems: SelectItemI<PartnerCategoryTypes>[] = [
|
|
19
|
+
{
|
|
20
|
+
name: t('partner.categories.all'),
|
|
21
|
+
_id: 'all',
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
name: t('partner.categories.insurance'),
|
|
25
|
+
_id: 'insurance',
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
name: t('partner.categories.maintenance'),
|
|
29
|
+
_id: 'maintenance',
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
name: t('partner.categories.warranty'),
|
|
33
|
+
_id: 'warranty',
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
name: t('partner.categories.construction'),
|
|
37
|
+
_id: 'construction',
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
name: t('partner.categories.finance'),
|
|
41
|
+
_id: 'finance',
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
name: t('partner.categories.plumbing'),
|
|
45
|
+
_id: 'plumbing',
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
name: t('partner.categories.electrical'),
|
|
49
|
+
_id: 'electrical',
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
name: t('partner.categories.design'),
|
|
53
|
+
_id: 'design',
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
name: t('partner.categories.organization'),
|
|
57
|
+
_id: 'organization',
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
name: t('partner.categories.misc'),
|
|
61
|
+
_id: 'misc',
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
name: t('partner.categories.other'),
|
|
65
|
+
_id: 'other',
|
|
66
|
+
},
|
|
67
|
+
]
|
|
68
|
+
|
|
17
69
|
return (
|
|
18
70
|
<Menu>
|
|
19
71
|
<SelectButton variant="primary" selectedValue={category} width={width} />
|