@homefile/components-v2 2.40.10 → 2.40.12
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/folderPanel/fileDetails/FileDetailsTab.js +1 -1
- package/dist/components/forms/AddressStored.js +2 -2
- package/dist/components/forms/EditItemName.js +1 -1
- package/dist/components/forms/dynamicForm/fields/CurrencyField.js +4 -1
- package/dist/components/forms/dynamicForm/fields/DateField.js +6 -2
- package/dist/components/forms/dynamicForm/fields/GridField.js +1 -1
- package/dist/components/forms/dynamicForm/fields/LabeledField.d.ts +2 -1
- package/dist/components/forms/dynamicForm/fields/LabeledField.js +2 -2
- package/dist/components/forms/dynamicForm/fields/NumberField.js +2 -1
- package/dist/components/forms/dynamicForm/fields/SelectField.js +6 -4
- package/dist/components/forms/dynamicForm/fields/TextAreaField.js +4 -1
- package/dist/components/forms/readOnly/ReadOnlyToggle.js +1 -1
- package/dist/components/inputs/SelectInput.d.ts +1 -1
- package/dist/components/inputs/SelectInput.js +5 -2
- package/dist/components/inputs/TextAreaInput.js +4 -1
- package/dist/components/inputs/TextInput.d.ts +1 -1
- package/dist/components/inputs/TextInput.js +5 -2
- package/dist/components/launchpad/IconMenu.d.ts +1 -1
- package/dist/components/launchpad/IconMenu.js +2 -2
- package/dist/components/wizard/WizardStepOptions.js +1 -1
- package/dist/interfaces/inputs/Input.interface.d.ts +1 -0
- package/dist/interfaces/inputs/Select.interface.d.ts +1 -0
- package/dist/interfaces/launchpad/IconMenu.interface.d.ts +1 -0
- package/package.json +1 -1
|
@@ -23,5 +23,5 @@ export const FileDetailsTab = ({ addedBy, handleEdit, file, editing, }) => {
|
|
|
23
23
|
const updateFile = Object.assign(Object.assign({}, file), { title: fileName, description: fileDescription });
|
|
24
24
|
handleEdit(updateFile);
|
|
25
25
|
};
|
|
26
|
-
return editing ? (_jsx(Center, { h: "6rem", children: _jsx(BeatLoader, { color: "gray", size: 6 }) })) : (_jsxs(Stack, { spacing: "base", p: "base", children: [_jsxs(Flex, { gap: "base", align: "
|
|
26
|
+
return editing ? (_jsx(Center, { h: "6rem", children: _jsx(BeatLoader, { color: "gray", size: 6 }) })) : (_jsxs(Stack, { spacing: "base", p: "base", children: [_jsxs(Flex, { gap: "base", align: "flex-end", children: [_jsx(Image, { src: fileTypes[fileExtension] || DocIcon, w: "auto", h: "3rem", alt: t('folderSharing.altIcon') }), _jsx(TextInput, { handleChange: handleChangeName, id: file._id, placeholder: t('folderSharing.details.placeholder'), value: fileName, hasError: !fileName, errorMessage: `${t('folderSharing.details.name')} ${t('forms.required')}` }), fileName && (_jsx(Button, { variant: "tertiary", h: "input.md", onClick: () => fileName && handleEditFile(), children: t('createDocument.buttons.save') }))] }), _jsxs(Box, { children: [formattedUpdateAt && (_jsxs(Flex, { borderY: "1px solid", borderColor: "lightBlue.6", py: "base", px: "2", children: [_jsx(Text, { variant: "info", flex: "0.2", children: t('folderSharing.details.added') }), _jsx(Text, { variant: "info", flex: "0.8", children: formattedUpdateAt === null || formattedUpdateAt === void 0 ? void 0 : formattedUpdateAt.replace(' ', ' @ ') })] })), _jsxs(Flex, { borderBottom: "1px solid", borderColor: "lightBlue.6", py: "base", px: "2", children: [_jsx(Text, { variant: "info", flex: "0.2", children: t('folderSharing.details.addedBy') }), _jsx(Text, { variant: "info", color: "blue.3", flex: "0.8", children: addedBy })] }), _jsxs(Flex, { borderBottom: "1px solid", borderColor: "lightBlue.6", py: "base", pl: "2", align: "flex-end", gap: "base", children: [_jsx(TextInput, { handleChange: handleChangeDescription, id: file._id, placeholder: t('addMedia.description'), value: fileDescription || '' }), fileDescription && (_jsx(Button, { variant: "tertiary", h: "input.md", onClick: () => fileDescription && handleEditFile(), children: t('createDocument.buttons.save') }))] })] })] }));
|
|
27
27
|
};
|
|
@@ -10,9 +10,9 @@ export const AddressStored = ({ proxy = addressProxy, setIsDirty, }) => {
|
|
|
10
10
|
var _a;
|
|
11
11
|
const { fields, validations } = useSnapshot(proxy, { sync: true });
|
|
12
12
|
const { complements, handleAddComplement, handleDeleteComplement, handleErrorMessage, handleInputChange, handleValidation, } = useAddressStored({ proxy, setIsDirty });
|
|
13
|
-
return (_jsxs(Stack, { spacing: "base", children: [_jsxs(InputGroup, { gap: "base", children: [_jsx(Box, { w: "40%", children: _jsx(TextInput, { errorMessage: handleErrorMessage('number'), hasError: !validations.isStreetNumberValid, id: "streetNumber", placeholder: `${t('forms.number')}*`, value: (_a = fields.number) === null || _a === void 0 ? void 0 : _a.toString(), handleChange: (event) => handleInputChange(event, 'number'), onBlurCapture: () => handleValidation('number') }) }), _jsx(TextInput, { errorMessage: handleErrorMessage('street'), hasError: !validations.isStreetValid, id: "street", placeholder: `${t('forms.street')}*`, value: fields.street, handleChange: (event) => handleInputChange(event, 'street'), onBlurCapture: () => handleValidation('street') }), _jsx(IconButton, { "aria-label": "Add new address line", variant: "iconOutlined", icon: _jsx(Plus, { stroke: colors.blue[3], size: 28 }), onClick: handleAddComplement, isDisabled: complements.length === 2,
|
|
13
|
+
return (_jsxs(Stack, { spacing: "base", children: [_jsxs(InputGroup, { gap: "base", alignItems: "flex-end", children: [_jsx(Box, { w: "40%", children: _jsx(TextInput, { errorMessage: handleErrorMessage('number'), hasError: !validations.isStreetNumberValid, id: "streetNumber", placeholder: `${t('forms.number')}*`, value: (_a = fields.number) === null || _a === void 0 ? void 0 : _a.toString(), handleChange: (event) => handleInputChange(event, 'number'), onBlurCapture: () => handleValidation('number') }) }), _jsx(TextInput, { errorMessage: handleErrorMessage('street'), hasError: !validations.isStreetValid, id: "street", placeholder: `${t('forms.street')}*`, value: fields.street, handleChange: (event) => handleInputChange(event, 'street'), onBlurCapture: () => handleValidation('street') }), _jsx(IconButton, { "aria-label": "Add new address line", variant: "iconOutlined", icon: _jsx(Plus, { stroke: colors.blue[3], size: 28 }), onClick: handleAddComplement, isDisabled: complements.length === 2, h: "input.md" })] }), (complements === null || complements === void 0 ? void 0 : complements.length) > 0 &&
|
|
14
14
|
(complements === null || complements === void 0 ? void 0 : complements.map((complement) => {
|
|
15
15
|
var _a;
|
|
16
16
|
return (_jsxs(InputGroup, { gap: "base", children: [_jsx(TextInput, { id: complement, placeholder: t(`forms.${complement}`), value: (_a = fields[complement]) !== null && _a !== void 0 ? _a : '', handleChange: (event) => handleInputChange(event, complement) }), _jsx(Center, { w: "3.5rem", children: _jsx(IconButton, { w: "2rem", h: "2rem", "aria-label": "Delete address line", variant: "iconOutlined", icon: _jsx(Minus, {}), onClick: () => handleDeleteComplement(complement) }) })] }, complement));
|
|
17
|
-
})), _jsxs(InputGroup, { gap: "base", children: [_jsx(TextInput, { errorMessage: handleErrorMessage('zip'), hasError: !validations.isZipValid, id: "zip", placeholder: `${t('forms.zip')}*`, value: fields.zip, handleChange: (event) => handleInputChange(event, 'zip'), onBlurCapture: () => handleValidation('zip') }), _jsx(TextInput, { errorMessage: handleErrorMessage('city'), hasError: !validations.isCityValid, id: "city", placeholder: `${t('forms.city')}*`, value: fields.city, handleChange: (event) => handleInputChange(event, 'city'), isDisabled: !fields.zip, onBlurCapture: () => handleValidation('city') }), _jsx(TextInput, { errorMessage: handleErrorMessage('state'), hasError: !validations.isStateValid, id: "state", placeholder: `${t('forms.state')}*`, value: fields.state, handleChange: (event) => handleInputChange(event, 'state'), isDisabled: !fields.zip, onBlurCapture: () => handleValidation('state') })] })] }));
|
|
17
|
+
})), _jsxs(InputGroup, { gap: "base", alignItems: "flex-end", children: [_jsx(TextInput, { errorMessage: handleErrorMessage('zip'), hasError: !validations.isZipValid, id: "zip", placeholder: `${t('forms.zip')}*`, value: fields.zip, handleChange: (event) => handleInputChange(event, 'zip'), onBlurCapture: () => handleValidation('zip') }), _jsx(TextInput, { errorMessage: handleErrorMessage('city'), hasError: !validations.isCityValid, id: "city", placeholder: `${t('forms.city')}*`, value: fields.city, handleChange: (event) => handleInputChange(event, 'city'), isDisabled: !fields.zip, onBlurCapture: () => handleValidation('city') }), _jsx(TextInput, { errorMessage: handleErrorMessage('state'), hasError: !validations.isStateValid, id: "state", placeholder: `${t('forms.state')}*`, value: fields.state, handleChange: (event) => handleInputChange(event, 'state'), isDisabled: !fields.zip, onBlurCapture: () => handleValidation('state') })] })] }));
|
|
18
18
|
};
|
|
@@ -4,5 +4,5 @@ import { Box, Button, Flex } from '@chakra-ui/react';
|
|
|
4
4
|
import { TextInput } from '../../components';
|
|
5
5
|
export const EditItemName = ({ errorMessage, placeholder, isDisabled = false, isRequired = true, loading, onChange, onSave, showSaveButton = false, value, }) => {
|
|
6
6
|
const showButton = value || showSaveButton;
|
|
7
|
-
return (_jsx(Box, { w: "100%", children: _jsxs(Flex, { gap: "base", children: [_jsx(TextInput, { maxLength: 45, handleChange: onChange, id: "folder-name", placeholder: placeholder, value: value, isDisabled: isDisabled, hasError: isRequired && !value, errorMessage: errorMessage }), showButton && (_jsx(Button, { variant: "secondary", maxW: "fit-content", maxH: "input.md", onClick: onSave, isLoading: loading, children: t('createDocument.buttons.save') }))] }) }));
|
|
7
|
+
return (_jsx(Box, { w: "100%", children: _jsxs(Flex, { gap: "base", children: [_jsx(TextInput, { maxLength: 45, handleChange: onChange, id: "folder-name", placeholder: placeholder, value: value, isDisabled: isDisabled, hasError: isRequired && !value, errorMessage: errorMessage, showLabel: false }), showButton && (_jsx(Button, { variant: "secondary", maxW: "fit-content", maxH: "input.md", onClick: onSave, isLoading: loading, children: t('createDocument.buttons.save') }))] }) }));
|
|
8
8
|
};
|
|
@@ -4,9 +4,12 @@ import { NumericFormat } from 'react-number-format';
|
|
|
4
4
|
import { Flex, Input } from '@chakra-ui/react';
|
|
5
5
|
import { FormIcon, LabeledField } from '../../../../components';
|
|
6
6
|
export const CurrencyField = ({ label, id, icon, placeholder, value, }) => {
|
|
7
|
+
var _a;
|
|
7
8
|
const { control } = useFormContext();
|
|
9
|
+
const isFilled = String(value).trim().length > 0;
|
|
10
|
+
const placeholderToUse = isFilled ? '' : (_a = placeholder !== null && placeholder !== void 0 ? placeholder : label) !== null && _a !== void 0 ? _a : '';
|
|
8
11
|
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
|
-
return (_jsx(LabeledField, { label: label, children: _jsx(NumericFormat, Object.assign({}, field, { customInput: Input, thousandSeparator: true, decimalScale: 2, fixedDecimalScale: true, prefix: "$", placeholder:
|
|
12
|
+
return (_jsx(LabeledField, { label: label !== null && label !== void 0 ? label : placeholder, isFilled: isFilled, children: _jsx(NumericFormat, Object.assign({}, field, { customInput: Input, thousandSeparator: true, decimalScale: 2, fixedDecimalScale: true, prefix: "$", placeholder: placeholderToUse, textAlign: "right", _placeholder: { color: 'gray.2' }, onValueChange: ({ floatValue }) => {
|
|
10
13
|
field.onChange(floatValue);
|
|
11
14
|
} })) }));
|
|
12
15
|
} })] }));
|
|
@@ -1,10 +1,14 @@
|
|
|
1
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, Text } from '@chakra-ui/react';
|
|
4
|
-
import { DatePicker, FormIcon } from '../../../../components';
|
|
4
|
+
import { DatePicker, FormIcon, LabeledField } from '../../../../components';
|
|
5
5
|
export const DateField = ({ id, icon, name, placeholder, label, showCalendarIcon = true, value, width, }) => {
|
|
6
|
+
var _a;
|
|
6
7
|
const { control } = useFormContext();
|
|
8
|
+
const isFilled = String(value).trim().length > 0;
|
|
9
|
+
const placeholderToUse = isFilled ? '' : (_a = placeholder !== null && placeholder !== void 0 ? placeholder : label) !== null && _a !== void 0 ? _a : '';
|
|
7
10
|
return (_jsxs(Flex, { align: "center", gap: "base", w: "full", children: [name && (_jsxs(Flex, { align: "center", gap: "base", flexShrink: 0, children: [_jsx(FormIcon, { icon: icon }), _jsx(Text, { fontFamily: "secondary", noOfLines: 1, overflow: "hidden", children: name })] })), _jsx(Controller, { control: control, name: id, defaultValue: value, render: ({ field: { value, onChange } }) => {
|
|
8
|
-
|
|
11
|
+
const isFilled = String(value).trim().length > 0 && !name;
|
|
12
|
+
return (_jsx(LabeledField, { label: label !== null && label !== void 0 ? label : placeholder, isFilled: isFilled, children: _jsx(DatePicker, { onChange: onChange, showCalendarIcon: showCalendarIcon, placeholder: name ? '' : placeholderToUse, value: value, width: width, label: label }) }));
|
|
9
13
|
} })] }));
|
|
10
14
|
};
|
|
@@ -4,7 +4,7 @@ import { Flex } from '@chakra-ui/react';
|
|
|
4
4
|
import { DateField, NumberField, TextField, SelectField, CurrencyField, SingleImage, } from '../../../../components';
|
|
5
5
|
import { fieldIcons } from '../../../../helpers';
|
|
6
6
|
export const GridField = ({ children, onRemove, onUpload, showIcon, }) => {
|
|
7
|
-
return (_jsx(Flex, { align: "
|
|
7
|
+
return (_jsx(Flex, { align: "flex-end", gap: "base", flex: "1", children: children === null || children === void 0 ? void 0 : children.map(({ id, description, label, name, value, type, options = [], icon }) => {
|
|
8
8
|
const baseProps = {
|
|
9
9
|
id,
|
|
10
10
|
value,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
interface LabeledFieldProps {
|
|
2
2
|
children: React.ReactNode;
|
|
3
3
|
label?: string;
|
|
4
|
+
isFilled?: boolean;
|
|
4
5
|
}
|
|
5
|
-
export declare const LabeledField: ({ label, children }: LabeledFieldProps) => import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export declare const LabeledField: ({ label, isFilled, children, }: LabeledFieldProps) => import("react/jsx-runtime").JSX.Element;
|
|
6
7
|
export {};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Box, Text, Flex } from '@chakra-ui/react';
|
|
3
|
-
export const LabeledField = ({ label, children }) => {
|
|
3
|
+
export const LabeledField = ({ label, isFilled = false, children, }) => {
|
|
4
4
|
if (!label) {
|
|
5
5
|
return _jsx(_Fragment, { children: children });
|
|
6
6
|
}
|
|
7
|
-
return (_jsxs(Box, { w: "100%", children: [_jsx(Flex, { gap: "1", align: "start", children: _jsx(Text, { fontSize: "xs", fontFamily: "secondary", mb: "
|
|
7
|
+
return (_jsxs(Box, { w: "100%", children: [isFilled && (_jsx(Flex, { gap: "1", align: "start", children: _jsx(Text, { fontSize: "xs", fontFamily: "secondary", color: "gray.2", mb: "0.5", children: label }) })), children] }));
|
|
8
8
|
};
|
|
@@ -6,7 +6,8 @@ export const NumberField = ({ description, icon, id, label, placeholder, value,
|
|
|
6
6
|
const { control } = useFormContext();
|
|
7
7
|
const hasDescriptionAndIcon = Boolean(description) && Boolean(icon);
|
|
8
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
|
+
const isFilled = String(value).trim().length > 0;
|
|
10
|
+
return (_jsx(LabeledField, { label: label !== null && label !== void 0 ? label : placeholder, isFilled: isFilled, children: _jsx(Input, { onChange: (e) => {
|
|
10
11
|
const value = e.target.valueAsNumber;
|
|
11
12
|
const isNumber = !isNaN(value);
|
|
12
13
|
if (!isNumber) {
|
|
@@ -1,12 +1,14 @@
|
|
|
1
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 { FieldDescription, SelectInput } from '../../../../components';
|
|
4
|
+
import { FieldDescription, LabeledField, SelectInput } from '../../../../components';
|
|
5
5
|
export const SelectField = ({ description, id, icon, label, options, placeholder, value, }) => {
|
|
6
|
-
var _a;
|
|
6
|
+
var _a, _b;
|
|
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
|
-
|
|
10
|
-
|
|
9
|
+
const isFilled = String(value).trim().length > 0;
|
|
10
|
+
const placeholderToUse = isFilled ? '' : (_b = placeholder !== null && placeholder !== void 0 ? placeholder : label) !== null && _b !== void 0 ? _b : '';
|
|
11
|
+
return (_jsxs(Flex, { align: "center", 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 } }) => {
|
|
12
|
+
return (_jsx(LabeledField, { label: label !== null && label !== void 0 ? label : placeholder, isFilled: String(value).trim().length > 0, children: _jsx(SelectInput, { handleClick: onChange, height: "md", initialValue: value !== null && value !== void 0 ? value : stringOptions[0], items: stringOptions, placeholder: !description ? placeholderToUse : '', label: label, width: "100%" }) }));
|
|
11
13
|
} }) })] }));
|
|
12
14
|
};
|
|
@@ -6,9 +6,12 @@ import 'react-quill-new/dist/quill.snow.css';
|
|
|
6
6
|
import '../../../../styles';
|
|
7
7
|
import { LabeledField } from './LabeledField';
|
|
8
8
|
export const TextAreaField = ({ id, label, placeholder = '', value, }) => {
|
|
9
|
+
var _a;
|
|
9
10
|
const { control } = useFormContext();
|
|
11
|
+
const isFilled = String(value).trim().length > 0;
|
|
12
|
+
const placeholderToUse = isFilled ? '' : (_a = placeholder !== null && placeholder !== void 0 ? placeholder : label) !== null && _a !== void 0 ? _a : '';
|
|
10
13
|
return (_jsx(Flex, { gap: "base", align: "start", flex: "auto", children: _jsx(Controller, { control: control, name: id, defaultValue: value, render: ({ field: { value, onChange } }) => {
|
|
11
|
-
return (_jsx(LabeledField, { label: label, children: _jsx(QuillEditor, { theme: "snow", value: value, formats: formats, modules: { toolbar }, onChange: onChange, placeholder:
|
|
14
|
+
return (_jsx(LabeledField, { label: label !== null && label !== void 0 ? label : placeholder, isFilled: isFilled, children: _jsx(QuillEditor, { theme: "snow", value: value, formats: formats, modules: { toolbar }, onChange: onChange, placeholder: placeholderToUse }) }));
|
|
12
15
|
} }) }));
|
|
13
16
|
};
|
|
14
17
|
const formats = [
|
|
@@ -5,5 +5,5 @@ import { Edit, IconMenu, MoreHorizontal, TextInput } from '../../../components';
|
|
|
5
5
|
import { colors } from '../../../theme/colors';
|
|
6
6
|
export const ReadOnlyToggle = ({ canEdit = false, isInputDisabled = true, menuItems = [], onChange = () => { }, onEdit = () => { }, value, }) => {
|
|
7
7
|
const hasMenuItems = (menuItems === null || menuItems === void 0 ? void 0 : menuItems.length) > 0;
|
|
8
|
-
return (_jsxs(Flex, { gap: "base", p: "base", align: "stretch", bg: "lightBlue.2", children: [_jsx(TextInput, { handleChange: onChange, placeholder: t('dynamicForm.item'), value: value, isDisabled: isInputDisabled }), canEdit && (_jsx(Tooltip, { label: t('tooltips.editValue'), children: _jsx(IconButton, { "aria-label": "Edit icon", variant: "iconOutlined", icon: _jsx(Edit, { size: 16, stroke: colors.blue[3] }),
|
|
8
|
+
return (_jsxs(Flex, { gap: "base", p: "base", align: "stretch", bg: "lightBlue.2", children: [_jsx(TextInput, { handleChange: onChange, placeholder: t('dynamicForm.item'), value: value, isDisabled: isInputDisabled, showLabel: false }), canEdit && (_jsx(Tooltip, { label: t('tooltips.editValue'), children: _jsx(IconButton, { "aria-label": "Edit icon", variant: "iconOutlined", icon: _jsx(Edit, { size: 16, stroke: colors.blue[3] }), h: "input.md", flexShrink: 0, onClick: onEdit }) })), hasMenuItems && (_jsx(IconMenu, { icon: _jsx(MoreHorizontal, { size: 28 }), menuItems: menuItems, variant: "iconOutlined", width: "64px", buttonHeight: "input.md" }))] }));
|
|
9
9
|
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { SelectI } from '../../interfaces';
|
|
2
|
-
export declare const SelectInput: ({ filterValue, handleClick, handleFilter, hasFilter, height, initialValue, isDisabled, items, label, variant, width, }: SelectI) => import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export declare const SelectInput: ({ filterValue, handleClick, handleFilter, hasFilter, height, initialValue, isDisabled, items, label, variant, placeholder, width, emptyValues, }: SelectI) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -5,12 +5,15 @@ import { Menu, Text, Input, InputGroup, InputRightElement, Box, } from '@chakra-
|
|
|
5
5
|
import { textOptionVariants } from '../../helpers';
|
|
6
6
|
import { LabeledField, SearchIcon, SelectButton, SelectItem, SelectList, } from '../../components';
|
|
7
7
|
import { colors } from '../../theme/colors';
|
|
8
|
-
export const SelectInput = ({ filterValue = '', handleClick, handleFilter = () => null, hasFilter, height = 'sm', initialValue = 'All', isDisabled, items, label, variant = 'primary', width = '10rem', }) => {
|
|
8
|
+
export const SelectInput = ({ filterValue = '', handleClick, handleFilter = () => null, hasFilter, height = 'sm', initialValue = 'All', isDisabled, items, label, variant = 'primary', placeholder, width = '10rem', emptyValues = ['', 'All'], }) => {
|
|
9
|
+
var _a;
|
|
9
10
|
const [selectedValue, setSelectedValue] = useState(initialValue);
|
|
10
11
|
useEffect(() => {
|
|
11
12
|
setSelectedValue(initialValue);
|
|
12
13
|
}, [initialValue]);
|
|
13
|
-
|
|
14
|
+
const isFilled = ![...emptyValues, initialValue].includes(String(selectedValue));
|
|
15
|
+
const displayLabel = isFilled ? '' : (_a = placeholder !== null && placeholder !== void 0 ? placeholder : label) !== null && _a !== void 0 ? _a : initialValue;
|
|
16
|
+
return (_jsxs(Menu, { children: [_jsx(LabeledField, { label: displayLabel, isFilled: isFilled, children: _jsx(Box, { w: "100%", children: _jsx(SelectButton, { selectedValue: selectedValue, height: height, isDisabled: isDisabled, variant: variant, width: width }) }) }), _jsxs(SelectList, { children: [hasFilter && (_jsxs(InputGroup, { size: "md", w: "100%", px: "2", pb: "2", children: [_jsx(Input, { variant: "filled", bg: "lightBlue.2", pr: "4.5rem", placeholder: t('forms.search'), value: String(filterValue), onChange: handleFilter }), _jsx(InputRightElement, { mr: "base", children: _jsx(SearchIcon, { size: 26, stroke: colors.gray[3] }) })] })), items === null || items === void 0 ? void 0 : items.map((item) => {
|
|
14
17
|
const isSelectItem = typeof item === 'object';
|
|
15
18
|
const id = isSelectItem ? item._id : item;
|
|
16
19
|
const name = isSelectItem ? item.name : item;
|
|
@@ -11,8 +11,11 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
11
11
|
};
|
|
12
12
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
13
|
import { FormControl, Text, Textarea } from '@chakra-ui/react';
|
|
14
|
+
import { LabeledField } from '../../components';
|
|
14
15
|
export const TextAreaInput = (_a) => {
|
|
15
16
|
var { errorMessage } = _a, props = __rest(_a, ["errorMessage"]);
|
|
16
17
|
const hasError = Boolean(errorMessage);
|
|
17
|
-
|
|
18
|
+
const isFilled = String(props.value).trim().length > 0;
|
|
19
|
+
const { placeholder } = props;
|
|
20
|
+
return (_jsxs(FormControl, { isInvalid: hasError, children: [_jsx(LabeledField, { label: placeholder, isFilled: isFilled, children: _jsx(Textarea, Object.assign({}, props, { bg: "neutral.white" })) }), hasError && _jsx(Text, { variant: "error", children: errorMessage })] }));
|
|
18
21
|
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { InputI } from '../../interfaces';
|
|
2
|
-
export declare const TextInput: ({ autoCapitalize, autoCorrect, errorMessage, handleChange, hasError, id, isDisabled, label, placeholder, value, type, ...props }: InputI) => import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export declare const TextInput: ({ autoCapitalize, autoCorrect, errorMessage, handleChange, hasError, id, isDisabled, label, placeholder, value, type, showLabel, ...props }: InputI) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -13,7 +13,10 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
13
13
|
import { FormControl, Text, Input } from '@chakra-ui/react';
|
|
14
14
|
import { LabeledField } from '../../components';
|
|
15
15
|
export const TextInput = (_a) => {
|
|
16
|
-
var
|
|
16
|
+
var _b;
|
|
17
|
+
var { autoCapitalize = 'on', autoCorrect = 'on', errorMessage, handleChange, hasError, id, isDisabled, label, placeholder, value = '', type = 'text', showLabel = true } = _a, props = __rest(_a, ["autoCapitalize", "autoCorrect", "errorMessage", "handleChange", "hasError", "id", "isDisabled", "label", "placeholder", "value", "type", "showLabel"]);
|
|
17
18
|
const error = hasError && !isDisabled;
|
|
18
|
-
|
|
19
|
+
const isFilled = String(value).trim().length > 0 && showLabel;
|
|
20
|
+
const placeholderToUse = isFilled ? '' : (_b = placeholder !== null && placeholder !== void 0 ? placeholder : label) !== null && _b !== void 0 ? _b : '';
|
|
21
|
+
return (_jsxs(FormControl, { isInvalid: error, children: [_jsx(LabeledField, { label: label !== null && label !== void 0 ? label : placeholder, isFilled: isFilled, children: _jsx(Input, Object.assign({}, props, { autoCapitalize: autoCapitalize, autoCorrect: autoCorrect, id: id, placeholder: placeholderToUse, value: value, type: type, onChange: handleChange, isInvalid: error, isDisabled: isDisabled, _placeholder: { color: 'gray.2' } })) }), error && _jsx(Text, { variant: "error", children: errorMessage })] }));
|
|
19
22
|
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { IconMenuI } from '../../interfaces';
|
|
2
|
-
export declare const IconMenu: ({ disabled, icon, itemForm, menuItems, onClick, variant, width, zIndex, placement, }: IconMenuI) => import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export declare const IconMenu: ({ disabled, icon, itemForm, menuItems, onClick, variant, width, zIndex, placement, buttonHeight, }: IconMenuI) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { MenuButton, IconButton, Menu, MenuItem, MenuList, Box, } from '@chakra-ui/react';
|
|
3
3
|
import { ChevronDown, Overlay } from '../../components';
|
|
4
|
-
export const IconMenu = ({ disabled = false, icon = _jsx(ChevronDown, {}), itemForm, menuItems, onClick, variant = 'menuIcon', width = 'fit-content', zIndex = '999', placement = 'bottom', }) => {
|
|
5
|
-
return (_jsx(Box, { zIndex: zIndex, children: _jsx(Menu, { isLazy: true, placement: placement, children: ({ isOpen }) => (_jsxs(_Fragment, { children: [_jsx(Overlay, { bg: "overlay", showOverlay: isOpen, position: "fixed" }), _jsx(MenuButton, { as: IconButton, "aria-label": "Options", icon: _jsx(Box, { children: icon }), variant: variant, w: width, disabled: disabled, marginTop: "0 !important", onClick: onClick, "data-testid": "icon-menu" }), _jsx(MenuList, { zIndex: "5", children: menuItems === null || menuItems === void 0 ? void 0 : menuItems.map(({ handleClick, label }) => (_jsx(MenuItem, { "data-testid": label, onClick: (e) => {
|
|
4
|
+
export const IconMenu = ({ disabled = false, icon = _jsx(ChevronDown, {}), itemForm, menuItems, onClick, variant = 'menuIcon', width = 'fit-content', zIndex = '999', placement = 'bottom', buttonHeight, }) => {
|
|
5
|
+
return (_jsx(Box, { zIndex: zIndex, children: _jsx(Menu, { isLazy: true, placement: placement, children: ({ isOpen }) => (_jsxs(_Fragment, { children: [_jsx(Overlay, { bg: "overlay", showOverlay: isOpen, position: "fixed" }), _jsx(MenuButton, { as: IconButton, "aria-label": "Options", icon: _jsx(Box, { children: icon }), variant: variant, w: width, disabled: disabled, marginTop: "0 !important", onClick: onClick, "data-testid": "icon-menu", h: buttonHeight }), _jsx(MenuList, { zIndex: "5", children: menuItems === null || menuItems === void 0 ? void 0 : menuItems.map(({ handleClick, label }) => (_jsx(MenuItem, { "data-testid": label, onClick: (e) => {
|
|
6
6
|
e.stopPropagation();
|
|
7
7
|
handleClick(itemForm);
|
|
8
8
|
}, _hover: {
|
|
@@ -15,7 +15,7 @@ export const WizardStepOptions = ({ form, title, callback, style = 'wizard', })
|
|
|
15
15
|
return (_jsxs(Container, { position: "relative", children: [value && (_jsx(Image, { src: CheckInCircle, alt: "check", w: "22px", h: "auto", position: "absolute", top: "-4px", left: "-2px", boxShadow: "lg", borderRadius: "full" })), _jsxs(Stack, Object.assign({ as: "button", py: "base", w: "full", h: "full", onClick: () => {
|
|
16
16
|
onChange(!value);
|
|
17
17
|
callback === null || callback === void 0 ? void 0 : callback(Object.assign(Object.assign({}, field), { value: !value }));
|
|
18
|
-
} }, setOptionButtonStyles(value), { children: [_jsx(Center, { h: "60%", children: _jsx(Image, { src: iconSrc, alt: "icon", w: "auto", maxW: "36px", h: "28px" }) }), _jsx(Center, { h: "40%", px: "1", children: _jsx(Text, { fontSize: "11px", textTransform: "uppercase", textAlign: "center", lineHeight: "11px", children: label }) })] }))] }));
|
|
18
|
+
} }, setOptionButtonStyles(value), { children: [_jsx(Center, { h: "60%", w: '100%', children: _jsx(Image, { src: iconSrc, alt: "icon", w: "auto", maxW: "36px", h: "28px" }) }), _jsx(Center, { h: "40%", px: "1", w: '100%', children: _jsx(Text, { fontSize: "11px", textTransform: "uppercase", textAlign: "center", lineHeight: "11px", children: label }) })] }))] }));
|
|
19
19
|
} }, id));
|
|
20
20
|
}) })] }));
|
|
21
21
|
};
|