@homefile/components-v2 2.8.8 → 2.8.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.
@@ -12,6 +12,7 @@ export const ContactsContent = ({ apiError, contacts, menuItems, handleClose, ch
12
12
  });
13
13
  const { windowDimensions: { width }, } = useWindowDimensions();
14
14
  const maxW = width > 413 ? '16rem' : '10rem';
15
+ const isDisabled = Number(itemsSelected.length) === 0;
15
16
  return (_jsxs(DrawerContent, { bg: "lightBlue.1", children: [_jsxs(DrawerHeader, { p: "0", children: [_jsx(PanelHeader, { handleCloseButton: handleClose, icon: Contacts, title: t('contacts.title') }), _jsxs(Flex, { justify: "space-between", pl: "base", my: "base", align: "center", gap: "base", children: [_jsx(SearchInput, { maxW: maxW, value: search, onChange: handleChange }), _jsx(LeftButtonAnimated, { onClick: handleAdd, label: t('contacts.addBtn'), disabled: disabled })] })] }), _jsxs(DrawerBody, { p: "0", overflowX: "hidden", children: [_jsxs(Stack, { spacing: "base", pt: "base", pb: "120px", pr: "base", bg: "lightBlue.2", minHeight: "full", children: [_jsxs(Flex, { gap: "3", pl: "base", children: [_jsx(Checkbox, { onChange: handleSelectAll }), _jsx(Text, { fontFamily: "secondary", fontSize: "xs", children: t('subscription.select') })] }), _jsx(Box, { children: Object.keys(splittedContacts).map((letter, idx) => {
16
17
  const showLetterDivider = idx !== 0;
17
18
  return (_jsxs(Stack, { spacing: "0", children: [showLetterDivider && _jsx(LetterDivider, { letter: letter }), _jsx(Stack, { spacing: "2px", children: splittedContacts[letter].map((contact, idx) => {
@@ -24,11 +25,12 @@ export const ContactsContent = ({ apiError, contacts, menuItems, handleClose, ch
24
25
  }) })] }), children] }), _jsx(DrawerFooter, { p: "0", zIndex: "overlay", children: _jsx(FooterDrawer, { isOpen: true, children: _jsx(FooterButtons, { button1: {
25
26
  buttonStyle: 'primaryFooter',
26
27
  label: t('buttons.share'),
27
- isDisabled: Number(itemsSelected.length) === 0,
28
+ isDisabled,
28
29
  onClick: () => onShareContacts(getContactByIds(itemsSelected)),
29
30
  }, button2: {
30
31
  buttonStyle: 'secondaryFooter',
31
32
  label: t('buttons.delete'),
33
+ isDisabled,
32
34
  onClick: () => onDeleteContacts(itemsSelected),
33
35
  } }) }) })] }));
34
36
  };
@@ -2,5 +2,5 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { DrawerBody, DrawerHeader, DrawerContent, DrawerFooter, Box, } from '@chakra-ui/react';
3
3
  import { PanelHeader, FooterDrawer, ItemNameHeader, ItemFormFooter, Overlay, } from '../../..';
4
4
  export const ItemFormPanel = ({ children, itemName, onClose, onSaveItemName, onSubmitForm, panelIcon, panelTitle, showFooter = false, showOverlay = false, }) => {
5
- return (_jsxs(DrawerContent, { bg: "lightBlue.1", zIndex: 4, children: [_jsx(DrawerHeader, { p: "0", children: _jsx(PanelHeader, { handleCloseButton: onClose, icon: panelIcon, title: panelTitle }) }), _jsxs(DrawerBody, { p: "0", pb: "12", overflowX: "hidden", overflowY: "scroll", bg: "lightBlue.1", children: [_jsx(ItemNameHeader, { id: "item-name", onSave: onSaveItemName, value: itemName }), _jsxs(Box, { position: "relative", children: [_jsx(Overlay, { showOverlay: showOverlay, position: "absolute", w: "inherit", h: "inherit", zIndex: "9" }), children] })] }), _jsx(FooterDrawer, { isOpen: showFooter, children: _jsx(DrawerFooter, { w: "100%", children: _jsx(ItemFormFooter, { onSave: onSubmitForm, onCancel: onClose }) }) })] }));
5
+ return (_jsxs(DrawerContent, { bg: "lightBlue.1", children: [_jsx(DrawerHeader, { p: "0", children: _jsx(PanelHeader, { handleCloseButton: onClose, icon: panelIcon, title: panelTitle }) }), _jsxs(DrawerBody, { p: "0", pb: "12", overflowX: "hidden", bg: "lightBlue.1", children: [_jsx(ItemNameHeader, { id: "item-name", onSave: onSaveItemName, value: itemName }), _jsxs(Box, { position: "relative", children: [_jsx(Overlay, { showOverlay: showOverlay, position: "absolute", w: "inherit", h: "inherit", zIndex: "9" }), children] })] }), _jsx(FooterDrawer, { isOpen: showFooter, children: _jsx(DrawerFooter, { w: "100%", children: _jsx(ItemFormFooter, { onSave: onSubmitForm, onCancel: onClose }) }) })] }));
6
6
  };
@@ -11,7 +11,6 @@ var __rest = (this && this.__rest) || function (s, e) {
11
11
  };
12
12
  import { jsx as _jsx } from "react/jsx-runtime";
13
13
  import { t } from 'i18next';
14
- import { Box } from '@chakra-ui/react';
15
14
  import { DynamicForm, TabsHeader, ItemFormTabImage } from '../../..';
16
15
  import { v4 as uuidv4 } from 'uuid';
17
16
  export const ItemFormTabs = (_a) => {
@@ -20,7 +19,7 @@ export const ItemFormTabs = (_a) => {
20
19
  const tabList = [
21
20
  {
22
21
  label: t('createDocument.tabs.tab1'),
23
- component: (_jsx(Box, { overflow: "scroll", minH: "100vh", children: _jsx(DynamicForm, { form: formWithIds }) })),
22
+ component: _jsx(DynamicForm, { form: formWithIds }),
24
23
  },
25
24
  {
26
25
  label: t('createDocument.tabs.tab2'),
@@ -2,7 +2,10 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
2
2
  import { MenuButton, IconButton, Menu, MenuItem, MenuList, Box, } from '@chakra-ui/react';
3
3
  import { ChevronDown, Overlay } from '..';
4
4
  export const IconMenu = ({ disabled = false, icon = _jsx(ChevronDown, {}), itemForm, menuItems, onClick, variant = 'menuIcon', width = 'fit-content', zIndex = '999', }) => {
5
- return (_jsx(Box, { zIndex: zIndex, children: _jsx(Menu, { isLazy: true, 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: () => handleClick(itemForm), _hover: {
5
+ return (_jsx(Box, { zIndex: zIndex, children: _jsx(Menu, { isLazy: true, 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) => {
6
+ e.stopPropagation();
7
+ handleClick(itemForm);
8
+ }, _hover: {
6
9
  bg: 'lightGreen.1',
7
10
  }, _focus: {
8
11
  bg: 'lightGreen.1',
@@ -1,2 +1,2 @@
1
1
  import { PanelI } from '../../interfaces';
2
- export declare const Panel: ({ children, isOpen, onClose, overlay, placement, size, }: PanelI) => import("react/jsx-runtime").JSX.Element;
2
+ export declare const Panel: ({ children, isOpen, onClose, overlay, placement, size, ...props }: PanelI) => import("react/jsx-runtime").JSX.Element;
@@ -1,9 +1,21 @@
1
+ var __rest = (this && this.__rest) || function (s, e) {
2
+ var t = {};
3
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
+ t[p] = s[p];
5
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
+ t[p[i]] = s[p[i]];
9
+ }
10
+ return t;
11
+ };
1
12
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
13
  import { Drawer, DrawerOverlay } from '@chakra-ui/react';
3
14
  import { useWindowDimensions } from '../../hooks';
4
15
  import { MOBILE_WIDTH } from '../../utils';
5
- export const Panel = ({ children, isOpen, onClose, overlay = true, placement = 'right', size = 'md', }) => {
16
+ export const Panel = (_a) => {
17
+ var { children, isOpen, onClose, overlay = true, placement = 'right', size = 'md' } = _a, props = __rest(_a, ["children", "isOpen", "onClose", "overlay", "placement", "size"]);
6
18
  const { windowDimensions: { width }, } = useWindowDimensions();
7
19
  const isMobile = width < MOBILE_WIDTH;
8
- return (_jsxs(Drawer, { placement: placement, onClose: onClose, isOpen: isOpen, size: isMobile ? 'full' : size, children: [overlay && _jsx(DrawerOverlay, { zIndex: "1399" }), children] }));
20
+ return (_jsxs(Drawer, Object.assign({}, props, { placement: placement, onClose: onClose, isOpen: isOpen, size: isMobile ? 'full' : size, children: [overlay && _jsx(DrawerOverlay, { zIndex: "1399" }), children] })));
9
21
  };
@@ -1,5 +1,6 @@
1
- import { ReactNode } from "react";
2
- export interface LeftPanelI {
1
+ import { DrawerProps } from '@chakra-ui/react';
2
+ import { ReactNode } from 'react';
3
+ export interface LeftPanelI extends DrawerProps {
3
4
  children: ReactNode;
4
5
  isOpen: boolean;
5
6
  onClose: () => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@homefile/components-v2",
3
- "version": "2.8.8",
3
+ "version": "2.8.10",
4
4
  "author": "Homefile",
5
5
  "license": "UNLICENSED",
6
6
  "typings": "dist/index.d.ts",
@@ -66,6 +66,7 @@ export const ContactsContent = ({
66
66
  } = useWindowDimensions()
67
67
 
68
68
  const maxW = width > 413 ? '16rem' : '10rem'
69
+ const isDisabled = Number(itemsSelected.length) === 0
69
70
 
70
71
  return (
71
72
  <DrawerContent bg="lightBlue.1">
@@ -161,12 +162,13 @@ export const ContactsContent = ({
161
162
  button1={{
162
163
  buttonStyle: 'primaryFooter',
163
164
  label: t('buttons.share'),
164
- isDisabled: Number(itemsSelected.length) === 0,
165
+ isDisabled,
165
166
  onClick: () => onShareContacts(getContactByIds(itemsSelected)),
166
167
  }}
167
168
  button2={{
168
169
  buttonStyle: 'secondaryFooter',
169
170
  label: t('buttons.delete'),
171
+ isDisabled,
170
172
  onClick: () => onDeleteContacts(itemsSelected),
171
173
  }}
172
174
  />
@@ -27,7 +27,7 @@ export const ItemFormPanel = ({
27
27
  showOverlay = false,
28
28
  }: PropsWithChildren<ItemFormPanelI>) => {
29
29
  return (
30
- <DrawerContent bg="lightBlue.1" zIndex={4}>
30
+ <DrawerContent bg="lightBlue.1">
31
31
  <DrawerHeader p="0">
32
32
  <PanelHeader
33
33
  handleCloseButton={onClose}
@@ -36,13 +36,7 @@ export const ItemFormPanel = ({
36
36
  />
37
37
  </DrawerHeader>
38
38
 
39
- <DrawerBody
40
- p="0"
41
- pb="12"
42
- overflowX="hidden"
43
- overflowY="scroll"
44
- bg="lightBlue.1"
45
- >
39
+ <DrawerBody p="0" pb="12" overflowX="hidden" bg="lightBlue.1">
46
40
  <ItemNameHeader
47
41
  id="item-name"
48
42
  onSave={onSaveItemName}
@@ -1,5 +1,4 @@
1
1
  import { t } from 'i18next'
2
- import { Box } from '@chakra-ui/react'
3
2
  import { DynamicForm, TabsHeader, ItemFormTabImage } from '@/components'
4
3
  import { ItemFormTabsI } from '@/interfaces'
5
4
  import { v4 as uuidv4 } from 'uuid'
@@ -13,11 +12,7 @@ export const ItemFormTabs = ({ form = [], ...props }: ItemFormTabsI) => {
13
12
  const tabList = [
14
13
  {
15
14
  label: t('createDocument.tabs.tab1'),
16
- component: (
17
- <Box overflow="scroll" minH="100vh">
18
- <DynamicForm form={formWithIds} />
19
- </Box>
20
- ),
15
+ component: <DynamicForm form={formWithIds} />,
21
16
  },
22
17
  {
23
18
  label: t('createDocument.tabs.tab2'),
@@ -41,7 +41,10 @@ export const IconMenu = ({
41
41
  <MenuItem
42
42
  data-testid={label}
43
43
  key={label}
44
- onClick={() => handleClick(itemForm)}
44
+ onClick={(e) => {
45
+ e.stopPropagation()
46
+ handleClick(itemForm)
47
+ }}
45
48
  _hover={{
46
49
  bg: 'lightGreen.1',
47
50
  }}
@@ -10,6 +10,7 @@ export const Panel = ({
10
10
  overlay = true,
11
11
  placement = 'right',
12
12
  size = 'md',
13
+ ...props
13
14
  }: PanelI) => {
14
15
  const {
15
16
  windowDimensions: { width },
@@ -17,6 +18,7 @@ export const Panel = ({
17
18
  const isMobile = width < MOBILE_WIDTH
18
19
  return (
19
20
  <Drawer
21
+ {...props}
20
22
  placement={placement}
21
23
  onClose={onClose}
22
24
  isOpen={isOpen}
@@ -1,9 +1,10 @@
1
- import { ReactNode } from "react"
1
+ import { DrawerProps } from '@chakra-ui/react'
2
+ import { ReactNode } from 'react'
2
3
 
3
- export interface LeftPanelI {
4
+ export interface LeftPanelI extends DrawerProps {
4
5
  children: ReactNode
5
6
  isOpen: boolean
6
7
  onClose: () => void
7
8
  overlay?: boolean
8
9
  size?: string
9
- }
10
+ }