@homefile/components-v2 2.24.21 → 2.24.23
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/CurrencyField.js +1 -1
- package/dist/components/forms/dynamicForm/fields/NumberField.js +1 -1
- package/dist/components/forms/dynamicForm/fields/TextField.js +1 -1
- package/dist/components/receipts/AssignableReceiptCard.js +1 -1
- package/dist/hooks/receipts/useDisplayReceipts.d.ts +1 -1
- package/dist/interfaces/receipts/receipt/ReceiptDetails.interface.d.ts +1 -1
- package/dist/stories/receipts/displayReceipts/GridReceipt.stories.d.ts +1 -1
- package/dist/stories/receipts/displayReceipts/ItemReceipt.stories.d.ts +1 -1
- package/dist/stories/receipts/displayReceipts/ListReceipt.stories.d.ts +1 -1
- package/package.json +1 -1
- package/src/components/forms/dynamicForm/fields/CurrencyField.tsx +3 -3
- package/src/components/forms/dynamicForm/fields/NumberField.tsx +1 -1
- package/src/components/forms/dynamicForm/fields/TextField.tsx +1 -1
- package/src/components/receipts/AssignableReceiptCard.tsx +1 -1
- package/src/interfaces/receipts/receipt/ReceiptDetails.interface.ts +1 -1
|
@@ -5,7 +5,7 @@ import { Flex, Input } from '@chakra-ui/react';
|
|
|
5
5
|
import { FormIcon, LabeledField } from '../../..';
|
|
6
6
|
export const CurrencyField = ({ label, id, icon, placeholder, value, }) => {
|
|
7
7
|
const { control } = useFormContext();
|
|
8
|
-
return (_jsxs(Flex, { align: "center", gap: "base", flex: "auto", children: [_jsx(FormIcon, { icon: icon }), _jsx(Controller, { control: control, name: id, defaultValue: value, render: ({ field }) => {
|
|
8
|
+
return (_jsxs(Flex, { align: "center", gap: "base", flex: "auto", w: "full", children: [_jsx(FormIcon, { icon: icon }), _jsx(Controller, { control: control, name: id, defaultValue: value, render: ({ field }) => {
|
|
9
9
|
return (_jsx(LabeledField, { label: label, children: _jsx(NumericFormat, Object.assign({}, field, { customInput: Input, thousandSeparator: true, decimalScale: 2, fixedDecimalScale: true, prefix: "$", placeholder: placeholder, textAlign: "right", _placeholder: { color: 'gray.2' }, onValueChange: ({ floatValue }) => {
|
|
10
10
|
field.onChange(floatValue);
|
|
11
11
|
} })) }));
|
|
@@ -5,7 +5,7 @@ import { FieldDescription, LabeledField } from '../../..';
|
|
|
5
5
|
export const NumberField = ({ description, icon, id, label, placeholder, value, }) => {
|
|
6
6
|
const { control } = useFormContext();
|
|
7
7
|
const hasDescriptionAndIcon = Boolean(description) && Boolean(icon);
|
|
8
|
-
return (_jsxs(Flex, { align: "center", gap: "base", flex: "auto", children: [hasDescriptionAndIcon && (_jsx(FieldDescription, { description: description, icon: icon })), _jsx(Controller, { control: control, name: id, defaultValue: value, render: ({ field: { value, onChange } }) => {
|
|
8
|
+
return (_jsxs(Flex, { align: "center", gap: "base", flex: "auto", w: "full", children: [hasDescriptionAndIcon && (_jsx(FieldDescription, { description: description, icon: icon })), _jsx(Controller, { control: control, name: id, defaultValue: value, render: ({ field: { value, onChange } }) => {
|
|
9
9
|
return (_jsx(LabeledField, { label: label, children: _jsx(Input, { onChange: (e) => {
|
|
10
10
|
const value = e.target.valueAsNumber;
|
|
11
11
|
const isNumber = !isNaN(value);
|
|
@@ -4,7 +4,7 @@ import { Flex } from '@chakra-ui/react';
|
|
|
4
4
|
import { FormIcon, TextInput } from '../../..';
|
|
5
5
|
export const TextField = ({ id, icon, placeholder = '', label, type = 'text', showIcon = false, value, }) => {
|
|
6
6
|
const { control } = useFormContext();
|
|
7
|
-
return (_jsxs(Flex, { align: "center", gap: "base", flex: "auto", children: [showIcon && icon && _jsx(FormIcon, { icon: icon }), _jsx(Controller, { control: control, name: id, defaultValue: value, render: ({ field: { value, onChange } }) => {
|
|
7
|
+
return (_jsxs(Flex, { align: "center", gap: "base", flex: "auto", w: "full", children: [showIcon && icon && _jsx(FormIcon, { icon: icon }), _jsx(Controller, { control: control, name: id, defaultValue: value, render: ({ field: { value, onChange } }) => {
|
|
8
8
|
return (_jsx(TextInput, { handleChange: onChange, placeholder: placeholder, type: type, value: value, label: label }));
|
|
9
9
|
} })] }));
|
|
10
10
|
};
|
|
@@ -6,7 +6,7 @@ import { formatCurrency, formatDateWithAt } from '../../utils';
|
|
|
6
6
|
export const AssignableReceiptCard = ({ isChecked, itemQuantity = 1, onChange, purchaseDate = new Date(), origin = '', total = '0', }) => {
|
|
7
7
|
const date = formatDateWithAt({ date: purchaseDate });
|
|
8
8
|
const totalFormatted = formatCurrency({ value: total });
|
|
9
|
-
const totalItems = itemQuantity > 1
|
|
9
|
+
const totalItems = Number(itemQuantity) > 1
|
|
10
10
|
? `${itemQuantity} ${t('receipts.items')}`
|
|
11
11
|
: `${itemQuantity} ${t('receipts.item')}`;
|
|
12
12
|
return (_jsxs(Flex, { bg: "lightBlue.2", gap: "4", borderTop: "1px solid", borderColor: "lightBlue.2", children: [_jsx(Checkbox, { isChecked: isChecked, onChange: onChange }), _jsx(Stack, { w: "100%", p: "base", bg: isChecked ? 'lightGreen.1' : 'neutral.white', spacing: "1", children: _jsxs(Flex, { align: "center", gap: "base", children: [_jsx(Image, { src: getReceiptOrigin(origin), w: "auto", h: ["40px", "69px"], fit: "contain" }), _jsxs(Stack, { w: "100%", spacing: "1", children: [_jsx(Text, { fontSize: "xxs", children: date }), _jsx(Text, { textTransform: "capitalize", children: `${origin} ${t('receipts.receipt')}` }), _jsxs(Flex, { align: "baseline", justify: "flex-end", gap: "4", children: [_jsx(Text, { fontSize: "xs", fontFamily: "secondary", textTransform: "uppercase", children: totalItems }), _jsx(Text, { children: totalFormatted })] })] })] }) })] }));
|
|
@@ -11,7 +11,7 @@ export declare const useDisplayReceipts: ({ receipts }: UseDisplayReceiptsI) =>
|
|
|
11
11
|
cashier?: string;
|
|
12
12
|
createAt?: Date;
|
|
13
13
|
home?: string | null;
|
|
14
|
-
itemQuantity: number;
|
|
14
|
+
itemQuantity: number | string;
|
|
15
15
|
name?: string;
|
|
16
16
|
paymentMethod: string;
|
|
17
17
|
purchaseDate?: Date;
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Controller, useFormContext } from 'react-hook-form'
|
|
2
|
-
import {NumericFormat} from 'react-number-format'
|
|
2
|
+
import { NumericFormat } from 'react-number-format'
|
|
3
3
|
import { Flex, Input } from '@chakra-ui/react'
|
|
4
4
|
import { TextFieldI } from '@/interfaces'
|
|
5
5
|
import { FormIcon, LabeledField } from '@/components'
|
|
@@ -14,13 +14,13 @@ export const CurrencyField = ({
|
|
|
14
14
|
const { control } = useFormContext()
|
|
15
15
|
|
|
16
16
|
return (
|
|
17
|
-
<Flex align="center" gap="base" flex="auto">
|
|
17
|
+
<Flex align="center" gap="base" flex="auto" w="full">
|
|
18
18
|
<FormIcon icon={icon} />
|
|
19
19
|
<Controller
|
|
20
20
|
control={control}
|
|
21
21
|
name={id}
|
|
22
22
|
defaultValue={value}
|
|
23
|
-
render={({ field}) => {
|
|
23
|
+
render={({ field }) => {
|
|
24
24
|
return (
|
|
25
25
|
<LabeledField label={label}>
|
|
26
26
|
<NumericFormat
|
|
@@ -14,7 +14,7 @@ export const NumberField = ({
|
|
|
14
14
|
const { control } = useFormContext()
|
|
15
15
|
const hasDescriptionAndIcon = Boolean(description) && Boolean(icon)
|
|
16
16
|
return (
|
|
17
|
-
<Flex align="center" gap="base" flex="auto">
|
|
17
|
+
<Flex align="center" gap="base" flex="auto" w="full">
|
|
18
18
|
{hasDescriptionAndIcon && (
|
|
19
19
|
<FieldDescription description={description} icon={icon} />
|
|
20
20
|
)}
|
|
@@ -14,7 +14,7 @@ export const TextField = ({
|
|
|
14
14
|
}: TextFieldI) => {
|
|
15
15
|
const { control } = useFormContext()
|
|
16
16
|
return (
|
|
17
|
-
<Flex align="center" gap="base" flex="auto">
|
|
17
|
+
<Flex align="center" gap="base" flex="auto" w="full">
|
|
18
18
|
{showIcon && icon && <FormIcon icon={icon} />}
|
|
19
19
|
<Controller
|
|
20
20
|
control={control}
|
|
@@ -15,7 +15,7 @@ export const AssignableReceiptCard = ({
|
|
|
15
15
|
const date = formatDateWithAt({ date: purchaseDate })
|
|
16
16
|
const totalFormatted = formatCurrency({ value: total })
|
|
17
17
|
const totalItems =
|
|
18
|
-
itemQuantity > 1
|
|
18
|
+
Number(itemQuantity) > 1
|
|
19
19
|
? `${itemQuantity} ${t('receipts.items')}`
|
|
20
20
|
: `${itemQuantity} ${t('receipts.item')}`
|
|
21
21
|
return (
|