@homefile/components-v2 2.8.19 → 2.8.21
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/contacts/ContactCardAddress.js +1 -1
- package/dist/components/contacts/ContactCardHeader.js +1 -1
- package/dist/components/forms/dynamicForm/ItemFormPanel/ItemFormPanel.d.ts +1 -1
- package/dist/components/forms/dynamicForm/ItemFormPanel/ItemFormPanel.js +12 -3
- package/dist/interfaces/forms/ItemFormPanel/ItemFormPanel.interface.d.ts +0 -2
- package/dist/stories/forms/ItemFormPanel/ItemFormPanel.stories.js +3 -3
- package/package.json +1 -1
- package/src/components/contacts/ContactCardAddress.tsx +1 -1
- package/src/components/contacts/ContactCardHeader.tsx +2 -2
- package/src/components/forms/dynamicForm/ItemFormPanel/ItemFormPanel.tsx +14 -10
- package/src/interfaces/forms/ItemFormPanel/ItemFormPanel.interface.ts +0 -2
- package/src/stories/forms/ItemFormPanel/ItemFormPanel.stories.tsx +10 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Stack, Text } from '@chakra-ui/react';
|
|
3
3
|
export const ContactCardAddress = ({ address, city, company, state, zip, }) => {
|
|
4
|
-
return (_jsxs(Stack, { spacing: "-1", minH: "full", children: [_jsx(Text, { variant: "address", children: company.toUpperCase() }), _jsx(Text, { variant: "address", children: address }), _jsxs(Text, { variant: "address", children: [city, ", ", state, " ", zip] })] }));
|
|
4
|
+
return (_jsxs(Stack, { spacing: "-1", minH: "full", children: [_jsx(Text, { variant: "address", children: company === null || company === void 0 ? void 0 : company.toUpperCase() }), _jsx(Text, { variant: "address", children: address }), _jsxs(Text, { variant: "address", children: [city, ", ", state, " ", zip] })] }));
|
|
5
5
|
};
|
|
@@ -6,5 +6,5 @@ import { IconMenu, MoreHorizontal } from '..';
|
|
|
6
6
|
export const ContactCardHeader = ({ contact, menuItems = [], }) => {
|
|
7
7
|
var _a;
|
|
8
8
|
const { category, title } = contact;
|
|
9
|
-
return (_jsxs(Flex, { align: "center", justify: "space-between", children: [_jsxs(Flex, { align: "center", gap: "base", children: [_jsx(Image, { src: Contacts, boxSize: "1rem", "aria-label": (_a = t('ariaLabels.contact')) !== null && _a !== void 0 ? _a : ' ' }), _jsxs(Flex, { align: "center", gap: "base", children: [_jsx(Text, { fontSize: "xs", children: category.toUpperCase() }), title && (_jsx(Text, { fontSize: "xs", color: "gray.4", children: "|" })), _jsx(Text, { fontSize: "xs", children: title.toUpperCase() })] })] }), !!menuItems.length && (_jsx(IconMenu, { icon: _jsx(MoreHorizontal, { size: 32 }), itemForm: contact, menuItems: menuItems, disabled: menuItems.length < 1 }))] }));
|
|
9
|
+
return (_jsxs(Flex, { align: "center", justify: "space-between", children: [_jsxs(Flex, { align: "center", gap: "base", children: [_jsx(Image, { src: Contacts, boxSize: "1rem", "aria-label": (_a = t('ariaLabels.contact')) !== null && _a !== void 0 ? _a : ' ' }), _jsxs(Flex, { align: "center", gap: "base", children: [_jsx(Text, { fontSize: "xs", children: category === null || category === void 0 ? void 0 : category.toUpperCase() }), title && (_jsx(Text, { fontSize: "xs", color: "gray.4", children: "|" })), _jsx(Text, { fontSize: "xs", children: title === null || title === void 0 ? void 0 : title.toUpperCase() })] })] }), !!menuItems.length && (_jsx(IconMenu, { icon: _jsx(MoreHorizontal, { size: 32 }), itemForm: contact, menuItems: menuItems, disabled: menuItems.length < 1 }))] }));
|
|
10
10
|
};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { PropsWithChildren } from 'react';
|
|
2
2
|
import { ItemFormPanelI } from '../../../../interfaces';
|
|
3
|
-
export declare const ItemFormPanel: ({ children,
|
|
3
|
+
export declare const ItemFormPanel: ({ children, onClose, onSubmitForm, panelIcon, panelTitle, showOverlay, }: PropsWithChildren<ItemFormPanelI>) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { DrawerBody, DrawerHeader, DrawerContent, DrawerFooter, Box, } from '@chakra-ui/react';
|
|
3
|
-
import { PanelHeader, FooterDrawer,
|
|
4
|
-
export const ItemFormPanel = ({ children,
|
|
5
|
-
|
|
3
|
+
import { PanelHeader, FooterDrawer, ItemFormFooter, Overlay, } from '../../..';
|
|
4
|
+
export const ItemFormPanel = ({ children, onClose, onSubmitForm, panelIcon, panelTitle, showOverlay = false, }) => {
|
|
5
|
+
let firstChild = null;
|
|
6
|
+
let otherChildren = children;
|
|
7
|
+
if (Array.isArray(children) && children.length > 0) {
|
|
8
|
+
const header = children[0];
|
|
9
|
+
if (header.props.id === 'item-name-header') {
|
|
10
|
+
firstChild = header;
|
|
11
|
+
otherChildren = children.slice(1);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
return (_jsxs(DrawerContent, { bg: "lightBlue.1", children: [_jsx(DrawerHeader, { p: "0", children: _jsx(PanelHeader, { handleCloseButton: onClose, icon: panelIcon, title: panelTitle }) }), _jsxs(DrawerBody, { p: "0", overflowX: "hidden", bg: "lightBlue.1", children: [firstChild, _jsxs(Box, { position: "relative", mb: "200px", children: [_jsx(Overlay, { showOverlay: showOverlay, position: "absolute", w: "inherit", h: "inherit", zIndex: "9" }), otherChildren] })] }), _jsx(FooterDrawer, { isOpen: !showOverlay, children: _jsx(DrawerFooter, { w: "100%", py: "0", children: _jsx(ItemFormFooter, { onSave: onSubmitForm, onCancel: onClose }) }) })] }));
|
|
6
15
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { ItemFormPanel, ItemFormTabs, RightPanel } from '../../../components';
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { ItemFormPanel, ItemFormTabs, ItemNameHeader, RightPanel, } from '../../../components';
|
|
3
3
|
import { Paint } from '../../../assets/images/groups';
|
|
4
4
|
import { action } from '@storybook/addon-actions';
|
|
5
5
|
import { contactFieldsMock } from '../../../mocks';
|
|
@@ -16,5 +16,5 @@ export default {
|
|
|
16
16
|
},
|
|
17
17
|
};
|
|
18
18
|
export const ItemFormPanelComponent = (args) => {
|
|
19
|
-
return (_jsx(RightPanel, { isOpen: true, onClose: () => null, children:
|
|
19
|
+
return (_jsx(RightPanel, { isOpen: true, onClose: () => null, children: _jsxs(ItemFormPanel, Object.assign({}, args, { children: [_jsx(ItemNameHeader, { id: "item-name-header", onSave: action('onSaveItemName') }), _jsx(ItemFormTabs, { form: contactFieldsMock })] })) }));
|
|
20
20
|
};
|
package/package.json
CHANGED
|
@@ -10,7 +10,7 @@ export const ContactCardAddress = ({
|
|
|
10
10
|
}: ContactCardAddressI) => {
|
|
11
11
|
return (
|
|
12
12
|
<Stack spacing="-1" minH="full">
|
|
13
|
-
<Text variant="address">{company
|
|
13
|
+
<Text variant="address">{company?.toUpperCase()}</Text>
|
|
14
14
|
<Text variant="address">{address}</Text>
|
|
15
15
|
<Text variant="address">
|
|
16
16
|
{city}, {state} {zip}
|
|
@@ -18,13 +18,13 @@ export const ContactCardHeader = ({
|
|
|
18
18
|
aria-label={t('ariaLabels.contact') ?? ' '}
|
|
19
19
|
/>
|
|
20
20
|
<Flex align="center" gap="base">
|
|
21
|
-
<Text fontSize="xs">{category
|
|
21
|
+
<Text fontSize="xs">{category?.toUpperCase()}</Text>
|
|
22
22
|
{title && (
|
|
23
23
|
<Text fontSize="xs" color="gray.4">
|
|
24
24
|
|
|
|
25
25
|
</Text>
|
|
26
26
|
)}
|
|
27
|
-
<Text fontSize="xs">{title
|
|
27
|
+
<Text fontSize="xs">{title?.toUpperCase()}</Text>
|
|
28
28
|
</Flex>
|
|
29
29
|
</Flex>
|
|
30
30
|
{!!menuItems.length && (
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PropsWithChildren } from 'react'
|
|
1
|
+
import { PropsWithChildren, ReactNode } from 'react'
|
|
2
2
|
import {
|
|
3
3
|
DrawerBody,
|
|
4
4
|
DrawerHeader,
|
|
@@ -9,7 +9,6 @@ import {
|
|
|
9
9
|
import {
|
|
10
10
|
PanelHeader,
|
|
11
11
|
FooterDrawer,
|
|
12
|
-
ItemNameHeader,
|
|
13
12
|
ItemFormFooter,
|
|
14
13
|
Overlay,
|
|
15
14
|
} from '@/components'
|
|
@@ -17,14 +16,23 @@ import { ItemFormPanelI } from '@/interfaces'
|
|
|
17
16
|
|
|
18
17
|
export const ItemFormPanel = ({
|
|
19
18
|
children,
|
|
20
|
-
itemName,
|
|
21
19
|
onClose,
|
|
22
|
-
onSaveItemName,
|
|
23
20
|
onSubmitForm,
|
|
24
21
|
panelIcon,
|
|
25
22
|
panelTitle,
|
|
26
23
|
showOverlay = false,
|
|
27
24
|
}: PropsWithChildren<ItemFormPanelI>) => {
|
|
25
|
+
let firstChild: ReactNode | null = null
|
|
26
|
+
let otherChildren: ReactNode = children
|
|
27
|
+
|
|
28
|
+
if (Array.isArray(children) && children.length > 0) {
|
|
29
|
+
const header = children[0]
|
|
30
|
+
if (header.props.id === 'item-name-header') {
|
|
31
|
+
firstChild = header
|
|
32
|
+
otherChildren = children.slice(1)
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
28
36
|
return (
|
|
29
37
|
<DrawerContent bg="lightBlue.1">
|
|
30
38
|
<DrawerHeader p="0">
|
|
@@ -36,11 +44,7 @@ export const ItemFormPanel = ({
|
|
|
36
44
|
</DrawerHeader>
|
|
37
45
|
|
|
38
46
|
<DrawerBody p="0" overflowX="hidden" bg="lightBlue.1">
|
|
39
|
-
|
|
40
|
-
id="item-name"
|
|
41
|
-
onSave={onSaveItemName}
|
|
42
|
-
value={itemName}
|
|
43
|
-
/>
|
|
47
|
+
{firstChild}
|
|
44
48
|
<Box position="relative" mb="200px">
|
|
45
49
|
<Overlay
|
|
46
50
|
showOverlay={showOverlay}
|
|
@@ -49,7 +53,7 @@ export const ItemFormPanel = ({
|
|
|
49
53
|
h="inherit"
|
|
50
54
|
zIndex="9"
|
|
51
55
|
/>
|
|
52
|
-
{
|
|
56
|
+
{otherChildren}
|
|
53
57
|
</Box>
|
|
54
58
|
</DrawerBody>
|
|
55
59
|
<FooterDrawer isOpen={!showOverlay}>
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import { Meta } from '@storybook/react'
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
ItemFormPanel,
|
|
4
|
+
ItemFormTabs,
|
|
5
|
+
ItemNameHeader,
|
|
6
|
+
RightPanel,
|
|
7
|
+
} from '@/components'
|
|
3
8
|
import { ItemFormPanelI } from '@/interfaces'
|
|
4
9
|
import { Paint } from '@/assets/images/groups'
|
|
5
10
|
import { action } from '@storybook/addon-actions'
|
|
@@ -22,6 +27,10 @@ export const ItemFormPanelComponent = (args: ItemFormPanelI) => {
|
|
|
22
27
|
return (
|
|
23
28
|
<RightPanel isOpen onClose={() => null}>
|
|
24
29
|
<ItemFormPanel {...args}>
|
|
30
|
+
<ItemNameHeader
|
|
31
|
+
id="item-name-header"
|
|
32
|
+
onSave={action('onSaveItemName')}
|
|
33
|
+
/>
|
|
25
34
|
<ItemFormTabs form={contactFieldsMock} />
|
|
26
35
|
</ItemFormPanel>
|
|
27
36
|
</RightPanel>
|